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 364ecf3775..06e41c4176 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 @@ -77,8 +77,8 @@ describe('UmbSelectionManager', () => { expect(manager).to.have.property('clearSelection').that.is.a('function'); }); - it('has a setFilter method', () => { - expect(manager).to.have.property('setFilter').that.is.a('function'); + it('has a setDisallow method', () => { + expect(manager).to.have.property('setDisallow').that.is.a('function'); }); }); }); @@ -155,8 +155,8 @@ describe('UmbSelectionManager', () => { expect(manager.getSelection()).to.deep.equal([]); }); - it('can not select an item if it does not pass the filter', () => { - manager.setFilter((item) => item !== '2'); + it('can not select an item if it does not pass the disallow function', () => { + manager.setDisallow((item) => item !== '2'); manager.select('2'); expect(manager.getSelection()).to.deep.equal([]); 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 e3b686c941..34d45a2e97 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; + #disallow = (unique: ValueType) => true; constructor(host: UmbControllerHost) { super(host); @@ -112,7 +112,7 @@ export class UmbSelectionManager boolean): void { - this.#selectionFilter = filter; + public setDisallow(compareFn: (unique: ValueType) => boolean): void { + this.#disallow = 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 1d1042a69f..7c2360419d 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.setFilter((unique) => { + this.#selectionManager.setDisallow((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 b5c6b5e86b..dd9d5ab6b3 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.setFilter((unique) => { + this.#selectionManager.setDisallow((unique) => { const option = this.variantLanguageOptions.find((o) => o.unique === unique); return option ? this.pickableFilter!(option) : true; });