diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html index ba44a40f2f..ce76ef20db 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.html @@ -37,7 +37,7 @@ -
+
diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts index d98624f0c5..455b82be5f 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts @@ -227,6 +227,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo } ngOnInit(): void { + console.log(this.model); this.hasRelationLookup = hasValue(this.model.relationship); if (this.hasRelationLookup) { diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/existing-metadata-list-element/existing-metadata-list-element.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/existing-metadata-list-element/existing-metadata-list-element.component.html index 960dd78767..20bfd34689 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/existing-metadata-list-element/existing-metadata-list-element.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/existing-metadata-list-element/existing-metadata-list-element.component.html @@ -1,7 +1,4 @@
  • - diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.html index 247bf20a8c..3c24371957 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.html @@ -1,30 +1,42 @@
    - -
    - - - - - - + [ngClass]="getClass('element', 'control')"> +
    + + + +
    +
    +
    + + + + + + +
    -
    - + + + + + diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.ts index 1843beb448..20a4a6c275 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/array-group/dynamic-form-array.component.ts @@ -69,6 +69,7 @@ export class DsDynamicFormArrayComponent extends DynamicFormArrayComponent imple } ngOnInit(): void { + console.log(this.model); this.submissionObjectService .findById(this.model.submissionId).pipe( getSucceededRemoteData(), diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model.ts index 432446c56c..1a20453248 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/ds-dynamic-row-array-model.ts @@ -4,12 +4,14 @@ export interface DynamicRowArrayModelConfig extends DynamicFormArrayModelConfig notRepeatable: boolean; required: boolean; submissionId: string; + hasRelationship: boolean; } export class DynamicRowArrayModel extends DynamicFormArrayModel { @serializable() notRepeatable = false; @serializable() required = false; @serializable() submissionId: string; + @serializable() hasRelationship: boolean; isRowArray = true; constructor(config: DynamicRowArrayModelConfig, layout?: DynamicFormControlLayout) { @@ -17,5 +19,6 @@ export class DynamicRowArrayModel extends DynamicFormArrayModel { this.notRepeatable = config.notRepeatable; this.required = config.required; this.submissionId = config.submissionId; + this.hasRelationship = config.hasRelationship; } } diff --git a/src/app/shared/form/builder/parsers/field-parser.ts b/src/app/shared/form/builder/parsers/field-parser.ts index 7b83d20e1d..5cacbe962c 100644 --- a/src/app/shared/form/builder/parsers/field-parser.ts +++ b/src/app/shared/form/builder/parsers/field-parser.ts @@ -48,7 +48,8 @@ export abstract class FieldParser { id: uniqueId() + '_array', label: this.configData.label, initialCount: this.getInitArrayIndex() + 1, - notRepeatable: !this.configData.repeatable || hasValue(this.configData.selectableRelationship), + notRepeatable: !this.configData.repeatable, + hasRelationship: isNotEmpty(this.configData.selectableRelationship), required: isNotEmpty(this.configData.mandatory), submissionId: this.submissionId, groupFactory: () => { @@ -79,7 +80,7 @@ export abstract class FieldParser { } } setLayout(model, 'element', 'host', 'col'); - if (model.hasLanguages) { + if (model.hasLanguages|| isNotEmpty(model.relationship)) { setLayout(model, 'grid', 'control', 'col'); } return [model]; @@ -193,7 +194,7 @@ export abstract class FieldParser { } } - protected initModel(id?: string, label = true, setErrors = true) { + protected initModel(id?: string, label = true, setErrors = true, hint = true) { const controlModel = Object.create(null); @@ -218,11 +219,11 @@ export abstract class FieldParser { // Set label this.setLabel(controlModel, label); - + if (hint) { + controlModel.hint = this.configData.hints; + } controlModel.placeholder = this.configData.label; - controlModel.hint = this.configData.hints; - if (this.configData.mandatory && setErrors) { this.markAsRequired(controlModel); } diff --git a/src/app/shared/form/form.component.html b/src/app/shared/form/form.component.html index aebf8bcf67..61649e384d 100644 --- a/src/app/shared/form/form.component.html +++ b/src/app/shared/form/form.component.html @@ -1,62 +1,71 @@
    -
    + - + - + + + +
    +
    + + +
    +
    - -
    -
    - - -
    + +
    +
    + +
    +
    + + +
    + +
    + + + + +
    +
    +
    +
    + + +
    +
    - -
    -
    - -
    -
    - - - - -
    -
    -
    -
    - - -
    -
    -
    - - +
    diff --git a/src/app/shared/mocks/mock-form-models.ts b/src/app/shared/mocks/mock-form-models.ts index 9a6ef13731..a98a950527 100644 --- a/src/app/shared/mocks/mock-form-models.ts +++ b/src/app/shared/mocks/mock-form-models.ts @@ -76,6 +76,7 @@ const rowArrayQualdropConfig = { id: 'row_QUALDROP_GROUP', initialCount: 1, notRepeatable: true, + hasRelationship: false, groupFactory: () => { return [MockQualdropModel]; },