checkbox list move

This commit is contained in:
Niels Lyngsø
2024-01-24 13:10:36 +01:00
parent c6294435b7
commit a625de06eb
7 changed files with 9 additions and 5 deletions

View File

@@ -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';

View File

@@ -0,0 +1 @@
export * from './input-checkbox-list/index.js';

View File

@@ -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<string> = [];
@@ -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) {

View File

@@ -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';

View File

@@ -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';