ColorPicker: Fixed bug with initial value

Added event dispatch for sorting change.
This commit is contained in:
leekelleher
2024-02-21 12:12:09 +00:00
parent a245f40762
commit fd6d04297f
2 changed files with 6 additions and 2 deletions

View File

@@ -39,6 +39,7 @@ export class UmbMultipleColorPickerInputElement extends FormControlMixin(UmbLitE
const oldValue = this._items;
this._items = model;
this.requestUpdate('_items', oldValue);
this.dispatchEvent(new UmbChangeEvent());
},
});

View File

@@ -21,7 +21,10 @@ export class UmbPropertyEditorUIColorSwatchesEditorElement extends UmbLitElement
@property({ attribute: false })
public set config(config: UmbPropertyEditorConfigCollection | undefined) {
this._showLabels = config?.getValueByAlias('useLabel') ?? this.#defaultShowLabels;
this.value = config?.getValueByAlias('items') ?? [];
const items = config?.getValueByAlias('items') as typeof this.value;
if (items) {
this.value = items;
}
}
#onChange(event: CustomEvent) {
@@ -32,7 +35,7 @@ export class UmbPropertyEditorUIColorSwatchesEditorElement extends UmbLitElement
render() {
return html`<umb-multiple-color-picker-input
?showLabels=${this._showLabels}
.items="${this.value ?? []}"
.items="${this.value}"
@change=${this.#onChange}></umb-multiple-color-picker-input>`;
}
}