@lucca-front/ng 16.3.1-rc.2 → 16.4.0-rc.1
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/api/select/feeder/api-feeder.component.d.ts +2 -2
- package/api/select/feeder/api-feeder.model.d.ts +2 -2
- package/api/select/input/api-select-input.component.d.ts +1 -1
- package/api/select/pager/api-pager.component.d.ts +1 -1
- package/api/select/pager/api-pager.model.d.ts +3 -3
- package/api/select/searcher/api-searcher.component.d.ts +2 -2
- package/api/select/searcher/api-searcher.model.d.ts +2 -2
- package/api/service/api-hybrid.service.d.ts +5 -5
- package/api/service/api-service.model.d.ts +8 -8
- package/api/service/api-v3.service.d.ts +7 -7
- package/api/service/api-v4.service.d.ts +7 -7
- package/callout/callout.component.d.ts +2 -1
- package/core/public-api.d.ts +1 -0
- package/core/tools/ng-clazz.directive.d.ts +6 -0
- package/{simple-select/option → core-select/displayer}/displayer.directive.d.ts +2 -2
- package/core-select/displayer/index.d.ts +1 -0
- package/core-select/index.d.ts +5 -0
- package/core-select/input/index.d.ts +2 -0
- package/core-select/input/select-input.component.d.ts +59 -0
- package/{simple-select → core-select}/option/index.d.ts +2 -1
- package/{simple-select → core-select}/option/option.component.d.ts +2 -1
- package/{simple-select → core-select}/option/option.directive.d.ts +2 -2
- package/core-select/panel/index.d.ts +1 -0
- package/{simple-select → core-select}/panel/panel.models.d.ts +4 -4
- package/core-select/public-api.d.ts +5 -0
- package/core-select/select.model.d.ts +7 -0
- package/department/select/feeder/department-feeder.component.d.ts +2 -2
- package/department/select/input/department-select-input.component.d.ts +2 -2
- package/department/service/department-v3.service.d.ts +2 -2
- package/esm2022/api/select/feeder/api-feeder.component.mjs +1 -1
- package/esm2022/api/select/feeder/api-feeder.model.mjs +1 -1
- package/esm2022/api/select/input/api-select-input.component.mjs +3 -3
- package/esm2022/api/select/pager/api-pager.component.mjs +1 -1
- package/esm2022/api/select/pager/api-pager.model.mjs +1 -1
- package/esm2022/api/select/searcher/api-searcher.component.mjs +1 -1
- package/esm2022/api/select/searcher/api-searcher.model.mjs +1 -1
- package/esm2022/api/service/api-hybrid.service.mjs +1 -1
- package/esm2022/api/service/api-service.model.mjs +1 -1
- package/esm2022/api/service/api-v3.service.mjs +1 -1
- package/esm2022/api/service/api-v4.service.mjs +1 -1
- package/esm2022/callout/callout.component.mjs +3 -3
- package/esm2022/core/public-api.mjs +2 -1
- package/esm2022/core/tools/ng-clazz.directive.mjs +18 -0
- package/esm2022/{simple-select/option → core-select/displayer}/displayer.directive.mjs +1 -1
- package/esm2022/core-select/displayer/index.mjs +2 -0
- package/esm2022/core-select/input/index.mjs +3 -0
- package/esm2022/core-select/input/select-input.component.mjs +203 -0
- package/esm2022/core-select/input/select-input.models.mjs +60 -0
- package/esm2022/core-select/lucca-front-ng-core-select.mjs +5 -0
- package/esm2022/{simple-select → core-select}/option/default-option.component.mjs +1 -1
- package/esm2022/core-select/option/disabled.directive.mjs +27 -0
- package/esm2022/core-select/option/index.mjs +7 -0
- package/esm2022/core-select/option/option-outlet.directive.mjs +71 -0
- package/esm2022/core-select/option/option.component.mjs +81 -0
- package/esm2022/core-select/option/option.directive.mjs +27 -0
- package/esm2022/core-select/option/option.token.mjs +22 -0
- package/esm2022/core-select/panel/index.mjs +2 -0
- package/esm2022/core-select/panel/panel.models.mjs +23 -0
- package/esm2022/core-select/public-api.mjs +6 -0
- package/esm2022/core-select/select.model.mjs +5 -0
- package/esm2022/date/input/date-input.translate.mjs +21 -21
- package/esm2022/date/select/date-select-input.component.mjs +3 -3
- package/esm2022/date/select/date-select-input.translate.mjs +16 -16
- package/esm2022/department/select/feeder/department-feeder.component.mjs +1 -1
- package/esm2022/department/select/input/department-select-input.component.mjs +3 -3
- package/esm2022/department/service/department-v3.service.mjs +1 -1
- package/esm2022/establishment/select/input/establishment-select-input.component.mjs +3 -3
- package/esm2022/establishment/select/legal-unit-selector/legal-unit-selector.directive.mjs +1 -1
- package/esm2022/establishment/select/searcher/establishment-searcher.component.mjs +1 -1
- package/esm2022/establishment/select/select-all/establishment-select-all.component.mjs +1 -1
- package/esm2022/establishment/service/establishment.service.mjs +1 -1
- package/esm2022/establishment/service/legal-unit.service.mjs +1 -1
- package/esm2022/form-field/form-field-size.mjs +2 -0
- package/esm2022/form-field/form-field.component.mjs +116 -0
- package/esm2022/form-field/input.directive.mjs +22 -0
- package/esm2022/form-field/lucca-front-ng-form-field.mjs +5 -0
- package/esm2022/form-field/public-api.mjs +4 -0
- package/esm2022/formly/types/api.mjs +1 -1
- package/esm2022/forms/abstract-field-component.mjs +25 -0
- package/esm2022/forms/checkboxfield/checkboxfield.component.mjs +41 -0
- package/esm2022/forms/form-field-id.directive.mjs +53 -0
- package/esm2022/forms/inject-ng-control.mjs +25 -0
- package/esm2022/forms/lucca-front-ng-forms.mjs +5 -0
- package/esm2022/forms/noop-value-accessor.directive.mjs +36 -0
- package/esm2022/forms/public-api.mjs +8 -0
- package/esm2022/forms/switchfield/switchfield.component.mjs +40 -0
- package/esm2022/forms/textfield/textfield-addon.mjs +2 -0
- package/esm2022/forms/textfield/textfield.component.mjs +73 -0
- package/esm2022/forms/textfield/textfield.translate.mjs +13 -0
- package/esm2022/icon/icon.component.mjs +27 -0
- package/esm2022/icon/lucca-front-ng-icon.mjs +5 -0
- package/esm2022/icon/public-api.mjs +2 -0
- package/esm2022/inline-message/inline-message-state.mjs +2 -0
- package/esm2022/inline-message/inline-message.component.mjs +15 -4
- package/esm2022/inline-message/public-api.mjs +2 -1
- package/esm2022/input/displayer/input-displayer.directive.mjs +1 -1
- package/esm2022/input/displayer/input-displayer.model.mjs +1 -1
- package/esm2022/multi-select/displayer/default-displayer.component.mjs +155 -0
- package/esm2022/multi-select/displayer/default-displayer.translate.mjs +32 -0
- package/esm2022/multi-select/displayer/displayer.directive.mjs +27 -0
- package/esm2022/multi-select/displayer/index.mjs +3 -0
- package/esm2022/multi-select/input/index.mjs +2 -0
- package/esm2022/multi-select/input/panel-ref.factory.mjs +121 -0
- package/esm2022/multi-select/input/panel.model.mjs +13 -0
- package/esm2022/multi-select/input/select-input.component.mjs +106 -0
- package/esm2022/multi-select/lucca-front-ng-multi-select.mjs +5 -0
- package/esm2022/multi-select/panel/index.mjs +2 -0
- package/esm2022/multi-select/panel/option-selected.pipe.mjs +18 -0
- package/esm2022/multi-select/panel/panel.component.mjs +146 -0
- package/esm2022/multi-select/panel/selected-chip.directive.mjs +27 -0
- package/esm2022/multi-select/public-api.mjs +4 -0
- package/esm2022/multi-select/select.model.mjs +3 -0
- package/esm2022/multi-select/select.translate.mjs +62 -0
- package/esm2022/option/item/option-item.component.mjs +3 -3
- package/esm2022/option/item/tree-option-item.component.mjs +3 -3
- package/esm2022/option/operator/feeder/option-feeder.component.mjs +1 -1
- package/esm2022/option/operator/for-options/for-options.directive.mjs +1 -1
- package/esm2022/option/operator/option-operator.model.mjs +1 -1
- package/esm2022/option/operator/pager/tree-option-pager.component.mjs +1 -1
- package/esm2022/option/picker/option-picker-advanced.component.mjs +1 -1
- package/esm2022/option/picker/option-picker.model.mjs +1 -1
- package/esm2022/option/picker/tree-option-picker-advanced.component.mjs +1 -1
- package/esm2022/option/picker/tree-option-picker.component.mjs +1 -1
- package/esm2022/option/selector/all/select-all.component.mjs +1 -1
- package/esm2022/option/selector/all/tree-select-all.component.mjs +1 -1
- package/esm2022/option/selector/option-selector.model.mjs +1 -1
- package/esm2022/picker/input-picker.model.mjs +1 -1
- package/esm2022/popover/panel/popover-panel.model.mjs +1 -1
- package/esm2022/qualification/select/input/qualification-select-input.component.mjs +3 -3
- package/esm2022/select/input/select-input.component.mjs +2 -2
- package/esm2022/select/input/select-input.model.mjs +1 -1
- package/esm2022/simple-select/api/api-v3.directive.mjs +3 -3
- package/esm2022/simple-select/api/api-v4.directive.mjs +3 -3
- package/esm2022/simple-select/api/api.directive.mjs +3 -3
- package/esm2022/simple-select/input/panel-ref.factory.mjs +5 -4
- package/esm2022/simple-select/input/select-input.component.mjs +26 -189
- package/esm2022/simple-select/panel/index.mjs +1 -2
- package/esm2022/simple-select/panel/panel.component.mjs +6 -7
- package/esm2022/simple-select/public-api.mjs +1 -2
- package/esm2022/simple-select/select.model.mjs +2 -5
- package/esm2022/user/select/homonyms/user-homonyms.service.mjs +1 -1
- package/esm2022/user/select/input/user-select-input.component.mjs +3 -3
- package/esm2022/user/select/me/me-option.directive.mjs +1 -1
- package/esm2022/user/select/searcher/user-searcher.component.mjs +1 -1
- package/esm2022/user/service/user-v3.service.mjs +1 -1
- package/establishment/select/input/establishment-select-input.component.d.ts +2 -2
- package/establishment/select/legal-unit-selector/legal-unit-selector.directive.d.ts +2 -2
- package/establishment/select/searcher/establishment-searcher.component.d.ts +2 -2
- package/establishment/select/select-all/establishment-select-all.component.d.ts +2 -2
- package/establishment/service/establishment.service.d.ts +4 -4
- package/establishment/service/legal-unit.service.d.ts +4 -4
- package/fesm2022/lucca-front-ng-api.mjs +2 -2
- package/fesm2022/lucca-front-ng-api.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-callout.mjs +2 -2
- package/fesm2022/lucca-front-ng-callout.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-core-select.mjs +537 -0
- package/fesm2022/lucca-front-ng-core-select.mjs.map +1 -0
- package/fesm2022/lucca-front-ng-core.mjs +17 -3
- package/fesm2022/lucca-front-ng-core.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-date.mjs +37 -37
- package/fesm2022/lucca-front-ng-date.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-department.mjs +2 -2
- package/fesm2022/lucca-front-ng-department.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-establishment.mjs +2 -2
- package/fesm2022/lucca-front-ng-establishment.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-form-field.mjs +140 -0
- package/fesm2022/lucca-front-ng-form-field.mjs.map +1 -0
- package/fesm2022/lucca-front-ng-formly.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-forms.mjs +271 -0
- package/fesm2022/lucca-front-ng-forms.mjs.map +1 -0
- package/fesm2022/lucca-front-ng-icon.mjs +33 -0
- package/fesm2022/lucca-front-ng-icon.mjs.map +1 -0
- package/fesm2022/lucca-front-ng-inline-message.mjs +14 -3
- package/fesm2022/lucca-front-ng-inline-message.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-input.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-multi-select.mjs +669 -0
- package/fesm2022/lucca-front-ng-multi-select.mjs.map +1 -0
- package/fesm2022/lucca-front-ng-option.mjs +4 -4
- package/fesm2022/lucca-front-ng-option.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-picker.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-popover.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-qualification.mjs +2 -2
- package/fesm2022/lucca-front-ng-qualification.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-select.mjs +2 -2
- package/fesm2022/lucca-front-ng-select.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-simple-select-api.mjs +6 -6
- package/fesm2022/lucca-front-ng-simple-select-api.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-simple-select.mjs +34 -517
- package/fesm2022/lucca-front-ng-simple-select.mjs.map +1 -1
- package/fesm2022/lucca-front-ng-user.mjs +2 -2
- package/fesm2022/lucca-front-ng-user.mjs.map +1 -1
- package/form-field/form-field-size.d.ts +1 -0
- package/form-field/form-field.component.d.ts +39 -0
- package/form-field/index.d.ts +5 -0
- package/form-field/input.directive.d.ts +8 -0
- package/form-field/public-api.d.ts +3 -0
- package/formly/types/api.d.ts +1 -1
- package/forms/abstract-field-component.d.ts +8 -0
- package/forms/checkboxfield/checkboxfield.component.d.ts +18 -0
- package/forms/form-field-id.directive.d.ts +13 -0
- package/forms/index.d.ts +5 -0
- package/forms/inject-ng-control.d.ts +2 -0
- package/forms/noop-value-accessor.directive.d.ts +9 -0
- package/forms/public-api.d.ts +7 -0
- package/forms/switchfield/switchfield.component.d.ts +18 -0
- package/forms/textfield/textfield-addon.d.ts +10 -0
- package/forms/textfield/textfield.component.d.ts +35 -0
- package/forms/textfield/textfield.translate.d.ts +7 -0
- package/icon/icon.component.d.ts +10 -0
- package/icon/index.d.ts +5 -0
- package/icon/public-api.d.ts +1 -0
- package/inline-message/inline-message-state.d.ts +1 -0
- package/inline-message/inline-message.component.d.ts +8 -3
- package/inline-message/public-api.d.ts +1 -0
- package/input/displayer/input-displayer.directive.d.ts +3 -3
- package/input/displayer/input-displayer.model.d.ts +2 -2
- package/multi-select/displayer/default-displayer.component.d.ts +32 -0
- package/multi-select/displayer/default-displayer.translate.d.ts +9 -0
- package/multi-select/displayer/displayer.directive.d.ts +12 -0
- package/multi-select/displayer/index.d.ts +2 -0
- package/multi-select/index.d.ts +5 -0
- package/multi-select/input/index.d.ts +1 -0
- package/multi-select/input/panel-ref.factory.d.ts +22 -0
- package/multi-select/input/panel.model.d.ts +11 -0
- package/multi-select/input/select-input.component.d.ts +26 -0
- package/multi-select/panel/index.d.ts +1 -0
- package/multi-select/panel/option-selected.pipe.d.ts +7 -0
- package/multi-select/panel/panel.component.d.ts +40 -0
- package/multi-select/panel/selected-chip.directive.d.ts +10 -0
- package/multi-select/public-api.d.ts +3 -0
- package/multi-select/select.model.d.ts +15 -0
- package/multi-select/select.translate.d.ts +15 -0
- package/option/operator/feeder/option-feeder.component.d.ts +2 -2
- package/option/operator/for-options/for-options.directive.d.ts +1 -1
- package/option/operator/option-operator.model.d.ts +2 -2
- package/option/operator/pager/tree-option-pager.component.d.ts +2 -2
- package/option/picker/option-picker-advanced.component.d.ts +1 -1
- package/option/picker/option-picker.model.d.ts +5 -5
- package/option/picker/tree-option-picker-advanced.component.d.ts +1 -1
- package/option/picker/tree-option-picker.component.d.ts +2 -2
- package/option/selector/all/select-all.component.d.ts +1 -1
- package/option/selector/all/tree-select-all.component.d.ts +3 -3
- package/option/selector/option-selector.model.d.ts +4 -4
- package/package.json +49 -19
- package/picker/input-picker.model.d.ts +4 -4
- package/popover/panel/popover-panel.model.d.ts +3 -3
- package/qualification/select/input/qualification-select-input.component.d.ts +1 -1
- package/schematics/lib/scss-ast.js +4 -4
- package/select/input/select-input.model.d.ts +8 -8
- package/simple-select/api/api-v3.directive.d.ts +1 -1
- package/simple-select/api/api-v4.directive.d.ts +1 -1
- package/simple-select/api/api.directive.d.ts +2 -2
- package/simple-select/input/panel-ref.factory.d.ts +3 -3
- package/simple-select/input/select-input.component.d.ts +5 -51
- package/simple-select/panel/index.d.ts +0 -1
- package/simple-select/panel/panel.component.d.ts +6 -7
- package/simple-select/public-api.d.ts +0 -1
- package/simple-select/select.model.d.ts +4 -9
- package/src/components/_popup.scss +1 -8
- package/src/definitions/option/_option-item.scss +5 -1
- package/src/definitions/select/_select-input.scss +18 -17
- package/user/select/input/user-select-input.component.d.ts +2 -2
- package/user/select/me/me-option.directive.d.ts +2 -2
- package/user/select/searcher/user-searcher.component.d.ts +2 -2
- package/user/service/user-v3.service.d.ts +2 -2
- package/esm2022/simple-select/input/select-input.models.mjs +0 -60
- package/esm2022/simple-select/option/disabled.directive.mjs +0 -27
- package/esm2022/simple-select/option/index.mjs +0 -6
- package/esm2022/simple-select/option/option-outlet.directive.mjs +0 -71
- package/esm2022/simple-select/option/option.component.mjs +0 -78
- package/esm2022/simple-select/option/option.directive.mjs +0 -27
- package/esm2022/simple-select/option/option.token.mjs +0 -22
- package/esm2022/simple-select/panel/panel.models.mjs +0 -23
- /package/{simple-select → core-select}/input/select-input.models.d.ts +0 -0
- /package/{simple-select → core-select}/option/default-option.component.d.ts +0 -0
- /package/{simple-select → core-select}/option/disabled.directive.d.ts +0 -0
- /package/{simple-select → core-select}/option/option-outlet.directive.d.ts +0 -0
- /package/{simple-select → core-select}/option/option.token.d.ts +0 -0
|
@@ -0,0 +1,669 @@
|
|
|
1
|
+
import * as i1$1 from '@angular/common';
|
|
2
|
+
import { AsyncPipe, NgIf, NgFor, NgTemplateOutlet, CommonModule, NgPlural, NgPluralCase } from '@angular/common';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { InjectionToken, EventEmitter, Pipe, inject, ElementRef, Directive, Input, Component, ChangeDetectionStrategy, ViewChild, ViewChildren, HostListener, Injector, ChangeDetectorRef, Injectable, forwardRef, HostBinding, DestroyRef, NgZone } from '@angular/core';
|
|
5
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
|
+
import { getIntl } from '@lucca-front/ng/core';
|
|
7
|
+
import { LuSelectPanelRef, SELECT_ID, ɵLuOptionComponent, ɵLuOptionOutletDirective, ALuSelectInputComponent, provideLuSelectOverlayContainer, provideLuSelectLabelsAndIds, LU_OPTION_CONTEXT } from '@lucca-front/ng/core-select';
|
|
8
|
+
import { LuTooltipModule } from '@lucca-front/ng/tooltip';
|
|
9
|
+
import { observeOn, asyncScheduler, map, filter, take, takeUntil, ReplaySubject, Observable, distinctUntilChanged, concatMap, startWith, combineLatest, debounceTime } from 'rxjs';
|
|
10
|
+
import * as i2 from '@angular/forms';
|
|
11
|
+
import { FormsModule, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
12
|
+
import { Overlay, OverlayPositionBuilder, ScrollStrategyOptions } from '@angular/cdk/overlay';
|
|
13
|
+
import { ComponentPortal } from '@angular/cdk/portal';
|
|
14
|
+
import * as i1 from '@angular/cdk/a11y';
|
|
15
|
+
import { ActiveDescendantKeyManager, A11yModule } from '@angular/cdk/a11y';
|
|
16
|
+
|
|
17
|
+
const LU_MULTI_SELECT_TRANSLATIONS = new InjectionToken('LuMultiSelectTranslations', {
|
|
18
|
+
factory: () => luMultiSelectTranslations,
|
|
19
|
+
});
|
|
20
|
+
const luMultiSelectTranslations = {
|
|
21
|
+
en: {
|
|
22
|
+
placeholder: 'Select an option',
|
|
23
|
+
search: 'Search',
|
|
24
|
+
clear: 'Clear selection',
|
|
25
|
+
clearSearch: 'Clear search',
|
|
26
|
+
emptyResults: 'No results',
|
|
27
|
+
emptySelection: 'Select items in the left list to start',
|
|
28
|
+
expand: 'Expand',
|
|
29
|
+
reduce: 'Reduce',
|
|
30
|
+
selectAll: 'Select all',
|
|
31
|
+
},
|
|
32
|
+
fr: {
|
|
33
|
+
placeholder: 'Sélectionnez une option',
|
|
34
|
+
search: 'Rechercher',
|
|
35
|
+
clear: 'Vider la sélection',
|
|
36
|
+
clearSearch: 'Vider la recherche',
|
|
37
|
+
emptySelection: 'Sélectionnez les éléments dans la liste de gauche pour commencer',
|
|
38
|
+
emptyResults: 'Aucun résultat pour votre recherche',
|
|
39
|
+
expand: 'Étendre',
|
|
40
|
+
reduce: 'Réduire',
|
|
41
|
+
selectAll: 'Tout sélectionner',
|
|
42
|
+
},
|
|
43
|
+
de: {
|
|
44
|
+
placeholder: 'Wählen Sie eine Option',
|
|
45
|
+
search: 'Suche',
|
|
46
|
+
clear: 'Auswahl löschen',
|
|
47
|
+
clearSearch: 'Suche löschen',
|
|
48
|
+
emptyResults: 'Keine Ergebnisse für Ihre Suche',
|
|
49
|
+
emptySelection: 'Wählen Sie Elemente in der linken Liste aus, um zu beginnen',
|
|
50
|
+
expand: 'Erweitern',
|
|
51
|
+
reduce: 'Reduzieren',
|
|
52
|
+
selectAll: 'Alles auswählen',
|
|
53
|
+
},
|
|
54
|
+
es: {
|
|
55
|
+
placeholder: 'Seleccione una opción',
|
|
56
|
+
search: 'Buscar',
|
|
57
|
+
clear: 'Borrar selección',
|
|
58
|
+
clearSearch: 'Borrar búsqueda',
|
|
59
|
+
emptyResults: 'No hay resultados para su búsqueda',
|
|
60
|
+
emptySelection: 'Seleccione elementos en la lista de la izquierda para comenzar',
|
|
61
|
+
expand: 'Expandir',
|
|
62
|
+
reduce: 'Reducir',
|
|
63
|
+
selectAll: 'Seleccionar todo',
|
|
64
|
+
},
|
|
65
|
+
pt: {
|
|
66
|
+
placeholder: 'Selecione uma opção',
|
|
67
|
+
search: 'Pesquisar',
|
|
68
|
+
clear: 'Limpar seleção',
|
|
69
|
+
clearSearch: 'Limpar pesquisa',
|
|
70
|
+
emptyResults: 'Nenhum resultado para sua pesquisa',
|
|
71
|
+
emptySelection: 'Selecione itens na lista à esquerda para começar',
|
|
72
|
+
expand: 'Expandir',
|
|
73
|
+
reduce: 'Reduzir',
|
|
74
|
+
selectAll: 'Selecionar tudo',
|
|
75
|
+
},
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
class LuMultiSelectPanelRef extends LuSelectPanelRef {
|
|
79
|
+
constructor() {
|
|
80
|
+
super(...arguments);
|
|
81
|
+
this.selectAll = new EventEmitter();
|
|
82
|
+
}
|
|
83
|
+
close() {
|
|
84
|
+
super.close();
|
|
85
|
+
this.selectAll.complete();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const MULTI_SELECT_PANEL_DATA = new InjectionToken('MultiSelectPanelData');
|
|
90
|
+
|
|
91
|
+
class LuIsOptionSelectedPipe {
|
|
92
|
+
transform(option, comparer, selectedOptions) {
|
|
93
|
+
return selectedOptions.some((selectedOption) => comparer(option, selectedOption));
|
|
94
|
+
}
|
|
95
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: LuIsOptionSelectedPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
96
|
+
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.3", ngImport: i0, type: LuIsOptionSelectedPipe, isStandalone: true, name: "luIsOptionSelected" }); }
|
|
97
|
+
}
|
|
98
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: LuIsOptionSelectedPipe, decorators: [{
|
|
99
|
+
type: Pipe,
|
|
100
|
+
args: [{
|
|
101
|
+
name: 'luIsOptionSelected',
|
|
102
|
+
standalone: true,
|
|
103
|
+
}]
|
|
104
|
+
}] });
|
|
105
|
+
|
|
106
|
+
class ɵLuMultiSelectSelectedChipDirective {
|
|
107
|
+
constructor() {
|
|
108
|
+
this.elementRef = inject(ElementRef).nativeElement;
|
|
109
|
+
}
|
|
110
|
+
setActiveStyles() {
|
|
111
|
+
this.elementRef.querySelector('button').focus();
|
|
112
|
+
}
|
|
113
|
+
setInactiveStyles() {
|
|
114
|
+
// Nothing to do
|
|
115
|
+
}
|
|
116
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ɵLuMultiSelectSelectedChipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
117
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.3", type: ɵLuMultiSelectSelectedChipDirective, isStandalone: true, selector: "[luMultiSelectSelectedChip]", inputs: { option: ["luMultiSelectSelectedChip", "option"] }, ngImport: i0 }); }
|
|
118
|
+
}
|
|
119
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: ɵLuMultiSelectSelectedChipDirective, decorators: [{
|
|
120
|
+
type: Directive,
|
|
121
|
+
args: [{
|
|
122
|
+
standalone: true,
|
|
123
|
+
selector: '[luMultiSelectSelectedChip]',
|
|
124
|
+
}]
|
|
125
|
+
}], propDecorators: { option: [{
|
|
126
|
+
type: Input,
|
|
127
|
+
args: ['luMultiSelectSelectedChip']
|
|
128
|
+
}] } });
|
|
129
|
+
|
|
130
|
+
class LuMultiSelectPanelComponent {
|
|
131
|
+
constructor() {
|
|
132
|
+
this.panelData = inject(MULTI_SELECT_PANEL_DATA);
|
|
133
|
+
this.panelRef = inject(LuMultiSelectPanelRef);
|
|
134
|
+
this.selectId = inject(SELECT_ID);
|
|
135
|
+
this.intl = getIntl(LU_MULTI_SELECT_TRANSLATIONS);
|
|
136
|
+
this.isExpanded = this.panelData.expanded;
|
|
137
|
+
this.options$ = this.panelData.options$;
|
|
138
|
+
this.loading$ = this.panelData.loading$;
|
|
139
|
+
this.areAllOptionsSelected$ = this.panelData.areAllOptionsSelected$;
|
|
140
|
+
this.canSelectAll = false; // TODO connect to panel options when we'll be ok on designing select all
|
|
141
|
+
this.optionComparer = this.panelData.optionComparer;
|
|
142
|
+
this.selectedOptions = this.panelData.initialValue || [];
|
|
143
|
+
this.optionTpl = this.panelData.optionTpl;
|
|
144
|
+
this.searchable = this.panelData.searchable;
|
|
145
|
+
this.search = null;
|
|
146
|
+
}
|
|
147
|
+
onScroll(evt) {
|
|
148
|
+
if (!(evt.target instanceof HTMLElement)) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (evt.target.scrollTop === 0) {
|
|
152
|
+
this.panelRef.previousPage.emit();
|
|
153
|
+
}
|
|
154
|
+
if (evt.target.scrollHeight - evt.target.scrollTop - evt.target.clientHeight < 1) {
|
|
155
|
+
this.panelRef.nextPage.emit();
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
ngAfterViewInit() {
|
|
159
|
+
if (!this.optionsQL) {
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
this.initLeftColumnKeyManager();
|
|
163
|
+
this.initRightColumnKeyManager();
|
|
164
|
+
if (this.searchInput) {
|
|
165
|
+
setTimeout(() => this.searchInput.nativeElement.focus());
|
|
166
|
+
}
|
|
167
|
+
if (this.isExpanded) {
|
|
168
|
+
this.panelRef.useExpandedPosition();
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
this.panelRef.useDefaultPosition();
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
onKeyDown($event) {
|
|
175
|
+
if ($event.key === 'Escape') {
|
|
176
|
+
return this.panelRef.close();
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
onLeftColumnKeydown($event) {
|
|
180
|
+
if ($event.code === 'Space' || $event.code === 'Enter') {
|
|
181
|
+
this.toggleOption(this.leftColumnKeyManager?.activeItem?.option);
|
|
182
|
+
$event.preventDefault();
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
this.leftColumnKeyManager?.onKeydown($event);
|
|
186
|
+
}
|
|
187
|
+
onRightColumnKeydown($event) {
|
|
188
|
+
const option = this.rightColumnKeyManager?.activeItem?.option;
|
|
189
|
+
if (option && ($event.code === 'Space' || $event.code === 'Enter')) {
|
|
190
|
+
this.onChipKillClick(option);
|
|
191
|
+
$event.preventDefault();
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
this.rightColumnKeyManager?.onKeydown($event);
|
|
195
|
+
}
|
|
196
|
+
// toggleAll(shouldSelectAll: boolean): void {
|
|
197
|
+
// if (shouldSelectAll) {
|
|
198
|
+
// this.panelRef.selectAll.emit();
|
|
199
|
+
// } else {
|
|
200
|
+
// this.clear();
|
|
201
|
+
// }
|
|
202
|
+
// }
|
|
203
|
+
updateClue(clue) {
|
|
204
|
+
this.search = clue;
|
|
205
|
+
this.panelRef.clueChanged.emit(clue);
|
|
206
|
+
setTimeout(() => this.leftColumnKeyManager.setFirstItemActive());
|
|
207
|
+
}
|
|
208
|
+
toggleOption(option) {
|
|
209
|
+
const selectedOption = this.selectedOptions.find((o) => this.optionComparer(o, option));
|
|
210
|
+
this.selectedOptions = selectedOption ? this.selectedOptions.filter((o) => o !== selectedOption) : [...this.selectedOptions, option];
|
|
211
|
+
this.panelRef.emitValue(this.selectedOptions);
|
|
212
|
+
this.leftColumnKeyManager?.setActiveItem(this.optionsQL.toArray().findIndex((o) => o.option === option));
|
|
213
|
+
}
|
|
214
|
+
onChipKillClick(option) {
|
|
215
|
+
const optionToUnselectIndex = this.selectedOptions.findIndex((o) => this.optionComparer(o, option));
|
|
216
|
+
this.selectedOptions = this.selectedOptions.filter((_, index) => index !== optionToUnselectIndex);
|
|
217
|
+
this.panelRef.emitValue(this.selectedOptions);
|
|
218
|
+
if (this.selectedOptions.length && this.rightColumnKeyManager) {
|
|
219
|
+
optionToUnselectIndex >= this.selectedOptions.length ? this.rightColumnKeyManager.setPreviousItemActive() : this.rightColumnKeyManager.setNextItemActive();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
clear() {
|
|
223
|
+
this.selectedOptions = [];
|
|
224
|
+
this.panelRef.emitValue(this.selectedOptions);
|
|
225
|
+
}
|
|
226
|
+
initLeftColumnKeyManager() {
|
|
227
|
+
this.leftColumnKeyManager = new ActiveDescendantKeyManager(this.optionsQL).withHomeAndEnd();
|
|
228
|
+
if (this.selectedOptions) {
|
|
229
|
+
this.options$
|
|
230
|
+
?.pipe(observeOn(asyncScheduler), map((options) => (this.selectedOptions.length ? options.findIndex((o) => this.optionComparer(o, this.selectedOptions[0])) : -1)), filter((index) => index !== -1), take(1), takeUntil(this.panelRef.closed))
|
|
231
|
+
.subscribe((selectedIndex) => this.leftColumnKeyManager.setActiveItem(selectedIndex));
|
|
232
|
+
}
|
|
233
|
+
this.leftColumnKeyManager.change
|
|
234
|
+
.pipe(map(() => this.leftColumnKeyManager.activeItem?.id), takeUntil(this.panelRef.closed))
|
|
235
|
+
.subscribe((activeDescendant) => this.panelRef.activeOptionIdChanged.emit(activeDescendant));
|
|
236
|
+
}
|
|
237
|
+
initRightColumnKeyManager() {
|
|
238
|
+
this.rightColumnKeyManager = new ActiveDescendantKeyManager(this.selectedChipsQL).withHomeAndEnd();
|
|
239
|
+
}
|
|
240
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: LuMultiSelectPanelComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
241
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: LuMultiSelectPanelComponent, isStandalone: true, selector: "lu-select-panel", host: { listeners: { "keydown": "onKeyDown($event)" } }, viewQueries: [{ propertyName: "searchInput", first: true, predicate: ["searchInput"], descendants: true }, { propertyName: "optionsQL", predicate: ɵLuOptionComponent, descendants: true }, { propertyName: "selectedChipsQL", predicate: ɵLuMultiSelectSelectedChipDirective, descendants: true }], ngImport: i0, template: "<!-- TODO : il faudrait remplacer la classe is-expanded par un attribut aria-expanded=\"true\"-->\r\n<ng-template #searchInputTpl>\r\n\t<label class=\"panel-search textfield mod-search mod-outlined lu-multiselect-search\">\r\n\t\t<input\r\n\t\t\t#searchInput\r\n\t\t\tclass=\"textfield-input\"\r\n\t\t\t[(ngModel)]=\"search\"\r\n\t\t\t(ngModelChange)=\"updateClue($event)\"\r\n\t\t\t[ngModelOptions]=\"{ standalone: true }\"\r\n\t\t/>\r\n\t\t<span class=\"u-mask textfield-label\">{{ intl.search }}</span>\r\n\t</label>\r\n</ng-template>\r\n\r\n<div\r\n\tclass=\"lu-picker-panel lu-option-picker-panel lu-multiselect-panel mod-multiple\"\r\n\trole=\"dialog\"\r\n\tcdkTrapFocus\r\n\t*ngIf=\"{ options: options$ | async } as ctx\"\r\n\t[cdkTrapFocusAutoCapture]=\"true\"\r\n\t[class.is-expanded]=\"isExpanded\"\r\n\t[attr.aria-expanded]=\"isExpanded ? 'true' : undefined\"\r\n>\r\n\t<div class=\"lu-multiselect-panel-form\" *ngIf=\"searchable && !isExpanded\">\r\n\t\t<ng-container *ngTemplateOutlet=\"searchInputTpl\"></ng-container>\r\n\t\t<!--\t\t<button class=\"button mod-text mod-icon lu-multiselect-expandbutton\" type=\"button\" (click)=\"toggleExpansion()\">-->\r\n\t\t<!--\t\t\t<span aria-hidden=\"true\" class=\"lucca-icon\" [class.icon-fullscreen]=\"!isExpanded\" [class.icon-fullscreenExit]=\"isExpanded\"></span>-->\r\n\t\t<!--\t\t\t{{ isExpanded ? intl.reduce : intl.expand }}-->\r\n\t\t<!--\t\t</button>-->\r\n\t</div>\r\n\t<div class=\"lu-multiselect-panel-columns\">\r\n\t\t<div class=\"lu-multiselect-panel-columns-col1\" (keydown)=\"onLeftColumnKeydown($event)\">\r\n\t\t\t<div class=\"lu-multiselect-panel-form\" *ngIf=\"searchable && isExpanded\">\r\n\t\t\t\t<ng-container *ngTemplateOutlet=\"searchInputTpl\"></ng-container>\r\n\t\t\t</div>\r\n\t\t\t<div\r\n\t\t\t\tclass=\"lu-picker-content lu-multiselect-panel-columns-col1-content\"\r\n\t\t\t\t[class.is-loading]=\"loading$ | async\"\r\n\t\t\t\ttabindex=\"0\"\r\n\t\t\t\tcdkFocusInitial\r\n\t\t\t\trole=\"list\"\r\n\t\t\t\taria-multiselectable=\"true\"\r\n\t\t\t\t(scroll)=\"onScroll($event)\"\r\n\t\t\t>\r\n\t\t\t\t<ng-container *ngIf=\"searchable\">\r\n\t\t\t\t\t<div class=\"optionPlaceholder\" *ngIf=\"search && !ctx.options?.length\">\r\n\t\t\t\t\t\t<p class=\"optionPlaceholder-content u-marginBottom0\">{{ intl.emptyResults }}</p>\r\n\t\t\t\t\t\t<button type=\"button\" class=\"link\" (click)=\"updateClue(null); searchInput.nativeElement.focus()\">{{ intl.clearSearch }}</button>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<!--\t\t\t\t<ng-container *ngIf=\"canSelectAll\">-->\r\n\t\t\t\t<!--\t\t\t\t\t<label class=\"checkbox lu-multiselect-selectall\" role=\"option\" [for]=\"selectId + '-select-all'\">-->\r\n\t\t\t\t<!--\t\t\t\t\t\t<input-->\r\n\t\t\t\t<!--\t\t\t\t\t\t\tclass=\"checkbox-input\"-->\r\n\t\t\t\t<!--\t\t\t\t\t\t\ttype=\"checkbox\"-->\r\n\t\t\t\t<!--\t\t\t\t\t\t\t[class.is-incomplete]=\"(areAllOptionsSelected$ | async) !== true && selectedOptions.length\"-->\r\n\t\t\t\t<!--\t\t\t\t\t\t\t[id]=\"selectId + '-select-all'\"-->\r\n\t\t\t\t<!--\t\t\t\t\t\t\t[ngModel]=\"(areAllOptionsSelected$ | async) === true || !!selectedOptions.length\"-->\r\n\t\t\t\t<!--\t\t\t\t\t\t\t(ngModelChange)=\"toggleAll($event)\"-->\r\n\t\t\t\t<!--\t\t\t\t\t\t/>-->\r\n\t\t\t\t<!--\t\t\t\t\t\t<span class=\"checkbox-label\">{{ intl.selectAll }}</span>-->\r\n\t\t\t\t<!--\t\t\t\t\t</label>-->\r\n\t\t\t\t<!--\t\t\t\t</ng-container>-->\r\n\r\n\t\t\t\t<div class=\"lu-picker-content-option\">\r\n\t\t\t\t\t<lu-select-option\r\n\t\t\t\t\t\t*ngFor=\"let option of ctx.options; let index = index\"\r\n\t\t\t\t\t\t[option]=\"option\"\r\n\t\t\t\t\t\t[optionTpl]=\"optionTpl\"\r\n\t\t\t\t\t\t[optionIndex]=\"index\"\r\n\t\t\t\t\t\t[scrollIntoViewOptions]=\"{ block: 'nearest' }\"\r\n\t\t\t\t\t\t[isSelected]=\"option | luIsOptionSelected:optionComparer:selectedOptions\"\r\n\t\t\t\t\t\t(click)=\"toggleOption(option)\"\r\n\t\t\t\t\t></lu-select-option>\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t<div *ngIf=\"loading$ | async\" class=\"panel-loading loading lu-picker-loading\"></div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div class=\"lu-multiselect-panel-columns-col2\" *ngIf=\"isExpanded\">\r\n\t\t\t<div class=\"lu-multiselect-emptystate\" *ngIf=\"!selectedOptions.length\">{{ intl.emptySelection }}</div>\r\n\t\t\t<div class=\"lu-multiselect-chips\" role=\"listbox\" tabindex=\"0\" *ngIf=\"selectedOptions.length\" (keydown)=\"onRightColumnKeydown($event)\">\r\n\t\t\t\t<div role=\"option\" class=\"chip lu-multiselect-chip\" *ngFor=\"let option of selectedOptions\" [luMultiSelectSelectedChip]=\"option\">\r\n\t\t\t\t\t<ng-container *luOptionOutlet=\"optionTpl; value: option\"></ng-container>\r\n\t\t\t\t\t<button type=\"button\" class=\"chip-kill\" tabindex=\"-1\" (click)=\"onChipKillClick(option)\"></button>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<div *ngIf=\"selectedOptions.length\" class=\"lu-multiselect-panel-columns-col2-footer\">\r\n\t\t\t\t<button class=\"button mod-text\" type=\"button\" (click)=\"clear()\">{{ intl.clear }}</button>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n", styles: [":root{--components-options-item-padding-vertical: var(--spacings-XS);--components-options-item-padding-horizontal: var(--spacings-XS);--components-options-item-multiple-padding: 2.25rem;--components-options-item-icon-color: var(--palettes-grey-800);--components-options-checkbox-left: .5rem;--components-options-checkbox-size: 1.25rem;--components-options-checkbox-color: var(--palettes-primary-700);--components-options-checkbox-border-radius: 6px;--components-options-checkbox-border-color: var(--palettes-grey-700);--components-options-establishment-multiple-padding: 2rem}.optionPlaceholder{display:block;padding:var(--components-options-item-padding-vertical) var(--components-options-item-padding-horizontal);font-style:italic;color:var(--palettes-grey-600)}.lu-multiselect-panel{display:flex;flex-direction:column;width:100%;border-radius:var(--commons-borderRadius-M);background-color:var(--colors-white-color);box-shadow:var(--commons-boxShadow-M);transition-property:width,min-width,margin-top,margin-left;transition-duration:var(--commons-animations-durations-fast);transition-timing-function:ease-in}.lu-multiselect-panel-form{padding:var(--spacings-XS);z-index:1}.lu-multiselect-panel-columns{display:flex;gap:var(--spacings-XS);padding:0;width:100%;transition:padding var(--commons-animations-durations-standard) ease}.is-expanded .lu-multiselect-panel-columns{padding:var(--spacings-XS)}[class*=lu-multiselect-panel-columns-col]{display:flex;flex-basis:100%;flex-direction:column}.is-expanded [class*=lu-multiselect-panel-columns-col]{border-radius:var(--commons-borderRadius-M)}.lu-multiselect-panel-columns-col2{align-items:flex-start;height:var(--components-picker-max-height);background-color:var(--palettes-grey-25);min-width:18rem}.is-expanded .lu-multiselect-panel-columns-col1{border:var(--commons-divider-width) solid var(--palettes-grey-200)}.lu-multiselect-panel-columns-col1-content{box-shadow:none;animation:none;padding:0;margin:0 var(--spacings-XS) var(--spacings-XS)}.lu-multiselect-panel-columns-col1-content,.lu-multiselect-chips{scroll-snap-type:y proximity;outline:none}.lu-multiselect-panel-columns-col1-content>*,.lu-multiselect-chips>*{scroll-snap-align:center}.lu-multiselect-panel-columns-col1-content:focus-visible,.lu-multiselect-chips:focus-visible{outline:2px solid var(--palettes-primary-700);outline-offset:2px}.lu-multiselect-search{flex-grow:1}.lu-multiselect-selectall{padding:var(--spacings-XS);font-weight:600;border-radius:var(--commons-borderRadius-M);margin-bottom:var(--spacings-XXS)}.lu-multiselect-selectall:hover,.lu-multiselect-selectall:focus-within{background-color:var(--palettes-grey-25)}.lu-multiselect-chips{overflow-y:auto;display:flex;max-height:18.5rem;flex-grow:1;flex-direction:column;align-items:flex-start;align-self:stretch;gap:var(--spacings-XXS);padding:var(--spacings-XS);border-top-left-radius:var(--commons-borderRadius-M);border-top-right-radius:var(--commons-borderRadius-M)}.lu-multiselect-panel-columns-col2-footer{display:flex;flex:0;align-items:flex-end;align-self:stretch;justify-content:flex-end;border-radius:0!important;border-top:var(--commons-divider-border);margin-top:auto;padding:var(--spacings-XXS) var(--spacings-XS)}.lu-multiselect-panel-form{display:flex;gap:var(--spacings-XS)}@media not all and (min-width: 50em){.lu-multiselect-expandbutton{display:none}}.lu-multiselect-emptystate{margin:auto;text-align:center;padding:var(--spacings-S);color:var(--palettes-grey-600)}\n"], dependencies: [{ kind: "ngmodule", type: A11yModule }, { kind: "directive", type: i1.CdkTrapFocus, selector: "[cdkTrapFocus]", inputs: ["cdkTrapFocus", "cdkTrapFocusAutoCapture"], exportAs: ["cdkTrapFocus"] }, { kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "pipe", type: LuIsOptionSelectedPipe, name: "luIsOptionSelected" }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "component", type: ɵLuOptionComponent, selector: "lu-select-option", inputs: ["optionTpl", "isSelected", "option", "optionIndex", "scrollIntoViewOptions"] }, { kind: "directive", type: ɵLuOptionOutletDirective, selector: "[luOptionOutlet]", inputs: ["luOptionOutlet", "luOptionOutletValue"] }, { kind: "directive", type: ɵLuMultiSelectSelectedChipDirective, selector: "[luMultiSelectSelectedChip]", inputs: ["luMultiSelectSelectedChip"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
242
|
+
}
|
|
243
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: LuMultiSelectPanelComponent, decorators: [{
|
|
244
|
+
type: Component,
|
|
245
|
+
args: [{ selector: 'lu-select-panel', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [A11yModule, AsyncPipe, FormsModule, LuIsOptionSelectedPipe, NgIf, NgFor, ɵLuOptionComponent, ɵLuOptionOutletDirective, ɵLuMultiSelectSelectedChipDirective, NgTemplateOutlet], template: "<!-- TODO : il faudrait remplacer la classe is-expanded par un attribut aria-expanded=\"true\"-->\r\n<ng-template #searchInputTpl>\r\n\t<label class=\"panel-search textfield mod-search mod-outlined lu-multiselect-search\">\r\n\t\t<input\r\n\t\t\t#searchInput\r\n\t\t\tclass=\"textfield-input\"\r\n\t\t\t[(ngModel)]=\"search\"\r\n\t\t\t(ngModelChange)=\"updateClue($event)\"\r\n\t\t\t[ngModelOptions]=\"{ standalone: true }\"\r\n\t\t/>\r\n\t\t<span class=\"u-mask textfield-label\">{{ intl.search }}</span>\r\n\t</label>\r\n</ng-template>\r\n\r\n<div\r\n\tclass=\"lu-picker-panel lu-option-picker-panel lu-multiselect-panel mod-multiple\"\r\n\trole=\"dialog\"\r\n\tcdkTrapFocus\r\n\t*ngIf=\"{ options: options$ | async } as ctx\"\r\n\t[cdkTrapFocusAutoCapture]=\"true\"\r\n\t[class.is-expanded]=\"isExpanded\"\r\n\t[attr.aria-expanded]=\"isExpanded ? 'true' : undefined\"\r\n>\r\n\t<div class=\"lu-multiselect-panel-form\" *ngIf=\"searchable && !isExpanded\">\r\n\t\t<ng-container *ngTemplateOutlet=\"searchInputTpl\"></ng-container>\r\n\t\t<!--\t\t<button class=\"button mod-text mod-icon lu-multiselect-expandbutton\" type=\"button\" (click)=\"toggleExpansion()\">-->\r\n\t\t<!--\t\t\t<span aria-hidden=\"true\" class=\"lucca-icon\" [class.icon-fullscreen]=\"!isExpanded\" [class.icon-fullscreenExit]=\"isExpanded\"></span>-->\r\n\t\t<!--\t\t\t{{ isExpanded ? intl.reduce : intl.expand }}-->\r\n\t\t<!--\t\t</button>-->\r\n\t</div>\r\n\t<div class=\"lu-multiselect-panel-columns\">\r\n\t\t<div class=\"lu-multiselect-panel-columns-col1\" (keydown)=\"onLeftColumnKeydown($event)\">\r\n\t\t\t<div class=\"lu-multiselect-panel-form\" *ngIf=\"searchable && isExpanded\">\r\n\t\t\t\t<ng-container *ngTemplateOutlet=\"searchInputTpl\"></ng-container>\r\n\t\t\t</div>\r\n\t\t\t<div\r\n\t\t\t\tclass=\"lu-picker-content lu-multiselect-panel-columns-col1-content\"\r\n\t\t\t\t[class.is-loading]=\"loading$ | async\"\r\n\t\t\t\ttabindex=\"0\"\r\n\t\t\t\tcdkFocusInitial\r\n\t\t\t\trole=\"list\"\r\n\t\t\t\taria-multiselectable=\"true\"\r\n\t\t\t\t(scroll)=\"onScroll($event)\"\r\n\t\t\t>\r\n\t\t\t\t<ng-container *ngIf=\"searchable\">\r\n\t\t\t\t\t<div class=\"optionPlaceholder\" *ngIf=\"search && !ctx.options?.length\">\r\n\t\t\t\t\t\t<p class=\"optionPlaceholder-content u-marginBottom0\">{{ intl.emptyResults }}</p>\r\n\t\t\t\t\t\t<button type=\"button\" class=\"link\" (click)=\"updateClue(null); searchInput.nativeElement.focus()\">{{ intl.clearSearch }}</button>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t</ng-container>\r\n\r\n\t\t\t\t<!--\t\t\t\t<ng-container *ngIf=\"canSelectAll\">-->\r\n\t\t\t\t<!--\t\t\t\t\t<label class=\"checkbox lu-multiselect-selectall\" role=\"option\" [for]=\"selectId + '-select-all'\">-->\r\n\t\t\t\t<!--\t\t\t\t\t\t<input-->\r\n\t\t\t\t<!--\t\t\t\t\t\t\tclass=\"checkbox-input\"-->\r\n\t\t\t\t<!--\t\t\t\t\t\t\ttype=\"checkbox\"-->\r\n\t\t\t\t<!--\t\t\t\t\t\t\t[class.is-incomplete]=\"(areAllOptionsSelected$ | async) !== true && selectedOptions.length\"-->\r\n\t\t\t\t<!--\t\t\t\t\t\t\t[id]=\"selectId + '-select-all'\"-->\r\n\t\t\t\t<!--\t\t\t\t\t\t\t[ngModel]=\"(areAllOptionsSelected$ | async) === true || !!selectedOptions.length\"-->\r\n\t\t\t\t<!--\t\t\t\t\t\t\t(ngModelChange)=\"toggleAll($event)\"-->\r\n\t\t\t\t<!--\t\t\t\t\t\t/>-->\r\n\t\t\t\t<!--\t\t\t\t\t\t<span class=\"checkbox-label\">{{ intl.selectAll }}</span>-->\r\n\t\t\t\t<!--\t\t\t\t\t</label>-->\r\n\t\t\t\t<!--\t\t\t\t</ng-container>-->\r\n\r\n\t\t\t\t<div class=\"lu-picker-content-option\">\r\n\t\t\t\t\t<lu-select-option\r\n\t\t\t\t\t\t*ngFor=\"let option of ctx.options; let index = index\"\r\n\t\t\t\t\t\t[option]=\"option\"\r\n\t\t\t\t\t\t[optionTpl]=\"optionTpl\"\r\n\t\t\t\t\t\t[optionIndex]=\"index\"\r\n\t\t\t\t\t\t[scrollIntoViewOptions]=\"{ block: 'nearest' }\"\r\n\t\t\t\t\t\t[isSelected]=\"option | luIsOptionSelected:optionComparer:selectedOptions\"\r\n\t\t\t\t\t\t(click)=\"toggleOption(option)\"\r\n\t\t\t\t\t></lu-select-option>\r\n\t\t\t\t</div>\r\n\r\n\t\t\t\t<div *ngIf=\"loading$ | async\" class=\"panel-loading loading lu-picker-loading\"></div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t\t<div class=\"lu-multiselect-panel-columns-col2\" *ngIf=\"isExpanded\">\r\n\t\t\t<div class=\"lu-multiselect-emptystate\" *ngIf=\"!selectedOptions.length\">{{ intl.emptySelection }}</div>\r\n\t\t\t<div class=\"lu-multiselect-chips\" role=\"listbox\" tabindex=\"0\" *ngIf=\"selectedOptions.length\" (keydown)=\"onRightColumnKeydown($event)\">\r\n\t\t\t\t<div role=\"option\" class=\"chip lu-multiselect-chip\" *ngFor=\"let option of selectedOptions\" [luMultiSelectSelectedChip]=\"option\">\r\n\t\t\t\t\t<ng-container *luOptionOutlet=\"optionTpl; value: option\"></ng-container>\r\n\t\t\t\t\t<button type=\"button\" class=\"chip-kill\" tabindex=\"-1\" (click)=\"onChipKillClick(option)\"></button>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t\t<div *ngIf=\"selectedOptions.length\" class=\"lu-multiselect-panel-columns-col2-footer\">\r\n\t\t\t\t<button class=\"button mod-text\" type=\"button\" (click)=\"clear()\">{{ intl.clear }}</button>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n", styles: [":root{--components-options-item-padding-vertical: var(--spacings-XS);--components-options-item-padding-horizontal: var(--spacings-XS);--components-options-item-multiple-padding: 2.25rem;--components-options-item-icon-color: var(--palettes-grey-800);--components-options-checkbox-left: .5rem;--components-options-checkbox-size: 1.25rem;--components-options-checkbox-color: var(--palettes-primary-700);--components-options-checkbox-border-radius: 6px;--components-options-checkbox-border-color: var(--palettes-grey-700);--components-options-establishment-multiple-padding: 2rem}.optionPlaceholder{display:block;padding:var(--components-options-item-padding-vertical) var(--components-options-item-padding-horizontal);font-style:italic;color:var(--palettes-grey-600)}.lu-multiselect-panel{display:flex;flex-direction:column;width:100%;border-radius:var(--commons-borderRadius-M);background-color:var(--colors-white-color);box-shadow:var(--commons-boxShadow-M);transition-property:width,min-width,margin-top,margin-left;transition-duration:var(--commons-animations-durations-fast);transition-timing-function:ease-in}.lu-multiselect-panel-form{padding:var(--spacings-XS);z-index:1}.lu-multiselect-panel-columns{display:flex;gap:var(--spacings-XS);padding:0;width:100%;transition:padding var(--commons-animations-durations-standard) ease}.is-expanded .lu-multiselect-panel-columns{padding:var(--spacings-XS)}[class*=lu-multiselect-panel-columns-col]{display:flex;flex-basis:100%;flex-direction:column}.is-expanded [class*=lu-multiselect-panel-columns-col]{border-radius:var(--commons-borderRadius-M)}.lu-multiselect-panel-columns-col2{align-items:flex-start;height:var(--components-picker-max-height);background-color:var(--palettes-grey-25);min-width:18rem}.is-expanded .lu-multiselect-panel-columns-col1{border:var(--commons-divider-width) solid var(--palettes-grey-200)}.lu-multiselect-panel-columns-col1-content{box-shadow:none;animation:none;padding:0;margin:0 var(--spacings-XS) var(--spacings-XS)}.lu-multiselect-panel-columns-col1-content,.lu-multiselect-chips{scroll-snap-type:y proximity;outline:none}.lu-multiselect-panel-columns-col1-content>*,.lu-multiselect-chips>*{scroll-snap-align:center}.lu-multiselect-panel-columns-col1-content:focus-visible,.lu-multiselect-chips:focus-visible{outline:2px solid var(--palettes-primary-700);outline-offset:2px}.lu-multiselect-search{flex-grow:1}.lu-multiselect-selectall{padding:var(--spacings-XS);font-weight:600;border-radius:var(--commons-borderRadius-M);margin-bottom:var(--spacings-XXS)}.lu-multiselect-selectall:hover,.lu-multiselect-selectall:focus-within{background-color:var(--palettes-grey-25)}.lu-multiselect-chips{overflow-y:auto;display:flex;max-height:18.5rem;flex-grow:1;flex-direction:column;align-items:flex-start;align-self:stretch;gap:var(--spacings-XXS);padding:var(--spacings-XS);border-top-left-radius:var(--commons-borderRadius-M);border-top-right-radius:var(--commons-borderRadius-M)}.lu-multiselect-panel-columns-col2-footer{display:flex;flex:0;align-items:flex-end;align-self:stretch;justify-content:flex-end;border-radius:0!important;border-top:var(--commons-divider-border);margin-top:auto;padding:var(--spacings-XXS) var(--spacings-XS)}.lu-multiselect-panel-form{display:flex;gap:var(--spacings-XS)}@media not all and (min-width: 50em){.lu-multiselect-expandbutton{display:none}}.lu-multiselect-emptystate{margin:auto;text-align:center;padding:var(--spacings-S);color:var(--palettes-grey-600)}\n"] }]
|
|
246
|
+
}], propDecorators: { searchInput: [{
|
|
247
|
+
type: ViewChild,
|
|
248
|
+
args: ['searchInput']
|
|
249
|
+
}], optionsQL: [{
|
|
250
|
+
type: ViewChildren,
|
|
251
|
+
args: [ɵLuOptionComponent]
|
|
252
|
+
}], selectedChipsQL: [{
|
|
253
|
+
type: ViewChildren,
|
|
254
|
+
args: [ɵLuMultiSelectSelectedChipDirective]
|
|
255
|
+
}], onKeyDown: [{
|
|
256
|
+
type: HostListener,
|
|
257
|
+
args: ['keydown', ['$event']]
|
|
258
|
+
}] } });
|
|
259
|
+
|
|
260
|
+
class MultiSelectPanelRef extends LuMultiSelectPanelRef {
|
|
261
|
+
constructor(overlayRef, parentInjector, panelData, defaultPositionStrategy, expandedPositionStrategy) {
|
|
262
|
+
super();
|
|
263
|
+
this.overlayRef = overlayRef;
|
|
264
|
+
this.defaultPositionStrategy = defaultPositionStrategy;
|
|
265
|
+
this.expandedPositionStrategy = expandedPositionStrategy;
|
|
266
|
+
const injector = Injector.create({
|
|
267
|
+
providers: [
|
|
268
|
+
{ provide: LuMultiSelectPanelRef, useValue: this },
|
|
269
|
+
{ provide: MULTI_SELECT_PANEL_DATA, useValue: panelData },
|
|
270
|
+
],
|
|
271
|
+
parent: parentInjector,
|
|
272
|
+
});
|
|
273
|
+
this.portalRef = new ComponentPortal(LuMultiSelectPanelComponent, undefined, injector);
|
|
274
|
+
this.panelRef = overlayRef.attach(this.portalRef);
|
|
275
|
+
this.instance = this.panelRef.instance;
|
|
276
|
+
overlayRef
|
|
277
|
+
.backdropClick()
|
|
278
|
+
.pipe(takeUntil(this.closed))
|
|
279
|
+
.subscribe(() => this.close());
|
|
280
|
+
}
|
|
281
|
+
emitValue(value) {
|
|
282
|
+
this.valueChanged.emit(value);
|
|
283
|
+
}
|
|
284
|
+
updateSelectedOptions(selectedOptions) {
|
|
285
|
+
this.instance.selectedOptions = selectedOptions;
|
|
286
|
+
// Run change detection on the panel component
|
|
287
|
+
this.panelRef.injector.get(ChangeDetectorRef).markForCheck();
|
|
288
|
+
}
|
|
289
|
+
useExpandedPosition() {
|
|
290
|
+
this.overlayRef.updatePositionStrategy(this.expandedPositionStrategy);
|
|
291
|
+
}
|
|
292
|
+
useDefaultPosition() {
|
|
293
|
+
this.overlayRef.updatePositionStrategy(this.defaultPositionStrategy);
|
|
294
|
+
}
|
|
295
|
+
close() {
|
|
296
|
+
super.close();
|
|
297
|
+
this.panelRef.destroy();
|
|
298
|
+
this.overlayRef.detach();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
class LuMultiSelectPanelRefFactory {
|
|
302
|
+
constructor() {
|
|
303
|
+
this.overlay = inject(Overlay);
|
|
304
|
+
this.elementRef = inject(ElementRef);
|
|
305
|
+
this.positionBuilder = inject(OverlayPositionBuilder);
|
|
306
|
+
this.scrollStrategies = inject(ScrollStrategyOptions);
|
|
307
|
+
this.parentInjector = inject(Injector);
|
|
308
|
+
}
|
|
309
|
+
buildPanelRef(panelData, defaultOverlayConfigOverride = {}, expandedPositionStrategy) {
|
|
310
|
+
const defaultOverlayConfig = this.buildDefaultOverlayConfig(defaultOverlayConfigOverride);
|
|
311
|
+
expandedPositionStrategy ??= this.buildExpandedPositionStrategy();
|
|
312
|
+
const overlayRef = this.overlay.create(defaultOverlayConfig);
|
|
313
|
+
overlayRef.hostElement.style.transitionProperty = 'height';
|
|
314
|
+
overlayRef.hostElement.style.transitionDuration = 'var(--commons-animations-durations-standard)';
|
|
315
|
+
return new MultiSelectPanelRef(overlayRef, this.parentInjector, panelData, defaultOverlayConfig.positionStrategy, expandedPositionStrategy);
|
|
316
|
+
}
|
|
317
|
+
buildDefaultOverlayConfig(overlayConfigOverride = {}) {
|
|
318
|
+
const overlayConfig = { ...overlayConfigOverride };
|
|
319
|
+
const config = { overlapInput: false, offsetY: 2 };
|
|
320
|
+
overlayConfig.positionStrategy = this.positionBuilder
|
|
321
|
+
.flexibleConnectedTo(this.elementRef)
|
|
322
|
+
.withViewportMargin(10)
|
|
323
|
+
.withPositions([
|
|
324
|
+
this.buildPosition('bottom', 'right', config),
|
|
325
|
+
this.buildPosition('bottom', 'left', config),
|
|
326
|
+
this.buildPosition('top', 'right', config),
|
|
327
|
+
this.buildPosition('top', 'left', config),
|
|
328
|
+
]);
|
|
329
|
+
overlayConfig.scrollStrategy = this.scrollStrategies.reposition();
|
|
330
|
+
overlayConfig.minWidth = this.elementRef.nativeElement.clientWidth;
|
|
331
|
+
overlayConfig.maxWidth = '100vw';
|
|
332
|
+
return overlayConfig;
|
|
333
|
+
}
|
|
334
|
+
buildExpandedPositionStrategy() {
|
|
335
|
+
const config = { overlapInput: true, offsetX: -4, offsetY: -4 };
|
|
336
|
+
return this.positionBuilder
|
|
337
|
+
.flexibleConnectedTo(this.elementRef)
|
|
338
|
+
.withViewportMargin(10)
|
|
339
|
+
.withPositions([
|
|
340
|
+
this.buildPosition('top', 'right', config),
|
|
341
|
+
this.buildPosition('top', 'left', config),
|
|
342
|
+
this.buildPosition('bottom', 'right', config),
|
|
343
|
+
this.buildPosition('bottom', 'left', config),
|
|
344
|
+
]);
|
|
345
|
+
}
|
|
346
|
+
buildPosition(yDirection, xDirection, config) {
|
|
347
|
+
const originX = xDirection === 'right' ? 'start' : 'end';
|
|
348
|
+
const overlayX = originX;
|
|
349
|
+
const oppositeYDirection = yDirection === 'top' ? 'bottom' : 'top';
|
|
350
|
+
const { originY, overlayY } = config.overlapInput
|
|
351
|
+
? {
|
|
352
|
+
originY: oppositeYDirection,
|
|
353
|
+
overlayY: oppositeYDirection,
|
|
354
|
+
}
|
|
355
|
+
: { originY: yDirection, overlayY: oppositeYDirection };
|
|
356
|
+
return {
|
|
357
|
+
originX,
|
|
358
|
+
originY,
|
|
359
|
+
overlayX,
|
|
360
|
+
overlayY,
|
|
361
|
+
...(config.offsetX ? { offsetX: xDirection === 'right' ? config.offsetX : -config.offsetX } : {}),
|
|
362
|
+
...(config.offsetY ? { offsetY: yDirection === 'bottom' ? config.offsetY : -config.offsetY } : {}),
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: LuMultiSelectPanelRefFactory, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
366
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: LuMultiSelectPanelRefFactory }); }
|
|
367
|
+
}
|
|
368
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: LuMultiSelectPanelRefFactory, decorators: [{
|
|
369
|
+
type: Injectable
|
|
370
|
+
}] });
|
|
371
|
+
|
|
372
|
+
class LuMultiSelectInputComponent extends ALuSelectInputComponent {
|
|
373
|
+
constructor() {
|
|
374
|
+
super(...arguments);
|
|
375
|
+
this.intl = getIntl(LU_MULTI_SELECT_TRANSLATIONS);
|
|
376
|
+
this.modMultipleClass = true;
|
|
377
|
+
this.valuesTpl = LuMultiSelectDefaultDisplayerComponent;
|
|
378
|
+
// TODO this is for select all
|
|
379
|
+
// @Output() selectAll = new EventEmitter<void>();
|
|
380
|
+
this.expanded = false;
|
|
381
|
+
this.areAllOptionsSelected$ = new ReplaySubject(1);
|
|
382
|
+
this.panelRefFactory = inject(LuMultiSelectPanelRefFactory);
|
|
383
|
+
}
|
|
384
|
+
get panelRef() {
|
|
385
|
+
return this._panelRef;
|
|
386
|
+
}
|
|
387
|
+
writeValue(value) {
|
|
388
|
+
super.writeValue(value);
|
|
389
|
+
this.panelRef?.updateSelectedOptions(value);
|
|
390
|
+
}
|
|
391
|
+
buildPanelRef() {
|
|
392
|
+
return this.panelRefFactory.buildPanelRef({
|
|
393
|
+
initialValue: this.value,
|
|
394
|
+
optionComparer: this.optionComparer,
|
|
395
|
+
options$: this.options$,
|
|
396
|
+
loading$: this.loading$,
|
|
397
|
+
searchable: this.searchable,
|
|
398
|
+
optionTpl: this.optionTpl,
|
|
399
|
+
canSelectAll: false,
|
|
400
|
+
areAllOptionsSelected$: this.areAllOptionsSelected$,
|
|
401
|
+
expanded: this.expanded,
|
|
402
|
+
}, this.overlayConfig, this.expandedPositionStrategy);
|
|
403
|
+
}
|
|
404
|
+
bindInputToPanelRefEvents() {
|
|
405
|
+
if (!this.panelRef) {
|
|
406
|
+
return;
|
|
407
|
+
}
|
|
408
|
+
super.bindInputToPanelRefEvents();
|
|
409
|
+
// TODO This is for select all
|
|
410
|
+
// this.panelRef.selectAll.subscribe(() => this.selectAll.emit());
|
|
411
|
+
}
|
|
412
|
+
get hasValue() {
|
|
413
|
+
return this.value && this.value.length > 0;
|
|
414
|
+
}
|
|
415
|
+
clearValue(event) {
|
|
416
|
+
event.stopPropagation();
|
|
417
|
+
this.onChange?.([]);
|
|
418
|
+
this.value = [];
|
|
419
|
+
}
|
|
420
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: LuMultiSelectInputComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
421
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: LuMultiSelectInputComponent, isStandalone: true, selector: "lu-multi-select", inputs: { valuesTpl: "valuesTpl", expandedPositionStrategy: "expandedPositionStrategy", expanded: "expanded", panelRef: "panelRef" }, host: { properties: { "class.mod-multiple": "this.modMultipleClass" } }, providers: [
|
|
422
|
+
{
|
|
423
|
+
provide: NG_VALUE_ACCESSOR,
|
|
424
|
+
useExisting: forwardRef(() => LuMultiSelectInputComponent),
|
|
425
|
+
multi: true,
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
provide: ALuSelectInputComponent,
|
|
429
|
+
useExisting: forwardRef(() => LuMultiSelectInputComponent),
|
|
430
|
+
},
|
|
431
|
+
provideLuSelectOverlayContainer(),
|
|
432
|
+
provideLuSelectLabelsAndIds(),
|
|
433
|
+
LuMultiSelectPanelRefFactory,
|
|
434
|
+
], usesInheritance: true, ngImport: i0, template: "<div class=\"lu-select-placeholder\">{{ placeholder }}</div>\r\n<div class=\"lu-select-value\">\r\n\t<div class=\"lu-select-display-wrapper\">\r\n\t\t<ng-container *luOptionOutlet=\"valuesTpl; value: value\"></ng-container>\r\n\t</div>\r\n</div>\r\n<div class=\"lu-select-suffix\">\r\n\t<a *ngIf=\"hasValue && clearable\" role=\"button\" class=\"clear\" (click)=\"clearValue($event)\">\r\n\t\t<span aria-hidden=\"true\" class=\"lucca-icon icon-thinCross\"></span>\r\n\t\t<span class=\"u-mask\">{{ intl.clear }}</span>\r\n\t</a>\r\n</div>\r\n", styles: [":root{--components-options-item-padding-vertical: var(--spacings-XS);--components-options-item-padding-horizontal: var(--spacings-XS);--components-options-item-multiple-padding: 2.25rem;--components-options-item-icon-color: var(--palettes-grey-800);--components-options-checkbox-left: .5rem;--components-options-checkbox-size: 1.25rem;--components-options-checkbox-color: var(--palettes-primary-700);--components-options-checkbox-border-radius: 6px;--components-options-checkbox-border-color: var(--palettes-grey-700);--components-options-establishment-multiple-padding: 2rem}:host{--components-select-input-padding-horizontal: var(--spacings-XS);--components-select-input-padding-vertical: var(--spacings-XS);--components-select-framed-color: var(--palettes-grey-500);--components-select-framed-color50: var(--palettes-grey-50);--components-select-framed-see-through: var(--palettes-grey-50);--components-select-framed-text: var(--palettes-grey-800);--components-select-framed-placeholder: #cccccc;--components-select-framed-side-padding: var(--spacings-S);--components-select-framed-top-padding: var(--spacings-L);--components-select-framed-bottom-padding: var(--spacings-S);--components-select-framed-label-top-offset: var(--spacings-XS);cursor:pointer;outline:none;padding:0;gap:0}:host:after{display:inline-block;vertical-align:text-bottom;font-style:normal;font-family:Lucca icons;color:var(--palettes-grey-600);bottom:var(--components-select-input-padding-vertical);font-size:var(--sizes-M-lineHeight);line-height:var(--sizes-M-lineHeight);pointer-events:none;position:absolute;right:var(--components-select-input-padding-horizontal)}@supports (content: \"*\"/\"\"){:host:after{content:\"\\e97c\"/\"\"}}@supports not (content: \"*\"/\"\"){:host:after{content:\"\\e97c\"}}:host[disabled],:host.is-disabled{cursor:not-allowed;pointer-events:all}.lu-select-display-wrapper{display:flex;text-overflow:ellipsis;white-space:nowrap;gap:var(--spacings-XXS)}.lu-select-value{line-height:var(--sizes-M-lineHeight);min-height:calc(var(--components-select-framed-bottom-padding) + var(--sizes-M-lineHeight));padding:var(--components-select-input-padding-vertical) 3.5rem var(--components-select-input-padding-vertical) var(--components-select-input-padding-horizontal);transition:all var(--commons-animations-durations-standard);display:none}.lu-select-placeholder{color:var(--palettes-grey-400);line-height:var(--sizes-M-lineHeight);min-height:calc(var(--components-select-framed-bottom-padding) + var(--sizes-M-lineHeight));padding:var(--components-select-input-padding-vertical) 3.5rem var(--components-select-input-padding-vertical) var(--components-select-input-padding-horizontal);transition:all var(--commons-animations-durations-standard);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lu-select-suffix,.lu-select-clearer{position:absolute;bottom:.75rem;right:2.25rem}::ng-deep .lu-select-value lu-simple-select-default-option{max-width:5rem;text-overflow:ellipsis;overflow:hidden}::ng-deep .lu-select-value .label{padding:var(--spacings-XXS) var(--spacings-XS);margin-left:0}::ng-deep .lu-select-value .chip{vertical-align:baseline;max-width:100%;margin:0 var(--spacings-XXS) var(--spacings-XXS) 0;text-overflow:ellipsis;overflow:hidden;vertical-align:top;white-space:nowrap}:host-context(.textfield.mod-S){padding:0}:host-context(.textfield.mod-S) .lu-select-value,:host-context(.textfield.mod-S) .lu-select-placeholder{font-size:var(--sizes-S-fontSize);line-height:var(--sizes-XS-lineHeight);min-height:calc(var(--components-select-framed-bottom-padding) + var(--sizes-XS-lineHeight))}:host-context(.textfield.mod-S) .lu-select-clearer{bottom:var(--spacings-XS)}:host-context(.textfield.mod-S):after{line-height:var(--sizes-XS-lineHeight);font-size:var(--sizes-S-lineHeight)}:host-context(.textfield.mod-S) .lu-select-suffix{bottom:.5rem;right:2rem}:host-context(.textfield.mod-S) ::ng-deep .lu-select-value .label{font-size:var(--sizes-S-fontSize);line-height:var(--sizes-S-lineHeight);font-weight:600;margin:0;padding:0;background-color:transparent}:host-context(.textfield.mod-S) ::ng-deep .lu-select-value .chip{height:var(--sizes-XS-lineHeight);line-height:var(--sizes-XS-lineHeight);font-size:var(--sizes-XS-fontSize);padding-left:var(--spacings-XXS);padding-right:var(--spacings-XXS);gap:var(--spacings-XXS)}:host-context(.textfield.mod-S) ::ng-deep .lu-select-value .numericBadge{--components-numericBadge-size: 1.25rem;--components-numericBadge-borderRadius: 6px;--components-numericBadge-fontSize: var(--sizes-XS-fontSize);--components-numericBadge-lineHeight: var(--sizes-XS-lineHeight)}:host-context(.textfield.mod-framed).textfield-input,:host-context(.form.mod-framed).textfield-input{padding:var(--components-select-framed-top-padding) 0 0}:host-context(.textfield.mod-framed).textfield-input:after,:host-context(.form.mod-framed).textfield-input:after{color:var(--palettes-grey-500);bottom:var(--components-select-framed-bottom-padding);right:var(--spacings-XS)}:host-context(.textfield.mod-framed).textfield-input .lu-select-value,:host-context(.form.mod-framed).textfield-input .lu-select-value{padding:0 calc(var(--components-select-framed-side-padding) * 3) var(--components-select-framed-bottom-padding) var(--components-select-framed-side-padding)}:host-context(.textfield.mod-framed).textfield-input .lu-select-placeholder,:host-context(.form.mod-framed).textfield-input .lu-select-placeholder{color:var(--palettes-grey-400);padding:0 calc(var(--components-select-framed-side-padding) * 3) var(--components-select-framed-bottom-padding) var(--components-select-framed-side-padding)}:host-context(.textfield.mod-framed).textfield-input .lu-select-suffix,:host-context(.form.mod-framed).textfield-input .lu-select-suffix{bottom:var(--components-select-framed-bottom-padding);right:1.7rem}:host-context(.textfield.mod-filter) .lu-select-value,:host-context(.textfield.mod-filter) .lu-select-placeholder{padding:0;height:auto;padding-top:var(--spacings-S);color:var(--palettes-grey-800)}:host-context(.textfield.mod-material):after{color:var(--palettes-grey-500);bottom:.6rem;right:0}:host-context(.textfield.mod-material) .lu-select-value,:host-context(.textfield.mod-material) .lu-select-placeholder{padding-left:0;padding-right:.8rem}:host-context(.textfield.mod-material) .lu-select-suffix{right:calc(2 * var(--components-select-input-padding-horizontal))}:host-context(.textfield.mod-material).is-select .lu-select-placeholder{display:none}:host-context(.textfield.mod-material).mod-search:after{bottom:0}:host-context(.textfield.mod-material).mod-search .lu-select-suffix{right:calc(2.75 * var(--components-select-input-padding-horizontal))}:host-context(.textfield.mod-material .textfield-input.is-focused) .lu-select-placeholder{display:none}:host(.mod-multiple) .lu-select-value{height:auto;align-items:center}:host(.mod-multiple) .lu-select-display-wrapper{overflow:visible;white-space:normal;margin-bottom:calc(var(--spacings-XXS) * -1)}:host-context(.textfield.mod-outlined).textfield-input:after{color:var(--palettes-grey-600)}:host-context(.textfield.mod-outlined).textfield-input .lu-select-placeholder{color:var(--palettes-grey-400)}:host-context(.textfield.mod-outlined) :host-context(.textfield-input.is-error):after{color:var(--palettes-error-600)}:host-context(.textfield.mod-outlined) :host-context(.textfield-input.is-error) .lu-select-placeholder{color:var(--palettes-error-400)}:host-context(.textfield-input.is-filled) .lu-select-placeholder{display:none}:host-context(.textfield-input.is-filled) .lu-select-value{display:flex;align-items:flex-start}:host-context(.textfield-input.is-clearable) .lu-select-value{padding-right:3.5rem}:host-context(.textfield-input.is-error):after{color:var(--palettes-error-700)}:host-context(.textfield-input.is-error) .lu-select-placeholder{color:var(--palettes-error-400)}:host-context(.textfield-input.is-disabled,.textfield-input[disabled]):after{color:var(--commons-disabled-color)}:host-context(.textfield-input.is-disabled,.textfield-input[disabled]) .lu-select-placeholder{color:var(--commons-disabled-placeholder)}:host[aria-expanded=true]{outline:none}.lu-select-value{padding-right:2rem}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: LuTooltipModule }, { kind: "directive", type: ɵLuOptionOutletDirective, selector: "[luOptionOutlet]", inputs: ["luOptionOutlet", "luOptionOutletValue"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
435
|
+
}
|
|
436
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: LuMultiSelectInputComponent, decorators: [{
|
|
437
|
+
type: Component,
|
|
438
|
+
args: [{ selector: 'lu-multi-select', standalone: true, imports: [CommonModule, LuTooltipModule, ɵLuOptionOutletDirective], changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
439
|
+
{
|
|
440
|
+
provide: NG_VALUE_ACCESSOR,
|
|
441
|
+
useExisting: forwardRef(() => LuMultiSelectInputComponent),
|
|
442
|
+
multi: true,
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
provide: ALuSelectInputComponent,
|
|
446
|
+
useExisting: forwardRef(() => LuMultiSelectInputComponent),
|
|
447
|
+
},
|
|
448
|
+
provideLuSelectOverlayContainer(),
|
|
449
|
+
provideLuSelectLabelsAndIds(),
|
|
450
|
+
LuMultiSelectPanelRefFactory,
|
|
451
|
+
], template: "<div class=\"lu-select-placeholder\">{{ placeholder }}</div>\r\n<div class=\"lu-select-value\">\r\n\t<div class=\"lu-select-display-wrapper\">\r\n\t\t<ng-container *luOptionOutlet=\"valuesTpl; value: value\"></ng-container>\r\n\t</div>\r\n</div>\r\n<div class=\"lu-select-suffix\">\r\n\t<a *ngIf=\"hasValue && clearable\" role=\"button\" class=\"clear\" (click)=\"clearValue($event)\">\r\n\t\t<span aria-hidden=\"true\" class=\"lucca-icon icon-thinCross\"></span>\r\n\t\t<span class=\"u-mask\">{{ intl.clear }}</span>\r\n\t</a>\r\n</div>\r\n", styles: [":root{--components-options-item-padding-vertical: var(--spacings-XS);--components-options-item-padding-horizontal: var(--spacings-XS);--components-options-item-multiple-padding: 2.25rem;--components-options-item-icon-color: var(--palettes-grey-800);--components-options-checkbox-left: .5rem;--components-options-checkbox-size: 1.25rem;--components-options-checkbox-color: var(--palettes-primary-700);--components-options-checkbox-border-radius: 6px;--components-options-checkbox-border-color: var(--palettes-grey-700);--components-options-establishment-multiple-padding: 2rem}:host{--components-select-input-padding-horizontal: var(--spacings-XS);--components-select-input-padding-vertical: var(--spacings-XS);--components-select-framed-color: var(--palettes-grey-500);--components-select-framed-color50: var(--palettes-grey-50);--components-select-framed-see-through: var(--palettes-grey-50);--components-select-framed-text: var(--palettes-grey-800);--components-select-framed-placeholder: #cccccc;--components-select-framed-side-padding: var(--spacings-S);--components-select-framed-top-padding: var(--spacings-L);--components-select-framed-bottom-padding: var(--spacings-S);--components-select-framed-label-top-offset: var(--spacings-XS);cursor:pointer;outline:none;padding:0;gap:0}:host:after{display:inline-block;vertical-align:text-bottom;font-style:normal;font-family:Lucca icons;color:var(--palettes-grey-600);bottom:var(--components-select-input-padding-vertical);font-size:var(--sizes-M-lineHeight);line-height:var(--sizes-M-lineHeight);pointer-events:none;position:absolute;right:var(--components-select-input-padding-horizontal)}@supports (content: \"*\"/\"\"){:host:after{content:\"\\e97c\"/\"\"}}@supports not (content: \"*\"/\"\"){:host:after{content:\"\\e97c\"}}:host[disabled],:host.is-disabled{cursor:not-allowed;pointer-events:all}.lu-select-display-wrapper{display:flex;text-overflow:ellipsis;white-space:nowrap;gap:var(--spacings-XXS)}.lu-select-value{line-height:var(--sizes-M-lineHeight);min-height:calc(var(--components-select-framed-bottom-padding) + var(--sizes-M-lineHeight));padding:var(--components-select-input-padding-vertical) 3.5rem var(--components-select-input-padding-vertical) var(--components-select-input-padding-horizontal);transition:all var(--commons-animations-durations-standard);display:none}.lu-select-placeholder{color:var(--palettes-grey-400);line-height:var(--sizes-M-lineHeight);min-height:calc(var(--components-select-framed-bottom-padding) + var(--sizes-M-lineHeight));padding:var(--components-select-input-padding-vertical) 3.5rem var(--components-select-input-padding-vertical) var(--components-select-input-padding-horizontal);transition:all var(--commons-animations-durations-standard);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.lu-select-suffix,.lu-select-clearer{position:absolute;bottom:.75rem;right:2.25rem}::ng-deep .lu-select-value lu-simple-select-default-option{max-width:5rem;text-overflow:ellipsis;overflow:hidden}::ng-deep .lu-select-value .label{padding:var(--spacings-XXS) var(--spacings-XS);margin-left:0}::ng-deep .lu-select-value .chip{vertical-align:baseline;max-width:100%;margin:0 var(--spacings-XXS) var(--spacings-XXS) 0;text-overflow:ellipsis;overflow:hidden;vertical-align:top;white-space:nowrap}:host-context(.textfield.mod-S){padding:0}:host-context(.textfield.mod-S) .lu-select-value,:host-context(.textfield.mod-S) .lu-select-placeholder{font-size:var(--sizes-S-fontSize);line-height:var(--sizes-XS-lineHeight);min-height:calc(var(--components-select-framed-bottom-padding) + var(--sizes-XS-lineHeight))}:host-context(.textfield.mod-S) .lu-select-clearer{bottom:var(--spacings-XS)}:host-context(.textfield.mod-S):after{line-height:var(--sizes-XS-lineHeight);font-size:var(--sizes-S-lineHeight)}:host-context(.textfield.mod-S) .lu-select-suffix{bottom:.5rem;right:2rem}:host-context(.textfield.mod-S) ::ng-deep .lu-select-value .label{font-size:var(--sizes-S-fontSize);line-height:var(--sizes-S-lineHeight);font-weight:600;margin:0;padding:0;background-color:transparent}:host-context(.textfield.mod-S) ::ng-deep .lu-select-value .chip{height:var(--sizes-XS-lineHeight);line-height:var(--sizes-XS-lineHeight);font-size:var(--sizes-XS-fontSize);padding-left:var(--spacings-XXS);padding-right:var(--spacings-XXS);gap:var(--spacings-XXS)}:host-context(.textfield.mod-S) ::ng-deep .lu-select-value .numericBadge{--components-numericBadge-size: 1.25rem;--components-numericBadge-borderRadius: 6px;--components-numericBadge-fontSize: var(--sizes-XS-fontSize);--components-numericBadge-lineHeight: var(--sizes-XS-lineHeight)}:host-context(.textfield.mod-framed).textfield-input,:host-context(.form.mod-framed).textfield-input{padding:var(--components-select-framed-top-padding) 0 0}:host-context(.textfield.mod-framed).textfield-input:after,:host-context(.form.mod-framed).textfield-input:after{color:var(--palettes-grey-500);bottom:var(--components-select-framed-bottom-padding);right:var(--spacings-XS)}:host-context(.textfield.mod-framed).textfield-input .lu-select-value,:host-context(.form.mod-framed).textfield-input .lu-select-value{padding:0 calc(var(--components-select-framed-side-padding) * 3) var(--components-select-framed-bottom-padding) var(--components-select-framed-side-padding)}:host-context(.textfield.mod-framed).textfield-input .lu-select-placeholder,:host-context(.form.mod-framed).textfield-input .lu-select-placeholder{color:var(--palettes-grey-400);padding:0 calc(var(--components-select-framed-side-padding) * 3) var(--components-select-framed-bottom-padding) var(--components-select-framed-side-padding)}:host-context(.textfield.mod-framed).textfield-input .lu-select-suffix,:host-context(.form.mod-framed).textfield-input .lu-select-suffix{bottom:var(--components-select-framed-bottom-padding);right:1.7rem}:host-context(.textfield.mod-filter) .lu-select-value,:host-context(.textfield.mod-filter) .lu-select-placeholder{padding:0;height:auto;padding-top:var(--spacings-S);color:var(--palettes-grey-800)}:host-context(.textfield.mod-material):after{color:var(--palettes-grey-500);bottom:.6rem;right:0}:host-context(.textfield.mod-material) .lu-select-value,:host-context(.textfield.mod-material) .lu-select-placeholder{padding-left:0;padding-right:.8rem}:host-context(.textfield.mod-material) .lu-select-suffix{right:calc(2 * var(--components-select-input-padding-horizontal))}:host-context(.textfield.mod-material).is-select .lu-select-placeholder{display:none}:host-context(.textfield.mod-material).mod-search:after{bottom:0}:host-context(.textfield.mod-material).mod-search .lu-select-suffix{right:calc(2.75 * var(--components-select-input-padding-horizontal))}:host-context(.textfield.mod-material .textfield-input.is-focused) .lu-select-placeholder{display:none}:host(.mod-multiple) .lu-select-value{height:auto;align-items:center}:host(.mod-multiple) .lu-select-display-wrapper{overflow:visible;white-space:normal;margin-bottom:calc(var(--spacings-XXS) * -1)}:host-context(.textfield.mod-outlined).textfield-input:after{color:var(--palettes-grey-600)}:host-context(.textfield.mod-outlined).textfield-input .lu-select-placeholder{color:var(--palettes-grey-400)}:host-context(.textfield.mod-outlined) :host-context(.textfield-input.is-error):after{color:var(--palettes-error-600)}:host-context(.textfield.mod-outlined) :host-context(.textfield-input.is-error) .lu-select-placeholder{color:var(--palettes-error-400)}:host-context(.textfield-input.is-filled) .lu-select-placeholder{display:none}:host-context(.textfield-input.is-filled) .lu-select-value{display:flex;align-items:flex-start}:host-context(.textfield-input.is-clearable) .lu-select-value{padding-right:3.5rem}:host-context(.textfield-input.is-error):after{color:var(--palettes-error-700)}:host-context(.textfield-input.is-error) .lu-select-placeholder{color:var(--palettes-error-400)}:host-context(.textfield-input.is-disabled,.textfield-input[disabled]):after{color:var(--commons-disabled-color)}:host-context(.textfield-input.is-disabled,.textfield-input[disabled]) .lu-select-placeholder{color:var(--commons-disabled-placeholder)}:host[aria-expanded=true]{outline:none}.lu-select-value{padding-right:2rem}\n"] }]
|
|
452
|
+
}], propDecorators: { modMultipleClass: [{
|
|
453
|
+
type: HostBinding,
|
|
454
|
+
args: ['class.mod-multiple']
|
|
455
|
+
}], valuesTpl: [{
|
|
456
|
+
type: Input
|
|
457
|
+
}], expandedPositionStrategy: [{
|
|
458
|
+
type: Input
|
|
459
|
+
}], expanded: [{
|
|
460
|
+
type: Input
|
|
461
|
+
}], panelRef: [{
|
|
462
|
+
type: Input
|
|
463
|
+
}] } });
|
|
464
|
+
|
|
465
|
+
const LU_MULTI_SELECT_DISPLAYER_TRANSLATIONS = new InjectionToken('LuMultiSelectDisplayerTranslations', {
|
|
466
|
+
factory: () => luMultiSelectDisplayerTranslations,
|
|
467
|
+
});
|
|
468
|
+
const luMultiSelectDisplayerTranslations = {
|
|
469
|
+
fr: {
|
|
470
|
+
otherResult: 'autre résultat',
|
|
471
|
+
otherResults: 'autres résultats',
|
|
472
|
+
showResultsDetails: 'Voir le détail',
|
|
473
|
+
},
|
|
474
|
+
en: {
|
|
475
|
+
otherResult: 'other result',
|
|
476
|
+
otherResults: 'other results',
|
|
477
|
+
showResultsDetails: 'Show details',
|
|
478
|
+
},
|
|
479
|
+
de: {
|
|
480
|
+
otherResult: 'anderes Ergebnis',
|
|
481
|
+
otherResults: 'andere Ergebnisse',
|
|
482
|
+
showResultsDetails: 'Details anzeigen',
|
|
483
|
+
},
|
|
484
|
+
es: {
|
|
485
|
+
otherResult: 'otro resultado',
|
|
486
|
+
otherResults: 'otros resultados',
|
|
487
|
+
showResultsDetails: 'Mostrar detalles',
|
|
488
|
+
},
|
|
489
|
+
pt: {
|
|
490
|
+
otherResult: 'outro resultado',
|
|
491
|
+
otherResults: 'outros resultados',
|
|
492
|
+
showResultsDetails: 'Mostrar detalhes',
|
|
493
|
+
},
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
function fromElementWidth(el) {
|
|
497
|
+
return new Observable((observer) => {
|
|
498
|
+
// Emit the initial width
|
|
499
|
+
observer.next(el.getBoundingClientRect().width);
|
|
500
|
+
// Emit the new width whenever the element is resized
|
|
501
|
+
const resizeObserver = new ResizeObserver((entries) => observer.next(entries[0].contentRect.width));
|
|
502
|
+
resizeObserver.observe(el);
|
|
503
|
+
// Cleanup observer on cancellation
|
|
504
|
+
return () => resizeObserver.disconnect();
|
|
505
|
+
}).pipe(distinctUntilChanged());
|
|
506
|
+
}
|
|
507
|
+
class LuMultiSelectDefaultDisplayerComponent {
|
|
508
|
+
constructor() {
|
|
509
|
+
this.select = inject(LuMultiSelectInputComponent);
|
|
510
|
+
this.elementRef = inject(ElementRef);
|
|
511
|
+
this.cdr = inject(ChangeDetectorRef);
|
|
512
|
+
this.intl = getIntl(LU_MULTI_SELECT_DISPLAYER_TRANSLATIONS);
|
|
513
|
+
this.destroyRef = inject(DestroyRef);
|
|
514
|
+
this.zone = inject(NgZone);
|
|
515
|
+
this.ngAfterViewInit$ = new ReplaySubject(1);
|
|
516
|
+
this.chips$ = this.ngAfterViewInit$.pipe(concatMap(() => this.chipsQL.changes.pipe(startWith(undefined))), map(() => this.chipsQL.toArray().map((chip) => chip.nativeElement)));
|
|
517
|
+
this.context = inject(LU_OPTION_CONTEXT);
|
|
518
|
+
this.visibleChips$ = new ReplaySubject(1);
|
|
519
|
+
this.hiddenChips$ = new ReplaySubject(1);
|
|
520
|
+
this.visibleChipsCount$ = this.visibleChips$.pipe(map((chips) => chips.length), distinctUntilChanged());
|
|
521
|
+
this.hiddenChipsCount$ = this.hiddenChips$.pipe(map((chips) => chips.length), distinctUntilChanged());
|
|
522
|
+
this.hiddenOptionCountWidthCssVar = 0;
|
|
523
|
+
this.hiddenOptionCountOffsetLeftCssVar = 0;
|
|
524
|
+
}
|
|
525
|
+
get disabled() {
|
|
526
|
+
return this.select.disabled;
|
|
527
|
+
}
|
|
528
|
+
ngOnInit() {
|
|
529
|
+
this.visibleChips$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((visible) => {
|
|
530
|
+
this.hiddenOptionCountOffsetLeftCssVar = visible.length ? visible[visible.length - 1].offsetLeft + visible[visible.length - 1].offsetWidth : 0;
|
|
531
|
+
this.cdr.markForCheck();
|
|
532
|
+
});
|
|
533
|
+
this.hiddenChipsCount$.pipe(takeUntilDestroyed(this.destroyRef)).subscribe((hidden) => {
|
|
534
|
+
this.hiddenOptionCountWidthCssVar = hidden;
|
|
535
|
+
this.cdr.markForCheck();
|
|
536
|
+
});
|
|
537
|
+
combineLatest([fromElementWidth(this.chipsContainer.nativeElement), fromElementWidth(this.overflowCountContainer.nativeElement), this.chips$])
|
|
538
|
+
.pipe(debounceTime(0), map(([containerWidth, counterWidth, chips]) => {
|
|
539
|
+
const baseOffsetTop = this.elementRef.nativeElement.offsetTop;
|
|
540
|
+
const isOutOfContainer = (chip, allowedWidth) => chip.offsetTop > baseOffsetTop || chip.offsetLeft + chip.offsetWidth > allowedWidth;
|
|
541
|
+
const needsCounterSpace = !!chips.length && isOutOfContainer(chips[chips.length - 1], containerWidth);
|
|
542
|
+
const availableWidth = needsCounterSpace ? containerWidth - counterWidth : containerWidth;
|
|
543
|
+
// First on next line or first out of container
|
|
544
|
+
const firstHiddenIndex = chips.findIndex((chip) => isOutOfContainer(chip, availableWidth));
|
|
545
|
+
return firstHiddenIndex !== -1
|
|
546
|
+
? {
|
|
547
|
+
visible: chips.slice(0, firstHiddenIndex),
|
|
548
|
+
hidden: chips.slice(firstHiddenIndex),
|
|
549
|
+
}
|
|
550
|
+
: {
|
|
551
|
+
visible: chips,
|
|
552
|
+
hidden: [],
|
|
553
|
+
};
|
|
554
|
+
}), takeUntilDestroyed(this.destroyRef))
|
|
555
|
+
.subscribe(({ visible, hidden }) => {
|
|
556
|
+
this.zone.run(() => {
|
|
557
|
+
this.visibleChips$.next(visible);
|
|
558
|
+
this.hiddenChips$.next(hidden);
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
unselectOption(option, $event) {
|
|
563
|
+
$event.stopPropagation();
|
|
564
|
+
$event.preventDefault();
|
|
565
|
+
this.select.updateValue(this.select.value.filter((o) => o !== option));
|
|
566
|
+
}
|
|
567
|
+
ngOnDestroy() {
|
|
568
|
+
this.ngAfterViewInit$.complete();
|
|
569
|
+
}
|
|
570
|
+
ngAfterViewInit() {
|
|
571
|
+
this.ngAfterViewInit$.next();
|
|
572
|
+
}
|
|
573
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: LuMultiSelectDefaultDisplayerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
574
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.1.3", type: LuMultiSelectDefaultDisplayerComponent, isStandalone: true, selector: "lu-multi-select-default-displayer", host: { properties: { "style.--hidden-option-count-width.px": "this.hiddenOptionCountWidthCssVar", "style.--hidden-option-count-offset-left.px": "this.hiddenOptionCountOffsetLeftCssVar" } }, viewQueries: [{ propertyName: "overflowCountContainer", first: true, predicate: ["overflow"], descendants: true, static: true }, { propertyName: "chipsContainer", first: true, predicate: ["chipsContainer"], descendants: true, static: true }, { propertyName: "chipsQL", predicate: ["chip"], descendants: true }], ngImport: i0, template: `
|
|
575
|
+
<div class="chips-container" #chipsContainer>
|
|
576
|
+
<div
|
|
577
|
+
#chip
|
|
578
|
+
*ngFor="let option of context.option$ | async; let index = index"
|
|
579
|
+
class="chip lu-multiselect-chip"
|
|
580
|
+
[class.mod-unkillable]="disabled"
|
|
581
|
+
[attr.aria-hidden]="index >= ((visibleChipsCount$ | async) || 0) ? 'true' : undefined"
|
|
582
|
+
>
|
|
583
|
+
<span class="lu-multiselect-chip-value"><ng-container *luOptionOutlet="select.valueTpl || select.optionTpl; value: option"></ng-container></span>
|
|
584
|
+
<a href *ngIf="!disabled" type="button" class="chip-kill" (click)="unselectOption(option, $event)" [attr.tabindex]="index >= ((visibleChipsCount$ | async) || 0) ? -1 : undefined"></a>
|
|
585
|
+
</div>
|
|
586
|
+
</div>
|
|
587
|
+
<div class="lu-multiselect-counter" #overflow>
|
|
588
|
+
<ng-container *ngIf="hiddenChipsCount$ | async as count">
|
|
589
|
+
<div class="chip mod-unkillable lu-multiselect-counter-chip" aria-hidden="true">+ {{ count }}</div>
|
|
590
|
+
<span class="u-mask" [ngPlural]="count">
|
|
591
|
+
<ng-template ngPluralCase="=1">{{ intl.otherResult }}</ng-template>
|
|
592
|
+
<ng-template ngPluralCase="other">{{ intl.otherResults }}</ng-template>
|
|
593
|
+
</span>
|
|
594
|
+
</ng-container>
|
|
595
|
+
</div>
|
|
596
|
+
`, isInline: true, styles: [":host{display:flex;height:var(--sizes-M-lineHeight);position:relative;padding-right:var(--hidden-option-count-width)}:host-context(.textfield.mod-S){height:var(--sizes-S-lineHeight)}:host-context(lu-multi-select.is-disabled) .chip{background:var(--palettes-grey-100);color:var(--palettes-grey-500)}:host-context(lu-multi-select.is-disabled) .chip .chip-kill{display:none}.lu-multiselect-counter{position:absolute;top:0;left:calc(var(--hidden-option-count-offset-left) + var(--spacings-XXS))}.lu-multiselect-counter-chip:focus-visible{outline:2px solid var(--palettes-primary-700);outline-offset:2px}.lu-multiselect-chip[aria-hidden]{visibility:hidden}.lu-multiselect-chip-value{max-width:4rem;text-overflow:ellipsis;overflow:hidden}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "ngmodule", type: LuTooltipModule }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgFor, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: NgPlural, selector: "[ngPlural]", inputs: ["ngPlural"] }, { kind: "directive", type: NgPluralCase, selector: "[ngPluralCase]" }, { kind: "directive", type: ɵLuOptionOutletDirective, selector: "[luOptionOutlet]", inputs: ["luOptionOutlet", "luOptionOutletValue"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
597
|
+
}
|
|
598
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: LuMultiSelectDefaultDisplayerComponent, decorators: [{
|
|
599
|
+
type: Component,
|
|
600
|
+
args: [{ selector: 'lu-multi-select-default-displayer', standalone: true, imports: [AsyncPipe, LuTooltipModule, NgIf, NgFor, NgPlural, NgPluralCase, ɵLuOptionOutletDirective], template: `
|
|
601
|
+
<div class="chips-container" #chipsContainer>
|
|
602
|
+
<div
|
|
603
|
+
#chip
|
|
604
|
+
*ngFor="let option of context.option$ | async; let index = index"
|
|
605
|
+
class="chip lu-multiselect-chip"
|
|
606
|
+
[class.mod-unkillable]="disabled"
|
|
607
|
+
[attr.aria-hidden]="index >= ((visibleChipsCount$ | async) || 0) ? 'true' : undefined"
|
|
608
|
+
>
|
|
609
|
+
<span class="lu-multiselect-chip-value"><ng-container *luOptionOutlet="select.valueTpl || select.optionTpl; value: option"></ng-container></span>
|
|
610
|
+
<a href *ngIf="!disabled" type="button" class="chip-kill" (click)="unselectOption(option, $event)" [attr.tabindex]="index >= ((visibleChipsCount$ | async) || 0) ? -1 : undefined"></a>
|
|
611
|
+
</div>
|
|
612
|
+
</div>
|
|
613
|
+
<div class="lu-multiselect-counter" #overflow>
|
|
614
|
+
<ng-container *ngIf="hiddenChipsCount$ | async as count">
|
|
615
|
+
<div class="chip mod-unkillable lu-multiselect-counter-chip" aria-hidden="true">+ {{ count }}</div>
|
|
616
|
+
<span class="u-mask" [ngPlural]="count">
|
|
617
|
+
<ng-template ngPluralCase="=1">{{ intl.otherResult }}</ng-template>
|
|
618
|
+
<ng-template ngPluralCase="other">{{ intl.otherResults }}</ng-template>
|
|
619
|
+
</span>
|
|
620
|
+
</ng-container>
|
|
621
|
+
</div>
|
|
622
|
+
`, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:flex;height:var(--sizes-M-lineHeight);position:relative;padding-right:var(--hidden-option-count-width)}:host-context(.textfield.mod-S){height:var(--sizes-S-lineHeight)}:host-context(lu-multi-select.is-disabled) .chip{background:var(--palettes-grey-100);color:var(--palettes-grey-500)}:host-context(lu-multi-select.is-disabled) .chip .chip-kill{display:none}.lu-multiselect-counter{position:absolute;top:0;left:calc(var(--hidden-option-count-offset-left) + var(--spacings-XXS))}.lu-multiselect-counter-chip:focus-visible{outline:2px solid var(--palettes-primary-700);outline-offset:2px}.lu-multiselect-chip[aria-hidden]{visibility:hidden}.lu-multiselect-chip-value{max-width:4rem;text-overflow:ellipsis;overflow:hidden}\n"] }]
|
|
623
|
+
}], propDecorators: { overflowCountContainer: [{
|
|
624
|
+
type: ViewChild,
|
|
625
|
+
args: ['overflow', { static: true }]
|
|
626
|
+
}], chipsContainer: [{
|
|
627
|
+
type: ViewChild,
|
|
628
|
+
args: ['chipsContainer', { static: true }]
|
|
629
|
+
}], chipsQL: [{
|
|
630
|
+
type: ViewChildren,
|
|
631
|
+
args: ['chip']
|
|
632
|
+
}], hiddenOptionCountWidthCssVar: [{
|
|
633
|
+
type: HostBinding,
|
|
634
|
+
args: ['style.--hidden-option-count-width.px']
|
|
635
|
+
}], hiddenOptionCountOffsetLeftCssVar: [{
|
|
636
|
+
type: HostBinding,
|
|
637
|
+
args: ['style.--hidden-option-count-offset-left.px']
|
|
638
|
+
}] } });
|
|
639
|
+
|
|
640
|
+
class LuMultiDisplayerDirective {
|
|
641
|
+
set select(select) {
|
|
642
|
+
select.valuesTpl = this.templateRef;
|
|
643
|
+
}
|
|
644
|
+
constructor(templateRef) {
|
|
645
|
+
this.templateRef = templateRef;
|
|
646
|
+
}
|
|
647
|
+
static ngTemplateContextGuard(_dir, ctx) {
|
|
648
|
+
return true;
|
|
649
|
+
}
|
|
650
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: LuMultiDisplayerDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive }); }
|
|
651
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.1.3", type: LuMultiDisplayerDirective, isStandalone: true, selector: "[luMultiDisplayer]", inputs: { select: ["luMultiDisplayerSelect", "select"] }, ngImport: i0 }); }
|
|
652
|
+
}
|
|
653
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.3", ngImport: i0, type: LuMultiDisplayerDirective, decorators: [{
|
|
654
|
+
type: Directive,
|
|
655
|
+
args: [{
|
|
656
|
+
selector: '[luMultiDisplayer]',
|
|
657
|
+
standalone: true,
|
|
658
|
+
}]
|
|
659
|
+
}], ctorParameters: function () { return [{ type: i0.TemplateRef }]; }, propDecorators: { select: [{
|
|
660
|
+
type: Input,
|
|
661
|
+
args: ['luMultiDisplayerSelect']
|
|
662
|
+
}] } });
|
|
663
|
+
|
|
664
|
+
/**
|
|
665
|
+
* Generated bundle index. Do not edit.
|
|
666
|
+
*/
|
|
667
|
+
|
|
668
|
+
export { LU_MULTI_SELECT_TRANSLATIONS, LuMultiDisplayerDirective, LuMultiSelectDefaultDisplayerComponent, LuMultiSelectInputComponent, luMultiSelectTranslations };
|
|
669
|
+
//# sourceMappingURL=lucca-front-ng-multi-select.mjs.map
|