@eui/ecl 22.0.0-alpha.30 → 22.0.0-alpha.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/changelog.html +76 -0
- package/docs/components/EclMultiselectComponent.html +88 -605
- package/docs/components/EclMultiselectDropdownComponent.html +204 -2316
- package/docs/components/EclMultiselectInputComponent.html +3 -545
- package/docs/components/EclMultiselectOptionComponent.html +48 -443
- package/docs/components/EclRatingFieldComponent.html +0 -45
- package/docs/components/EclSearchFormComponent.html +4 -447
- package/docs/directives/EclMultiselectOptionDirective.html +21 -286
- package/docs/interfaces/EclMultiselectOption.html +6 -6
- package/docs/js/search/search_index.js +2 -2
- package/docs/json/EclMultiselectComponent.md +6 -6
- package/docs/json/EclMultiselectDropdownComponent.md +1 -6
- package/docs/json/EclMultiselectInputComponent.md +1 -1
- package/docs/json/EclMultiselectOptionComponent.md +2 -1
- package/docs/json/EclMultiselectOptionDirective.md +1 -1
- package/docs/json/documentation.json +834 -1416
- package/docs/llms.txt +33 -95
- package/docs/properties.html +1 -1
- package/fesm2022/eui-ecl-components-ecl-multiselect.mjs +320 -430
- package/fesm2022/eui-ecl-components-ecl-multiselect.mjs.map +1 -1
- package/fesm2022/eui-ecl-components-ecl-rating-field.mjs +4 -6
- package/fesm2022/eui-ecl-components-ecl-rating-field.mjs.map +1 -1
- package/fesm2022/eui-ecl-components-ecl-search-form.mjs +22 -27
- package/fesm2022/eui-ecl-components-ecl-search-form.mjs.map +1 -1
- package/package.json +1 -1
- package/types/eui-ecl-components-ecl-multiselect.d.ts +163 -192
- package/types/eui-ecl-components-ecl-multiselect.d.ts.map +1 -1
- package/types/eui-ecl-components-ecl-rating-field.d.ts.map +1 -1
- package/types/eui-ecl-components-ecl-search-form.d.ts +14 -14
- package/types/eui-ecl-components-ecl-search-form.d.ts.map +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Pipe, input,
|
|
2
|
+
import { Pipe, input, booleanAttribute, output, signal, viewChild, computed, inject, Renderer2, Component, model, HostBinding, ElementRef, viewChildren, effect, untracked, forwardRef, contentChildren, Directive, Injector, ViewContainerRef, IterableDiffers, PLATFORM_ID, afterNextRender, ViewEncapsulation } from '@angular/core';
|
|
3
3
|
import { NG_VALUE_ACCESSOR, NgControl } from '@angular/forms';
|
|
4
|
-
import { Subject
|
|
4
|
+
import { Subject } from 'rxjs';
|
|
5
5
|
import { TranslatePipe } from '@ngx-translate/core';
|
|
6
6
|
import { ECLBaseDirective, EclThemeService, KeyCode } from '@eui/ecl/core';
|
|
7
7
|
import * as i1 from '@eui/ecl/components/ecl-button';
|
|
@@ -10,7 +10,6 @@ import * as i2 from '@eui/ecl/components/ecl-icon';
|
|
|
10
10
|
import { EUI_ECL_ICON } from '@eui/ecl/components/ecl-icon';
|
|
11
11
|
import * as i1$1 from '@eui/ecl/components/ecl-checkbox';
|
|
12
12
|
import { EclCheckboxDirective, EUI_ECL_CHECKBOX } from '@eui/ecl/components/ecl-checkbox';
|
|
13
|
-
import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
14
13
|
import { isPlatformBrowser } from '@angular/common';
|
|
15
14
|
|
|
16
15
|
class BoldTextPipe {
|
|
@@ -77,11 +76,6 @@ class EclMultiselectInputComponent extends ECLBaseDirective {
|
|
|
77
76
|
*/
|
|
78
77
|
this.eclSize = input('m', /* @ts-ignore */
|
|
79
78
|
...(ngDevMode ? [{ debugName: "eclSize" }] : /* istanbul ignore next */ []));
|
|
80
|
-
/**
|
|
81
|
-
* Unique ID for the counter element.
|
|
82
|
-
*/
|
|
83
|
-
this.counterId = signal(crypto.randomUUID(), /* @ts-ignore */
|
|
84
|
-
...(ngDevMode ? [{ debugName: "counterId" }] : /* istanbul ignore next */ []));
|
|
85
79
|
/**
|
|
86
80
|
* Label for the selections counter, read by screen readers.
|
|
87
81
|
*/
|
|
@@ -113,8 +107,8 @@ class EclMultiselectInputComponent extends ECLBaseDirective {
|
|
|
113
107
|
/**
|
|
114
108
|
* Array of currently selected item labels.
|
|
115
109
|
*/
|
|
116
|
-
this.
|
|
117
|
-
...(ngDevMode ? [{ debugName: "
|
|
110
|
+
this.selectedItemsLabels = input([], /* @ts-ignore */
|
|
111
|
+
...(ngDevMode ? [{ debugName: "selectedItemsLabels" }] : /* istanbul ignore next */ []));
|
|
118
112
|
/**
|
|
119
113
|
* Indicates that the dropdown is currently expanded.
|
|
120
114
|
*/
|
|
@@ -130,54 +124,59 @@ class EclMultiselectInputComponent extends ECLBaseDirective {
|
|
|
130
124
|
this.ariaDescribedby = input(undefined, /* @ts-ignore */
|
|
131
125
|
...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : /* istanbul ignore next */ []));
|
|
132
126
|
/**
|
|
133
|
-
*
|
|
127
|
+
* Event emitted when the input is clicked.
|
|
134
128
|
*/
|
|
135
|
-
this.
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
129
|
+
this.mainInputClick = output();
|
|
130
|
+
/**
|
|
131
|
+
* Event emitted when a key is pressed on the input.
|
|
132
|
+
*/
|
|
133
|
+
this.mainInputKeydown = output();
|
|
134
|
+
/**
|
|
135
|
+
* Unique ID for the counter element.
|
|
136
|
+
*/
|
|
137
|
+
this.counterId = signal(crypto.randomUUID(), /* @ts-ignore */
|
|
138
|
+
...(ngDevMode ? [{ debugName: "counterId" }] : /* istanbul ignore next */ []));
|
|
141
139
|
/**
|
|
142
140
|
* Reference to the internal input element.
|
|
143
141
|
*/
|
|
144
142
|
this.inputMultiselect = viewChild('inputMultiselect', /* @ts-ignore */
|
|
145
143
|
...(ngDevMode ? [{ debugName: "inputMultiselect" }] : /* istanbul ignore next */ []));
|
|
146
144
|
/**
|
|
147
|
-
*
|
|
148
|
-
*/
|
|
149
|
-
this.mainInputClick = output();
|
|
150
|
-
/**
|
|
151
|
-
* Event emitted when a key is pressed on the input.
|
|
145
|
+
* Computed ARIA describedby combining the input value with the counter ID.
|
|
152
146
|
*/
|
|
153
|
-
this.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
147
|
+
this.ariaDescribedbyFull = computed(() => {
|
|
148
|
+
const describedby = this.ariaDescribedby();
|
|
149
|
+
const counter = this.counterId();
|
|
150
|
+
return [describedby, counter].filter(Boolean).join(' ') || undefined;
|
|
151
|
+
}, /* @ts-ignore */
|
|
152
|
+
...(ngDevMode ? [{ debugName: "ariaDescribedbyFull" }] : /* istanbul ignore next */ []));
|
|
158
153
|
/**
|
|
159
154
|
* Returns the label text shown inside the button.
|
|
160
155
|
*/
|
|
161
156
|
this.buttonText = computed(() => {
|
|
162
|
-
const items = this.
|
|
157
|
+
const items = this.selectedItemsLabels();
|
|
163
158
|
return items.length === 0 ? this.inputPlaceholder() : items.join(',');
|
|
164
159
|
}, /* @ts-ignore */
|
|
165
160
|
...(ngDevMode ? [{ debugName: "buttonText" }] : /* istanbul ignore next */ []));
|
|
166
161
|
/**
|
|
167
162
|
* Returns the count of selected items.
|
|
168
163
|
*/
|
|
169
|
-
this.selectedItemsCount = computed(() => this.
|
|
164
|
+
this.selectedItemsCount = computed(() => this.selectedItemsLabels().length, /* @ts-ignore */
|
|
170
165
|
...(ngDevMode ? [{ debugName: "selectedItemsCount" }] : /* istanbul ignore next */ []));
|
|
171
166
|
/**
|
|
172
167
|
* Displays a count badge when items are selected.
|
|
173
168
|
*/
|
|
174
|
-
this.isShowCounter = computed(() => this.
|
|
169
|
+
this.isShowCounter = computed(() => this.selectedItemsLabels().length > 0, /* @ts-ignore */
|
|
175
170
|
...(ngDevMode ? [{ debugName: "isShowCounter" }] : /* istanbul ignore next */ []));
|
|
176
171
|
/**
|
|
177
172
|
* Indicates that the dropdown is expanded (active).
|
|
178
173
|
*/
|
|
179
174
|
this.isActive = computed(() => this.isDropdownExpanded(), /* @ts-ignore */
|
|
180
175
|
...(ngDevMode ? [{ debugName: "isActive" }] : /* istanbul ignore next */ []));
|
|
176
|
+
this.ICON_SIZE_FOR_EC_THEME_ON = 'xs';
|
|
177
|
+
this.ICON_SIZE_FOR_EU_THEME_ON = 's';
|
|
178
|
+
this.eclThemeService = inject(EclThemeService);
|
|
179
|
+
this.renderer = inject(Renderer2);
|
|
181
180
|
}
|
|
182
181
|
/**
|
|
183
182
|
* CSS classes for the component, including size and inherited classes.
|
|
@@ -199,6 +198,12 @@ class EclMultiselectInputComponent extends ECLBaseDirective {
|
|
|
199
198
|
return this.ICON_SIZE_FOR_EU_THEME_ON;
|
|
200
199
|
}
|
|
201
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* Focuses the multiselect input element.
|
|
203
|
+
*/
|
|
204
|
+
onFocus() {
|
|
205
|
+
this.renderer.selectRootElement(this.inputMultiselect().nativeElement, true).focus();
|
|
206
|
+
}
|
|
202
207
|
/**
|
|
203
208
|
* Handles click on the input container. Emits custom event with original DOM event.
|
|
204
209
|
*/
|
|
@@ -223,25 +228,17 @@ class EclMultiselectInputComponent extends ECLBaseDirective {
|
|
|
223
228
|
}
|
|
224
229
|
}
|
|
225
230
|
}
|
|
226
|
-
/**
|
|
227
|
-
* Focuses the multiselect input element.
|
|
228
|
-
*/
|
|
229
|
-
onFocus() {
|
|
230
|
-
this.renderer.selectRootElement(this.inputMultiselect().nativeElement, true).focus();
|
|
231
|
-
}
|
|
232
231
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: EclMultiselectInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
233
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.2", type: EclMultiselectInputComponent, isStandalone: true, selector: "div[eclMultiselectInput]", inputs: { eclSize: { classPropertyName: "eclSize", publicName: "eclSize", isSignal: true, isRequired: false, transformFunction: null }, counterLabel: { classPropertyName: "counterLabel", publicName: "counterLabel", isSignal: true, isRequired: false, transformFunction: null }, toggleId: { classPropertyName: "toggleId", publicName: "toggleId", isSignal: true, isRequired: false, transformFunction: null }, toggleLabel: { classPropertyName: "toggleLabel", publicName: "toggleLabel", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, isInvalid: { classPropertyName: "isInvalid", publicName: "isInvalid", isSignal: true, isRequired: false, transformFunction: null }, inputPlaceholder: { classPropertyName: "inputPlaceholder", publicName: "inputPlaceholder", isSignal: true, isRequired: false, transformFunction: null },
|
|
232
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.2", type: EclMultiselectInputComponent, isStandalone: true, selector: "div[eclMultiselectInput]", inputs: { eclSize: { classPropertyName: "eclSize", publicName: "eclSize", isSignal: true, isRequired: false, transformFunction: null }, counterLabel: { classPropertyName: "counterLabel", publicName: "counterLabel", isSignal: true, isRequired: false, transformFunction: null }, toggleId: { classPropertyName: "toggleId", publicName: "toggleId", isSignal: true, isRequired: false, transformFunction: null }, toggleLabel: { classPropertyName: "toggleLabel", publicName: "toggleLabel", isSignal: true, isRequired: false, transformFunction: null }, isDisabled: { classPropertyName: "isDisabled", publicName: "isDisabled", isSignal: true, isRequired: false, transformFunction: null }, isInvalid: { classPropertyName: "isInvalid", publicName: "isInvalid", isSignal: true, isRequired: false, transformFunction: null }, inputPlaceholder: { classPropertyName: "inputPlaceholder", publicName: "inputPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, selectedItemsLabels: { classPropertyName: "selectedItemsLabels", publicName: "selectedItemsLabels", isSignal: true, isRequired: false, transformFunction: null }, isDropdownExpanded: { classPropertyName: "isDropdownExpanded", publicName: "isDropdownExpanded", isSignal: true, isRequired: false, transformFunction: null }, ariaControls: { classPropertyName: "ariaControls", publicName: "ariaControls", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "ariaDescribedby", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { mainInputClick: "mainInputClick", mainInputKeydown: "mainInputKeydown" }, host: { properties: { "class": "cssClasses", "class.ecl-select__container--disabled": "isDisabled()", "class.ecl-select__container--invalid": "isInvalid()" } }, viewQueries: [{ propertyName: "inputMultiselect", first: true, predicate: ["inputMultiselect"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div [class.ecl-select-multiple-selections-counter--visible]=\"isShowCounter()\"\n class=\"ecl-select-multiple-selections-counter\" [id]=\"counterId()\">\n <div class=\"ecl-select-multiple-selections-counter__label\">{{ counterLabel() | translate }}</div>\n <span>{{ selectedItemsCount() }}</span>\n</div>\n<button\n class=\"ecl-select ecl-select__multiple-toggle\"\n [class.ecl-select--active]=\"isActive()\"\n #inputMultiselect\n type=\"button\"\n [id]=\"toggleId()\"\n [attr.aria-expanded]=\"isDropdownExpanded()\"\n [attr.aria-controls]=\"ariaControls()\"\n [attr.disabled]=\"isDisabled() ? true : undefined\"\n [attr.aria-describedby]=\"ariaDescribedbyFull()\"\n (keydown)=\"onKeydown($event)\"\n (click)=\"onClick($event)\"> {{ buttonText() }}\n</button>\n<div class=\"ecl-select__icon\">\n <button eclButton isIconOnly variant=\"tertiary\" tabindex=\"-1\">\n <span eclButtonLabel>\n {{ toggleLabel() || 'ecl.multiselect.TOGGLE.DROPDOWN' | translate }}\n </span>\n <ecl-icon icon=\"corner-arrow\" [size]=\"sizeIcon\" transform=\"rotate-180\"></ecl-icon>\n </button>\n</div>\n", dependencies: [{ kind: "component", type: i1.EclButtonComponent, selector: "button[eclButton], button[ecl-button], a[eclButton]", inputs: ["isIconOnly", "variant", "eclStyle", "size", "containerStyleClass"] }, { kind: "directive", type: i1.EclButtonLabelDirective, selector: "[eclButtonLabel]" }, { kind: "component", type: i2.EclIconComponent, selector: "ecl-icon", inputs: ["iconSet", "icon", "size", "color", "transform", "ariaLabelledby", "role", "title", "ariaHidden", "focusable", "isFlipHorizontal"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
234
233
|
}
|
|
235
234
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: EclMultiselectInputComponent, decorators: [{
|
|
236
235
|
type: Component,
|
|
237
236
|
args: [{ selector: 'div[eclMultiselectInput]', imports: [TranslatePipe, ...EUI_ECL_BUTTON, ...EUI_ECL_ICON], host: {
|
|
237
|
+
'[class]': 'cssClasses',
|
|
238
238
|
'[class.ecl-select__container--disabled]': 'isDisabled()',
|
|
239
239
|
'[class.ecl-select__container--invalid]': 'isInvalid()',
|
|
240
240
|
}, template: "<div [class.ecl-select-multiple-selections-counter--visible]=\"isShowCounter()\"\n class=\"ecl-select-multiple-selections-counter\" [id]=\"counterId()\">\n <div class=\"ecl-select-multiple-selections-counter__label\">{{ counterLabel() | translate }}</div>\n <span>{{ selectedItemsCount() }}</span>\n</div>\n<button\n class=\"ecl-select ecl-select__multiple-toggle\"\n [class.ecl-select--active]=\"isActive()\"\n #inputMultiselect\n type=\"button\"\n [id]=\"toggleId()\"\n [attr.aria-expanded]=\"isDropdownExpanded()\"\n [attr.aria-controls]=\"ariaControls()\"\n [attr.disabled]=\"isDisabled() ? true : undefined\"\n [attr.aria-describedby]=\"ariaDescribedbyFull()\"\n (keydown)=\"onKeydown($event)\"\n (click)=\"onClick($event)\"> {{ buttonText() }}\n</button>\n<div class=\"ecl-select__icon\">\n <button eclButton isIconOnly variant=\"tertiary\" tabindex=\"-1\">\n <span eclButtonLabel>\n {{ toggleLabel() || 'ecl.multiselect.TOGGLE.DROPDOWN' | translate }}\n </span>\n <ecl-icon icon=\"corner-arrow\" [size]=\"sizeIcon\" transform=\"rotate-180\"></ecl-icon>\n </button>\n</div>\n" }]
|
|
241
|
-
}], propDecorators: { eclSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "eclSize", required: false }] }], counterLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "counterLabel", required: false }] }], toggleId: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleId", required: false }] }], toggleLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleLabel", required: false }] }], isDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "isDisabled", required: false }] }], isInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "isInvalid", required: false }] }],
|
|
242
|
-
type: HostBinding,
|
|
243
|
-
args: ['class']
|
|
244
|
-
}], inputPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputPlaceholder", required: false }] }], selectedItems: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedItems", required: false }] }], isDropdownExpanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "isDropdownExpanded", required: false }] }], ariaControls: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaControls", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedby", required: false }] }], inputMultiselect: [{ type: i0.ViewChild, args: ['inputMultiselect', { isSignal: true }] }], mainInputClick: [{ type: i0.Output, args: ["mainInputClick"] }], mainInputKeydown: [{ type: i0.Output, args: ["mainInputKeydown"] }] } });
|
|
241
|
+
}], propDecorators: { eclSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "eclSize", required: false }] }], counterLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "counterLabel", required: false }] }], toggleId: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleId", required: false }] }], toggleLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleLabel", required: false }] }], isDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "isDisabled", required: false }] }], isInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "isInvalid", required: false }] }], inputPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputPlaceholder", required: false }] }], selectedItemsLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedItemsLabels", required: false }] }], isDropdownExpanded: [{ type: i0.Input, args: [{ isSignal: true, alias: "isDropdownExpanded", required: false }] }], ariaControls: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaControls", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedby", required: false }] }], mainInputClick: [{ type: i0.Output, args: ["mainInputClick"] }], mainInputKeydown: [{ type: i0.Output, args: ["mainInputKeydown"] }], inputMultiselect: [{ type: i0.ViewChild, args: ['inputMultiselect', { isSignal: true }] }] } });
|
|
245
242
|
|
|
246
243
|
/**
|
|
247
244
|
* Component representing a single selectable option in the multiselect dropdown.
|
|
@@ -249,14 +246,25 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
|
|
|
249
246
|
class EclMultiselectOptionComponent extends ECLBaseDirective {
|
|
250
247
|
constructor() {
|
|
251
248
|
super(...arguments);
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
this.
|
|
249
|
+
/**
|
|
250
|
+
* Value assigned to the option.
|
|
251
|
+
*/
|
|
252
|
+
this.value = input('', /* @ts-ignore */
|
|
253
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
254
|
+
/**
|
|
255
|
+
* Display label for the option.
|
|
256
|
+
*/
|
|
257
|
+
this.label = input('', /* @ts-ignore */
|
|
258
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
256
259
|
/**
|
|
257
260
|
* Disables the option when true.
|
|
258
261
|
*/
|
|
259
|
-
this.disabled = false;
|
|
262
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
263
|
+
/**
|
|
264
|
+
* Indicates whether the option is selected.
|
|
265
|
+
*/
|
|
266
|
+
this.isChecked = model(false, /* @ts-ignore */
|
|
267
|
+
...(ngDevMode ? [{ debugName: "isChecked" }] : /* istanbul ignore next */ []));
|
|
260
268
|
/**
|
|
261
269
|
* Emits when the option is clicked.
|
|
262
270
|
*/
|
|
@@ -265,30 +273,22 @@ class EclMultiselectOptionComponent extends ECLBaseDirective {
|
|
|
265
273
|
* Emits when a key is pressed while focused on the option.
|
|
266
274
|
*/
|
|
267
275
|
this.optionKeydown = output();
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
276
|
+
/**
|
|
277
|
+
* Reference to the checkbox input element.
|
|
278
|
+
*/
|
|
279
|
+
this.eclCheckboxInput = viewChild('checkboxInput', /* @ts-ignore */
|
|
280
|
+
...(ngDevMode ? [{ debugName: "eclCheckboxInput" }] : /* istanbul ignore next */ []));
|
|
281
|
+
/**
|
|
282
|
+
* Keyword used by the boldText pipe to highlight matching text.
|
|
283
|
+
*/
|
|
284
|
+
this.keyword = '';
|
|
285
|
+
/**
|
|
286
|
+
* Controls the host element visibility (`display` style).
|
|
287
|
+
*/
|
|
288
|
+
this.display = signal('flex', /* @ts-ignore */
|
|
289
|
+
...(ngDevMode ? [{ debugName: "display" }] : /* istanbul ignore next */ []));
|
|
273
290
|
this.renderer = inject(Renderer2);
|
|
274
|
-
|
|
275
|
-
set value(value) {
|
|
276
|
-
this._value = value;
|
|
277
|
-
}
|
|
278
|
-
get value() {
|
|
279
|
-
return this._value;
|
|
280
|
-
}
|
|
281
|
-
get cssClasses() {
|
|
282
|
-
return [super.getCssClasses('ecl-checkbox')].join(' ').trim();
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Indicates whether the option is selected.
|
|
286
|
-
*/
|
|
287
|
-
get isChecked() {
|
|
288
|
-
return this._checked();
|
|
289
|
-
}
|
|
290
|
-
set isChecked(value) {
|
|
291
|
-
this._checked.set(value);
|
|
291
|
+
this._id = '';
|
|
292
292
|
}
|
|
293
293
|
/**
|
|
294
294
|
* Returns the unique identifier for the option.
|
|
@@ -300,30 +300,11 @@ class EclMultiselectOptionComponent extends ECLBaseDirective {
|
|
|
300
300
|
* Indicates whether the option is active (visible and not disabled).
|
|
301
301
|
*/
|
|
302
302
|
get isActive() {
|
|
303
|
-
return this.display === 'flex' && !this.disabled;
|
|
304
|
-
}
|
|
305
|
-
ngOnChanges() {
|
|
306
|
-
this.changes.next(this.label);
|
|
303
|
+
return this.display() === 'flex' && !this.disabled();
|
|
307
304
|
}
|
|
308
305
|
ngOnInit() {
|
|
309
306
|
this._id = this.createId();
|
|
310
307
|
}
|
|
311
|
-
ngOnDestroy() {
|
|
312
|
-
this.changes.complete();
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Toggles the selected state and emits the optionClick event.
|
|
316
|
-
*/
|
|
317
|
-
onOptionClick() {
|
|
318
|
-
this.isChecked = !this.isChecked;
|
|
319
|
-
this.optionClick.emit(new EclMultiselectOptionClickEvent(this));
|
|
320
|
-
}
|
|
321
|
-
/**
|
|
322
|
-
* Emits the optionKeydown event when a key is pressed.
|
|
323
|
-
*/
|
|
324
|
-
onOptionKeydown(evt) {
|
|
325
|
-
this.optionKeydown.emit(new EclMultiselectOptionKeydownEvent(this, evt));
|
|
326
|
-
}
|
|
327
308
|
/**
|
|
328
309
|
* Focuses the checkbox input.
|
|
329
310
|
*/
|
|
@@ -334,53 +315,54 @@ class EclMultiselectOptionComponent extends ECLBaseDirective {
|
|
|
334
315
|
* Makes the option visible.
|
|
335
316
|
*/
|
|
336
317
|
show() {
|
|
337
|
-
this.display
|
|
318
|
+
this.display.set('flex');
|
|
338
319
|
}
|
|
339
320
|
/**
|
|
340
321
|
* Hides the option from view.
|
|
341
322
|
*/
|
|
342
323
|
hide() {
|
|
343
|
-
this.display
|
|
324
|
+
this.display.set('none');
|
|
344
325
|
}
|
|
345
326
|
/**
|
|
346
|
-
* Sets the keyword
|
|
327
|
+
* Sets the keyword used by the boldText pipe to highlight matching text.
|
|
347
328
|
*/
|
|
348
329
|
highlightSearchText(keyword) {
|
|
349
330
|
this.keyword = keyword;
|
|
350
|
-
|
|
351
|
-
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Applies ECL checkbox styling class to the option.
|
|
334
|
+
*/
|
|
335
|
+
get cssClasses() {
|
|
336
|
+
return [super.getCssClasses('ecl-checkbox')].join(' ').trim();
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Toggles the selected state and emits the optionClick event.
|
|
340
|
+
*/
|
|
341
|
+
onOptionClick() {
|
|
342
|
+
this.isChecked.set(!this.isChecked());
|
|
343
|
+
this.optionClick.emit(new EclMultiselectOptionClickEvent(this));
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Emits the optionKeydown event when a key is pressed.
|
|
347
|
+
*/
|
|
348
|
+
onOptionKeydown(evt) {
|
|
349
|
+
this.optionKeydown.emit(new EclMultiselectOptionKeydownEvent(this, evt));
|
|
352
350
|
}
|
|
353
351
|
createId() {
|
|
354
352
|
return crypto.randomUUID();
|
|
355
353
|
}
|
|
356
354
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: EclMultiselectOptionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
357
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.2", type: EclMultiselectOptionComponent, isStandalone: true, selector: "div[eclMultiselectOption]", inputs: { value: "value", label: "label", disabled:
|
|
355
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.2", type: EclMultiselectOptionComponent, isStandalone: true, selector: "div[eclMultiselectOption]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, isChecked: { classPropertyName: "isChecked", publicName: "isChecked", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { isChecked: "isCheckedChange", optionClick: "optionClick", optionKeydown: "optionKeydown" }, host: { properties: { "class": "cssClasses", "class.ecl-checkbox--disabled": "disabled()", "attr.disabled": "disabled() || null", "style.display": "display()" } }, viewQueries: [{ propertyName: "eclCheckboxInput", first: true, predicate: ["checkboxInput"], descendants: true, isSignal: true }], usesInheritance: true, hostDirectives: [{ directive: i1$1.EclCheckboxDirective }], ngImport: i0, template: "<input\n eclCheckboxInput\n type=\"checkbox\"\n [id]=\"id\"\n [value]=\"value()\"\n (click)=\"onOptionClick()\"\n (keydown)=\"onOptionKeydown($event)\"\n [checked]=\"isChecked()\"\n [disabled]=\"disabled()\"\n #checkboxInput />\n<label [for]=\"id\" eclCheckboxLabel><span [innerHTML]=\"label() | boldText: keyword\"></span></label>\n", dependencies: [{ kind: "component", type: i1$1.EclCheckboxLabelComponent, selector: "label[eclCheckboxLabel]", inputs: ["isInvalid", "isDisabled", "isRequired"] }, { kind: "directive", type: i1$1.EclCheckboxInputDirective, selector: "input[eclCheckboxInput]" }, { kind: "pipe", type: BoldTextPipe, name: "boldText" }] }); }
|
|
358
356
|
}
|
|
359
357
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: EclMultiselectOptionComponent, decorators: [{
|
|
360
358
|
type: Component,
|
|
361
|
-
args: [{ selector: 'div[eclMultiselectOption]', imports: [BoldTextPipe, ...EUI_ECL_CHECKBOX], hostDirectives: [EclCheckboxDirective],
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
args: [{ transform: booleanAttribute }]
|
|
369
|
-
}, {
|
|
370
|
-
type: HostBinding,
|
|
371
|
-
args: ['class.ecl-checkbox--disabled']
|
|
372
|
-
}, {
|
|
373
|
-
type: HostBinding,
|
|
374
|
-
args: ['attr.disabled']
|
|
375
|
-
}], optionClick: [{ type: i0.Output, args: ["optionClick"] }], optionKeydown: [{ type: i0.Output, args: ["optionKeydown"] }], display: [{
|
|
376
|
-
type: HostBinding,
|
|
377
|
-
args: ['style.display']
|
|
378
|
-
}], cssClasses: [{
|
|
379
|
-
type: HostBinding,
|
|
380
|
-
args: ['class']
|
|
381
|
-
}], isChecked: [{
|
|
382
|
-
type: Input
|
|
383
|
-
}] } });
|
|
359
|
+
args: [{ selector: 'div[eclMultiselectOption]', imports: [BoldTextPipe, ...EUI_ECL_CHECKBOX], hostDirectives: [EclCheckboxDirective], host: {
|
|
360
|
+
'[class]': 'cssClasses',
|
|
361
|
+
'[class.ecl-checkbox--disabled]': 'disabled()',
|
|
362
|
+
'[attr.disabled]': 'disabled() || null',
|
|
363
|
+
'[style.display]': 'display()',
|
|
364
|
+
}, template: "<input\n eclCheckboxInput\n type=\"checkbox\"\n [id]=\"id\"\n [value]=\"value()\"\n (click)=\"onOptionClick()\"\n (keydown)=\"onOptionKeydown($event)\"\n [checked]=\"isChecked()\"\n [disabled]=\"disabled()\"\n #checkboxInput />\n<label [for]=\"id\" eclCheckboxLabel><span [innerHTML]=\"label() | boldText: keyword\"></span></label>\n" }]
|
|
365
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], isChecked: [{ type: i0.Input, args: [{ isSignal: true, alias: "isChecked", required: false }] }, { type: i0.Output, args: ["isCheckedChange"] }], optionClick: [{ type: i0.Output, args: ["optionClick"] }], optionKeydown: [{ type: i0.Output, args: ["optionKeydown"] }], eclCheckboxInput: [{ type: i0.ViewChild, args: ['checkboxInput', { isSignal: true }] }] } });
|
|
384
366
|
|
|
385
367
|
/**
|
|
386
368
|
* Component representing an option group (fieldset) in a multiselect component.
|
|
@@ -417,73 +399,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
|
|
|
417
399
|
* Used internally by the `EclMultiselectComponent`.
|
|
418
400
|
*/
|
|
419
401
|
class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
420
|
-
/**
|
|
421
|
-
* Marks the component as visually invalid.
|
|
422
|
-
*/
|
|
423
|
-
get isInvalid() {
|
|
424
|
-
return this._isInvalid;
|
|
425
|
-
}
|
|
426
|
-
set isInvalid(value) {
|
|
427
|
-
this._isInvalid = value;
|
|
428
|
-
}
|
|
429
|
-
/**
|
|
430
|
-
* Adds the ECL base CSS class for multiselect dropdowns.
|
|
431
|
-
*/
|
|
432
|
-
get cssClasses() {
|
|
433
|
-
return [super.getCssClasses('ecl-select__multiple')].join(' ').trim();
|
|
434
|
-
}
|
|
435
|
-
/**
|
|
436
|
-
* Disables the component when true.
|
|
437
|
-
*/
|
|
438
|
-
get disabled() {
|
|
439
|
-
return this._disabled || undefined;
|
|
440
|
-
}
|
|
441
|
-
set disabled(value) {
|
|
442
|
-
this._disabled = value;
|
|
443
|
-
}
|
|
444
402
|
constructor() {
|
|
445
403
|
super();
|
|
446
|
-
this.searchInput = viewChild('searchInput', /* @ts-ignore */
|
|
447
|
-
...(ngDevMode ? [{ debugName: "searchInput" }] : /* istanbul ignore next */ []));
|
|
448
|
-
this.eclMultiselectInput = viewChild('eclMultiselectInput', /* @ts-ignore */
|
|
449
|
-
...(ngDevMode ? [{ debugName: "eclMultiselectInput" }] : /* istanbul ignore next */ []));
|
|
450
|
-
this.selectAllCheckbox = viewChild('selectAllCheckbox', /* @ts-ignore */
|
|
451
|
-
...(ngDevMode ? [{ debugName: "selectAllCheckbox" }] : /* istanbul ignore next */ []));
|
|
452
|
-
this.closeBtn = viewChild('closeBtn', { ...(ngDevMode ? { debugName: "closeBtn" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
453
|
-
this.clearAllBtn = viewChild('clearAllBtn', { ...(ngDevMode ? { debugName: "clearAllBtn" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
454
404
|
/**
|
|
455
405
|
* Emits the list of selected values whenever the selection changes.
|
|
456
406
|
*/
|
|
457
|
-
this.eclChange =
|
|
407
|
+
this.eclChange = output();
|
|
408
|
+
/**
|
|
409
|
+
* State configured imperatively by the parent `EclMultiselectComponent`.
|
|
410
|
+
* This dropdown is created dynamically and is never bound in a template, so these
|
|
411
|
+
* are writable signals set through their `.set()` accessor rather than inputs.
|
|
412
|
+
*/
|
|
413
|
+
this.isInvalid = signal(undefined, /* @ts-ignore */
|
|
414
|
+
...(ngDevMode ? [{ debugName: "isInvalid" }] : /* istanbul ignore next */ []));
|
|
458
415
|
/**
|
|
459
416
|
* Placeholder for the main multiselect input.
|
|
460
417
|
*/
|
|
461
|
-
this.mainInputPlaceholder = 'Select an item'
|
|
418
|
+
this.mainInputPlaceholder = signal('Select an item', /* @ts-ignore */
|
|
419
|
+
...(ngDevMode ? [{ debugName: "mainInputPlaceholder" }] : /* istanbul ignore next */ []));
|
|
462
420
|
/**
|
|
463
421
|
* Placeholder for the search field input.
|
|
464
422
|
*/
|
|
465
|
-
this.searchFieldPlaceholder =
|
|
423
|
+
this.searchFieldPlaceholder = signal('Enter filter keyword', /* @ts-ignore */
|
|
466
424
|
...(ngDevMode ? [{ debugName: "searchFieldPlaceholder" }] : /* istanbul ignore next */ []));
|
|
467
425
|
/**
|
|
468
426
|
* Size of the multiselect dropdown (e.g., 'm', 'l').
|
|
469
427
|
*/
|
|
470
|
-
this.eclSize = 'm'
|
|
428
|
+
this.eclSize = signal('m', /* @ts-ignore */
|
|
429
|
+
...(ngDevMode ? [{ debugName: "eclSize" }] : /* istanbul ignore next */ []));
|
|
430
|
+
/**
|
|
431
|
+
* Disables the component when true.
|
|
432
|
+
* Set by the parent and by `ControlValueAccessor.setDisabledState`.
|
|
433
|
+
*/
|
|
434
|
+
this.disabled = signal(undefined, /* @ts-ignore */
|
|
435
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
471
436
|
/**
|
|
472
437
|
* Optional ARIA description used for accessibility purposes.
|
|
473
438
|
*/
|
|
474
|
-
this.ariaDescribedby = undefined
|
|
439
|
+
this.ariaDescribedby = signal(undefined, /* @ts-ignore */
|
|
440
|
+
...(ngDevMode ? [{ debugName: "ariaDescribedby" }] : /* istanbul ignore next */ []));
|
|
475
441
|
/**
|
|
476
442
|
* Label displayed for the toggle button to assist screen readers.
|
|
477
443
|
*/
|
|
478
|
-
this.toggleLabel = undefined
|
|
444
|
+
this.toggleLabel = signal(undefined, /* @ts-ignore */
|
|
445
|
+
...(ngDevMode ? [{ debugName: "toggleLabel" }] : /* istanbul ignore next */ []));
|
|
479
446
|
/**
|
|
480
447
|
* Enables the search box in the dropdown interface.
|
|
481
448
|
*/
|
|
482
|
-
this.hasSearchBox = true
|
|
449
|
+
this.hasSearchBox = signal(true, /* @ts-ignore */
|
|
450
|
+
...(ngDevMode ? [{ debugName: "hasSearchBox" }] : /* istanbul ignore next */ []));
|
|
483
451
|
/**
|
|
484
452
|
* Displays the "Select all" checkbox above the list of options.
|
|
485
453
|
*/
|
|
486
|
-
this.hasSelectAll = true
|
|
454
|
+
this.hasSelectAll = signal(true, /* @ts-ignore */
|
|
455
|
+
...(ngDevMode ? [{ debugName: "hasSelectAll" }] : /* istanbul ignore next */ []));
|
|
487
456
|
/**
|
|
488
457
|
* When true, the Apply button acts as a submit button (type="submit") instead of a regular button.
|
|
489
458
|
*/
|
|
@@ -492,11 +461,39 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
492
461
|
/**
|
|
493
462
|
* Label for the selections counter, read by screen readers.
|
|
494
463
|
*/
|
|
495
|
-
this.counterLabel = 'ecl.multiselect.SELECTED'
|
|
464
|
+
this.counterLabel = signal('ecl.multiselect.SELECTED', /* @ts-ignore */
|
|
465
|
+
...(ngDevMode ? [{ debugName: "counterLabel" }] : /* istanbul ignore next */ []));
|
|
496
466
|
/**
|
|
497
467
|
* Optional identifier used for the dropdown element.
|
|
498
468
|
*/
|
|
499
|
-
this.id = ''
|
|
469
|
+
this.id = signal('', /* @ts-ignore */
|
|
470
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
471
|
+
/**
|
|
472
|
+
* List of option directives currently rendered in the dropdown.
|
|
473
|
+
*/
|
|
474
|
+
this.multiOptionDirectives = signal([], /* @ts-ignore */
|
|
475
|
+
...(ngDevMode ? [{ debugName: "multiOptionDirectives" }] : /* istanbul ignore next */ []));
|
|
476
|
+
this.searchInput = viewChild('searchInput', /* @ts-ignore */
|
|
477
|
+
...(ngDevMode ? [{ debugName: "searchInput" }] : /* istanbul ignore next */ []));
|
|
478
|
+
this.eclMultiselectInput = viewChild('eclMultiselectInput', /* @ts-ignore */
|
|
479
|
+
...(ngDevMode ? [{ debugName: "eclMultiselectInput" }] : /* istanbul ignore next */ []));
|
|
480
|
+
this.selectAllCheckbox = viewChild('selectAllCheckbox', /* @ts-ignore */
|
|
481
|
+
...(ngDevMode ? [{ debugName: "selectAllCheckbox" }] : /* istanbul ignore next */ []));
|
|
482
|
+
this.closeBtn = viewChild('closeBtn', { ...(ngDevMode ? { debugName: "closeBtn" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
483
|
+
this.clearAllBtn = viewChild('clearAllBtn', { ...(ngDevMode ? { debugName: "clearAllBtn" } : /* istanbul ignore next */ {}), read: ElementRef });
|
|
484
|
+
this.multiOptionComponents = viewChildren(EclMultiselectOptionComponent, /* @ts-ignore */
|
|
485
|
+
...(ngDevMode ? [{ debugName: "multiOptionComponents" }] : /* istanbul ignore next */ []));
|
|
486
|
+
/**
|
|
487
|
+
* Gets labels of currently selected options.
|
|
488
|
+
*/
|
|
489
|
+
this.selectedItemsLabels = computed(() => this._selectedItems().map((item) => item.label()), /* @ts-ignore */
|
|
490
|
+
...(ngDevMode ? [{ debugName: "selectedItemsLabels" }] : /* istanbul ignore next */ []));
|
|
491
|
+
/**
|
|
492
|
+
* Controls the visibility of the multiselect toolbar.
|
|
493
|
+
* Always visible when isSubmitOnApply is true so the user can submit the form.
|
|
494
|
+
*/
|
|
495
|
+
this.isShowToolbar = computed(() => this.isSubmitOnApply() || this._selectedItems().length > 0, /* @ts-ignore */
|
|
496
|
+
...(ngDevMode ? [{ debugName: "isShowToolbar" }] : /* istanbul ignore next */ []));
|
|
500
497
|
/**
|
|
501
498
|
* Indicates that the "no results found" message should be displayed.
|
|
502
499
|
*/
|
|
@@ -505,11 +502,6 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
505
502
|
* Controls the visibility of the multiselect dropdown.
|
|
506
503
|
*/
|
|
507
504
|
this.isShowMultiselectDropdown = false;
|
|
508
|
-
/**
|
|
509
|
-
* List of option directives currently rendered in the dropdown.
|
|
510
|
-
*/
|
|
511
|
-
this.multiOptionDirectives = signal([], /* @ts-ignore */
|
|
512
|
-
...(ngDevMode ? [{ debugName: "multiOptionDirectives" }] : /* istanbul ignore next */ []));
|
|
513
505
|
/**
|
|
514
506
|
* Total number of options available in the dropdown list.
|
|
515
507
|
*/
|
|
@@ -518,8 +510,6 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
518
510
|
this.isSelectAllDisabled = null;
|
|
519
511
|
this.selectAllId = '';
|
|
520
512
|
this.toggleId = '';
|
|
521
|
-
this._disabled = false;
|
|
522
|
-
this._isInvalid = false;
|
|
523
513
|
this._selectedItems = signal([], /* @ts-ignore */
|
|
524
514
|
...(ngDevMode ? [{ debugName: "_selectedItems" }] : /* istanbul ignore next */ []));
|
|
525
515
|
this.destroy$ = new Subject();
|
|
@@ -527,22 +517,6 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
527
517
|
this.values = [];
|
|
528
518
|
this.elRef = inject(ElementRef);
|
|
529
519
|
this.renderer = inject(Renderer2);
|
|
530
|
-
/**
|
|
531
|
-
* Gets labels of currently selected options.
|
|
532
|
-
*/
|
|
533
|
-
this.selectedItems = computed(() => this._selectedItems().map((item) => item.label), /* @ts-ignore */
|
|
534
|
-
...(ngDevMode ? [{ debugName: "selectedItems" }] : /* istanbul ignore next */ []));
|
|
535
|
-
/**
|
|
536
|
-
* Indicates if any options are currently selected.
|
|
537
|
-
*/
|
|
538
|
-
this.isItemsSelected = computed(() => this._selectedItems().length > 0, /* @ts-ignore */
|
|
539
|
-
...(ngDevMode ? [{ debugName: "isItemsSelected" }] : /* istanbul ignore next */ []));
|
|
540
|
-
/**
|
|
541
|
-
* Controls the visibility of the multiselect toolbar.
|
|
542
|
-
* Always visible when isSubmitOnApply is true so the user can submit the form.
|
|
543
|
-
*/
|
|
544
|
-
this.isShowToolbar = computed(() => this.isSubmitOnApply() || this._selectedItems().length > 0, /* @ts-ignore */
|
|
545
|
-
...(ngDevMode ? [{ debugName: "isShowToolbar" }] : /* istanbul ignore next */ []));
|
|
546
520
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
547
521
|
this.propagateChange = (_) => {
|
|
548
522
|
/* empty */
|
|
@@ -550,6 +524,19 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
550
524
|
this.propagateTouched = () => {
|
|
551
525
|
/* empty */
|
|
552
526
|
};
|
|
527
|
+
// Re-apply the selection state whenever the rendered set of option components
|
|
528
|
+
// changes. This replaces the previous QueryList.changes subscription: the option
|
|
529
|
+
// components arrive asynchronously (the parent publishes the option directives via
|
|
530
|
+
// a setTimeout, then the @for renders them), and their arrival does not always emit
|
|
531
|
+
// a change event. Only the identity of the option list is tracked here; the option
|
|
532
|
+
// state reads/writes inside applyOptionState run untracked so toggling an option
|
|
533
|
+
// does not re-trigger this effect.
|
|
534
|
+
effect(() => {
|
|
535
|
+
const options = this.multiOptionComponents();
|
|
536
|
+
if (options.length > 0) {
|
|
537
|
+
untracked(() => this.applyOptionState());
|
|
538
|
+
}
|
|
539
|
+
});
|
|
553
540
|
}
|
|
554
541
|
ngDoCheck() {
|
|
555
542
|
this.optionsCount = this.getAvailableOptions() ? this.getAvailableOptions().length : 0;
|
|
@@ -562,27 +549,6 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
562
549
|
this.modifyParentLabelForAttribute();
|
|
563
550
|
});
|
|
564
551
|
}
|
|
565
|
-
ngAfterViewInit() {
|
|
566
|
-
// Apply the current option state once, in case the option components are already
|
|
567
|
-
// present when this hook runs (their arrival does not always emit a changes event).
|
|
568
|
-
if (this.multiOptionComponents.length > 0) {
|
|
569
|
-
this.applyOptionState();
|
|
570
|
-
}
|
|
571
|
-
this.multiOptionComponents.changes.pipe(takeUntil(this.destroy$)).subscribe(() => {
|
|
572
|
-
this.applyOptionState();
|
|
573
|
-
});
|
|
574
|
-
}
|
|
575
|
-
applyOptionState() {
|
|
576
|
-
if (this.isWriteValueCalled) {
|
|
577
|
-
this.resetComponent();
|
|
578
|
-
this.writeValues(this.values);
|
|
579
|
-
this.isWriteValueCalled = false;
|
|
580
|
-
}
|
|
581
|
-
else {
|
|
582
|
-
this.initSelectedOptions();
|
|
583
|
-
}
|
|
584
|
-
this.optionsCount = this.getAvailableOptions() ? this.getAvailableOptions().length : 0;
|
|
585
|
-
}
|
|
586
552
|
ngOnDestroy() {
|
|
587
553
|
this.destroy$.next(true);
|
|
588
554
|
this.destroy$.unsubscribe();
|
|
@@ -593,7 +559,7 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
593
559
|
*/
|
|
594
560
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
595
561
|
writeValue(values) {
|
|
596
|
-
if (this.multiOptionComponents && this.multiOptionComponents.length > 0) {
|
|
562
|
+
if (this.multiOptionComponents() && this.multiOptionComponents().length > 0) {
|
|
597
563
|
this.resetComponent();
|
|
598
564
|
this.writeValues(values);
|
|
599
565
|
}
|
|
@@ -623,7 +589,13 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
623
589
|
* Required by ControlValueAccessor.
|
|
624
590
|
*/
|
|
625
591
|
setDisabledState(isDisabled) {
|
|
626
|
-
this.
|
|
592
|
+
this.disabled.set(isDisabled);
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Adds the ECL base CSS class for multiselect dropdowns.
|
|
596
|
+
*/
|
|
597
|
+
get cssClasses() {
|
|
598
|
+
return [super.getCssClasses('ecl-select__multiple')].join(' ').trim();
|
|
627
599
|
}
|
|
628
600
|
onEscapeKey() {
|
|
629
601
|
this.hideMultiselectDropdown();
|
|
@@ -634,15 +606,6 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
634
606
|
this.hideMultiselectDropdown();
|
|
635
607
|
}
|
|
636
608
|
}
|
|
637
|
-
initSelectedOptions() {
|
|
638
|
-
const items = [];
|
|
639
|
-
this.multiOptionComponents
|
|
640
|
-
.filter((elem) => elem.isChecked)
|
|
641
|
-
.forEach((item) => {
|
|
642
|
-
items.push(item);
|
|
643
|
-
});
|
|
644
|
-
this._selectedItems.set(items);
|
|
645
|
-
}
|
|
646
609
|
onClickClearAll(evt) {
|
|
647
610
|
evt.stopPropagation();
|
|
648
611
|
this.unselectAllActiveOptions();
|
|
@@ -695,7 +658,7 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
695
658
|
onArrowDownSearch(evt) {
|
|
696
659
|
evt.preventDefault();
|
|
697
660
|
const currentOptions = this.getActiveOptions();
|
|
698
|
-
if (this.hasSelectAll) {
|
|
661
|
+
if (this.hasSelectAll()) {
|
|
699
662
|
this.renderer.selectRootElement(this.selectAllCheckbox()?.nativeElement, true).focus();
|
|
700
663
|
}
|
|
701
664
|
else {
|
|
@@ -710,7 +673,7 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
710
673
|
onKeydownMainInput(evt) {
|
|
711
674
|
evt.preventDefault();
|
|
712
675
|
this.showMultiselectDropdown();
|
|
713
|
-
if (this.hasSearchBox) {
|
|
676
|
+
if (this.hasSearchBox()) {
|
|
714
677
|
setTimeout(() => this.renderer.selectRootElement(this.searchInput()?.nativeElement, true).focus());
|
|
715
678
|
}
|
|
716
679
|
else {
|
|
@@ -730,7 +693,7 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
730
693
|
}
|
|
731
694
|
onArrowUpSelectAll(evt) {
|
|
732
695
|
evt.preventDefault();
|
|
733
|
-
if (this.hasSearchBox) {
|
|
696
|
+
if (this.hasSearchBox()) {
|
|
734
697
|
this.renderer.selectRootElement(this.searchInput()?.nativeElement, true).focus();
|
|
735
698
|
}
|
|
736
699
|
else {
|
|
@@ -750,14 +713,14 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
750
713
|
if (keyword === '') {
|
|
751
714
|
this.enableSelectAll();
|
|
752
715
|
isMatchFound = true;
|
|
753
|
-
this.multiOptionComponents.forEach((item) => {
|
|
716
|
+
this.multiOptionComponents().forEach((item) => {
|
|
754
717
|
item.highlightSearchText('');
|
|
755
718
|
item.show();
|
|
756
719
|
});
|
|
757
720
|
}
|
|
758
721
|
else {
|
|
759
|
-
this.multiOptionComponents.forEach((item) => {
|
|
760
|
-
if (item.label.toLowerCase().indexOf(keyword.toLowerCase()) < 0) {
|
|
722
|
+
this.multiOptionComponents().forEach((item) => {
|
|
723
|
+
if (item.label().toLowerCase().indexOf(keyword.toLowerCase()) < 0) {
|
|
761
724
|
item.hide();
|
|
762
725
|
}
|
|
763
726
|
else {
|
|
@@ -786,8 +749,8 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
786
749
|
this.unselectAllActiveOptions();
|
|
787
750
|
}
|
|
788
751
|
this.propagateTouched();
|
|
789
|
-
this.eclChange.emit(this._selectedItems().map((item) => item.value));
|
|
790
|
-
this.propagateChange(this._selectedItems().map((item) => item.value));
|
|
752
|
+
this.eclChange.emit(this._selectedItems().map((item) => item.value()));
|
|
753
|
+
this.propagateChange(this._selectedItems().map((item) => item.value()));
|
|
791
754
|
}
|
|
792
755
|
/**
|
|
793
756
|
* Handles keyboard interaction on option items.
|
|
@@ -828,21 +791,41 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
828
791
|
this.renderer.setProperty(selectAllCheckbox.nativeElement, 'checked', false);
|
|
829
792
|
}
|
|
830
793
|
const currOption = evt.multiselectOption;
|
|
831
|
-
if (currOption.isChecked) {
|
|
794
|
+
if (currOption.isChecked()) {
|
|
832
795
|
this._selectedItems.update((items) => [...items, currOption]);
|
|
833
796
|
}
|
|
834
797
|
else {
|
|
835
798
|
this._selectedItems.update((items) => items.filter((item) => item !== currOption));
|
|
836
799
|
}
|
|
837
|
-
this.propagateChange(this._selectedItems().map((item) => item.value));
|
|
800
|
+
this.propagateChange(this._selectedItems().map((item) => item.value()));
|
|
838
801
|
this.propagateTouched();
|
|
839
|
-
this.eclChange.emit(this._selectedItems().map((item) => item.value));
|
|
802
|
+
this.eclChange.emit(this._selectedItems().map((item) => item.value()));
|
|
803
|
+
}
|
|
804
|
+
applyOptionState() {
|
|
805
|
+
if (this.isWriteValueCalled) {
|
|
806
|
+
this.resetComponent();
|
|
807
|
+
this.writeValues(this.values);
|
|
808
|
+
this.isWriteValueCalled = false;
|
|
809
|
+
}
|
|
810
|
+
else {
|
|
811
|
+
this.initSelectedOptions();
|
|
812
|
+
}
|
|
813
|
+
this.optionsCount = this.getAvailableOptions() ? this.getAvailableOptions().length : 0;
|
|
814
|
+
}
|
|
815
|
+
initSelectedOptions() {
|
|
816
|
+
const items = [];
|
|
817
|
+
this.multiOptionComponents()
|
|
818
|
+
.filter((elem) => elem.isChecked())
|
|
819
|
+
.forEach((item) => {
|
|
820
|
+
items.push(item);
|
|
821
|
+
});
|
|
822
|
+
this._selectedItems.set(items);
|
|
840
823
|
}
|
|
841
824
|
selectAllActiveOptions() {
|
|
842
825
|
const newItems = [...this._selectedItems()];
|
|
843
826
|
this.getActiveOptions().forEach((item) => {
|
|
844
|
-
if (!item.isChecked) {
|
|
845
|
-
item.isChecked
|
|
827
|
+
if (!item.isChecked()) {
|
|
828
|
+
item.isChecked.set(true);
|
|
846
829
|
newItems.push(item);
|
|
847
830
|
}
|
|
848
831
|
});
|
|
@@ -855,7 +838,7 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
855
838
|
}
|
|
856
839
|
this._selectedItems.set([]);
|
|
857
840
|
this.getAvailableOptions().forEach((item) => {
|
|
858
|
-
item.isChecked
|
|
841
|
+
item.isChecked.set(false);
|
|
859
842
|
});
|
|
860
843
|
}
|
|
861
844
|
showMultiselectDropdown() {
|
|
@@ -877,8 +860,8 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
877
860
|
this.isShowNoResultsFound = false;
|
|
878
861
|
}
|
|
879
862
|
resetComponent() {
|
|
880
|
-
this.multiOptionComponents.forEach((item) => {
|
|
881
|
-
item.isChecked
|
|
863
|
+
this.multiOptionComponents().forEach((item) => {
|
|
864
|
+
item.isChecked.set(false);
|
|
882
865
|
});
|
|
883
866
|
const selectAllCheckbox = this.selectAllCheckbox();
|
|
884
867
|
if (selectAllCheckbox) {
|
|
@@ -889,11 +872,11 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
889
872
|
writeValues(values) {
|
|
890
873
|
if (values) {
|
|
891
874
|
const newItems = [...this._selectedItems()];
|
|
892
|
-
if (this.multiOptionComponents && this.multiOptionComponents.length > 0) {
|
|
893
|
-
this.multiOptionComponents
|
|
894
|
-
.filter((item) => values.includes(item.value) && !item.disabled)
|
|
875
|
+
if (this.multiOptionComponents() && this.multiOptionComponents().length > 0) {
|
|
876
|
+
this.multiOptionComponents()
|
|
877
|
+
.filter((item) => values.includes(item.value()) && !item.disabled())
|
|
895
878
|
.forEach((el) => {
|
|
896
|
-
el.isChecked
|
|
879
|
+
el.isChecked.set(true);
|
|
897
880
|
newItems.push(el);
|
|
898
881
|
});
|
|
899
882
|
}
|
|
@@ -924,8 +907,8 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
924
907
|
const prevSiblingCheckbox = this.getActiveOptions()[index - 1];
|
|
925
908
|
prevSiblingCheckbox.onFocus();
|
|
926
909
|
}
|
|
927
|
-
else if (!this.hasSelectAll || selectAllCheckbox.nativeElement.disabled) {
|
|
928
|
-
if (this.hasSearchBox) {
|
|
910
|
+
else if (!this.hasSelectAll() || selectAllCheckbox.nativeElement.disabled) {
|
|
911
|
+
if (this.hasSearchBox()) {
|
|
929
912
|
this.renderer.selectRootElement(this.searchInput()?.nativeElement, true).focus();
|
|
930
913
|
}
|
|
931
914
|
else {
|
|
@@ -937,10 +920,10 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
937
920
|
}
|
|
938
921
|
}
|
|
939
922
|
getActiveOptions() {
|
|
940
|
-
return this.multiOptionComponents ? this.multiOptionComponents.filter((item) => item.isActive) : [];
|
|
923
|
+
return this.multiOptionComponents() ? this.multiOptionComponents().filter((item) => item.isActive) : [];
|
|
941
924
|
}
|
|
942
925
|
getAvailableOptions() {
|
|
943
|
-
return this.multiOptionComponents ? this.multiOptionComponents.filter((item) => !item.disabled) : [];
|
|
926
|
+
return this.multiOptionComponents() ? this.multiOptionComponents().filter((item) => !item.disabled()) : [];
|
|
944
927
|
}
|
|
945
928
|
getOptionIndexByIdFromActiveOptions(id) {
|
|
946
929
|
return this.getActiveOptions().findIndex((option) => option.id === id);
|
|
@@ -949,10 +932,10 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
949
932
|
return crypto.randomUUID();
|
|
950
933
|
}
|
|
951
934
|
getDropdownId() {
|
|
952
|
-
return this.id !== '' ? `${this.id}-dropdown` : crypto.randomUUID();
|
|
935
|
+
return this.id() !== '' ? `${this.id()}-dropdown` : crypto.randomUUID();
|
|
953
936
|
}
|
|
954
937
|
getToggleId() {
|
|
955
|
-
return this.id !== '' ? `${this.id}-toggle` : crypto.randomUUID();
|
|
938
|
+
return this.id() !== '' ? `${this.id()}-toggle` : crypto.randomUUID();
|
|
956
939
|
}
|
|
957
940
|
modifyParentLabelForAttribute() {
|
|
958
941
|
const form = this.renderer.parentNode(this.elRef.nativeElement);
|
|
@@ -962,13 +945,13 @@ class EclMultiselectDropdownComponent extends ECLBaseDirective {
|
|
|
962
945
|
}
|
|
963
946
|
}
|
|
964
947
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: EclMultiselectDropdownComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
965
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.2", type: EclMultiselectDropdownComponent, isStandalone: true, selector: "div[eclMultiselectDropdown]",
|
|
948
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.2", type: EclMultiselectDropdownComponent, isStandalone: true, selector: "div[eclMultiselectDropdown]", outputs: { eclChange: "eclChange" }, host: { listeners: { "keyup.escape": "onEscapeKey()", "document:click": "onKeyUp($event)" }, properties: { "class": "cssClasses", "attr.disabled": "disabled() || undefined" } }, providers: [
|
|
966
949
|
{
|
|
967
950
|
provide: NG_VALUE_ACCESSOR,
|
|
968
951
|
useExisting: forwardRef(() => EclMultiselectDropdownComponent),
|
|
969
952
|
multi: true,
|
|
970
953
|
},
|
|
971
|
-
], viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "eclMultiselectInput", first: true, predicate: ["eclMultiselectInput"], descendants: true, isSignal: true }, { propertyName: "selectAllCheckbox", first: true, predicate: ["selectAllCheckbox"], descendants: true, isSignal: true }, { propertyName: "closeBtn", first: true, predicate: ["closeBtn"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "clearAllBtn", first: true, predicate: ["clearAllBtn"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "multiOptionComponents", predicate: EclMultiselectOptionComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div eclMultiselectInput #eclMultiselectInput [inputPlaceholder]=\"mainInputPlaceholder\" [
|
|
954
|
+
], viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "eclMultiselectInput", first: true, predicate: ["eclMultiselectInput"], descendants: true, isSignal: true }, { propertyName: "selectAllCheckbox", first: true, predicate: ["selectAllCheckbox"], descendants: true, isSignal: true }, { propertyName: "closeBtn", first: true, predicate: ["closeBtn"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "clearAllBtn", first: true, predicate: ["clearAllBtn"], descendants: true, read: ElementRef, isSignal: true }, { propertyName: "multiOptionComponents", predicate: EclMultiselectOptionComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<div eclMultiselectInput #eclMultiselectInput [inputPlaceholder]=\"mainInputPlaceholder()\" [selectedItemsLabels]=\"selectedItemsLabels()\"\n (mainInputClick)=\"onClickMainInput($event)\" (mainInputKeydown)=\"onKeydownMainInput($event)\" [isDisabled]=\"disabled()\"\n [ariaDescribedby]=\"ariaDescribedby()\" [toggleLabel]=\"toggleLabel()\" [ariaControls]=\"dropdownId\" [isInvalid]=\"isInvalid()\"\n [isDropdownExpanded]=\"isShowMultiselectDropdown\" [eclSize]=\"eclSize()\" [toggleId]=\"toggleId\" [counterLabel]=\"counterLabel()\"></div>\n<div\n [style.display]=\"isShowMultiselectDropdown ? 'block' : 'none'\"\n class=\"ecl-select__multiple-dropdown ecl-select__container ecl-select__container--{{eclSize()}}\"\n [id]=\"dropdownId\">\n @if(hasSearchBox()) {\n <input class=\"ecl-text-input\" type=\"search\" #searchInput [placeholder]=\"searchFieldPlaceholder()\"\n (input)=\"onSearch($event.target)\" (keydown.enter)=\"onEnterSearch($event)\" [attr.aria-label]=\"searchFieldPlaceholder()\"\n (keydown.arrowup)=\"onArrowUpSearch($event)\" (keydown.arrowdown)=\"onArrowDownSearch($event)\" />\n }\n @if(hasSelectAll()) {\n <div eclCheckbox [isDisabled]=\"isSelectAllDisabled\" class=\"ecl-select__multiple-all\">\n <input eclCheckboxInput #selectAllCheckbox [id]=\"selectAllId\" type=\"checkbox\" [attr.disabled]=\"isSelectAllDisabled\"\n (click)=\"onSelectAll()\" (keydown.arrowup)=\"onArrowUpSelectAll($event)\"\n (keydown.arrowdown)=\"onArrowDownSelectAll($event)\" (keydown.enter)=\"onEnterSelectAll($event)\" />\n <label [for]=\"selectAllId\" eclCheckboxLabel> {{ 'ecl.multiselect.SELECT-ALL' | translate }} ({{ optionsCount }})\n </label>\n </div>\n }\n <div class=\"ecl-select__multiple-options\" aria-live=\"polite\">\n @for (item of multiOptionDirectives(); track item.label()) {\n @if (item.isOptGroup()) {\n <fieldset eclMultiselectOptgroup [label]=\"item.label()\">\n @for (elem of item.eclOptionItems(); track elem.label()) {\n <div\n eclMultiselectOption\n [value]=\"elem.value()\"\n [label]=\"elem.label()\"\n [disabled]=\"elem.disabled()\"\n [isChecked]=\"elem.selected()\"\n [class]=\"elem.class\"\n (optionClick)=\"onOptionSelected($event)\"\n (optionKeydown)=\"onKeydownOption($event)\"></div>\n }\n </fieldset>\n } @else if (!item.isOptGroup()) {\n <div\n eclMultiselectOption\n [value]=\"item.value()\"\n [label]=\"item.label()\"\n [disabled]=\"item.disabled()\"\n [isChecked]=\"item.selected()\"\n [class]=\"item.class\"\n (optionClick)=\"onOptionSelected($event)\"\n (optionKeydown)=\"onKeydownOption($event)\"></div>\n }\n }\n\n\n @if (isShowNoResultsFound) {\n <div class=\"ecl-select__multiple-no-results\">\n <span>{{ 'ecl.multiselect.NO-RESULTS-FOUND' | translate }}</span>\n </div>\n }\n\n </div>\n @if (isShowToolbar()) {\n <div class=\"ecl-select-multiple-toolbar\">\n <button\n eclButton\n variant=\"primary\"\n #closeBtn\n [type]=\"isSubmitOnApply() ? 'submit' : 'button'\"\n (keydown.arrowup)=\"onArrowUpClose($event)\"\n (keydown.arrowDown)=\"onArrowDownClose($event)\"\n (keydown.tab)=\"onTabClose($event)\"\n (click)=\"onClickClose($event)\">\n {{ 'ecl.common.APPLY' | translate }}\n </button>\n <button\n eclButton\n variant=\"tertiary\"\n #clearAllBtn\n (keydown.arrowup)=\"onArrowUpClear($event)\"\n (keydown.arrowDown)=\"onArrowDownClear($event)\"\n (keydown.tab)=\"onTabClear($event)\"\n (keydown.enter)=\"onEnterClear($event)\"\n (click)=\"onClickClearAll($event)\">\n {{ 'ecl.multiselect.CLEAR-ALL' | translate }}\n </button>\n </div>\n }\n</div>\n", dependencies: [{ kind: "component", type: i1.EclButtonComponent, selector: "button[eclButton], button[ecl-button], a[eclButton]", inputs: ["isIconOnly", "variant", "eclStyle", "size", "containerStyleClass"] }, { kind: "component", type: EclMultiselectOptionComponent, selector: "div[eclMultiselectOption]", inputs: ["value", "label", "disabled", "isChecked"], outputs: ["isCheckedChange", "optionClick", "optionKeydown"] }, { kind: "component", type: EclMultiselectOptgroupComponent, selector: "fieldset[eclMultiselectOptgroup]", inputs: ["label"] }, { kind: "component", type: EclMultiselectInputComponent, selector: "div[eclMultiselectInput]", inputs: ["eclSize", "counterLabel", "toggleId", "toggleLabel", "isDisabled", "isInvalid", "inputPlaceholder", "selectedItemsLabels", "isDropdownExpanded", "ariaControls", "ariaDescribedby"], outputs: ["mainInputClick", "mainInputKeydown"] }, { kind: "component", type: i1$1.EclCheckboxLabelComponent, selector: "label[eclCheckboxLabel]", inputs: ["isInvalid", "isDisabled", "isRequired"] }, { kind: "directive", type: i1$1.EclCheckboxInputDirective, selector: "input[eclCheckboxInput]" }, { kind: "directive", type: i1$1.EclCheckboxDirective, selector: "[eclCheckbox]", inputs: ["isDisabled", "isInvalid", "isSingle"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] }); }
|
|
972
955
|
}
|
|
973
956
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: EclMultiselectDropdownComponent, decorators: [{
|
|
974
957
|
type: Component,
|
|
@@ -982,29 +965,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
|
|
|
982
965
|
multi: true,
|
|
983
966
|
},
|
|
984
967
|
], host: {
|
|
968
|
+
'[class]': 'cssClasses',
|
|
985
969
|
'(keyup.escape)': 'onEscapeKey()',
|
|
986
970
|
'(document:click)': 'onKeyUp($event)',
|
|
987
|
-
'[attr.disabled]': 'disabled || undefined',
|
|
988
|
-
}, template: "<div eclMultiselectInput #eclMultiselectInput [inputPlaceholder]=\"mainInputPlaceholder\" [
|
|
989
|
-
}], ctorParameters: () => [], propDecorators: { searchInput: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }], eclMultiselectInput: [{ type: i0.ViewChild, args: ['eclMultiselectInput', { isSignal: true }] }], selectAllCheckbox: [{ type: i0.ViewChild, args: ['selectAllCheckbox', { isSignal: true }] }], closeBtn: [{ type: i0.ViewChild, args: ['closeBtn', { ...{ read: ElementRef }, isSignal: true }] }], clearAllBtn: [{ type: i0.ViewChild, args: ['clearAllBtn', { ...{ read: ElementRef }, isSignal: true }] }], multiOptionComponents: [{
|
|
990
|
-
type: ViewChildren,
|
|
991
|
-
args: [EclMultiselectOptionComponent]
|
|
992
|
-
}], eclChange: [{
|
|
993
|
-
type: Output
|
|
994
|
-
}], isInvalid: [{
|
|
995
|
-
type: Input,
|
|
996
|
-
args: [{ transform: booleanAttribute }]
|
|
997
|
-
}], cssClasses: [{
|
|
998
|
-
type: HostBinding,
|
|
999
|
-
args: ['class']
|
|
1000
|
-
}], mainInputPlaceholder: [{
|
|
1001
|
-
type: Input
|
|
1002
|
-
}], searchFieldPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchFieldPlaceholder", required: false }] }], eclSize: [{
|
|
1003
|
-
type: Input
|
|
1004
|
-
}], disabled: [{
|
|
1005
|
-
type: Input,
|
|
1006
|
-
args: [{ transform: booleanAttribute }]
|
|
1007
|
-
}] } });
|
|
971
|
+
'[attr.disabled]': 'disabled() || undefined',
|
|
972
|
+
}, template: "<div eclMultiselectInput #eclMultiselectInput [inputPlaceholder]=\"mainInputPlaceholder()\" [selectedItemsLabels]=\"selectedItemsLabels()\"\n (mainInputClick)=\"onClickMainInput($event)\" (mainInputKeydown)=\"onKeydownMainInput($event)\" [isDisabled]=\"disabled()\"\n [ariaDescribedby]=\"ariaDescribedby()\" [toggleLabel]=\"toggleLabel()\" [ariaControls]=\"dropdownId\" [isInvalid]=\"isInvalid()\"\n [isDropdownExpanded]=\"isShowMultiselectDropdown\" [eclSize]=\"eclSize()\" [toggleId]=\"toggleId\" [counterLabel]=\"counterLabel()\"></div>\n<div\n [style.display]=\"isShowMultiselectDropdown ? 'block' : 'none'\"\n class=\"ecl-select__multiple-dropdown ecl-select__container ecl-select__container--{{eclSize()}}\"\n [id]=\"dropdownId\">\n @if(hasSearchBox()) {\n <input class=\"ecl-text-input\" type=\"search\" #searchInput [placeholder]=\"searchFieldPlaceholder()\"\n (input)=\"onSearch($event.target)\" (keydown.enter)=\"onEnterSearch($event)\" [attr.aria-label]=\"searchFieldPlaceholder()\"\n (keydown.arrowup)=\"onArrowUpSearch($event)\" (keydown.arrowdown)=\"onArrowDownSearch($event)\" />\n }\n @if(hasSelectAll()) {\n <div eclCheckbox [isDisabled]=\"isSelectAllDisabled\" class=\"ecl-select__multiple-all\">\n <input eclCheckboxInput #selectAllCheckbox [id]=\"selectAllId\" type=\"checkbox\" [attr.disabled]=\"isSelectAllDisabled\"\n (click)=\"onSelectAll()\" (keydown.arrowup)=\"onArrowUpSelectAll($event)\"\n (keydown.arrowdown)=\"onArrowDownSelectAll($event)\" (keydown.enter)=\"onEnterSelectAll($event)\" />\n <label [for]=\"selectAllId\" eclCheckboxLabel> {{ 'ecl.multiselect.SELECT-ALL' | translate }} ({{ optionsCount }})\n </label>\n </div>\n }\n <div class=\"ecl-select__multiple-options\" aria-live=\"polite\">\n @for (item of multiOptionDirectives(); track item.label()) {\n @if (item.isOptGroup()) {\n <fieldset eclMultiselectOptgroup [label]=\"item.label()\">\n @for (elem of item.eclOptionItems(); track elem.label()) {\n <div\n eclMultiselectOption\n [value]=\"elem.value()\"\n [label]=\"elem.label()\"\n [disabled]=\"elem.disabled()\"\n [isChecked]=\"elem.selected()\"\n [class]=\"elem.class\"\n (optionClick)=\"onOptionSelected($event)\"\n (optionKeydown)=\"onKeydownOption($event)\"></div>\n }\n </fieldset>\n } @else if (!item.isOptGroup()) {\n <div\n eclMultiselectOption\n [value]=\"item.value()\"\n [label]=\"item.label()\"\n [disabled]=\"item.disabled()\"\n [isChecked]=\"item.selected()\"\n [class]=\"item.class\"\n (optionClick)=\"onOptionSelected($event)\"\n (optionKeydown)=\"onKeydownOption($event)\"></div>\n }\n }\n\n\n @if (isShowNoResultsFound) {\n <div class=\"ecl-select__multiple-no-results\">\n <span>{{ 'ecl.multiselect.NO-RESULTS-FOUND' | translate }}</span>\n </div>\n }\n\n </div>\n @if (isShowToolbar()) {\n <div class=\"ecl-select-multiple-toolbar\">\n <button\n eclButton\n variant=\"primary\"\n #closeBtn\n [type]=\"isSubmitOnApply() ? 'submit' : 'button'\"\n (keydown.arrowup)=\"onArrowUpClose($event)\"\n (keydown.arrowDown)=\"onArrowDownClose($event)\"\n (keydown.tab)=\"onTabClose($event)\"\n (click)=\"onClickClose($event)\">\n {{ 'ecl.common.APPLY' | translate }}\n </button>\n <button\n eclButton\n variant=\"tertiary\"\n #clearAllBtn\n (keydown.arrowup)=\"onArrowUpClear($event)\"\n (keydown.arrowDown)=\"onArrowDownClear($event)\"\n (keydown.tab)=\"onTabClear($event)\"\n (keydown.enter)=\"onEnterClear($event)\"\n (click)=\"onClickClearAll($event)\">\n {{ 'ecl.multiselect.CLEAR-ALL' | translate }}\n </button>\n </div>\n }\n</div>\n" }]
|
|
973
|
+
}], ctorParameters: () => [], propDecorators: { eclChange: [{ type: i0.Output, args: ["eclChange"] }], searchInput: [{ type: i0.ViewChild, args: ['searchInput', { isSignal: true }] }], eclMultiselectInput: [{ type: i0.ViewChild, args: ['eclMultiselectInput', { isSignal: true }] }], selectAllCheckbox: [{ type: i0.ViewChild, args: ['selectAllCheckbox', { isSignal: true }] }], closeBtn: [{ type: i0.ViewChild, args: ['closeBtn', { ...{ read: ElementRef }, isSignal: true }] }], clearAllBtn: [{ type: i0.ViewChild, args: ['clearAllBtn', { ...{ read: ElementRef }, isSignal: true }] }], multiOptionComponents: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => EclMultiselectOptionComponent), { isSignal: true }] }] } });
|
|
1008
974
|
|
|
1009
975
|
/**
|
|
1010
976
|
* Directive used to decorate <option> and <optgroup> elements within a multiselect.
|
|
@@ -1029,31 +995,15 @@ class EclMultiselectOptionDirective extends ECLBaseDirective {
|
|
|
1029
995
|
this.label = input(undefined, /* @ts-ignore */
|
|
1030
996
|
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1031
997
|
/**
|
|
1032
|
-
*
|
|
998
|
+
* Indicates that the option is disabled.
|
|
1033
999
|
*/
|
|
1034
|
-
this.
|
|
1035
|
-
|
|
1036
|
-
|
|
1000
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1001
|
+
/**
|
|
1002
|
+
* Indicates that the option is selected.
|
|
1003
|
+
*/
|
|
1004
|
+
this.selected = input(false, { ...(ngDevMode ? { debugName: "selected" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1037
1005
|
this.elRef = inject(ElementRef);
|
|
1038
1006
|
}
|
|
1039
|
-
/**
|
|
1040
|
-
* Indicates that the option is disabled.
|
|
1041
|
-
*/
|
|
1042
|
-
get disabled() {
|
|
1043
|
-
return this._disabled || null;
|
|
1044
|
-
}
|
|
1045
|
-
set disabled(value) {
|
|
1046
|
-
this._disabled = coerceBooleanProperty(value);
|
|
1047
|
-
}
|
|
1048
|
-
/**
|
|
1049
|
-
* Indicates that the option is selected.
|
|
1050
|
-
*/
|
|
1051
|
-
get selected() {
|
|
1052
|
-
return this._selected || null;
|
|
1053
|
-
}
|
|
1054
|
-
set selected(value) {
|
|
1055
|
-
this._selected = coerceBooleanProperty(value);
|
|
1056
|
-
}
|
|
1057
1007
|
/**
|
|
1058
1008
|
* Applies ECL checkbox styling class to the option.
|
|
1059
1009
|
*/
|
|
@@ -1067,27 +1017,19 @@ class EclMultiselectOptionDirective extends ECLBaseDirective {
|
|
|
1067
1017
|
return this.elRef.nativeElement.nodeName === 'OPTGROUP';
|
|
1068
1018
|
}
|
|
1069
1019
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: EclMultiselectOptionDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
1070
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "22.1.2", type: EclMultiselectOptionDirective, isStandalone: true, selector: "optgroup[eclMultiselectOptgroup], option[eclMultiselectOption]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal:
|
|
1020
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "22.1.2", type: EclMultiselectOptionDirective, isStandalone: true, selector: "optgroup[eclMultiselectOptgroup], option[eclMultiselectOption]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "attr.disabled": "disabled() || null", "attr.selected": "selected() || null", "class": "cssClasses" } }, queries: [{ propertyName: "eclOptionItems", predicate: i0.forwardRef(() => EclMultiselectOptionDirective), isSignal: true }], usesInheritance: true, ngImport: i0 }); }
|
|
1071
1021
|
}
|
|
1072
1022
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: EclMultiselectOptionDirective, decorators: [{
|
|
1073
1023
|
type: Directive,
|
|
1074
1024
|
args: [{
|
|
1075
1025
|
selector: 'optgroup[eclMultiselectOptgroup], option[eclMultiselectOption]',
|
|
1026
|
+
host: {
|
|
1027
|
+
'[attr.disabled]': 'disabled() || null',
|
|
1028
|
+
'[attr.selected]': 'selected() || null',
|
|
1029
|
+
'[class]': 'cssClasses',
|
|
1030
|
+
},
|
|
1076
1031
|
}]
|
|
1077
|
-
}], propDecorators: { eclOptionItems: [{ type: i0.ContentChildren, args: [forwardRef(() => EclMultiselectOptionDirective), { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], disabled: [{
|
|
1078
|
-
type: Input
|
|
1079
|
-
}, {
|
|
1080
|
-
type: HostBinding,
|
|
1081
|
-
args: ['attr.disabled']
|
|
1082
|
-
}], selected: [{
|
|
1083
|
-
type: Input
|
|
1084
|
-
}, {
|
|
1085
|
-
type: HostBinding,
|
|
1086
|
-
args: ['attr.selected']
|
|
1087
|
-
}], cssClasses: [{
|
|
1088
|
-
type: HostBinding,
|
|
1089
|
-
args: ['class']
|
|
1090
|
-
}] } });
|
|
1032
|
+
}], propDecorators: { eclOptionItems: [{ type: i0.ContentChildren, args: [forwardRef(() => EclMultiselectOptionDirective), { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }] } });
|
|
1091
1033
|
|
|
1092
1034
|
/**
|
|
1093
1035
|
* Component representing a custom multiselect input using the ECL design system.
|
|
@@ -1096,88 +1038,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
|
|
|
1096
1038
|
* Replaces the original element with a custom dropdown rendered dynamically.
|
|
1097
1039
|
*/
|
|
1098
1040
|
class EclMultiselectComponent extends ECLBaseDirective {
|
|
1099
|
-
/**
|
|
1100
|
-
* Marks the multiselect as invalid.
|
|
1101
|
-
*/
|
|
1102
|
-
get isInvalid() {
|
|
1103
|
-
return this._isInvalid;
|
|
1104
|
-
}
|
|
1105
|
-
set isInvalid(value) {
|
|
1106
|
-
this._isInvalid = value;
|
|
1107
|
-
if (this.multiselectComponent) {
|
|
1108
|
-
this.multiselectComponent.isInvalid = value;
|
|
1109
|
-
}
|
|
1110
|
-
}
|
|
1111
|
-
/**
|
|
1112
|
-
* Disables the multiselect component when set to true.
|
|
1113
|
-
*/
|
|
1114
|
-
set disabled(value) {
|
|
1115
|
-
if (this.multiselectComponent) {
|
|
1116
|
-
this.multiselectComponent.disabled = coerceBooleanProperty(value);
|
|
1117
|
-
}
|
|
1118
|
-
this._disabled = coerceBooleanProperty(value);
|
|
1119
|
-
}
|
|
1120
|
-
get disabled() {
|
|
1121
|
-
return this._disabled || undefined;
|
|
1122
|
-
}
|
|
1123
|
-
/**
|
|
1124
|
-
* CSS classes applied to the host element.
|
|
1125
|
-
*/
|
|
1126
|
-
get cssClasses() {
|
|
1127
|
-
return [super.getCssClasses('ecl-select')].join(' ').trim();
|
|
1128
|
-
}
|
|
1129
|
-
/**
|
|
1130
|
-
* Enables the search box within the dropdown.
|
|
1131
|
-
*/
|
|
1132
|
-
set hasSearchBox(value) {
|
|
1133
|
-
if (this.multiselectComponent) {
|
|
1134
|
-
this.multiselectComponent.hasSearchBox = coerceBooleanProperty(value);
|
|
1135
|
-
}
|
|
1136
|
-
this._hasSearchBox = coerceBooleanProperty(value);
|
|
1137
|
-
}
|
|
1138
|
-
/**
|
|
1139
|
-
* Displays the "Select all" option in the dropdown.
|
|
1140
|
-
*/
|
|
1141
|
-
set hasSelectAll(value) {
|
|
1142
|
-
if (this.multiselectComponent) {
|
|
1143
|
-
this.multiselectComponent.hasSelectAll = coerceBooleanProperty(value);
|
|
1144
|
-
}
|
|
1145
|
-
this._hasSelectAll = coerceBooleanProperty(value);
|
|
1146
|
-
}
|
|
1147
|
-
/**
|
|
1148
|
-
* When true, the Apply button in the dropdown acts as a submit button (type="submit").
|
|
1149
|
-
*/
|
|
1150
|
-
set isSubmitOnApply(value) {
|
|
1151
|
-
if (this.multiselectComponent) {
|
|
1152
|
-
this.multiselectComponent.isSubmitOnApply.set(coerceBooleanProperty(value));
|
|
1153
|
-
}
|
|
1154
|
-
this._isSubmitOnApply = coerceBooleanProperty(value);
|
|
1155
|
-
}
|
|
1156
|
-
/**
|
|
1157
|
-
* Placeholder text to show in the multiselect input field when no options are selected.
|
|
1158
|
-
*/
|
|
1159
|
-
set eclPlaceholder(value) {
|
|
1160
|
-
this._eclPlaceholder = value;
|
|
1161
|
-
if (this.multiselectComponent) {
|
|
1162
|
-
this.multiselectComponent.mainInputPlaceholder = value;
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
get eclPlaceholder() {
|
|
1166
|
-
return this._eclPlaceholder;
|
|
1167
|
-
}
|
|
1168
|
-
/**
|
|
1169
|
-
* Label for the selections counter, read by screen readers.
|
|
1170
|
-
* Accepts a translation key or plain text. Default: 'ecl.multiselect.SELECTED'.
|
|
1171
|
-
*/
|
|
1172
|
-
set counterLabel(value) {
|
|
1173
|
-
this._counterLabel = value;
|
|
1174
|
-
if (this.multiselectComponent) {
|
|
1175
|
-
this.multiselectComponent.counterLabel = value;
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1178
1041
|
constructor() {
|
|
1179
1042
|
super();
|
|
1180
|
-
this.injector = inject(Injector);
|
|
1181
1043
|
/**
|
|
1182
1044
|
* List of option directives projected into the component.
|
|
1183
1045
|
*/
|
|
@@ -1198,31 +1060,73 @@ class EclMultiselectComponent extends ECLBaseDirective {
|
|
|
1198
1060
|
*/
|
|
1199
1061
|
this.toggleLabel = input(undefined, /* @ts-ignore */
|
|
1200
1062
|
...(ngDevMode ? [{ debugName: "toggleLabel" }] : /* istanbul ignore next */ []));
|
|
1063
|
+
/**
|
|
1064
|
+
* Marks the multiselect as invalid.
|
|
1065
|
+
*/
|
|
1066
|
+
this.isInvalid = input(false, { ...(ngDevMode ? { debugName: "isInvalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1067
|
+
/**
|
|
1068
|
+
* Disables the multiselect component when set to true.
|
|
1069
|
+
*/
|
|
1070
|
+
this.disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1201
1071
|
/**
|
|
1202
1072
|
* Emits an array of selected option values when the selection changes.
|
|
1203
1073
|
*/
|
|
1204
1074
|
this.eclChange = output();
|
|
1075
|
+
/**
|
|
1076
|
+
* Enables the search box within the dropdown.
|
|
1077
|
+
*/
|
|
1078
|
+
this.hasSearchBox = input(true, { ...(ngDevMode ? { debugName: "hasSearchBox" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1079
|
+
/**
|
|
1080
|
+
* Displays the "Select all" option in the dropdown.
|
|
1081
|
+
*/
|
|
1082
|
+
this.hasSelectAll = input(true, { ...(ngDevMode ? { debugName: "hasSelectAll" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1083
|
+
/**
|
|
1084
|
+
* When true, the Apply button in the dropdown acts as a submit button (type="submit").
|
|
1085
|
+
*/
|
|
1086
|
+
this.isSubmitOnApply = input(false, { ...(ngDevMode ? { debugName: "isSubmitOnApply" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1087
|
+
/**
|
|
1088
|
+
* Placeholder text to show in the multiselect input field when no options are selected.
|
|
1089
|
+
*/
|
|
1090
|
+
this.eclPlaceholder = input('Select item', /* @ts-ignore */
|
|
1091
|
+
...(ngDevMode ? [{ debugName: "eclPlaceholder" }] : /* istanbul ignore next */ []));
|
|
1205
1092
|
/**
|
|
1206
1093
|
* Multiselect size: 's' | 'm' | 'l'. Default is 'm'.
|
|
1207
1094
|
*/
|
|
1208
1095
|
this.eclSize = input('m', /* @ts-ignore */
|
|
1209
1096
|
...(ngDevMode ? [{ debugName: "eclSize" }] : /* istanbul ignore next */ []));
|
|
1097
|
+
/**
|
|
1098
|
+
* Label for the selections counter, read by screen readers.
|
|
1099
|
+
* Accepts a translation key or plain text. Default: 'ecl.multiselect.SELECTED'.
|
|
1100
|
+
*/
|
|
1101
|
+
this.counterLabel = input('ecl.multiselect.SELECTED', /* @ts-ignore */
|
|
1102
|
+
...(ngDevMode ? [{ debugName: "counterLabel" }] : /* istanbul ignore next */ []));
|
|
1210
1103
|
this.SELECT_CONTAINER_CLASS = 'ecl-select__container';
|
|
1211
1104
|
this.SELECT_CONTAINER_HIDDEN_CLASS = 'ecl-select__container--hidden';
|
|
1212
|
-
this.
|
|
1213
|
-
this._hasSelectAll = true;
|
|
1214
|
-
this._hasSearchBox = true;
|
|
1215
|
-
this._isSubmitOnApply = false;
|
|
1216
|
-
this._counterLabel = 'ecl.multiselect.SELECTED';
|
|
1217
|
-
this._isInvalid = false;
|
|
1218
|
-
this._eclPlaceholder = 'Select item';
|
|
1219
|
-
this.destroy$ = new Subject();
|
|
1105
|
+
this.injector = inject(Injector);
|
|
1220
1106
|
this.el = inject(ElementRef);
|
|
1221
1107
|
this.viewContainerRef = inject(ViewContainerRef);
|
|
1222
1108
|
this.differs = inject(IterableDiffers);
|
|
1223
1109
|
this.renderer = inject(Renderer2);
|
|
1224
1110
|
this.platformId = inject(PLATFORM_ID);
|
|
1111
|
+
this.destroy$ = new Subject();
|
|
1225
1112
|
this.differ = this.differs.find([]).create();
|
|
1113
|
+
// Keep the dynamically created dropdown in sync with this component's inputs.
|
|
1114
|
+
// The dropdown is created lazily in ngOnInit, so the sync is guarded on its
|
|
1115
|
+
// instance; once created, this effect re-applies whenever any of the inputs change.
|
|
1116
|
+
effect(() => {
|
|
1117
|
+
const dropdown = this.multiselectComponent;
|
|
1118
|
+
if (!dropdown) {
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1121
|
+
dropdown.mainInputPlaceholder.set(this.eclPlaceholder());
|
|
1122
|
+
dropdown.eclSize.set(this.eclSize());
|
|
1123
|
+
dropdown.disabled.set(this.disabled());
|
|
1124
|
+
dropdown.isInvalid.set(this.isInvalid());
|
|
1125
|
+
dropdown.hasSearchBox.set(this.hasSearchBox());
|
|
1126
|
+
dropdown.hasSelectAll.set(this.hasSelectAll());
|
|
1127
|
+
dropdown.isSubmitOnApply.set(this.isSubmitOnApply());
|
|
1128
|
+
dropdown.counterLabel.set(this.counterLabel());
|
|
1129
|
+
});
|
|
1226
1130
|
afterNextRender(() => {
|
|
1227
1131
|
this.attachOptions();
|
|
1228
1132
|
if (this.hostParentEl != null) {
|
|
@@ -1252,6 +1156,12 @@ class EclMultiselectComponent extends ECLBaseDirective {
|
|
|
1252
1156
|
this.destroy$.next(true);
|
|
1253
1157
|
this.destroy$.unsubscribe();
|
|
1254
1158
|
}
|
|
1159
|
+
/**
|
|
1160
|
+
* CSS classes applied to the host element.
|
|
1161
|
+
*/
|
|
1162
|
+
get cssClasses() {
|
|
1163
|
+
return [super.getCssClasses('ecl-select')].join(' ').trim();
|
|
1164
|
+
}
|
|
1255
1165
|
hideOriginalSelectComponent() {
|
|
1256
1166
|
this.hostParentEl.replaceChild(this.hostWrapperEl, this.hostEl);
|
|
1257
1167
|
this.hostWrapperEl.appendChild(this.hostEl);
|
|
@@ -1274,33 +1184,34 @@ class EclMultiselectComponent extends ECLBaseDirective {
|
|
|
1274
1184
|
createMultiselectComponent() {
|
|
1275
1185
|
const ngControl = this.injector.get(NgControl, undefined, { optional: true });
|
|
1276
1186
|
const multiselect = this.viewContainerRef.createComponent(EclMultiselectDropdownComponent);
|
|
1277
|
-
|
|
1278
|
-
this.multiselectComponent
|
|
1187
|
+
const dropdown = multiselect.instance;
|
|
1188
|
+
this.multiselectComponent = dropdown;
|
|
1189
|
+
dropdown.eclChange.subscribe((evt) => {
|
|
1279
1190
|
this.eclChange.emit(evt);
|
|
1280
1191
|
});
|
|
1281
|
-
|
|
1192
|
+
dropdown.mainInputPlaceholder.set(this.eclPlaceholder());
|
|
1282
1193
|
const ariaDescribedby = this.ariaDescribedby();
|
|
1283
1194
|
if (ariaDescribedby !== undefined) {
|
|
1284
|
-
|
|
1195
|
+
dropdown.ariaDescribedby.set(ariaDescribedby);
|
|
1285
1196
|
}
|
|
1286
1197
|
const toggleLabel = this.toggleLabel();
|
|
1287
1198
|
if (toggleLabel !== undefined) {
|
|
1288
|
-
|
|
1199
|
+
dropdown.toggleLabel.set(toggleLabel);
|
|
1289
1200
|
}
|
|
1290
1201
|
const id = this.id();
|
|
1291
1202
|
if (id !== undefined) {
|
|
1292
|
-
|
|
1203
|
+
dropdown.id.set(id);
|
|
1293
1204
|
}
|
|
1294
|
-
|
|
1205
|
+
dropdown.eclSize.set(this.eclSize());
|
|
1295
1206
|
if (ngControl) {
|
|
1296
|
-
ngControl.valueAccessor =
|
|
1207
|
+
ngControl.valueAccessor = dropdown;
|
|
1297
1208
|
}
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1209
|
+
dropdown.disabled.set(this.disabled());
|
|
1210
|
+
dropdown.isInvalid.set(this.isInvalid());
|
|
1211
|
+
dropdown.hasSearchBox.set(this.hasSearchBox());
|
|
1212
|
+
dropdown.hasSelectAll.set(this.hasSelectAll());
|
|
1213
|
+
dropdown.isSubmitOnApply.set(this.isSubmitOnApply());
|
|
1214
|
+
dropdown.counterLabel.set(this.counterLabel());
|
|
1304
1215
|
return multiselect.location.nativeElement;
|
|
1305
1216
|
}
|
|
1306
1217
|
setAriaLabelledBy() {
|
|
@@ -1328,7 +1239,7 @@ class EclMultiselectComponent extends ECLBaseDirective {
|
|
|
1328
1239
|
});
|
|
1329
1240
|
}
|
|
1330
1241
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.2", ngImport: i0, type: EclMultiselectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
1331
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.2", type: EclMultiselectComponent, isStandalone: true, selector: "select[eclMultiselect]", inputs: { ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "ariaDescribedby", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, toggleLabel: { classPropertyName: "toggleLabel", publicName: "toggleLabel", isSignal: true, isRequired: false, transformFunction: null }, isInvalid: { classPropertyName: "isInvalid", publicName: "isInvalid", isSignal:
|
|
1242
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.2", type: EclMultiselectComponent, isStandalone: true, selector: "select[eclMultiselect]", inputs: { ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "ariaDescribedby", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, toggleLabel: { classPropertyName: "toggleLabel", publicName: "toggleLabel", isSignal: true, isRequired: false, transformFunction: null }, isInvalid: { classPropertyName: "isInvalid", publicName: "isInvalid", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, hasSearchBox: { classPropertyName: "hasSearchBox", publicName: "hasSearchBox", isSignal: true, isRequired: false, transformFunction: null }, hasSelectAll: { classPropertyName: "hasSelectAll", publicName: "hasSelectAll", isSignal: true, isRequired: false, transformFunction: null }, isSubmitOnApply: { classPropertyName: "isSubmitOnApply", publicName: "isSubmitOnApply", isSignal: true, isRequired: false, transformFunction: null }, eclPlaceholder: { classPropertyName: "eclPlaceholder", publicName: "eclPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, eclSize: { classPropertyName: "eclSize", publicName: "eclSize", isSignal: true, isRequired: false, transformFunction: null }, counterLabel: { classPropertyName: "counterLabel", publicName: "counterLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { eclChange: "eclChange" }, host: { properties: { "class": "cssClasses", "attr.disabled": "disabled() || null" } }, providers: [
|
|
1332
1243
|
{
|
|
1333
1244
|
provide: NG_VALUE_ACCESSOR,
|
|
1334
1245
|
useExisting: forwardRef(() => EclMultiselectComponent),
|
|
@@ -1344,32 +1255,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.2", ngImpor
|
|
|
1344
1255
|
useExisting: forwardRef(() => EclMultiselectComponent),
|
|
1345
1256
|
multi: true,
|
|
1346
1257
|
},
|
|
1347
|
-
],
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
type: Input
|
|
1353
|
-
}, {
|
|
1354
|
-
type: HostBinding,
|
|
1355
|
-
args: ['attr.disabled']
|
|
1356
|
-
}], cssClasses: [{
|
|
1357
|
-
type: HostBinding,
|
|
1358
|
-
args: ['class']
|
|
1359
|
-
}], eclChange: [{ type: i0.Output, args: ["eclChange"] }], hasSearchBox: [{
|
|
1360
|
-
type: Input,
|
|
1361
|
-
args: [{ transform: booleanAttribute }]
|
|
1362
|
-
}], hasSelectAll: [{
|
|
1363
|
-
type: Input,
|
|
1364
|
-
args: [{ transform: booleanAttribute }]
|
|
1365
|
-
}], isSubmitOnApply: [{
|
|
1366
|
-
type: Input,
|
|
1367
|
-
args: [{ transform: booleanAttribute }]
|
|
1368
|
-
}], eclPlaceholder: [{
|
|
1369
|
-
type: Input
|
|
1370
|
-
}], eclSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "eclSize", required: false }] }], counterLabel: [{
|
|
1371
|
-
type: Input
|
|
1372
|
-
}] } });
|
|
1258
|
+
], host: {
|
|
1259
|
+
'[class]': 'cssClasses',
|
|
1260
|
+
'[attr.disabled]': 'disabled() || null',
|
|
1261
|
+
}, template: "<ng-content></ng-content>\n" }]
|
|
1262
|
+
}], ctorParameters: () => [], propDecorators: { eclOptionItems: [{ type: i0.ContentChildren, args: [forwardRef(() => EclMultiselectOptionDirective), { isSignal: true }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedby", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], toggleLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "toggleLabel", required: false }] }], isInvalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "isInvalid", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], eclChange: [{ type: i0.Output, args: ["eclChange"] }], hasSearchBox: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasSearchBox", required: false }] }], hasSelectAll: [{ type: i0.Input, args: [{ isSignal: true, alias: "hasSelectAll", required: false }] }], isSubmitOnApply: [{ type: i0.Input, args: [{ isSignal: true, alias: "isSubmitOnApply", required: false }] }], eclPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "eclPlaceholder", required: false }] }], eclSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "eclSize", required: false }] }], counterLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "counterLabel", required: false }] }] } });
|
|
1373
1263
|
|
|
1374
1264
|
const EUI_ECL_MULTISELECT = [
|
|
1375
1265
|
EclMultiselectComponent,
|