update method name

This commit is contained in:
Mads Rasmussen
2024-09-17 12:43:37 +02:00
parent 410285aa93
commit e4bbbe0f81
4 changed files with 6 additions and 6 deletions

View File

@@ -77,8 +77,8 @@ describe('UmbSelectionManager', () => {
expect(manager).to.have.property('clearSelection').that.is.a('function');
});
it('has a setAllow method', () => {
expect(manager).to.have.property('setAllow').that.is.a('function');
it('has a setAllowLimitation method', () => {
expect(manager).to.have.property('setAllowLimitation').that.is.a('function');
});
});
});
@@ -156,7 +156,7 @@ describe('UmbSelectionManager', () => {
});
it('can not select an item if it does not pass the allow function', () => {
manager.setAllow((item) => item !== '2');
manager.setAllowLimitation((item) => item !== '2');
expect(() => manager.select('2')).to.throw();
expect(manager.getSelection()).to.deep.equal([]);

View File

@@ -158,7 +158,7 @@ export class UmbSelectionManager<ValueType extends string | null = string | null
* @param compareFn A function that determines if an item is selectable or not.
* @memberof UmbSelectionManager
*/
public setAllow(compareFn: (unique: ValueType) => boolean): void {
public setAllowLimitation(compareFn: (unique: ValueType) => boolean): void {
this.#allow = compareFn;
}
}

View File

@@ -44,7 +44,7 @@ export class UmbDocumentScheduleModalElement extends UmbModalBaseElement<
const pickableFilter = this.data?.pickableFilter;
if (pickableFilter) {
this.#selectionManager.setAllow((unique) => {
this.#selectionManager.setAllowLimitation((unique) => {
const option = this.data?.options.find((o) => o.unique === unique);
return option ? pickableFilter(option) : true;
});

View File

@@ -50,7 +50,7 @@ export class UmbDocumentVariantLanguagePickerElement extends UmbLitElement {
super.updated(_changedProperties);
if (this.selectionManager && this.pickableFilter) {
this.#selectionManager.setAllow((unique) => {
this.#selectionManager.setAllowLimitation((unique) => {
const option = this.variantLanguageOptions.find((o) => o.unique === unique);
return option ? this.pickableFilter!(option) : true;
});