fix ui ordinal
This commit is contained in:
parent
0d2db89f1c
commit
dcbcc951b6
|
@ -190,7 +190,7 @@ export class DescriptionPropertyDefinitionEditorModel implements DescriptionProp
|
|||
let result: Map<string, DescriptionPropertyDefinitionFieldSetEditorModel> = new Map<string, DescriptionPropertyDefinitionFieldSetEditorModel>();
|
||||
|
||||
definitionSection?.fieldSets?.forEach(definitionFieldSet => {
|
||||
const fieldSetResult = this.calculateFieldSetProperties(definitionFieldSet, item, descriptionReferences);
|
||||
const fieldSetResult = this.calculateFieldSetProperties(definitionFieldSet, 0, item, descriptionReferences);
|
||||
if (fieldSetResult != null) {
|
||||
result.set(definitionFieldSet.id, fieldSetResult);
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ export class DescriptionPropertyDefinitionEditorModel implements DescriptionProp
|
|||
return result;
|
||||
}
|
||||
|
||||
public calculateFieldSetProperties(definitionFieldSet: DescriptionTemplateFieldSet, item: DescriptionPropertyDefinition, descriptionReferences: DescriptionReference[]): DescriptionPropertyDefinitionFieldSetEditorModel {
|
||||
public calculateFieldSetProperties(definitionFieldSet: DescriptionTemplateFieldSet, ordinal: number, item: DescriptionPropertyDefinition, descriptionReferences: DescriptionReference[]): DescriptionPropertyDefinitionFieldSetEditorModel {
|
||||
if (definitionFieldSet == null) return null;
|
||||
|
||||
// current saved values
|
||||
|
@ -229,7 +229,7 @@ export class DescriptionPropertyDefinitionEditorModel implements DescriptionProp
|
|||
})
|
||||
fieldSetValue.items = [{
|
||||
fields: fields,
|
||||
ordinal: 0
|
||||
ordinal: ordinal
|
||||
} as DescriptionPropertyDefinitionFieldSetItem]
|
||||
}
|
||||
|
||||
|
@ -744,7 +744,7 @@ export class DescriptionFieldIndicator {
|
|||
break;
|
||||
case DescriptionTemplateFieldType.TAGS:
|
||||
this.type = "textListValue";
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@ import { Guid } from '@common/types/guid';
|
|||
import { AnnotationDialogComponent } from '@app/ui/annotations/annotation-dialog-component/annotation-dialog.component';
|
||||
import { AnnotationEntityType } from '@app/core/common/enum/annotation-entity-type';
|
||||
import { DescriptionFormAnnotationService } from '../../description-form-annotation.service';
|
||||
import { DescriptionPropertyDefinitionFieldSet } from '@app/core/model/description/description';
|
||||
|
||||
@Component({
|
||||
selector: 'app-description-form-field-set',
|
||||
|
@ -88,17 +89,21 @@ export class DescriptionFormFieldSetComponent extends BaseComponent {
|
|||
if (formArray.disabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
const item: DescriptionPropertyDefinitionFieldSetEditorModel = new DescriptionPropertyDefinitionEditorModel(this.validationErrorModel).calculateFieldSetProperties(this.fieldSet, null, null);
|
||||
const properties: DescriptionPropertyDefinitionFieldSet = this.propertiesFormGroup.value;
|
||||
let ordinal = 0;
|
||||
if (properties?.items && properties.items.map(x => x.ordinal).filter(val => !isNaN(val)).length > 0) {
|
||||
ordinal = Math.max(...properties.items.map(x => x.ordinal).filter(val => !isNaN(val))) + 1;
|
||||
}
|
||||
const item: DescriptionPropertyDefinitionFieldSetEditorModel = new DescriptionPropertyDefinitionEditorModel(this.validationErrorModel).calculateFieldSetProperties(this.fieldSet, ordinal, null, null);
|
||||
formArray.push((item.buildForm({ rootPath: `properties.fieldSets[${this.fieldSet.id}].` }).get('items') as UntypedFormArray).at(0));
|
||||
|
||||
this.visibilityRulesService.reloadVisibility();
|
||||
}
|
||||
|
||||
deleteMultiplicityField(fieldSetIndex: number): void {
|
||||
const formArray = this.propertiesFormGroup.get('items') as UntypedFormArray;
|
||||
formArray.removeAt(fieldSetIndex);
|
||||
formArray.controls.forEach((fieldSet, index) => {
|
||||
fieldSet.get('ordinal').setValue(index + 1);
|
||||
fieldSet.get('ordinal').setValue(index);
|
||||
});
|
||||
|
||||
//Reapply validators
|
||||
|
@ -110,6 +115,8 @@ export class DescriptionFormFieldSetComponent extends BaseComponent {
|
|||
}
|
||||
);
|
||||
formArray.markAsDirty();
|
||||
this.visibilityRulesService.reloadVisibility();
|
||||
|
||||
}
|
||||
|
||||
editTableMultiplicityFieldInDialog(fieldSetIndex: number) {
|
||||
|
|
|
@ -127,8 +127,8 @@
|
|||
</ng-container>
|
||||
<div *ngSwitchCase="descriptionTemplateFieldTypeEnum.BOOLEAN_DECISION" class="col-12">
|
||||
<mat-radio-group [formControl]="propertiesFormGroup?.get(field.id).get('textValue')" [required]="isRequired">
|
||||
<mat-radio-button class="radio-button-item" name="{{propertiesFormGroup?.get(field.id).value}}" value="true">{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.ACTIONS.YES" | translate }}</mat-radio-button>
|
||||
<mat-radio-button class="radio-button-item" name="{{propertiesFormGroup?.get(field.id).value}}" value="false">{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.ACTIONS.NO" | translate }}</mat-radio-button>
|
||||
<mat-radio-button class="radio-button-item" value="true">{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.ACTIONS.YES" | translate }}</mat-radio-button>
|
||||
<mat-radio-button class="radio-button-item" value="false">{{ "TYPES.DATASET-PROFILE-COMBO-BOX-TYPE.ACTIONS.NO" | translate }}</mat-radio-button>
|
||||
<mat-error *ngIf="propertiesFormGroup?.get(field.id).get('textValue').hasError('backendError')">{{propertiesFormGroup?.get(field.id).get('textValue').getError('backendError').message}}</mat-error>
|
||||
</mat-radio-group>
|
||||
<small class="text-danger d-block" *ngIf="propertiesFormGroup?.get(field.id).get('textValue').hasError('required') && propertiesFormGroup?.get(field.id).get('textValue').touched">{{'GENERAL.VALIDATION.REQUIRED' | translate}}
|
||||
|
|
Loading…
Reference in New Issue