@coreui/angular-pro 5.1.3 → 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.
- package/esm2022/lib/date-picker/date-picker.component.mjs +14 -20
- package/esm2022/lib/date-range-picker/date-range-picker/date-range-picker.component.mjs +133 -135
- package/esm2022/lib/multi-select/multi-select/multi-select.component.mjs +106 -80
- package/fesm2022/coreui-angular-pro.mjs +248 -231
- package/fesm2022/coreui-angular-pro.mjs.map +1 -1
- package/lib/date-picker/date-picker.component.d.ts +4 -5
- package/lib/date-range-picker/date-range-picker/date-range-picker.component.d.ts +13 -20
- package/lib/multi-select/multi-select/multi-select.component.d.ts +5 -4
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ElementRef, Directive, Input, TemplateRef, Renderer2, booleanAttribute, NgModule, HostBinding, Injectable, Component, EventEmitter, Output, ContentChildren, HostListener, DestroyRef, signal, effect, RendererFactory2, Pipe, computed, numberAttribute, ViewChildren, PLATFORM_ID, Inject, afterNextRender, AfterRenderPhase, ViewChild, forwardRef, ContentChild, Optional,
|
|
2
|
+
import { inject, ElementRef, Directive, Input, TemplateRef, Renderer2, booleanAttribute, NgModule, HostBinding, Injectable, Component, EventEmitter, Output, ContentChildren, HostListener, DestroyRef, signal, effect, RendererFactory2, Pipe, computed, numberAttribute, ViewChildren, PLATFORM_ID, Inject, afterNextRender, AfterRenderPhase, ViewChild, forwardRef, ContentChild, Optional, model, input, ChangeDetectionStrategy, output, NgZone, ViewContainerRef, contentChildren, viewChildren, untracked } from '@angular/core';
|
|
3
3
|
import { NgTemplateOutlet, DOCUMENT, NgClass, NgOptimizedImage, AsyncPipe, NgStyle, isPlatformServer, isPlatformBrowser, formatDate, I18nPluralPipe, JsonPipe } from '@angular/common';
|
|
4
4
|
import * as i1 from '@angular/animations';
|
|
5
5
|
import { animation, animate, style, useAnimation, trigger, state, transition, group, query } from '@angular/animations';
|
|
6
|
-
import { takeUntilDestroyed, toObservable, toSignal } from '@angular/core/rxjs-interop';
|
|
6
|
+
import { takeUntilDestroyed, toObservable, outputToObservable, toSignal } from '@angular/core/rxjs-interop';
|
|
7
7
|
import { fromEvent, Subject, BehaviorSubject, Observable, skip, merge, takeWhile, distinctUntilChanged as distinctUntilChanged$1, map as map$1, debounceTime as debounceTime$1 } from 'rxjs';
|
|
8
8
|
import * as i1$1 from '@angular/router';
|
|
9
9
|
import { RouterModule, NavigationEnd, RouterLink } from '@angular/router';
|
|
@@ -7710,6 +7710,35 @@ class DateRangePickerComponent {
|
|
|
7710
7710
|
* @default false
|
|
7711
7711
|
*/
|
|
7712
7712
|
this.visible = false;
|
|
7713
|
+
this.startDateModel = model(undefined, {
|
|
7714
|
+
alias: 'startDate'
|
|
7715
|
+
});
|
|
7716
|
+
this.dateModelEffect = effect(() => {
|
|
7717
|
+
this.dateRangeGroup.patchValue({ startDateInput: this.startDateValue(), endDateInput: this.endDateValue() });
|
|
7718
|
+
});
|
|
7719
|
+
this.startDateChange = outputToObservable(this.startDateModel);
|
|
7720
|
+
this.startDate = computed(() => {
|
|
7721
|
+
const prevDate = this.#startDate ? new Date(this.#startDate) : null;
|
|
7722
|
+
const currDate = this.startDateModel() ? new Date(this.startDateModel()) : null;
|
|
7723
|
+
if (prevDate?.getTime() !== currDate?.getTime()) {
|
|
7724
|
+
return currDate;
|
|
7725
|
+
}
|
|
7726
|
+
return prevDate;
|
|
7727
|
+
});
|
|
7728
|
+
this.#startDate = null;
|
|
7729
|
+
this.endDateModel = model(undefined, {
|
|
7730
|
+
alias: 'endDate'
|
|
7731
|
+
});
|
|
7732
|
+
this.endDateChange = outputToObservable(this.endDateModel);
|
|
7733
|
+
this.endDate = computed(() => {
|
|
7734
|
+
const prevDate = this.#endDate ? new Date(this.#endDate) : null;
|
|
7735
|
+
const currDate = this.endDateModel() ? new Date(this.endDateModel()) : null;
|
|
7736
|
+
if (prevDate?.getTime() !== currDate?.getTime()) {
|
|
7737
|
+
return currDate;
|
|
7738
|
+
}
|
|
7739
|
+
return prevDate;
|
|
7740
|
+
});
|
|
7741
|
+
this.#endDate = null;
|
|
7713
7742
|
this.calendarDate = new Date();
|
|
7714
7743
|
this.disabledDates = [];
|
|
7715
7744
|
/**
|
|
@@ -7718,7 +7747,7 @@ class DateRangePickerComponent {
|
|
|
7718
7747
|
* @default 1 (Monday)
|
|
7719
7748
|
*/
|
|
7720
7749
|
this.firstDayOfWeek = 1;
|
|
7721
|
-
this.locale = 'default';
|
|
7750
|
+
this.locale = input('default');
|
|
7722
7751
|
this.maxDate = null;
|
|
7723
7752
|
this.minDate = null;
|
|
7724
7753
|
/**
|
|
@@ -7779,27 +7808,39 @@ class DateRangePickerComponent {
|
|
|
7779
7808
|
this.valueChange = new EventEmitter();
|
|
7780
7809
|
this.calendarCellHover = new EventEmitter();
|
|
7781
7810
|
this.calendarDateChange = new EventEmitter();
|
|
7782
|
-
this.endDateChange = new EventEmitter();
|
|
7783
|
-
this.startDateChange = new EventEmitter();
|
|
7784
7811
|
this.templates = {};
|
|
7785
7812
|
this.dateChangeSubscriptions = [];
|
|
7786
7813
|
this.isMobile = true;
|
|
7787
7814
|
this.showRanges = false;
|
|
7788
|
-
this.
|
|
7789
|
-
|
|
7815
|
+
this.startDateValue = computed(() => {
|
|
7816
|
+
const locale = this.locale() ?? 'default';
|
|
7817
|
+
const dateFormatted = this.formatDate(this.startDate());
|
|
7818
|
+
this.#startDate = this.startDate();
|
|
7819
|
+
return dateFormatted;
|
|
7820
|
+
});
|
|
7821
|
+
this.endDateValue = computed(() => {
|
|
7822
|
+
const locale = this.locale() ?? 'default';
|
|
7823
|
+
const dateFormatted = this.formatDate(this.endDate());
|
|
7824
|
+
this.#endDate = this.endDate();
|
|
7825
|
+
return dateFormatted;
|
|
7826
|
+
});
|
|
7790
7827
|
// todo: validation
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
]);
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
]);
|
|
7828
|
+
// startDateInput = new FormControl({ value: this.startDateValue, disabled: this.disabled }, [
|
|
7829
|
+
// Validators.required
|
|
7830
|
+
// // Validators.minLength(8),
|
|
7831
|
+
// // Validators.maxLength(10),
|
|
7832
|
+
// // invalidDateStringValidator(this.locale)
|
|
7833
|
+
// ]);
|
|
7834
|
+
// endDateInput = new FormControl({ value: this.endDateValue, disabled: this.disabled }, [
|
|
7835
|
+
// Validators.required
|
|
7836
|
+
// // Validators.minLength(8),
|
|
7837
|
+
// // Validators.maxLength(10),
|
|
7838
|
+
// // invalidDateStringValidator(this.locale)
|
|
7839
|
+
// ]);
|
|
7840
|
+
this.dateRangeGroup = new FormGroup({
|
|
7841
|
+
startDateInput: new FormControl({ value: '', disabled: this.disabled }, [Validators.required]),
|
|
7842
|
+
endDateInput: new FormControl({ value: '', disabled: this.disabled }, [Validators.required])
|
|
7843
|
+
});
|
|
7803
7844
|
this.#breakpoints = {
|
|
7804
7845
|
OneCalendarRanges: '(min-width: 480px)',
|
|
7805
7846
|
TwoCalendars: '(max-width: 650px)',
|
|
@@ -7841,32 +7882,11 @@ class DateRangePickerComponent {
|
|
|
7841
7882
|
// return this.#timepicker;
|
|
7842
7883
|
}
|
|
7843
7884
|
#timepicker;
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
this._startDate = value ? new Date(value) : null;
|
|
7847
|
-
if (prevDate?.getTime() !== this._startDate?.getTime()) {
|
|
7848
|
-
this.startDateValue = this.formatDate(this._startDate);
|
|
7849
|
-
this.startDateChange.emit(this._startDate);
|
|
7850
|
-
}
|
|
7851
|
-
}
|
|
7852
|
-
get startDate() {
|
|
7853
|
-
return this._startDate;
|
|
7854
|
-
}
|
|
7855
|
-
set endDate(value) {
|
|
7856
|
-
const prevDate = this._endDate ? new Date(this._endDate ?? 0) : null;
|
|
7857
|
-
this._endDate = value ? new Date(value) : null;
|
|
7858
|
-
if (prevDate?.getTime() !== this._endDate?.getTime()) {
|
|
7859
|
-
this.endDateValue = this.formatDate(this._endDate);
|
|
7860
|
-
this.endDateChange.emit(this._endDate);
|
|
7861
|
-
}
|
|
7862
|
-
}
|
|
7863
|
-
get endDate() {
|
|
7864
|
-
return this._endDate;
|
|
7865
|
-
}
|
|
7885
|
+
#startDate;
|
|
7886
|
+
#endDate;
|
|
7866
7887
|
set disabled(value) {
|
|
7867
7888
|
this.#disabled = value;
|
|
7868
|
-
this.#disabled ? this.
|
|
7869
|
-
this.#disabled ? this.endDateInput.disable() : this.endDateInput.enable();
|
|
7889
|
+
this.#disabled ? this.dateRangeGroup.disable() : this.dateRangeGroup.enable();
|
|
7870
7890
|
}
|
|
7871
7891
|
get disabled() {
|
|
7872
7892
|
return this.#disabled;
|
|
@@ -7876,16 +7896,10 @@ class DateRangePickerComponent {
|
|
|
7876
7896
|
const newValue = this.range ? { ...value } : value;
|
|
7877
7897
|
if (JSON.stringify(this._value) !== JSON.stringify(newValue)) {
|
|
7878
7898
|
this._value = newValue;
|
|
7879
|
-
if (this.range) {
|
|
7880
|
-
this.handleStartDateChange(newValue.startDate ?? null);
|
|
7881
|
-
this.handleEndDateChange(newValue.endDate ?? null);
|
|
7882
|
-
}
|
|
7883
|
-
else {
|
|
7884
|
-
this.handleStartDateChange(newValue ?? null);
|
|
7885
|
-
}
|
|
7886
7899
|
this.onChange(newValue);
|
|
7887
7900
|
this.onTouched();
|
|
7888
7901
|
this.valueChange.emit(this.value);
|
|
7902
|
+
// this.dateRangeGroup.setValue({ startDateInput: this.startDateValue(), endDateInput: this.endDateValue() });
|
|
7889
7903
|
if (this.closeOnSelect) {
|
|
7890
7904
|
const hasValue = this.range ? !!(this.value.startDate && this.value.endDate) : !!this.value;
|
|
7891
7905
|
this.visible = !hasValue;
|
|
@@ -7898,45 +7912,35 @@ class DateRangePickerComponent {
|
|
|
7898
7912
|
subscribeDateChange(subscribe = true) {
|
|
7899
7913
|
if (subscribe) {
|
|
7900
7914
|
// todo
|
|
7901
|
-
// this.dateChangeSubscriptions.push(
|
|
7902
|
-
// this.
|
|
7903
|
-
//
|
|
7904
|
-
//
|
|
7905
|
-
// this.
|
|
7906
|
-
//
|
|
7907
|
-
//
|
|
7908
|
-
//
|
|
7915
|
+
// this.dateChangeSubscriptions.push(
|
|
7916
|
+
// this.startDateChange.subscribe((next) => {
|
|
7917
|
+
// // console.log('startDateChange', next);
|
|
7918
|
+
// // this.startDate = next;
|
|
7919
|
+
// // this.onChange(next);
|
|
7920
|
+
// })
|
|
7921
|
+
// );
|
|
7922
|
+
// this.dateChangeSubscriptions.push(
|
|
7923
|
+
// this.endDateChange.subscribe((next) => {
|
|
7924
|
+
// // console.log('endDateChange', next);
|
|
7925
|
+
// // this.endDate = next;
|
|
7926
|
+
// // this.onChange(next);
|
|
7927
|
+
// })
|
|
7928
|
+
// );
|
|
7909
7929
|
return;
|
|
7910
7930
|
}
|
|
7911
|
-
this.dateChangeSubscriptions.forEach(subscription => {
|
|
7931
|
+
this.dateChangeSubscriptions.forEach((subscription) => {
|
|
7912
7932
|
subscription?.unsubscribe();
|
|
7913
7933
|
});
|
|
7914
7934
|
}
|
|
7915
7935
|
onBlur() {
|
|
7916
7936
|
this.onTouched();
|
|
7917
7937
|
}
|
|
7918
|
-
set startDateValue(value) {
|
|
7919
|
-
this.startDateInput.setValue(value);
|
|
7920
|
-
this._startDateValue = value;
|
|
7921
|
-
}
|
|
7922
|
-
get startDateValue() {
|
|
7923
|
-
return this._startDateValue;
|
|
7924
|
-
}
|
|
7925
|
-
set endDateValue(value) {
|
|
7926
|
-
this.endDateInput.setValue(value);
|
|
7927
|
-
this._endDateValue = value;
|
|
7928
|
-
}
|
|
7929
|
-
get endDateValue() {
|
|
7930
|
-
return this._endDateValue;
|
|
7931
|
-
}
|
|
7932
7938
|
get startDatePlaceholder() {
|
|
7933
7939
|
return Array.isArray(this.placeholder) ? this.placeholder[0] : this.placeholder;
|
|
7934
7940
|
}
|
|
7935
|
-
;
|
|
7936
7941
|
get endDatePlaceholder() {
|
|
7937
7942
|
return Array.isArray(this.placeholder) ? this.placeholder[1] : this.placeholder;
|
|
7938
7943
|
}
|
|
7939
|
-
;
|
|
7940
7944
|
set inputStartHoverValue(value) {
|
|
7941
7945
|
this._inputStartHoverValue = value;
|
|
7942
7946
|
}
|
|
@@ -7959,30 +7963,32 @@ class DateRangePickerComponent {
|
|
|
7959
7963
|
};
|
|
7960
7964
|
}
|
|
7961
7965
|
formatDate(date) {
|
|
7962
|
-
return !date || !isValidDate(date)
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7966
|
+
return !date || !isValidDate(date)
|
|
7967
|
+
? ''
|
|
7968
|
+
: typeof this.inputDateFormat === 'function'
|
|
7969
|
+
? this.inputDateFormat(date)
|
|
7970
|
+
: !!this.format && !!this.locale() && this.locale() !== 'default'
|
|
7971
|
+
? formatDate(date, this.format, this.locale())
|
|
7972
|
+
: this.timepicker
|
|
7973
|
+
? date.toLocaleString(this.locale())
|
|
7974
|
+
: date.toLocaleDateString(this.locale());
|
|
7967
7975
|
}
|
|
7968
7976
|
#breakpoints;
|
|
7969
7977
|
ngOnInit() {
|
|
7970
7978
|
this.customRanges = this.ranges ? Object.entries(this.ranges) : [];
|
|
7971
7979
|
const breakpoints = this.#breakpoints;
|
|
7972
|
-
this.layoutChanges = this.breakpointObserver
|
|
7973
|
-
breakpoints.OneCalendarRanges,
|
|
7974
|
-
|
|
7975
|
-
breakpoints.TwoCalendarsRanges
|
|
7976
|
-
]).subscribe(result => {
|
|
7980
|
+
this.layoutChanges = this.breakpointObserver
|
|
7981
|
+
.observe([breakpoints.OneCalendarRanges, breakpoints.TwoCalendars, breakpoints.TwoCalendarsRanges])
|
|
7982
|
+
.subscribe((result) => {
|
|
7977
7983
|
if (result.matches) {
|
|
7978
|
-
this.isMobile =
|
|
7984
|
+
this.isMobile =
|
|
7985
|
+
(this.customRanges?.length > 0 && result.breakpoints[breakpoints.TwoCalendarsRanges]) ||
|
|
7986
|
+
result.breakpoints[breakpoints.TwoCalendars];
|
|
7979
7987
|
if (this.customRanges?.length > 0) {
|
|
7980
7988
|
this.showRanges = !result.breakpoints[breakpoints.OneCalendarRanges];
|
|
7981
7989
|
}
|
|
7982
7990
|
}
|
|
7983
7991
|
});
|
|
7984
|
-
this.startDateValue = this.formatDate(this.startDate);
|
|
7985
|
-
this.endDateValue = this.formatDate(this.endDate);
|
|
7986
7992
|
this.subscribeDateChange();
|
|
7987
7993
|
}
|
|
7988
7994
|
ngOnDestroy() {
|
|
@@ -8012,10 +8018,6 @@ class DateRangePickerComponent {
|
|
|
8012
8018
|
const date = this.convertValueToDate(changes['endDate']?.currentValue) ?? null;
|
|
8013
8019
|
this.handleEndDateChange(date);
|
|
8014
8020
|
}
|
|
8015
|
-
if (changes['locale']) {
|
|
8016
|
-
this.startDateValue = this.formatDate(this.startDate);
|
|
8017
|
-
this.endDateValue = this.formatDate(this.endDate);
|
|
8018
|
-
}
|
|
8019
8021
|
}
|
|
8020
8022
|
convertValueToDate(value) {
|
|
8021
8023
|
if (!value) {
|
|
@@ -8033,7 +8035,7 @@ class DateRangePickerComponent {
|
|
|
8033
8035
|
return parsedDate;
|
|
8034
8036
|
}
|
|
8035
8037
|
}
|
|
8036
|
-
return getLocalDateFromString(date, this.locale, this.timepicker);
|
|
8038
|
+
return getLocalDateFromString(date, this.locale(), this.timepicker);
|
|
8037
8039
|
}
|
|
8038
8040
|
getCustomRangeKey(customRange) {
|
|
8039
8041
|
return customRange[0];
|
|
@@ -8045,14 +8047,14 @@ class DateRangePickerComponent {
|
|
|
8045
8047
|
}
|
|
8046
8048
|
handleCalendarCellHover($event) {
|
|
8047
8049
|
this.calendarCellHover.emit($event);
|
|
8048
|
-
if (!this.startDate) {
|
|
8050
|
+
if (!this.startDate()) {
|
|
8049
8051
|
this.setInputValue(this.startDateElementRef, $event);
|
|
8050
8052
|
this.inputStartHoverValue = $event;
|
|
8051
8053
|
this.setInputValue(this.endDateElementRef, null);
|
|
8052
8054
|
this.inputEndHoverValue = null;
|
|
8053
8055
|
return;
|
|
8054
8056
|
}
|
|
8055
|
-
if (!this.endDate) {
|
|
8057
|
+
if (!this.endDate()) {
|
|
8056
8058
|
this.setInputValue(this.endDateElementRef, $event);
|
|
8057
8059
|
this.inputEndHoverValue = $event;
|
|
8058
8060
|
return;
|
|
@@ -8064,23 +8066,19 @@ class DateRangePickerComponent {
|
|
|
8064
8066
|
}
|
|
8065
8067
|
}
|
|
8066
8068
|
handleStartDateChange(date) {
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
this.value = this.range ? { startDate: this.startDate, endDate: this.endDate } : this.startDate;
|
|
8072
|
-
}
|
|
8069
|
+
this.startDateModel.set(date ?? null);
|
|
8070
|
+
this.dateRangeGroup.patchValue({ startDateInput: this.startDateValue() });
|
|
8071
|
+
this.inputStartHoverValue = null;
|
|
8072
|
+
this.value = this.range ? { startDate: this.startDate(), endDate: this.endDate() } : this.startDate();
|
|
8073
8073
|
}
|
|
8074
8074
|
handleEndDateChange(date) {
|
|
8075
|
-
if (
|
|
8076
|
-
|
|
8077
|
-
return;
|
|
8078
|
-
}
|
|
8079
|
-
this.endDate = date ?? null;
|
|
8080
|
-
this.endDateValue = this.formatDate(this.endDate);
|
|
8081
|
-
this.inputEndHoverValue = null;
|
|
8082
|
-
this.value = this.range ? { startDate: this.startDate, endDate: this.endDate } : this.startDate;
|
|
8075
|
+
if (!this.range) {
|
|
8076
|
+
return;
|
|
8083
8077
|
}
|
|
8078
|
+
this.endDateModel.set(date ?? null);
|
|
8079
|
+
this.dateRangeGroup.patchValue({ endDateInput: this.endDateValue() });
|
|
8080
|
+
this.inputEndHoverValue = null;
|
|
8081
|
+
this.value = this.range ? { startDate: this.startDate(), endDate: this.endDate() } : this.startDate();
|
|
8084
8082
|
}
|
|
8085
8083
|
handleClear($event) {
|
|
8086
8084
|
// this.calendarComponent.clearDates();
|
|
@@ -8094,31 +8092,39 @@ class DateRangePickerComponent {
|
|
|
8094
8092
|
// this.calendarComponent.clearDates();
|
|
8095
8093
|
this.handleStartDateChange(null);
|
|
8096
8094
|
this.handleEndDateChange(null);
|
|
8095
|
+
return;
|
|
8097
8096
|
}
|
|
8098
8097
|
if (date instanceof Date && date.getTime()) {
|
|
8099
|
-
|
|
8098
|
+
// @ts-ignore
|
|
8099
|
+
if (!(this.forbiddenDate(date) || (this.endDate() && this.endDate() < date))) {
|
|
8100
8100
|
this.calendarDate = date;
|
|
8101
|
-
this.
|
|
8101
|
+
this.handleStartDateChange(date);
|
|
8102
8102
|
}
|
|
8103
8103
|
}
|
|
8104
|
-
this.handleStartDateChange(this.startDate ?? null);
|
|
8104
|
+
this.handleStartDateChange(this.startDate() ?? null);
|
|
8105
8105
|
}
|
|
8106
8106
|
handleEndDateInputChange($event) {
|
|
8107
8107
|
const inputValue = $event.target.value;
|
|
8108
8108
|
const date = this.inputParse(inputValue);
|
|
8109
8109
|
if (!date) {
|
|
8110
|
-
this.
|
|
8110
|
+
this.handleEndDateChange(null);
|
|
8111
|
+
return;
|
|
8111
8112
|
}
|
|
8112
8113
|
if (date instanceof Date && date.getTime()) {
|
|
8113
|
-
|
|
8114
|
+
// @ts-ignore
|
|
8115
|
+
if (!(this.forbiddenDate(date) || (this.startDate() && this.startDate() > date))) {
|
|
8114
8116
|
this.calendarDate = date;
|
|
8115
|
-
this.
|
|
8117
|
+
this.handleEndDateChange(date);
|
|
8118
|
+
}
|
|
8119
|
+
else {
|
|
8120
|
+
this.handleEndDateChange(null);
|
|
8116
8121
|
}
|
|
8117
8122
|
}
|
|
8118
|
-
this.handleEndDateChange(this.endDate ?? null);
|
|
8123
|
+
this.handleEndDateChange(this.endDate() ?? null);
|
|
8119
8124
|
}
|
|
8120
8125
|
forbiddenDate(date) {
|
|
8121
|
-
return isDateDisabled(date, this.minDate, this.maxDate, this.disabledDates) ||
|
|
8126
|
+
return (isDateDisabled(date, this.minDate, this.maxDate, this.disabledDates) ||
|
|
8127
|
+
(this.dateFilter ? !this.dateFilter(date) : false));
|
|
8122
8128
|
}
|
|
8123
8129
|
registerOnChange(fn) {
|
|
8124
8130
|
this.onChange = fn;
|
|
@@ -8130,27 +8136,28 @@ class DateRangePickerComponent {
|
|
|
8130
8136
|
this.disabled = isDisabled;
|
|
8131
8137
|
}
|
|
8132
8138
|
writeValue(value) {
|
|
8133
|
-
if (value
|
|
8134
|
-
this.
|
|
8139
|
+
if (!!value) {
|
|
8140
|
+
this.handleStartDateChange(this.range ? value.startDate : value);
|
|
8141
|
+
this.handleEndDateChange(this.range ? value.endDate : null);
|
|
8135
8142
|
}
|
|
8136
8143
|
}
|
|
8137
8144
|
handleStartTimeChange(time) {
|
|
8138
|
-
this.
|
|
8145
|
+
this.startDateModel.set(time ?? this.startDate());
|
|
8139
8146
|
}
|
|
8140
8147
|
handleEndTimeChange(time) {
|
|
8141
8148
|
if (!this.range) {
|
|
8142
8149
|
return;
|
|
8143
8150
|
}
|
|
8144
|
-
this.
|
|
8151
|
+
this.endDateModel.set(time ?? this.endDate());
|
|
8145
8152
|
}
|
|
8146
8153
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: DateRangePickerComponent, deps: [{ token: i1$4.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8147
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.11", type: DateRangePickerComponent, isStandalone: true, selector: "c-date-range-picker", inputs: { dayFormat: "dayFormat", calendars:
|
|
8154
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.11", type: DateRangePickerComponent, isStandalone: true, selector: "c-date-range-picker", inputs: { dayFormat: { classPropertyName: "dayFormat", publicName: "dayFormat", isSignal: false, isRequired: false, transformFunction: null }, calendars: { classPropertyName: "calendars", publicName: "calendars", isSignal: false, isRequired: false, transformFunction: numberAttribute }, cleaner: { classPropertyName: "cleaner", publicName: "cleaner", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, format: { classPropertyName: "format", publicName: "format", isSignal: false, isRequired: false, transformFunction: null }, indicator: { classPropertyName: "indicator", publicName: "indicator", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, inputDateFormat: { classPropertyName: "inputDateFormat", publicName: "inputDateFormat", isSignal: false, isRequired: false, transformFunction: null }, inputDateParse: { classPropertyName: "inputDateParse", publicName: "inputDateParse", isSignal: false, isRequired: false, transformFunction: null }, inputReadOnly: { classPropertyName: "inputReadOnly", publicName: "inputReadOnly", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, navYearFirst: { classPropertyName: "navYearFirst", publicName: "navYearFirst", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, ranges: { classPropertyName: "ranges", publicName: "ranges", isSignal: false, isRequired: false, transformFunction: null }, rangesButtonsColor: { classPropertyName: "rangesButtonsColor", publicName: "rangesButtonsColor", isSignal: false, isRequired: false, transformFunction: null }, rangesButtonsSize: { classPropertyName: "rangesButtonsSize", publicName: "rangesButtonsSize", isSignal: false, isRequired: false, transformFunction: null }, rangesButtonsVariant: { classPropertyName: "rangesButtonsVariant", publicName: "rangesButtonsVariant", isSignal: false, isRequired: false, transformFunction: null }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, size: { classPropertyName: "size", publicName: "size", isSignal: false, isRequired: false, transformFunction: null }, timepicker: { classPropertyName: "timepicker", publicName: "timepicker", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, valid: { classPropertyName: "valid", publicName: "valid", isSignal: false, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, startDateModel: { classPropertyName: "startDateModel", publicName: "startDate", isSignal: true, isRequired: false, transformFunction: null }, endDateModel: { classPropertyName: "endDateModel", publicName: "endDate", isSignal: true, isRequired: false, transformFunction: null }, calendarDate: { classPropertyName: "calendarDate", publicName: "calendarDate", isSignal: false, isRequired: false, transformFunction: dateTransform }, disabledDates: { classPropertyName: "disabledDates", publicName: "disabledDates", isSignal: false, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: false, isRequired: false, transformFunction: numberAttribute }, locale: { classPropertyName: "locale", publicName: "locale", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: false, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: false, isRequired: false, transformFunction: null }, navigation: { classPropertyName: "navigation", publicName: "navigation", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, range: { classPropertyName: "range", publicName: "range", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: false, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, value: { classPropertyName: "value", publicName: "value", isSignal: false, isRequired: false, transformFunction: null }, weekdayFormat: { classPropertyName: "weekdayFormat", publicName: "weekdayFormat", isSignal: false, isRequired: false, transformFunction: null }, popperjsOptions: { classPropertyName: "popperjsOptions", publicName: "popperOptions", isSignal: false, isRequired: false, transformFunction: null }, selectAdjacentDays: { classPropertyName: "selectAdjacentDays", publicName: "selectAdjacentDays", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, showAdjacentDays: { classPropertyName: "showAdjacentDays", publicName: "showAdjacentDays", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, selectionType: { classPropertyName: "selectionType", publicName: "selectionType", isSignal: false, isRequired: false, transformFunction: null }, showWeekNumber: { classPropertyName: "showWeekNumber", publicName: "showWeekNumber", isSignal: false, isRequired: false, transformFunction: booleanAttribute }, weekNumbersLabel: { classPropertyName: "weekNumbersLabel", publicName: "weekNumbersLabel", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { startDateModel: "startDateChange", endDateModel: "endDateChange", valueChange: "valueChange", calendarCellHover: "calendarCellHover", calendarDateChange: "calendarDateChange" }, host: { listeners: { "focusout": "onBlur()" }, properties: { "class": "this.datePickerClasses" } }, providers: [
|
|
8148
8155
|
{
|
|
8149
8156
|
provide: NG_VALUE_ACCESSOR,
|
|
8150
8157
|
useExisting: forwardRef(() => DateRangePickerComponent),
|
|
8151
8158
|
multi: true
|
|
8152
8159
|
}
|
|
8153
|
-
], queries: [{ propertyName: "contentTemplates", predicate: TemplateIdDirective, descendants: true }], viewQueries: [{ propertyName: "startDateElementRef", first: true, predicate: ["startDateElementRef"], descendants: true }, { propertyName: "endDateElementRef", first: true, predicate: ["endDateElementRef"], descendants: true }], exportAs: ["cDateRangePicker"], usesOnChanges: true, ngImport: i0, template: "<c-dropdown #dropdown=\"cDropdown\" [
|
|
8160
|
+
], queries: [{ propertyName: "contentTemplates", predicate: TemplateIdDirective, descendants: true }], viewQueries: [{ propertyName: "startDateElementRef", first: true, predicate: ["startDateElementRef"], descendants: true }, { propertyName: "endDateElementRef", first: true, predicate: ["endDateElementRef"], descendants: true }], exportAs: ["cDateRangePicker"], usesOnChanges: true, ngImport: i0, template: "<fieldset [formGroup]=\"dateRangeGroup\">\n <c-dropdown #dropdown=\"cDropdown\" [(visible)]=\"visible\" [autoClose]=\"'outside'\" [ngClass]=\"datePickerClasses\"\n [popperOptions]=\"popperjsOptions\" class=\"date-picker picker\">\n <div [caret]=\"false\"\n [disabled]=\"disabled ?? dropdown.visible\"\n cDropdownToggle\n class=\"date-picker-input-group\"\n >\n <input #startDateElementRef\n (change)=\"handleStartDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputStartHoverValue}\"\n [placeholder]=\"startDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"range ? undefined : valid\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"startDateInput\"\n pattern=\"[1-9]*\"\n >\n @if (range && separator !== false) {\n <div class=\"date-picker-separator\"></div>\n }\n @if (range) {\n <input #endDateElementRef\n (change)=\"handleEndDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputEndHoverValue}\"\n [placeholder]=\"endDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"valid ?? undefined\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"endDateInput\"\n pattern=\"[1-9]*\"\n >\n }\n @if (indicator) {\n <div class=\"date-picker-indicator\"></div>\n }\n @if (cleaner && startDateElementRef.value && !disabled) {\n <div (click)=\"!disabled && handleClear($event)\" class=\"date-picker-cleaner\" role=\"button\"></div>\n }\n </div>\n <div cDropdownMenu class=\"date-picker-dropdown py-0\">\n <div class=\"date-picker-body\">\n @if (!showRanges) {\n @if (ranges && customRanges.length > 0) {\n <div class=\"date-picker-ranges\">\n @for (customRange of customRanges; track customRange) {\n <button (click)=\"setCustomRange(customRange)\"\n [color]=\"rangesButtonsColor\"\n [size]=\"rangesButtonsSize\"\n [variant]=\"rangesButtonsVariant\"\n cButton>\n {{ customRange | customRangeKey }}\n </button>\n }\n </div>\n }\n }\n <c-calendar\n (calendarCellHover)=\"handleCalendarCellHover($event)\"\n (calendarDateChange)=\"handleCalendarDateChange($event)\"\n (endDateChange)=\"handleEndDateChange($event)\"\n (startDateChange)=\"handleStartDateChange($event)\"\n [calendarDate]=\"calendarDate\"\n [calendars]=\"isMobile ? 1 : calendars\"\n [dateFilter]=\"dateFilter\"\n [dayFormat]=\"dayFormat\"\n [disabledDates]=\"disabledDates\"\n [endDate]=\"endDate()\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [navYearFirst]=\"navYearFirst\"\n [navigation]=\"navigation\"\n [range]=\"range\"\n [selectAdjacentDays]=\"selectAdjacentDays\"\n [selectionType]=\"selectionType\"\n [showAdjacentDays]=\"showAdjacentDays\"\n [showWeekNumber]=\"showWeekNumber\"\n [startDate]=\"startDate()\"\n [weekNumbersLabel]=\"weekNumbersLabel\"\n [weekdayFormat]=\"weekdayFormat\"\n class=\"date-picker-calendars\"\n />\n @if (false && timepicker) {\n <div class=\"date-picker-timepickers\">\n <!-- todo-->\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!startDate()\"\n [time]=\"startDate() ?? undefined\"\n (timeChange)=\"handleStartTimeChange($event)\"\n />\n @if (range) {\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!endDate()\"\n [time]=\"endDate() ?? undefined\"\n (timeChange)=\"handleEndTimeChange($event)\"\n />\n }\n </div>\n }\n </div>\n @if (templates?.datePickerFooter) {\n <div class=\"date-picker-footer\">\n <ng-container *ngTemplateOutlet=\"templates?.datePickerFooter; context: {$implicit: dropdown}\" />\n </div>\n }\n </div>\n <ng-content />\n </c-dropdown>\n</fieldset>\n", styles: [".form-control.date-picker-input:focus{box-shadow:0 0}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: CalendarComponent, selector: "c-calendar", inputs: ["calendarDate", "calendars", "dayFormat", "disabledDates", "startDate", "endDate", "firstDayOfWeek", "locale", "maxDate", "minDate", "navigation", "navYearFirst", "range", "view", "weekdayFormat", "dateFilter", "selectAdjacentDays", "showAdjacentDays", "selectionType", "showWeekNumber", "weekNumbersLabel"], outputs: ["calendarCellHover", "calendarDateChange", "endDateChange", "startDateChange", "viewChange"], exportAs: ["cCalendar"] }, { kind: "component", type: TimePickerComponent, selector: "c-time-picker", inputs: ["cleaner", "dateTimeFormatOptions", "disabled", "filterHours", "filterMinutes", "filterSeconds", "indicator", "inputReadOnly", "locale", "placeholder", "seconds", "size", "time", "variant", "valid", "visible"], outputs: ["timeChange"], exportAs: ["cTimePicker"] }, { kind: "directive", type: ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "type", "variant"], exportAs: ["cButton"] }, { kind: "component", type: DropdownComponent, selector: "c-dropdown", inputs: ["alignment", "autoClose", "direction", "placement", "popper", "popperOptions", "variant", "visible"], outputs: ["visibleChange"], exportAs: ["cDropdown"] }, { kind: "directive", type: DropdownToggleDirective, selector: "[cDropdownToggle]", inputs: ["dropdownComponent", "disabled", "caret", "split"], exportAs: ["cDropdownToggle"] }, { kind: "directive", type: DropdownMenuDirective, selector: "[cDropdownMenu]", inputs: ["alignment", "visible"], exportAs: ["cDropdownMenu"] }, { kind: "directive", type: FormControlDirective, selector: "input[cFormControl], textarea[cFormControl]", inputs: ["sizing", "valid", "type", "plaintext"] }, { kind: "pipe", type: CustomRangeKeyPipe, name: "customRangeKey" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
8154
8161
|
}
|
|
8155
8162
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: DateRangePickerComponent, decorators: [{
|
|
8156
8163
|
type: Component,
|
|
@@ -8174,7 +8181,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
8174
8181
|
useExisting: forwardRef(() => DateRangePickerComponent),
|
|
8175
8182
|
multi: true
|
|
8176
8183
|
}
|
|
8177
|
-
], template: "<c-dropdown #dropdown=\"cDropdown\" [
|
|
8184
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<fieldset [formGroup]=\"dateRangeGroup\">\n <c-dropdown #dropdown=\"cDropdown\" [(visible)]=\"visible\" [autoClose]=\"'outside'\" [ngClass]=\"datePickerClasses\"\n [popperOptions]=\"popperjsOptions\" class=\"date-picker picker\">\n <div [caret]=\"false\"\n [disabled]=\"disabled ?? dropdown.visible\"\n cDropdownToggle\n class=\"date-picker-input-group\"\n >\n <input #startDateElementRef\n (change)=\"handleStartDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputStartHoverValue}\"\n [placeholder]=\"startDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"range ? undefined : valid\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"startDateInput\"\n pattern=\"[1-9]*\"\n >\n @if (range && separator !== false) {\n <div class=\"date-picker-separator\"></div>\n }\n @if (range) {\n <input #endDateElementRef\n (change)=\"handleEndDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputEndHoverValue}\"\n [placeholder]=\"endDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"valid ?? undefined\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"endDateInput\"\n pattern=\"[1-9]*\"\n >\n }\n @if (indicator) {\n <div class=\"date-picker-indicator\"></div>\n }\n @if (cleaner && startDateElementRef.value && !disabled) {\n <div (click)=\"!disabled && handleClear($event)\" class=\"date-picker-cleaner\" role=\"button\"></div>\n }\n </div>\n <div cDropdownMenu class=\"date-picker-dropdown py-0\">\n <div class=\"date-picker-body\">\n @if (!showRanges) {\n @if (ranges && customRanges.length > 0) {\n <div class=\"date-picker-ranges\">\n @for (customRange of customRanges; track customRange) {\n <button (click)=\"setCustomRange(customRange)\"\n [color]=\"rangesButtonsColor\"\n [size]=\"rangesButtonsSize\"\n [variant]=\"rangesButtonsVariant\"\n cButton>\n {{ customRange | customRangeKey }}\n </button>\n }\n </div>\n }\n }\n <c-calendar\n (calendarCellHover)=\"handleCalendarCellHover($event)\"\n (calendarDateChange)=\"handleCalendarDateChange($event)\"\n (endDateChange)=\"handleEndDateChange($event)\"\n (startDateChange)=\"handleStartDateChange($event)\"\n [calendarDate]=\"calendarDate\"\n [calendars]=\"isMobile ? 1 : calendars\"\n [dateFilter]=\"dateFilter\"\n [dayFormat]=\"dayFormat\"\n [disabledDates]=\"disabledDates\"\n [endDate]=\"endDate()\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [navYearFirst]=\"navYearFirst\"\n [navigation]=\"navigation\"\n [range]=\"range\"\n [selectAdjacentDays]=\"selectAdjacentDays\"\n [selectionType]=\"selectionType\"\n [showAdjacentDays]=\"showAdjacentDays\"\n [showWeekNumber]=\"showWeekNumber\"\n [startDate]=\"startDate()\"\n [weekNumbersLabel]=\"weekNumbersLabel\"\n [weekdayFormat]=\"weekdayFormat\"\n class=\"date-picker-calendars\"\n />\n @if (false && timepicker) {\n <div class=\"date-picker-timepickers\">\n <!-- todo-->\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!startDate()\"\n [time]=\"startDate() ?? undefined\"\n (timeChange)=\"handleStartTimeChange($event)\"\n />\n @if (range) {\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!endDate()\"\n [time]=\"endDate() ?? undefined\"\n (timeChange)=\"handleEndTimeChange($event)\"\n />\n }\n </div>\n }\n </div>\n @if (templates?.datePickerFooter) {\n <div class=\"date-picker-footer\">\n <ng-container *ngTemplateOutlet=\"templates?.datePickerFooter; context: {$implicit: dropdown}\" />\n </div>\n }\n </div>\n <ng-content />\n </c-dropdown>\n</fieldset>\n", styles: [".form-control.date-picker-input:focus{box-shadow:0 0}\n"] }]
|
|
8178
8185
|
}], ctorParameters: () => [{ type: i1$4.BreakpointObserver }], propDecorators: { dayFormat: [{
|
|
8179
8186
|
type: Input
|
|
8180
8187
|
}], calendars: [{
|
|
@@ -8224,10 +8231,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
8224
8231
|
}], visible: [{
|
|
8225
8232
|
type: Input,
|
|
8226
8233
|
args: [{ transform: booleanAttribute }]
|
|
8227
|
-
}], startDate: [{
|
|
8228
|
-
type: Input
|
|
8229
|
-
}], endDate: [{
|
|
8230
|
-
type: Input
|
|
8231
8234
|
}], calendarDate: [{
|
|
8232
8235
|
type: Input,
|
|
8233
8236
|
args: [{ transform: dateTransform }]
|
|
@@ -8236,8 +8239,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
8236
8239
|
}], firstDayOfWeek: [{
|
|
8237
8240
|
type: Input,
|
|
8238
8241
|
args: [{ transform: numberAttribute }]
|
|
8239
|
-
}], locale: [{
|
|
8240
|
-
type: Input
|
|
8241
8242
|
}], maxDate: [{
|
|
8242
8243
|
type: Input
|
|
8243
8244
|
}], minDate: [{
|
|
@@ -8279,10 +8280,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
8279
8280
|
type: Output
|
|
8280
8281
|
}], calendarDateChange: [{
|
|
8281
8282
|
type: Output
|
|
8282
|
-
}], endDateChange: [{
|
|
8283
|
-
type: Output
|
|
8284
|
-
}], startDateChange: [{
|
|
8285
|
-
type: Output
|
|
8286
8283
|
}], startDateElementRef: [{
|
|
8287
8284
|
type: ViewChild,
|
|
8288
8285
|
args: ['startDateElementRef']
|
|
@@ -8317,45 +8314,42 @@ class DatePickerComponent extends DateRangePickerComponent {
|
|
|
8317
8314
|
constructor(breakpointObserver) {
|
|
8318
8315
|
super(breakpointObserver);
|
|
8319
8316
|
this.placeholder = 'Select date';
|
|
8320
|
-
|
|
8321
|
-
this.startDateChange = new EventEmitter();
|
|
8317
|
+
this.dateChange = output();
|
|
8322
8318
|
this.range = false;
|
|
8323
8319
|
this.calendars = 1;
|
|
8320
|
+
this.endDate = model(null);
|
|
8324
8321
|
}
|
|
8325
|
-
|
|
8326
|
-
|
|
8322
|
+
set date(value) {
|
|
8323
|
+
this.startDateModel.set(value);
|
|
8327
8324
|
}
|
|
8328
8325
|
get date() {
|
|
8329
|
-
return this.startDate;
|
|
8330
|
-
}
|
|
8331
|
-
set date(value) {
|
|
8332
|
-
this.startDate = value;
|
|
8326
|
+
return this.startDate();
|
|
8333
8327
|
}
|
|
8334
|
-
// @ts-ignore
|
|
8335
8328
|
writeValue(value) {
|
|
8336
8329
|
this.date = value;
|
|
8337
|
-
|
|
8330
|
+
super.writeValue(value);
|
|
8338
8331
|
}
|
|
8339
8332
|
subscribeDateChange(subscribe = true) {
|
|
8340
8333
|
if (subscribe) {
|
|
8341
|
-
this.dateChangeSubscriptions.push(this.startDateChange.subscribe(next => {
|
|
8334
|
+
this.dateChangeSubscriptions.push(this.startDateChange.subscribe((next) => {
|
|
8342
8335
|
this.date = next;
|
|
8343
8336
|
this.onChange(next);
|
|
8337
|
+
this.dateChange.emit(this.date);
|
|
8344
8338
|
}));
|
|
8345
8339
|
return;
|
|
8346
8340
|
}
|
|
8347
|
-
this.dateChangeSubscriptions.forEach(subscription => {
|
|
8341
|
+
this.dateChangeSubscriptions.forEach((subscription) => {
|
|
8348
8342
|
subscription?.unsubscribe();
|
|
8349
8343
|
});
|
|
8350
8344
|
}
|
|
8351
8345
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: DatePickerComponent, deps: [{ token: i1$4.BreakpointObserver }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
8352
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.11", type: DatePickerComponent, isStandalone: true, selector: "c-date-picker", inputs: { placeholder: "placeholder", date: "date" }, outputs: {
|
|
8346
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.11", type: DatePickerComponent, isStandalone: true, selector: "c-date-picker", inputs: { placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: false, isRequired: false, transformFunction: null }, endDate: { classPropertyName: "endDate", publicName: "endDate", isSignal: true, isRequired: false, transformFunction: null }, date: { classPropertyName: "date", publicName: "date", isSignal: false, isRequired: false, transformFunction: null } }, outputs: { dateChange: "dateChange", endDate: "endDateChange" }, providers: [
|
|
8353
8347
|
{
|
|
8354
8348
|
provide: NG_VALUE_ACCESSOR,
|
|
8355
8349
|
useExisting: forwardRef(() => DatePickerComponent),
|
|
8356
8350
|
multi: true
|
|
8357
8351
|
}
|
|
8358
|
-
], exportAs: ["cDatePicker"], usesInheritance: true, ngImport: i0, template: "<c-dropdown #dropdown=\"cDropdown\" [
|
|
8352
|
+
], exportAs: ["cDatePicker"], usesInheritance: true, ngImport: i0, template: "<fieldset [formGroup]=\"dateRangeGroup\">\n <c-dropdown #dropdown=\"cDropdown\" [(visible)]=\"visible\" [autoClose]=\"'outside'\" [ngClass]=\"datePickerClasses\"\n [popperOptions]=\"popperjsOptions\" class=\"date-picker picker\">\n <div [caret]=\"false\"\n [disabled]=\"disabled ?? dropdown.visible\"\n cDropdownToggle\n class=\"date-picker-input-group\"\n >\n <input #startDateElementRef\n (change)=\"handleStartDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputStartHoverValue}\"\n [placeholder]=\"startDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"range ? undefined : valid\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"startDateInput\"\n pattern=\"[1-9]*\"\n >\n @if (range && separator !== false) {\n <div class=\"date-picker-separator\"></div>\n }\n @if (range) {\n <input #endDateElementRef\n (change)=\"handleEndDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputEndHoverValue}\"\n [placeholder]=\"endDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"valid ?? undefined\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"endDateInput\"\n pattern=\"[1-9]*\"\n >\n }\n @if (indicator) {\n <div class=\"date-picker-indicator\"></div>\n }\n @if (cleaner && startDateElementRef.value && !disabled) {\n <div (click)=\"!disabled && handleClear($event)\" class=\"date-picker-cleaner\" role=\"button\"></div>\n }\n </div>\n <div cDropdownMenu class=\"date-picker-dropdown py-0\">\n <div class=\"date-picker-body\">\n @if (!showRanges) {\n @if (ranges && customRanges.length > 0) {\n <div class=\"date-picker-ranges\">\n @for (customRange of customRanges; track customRange) {\n <button (click)=\"setCustomRange(customRange)\"\n [color]=\"rangesButtonsColor\"\n [size]=\"rangesButtonsSize\"\n [variant]=\"rangesButtonsVariant\"\n cButton>\n {{ customRange | customRangeKey }}\n </button>\n }\n </div>\n }\n }\n <c-calendar\n (calendarCellHover)=\"handleCalendarCellHover($event)\"\n (calendarDateChange)=\"handleCalendarDateChange($event)\"\n (endDateChange)=\"handleEndDateChange($event)\"\n (startDateChange)=\"handleStartDateChange($event)\"\n [calendarDate]=\"calendarDate\"\n [calendars]=\"isMobile ? 1 : calendars\"\n [dateFilter]=\"dateFilter\"\n [dayFormat]=\"dayFormat\"\n [disabledDates]=\"disabledDates\"\n [endDate]=\"endDate()\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [navYearFirst]=\"navYearFirst\"\n [navigation]=\"navigation\"\n [range]=\"range\"\n [selectAdjacentDays]=\"selectAdjacentDays\"\n [selectionType]=\"selectionType\"\n [showAdjacentDays]=\"showAdjacentDays\"\n [showWeekNumber]=\"showWeekNumber\"\n [startDate]=\"startDate()\"\n [weekNumbersLabel]=\"weekNumbersLabel\"\n [weekdayFormat]=\"weekdayFormat\"\n class=\"date-picker-calendars\"\n />\n @if (false && timepicker) {\n <div class=\"date-picker-timepickers\">\n <!-- todo-->\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!startDate()\"\n [time]=\"startDate() ?? undefined\"\n (timeChange)=\"handleStartTimeChange($event)\"\n />\n @if (range) {\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!endDate()\"\n [time]=\"endDate() ?? undefined\"\n (timeChange)=\"handleEndTimeChange($event)\"\n />\n }\n </div>\n }\n </div>\n @if (templates?.datePickerFooter) {\n <div class=\"date-picker-footer\">\n <ng-container *ngTemplateOutlet=\"templates?.datePickerFooter; context: {$implicit: dropdown}\" />\n </div>\n }\n </div>\n <ng-content />\n </c-dropdown>\n</fieldset>\n", styles: [".form-control.date-picker-input:focus{box-shadow:0 0}\n"], dependencies: [{ kind: "directive", type: NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { 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.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1$3.PatternValidator, selector: "[pattern][formControlName],[pattern][formControl],[pattern][ngModel]", inputs: ["pattern"] }, { kind: "directive", type: i1$3.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1$3.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "component", type: CalendarComponent, selector: "c-calendar", inputs: ["calendarDate", "calendars", "dayFormat", "disabledDates", "startDate", "endDate", "firstDayOfWeek", "locale", "maxDate", "minDate", "navigation", "navYearFirst", "range", "view", "weekdayFormat", "dateFilter", "selectAdjacentDays", "showAdjacentDays", "selectionType", "showWeekNumber", "weekNumbersLabel"], outputs: ["calendarCellHover", "calendarDateChange", "endDateChange", "startDateChange", "viewChange"], exportAs: ["cCalendar"] }, { kind: "component", type: TimePickerComponent, selector: "c-time-picker", inputs: ["cleaner", "dateTimeFormatOptions", "disabled", "filterHours", "filterMinutes", "filterSeconds", "indicator", "inputReadOnly", "locale", "placeholder", "seconds", "size", "time", "variant", "valid", "visible"], outputs: ["timeChange"], exportAs: ["cTimePicker"] }, { kind: "directive", type: ButtonDirective, selector: "[cButton]", inputs: ["active", "color", "disabled", "shape", "size", "type", "variant"], exportAs: ["cButton"] }, { kind: "component", type: DropdownComponent, selector: "c-dropdown", inputs: ["alignment", "autoClose", "direction", "placement", "popper", "popperOptions", "variant", "visible"], outputs: ["visibleChange"], exportAs: ["cDropdown"] }, { kind: "directive", type: DropdownToggleDirective, selector: "[cDropdownToggle]", inputs: ["dropdownComponent", "disabled", "caret", "split"], exportAs: ["cDropdownToggle"] }, { kind: "directive", type: DropdownMenuDirective, selector: "[cDropdownMenu]", inputs: ["alignment", "visible"], exportAs: ["cDropdownMenu"] }, { kind: "directive", type: FormControlDirective, selector: "input[cFormControl], textarea[cFormControl]", inputs: ["sizing", "valid", "type", "plaintext"] }, { kind: "pipe", type: CustomRangeKeyPipe, name: "customRangeKey" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
8359
8353
|
}
|
|
8360
8354
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: DatePickerComponent, decorators: [{
|
|
8361
8355
|
type: Component,
|
|
@@ -8379,12 +8373,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
8379
8373
|
useExisting: forwardRef(() => DatePickerComponent),
|
|
8380
8374
|
multi: true
|
|
8381
8375
|
}
|
|
8382
|
-
], template: "<c-dropdown #dropdown=\"cDropdown\" [
|
|
8376
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, template: "<fieldset [formGroup]=\"dateRangeGroup\">\n <c-dropdown #dropdown=\"cDropdown\" [(visible)]=\"visible\" [autoClose]=\"'outside'\" [ngClass]=\"datePickerClasses\"\n [popperOptions]=\"popperjsOptions\" class=\"date-picker picker\">\n <div [caret]=\"false\"\n [disabled]=\"disabled ?? dropdown.visible\"\n cDropdownToggle\n class=\"date-picker-input-group\"\n >\n <input #startDateElementRef\n (change)=\"handleStartDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputStartHoverValue}\"\n [placeholder]=\"startDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"range ? undefined : valid\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"startDateInput\"\n pattern=\"[1-9]*\"\n >\n @if (range && separator !== false) {\n <div class=\"date-picker-separator\"></div>\n }\n @if (range) {\n <input #endDateElementRef\n (change)=\"handleEndDateInputChange($event)\"\n [attr.tabindex]=\"disabled ? -1 : 0\"\n [ngClass]=\"{hover: !!inputEndHoverValue}\"\n [placeholder]=\"endDatePlaceholder\"\n [readonly]=\"inputReadOnly ?? null\"\n [valid]=\"valid ?? undefined\"\n cFormControl\n class=\"date-picker-input\"\n formControlName=\"endDateInput\"\n pattern=\"[1-9]*\"\n >\n }\n @if (indicator) {\n <div class=\"date-picker-indicator\"></div>\n }\n @if (cleaner && startDateElementRef.value && !disabled) {\n <div (click)=\"!disabled && handleClear($event)\" class=\"date-picker-cleaner\" role=\"button\"></div>\n }\n </div>\n <div cDropdownMenu class=\"date-picker-dropdown py-0\">\n <div class=\"date-picker-body\">\n @if (!showRanges) {\n @if (ranges && customRanges.length > 0) {\n <div class=\"date-picker-ranges\">\n @for (customRange of customRanges; track customRange) {\n <button (click)=\"setCustomRange(customRange)\"\n [color]=\"rangesButtonsColor\"\n [size]=\"rangesButtonsSize\"\n [variant]=\"rangesButtonsVariant\"\n cButton>\n {{ customRange | customRangeKey }}\n </button>\n }\n </div>\n }\n }\n <c-calendar\n (calendarCellHover)=\"handleCalendarCellHover($event)\"\n (calendarDateChange)=\"handleCalendarDateChange($event)\"\n (endDateChange)=\"handleEndDateChange($event)\"\n (startDateChange)=\"handleStartDateChange($event)\"\n [calendarDate]=\"calendarDate\"\n [calendars]=\"isMobile ? 1 : calendars\"\n [dateFilter]=\"dateFilter\"\n [dayFormat]=\"dayFormat\"\n [disabledDates]=\"disabledDates\"\n [endDate]=\"endDate()\"\n [firstDayOfWeek]=\"firstDayOfWeek\"\n [locale]=\"locale()\"\n [maxDate]=\"maxDate\"\n [minDate]=\"minDate\"\n [navYearFirst]=\"navYearFirst\"\n [navigation]=\"navigation\"\n [range]=\"range\"\n [selectAdjacentDays]=\"selectAdjacentDays\"\n [selectionType]=\"selectionType\"\n [showAdjacentDays]=\"showAdjacentDays\"\n [showWeekNumber]=\"showWeekNumber\"\n [startDate]=\"startDate()\"\n [weekNumbersLabel]=\"weekNumbersLabel\"\n [weekdayFormat]=\"weekdayFormat\"\n class=\"date-picker-calendars\"\n />\n @if (false && timepicker) {\n <div class=\"date-picker-timepickers\">\n <!-- todo-->\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!startDate()\"\n [time]=\"startDate() ?? undefined\"\n (timeChange)=\"handleStartTimeChange($event)\"\n />\n @if (range) {\n <c-time-picker\n variant=\"select\"\n [locale]=\"locale()\"\n [disabled]=\"!endDate()\"\n [time]=\"endDate() ?? undefined\"\n (timeChange)=\"handleEndTimeChange($event)\"\n />\n }\n </div>\n }\n </div>\n @if (templates?.datePickerFooter) {\n <div class=\"date-picker-footer\">\n <ng-container *ngTemplateOutlet=\"templates?.datePickerFooter; context: {$implicit: dropdown}\" />\n </div>\n }\n </div>\n <ng-content />\n </c-dropdown>\n</fieldset>\n", styles: [".form-control.date-picker-input:focus{box-shadow:0 0}\n"] }]
|
|
8383
8377
|
}], ctorParameters: () => [{ type: i1$4.BreakpointObserver }], propDecorators: { placeholder: [{
|
|
8384
8378
|
type: Input
|
|
8385
|
-
}], startDateChange: [{
|
|
8386
|
-
type: Output,
|
|
8387
|
-
args: ['dateChange']
|
|
8388
8379
|
}], date: [{
|
|
8389
8380
|
type: Input
|
|
8390
8381
|
}] } });
|
|
@@ -10025,7 +10016,7 @@ const observeReferenceResizeModifier = {
|
|
|
10025
10016
|
const RO_PROP = '__popperjsRO__';
|
|
10026
10017
|
const { reference } = state.elements;
|
|
10027
10018
|
let resizeObserver = new ResizeObserver((entries) => {
|
|
10028
|
-
if (entries.find(entry => entry.target === reference)) {
|
|
10019
|
+
if (entries.find((entry) => entry.target === reference)) {
|
|
10029
10020
|
instance.update();
|
|
10030
10021
|
}
|
|
10031
10022
|
});
|
|
@@ -10182,8 +10173,8 @@ class MultiSelectComponent {
|
|
|
10182
10173
|
* @type IPluralMap
|
|
10183
10174
|
* @default { '=1': 'item selected', 'other': 'items selected' }
|
|
10184
10175
|
*/
|
|
10185
|
-
this.selectionTypeCounterTextPluralMap = { '=1': 'item selected',
|
|
10186
|
-
this.#value = [];
|
|
10176
|
+
this.selectionTypeCounterTextPluralMap = { '=1': 'item selected', other: 'items selected' };
|
|
10177
|
+
this.#value = signal([]);
|
|
10187
10178
|
/**
|
|
10188
10179
|
* Emits valueChange
|
|
10189
10180
|
* @type TValue | TValue[]
|
|
@@ -10203,6 +10194,7 @@ class MultiSelectComponent {
|
|
|
10203
10194
|
* @default 196
|
|
10204
10195
|
*/
|
|
10205
10196
|
this.itemMinWidth = 196;
|
|
10197
|
+
this.minWidth = signal(this.itemMinWidth);
|
|
10206
10198
|
this._visible = false;
|
|
10207
10199
|
/**
|
|
10208
10200
|
* Emits visibleChange
|
|
@@ -10217,7 +10209,7 @@ class MultiSelectComponent {
|
|
|
10217
10209
|
this._subtreeFocused = this.focusOrigin(null);
|
|
10218
10210
|
this.userOptions = this.multiSelectService.getUserOptions();
|
|
10219
10211
|
this.activeOption = null;
|
|
10220
|
-
this.differ = this.iterableDiffers.find(this.#value).create();
|
|
10212
|
+
this.differ = this.iterableDiffers.find(this.#value()).create();
|
|
10221
10213
|
this.multiSelectService.setSelectionModel(this.multiple);
|
|
10222
10214
|
this.optionsArray$ = this.multiSelectService.getOptionsArray();
|
|
10223
10215
|
}
|
|
@@ -10226,7 +10218,7 @@ class MultiSelectComponent {
|
|
|
10226
10218
|
#options;
|
|
10227
10219
|
#optionsContent;
|
|
10228
10220
|
writeValue(value) {
|
|
10229
|
-
if (
|
|
10221
|
+
if (value !== undefined && value !== null) {
|
|
10230
10222
|
this.value = Array.isArray(value) ? [...value] : [value];
|
|
10231
10223
|
}
|
|
10232
10224
|
else {
|
|
@@ -10318,22 +10310,22 @@ class MultiSelectComponent {
|
|
|
10318
10310
|
}
|
|
10319
10311
|
/**
|
|
10320
10312
|
* Initial value of multi-select
|
|
10321
|
-
* @type TValue | TValue[]
|
|
10313
|
+
* @type (TValue | TValue[])
|
|
10322
10314
|
*/
|
|
10323
10315
|
set value(value) {
|
|
10324
10316
|
const newValue = Array.isArray(value) ? [...value] : [value];
|
|
10325
|
-
if (this.differ) {
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
}
|
|
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);
|
|
10333
10324
|
}
|
|
10325
|
+
// }
|
|
10334
10326
|
}
|
|
10335
10327
|
get value() {
|
|
10336
|
-
const value = this.multiSelectService.selectionModel?.selected ?? [...this.#value];
|
|
10328
|
+
const value = this.multiSelectService.selectionModel?.selected ?? [...this.#value()];
|
|
10337
10329
|
return this.multiple ? [...value] : value[0];
|
|
10338
10330
|
}
|
|
10339
10331
|
#value;
|
|
@@ -10355,7 +10347,7 @@ class MultiSelectComponent {
|
|
|
10355
10347
|
*/
|
|
10356
10348
|
set visibleItems(value) {
|
|
10357
10349
|
this._visibleItems = value > 0 ? value : 8;
|
|
10358
|
-
this.optionsMaxHeight = (
|
|
10350
|
+
this.optionsMaxHeight = (this.itemSize * this._visibleItems + 16).toString();
|
|
10359
10351
|
}
|
|
10360
10352
|
get visibleItems() {
|
|
10361
10353
|
return this._visibleItems;
|
|
@@ -10390,7 +10382,7 @@ class MultiSelectComponent {
|
|
|
10390
10382
|
const currOptions = {
|
|
10391
10383
|
...options,
|
|
10392
10384
|
modifiers: [
|
|
10393
|
-
...prevModifiers.filter(prevModifier => !currModifiers.find(currModifier => currModifier.name === prevModifier.name)),
|
|
10385
|
+
...prevModifiers.filter((prevModifier) => !currModifiers.find((currModifier) => currModifier.name === prevModifier.name)),
|
|
10394
10386
|
...currModifiers
|
|
10395
10387
|
]
|
|
10396
10388
|
};
|
|
@@ -10404,7 +10396,7 @@ class MultiSelectComponent {
|
|
|
10404
10396
|
return [...this.optionsSelected.values()];
|
|
10405
10397
|
}
|
|
10406
10398
|
get selectedOptionsText() {
|
|
10407
|
-
return this.selectedOptions.map(option => option.label).join(', ');
|
|
10399
|
+
return this.selectedOptions.map((option) => option.label).join(', ');
|
|
10408
10400
|
}
|
|
10409
10401
|
get counterText() {
|
|
10410
10402
|
return `${this.selectedOptions.length} ${this.selectionTypeCounterText}`;
|
|
@@ -10412,7 +10404,6 @@ class MultiSelectComponent {
|
|
|
10412
10404
|
get counterTextType() {
|
|
10413
10405
|
return typeof (this.selectionTypeCounterTextPluralMap ?? this.selectionTypeCounterText);
|
|
10414
10406
|
}
|
|
10415
|
-
;
|
|
10416
10407
|
get counterPlaceholderText() {
|
|
10417
10408
|
if (this.selectedOptions.length === 0 || this.selectionType !== 'counter') {
|
|
10418
10409
|
return null;
|
|
@@ -10465,7 +10456,8 @@ class MultiSelectComponent {
|
|
|
10465
10456
|
this.setFocus('keyboard', 'onKeyUp');
|
|
10466
10457
|
return;
|
|
10467
10458
|
}
|
|
10468
|
-
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)) {
|
|
10469
10461
|
$event.stopPropagation();
|
|
10470
10462
|
this.visible = true;
|
|
10471
10463
|
if (!this.search) {
|
|
@@ -10489,12 +10481,16 @@ class MultiSelectComponent {
|
|
|
10489
10481
|
if (this.visible && this.subtreeFocused) {
|
|
10490
10482
|
if (targetTagName === 'C-MULTI-SELECT-OPTION') {
|
|
10491
10483
|
if (this.tabTarget === 'C-MULTI-SELECT-OPTION') {
|
|
10492
|
-
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) {
|
|
10493
10487
|
this.setFocus('keyboard', 'onKeyUp');
|
|
10494
10488
|
this.tabTarget = targetTagName;
|
|
10495
10489
|
return;
|
|
10496
10490
|
}
|
|
10497
|
-
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) {
|
|
10498
10494
|
this.setFocus('keyboard', 'onKeyUp');
|
|
10499
10495
|
this.tabTarget = targetTagName;
|
|
10500
10496
|
this.updateActiveItem(0);
|
|
@@ -10581,21 +10577,23 @@ class MultiSelectComponent {
|
|
|
10581
10577
|
}
|
|
10582
10578
|
ngOnInit() {
|
|
10583
10579
|
this.multiSelectService.selectionModel.changed
|
|
10584
|
-
.pipe(filter(() => !this.multiple), delay(0), tap(change => {
|
|
10580
|
+
.pipe(filter(() => !this.multiple), delay(0), tap((change) => {
|
|
10585
10581
|
if (change.added.length > 0) {
|
|
10586
10582
|
// close dropdown for single select (!multiple)
|
|
10587
10583
|
this.visible = false;
|
|
10588
10584
|
this.searchValue = '';
|
|
10589
10585
|
}
|
|
10590
|
-
}), skip(1), tap(change => {
|
|
10586
|
+
}), skip(1), tap((change) => {
|
|
10591
10587
|
this.setFocus('program', 'selectionModel.changed (single)');
|
|
10592
10588
|
}), takeUntilDestroyed(this.#destroyRef))
|
|
10593
10589
|
.subscribe();
|
|
10594
|
-
this.#optionsReady
|
|
10590
|
+
this.#optionsReady$
|
|
10591
|
+
.pipe(filter(() => !this.virtualScroller), delay(0), tap(() => {
|
|
10595
10592
|
this.setFocusKeyManager([...this.multiSelectOptionsContent, ...this.multiSelectOptionsView]);
|
|
10596
|
-
}), takeUntilDestroyed(this.#destroyRef))
|
|
10593
|
+
}), takeUntilDestroyed(this.#destroyRef))
|
|
10594
|
+
.subscribe();
|
|
10597
10595
|
this.multiSelectService.selectionModel.changed
|
|
10598
|
-
.pipe(tap(change => {
|
|
10596
|
+
.pipe(tap((change) => {
|
|
10599
10597
|
const { added } = { ...change };
|
|
10600
10598
|
if (added.length > 0 && this.clearSearchOnSelect) {
|
|
10601
10599
|
this.searchValue = '';
|
|
@@ -10607,10 +10605,10 @@ class MultiSelectComponent {
|
|
|
10607
10605
|
// delay(0),
|
|
10608
10606
|
combineLatestWith(this.#optionsReady$), tap(([change, ready]) => {
|
|
10609
10607
|
const { removed } = { ...change };
|
|
10610
|
-
removed.forEach(value => {
|
|
10608
|
+
removed.forEach((value) => {
|
|
10611
10609
|
this.optionsSelected.delete(value);
|
|
10612
10610
|
});
|
|
10613
|
-
this.multiSelectService.selectionModel.selected.forEach(key => {
|
|
10611
|
+
this.multiSelectService.selectionModel.selected.forEach((key) => {
|
|
10614
10612
|
const value = this.#options.get(key);
|
|
10615
10613
|
if (value) {
|
|
10616
10614
|
this.optionsSelected.set(key, value);
|
|
@@ -10623,20 +10621,18 @@ class MultiSelectComponent {
|
|
|
10623
10621
|
}), takeUntilDestroyed(this.#destroyRef))
|
|
10624
10622
|
.subscribe();
|
|
10625
10623
|
// set initial values
|
|
10626
|
-
this.multiSelectService.selectionModel.select(...this.#value);
|
|
10627
|
-
this.value
|
|
10628
|
-
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
10629
|
-
.subscribe(value => {
|
|
10624
|
+
this.multiSelectService.selectionModel.select(...this.#value());
|
|
10625
|
+
this.value$.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((value) => {
|
|
10630
10626
|
if (!value.length) {
|
|
10631
10627
|
this.clearAllOptions();
|
|
10632
10628
|
return;
|
|
10633
10629
|
}
|
|
10634
|
-
value.forEach(value => {
|
|
10630
|
+
value.forEach((value) => {
|
|
10635
10631
|
this.multiSelectService.selectionModel.select(value);
|
|
10636
10632
|
});
|
|
10637
10633
|
});
|
|
10638
10634
|
this.value$
|
|
10639
|
-
.pipe(debounceTime(100), tap(value => {
|
|
10635
|
+
.pipe(debounceTime(100), distinctUntilChanged(), tap((value) => {
|
|
10640
10636
|
this.valueChange.emit(this.value);
|
|
10641
10637
|
}), takeUntilDestroyed(this.#destroyRef))
|
|
10642
10638
|
.subscribe();
|
|
@@ -10645,15 +10641,15 @@ class MultiSelectComponent {
|
|
|
10645
10641
|
this.visibleOptions.set(options.some((item) => item.visible) || userOptions.some((item) => item.visible));
|
|
10646
10642
|
this.activeOption = null;
|
|
10647
10643
|
if (this.virtualScroller) {
|
|
10648
|
-
this.multiSelectOptionsContent?.forEach(option => {
|
|
10644
|
+
this.multiSelectOptionsContent?.forEach((option) => {
|
|
10649
10645
|
option.active = false;
|
|
10650
10646
|
});
|
|
10651
10647
|
this.scrollViewport?.setRenderedRange({ start: 0, end: this.visibleItems });
|
|
10652
10648
|
this.scrollViewport?.scrollToIndex(0);
|
|
10653
10649
|
}
|
|
10654
10650
|
else {
|
|
10655
|
-
this.multiSelectOptionsContent?.forEach(option => {
|
|
10656
|
-
const found = options.find(item => item.value === option.value);
|
|
10651
|
+
this.multiSelectOptionsContent?.forEach((option) => {
|
|
10652
|
+
const found = options.find((item) => item.value === option.value);
|
|
10657
10653
|
option.visible = found?.visible ?? false;
|
|
10658
10654
|
option.active = false;
|
|
10659
10655
|
});
|
|
@@ -10688,17 +10684,21 @@ class MultiSelectComponent {
|
|
|
10688
10684
|
}
|
|
10689
10685
|
makeOptions(options) {
|
|
10690
10686
|
if (this.search === 'external' && this.searchValue.length) {
|
|
10691
|
-
this.#options.forEach((
|
|
10692
|
-
|
|
10687
|
+
this.#options.forEach((option, key) => {
|
|
10688
|
+
option.visible = false;
|
|
10693
10689
|
});
|
|
10694
10690
|
}
|
|
10695
|
-
options.forEach(option => {
|
|
10691
|
+
options.forEach((option) => {
|
|
10696
10692
|
const key = option.value;
|
|
10697
10693
|
const value = {
|
|
10698
10694
|
value: option.value ?? option.label,
|
|
10699
10695
|
label: option.label ?? option.value?.toString(),
|
|
10700
10696
|
disabled: option.disabled === true,
|
|
10701
|
-
visible: this.search === 'external'
|
|
10697
|
+
visible: this.search === 'external'
|
|
10698
|
+
? true
|
|
10699
|
+
: option.custom && option.selected
|
|
10700
|
+
? option.visible
|
|
10701
|
+
: option.visible !== false,
|
|
10702
10702
|
text: option.text ?? option.label ?? option.value?.toString(),
|
|
10703
10703
|
selected: option.selected,
|
|
10704
10704
|
custom: option.custom
|
|
@@ -10719,7 +10719,7 @@ class MultiSelectComponent {
|
|
|
10719
10719
|
// });
|
|
10720
10720
|
addUserOption() {
|
|
10721
10721
|
if (this.allowCreateOptions) {
|
|
10722
|
-
if (this.userOptions().some(option => option.value === this.searchValue)) {
|
|
10722
|
+
if (this.userOptions().some((option) => option.value === this.searchValue)) {
|
|
10723
10723
|
return;
|
|
10724
10724
|
}
|
|
10725
10725
|
if (this.#options.get(this.searchValue)) {
|
|
@@ -10733,7 +10733,7 @@ class MultiSelectComponent {
|
|
|
10733
10733
|
custom: true,
|
|
10734
10734
|
selected: true
|
|
10735
10735
|
};
|
|
10736
|
-
this.searchValue =
|
|
10736
|
+
this.searchValue = this.clearSearchOnSelect || this.allowCreateOptions ? '' : this.searchValue;
|
|
10737
10737
|
this.multiSelectService.addUserOption(userOption);
|
|
10738
10738
|
this.multiSelectService.selectionModel.select(userOption.value);
|
|
10739
10739
|
this.optionsSelected.set(userOption.value, userOption);
|
|
@@ -10747,18 +10747,21 @@ class MultiSelectComponent {
|
|
|
10747
10747
|
this.setVirtualScroller();
|
|
10748
10748
|
this.multiSelectOptionsContent?.changes
|
|
10749
10749
|
.pipe(delay(0), distinctUntilChanged((previous, current) => {
|
|
10750
|
-
const prev = previous.toArray().map(option => option.value);
|
|
10751
|
-
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);
|
|
10752
10752
|
if (this.virtualScroller) {
|
|
10753
10753
|
return JSON.stringify(prev) === JSON.stringify(curr);
|
|
10754
10754
|
}
|
|
10755
10755
|
return JSON.stringify(this.#optionsContent) === JSON.stringify(curr);
|
|
10756
|
-
}), tap(changes => {
|
|
10757
|
-
this.#optionsContent = changes.toArray().map(option => option.value);
|
|
10756
|
+
}), tap((changes) => {
|
|
10757
|
+
this.#optionsContent = changes.toArray().map((option) => option.value);
|
|
10758
10758
|
}), takeUntilDestroyed(this.#destroyRef))
|
|
10759
|
-
.subscribe(next => {
|
|
10759
|
+
.subscribe((next) => {
|
|
10760
10760
|
this.visibleOptions.set(this.multiSelectOptionsContent?.some((option) => option.visible));
|
|
10761
10761
|
if (this.visibleOptions()) {
|
|
10762
|
+
if (!this.virtualScroller) {
|
|
10763
|
+
this.#options.clear();
|
|
10764
|
+
}
|
|
10762
10765
|
this.makeOptions(this.multiSelectOptionsContent.toArray());
|
|
10763
10766
|
}
|
|
10764
10767
|
});
|
|
@@ -10793,6 +10796,10 @@ class MultiSelectComponent {
|
|
|
10793
10796
|
}
|
|
10794
10797
|
else {
|
|
10795
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
|
+
}
|
|
10796
10803
|
this.scrollViewport?.setRenderedRange({ start: 0, end: this.visibleItems });
|
|
10797
10804
|
this.scrollViewport?.scrollToIndex(0);
|
|
10798
10805
|
}
|
|
@@ -10804,7 +10811,9 @@ class MultiSelectComponent {
|
|
|
10804
10811
|
}
|
|
10805
10812
|
clearAllOptions($event) {
|
|
10806
10813
|
setTimeout(() => {
|
|
10807
|
-
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);
|
|
10808
10817
|
this.multiSelectService.selectionModel.deselect(...enabledOptions);
|
|
10809
10818
|
this.removeAllUserOptions();
|
|
10810
10819
|
this.searchValue = '';
|
|
@@ -10814,7 +10823,9 @@ class MultiSelectComponent {
|
|
|
10814
10823
|
});
|
|
10815
10824
|
}
|
|
10816
10825
|
selectAllOptions() {
|
|
10817
|
-
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);
|
|
10818
10829
|
this.multiSelectService.selectionModel.select(...enabledOptions);
|
|
10819
10830
|
this.inputElementSize();
|
|
10820
10831
|
}
|
|
@@ -10863,7 +10874,7 @@ class MultiSelectComponent {
|
|
|
10863
10874
|
if (!this.nativeSelectRef || !this.nativeId) {
|
|
10864
10875
|
return;
|
|
10865
10876
|
}
|
|
10866
|
-
const options = Array.from(this.optionsSelected).map(item => {
|
|
10877
|
+
const options = Array.from(this.optionsSelected).map((item) => {
|
|
10867
10878
|
const { selected, value, label } = item[1];
|
|
10868
10879
|
return { selected, value, label };
|
|
10869
10880
|
});
|
|
@@ -10900,7 +10911,7 @@ class MultiSelectComponent {
|
|
|
10900
10911
|
}
|
|
10901
10912
|
if (['Backspace', 'Delete'].includes($event.key)) {
|
|
10902
10913
|
$event.stopPropagation();
|
|
10903
|
-
const last = this.selectedOptions.filter(option => !option.disabled).pop();
|
|
10914
|
+
const last = this.selectedOptions.filter((option) => !option.disabled).pop();
|
|
10904
10915
|
if (last) {
|
|
10905
10916
|
this.multiSelectService.selectionModel.deselect(last.value);
|
|
10906
10917
|
}
|
|
@@ -10919,7 +10930,8 @@ class MultiSelectComponent {
|
|
|
10919
10930
|
// takeUntilDestroyed(this.#destroyRef)
|
|
10920
10931
|
// )
|
|
10921
10932
|
// .subscribe();
|
|
10922
|
-
this.focusMonitorSubscription = this.focusMonitor
|
|
10933
|
+
this.focusMonitorSubscription = this.focusMonitor
|
|
10934
|
+
?.monitor(this.elementRef, true)
|
|
10923
10935
|
.pipe(
|
|
10924
10936
|
// to avoid focus lost on speed scrolling with virtualScroll
|
|
10925
10937
|
debounceTime(100), takeUntilDestroyed(this.#destroyRef))
|
|
@@ -10939,19 +10951,19 @@ class MultiSelectComponent {
|
|
|
10939
10951
|
if (!this.scrollViewport) {
|
|
10940
10952
|
this.scrollViewport = scrollViewport;
|
|
10941
10953
|
}
|
|
10942
|
-
const availableOptions = this.options.filter(option => option.visible);
|
|
10954
|
+
const availableOptions = this.options.filter((option) => option.visible);
|
|
10943
10955
|
const firstVisibleOption = availableOptions[scrolledIndex];
|
|
10944
|
-
const activeOptionIndex = availableOptions.findIndex(option => option.value === this.activeOption?.value);
|
|
10956
|
+
const activeOptionIndex = availableOptions.findIndex((option) => option.value === this.activeOption?.value);
|
|
10945
10957
|
const optionsArray = this.multiSelectOptionsContent.toArray();
|
|
10946
10958
|
if (scrolledIndex > activeOptionIndex) {
|
|
10947
|
-
const firstVisibleItem = optionsArray.find(option => option.value === firstVisibleOption?.value);
|
|
10959
|
+
const firstVisibleItem = optionsArray.find((option) => option.value === firstVisibleOption?.value);
|
|
10948
10960
|
if (firstVisibleItem && scrolledIndex) {
|
|
10949
10961
|
this.focusKeyManager.setActiveItem(firstVisibleItem);
|
|
10950
10962
|
}
|
|
10951
10963
|
return;
|
|
10952
10964
|
}
|
|
10953
10965
|
if (scrolledIndex + this.visibleItems - 2 <= activeOptionIndex) {
|
|
10954
|
-
const lastVisibleItem = optionsArray.findIndex(option => option.value === firstVisibleOption.value);
|
|
10966
|
+
const lastVisibleItem = optionsArray.findIndex((option) => option.value === firstVisibleOption.value);
|
|
10955
10967
|
if (lastVisibleItem > -1) {
|
|
10956
10968
|
this.focusKeyManager.setActiveItem(lastVisibleItem + this.visibleItems - 2);
|
|
10957
10969
|
}
|
|
@@ -10990,14 +11002,12 @@ class MultiSelectComponent {
|
|
|
10990
11002
|
return [...option.elementRef.nativeElement.parentElement.children]?.indexOf(option.elementRef.nativeElement);
|
|
10991
11003
|
};
|
|
10992
11004
|
const optionsChange$ = this.multiSelectOptionsContent.changes;
|
|
10993
|
-
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));
|
|
10994
|
-
sortedOptions
|
|
10995
|
-
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
10996
|
-
.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) => {
|
|
10997
11007
|
return this.multiSelectOptionsContent.reset(sortedOptions);
|
|
10998
11008
|
});
|
|
10999
11009
|
this.scrollViewportView.changes
|
|
11000
|
-
.pipe(take(1), map(changes => changes.toArray()[0]), tap((scrollViewport) => {
|
|
11010
|
+
.pipe(take(1), map((changes) => changes.toArray()[0]), tap((scrollViewport) => {
|
|
11001
11011
|
if (!this.scrollViewport) {
|
|
11002
11012
|
this.scrollViewport = scrollViewport;
|
|
11003
11013
|
const cdkVirtualScrollContentWrapper = this.scrollViewport.getElementRef().nativeElement?.firstElementChild;
|
|
@@ -11005,8 +11015,8 @@ class MultiSelectComponent {
|
|
|
11005
11015
|
const style = getComputedStyle(cdkVirtualScrollContentWrapper, null) ?? undefined;
|
|
11006
11016
|
const padding = parseInt(style?.getPropertyValue('padding-left') ?? '12px') * 3;
|
|
11007
11017
|
const observer = new MutationObserver((mutationRecords) => {
|
|
11008
|
-
mutationRecords.forEach(child => {
|
|
11009
|
-
child.addedNodes.forEach(node => {
|
|
11018
|
+
mutationRecords.forEach((child) => {
|
|
11019
|
+
child.addedNodes.forEach((node) => {
|
|
11010
11020
|
if (node.nodeName === 'C-MULTI-SELECT-OPTION') {
|
|
11011
11021
|
const width = node.offsetWidth;
|
|
11012
11022
|
if (width > this.itemMinWidth) {
|
|
@@ -11038,16 +11048,14 @@ class MultiSelectComponent {
|
|
|
11038
11048
|
this.focusKeyManager = new FocusKeyManager(focusableOptions)
|
|
11039
11049
|
.withHomeAndEnd()
|
|
11040
11050
|
.withPageUpDown()
|
|
11041
|
-
.skipPredicate((option) =>
|
|
11051
|
+
.skipPredicate((option) => option.disabled || !option.visible);
|
|
11042
11052
|
if (!this._virtualScroller) {
|
|
11043
11053
|
this.focusKeyManager.withTypeAhead(300);
|
|
11044
11054
|
}
|
|
11045
11055
|
this.focusKeyManager.tabOut
|
|
11046
11056
|
.pipe(takeUntilDestroyed(this.#destroyRef), tap(() => { }))
|
|
11047
11057
|
.subscribe();
|
|
11048
|
-
this.focusKeyManager.change
|
|
11049
|
-
.pipe(takeUntilDestroyed(this.#destroyRef))
|
|
11050
|
-
.subscribe(change => {
|
|
11058
|
+
this.focusKeyManager.change.pipe(takeUntilDestroyed(this.#destroyRef)).subscribe((change) => {
|
|
11051
11059
|
if (change < 0) {
|
|
11052
11060
|
this.activeOption ? this.focusKeyManager.setActiveItem(this.activeOption) : this.setFirstItemActive();
|
|
11053
11061
|
}
|
|
@@ -11065,21 +11073,26 @@ class MultiSelectComponent {
|
|
|
11065
11073
|
// }
|
|
11066
11074
|
}
|
|
11067
11075
|
get firstFocusableItem() {
|
|
11068
|
-
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));
|
|
11069
11078
|
}
|
|
11070
11079
|
setFirstItemActive() {
|
|
11071
11080
|
const firstFocusableItem = this.firstFocusableItem;
|
|
11072
|
-
firstFocusableItem
|
|
11081
|
+
firstFocusableItem
|
|
11082
|
+
? this.focusKeyManager?.setActiveItem(firstFocusableItem)
|
|
11083
|
+
: this.focusKeyManager?.setFirstItemActive();
|
|
11073
11084
|
this.activeOption = this.focusKeyManager?.activeItem ?? null;
|
|
11074
11085
|
}
|
|
11075
11086
|
updateActiveItem(item) {
|
|
11076
11087
|
const firstFocusableItem = this.firstFocusableItem ?? item;
|
|
11077
|
-
firstFocusableItem
|
|
11088
|
+
firstFocusableItem
|
|
11089
|
+
? this.focusKeyManager?.updateActiveItem(firstFocusableItem)
|
|
11090
|
+
: this.focusKeyManager?.updateActiveItem(0);
|
|
11078
11091
|
if (this.focusKeyManager?.activeItem) {
|
|
11079
|
-
this.multiSelectOptionsContent?.forEach(option => {
|
|
11092
|
+
this.multiSelectOptionsContent?.forEach((option) => {
|
|
11080
11093
|
option.active = false;
|
|
11081
11094
|
});
|
|
11082
|
-
this.multiSelectOptionsView?.forEach(option => {
|
|
11095
|
+
this.multiSelectOptionsView?.forEach((option) => {
|
|
11083
11096
|
option.active = false;
|
|
11084
11097
|
});
|
|
11085
11098
|
this.focusKeyManager.activeItem.active = true;
|
|
@@ -11096,9 +11109,11 @@ class MultiSelectComponent {
|
|
|
11096
11109
|
I18nPluralPipe,
|
|
11097
11110
|
MultiSelectService,
|
|
11098
11111
|
{
|
|
11099
|
-
provide: NG_VALUE_ACCESSOR,
|
|
11112
|
+
provide: NG_VALUE_ACCESSOR,
|
|
11113
|
+
useExisting: forwardRef(() => MultiSelectComponent),
|
|
11114
|
+
multi: true
|
|
11100
11115
|
}
|
|
11101
|
-
], 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"] }] }); }
|
|
11102
11117
|
}
|
|
11103
11118
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImport: i0, type: MultiSelectComponent, decorators: [{
|
|
11104
11119
|
type: Component,
|
|
@@ -11106,7 +11121,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
11106
11121
|
I18nPluralPipe,
|
|
11107
11122
|
MultiSelectService,
|
|
11108
11123
|
{
|
|
11109
|
-
provide: NG_VALUE_ACCESSOR,
|
|
11124
|
+
provide: NG_VALUE_ACCESSOR,
|
|
11125
|
+
useExisting: forwardRef(() => MultiSelectComponent),
|
|
11126
|
+
multi: true
|
|
11110
11127
|
}
|
|
11111
11128
|
], standalone: true, imports: [
|
|
11112
11129
|
AsyncPipe,
|
|
@@ -11126,7 +11143,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
11126
11143
|
DropdownMenuDirective,
|
|
11127
11144
|
DropdownToggleDirective,
|
|
11128
11145
|
ElementCoverComponent
|
|
11129
|
-
], 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"] }]
|
|
11130
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: [{
|
|
11131
11148
|
type: Input,
|
|
11132
11149
|
args: [{ transform: booleanAttribute }]
|
|
@@ -11221,7 +11238,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.11", ngImpo
|
|
|
11221
11238
|
args: ['inputElement']
|
|
11222
11239
|
}], dropdownMenu: [{
|
|
11223
11240
|
type: ViewChild,
|
|
11224
|
-
args: [
|
|
11241
|
+
args: [DropdownMenuDirective, { read: ElementRef }]
|
|
11225
11242
|
}], dropdown: [{
|
|
11226
11243
|
type: ViewChild,
|
|
11227
11244
|
args: [DropdownComponent, { read: ElementRef }]
|