Skip to content

Commit c1d83e1

Browse files
committed
apply filter to input
1 parent 0670c3c commit c1d83e1

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/packages/documents/documents/modals/shared/document-variant-language-picker.element.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
import { UmbDocumentVariantState, type UmbDocumentVariantOptionModel } from '../../types.js';
2-
import { css, customElement, html, nothing, property, repeat, state } from '@umbraco-cms/backoffice/external/lit';
2+
import {
3+
css,
4+
customElement,
5+
html,
6+
nothing,
7+
property,
8+
repeat,
9+
state,
10+
type PropertyValues,
11+
} from '@umbraco-cms/backoffice/external/lit';
312
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
413
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
514
import type { UmbSelectionManager } from '@umbraco-cms/backoffice/utils';
@@ -37,6 +46,17 @@ export class UmbDocumentVariantLanguagePickerElement extends UmbLitElement {
3746
@property({ attribute: false })
3847
public pickableFilter?: (item: UmbDocumentVariantOptionModel) => boolean;
3948

49+
protected override updated(_changedProperties: PropertyValues): void {
50+
super.updated(_changedProperties);
51+
52+
if (this.selectionManager && this.pickableFilter) {
53+
this.#selectionManager.setFilter((unique) => {
54+
const option = this.variantLanguageOptions.find((o) => o.unique === unique);
55+
return option ? this.pickableFilter!(option) : true;
56+
});
57+
}
58+
}
59+
4060
override render() {
4161
return this.variantLanguageOptions.length
4262
? repeat(

0 commit comments

Comments
 (0)