small refactor

This commit is contained in:
Niels Lyngsø
2024-10-11 16:22:59 +02:00
parent a5df883776
commit 1f56d3c263
2 changed files with 10 additions and 2 deletions

View File

@@ -21,6 +21,9 @@ export class UmbDocumentScheduleModalElement extends UmbModalBaseElement<
@state()
_selection: UmbDocumentScheduleModalValue['selection'] = [];
@state()
_isAllSelected?: boolean;
constructor() {
super();
this.observe(
@@ -29,6 +32,7 @@ export class UmbDocumentScheduleModalElement extends UmbModalBaseElement<
this._selection = selection.map((unique) => {
return { unique, schedule: {} };
});
this._isAllSelected = this.#isAllSelected();
},
'_selection',
);
@@ -132,7 +136,7 @@ export class UmbDocumentScheduleModalElement extends UmbModalBaseElement<
<uui-checkbox
@change=${this.#onSelectAllChange}
label=${this.localize.term('general_selectAll')}
.checked=${this.#isAllSelected()}></uui-checkbox>
.checked=${this._isAllSelected}></uui-checkbox>
${repeat(
this._options,

View File

@@ -28,6 +28,7 @@ export class UmbDocumentVariantLanguagePickerElement extends UmbLitElement {
this.selectionManager.selection,
(selection) => {
this._selection = selection;
this._isAllSelected = this.#isAllSelected();
},
'_selectionManager',
);
@@ -39,6 +40,9 @@ export class UmbDocumentVariantLanguagePickerElement extends UmbLitElement {
@state()
_selection: Array<string> = [];
@state()
_isAllSelected?: boolean;
/**
* A filter function that determines if an item is pickableFilter or not.
* @memberof UmbDocumentVariantLanguagePickerElement
@@ -96,7 +100,7 @@ export class UmbDocumentVariantLanguagePickerElement extends UmbLitElement {
<uui-checkbox
@change=${this.#onSelectAllChange}
label=${this.localize.term('general_selectAll')}
.checked=${this.#isAllSelected()}></uui-checkbox>
.checked=${this._isAllSelected}></uui-checkbox>
${repeat(
this.variantLanguageOptions,
(option) => option.unique,