diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/collection-view/config/layout-configuration/property-editor-ui-collection-view-layout-configuration.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/collection-view/config/layout-configuration/property-editor-ui-collection-view-layout-configuration.element.ts index 5784dc630c..d59831a0a2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/collection-view/config/layout-configuration/property-editor-ui-collection-view-layout-configuration.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/collection-view/config/layout-configuration/property-editor-ui-collection-view-layout-configuration.element.ts @@ -1,6 +1,10 @@ import { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry'; import { html, customElement, property, state, repeat, css, ifDefined } from '@umbraco-cms/backoffice/external/lit'; -import { UmbPropertyEditorConfigCollection } from '@umbraco-cms/backoffice/property-editor'; +import { UUIBooleanInputEvent, UUIInputEvent } from '@umbraco-cms/backoffice/external/uui'; +import { + UmbPropertyEditorConfigCollection, + UmbPropertyValueChangeEvent, +} from '@umbraco-cms/backoffice/property-editor'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; @@ -27,14 +31,36 @@ export class UmbPropertyEditorUICollectionViewLayoutConfigurationElement public config?: UmbPropertyEditorConfigCollection; #onAdd() { - this.value = [...this.value, {}]; - console.log(this.value); + this.value = [...this.value, { isSystem: false, icon: 'icon-stop', selected: true }]; + this.dispatchEvent(new UmbPropertyValueChangeEvent()); } - #onRemove(index: number) { + #onRemove(unique: number) { const values = [...this.value]; - values.splice(index, 1); + values.splice(unique, 1); this.value = values; + this.dispatchEvent(new UmbPropertyValueChangeEvent()); + } + + #onChangePath(e: UUIInputEvent, index: number) { + const values = [...this.value]; + values[index] = { ...values[index], path: e.target.value as string }; + this.value = values; + this.dispatchEvent(new UmbPropertyValueChangeEvent()); + } + + #onChangeName(e: UUIInputEvent, index: number) { + const values = [...this.value]; + values[index] = { ...values[index], name: e.target.value as string }; + this.value = values; + this.dispatchEvent(new UmbPropertyValueChangeEvent()); + } + + #onChangeSelected(e: UUIBooleanInputEvent, index: number) { + const values = [...this.value]; + values[index] = { ...values[index], selected: e.target.checked }; + this.value = values; + this.dispatchEvent(new UmbPropertyValueChangeEvent()); } render() { @@ -63,7 +89,11 @@ export class UmbPropertyEditorUICollectionViewLayoutConfigurationElement ${index} ${ifDefined(layout.name)} (system field) - `; + this.#onChangeSelected(e, index)}> + `; } renderCustomFieldRow(layout: LayoutConfig, index: number) { @@ -71,8 +101,16 @@ export class UmbPropertyEditorUICollectionViewLayoutConfigurationElement ${index} - - + this.#onChangeName(e, index)}> + this.#onChangePath(e, index)}>