TreePickerSourceTypes: Value need to be a CSV

rather than a `string[]`, as the API is expecting a flat string format.
This commit is contained in:
leekelleher
2024-01-15 14:57:36 +00:00
committed by Jacob Overgaard
parent deaac83257
commit 01c513a5b8

View File

@@ -19,8 +19,17 @@ export class UmbPropertyEditorUITreePickerSourceTypePickerElement
{
#datasetContext?: typeof UMB_PROPERTY_DATASET_CONTEXT.TYPE;
@property({ type: Array })
value?: string[];
@property()
public set value(value: string) {
if (value) {
this.#selectedIds = value.split(',');
} else {
this.#selectedIds = [];
}
}
public get value(): string {
return this.#selectedIds.join(',');
}
@state()
private sourceType: string = 'content';
@@ -76,8 +85,10 @@ export class UmbPropertyEditorUITreePickerSourceTypePickerElement
}
}
#selectedIds: Array<string> = [];
#setValue(value: string[]) {
this.value = value;
this.value = value.join(',');
this.dispatchEvent(new UmbPropertyValueChangeEvent());
}
@@ -101,19 +112,19 @@ export class UmbPropertyEditorUITreePickerSourceTypePickerElement
#renderTypeContent() {
return html`<umb-input-document-type
@change=${this.#onChange}
.selectedIds=${this.value || []}></umb-input-document-type>`;
.selectedIds=${this.#selectedIds}></umb-input-document-type>`;
}
#renderTypeMedia() {
return html`<umb-input-media-type
@change=${this.#onChange}
.selectedIds=${this.value || []}></umb-input-media-type>`;
.selectedIds=${this.#selectedIds}></umb-input-media-type>`;
}
#renderTypeMember() {
return html`<umb-input-member-type
@change=${this.#onChange}
.selectedIds=${this.value || []}></umb-input-member-type>`;
.selectedIds=${this.#selectedIds}></umb-input-member-type>`;
}
static styles = [UmbTextStyles];