fix model issue

This commit is contained in:
Niels Lyngsø
2024-02-24 21:46:39 +01:00
parent 53e19dd22c
commit 709c1dcb5a

View File

@@ -35,7 +35,6 @@ export class UmbPropertyEditorUIBlockGridTypeConfigurationElement
extends UmbLitElement
implements UmbPropertyEditorUiElement
{
#model: Array<MappedGroupWithBlockTypes> = [];
#sorter = new UmbSorterController<MappedGroupWithBlockTypes, HTMLElement>(this, {
getUniqueOfElement: (element) => element.getAttribute('data-umb-group-key'),
getUniqueOfModel: (modelEntry) => modelEntry.key!,
@@ -44,12 +43,11 @@ export class UmbPropertyEditorUIBlockGridTypeConfigurationElement
containerSelector: '#groups',
onChange: ({ model }) => {
this._groupsWithBlockTypes = model;
this.#model = model;
},
onEnd: () => {
this.#datasetContext?.setPropertyValue(
'blockGroups',
this.#model.map((group) => ({ key: group.key, name: group.name })),
this._groupsWithBlockTypes.map((group) => ({ key: group.key, name: group.name })),
);
},
});
@@ -136,10 +134,10 @@ export class UmbPropertyEditorUIBlockGridTypeConfigurationElement
this.dispatchEvent(new UmbPropertyValueChangeEvent());
}
#onCreate(e: CustomEvent, groupKey: string | null) {
#onCreate(e: CustomEvent, groupKey?: string) {
const selectedElementType = e.detail.contentElementTypeKey;
if (selectedElementType) {
this.#blockTypeWorkspaceModalRegistration?.open({}, 'create/' + selectedElementType + '/' + groupKey);
this.#blockTypeWorkspaceModalRegistration?.open({}, 'create/' + selectedElementType + '/' + (groupKey ?? null));
}
}