nexheal-lib 0.0.56 → 0.0.58
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/nexheal-lib.mjs +347 -36
- package/fesm2022/nexheal-lib.mjs.map +1 -1
- package/index.d.ts +45 -4
- package/package.json +1 -1
package/fesm2022/nexheal-lib.mjs
CHANGED
|
@@ -423,6 +423,10 @@ class CalendarControl {
|
|
|
423
423
|
errorMessage = "";
|
|
424
424
|
hourFormat = "24";
|
|
425
425
|
selectionMode = "single";
|
|
426
|
+
/** `week` = Sun–Sat calendar week. `sevenDays` = clicked date through +6 days. */
|
|
427
|
+
get isWeekLikeMode() {
|
|
428
|
+
return this.selectionMode === "week" || this.selectionMode === "sevenDays";
|
|
429
|
+
}
|
|
426
430
|
timeOnly = false;
|
|
427
431
|
dateFormat = "dd/MM/yyyy";
|
|
428
432
|
placeholder = "";
|
|
@@ -450,8 +454,10 @@ class CalendarControl {
|
|
|
450
454
|
selectionCleared = new EventEmitter();
|
|
451
455
|
blurEvent = new EventEmitter();
|
|
452
456
|
dateSelected = new EventEmitter();
|
|
453
|
-
/** Emitted in `selectionMode="week"`
|
|
457
|
+
/** Emitted in `selectionMode="week"` (Sun–Sat) and `"sevenDays"` (clicked date through +6 days). */
|
|
454
458
|
weekSelected = new EventEmitter();
|
|
459
|
+
/** Emitted in `selectionMode="range"` with the selected start/end (or null when cleared). */
|
|
460
|
+
rangeSelected = new EventEmitter();
|
|
455
461
|
_defaultDate;
|
|
456
462
|
get defaultDate() {
|
|
457
463
|
return this._defaultDate;
|
|
@@ -503,6 +509,11 @@ class CalendarControl {
|
|
|
503
509
|
selectedWeekEnd = null;
|
|
504
510
|
hoverWeekStart = null;
|
|
505
511
|
hoverWeekEnd = null;
|
|
512
|
+
rangeStart = null;
|
|
513
|
+
rangeEnd = null;
|
|
514
|
+
hoverDate = null;
|
|
515
|
+
committedRangeStart = null;
|
|
516
|
+
committedRangeEnd = null;
|
|
506
517
|
today = new Date();
|
|
507
518
|
todayYear = this.today.getFullYear();
|
|
508
519
|
todayMonth = this.today.getMonth();
|
|
@@ -543,14 +554,13 @@ class CalendarControl {
|
|
|
543
554
|
this.selectedDate = null;
|
|
544
555
|
this.selectedWeekStart = null;
|
|
545
556
|
this.selectedWeekEnd = null;
|
|
557
|
+
this.applyDateRange(null, null, false);
|
|
546
558
|
this.inputControl.setValue("", { emitEvent: false });
|
|
547
559
|
return;
|
|
548
560
|
}
|
|
549
561
|
// Week mode: value is a "start - end" range string
|
|
550
|
-
if (this.
|
|
551
|
-
const
|
|
552
|
-
const firstPart = raw.split(" - ")[0].trim();
|
|
553
|
-
const parsed = this.parseDate(firstPart) || this.parseDate(raw);
|
|
562
|
+
if (this.isWeekLikeMode) {
|
|
563
|
+
const parsed = this.parseWeekAnchor(value);
|
|
554
564
|
if (!parsed) {
|
|
555
565
|
this.selectedWeekStart = null;
|
|
556
566
|
this.selectedWeekEnd = null;
|
|
@@ -567,6 +577,20 @@ class CalendarControl {
|
|
|
567
577
|
this.inputControl.setValue(this.formatWeek(start, end), { emitEvent: false });
|
|
568
578
|
return;
|
|
569
579
|
}
|
|
580
|
+
if (this.selectionMode === "range") {
|
|
581
|
+
const parsedRange = this.parseIncomingRange(value);
|
|
582
|
+
if (!parsedRange) {
|
|
583
|
+
this.applyDateRange(null, null, false);
|
|
584
|
+
this.selectedDate = null;
|
|
585
|
+
this.inputControl.setValue("", { emitEvent: false });
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
this.applyDateRange(parsedRange.start, parsedRange.end, false);
|
|
589
|
+
this.selectedDate = parsedRange.start;
|
|
590
|
+
this.displayMonth = parsedRange.start.getMonth();
|
|
591
|
+
this.displayYear = parsedRange.start.getFullYear();
|
|
592
|
+
return;
|
|
593
|
+
}
|
|
570
594
|
if (this.timeOnly) {
|
|
571
595
|
let hours, mins;
|
|
572
596
|
if (typeof value === "string") {
|
|
@@ -697,7 +721,7 @@ class CalendarControl {
|
|
|
697
721
|
this.onTouchedFn();
|
|
698
722
|
// Week mode keeps a "start - end" range string; the single-date parsing
|
|
699
723
|
// below would fail to parse it and wipe the selection, so handle it here.
|
|
700
|
-
if (this.
|
|
724
|
+
if (this.isWeekLikeMode) {
|
|
701
725
|
const rawWeek = (this.inputControl.value || "").trim();
|
|
702
726
|
const current = this.selectedWeekStart && this.selectedWeekEnd
|
|
703
727
|
? this.formatWeek(this.selectedWeekStart, this.selectedWeekEnd)
|
|
@@ -718,8 +742,8 @@ class CalendarControl {
|
|
|
718
742
|
this.blurEvent.emit();
|
|
719
743
|
return;
|
|
720
744
|
}
|
|
721
|
-
// typed a different value -> recompute the week
|
|
722
|
-
const parsed = this.
|
|
745
|
+
// typed a different value -> recompute the week, else revert
|
|
746
|
+
const parsed = this.parseWeekAnchor(rawWeek);
|
|
723
747
|
if (!parsed) {
|
|
724
748
|
this.inputControl.setValue(current, { emitEvent: false });
|
|
725
749
|
this.blurEvent.emit();
|
|
@@ -739,6 +763,10 @@ class CalendarControl {
|
|
|
739
763
|
this.blurEvent.emit();
|
|
740
764
|
return;
|
|
741
765
|
}
|
|
766
|
+
if (this.selectionMode === "range") {
|
|
767
|
+
this.onRangeBlur();
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
742
770
|
const raw = (this.inputControl.value || "");
|
|
743
771
|
let currentFormatted = "";
|
|
744
772
|
if (this.selectedDate) {
|
|
@@ -880,7 +908,10 @@ class CalendarControl {
|
|
|
880
908
|
this.toggleCalendar();
|
|
881
909
|
break;
|
|
882
910
|
case "Escape":
|
|
883
|
-
this.
|
|
911
|
+
if (this.selectionMode === "range")
|
|
912
|
+
this.closeCalendar();
|
|
913
|
+
else
|
|
914
|
+
this.isOpen = false;
|
|
884
915
|
break;
|
|
885
916
|
case " ":
|
|
886
917
|
case "Spacebar":
|
|
@@ -888,7 +919,10 @@ class CalendarControl {
|
|
|
888
919
|
this.toggleCalendar();
|
|
889
920
|
break;
|
|
890
921
|
case "Tab":
|
|
891
|
-
this.
|
|
922
|
+
if (this.selectionMode === "range")
|
|
923
|
+
this.closeCalendar();
|
|
924
|
+
else
|
|
925
|
+
this.isOpen = false;
|
|
892
926
|
break;
|
|
893
927
|
}
|
|
894
928
|
}
|
|
@@ -897,8 +931,8 @@ class CalendarControl {
|
|
|
897
931
|
if (!cell || cell.disabled)
|
|
898
932
|
return;
|
|
899
933
|
const base = cell.date;
|
|
900
|
-
// Week
|
|
901
|
-
if (this.
|
|
934
|
+
// Week / sevenDays: select a 7-day span from the clicked date
|
|
935
|
+
if (this.isWeekLikeMode) {
|
|
902
936
|
const { start, end } = this.getWeekRange(base);
|
|
903
937
|
this.selectedWeekStart = start;
|
|
904
938
|
this.selectedWeekEnd = end;
|
|
@@ -912,6 +946,10 @@ class CalendarControl {
|
|
|
912
946
|
this.isOpen = false;
|
|
913
947
|
return;
|
|
914
948
|
}
|
|
949
|
+
if (this.selectionMode === "range") {
|
|
950
|
+
this.selectRangeDay(cell);
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
915
953
|
const picked = this.showTime
|
|
916
954
|
? new Date(base.getFullYear(), base.getMonth(), base.getDate(), this.selectedHour, this.selectedMinute)
|
|
917
955
|
: new Date(base.getFullYear(), base.getMonth(), base.getDate());
|
|
@@ -944,12 +982,7 @@ class CalendarControl {
|
|
|
944
982
|
day: date.getDate(),
|
|
945
983
|
otherMonth: date.getMonth() !== this.displayMonth,
|
|
946
984
|
disabled: this.isDateDisabled(date),
|
|
947
|
-
selected: this.
|
|
948
|
-
? this.isWithin(date, this.selectedWeekStart, this.selectedWeekEnd)
|
|
949
|
-
: !!this.selectedDate &&
|
|
950
|
-
this.selectedDate.getFullYear() === date.getFullYear() &&
|
|
951
|
-
this.selectedDate.getMonth() === date.getMonth() &&
|
|
952
|
-
this.selectedDate.getDate() === date.getDate(),
|
|
985
|
+
selected: this.isCellSelected(date),
|
|
953
986
|
today: this.todayYear === date.getFullYear() &&
|
|
954
987
|
this.todayMonth === date.getMonth() &&
|
|
955
988
|
this.todayDate === date.getDate(),
|
|
@@ -974,6 +1007,11 @@ class CalendarControl {
|
|
|
974
1007
|
const d = +m[1], mo = +m[2] - 1, y = +m[3];
|
|
975
1008
|
return new Date(y, mo, d);
|
|
976
1009
|
}
|
|
1010
|
+
// Date-only ISO must be local; `new Date("yyyy-MM-dd")` is UTC and shifts the day in IST.
|
|
1011
|
+
const isoDateOnly = val.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
1012
|
+
if (isoDateOnly) {
|
|
1013
|
+
return new Date(+isoDateOnly[1], +isoDateOnly[2] - 1, +isoDateOnly[3]);
|
|
1014
|
+
}
|
|
977
1015
|
}
|
|
978
1016
|
// fallback
|
|
979
1017
|
const date = new Date(val);
|
|
@@ -1013,42 +1051,293 @@ class CalendarControl {
|
|
|
1013
1051
|
this.isDateDisabled(new Date(this.displayYear, this.displayMonth, day)));
|
|
1014
1052
|
}
|
|
1015
1053
|
// week
|
|
1016
|
-
/**
|
|
1054
|
+
/**
|
|
1055
|
+
* `week`: Sun–Sat containing `date`.
|
|
1056
|
+
* `sevenDays`: `date` through the next 6 days.
|
|
1057
|
+
*/
|
|
1017
1058
|
getWeekRange(date) {
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1059
|
+
const day = this.startOfDay(date);
|
|
1060
|
+
if (this.selectionMode === "sevenDays") {
|
|
1061
|
+
const start = day;
|
|
1062
|
+
const end = new Date(start.getFullYear(), start.getMonth(), start.getDate() + 6, 23, 59, 59, 999);
|
|
1063
|
+
return { start, end };
|
|
1064
|
+
}
|
|
1065
|
+
const start = new Date(day.getFullYear(), day.getMonth(), day.getDate() - day.getDay());
|
|
1066
|
+
const end = new Date(start.getFullYear(), start.getMonth(), start.getDate() + 6, 23, 59, 59, 999);
|
|
1024
1067
|
return { start, end };
|
|
1025
1068
|
}
|
|
1069
|
+
/**
|
|
1070
|
+
* `sevenDays` anchors on the start date (clicked day).
|
|
1071
|
+
* `week` (Sun–Sat) prefers the end date when both are present so Sunday 00:00 IST
|
|
1072
|
+
* does not snap the previous UTC day back a calendar week.
|
|
1073
|
+
*/
|
|
1074
|
+
parseWeekAnchor(value) {
|
|
1075
|
+
if (value instanceof Date && !isNaN(value.getTime())) {
|
|
1076
|
+
return this.startOfDay(value);
|
|
1077
|
+
}
|
|
1078
|
+
if (Array.isArray(value) && value.length) {
|
|
1079
|
+
if (this.selectionMode === "week" && value[1] != null) {
|
|
1080
|
+
const end = this.parseDate(value[1]);
|
|
1081
|
+
if (end)
|
|
1082
|
+
return end;
|
|
1083
|
+
}
|
|
1084
|
+
return this.parseWeekAnchor(value[0]);
|
|
1085
|
+
}
|
|
1086
|
+
if (value && typeof value === "object" && !(value instanceof Date) && (value.start || value.end)) {
|
|
1087
|
+
if (this.selectionMode === "week" && value.end) {
|
|
1088
|
+
const end = this.parseDate(value.end);
|
|
1089
|
+
if (end)
|
|
1090
|
+
return end;
|
|
1091
|
+
}
|
|
1092
|
+
return this.parseWeekAnchor(value.start);
|
|
1093
|
+
}
|
|
1094
|
+
const raw = String(value ?? "").trim();
|
|
1095
|
+
if (!raw)
|
|
1096
|
+
return null;
|
|
1097
|
+
const parts = raw.split(/\s+[-–—]\s+/).map((part) => part.trim()).filter(Boolean);
|
|
1098
|
+
if (this.selectionMode === "week" && parts.length >= 2) {
|
|
1099
|
+
const end = this.parseDate(parts[1]);
|
|
1100
|
+
if (end)
|
|
1101
|
+
return end;
|
|
1102
|
+
}
|
|
1103
|
+
if (parts.length >= 1) {
|
|
1104
|
+
const start = this.parseDate(parts[0]);
|
|
1105
|
+
if (start)
|
|
1106
|
+
return start;
|
|
1107
|
+
}
|
|
1108
|
+
return this.parseDate(raw);
|
|
1109
|
+
}
|
|
1026
1110
|
formatWeek(start, end) {
|
|
1027
1111
|
return `${this.datePipe.transform(start, this.dateFormat)} - ${this.datePipe.transform(end, this.dateFormat)}`;
|
|
1028
1112
|
}
|
|
1029
1113
|
isWithin(date, start, end) {
|
|
1030
1114
|
if (!start || !end)
|
|
1031
1115
|
return false;
|
|
1032
|
-
return date
|
|
1116
|
+
return this.isWithinDayRange(date, start, end);
|
|
1033
1117
|
}
|
|
1034
1118
|
isInHoverWeek(date) {
|
|
1035
|
-
if (this.
|
|
1119
|
+
if (!this.isWeekLikeMode)
|
|
1036
1120
|
return false;
|
|
1037
1121
|
return this.isWithin(date, this.hoverWeekStart, this.hoverWeekEnd);
|
|
1038
1122
|
}
|
|
1039
1123
|
onDayHover(cell) {
|
|
1040
|
-
if (this.
|
|
1124
|
+
if (this.isWeekLikeMode) {
|
|
1125
|
+
const { start, end } = this.getWeekRange(cell.date);
|
|
1126
|
+
this.hoverWeekStart = start;
|
|
1127
|
+
this.hoverWeekEnd = end;
|
|
1041
1128
|
return;
|
|
1042
|
-
|
|
1043
|
-
this.
|
|
1044
|
-
|
|
1129
|
+
}
|
|
1130
|
+
if (this.selectionMode === "range") {
|
|
1131
|
+
if (!this.rangeStart || this.rangeEnd)
|
|
1132
|
+
return;
|
|
1133
|
+
this.hoverDate = cell.date;
|
|
1134
|
+
}
|
|
1045
1135
|
}
|
|
1046
1136
|
onDayLeave() {
|
|
1047
1137
|
this.hoverWeekStart = null;
|
|
1048
1138
|
this.hoverWeekEnd = null;
|
|
1139
|
+
this.hoverDate = null;
|
|
1049
1140
|
}
|
|
1050
1141
|
/** Stable identity for day cells so they aren't re-created every change-detection. */
|
|
1051
1142
|
trackByDate = (_, cell) => cell.date.getTime();
|
|
1143
|
+
isCellSelected(date) {
|
|
1144
|
+
if (this.isWeekLikeMode) {
|
|
1145
|
+
return this.isWithin(date, this.selectedWeekStart, this.selectedWeekEnd);
|
|
1146
|
+
}
|
|
1147
|
+
if (this.selectionMode === "range") {
|
|
1148
|
+
return this.isRangeStart(date) || this.isRangeEnd(date);
|
|
1149
|
+
}
|
|
1150
|
+
return (!!this.selectedDate &&
|
|
1151
|
+
this.selectedDate.getFullYear() === date.getFullYear() &&
|
|
1152
|
+
this.selectedDate.getMonth() === date.getMonth() &&
|
|
1153
|
+
this.selectedDate.getDate() === date.getDate());
|
|
1154
|
+
}
|
|
1155
|
+
isRangeStart(date) {
|
|
1156
|
+
if (this.selectionMode !== "range" || !this.rangeStart)
|
|
1157
|
+
return false;
|
|
1158
|
+
return this.isSameDay(date, this.rangeStart);
|
|
1159
|
+
}
|
|
1160
|
+
isRangeEnd(date) {
|
|
1161
|
+
if (this.selectionMode !== "range")
|
|
1162
|
+
return false;
|
|
1163
|
+
if (this.rangeEnd)
|
|
1164
|
+
return this.isSameDay(date, this.rangeEnd);
|
|
1165
|
+
return !!this.rangeStart && !!this.hoverDate && this.isSameDay(date, this.hoverDate);
|
|
1166
|
+
}
|
|
1167
|
+
isInSelectedRange(date) {
|
|
1168
|
+
if (this.selectionMode !== "range" || !this.rangeStart || !this.rangeEnd)
|
|
1169
|
+
return false;
|
|
1170
|
+
return this.isWithinDayRange(date, this.rangeStart, this.rangeEnd);
|
|
1171
|
+
}
|
|
1172
|
+
isInHoverRange(date) {
|
|
1173
|
+
if (this.selectionMode !== "range" || !this.rangeStart || this.rangeEnd || !this.hoverDate)
|
|
1174
|
+
return false;
|
|
1175
|
+
const ordered = this.orderDateRange(this.rangeStart, this.hoverDate);
|
|
1176
|
+
return this.isWithinDayRange(date, ordered.start, ordered.end);
|
|
1177
|
+
}
|
|
1178
|
+
selectRangeDay(cell) {
|
|
1179
|
+
const picked = this.startOfDay(cell.date);
|
|
1180
|
+
if (!this.rangeStart || this.rangeEnd) {
|
|
1181
|
+
this.rangeStart = picked;
|
|
1182
|
+
this.rangeEnd = null;
|
|
1183
|
+
this.hoverDate = null;
|
|
1184
|
+
this.selectedDate = picked;
|
|
1185
|
+
this.displayMonth = picked.getMonth();
|
|
1186
|
+
this.displayYear = picked.getFullYear();
|
|
1187
|
+
this.inputControl.setValue(this.formatInProgressRange(picked), { emitEvent: false });
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
const ordered = this.orderDateRange(this.rangeStart, picked);
|
|
1191
|
+
this.applyDateRange(ordered.start, ordered.end, true);
|
|
1192
|
+
this.selectedDate = ordered.start;
|
|
1193
|
+
this.displayMonth = ordered.start.getMonth();
|
|
1194
|
+
this.displayYear = ordered.start.getFullYear();
|
|
1195
|
+
this.onTouchedFn();
|
|
1196
|
+
this.rangeSelected.emit({ start: ordered.start, end: ordered.end });
|
|
1197
|
+
this.dateSelected.emit(ordered.start);
|
|
1198
|
+
this.closeCalendar();
|
|
1199
|
+
}
|
|
1200
|
+
onRangeBlur() {
|
|
1201
|
+
const raw = (this.inputControl.value || "").trim();
|
|
1202
|
+
const current = this.formatCommittedRangeInput();
|
|
1203
|
+
if (raw === current) {
|
|
1204
|
+
this.blurEvent.emit();
|
|
1205
|
+
return;
|
|
1206
|
+
}
|
|
1207
|
+
if (!raw) {
|
|
1208
|
+
this.applyDateRange(null, null, true);
|
|
1209
|
+
this.selectedDate = null;
|
|
1210
|
+
this.rangeSelected.emit(null);
|
|
1211
|
+
this.dateSelected.emit(null);
|
|
1212
|
+
this.blurEvent.emit();
|
|
1213
|
+
return;
|
|
1214
|
+
}
|
|
1215
|
+
const parsed = this.parseIncomingRange(raw);
|
|
1216
|
+
if (parsed) {
|
|
1217
|
+
this.applyDateRange(parsed.start, parsed.end, true);
|
|
1218
|
+
this.selectedDate = parsed.start;
|
|
1219
|
+
this.displayMonth = parsed.start.getMonth();
|
|
1220
|
+
this.displayYear = parsed.start.getFullYear();
|
|
1221
|
+
this.rangeSelected.emit({ start: parsed.start, end: parsed.end });
|
|
1222
|
+
this.dateSelected.emit(parsed.start);
|
|
1223
|
+
this.blurEvent.emit();
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1226
|
+
const startOnly = this.parseDate(raw.replace(/\s*-\s*$/, "").trim());
|
|
1227
|
+
if (startOnly && !this.rangeEnd) {
|
|
1228
|
+
this.rangeStart = this.startOfDay(startOnly);
|
|
1229
|
+
this.selectedDate = this.rangeStart;
|
|
1230
|
+
this.inputControl.setValue(this.formatInProgressRange(this.rangeStart), { emitEvent: false });
|
|
1231
|
+
this.blurEvent.emit();
|
|
1232
|
+
return;
|
|
1233
|
+
}
|
|
1234
|
+
this.inputControl.setValue(current, { emitEvent: false });
|
|
1235
|
+
this.rangeStart = this.committedRangeStart;
|
|
1236
|
+
this.rangeEnd = this.committedRangeEnd;
|
|
1237
|
+
this.selectedDate = this.rangeStart;
|
|
1238
|
+
this.blurEvent.emit();
|
|
1239
|
+
}
|
|
1240
|
+
applyDateRange(start, end, emit) {
|
|
1241
|
+
this.rangeStart = start;
|
|
1242
|
+
this.rangeEnd = end;
|
|
1243
|
+
this.hoverDate = null;
|
|
1244
|
+
this.committedRangeStart = start;
|
|
1245
|
+
this.committedRangeEnd = end;
|
|
1246
|
+
const out = start && end ? this.formatWeek(start, end) : "";
|
|
1247
|
+
this.inputControl.setValue(out, { emitEvent: false });
|
|
1248
|
+
if (emit) {
|
|
1249
|
+
this.onChangeFn(out || null);
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1252
|
+
formatInProgressRange(start) {
|
|
1253
|
+
return `${this.datePipe.transform(start, this.dateFormat)} - `;
|
|
1254
|
+
}
|
|
1255
|
+
formatCommittedRangeInput() {
|
|
1256
|
+
if (this.committedRangeStart && this.committedRangeEnd) {
|
|
1257
|
+
return this.formatWeek(this.committedRangeStart, this.committedRangeEnd);
|
|
1258
|
+
}
|
|
1259
|
+
if (this.rangeStart && !this.rangeEnd) {
|
|
1260
|
+
return this.formatInProgressRange(this.rangeStart);
|
|
1261
|
+
}
|
|
1262
|
+
return "";
|
|
1263
|
+
}
|
|
1264
|
+
parseIncomingRange(value) {
|
|
1265
|
+
if (Array.isArray(value) && value.length >= 2) {
|
|
1266
|
+
const start = this.parseDate(value[0]);
|
|
1267
|
+
const end = this.parseDate(value[1]);
|
|
1268
|
+
if (start && end)
|
|
1269
|
+
return this.orderDateRange(start, end);
|
|
1270
|
+
return null;
|
|
1271
|
+
}
|
|
1272
|
+
if (value && typeof value === "object" && !(value instanceof Date) && value.start && value.end) {
|
|
1273
|
+
const start = this.parseDate(value.start);
|
|
1274
|
+
const end = this.parseDate(value.end);
|
|
1275
|
+
if (start && end)
|
|
1276
|
+
return this.orderDateRange(start, end);
|
|
1277
|
+
return null;
|
|
1278
|
+
}
|
|
1279
|
+
if (typeof value === "string") {
|
|
1280
|
+
const parts = value.split(" - ").map((part) => part.trim()).filter(Boolean);
|
|
1281
|
+
if (parts.length === 2) {
|
|
1282
|
+
const start = this.parseDate(parts[0]);
|
|
1283
|
+
const end = this.parseDate(parts[1]);
|
|
1284
|
+
if (start && end)
|
|
1285
|
+
return this.orderDateRange(start, end);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
return null;
|
|
1289
|
+
}
|
|
1290
|
+
orderDateRange(a, b) {
|
|
1291
|
+
const start = this.startOfDay(a);
|
|
1292
|
+
const end = this.startOfDay(b);
|
|
1293
|
+
if (this.toDayKey(end) < this.toDayKey(start)) {
|
|
1294
|
+
return { start: end, end: start };
|
|
1295
|
+
}
|
|
1296
|
+
return { start, end };
|
|
1297
|
+
}
|
|
1298
|
+
startOfDay(d) {
|
|
1299
|
+
return new Date(d.getFullYear(), d.getMonth(), d.getDate());
|
|
1300
|
+
}
|
|
1301
|
+
toDayKey(d) {
|
|
1302
|
+
return d.getFullYear() * 10000 + d.getMonth() * 100 + d.getDate();
|
|
1303
|
+
}
|
|
1304
|
+
isSameDay(a, b) {
|
|
1305
|
+
return this.toDayKey(a) === this.toDayKey(b);
|
|
1306
|
+
}
|
|
1307
|
+
isWithinDayRange(date, start, end) {
|
|
1308
|
+
const key = this.toDayKey(date);
|
|
1309
|
+
return key >= this.toDayKey(start) && key <= this.toDayKey(end);
|
|
1310
|
+
}
|
|
1311
|
+
rangeCoversMonth(year, monthIndex) {
|
|
1312
|
+
if (!this.rangeStart)
|
|
1313
|
+
return false;
|
|
1314
|
+
const start = this.rangeStart;
|
|
1315
|
+
const end = this.rangeEnd || this.rangeStart;
|
|
1316
|
+
const monthStart = new Date(year, monthIndex, 1);
|
|
1317
|
+
const monthEnd = new Date(year, monthIndex + 1, 0);
|
|
1318
|
+
return this.toDayKey(start) <= this.toDayKey(monthEnd) && this.toDayKey(end) >= this.toDayKey(monthStart);
|
|
1319
|
+
}
|
|
1320
|
+
rangeCoversYear(year) {
|
|
1321
|
+
if (!this.rangeStart)
|
|
1322
|
+
return false;
|
|
1323
|
+
const startYear = this.rangeStart.getFullYear();
|
|
1324
|
+
const endYear = (this.rangeEnd || this.rangeStart).getFullYear();
|
|
1325
|
+
return year >= startYear && year <= endYear;
|
|
1326
|
+
}
|
|
1327
|
+
restoreIncompleteRange() {
|
|
1328
|
+
if (this.selectionMode !== "range")
|
|
1329
|
+
return;
|
|
1330
|
+
if (!this.rangeStart || this.rangeEnd)
|
|
1331
|
+
return;
|
|
1332
|
+
this.rangeStart = this.committedRangeStart;
|
|
1333
|
+
this.rangeEnd = this.committedRangeEnd;
|
|
1334
|
+
this.hoverDate = null;
|
|
1335
|
+
this.selectedDate = this.rangeStart;
|
|
1336
|
+
const out = this.committedRangeStart && this.committedRangeEnd
|
|
1337
|
+
? this.formatWeek(this.committedRangeStart, this.committedRangeEnd)
|
|
1338
|
+
: "";
|
|
1339
|
+
this.inputControl.setValue(out, { emitEvent: false });
|
|
1340
|
+
}
|
|
1052
1341
|
// month
|
|
1053
1342
|
goToMonthView() {
|
|
1054
1343
|
this.currentView = "month";
|
|
@@ -1089,6 +1378,9 @@ class CalendarControl {
|
|
|
1089
1378
|
return this.months[this.displayMonth];
|
|
1090
1379
|
}
|
|
1091
1380
|
isMonthSelected(monthIndex) {
|
|
1381
|
+
if (this.selectionMode === "range") {
|
|
1382
|
+
return this.rangeCoversMonth(this.displayYear, monthIndex);
|
|
1383
|
+
}
|
|
1092
1384
|
return (!!this.selectedDate &&
|
|
1093
1385
|
this.selectedDate.getFullYear() === this.displayYear &&
|
|
1094
1386
|
this.selectedDate.getMonth() === monthIndex);
|
|
@@ -1097,6 +1389,9 @@ class CalendarControl {
|
|
|
1097
1389
|
return this.todayYear === this.displayYear && this.todayMonth === monthIndex;
|
|
1098
1390
|
}
|
|
1099
1391
|
isYearSelected(year) {
|
|
1392
|
+
if (this.selectionMode === "range") {
|
|
1393
|
+
return this.rangeCoversYear(year);
|
|
1394
|
+
}
|
|
1100
1395
|
return !!this.selectedDate && this.selectedDate.getFullYear() === year;
|
|
1101
1396
|
}
|
|
1102
1397
|
isYearCurrent(year) {
|
|
@@ -1398,6 +1693,9 @@ class CalendarControl {
|
|
|
1398
1693
|
}
|
|
1399
1694
|
}
|
|
1400
1695
|
else {
|
|
1696
|
+
if (this.selectionMode === "range") {
|
|
1697
|
+
this.restoreIncompleteRange();
|
|
1698
|
+
}
|
|
1401
1699
|
this.destroyPopper();
|
|
1402
1700
|
}
|
|
1403
1701
|
}
|
|
@@ -1408,10 +1706,18 @@ class CalendarControl {
|
|
|
1408
1706
|
}
|
|
1409
1707
|
clickOutside(event) {
|
|
1410
1708
|
if (!this.rootElement.nativeElement.contains(event.target) && this.isOpen) {
|
|
1411
|
-
this.
|
|
1709
|
+
if (this.selectionMode === "range") {
|
|
1710
|
+
this.closeCalendar();
|
|
1711
|
+
}
|
|
1712
|
+
else {
|
|
1713
|
+
this.isOpen = false;
|
|
1714
|
+
}
|
|
1412
1715
|
}
|
|
1413
1716
|
}
|
|
1414
1717
|
closeCalendar() {
|
|
1718
|
+
if (this.selectionMode === "range") {
|
|
1719
|
+
this.restoreIncompleteRange();
|
|
1720
|
+
}
|
|
1415
1721
|
this.destroyPopper();
|
|
1416
1722
|
this.isOpen = false;
|
|
1417
1723
|
if (CalendarControl._currentlyOpen === this) {
|
|
@@ -1424,6 +1730,7 @@ class CalendarControl {
|
|
|
1424
1730
|
this.selectedDate = null;
|
|
1425
1731
|
this.selectedWeekStart = null;
|
|
1426
1732
|
this.selectedWeekEnd = null;
|
|
1733
|
+
this.applyDateRange(null, null, false);
|
|
1427
1734
|
if (this._minDate) {
|
|
1428
1735
|
const parsed = new Date(this._minDate);
|
|
1429
1736
|
if (!isNaN(parsed.getTime())) {
|
|
@@ -1446,18 +1753,20 @@ class CalendarControl {
|
|
|
1446
1753
|
this.onChangeFn(null);
|
|
1447
1754
|
this.onTouchedFn();
|
|
1448
1755
|
this.dateSelected.emit(null);
|
|
1449
|
-
if (this.
|
|
1756
|
+
if (this.isWeekLikeMode)
|
|
1450
1757
|
this.weekSelected.emit(null);
|
|
1758
|
+
if (this.selectionMode === "range")
|
|
1759
|
+
this.rangeSelected.emit(null);
|
|
1451
1760
|
}
|
|
1452
1761
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: CalendarControl, deps: [{ token: i1.DatePipe }], target: i0.ɵɵFactoryTarget.Component });
|
|
1453
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: CalendarControl, isStandalone: true, selector: "calendar-control", inputs: { title: "title", required: "required", customClass: "customClass", clearVal: "clearVal", deFocus: "deFocus", error: "error", errorMessage: "errorMessage", hourFormat: "hourFormat", selectionMode: "selectionMode", timeOnly: "timeOnly", dateFormat: "dateFormat", placeholder: "placeholder", viewMode: "viewMode", inputLoader: "inputLoader", disabled: "disabled", readonly: "readonly", submitted: "submitted", closeVal: ["close-val", "closeVal"], showTime: "showTime", defaultDate: "defaultDate", minDate: "minDate", maxDate: "maxDate" }, outputs: { selectionCleared: "selectionCleared", blurEvent: "blurEvent", dateSelected: "dateSelected", weekSelected: "weekSelected" }, host: { listeners: { "document:click": "clickOutside($event)" } }, providers: [
|
|
1762
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.25", type: CalendarControl, isStandalone: true, selector: "calendar-control", inputs: { title: "title", required: "required", customClass: "customClass", clearVal: "clearVal", deFocus: "deFocus", error: "error", errorMessage: "errorMessage", hourFormat: "hourFormat", selectionMode: "selectionMode", timeOnly: "timeOnly", dateFormat: "dateFormat", placeholder: "placeholder", viewMode: "viewMode", inputLoader: "inputLoader", disabled: "disabled", readonly: "readonly", submitted: "submitted", closeVal: ["close-val", "closeVal"], showTime: "showTime", defaultDate: "defaultDate", minDate: "minDate", maxDate: "maxDate" }, outputs: { selectionCleared: "selectionCleared", blurEvent: "blurEvent", dateSelected: "dateSelected", weekSelected: "weekSelected", rangeSelected: "rangeSelected" }, host: { listeners: { "document:click": "clickOutside($event)" } }, providers: [
|
|
1454
1763
|
DatePipe,
|
|
1455
1764
|
{
|
|
1456
1765
|
provide: NG_VALUE_ACCESSOR,
|
|
1457
1766
|
useExisting: forwardRef(() => CalendarControl),
|
|
1458
1767
|
multi: true,
|
|
1459
1768
|
},
|
|
1460
|
-
], viewQueries: [{ propertyName: "rootElement", first: true, predicate: ["root"], descendants: true, static: true }, { propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true, static: true }, { propertyName: "datePickerEl", first: true, predicate: ["datePicker"], descendants: true }], ngImport: i0, template: "<div class=\"form-group calendar\" [ngClass]=\"customClass\" [class.readonly]=\"readonly\" [class.disabled]=\"disabled\" #root\r\n (click)=\"openCalendar()\">\r\n <label class=\"inp-label\" [ngClass]=\"{'required' : required}\" *ngIf=\"title\">{{ title }}</label>\r\n <input type=\"text\" #inputEl [placeholder]=\"placeholder\" [formControl]=\"inputControl\" class=\"form-control\"\r\n [ngClass]=\"{ 'is-invalid': error }\" (blur)=\"onBlur()\" (focus)=\"onFocus()\" [readonly]=\"readonly\"\r\n (click)=\"openCalendar(); $event.stopPropagation()\" (keydown)=\"onInputKeydown($event)\" />\r\n\r\n <span class=\"focus-border\" *ngIf=\"deFocus\"></span>\r\n @if(!inputLoader) {\r\n <span class=\"calendar-icon\">\r\n <i class=\"he\" [ngClass]=\"!timeOnly ? 'he-calendar-blank' : 'he-clock'\"></i>\r\n </span>\r\n }\r\n\r\n @if(!inputLoader &&(selectedDate && !disabled && !readonly) && clearVal) {\r\n <label class=\"clear\" (click)=\"clearDate($event)\">\r\n <i class=\"he he-close\"></i>\r\n </label>\r\n }\r\n\r\n @if(inputLoader) {\r\n <label class=\"loader input-loader\"></label>\r\n }\r\n @if(error) {\r\n <div class=\"val-msg\">{{ errorMessage }}</div>\r\n }\r\n\r\n <div class=\"datepicker-group\" #datePicker *ngIf=\"isOpen\" (mousedown)=\"$event.preventDefault()\"\r\n (click)=\"$event.stopPropagation()\">\r\n\r\n <!-- time picker -->\r\n <ng-container *ngIf=\"timeOnly\">\r\n <div class=\"time-picker\">\r\n <div class=\"time-select\">\r\n <button (click)=\"incrementHour()\" [disabled]=\"!isIncrementHourValid()\"><i\r\n class=\"he he-chevron-up\"></i></button>\r\n <ng-container *ngIf=\"hourFormat === '12'; else show24\">\r\n <div class=\"time-value\">\r\n {{ ((selectedHour % 12) || 12) | number:'2.0' }}\r\n </div>\r\n </ng-container>\r\n <ng-template #show24>\r\n <div class=\"time-value\">\r\n {{ selectedHour | number:'2.0' }}\r\n </div>\r\n </ng-template>\r\n\r\n <button (click)=\"decrementHour()\" [disabled]=\"!isDecrementHourValid()\"><i\r\n class=\"he he-chevron-down\"></i></button>\r\n </div>\r\n <span class=\"time-separator\">:</span>\r\n <div class=\"time-select\">\r\n <button (click)=\"incrementMinute()\" [disabled]=\"!isIncrementMinuteValid()\"><i\r\n class=\"he he-chevron-up\"></i></button>\r\n <div class=\"time-value\">{{ selectedMinute | number:'2.0' }}</div>\r\n <button (click)=\"decrementMinute()\" [disabled]=\"!isDecrementMinuteValid()\"><i\r\n class=\"he he-chevron-down\"></i></button>\r\n </div>\r\n <div class=\"ampm-toggle\" *ngIf=\"hourFormat === '12'\">\r\n <button type=\"button\" [class.active]=\"meridian === 'AM'\" (click)=\"setMeridian('AM')\">AM</button>\r\n <button type=\"button\" [class.active]=\"meridian === 'PM'\" (click)=\"setMeridian('PM')\">PM</button>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- day view -->\r\n <ng-container *ngIf=\"!timeOnly && currentView === 'day'\">\r\n <div class=\"header\">\r\n <button class=\"calendar-arrow\" (click)=\"prevMonth()\"><i class=\"he he-chevron-left\"></i></button>\r\n <div class=\"title\" (click)=\"goToMonthView()\">\r\n <div>{{ displayMonthName }}</div>\r\n <div>{{ displayYear }}</div>\r\n </div>\r\n <button class=\"calendar-arrow\" (click)=\"nextMonth()\"><i class=\"he he-chevron-right\"></i></button>\r\n </div>\r\n <div class=\"week-header\">\r\n <div>Sun</div>\r\n <div>Mon</div>\r\n <div>Tue</div>\r\n <div>Wed</div>\r\n <div>Thu</div>\r\n <div>Fri</div>\r\n <div>Sat</div>\r\n </div>\r\n <div class=\"days-grid\" [class.week-mode]=\"selectionMode === 'week'\">\r\n <div class=\"day-cell\" *ngFor=\"let cell of daysInMonth; trackBy: trackByDate\" (click)=\"selectDay(cell)\"\r\n (mouseenter)=\"onDayHover(cell)\" (mouseleave)=\"onDayLeave()\"\r\n [class.other-month]=\"cell.otherMonth\"\r\n [class.disabled]=\"cell.disabled\"\r\n [class.selected]=\"cell.selected\"\r\n [class.week-hover]=\"isInHoverWeek(cell.date)\"\r\n [class.today]=\"cell.today\">\r\n {{ cell.day }}\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"showTime\">\r\n <div class=\"time-picker\">\r\n <div class=\"time-select\">\r\n <button type=\"button\" (click)=\"incrementHour()\" [disabled]=\"!isIncrementHourValid()\">\r\n <i class=\"he he-chevron-up\"></i>\r\n </button>\r\n <ng-container *ngIf=\"hourFormat === '12'; else show24\">\r\n <div class=\"time-value\">\r\n {{\r\n selectedHour % 12 === 0\r\n ? 12\r\n : selectedHour % 12\r\n | number:'2.0' }}\r\n </div>\r\n </ng-container>\r\n <ng-template #show24>\r\n <div class=\"time-value\">{{ selectedHour | number:'2.0' }}</div>\r\n </ng-template>\r\n <button type=\"button\" (click)=\"decrementHour()\" [disabled]=\"!isDecrementHourValid()\">\r\n <i class=\"he he-chevron-down\"></i>\r\n </button>\r\n </div>\r\n <span class=\"time-separator\">:</span>\r\n <div class=\"time-select\">\r\n <button type=\"button\" (click)=\"incrementMinute()\" [disabled]=\"!isIncrementMinuteValid()\">\r\n <i class=\"he he-chevron-up\"></i>\r\n </button>\r\n <div class=\"time-value\">\r\n {{ selectedMinute < 10 ? '0' +selectedMinute : selectedMinute }} </div>\r\n <button type=\"button\" (click)=\"decrementMinute()\" [disabled]=\"!isDecrementMinuteValid()\">\r\n <i class=\"he he-chevron-down\"></i>\r\n </button>\r\n </div>\r\n <div class=\"ampm-toggle\" *ngIf=\"hourFormat === '12'\">\r\n <button type=\"button\" [class.active]=\"meridian === 'AM'\" (click)=\"setMeridian('AM')\">AM</button>\r\n <button type=\"button\" [class.active]=\"meridian === 'PM'\" (click)=\"setMeridian('PM')\">PM</button>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <!-- month view -->\r\n <ng-container *ngIf=\"!timeOnly && currentView === 'month'\">\r\n <div class=\"header\" *ngIf=\"viewMode !== 'month'\">\r\n <button class=\"calendar-arrow\" (click)=\"displayYear = displayYear - 1\"><i\r\n class=\"he he-chevron-left\"></i></button>\r\n <div class=\"title\" (click)=\"goToYearRangeView()\">{{ displayYear }}</div>\r\n <button class=\"calendar-arrow\" (click)=\"displayYear = displayYear + 1\"><i\r\n class=\"he he-chevron-right\"></i></button>\r\n </div>\r\n <div class=\"month-grid\">\r\n <div class=\"month-cell\" *ngFor=\"let m of months; index as i\" (click)=\"selectMonth(i)\"\r\n [class.selected]=\"isMonthSelected(i)\" [class.today]=\"isMonthCurrent(i)\">{{ m }}\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- year range view -->\r\n <ng-container *ngIf=\"!timeOnly && currentView === 'yearRange'\">\r\n <div class=\"header\">\r\n <button class=\"calendar-arrow\" (click)=\"prevYearRange()\"><i class=\"he he-chevron-left\"></i></button>\r\n <div class=\"title\">{{ yearRange[0] }} ~ {{ yearRange[yearRangeSize-1] }}</div>\r\n <button class=\"calendar-arrow\" (click)=\"nextYearRange()\"><i class=\"he he-chevron-right\"></i></button>\r\n </div>\r\n <div class=\"year-grid\">\r\n <div class=\"year-cell\" *ngFor=\"let y of yearRange\" (click)=\"selectYear(y)\"\r\n [class.selected]=\"isYearSelected(y)\" [class.today]=\"isYearCurrent(y)\">{{ y }}</div>\r\n </div>\r\n </ng-container>\r\n\r\n </div>\r\n</div>", styles: [".form-group.calendar{position:relative}.form-group.calendar .datepicker-group{left:0;width:100%;z-index:1000;padding:.5rem;color:#495057;min-width:240px;max-width:260px;border-radius:3px;background:#fff;box-shadow:0 2px 4px -1px #0003,0 4px 5px #00000024,0 1px 10px #0000001f}.form-group.calendar .datepicker-group .header{display:flex;font-weight:600;padding:5px;align-items:center;justify-content:space-between;border-bottom:1px solid #dee2e6}.form-group.calendar .datepicker-group .header .title{gap:8px;display:flex;font-size:15px;cursor:pointer;font-weight:600}.form-group.calendar .datepicker-group .header .calendar-arrow{width:28px;height:28px;border:none;line-height:1;cursor:pointer;background:none}.form-group.calendar .datepicker-group .header .calendar-arrow i{font-size:14px}.form-group.calendar .datepicker-group .header .calendar-arrow:hover{background:#f0f0f0}.form-group.calendar .datepicker-group .week-header{display:grid;padding:8px 0;font-size:13px;font-weight:700;text-align:center;grid-template-columns:repeat(7,1fr)}.form-group.calendar .datepicker-group .days-grid,.form-group.calendar .datepicker-group .month-grid,.form-group.calendar .datepicker-group .year-grid{gap:3px;padding:5px;display:grid;grid-template-columns:repeat(7,1fr)}.form-group.calendar .datepicker-group .days-grid .day-cell,.form-group.calendar .datepicker-group .days-grid .month-cell,.form-group.calendar .datepicker-group .days-grid .year-cell,.form-group.calendar .datepicker-group .month-grid .day-cell,.form-group.calendar .datepicker-group .month-grid .month-cell,.form-group.calendar .datepicker-group .month-grid .year-cell,.form-group.calendar .datepicker-group .year-grid .day-cell,.form-group.calendar .datepicker-group .year-grid .month-cell,.form-group.calendar .datepicker-group .year-grid .year-cell{display:flex;font-size:14px;cursor:pointer;align-items:center;justify-content:center}.form-group.calendar .datepicker-group .days-grid .day-cell.today,.form-group.calendar .datepicker-group .days-grid .month-cell.today,.form-group.calendar .datepicker-group .days-grid .year-cell.today,.form-group.calendar .datepicker-group .month-grid .day-cell.today,.form-group.calendar .datepicker-group .month-grid .month-cell.today,.form-group.calendar .datepicker-group .month-grid .year-cell.today,.form-group.calendar .datepicker-group .year-grid .day-cell.today,.form-group.calendar .datepicker-group .year-grid .month-cell.today,.form-group.calendar .datepicker-group .year-grid .year-cell.today{color:#37c0b3;font-weight:700;border:1px solid #37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.selected,.form-group.calendar .datepicker-group .days-grid .day-cell:hover,.form-group.calendar .datepicker-group .days-grid .month-cell.selected,.form-group.calendar .datepicker-group .days-grid .month-cell:hover,.form-group.calendar .datepicker-group .days-grid .year-cell.selected,.form-group.calendar .datepicker-group .days-grid .year-cell:hover,.form-group.calendar .datepicker-group .month-grid .day-cell.selected,.form-group.calendar .datepicker-group .month-grid .day-cell:hover,.form-group.calendar .datepicker-group .month-grid .month-cell.selected,.form-group.calendar .datepicker-group .month-grid .month-cell:hover,.form-group.calendar .datepicker-group .month-grid .year-cell.selected,.form-group.calendar .datepicker-group .month-grid .year-cell:hover,.form-group.calendar .datepicker-group .year-grid .day-cell.selected,.form-group.calendar .datepicker-group .year-grid .day-cell:hover,.form-group.calendar .datepicker-group .year-grid .month-cell.selected,.form-group.calendar .datepicker-group .year-grid .month-cell:hover,.form-group.calendar .datepicker-group .year-grid .year-cell.selected,.form-group.calendar .datepicker-group .year-grid .year-cell:hover{color:#fff;background:#37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled{color:#e0e0e0;background:none;-webkit-user-select:none;user-select:none;cursor:not-allowed}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled.today,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled.today,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled.today,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled.today,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled.today,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled.today,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled.today,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled.today,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled.today{color:#37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled.today:hover,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled.today:hover,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled.today:hover,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled.today:hover,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled.today:hover,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled.today:hover,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled.today:hover,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled.today:hover,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled.today:hover{color:#fff;background:#37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled:hover,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled:hover,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled:hover,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled:hover,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled:hover,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled:hover,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled:hover,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled:hover,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled:hover{color:#e0e0e0;background:transparent}.form-group.calendar .datepicker-group .days-grid .day-cell,.form-group.calendar .datepicker-group .month-grid .day-cell,.form-group.calendar .datepicker-group .year-grid .day-cell{padding:5px 2px;border-radius:50%}.form-group.calendar .datepicker-group .days-grid .day-cell.other-month:not(.selected):not(:hover),.form-group.calendar .datepicker-group .month-grid .day-cell.other-month:not(.selected):not(:hover),.form-group.calendar .datepicker-group .year-grid .day-cell.other-month:not(.selected):not(:hover){color:#c5c5c5}.form-group.calendar .datepicker-group .days-grid .month-cell,.form-group.calendar .datepicker-group .days-grid .year-cell,.form-group.calendar .datepicker-group .month-grid .month-cell,.form-group.calendar .datepicker-group .month-grid .year-cell,.form-group.calendar .datepicker-group .year-grid .month-cell,.form-group.calendar .datepicker-group .year-grid .year-cell{padding:8px 2px;border-radius:3px}.form-group.calendar .datepicker-group .days-grid.week-mode .day-cell{border-radius:4px}.form-group.calendar .datepicker-group .days-grid.week-mode .day-cell.week-hover:not(.selected){color:#0d6f7d;background:#e6f5f3}.form-group.calendar .datepicker-group .month-grid{grid-template-columns:repeat(3,1fr)}.form-group.calendar .datepicker-group .year-grid{grid-template-columns:repeat(4,1fr)}.form-group.calendar .datepicker-group .time-picker{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.form-group.calendar .datepicker-group .time-picker .ampm-toggle{gap:6px;display:flex;margin-left:1rem;flex-direction:column;justify-content:center}.form-group.calendar .datepicker-group .time-picker .ampm-toggle button{cursor:pointer;padding:3px 8px;font-size:.75rem;background:#fff;border:1px solid #cccccc}.form-group.calendar .datepicker-group .time-picker .ampm-toggle button.active{color:#fff;border-color:#37c0b3;background-color:#37c0b3}.form-group.calendar .datepicker-group .time-picker .time-select{display:flex;margin:0 .75rem;align-items:center;flex-direction:column}.form-group.calendar .datepicker-group .time-picker .time-select button{border:none;cursor:pointer;padding:4px 8px;background:transparent}.form-group.calendar .datepicker-group .time-picker .time-select button i{font-size:1rem}.form-group.calendar .datepicker-group .time-picker .time-select button:hover{background:#f0f0f0}.form-group.calendar .datepicker-group .time-picker .time-select .time-value{width:2rem;font-size:1rem;text-align:center;margin:2px 3px 4px}.form-group.calendar .datepicker-group .time-picker .time-separator{line-height:1;font-size:1rem}.form-group.calendar .clear{right:35px}.form-group.calendar.group-sm .clear{top:7px;right:35px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormsModule }, { kind: "pipe", type: i1.DecimalPipe, name: "number" }] });
|
|
1769
|
+
], viewQueries: [{ propertyName: "rootElement", first: true, predicate: ["root"], descendants: true, static: true }, { propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true, static: true }, { propertyName: "datePickerEl", first: true, predicate: ["datePicker"], descendants: true }], ngImport: i0, template: "<div class=\"form-group calendar\" [ngClass]=\"customClass\" [class.readonly]=\"readonly\" [class.disabled]=\"disabled\" #root\r\n (click)=\"openCalendar()\">\r\n <label class=\"inp-label\" [ngClass]=\"{'required' : required}\" *ngIf=\"title\">{{ title }}</label>\r\n <input type=\"text\" #inputEl [placeholder]=\"placeholder\" [formControl]=\"inputControl\" class=\"form-control\"\r\n [ngClass]=\"{ 'is-invalid': error }\" (blur)=\"onBlur()\" (focus)=\"onFocus()\" [readonly]=\"readonly\"\r\n (click)=\"openCalendar(); $event.stopPropagation()\" (keydown)=\"onInputKeydown($event)\" />\r\n\r\n <span class=\"focus-border\" *ngIf=\"deFocus\"></span>\r\n @if(!inputLoader) {\r\n <span class=\"calendar-icon\">\r\n <i class=\"he\" [ngClass]=\"!timeOnly ? 'he-calendar-blank' : 'he-clock'\"></i>\r\n </span>\r\n }\r\n\r\n @if(!inputLoader &&(selectedDate && !disabled && !readonly) && clearVal) {\r\n <label class=\"clear\" (click)=\"clearDate($event)\">\r\n <i class=\"he he-close\"></i>\r\n </label>\r\n }\r\n\r\n @if(inputLoader) {\r\n <label class=\"loader input-loader\"></label>\r\n }\r\n @if(error) {\r\n <div class=\"val-msg\">{{ errorMessage }}</div>\r\n }\r\n\r\n <div class=\"datepicker-group\" #datePicker *ngIf=\"isOpen\" (mousedown)=\"$event.preventDefault()\"\r\n (click)=\"$event.stopPropagation()\">\r\n\r\n <!-- time picker -->\r\n <ng-container *ngIf=\"timeOnly\">\r\n <div class=\"time-picker\">\r\n <div class=\"time-select\">\r\n <button (click)=\"incrementHour()\" [disabled]=\"!isIncrementHourValid()\"><i\r\n class=\"he he-chevron-up\"></i></button>\r\n <ng-container *ngIf=\"hourFormat === '12'; else show24\">\r\n <div class=\"time-value\">\r\n {{ ((selectedHour % 12) || 12) | number:'2.0' }}\r\n </div>\r\n </ng-container>\r\n <ng-template #show24>\r\n <div class=\"time-value\">\r\n {{ selectedHour | number:'2.0' }}\r\n </div>\r\n </ng-template>\r\n\r\n <button (click)=\"decrementHour()\" [disabled]=\"!isDecrementHourValid()\"><i\r\n class=\"he he-chevron-down\"></i></button>\r\n </div>\r\n <span class=\"time-separator\">:</span>\r\n <div class=\"time-select\">\r\n <button (click)=\"incrementMinute()\" [disabled]=\"!isIncrementMinuteValid()\"><i\r\n class=\"he he-chevron-up\"></i></button>\r\n <div class=\"time-value\">{{ selectedMinute | number:'2.0' }}</div>\r\n <button (click)=\"decrementMinute()\" [disabled]=\"!isDecrementMinuteValid()\"><i\r\n class=\"he he-chevron-down\"></i></button>\r\n </div>\r\n <div class=\"ampm-toggle\" *ngIf=\"hourFormat === '12'\">\r\n <button type=\"button\" [class.active]=\"meridian === 'AM'\" (click)=\"setMeridian('AM')\">AM</button>\r\n <button type=\"button\" [class.active]=\"meridian === 'PM'\" (click)=\"setMeridian('PM')\">PM</button>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- day view -->\r\n <ng-container *ngIf=\"!timeOnly && currentView === 'day'\">\r\n <div class=\"header\">\r\n <button class=\"calendar-arrow\" (click)=\"prevMonth()\"><i class=\"he he-chevron-left\"></i></button>\r\n <div class=\"title\" (click)=\"goToMonthView()\">\r\n <div>{{ displayMonthName }}</div>\r\n <div>{{ displayYear }}</div>\r\n </div>\r\n <button class=\"calendar-arrow\" (click)=\"nextMonth()\"><i class=\"he he-chevron-right\"></i></button>\r\n </div>\r\n <div class=\"week-header\">\r\n <div>Sun</div>\r\n <div>Mon</div>\r\n <div>Tue</div>\r\n <div>Wed</div>\r\n <div>Thu</div>\r\n <div>Fri</div>\r\n <div>Sat</div>\r\n </div>\r\n <div class=\"days-grid\" [class.week-mode]=\"isWeekLikeMode\"\r\n [class.range-mode]=\"selectionMode === 'range'\" (mouseleave)=\"onDayLeave()\">\r\n <div class=\"day-cell\" *ngFor=\"let cell of daysInMonth; trackBy: trackByDate\" (click)=\"selectDay(cell)\"\r\n (mouseenter)=\"onDayHover(cell)\" (mouseleave)=\"onDayLeave()\"\r\n [class.other-month]=\"cell.otherMonth\"\r\n [class.disabled]=\"cell.disabled\"\r\n [class.selected]=\"cell.selected\"\r\n [class.week-hover]=\"isInHoverWeek(cell.date)\"\r\n [class.range-start]=\"isRangeStart(cell.date)\"\r\n [class.range-end]=\"isRangeEnd(cell.date)\"\r\n [class.in-range]=\"isInSelectedRange(cell.date)\"\r\n [class.range-hover]=\"isInHoverRange(cell.date)\"\r\n [class.today]=\"cell.today\">\r\n {{ cell.day }}\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"showTime\">\r\n <div class=\"time-picker\">\r\n <div class=\"time-select\">\r\n <button type=\"button\" (click)=\"incrementHour()\" [disabled]=\"!isIncrementHourValid()\">\r\n <i class=\"he he-chevron-up\"></i>\r\n </button>\r\n <ng-container *ngIf=\"hourFormat === '12'; else show24\">\r\n <div class=\"time-value\">\r\n {{\r\n selectedHour % 12 === 0\r\n ? 12\r\n : selectedHour % 12\r\n | number:'2.0' }}\r\n </div>\r\n </ng-container>\r\n <ng-template #show24>\r\n <div class=\"time-value\">{{ selectedHour | number:'2.0' }}</div>\r\n </ng-template>\r\n <button type=\"button\" (click)=\"decrementHour()\" [disabled]=\"!isDecrementHourValid()\">\r\n <i class=\"he he-chevron-down\"></i>\r\n </button>\r\n </div>\r\n <span class=\"time-separator\">:</span>\r\n <div class=\"time-select\">\r\n <button type=\"button\" (click)=\"incrementMinute()\" [disabled]=\"!isIncrementMinuteValid()\">\r\n <i class=\"he he-chevron-up\"></i>\r\n </button>\r\n <div class=\"time-value\">\r\n {{ selectedMinute < 10 ? '0' +selectedMinute : selectedMinute }} </div>\r\n <button type=\"button\" (click)=\"decrementMinute()\" [disabled]=\"!isDecrementMinuteValid()\">\r\n <i class=\"he he-chevron-down\"></i>\r\n </button>\r\n </div>\r\n <div class=\"ampm-toggle\" *ngIf=\"hourFormat === '12'\">\r\n <button type=\"button\" [class.active]=\"meridian === 'AM'\" (click)=\"setMeridian('AM')\">AM</button>\r\n <button type=\"button\" [class.active]=\"meridian === 'PM'\" (click)=\"setMeridian('PM')\">PM</button>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <!-- month view -->\r\n <ng-container *ngIf=\"!timeOnly && currentView === 'month'\">\r\n <div class=\"header\" *ngIf=\"viewMode !== 'month'\">\r\n <button class=\"calendar-arrow\" (click)=\"displayYear = displayYear - 1\"><i\r\n class=\"he he-chevron-left\"></i></button>\r\n <div class=\"title\" (click)=\"goToYearRangeView()\">{{ displayYear }}</div>\r\n <button class=\"calendar-arrow\" (click)=\"displayYear = displayYear + 1\"><i\r\n class=\"he he-chevron-right\"></i></button>\r\n </div>\r\n <div class=\"month-grid\">\r\n <div class=\"month-cell\" *ngFor=\"let m of months; index as i\" (click)=\"selectMonth(i)\"\r\n [class.selected]=\"isMonthSelected(i)\" [class.today]=\"isMonthCurrent(i)\">{{ m }}\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- year range view -->\r\n <ng-container *ngIf=\"!timeOnly && currentView === 'yearRange'\">\r\n <div class=\"header\">\r\n <button class=\"calendar-arrow\" (click)=\"prevYearRange()\"><i class=\"he he-chevron-left\"></i></button>\r\n <div class=\"title\">{{ yearRange[0] }} ~ {{ yearRange[yearRangeSize-1] }}</div>\r\n <button class=\"calendar-arrow\" (click)=\"nextYearRange()\"><i class=\"he he-chevron-right\"></i></button>\r\n </div>\r\n <div class=\"year-grid\">\r\n <div class=\"year-cell\" *ngFor=\"let y of yearRange\" (click)=\"selectYear(y)\"\r\n [class.selected]=\"isYearSelected(y)\" [class.today]=\"isYearCurrent(y)\">{{ y }}</div>\r\n </div>\r\n </ng-container>\r\n\r\n </div>\r\n</div>", styles: [".form-group.calendar{position:relative}.form-group.calendar .datepicker-group{left:0;width:100%;z-index:1000;padding:.5rem;color:#495057;min-width:240px;max-width:260px;border-radius:3px;background:#fff;box-shadow:0 2px 4px -1px #0003,0 4px 5px #00000024,0 1px 10px #0000001f}.form-group.calendar .datepicker-group .header{display:flex;font-weight:600;padding:5px;align-items:center;justify-content:space-between;border-bottom:1px solid #dee2e6}.form-group.calendar .datepicker-group .header .title{gap:8px;display:flex;font-size:15px;cursor:pointer;font-weight:600}.form-group.calendar .datepicker-group .header .calendar-arrow{width:28px;height:28px;border:none;line-height:1;cursor:pointer;background:none}.form-group.calendar .datepicker-group .header .calendar-arrow i{font-size:14px}.form-group.calendar .datepicker-group .header .calendar-arrow:hover{background:#f0f0f0}.form-group.calendar .datepicker-group .week-header{display:grid;padding:8px 0;font-size:13px;font-weight:700;text-align:center;grid-template-columns:repeat(7,1fr)}.form-group.calendar .datepicker-group .days-grid,.form-group.calendar .datepicker-group .month-grid,.form-group.calendar .datepicker-group .year-grid{gap:3px;padding:5px;display:grid;grid-template-columns:repeat(7,1fr)}.form-group.calendar .datepicker-group .days-grid .day-cell,.form-group.calendar .datepicker-group .days-grid .month-cell,.form-group.calendar .datepicker-group .days-grid .year-cell,.form-group.calendar .datepicker-group .month-grid .day-cell,.form-group.calendar .datepicker-group .month-grid .month-cell,.form-group.calendar .datepicker-group .month-grid .year-cell,.form-group.calendar .datepicker-group .year-grid .day-cell,.form-group.calendar .datepicker-group .year-grid .month-cell,.form-group.calendar .datepicker-group .year-grid .year-cell{display:flex;font-size:14px;cursor:pointer;align-items:center;justify-content:center}.form-group.calendar .datepicker-group .days-grid .day-cell.today,.form-group.calendar .datepicker-group .days-grid .month-cell.today,.form-group.calendar .datepicker-group .days-grid .year-cell.today,.form-group.calendar .datepicker-group .month-grid .day-cell.today,.form-group.calendar .datepicker-group .month-grid .month-cell.today,.form-group.calendar .datepicker-group .month-grid .year-cell.today,.form-group.calendar .datepicker-group .year-grid .day-cell.today,.form-group.calendar .datepicker-group .year-grid .month-cell.today,.form-group.calendar .datepicker-group .year-grid .year-cell.today{color:#37c0b3;font-weight:700;border:1px solid #37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.selected,.form-group.calendar .datepicker-group .days-grid .day-cell:hover,.form-group.calendar .datepicker-group .days-grid .month-cell.selected,.form-group.calendar .datepicker-group .days-grid .month-cell:hover,.form-group.calendar .datepicker-group .days-grid .year-cell.selected,.form-group.calendar .datepicker-group .days-grid .year-cell:hover,.form-group.calendar .datepicker-group .month-grid .day-cell.selected,.form-group.calendar .datepicker-group .month-grid .day-cell:hover,.form-group.calendar .datepicker-group .month-grid .month-cell.selected,.form-group.calendar .datepicker-group .month-grid .month-cell:hover,.form-group.calendar .datepicker-group .month-grid .year-cell.selected,.form-group.calendar .datepicker-group .month-grid .year-cell:hover,.form-group.calendar .datepicker-group .year-grid .day-cell.selected,.form-group.calendar .datepicker-group .year-grid .day-cell:hover,.form-group.calendar .datepicker-group .year-grid .month-cell.selected,.form-group.calendar .datepicker-group .year-grid .month-cell:hover,.form-group.calendar .datepicker-group .year-grid .year-cell.selected,.form-group.calendar .datepicker-group .year-grid .year-cell:hover{color:#fff;background:#37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled{color:#e0e0e0;background:none;-webkit-user-select:none;user-select:none;cursor:not-allowed}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled.today,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled.today,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled.today,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled.today,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled.today,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled.today,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled.today,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled.today,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled.today{color:#37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled.today:hover,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled.today:hover,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled.today:hover,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled.today:hover,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled.today:hover,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled.today:hover,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled.today:hover,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled.today:hover,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled.today:hover{color:#fff;background:#37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled:hover,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled:hover,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled:hover,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled:hover,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled:hover,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled:hover,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled:hover,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled:hover,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled:hover{color:#e0e0e0;background:transparent}.form-group.calendar .datepicker-group .days-grid .day-cell,.form-group.calendar .datepicker-group .month-grid .day-cell,.form-group.calendar .datepicker-group .year-grid .day-cell{padding:5px 2px;border-radius:50%}.form-group.calendar .datepicker-group .days-grid .day-cell.other-month:not(.selected):not(:hover),.form-group.calendar .datepicker-group .month-grid .day-cell.other-month:not(.selected):not(:hover),.form-group.calendar .datepicker-group .year-grid .day-cell.other-month:not(.selected):not(:hover){color:#c5c5c5}.form-group.calendar .datepicker-group .days-grid .month-cell,.form-group.calendar .datepicker-group .days-grid .year-cell,.form-group.calendar .datepicker-group .month-grid .month-cell,.form-group.calendar .datepicker-group .month-grid .year-cell,.form-group.calendar .datepicker-group .year-grid .month-cell,.form-group.calendar .datepicker-group .year-grid .year-cell{padding:8px 2px;border-radius:3px}.form-group.calendar .datepicker-group .days-grid.week-mode .day-cell{border-radius:4px}.form-group.calendar .datepicker-group .days-grid.week-mode .day-cell.week-hover:not(.selected){color:#0d6f7d;background:#e6f5f3}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell{border-radius:4px}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.in-range:not(.range-start):not(.range-end),.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.range-hover:not(.range-start):not(.range-end){color:#0d6f7d;background:#e6f5f3;border-radius:0}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.other-month.in-range:not(.range-start):not(.range-end),.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.other-month.range-hover:not(.range-start):not(.range-end){color:#0d6f7d}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.range-start,.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.range-end,.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.selected{color:#fff;background:#37c0b3}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.range-start:not(.range-end){border-radius:4px 0 0 4px}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.range-end:not(.range-start){border-radius:0 4px 4px 0}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell:hover:not(.disabled):not(.range-start):not(.range-end){color:#0d6f7d;background:#e6f5f3}.form-group.calendar .datepicker-group .month-grid{grid-template-columns:repeat(3,1fr)}.form-group.calendar .datepicker-group .year-grid{grid-template-columns:repeat(4,1fr)}.form-group.calendar .datepicker-group .time-picker{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.form-group.calendar .datepicker-group .time-picker .ampm-toggle{gap:6px;display:flex;margin-left:1rem;flex-direction:column;justify-content:center}.form-group.calendar .datepicker-group .time-picker .ampm-toggle button{cursor:pointer;padding:3px 8px;font-size:.75rem;background:#fff;border:1px solid #cccccc}.form-group.calendar .datepicker-group .time-picker .ampm-toggle button.active{color:#fff;border-color:#37c0b3;background-color:#37c0b3}.form-group.calendar .datepicker-group .time-picker .time-select{display:flex;margin:0 .75rem;align-items:center;flex-direction:column}.form-group.calendar .datepicker-group .time-picker .time-select button{border:none;cursor:pointer;padding:4px 8px;background:transparent}.form-group.calendar .datepicker-group .time-picker .time-select button i{font-size:1rem}.form-group.calendar .datepicker-group .time-picker .time-select button:hover{background:#f0f0f0}.form-group.calendar .datepicker-group .time-picker .time-select .time-value{width:2rem;font-size:1rem;text-align:center;margin:2px 3px 4px}.form-group.calendar .datepicker-group .time-picker .time-separator{line-height:1;font-size:1rem}.form-group.calendar .clear{right:35px}.form-group.calendar.group-sm .clear{top:7px;right:35px}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: FormsModule }, { kind: "pipe", type: i1.DecimalPipe, name: "number" }] });
|
|
1461
1770
|
}
|
|
1462
1771
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: CalendarControl, decorators: [{
|
|
1463
1772
|
type: Component,
|
|
@@ -1472,7 +1781,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
1472
1781
|
useExisting: forwardRef(() => CalendarControl),
|
|
1473
1782
|
multi: true,
|
|
1474
1783
|
},
|
|
1475
|
-
], template: "<div class=\"form-group calendar\" [ngClass]=\"customClass\" [class.readonly]=\"readonly\" [class.disabled]=\"disabled\" #root\r\n (click)=\"openCalendar()\">\r\n <label class=\"inp-label\" [ngClass]=\"{'required' : required}\" *ngIf=\"title\">{{ title }}</label>\r\n <input type=\"text\" #inputEl [placeholder]=\"placeholder\" [formControl]=\"inputControl\" class=\"form-control\"\r\n [ngClass]=\"{ 'is-invalid': error }\" (blur)=\"onBlur()\" (focus)=\"onFocus()\" [readonly]=\"readonly\"\r\n (click)=\"openCalendar(); $event.stopPropagation()\" (keydown)=\"onInputKeydown($event)\" />\r\n\r\n <span class=\"focus-border\" *ngIf=\"deFocus\"></span>\r\n @if(!inputLoader) {\r\n <span class=\"calendar-icon\">\r\n <i class=\"he\" [ngClass]=\"!timeOnly ? 'he-calendar-blank' : 'he-clock'\"></i>\r\n </span>\r\n }\r\n\r\n @if(!inputLoader &&(selectedDate && !disabled && !readonly) && clearVal) {\r\n <label class=\"clear\" (click)=\"clearDate($event)\">\r\n <i class=\"he he-close\"></i>\r\n </label>\r\n }\r\n\r\n @if(inputLoader) {\r\n <label class=\"loader input-loader\"></label>\r\n }\r\n @if(error) {\r\n <div class=\"val-msg\">{{ errorMessage }}</div>\r\n }\r\n\r\n <div class=\"datepicker-group\" #datePicker *ngIf=\"isOpen\" (mousedown)=\"$event.preventDefault()\"\r\n (click)=\"$event.stopPropagation()\">\r\n\r\n <!-- time picker -->\r\n <ng-container *ngIf=\"timeOnly\">\r\n <div class=\"time-picker\">\r\n <div class=\"time-select\">\r\n <button (click)=\"incrementHour()\" [disabled]=\"!isIncrementHourValid()\"><i\r\n class=\"he he-chevron-up\"></i></button>\r\n <ng-container *ngIf=\"hourFormat === '12'; else show24\">\r\n <div class=\"time-value\">\r\n {{ ((selectedHour % 12) || 12) | number:'2.0' }}\r\n </div>\r\n </ng-container>\r\n <ng-template #show24>\r\n <div class=\"time-value\">\r\n {{ selectedHour | number:'2.0' }}\r\n </div>\r\n </ng-template>\r\n\r\n <button (click)=\"decrementHour()\" [disabled]=\"!isDecrementHourValid()\"><i\r\n class=\"he he-chevron-down\"></i></button>\r\n </div>\r\n <span class=\"time-separator\">:</span>\r\n <div class=\"time-select\">\r\n <button (click)=\"incrementMinute()\" [disabled]=\"!isIncrementMinuteValid()\"><i\r\n class=\"he he-chevron-up\"></i></button>\r\n <div class=\"time-value\">{{ selectedMinute | number:'2.0' }}</div>\r\n <button (click)=\"decrementMinute()\" [disabled]=\"!isDecrementMinuteValid()\"><i\r\n class=\"he he-chevron-down\"></i></button>\r\n </div>\r\n <div class=\"ampm-toggle\" *ngIf=\"hourFormat === '12'\">\r\n <button type=\"button\" [class.active]=\"meridian === 'AM'\" (click)=\"setMeridian('AM')\">AM</button>\r\n <button type=\"button\" [class.active]=\"meridian === 'PM'\" (click)=\"setMeridian('PM')\">PM</button>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- day view -->\r\n <ng-container *ngIf=\"!timeOnly && currentView === 'day'\">\r\n <div class=\"header\">\r\n <button class=\"calendar-arrow\" (click)=\"prevMonth()\"><i class=\"he he-chevron-left\"></i></button>\r\n <div class=\"title\" (click)=\"goToMonthView()\">\r\n <div>{{ displayMonthName }}</div>\r\n <div>{{ displayYear }}</div>\r\n </div>\r\n <button class=\"calendar-arrow\" (click)=\"nextMonth()\"><i class=\"he he-chevron-right\"></i></button>\r\n </div>\r\n <div class=\"week-header\">\r\n <div>Sun</div>\r\n <div>Mon</div>\r\n <div>Tue</div>\r\n <div>Wed</div>\r\n <div>Thu</div>\r\n <div>Fri</div>\r\n <div>Sat</div>\r\n </div>\r\n <div class=\"days-grid\" [class.week-mode]=\"selectionMode === 'week'\">\r\n <div class=\"day-cell\" *ngFor=\"let cell of daysInMonth; trackBy: trackByDate\" (click)=\"selectDay(cell)\"\r\n (mouseenter)=\"onDayHover(cell)\" (mouseleave)=\"onDayLeave()\"\r\n [class.other-month]=\"cell.otherMonth\"\r\n [class.disabled]=\"cell.disabled\"\r\n [class.selected]=\"cell.selected\"\r\n [class.week-hover]=\"isInHoverWeek(cell.date)\"\r\n [class.today]=\"cell.today\">\r\n {{ cell.day }}\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"showTime\">\r\n <div class=\"time-picker\">\r\n <div class=\"time-select\">\r\n <button type=\"button\" (click)=\"incrementHour()\" [disabled]=\"!isIncrementHourValid()\">\r\n <i class=\"he he-chevron-up\"></i>\r\n </button>\r\n <ng-container *ngIf=\"hourFormat === '12'; else show24\">\r\n <div class=\"time-value\">\r\n {{\r\n selectedHour % 12 === 0\r\n ? 12\r\n : selectedHour % 12\r\n | number:'2.0' }}\r\n </div>\r\n </ng-container>\r\n <ng-template #show24>\r\n <div class=\"time-value\">{{ selectedHour | number:'2.0' }}</div>\r\n </ng-template>\r\n <button type=\"button\" (click)=\"decrementHour()\" [disabled]=\"!isDecrementHourValid()\">\r\n <i class=\"he he-chevron-down\"></i>\r\n </button>\r\n </div>\r\n <span class=\"time-separator\">:</span>\r\n <div class=\"time-select\">\r\n <button type=\"button\" (click)=\"incrementMinute()\" [disabled]=\"!isIncrementMinuteValid()\">\r\n <i class=\"he he-chevron-up\"></i>\r\n </button>\r\n <div class=\"time-value\">\r\n {{ selectedMinute < 10 ? '0' +selectedMinute : selectedMinute }} </div>\r\n <button type=\"button\" (click)=\"decrementMinute()\" [disabled]=\"!isDecrementMinuteValid()\">\r\n <i class=\"he he-chevron-down\"></i>\r\n </button>\r\n </div>\r\n <div class=\"ampm-toggle\" *ngIf=\"hourFormat === '12'\">\r\n <button type=\"button\" [class.active]=\"meridian === 'AM'\" (click)=\"setMeridian('AM')\">AM</button>\r\n <button type=\"button\" [class.active]=\"meridian === 'PM'\" (click)=\"setMeridian('PM')\">PM</button>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <!-- month view -->\r\n <ng-container *ngIf=\"!timeOnly && currentView === 'month'\">\r\n <div class=\"header\" *ngIf=\"viewMode !== 'month'\">\r\n <button class=\"calendar-arrow\" (click)=\"displayYear = displayYear - 1\"><i\r\n class=\"he he-chevron-left\"></i></button>\r\n <div class=\"title\" (click)=\"goToYearRangeView()\">{{ displayYear }}</div>\r\n <button class=\"calendar-arrow\" (click)=\"displayYear = displayYear + 1\"><i\r\n class=\"he he-chevron-right\"></i></button>\r\n </div>\r\n <div class=\"month-grid\">\r\n <div class=\"month-cell\" *ngFor=\"let m of months; index as i\" (click)=\"selectMonth(i)\"\r\n [class.selected]=\"isMonthSelected(i)\" [class.today]=\"isMonthCurrent(i)\">{{ m }}\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- year range view -->\r\n <ng-container *ngIf=\"!timeOnly && currentView === 'yearRange'\">\r\n <div class=\"header\">\r\n <button class=\"calendar-arrow\" (click)=\"prevYearRange()\"><i class=\"he he-chevron-left\"></i></button>\r\n <div class=\"title\">{{ yearRange[0] }} ~ {{ yearRange[yearRangeSize-1] }}</div>\r\n <button class=\"calendar-arrow\" (click)=\"nextYearRange()\"><i class=\"he he-chevron-right\"></i></button>\r\n </div>\r\n <div class=\"year-grid\">\r\n <div class=\"year-cell\" *ngFor=\"let y of yearRange\" (click)=\"selectYear(y)\"\r\n [class.selected]=\"isYearSelected(y)\" [class.today]=\"isYearCurrent(y)\">{{ y }}</div>\r\n </div>\r\n </ng-container>\r\n\r\n </div>\r\n</div>", styles: [".form-group.calendar{position:relative}.form-group.calendar .datepicker-group{left:0;width:100%;z-index:1000;padding:.5rem;color:#495057;min-width:240px;max-width:260px;border-radius:3px;background:#fff;box-shadow:0 2px 4px -1px #0003,0 4px 5px #00000024,0 1px 10px #0000001f}.form-group.calendar .datepicker-group .header{display:flex;font-weight:600;padding:5px;align-items:center;justify-content:space-between;border-bottom:1px solid #dee2e6}.form-group.calendar .datepicker-group .header .title{gap:8px;display:flex;font-size:15px;cursor:pointer;font-weight:600}.form-group.calendar .datepicker-group .header .calendar-arrow{width:28px;height:28px;border:none;line-height:1;cursor:pointer;background:none}.form-group.calendar .datepicker-group .header .calendar-arrow i{font-size:14px}.form-group.calendar .datepicker-group .header .calendar-arrow:hover{background:#f0f0f0}.form-group.calendar .datepicker-group .week-header{display:grid;padding:8px 0;font-size:13px;font-weight:700;text-align:center;grid-template-columns:repeat(7,1fr)}.form-group.calendar .datepicker-group .days-grid,.form-group.calendar .datepicker-group .month-grid,.form-group.calendar .datepicker-group .year-grid{gap:3px;padding:5px;display:grid;grid-template-columns:repeat(7,1fr)}.form-group.calendar .datepicker-group .days-grid .day-cell,.form-group.calendar .datepicker-group .days-grid .month-cell,.form-group.calendar .datepicker-group .days-grid .year-cell,.form-group.calendar .datepicker-group .month-grid .day-cell,.form-group.calendar .datepicker-group .month-grid .month-cell,.form-group.calendar .datepicker-group .month-grid .year-cell,.form-group.calendar .datepicker-group .year-grid .day-cell,.form-group.calendar .datepicker-group .year-grid .month-cell,.form-group.calendar .datepicker-group .year-grid .year-cell{display:flex;font-size:14px;cursor:pointer;align-items:center;justify-content:center}.form-group.calendar .datepicker-group .days-grid .day-cell.today,.form-group.calendar .datepicker-group .days-grid .month-cell.today,.form-group.calendar .datepicker-group .days-grid .year-cell.today,.form-group.calendar .datepicker-group .month-grid .day-cell.today,.form-group.calendar .datepicker-group .month-grid .month-cell.today,.form-group.calendar .datepicker-group .month-grid .year-cell.today,.form-group.calendar .datepicker-group .year-grid .day-cell.today,.form-group.calendar .datepicker-group .year-grid .month-cell.today,.form-group.calendar .datepicker-group .year-grid .year-cell.today{color:#37c0b3;font-weight:700;border:1px solid #37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.selected,.form-group.calendar .datepicker-group .days-grid .day-cell:hover,.form-group.calendar .datepicker-group .days-grid .month-cell.selected,.form-group.calendar .datepicker-group .days-grid .month-cell:hover,.form-group.calendar .datepicker-group .days-grid .year-cell.selected,.form-group.calendar .datepicker-group .days-grid .year-cell:hover,.form-group.calendar .datepicker-group .month-grid .day-cell.selected,.form-group.calendar .datepicker-group .month-grid .day-cell:hover,.form-group.calendar .datepicker-group .month-grid .month-cell.selected,.form-group.calendar .datepicker-group .month-grid .month-cell:hover,.form-group.calendar .datepicker-group .month-grid .year-cell.selected,.form-group.calendar .datepicker-group .month-grid .year-cell:hover,.form-group.calendar .datepicker-group .year-grid .day-cell.selected,.form-group.calendar .datepicker-group .year-grid .day-cell:hover,.form-group.calendar .datepicker-group .year-grid .month-cell.selected,.form-group.calendar .datepicker-group .year-grid .month-cell:hover,.form-group.calendar .datepicker-group .year-grid .year-cell.selected,.form-group.calendar .datepicker-group .year-grid .year-cell:hover{color:#fff;background:#37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled{color:#e0e0e0;background:none;-webkit-user-select:none;user-select:none;cursor:not-allowed}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled.today,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled.today,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled.today,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled.today,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled.today,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled.today,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled.today,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled.today,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled.today{color:#37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled.today:hover,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled.today:hover,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled.today:hover,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled.today:hover,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled.today:hover,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled.today:hover,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled.today:hover,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled.today:hover,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled.today:hover{color:#fff;background:#37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled:hover,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled:hover,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled:hover,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled:hover,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled:hover,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled:hover,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled:hover,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled:hover,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled:hover{color:#e0e0e0;background:transparent}.form-group.calendar .datepicker-group .days-grid .day-cell,.form-group.calendar .datepicker-group .month-grid .day-cell,.form-group.calendar .datepicker-group .year-grid .day-cell{padding:5px 2px;border-radius:50%}.form-group.calendar .datepicker-group .days-grid .day-cell.other-month:not(.selected):not(:hover),.form-group.calendar .datepicker-group .month-grid .day-cell.other-month:not(.selected):not(:hover),.form-group.calendar .datepicker-group .year-grid .day-cell.other-month:not(.selected):not(:hover){color:#c5c5c5}.form-group.calendar .datepicker-group .days-grid .month-cell,.form-group.calendar .datepicker-group .days-grid .year-cell,.form-group.calendar .datepicker-group .month-grid .month-cell,.form-group.calendar .datepicker-group .month-grid .year-cell,.form-group.calendar .datepicker-group .year-grid .month-cell,.form-group.calendar .datepicker-group .year-grid .year-cell{padding:8px 2px;border-radius:3px}.form-group.calendar .datepicker-group .days-grid.week-mode .day-cell{border-radius:4px}.form-group.calendar .datepicker-group .days-grid.week-mode .day-cell.week-hover:not(.selected){color:#0d6f7d;background:#e6f5f3}.form-group.calendar .datepicker-group .month-grid{grid-template-columns:repeat(3,1fr)}.form-group.calendar .datepicker-group .year-grid{grid-template-columns:repeat(4,1fr)}.form-group.calendar .datepicker-group .time-picker{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.form-group.calendar .datepicker-group .time-picker .ampm-toggle{gap:6px;display:flex;margin-left:1rem;flex-direction:column;justify-content:center}.form-group.calendar .datepicker-group .time-picker .ampm-toggle button{cursor:pointer;padding:3px 8px;font-size:.75rem;background:#fff;border:1px solid #cccccc}.form-group.calendar .datepicker-group .time-picker .ampm-toggle button.active{color:#fff;border-color:#37c0b3;background-color:#37c0b3}.form-group.calendar .datepicker-group .time-picker .time-select{display:flex;margin:0 .75rem;align-items:center;flex-direction:column}.form-group.calendar .datepicker-group .time-picker .time-select button{border:none;cursor:pointer;padding:4px 8px;background:transparent}.form-group.calendar .datepicker-group .time-picker .time-select button i{font-size:1rem}.form-group.calendar .datepicker-group .time-picker .time-select button:hover{background:#f0f0f0}.form-group.calendar .datepicker-group .time-picker .time-select .time-value{width:2rem;font-size:1rem;text-align:center;margin:2px 3px 4px}.form-group.calendar .datepicker-group .time-picker .time-separator{line-height:1;font-size:1rem}.form-group.calendar .clear{right:35px}.form-group.calendar.group-sm .clear{top:7px;right:35px}\n"] }]
|
|
1784
|
+
], template: "<div class=\"form-group calendar\" [ngClass]=\"customClass\" [class.readonly]=\"readonly\" [class.disabled]=\"disabled\" #root\r\n (click)=\"openCalendar()\">\r\n <label class=\"inp-label\" [ngClass]=\"{'required' : required}\" *ngIf=\"title\">{{ title }}</label>\r\n <input type=\"text\" #inputEl [placeholder]=\"placeholder\" [formControl]=\"inputControl\" class=\"form-control\"\r\n [ngClass]=\"{ 'is-invalid': error }\" (blur)=\"onBlur()\" (focus)=\"onFocus()\" [readonly]=\"readonly\"\r\n (click)=\"openCalendar(); $event.stopPropagation()\" (keydown)=\"onInputKeydown($event)\" />\r\n\r\n <span class=\"focus-border\" *ngIf=\"deFocus\"></span>\r\n @if(!inputLoader) {\r\n <span class=\"calendar-icon\">\r\n <i class=\"he\" [ngClass]=\"!timeOnly ? 'he-calendar-blank' : 'he-clock'\"></i>\r\n </span>\r\n }\r\n\r\n @if(!inputLoader &&(selectedDate && !disabled && !readonly) && clearVal) {\r\n <label class=\"clear\" (click)=\"clearDate($event)\">\r\n <i class=\"he he-close\"></i>\r\n </label>\r\n }\r\n\r\n @if(inputLoader) {\r\n <label class=\"loader input-loader\"></label>\r\n }\r\n @if(error) {\r\n <div class=\"val-msg\">{{ errorMessage }}</div>\r\n }\r\n\r\n <div class=\"datepicker-group\" #datePicker *ngIf=\"isOpen\" (mousedown)=\"$event.preventDefault()\"\r\n (click)=\"$event.stopPropagation()\">\r\n\r\n <!-- time picker -->\r\n <ng-container *ngIf=\"timeOnly\">\r\n <div class=\"time-picker\">\r\n <div class=\"time-select\">\r\n <button (click)=\"incrementHour()\" [disabled]=\"!isIncrementHourValid()\"><i\r\n class=\"he he-chevron-up\"></i></button>\r\n <ng-container *ngIf=\"hourFormat === '12'; else show24\">\r\n <div class=\"time-value\">\r\n {{ ((selectedHour % 12) || 12) | number:'2.0' }}\r\n </div>\r\n </ng-container>\r\n <ng-template #show24>\r\n <div class=\"time-value\">\r\n {{ selectedHour | number:'2.0' }}\r\n </div>\r\n </ng-template>\r\n\r\n <button (click)=\"decrementHour()\" [disabled]=\"!isDecrementHourValid()\"><i\r\n class=\"he he-chevron-down\"></i></button>\r\n </div>\r\n <span class=\"time-separator\">:</span>\r\n <div class=\"time-select\">\r\n <button (click)=\"incrementMinute()\" [disabled]=\"!isIncrementMinuteValid()\"><i\r\n class=\"he he-chevron-up\"></i></button>\r\n <div class=\"time-value\">{{ selectedMinute | number:'2.0' }}</div>\r\n <button (click)=\"decrementMinute()\" [disabled]=\"!isDecrementMinuteValid()\"><i\r\n class=\"he he-chevron-down\"></i></button>\r\n </div>\r\n <div class=\"ampm-toggle\" *ngIf=\"hourFormat === '12'\">\r\n <button type=\"button\" [class.active]=\"meridian === 'AM'\" (click)=\"setMeridian('AM')\">AM</button>\r\n <button type=\"button\" [class.active]=\"meridian === 'PM'\" (click)=\"setMeridian('PM')\">PM</button>\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- day view -->\r\n <ng-container *ngIf=\"!timeOnly && currentView === 'day'\">\r\n <div class=\"header\">\r\n <button class=\"calendar-arrow\" (click)=\"prevMonth()\"><i class=\"he he-chevron-left\"></i></button>\r\n <div class=\"title\" (click)=\"goToMonthView()\">\r\n <div>{{ displayMonthName }}</div>\r\n <div>{{ displayYear }}</div>\r\n </div>\r\n <button class=\"calendar-arrow\" (click)=\"nextMonth()\"><i class=\"he he-chevron-right\"></i></button>\r\n </div>\r\n <div class=\"week-header\">\r\n <div>Sun</div>\r\n <div>Mon</div>\r\n <div>Tue</div>\r\n <div>Wed</div>\r\n <div>Thu</div>\r\n <div>Fri</div>\r\n <div>Sat</div>\r\n </div>\r\n <div class=\"days-grid\" [class.week-mode]=\"isWeekLikeMode\"\r\n [class.range-mode]=\"selectionMode === 'range'\" (mouseleave)=\"onDayLeave()\">\r\n <div class=\"day-cell\" *ngFor=\"let cell of daysInMonth; trackBy: trackByDate\" (click)=\"selectDay(cell)\"\r\n (mouseenter)=\"onDayHover(cell)\" (mouseleave)=\"onDayLeave()\"\r\n [class.other-month]=\"cell.otherMonth\"\r\n [class.disabled]=\"cell.disabled\"\r\n [class.selected]=\"cell.selected\"\r\n [class.week-hover]=\"isInHoverWeek(cell.date)\"\r\n [class.range-start]=\"isRangeStart(cell.date)\"\r\n [class.range-end]=\"isRangeEnd(cell.date)\"\r\n [class.in-range]=\"isInSelectedRange(cell.date)\"\r\n [class.range-hover]=\"isInHoverRange(cell.date)\"\r\n [class.today]=\"cell.today\">\r\n {{ cell.day }}\r\n </div>\r\n </div>\r\n <ng-container *ngIf=\"showTime\">\r\n <div class=\"time-picker\">\r\n <div class=\"time-select\">\r\n <button type=\"button\" (click)=\"incrementHour()\" [disabled]=\"!isIncrementHourValid()\">\r\n <i class=\"he he-chevron-up\"></i>\r\n </button>\r\n <ng-container *ngIf=\"hourFormat === '12'; else show24\">\r\n <div class=\"time-value\">\r\n {{\r\n selectedHour % 12 === 0\r\n ? 12\r\n : selectedHour % 12\r\n | number:'2.0' }}\r\n </div>\r\n </ng-container>\r\n <ng-template #show24>\r\n <div class=\"time-value\">{{ selectedHour | number:'2.0' }}</div>\r\n </ng-template>\r\n <button type=\"button\" (click)=\"decrementHour()\" [disabled]=\"!isDecrementHourValid()\">\r\n <i class=\"he he-chevron-down\"></i>\r\n </button>\r\n </div>\r\n <span class=\"time-separator\">:</span>\r\n <div class=\"time-select\">\r\n <button type=\"button\" (click)=\"incrementMinute()\" [disabled]=\"!isIncrementMinuteValid()\">\r\n <i class=\"he he-chevron-up\"></i>\r\n </button>\r\n <div class=\"time-value\">\r\n {{ selectedMinute < 10 ? '0' +selectedMinute : selectedMinute }} </div>\r\n <button type=\"button\" (click)=\"decrementMinute()\" [disabled]=\"!isDecrementMinuteValid()\">\r\n <i class=\"he he-chevron-down\"></i>\r\n </button>\r\n </div>\r\n <div class=\"ampm-toggle\" *ngIf=\"hourFormat === '12'\">\r\n <button type=\"button\" [class.active]=\"meridian === 'AM'\" (click)=\"setMeridian('AM')\">AM</button>\r\n <button type=\"button\" [class.active]=\"meridian === 'PM'\" (click)=\"setMeridian('PM')\">PM</button>\r\n </div>\r\n </div>\r\n </ng-container>\r\n </ng-container>\r\n\r\n <!-- month view -->\r\n <ng-container *ngIf=\"!timeOnly && currentView === 'month'\">\r\n <div class=\"header\" *ngIf=\"viewMode !== 'month'\">\r\n <button class=\"calendar-arrow\" (click)=\"displayYear = displayYear - 1\"><i\r\n class=\"he he-chevron-left\"></i></button>\r\n <div class=\"title\" (click)=\"goToYearRangeView()\">{{ displayYear }}</div>\r\n <button class=\"calendar-arrow\" (click)=\"displayYear = displayYear + 1\"><i\r\n class=\"he he-chevron-right\"></i></button>\r\n </div>\r\n <div class=\"month-grid\">\r\n <div class=\"month-cell\" *ngFor=\"let m of months; index as i\" (click)=\"selectMonth(i)\"\r\n [class.selected]=\"isMonthSelected(i)\" [class.today]=\"isMonthCurrent(i)\">{{ m }}\r\n </div>\r\n </div>\r\n </ng-container>\r\n\r\n <!-- year range view -->\r\n <ng-container *ngIf=\"!timeOnly && currentView === 'yearRange'\">\r\n <div class=\"header\">\r\n <button class=\"calendar-arrow\" (click)=\"prevYearRange()\"><i class=\"he he-chevron-left\"></i></button>\r\n <div class=\"title\">{{ yearRange[0] }} ~ {{ yearRange[yearRangeSize-1] }}</div>\r\n <button class=\"calendar-arrow\" (click)=\"nextYearRange()\"><i class=\"he he-chevron-right\"></i></button>\r\n </div>\r\n <div class=\"year-grid\">\r\n <div class=\"year-cell\" *ngFor=\"let y of yearRange\" (click)=\"selectYear(y)\"\r\n [class.selected]=\"isYearSelected(y)\" [class.today]=\"isYearCurrent(y)\">{{ y }}</div>\r\n </div>\r\n </ng-container>\r\n\r\n </div>\r\n</div>", styles: [".form-group.calendar{position:relative}.form-group.calendar .datepicker-group{left:0;width:100%;z-index:1000;padding:.5rem;color:#495057;min-width:240px;max-width:260px;border-radius:3px;background:#fff;box-shadow:0 2px 4px -1px #0003,0 4px 5px #00000024,0 1px 10px #0000001f}.form-group.calendar .datepicker-group .header{display:flex;font-weight:600;padding:5px;align-items:center;justify-content:space-between;border-bottom:1px solid #dee2e6}.form-group.calendar .datepicker-group .header .title{gap:8px;display:flex;font-size:15px;cursor:pointer;font-weight:600}.form-group.calendar .datepicker-group .header .calendar-arrow{width:28px;height:28px;border:none;line-height:1;cursor:pointer;background:none}.form-group.calendar .datepicker-group .header .calendar-arrow i{font-size:14px}.form-group.calendar .datepicker-group .header .calendar-arrow:hover{background:#f0f0f0}.form-group.calendar .datepicker-group .week-header{display:grid;padding:8px 0;font-size:13px;font-weight:700;text-align:center;grid-template-columns:repeat(7,1fr)}.form-group.calendar .datepicker-group .days-grid,.form-group.calendar .datepicker-group .month-grid,.form-group.calendar .datepicker-group .year-grid{gap:3px;padding:5px;display:grid;grid-template-columns:repeat(7,1fr)}.form-group.calendar .datepicker-group .days-grid .day-cell,.form-group.calendar .datepicker-group .days-grid .month-cell,.form-group.calendar .datepicker-group .days-grid .year-cell,.form-group.calendar .datepicker-group .month-grid .day-cell,.form-group.calendar .datepicker-group .month-grid .month-cell,.form-group.calendar .datepicker-group .month-grid .year-cell,.form-group.calendar .datepicker-group .year-grid .day-cell,.form-group.calendar .datepicker-group .year-grid .month-cell,.form-group.calendar .datepicker-group .year-grid .year-cell{display:flex;font-size:14px;cursor:pointer;align-items:center;justify-content:center}.form-group.calendar .datepicker-group .days-grid .day-cell.today,.form-group.calendar .datepicker-group .days-grid .month-cell.today,.form-group.calendar .datepicker-group .days-grid .year-cell.today,.form-group.calendar .datepicker-group .month-grid .day-cell.today,.form-group.calendar .datepicker-group .month-grid .month-cell.today,.form-group.calendar .datepicker-group .month-grid .year-cell.today,.form-group.calendar .datepicker-group .year-grid .day-cell.today,.form-group.calendar .datepicker-group .year-grid .month-cell.today,.form-group.calendar .datepicker-group .year-grid .year-cell.today{color:#37c0b3;font-weight:700;border:1px solid #37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.selected,.form-group.calendar .datepicker-group .days-grid .day-cell:hover,.form-group.calendar .datepicker-group .days-grid .month-cell.selected,.form-group.calendar .datepicker-group .days-grid .month-cell:hover,.form-group.calendar .datepicker-group .days-grid .year-cell.selected,.form-group.calendar .datepicker-group .days-grid .year-cell:hover,.form-group.calendar .datepicker-group .month-grid .day-cell.selected,.form-group.calendar .datepicker-group .month-grid .day-cell:hover,.form-group.calendar .datepicker-group .month-grid .month-cell.selected,.form-group.calendar .datepicker-group .month-grid .month-cell:hover,.form-group.calendar .datepicker-group .month-grid .year-cell.selected,.form-group.calendar .datepicker-group .month-grid .year-cell:hover,.form-group.calendar .datepicker-group .year-grid .day-cell.selected,.form-group.calendar .datepicker-group .year-grid .day-cell:hover,.form-group.calendar .datepicker-group .year-grid .month-cell.selected,.form-group.calendar .datepicker-group .year-grid .month-cell:hover,.form-group.calendar .datepicker-group .year-grid .year-cell.selected,.form-group.calendar .datepicker-group .year-grid .year-cell:hover{color:#fff;background:#37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled{color:#e0e0e0;background:none;-webkit-user-select:none;user-select:none;cursor:not-allowed}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled.today,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled.today,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled.today,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled.today,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled.today,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled.today,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled.today,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled.today,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled.today{color:#37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled.today:hover,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled.today:hover,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled.today:hover,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled.today:hover,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled.today:hover,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled.today:hover,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled.today:hover,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled.today:hover,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled.today:hover{color:#fff;background:#37c0b3}.form-group.calendar .datepicker-group .days-grid .day-cell.disabled:hover,.form-group.calendar .datepicker-group .days-grid .month-cell.disabled:hover,.form-group.calendar .datepicker-group .days-grid .year-cell.disabled:hover,.form-group.calendar .datepicker-group .month-grid .day-cell.disabled:hover,.form-group.calendar .datepicker-group .month-grid .month-cell.disabled:hover,.form-group.calendar .datepicker-group .month-grid .year-cell.disabled:hover,.form-group.calendar .datepicker-group .year-grid .day-cell.disabled:hover,.form-group.calendar .datepicker-group .year-grid .month-cell.disabled:hover,.form-group.calendar .datepicker-group .year-grid .year-cell.disabled:hover{color:#e0e0e0;background:transparent}.form-group.calendar .datepicker-group .days-grid .day-cell,.form-group.calendar .datepicker-group .month-grid .day-cell,.form-group.calendar .datepicker-group .year-grid .day-cell{padding:5px 2px;border-radius:50%}.form-group.calendar .datepicker-group .days-grid .day-cell.other-month:not(.selected):not(:hover),.form-group.calendar .datepicker-group .month-grid .day-cell.other-month:not(.selected):not(:hover),.form-group.calendar .datepicker-group .year-grid .day-cell.other-month:not(.selected):not(:hover){color:#c5c5c5}.form-group.calendar .datepicker-group .days-grid .month-cell,.form-group.calendar .datepicker-group .days-grid .year-cell,.form-group.calendar .datepicker-group .month-grid .month-cell,.form-group.calendar .datepicker-group .month-grid .year-cell,.form-group.calendar .datepicker-group .year-grid .month-cell,.form-group.calendar .datepicker-group .year-grid .year-cell{padding:8px 2px;border-radius:3px}.form-group.calendar .datepicker-group .days-grid.week-mode .day-cell{border-radius:4px}.form-group.calendar .datepicker-group .days-grid.week-mode .day-cell.week-hover:not(.selected){color:#0d6f7d;background:#e6f5f3}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell{border-radius:4px}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.in-range:not(.range-start):not(.range-end),.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.range-hover:not(.range-start):not(.range-end){color:#0d6f7d;background:#e6f5f3;border-radius:0}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.other-month.in-range:not(.range-start):not(.range-end),.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.other-month.range-hover:not(.range-start):not(.range-end){color:#0d6f7d}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.range-start,.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.range-end,.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.selected{color:#fff;background:#37c0b3}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.range-start:not(.range-end){border-radius:4px 0 0 4px}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell.range-end:not(.range-start){border-radius:0 4px 4px 0}.form-group.calendar .datepicker-group .days-grid.range-mode .day-cell:hover:not(.disabled):not(.range-start):not(.range-end){color:#0d6f7d;background:#e6f5f3}.form-group.calendar .datepicker-group .month-grid{grid-template-columns:repeat(3,1fr)}.form-group.calendar .datepicker-group .year-grid{grid-template-columns:repeat(4,1fr)}.form-group.calendar .datepicker-group .time-picker{display:flex;-webkit-user-select:none;user-select:none;align-items:center;justify-content:center}.form-group.calendar .datepicker-group .time-picker .ampm-toggle{gap:6px;display:flex;margin-left:1rem;flex-direction:column;justify-content:center}.form-group.calendar .datepicker-group .time-picker .ampm-toggle button{cursor:pointer;padding:3px 8px;font-size:.75rem;background:#fff;border:1px solid #cccccc}.form-group.calendar .datepicker-group .time-picker .ampm-toggle button.active{color:#fff;border-color:#37c0b3;background-color:#37c0b3}.form-group.calendar .datepicker-group .time-picker .time-select{display:flex;margin:0 .75rem;align-items:center;flex-direction:column}.form-group.calendar .datepicker-group .time-picker .time-select button{border:none;cursor:pointer;padding:4px 8px;background:transparent}.form-group.calendar .datepicker-group .time-picker .time-select button i{font-size:1rem}.form-group.calendar .datepicker-group .time-picker .time-select button:hover{background:#f0f0f0}.form-group.calendar .datepicker-group .time-picker .time-select .time-value{width:2rem;font-size:1rem;text-align:center;margin:2px 3px 4px}.form-group.calendar .datepicker-group .time-picker .time-separator{line-height:1;font-size:1rem}.form-group.calendar .clear{right:35px}.form-group.calendar.group-sm .clear{top:7px;right:35px}\n"] }]
|
|
1476
1785
|
}], ctorParameters: () => [{ type: i1.DatePipe }], propDecorators: { title: [{
|
|
1477
1786
|
type: Input
|
|
1478
1787
|
}], required: [{
|
|
@@ -1520,6 +1829,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.25", ngImpo
|
|
|
1520
1829
|
type: Output
|
|
1521
1830
|
}], weekSelected: [{
|
|
1522
1831
|
type: Output
|
|
1832
|
+
}], rangeSelected: [{
|
|
1833
|
+
type: Output
|
|
1523
1834
|
}], defaultDate: [{
|
|
1524
1835
|
type: Input
|
|
1525
1836
|
}], minDate: [{
|