UI: Refactoring
This commit is contained in:
parent
e74d6f4534
commit
eb66fd30cc
@ -56,11 +56,6 @@ import { coerceBoolean } from '@shared/decorators/coercion';
|
|||||||
provide: NG_VALUE_ACCESSOR,
|
provide: NG_VALUE_ACCESSOR,
|
||||||
useExisting: forwardRef(() => EntityListComponent),
|
useExisting: forwardRef(() => EntityListComponent),
|
||||||
multi: true
|
multi: true
|
||||||
},
|
|
||||||
{
|
|
||||||
provide: NG_VALIDATORS,
|
|
||||||
useExisting: forwardRef(() => EntityListComponent),
|
|
||||||
multi: true
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
@ -194,7 +189,8 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV
|
|||||||
(entities) => {
|
(entities) => {
|
||||||
this.entities = entities;
|
this.entities = entities;
|
||||||
this.entityListFormGroup.get('entities').setValue(this.entities);
|
this.entityListFormGroup.get('entities').setValue(this.entities);
|
||||||
if (this.syncedIdListPropagator) {
|
if (this.syncedIdListPropagator && this.modelValue.length !== entities.length) {
|
||||||
|
this.modelValue = entities.map(entity => entity.id.id);
|
||||||
this.propagateChange(this.modelValue);
|
this.propagateChange(this.modelValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -207,12 +203,6 @@ export class EntityListComponent implements ControlValueAccessor, OnInit, AfterV
|
|||||||
this.dirty = true;
|
this.dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
validate(): ValidationErrors | null {
|
|
||||||
return this.entityListFormGroup.valid ? null : {
|
|
||||||
entities: {valid: false}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private reset() {
|
private reset() {
|
||||||
this.entities = [];
|
this.entities = [];
|
||||||
this.entityListFormGroup.get('entities').setValue(this.entities);
|
this.entityListFormGroup.get('entities').setValue(this.entities);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user