mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
fix update of @ng-dynamic-forms libs
This commit is contained in:
@@ -23,6 +23,6 @@ export class DynamicDisabledModel extends DsDynamicInputModel {
|
||||
this.disabled = true;
|
||||
this.hasSelectableMetadata = config.hasSelectableMetadata;
|
||||
|
||||
this.valueUpdates.next(config.value);
|
||||
this.value = config.value;
|
||||
}
|
||||
}
|
||||
|
@@ -89,14 +89,14 @@ export class DynamicConcatModel extends DynamicFormGroupModel {
|
||||
Object.assign(new FormFieldMetadataValueObject(), value, { display: v, value: v }));
|
||||
|
||||
if (values[0].value) {
|
||||
(this.get(0) as DsDynamicInputModel).valueUpdates.next(values[0]);
|
||||
(this.get(0) as DsDynamicInputModel).value = values[0];
|
||||
} else {
|
||||
(this.get(0) as DsDynamicInputModel).valueUpdates.next(undefined);
|
||||
(this.get(0) as DsDynamicInputModel).value = undefined;
|
||||
}
|
||||
if (values[1].value) {
|
||||
(this.get(1) as DsDynamicInputModel).valueUpdates.next(values[1]);
|
||||
(this.get(1) as DsDynamicInputModel).value = values[1];
|
||||
} else {
|
||||
(this.get(1) as DsDynamicInputModel).valueUpdates.next(undefined);
|
||||
(this.get(1) as DsDynamicInputModel).value = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -113,7 +113,7 @@ export abstract class DsDynamicVocabularyComponent extends DynamicFormControlCom
|
||||
* @param updateValue
|
||||
*/
|
||||
dispatchUpdate(updateValue: any) {
|
||||
this.model.valueUpdates.next(updateValue);
|
||||
this.model.value = updateValue;
|
||||
this.change.emit(updateValue);
|
||||
}
|
||||
|
||||
|
@@ -27,7 +27,7 @@ export class DynamicListRadioGroupModel extends DynamicRadioGroupModel<any> {
|
||||
this.vocabularyOptions = config.vocabularyOptions;
|
||||
this.groupLength = config.groupLength || 5;
|
||||
this.repeatable = config.repeatable;
|
||||
this.valueUpdates.next(config.value);
|
||||
this.value = config.value;
|
||||
}
|
||||
|
||||
get hasAuthority(): boolean {
|
||||
|
@@ -99,7 +99,7 @@ export class DsDynamicListComponent extends DynamicFormControlComponent implemen
|
||||
this.model.valueUpdates.next(newValue);
|
||||
}
|
||||
} else {
|
||||
(this.model as DynamicListRadioGroupModel).valueUpdates.next(this.optionsList[target.value]);
|
||||
(this.model as DynamicListRadioGroupModel).value = this.optionsList[target.value];
|
||||
}
|
||||
this.change.emit(event);
|
||||
}
|
||||
|
@@ -21,6 +21,6 @@ export class DynamicLookupModel extends DsDynamicInputModel {
|
||||
this.autoComplete = AUTOCOMPLETE_OFF;
|
||||
this.maxOptions = config.maxOptions || 10;
|
||||
|
||||
this.valueUpdates.next(config.value);
|
||||
this.value = config.value;
|
||||
}
|
||||
}
|
||||
|
@@ -74,7 +74,7 @@ export class DsDynamicRelationGroupComponent extends DynamicFormControlComponent
|
||||
if (!this.model.isEmpty()) {
|
||||
this.formCollapsed = observableOf(true);
|
||||
}
|
||||
this.model.valueUpdates.subscribe((value: any[]) => {
|
||||
this.model.valueChanges.subscribe((value: any[]) => {
|
||||
if ((isNotEmpty(value) && !(value.length === 1 && hasOnlyEmptyProperties(value[0])))) {
|
||||
this.collapseForm();
|
||||
} else {
|
||||
@@ -124,7 +124,7 @@ export class DsDynamicRelationGroupComponent extends DynamicFormControlComponent
|
||||
|
||||
const nextValue = (this.formBuilderService.isInputModel(model) && isNotNull(value) && (typeof value !== 'string')) ?
|
||||
value.value : value;
|
||||
model.valueUpdates.next(nextValue);
|
||||
model.value = nextValue;
|
||||
|
||||
});
|
||||
});
|
||||
@@ -276,7 +276,7 @@ export class DsDynamicRelationGroupComponent extends DynamicFormControlComponent
|
||||
}, []),
|
||||
filter((modelValues: any[]) => this.model.value.length === modelValues.length)
|
||||
).subscribe((modelValue) => {
|
||||
this.model.valueUpdates.next(modelValue);
|
||||
this.model.value = modelValue;
|
||||
this.initChips(modelValue);
|
||||
this.cdr.markForCheck();
|
||||
}));
|
||||
@@ -296,7 +296,7 @@ export class DsDynamicRelationGroupComponent extends DynamicFormControlComponent
|
||||
// Does not emit change if model value is equal to the current value
|
||||
if (!isEqual(items, this.model.value)) {
|
||||
if (!(isEmpty(items) && this.model.isEmpty())) {
|
||||
this.model.valueUpdates.next(items);
|
||||
this.model.value = items;
|
||||
this.change.emit();
|
||||
}
|
||||
}
|
||||
|
@@ -26,7 +26,6 @@ export class DynamicRelationGroupModel extends DsDynamicInputModel {
|
||||
@serializable() relationFields: string[];
|
||||
@serializable() scopeUUID: string;
|
||||
@serializable() submissionScope: string;
|
||||
@serializable() _value: any[];
|
||||
@serializable() readonly type: string = DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP;
|
||||
|
||||
constructor(config: DynamicRelationGroupModelConfig, layout?: DynamicFormControlLayout) {
|
||||
@@ -39,15 +38,15 @@ export class DynamicRelationGroupModel extends DsDynamicInputModel {
|
||||
this.scopeUUID = config.scopeUUID;
|
||||
this.submissionScope = config.submissionScope;
|
||||
const value = config.value || [];
|
||||
this.valueUpdates.next(value);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
get value() {
|
||||
return this._value
|
||||
return this.value
|
||||
}
|
||||
|
||||
set value(value) {
|
||||
this._value = (isEmpty(value)) ? null : value;
|
||||
this.value = (isEmpty(value)) ? null : value;
|
||||
}
|
||||
|
||||
isEmpty() {
|
||||
@@ -56,7 +55,7 @@ export class DynamicRelationGroupModel extends DsDynamicInputModel {
|
||||
}
|
||||
|
||||
getGroupValue(): any[] {
|
||||
if (isEmpty(this._value)) {
|
||||
if (isEmpty(this.value)) {
|
||||
// If items is empty, last element has been removed
|
||||
// so emit an empty value that allows to dispatch
|
||||
// a remove JSON PATCH operation
|
||||
@@ -68,6 +67,6 @@ export class DynamicRelationGroupModel extends DsDynamicInputModel {
|
||||
});
|
||||
return [emptyItem];
|
||||
}
|
||||
return this._value
|
||||
return this.value
|
||||
}
|
||||
}
|
||||
|
@@ -21,7 +21,7 @@ export class DynamicTagModel extends DsDynamicInputModel {
|
||||
this.autoComplete = AUTOCOMPLETE_OFF;
|
||||
this.minChars = config.minChars || 3;
|
||||
const value = config.value || [];
|
||||
this.valueUpdates.next(value);
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -127,11 +127,7 @@ export class SubmissionSectionLicenseComponent extends SectionModelComponent {
|
||||
const model = this.formBuilderService.findById('granted', this.formModel);
|
||||
|
||||
// Retrieve license accepted status
|
||||
if ((this.sectionData.data as WorkspaceitemSectionLicenseObject).granted) {
|
||||
(model as DynamicCheckboxModel).valueUpdates.next(true);
|
||||
} else {
|
||||
(model as DynamicCheckboxModel).valueUpdates.next(false);
|
||||
}
|
||||
(model as DynamicCheckboxModel).value = (this.sectionData.data as WorkspaceitemSectionLicenseObject).granted;
|
||||
|
||||
this.licenseText$ = this.collectionDataService.findById(this.collectionId, followLink('license')).pipe(
|
||||
filter((collectionData: RemoteData<Collection>) => isNotUndefined((collectionData.payload))),
|
||||
@@ -149,7 +145,7 @@ export class SubmissionSectionLicenseComponent extends SectionModelComponent {
|
||||
take(1),
|
||||
filter((isReadOnly) => isReadOnly))
|
||||
.subscribe(() => {
|
||||
model.disabledUpdates.next(true);
|
||||
model.disabled = true;
|
||||
}),
|
||||
|
||||
this.sectionService.getSectionErrors(this.submissionId, this.sectionData.id).pipe(
|
||||
@@ -192,7 +188,7 @@ export class SubmissionSectionLicenseComponent extends SectionModelComponent {
|
||||
*/
|
||||
protected getSectionStatus(): Observable<boolean> {
|
||||
const model = this.formBuilderService.findById('granted', this.formModel);
|
||||
return (model as DynamicCheckboxModel).valueUpdates.pipe(
|
||||
return (model as DynamicCheckboxModel).valueChanges.pipe(
|
||||
map((value) => value === true),
|
||||
startWith((model as DynamicCheckboxModel).value));
|
||||
}
|
||||
|
Reference in New Issue
Block a user