mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-07 10:04:11 +00:00
hide hints for repeated models of the same field, fix typo
This commit is contained in:
@@ -41,7 +41,6 @@ export abstract class FieldParser {
|
|||||||
&& (this.configData.input.type !== 'tag')
|
&& (this.configData.input.type !== 'tag')
|
||||||
&& (this.configData.input.type !== 'group')
|
&& (this.configData.input.type !== 'group')
|
||||||
) {
|
) {
|
||||||
let hideHints = false;
|
|
||||||
let arrayCounter = 0;
|
let arrayCounter = 0;
|
||||||
let fieldArrayCounter = 0;
|
let fieldArrayCounter = 0;
|
||||||
|
|
||||||
@@ -53,33 +52,35 @@ export abstract class FieldParser {
|
|||||||
required: isNotEmpty(this.configData.mandatory),
|
required: isNotEmpty(this.configData.mandatory),
|
||||||
groupFactory: () => {
|
groupFactory: () => {
|
||||||
let model;
|
let model;
|
||||||
|
let isFirstModelInArray = true;
|
||||||
if ((arrayCounter === 0)) {
|
if ((arrayCounter === 0)) {
|
||||||
model = this.modelFactory();
|
model = this.modelFactory();
|
||||||
arrayCounter++;
|
arrayCounter++;
|
||||||
} else {
|
} else {
|
||||||
const fieldArrayOfValueLenght = this.getInitValueCount(arrayCounter - 1);
|
const fieldArrayOfValueLength = this.getInitValueCount(arrayCounter - 1);
|
||||||
let fieldValue = null;
|
let fieldValue = null;
|
||||||
if (fieldArrayOfValueLenght > 0) {
|
if (fieldArrayOfValueLength > 0) {
|
||||||
if (fieldArrayCounter === 0) {
|
if (fieldArrayCounter === 0) {
|
||||||
fieldValue = '';
|
fieldValue = '';
|
||||||
} else {
|
} else {
|
||||||
fieldValue = this.getInitFieldValue(arrayCounter - 1, fieldArrayCounter - 1);
|
fieldValue = this.getInitFieldValue(arrayCounter - 1, fieldArrayCounter - 1);
|
||||||
|
isFirstModelInArray = false;
|
||||||
}
|
}
|
||||||
fieldArrayCounter++;
|
fieldArrayCounter++;
|
||||||
if (fieldArrayCounter === fieldArrayOfValueLenght + 1) {
|
if (fieldArrayCounter === fieldArrayOfValueLength + 1) {
|
||||||
fieldArrayCounter = 0;
|
fieldArrayCounter = 0;
|
||||||
arrayCounter++;
|
arrayCounter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model = this.modelFactory(fieldValue, false);
|
model = this.modelFactory(fieldValue, false);
|
||||||
|
if (!isFirstModelInArray) {
|
||||||
|
model.hint = undefined;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
setLayout(model, 'element', 'host', 'col');
|
setLayout(model, 'element', 'host', 'col');
|
||||||
if (model.hasLanguages) {
|
if (model.hasLanguages) {
|
||||||
setLayout(model, 'grid', 'control', 'col');
|
setLayout(model, 'grid', 'control', 'col');
|
||||||
}
|
}
|
||||||
if (hideHints) {
|
|
||||||
model.hint = undefined;
|
|
||||||
}
|
|
||||||
return [model];
|
return [model];
|
||||||
}
|
}
|
||||||
} as DynamicRowArrayModelConfig;
|
} as DynamicRowArrayModelConfig;
|
||||||
|
Reference in New Issue
Block a user