ngx-com 0.1.2 → 0.1.4
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/fesm2022/ngx-com-components-calendar.mjs +21 -11
- package/fesm2022/ngx-com-components-calendar.mjs.map +1 -1
- package/fesm2022/ngx-com-components-datepicker.mjs +222 -51
- package/fesm2022/ngx-com-components-datepicker.mjs.map +1 -1
- package/fesm2022/ngx-com-components-dropdown.mjs +193 -10
- package/fesm2022/ngx-com-components-dropdown.mjs.map +1 -1
- package/fesm2022/ngx-com-components-table.mjs +1 -1
- package/fesm2022/ngx-com-components-table.mjs.map +1 -1
- package/package.json +1 -1
- package/types/ngx-com-components-calendar.d.ts +5 -5
- package/types/ngx-com-components-datepicker.d.ts +44 -10
- package/types/ngx-com-components-dropdown.d.ts +54 -3
|
@@ -469,6 +469,16 @@ class ComDatepicker {
|
|
|
469
469
|
showSeconds = input(false, ...(ngDevMode ? [{ debugName: "showSeconds" }] : []));
|
|
470
470
|
/** Step interval for minutes in the time picker. */
|
|
471
471
|
minuteStep = input(1, ...(ngDevMode ? [{ debugName: "minuteStep" }] : []));
|
|
472
|
+
/**
|
|
473
|
+
* When true, date/time selections while the panel is open update only the visual state.
|
|
474
|
+
* The value is committed (emitted via `dateChange`, propagated to forms) only when
|
|
475
|
+
* the user presses "Done". Closing via Escape or backdrop click reverts to the
|
|
476
|
+
* pre-open value without emitting.
|
|
477
|
+
*
|
|
478
|
+
* All in-panel actions (date selection, time change, today, footer clear) are buffered.
|
|
479
|
+
* The trigger clear button (panel closed) always commits immediately.
|
|
480
|
+
*/
|
|
481
|
+
commitOnClose = input(false, ...(ngDevMode ? [{ debugName: "commitOnClose" }] : []));
|
|
472
482
|
// ============ OUTPUTS ============
|
|
473
483
|
/** Emitted when a date is selected. */
|
|
474
484
|
dateChange = output();
|
|
@@ -484,6 +494,11 @@ class ComDatepicker {
|
|
|
484
494
|
/** Calendar active date for navigation. Recomputes when value or startAt changes; user navigation overrides via .set(). */
|
|
485
495
|
calendarActiveDate = linkedSignal({ ...(ngDevMode ? { debugName: "calendarActiveDate" } : {}), source: () => ({ value: this.internalValue(), startAt: this.startAt() }),
|
|
486
496
|
computation: ({ value, startAt }) => value ?? startAt ?? this.dateAdapter.today() });
|
|
497
|
+
/**
|
|
498
|
+
* Snapshot of the value when the panel was opened.
|
|
499
|
+
* Used by `commitOnClose` to revert on Escape/backdrop close.
|
|
500
|
+
*/
|
|
501
|
+
committedValue = signal(null, ...(ngDevMode ? [{ debugName: "committedValue" }] : []));
|
|
487
502
|
/** Live announcements for screen readers. */
|
|
488
503
|
liveAnnouncement = signal('', ...(ngDevMode ? [{ debugName: "liveAnnouncement" }] : []));
|
|
489
504
|
/** Whether the input is focused (not panel). */
|
|
@@ -612,9 +627,9 @@ class ComDatepicker {
|
|
|
612
627
|
}
|
|
613
628
|
return this.dateFormat();
|
|
614
629
|
}, ...(ngDevMode ? [{ debugName: "effectiveDateFormat" }] : []));
|
|
615
|
-
/** Whether the panel should stay open (keepOpen
|
|
630
|
+
/** Whether the panel should stay open (keepOpen, time picker shown, or commitOnClose). */
|
|
616
631
|
effectiveKeepOpen = computed(() => {
|
|
617
|
-
return this.keepOpen() || this.showTimePicker();
|
|
632
|
+
return this.keepOpen() || this.showTimePicker() || this.commitOnClose();
|
|
618
633
|
}, ...(ngDevMode ? [{ debugName: "effectiveKeepOpen" }] : []));
|
|
619
634
|
// ============ CVA CALLBACKS ============
|
|
620
635
|
onChange = () => { };
|
|
@@ -632,6 +647,7 @@ class ComDatepicker {
|
|
|
632
647
|
// ============ CVA IMPLEMENTATION ============
|
|
633
648
|
writeValue(value) {
|
|
634
649
|
this.internalValue.set(value);
|
|
650
|
+
this.committedValue.set(value);
|
|
635
651
|
}
|
|
636
652
|
registerOnChange(fn) {
|
|
637
653
|
this.onChange = fn;
|
|
@@ -677,16 +693,40 @@ class ComDatepicker {
|
|
|
677
693
|
if (this.disabled() || this.isOpen()) {
|
|
678
694
|
return;
|
|
679
695
|
}
|
|
696
|
+
this.committedValue.set(this.value());
|
|
680
697
|
this.createOverlay();
|
|
681
698
|
this.isOpen.set(true);
|
|
682
699
|
this.opened.emit();
|
|
683
700
|
this.announce('Calendar opened');
|
|
684
701
|
}
|
|
685
|
-
/** Closes the datepicker panel. */
|
|
702
|
+
/** Closes the datepicker panel. Reverts buffered changes when `commitOnClose` is active. */
|
|
686
703
|
close() {
|
|
687
704
|
if (!this.isOpen()) {
|
|
688
705
|
return;
|
|
689
706
|
}
|
|
707
|
+
// Revert to committed value when commitOnClose is active
|
|
708
|
+
if (this.commitOnClose()) {
|
|
709
|
+
this.internalValue.set(this.committedValue());
|
|
710
|
+
this.announce('Changes discarded');
|
|
711
|
+
}
|
|
712
|
+
this.destroyOverlay();
|
|
713
|
+
this.isOpen.set(false);
|
|
714
|
+
this.closed.emit();
|
|
715
|
+
this.onTouched();
|
|
716
|
+
this.touched.set(true);
|
|
717
|
+
// Return focus to trigger
|
|
718
|
+
this.inputRef().nativeElement.focus();
|
|
719
|
+
}
|
|
720
|
+
/** Commits the buffered value and closes the panel. Called by the Done button. */
|
|
721
|
+
commitAndClose() {
|
|
722
|
+
if (!this.isOpen()) {
|
|
723
|
+
return;
|
|
724
|
+
}
|
|
725
|
+
// Commit the buffered value before closing
|
|
726
|
+
if (this.commitOnClose()) {
|
|
727
|
+
this.updateValue(this.internalValue());
|
|
728
|
+
this.announce('Date confirmed');
|
|
729
|
+
}
|
|
690
730
|
this.destroyOverlay();
|
|
691
731
|
this.isOpen.set(false);
|
|
692
732
|
this.closed.emit();
|
|
@@ -704,17 +744,27 @@ class ComDatepicker {
|
|
|
704
744
|
this.open();
|
|
705
745
|
}
|
|
706
746
|
}
|
|
707
|
-
/** Clears the selected date. */
|
|
747
|
+
/** Clears the selected date. Buffered when commitOnClose is active and panel is open. */
|
|
708
748
|
clear(event) {
|
|
709
749
|
event?.preventDefault();
|
|
710
750
|
event?.stopPropagation();
|
|
711
|
-
this.
|
|
751
|
+
if (this.commitOnClose() && this.isOpen()) {
|
|
752
|
+
this.internalValue.set(null);
|
|
753
|
+
}
|
|
754
|
+
else {
|
|
755
|
+
this.updateValue(null);
|
|
756
|
+
}
|
|
712
757
|
this.announce('Date cleared');
|
|
713
758
|
}
|
|
714
|
-
/** Selects today's date. */
|
|
759
|
+
/** Selects today's date. Buffered when commitOnClose is active and panel is open. */
|
|
715
760
|
selectToday() {
|
|
716
761
|
const today = this.dateAdapter.today();
|
|
717
|
-
this.
|
|
762
|
+
if (this.commitOnClose() && this.isOpen()) {
|
|
763
|
+
this.internalValue.set(today);
|
|
764
|
+
}
|
|
765
|
+
else {
|
|
766
|
+
this.updateValue(today);
|
|
767
|
+
}
|
|
718
768
|
if (!this.effectiveKeepOpen()) {
|
|
719
769
|
this.close();
|
|
720
770
|
}
|
|
@@ -795,18 +845,18 @@ class ComDatepicker {
|
|
|
795
845
|
}
|
|
796
846
|
onDateSelected(date) {
|
|
797
847
|
// Preserve time when selecting a new date if time picker is shown
|
|
848
|
+
let resolvedDate = date;
|
|
798
849
|
if (this.showTimePicker()) {
|
|
799
850
|
const currentValue = this.internalValue();
|
|
800
851
|
if (currentValue) {
|
|
801
|
-
|
|
802
|
-
this.updateValue(withTime);
|
|
803
|
-
}
|
|
804
|
-
else {
|
|
805
|
-
this.updateValue(date);
|
|
852
|
+
resolvedDate = this.dateAdapter.setTime(date, this.dateAdapter.getHours(currentValue), this.dateAdapter.getMinutes(currentValue), this.dateAdapter.getSeconds(currentValue));
|
|
806
853
|
}
|
|
807
854
|
}
|
|
855
|
+
if (this.commitOnClose() && this.isOpen()) {
|
|
856
|
+
this.internalValue.set(resolvedDate);
|
|
857
|
+
}
|
|
808
858
|
else {
|
|
809
|
-
this.updateValue(
|
|
859
|
+
this.updateValue(resolvedDate);
|
|
810
860
|
}
|
|
811
861
|
if (!this.effectiveKeepOpen()) {
|
|
812
862
|
this.close();
|
|
@@ -818,7 +868,12 @@ class ComDatepicker {
|
|
|
818
868
|
return;
|
|
819
869
|
const current = this.internalValue() ?? this.dateAdapter.today();
|
|
820
870
|
const updated = this.dateAdapter.setTime(current, time.hours, time.minutes, time.seconds);
|
|
821
|
-
this.
|
|
871
|
+
if (this.commitOnClose() && this.isOpen()) {
|
|
872
|
+
this.internalValue.set(updated);
|
|
873
|
+
}
|
|
874
|
+
else {
|
|
875
|
+
this.updateValue(updated);
|
|
876
|
+
}
|
|
822
877
|
}
|
|
823
878
|
onActiveDateChange(date) {
|
|
824
879
|
this.calendarActiveDate.set(date);
|
|
@@ -893,10 +948,16 @@ class ComDatepicker {
|
|
|
893
948
|
this.onValidatorChange();
|
|
894
949
|
}
|
|
895
950
|
parseAndSetValue(inputValue) {
|
|
951
|
+
const shouldBuffer = this.commitOnClose() && this.isOpen();
|
|
896
952
|
if (!inputValue.trim()) {
|
|
897
953
|
// Empty input - clear if allowed
|
|
898
954
|
if (this.hasValue()) {
|
|
899
|
-
|
|
955
|
+
if (shouldBuffer) {
|
|
956
|
+
this.internalValue.set(null);
|
|
957
|
+
}
|
|
958
|
+
else {
|
|
959
|
+
this.updateValue(null);
|
|
960
|
+
}
|
|
900
961
|
}
|
|
901
962
|
return;
|
|
902
963
|
}
|
|
@@ -904,7 +965,12 @@ class ComDatepicker {
|
|
|
904
965
|
if (parsed && this.dateAdapter.isValid(parsed)) {
|
|
905
966
|
// Validate against min/max/filter
|
|
906
967
|
if (this.isDateValid(parsed)) {
|
|
907
|
-
|
|
968
|
+
if (shouldBuffer) {
|
|
969
|
+
this.internalValue.set(parsed);
|
|
970
|
+
}
|
|
971
|
+
else {
|
|
972
|
+
this.updateValue(parsed);
|
|
973
|
+
}
|
|
908
974
|
}
|
|
909
975
|
else {
|
|
910
976
|
// Invalid date - revert to current value
|
|
@@ -935,7 +1001,7 @@ class ComDatepicker {
|
|
|
935
1001
|
this.liveAnnouncement.set(message);
|
|
936
1002
|
}
|
|
937
1003
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComDatepicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
938
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: ComDatepicker, isStandalone: true, selector: "com-datepicker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, startAt: { classPropertyName: "startAt", publicName: "startAt", isSignal: true, isRequired: false, transformFunction: null }, startView: { classPropertyName: "startView", publicName: "startView", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, dateFormat: { classPropertyName: "dateFormat", publicName: "dateFormat", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, showTodayButton: { classPropertyName: "showTodayButton", publicName: "showTodayButton", isSignal: true, isRequired: false, transformFunction: null }, showFooterClearButton: { classPropertyName: "showFooterClearButton", publicName: "showFooterClearButton", isSignal: true, isRequired: false, transformFunction: null }, keepOpen: { classPropertyName: "keepOpen", publicName: "keepOpen", isSignal: true, isRequired: false, transformFunction: null }, allowManualInput: { classPropertyName: "allowManualInput", publicName: "allowManualInput", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: true, isRequired: false, transformFunction: null }, panelWidth: { classPropertyName: "panelWidth", publicName: "panelWidth", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "ariaDescribedBy", isSignal: true, isRequired: false, transformFunction: null }, errorStateMatcher: { classPropertyName: "errorStateMatcher", publicName: "errorStateMatcher", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, sfErrors: { classPropertyName: "sfErrors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, showTimePicker: { classPropertyName: "showTimePicker", publicName: "showTimePicker", isSignal: true, isRequired: false, transformFunction: null }, use12HourFormat: { classPropertyName: "use12HourFormat", publicName: "use12HourFormat", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touched: "touchedChange", dateChange: "dateChange", opened: "opened", closed: "closed" }, host: { properties: { "class.com-datepicker-disabled": "disabled()", "class.com-datepicker-open": "isOpen()" }, classAttribute: "com-datepicker-host inline-block" }, providers: [
|
|
1004
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: ComDatepicker, isStandalone: true, selector: "com-datepicker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, startAt: { classPropertyName: "startAt", publicName: "startAt", isSignal: true, isRequired: false, transformFunction: null }, startView: { classPropertyName: "startView", publicName: "startView", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, dateFormat: { classPropertyName: "dateFormat", publicName: "dateFormat", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, showTodayButton: { classPropertyName: "showTodayButton", publicName: "showTodayButton", isSignal: true, isRequired: false, transformFunction: null }, showFooterClearButton: { classPropertyName: "showFooterClearButton", publicName: "showFooterClearButton", isSignal: true, isRequired: false, transformFunction: null }, keepOpen: { classPropertyName: "keepOpen", publicName: "keepOpen", isSignal: true, isRequired: false, transformFunction: null }, allowManualInput: { classPropertyName: "allowManualInput", publicName: "allowManualInput", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: true, isRequired: false, transformFunction: null }, panelWidth: { classPropertyName: "panelWidth", publicName: "panelWidth", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedBy: { classPropertyName: "ariaDescribedBy", publicName: "ariaDescribedBy", isSignal: true, isRequired: false, transformFunction: null }, errorStateMatcher: { classPropertyName: "errorStateMatcher", publicName: "errorStateMatcher", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, sfErrors: { classPropertyName: "sfErrors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, showTimePicker: { classPropertyName: "showTimePicker", publicName: "showTimePicker", isSignal: true, isRequired: false, transformFunction: null }, use12HourFormat: { classPropertyName: "use12HourFormat", publicName: "use12HourFormat", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null }, commitOnClose: { classPropertyName: "commitOnClose", publicName: "commitOnClose", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touched: "touchedChange", dateChange: "dateChange", opened: "opened", closed: "closed" }, host: { properties: { "class.com-datepicker-disabled": "disabled()", "class.com-datepicker-open": "isOpen()" }, classAttribute: "com-datepicker-host inline-block" }, providers: [
|
|
939
1005
|
SingleSelectionStrategy,
|
|
940
1006
|
{ provide: CALENDAR_SELECTION_STRATEGY, useExisting: SingleSelectionStrategy },
|
|
941
1007
|
{ provide: FormFieldControl, useExisting: forwardRef(() => ComDatepicker) },
|
|
@@ -1037,7 +1103,7 @@ class ComDatepicker {
|
|
|
1037
1103
|
</div>
|
|
1038
1104
|
}
|
|
1039
1105
|
|
|
1040
|
-
@if (showTodayButton() || showFooterClearButton() || showTimePicker()) {
|
|
1106
|
+
@if (showTodayButton() || showFooterClearButton() || showTimePicker() || commitOnClose()) {
|
|
1041
1107
|
<div [class]="footerClasses()">
|
|
1042
1108
|
@if (showTodayButton()) {
|
|
1043
1109
|
<button
|
|
@@ -1057,11 +1123,11 @@ class ComDatepicker {
|
|
|
1057
1123
|
Clear
|
|
1058
1124
|
</button>
|
|
1059
1125
|
}
|
|
1060
|
-
@if (showTimePicker()) {
|
|
1126
|
+
@if (showTimePicker() || commitOnClose()) {
|
|
1061
1127
|
<button
|
|
1062
1128
|
type="button"
|
|
1063
1129
|
[class]="todayButtonClasses()"
|
|
1064
|
-
(click)="
|
|
1130
|
+
(click)="commitAndClose()"
|
|
1065
1131
|
>
|
|
1066
1132
|
Done
|
|
1067
1133
|
</button>
|
|
@@ -1177,7 +1243,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
|
|
|
1177
1243
|
</div>
|
|
1178
1244
|
}
|
|
1179
1245
|
|
|
1180
|
-
@if (showTodayButton() || showFooterClearButton() || showTimePicker()) {
|
|
1246
|
+
@if (showTodayButton() || showFooterClearButton() || showTimePicker() || commitOnClose()) {
|
|
1181
1247
|
<div [class]="footerClasses()">
|
|
1182
1248
|
@if (showTodayButton()) {
|
|
1183
1249
|
<button
|
|
@@ -1197,11 +1263,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
|
|
|
1197
1263
|
Clear
|
|
1198
1264
|
</button>
|
|
1199
1265
|
}
|
|
1200
|
-
@if (showTimePicker()) {
|
|
1266
|
+
@if (showTimePicker() || commitOnClose()) {
|
|
1201
1267
|
<button
|
|
1202
1268
|
type="button"
|
|
1203
1269
|
[class]="todayButtonClasses()"
|
|
1204
|
-
(click)="
|
|
1270
|
+
(click)="commitAndClose()"
|
|
1205
1271
|
>
|
|
1206
1272
|
Done
|
|
1207
1273
|
</button>
|
|
@@ -1230,7 +1296,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
|
|
|
1230
1296
|
'[class.com-datepicker-disabled]': 'disabled()',
|
|
1231
1297
|
'[class.com-datepicker-open]': 'isOpen()',
|
|
1232
1298
|
}, styles: [".sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"] }]
|
|
1233
|
-
}], ctorParameters: () => [], propDecorators: { triggerRef: [{ type: i0.ViewChild, args: ['triggerElement', { isSignal: true }] }], inputRef: [{ type: i0.ViewChild, args: ['inputElement', { isSignal: true }] }], panelTemplateRef: [{ type: i0.ViewChild, args: ['panelTemplate', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], startAt: [{ type: i0.Input, args: [{ isSignal: true, alias: "startAt", required: false }] }], startView: [{ type: i0.Input, args: [{ isSignal: true, alias: "startView", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], dateFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFormat", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], showTodayButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTodayButton", required: false }] }], showFooterClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFooterClearButton", required: false }] }], keepOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepOpen", required: false }] }], allowManualInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowManualInput", required: false }] }], panelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelClass", required: false }] }], panelWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelWidth", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedBy", required: false }] }], errorStateMatcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorStateMatcher", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], sfErrors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], showTimePicker: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTimePicker", required: false }] }], use12HourFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "use12HourFormat", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], dateChange: [{ type: i0.Output, args: ["dateChange"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
|
|
1299
|
+
}], ctorParameters: () => [], propDecorators: { triggerRef: [{ type: i0.ViewChild, args: ['triggerElement', { isSignal: true }] }], inputRef: [{ type: i0.ViewChild, args: ['inputElement', { isSignal: true }] }], panelTemplateRef: [{ type: i0.ViewChild, args: ['panelTemplate', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], startAt: [{ type: i0.Input, args: [{ isSignal: true, alias: "startAt", required: false }] }], startView: [{ type: i0.Input, args: [{ isSignal: true, alias: "startView", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], dateFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFormat", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], showTodayButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTodayButton", required: false }] }], showFooterClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFooterClearButton", required: false }] }], keepOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepOpen", required: false }] }], allowManualInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowManualInput", required: false }] }], panelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelClass", required: false }] }], panelWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelWidth", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaDescribedBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaDescribedBy", required: false }] }], errorStateMatcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorStateMatcher", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], sfErrors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], showTimePicker: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTimePicker", required: false }] }], use12HourFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "use12HourFormat", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], commitOnClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "commitOnClose", required: false }] }], dateChange: [{ type: i0.Output, args: ["dateChange"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
|
|
1234
1300
|
|
|
1235
1301
|
/** Default position for the datepicker panel. */
|
|
1236
1302
|
const DEFAULT_POSITIONS = [
|
|
@@ -1355,6 +1421,16 @@ class ComDateRangePicker {
|
|
|
1355
1421
|
showSeconds = input(false, ...(ngDevMode ? [{ debugName: "showSeconds" }] : []));
|
|
1356
1422
|
/** Step interval for minutes in the time pickers. */
|
|
1357
1423
|
minuteStep = input(1, ...(ngDevMode ? [{ debugName: "minuteStep" }] : []));
|
|
1424
|
+
/**
|
|
1425
|
+
* When true, range/time selections while the panel is open update only the visual state.
|
|
1426
|
+
* The value is committed (emitted via `rangeChange`, propagated to forms) only when
|
|
1427
|
+
* the user presses "Done". Closing via Escape or backdrop click reverts to the
|
|
1428
|
+
* pre-open value without emitting.
|
|
1429
|
+
*
|
|
1430
|
+
* All in-panel actions (range selection, time change, today, footer clear) are buffered.
|
|
1431
|
+
* The trigger clear button (panel closed) always commits immediately.
|
|
1432
|
+
*/
|
|
1433
|
+
commitOnClose = input(false, ...(ngDevMode ? [{ debugName: "commitOnClose" }] : []));
|
|
1358
1434
|
// ============ OUTPUTS ============
|
|
1359
1435
|
/** Emitted when a complete range is selected. */
|
|
1360
1436
|
rangeChange = output();
|
|
@@ -1372,6 +1448,11 @@ class ComDateRangePicker {
|
|
|
1372
1448
|
/** Calendar active date for navigation. Recomputes when value or startAt changes; user navigation overrides via .set(). */
|
|
1373
1449
|
calendarActiveDate = linkedSignal({ ...(ngDevMode ? { debugName: "calendarActiveDate" } : {}), source: () => ({ value: this.internalValue(), startAt: this.startAt() }),
|
|
1374
1450
|
computation: ({ value, startAt }) => value?.start ?? startAt ?? this.dateAdapter.today() });
|
|
1451
|
+
/**
|
|
1452
|
+
* Snapshot of the value when the panel was opened.
|
|
1453
|
+
* Used by `commitOnClose` to revert on Escape/backdrop close.
|
|
1454
|
+
*/
|
|
1455
|
+
committedValue = signal(null, ...(ngDevMode ? [{ debugName: "committedValue" }] : []));
|
|
1375
1456
|
/** Live announcements for screen readers. */
|
|
1376
1457
|
liveAnnouncement = signal('', ...(ngDevMode ? [{ debugName: "liveAnnouncement" }] : []));
|
|
1377
1458
|
/** Whether any input is focused. */
|
|
@@ -1531,9 +1612,9 @@ class ComDateRangePicker {
|
|
|
1531
1612
|
}
|
|
1532
1613
|
return this.dateFormat();
|
|
1533
1614
|
}, ...(ngDevMode ? [{ debugName: "effectiveDateFormat" }] : []));
|
|
1534
|
-
/** Whether the panel should stay open (keepOpen
|
|
1615
|
+
/** Whether the panel should stay open (keepOpen, time picker shown, or commitOnClose). */
|
|
1535
1616
|
effectiveKeepOpen = computed(() => {
|
|
1536
|
-
return this.keepOpen() || this.showTimePicker();
|
|
1617
|
+
return this.keepOpen() || this.showTimePicker() || this.commitOnClose();
|
|
1537
1618
|
}, ...(ngDevMode ? [{ debugName: "effectiveKeepOpen" }] : []));
|
|
1538
1619
|
// ============ CVA CALLBACKS ============
|
|
1539
1620
|
onChange = () => { };
|
|
@@ -1551,6 +1632,7 @@ class ComDateRangePicker {
|
|
|
1551
1632
|
// ============ CVA IMPLEMENTATION ============
|
|
1552
1633
|
writeValue(value) {
|
|
1553
1634
|
this.internalValue.set(value);
|
|
1635
|
+
this.committedValue.set(value);
|
|
1554
1636
|
}
|
|
1555
1637
|
registerOnChange(fn) {
|
|
1556
1638
|
this.onChange = fn;
|
|
@@ -1604,16 +1686,46 @@ class ComDateRangePicker {
|
|
|
1604
1686
|
if (this.disabled() || this.isOpen()) {
|
|
1605
1687
|
return;
|
|
1606
1688
|
}
|
|
1689
|
+
this.committedValue.set(this.value());
|
|
1607
1690
|
this.createOverlay();
|
|
1608
1691
|
this.isOpen.set(true);
|
|
1609
1692
|
this.opened.emit();
|
|
1610
1693
|
this.announce('Calendar opened. Select a start date.');
|
|
1611
1694
|
}
|
|
1612
|
-
/** Closes the datepicker panel. */
|
|
1695
|
+
/** Closes the datepicker panel. Reverts buffered changes when `commitOnClose` is active. */
|
|
1613
1696
|
close() {
|
|
1614
1697
|
if (!this.isOpen()) {
|
|
1615
1698
|
return;
|
|
1616
1699
|
}
|
|
1700
|
+
// Revert to committed value when commitOnClose is active
|
|
1701
|
+
if (this.commitOnClose()) {
|
|
1702
|
+
this.internalValue.set(this.committedValue());
|
|
1703
|
+
this.announce('Changes discarded');
|
|
1704
|
+
}
|
|
1705
|
+
this.destroyOverlay();
|
|
1706
|
+
this.isOpen.set(false);
|
|
1707
|
+
this.closed.emit();
|
|
1708
|
+
this.onTouched();
|
|
1709
|
+
this.touched.set(true);
|
|
1710
|
+
// Return focus to appropriate input
|
|
1711
|
+
const activeInput = this.activeInput();
|
|
1712
|
+
if (activeInput === 'end') {
|
|
1713
|
+
this.endInputRef().nativeElement.focus();
|
|
1714
|
+
}
|
|
1715
|
+
else {
|
|
1716
|
+
this.startInputRef().nativeElement.focus();
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
/** Commits the buffered value and closes the panel. Called by the Done button. */
|
|
1720
|
+
commitAndClose() {
|
|
1721
|
+
if (!this.isOpen()) {
|
|
1722
|
+
return;
|
|
1723
|
+
}
|
|
1724
|
+
// Commit the buffered value before closing
|
|
1725
|
+
if (this.commitOnClose()) {
|
|
1726
|
+
this.updateValue(this.internalValue());
|
|
1727
|
+
this.announce('Date range confirmed');
|
|
1728
|
+
}
|
|
1617
1729
|
this.destroyOverlay();
|
|
1618
1730
|
this.isOpen.set(false);
|
|
1619
1731
|
this.closed.emit();
|
|
@@ -1637,20 +1749,31 @@ class ComDateRangePicker {
|
|
|
1637
1749
|
this.open();
|
|
1638
1750
|
}
|
|
1639
1751
|
}
|
|
1640
|
-
/** Clears the selected date range. */
|
|
1752
|
+
/** Clears the selected date range. Buffered when commitOnClose is active and panel is open. */
|
|
1641
1753
|
clear(event) {
|
|
1642
1754
|
event?.preventDefault();
|
|
1643
1755
|
event?.stopPropagation();
|
|
1644
|
-
this.
|
|
1756
|
+
if (this.commitOnClose() && this.isOpen()) {
|
|
1757
|
+
this.internalValue.set(null);
|
|
1758
|
+
}
|
|
1759
|
+
else {
|
|
1760
|
+
this.updateValue(null);
|
|
1761
|
+
}
|
|
1645
1762
|
this.announce('Date range cleared');
|
|
1646
1763
|
}
|
|
1647
|
-
/** Selects today's date as the start date. */
|
|
1764
|
+
/** Selects today's date as the start date. Buffered when commitOnClose is active and panel is open. */
|
|
1648
1765
|
selectToday() {
|
|
1649
1766
|
const today = this.dateAdapter.today();
|
|
1650
1767
|
const currentValue = this.internalValue();
|
|
1768
|
+
const shouldBuffer = this.commitOnClose() && this.isOpen();
|
|
1651
1769
|
// Set today as start if no start, or as end if we have a start
|
|
1652
1770
|
if (!currentValue?.start) {
|
|
1653
|
-
|
|
1771
|
+
if (shouldBuffer) {
|
|
1772
|
+
this.internalValue.set(createDateRangeValue(today, null));
|
|
1773
|
+
}
|
|
1774
|
+
else {
|
|
1775
|
+
this.updateValue(createDateRangeValue(today, null));
|
|
1776
|
+
}
|
|
1654
1777
|
this.announce('Start date set to today');
|
|
1655
1778
|
}
|
|
1656
1779
|
else if (!currentValue.end) {
|
|
@@ -1658,7 +1781,12 @@ class ComDateRangePicker {
|
|
|
1658
1781
|
const newRange = this.dateAdapter.compareDate(today, currentValue.start) < 0
|
|
1659
1782
|
? createDateRangeValue(today, currentValue.start)
|
|
1660
1783
|
: createDateRangeValue(currentValue.start, today);
|
|
1661
|
-
|
|
1784
|
+
if (shouldBuffer) {
|
|
1785
|
+
this.internalValue.set(newRange);
|
|
1786
|
+
}
|
|
1787
|
+
else {
|
|
1788
|
+
this.updateValue(newRange);
|
|
1789
|
+
}
|
|
1662
1790
|
if (!this.effectiveKeepOpen()) {
|
|
1663
1791
|
this.close();
|
|
1664
1792
|
}
|
|
@@ -1757,7 +1885,12 @@ class ComDateRangePicker {
|
|
|
1757
1885
|
const range = selection;
|
|
1758
1886
|
if (range) {
|
|
1759
1887
|
const newValue = createDateRangeValue(range.start, range.end);
|
|
1760
|
-
this.
|
|
1888
|
+
if (this.commitOnClose() && this.isOpen()) {
|
|
1889
|
+
this.internalValue.set(newValue);
|
|
1890
|
+
}
|
|
1891
|
+
else {
|
|
1892
|
+
this.updateValue(newValue);
|
|
1893
|
+
}
|
|
1761
1894
|
if (range.start && range.end) {
|
|
1762
1895
|
// Complete range selected
|
|
1763
1896
|
this.announce(`Range selected: ${this.formatDate(range.start)} to ${this.formatDate(range.end)}`);
|
|
@@ -1779,7 +1912,13 @@ class ComDateRangePicker {
|
|
|
1779
1912
|
const value = this.internalValue();
|
|
1780
1913
|
const startDate = value?.start ?? this.dateAdapter.today();
|
|
1781
1914
|
const updated = this.dateAdapter.setTime(startDate, time.hours, time.minutes, time.seconds);
|
|
1782
|
-
|
|
1915
|
+
const newValue = createDateRangeValue(updated, value?.end ?? null);
|
|
1916
|
+
if (this.commitOnClose() && this.isOpen()) {
|
|
1917
|
+
this.internalValue.set(newValue);
|
|
1918
|
+
}
|
|
1919
|
+
else {
|
|
1920
|
+
this.updateValue(newValue);
|
|
1921
|
+
}
|
|
1783
1922
|
}
|
|
1784
1923
|
onEndTimeChange(time) {
|
|
1785
1924
|
if (!time)
|
|
@@ -1787,7 +1926,13 @@ class ComDateRangePicker {
|
|
|
1787
1926
|
const value = this.internalValue();
|
|
1788
1927
|
const endDate = value?.end ?? this.dateAdapter.today();
|
|
1789
1928
|
const updated = this.dateAdapter.setTime(endDate, time.hours, time.minutes, time.seconds);
|
|
1790
|
-
|
|
1929
|
+
const newValue = createDateRangeValue(value?.start ?? null, updated);
|
|
1930
|
+
if (this.commitOnClose() && this.isOpen()) {
|
|
1931
|
+
this.internalValue.set(newValue);
|
|
1932
|
+
}
|
|
1933
|
+
else {
|
|
1934
|
+
this.updateValue(newValue);
|
|
1935
|
+
}
|
|
1791
1936
|
}
|
|
1792
1937
|
// ============ FormFieldControl IMPLEMENTATION ============
|
|
1793
1938
|
/**
|
|
@@ -1861,22 +2006,35 @@ class ComDateRangePicker {
|
|
|
1861
2006
|
}
|
|
1862
2007
|
parseAndSetStart(inputValue) {
|
|
1863
2008
|
const currentValue = this.internalValue();
|
|
2009
|
+
const shouldBuffer = this.commitOnClose() && this.isOpen();
|
|
1864
2010
|
if (!inputValue.trim()) {
|
|
1865
2011
|
// Clear start date
|
|
1866
2012
|
if (currentValue?.start) {
|
|
1867
|
-
|
|
2013
|
+
const newValue = createDateRangeValue(null, currentValue.end);
|
|
2014
|
+
if (shouldBuffer) {
|
|
2015
|
+
this.internalValue.set(newValue);
|
|
2016
|
+
}
|
|
2017
|
+
else {
|
|
2018
|
+
this.updateValue(newValue);
|
|
2019
|
+
}
|
|
1868
2020
|
}
|
|
1869
2021
|
return;
|
|
1870
2022
|
}
|
|
1871
2023
|
const parsed = this.dateAdapter.parse(inputValue, this.effectiveDateFormat());
|
|
1872
2024
|
if (parsed && this.dateAdapter.isValid(parsed) && this.isDateValid(parsed)) {
|
|
1873
2025
|
// Ensure start <= end
|
|
2026
|
+
let newValue;
|
|
1874
2027
|
if (currentValue?.end && this.dateAdapter.compareDate(parsed, currentValue.end) > 0) {
|
|
1875
|
-
|
|
1876
|
-
|
|
2028
|
+
newValue = createDateRangeValue(currentValue.end, parsed);
|
|
2029
|
+
}
|
|
2030
|
+
else {
|
|
2031
|
+
newValue = createDateRangeValue(parsed, currentValue?.end ?? null);
|
|
2032
|
+
}
|
|
2033
|
+
if (shouldBuffer) {
|
|
2034
|
+
this.internalValue.set(newValue);
|
|
1877
2035
|
}
|
|
1878
2036
|
else {
|
|
1879
|
-
this.updateValue(
|
|
2037
|
+
this.updateValue(newValue);
|
|
1880
2038
|
}
|
|
1881
2039
|
}
|
|
1882
2040
|
else {
|
|
@@ -1886,22 +2044,35 @@ class ComDateRangePicker {
|
|
|
1886
2044
|
}
|
|
1887
2045
|
parseAndSetEnd(inputValue) {
|
|
1888
2046
|
const currentValue = this.internalValue();
|
|
2047
|
+
const shouldBuffer = this.commitOnClose() && this.isOpen();
|
|
1889
2048
|
if (!inputValue.trim()) {
|
|
1890
2049
|
// Clear end date
|
|
1891
2050
|
if (currentValue?.end) {
|
|
1892
|
-
|
|
2051
|
+
const newValue = createDateRangeValue(currentValue.start, null);
|
|
2052
|
+
if (shouldBuffer) {
|
|
2053
|
+
this.internalValue.set(newValue);
|
|
2054
|
+
}
|
|
2055
|
+
else {
|
|
2056
|
+
this.updateValue(newValue);
|
|
2057
|
+
}
|
|
1893
2058
|
}
|
|
1894
2059
|
return;
|
|
1895
2060
|
}
|
|
1896
2061
|
const parsed = this.dateAdapter.parse(inputValue, this.effectiveDateFormat());
|
|
1897
2062
|
if (parsed && this.dateAdapter.isValid(parsed) && this.isDateValid(parsed)) {
|
|
1898
2063
|
// Ensure start <= end
|
|
2064
|
+
let newValue;
|
|
1899
2065
|
if (currentValue?.start && this.dateAdapter.compareDate(parsed, currentValue.start) < 0) {
|
|
1900
|
-
|
|
1901
|
-
|
|
2066
|
+
newValue = createDateRangeValue(parsed, currentValue.start);
|
|
2067
|
+
}
|
|
2068
|
+
else {
|
|
2069
|
+
newValue = createDateRangeValue(currentValue?.start ?? null, parsed);
|
|
2070
|
+
}
|
|
2071
|
+
if (shouldBuffer) {
|
|
2072
|
+
this.internalValue.set(newValue);
|
|
1902
2073
|
}
|
|
1903
2074
|
else {
|
|
1904
|
-
this.updateValue(
|
|
2075
|
+
this.updateValue(newValue);
|
|
1905
2076
|
}
|
|
1906
2077
|
}
|
|
1907
2078
|
else {
|
|
@@ -1931,7 +2102,7 @@ class ComDateRangePicker {
|
|
|
1931
2102
|
this.liveAnnouncement.set(message);
|
|
1932
2103
|
}
|
|
1933
2104
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.0", ngImport: i0, type: ComDateRangePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1934
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: ComDateRangePicker, isStandalone: true, selector: "com-date-range-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, startAt: { classPropertyName: "startAt", publicName: "startAt", isSignal: true, isRequired: false, transformFunction: null }, startView: { classPropertyName: "startView", publicName: "startView", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, startPlaceholder: { classPropertyName: "startPlaceholder", publicName: "startPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, endPlaceholder: { classPropertyName: "endPlaceholder", publicName: "endPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, dateFormat: { classPropertyName: "dateFormat", publicName: "dateFormat", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, showTodayButton: { classPropertyName: "showTodayButton", publicName: "showTodayButton", isSignal: true, isRequired: false, transformFunction: null }, showFooterClearButton: { classPropertyName: "showFooterClearButton", publicName: "showFooterClearButton", isSignal: true, isRequired: false, transformFunction: null }, keepOpen: { classPropertyName: "keepOpen", publicName: "keepOpen", isSignal: true, isRequired: false, transformFunction: null }, allowManualInput: { classPropertyName: "allowManualInput", publicName: "allowManualInput", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: true, isRequired: false, transformFunction: null }, panelWidth: { classPropertyName: "panelWidth", publicName: "panelWidth", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, startAriaLabel: { classPropertyName: "startAriaLabel", publicName: "startAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, endAriaLabel: { classPropertyName: "endAriaLabel", publicName: "endAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, errorStateMatcher: { classPropertyName: "errorStateMatcher", publicName: "errorStateMatcher", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, sfErrors: { classPropertyName: "sfErrors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, showTimePicker: { classPropertyName: "showTimePicker", publicName: "showTimePicker", isSignal: true, isRequired: false, transformFunction: null }, use12HourFormat: { classPropertyName: "use12HourFormat", publicName: "use12HourFormat", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touched: "touchedChange", rangeChange: "rangeChange", opened: "opened", closed: "closed" }, host: { properties: { "class.com-date-range-picker-disabled": "disabled()", "class.com-date-range-picker-open": "isOpen()" }, classAttribute: "com-date-range-picker-host inline-block" }, providers: [
|
|
2105
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.0", type: ComDateRangePicker, isStandalone: true, selector: "com-date-range-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, dateFilter: { classPropertyName: "dateFilter", publicName: "dateFilter", isSignal: true, isRequired: false, transformFunction: null }, startAt: { classPropertyName: "startAt", publicName: "startAt", isSignal: true, isRequired: false, transformFunction: null }, startView: { classPropertyName: "startView", publicName: "startView", isSignal: true, isRequired: false, transformFunction: null }, firstDayOfWeek: { classPropertyName: "firstDayOfWeek", publicName: "firstDayOfWeek", isSignal: true, isRequired: false, transformFunction: null }, startPlaceholder: { classPropertyName: "startPlaceholder", publicName: "startPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, endPlaceholder: { classPropertyName: "endPlaceholder", publicName: "endPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, dateFormat: { classPropertyName: "dateFormat", publicName: "dateFormat", isSignal: true, isRequired: false, transformFunction: null }, showClearButton: { classPropertyName: "showClearButton", publicName: "showClearButton", isSignal: true, isRequired: false, transformFunction: null }, showTodayButton: { classPropertyName: "showTodayButton", publicName: "showTodayButton", isSignal: true, isRequired: false, transformFunction: null }, showFooterClearButton: { classPropertyName: "showFooterClearButton", publicName: "showFooterClearButton", isSignal: true, isRequired: false, transformFunction: null }, keepOpen: { classPropertyName: "keepOpen", publicName: "keepOpen", isSignal: true, isRequired: false, transformFunction: null }, allowManualInput: { classPropertyName: "allowManualInput", publicName: "allowManualInput", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: true, isRequired: false, transformFunction: null }, panelWidth: { classPropertyName: "panelWidth", publicName: "panelWidth", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, state: { classPropertyName: "state", publicName: "state", isSignal: true, isRequired: false, transformFunction: null }, userClass: { classPropertyName: "userClass", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, startAriaLabel: { classPropertyName: "startAriaLabel", publicName: "startAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, endAriaLabel: { classPropertyName: "endAriaLabel", publicName: "endAriaLabel", isSignal: true, isRequired: false, transformFunction: null }, errorStateMatcher: { classPropertyName: "errorStateMatcher", publicName: "errorStateMatcher", isSignal: true, isRequired: false, transformFunction: null }, touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, sfErrors: { classPropertyName: "sfErrors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, showTimePicker: { classPropertyName: "showTimePicker", publicName: "showTimePicker", isSignal: true, isRequired: false, transformFunction: null }, use12HourFormat: { classPropertyName: "use12HourFormat", publicName: "use12HourFormat", isSignal: true, isRequired: false, transformFunction: null }, showSeconds: { classPropertyName: "showSeconds", publicName: "showSeconds", isSignal: true, isRequired: false, transformFunction: null }, minuteStep: { classPropertyName: "minuteStep", publicName: "minuteStep", isSignal: true, isRequired: false, transformFunction: null }, commitOnClose: { classPropertyName: "commitOnClose", publicName: "commitOnClose", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", touched: "touchedChange", rangeChange: "rangeChange", opened: "opened", closed: "closed" }, host: { properties: { "class.com-date-range-picker-disabled": "disabled()", "class.com-date-range-picker-open": "isOpen()" }, classAttribute: "com-date-range-picker-host inline-block" }, providers: [
|
|
1935
2106
|
RangeSelectionStrategy,
|
|
1936
2107
|
{ provide: CALENDAR_SELECTION_STRATEGY, useExisting: RangeSelectionStrategy },
|
|
1937
2108
|
{ provide: FormFieldControl, useExisting: forwardRef(() => ComDateRangePicker) },
|
|
@@ -2080,7 +2251,7 @@ class ComDateRangePicker {
|
|
|
2080
2251
|
</div>
|
|
2081
2252
|
}
|
|
2082
2253
|
|
|
2083
|
-
@if (showTodayButton() || showFooterClearButton() || showTimePicker()) {
|
|
2254
|
+
@if (showTodayButton() || showFooterClearButton() || showTimePicker() || commitOnClose()) {
|
|
2084
2255
|
<div [class]="footerClasses()">
|
|
2085
2256
|
@if (showTodayButton()) {
|
|
2086
2257
|
<button
|
|
@@ -2100,11 +2271,11 @@ class ComDateRangePicker {
|
|
|
2100
2271
|
Clear
|
|
2101
2272
|
</button>
|
|
2102
2273
|
}
|
|
2103
|
-
@if (showTimePicker()) {
|
|
2274
|
+
@if (showTimePicker() || commitOnClose()) {
|
|
2104
2275
|
<button
|
|
2105
2276
|
type="button"
|
|
2106
2277
|
[class]="todayButtonClasses()"
|
|
2107
|
-
(click)="
|
|
2278
|
+
(click)="commitAndClose()"
|
|
2108
2279
|
>
|
|
2109
2280
|
Done
|
|
2110
2281
|
</button>
|
|
@@ -2267,7 +2438,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
|
|
|
2267
2438
|
</div>
|
|
2268
2439
|
}
|
|
2269
2440
|
|
|
2270
|
-
@if (showTodayButton() || showFooterClearButton() || showTimePicker()) {
|
|
2441
|
+
@if (showTodayButton() || showFooterClearButton() || showTimePicker() || commitOnClose()) {
|
|
2271
2442
|
<div [class]="footerClasses()">
|
|
2272
2443
|
@if (showTodayButton()) {
|
|
2273
2444
|
<button
|
|
@@ -2287,11 +2458,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
|
|
|
2287
2458
|
Clear
|
|
2288
2459
|
</button>
|
|
2289
2460
|
}
|
|
2290
|
-
@if (showTimePicker()) {
|
|
2461
|
+
@if (showTimePicker() || commitOnClose()) {
|
|
2291
2462
|
<button
|
|
2292
2463
|
type="button"
|
|
2293
2464
|
[class]="todayButtonClasses()"
|
|
2294
|
-
(click)="
|
|
2465
|
+
(click)="commitAndClose()"
|
|
2295
2466
|
>
|
|
2296
2467
|
Done
|
|
2297
2468
|
</button>
|
|
@@ -2320,7 +2491,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.0", ngImpor
|
|
|
2320
2491
|
'[class.com-date-range-picker-disabled]': 'disabled()',
|
|
2321
2492
|
'[class.com-date-range-picker-open]': 'isOpen()',
|
|
2322
2493
|
}, styles: [".sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}\n"] }]
|
|
2323
|
-
}], ctorParameters: () => [], propDecorators: { triggerRef: [{ type: i0.ViewChild, args: ['triggerElement', { isSignal: true }] }], startInputRef: [{ type: i0.ViewChild, args: ['startInputElement', { isSignal: true }] }], endInputRef: [{ type: i0.ViewChild, args: ['endInputElement', { isSignal: true }] }], panelTemplateRef: [{ type: i0.ViewChild, args: ['panelTemplate', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], startAt: [{ type: i0.Input, args: [{ isSignal: true, alias: "startAt", required: false }] }], startView: [{ type: i0.Input, args: [{ isSignal: true, alias: "startView", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], startPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "startPlaceholder", required: false }] }], endPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "endPlaceholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], dateFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFormat", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], showTodayButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTodayButton", required: false }] }], showFooterClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFooterClearButton", required: false }] }], keepOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepOpen", required: false }] }], allowManualInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowManualInput", required: false }] }], panelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelClass", required: false }] }], panelWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelWidth", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], startAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "startAriaLabel", required: false }] }], endAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "endAriaLabel", required: false }] }], errorStateMatcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorStateMatcher", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], sfErrors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], showTimePicker: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTimePicker", required: false }] }], use12HourFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "use12HourFormat", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], rangeChange: [{ type: i0.Output, args: ["rangeChange"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
|
|
2494
|
+
}], ctorParameters: () => [], propDecorators: { triggerRef: [{ type: i0.ViewChild, args: ['triggerElement', { isSignal: true }] }], startInputRef: [{ type: i0.ViewChild, args: ['startInputElement', { isSignal: true }] }], endInputRef: [{ type: i0.ViewChild, args: ['endInputElement', { isSignal: true }] }], panelTemplateRef: [{ type: i0.ViewChild, args: ['panelTemplate', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], dateFilter: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFilter", required: false }] }], startAt: [{ type: i0.Input, args: [{ isSignal: true, alias: "startAt", required: false }] }], startView: [{ type: i0.Input, args: [{ isSignal: true, alias: "startView", required: false }] }], firstDayOfWeek: [{ type: i0.Input, args: [{ isSignal: true, alias: "firstDayOfWeek", required: false }] }], startPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "startPlaceholder", required: false }] }], endPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "endPlaceholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], dateFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "dateFormat", required: false }] }], showClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showClearButton", required: false }] }], showTodayButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTodayButton", required: false }] }], showFooterClearButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFooterClearButton", required: false }] }], keepOpen: [{ type: i0.Input, args: [{ isSignal: true, alias: "keepOpen", required: false }] }], allowManualInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowManualInput", required: false }] }], panelClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelClass", required: false }] }], panelWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "panelWidth", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], state: [{ type: i0.Input, args: [{ isSignal: true, alias: "state", required: false }] }], userClass: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], startAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "startAriaLabel", required: false }] }], endAriaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "endAriaLabel", required: false }] }], errorStateMatcher: [{ type: i0.Input, args: [{ isSignal: true, alias: "errorStateMatcher", required: false }] }], touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], sfErrors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], showTimePicker: [{ type: i0.Input, args: [{ isSignal: true, alias: "showTimePicker", required: false }] }], use12HourFormat: [{ type: i0.Input, args: [{ isSignal: true, alias: "use12HourFormat", required: false }] }], showSeconds: [{ type: i0.Input, args: [{ isSignal: true, alias: "showSeconds", required: false }] }], minuteStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "minuteStep", required: false }] }], commitOnClose: [{ type: i0.Input, args: [{ isSignal: true, alias: "commitOnClose", required: false }] }], rangeChange: [{ type: i0.Output, args: ["rangeChange"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }] } });
|
|
2324
2495
|
|
|
2325
2496
|
/**
|
|
2326
2497
|
* Datepicker components public API.
|