From a625de06ebe2f55dad9a47747664c9da98ed5dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Wed, 24 Jan 2024 13:10:36 +0100 Subject: [PATCH] checkbox list move --- .../src/packages/core/components/index.ts | 2 +- .../packages/core/property-editor/uis/checkbox-list/index.ts | 1 + .../uis/checkbox-list}/input-checkbox-list/index.ts | 0 .../input-checkbox-list/input-checkbox-list.element.ts | 5 +++-- .../input-checkbox-list/input-checkbox-list.stories.ts | 0 .../property-editor-ui-checkbox-list.element.ts | 4 ++-- .../src/packages/core/property-editor/uis/index.ts | 2 ++ 7 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/index.ts rename src/Umbraco.Web.UI.Client/src/packages/core/{components => property-editor/uis/checkbox-list}/input-checkbox-list/index.ts (100%) rename src/Umbraco.Web.UI.Client/src/packages/core/{components => property-editor/uis/checkbox-list}/input-checkbox-list/input-checkbox-list.element.ts (93%) rename src/Umbraco.Web.UI.Client/src/packages/core/{components => property-editor/uis/checkbox-list}/input-checkbox-list/input-checkbox-list.stories.ts (100%) create mode 100644 src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/index.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/components/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/components/index.ts index b1939d8726..50727337dc 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/components/index.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/components/index.ts @@ -11,7 +11,7 @@ export * from './extension-slot/index.js'; export * from './footer-layout/index.js'; export * from './header-app/index.js'; export * from './history/index.js'; -export * from './input-checkbox-list/index.js'; +export * from '../property-editor/uis/checkbox-list/input-checkbox-list/index.js'; export * from './input-color/index.js'; export * from './input-date/index.js'; export * from './input-dropdown/index.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/index.ts new file mode 100644 index 0000000000..03e917dc11 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/index.ts @@ -0,0 +1 @@ +export * from './input-checkbox-list/index.js'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/components/input-checkbox-list/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/input-checkbox-list/index.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/packages/core/components/input-checkbox-list/index.ts rename to src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/input-checkbox-list/index.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/components/input-checkbox-list/input-checkbox-list.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/input-checkbox-list/input-checkbox-list.element.ts similarity index 93% rename from src/Umbraco.Web.UI.Client/src/packages/core/components/input-checkbox-list/input-checkbox-list.element.ts rename to src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/input-checkbox-list/input-checkbox-list.element.ts index 2813975c2b..1b3e75b0a2 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/components/input-checkbox-list/input-checkbox-list.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/input-checkbox-list/input-checkbox-list.element.ts @@ -1,3 +1,4 @@ +import { UmbChangeEvent } from '@umbraco-cms/backoffice/event'; import { css, html, nothing, repeat, customElement, property } from '@umbraco-cms/backoffice/external/lit'; import { FormControlMixin, UUIBooleanInputEvent } from '@umbraco-cms/backoffice/external/uui'; import { UmbLitElement } from '@umbraco-cms/internal/lit-element'; @@ -8,7 +9,7 @@ export class UmbInputCheckboxListElement extends FormControlMixin(UmbLitElement) * List of items. */ // TODO: Could this use a type that we export to ensure TS failure, or hook this up with a type coming from backend? - @property() + @property({ attribute: false }) public list: Array<{ key: string; checked: boolean; value: string }> = []; #selected: Array = []; @@ -36,7 +37,7 @@ export class UmbInputCheckboxListElement extends FormControlMixin(UmbLitElement) if (e.target.checked) this.selected = [...this.selected, e.target.value]; else this.#removeFromSelection(this.selected.findIndex((key) => e.target.value === key)); - this.dispatchEvent(new CustomEvent('change', { bubbles: true, composed: true })); + this.dispatchEvent(new UmbChangeEvent()); } #removeFromSelection(index: number) { diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/components/input-checkbox-list/input-checkbox-list.stories.ts b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/input-checkbox-list/input-checkbox-list.stories.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/packages/core/components/input-checkbox-list/input-checkbox-list.stories.ts rename to src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/input-checkbox-list/input-checkbox-list.stories.ts diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/property-editor-ui-checkbox-list.element.ts b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/property-editor-ui-checkbox-list.element.ts index a58aca4a74..25a69ae6d9 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/property-editor-ui-checkbox-list.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/checkbox-list/property-editor-ui-checkbox-list.element.ts @@ -1,5 +1,5 @@ -import type { UmbInputCheckboxListElement } from '../../../components/input-checkbox-list/input-checkbox-list.element.js'; -import '../../../components/input-checkbox-list/input-checkbox-list.element.js'; +import type { UmbInputCheckboxListElement } from './input-checkbox-list/input-checkbox-list.element.js'; +import './input-checkbox-list/input-checkbox-list.element.js'; import { html, customElement, property, state } from '@umbraco-cms/backoffice/external/lit'; import { UmbTextStyles } from '@umbraco-cms/backoffice/style'; import { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry'; diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/index.ts b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/index.ts new file mode 100644 index 0000000000..0eef45ef3c --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/packages/core/property-editor/uis/index.ts @@ -0,0 +1,2 @@ +// TODO: Currently we export input-checkbox-list because package-builder uses it, but this should be changed over time, so package builder uses the property editor UI and then this export can be removed. +export * from './checkbox-list/index.js';