diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/utils/selection-manager/selection.manager.test.ts b/src/Umbraco.Web.UI.Client/src/packages/core/utils/selection-manager/selection.manager.test.ts index 06e41c4176..81630b60bc 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/utils/selection-manager/selection.manager.test.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/utils/selection-manager/selection.manager.test.ts @@ -155,9 +155,9 @@ describe('UmbSelectionManager', () => { expect(manager.getSelection()).to.deep.equal([]); }); - it('can not select an item if it does not pass the disallow function', () => { - manager.setDisallow((item) => item !== '2'); - manager.select('2'); + it('can not select an item if it does not pass the allow function', () => { + manager.setAllow((item) => item !== '2'); + expect(() => manager.select('2')).to.throw(); expect(manager.getSelection()).to.deep.equal([]); manager.select('1'); diff --git a/src/Umbraco.Web.UI.Client/src/packages/core/utils/selection-manager/selection.manager.ts b/src/Umbraco.Web.UI.Client/src/packages/core/utils/selection-manager/selection.manager.ts index 34d45a2e97..58073bdb37 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/core/utils/selection-manager/selection.manager.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/core/utils/selection-manager/selection.manager.ts @@ -19,7 +19,7 @@ export class UmbSelectionManager true; + #allow = (unique: ValueType) => true; constructor(host: UmbControllerHost) { super(host); @@ -112,8 +112,8 @@ export class UmbSelectionManager boolean): void { - this.#disallow = compareFn; + public setAllow(compareFn: (unique: ValueType) => boolean): void { + this.#allow = compareFn; } } diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/modals/schedule-modal/document-schedule-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/modals/schedule-modal/document-schedule-modal.element.ts index 7c2360419d..fbef782e92 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/modals/schedule-modal/document-schedule-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/modals/schedule-modal/document-schedule-modal.element.ts @@ -44,7 +44,7 @@ export class UmbDocumentScheduleModalElement extends UmbModalBaseElement< const pickableFilter = this.data?.pickableFilter; if (pickableFilter) { - this.#selectionManager.setDisallow((unique) => { + this.#selectionManager.setAllow((unique) => { const option = this.data?.options.find((o) => o.unique === unique); return option ? pickableFilter(option) : true; }); diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/modals/shared/document-variant-language-picker.element.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/modals/shared/document-variant-language-picker.element.ts index dd9d5ab6b3..cf5f90efbf 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/modals/shared/document-variant-language-picker.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/modals/shared/document-variant-language-picker.element.ts @@ -50,7 +50,7 @@ export class UmbDocumentVariantLanguagePickerElement extends UmbLitElement { super.updated(_changedProperties); if (this.selectionManager && this.pickableFilter) { - this.#selectionManager.setDisallow((unique) => { + this.#selectionManager.setAllow((unique) => { const option = this.variantLanguageOptions.find((o) => o.unique === unique); return option ? this.pickableFilter!(option) : true; });