diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/components/input-list-base/input-list-base.ts b/src/Umbraco.Web.UI.Client/src/backoffice/components/input-list-base/input-list-base.ts index 905f3f4a35..db4b8c3851 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/components/input-list-base/input-list-base.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/components/input-list-base/input-list-base.ts @@ -5,9 +5,9 @@ import { UmbPickerData } from '../../../core/services/modal/layouts/modal-layout import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; //TODO: These should probably be imported dynamically. -import '../input-section/picker-layout-section.element'; -import '../input-user-group/picker-layout-user-group.element'; -import '../input-user/picker-layout-user.element'; +import '../../../core/services/modal/layouts/picker-section/picker-layout-section.element'; +import '../../../core/services/modal/layouts/picker-user-group/picker-layout-user-group.element'; +import '../../../core/services/modal/layouts/picker-user/picker-layout-user.element'; import { UmbModalService, UmbModalType } from '@umbraco-cms/services'; /** TODO: Make use of UUI FORM Mixin, to make it easily take part of a form. */ diff --git a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/modal-layout-picker-base.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/modal-layout-picker-base.ts index 01ab0fd905..52c53bd22d 100644 --- a/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/modal-layout-picker-base.ts +++ b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/modal-layout-picker-base.ts @@ -6,7 +6,7 @@ export interface UmbPickerData { selection: Array; } -export class UmbPickerLayoutBase extends UmbModalLayoutElement> { +export class UmbModalLayoutPickerBase extends UmbModalLayoutElement> { @state() private _selection: Array = []; @@ -30,10 +30,11 @@ export class UmbPickerLayoutBase extends UmbModalLayoutElem } } + /* TODO: Write test for this select/deselect method. */ protected _handleItemClick(key: selectType) { if (this.data?.multiple) { if (this._isSelected(key)) { - this._selection = this._selection.filter((key) => key !== key); + this._selection = this._selection.filter((selectedKey) => selectedKey !== key); } else { this._selection.push(key); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/components/input-section/picker-layout-section.element.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-section/picker-layout-section.element.ts similarity index 93% rename from src/Umbraco.Web.UI.Client/src/backoffice/components/input-section/picker-layout-section.element.ts rename to src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-section/picker-layout-section.element.ts index afc5b35c2f..12dca4bd09 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/components/input-section/picker-layout-section.element.ts +++ b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-section/picker-layout-section.element.ts @@ -1,14 +1,14 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; import { css, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; -import { UmbPickerLayoutBase } from '../../../core/services/modal/layouts/modal-layout-picker-base'; +import { UmbModalLayoutPickerBase } from '../modal-layout-picker-base'; import { UmbObserverMixin } from '@umbraco-cms/observable-api'; import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; import { umbExtensionsRegistry } from '@umbraco-cms/extensions-registry'; import type { ManifestSection } from '@umbraco-cms/models'; @customElement('umb-picker-layout-section') -export class UmbPickerLayoutSectionElement extends UmbContextConsumerMixin(UmbObserverMixin(UmbPickerLayoutBase)) { +export class UmbPickerLayoutSectionElement extends UmbContextConsumerMixin(UmbObserverMixin(UmbModalLayoutPickerBase)) { static styles = [ UUITextStyles, css` @@ -65,8 +65,6 @@ export class UmbPickerLayoutSectionElement extends UmbContextConsumerMixin(UmbOb }); } - //todo: save section aliasess in array - render() { return html` diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/components/input-section/picker-layout-section.test.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-section/picker-layout-section.test.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/backoffice/components/input-section/picker-layout-section.test.ts rename to src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-section/picker-layout-section.test.ts diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/components/input-user-group/picker-layout-user-group.element.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-user-group/picker-layout-user-group.element.ts similarity index 95% rename from src/Umbraco.Web.UI.Client/src/backoffice/components/input-user-group/picker-layout-user-group.element.ts rename to src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-user-group/picker-layout-user-group.element.ts index e8e922a4e4..32d2b5165e 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/components/input-user-group/picker-layout-user-group.element.ts +++ b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-user-group/picker-layout-user-group.element.ts @@ -1,14 +1,14 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; import { css, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; -import { UmbPickerLayoutBase } from '../../../core/services/modal/layouts/modal-layout-picker-base'; +import { UmbModalLayoutPickerBase } from '../modal-layout-picker-base'; import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; import { UmbObserverMixin } from '@umbraco-cms/observable-api'; import type { UserGroupDetails } from '@umbraco-cms/models'; import { UmbUserGroupStore } from '@umbraco-cms/stores/user/user-group.store'; @customElement('umb-picker-layout-user-group') -export class UmbPickerLayoutUserGroupElement extends UmbContextConsumerMixin(UmbObserverMixin(UmbPickerLayoutBase)) { +export class UmbPickerLayoutUserGroupElement extends UmbContextConsumerMixin(UmbObserverMixin(UmbModalLayoutPickerBase)) { static styles = [ UUITextStyles, css` diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/components/input-user-group/picker-layout-user-group.test.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-user-group/picker-layout-user-group.test.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/backoffice/components/input-user-group/picker-layout-user-group.test.ts rename to src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-user-group/picker-layout-user-group.test.ts diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/components/input-user/picker-layout-user.element.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-user/picker-layout-user.element.ts similarity index 95% rename from src/Umbraco.Web.UI.Client/src/backoffice/components/input-user/picker-layout-user.element.ts rename to src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-user/picker-layout-user.element.ts index 9963051058..c754f3d1ad 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/components/input-user/picker-layout-user.element.ts +++ b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-user/picker-layout-user.element.ts @@ -1,14 +1,14 @@ import { UUITextStyles } from '@umbraco-ui/uui-css'; import { css, html } from 'lit'; import { customElement, state } from 'lit/decorators.js'; -import { UmbPickerLayoutBase } from '../../../core/services/modal/layouts/modal-layout-picker-base'; +import { UmbModalLayoutPickerBase } from '../modal-layout-picker-base'; import type { UserDetails } from '@umbraco-cms/models'; import { UmbContextConsumerMixin } from '@umbraco-cms/context-api'; import { UmbObserverMixin } from '@umbraco-cms/observable-api'; import { UmbUserStore } from '@umbraco-cms/stores/user/user.store'; @customElement('umb-picker-layout-user') -export class UmbPickerLayoutUserElement extends UmbContextConsumerMixin(UmbObserverMixin(UmbPickerLayoutBase)) { +export class UmbPickerLayoutUserElement extends UmbContextConsumerMixin(UmbObserverMixin(UmbModalLayoutPickerBase)) { static styles = [ UUITextStyles, css` diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/components/input-user/picker-layout-user.test.ts b/src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-user/picker-layout-user.test.ts similarity index 100% rename from src/Umbraco.Web.UI.Client/src/backoffice/components/input-user/picker-layout-user.test.ts rename to src/Umbraco.Web.UI.Client/src/core/services/modal/layouts/picker-user/picker-layout-user.test.ts