Skip to content
This repository has been archived by the owner on Oct 10, 2018. It is now read-only.

Fixed schema support issue #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 21 additions & 19 deletions lib/src/form.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,29 +70,31 @@ export class FormComponent implements OnChanges {
private coverProperty(schema: SFSchema) {
const isHorizontal = this.layout === 'horizontal';

Object.keys(schema.properties).forEach(key => {
const p = schema.properties[key];
if (isHorizontal) {
if (schema.span_label_fixed) {
if (!p.span_label_fixed) p.span_label_fixed = schema.span_label_fixed;
if (schema.properties) {
Object.keys(schema.properties).forEach(key => {
const p = schema.properties[key];
if (isHorizontal) {
if (schema.span_label_fixed) {
if (!p.span_label_fixed) p.span_label_fixed = schema.span_label_fixed;
} else {
if (!p.span_label) p.span_label = typeof schema.span_label === 'undefined' ? 5 : schema.span_label;
if (!p.span_control) p.span_control = typeof schema.span_control === 'undefined' ? 19 : schema.span_control;
if (!p.offset_control) p.offset_control = typeof schema.offset_control === 'undefined' ? null : schema.offset_control;
}
} else {
if (!p.span_label) p.span_label = typeof schema.span_label === 'undefined' ? 5 : schema.span_label;
if (!p.span_control) p.span_control = typeof schema.span_control === 'undefined' ? 19 : schema.span_control;
if (!p.offset_control) p.offset_control = typeof schema.offset_control === 'undefined' ? null : schema.offset_control;
p.span_label = null;
p.span_control = null;
p.offset_control = null;
}
} else {
p.span_label = null;
p.span_control = null;
p.offset_control = null;
}

if (p.items && p.type === 'array') {
this.coverProperty(p.items);
}
if (p.items && p.type === 'array') {
this.coverProperty(p.items);
}

if (p.properties && Object.keys(p.properties).length)
this.coverProperty(p);
});
if (p.properties && Object.keys(p.properties).length)
this.coverProperty(p);
});
}
}

private coverButtonProperty(schema: SFSchema) {
Expand Down