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 !== 'group')
|
||||
) {
|
||||
let hideHints = false;
|
||||
let arrayCounter = 0;
|
||||
let fieldArrayCounter = 0;
|
||||
|
||||
@@ -53,33 +52,35 @@ export abstract class FieldParser {
|
||||
required: isNotEmpty(this.configData.mandatory),
|
||||
groupFactory: () => {
|
||||
let model;
|
||||
let isFirstModelInArray = true;
|
||||
if ((arrayCounter === 0)) {
|
||||
model = this.modelFactory();
|
||||
arrayCounter++;
|
||||
} else {
|
||||
const fieldArrayOfValueLenght = this.getInitValueCount(arrayCounter - 1);
|
||||
const fieldArrayOfValueLength = this.getInitValueCount(arrayCounter - 1);
|
||||
let fieldValue = null;
|
||||
if (fieldArrayOfValueLenght > 0) {
|
||||
if (fieldArrayOfValueLength > 0) {
|
||||
if (fieldArrayCounter === 0) {
|
||||
fieldValue = '';
|
||||
} else {
|
||||
fieldValue = this.getInitFieldValue(arrayCounter - 1, fieldArrayCounter - 1);
|
||||
isFirstModelInArray = false;
|
||||
}
|
||||
fieldArrayCounter++;
|
||||
if (fieldArrayCounter === fieldArrayOfValueLenght + 1) {
|
||||
if (fieldArrayCounter === fieldArrayOfValueLength + 1) {
|
||||
fieldArrayCounter = 0;
|
||||
arrayCounter++;
|
||||
}
|
||||
}
|
||||
model = this.modelFactory(fieldValue, false);
|
||||
if (!isFirstModelInArray) {
|
||||
model.hint = undefined;
|
||||
}
|
||||
}
|
||||
setLayout(model, 'element', 'host', 'col');
|
||||
if (model.hasLanguages) {
|
||||
setLayout(model, 'grid', 'control', 'col');
|
||||
}
|
||||
if (hideHints) {
|
||||
model.hint = undefined;
|
||||
}
|
||||
return [model];
|
||||
}
|
||||
} as DynamicRowArrayModelConfig;
|
||||
|
Reference in New Issue
Block a user