make sure to trigger validation system by using super.value

This commit is contained in:
Niels Lyngsø
2025-01-31 20:37:16 +01:00
parent 3157601724
commit 0b7ed5d6f9

View File

@@ -54,10 +54,6 @@ export class UmbPropertyEditorUIBlockListElement
#contentDataPathTranslator?: UmbBlockElementDataValidationPathTranslator;
#settingsDataPathTranslator?: UmbBlockElementDataValidationPathTranslator;
//#catalogueModal: UmbModalRouteRegistrationController<typeof UMB_BLOCK_CATALOGUE_MODAL.DATA, undefined>;
private _value: UmbBlockListValueModel | undefined = undefined;
#lastValue: UmbBlockListValueModel | undefined = undefined;
@property({ attribute: false })
@@ -65,7 +61,7 @@ export class UmbPropertyEditorUIBlockListElement
this.#lastValue = value;
if (!value) {
this._value = undefined;
super.value = undefined;
return;
}
@@ -74,15 +70,15 @@ export class UmbPropertyEditorUIBlockListElement
buildUpValue.contentData ??= [];
buildUpValue.settingsData ??= [];
buildUpValue.expose ??= [];
this._value = buildUpValue as UmbBlockListValueModel;
super.value = buildUpValue as UmbBlockListValueModel;
this.#managerContext.setLayouts(this._value.layout[UMB_BLOCK_LIST_PROPERTY_EDITOR_SCHEMA_ALIAS] ?? []);
this.#managerContext.setContents(this._value.contentData);
this.#managerContext.setSettings(this._value.settingsData);
this.#managerContext.setExposes(this._value.expose);
this.#managerContext.setLayouts(super.value.layout[UMB_BLOCK_LIST_PROPERTY_EDITOR_SCHEMA_ALIAS] ?? []);
this.#managerContext.setContents(super.value.contentData);
this.#managerContext.setSettings(super.value.settingsData);
this.#managerContext.setExposes(super.value.expose);
}
public override get value(): UmbBlockListValueModel | undefined {
return this._value;
return super.value;
}
@state()
@@ -214,10 +210,10 @@ export class UmbPropertyEditorUIBlockListElement
]).pipe(debounceTime(20)),
([layouts, contents, settings, exposes]) => {
if (layouts.length === 0) {
this._value = undefined;
super.value = undefined;
} else {
this._value = {
...this._value,
super.value = {
...super.value,
layout: { [UMB_BLOCK_LIST_PROPERTY_EDITOR_SCHEMA_ALIAS]: layouts },
contentData: contents,
settingsData: settings,
@@ -227,11 +223,11 @@ export class UmbPropertyEditorUIBlockListElement
// If we don't have a value set from the outside or an internal value, we don't want to set the value.
// This is added to prevent the block list from setting an empty value on startup.
if (this.#lastValue === undefined && this._value === undefined) {
if (this.#lastValue === undefined && super.value === undefined) {
return;
}
context.setValue(this._value);
context.setValue(super.value);
},
'motherObserver',
);