@coreui/angular-pro 5.1.4 → 5.1.5
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.
|
@@ -10016,7 +10016,7 @@ const observeReferenceResizeModifier = {
|
|
|
10016
10016
|
const RO_PROP = '__popperjsRO__';
|
|
10017
10017
|
const { reference } = state.elements;
|
|
10018
10018
|
let resizeObserver = new ResizeObserver((entries) => {
|
|
10019
|
-
if (entries.find(entry => entry.target === reference)) {
|
|
10019
|
+
if (entries.find((entry) => entry.target === reference)) {
|
|
10020
10020
|
instance.update();
|
|
10021
10021
|
}
|
|
10022
10022
|
});
|
|
@@ -10173,8 +10173,8 @@ class MultiSelectComponent {
|
|
|
10173
10173
|
* @type IPluralMap
|
|
10174
10174
|
* @default { '=1': 'item selected', 'other': 'items selected' }
|
|
10175
10175
|
*/
|
|
10176
|
-
this.selectionTypeCounterTextPluralMap = { '=1': 'item selected',
|
|
10177
|
-
this.#value = [];
|
|
10176
|
+
this.selectionTypeCounterTextPluralMap = { '=1': 'item selected', other: 'items selected' };
|
|
10177
|
+
this.#value = signal([]);
|
|
10178
10178
|
/**
|
|
10179
10179
|
* Emits valueChange
|
|
10180
10180
|
* @type TValue | TValue[]
|
|
@@ -10194,6 +10194,7 @@ class MultiSelectComponent {
|
|
|
10194
10194
|
* @default 196
|
|
10195
10195
|
*/
|
|
10196
10196
|
this.itemMinWidth = 196;
|
|
10197
|
+
this.minWidth = signal(this.itemMinWidth);
|
|
10197
10198
|
this._visible = false;
|
|
10198
10199
|
/**
|
|
10199
10200
|
* Emits visibleChange
|
|
@@ -10208,7 +10209,7 @@ class MultiSelectComponent {
|
|
|
10208
10209
|
this._subtreeFocused = this.focusOrigin(null);
|
|
10209
10210
|
this.userOptions = this.multiSelectService.getUserOptions();
|
|
10210
10211
|
this.activeOption = null;
|
|
10211
|
-
this.differ = this.iterableDiffers.find(this.#value).create();
|
|
10212
|
+
this.differ = this.iterableDiffers.find(this.#value()).create();
|
|
10212
10213
|
this.multiSelectService.setSelectionModel(this.multiple);
|
|
10213
10214
|
this.optionsArray$ = this.multiSelectService.getOptionsArray();
|
|
10214
10215
|
}
|
|
@@ -10217,7 +10218,7 @@ class MultiSelectComponent {
|
|
|
10217
10218
|
#options;
|
|
10218
10219
|
#optionsContent;
|
|
10219
10220
|
writeValue(value) {
|
|
10220
|
-
if (
|
|
10221
|
+
if (value !== undefined && value !== null) {
|
|
10221
10222
|
this.value = Array.isArray(value) ? [...value] : [value];
|
|
10222
10223
|
}
|
|
10223
10224
|
else {
|
|
@@ -10309,22 +10310,22 @@ class MultiSelectComponent {
|
|
|
10309
10310
|
}
|
|
10310
10311
|
/**
|
|
10311
10312
|
* Initial value of multi-select
|
|
10312
|
-
* @type TValue | TValue[]
|
|
10313
|
+
* @type (TValue | TValue[])
|
|
10313
10314
|
*/
|
|
10314
10315
|
set value(value) {
|
|
10315
10316
|
const newValue = Array.isArray(value) ? [...value] : [value];
|
|
10316
|
-
if (this.differ) {
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
}
|
|
10317
|
+
// if (this.differ) {
|
|
10318
|
+
const changes = this.differ?.diff(newValue);
|
|
10319
|
+
if (changes) {
|
|
10320
|
+
this.#value.set([...newValue]);
|
|
10321
|
+
this.value$.next([...newValue]);
|
|
10322
|
+
this.onChange(this.value);
|
|
10323
|
+
// this.valueChange.emit(this.value);
|
|
10324
10324
|
}
|
|
10325
|
+
// }
|
|
10325
10326
|
}
|
|
10326
10327
|
get value() {
|
|
10327
|
-
const value = this.multiSelectService.selectionModel?.selected ?? [...this.#value];
|
|
10328
|
+
const value = this.multiSelectService.selectionModel?.selected ?? [...this.#value()];
|
|
10328
10329
|
return this.multiple ? [...value] : value[0];
|
|
10329
10330
|
}
|
|
10330
10331
|
#value;
|
|
@@ -10346,7 +10347,7 @@ class MultiSelectComponent {
|
|
|
10346
10347
|
*/
|
|
10347
10348
|
set visibleItems(value) {
|
|
10348
10349
|
this._visibleItems = value > 0 ? value : 8;
|
|
10349
|
-
this.optionsMaxHeight = (
|
|
10350
|
+
this.optionsMaxHeight = (this.itemSize * this._visibleItems + 16).toString();
|
|
10350
10351
|
}
|
|
10351
10352
|
get visibleItems() {
|
|
10352
10353
|
return this._visibleItems;
|
|
@@ -10381,7 +10382,7 @@ class MultiSelectComponent {
|
|
|
10381
10382
|
const currOptions = {
|
|
10382
10383
|
...options,
|
|
10383
10384
|
modifiers: [
|
|
10384
|
-
...prevModifiers.filter(prevModifier => !currModifiers.find(currModifier => currModifier.name === prevModifier.name)),
|
|
10385
|
+
...prevModifiers.filter((prevModifier) => !currModifiers.find((currModifier) => currModifier.name === prevModifier.name)),
|
|
10385
10386
|
...currModifiers
|
|
10386
10387
|
]
|
|
10387
10388
|
};
|
|
@@ -10395,7 +10396,7 @@ class MultiSelectComponent {
|
|
|
10395
10396
|
return [...this.optionsSelected.values()];
|
|
10396
10397
|
}
|
|
10397
10398
|
get selectedOptionsText() {
|
|
10398
|
-
return this.selectedOptions.map(option => option.label).join(', ');
|
|
10399
|
+
return this.selectedOptions.map((option) => option.label).join(', ');
|
|
10399
10400
|
}
|
|
10400
10401
|
get counterText() {
|
|
10401
10402
|
return `${this.selectedOptions.length} ${this.selectionTypeCounterText}`;
|
|
@@ -10403,7 +10404,6 @@ class MultiSelectComponent {
|
|
|
10403
10404
|
get counterTextType() {
|
|
10404
10405
|
return typeof (this.selectionTypeCounterTextPluralMap ?? this.selectionTypeCounterText);
|
|
10405
10406
|
}
|
|
10406
|
-
;
|
|
10407
10407
|
get counterPlaceholderText() {
|
|
10408
10408
|
if (this.selectedOptions.length === 0 || this.selectionType !== 'counter') {
|
|
10409
10409
|
return null;
|
|
@@ -10456,7 +10456,8 @@ class MultiSelectComponent {
|
|
|
10456
10456
|
this.setFocus('keyboard', 'onKeyUp');
|
|
10457
10457
|
return;
|
|
10458
10458
|
}
|
|
10459
|
-
if (['Enter', 'Space', 'ArrowDown'].includes($event.code) &&
|
|
10459
|
+
if (['Enter', 'Space', 'ArrowDown'].includes($event.code) &&
|
|
10460
|
+
[this.inputElement?.nativeElement, this.elementRef.nativeElement].includes($event.target)) {
|
|
10460
10461
|
$event.stopPropagation();
|
|
10461
10462
|
this.visible = true;
|
|
10462
10463
|
if (!this.search) {
|
|
@@ -10480,12 +10481,16 @@ class MultiSelectComponent {
|
|
|
10480
10481
|
if (this.visible && this.subtreeFocused) {
|
|
10481
10482
|
if (targetTagName === 'C-MULTI-SELECT-OPTION') {
|
|
10482
10483
|
if (this.tabTarget === 'C-MULTI-SELECT-OPTION') {
|
|
10483
|
-
if ($event.shiftKey &&
|
|
10484
|
+
if ($event.shiftKey &&
|
|
10485
|
+
this.focusKeyManager.activeItem?.value ===
|
|
10486
|
+
this.options.filter((option) => option.visible && !option.disabled).slice(0)[0].value) {
|
|
10484
10487
|
this.setFocus('keyboard', 'onKeyUp');
|
|
10485
10488
|
this.tabTarget = targetTagName;
|
|
10486
10489
|
return;
|
|
10487
10490
|
}
|
|
10488
|
-
if (!$event.shiftKey &&
|
|
10491
|
+
if (!$event.shiftKey &&
|
|
10492
|
+
this.focusKeyManager.activeItem?.value ===
|
|
10493
|
+
this.options.filter((option) => option.visible && !option.disabled).slice(-1)[0].value) {
|
|
10489
10494
|
this.setFocus('keyboard', 'onKeyUp');
|
|
10490
10495
|
this.tabTarget = targetTagName;
|
|
10491
10496
|
this.updateActiveItem(0);
|
|
@@ -10572,21 +10577,23 @@ class MultiSelectComponent {
|
|
|
10572
10577
|
}
|
|
10573
10578
|
ngOnInit() {
|
|
10574
10579
|
this.multiSelectService.selectionModel.changed
|
|
10575
|
-
.pipe(filter(() => !this.multiple), delay(0), tap(change => {
|
|
10580
|
+
.pipe(filter(() => !this.multiple), delay(0), tap((change) => {
|
|
10576
10581
|
if (change.added.length > 0) {
|
|
10577
10582
|
// close dropdown for single select (!multiple)
|
|
10578
10583
|
this.visible = false;
|
|
10579
10584
|
this.searchValue = '';
|
|
10580
10585
|
}
|
|
10581
|
-
}), skip(1), tap(change => {
|
|
10586
|
+
}), skip(1), tap((change) => {
|
|
10582
10587
|
this.setFocus('program', 'selectionModel.changed (single)');
|
|
10583
10588
|
}), takeUntilDestroyed(this.#destroyRef))
|
|
10584
10589
|
.subscribe();
|
|
10585
|
-
this.#optionsReady
|
|
10590
|
+
this.#optionsReady$
|
|
10591
|
+
.pipe(filter(() => !this.virtualScroller), delay(0), tap(() => {
|
|
10586
10592
|
this.setFocusKeyManager([...this.multiSelectOptionsContent, ...this.multiSelectOptionsView]);
|
|
10587
|
-
}), takeUntilDestroyed(this.#destroyRef))
|
|
10593
|
+
}), takeUntilDestroyed(this.#destroyRef))
|
|
10594
|
+
.subscribe();
|
|
10588
10595
|
this.multiSelectService.selectionModel.changed
|
|
10589
|
-
.pipe(tap(change => {
|
|
10596
|
+
.pipe(tap((change) => {
|
|
10590
10597
|
const { added } = { ...change };
|
|
10591
10598
|
if (added.length > 0 && this.clearSearchOnSelect) {
|
|
10592
10599
|
this.searchValue = '';
|
|
@@ -10598,10 +10605,10 @@ class MultiSelectComponent {
|
|
|
10598
10605
|
// delay(0),
|
|
10599
10606
|
combineLatestWith(this.#optionsReady$), tap(([change, ready]) => {
|
|
10600
10607
|
const { removed } = { ...change };
|
|
10601
|
-
removed.forEach(value => {
|
|
10608
|
+
removed.forEach((value) => {
|
|
10602
10609
|
this.optionsSelected.delete(value);
|
|
10603
10610
|
});
|
|
10604
|
-
this.multiSelectService.selectionModel.selected.forEach(key => {
|
|
10611
|
+
this.multiSelectService.selectionModel.selected.forEach((key) => {
|
|
10605
10612
|
const value = this.#options.get(key);
|
|
10606
10613
|
if (value) {
|
|
10607
10614
|
this.optionsSelected.set(key, value);
|
|
@@ -10614,20 +10621,18 @@ class MultiSelectComponent {
|
|
|
10614
10621
|
}), takeUntilDestroyed(this.#destroyRef))
|
|
10615
10622
|
.subscribe();
|
|
10616
10623
|
// set initial values
|
|
10617
|
-
this.multiSelectService.selectionModel.select(...this.#value);
|
|
10618
|
-
this.value
|
|
10619
|
-
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
10620
|
-
.subscribe(value => {
|
|
10624
|
+
this.multiSelectService.selectionModel.select(...this.#value());
|
|
10625
|
+
this.value$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((value) => {
|
|
10621
10626
|
if (!value.length) {
|
|
10622
10627
|
this.clearAllOptions();
|
|
10623
10628
|
return;
|
|
10624
10629
|
}
|
|
10625
|
-
value.forEach(value => {
|
|
10630
|
+
value.forEach((value) => {
|
|
10626
10631
|
this.multiSelectService.selectionModel.select(value);
|
|
10627
10632
|
});
|
|
10628
10633
|
});
|
|
10629
10634
|
this.value$
|
|
10630
|
-
.pipe(debounceTime(100), tap(value => {
|
|
10635
|
+
.pipe(debounceTime(100), distinctUntilChanged(), tap((value) => {
|
|
10631
10636
|
this.valueChange.emit(this.value);
|
|
10632
10637
|
}), takeUntilDestroyed(this.#destroyRef))
|
|
10633
10638
|
.subscribe();
|
|
@@ -10636,15 +10641,15 @@ class MultiSelectComponent {
|
|
|
10636
10641
|
this.visibleOptions.set(options.some((item) => item.visible) || userOptions.some((item) => item.visible));
|
|
10637
10642
|
this.activeOption = null;
|
|
10638
10643
|
if (this.virtualScroller) {
|
|
10639
|
-
this.multiSelectOptionsContent?.forEach(option => {
|
|
10644
|
+
this.multiSelectOptionsContent?.forEach((option) => {
|
|
10640
10645
|
option.active = false;
|
|
10641
10646
|
});
|
|
10642
10647
|
this.scrollViewport?.setRenderedRange({ start: 0, end: this.visibleItems });
|
|
10643
10648
|
this.scrollViewport?.scrollToIndex(0);
|
|
10644
10649
|
}
|
|
10645
10650
|
else {
|
|
10646
|
-
this.multiSelectOptionsContent?.forEach(option => {
|
|
10647
|
-
const found = options.find(item => item.value === option.value);
|
|
10651
|
+
this.multiSelectOptionsContent?.forEach((option) => {
|
|
10652
|
+
const found = options.find((item) => item.value === option.value);
|
|
10648
10653
|
option.visible = found?.visible ?? false;
|
|
10649
10654
|
option.active = false;
|
|
10650
10655
|
});
|
|
@@ -10679,17 +10684,21 @@ class MultiSelectComponent {
|
|
|
10679
10684
|
}
|
|
10680
10685
|
makeOptions(options) {
|
|
10681
10686
|
if (this.search === 'external' && this.searchValue.length) {
|
|
10682
|
-
this.#options.forEach((
|
|
10683
|
-
|
|
10687
|
+
this.#options.forEach((option, key) => {
|
|
10688
|
+
option.visible = false;
|
|
10684
10689
|
});
|
|
10685
10690
|
}
|
|
10686
|
-
options.forEach(option => {
|
|
10691
|
+
options.forEach((option) => {
|
|
10687
10692
|
const key = option.value;
|
|
10688
10693
|
const value = {
|
|
10689
10694
|
value: option.value ?? option.label,
|
|
10690
10695
|
label: option.label ?? option.value?.toString(),
|
|
10691
10696
|
disabled: option.disabled === true,
|
|
10692
|
-
visible: this.search === 'external'
|
|
10697
|
+
visible: this.search === 'external'
|
|
10698
|
+
? true
|
|
10699
|
+
: option.custom && option.selected
|
|
10700
|
+
? option.visible
|
|
10701
|
+
: option.visible !== false,
|
|
10693
10702
|
text: option.text ?? option.label ?? option.value?.toString(),
|
|
10694
10703
|
selected: option.selected,
|
|
10695
10704
|
custom: option.custom
|
|
@@ -10710,7 +10719,7 @@ class MultiSelectComponent {
|
|
|
10710
10719
|
// });
|
|
10711
10720
|
addUserOption() {
|
|
10712
10721
|
if (this.allowCreateOptions) {
|
|
10713
|
-
if (this.userOptions().some(option => option.value === this.searchValue)) {
|
|
10722
|
+
if (this.userOptions().some((option) => option.value === this.searchValue)) {
|
|
10714
10723
|
return;
|
|
10715
10724
|
}
|
|
10716
10725
|
if (this.#options.get(this.searchValue)) {
|
|
@@ -10724,7 +10733,7 @@ class MultiSelectComponent {
|
|
|
10724
10733
|
custom: true,
|
|
10725
10734
|
selected: true
|
|
10726
10735
|
};
|
|
10727
|
-
this.searchValue =
|
|
10736
|
+
this.searchValue = this.clearSearchOnSelect || this.allowCreateOptions ? '' : this.searchValue;
|
|
10728
10737
|
this.multiSelectService.addUserOption(userOption);
|
|
10729
10738
|
this.multiSelectService.selectionModel.select(userOption.value);
|
|
10730
10739
|
this.optionsSelected.set(userOption.value, userOption);
|
|
@@ -10738,18 +10747,21 @@ class MultiSelectComponent {
|
|
|
10738
10747
|
this.setVirtualScroller();
|
|
10739
10748
|
this.multiSelectOptionsContent?.changes
|
|
10740
10749
|
.pipe(delay(0), distinctUntilChanged((previous, current) => {
|
|
10741
|
-
const prev = previous.toArray().map(option => option.value);
|
|
10742
|
-
const curr = current.toArray().map(option => option.value);
|
|
10750
|
+
const prev = previous.toArray().map((option) => option.value);
|
|
10751
|
+
const curr = current.toArray().map((option) => option.value);
|
|
10743
10752
|
if (this.virtualScroller) {
|
|
10744
10753
|
return JSON.stringify(prev) === JSON.stringify(curr);
|
|
10745
10754
|
}
|
|
10746
10755
|
return JSON.stringify(this.#optionsContent) === JSON.stringify(curr);
|
|
10747
|
-
}), tap(changes => {
|
|
10748
|
-
this.#optionsContent = changes.toArray().map(option => option.value);
|
|
10756
|
+
}), tap((changes) => {
|
|
10757
|
+
this.#optionsContent = changes.toArray().map((option) => option.value);
|
|
10749
10758
|
}), takeUntilDestroyed(this.#destroyRef))
|
|
10750
|
-
.subscribe(next => {
|
|
10759
|
+
.subscribe((next) => {
|
|
10751
10760
|
this.visibleOptions.set(this.multiSelectOptionsContent?.some((option) => option.visible));
|
|
10752
10761
|
if (this.visibleOptions()) {
|
|
10762
|
+
if (!this.virtualScroller) {
|
|
10763
|
+
this.#options.clear();
|
|
10764
|
+
}
|
|
10753
10765
|
this.makeOptions(this.multiSelectOptionsContent.toArray());
|
|
10754
10766
|
}
|
|
10755
10767
|
});
|
|
@@ -10784,6 +10796,10 @@ class MultiSelectComponent {
|
|
|
10784
10796
|
}
|
|
10785
10797
|
else {
|
|
10786
10798
|
if (this.virtualScroller) {
|
|
10799
|
+
{
|
|
10800
|
+
const dropdownMinWidth = parseInt(this.dropdownMenu.nativeElement.style.minWidth, 10);
|
|
10801
|
+
this.minWidth.set(this.itemMinWidth > dropdownMinWidth ? this.itemMinWidth : dropdownMinWidth);
|
|
10802
|
+
}
|
|
10787
10803
|
this.scrollViewport?.setRenderedRange({ start: 0, end: this.visibleItems });
|
|
10788
10804
|
this.scrollViewport?.scrollToIndex(0);
|
|
10789
10805
|
}
|
|
@@ -10795,7 +10811,9 @@ class MultiSelectComponent {
|
|
|
10795
10811
|
}
|
|
10796
10812
|
clearAllOptions($event) {
|
|
10797
10813
|
setTimeout(() => {
|
|
10798
|
-
const enabledOptions = Array.from(this.optionsSelected.values())
|
|
10814
|
+
const enabledOptions = Array.from(this.optionsSelected.values())
|
|
10815
|
+
.filter((option) => !option.disabled)
|
|
10816
|
+
.map((option) => option.value);
|
|
10799
10817
|
this.multiSelectService.selectionModel.deselect(...enabledOptions);
|
|
10800
10818
|
this.removeAllUserOptions();
|
|
10801
10819
|
this.searchValue = '';
|
|
@@ -10805,7 +10823,9 @@ class MultiSelectComponent {
|
|
|
10805
10823
|
});
|
|
10806
10824
|
}
|
|
10807
10825
|
selectAllOptions() {
|
|
10808
|
-
const enabledOptions = Array.from(this.#options.values())
|
|
10826
|
+
const enabledOptions = Array.from(this.#options.values())
|
|
10827
|
+
.filter((option) => option.visible && !option.disabled)
|
|
10828
|
+
.map((option) => option.value);
|
|
10809
10829
|
this.multiSelectService.selectionModel.select(...enabledOptions);
|
|
10810
10830
|
this.inputElementSize();
|
|
10811
10831
|
}
|
|
@@ -10854,7 +10874,7 @@ class MultiSelectComponent {
|
|
|
10854
10874
|
if (!this.nativeSelectRef || !this.nativeId) {
|
|
10855
10875
|
return;
|
|
10856
10876
|
}
|
|
10857
|
-
const options = Array.from(this.optionsSelected).map(item => {
|
|
10877
|
+
const options = Array.from(this.optionsSelected).map((item) => {
|
|
10858
10878
|
const { selected, value, label } = item[1];
|
|
10859
10879
|
return { selected, value, label };
|
|
10860
10880
|
});
|
|
@@ -10891,7 +10911,7 @@ class MultiSelectComponent {
|
|
|
10891
10911
|
}
|
|
10892
10912
|
if (['Backspace', 'Delete'].includes($event.key)) {
|
|
10893
10913
|
$event.stopPropagation();
|
|
10894
|
-
const last = this.selectedOptions.filter(option => !option.disabled).pop();
|
|
10914
|
+
const last = this.selectedOptions.filter((option) => !option.disabled).pop();
|
|
10895
10915
|
if (last) {
|
|
10896
10916
|
this.multiSelectService.selectionModel.deselect(last.value);
|
|
10897
10917
|
}
|
|
@@ -10910,7 +10930,8 @@ class MultiSelectComponent {
|
|
|
10910
10930
|
// takeUntilDestroyed(this.#destroyRef)
|
|
10911
10931
|
// )
|
|
10912
10932
|
// .subscribe();
|
|
10913
|
-
this.focusMonitorSubscription = this.focusMonitor
|
|
10933
|
+
this.focusMonitorSubscription = this.focusMonitor
|
|
10934
|
+
?.monitor(this.elementRef, true)
|
|
10914
10935
|
.pipe(
|
|
10915
10936
|
// to avoid focus lost on speed scrolling with virtualScroll
|
|
10916
10937
|
debounceTime(100), takeUntilDestroyed(this.#destroyRef))
|
|
@@ -10930,19 +10951,19 @@ class MultiSelectComponent {
|
|
|
10930
10951
|
if (!this.scrollViewport) {
|
|
10931
10952
|
this.scrollViewport = scrollViewport;
|
|
10932
10953
|
}
|
|
10933
|
-
const availableOptions = this.options.filter(option => option.visible);
|
|
10954
|
+
const availableOptions = this.options.filter((option) => option.visible);
|
|
10934
10955
|
const firstVisibleOption = availableOptions[scrolledIndex];
|
|
10935
|
-
const activeOptionIndex = availableOptions.findIndex(option => option.value === this.activeOption?.value);
|
|
10956
|
+
const activeOptionIndex = availableOptions.findIndex((option) => option.value === this.activeOption?.value);
|
|
10936
10957
|
const optionsArray = this.multiSelectOptionsContent.toArray();
|
|
10937
10958
|
if (scrolledIndex > activeOptionIndex) {
|
|
10938
|
-
const firstVisibleItem = optionsArray.find(option => option.value === firstVisibleOption?.value);
|
|
10959
|
+
const firstVisibleItem = optionsArray.find((option) => option.value === firstVisibleOption?.value);
|
|
10939
10960
|
if (firstVisibleItem && scrolledIndex) {
|
|
10940
10961
|
this.focusKeyManager.setActiveItem(firstVisibleItem);
|
|
10941
10962
|
}
|
|
10942
10963
|
return;
|
|
10943
10964
|
}
|
|
10944
10965
|
if (scrolledIndex + this.visibleItems - 2 <= activeOptionIndex) {
|
|
10945
|
-
const lastVisibleItem = optionsArray.findIndex(option => option.value === firstVisibleOption.value);
|
|
10966
|
+
const lastVisibleItem = optionsArray.findIndex((option) => option.value === firstVisibleOption.value);
|
|
10946
10967
|
if (lastVisibleItem > -1) {
|
|
10947
10968
|
this.focusKeyManager.setActiveItem(lastVisibleItem + this.visibleItems - 2);
|
|
10948
10969
|
}
|
|
@@ -10981,14 +11002,12 @@ class MultiSelectComponent {
|
|
|
10981
11002
|
return [...option.elementRef.nativeElement.parentElement.children]?.indexOf(option.elementRef.nativeElement);
|
|
10982
11003
|
};
|
|
10983
11004
|
const optionsChange$ = this.multiSelectOptionsContent.changes;
|
|
10984
|
-
const sortedOptions$ = optionsChange$.pipe(map(options => options.toArray()), filter(options => options.length > 0), map(options => options.sort((a, b) => indexOfOption(a) - indexOfOption(b))), takeUntilDestroyed(this.#destroyRef));
|
|
10985
|
-
sortedOptions
|
|
10986
|
-
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
10987
|
-
.subscribe(sortedOptions => {
|
|
11005
|
+
const sortedOptions$ = optionsChange$.pipe(map((options) => options.toArray()), filter((options) => options.length > 0), map((options) => options.sort((a, b) => indexOfOption(a) - indexOfOption(b))), takeUntilDestroyed(this.#destroyRef));
|
|
11006
|
+
sortedOptions$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((sortedOptions) => {
|
|
10988
11007
|
return this.multiSelectOptionsContent.reset(sortedOptions);
|
|
10989
11008
|
});
|
|
10990
11009
|
this.scrollViewportView.changes
|
|
10991
|
-
.pipe(take(1), map(changes => changes.toArray()[0]), tap((scrollViewport) => {
|
|
11010
|
+
.pipe(take(1), map((changes) => changes.toArray()[0]), tap((scrollViewport) => {
|
|
10992
11011
|
if (!this.scrollViewport) {
|
|
10993
11012
|
this.scrollViewport = scrollViewport;
|
|
10994
11013
|
const cdkVirtualScrollContentWrapper = this.scrollViewport.getElementRef().nativeElement?.firstElementChild;
|
|
@@ -10996,8 +11015,8 @@ class MultiSelectComponent {
|
|
|
10996
11015
|
const style = getComputedStyle(cdkVirtualScrollContentWrapper, null) ?? undefined;
|
|
10997
11016
|
const padding = parseInt(style?.getPropertyValue('padding-left') ?? '12px') * 3;
|
|
10998
11017
|
const observer = new MutationObserver((mutationRecords) => {
|
|
10999
|
-
mutationRecords.forEach(child => {
|
|
11000
|
-
child.addedNodes.forEach(node => {
|
|
11018
|
+
mutationRecords.forEach((child) => {
|
|
11019
|
+
child.addedNodes.forEach((node) => {
|
|
11001
11020
|
if (node.nodeName === 'C-MULTI-SELECT-OPTION') {
|
|
11002
11021
|
const width = node.offsetWidth;
|
|
11003
11022
|
if (width > this.itemMinWidth) {
|
|
@@ -11029,16 +11048,14 @@ class MultiSelectComponent {
|
|
|
11029
11048
|
this.focusKeyManager = new FocusKeyManager(focusableOptions)
|
|
11030
11049
|
.withHomeAndEnd()
|
|
11031
11050
|
.withPageUpDown()
|
|
11032
|
-
.skipPredicate((option) =>
|
|
11051
|
+
.skipPredicate((option) => option.disabled || !option.visible);
|
|
11033
11052
|
if (!this._virtualScroller) {
|
|
11034
11053
|
this.focusKeyManager.withTypeAhead(300);
|
|
11035
11054
|
}
|
|
11036
11055
|
this.focusKeyManager.tabOut
|
|
11037
11056
|
.pipe(takeUntilDestroyed(this.#destroyRef), tap(() => { }))
|
|
11038
11057
|
.subscribe();
|
|
11039
|
-
this.focusKeyManager.change
|
|
11040
|
-
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
11041
|
-
.subscribe(change => {
|
|
11058
|
+
this.focusKeyManager.change.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((change) => {
|
|
11042
11059
|
if (change < 0) {
|
|
11043
11060
|
this.activeOption ? this.focusKeyManager.setActiveItem(this.activeOption) : this.setFirstItemActive();
|
|
11044
11061
|
}
|
|
@@ -11056,21 +11073,26 @@ class MultiSelectComponent {
|
|
|
11056
11073
|
// }
|
|
11057
11074
|
}
|
|
11058
11075
|
get firstFocusableItem() {
|
|
11059
|
-
return this.multiSelectOptionsContent?.find(option => option.visible && !option.disabled) ??
|
|
11076
|
+
return (this.multiSelectOptionsContent?.find((option) => option.visible && !option.disabled) ??
|
|
11077
|
+
this.multiSelectOptionsView?.find((option) => option.visible && !option.disabled));
|
|
11060
11078
|
}
|
|
11061
11079
|
setFirstItemActive() {
|
|
11062
11080
|
const firstFocusableItem = this.firstFocusableItem;
|
|
11063
|
-
firstFocusableItem
|
|
11081
|
+
firstFocusableItem
|
|
11082
|
+
? this.focusKeyManager?.setActiveItem(firstFocusableItem)
|
|
11083
|
+
: this.focusKeyManager?.setFirstItemActive();
|
|
11064
11084
|
this.activeOption = this.focusKeyManager?.activeItem ?? null;
|
|
11065
11085
|
}
|
|
11066
11086
|
updateActiveItem(item) {
|
|
11067
11087
|
const firstFocusableItem = this.firstFocusableItem ?? item;
|
|
11068
|
-
firstFocusableItem
|
|
11088
|
+
firstFocusableItem
|
|
11089
|
+
? this.focusKeyManager?.updateActiveItem(firstFocusableItem)
|
|
11090
|
+
: this.focusKeyManager?.updateActiveItem(0);
|
|
11069
11091
|
if (this.focusKeyManager?.activeItem) {
|
|
11070
|
-
this.multiSelectOptionsContent?.forEach(option => {
|
|
11092
|
+
this.multiSelectOptionsContent?.forEach((option) => {
|
|
11071
11093
|
option.active = false;
|
|
11072
11094
|
});
|
|
11073
|
-
this.multiSelectOptionsView?.forEach(option => {
|
|
11095
|
+
this.multiSelectOptionsView?.forEach((option) => {
|
|
11074
11096
|
option.active = false;
|
|
11075
11097
|
});
|
|
11076
11098
|
this.focusKeyManager.activeItem.active = true;
|
|
@@ -11087,9 +11109,11 @@ class MultiSelectComponent {
|
|
|
11087
11109
|
I18nPluralPipe,
|
|
11088
11110
|
MultiSelectService,
|
|
11089
11111
|
{
|
|
11090
|
-
provide: NG_VALUE_ACCESSOR,
|
|
11112
|
+
provide: NG_VALUE_ACCESSOR,
|
|
11113
|
+
useExisting: forwardRef(() => MultiSelectComponent),
|
|
11114
|
+
multi: true
|
|
11091
11115
|
}
|
|
11092
|
-
], queries: [{ propertyName: "multiSelectOptionsContent", predicate: MultiSelectOptionComponent, descendants: true }, { propertyName: "contentTemplates", predicate: TemplateIdDirective, descendants: true }], viewQueries: [{ propertyName: "optionsElementRef", first: true, predicate: ["options"], descendants: true }, { propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true }, { propertyName: "dropdownMenu", first: true, predicate: ["dropdownMenu"], descendants: true }, { propertyName: "dropdown", first: true, predicate: DropdownComponent, descendants: true, read: ElementRef }, { propertyName: "dropdownToggle", first: true, predicate: DropdownToggleDirective, descendants: true, read: ElementRef }, { propertyName: "multiSelectOptionsView", predicate: MultiSelectOptionComponent, descendants: true }, { propertyName: "scrollViewportView", predicate: ["scrollViewport"], descendants: true }], exportAs: ["cMultiSelect"], usesOnChanges: true, ngImport: i0, template: "<c-dropdown #dropdown=\"cDropdown\"\n [(visible)]=\"visible\"\n [autoClose]=\"'outside'\"\n [ngClass]=\"multiselectClasses\"\n [popperOptions]=\"popperOptions\">\n <div #dropdownToggle=\"cDropdownToggle\" [caret]=\"false\" [disabled]=\"disabled\" cDropdownToggle role=\"button\"\n class=\"form-multi-select-input-group\">\n <span\n [ngClass]=\"{'form-multi-select-selection': true, 'form-multi-select-selection-tags': (selectionType === 'tags' && selectedOptions.length)}\">\n @if (selectionType === 'tags') {\n @if (optionsSelected$ | async; as optionTags) {\n @for (option of optionTags; track option.value; let i = $index) {\n <c-multi-select-tag\n (remove)=\"handleTagRemove($event)\"\n [disabled]=\"option.disabled ?? false\"\n [label]=\"option.label ?? option.value?.toString()\"\n [option]=\"option\"\n [value]=\"option.value\"\n class=\"form-multi-select-tag text-truncate\"\n tabindex=\"-1\"\n />\n }\n }\n } @else if (selectionType === 'text' && !!selectedOptions.length) {\n @for (option of selectedOptions; track option.value; let i = $index, last = $last) {\n <span class=\"form-multi-select-text text-truncate\">{{ option.label }}{{ last ? ' ' : ', ' }}</span>\n }\n }\n @if (!search) {\n <span class=\"text-placeholder text-truncate\">\n {{ optionsSelected.size === 0 ? placeholder : counterPlaceholderText }}\n </span>\n }\n @if (search) {\n <input\n #inputElement\n (keydown)=\"handleSearchKeyDown($event)\"\n (valueChange)=\"handleSearchValueChange($event)\"\n [attr.placeholder]=\"selectedOptions.length === 0 ? placeholder : counterPlaceholderText\"\n [disabled]=\"disabled || !search\"\n [ngClass]=\"{ 'form-multi-select-search': true, disabled: (disabled || !search), 'text-truncate': true }\"\n [ngModel]=\"searchValue\"\n [value]=\"searchValue\"\n autocomplete=\"off\"\n cMultiSelectSearch\n size=\"2\"\n tabindex=\"{{ disabled ? -1 : 0 }}\"\n type=\"text\"\n >\n }\n </span>\n <div class=\"form-multi-select-buttons\">\n @if (!!cleaner && optionsSelected.size > 0 && !disabled) {\n <button\n (click)=\"clearAllOptions($event)\"\n [disabled]=\"disabled || (!isDropdownVisible && cleaner !== 'active')\"\n aria-label=\"Clear all\"\n class=\"form-multi-select-cleaner\"\n type=\"button\"\n ></button>\n }\n <button (click)=\"handleIndicatorClick($event)\"\n [disabled]=\"disabled\"\n class=\"form-multi-select-indicator\"\n type=\"button\">\n </button>\n </div>\n </div>\n @if (!disabled) {\n <div #dropdownMenu=\"cDropdownMenu\" [visible]=\"dropdown.visible\" cDropdownMenu\n class=\"form-multi-select-dropdown\" role=\"menu\">\n @if (visibleOptions() && options.length > 0) {\n @if (selectAll && multiple && !virtualScroller) {\n <button\n (click)=\"selectAllOptions()\"\n class=\"form-multi-select-all\"\n type=\"button\"\n tabindex=\"0\"\n >\n {{ selectAllLabel }}\n </button>\n }\n }\n @if ((visibleOptions() && options.length > 0) || isLoading()) {\n <ng-container *ngTemplateOutlet=\"virtualScroller ? multiselectVirtualScroller : multiselectOptionsDiv\" />\n } @else {\n <div class=\"form-multi-select-options-empty\">{{ searchNoResultsLabel }}</div>\n }\n @if (isLoading()) {\n <c-element-cover [ngStyle]=\"{'border-radius': '6px', 'z-index': 2}\" />\n }\n </div>\n }\n</c-dropdown>\n\n<ng-template #multiselectVirtualScroller>\n @defer (on immediate) {\n @if ((optionsArray$ | async); as optionsArray) {\n <cdk-virtual-scroll-viewport\n #scrollViewport\n (scrolledIndexChange)=\"handleScrolledIndexChange($event, scrollViewport)\"\n [itemSize]=\"itemSize\"\n [ngStyle]=\"optionsMaxHeight !== 'auto' ? { 'height.px': optionsMaxHeight, 'maxHeight.px': optionsMaxHeight, 'minWidth.px': itemMinWidth ?? 196, overflowX: 'hidden' } : { 'minWidth.px': itemMinWidth ?? 196, overflowX: 'hidden'}\"\n maxBufferPx=\"{{itemSize * visibleItems}}\"\n minBufferPx=\"{{itemSize * visibleItems}}\"\n class=\"form-multi-select-options\"\n tabindex=\"-1\"\n >\n <ng-container\n #cdkVirtualFor\n *cdkVirtualFor=\"let option of optionsArray; trackBy: trackByFn; templateCacheSize: 0; even as even; odd as odd; index as index; count as count; first as first; last as last;\"\n [ngTemplateOutletContext]=\"{$implicit: option, even, odd, index, count, first, last}\"\n [ngTemplateOutlet]=\"templates['multiSelectOptionTemplate'] || defaultMultiSelectOptionTemplate\"\n />\n </cdk-virtual-scroll-viewport>\n }\n }\n</ng-template>\n\n<ng-template #multiselectOptionsDiv>\n <div\n [ngClass]=\"{'form-multi-select-options': visibleOptions()}\"\n [ngStyle]=\"optionsMaxHeight !== 'auto' ? { 'maxHeight.px': optionsMaxHeight, overflowY: 'scroll' } : {}\"\n >\n <ng-content />\n <ng-container [ngTemplateOutlet]=\"userOptionsTemplate\" />\n </div>\n</ng-template>\n\n<ng-template #defaultMultiSelectOptionTemplate let-option>\n <c-multi-select-option\n [disabled]=\"option.disabled\"\n [label]=\"option.label\"\n [text]=\"option.text\"\n [value]=\"option.value\"\n [visible]=\"option.visible\"\n >\n {{ option.text }}\n </c-multi-select-option>\n</ng-template>\n\n<ng-template #userOptionsTemplate>\n @for (option of userOptionsArray$ | async; track option; let even = $even, odd = $odd, index = $index, count = $count, first = $first, last = $last) {\n <ng-container\n [ngTemplateOutlet]=\"templates['multiSelectOptionTemplate'] || defaultMultiSelectOptionTemplate\"\n [ngTemplateOutletContext]=\"{$implicit: option, even, odd, index, count, first, last}\"\n />\n }\n</ng-template>\n", styles: [":host{display:block}:host:focus-visible{outline:none}:host.cdk-focused:not(.disabled) .form-multi-select{outline:none;box-shadow:0 0 0 var(--cui-focus-ring-width) var(--cui-focus-ring-color);border-radius:var(--cui-border-radius, .375rem)}:host:not(.cdk-focused) .form-multi-select:not(.show) input.form-multi-select-search:not([placeholder]){display:none}:host .form-multi-select .form-multi-select-selection{display:flex;flex:1 1 auto;flex-wrap:wrap}:host .form-multi-select .form-multi-select-selection .text-placeholder,:host .form-multi-select .form-multi-select-selection .form-multi-select-search::placeholder{color:var(--cui-form-multi-select-color);opacity:.8}:host .form-multi-select .form-multi-select-search[size]{display:flex}:host ::ng-deep .cdk-virtual-scroll-content-wrapper{padding:var(--cui-form-multi-select-options-padding-y) var(--cui-form-multi-select-options-padding-x);font-size:1rem;color:var(--cui-form-multi-select-options-color)}:host .cdk-virtual-scroll-viewport{width:var(--cui-dropdown-min-width)}:host .dropdown-menu{--cui-dropdown-padding-y: 0}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$3.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: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: MultiSelectTagComponent, selector: "c-multi-select-tag", inputs: ["option", "disabled", "label", "value"], outputs: ["remove"] }, { kind: "component", type: MultiSelectOptionComponent, selector: "c-multi-select-option", inputs: ["optionsStyle", "label", "text", "visible", "disabled", "selected", "value", "active", "role"], outputs: ["selectedChange", "focusChange"], exportAs: ["cMultiSelectOption"] }, { kind: "directive", type: MultiSelectSearchDirective, selector: "[cMultiSelectSearch]", inputs: ["delay", "value"], outputs: ["valueChange"], exportAs: ["cMultiSelectSearch"] }, { kind: "component", type: DropdownComponent, selector: "c-dropdown", inputs: ["alignment", "autoClose", "direction", "placement", "popper", "popperOptions", "variant", "visible"], outputs: ["visibleChange"], exportAs: ["cDropdown"] }, { kind: "directive", type: DropdownMenuDirective, selector: "[cDropdownMenu]", inputs: ["alignment", "visible"], exportAs: ["cDropdownMenu"] }, { kind: "directive", type: DropdownToggleDirective, selector: "[cDropdownToggle]", inputs: ["dropdownComponent", "disabled", "caret", "split"], exportAs: ["cDropdownToggle"] }, { kind: "component", type: ElementCoverComponent, selector: "c-element-cover, [cElementCover]", inputs: ["boundaries", "opacity"] }] }); }
|
|
11116
|
+
], queries: [{ propertyName: "multiSelectOptionsContent", predicate: MultiSelectOptionComponent, descendants: true }, { propertyName: "contentTemplates", predicate: TemplateIdDirective, descendants: true }], viewQueries: [{ propertyName: "optionsElementRef", first: true, predicate: ["options"], descendants: true }, { propertyName: "inputElement", first: true, predicate: ["inputElement"], descendants: true }, { propertyName: "dropdownMenu", first: true, predicate: DropdownMenuDirective, descendants: true, read: ElementRef }, { propertyName: "dropdown", first: true, predicate: DropdownComponent, descendants: true, read: ElementRef }, { propertyName: "dropdownToggle", first: true, predicate: DropdownToggleDirective, descendants: true, read: ElementRef }, { propertyName: "multiSelectOptionsView", predicate: MultiSelectOptionComponent, descendants: true }, { propertyName: "scrollViewportView", predicate: ["scrollViewport"], descendants: true }], exportAs: ["cMultiSelect"], usesOnChanges: true, ngImport: i0, template: "<c-dropdown #dropdown=\"cDropdown\"\n [(visible)]=\"visible\"\n [autoClose]=\"'outside'\"\n [ngClass]=\"multiselectClasses\"\n [popperOptions]=\"popperOptions\">\n <div #dropdownToggle=\"cDropdownToggle\" [caret]=\"false\" [disabled]=\"disabled\" cDropdownToggle role=\"button\"\n class=\"form-multi-select-input-group\">\n <span\n [ngClass]=\"{'form-multi-select-selection': true, 'form-multi-select-selection-tags': (selectionType === 'tags' && selectedOptions.length)}\">\n @if (selectionType === 'tags') {\n @if (optionsSelected$ | async; as optionTags) {\n @for (option of optionTags; track option.value; let i = $index) {\n <c-multi-select-tag\n (remove)=\"handleTagRemove($event)\"\n [disabled]=\"option.disabled ?? false\"\n [label]=\"option.label ?? option.value?.toString()\"\n [option]=\"option\"\n [value]=\"option.value\"\n class=\"form-multi-select-tag text-truncate\"\n tabindex=\"-1\"\n />\n }\n }\n } @else if (selectionType === 'text' && !!selectedOptions.length) {\n @for (option of selectedOptions; track option.value; let i = $index, last = $last) {\n <span class=\"form-multi-select-text text-truncate\">{{ option.label }}{{ last ? ' ' : ', ' }}</span>\n }\n }\n @if (!search) {\n <span class=\"text-placeholder text-truncate\">\n {{ optionsSelected.size === 0 ? placeholder : counterPlaceholderText }}\n </span>\n }\n @if (search) {\n <input\n #inputElement\n (keydown)=\"handleSearchKeyDown($event)\"\n (valueChange)=\"handleSearchValueChange($event)\"\n [attr.placeholder]=\"selectedOptions.length === 0 ? placeholder : counterPlaceholderText\"\n [disabled]=\"disabled || !search\"\n [ngClass]=\"{ 'form-multi-select-search': true, disabled: (disabled || !search), 'text-truncate': true }\"\n [ngModel]=\"searchValue\"\n [value]=\"searchValue\"\n autocomplete=\"off\"\n cMultiSelectSearch\n size=\"2\"\n tabindex=\"{{ disabled ? -1 : 0 }}\"\n type=\"text\"\n >\n }\n </span>\n <div class=\"form-multi-select-buttons\">\n @if (!!cleaner && optionsSelected.size > 0 && !disabled) {\n <button\n (click)=\"clearAllOptions($event)\"\n [disabled]=\"disabled || (!isDropdownVisible && cleaner !== 'active')\"\n aria-label=\"Clear all\"\n class=\"form-multi-select-cleaner\"\n type=\"button\"\n ></button>\n }\n <button (click)=\"handleIndicatorClick($event)\"\n [disabled]=\"disabled\"\n class=\"form-multi-select-indicator\"\n type=\"button\">\n </button>\n </div>\n </div>\n @if (!disabled) {\n <div #dropdownMenu=\"cDropdownMenu\" [visible]=\"dropdown.visible\" cDropdownMenu\n class=\"form-multi-select-dropdown\" role=\"menu\">\n @if (visibleOptions() && options.length > 0) {\n @if (selectAll && multiple && !virtualScroller) {\n <button\n (click)=\"selectAllOptions()\"\n class=\"form-multi-select-all\"\n type=\"button\"\n tabindex=\"0\"\n >\n {{ selectAllLabel }}\n </button>\n }\n }\n @if ((visibleOptions() && options.length > 0) || isLoading()) {\n <ng-container *ngTemplateOutlet=\"virtualScroller ? multiselectVirtualScroller : multiselectOptionsDiv\" />\n } @else {\n <div class=\"form-multi-select-options-empty\">{{ searchNoResultsLabel }}</div>\n }\n @if (isLoading()) {\n <c-element-cover [ngStyle]=\"{'border-radius': '6px', 'z-index': 2}\" />\n }\n </div>\n }\n</c-dropdown>\n\n<ng-template #multiselectVirtualScroller>\n @defer (on immediate) {\n @if ((optionsArray$ | async); as optionsArray) {\n <cdk-virtual-scroll-viewport\n #scrollViewport\n (scrolledIndexChange)=\"handleScrolledIndexChange($event, scrollViewport)\"\n [itemSize]=\"itemSize\"\n [ngStyle]=\"optionsMaxHeight !== 'auto' ? { 'height.px': optionsMaxHeight, 'maxHeight.px': optionsMaxHeight, 'minWidth.px': minWidth(), overflowX: 'hidden' } : { 'minWidth.px': minWidth(), overflowX: 'hidden'}\"\n maxBufferPx=\"{{itemSize * visibleItems}}\"\n minBufferPx=\"{{itemSize * visibleItems}}\"\n class=\"form-multi-select-options\"\n tabindex=\"-1\"\n >\n <ng-container\n #cdkVirtualFor\n *cdkVirtualFor=\"let option of optionsArray; trackBy: trackByFn; templateCacheSize: 0; even as even; odd as odd; index as index; count as count; first as first; last as last;\"\n [ngTemplateOutletContext]=\"{$implicit: option, even, odd, index, count, first, last}\"\n [ngTemplateOutlet]=\"templates['multiSelectOptionTemplate'] || defaultMultiSelectOptionTemplate\"\n />\n </cdk-virtual-scroll-viewport>\n }\n }\n</ng-template>\n\n<ng-template #multiselectOptionsDiv>\n <div\n [ngClass]=\"{'form-multi-select-options': visibleOptions()}\"\n [ngStyle]=\"optionsMaxHeight !== 'auto' ? { 'maxHeight.px': optionsMaxHeight, overflowY: 'scroll' } : {}\"\n >\n <ng-content />\n <ng-container [ngTemplateOutlet]=\"userOptionsTemplate\" />\n </div>\n</ng-template>\n\n<ng-template #defaultMultiSelectOptionTemplate let-option>\n <c-multi-select-option\n [disabled]=\"option.disabled\"\n [label]=\"option.label\"\n [text]=\"option.text\"\n [value]=\"option.value\"\n [visible]=\"option.visible\"\n >\n {{ option.text }}\n </c-multi-select-option>\n</ng-template>\n\n<ng-template #userOptionsTemplate>\n @for (option of userOptionsArray$ | async; track option; let even = $even, odd = $odd, index = $index, count = $count, first = $first, last = $last) {\n <ng-container\n [ngTemplateOutlet]=\"templates['multiSelectOptionTemplate'] || defaultMultiSelectOptionTemplate\"\n [ngTemplateOutletContext]=\"{$implicit: option, even, odd, index, count, first, last}\"\n />\n }\n</ng-template>\n", styles: [":host{display:block}:host:focus-visible{outline:none}:host.cdk-focused:not(.disabled) .form-multi-select{outline:none;box-shadow:0 0 0 var(--cui-focus-ring-width) var(--cui-focus-ring-color);border-radius:var(--cui-border-radius, .375rem)}:host:not(.cdk-focused) .form-multi-select:not(.show) input.form-multi-select-search:not([placeholder]){display:none}:host .form-multi-select .form-multi-select-selection{display:flex;flex:1 1 auto;flex-wrap:wrap}:host .form-multi-select .form-multi-select-selection .text-placeholder,:host .form-multi-select .form-multi-select-selection .form-multi-select-search::placeholder{color:var(--cui-form-multi-select-color);opacity:.8}:host .form-multi-select .form-multi-select-search[size]{display:flex}:host ::ng-deep .cdk-virtual-scroll-content-wrapper{padding:var(--cui-form-multi-select-options-padding-y) var(--cui-form-multi-select-options-padding-x);font-size:1rem;color:var(--cui-form-multi-select-options-color)}:host .cdk-virtual-scroll-viewport{width:var(--cui-dropdown-min-width)}:host .dropdown-menu{--cui-dropdown-padding-y: 0}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }, { kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1$3.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: i1$3.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1$3.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: MultiSelectTagComponent, selector: "c-multi-select-tag", inputs: ["option", "disabled", "label", "value"], outputs: ["remove"] }, { kind: "component", type: MultiSelectOptionComponent, selector: "c-multi-select-option", inputs: ["optionsStyle", "label", "text", "visible", "disabled", "selected", "value", "active", "role"], outputs: ["selectedChange", "focusChange"], exportAs: ["cMultiSelectOption"] }, { kind: "directive", type: MultiSelectSearchDirective, selector: "[cMultiSelectSearch]", inputs: ["delay", "value"], outputs: ["valueChange"], exportAs: ["cMultiSelectSearch"] }, { kind: "component", type: DropdownComponent, selector: "c-dropdown", inputs: ["alignment", "autoClose", "direction", "placement", "popper", "popperOptions", "variant", "visible"], outputs: ["visibleChange"], exportAs: ["cDropdown"] }, { kind: "directive", type: DropdownMenuDirective, selector: "[cDropdownMenu]", inputs: ["alignment", "visible"], exportAs: ["cDropdownMenu"] }, { kind: "directive", type: DropdownToggleDirective, selector: "[cDropdownToggle]", inputs: ["dropdownComponent", "disabled", "caret", "split"], exportAs: ["cDropdownToggle"] }, { kind: "component", type: ElementCoverComponent, selector: "c-element-cover, [cElementCover]", inputs: ["boundaries", "opacity"] }] }); }
|
|
11093
11117
|
}
|
|
11094
11118
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: MultiSelectComponent, decorators: [{
|
|
11095
11119
|
type: Component,
|
|
@@ -11097,7 +11121,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
11097
11121
|
I18nPluralPipe,
|
|
11098
11122
|
MultiSelectService,
|
|
11099
11123
|
{
|
|
11100
|
-
provide: NG_VALUE_ACCESSOR,
|
|
11124
|
+
provide: NG_VALUE_ACCESSOR,
|
|
11125
|
+
useExisting: forwardRef(() => MultiSelectComponent),
|
|
11126
|
+
multi: true
|
|
11101
11127
|
}
|
|
11102
11128
|
], standalone: true, imports: [
|
|
11103
11129
|
AsyncPipe,
|
|
@@ -11117,7 +11143,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
11117
11143
|
DropdownMenuDirective,
|
|
11118
11144
|
DropdownToggleDirective,
|
|
11119
11145
|
ElementCoverComponent
|
|
11120
|
-
], template: "<c-dropdown #dropdown=\"cDropdown\"\n [(visible)]=\"visible\"\n [autoClose]=\"'outside'\"\n [ngClass]=\"multiselectClasses\"\n [popperOptions]=\"popperOptions\">\n <div #dropdownToggle=\"cDropdownToggle\" [caret]=\"false\" [disabled]=\"disabled\" cDropdownToggle role=\"button\"\n class=\"form-multi-select-input-group\">\n <span\n [ngClass]=\"{'form-multi-select-selection': true, 'form-multi-select-selection-tags': (selectionType === 'tags' && selectedOptions.length)}\">\n @if (selectionType === 'tags') {\n @if (optionsSelected$ | async; as optionTags) {\n @for (option of optionTags; track option.value; let i = $index) {\n <c-multi-select-tag\n (remove)=\"handleTagRemove($event)\"\n [disabled]=\"option.disabled ?? false\"\n [label]=\"option.label ?? option.value?.toString()\"\n [option]=\"option\"\n [value]=\"option.value\"\n class=\"form-multi-select-tag text-truncate\"\n tabindex=\"-1\"\n />\n }\n }\n } @else if (selectionType === 'text' && !!selectedOptions.length) {\n @for (option of selectedOptions; track option.value; let i = $index, last = $last) {\n <span class=\"form-multi-select-text text-truncate\">{{ option.label }}{{ last ? ' ' : ', ' }}</span>\n }\n }\n @if (!search) {\n <span class=\"text-placeholder text-truncate\">\n {{ optionsSelected.size === 0 ? placeholder : counterPlaceholderText }}\n </span>\n }\n @if (search) {\n <input\n #inputElement\n (keydown)=\"handleSearchKeyDown($event)\"\n (valueChange)=\"handleSearchValueChange($event)\"\n [attr.placeholder]=\"selectedOptions.length === 0 ? placeholder : counterPlaceholderText\"\n [disabled]=\"disabled || !search\"\n [ngClass]=\"{ 'form-multi-select-search': true, disabled: (disabled || !search), 'text-truncate': true }\"\n [ngModel]=\"searchValue\"\n [value]=\"searchValue\"\n autocomplete=\"off\"\n cMultiSelectSearch\n size=\"2\"\n tabindex=\"{{ disabled ? -1 : 0 }}\"\n type=\"text\"\n >\n }\n </span>\n <div class=\"form-multi-select-buttons\">\n @if (!!cleaner && optionsSelected.size > 0 && !disabled) {\n <button\n (click)=\"clearAllOptions($event)\"\n [disabled]=\"disabled || (!isDropdownVisible && cleaner !== 'active')\"\n aria-label=\"Clear all\"\n class=\"form-multi-select-cleaner\"\n type=\"button\"\n ></button>\n }\n <button (click)=\"handleIndicatorClick($event)\"\n [disabled]=\"disabled\"\n class=\"form-multi-select-indicator\"\n type=\"button\">\n </button>\n </div>\n </div>\n @if (!disabled) {\n <div #dropdownMenu=\"cDropdownMenu\" [visible]=\"dropdown.visible\" cDropdownMenu\n class=\"form-multi-select-dropdown\" role=\"menu\">\n @if (visibleOptions() && options.length > 0) {\n @if (selectAll && multiple && !virtualScroller) {\n <button\n (click)=\"selectAllOptions()\"\n class=\"form-multi-select-all\"\n type=\"button\"\n tabindex=\"0\"\n >\n {{ selectAllLabel }}\n </button>\n }\n }\n @if ((visibleOptions() && options.length > 0) || isLoading()) {\n <ng-container *ngTemplateOutlet=\"virtualScroller ? multiselectVirtualScroller : multiselectOptionsDiv\" />\n } @else {\n <div class=\"form-multi-select-options-empty\">{{ searchNoResultsLabel }}</div>\n }\n @if (isLoading()) {\n <c-element-cover [ngStyle]=\"{'border-radius': '6px', 'z-index': 2}\" />\n }\n </div>\n }\n</c-dropdown>\n\n<ng-template #multiselectVirtualScroller>\n @defer (on immediate) {\n @if ((optionsArray$ | async); as optionsArray) {\n <cdk-virtual-scroll-viewport\n #scrollViewport\n (scrolledIndexChange)=\"handleScrolledIndexChange($event, scrollViewport)\"\n [itemSize]=\"itemSize\"\n [ngStyle]=\"optionsMaxHeight !== 'auto' ? { 'height.px': optionsMaxHeight, 'maxHeight.px': optionsMaxHeight, 'minWidth.px':
|
|
11146
|
+
], template: "<c-dropdown #dropdown=\"cDropdown\"\n [(visible)]=\"visible\"\n [autoClose]=\"'outside'\"\n [ngClass]=\"multiselectClasses\"\n [popperOptions]=\"popperOptions\">\n <div #dropdownToggle=\"cDropdownToggle\" [caret]=\"false\" [disabled]=\"disabled\" cDropdownToggle role=\"button\"\n class=\"form-multi-select-input-group\">\n <span\n [ngClass]=\"{'form-multi-select-selection': true, 'form-multi-select-selection-tags': (selectionType === 'tags' && selectedOptions.length)}\">\n @if (selectionType === 'tags') {\n @if (optionsSelected$ | async; as optionTags) {\n @for (option of optionTags; track option.value; let i = $index) {\n <c-multi-select-tag\n (remove)=\"handleTagRemove($event)\"\n [disabled]=\"option.disabled ?? false\"\n [label]=\"option.label ?? option.value?.toString()\"\n [option]=\"option\"\n [value]=\"option.value\"\n class=\"form-multi-select-tag text-truncate\"\n tabindex=\"-1\"\n />\n }\n }\n } @else if (selectionType === 'text' && !!selectedOptions.length) {\n @for (option of selectedOptions; track option.value; let i = $index, last = $last) {\n <span class=\"form-multi-select-text text-truncate\">{{ option.label }}{{ last ? ' ' : ', ' }}</span>\n }\n }\n @if (!search) {\n <span class=\"text-placeholder text-truncate\">\n {{ optionsSelected.size === 0 ? placeholder : counterPlaceholderText }}\n </span>\n }\n @if (search) {\n <input\n #inputElement\n (keydown)=\"handleSearchKeyDown($event)\"\n (valueChange)=\"handleSearchValueChange($event)\"\n [attr.placeholder]=\"selectedOptions.length === 0 ? placeholder : counterPlaceholderText\"\n [disabled]=\"disabled || !search\"\n [ngClass]=\"{ 'form-multi-select-search': true, disabled: (disabled || !search), 'text-truncate': true }\"\n [ngModel]=\"searchValue\"\n [value]=\"searchValue\"\n autocomplete=\"off\"\n cMultiSelectSearch\n size=\"2\"\n tabindex=\"{{ disabled ? -1 : 0 }}\"\n type=\"text\"\n >\n }\n </span>\n <div class=\"form-multi-select-buttons\">\n @if (!!cleaner && optionsSelected.size > 0 && !disabled) {\n <button\n (click)=\"clearAllOptions($event)\"\n [disabled]=\"disabled || (!isDropdownVisible && cleaner !== 'active')\"\n aria-label=\"Clear all\"\n class=\"form-multi-select-cleaner\"\n type=\"button\"\n ></button>\n }\n <button (click)=\"handleIndicatorClick($event)\"\n [disabled]=\"disabled\"\n class=\"form-multi-select-indicator\"\n type=\"button\">\n </button>\n </div>\n </div>\n @if (!disabled) {\n <div #dropdownMenu=\"cDropdownMenu\" [visible]=\"dropdown.visible\" cDropdownMenu\n class=\"form-multi-select-dropdown\" role=\"menu\">\n @if (visibleOptions() && options.length > 0) {\n @if (selectAll && multiple && !virtualScroller) {\n <button\n (click)=\"selectAllOptions()\"\n class=\"form-multi-select-all\"\n type=\"button\"\n tabindex=\"0\"\n >\n {{ selectAllLabel }}\n </button>\n }\n }\n @if ((visibleOptions() && options.length > 0) || isLoading()) {\n <ng-container *ngTemplateOutlet=\"virtualScroller ? multiselectVirtualScroller : multiselectOptionsDiv\" />\n } @else {\n <div class=\"form-multi-select-options-empty\">{{ searchNoResultsLabel }}</div>\n }\n @if (isLoading()) {\n <c-element-cover [ngStyle]=\"{'border-radius': '6px', 'z-index': 2}\" />\n }\n </div>\n }\n</c-dropdown>\n\n<ng-template #multiselectVirtualScroller>\n @defer (on immediate) {\n @if ((optionsArray$ | async); as optionsArray) {\n <cdk-virtual-scroll-viewport\n #scrollViewport\n (scrolledIndexChange)=\"handleScrolledIndexChange($event, scrollViewport)\"\n [itemSize]=\"itemSize\"\n [ngStyle]=\"optionsMaxHeight !== 'auto' ? { 'height.px': optionsMaxHeight, 'maxHeight.px': optionsMaxHeight, 'minWidth.px': minWidth(), overflowX: 'hidden' } : { 'minWidth.px': minWidth(), overflowX: 'hidden'}\"\n maxBufferPx=\"{{itemSize * visibleItems}}\"\n minBufferPx=\"{{itemSize * visibleItems}}\"\n class=\"form-multi-select-options\"\n tabindex=\"-1\"\n >\n <ng-container\n #cdkVirtualFor\n *cdkVirtualFor=\"let option of optionsArray; trackBy: trackByFn; templateCacheSize: 0; even as even; odd as odd; index as index; count as count; first as first; last as last;\"\n [ngTemplateOutletContext]=\"{$implicit: option, even, odd, index, count, first, last}\"\n [ngTemplateOutlet]=\"templates['multiSelectOptionTemplate'] || defaultMultiSelectOptionTemplate\"\n />\n </cdk-virtual-scroll-viewport>\n }\n }\n</ng-template>\n\n<ng-template #multiselectOptionsDiv>\n <div\n [ngClass]=\"{'form-multi-select-options': visibleOptions()}\"\n [ngStyle]=\"optionsMaxHeight !== 'auto' ? { 'maxHeight.px': optionsMaxHeight, overflowY: 'scroll' } : {}\"\n >\n <ng-content />\n <ng-container [ngTemplateOutlet]=\"userOptionsTemplate\" />\n </div>\n</ng-template>\n\n<ng-template #defaultMultiSelectOptionTemplate let-option>\n <c-multi-select-option\n [disabled]=\"option.disabled\"\n [label]=\"option.label\"\n [text]=\"option.text\"\n [value]=\"option.value\"\n [visible]=\"option.visible\"\n >\n {{ option.text }}\n </c-multi-select-option>\n</ng-template>\n\n<ng-template #userOptionsTemplate>\n @for (option of userOptionsArray$ | async; track option; let even = $even, odd = $odd, index = $index, count = $count, first = $first, last = $last) {\n <ng-container\n [ngTemplateOutlet]=\"templates['multiSelectOptionTemplate'] || defaultMultiSelectOptionTemplate\"\n [ngTemplateOutletContext]=\"{$implicit: option, even, odd, index, count, first, last}\"\n />\n }\n</ng-template>\n", styles: [":host{display:block}:host:focus-visible{outline:none}:host.cdk-focused:not(.disabled) .form-multi-select{outline:none;box-shadow:0 0 0 var(--cui-focus-ring-width) var(--cui-focus-ring-color);border-radius:var(--cui-border-radius, .375rem)}:host:not(.cdk-focused) .form-multi-select:not(.show) input.form-multi-select-search:not([placeholder]){display:none}:host .form-multi-select .form-multi-select-selection{display:flex;flex:1 1 auto;flex-wrap:wrap}:host .form-multi-select .form-multi-select-selection .text-placeholder,:host .form-multi-select .form-multi-select-selection .form-multi-select-search::placeholder{color:var(--cui-form-multi-select-color);opacity:.8}:host .form-multi-select .form-multi-select-search[size]{display:flex}:host ::ng-deep .cdk-virtual-scroll-content-wrapper{padding:var(--cui-form-multi-select-options-padding-y) var(--cui-form-multi-select-options-padding-x);font-size:1rem;color:var(--cui-form-multi-select-options-color)}:host .cdk-virtual-scroll-viewport{width:var(--cui-dropdown-min-width)}:host .dropdown-menu{--cui-dropdown-padding-y: 0}\n"] }]
|
|
11121
11147
|
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i0.ChangeDetectorRef }, { type: i0.ViewContainerRef }, { type: i1$2.FocusMonitor }, { type: MultiSelectService }, { type: i0.IterableDiffers }], propDecorators: { allowCreateOptions: [{
|
|
11122
11148
|
type: Input,
|
|
11123
11149
|
args: [{ transform: booleanAttribute }]
|
|
@@ -11212,7 +11238,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
11212
11238
|
args: ['inputElement']
|
|
11213
11239
|
}], dropdownMenu: [{
|
|
11214
11240
|
type: ViewChild,
|
|
11215
|
-
args: [
|
|
11241
|
+
args: [DropdownMenuDirective, { read: ElementRef }]
|
|
11216
11242
|
}], dropdown: [{
|
|
11217
11243
|
type: ViewChild,
|
|
11218
11244
|
args: [DropdownComponent, { read: ElementRef }]
|