@libs-ui/components-datetime-picker 0.2.72

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.
Files changed (29) hide show
  1. package/README.md +3 -0
  2. package/custom-ranges/calendar/calendar.component.d.ts +140 -0
  3. package/custom-ranges/custom-ranges.component.d.ts +59 -0
  4. package/defines/calendar.define.d.ts +13 -0
  5. package/defines/date-options.define.d.ts +20 -0
  6. package/esm2022/custom-ranges/calendar/calendar.component.mjs +1256 -0
  7. package/esm2022/custom-ranges/custom-ranges.component.mjs +266 -0
  8. package/esm2022/defines/calendar.define.mjs +135 -0
  9. package/esm2022/defines/date-options.define.mjs +55 -0
  10. package/esm2022/index.mjs +2 -0
  11. package/esm2022/interfaces/calendar-emit.interface.mjs +2 -0
  12. package/esm2022/interfaces/calendar-variables.interface.mjs +6 -0
  13. package/esm2022/interfaces/function-control.interface.mjs +2 -0
  14. package/esm2022/interfaces/picker.interface.mjs +2 -0
  15. package/esm2022/interfaces/time-variables.interface.mjs +4 -0
  16. package/esm2022/interfaces/valid.interface.mjs +2 -0
  17. package/esm2022/libs-ui-components-datetime-picker.mjs +5 -0
  18. package/esm2022/picker.component.mjs +180 -0
  19. package/fesm2022/libs-ui-components-datetime-picker.mjs +1882 -0
  20. package/fesm2022/libs-ui-components-datetime-picker.mjs.map +1 -0
  21. package/index.d.ts +1 -0
  22. package/interfaces/calendar-emit.interface.d.ts +25 -0
  23. package/interfaces/calendar-variables.interface.d.ts +80 -0
  24. package/interfaces/function-control.interface.d.ts +8 -0
  25. package/interfaces/picker.interface.d.ts +26 -0
  26. package/interfaces/time-variables.interface.d.ts +36 -0
  27. package/interfaces/valid.interface.d.ts +5 -0
  28. package/package.json +25 -0
  29. package/picker.component.d.ts +77 -0
@@ -0,0 +1,1882 @@
1
+ import * as i0 from '@angular/core';
2
+ import { signal, computed, input, model, output, inject, viewChild, effect, untracked, Component, ChangeDetectionStrategy } from '@angular/core';
3
+ import { LibsUiComponentsLabelComponent } from '@libs-ui/components-label';
4
+ import { LibsUiComponentsPopoverComponent } from '@libs-ui/components-popover';
5
+ import { UtilsLanguageConstants, get, UtilsCache, UtilsHttpParamsRequestInstance, isEmpty, set, ERROR_MESSAGE_EMPTY_VALID } from '@libs-ui/utils';
6
+ import * as i1 from '@ngx-translate/core';
7
+ import { TranslateService, TranslateModule } from '@ngx-translate/core';
8
+ import dayjs from 'dayjs';
9
+ import { LibsUiComponentsButtonsButtonComponent } from '@libs-ui/components-buttons-button';
10
+ import { LibsUiComponentsDropdownComponent } from '@libs-ui/components-dropdown';
11
+ import { LibsUiComponentsInputsInputComponent } from '@libs-ui/components-inputs-input';
12
+ import isoWeek from 'dayjs/plugin/isoWeek';
13
+ import { returnListObject, returnDetailObject } from '@libs-ui/services-http-request';
14
+
15
+ const getDateOptions = () => {
16
+ const dateOptions = {
17
+ [UtilsLanguageConstants.VI]: {
18
+ "monthNames": ["Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"],
19
+ "ranges": { "today": "Hôm nay", "yesterday": "Hôm qua", "_7days_ago": "7 ngày trước", "_30days_ago": "30 ngày trước", "this_month": "Tháng này", "last_month": "Tháng trước", "_3months_ago": "90 ngày trước" },
20
+ "daysOfWeek": ["T2", "T3", "T4", "T5", "T6", "T7", "CN"],
21
+ "applyLabel": "Lưu",
22
+ "cancelLabel": "Huỷ bỏ",
23
+ "fromLabel": "Từ",
24
+ "toLabel": "Đến",
25
+ "customRangeLabel": "Tùy Chỉnh"
26
+ },
27
+ [UtilsLanguageConstants.EN]: {
28
+ "monthNames": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
29
+ "ranges": { "today": "Today", "yesterday": "Yesterday", "_7days_ago": "7 days ago", "_30days_ago": "30 days ago", "this_month": "This month", "last_month": "Last month", "_3months_ago": "90 days ago" },
30
+ "daysOfWeek": ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
31
+ "applyLabel": "Apply",
32
+ "cancelLabel": "Cancel",
33
+ "fromLabel": "From",
34
+ "toLabel": "To",
35
+ "customRangeLabel": "Customize"
36
+ }
37
+ };
38
+ return get(dateOptions, UtilsCache.getLang());
39
+ };
40
+ const defaultLocaleConfig = () => {
41
+ return {
42
+ direction: 'ltr',
43
+ separator: ' - ',
44
+ weekLabel: 'W',
45
+ applyLabel: 'Apply',
46
+ cancelLabel: 'Cancel',
47
+ clearLabel: 'Clear',
48
+ customRangeLabel: 'customRangeLabel',
49
+ daysOfWeek: [],
50
+ monthNames: [],
51
+ firstDay: 1
52
+ };
53
+ };
54
+ const getDateRangeDefault = () => {
55
+ return {
56
+ today: [dayjs().hour(0).minute(0).second(0).millisecond(0), dayjs().hour(23).minute(59).second(59)],
57
+ yesterday: [dayjs().subtract(1, 'days').hour(0).minute(0).second(0).millisecond(0), dayjs().subtract(1, 'days').hour(23).minute(59).second(59)],
58
+ _7days_ago: [dayjs().subtract(6, 'days').hour(0).second(0).minute(0).millisecond(0), dayjs().hour(23).minute(59).second(59)],
59
+ _30days_ago: [dayjs().subtract(29, 'days').hour(0).second(0).minute(0).millisecond(0), dayjs().hour(23).minute(59).second(59)],
60
+ this_month: [dayjs().startOf('month'), dayjs().endOf('month')],
61
+ last_month: [dayjs().subtract(1, 'month').startOf('month'), dayjs().subtract(1, 'month').endOf('month')],
62
+ _3months_ago: [dayjs().subtract(89, 'days').hour(0).second(0).minute(0).millisecond(0), dayjs().hour(23).minute(59).second(59)],
63
+ };
64
+ };
65
+ const DEFAULT_MIN_YEAR = 1945;
66
+ const DEFAULT_MAX_YEAR = 2100;
67
+
68
+ const getMonthsDefault = () => {
69
+ return [
70
+ {
71
+ id: 1,
72
+ label: 'i18n_january',
73
+ maxDays: 31
74
+ },
75
+ {
76
+ id: 2,
77
+ label: 'i18n_february',
78
+ maxDays: 29
79
+ },
80
+ {
81
+ id: 3,
82
+ label: 'i18n_march',
83
+ maxDays: 31
84
+ },
85
+ {
86
+ id: 4,
87
+ label: 'i18n_april',
88
+ maxDays: 30
89
+ },
90
+ {
91
+ id: 5,
92
+ label: 'i18n_may',
93
+ maxDays: 31
94
+ },
95
+ {
96
+ id: 6,
97
+ label: 'i18n_june',
98
+ maxDays: 30
99
+ },
100
+ {
101
+ id: 7,
102
+ label: 'i18n_july',
103
+ maxDays: 31
104
+ },
105
+ {
106
+ id: 8,
107
+ label: 'i18n_august',
108
+ maxDays: 31
109
+ },
110
+ {
111
+ id: 9,
112
+ label: 'i18n_september',
113
+ maxDays: 30
114
+ },
115
+ {
116
+ id: 10,
117
+ label: 'i18n_october',
118
+ maxDays: 31
119
+ },
120
+ {
121
+ id: 11,
122
+ label: 'i18n_november',
123
+ maxDays: 30
124
+ },
125
+ {
126
+ id: 12,
127
+ label: 'i18n_december',
128
+ maxDays: 31
129
+ }
130
+ ];
131
+ };
132
+ const getMonthsListConfig = (translate) => {
133
+ return {
134
+ type: 'text',
135
+ httpRequestData: signal({
136
+ serviceOther: returnListObject(getMonthsDefault()),
137
+ functionName: 'list',
138
+ argumentsValue: []
139
+ }),
140
+ configTemplateText: signal({
141
+ fieldKey: 'id',
142
+ autoScrollToItemSelected: true,
143
+ getValue: (item) => {
144
+ const label = translate.instant(item.label || ' ', { year: ' ' });
145
+ return label.substring(0, UtilsCache.getLang() === UtilsLanguageConstants.VI ? label.length : 3);
146
+ },
147
+ getClassIncludePopover: () => 'libs-ui-font-h5r'
148
+ })
149
+ };
150
+ };
151
+ const getMonthsDetailById = () => {
152
+ return {
153
+ serviceOther: returnDetailObject(UtilsHttpParamsRequestInstance(), getMonthsDefault()),
154
+ functionName: 'detailByData',
155
+ argumentsValue: [],
156
+ guideAutoUpdateArgumentsValue: {
157
+ paging: {},
158
+ detailById: {
159
+ fieldUpdate: '[0]',
160
+ fieldGetValue: '',
161
+ subFieldUpdate: 'keys'
162
+ }
163
+ }
164
+ };
165
+ };
166
+ const getYearsListConfig = (listOfYears = []) => {
167
+ return {
168
+ type: 'text',
169
+ httpRequestData: signal({
170
+ serviceOther: returnListObject(listOfYears),
171
+ functionName: 'list',
172
+ argumentsValue: []
173
+ }),
174
+ configTemplateText: signal({
175
+ fieldKey: 'id',
176
+ autoScrollToItemSelected: true,
177
+ getValue: (item) => {
178
+ return item.label;
179
+ },
180
+ getClassIncludeTooltip: () => 'libs-ui-font-h5r'
181
+ })
182
+ };
183
+ };
184
+ const getYearsDetailById = (listOfYears = []) => {
185
+ return {
186
+ serviceOther: returnDetailObject(UtilsHttpParamsRequestInstance(), listOfYears),
187
+ functionName: 'detailByData',
188
+ argumentsValue: [],
189
+ guideAutoUpdateArgumentsValue: {
190
+ paging: {},
191
+ detailById: {
192
+ fieldUpdate: '[0]',
193
+ fieldGetValue: '',
194
+ subFieldUpdate: 'keys'
195
+ }
196
+ }
197
+ };
198
+ };
199
+
200
+ var SideEnum;
201
+ (function (SideEnum) {
202
+ SideEnum["left"] = "left";
203
+ SideEnum["right"] = "right";
204
+ })(SideEnum || (SideEnum = {}));
205
+
206
+ /* eslint-disable @typescript-eslint/no-unused-expressions */
207
+ /* eslint-disable @typescript-eslint/no-explicit-any */
208
+ dayjs.extend(isoWeek);
209
+ class LibsUiComponentsDatetimePickerCustomRangesCalendarComponent {
210
+ /** PROPERTY */
211
+ sideEnum = SideEnum;
212
+ calendarVariables = signal({ left: signal({}), right: signal({}) });
213
+ timepickerVariables = signal({ left: signal({ selectedHour: 0, selectedMinute: 0 }), right: signal({ selectedHour: 23, selectedMinute: 59 }) });
214
+ disableMonth = signal({ left: signal([]), right: signal([]) });
215
+ today = signal(dayjs());
216
+ listKeyFromSelected = signal({ month: undefined, year: undefined });
217
+ listKeyToSelected = signal({ month: undefined, year: undefined });
218
+ checkShowListDropdown = signal({});
219
+ selectedQuickRange = signal('');
220
+ leftCalendar = signal({});
221
+ rightCalendar = signal({});
222
+ listMonthsConfig = signal(undefined);
223
+ monthHttpDetailConfig = signal(getMonthsDetailById());
224
+ listLeftYearConfig = signal(undefined);
225
+ listRightYearConfig = signal(undefined);
226
+ listYearConfig = signal(undefined);
227
+ leftYearHttpDetailConfig = signal(undefined);
228
+ rightYearHttpDetailConfig = signal(undefined);
229
+ timePickerError = signal(false);
230
+ computedDisplayTimeLeft = computed(() => this.computedDisplayTime({ selectedHour: this.timepickerValueItem().lefthour(), selectedMinute: this.timepickerValueItem().leftminute() }));
231
+ computedDisplayTimeRight = computed(() => this.computedDisplayTime({ selectedHour: this.timepickerValueItem().righthour(), selectedMinute: this.timepickerValueItem().rightminute() }));
232
+ computedDisplayTimeLeftInputHour = computed(() => this.computedDisplayTimeInput(SideEnum.left, 'hour'));
233
+ computedDisplayTimeLeftInputMinute = computed(() => this.computedDisplayTimeInput(SideEnum.left, 'minute'));
234
+ computedDisplayTimeRightInputHour = computed(() => this.computedDisplayTimeInput(SideEnum.right, 'hour'));
235
+ computedDisplayTimeRightInputMinute = computed(() => this.computedDisplayTimeInput(SideEnum.right, 'minute'));
236
+ functionControls = new Map();
237
+ pickingDate = signal(false);
238
+ isShown = signal(false);
239
+ nowHoveredDate = signal(null);
240
+ timePickerIncrement = signal(1);
241
+ selectedLabel = signal(undefined);
242
+ keyCodeBackspace = signal(false);
243
+ checkBackspaceFocus = signal({ lefthour: signal(1), leftminute: signal(1), righthour: signal(1), rightminute: signal(1) });
244
+ timepickerValueItem = signal({ lefthour: signal(0), leftminute: signal(0), righthour: signal(0), rightminute: signal(0) });
245
+ isZero = signal(undefined);
246
+ oldDate = signal({ start: dayjs(0), end: dayjs(0) });
247
+ isSelectedData = signal({ leftmonth: false, leftyear: false, rightmonth: false, rightyear: false });
248
+ splitPickerDate = signal({ start: signal({ month: 0, year: 0, day: 0, hour: 0, minute: 0 }), end: signal({ month: 0, year: 0, day: 0, hour: 23, minute: 59 }) });
249
+ /** INPUT */
250
+ quickRangesArray = input([]);
251
+ zIndex = input(1200, { transform: (value) => value ?? 1200 });
252
+ classInclude = input('');
253
+ isSingle = input(false);
254
+ showDropdownsSelect = input(true);
255
+ hasTimePicker = input(true);
256
+ flagMouse = input({ isMouseEnter: false, isMouseEnterContent: false });
257
+ dateOptions = input({ ...defaultLocaleConfig(), ...getDateOptions() });
258
+ autoApply = input(false);
259
+ hasSecondPicker = input(false);
260
+ showRangeLabelOnInput = input(undefined);
261
+ startDate = model(dayjs().startOf('day'));
262
+ endDate = model(dayjs().endOf('day'));
263
+ minDate = input(undefined, { transform: this.transformMinMaxDate.bind(this) });
264
+ maxDate = input(undefined, { transform: this.transformMinMaxDate.bind(this) });
265
+ /** OUTPUT */
266
+ outChangStageFlagMouse = output();
267
+ // readonly outStartDateChanged = output<{ startDate: dayjs.Dayjs | undefined }>();
268
+ // readonly outEndDateChanged = output<{ endDate: dayjs.Dayjs | undefined }>();
269
+ outPickerDate = output();
270
+ // readonly outRangeClicked: EventEmitter<IRangesClicked> = new EventEmitter();
271
+ outCancel = output();
272
+ outUpdateWidth = output();
273
+ outFunctionsControl = output();
274
+ /** INJECTION */
275
+ translate = inject(TranslateService);
276
+ pickerContainer = viewChild('pickerContainer');
277
+ constructor() {
278
+ this.listMonthsConfig.set(getMonthsListConfig(this.translate));
279
+ effect(() => {
280
+ const oldStart = this.startDate()?.clone();
281
+ const oldEnd = this.endDate()?.clone();
282
+ untracked(() => {
283
+ this.oldDate.set({ start: oldStart, end: oldEnd });
284
+ });
285
+ });
286
+ }
287
+ ngOnInit() {
288
+ const startDate = this.startDate()?.clone();
289
+ const endDate = this.endDate()?.clone();
290
+ this.splitPickerDate.update(current => {
291
+ current.start.update(sideCurrent => {
292
+ sideCurrent.day = (startDate ?? dayjs().startOf('day')).date();
293
+ return sideCurrent;
294
+ });
295
+ current.end.update(sideCurrent => {
296
+ sideCurrent.day = (endDate ?? dayjs().endOf('day')).date();
297
+ return sideCurrent;
298
+ });
299
+ return current;
300
+ });
301
+ if (startDate) {
302
+ this.updateElement();
303
+ }
304
+ if (startDate && this.hasTimePicker()) {
305
+ this.setStartDate(startDate);
306
+ this.renderTimePicker(SideEnum.left);
307
+ }
308
+ if (endDate && this.hasTimePicker()) {
309
+ this.setEndDate(endDate);
310
+ this.renderTimePicker(SideEnum.right);
311
+ }
312
+ this.buildConfigYear(SideEnum.left);
313
+ this.buildConfigYear(SideEnum.right, startDate?.year());
314
+ this.updateMonthsInView();
315
+ this.renderCalendar(SideEnum.left);
316
+ this.renderCalendar(SideEnum.right);
317
+ // this.renderRanges();
318
+ this.formatMonthYear();
319
+ this.outUpdateWidth.emit(1);
320
+ this.updateElement();
321
+ this.timepickerValueItem.set({
322
+ lefthour: signal(this.timepickerVariables().left().selectedHour),
323
+ righthour: signal(this.timepickerVariables().right().selectedHour),
324
+ leftminute: signal(this.timepickerVariables().left().selectedMinute),
325
+ rightminute: signal(this.timepickerVariables().right().selectedMinute)
326
+ });
327
+ // this.outFunctionsControl.emit({ buildDefaultRange: this.buildDefaultRange.bind(this), applyToSelect: this.applyToSelect.bind(this) })
328
+ }
329
+ buildConfigYear(side, startYear) {
330
+ const minDate = this.minDate();
331
+ const maxDate = this.maxDate();
332
+ const listLeftYear = [];
333
+ const listRightYear = [];
334
+ if (side === SideEnum.left) {
335
+ for (let i = (minDate ? minDate.year() : DEFAULT_MIN_YEAR); i <= (maxDate ? maxDate?.year() : DEFAULT_MAX_YEAR); i++) {
336
+ listLeftYear.push({
337
+ id: i,
338
+ label: `${i}`
339
+ });
340
+ }
341
+ this.listLeftYearConfig.set(getYearsListConfig(listLeftYear));
342
+ this.leftYearHttpDetailConfig.set(getYearsDetailById(listLeftYear));
343
+ return;
344
+ }
345
+ for (let i = (startYear ? startYear : minDate ? minDate.year() : dayjs().year()); i <= (maxDate ? maxDate?.year() : DEFAULT_MAX_YEAR); i++) {
346
+ listRightYear.push({
347
+ id: i,
348
+ label: `${i}`
349
+ });
350
+ }
351
+ this.listRightYearConfig.set(getYearsListConfig(listRightYear));
352
+ this.rightYearHttpDetailConfig.set(getYearsDetailById(listRightYear));
353
+ }
354
+ handlerChangeFlagMouse(flagMouse) {
355
+ this.outChangStageFlagMouse.emit(flagMouse);
356
+ }
357
+ updateStartEndDate(date) {
358
+ if ((this.endDate() || date.isBefore(this.startDate(), 'day'))) {
359
+ if (this.hasTimePicker()) {
360
+ date = this.getDateWithTime(date, SideEnum.left);
361
+ }
362
+ this.endDate.set(undefined);
363
+ this.setStartDate(date.clone());
364
+ return;
365
+ }
366
+ if (!this.endDate() && this.startDate() && date.isBefore(this.startDate())) {
367
+ this.setEndDate(this.startDate()?.clone());
368
+ return;
369
+ }
370
+ if (this.hasTimePicker()) {
371
+ date = this.getDateWithTime(date, SideEnum.right);
372
+ }
373
+ if (!date.isBefore(this.startDate(), 'day')) {
374
+ this.setEndDate(date.clone());
375
+ }
376
+ if (this.autoApply()) {
377
+ this.calculateSelectedLabel();
378
+ }
379
+ }
380
+ calculateSelectedLabel() {
381
+ this.updateElement();
382
+ }
383
+ formatMonthYear() {
384
+ const month = (this.calendarVariables().left().dropdowns?.()?.currentMonth ?? 0) + 1;
385
+ const rightMonth = (this.calendarVariables().right().dropdowns?.()?.currentMonth ?? 0) + 1;
386
+ this.listKeyFromSelected.update(current => {
387
+ current.month = month;
388
+ current.year = this.calendarVariables().left().dropdowns?.()?.currentYear;
389
+ return current;
390
+ });
391
+ this.listKeyToSelected.update(current => {
392
+ current.month = rightMonth;
393
+ current.year = this.calendarVariables().right().dropdowns?.()?.currentYear;
394
+ return current;
395
+ });
396
+ this.isSelectedData.set({ leftmonth: true, leftyear: true, rightmonth: true, rightyear: true });
397
+ }
398
+ setStartDate(startDate) {
399
+ if (!this.startDate()) {
400
+ return;
401
+ }
402
+ if (typeof startDate === 'string') {
403
+ this.startDate.set(dayjs(startDate, this.dateOptions().format));
404
+ }
405
+ if (typeof startDate === 'object') {
406
+ this.pickingDate.set(true);
407
+ this.startDate.set(dayjs(startDate));
408
+ }
409
+ if (!this.hasTimePicker()) {
410
+ this.pickingDate.set(true);
411
+ this.startDate.set(this.startDate()?.startOf('day'));
412
+ }
413
+ this.setStartDateInTimePicker();
414
+ if (this.minDate() && this.startDate()?.isBefore(this.minDate())) {
415
+ this.startDate.set(this.minDate()?.clone());
416
+ this.setStartDateInTimePicker();
417
+ }
418
+ if (this.maxDate() && this.startDate()?.isAfter(this.maxDate())) {
419
+ this.startDate.set(this.maxDate().clone());
420
+ this.setStartDateInTimePicker();
421
+ }
422
+ if (!this.isShown()) {
423
+ this.updateElement();
424
+ }
425
+ // this.outStartDateChanged.emit({ startDate: this.startDate() });
426
+ this.updateMonthsInView();
427
+ }
428
+ setStartDateInTimePicker() {
429
+ if (!this.hasTimePicker() || !this.timePickerIncrement()) {
430
+ return;
431
+ }
432
+ this.startDate.update((current) => {
433
+ if (!current) {
434
+ return;
435
+ }
436
+ current.minute(Math.round(current.minute() / this.timePickerIncrement()) * this.timePickerIncrement());
437
+ return current;
438
+ });
439
+ }
440
+ setEndDate(endDate) {
441
+ if (typeof endDate === 'string') {
442
+ this.endDate.set(dayjs(endDate, this.dateOptions().format));
443
+ }
444
+ if (typeof endDate === 'object') {
445
+ this.pickingDate.set(false);
446
+ this.endDate.set(dayjs(endDate));
447
+ }
448
+ if (!this.endDate() || !this.startDate()) {
449
+ return this.updateMonthsInView();
450
+ }
451
+ if (!this.hasTimePicker()) {
452
+ this.pickingDate.set(false);
453
+ this.endDate.set(this.endDate()?.add(1, 'd').startOf('day').subtract(1, 'second'));
454
+ }
455
+ if (this.hasTimePicker() && this.timePickerIncrement()) {
456
+ this.endDate.update((current) => {
457
+ if (!current) {
458
+ return;
459
+ }
460
+ current.minute(Math.round(current.minute() / this.timePickerIncrement()) * this.timePickerIncrement());
461
+ return current;
462
+ });
463
+ }
464
+ if (this.endDate()?.isBefore(this.startDate())) {
465
+ this.endDate.set(this.startDate()?.clone());
466
+ }
467
+ if (this.maxDate() && this.endDate()?.isAfter(this.maxDate())) {
468
+ this.endDate.set(this.maxDate()?.clone());
469
+ }
470
+ // this.outEndDateChanged.emit({ endDate: this.endDate() });
471
+ this.updateMonthsInView();
472
+ }
473
+ handlerHoverDate(event, side, row, col) {
474
+ event.stopPropagation();
475
+ const leftCalDate = this.calendarVariables().left().calendar?.[row][col];
476
+ const rightCalDate = this.calendarVariables().right().calendar?.[row][col];
477
+ if (!this.pickingDate || !rightCalDate || !leftCalDate) {
478
+ return;
479
+ }
480
+ this.nowHoveredDate.set(side === SideEnum.left ? leftCalDate : rightCalDate);
481
+ this.renderCalendar(SideEnum.left);
482
+ this.renderCalendar(SideEnum.right);
483
+ }
484
+ getDisable(type) {
485
+ const minDate = this.minDate();
486
+ const maxDate = this.maxDate();
487
+ if (type === 'left') {
488
+ this.disableMonth().left.set([]);
489
+ if (minDate?.year() === this.listKeyFromSelected().year) {
490
+ for (let i = 1; i < (minDate?.month() + 1); i++) {
491
+ this.disableMonth().left.update(current => {
492
+ current.push(i);
493
+ return current;
494
+ });
495
+ }
496
+ }
497
+ if (maxDate?.year() === this.listKeyFromSelected().year) {
498
+ for (let i = maxDate?.month() + 2; i < 13; i++) {
499
+ this.disableMonth().left.update(current => {
500
+ current.push(i);
501
+ return current;
502
+ });
503
+ }
504
+ }
505
+ return;
506
+ }
507
+ this.disableMonth().right.set([]);
508
+ if (minDate?.year() === this.listKeyToSelected().year) {
509
+ for (let i = 1; i < (minDate?.month() + 1); i++) {
510
+ this.disableMonth().right.update(current => {
511
+ current.push(i);
512
+ return current;
513
+ });
514
+ }
515
+ }
516
+ if (maxDate?.year() === this.listKeyToSelected().year) {
517
+ for (let i = maxDate?.month() + 2; i < 13; i++) {
518
+ this.disableMonth().right.update(current => {
519
+ current.push(i);
520
+ return current;
521
+ });
522
+ }
523
+ }
524
+ if ((Number(this.listKeyFromSelected().year) === Number(this.listKeyToSelected().year))) {
525
+ for (let i = 1; i <= Number(this.listKeyFromSelected().month); i++) {
526
+ this.disableMonth().right.update(current => {
527
+ current.push(i);
528
+ return current;
529
+ });
530
+ }
531
+ }
532
+ }
533
+ handlerClickPrev(side) {
534
+ if (side === SideEnum.left && this.leftCalendar().month) {
535
+ this.leftCalendar.update(current => {
536
+ current.month = current.month?.subtract(1, 'month');
537
+ return current;
538
+ });
539
+ this.listKeyFromSelected.update(current => {
540
+ current.month = (this.leftCalendar().month?.month() ?? 0) + 1;
541
+ current.year = this.leftCalendar().month?.year();
542
+ return current;
543
+ });
544
+ return this.updateCalendars();
545
+ }
546
+ this.rightCalendar.update(current => {
547
+ current.month = current.month?.subtract(1, 'month');
548
+ return current;
549
+ });
550
+ this.listKeyToSelected.update(current => {
551
+ current.month = (this.rightCalendar().month?.month() ?? 0) + 1;
552
+ current.year = this.rightCalendar().month?.year();
553
+ return current;
554
+ });
555
+ this.getDisable('right');
556
+ this.updateCalendars();
557
+ }
558
+ handlerClickNext(side) {
559
+ if (side === SideEnum.left) {
560
+ this.leftCalendar.update(current => {
561
+ current.month = current.month?.add(1, 'month');
562
+ return current;
563
+ });
564
+ this.listKeyFromSelected.update(current => {
565
+ current.month = (this.leftCalendar().month?.month() ?? 0) + 1;
566
+ current.year = this.leftCalendar().month?.year();
567
+ return current;
568
+ });
569
+ if ((this.listKeyFromSelected().month === this.listKeyToSelected().month) && (this.listKeyFromSelected().year === this.listKeyToSelected().year)) {
570
+ this.rightCalendar.update(current => {
571
+ current.month = current.month?.add(1, 'month');
572
+ return current;
573
+ });
574
+ this.listKeyToSelected.update(current => {
575
+ current.month = (this.rightCalendar().month?.month() ?? 0) + 1;
576
+ current.year = this.rightCalendar().month?.year();
577
+ return current;
578
+ });
579
+ }
580
+ this.getDisable('right');
581
+ return this.updateCalendars();
582
+ }
583
+ this.rightCalendar.update(current => {
584
+ current.month = current.month?.add(1, 'month');
585
+ return current;
586
+ });
587
+ this.listKeyToSelected.update(current => {
588
+ current.month = (this.rightCalendar().month?.month() ?? 0) + 1;
589
+ current.year = this.rightCalendar().month?.year();
590
+ return current;
591
+ });
592
+ this.updateCalendars();
593
+ }
594
+ handlerPickerDate(event, side, row, col) {
595
+ event.stopPropagation();
596
+ if (event.target?.tagName === 'TD') {
597
+ if (event.target.classList && !event.target.classList.contains('available')) {
598
+ return;
599
+ }
600
+ }
601
+ if (event.target.tagName === 'SPAN') {
602
+ if (event.target.parentElement && event.target.parentElement.classList && !event.target.parentElement.classList.contains('available')) {
603
+ return;
604
+ }
605
+ }
606
+ if (!this.dateOptions().customRangeLabel) {
607
+ return;
608
+ }
609
+ if (this.quickRangesArray().length) {
610
+ this.selectedQuickRange.set(this.dateOptions().customRangeLabel);
611
+ }
612
+ const date = side === SideEnum.left ? this.leftCalendar().calendar?.[row][col] : this.rightCalendar().calendar?.[row][col];
613
+ if (!date) {
614
+ return;
615
+ }
616
+ this.splitPickerDate.update(current => {
617
+ current[side === SideEnum.left ? 'start' : 'end'].update(sideCurrent => {
618
+ sideCurrent.day = date.date();
619
+ return sideCurrent;
620
+ });
621
+ return current;
622
+ });
623
+ this.updateStartEndDate(date);
624
+ if (this.isSingle() && this.startDate()) {
625
+ this.setEndDate(this.startDate());
626
+ this.updateElement();
627
+ if (this.autoApply()) {
628
+ this.handlerClickApply();
629
+ }
630
+ }
631
+ this.updateView();
632
+ if (this.autoApply() && this.startDate() && this.endDate()) {
633
+ this.handlerClickApply();
634
+ }
635
+ }
636
+ handlerClickApply(event) {
637
+ event?.stopPropagation();
638
+ // this.validate();
639
+ // if (!this.validate()) {
640
+ // return;
641
+ // }
642
+ if (this.hasTimePicker()) {
643
+ this.setTimeInput(SideEnum.left);
644
+ this.setTimeInput(SideEnum.right);
645
+ }
646
+ this.calculateSelectedLabel();
647
+ if (this.selectedLabel()) {
648
+ this.outPickerDate.emit({ displayLabel: this.selectedLabel(), startDate: this.startDate(), endDate: this.endDate(), detailDatePicker: this.splitPickerDate() });
649
+ }
650
+ }
651
+ handlerClickCancel(event) {
652
+ event.stopPropagation();
653
+ this.startDate.set(dayjs(0));
654
+ this.endDate.set(dayjs(0));
655
+ this.outCancel.emit('');
656
+ }
657
+ handlerFunctionControl(event, type) {
658
+ this.functionControls.set(type, event);
659
+ }
660
+ handlerSelectedDropdown(event, type) {
661
+ this.outChangStageFlagMouse.emit({
662
+ isMouseEnter: false,
663
+ isMouseEnterContent: false,
664
+ isContainerHasScroll: false
665
+ });
666
+ if (!event) {
667
+ return;
668
+ }
669
+ switch (type) {
670
+ case `${SideEnum.left}month`:
671
+ case `${SideEnum.right}month`:
672
+ this.updateMonthSelect(event, type);
673
+ break;
674
+ case `${SideEnum.left}year`:
675
+ case `${SideEnum.right}year`:
676
+ this.updateYearSelect(event, type);
677
+ break;
678
+ default:
679
+ break;
680
+ }
681
+ this.splitPickerDate.update(current => {
682
+ if (type === `${SideEnum.left}month` || type === `${SideEnum.left}year`) {
683
+ current.start.update(start => {
684
+ if (type === `${SideEnum.left}month`) {
685
+ start.month = event.key;
686
+ }
687
+ if (type === `${SideEnum.left}year`) {
688
+ start.year = event.key;
689
+ }
690
+ return start;
691
+ });
692
+ return current;
693
+ }
694
+ current.end.update(end => {
695
+ if (type === `${SideEnum.right}month`) {
696
+ end.month = event.key;
697
+ }
698
+ if (type === `${SideEnum.right}year`) {
699
+ end.year = event.key;
700
+ }
701
+ return end;
702
+ });
703
+ return current;
704
+ });
705
+ }
706
+ updateMonthSelect(event, type) {
707
+ const side = type.includes(SideEnum.left) ? SideEnum.left : SideEnum.right;
708
+ const year = this.calendarVariables()[side]().dropdowns?.()?.currentYear || dayjs().year();
709
+ const month = Number(event.key) - 1;
710
+ if (side === SideEnum.left) {
711
+ if (this.isSelectedData().leftmonth) {
712
+ this.isSelectedData.update(current => {
713
+ current.leftmonth = false;
714
+ return current;
715
+ });
716
+ this.getDisable('right');
717
+ return;
718
+ }
719
+ this.listKeyFromSelected.update(current => {
720
+ current.month = event.key;
721
+ return current;
722
+ });
723
+ if (Number(event.key) >= Number(this.listKeyFromSelected().month) && (Number(this.listKeyFromSelected().year) === Number(this.listKeyToSelected().year))) {
724
+ if (Number(event.key) <= 11) {
725
+ this.listKeyToSelected.update(current => {
726
+ current.month = Number(event.key) + 1;
727
+ return current;
728
+ });
729
+ }
730
+ if (Number(event.key) === 12) {
731
+ this.listKeyToSelected.update(current => {
732
+ current.month = 1;
733
+ current.year += 1;
734
+ return current;
735
+ });
736
+ }
737
+ }
738
+ }
739
+ if (side === SideEnum.right) {
740
+ if (this.isSelectedData().rightmonth) {
741
+ this.isSelectedData.update(current => {
742
+ current.rightmonth = false;
743
+ return current;
744
+ });
745
+ this.getDisable('right');
746
+ return;
747
+ }
748
+ this.listKeyToSelected.update(current => {
749
+ current.month = event.key;
750
+ return current;
751
+ });
752
+ }
753
+ this.functionControls.get(type)?.removeList();
754
+ this.getDisable('right');
755
+ this.monthOrYearChanged(month, year, side);
756
+ }
757
+ updateYearSelect(event, type) {
758
+ const side = type.includes(SideEnum.left) ? SideEnum.left : SideEnum.right;
759
+ if (side === SideEnum.left) {
760
+ if (this.isSelectedData()?.leftyear) {
761
+ this.isSelectedData.update(current => {
762
+ current.leftyear = false;
763
+ return current;
764
+ });
765
+ this.getDisable('left');
766
+ // this.SetListYearRight(this.listViewKeySelectedYear as number);
767
+ this.functionControls.get(type)?.removeList();
768
+ return;
769
+ }
770
+ this.listKeyFromSelected.update(current => {
771
+ current.year = event.key;
772
+ return current;
773
+ });
774
+ if (this.listKeyFromSelected().year && this.listKeyToSelected().year && (this.listKeyFromSelected().year >= this.listKeyToSelected().year)) {
775
+ this.listKeyToSelected.update(current => {
776
+ current.year = event.key;
777
+ return current;
778
+ });
779
+ if (this.listKeyFromSelected().month && Number(this.listKeyFromSelected().month) <= 11) {
780
+ this.listKeyToSelected.update(current => {
781
+ current.month = Number(this.listKeyFromSelected().month) + 1;
782
+ return current;
783
+ });
784
+ }
785
+ if (this.listKeyFromSelected().month && this.listKeyFromSelected().month === 12) {
786
+ this.listKeyToSelected.update(current => {
787
+ current.month = Number(this.listKeyFromSelected().month);
788
+ return current;
789
+ });
790
+ }
791
+ }
792
+ this.getDisable('left');
793
+ this.buildConfigYear(SideEnum.right, this.listKeyFromSelected().year);
794
+ this.functionControls.get(type)?.removeList();
795
+ }
796
+ if (side === SideEnum.right) {
797
+ if (this.isSelectedData().rightyear) {
798
+ this.isSelectedData.update(current => {
799
+ current.rightyear = false;
800
+ return current;
801
+ });
802
+ this.getDisable('right');
803
+ return;
804
+ }
805
+ this.listKeyToSelected.update(current => {
806
+ current.year = event.key;
807
+ return current;
808
+ });
809
+ if (this.listKeyFromSelected().year && this.listKeyToSelected().year && (this.listKeyFromSelected().year >= this.listKeyToSelected().year)) {
810
+ if (this.listKeyFromSelected().month && Number(this.listKeyFromSelected().month) <= 11) {
811
+ this.listKeyToSelected.update(current => {
812
+ current.month = Number(this.listKeyFromSelected().month) + 1;
813
+ return current;
814
+ });
815
+ }
816
+ if (this.listKeyFromSelected().month && this.listKeyFromSelected().month === 12) {
817
+ this.listKeyToSelected.update(current => {
818
+ current.month = Number(this.listKeyFromSelected().month);
819
+ return current;
820
+ });
821
+ }
822
+ }
823
+ }
824
+ this.getDisable('right');
825
+ let month = dayjs().month();
826
+ if (side === SideEnum.right && this.listKeyFromSelected().month) {
827
+ month = Number(this.listKeyFromSelected().month) - 1;
828
+ }
829
+ if (side === SideEnum.left && this.listKeyFromSelected().month) {
830
+ month = Number(this.listKeyFromSelected().month) - 1;
831
+ }
832
+ const year = Number(event.key);
833
+ this.monthOrYearChanged(month, year, side);
834
+ }
835
+ monthOrYearChanged(month, year, side) {
836
+ const isLeft = side === SideEnum.left;
837
+ const minDate = this.minDate();
838
+ const maxDate = this.maxDate();
839
+ if (minDate && (year < minDate?.year() || (year === minDate?.year() && month < minDate?.month()))) {
840
+ month = minDate?.month();
841
+ year = minDate?.year();
842
+ }
843
+ if (maxDate && (year > maxDate?.year() || (year === maxDate?.year() && month > maxDate?.month()))) {
844
+ month = maxDate?.month();
845
+ year = maxDate?.year();
846
+ }
847
+ const dropdowns = this.calendarVariables()[side]().dropdowns;
848
+ if (dropdowns?.()) {
849
+ dropdowns.update(current => {
850
+ current.currentYear = year;
851
+ current.currentMonth = month;
852
+ return current;
853
+ });
854
+ }
855
+ if (isLeft && this.leftCalendar().month) {
856
+ this.leftCalendar.update(current => {
857
+ current.month = current.month?.month(month).year(year);
858
+ return current;
859
+ });
860
+ return this.updateCalendars();
861
+ }
862
+ if (month === 12) {
863
+ this.rightCalendar.update(current => {
864
+ current.month = current.month?.clone().add(1, 'month');
865
+ return current;
866
+ });
867
+ return this.updateCalendars();
868
+ }
869
+ this.rightCalendar.update(current => {
870
+ current.month = current.month?.month(month).year(year);
871
+ return current;
872
+ });
873
+ this.updateCalendars();
874
+ }
875
+ handlerInputEvent(event, type) {
876
+ if (event.keyCode !== 8) {
877
+ event.keyCode && this.checkBackspaceFocus.update(current => {
878
+ current[type].set(1);
879
+ return current;
880
+ });
881
+ this.keyCodeBackspace.set(false);
882
+ return;
883
+ }
884
+ this.keyCodeBackspace.set(true);
885
+ switch (type) {
886
+ case 'leftminute':
887
+ if (isEmpty(this.timepickerValueItem().leftminute())) {
888
+ if (this.checkBackspaceFocus()[type]() === 1) {
889
+ this.checkBackspaceFocus.update(current => {
890
+ current[type].set(current[type]() + 1);
891
+ return current;
892
+ });
893
+ return;
894
+ }
895
+ this.checkBackspaceFocus.update(current => {
896
+ current[type].set(1);
897
+ return current;
898
+ });
899
+ this.functionControls.get(`${SideEnum.left}hour`)?.focus();
900
+ }
901
+ break;
902
+ case 'rightminute':
903
+ if (isEmpty(this.timepickerValueItem().rightminute())) {
904
+ if (this.checkBackspaceFocus()[type]() === 1) {
905
+ this.checkBackspaceFocus.update(current => {
906
+ current[type].set(current[type]() + 1);
907
+ return current;
908
+ });
909
+ return;
910
+ }
911
+ this.checkBackspaceFocus.update(current => {
912
+ current[type].set(1);
913
+ return current;
914
+ });
915
+ this.functionControls.get(`${SideEnum.right}hour`)?.focus();
916
+ }
917
+ break;
918
+ }
919
+ }
920
+ handlerFocusAndBlurTime(event, type) {
921
+ if (event.name === 'focus') {
922
+ return;
923
+ }
924
+ const eventInput = event.event;
925
+ const target = eventInput.target;
926
+ switch (type) {
927
+ case 'lefthour':
928
+ this.timepickerVariables().left.update(current => {
929
+ current.selectedHour = !isEmpty(this.timepickerValueItem().lefthour()) ? this.timepickerValueItem().lefthour() : 0;
930
+ return current;
931
+ });
932
+ if ((Number(this.timepickerValueItem().lefthour()) === 0) || isEmpty(this.timepickerValueItem().lefthour())) {
933
+ this.timepickerValueItem.update(current => {
934
+ current.lefthour.set(0);
935
+ return current;
936
+ });
937
+ target.value = '00';
938
+ break;
939
+ }
940
+ if (Number(this.timepickerValueItem().lefthour()) < 10) {
941
+ target.value = `0${Number(this.timepickerValueItem().lefthour())}`;
942
+ }
943
+ break;
944
+ case 'righthour':
945
+ this.timepickerVariables().right.update(current => {
946
+ current.selectedHour = !isEmpty(this.timepickerValueItem().righthour()) ? this.timepickerValueItem().righthour() : 0;
947
+ return current;
948
+ });
949
+ if ((Number(this.timepickerValueItem().righthour()) === 0) || isEmpty(this.timepickerValueItem().righthour())) {
950
+ this.timepickerValueItem.update(current => {
951
+ current.righthour.set(0);
952
+ return current;
953
+ });
954
+ target.value = '00';
955
+ break;
956
+ }
957
+ if (Number(this.timepickerValueItem().righthour()) < 10) {
958
+ target.value = `0${Number(this.timepickerValueItem().righthour())}`;
959
+ }
960
+ break;
961
+ case 'leftminute':
962
+ this.timepickerVariables().left.update(current => {
963
+ current.selectedMinute = !isEmpty(this.timepickerValueItem().leftminute()) ? this.timepickerValueItem().leftminute() : 0;
964
+ return current;
965
+ });
966
+ if ((Number(this.timepickerValueItem().leftminute()) === 0) || isEmpty(this.timepickerValueItem().leftminute())) {
967
+ this.timepickerValueItem.update(current => {
968
+ current.leftminute.set(0);
969
+ return current;
970
+ });
971
+ target.value = '00';
972
+ break;
973
+ }
974
+ if (Number(this.timepickerValueItem().leftminute()) < 10) {
975
+ target.value = `0${Number(this.timepickerValueItem().leftminute())}`;
976
+ }
977
+ break;
978
+ case 'rightminute':
979
+ this.timepickerVariables().right.update(current => {
980
+ current.selectedMinute = !isEmpty(this.timepickerValueItem().rightminute()) ? this.timepickerValueItem().rightminute() : 0;
981
+ return current;
982
+ });
983
+ if ((Number(this.timepickerValueItem().rightminute()) === 0) || isEmpty(this.timepickerValueItem().rightminute())) {
984
+ this.timepickerValueItem.update(current => {
985
+ current.rightminute.set(0);
986
+ return current;
987
+ });
988
+ target.value = '00';
989
+ break;
990
+ }
991
+ if (Number(this.timepickerValueItem().rightminute()) < 10) {
992
+ target.value = `0${Number(this.timepickerValueItem().rightminute())}`;
993
+ }
994
+ break;
995
+ }
996
+ }
997
+ handlerChangeTimeValue(event, type) {
998
+ this.timepickerValueItem.update(current => {
999
+ current[type].set(event);
1000
+ return current;
1001
+ });
1002
+ const side = type.includes(SideEnum.left) ? SideEnum.left : SideEnum.right;
1003
+ const attr = type.includes('hour') ? 'hour' : 'minute';
1004
+ this.splitPickerDate.update(current => {
1005
+ current[side === SideEnum.left ? 'start' : 'end'].update(sideCurrent => {
1006
+ sideCurrent[attr] = event;
1007
+ return sideCurrent;
1008
+ });
1009
+ return current;
1010
+ });
1011
+ if ((type !== 'lefthour' && type !== 'righthour') || event === undefined) {
1012
+ this.isZero.set(false);
1013
+ return;
1014
+ }
1015
+ if ((`${event}`.length === 2) || (Number(event) > 2) || (Number(event) <= 2 && Number(event) > 0 && this.isZero()) || (this.isZero() && !this.keyCodeBackspace())) {
1016
+ this.isZero.set(false);
1017
+ this.functionControls.get(type === 'lefthour' ? `${SideEnum.left}minute` : `${SideEnum.right}minute`)?.focus();
1018
+ return;
1019
+ }
1020
+ if (Number(event) === 0 && !this.keyCodeBackspace()) {
1021
+ this.isZero.set(true);
1022
+ return;
1023
+ }
1024
+ }
1025
+ handlerShowListDropdown(event, type) {
1026
+ this.checkShowListDropdown.update((current) => {
1027
+ current[type] = event;
1028
+ return current;
1029
+ });
1030
+ }
1031
+ convertItemMonth = (item) => {
1032
+ if (!item) {
1033
+ return '';
1034
+ }
1035
+ set(item, 'labelDisplay', this.translate.instant(item.label || ' ', { year: '' }));
1036
+ return item;
1037
+ };
1038
+ convertItemYear = (item) => {
1039
+ if (!item) {
1040
+ return '';
1041
+ }
1042
+ item.labelDisplay = this.translate.instant('i18n_year_param', { year: item.label });
1043
+ return item;
1044
+ };
1045
+ updateMonthsInView() {
1046
+ if (this.endDate()) {
1047
+ if (!this.isSingle() && this.leftCalendar().month && this.rightCalendar().month &&
1048
+ ((this.leftCalendar() && this.startDate()?.format('YYYY-MM') === this.leftCalendar().month?.format('YYYY-MM')) || (this.rightCalendar() && this.startDate()?.format('YYYY-MM') === this.rightCalendar().month?.format('YYYY-MM')))
1049
+ && (this.endDate()?.format('YYYY-MM') === this.leftCalendar().month?.format('YYYY-MM') || this.endDate()?.format('YYYY-MM') === this.rightCalendar().month?.format('YYYY-MM'))) {
1050
+ return;
1051
+ }
1052
+ if (this.startDate()) {
1053
+ this.leftCalendar.update(current => {
1054
+ current.month = this.startDate()?.clone()?.date(2);
1055
+ return current;
1056
+ });
1057
+ if (this.endDate()?.month() !== this.startDate()?.month() || this.endDate()?.year() !== this.startDate()?.year()) {
1058
+ this.rightCalendar.update(current => {
1059
+ current.month = this.endDate()?.clone()?.date(2);
1060
+ return current;
1061
+ });
1062
+ return;
1063
+ }
1064
+ this.rightCalendar.update(current => {
1065
+ current.month = this.startDate()?.clone()?.date(2)?.add(1, 'month');
1066
+ return current;
1067
+ });
1068
+ }
1069
+ }
1070
+ if (this.startDate() && this.leftCalendar().month && this.rightCalendar().month && this.leftCalendar().month?.format('YYYY-MM') !== this.startDate()?.format('YYYY-MM') && this.rightCalendar().month?.format('YYYY-MM') !== this.startDate()?.format('YYYY-MM')) {
1071
+ this.leftCalendar.update(current => {
1072
+ current.month = this.startDate()?.clone()?.date(2);
1073
+ return current;
1074
+ });
1075
+ this.rightCalendar.update(current => {
1076
+ current.month = this.startDate()?.clone()?.date(2)?.add(1, 'month');
1077
+ return current;
1078
+ });
1079
+ }
1080
+ }
1081
+ setTimeInput(side) {
1082
+ const hour = parseInt(`${this.timepickerVariables()[side]().selectedHour}`);
1083
+ const minute = parseInt(`${this.timepickerVariables()[side]().selectedMinute}`);
1084
+ if (side === SideEnum.left && this.startDate()) {
1085
+ let start = this.startDate()?.clone();
1086
+ start = start?.hour(hour);
1087
+ start = start?.minute(minute);
1088
+ this.setStartDate(start);
1089
+ if (this.isSingle()) {
1090
+ this.endDate.set(this.startDate()?.clone());
1091
+ }
1092
+ if (this.endDate() && this.endDate()?.format('YYYY-MM-DD') === start?.format('YYYY-MM-DD') && this.endDate()?.isBefore(start)) {
1093
+ this.setEndDate(start?.clone());
1094
+ }
1095
+ if (!this.endDate() && start && this.hasTimePicker()) {
1096
+ const startClone = this.getDateWithTime(start, SideEnum.right);
1097
+ if (startClone.isBefore(start)) {
1098
+ this.timepickerVariables()[SideEnum.right].update(current => {
1099
+ current.selectedHour = hour;
1100
+ current.selectedMinute = minute;
1101
+ return current;
1102
+ });
1103
+ }
1104
+ }
1105
+ return;
1106
+ }
1107
+ if (this.endDate()) {
1108
+ let end = this.endDate()?.clone();
1109
+ end = end?.hour(hour);
1110
+ end = end?.minute(minute);
1111
+ this.setEndDate(end);
1112
+ }
1113
+ this.updateCalendars();
1114
+ this.renderTimePicker(SideEnum.left);
1115
+ this.renderTimePicker(SideEnum.right);
1116
+ }
1117
+ updateCalendars() {
1118
+ this.renderCalendar(SideEnum.left);
1119
+ this.renderCalendar(SideEnum.right);
1120
+ if (this.endDate() === null) {
1121
+ return;
1122
+ }
1123
+ this.calculateSelectedLabel();
1124
+ }
1125
+ renderCalendar(side) {
1126
+ const mainCalendar = (side === SideEnum.left) ? this.leftCalendar() : this.rightCalendar();
1127
+ if (!mainCalendar.month || (this.dateOptions().firstDay === undefined || this.dateOptions().firstDay === undefined)) {
1128
+ return;
1129
+ }
1130
+ const month = mainCalendar.month.month();
1131
+ const year = mainCalendar.month.year();
1132
+ const hour = mainCalendar.month.hour();
1133
+ const minute = mainCalendar.month.minute();
1134
+ const second = mainCalendar.month.second();
1135
+ const daysInMonth = dayjs(new Date(year, month)).daysInMonth();
1136
+ const firstDay = dayjs(new Date(year, month, 1));
1137
+ const lastDay = dayjs(new Date(year, month, daysInMonth));
1138
+ const lastMonth = dayjs(firstDay).subtract(1, 'month').month();
1139
+ const lastYear = dayjs(firstDay).subtract(1, 'month').year();
1140
+ const daysInLastMonth = dayjs(new Date(lastYear, lastMonth)).daysInMonth();
1141
+ const dayOfWeek = firstDay.day();
1142
+ const calendar = {};
1143
+ calendar.firstDay = firstDay;
1144
+ calendar.lastDay = lastDay;
1145
+ for (let i = 0; i < 6; i++) {
1146
+ calendar[i] = [];
1147
+ }
1148
+ let startDay = daysInLastMonth - dayOfWeek + (this.dateOptions().firstDay ?? 1) + 1;
1149
+ if (startDay > daysInLastMonth) {
1150
+ startDay -= 7;
1151
+ }
1152
+ if (dayOfWeek === this.dateOptions().firstDay) {
1153
+ startDay = daysInLastMonth - 6;
1154
+ }
1155
+ let curDate = dayjs(new Date(lastYear, lastMonth, startDay, 12, minute, second));
1156
+ for (let i = 0, col = 0, row = 0; i < 42; i++, col++, curDate = dayjs(curDate).add(24, 'hour')) {
1157
+ if (i > 0 && col % 7 === 0) {
1158
+ col = 0;
1159
+ row++;
1160
+ }
1161
+ calendar[row][col] = curDate.clone().hour(hour).minute(minute).second(second);
1162
+ curDate = curDate.hour(12);
1163
+ const minDate = this.minDate();
1164
+ const maxDate = this.maxDate();
1165
+ if (minDate && calendar[row][col].format('YYYY-MM-DD') === minDate?.format('YYYY-MM-DD') && calendar[row][col].isBefore(minDate) && side === 'left') {
1166
+ calendar[row][col] = minDate?.clone();
1167
+ }
1168
+ if (maxDate && calendar[row][col].format('YYYY-MM-DD') === maxDate?.format('YYYY-MM-DD') && calendar[row][col].isAfter(maxDate) && side === 'right') {
1169
+ calendar[row][col] = maxDate?.clone();
1170
+ }
1171
+ }
1172
+ if (side === SideEnum.left) {
1173
+ this.leftCalendar.update(current => {
1174
+ current.calendar = calendar;
1175
+ return current;
1176
+ });
1177
+ }
1178
+ if (side === SideEnum.right) {
1179
+ this.rightCalendar.update(current => {
1180
+ current.calendar = calendar;
1181
+ return current;
1182
+ });
1183
+ }
1184
+ const minDate = side === 'left' ? this.minDate() : this.startDate();
1185
+ const maxDate = this.maxDate();
1186
+ this.calendarVariables()[side].set({
1187
+ month: month,
1188
+ year: year,
1189
+ hour: hour,
1190
+ minute: minute,
1191
+ second: second,
1192
+ daysInMonth: daysInMonth,
1193
+ firstDay: firstDay,
1194
+ lastDay: lastDay,
1195
+ lastMonth: lastMonth,
1196
+ lastYear: lastYear,
1197
+ daysInLastMonth: daysInLastMonth,
1198
+ dayOfWeek: dayOfWeek,
1199
+ calRows: signal(Array.from(Array(6).keys())),
1200
+ calCols: signal(Array.from(Array(7).keys())),
1201
+ classes: {},
1202
+ minDate: minDate,
1203
+ maxDate: maxDate,
1204
+ calendar: calendar,
1205
+ dropdowns: signal({})
1206
+ });
1207
+ if (this.showDropdownsSelect()) {
1208
+ const currentMonth = calendar[1][1].month();
1209
+ const currentYear = calendar[1][1].year();
1210
+ const maxYear = (maxDate && maxDate?.year()) || DEFAULT_MAX_YEAR;
1211
+ const minYear = (minDate && minDate?.year()) || DEFAULT_MIN_YEAR;
1212
+ const inMinYear = currentYear === minYear;
1213
+ const inMaxYear = currentYear === maxYear;
1214
+ const years = [];
1215
+ for (let y = minYear; y <= maxYear; y++) {
1216
+ years.push(y);
1217
+ }
1218
+ this.calendarVariables()[side]().dropdowns?.set({
1219
+ currentMonth: currentMonth,
1220
+ currentYear: currentYear,
1221
+ maxYear: maxYear,
1222
+ minYear: minYear,
1223
+ inMinYear: inMinYear,
1224
+ inMaxYear: inMaxYear,
1225
+ monthArrays: signal(Array.from(Array(12).keys())),
1226
+ yearArrays: signal(years)
1227
+ });
1228
+ }
1229
+ this.buildCells(calendar, side);
1230
+ }
1231
+ buildCells(calendar, side) {
1232
+ for (let row = 0; row < 6; row++) {
1233
+ const classless = this.calendarVariables()[side]();
1234
+ if (classless.classes) {
1235
+ classless.classes[row] = {};
1236
+ }
1237
+ for (let col = 0; col < 7; col++) {
1238
+ const classes = [];
1239
+ const startDate = this.startDate();
1240
+ const endDate = this.endDate();
1241
+ const nowHoveredDate = this.nowHoveredDate();
1242
+ if (calendar[row][col].isSame(new Date(), 'day')) {
1243
+ classes.push('today');
1244
+ }
1245
+ if (calendar[row][col].isoWeekday() > 5) {
1246
+ classes.push('weekend');
1247
+ }
1248
+ if (calendar[row][col].month() !== calendar[1][1].month()) {
1249
+ classes.push('off');
1250
+ }
1251
+ if (this.minDate() && calendar[row][col].isBefore(this.minDate(), 'day')) {
1252
+ classes.push('off', 'disabled');
1253
+ }
1254
+ if (this.calendarVariables()[side]().maxDate && calendar[row][col].isAfter(this.calendarVariables()[side]().maxDate, 'day')) {
1255
+ classes.push('off', 'disabled');
1256
+ }
1257
+ if (startDate && calendar[row][col].format('YYYY-MM-DD') === startDate?.format('YYYY-MM-DD')) {
1258
+ classes.push('active', 'start-date');
1259
+ }
1260
+ if (endDate !== null && calendar[row][col].format('YYYY-MM-DD') === endDate?.format('YYYY-MM-DD')) {
1261
+ classes.push('active', 'end-date');
1262
+ }
1263
+ if (startDate && calendar[row][col].format('YYYY-MM-DD') === startDate?.format('YYYY-MM-DD') && (!endDate || endDate !== null && calendar[row][col].format('YYYY-MM-DD') === endDate?.format('YYYY-MM-DD'))) {
1264
+ classes.push('active', 'full-date');
1265
+ }
1266
+ if (startDate && endDate && ((nowHoveredDate !== null && this.pickingDate()) || endDate !== null) && (calendar[row][col] > startDate && (calendar[row][col] < endDate || (nowHoveredDate && calendar[row][col] < nowHoveredDate && this.pickingDate())))) {
1267
+ classes.push(!classes.find(el => el === 'off') ? 'in-range' : 'focus-off');
1268
+ }
1269
+ let cname = '', disabled = false;
1270
+ for (let i = 0; i < classes.length; i++) {
1271
+ cname += classes[i] + ' ';
1272
+ if (classes[i] === 'disabled') {
1273
+ disabled = true;
1274
+ }
1275
+ ;
1276
+ }
1277
+ if (!disabled) {
1278
+ cname += 'available';
1279
+ }
1280
+ if (classless.classes) {
1281
+ classless.classes[row][col] = cname.replace(/^\s+|\s+$/g, '');
1282
+ }
1283
+ }
1284
+ }
1285
+ }
1286
+ renderTimePicker(side) {
1287
+ let selected = dayjs(), minDate;
1288
+ const maxDate = this.maxDate();
1289
+ const startDate = this.startDate();
1290
+ const endDate = this.endDate();
1291
+ if (side === SideEnum.left && startDate) {
1292
+ selected = startDate.clone();
1293
+ minDate = this.maxDate();
1294
+ }
1295
+ if (side === SideEnum.right && endDate) {
1296
+ selected = endDate.clone();
1297
+ minDate = this.startDate();
1298
+ }
1299
+ if (side === SideEnum.right && !endDate) {
1300
+ if (!startDate) {
1301
+ return;
1302
+ }
1303
+ selected = this.getDateWithTime(startDate, SideEnum.right);
1304
+ if (selected.isBefore(startDate)) {
1305
+ selected = startDate.clone();
1306
+ }
1307
+ minDate = startDate;
1308
+ }
1309
+ const start = 0;
1310
+ const end = 23;
1311
+ this.timepickerVariables()[side].set({
1312
+ hours: [],
1313
+ minutes: [],
1314
+ minutesLabel: [],
1315
+ seconds: [],
1316
+ secondsLabel: [],
1317
+ disabledHours: [],
1318
+ disabledMinutes: [],
1319
+ disabledSeconds: [],
1320
+ selectedHour: 0,
1321
+ selectedMinute: 0,
1322
+ selectedSecond: 0,
1323
+ });
1324
+ for (let i = start; i <= end; i++) {
1325
+ const i_in_24 = i;
1326
+ const time = selected.clone().hour(i_in_24);
1327
+ let disabled = false;
1328
+ if (minDate && time.minute(59).isBefore(minDate)) {
1329
+ disabled = true;
1330
+ }
1331
+ if (maxDate && time.minute(0).isAfter(maxDate)) {
1332
+ disabled = true;
1333
+ }
1334
+ this.timepickerVariables()[side].update(current => {
1335
+ current.hours?.push(i);
1336
+ if (i_in_24 === selected.hour() && !disabled) {
1337
+ current.selectedHour = i;
1338
+ }
1339
+ if (disabled) {
1340
+ current.disabledHours?.push(i);
1341
+ }
1342
+ return current;
1343
+ });
1344
+ }
1345
+ for (let i = 0; i < 60; i += this.timePickerIncrement()) {
1346
+ const padded = i < 10 ? '0' + i : `${i}`;
1347
+ const time = selected.clone().minute(i);
1348
+ let disabled = false;
1349
+ if (minDate && time.second(59).isBefore(minDate)) {
1350
+ disabled = true;
1351
+ }
1352
+ if (maxDate && time.second(0).isAfter(maxDate)) {
1353
+ disabled = true;
1354
+ }
1355
+ this.timepickerVariables()[side].update(current => {
1356
+ current.minutes?.push(i);
1357
+ current.minutesLabel?.push(padded);
1358
+ if (selected.minute() === i && !disabled) {
1359
+ current.selectedMinute = i;
1360
+ }
1361
+ if (disabled) {
1362
+ current.disabledMinutes?.push(i);
1363
+ }
1364
+ return current;
1365
+ });
1366
+ }
1367
+ this.timepickerVariables()[side].update(current => {
1368
+ current.selected = selected;
1369
+ return current;
1370
+ });
1371
+ }
1372
+ updateElement() {
1373
+ if (this.isSingle() && this.startDate()) {
1374
+ this.selectedLabel.set(this.startDate()?.format('DD/MM/YYYY'));
1375
+ return;
1376
+ }
1377
+ if (this.startDate() && this.endDate()) {
1378
+ // if we use ranges and should show range label on input
1379
+ if (this.quickRangesArray().length && this.showRangeLabelOnInput() && this.selectedQuickRange() && this.dateOptions().customRangeLabel !== this.selectedQuickRange()) {
1380
+ this.selectedLabel.set(this.selectedQuickRange());
1381
+ return;
1382
+ }
1383
+ this.selectedLabel.set(`${this.startDate()?.format('DD/MM/YYYY')}${this.dateOptions().separator}${this.endDate()?.format('DD/MM/YYYY')}`);
1384
+ }
1385
+ }
1386
+ updateView() {
1387
+ if (this.hasTimePicker()) {
1388
+ this.renderTimePicker(SideEnum.left);
1389
+ this.renderTimePicker(SideEnum.right);
1390
+ }
1391
+ this.updateMonthsInView();
1392
+ this.updateCalendars();
1393
+ }
1394
+ getDateWithTime(date, side) {
1395
+ const hour = parseInt(`${this.timepickerVariables()[side]().selectedHour}`, 10);
1396
+ const minute = parseInt(`${this.timepickerVariables()[side]().selectedMinute}`, 10);
1397
+ const second = this.hasSecondPicker() && !isEmpty(this.timepickerVariables()[side]().selectedSecond) ? parseInt(`${this.timepickerVariables()[side]().selectedSecond}`, 10) : 0;
1398
+ return date.clone().hour(hour).minute(minute).second(second);
1399
+ }
1400
+ transformMinMaxDate(value) {
1401
+ if (isEmpty(value)) {
1402
+ return undefined;
1403
+ }
1404
+ if (dayjs.isDayjs(value)) {
1405
+ return value;
1406
+ }
1407
+ if (typeof value === 'string') {
1408
+ return dayjs(value);
1409
+ }
1410
+ return undefined;
1411
+ }
1412
+ computedDisplayTime(side) {
1413
+ let strHours = side.selectedHour;
1414
+ let strMinute = side.selectedMinute;
1415
+ if ((side.selectedHour || 0) < 10) {
1416
+ strHours = `0${side.selectedHour ?? 0}`;
1417
+ }
1418
+ if ((side.selectedMinute || 0) < 10) {
1419
+ strMinute = `0${side.selectedMinute ?? 0}`;
1420
+ }
1421
+ return `${strHours}:${strMinute}`;
1422
+ }
1423
+ computedDisplayTimeInput(side, timeType) {
1424
+ const time = timeType === 'hour' ? (side === SideEnum.left ? this.timepickerValueItem().lefthour() : this.timepickerValueItem().righthour()) : (side === SideEnum.left ? this.timepickerValueItem().leftminute() : this.timepickerValueItem().rightminute());
1425
+ if (!time) {
1426
+ return '00';
1427
+ }
1428
+ if (time < 10) {
1429
+ return `0${time}`;
1430
+ }
1431
+ return time;
1432
+ }
1433
+ ngOnDestroy() {
1434
+ console.log('ngOnDestroy');
1435
+ }
1436
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsDatetimePickerCustomRangesCalendarComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1437
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsDatetimePickerCustomRangesCalendarComponent, isStandalone: true, selector: "libs_ui-components-datetime-picker-custom_ranges-calendar", inputs: { quickRangesArray: { classPropertyName: "quickRangesArray", publicName: "quickRangesArray", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, classInclude: { classPropertyName: "classInclude", publicName: "classInclude", isSignal: true, isRequired: false, transformFunction: null }, isSingle: { classPropertyName: "isSingle", publicName: "isSingle", isSignal: true, isRequired: false, transformFunction: null }, showDropdownsSelect: { classPropertyName: "showDropdownsSelect", publicName: "showDropdownsSelect", isSignal: true, isRequired: false, transformFunction: null }, hasTimePicker: { classPropertyName: "hasTimePicker", publicName: "hasTimePicker", isSignal: true, isRequired: false, transformFunction: null }, flagMouse: { classPropertyName: "flagMouse", publicName: "flagMouse", isSignal: true, isRequired: false, transformFunction: null }, dateOptions: { classPropertyName: "dateOptions", publicName: "dateOptions", isSignal: true, isRequired: false, transformFunction: null }, autoApply: { classPropertyName: "autoApply", publicName: "autoApply", isSignal: true, isRequired: false, transformFunction: null }, hasSecondPicker: { classPropertyName: "hasSecondPicker", publicName: "hasSecondPicker", isSignal: true, isRequired: false, transformFunction: null }, showRangeLabelOnInput: { classPropertyName: "showRangeLabelOnInput", publicName: "showRangeLabelOnInput", isSignal: true, isRequired: false, transformFunction: null }, startDate: { classPropertyName: "startDate", publicName: "startDate", isSignal: true, isRequired: false, transformFunction: null }, endDate: { classPropertyName: "endDate", publicName: "endDate", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, maxDate: { classPropertyName: "maxDate", publicName: "maxDate", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { startDate: "startDateChange", endDate: "endDateChange", outChangStageFlagMouse: "outChangStageFlagMouse", outPickerDate: "outPickerDate", outCancel: "outCancel", outUpdateWidth: "outUpdateWidth", outFunctionsControl: "outFunctionsControl" }, viewQueries: [{ propertyName: "pickerContainer", first: true, predicate: ["pickerContainer"], descendants: true, isSignal: true }], ngImport: i0, template: "<div class=\"libs-ui-component-custom_ranges-calendar test-class\">\n <div class=\"relative flex\">\n <div class=\"libs-ui-component-custom_ranges-calendar\"\n [class.right]=\"isSingle()\"\n [class.left]=\"!isSingle()\">\n <div class=\"rounded-[4px] bg-[#ffffff]\">\n @if (calendarVariables(); as calendarVariables) {\n <table>\n <thead>\n <tr>\n <th colspan=\"7\"\n class=\"month\">\n @if (showDropdownsSelect() && calendarVariables.left().dropdowns?.()) {\n <div class=\"!flex mb-[10px] w-full\">\n <div class=\"w-3/4 flex items-center\">\n <div class='mr-[8px]'>\n <libs_ui-components-dropdown [isNgContent]=\"true\"\n [zIndex]=\"zIndex() + 1\"\n [popoverCustomConfig]=\"{widthByParent:false,ignoreArrow:true,paddingLeftItem: true, classInclude: '!w-[130px]',position:{ mode:'center',distance:0}}\"\n [listMaxItemShow]=\"10\"\n [listClickExactly]=\"false\"\n [listKeysDisable]=\"disableMonth().left()\"\n [listHasButtonUnSelectOption]=\"false\"\n [convertItemSelected]=\"convertItemMonth\"\n [listConfig]=\"listMonthsConfig()\"\n [listKeySelected]=\"listKeyFromSelected().month\"\n [flagMouse]=\"flagMouse()\"\n [listHiddenInputSearch]=\"true\"\n [httpRequestDetailItemById]=\"monthHttpDetailConfig()\"\n (outSelectKey)=\"handlerSelectedDropdown($event, sideEnum.left + 'month')\"\n (outFunctionsControl)=\"handlerFunctionControl($event, sideEnum.left + 'month')\"\n (outChangStageFlagMouse)=\"handlerChangeFlagMouse($event)\"\n (outShowList)=\"handlerShowListDropdown($event, sideEnum.left + 'month')\">\n <div class=\"libs-ui-component-custom_ranges-calendar-dropdown\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.left + 'month']\"\n [class.text-[#6a7383]]=\"!checkShowListDropdown()[sideEnum.left + 'month']\">\n <div class=\"libs-ui-font-h4m\"\n [style.fontWeight]=\"500\"\n [style.fontStyle]=\"'normal'\">\n {{ dateOptions().monthNames && calendarVariables.left().calendar && dateOptions().monthNames[calendarVariables.left().calendar?.[1]?.[1]?.month() ?? -1] }}\n </div>\n <i class=\"libs-ui-icon-chevron-right text-[13px] text-[#6a7383]\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.left + 'month']\"\n [style.fontWeight]=\"500\"\n [style.rotate]=\"!checkShowListDropdown()[sideEnum.left + 'month'] ? '90deg':'270deg'\"></i>\n </div>\n </libs_ui-components-dropdown>\n </div>\n <div>\n <libs_ui-components-dropdown [listMaxItemShow]=\"10\"\n [isNgContent]=\"true\"\n [zIndex]=\"zIndex() + 1\"\n [popoverCustomConfig]=\"{widthByParent:false,ignoreArrow:true,paddingLeftItem: true,classInclude: '!w-[110px]',position:{mode:'center',distance:0}}\"\n [listClickExactly]=\"false\"\n [listHasButtonUnSelectOption]=\"false\"\n [convertItemSelected]=\"convertItemYear\"\n [listHiddenInputSearch]=\"true\"\n [listConfig]=\"listLeftYearConfig()\"\n [listKeySelected]=\"listKeyFromSelected().year\"\n [flagMouse]=\"flagMouse()\"\n [httpRequestDetailItemById]=\"leftYearHttpDetailConfig()\"\n (outChangStageFlagMouse)=\"handlerChangeFlagMouse($event)\"\n (outShowList)=\"handlerShowListDropdown($event, sideEnum.left + 'year')\"\n (outSelectKey)=\"handlerSelectedDropdown($event, sideEnum.left + 'year')\"\n (outFunctionsControl)=\"handlerFunctionControl($event, sideEnum.left + 'year')\">\n <div class=\"libs-ui-component-custom_ranges-calendar-dropdown\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.left + 'year']\"\n [class.text-[#6a7383]]=\"!checkShowListDropdown()[sideEnum.left + 'year']\">\n <div class=\"libs-ui-font-h4m\"\n [style.fontWeight]=\"500\"\n [style.fontStyle]=\"'normal'\">{{ calendarVariables.left().calendar && calendarVariables.left().calendar?.[1]?.[1]?.format(\" YYYY\") }}</div>\n <i class=\"libs-ui-icon-chevron-right text-[13px] text-[#6a7383]\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.left + 'year']\"\n [style.fontWeight]=\"500\"\n [style.rotate]=\"!checkShowListDropdown()[sideEnum.left + 'year'] ? '90deg':'270deg'\"></i>\n </div>\n </libs_ui-components-dropdown>\n </div>\n </div>\n\n <div class=\"w-1/4 flex items-center relative\">\n @if (!calendarVariables.left().minDate || (calendarVariables.left().minDate?.isBefore(calendarVariables.left().calendar && calendarVariables.left().calendar?.firstDay))) {\n <div (click)=\"handlerClickPrev(sideEnum.left)\">\n <div class=\"flex items-center justify-center absolute left-0 top-[-3px]\">\n <i class=\"libs-ui-icon-chevron-right rotate-[180deg] text-[#6a7383] cursor-pointer libs-ui-component-custom_ranges-calendar-icon\"></i>\n </div>\n </div>\n }\n @if ((!calendarVariables.left().maxDate || calendarVariables.left().maxDate?.isAfter(calendarVariables.left().calendar && calendarVariables.left().calendar?.lastDay)) && isSingle()) {\n <div (click)=\"handlerClickNext(sideEnum.left)\">\n <div class=\"flex items-center justify-center ml-[12px] absolute right-0 top-[-3px]\">\n <i class=\"libs-ui-icon-chevron-right text-[#6a7383] cursor-pointer libs-ui-component-custom_ranges-calendar-icon\"></i>\n </div>\n </div>\n }\n </div>\n </div>\n }\n @if (!showDropdownsSelect() || !calendarVariables.left().dropdowns) {\n {{ dateOptions().monthNames && calendarVariables.left().calendar && dateOptions().monthNames[calendarVariables.left().calendar?.[1]?.[1]?.month() ?? -1] }}\n {{ calendarVariables.left().calendar && calendarVariables.left().calendar?.[1]?.[1]?.format(\" YYYY\") }}\n }\n </th>\n </tr>\n <tr class=\"week-days\">\n @for (dayofweek of dateOptions().daysOfWeek; track dayofweek) {\n <th>\n <span class=\"libs-ui-font-h6m text-[#6a7383]\"\n [style.fontWeight]=\"500\"\n [style.fontStyle]=\"'normal'\">{{ dayofweek }}</span>\n </th>\n }\n </tr>\n </thead>\n <tbody class=\"drp-animate\">\n @for (row of calendarVariables.left().calRows?.(); track row) {\n <tr class=\"h-[32px]\"\n [class]=\"calendarVariables.left().classes && calendarVariables.left().classes?.[row]?.classList\">\n @for (col of calendarVariables.left().calCols?.(); track col) {\n <td class=\"libs-ui-font-h5r\"\n [class.today]=\"calendarVariables.left().calendar && calendarVariables.left().calendar?.[row]?.[col]?.date() === today().date() && calendarVariables.left().calendar?.[row]?.[col]?.month() === today().month() && calendarVariables.left().calendar?.[row]?.[col]?.year() === today().year()\"\n [class]=\"calendarVariables.left().classes && calendarVariables.left().classes?.[row]?.[col]\"\n (click)=\"handlerPickerDate($event, sideEnum.left, row, col)\"\n (mouseenter)=\"handlerHoverDate($event, sideEnum.left, row, col)\">\n <span class=\"libs-ui-font-h5r\">{{ calendarVariables.left().calendar && calendarVariables.left().calendar?.[row]?.[col]?.date() }}</span>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n }\n </div>\n @if (hasTimePicker()) {\n <div>\n <div class=\"flex justify-center column items-center pt-[12px]\">\n <div class=\"w-full flex justify-center items-center rounded-[4px] border\"\n [class.border-[#e6e8ed]]=\"!timePickerError()\"\n [class.border-[#ff5454]]=\"timePickerError()\">\n <libs_ui-components-inputs-input classInclude=\"!w-[30px] !p-0 !border-none !text-center libs-ui-font-h4s !text-[#071631]\"\n dataType=\"int\"\n [focusTimeOut]=\"0\"\n [blurTimeOut]=\"0\"\n [autoAddZeroLessThan10InTypeInt]=\"true\"\n [emitEmptyInDataTypeNumber]=\"true\"\n [maxValueNumber]=\"23\"\n [minValueNumber]=\"0\"\n [maxLength]=\"2\"\n [value]=\"timepickerValueItem().lefthour()\"\n (outInputEvent)=\"handlerInputEvent($event, 'lefthour')\"\n (outFunctionsControl)=\"handlerFunctionControl($event, sideEnum.left + 'hour')\"\n (outChange)=\"handlerChangeTimeValue($event, 'lefthour')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlurTime($event, 'lefthour')\" />\n <span class=\"libs-ui-font-h3s text-[#333333]\">:</span>\n <libs_ui-components-inputs-input classInclude=\"!w-[30px] !p-0 !border-none !text-center !libs-ui-font-h4s !text-[#071631]\"\n [autoAddZeroLessThan10InTypeInt]=\"true\"\n [emitEmptyInDataTypeNumber]=\"true\"\n dataType=\"int\"\n [focusTimeOut]=\"0\"\n [blurTimeOut]=\"0\"\n [maxValueNumber]=\"59\"\n [minValueNumber]=\"0\"\n [maxLength]=\"2\"\n [value]=\"timepickerValueItem().leftminute()\"\n (outFunctionsControl)=\"handlerFunctionControl($event, sideEnum.left + 'minute')\"\n (outInputEvent)=\"handlerInputEvent($event, 'leftminute')\"\n (outChange)=\"handlerChangeTimeValue($event, 'leftminute')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlurTime($event, 'leftminute')\" />\n </div>\n </div>\n </div>\n }\n </div>\n\n @if (!isSingle()) {\n <div class=\"libs-ui-component-custom_ranges-calendar right ml-[24px]\">\n <div class=\"rounded-[4px] bg-[#ffffff]\">\n @if (calendarVariables()) {\n <table>\n <thead>\n <tr>\n <th colspan=\"7\"\n class=\"month\">\n @if (showDropdownsSelect() && calendarVariables().left().dropdowns?.()) {\n <div class=\"!flex mb-[10px] w-full\">\n <div class=\"w-3/4 flex items-center\">\n <div class='mr-[8px]'>\n <libs_ui-components-dropdown [isNgContent]=\"true\"\n [zIndex]=\"zIndex() + 1\"\n [popoverCustomConfig]=\"{widthByParent:false,ignoreArrow:true,paddingLeftItem: true,classInclude: '!w-[130px]',position:{mode:'center',distance:0}}\"\n [listMaxItemShow]=\"10\"\n [listClickExactly]=\"false\"\n [listKeysDisable]=\"disableMonth().right()\"\n [listHasButtonUnSelectOption]=\"false\"\n [convertItemSelected]=\"convertItemMonth\"\n [listHiddenInputSearch]=\"true\"\n [listConfig]=\"listMonthsConfig()\"\n [listKeySelected]=\"listKeyToSelected().month\"\n [flagMouse]=\"flagMouse()\"\n [httpRequestDetailItemById]=\"monthHttpDetailConfig()\"\n (outFunctionsControl)=\"handlerFunctionControl($event, sideEnum.right + 'month')\"\n (outSelectKey)=\"handlerSelectedDropdown($event, sideEnum.right + 'month')\"\n (outChangStageFlagMouse)=\"handlerChangeFlagMouse($event)\"\n (outShowList)=\"handlerShowListDropdown($event, sideEnum.right + 'month')\">\n <div class=\"libs-ui-component-custom_ranges-calendar-dropdown\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.right + 'month']\"\n [class.text-[#6a7383]]=\"!checkShowListDropdown()[sideEnum.right + 'month']\">\n <div class=\"libs-ui-font-h4m\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.right + 'month']\"\n [style.fontWeight]=\"500\"\n [style.fontStyle]=\"'normal'\">\n {{ dateOptions().monthNames && calendarVariables().right().calendar && dateOptions().monthNames[ calendarVariables().right().calendar?.[1]?.[1]?.month() ?? -1] }}\n </div>\n <i class=\"libs-ui-icon-chevron-right text-[13px] text-[#6a7383]\"\n [style.fontWeight]=\"500\"\n [style.rotate]=\"!checkShowListDropdown()[sideEnum.right + 'month'] ? '90deg':'270deg'\"></i>\n </div>\n </libs_ui-components-dropdown>\n </div>\n <div>\n <libs_ui-components-dropdown [listMaxItemShow]=\"10\"\n [zIndex]=\"zIndex() + 1\"\n [isNgContent]=\"true\"\n [popoverCustomConfig]=\"{widthByParent:false,ignoreArrow:true,paddingLeftItem: true, classInclude: '!w-[110px]', position:{mode:'center', distance:0}}\"\n [listClickExactly]=\"false\"\n [listHasButtonUnSelectOption]=\"false\"\n [convertItemSelected]=\"convertItemYear\"\n [listHiddenInputSearch]=\"true\"\n [listConfig]=\"listRightYearConfig()\"\n [listKeySelected]=\"listKeyToSelected().year\"\n [flagMouse]=\"flagMouse()\"\n [httpRequestDetailItemById]=\"rightYearHttpDetailConfig()\"\n (outSelectKey)=\"handlerSelectedDropdown($event, sideEnum.right + 'year')\"\n (outFunctionsControl)=\"handlerFunctionControl($event, sideEnum.right + 'year')\"\n (outChangStageFlagMouse)=\"handlerChangeFlagMouse($event)\"\n (outShowList)=\"handlerShowListDropdown($event, sideEnum.right + 'year')\">\n <div class=\"libs-ui-component-custom_ranges-calendar-dropdown\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.right + 'year']\"\n [class.text-[#6a7383]]=\"!checkShowListDropdown()[sideEnum.right + 'year']\">\n <div class=\"libs-ui-font-h4m\"\n [style.fontWeight]=\"500\"\n [style.fontStyle]=\"'normal'\">\n {{ calendarVariables().right().calendar && calendarVariables().right().calendar?.[1]?.[1]?.format(\"YYYY\") }}\n </div>\n <i class=\"libs-ui-icon-chevron-right text-[13px] text-[#6a7383]\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.right + 'year']\"\n [style.fontWeight]=\"500\"\n [style.rotate]=\"!checkShowListDropdown()[sideEnum.right + 'year'] ? '90deg':'270deg'\"></i>\n </div>\n </libs_ui-components-dropdown>\n </div>\n </div>\n <div class=\"w-1/4 flex items-center relative\">\n @if (listKeyFromSelected().year && listKeyToSelected().year && !(((listKeyFromSelected().year +1) === listKeyToSelected().year) && (listKeyFromSelected().month === 12) && listKeyToSelected().month === 1)&& (listKeyFromSelected().year < listKeyToSelected().year) || listKeyFromSelected().month && listKeyToSelected().month && ((listKeyFromSelected().month + 1) < +listKeyToSelected().month)) {\n <div class=\"flex items-center justify-center absolute left-0 top-[-3px]\"\n (click)=\"handlerClickPrev(sideEnum.right)\">\n <i class=\"libs-ui-icon-chevron-right rotate-[180deg] text-[#6a7383] cursor-pointer libs-ui-component-custom_ranges-calendar-icon\"></i>\n </div>\n }\n @if (listKeyFromSelected().month && listKeyToSelected().month && (listKeyFromSelected().month > listKeyToSelected().month) && listKeyFromSelected().year && listKeyToSelected().year && (listKeyFromSelected().year === listKeyToSelected().year )) {\n <div class=\"bg-[#ffffff] w-[21px] h-[21px] cursor-none flex items-center justify-center rounded-[50px]\">\n </div>\n }\n @if (!calendarVariables().right().maxDate || (calendarVariables().right().maxDate?.isAfter(calendarVariables().right().calendar && calendarVariables().right().calendar?.lastDay))) {\n <div (click)=\"handlerClickNext(sideEnum.right)\">\n <div class=\"flex items-center justify-center ml-[12px] absolute right-0 top-[-3px]\">\n <i class=\"libs-ui-icon-chevron-right text-[#6a7383] cursor-pointer libs-ui-component-custom_ranges-calendar-icon\"></i>\n </div>\n </div>\n }\n </div>\n </div>\n }\n @if (!showDropdownsSelect() || !calendarVariables().right().dropdowns) {\n {{ dateOptions().monthNames && calendarVariables().right().calendar && dateOptions().monthNames[calendarVariables().right().calendar?.[1]?.[1]?.month() ?? -1] }}\n {{ calendarVariables().right().calendar && calendarVariables().right().calendar?.[1]?.[1]?.format(\"YYYY\") }}\n }\n </th>\n </tr>\n <tr class=\"week-days\">\n @for (dayofweek of dateOptions().daysOfWeek; track dayofweek) {\n <th>\n <span class=\"libs-ui-font-h6m text-[#6a7383]\"\n [style.fontWeight]=\"500\"\n [style.fontStyle]=\"'normal'\">{{ dayofweek }}</span>\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of calendarVariables().right().calRows?.(); track row) {\n <tr class=\"h-[32px]\"\n [class]=\"calendarVariables().right().classes && calendarVariables().right().classes?.[row]?.classList\">\n @for (col of calendarVariables().right().calCols?.(); track col) {\n <td class=\"libs-ui-font-h5r\"\n [class]=\"calendarVariables().right().classes && calendarVariables().right().classes?.[row]?.[col]\"\n [class.today]=\"calendarVariables().right().calendar && calendarVariables().right().calendar?.[row]?.[col]?.date() === today().date() && calendarVariables().right().calendar?.[row]?.[col]?.month() === today().month() && calendarVariables().right().calendar &&calendarVariables().right().calendar?.[row]?.[col]?.year() === today().year()\"\n (click)=\"handlerPickerDate($event, sideEnum.right, row, col)\"\n (mouseenter)=\"handlerHoverDate($event, sideEnum.right, row, col)\">\n <span>{{ calendarVariables().right().calendar?.[row]?.[col]?.date() }}</span>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n }\n </div>\n @if (hasTimePicker()) {\n <div>\n <div class=\"flex justify-center items-center pt-[12px]\">\n <div class=\"w-full flex justify-center items-center rounded-[4px] border\"\n [class.border-[#e6e8ed]]=\"!timePickerError()\"\n [class.border-[#ff5454]]=\"timePickerError()\">\n <libs_ui-components-inputs-input classInclude=\"!w-[30px] !p-0 !border-none !text-center !libs-ui-font-h4s !text-[#071631]\"\n dataType=\"int\"\n [autoAddZeroLessThan10InTypeInt]=\"true\"\n [emitEmptyInDataTypeNumber]=\"true\"\n [maxValueNumber]=\"23\"\n [minValueNumber]=\"0\"\n [focusTimeOut]=\"0\"\n [blurTimeOut]=\"0\"\n [maxLength]=\"2\"\n [value]=\"timepickerValueItem().righthour()\"\n (outChange)=\"handlerChangeTimeValue($event, 'righthour')\"\n (outInputEvent)=\"handlerInputEvent($event,'righthour')\"\n (outFunctionsControl)=\"handlerFunctionControl($event, 'righthour')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlurTime($event, 'righthour')\" />\n <span class=\"libs-ui-font-h3s text-[#333333]\">:</span>\n <libs_ui-components-inputs-input classInclude=\"!w-[30px] !p-0 !border-none !text-center libs-ui-font-h4s !text-[#071631]\"\n dataType=\"int\"\n [autoAddZeroLessThan10InTypeInt]=\"true\"\n [emitEmptyInDataTypeNumber]=\"true\"\n [maxValueNumber]=\"59\"\n [minValueNumber]=\"0\"\n [focusTimeOut]=\"0\"\n [blurTimeOut]=\"0\"\n [maxLength]=\"2\"\n [value]=\"timepickerValueItem().rightminute()\"\n (outInputEvent)=\"handlerInputEvent($event,'rightminute')\"\n (outFunctionsControl)=\"handlerFunctionControl($event, 'rightminute')\"\n (outChange)=\"handlerChangeTimeValue($event, 'rightminute')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlurTime($event, 'rightminute')\" />\n </div>\n </div>\n </div>\n }\n </div>\n }\n\n </div>\n <div>\n <div class=\"flex w-full\">\n @if (!isSingle() && hasTimePicker()) {\n <div class=\"mt-[8px] libs-ui-font-h7r text-[#ff5454] h-[14px]\">\n @if (timePickerError()) {\n <span>{{ 'i18n_date_compare_start_end_message_error' | translate }}</span>\n }\n </div>\n }\n </div>\n @if (!quickRangesArray().length || !isSingle()) {\n <div class=\" flex w-full pt-[16px] justify-between\">\n <div class=\"flex items-center\">\n @if (!isSingle()) {\n @if (!endDate()) {\n <div class=\"text-[#cdd0d6] libs-ui-font-h6r\">\n <span>{{ startDate()?.format('DD/MM/YYYY') }}</span>\n @if (hasTimePicker()) {\n <span> {{ computedDisplayTimeLeft() }}</span>\n }\n &hyphen;\n <span>{{ startDate()?.format('DD/MM/YYYY') }}</span>\n @if (hasTimePicker()) {\n <span> {{ computedDisplayTimeRight() }}</span>\n }\n </div>\n }\n @if (endDate()) {\n <div class=\"text-[#cdd0d6] libs-ui-font-h6r\">\n <span>{{ startDate()?.format('DD/MM/YYYY') }}</span>\n @if (hasTimePicker()) {\n <span> {{ computedDisplayTimeLeft() }}</span>\n }\n &hyphen;\n <span>{{ endDate()?.format('DD/MM/YYYY') }}</span>\n @if (hasTimePicker()) {\n <span> {{ computedDisplayTimeRight() }}</span>\n }\n </div>\n }\n }\n </div>\n\n <div class=\"flex\">\n <libs_ui-components-buttons-button class=\"mr-[12px]\"\n label=\"i18n_cancel\"\n type=\"button-third\"\n (outClick)=\"handlerClickCancel($event)\" />\n <libs_ui-components-buttons-button label=\"i18n_select\"\n (outClick)=\"handlerClickApply($event)\" />\n </div>\n </div>\n }\n </div>\n</div>\n", styles: [".libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-dropdown{display:flex;align-items:center}.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-dropdown:hover{color:var(--libs-ui-color-light-1)}.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-dropdown:hover i:before,.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-dropdown:hover i:after{color:var(--libs-ui-color-light-1)!important}.libs-ui-component-custom_ranges-calendar table{border-collapse:inherit;border-spacing:0 2px}.libs-ui-component-custom_ranges-calendar th,.libs-ui-component-custom_ranges-calendar td{padding:0;text-align:center;min-width:32px}.libs-ui-component-custom_ranges-calendar th span,.libs-ui-component-custom_ranges-calendar td span{pointer-events:none}.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-icon:hover{color:var(--libs-ui-color-light-1)}.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-icon:hover i:before,.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-icon:hover i:after{color:var(--libs-ui-color-light-1)!important}.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-icon:before{font-size:20px}.libs-ui-component-custom_ranges-calendar td,.libs-ui-component-custom_ranges-calendar th{cursor:pointer;height:2em;width:2em}.libs-ui-component-custom_ranges-calendar td.available:hover,.libs-ui-component-custom_ranges-calendar th.available:hover{background-color:#f8f5fe;border-color:transparent;border-radius:8px;color:inherit;background-repeat:no-repeat;background-size:.5em;background-position:center;margin:.25em 0;opacity:.8;transform:scale(1);transition:all .45s cubic-bezier(.23,1,.32,1) 0ms}.libs-ui-component-custom_ranges-calendar td{margin:.25em 0;background-color:#fff;transition:background-color .2s ease;transform:scale(1);transition:all .45s cubic-bezier(.23,1,.32,1) 0ms;color:#071631!important}.libs-ui-component-custom_ranges-calendar td:hover{color:#8e61ee!important}.libs-ui-component-custom_ranges-calendar td.off,.libs-ui-component-custom_ranges-calendar td.off.in-range,.libs-ui-component-custom_ranges-calendar td.off.start-date,.libs-ui-component-custom_ranges-calendar td.off.end-date{background-color:#fff;border-color:transparent;color:#cdd0d6!important}.libs-ui-component-custom_ranges-calendar td.focus-off{background-color:#f8f5fe!important}.libs-ui-component-custom_ranges-calendar td.in-range{background-color:#f8f5fe;border-color:transparent;border-radius:0;color:#8e61ee!important}.libs-ui-component-custom_ranges-calendar td.today{position:relative;color:#8e61ee!important}.libs-ui-component-custom_ranges-calendar td.today:after{position:absolute;content:\"\";width:2px;height:2px;background-color:#8e61ee;left:49%;bottom:5px}.libs-ui-component-custom_ranges-calendar td.active{transition:background .3s ease-out;background:#0000001a}.libs-ui-component-custom_ranges-calendar td.active.today:after{position:absolute;content:\"\";background-color:#fff}.libs-ui-component-custom_ranges-calendar td.active.start-date{border-radius:8px 0 0 8px}.libs-ui-component-custom_ranges-calendar td.active.end-date{border-radius:0 8px 8px 0}.libs-ui-component-custom_ranges-calendar td.active.full-date{border-radius:8px}.libs-ui-component-custom_ranges-calendar td.active,.libs-ui-component-custom_ranges-calendar td.active:hover{background-color:#8e61ee;border-color:transparent;color:#fff!important}.libs-ui-component-custom_ranges-calendar th.month{width:auto}.libs-ui-component-custom_ranges-calendar td.disabled,.libs-ui-component-custom_ranges-calendar option.disabled{color:#999!important;cursor:not-allowed;text-decoration:line-through;background-color:#f4f5f7}.libs-ui-component-custom_ranges-calendar .dropdowns{background-repeat:no-repeat;background-size:10px;background-position-y:center;background-position-x:right}.libs-ui-component-custom_ranges-calendar th.month>div{position:relative;display:inline-block}@media (min-width: 564px){.libs-ui-component-custom_ranges{width:auto}}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "component", type: LibsUiComponentsDropdownComponent, selector: "libs_ui-components-dropdown", inputs: ["useXssFilter", "popoverElementRefCustom", "classInclude", "ignoreStopPropagationEvent", "flagMouse", "flagMouseContent", "popoverCustomConfig", "isNgContent", "zIndex", "convertItemSelected", "getPopoverItemSelected", "httpRequestDetailItemById", "lengthKeys", "textDisplayWhenNoSelect", "textDisplayWhenMultiSelect", "classIncludeTextDisplayWhenNoSelect", "fieldGetLabel", "labelPopoverConfig", "labelPopoverFullWidth", "hasContentUnitRight", "listSearchNoDataTemplateRef", "fieldGetImage", "imageSize", "typeShape", "fieldGetIcon", "fieldGetTextAvatar", "fieldGetColorAvatar", "classAvatarInclude", "getLastTextAfterSpace", "linkImageError", "showError", "showBorderError", "disable", "readonly", "labelConfig", "listSearchConfig", "isSearchOnline", "listHiddenInputSearch", "listSearchPadding", "listKeySearch", "listDividerClassInclude", "listConfig", "listButtonsOther", "listHasButtonUnSelectOption", "listClickExactly", "listBackgroundCustom", "listMaxItemShow", "listKeySelected", "listMultiKeySelected", "listKeysDisable", "listKeysHidden", "validRequired", "validMaxItemSelected", "changeValidUndefinedResetError", "allowSelectItemMultiple", "focusInputSearch", "onlyEmitDataWhenReset", "resetKeyWhenSelectAllKey", "listConfigHasDivider", "classIncludeIcon", "classIncludeContent", "listIgnoreClassDisableDefaultWhenUseKeysDisableItem", "tabKeyActive", "tabsConfig", "ignoreBorderBottom"], outputs: ["flagMouseChange", "flagMouseContentChange", "lengthKeysChange", "showBorderErrorChange", "listKeySelectedChange", "listMultiKeySelectedChange", "tabKeyActiveChange", "outSelectKey", "outSelectMultiKey", "outFunctionsControl", "outValidEvent", "outChangStageFlagMouse", "outDataChange", "outClickButtonOther", "outShowList", "outChangeTabKeyActive"] }, { kind: "component", type: LibsUiComponentsInputsInputComponent, selector: "libs_ui-components-inputs-input", inputs: ["tagInput", "dataType", "tabInsertContentTagInput", "textAreaEnterNotNewLine", "emitEmptyInDataTypeNumber", "keepZeroInTypeInt", "autoAddZeroLessThan10InTypeInt", "ignoreBlockInputMaxValue", "hiddenContent", "maxValueNumber", "minValueNumber", "fixedFloat", "acceptNegativeValue", "valueUpDownNumber", "classInclude", "maxLength", "readonly", "disable", "noBorder", "backgroundNone", "borderError", "useColorModeExist", "placeholder", "keepPlaceholderOnly", "value", "autoRemoveEmoji", "defaultHeight", "minHeightTextArea", "maxHeightTextArea", "focusTimeOut", "blurTimeOut", "zIndexPopoverContent", "classContainerInput", "showCount", "ignoreStopPropagationEvent", "resize", "templateLeftBottomInput", "templateRightBottomInput", "classContainerBottomInput", "ignoreWidthInput100", "iconLeftClass", "popoverContentIconLeft", "iconRightClass", "popoverContentIconRight", "resetAutoCompletePassword", "acceptOnlyClickIcon", "setIconRightColorSameColorDisableReadOnly", "onlyAcceptNegativeValue", "maxLengthNumberCount", "focusInput"], outputs: ["maxValueNumberChange", "minValueNumberChange", "fixedFloatChange", "acceptNegativeValueChange", "maxLengthChange", "valueChange", "maxLengthNumberCountChange", "outHeightAreaChange", "outChange", "outFocusAndBlurEvent", "outEnterEvent", "outInputEvent", "outIconLeft", "outIconRight", "outFunctionsControl", "outFilesDrop", "outFileDrop", "outChangeValueByButtonUpDown"] }, { kind: "component", type: LibsUiComponentsButtonsButtonComponent, selector: "libs_ui-components-buttons-button", inputs: ["flagMouse", "type", "buttonCustom", "sizeButton", "label", "disable", "isPending", "imageLeft", "classInclude", "classIconLeft", "classIconRight", "classLabel", "iconOnlyType", "popover", "ignoreStopPropagationEvent", "zIndex", "widthLabelPopover", "styleIconLeft", "styleButton", "ignoreFocusWhenInputTab", "ignoreSetClickWhenShowPopover", "ignorePointerEvent", "isActive"], outputs: ["outClick", "outPopoverEvent", "outFunctionsControl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1438
+ }
1439
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsDatetimePickerCustomRangesCalendarComponent, decorators: [{
1440
+ type: Component,
1441
+ args: [{ selector: 'libs_ui-components-datetime-picker-custom_ranges-calendar', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
1442
+ TranslateModule,
1443
+ LibsUiComponentsDropdownComponent,
1444
+ LibsUiComponentsInputsInputComponent,
1445
+ LibsUiComponentsButtonsButtonComponent
1446
+ ], template: "<div class=\"libs-ui-component-custom_ranges-calendar test-class\">\n <div class=\"relative flex\">\n <div class=\"libs-ui-component-custom_ranges-calendar\"\n [class.right]=\"isSingle()\"\n [class.left]=\"!isSingle()\">\n <div class=\"rounded-[4px] bg-[#ffffff]\">\n @if (calendarVariables(); as calendarVariables) {\n <table>\n <thead>\n <tr>\n <th colspan=\"7\"\n class=\"month\">\n @if (showDropdownsSelect() && calendarVariables.left().dropdowns?.()) {\n <div class=\"!flex mb-[10px] w-full\">\n <div class=\"w-3/4 flex items-center\">\n <div class='mr-[8px]'>\n <libs_ui-components-dropdown [isNgContent]=\"true\"\n [zIndex]=\"zIndex() + 1\"\n [popoverCustomConfig]=\"{widthByParent:false,ignoreArrow:true,paddingLeftItem: true, classInclude: '!w-[130px]',position:{ mode:'center',distance:0}}\"\n [listMaxItemShow]=\"10\"\n [listClickExactly]=\"false\"\n [listKeysDisable]=\"disableMonth().left()\"\n [listHasButtonUnSelectOption]=\"false\"\n [convertItemSelected]=\"convertItemMonth\"\n [listConfig]=\"listMonthsConfig()\"\n [listKeySelected]=\"listKeyFromSelected().month\"\n [flagMouse]=\"flagMouse()\"\n [listHiddenInputSearch]=\"true\"\n [httpRequestDetailItemById]=\"monthHttpDetailConfig()\"\n (outSelectKey)=\"handlerSelectedDropdown($event, sideEnum.left + 'month')\"\n (outFunctionsControl)=\"handlerFunctionControl($event, sideEnum.left + 'month')\"\n (outChangStageFlagMouse)=\"handlerChangeFlagMouse($event)\"\n (outShowList)=\"handlerShowListDropdown($event, sideEnum.left + 'month')\">\n <div class=\"libs-ui-component-custom_ranges-calendar-dropdown\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.left + 'month']\"\n [class.text-[#6a7383]]=\"!checkShowListDropdown()[sideEnum.left + 'month']\">\n <div class=\"libs-ui-font-h4m\"\n [style.fontWeight]=\"500\"\n [style.fontStyle]=\"'normal'\">\n {{ dateOptions().monthNames && calendarVariables.left().calendar && dateOptions().monthNames[calendarVariables.left().calendar?.[1]?.[1]?.month() ?? -1] }}\n </div>\n <i class=\"libs-ui-icon-chevron-right text-[13px] text-[#6a7383]\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.left + 'month']\"\n [style.fontWeight]=\"500\"\n [style.rotate]=\"!checkShowListDropdown()[sideEnum.left + 'month'] ? '90deg':'270deg'\"></i>\n </div>\n </libs_ui-components-dropdown>\n </div>\n <div>\n <libs_ui-components-dropdown [listMaxItemShow]=\"10\"\n [isNgContent]=\"true\"\n [zIndex]=\"zIndex() + 1\"\n [popoverCustomConfig]=\"{widthByParent:false,ignoreArrow:true,paddingLeftItem: true,classInclude: '!w-[110px]',position:{mode:'center',distance:0}}\"\n [listClickExactly]=\"false\"\n [listHasButtonUnSelectOption]=\"false\"\n [convertItemSelected]=\"convertItemYear\"\n [listHiddenInputSearch]=\"true\"\n [listConfig]=\"listLeftYearConfig()\"\n [listKeySelected]=\"listKeyFromSelected().year\"\n [flagMouse]=\"flagMouse()\"\n [httpRequestDetailItemById]=\"leftYearHttpDetailConfig()\"\n (outChangStageFlagMouse)=\"handlerChangeFlagMouse($event)\"\n (outShowList)=\"handlerShowListDropdown($event, sideEnum.left + 'year')\"\n (outSelectKey)=\"handlerSelectedDropdown($event, sideEnum.left + 'year')\"\n (outFunctionsControl)=\"handlerFunctionControl($event, sideEnum.left + 'year')\">\n <div class=\"libs-ui-component-custom_ranges-calendar-dropdown\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.left + 'year']\"\n [class.text-[#6a7383]]=\"!checkShowListDropdown()[sideEnum.left + 'year']\">\n <div class=\"libs-ui-font-h4m\"\n [style.fontWeight]=\"500\"\n [style.fontStyle]=\"'normal'\">{{ calendarVariables.left().calendar && calendarVariables.left().calendar?.[1]?.[1]?.format(\" YYYY\") }}</div>\n <i class=\"libs-ui-icon-chevron-right text-[13px] text-[#6a7383]\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.left + 'year']\"\n [style.fontWeight]=\"500\"\n [style.rotate]=\"!checkShowListDropdown()[sideEnum.left + 'year'] ? '90deg':'270deg'\"></i>\n </div>\n </libs_ui-components-dropdown>\n </div>\n </div>\n\n <div class=\"w-1/4 flex items-center relative\">\n @if (!calendarVariables.left().minDate || (calendarVariables.left().minDate?.isBefore(calendarVariables.left().calendar && calendarVariables.left().calendar?.firstDay))) {\n <div (click)=\"handlerClickPrev(sideEnum.left)\">\n <div class=\"flex items-center justify-center absolute left-0 top-[-3px]\">\n <i class=\"libs-ui-icon-chevron-right rotate-[180deg] text-[#6a7383] cursor-pointer libs-ui-component-custom_ranges-calendar-icon\"></i>\n </div>\n </div>\n }\n @if ((!calendarVariables.left().maxDate || calendarVariables.left().maxDate?.isAfter(calendarVariables.left().calendar && calendarVariables.left().calendar?.lastDay)) && isSingle()) {\n <div (click)=\"handlerClickNext(sideEnum.left)\">\n <div class=\"flex items-center justify-center ml-[12px] absolute right-0 top-[-3px]\">\n <i class=\"libs-ui-icon-chevron-right text-[#6a7383] cursor-pointer libs-ui-component-custom_ranges-calendar-icon\"></i>\n </div>\n </div>\n }\n </div>\n </div>\n }\n @if (!showDropdownsSelect() || !calendarVariables.left().dropdowns) {\n {{ dateOptions().monthNames && calendarVariables.left().calendar && dateOptions().monthNames[calendarVariables.left().calendar?.[1]?.[1]?.month() ?? -1] }}\n {{ calendarVariables.left().calendar && calendarVariables.left().calendar?.[1]?.[1]?.format(\" YYYY\") }}\n }\n </th>\n </tr>\n <tr class=\"week-days\">\n @for (dayofweek of dateOptions().daysOfWeek; track dayofweek) {\n <th>\n <span class=\"libs-ui-font-h6m text-[#6a7383]\"\n [style.fontWeight]=\"500\"\n [style.fontStyle]=\"'normal'\">{{ dayofweek }}</span>\n </th>\n }\n </tr>\n </thead>\n <tbody class=\"drp-animate\">\n @for (row of calendarVariables.left().calRows?.(); track row) {\n <tr class=\"h-[32px]\"\n [class]=\"calendarVariables.left().classes && calendarVariables.left().classes?.[row]?.classList\">\n @for (col of calendarVariables.left().calCols?.(); track col) {\n <td class=\"libs-ui-font-h5r\"\n [class.today]=\"calendarVariables.left().calendar && calendarVariables.left().calendar?.[row]?.[col]?.date() === today().date() && calendarVariables.left().calendar?.[row]?.[col]?.month() === today().month() && calendarVariables.left().calendar?.[row]?.[col]?.year() === today().year()\"\n [class]=\"calendarVariables.left().classes && calendarVariables.left().classes?.[row]?.[col]\"\n (click)=\"handlerPickerDate($event, sideEnum.left, row, col)\"\n (mouseenter)=\"handlerHoverDate($event, sideEnum.left, row, col)\">\n <span class=\"libs-ui-font-h5r\">{{ calendarVariables.left().calendar && calendarVariables.left().calendar?.[row]?.[col]?.date() }}</span>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n }\n </div>\n @if (hasTimePicker()) {\n <div>\n <div class=\"flex justify-center column items-center pt-[12px]\">\n <div class=\"w-full flex justify-center items-center rounded-[4px] border\"\n [class.border-[#e6e8ed]]=\"!timePickerError()\"\n [class.border-[#ff5454]]=\"timePickerError()\">\n <libs_ui-components-inputs-input classInclude=\"!w-[30px] !p-0 !border-none !text-center libs-ui-font-h4s !text-[#071631]\"\n dataType=\"int\"\n [focusTimeOut]=\"0\"\n [blurTimeOut]=\"0\"\n [autoAddZeroLessThan10InTypeInt]=\"true\"\n [emitEmptyInDataTypeNumber]=\"true\"\n [maxValueNumber]=\"23\"\n [minValueNumber]=\"0\"\n [maxLength]=\"2\"\n [value]=\"timepickerValueItem().lefthour()\"\n (outInputEvent)=\"handlerInputEvent($event, 'lefthour')\"\n (outFunctionsControl)=\"handlerFunctionControl($event, sideEnum.left + 'hour')\"\n (outChange)=\"handlerChangeTimeValue($event, 'lefthour')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlurTime($event, 'lefthour')\" />\n <span class=\"libs-ui-font-h3s text-[#333333]\">:</span>\n <libs_ui-components-inputs-input classInclude=\"!w-[30px] !p-0 !border-none !text-center !libs-ui-font-h4s !text-[#071631]\"\n [autoAddZeroLessThan10InTypeInt]=\"true\"\n [emitEmptyInDataTypeNumber]=\"true\"\n dataType=\"int\"\n [focusTimeOut]=\"0\"\n [blurTimeOut]=\"0\"\n [maxValueNumber]=\"59\"\n [minValueNumber]=\"0\"\n [maxLength]=\"2\"\n [value]=\"timepickerValueItem().leftminute()\"\n (outFunctionsControl)=\"handlerFunctionControl($event, sideEnum.left + 'minute')\"\n (outInputEvent)=\"handlerInputEvent($event, 'leftminute')\"\n (outChange)=\"handlerChangeTimeValue($event, 'leftminute')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlurTime($event, 'leftminute')\" />\n </div>\n </div>\n </div>\n }\n </div>\n\n @if (!isSingle()) {\n <div class=\"libs-ui-component-custom_ranges-calendar right ml-[24px]\">\n <div class=\"rounded-[4px] bg-[#ffffff]\">\n @if (calendarVariables()) {\n <table>\n <thead>\n <tr>\n <th colspan=\"7\"\n class=\"month\">\n @if (showDropdownsSelect() && calendarVariables().left().dropdowns?.()) {\n <div class=\"!flex mb-[10px] w-full\">\n <div class=\"w-3/4 flex items-center\">\n <div class='mr-[8px]'>\n <libs_ui-components-dropdown [isNgContent]=\"true\"\n [zIndex]=\"zIndex() + 1\"\n [popoverCustomConfig]=\"{widthByParent:false,ignoreArrow:true,paddingLeftItem: true,classInclude: '!w-[130px]',position:{mode:'center',distance:0}}\"\n [listMaxItemShow]=\"10\"\n [listClickExactly]=\"false\"\n [listKeysDisable]=\"disableMonth().right()\"\n [listHasButtonUnSelectOption]=\"false\"\n [convertItemSelected]=\"convertItemMonth\"\n [listHiddenInputSearch]=\"true\"\n [listConfig]=\"listMonthsConfig()\"\n [listKeySelected]=\"listKeyToSelected().month\"\n [flagMouse]=\"flagMouse()\"\n [httpRequestDetailItemById]=\"monthHttpDetailConfig()\"\n (outFunctionsControl)=\"handlerFunctionControl($event, sideEnum.right + 'month')\"\n (outSelectKey)=\"handlerSelectedDropdown($event, sideEnum.right + 'month')\"\n (outChangStageFlagMouse)=\"handlerChangeFlagMouse($event)\"\n (outShowList)=\"handlerShowListDropdown($event, sideEnum.right + 'month')\">\n <div class=\"libs-ui-component-custom_ranges-calendar-dropdown\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.right + 'month']\"\n [class.text-[#6a7383]]=\"!checkShowListDropdown()[sideEnum.right + 'month']\">\n <div class=\"libs-ui-font-h4m\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.right + 'month']\"\n [style.fontWeight]=\"500\"\n [style.fontStyle]=\"'normal'\">\n {{ dateOptions().monthNames && calendarVariables().right().calendar && dateOptions().monthNames[ calendarVariables().right().calendar?.[1]?.[1]?.month() ?? -1] }}\n </div>\n <i class=\"libs-ui-icon-chevron-right text-[13px] text-[#6a7383]\"\n [style.fontWeight]=\"500\"\n [style.rotate]=\"!checkShowListDropdown()[sideEnum.right + 'month'] ? '90deg':'270deg'\"></i>\n </div>\n </libs_ui-components-dropdown>\n </div>\n <div>\n <libs_ui-components-dropdown [listMaxItemShow]=\"10\"\n [zIndex]=\"zIndex() + 1\"\n [isNgContent]=\"true\"\n [popoverCustomConfig]=\"{widthByParent:false,ignoreArrow:true,paddingLeftItem: true, classInclude: '!w-[110px]', position:{mode:'center', distance:0}}\"\n [listClickExactly]=\"false\"\n [listHasButtonUnSelectOption]=\"false\"\n [convertItemSelected]=\"convertItemYear\"\n [listHiddenInputSearch]=\"true\"\n [listConfig]=\"listRightYearConfig()\"\n [listKeySelected]=\"listKeyToSelected().year\"\n [flagMouse]=\"flagMouse()\"\n [httpRequestDetailItemById]=\"rightYearHttpDetailConfig()\"\n (outSelectKey)=\"handlerSelectedDropdown($event, sideEnum.right + 'year')\"\n (outFunctionsControl)=\"handlerFunctionControl($event, sideEnum.right + 'year')\"\n (outChangStageFlagMouse)=\"handlerChangeFlagMouse($event)\"\n (outShowList)=\"handlerShowListDropdown($event, sideEnum.right + 'year')\">\n <div class=\"libs-ui-component-custom_ranges-calendar-dropdown\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.right + 'year']\"\n [class.text-[#6a7383]]=\"!checkShowListDropdown()[sideEnum.right + 'year']\">\n <div class=\"libs-ui-font-h4m\"\n [style.fontWeight]=\"500\"\n [style.fontStyle]=\"'normal'\">\n {{ calendarVariables().right().calendar && calendarVariables().right().calendar?.[1]?.[1]?.format(\"YYYY\") }}\n </div>\n <i class=\"libs-ui-icon-chevron-right text-[13px] text-[#6a7383]\"\n [class.text-[var(--libs-ui-color-dark)]]=\"checkShowListDropdown()[sideEnum.right + 'year']\"\n [style.fontWeight]=\"500\"\n [style.rotate]=\"!checkShowListDropdown()[sideEnum.right + 'year'] ? '90deg':'270deg'\"></i>\n </div>\n </libs_ui-components-dropdown>\n </div>\n </div>\n <div class=\"w-1/4 flex items-center relative\">\n @if (listKeyFromSelected().year && listKeyToSelected().year && !(((listKeyFromSelected().year +1) === listKeyToSelected().year) && (listKeyFromSelected().month === 12) && listKeyToSelected().month === 1)&& (listKeyFromSelected().year < listKeyToSelected().year) || listKeyFromSelected().month && listKeyToSelected().month && ((listKeyFromSelected().month + 1) < +listKeyToSelected().month)) {\n <div class=\"flex items-center justify-center absolute left-0 top-[-3px]\"\n (click)=\"handlerClickPrev(sideEnum.right)\">\n <i class=\"libs-ui-icon-chevron-right rotate-[180deg] text-[#6a7383] cursor-pointer libs-ui-component-custom_ranges-calendar-icon\"></i>\n </div>\n }\n @if (listKeyFromSelected().month && listKeyToSelected().month && (listKeyFromSelected().month > listKeyToSelected().month) && listKeyFromSelected().year && listKeyToSelected().year && (listKeyFromSelected().year === listKeyToSelected().year )) {\n <div class=\"bg-[#ffffff] w-[21px] h-[21px] cursor-none flex items-center justify-center rounded-[50px]\">\n </div>\n }\n @if (!calendarVariables().right().maxDate || (calendarVariables().right().maxDate?.isAfter(calendarVariables().right().calendar && calendarVariables().right().calendar?.lastDay))) {\n <div (click)=\"handlerClickNext(sideEnum.right)\">\n <div class=\"flex items-center justify-center ml-[12px] absolute right-0 top-[-3px]\">\n <i class=\"libs-ui-icon-chevron-right text-[#6a7383] cursor-pointer libs-ui-component-custom_ranges-calendar-icon\"></i>\n </div>\n </div>\n }\n </div>\n </div>\n }\n @if (!showDropdownsSelect() || !calendarVariables().right().dropdowns) {\n {{ dateOptions().monthNames && calendarVariables().right().calendar && dateOptions().monthNames[calendarVariables().right().calendar?.[1]?.[1]?.month() ?? -1] }}\n {{ calendarVariables().right().calendar && calendarVariables().right().calendar?.[1]?.[1]?.format(\"YYYY\") }}\n }\n </th>\n </tr>\n <tr class=\"week-days\">\n @for (dayofweek of dateOptions().daysOfWeek; track dayofweek) {\n <th>\n <span class=\"libs-ui-font-h6m text-[#6a7383]\"\n [style.fontWeight]=\"500\"\n [style.fontStyle]=\"'normal'\">{{ dayofweek }}</span>\n </th>\n }\n </tr>\n </thead>\n <tbody>\n @for (row of calendarVariables().right().calRows?.(); track row) {\n <tr class=\"h-[32px]\"\n [class]=\"calendarVariables().right().classes && calendarVariables().right().classes?.[row]?.classList\">\n @for (col of calendarVariables().right().calCols?.(); track col) {\n <td class=\"libs-ui-font-h5r\"\n [class]=\"calendarVariables().right().classes && calendarVariables().right().classes?.[row]?.[col]\"\n [class.today]=\"calendarVariables().right().calendar && calendarVariables().right().calendar?.[row]?.[col]?.date() === today().date() && calendarVariables().right().calendar?.[row]?.[col]?.month() === today().month() && calendarVariables().right().calendar &&calendarVariables().right().calendar?.[row]?.[col]?.year() === today().year()\"\n (click)=\"handlerPickerDate($event, sideEnum.right, row, col)\"\n (mouseenter)=\"handlerHoverDate($event, sideEnum.right, row, col)\">\n <span>{{ calendarVariables().right().calendar?.[row]?.[col]?.date() }}</span>\n </td>\n }\n </tr>\n }\n </tbody>\n </table>\n }\n </div>\n @if (hasTimePicker()) {\n <div>\n <div class=\"flex justify-center items-center pt-[12px]\">\n <div class=\"w-full flex justify-center items-center rounded-[4px] border\"\n [class.border-[#e6e8ed]]=\"!timePickerError()\"\n [class.border-[#ff5454]]=\"timePickerError()\">\n <libs_ui-components-inputs-input classInclude=\"!w-[30px] !p-0 !border-none !text-center !libs-ui-font-h4s !text-[#071631]\"\n dataType=\"int\"\n [autoAddZeroLessThan10InTypeInt]=\"true\"\n [emitEmptyInDataTypeNumber]=\"true\"\n [maxValueNumber]=\"23\"\n [minValueNumber]=\"0\"\n [focusTimeOut]=\"0\"\n [blurTimeOut]=\"0\"\n [maxLength]=\"2\"\n [value]=\"timepickerValueItem().righthour()\"\n (outChange)=\"handlerChangeTimeValue($event, 'righthour')\"\n (outInputEvent)=\"handlerInputEvent($event,'righthour')\"\n (outFunctionsControl)=\"handlerFunctionControl($event, 'righthour')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlurTime($event, 'righthour')\" />\n <span class=\"libs-ui-font-h3s text-[#333333]\">:</span>\n <libs_ui-components-inputs-input classInclude=\"!w-[30px] !p-0 !border-none !text-center libs-ui-font-h4s !text-[#071631]\"\n dataType=\"int\"\n [autoAddZeroLessThan10InTypeInt]=\"true\"\n [emitEmptyInDataTypeNumber]=\"true\"\n [maxValueNumber]=\"59\"\n [minValueNumber]=\"0\"\n [focusTimeOut]=\"0\"\n [blurTimeOut]=\"0\"\n [maxLength]=\"2\"\n [value]=\"timepickerValueItem().rightminute()\"\n (outInputEvent)=\"handlerInputEvent($event,'rightminute')\"\n (outFunctionsControl)=\"handlerFunctionControl($event, 'rightminute')\"\n (outChange)=\"handlerChangeTimeValue($event, 'rightminute')\"\n (outFocusAndBlurEvent)=\"handlerFocusAndBlurTime($event, 'rightminute')\" />\n </div>\n </div>\n </div>\n }\n </div>\n }\n\n </div>\n <div>\n <div class=\"flex w-full\">\n @if (!isSingle() && hasTimePicker()) {\n <div class=\"mt-[8px] libs-ui-font-h7r text-[#ff5454] h-[14px]\">\n @if (timePickerError()) {\n <span>{{ 'i18n_date_compare_start_end_message_error' | translate }}</span>\n }\n </div>\n }\n </div>\n @if (!quickRangesArray().length || !isSingle()) {\n <div class=\" flex w-full pt-[16px] justify-between\">\n <div class=\"flex items-center\">\n @if (!isSingle()) {\n @if (!endDate()) {\n <div class=\"text-[#cdd0d6] libs-ui-font-h6r\">\n <span>{{ startDate()?.format('DD/MM/YYYY') }}</span>\n @if (hasTimePicker()) {\n <span> {{ computedDisplayTimeLeft() }}</span>\n }\n &hyphen;\n <span>{{ startDate()?.format('DD/MM/YYYY') }}</span>\n @if (hasTimePicker()) {\n <span> {{ computedDisplayTimeRight() }}</span>\n }\n </div>\n }\n @if (endDate()) {\n <div class=\"text-[#cdd0d6] libs-ui-font-h6r\">\n <span>{{ startDate()?.format('DD/MM/YYYY') }}</span>\n @if (hasTimePicker()) {\n <span> {{ computedDisplayTimeLeft() }}</span>\n }\n &hyphen;\n <span>{{ endDate()?.format('DD/MM/YYYY') }}</span>\n @if (hasTimePicker()) {\n <span> {{ computedDisplayTimeRight() }}</span>\n }\n </div>\n }\n }\n </div>\n\n <div class=\"flex\">\n <libs_ui-components-buttons-button class=\"mr-[12px]\"\n label=\"i18n_cancel\"\n type=\"button-third\"\n (outClick)=\"handlerClickCancel($event)\" />\n <libs_ui-components-buttons-button label=\"i18n_select\"\n (outClick)=\"handlerClickApply($event)\" />\n </div>\n </div>\n }\n </div>\n</div>\n", styles: [".libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-dropdown{display:flex;align-items:center}.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-dropdown:hover{color:var(--libs-ui-color-light-1)}.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-dropdown:hover i:before,.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-dropdown:hover i:after{color:var(--libs-ui-color-light-1)!important}.libs-ui-component-custom_ranges-calendar table{border-collapse:inherit;border-spacing:0 2px}.libs-ui-component-custom_ranges-calendar th,.libs-ui-component-custom_ranges-calendar td{padding:0;text-align:center;min-width:32px}.libs-ui-component-custom_ranges-calendar th span,.libs-ui-component-custom_ranges-calendar td span{pointer-events:none}.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-icon:hover{color:var(--libs-ui-color-light-1)}.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-icon:hover i:before,.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-icon:hover i:after{color:var(--libs-ui-color-light-1)!important}.libs-ui-component-custom_ranges-calendar .libs-ui-component-custom_ranges-calendar-icon:before{font-size:20px}.libs-ui-component-custom_ranges-calendar td,.libs-ui-component-custom_ranges-calendar th{cursor:pointer;height:2em;width:2em}.libs-ui-component-custom_ranges-calendar td.available:hover,.libs-ui-component-custom_ranges-calendar th.available:hover{background-color:#f8f5fe;border-color:transparent;border-radius:8px;color:inherit;background-repeat:no-repeat;background-size:.5em;background-position:center;margin:.25em 0;opacity:.8;transform:scale(1);transition:all .45s cubic-bezier(.23,1,.32,1) 0ms}.libs-ui-component-custom_ranges-calendar td{margin:.25em 0;background-color:#fff;transition:background-color .2s ease;transform:scale(1);transition:all .45s cubic-bezier(.23,1,.32,1) 0ms;color:#071631!important}.libs-ui-component-custom_ranges-calendar td:hover{color:#8e61ee!important}.libs-ui-component-custom_ranges-calendar td.off,.libs-ui-component-custom_ranges-calendar td.off.in-range,.libs-ui-component-custom_ranges-calendar td.off.start-date,.libs-ui-component-custom_ranges-calendar td.off.end-date{background-color:#fff;border-color:transparent;color:#cdd0d6!important}.libs-ui-component-custom_ranges-calendar td.focus-off{background-color:#f8f5fe!important}.libs-ui-component-custom_ranges-calendar td.in-range{background-color:#f8f5fe;border-color:transparent;border-radius:0;color:#8e61ee!important}.libs-ui-component-custom_ranges-calendar td.today{position:relative;color:#8e61ee!important}.libs-ui-component-custom_ranges-calendar td.today:after{position:absolute;content:\"\";width:2px;height:2px;background-color:#8e61ee;left:49%;bottom:5px}.libs-ui-component-custom_ranges-calendar td.active{transition:background .3s ease-out;background:#0000001a}.libs-ui-component-custom_ranges-calendar td.active.today:after{position:absolute;content:\"\";background-color:#fff}.libs-ui-component-custom_ranges-calendar td.active.start-date{border-radius:8px 0 0 8px}.libs-ui-component-custom_ranges-calendar td.active.end-date{border-radius:0 8px 8px 0}.libs-ui-component-custom_ranges-calendar td.active.full-date{border-radius:8px}.libs-ui-component-custom_ranges-calendar td.active,.libs-ui-component-custom_ranges-calendar td.active:hover{background-color:#8e61ee;border-color:transparent;color:#fff!important}.libs-ui-component-custom_ranges-calendar th.month{width:auto}.libs-ui-component-custom_ranges-calendar td.disabled,.libs-ui-component-custom_ranges-calendar option.disabled{color:#999!important;cursor:not-allowed;text-decoration:line-through;background-color:#f4f5f7}.libs-ui-component-custom_ranges-calendar .dropdowns{background-repeat:no-repeat;background-size:10px;background-position-y:center;background-position-x:right}.libs-ui-component-custom_ranges-calendar th.month>div{position:relative;display:inline-block}@media (min-width: 564px){.libs-ui-component-custom_ranges{width:auto}}\n"] }]
1447
+ }], ctorParameters: () => [] });
1448
+
1449
+ class LibsUiComponentsDatetimePickerCustomRangesComponent {
1450
+ /** PROPERTY */
1451
+ showCalTableInRanges = signal(false);
1452
+ quickRangesArray = signal([]);
1453
+ selectedQuickRange = signal(''); // quick range đã được lưu trước đó
1454
+ chosenQuickRange = signal(undefined); // quick range đang được chọn
1455
+ calendarShowing = signal(false);
1456
+ timeouts = signal([]);
1457
+ calendarFunctionControlEvent = signal(undefined);
1458
+ chosenSingleDate = signal(undefined);
1459
+ chosenDateRange = signal(undefined);
1460
+ /** INPUT */
1461
+ // readonly SelectedQuickRange = input<string>('');
1462
+ zIndex = input(1200, { transform: (value) => value ?? 1200 });
1463
+ classInclude = input('');
1464
+ extendRanges = input([]);
1465
+ widthByParent = input(false);
1466
+ autoApply = input(false);
1467
+ positionQuickRanges = input('left', { transform: (value) => value ?? 'left' });
1468
+ isSingle = input(false, { transform: (value) => value ?? false });
1469
+ hasTimePicker = input(true);
1470
+ flagMouse = input({ isMouseEnter: false, isMouseEnterContent: false });
1471
+ dateOptions = input({ ...defaultLocaleConfig(), ...getDateOptions() });
1472
+ alwaysShowCalendars = input(false);
1473
+ startDate = model(dayjs().startOf('day'));
1474
+ endDate = model(dayjs().endOf('day'));
1475
+ showCustomRangeLabel = input(undefined);
1476
+ keepCalendarOpeningWithRange = input(undefined);
1477
+ singleDateSelected = input();
1478
+ dateRangeSelected = input(undefined, {
1479
+ transform: (value) => {
1480
+ if (!value) {
1481
+ return;
1482
+ }
1483
+ let startDate = value.startDate;
1484
+ let endDate = value.endDate;
1485
+ if (typeof startDate === 'string') {
1486
+ startDate = dayjs(startDate);
1487
+ }
1488
+ if (typeof endDate === 'string') {
1489
+ endDate = dayjs(endDate);
1490
+ }
1491
+ return {
1492
+ ...value,
1493
+ startDate,
1494
+ endDate
1495
+ };
1496
+ }
1497
+ });
1498
+ /** OUTPUT */
1499
+ outChangStageFlagMouse = output();
1500
+ outUpdateWidth = output();
1501
+ outCancel = output();
1502
+ outSelectSingleDate = output();
1503
+ outSelectDateRange = output();
1504
+ outClickRange = output();
1505
+ constructor() {
1506
+ effect(() => untracked(this.onAfterViewInit.bind(this)));
1507
+ }
1508
+ ngOnInit() {
1509
+ throw new Error("Method not implemented.");
1510
+ }
1511
+ onAfterViewInit() {
1512
+ if (!this.startDate()) {
1513
+ this.startDate.set(dayjs().startOf('day'));
1514
+ }
1515
+ if (!this.endDate()) {
1516
+ this.endDate.set(dayjs().endOf('day'));
1517
+ }
1518
+ const dateRangeSelected = this.dateRangeSelected();
1519
+ const customRange = {
1520
+ id: this.dateOptions()?.customRangeLabel || '',
1521
+ label: this.dateOptions()?.customRangeLabel || ''
1522
+ };
1523
+ if (dateRangeSelected) {
1524
+ this.selectedQuickRange.set(dateRangeSelected.quickRangeId ? dateRangeSelected.quickRangeId : customRange.id);
1525
+ this.chosenQuickRange.set(dateRangeSelected.quickRangeId ?? customRange.id);
1526
+ this.startDate.set(dateRangeSelected.startDate);
1527
+ this.endDate.set(dateRangeSelected.endDate);
1528
+ }
1529
+ if (this.hasTimePicker()) {
1530
+ this.selectedQuickRange.set(customRange.id);
1531
+ this.chosenQuickRange.set(customRange.id);
1532
+ }
1533
+ if (this.selectedQuickRange() === this.dateOptions()?.customRangeLabel) {
1534
+ this.showCalTableInRanges.set(true);
1535
+ }
1536
+ this.renderRanges();
1537
+ }
1538
+ updateWidth() {
1539
+ const timeoutId = setTimeout(() => {
1540
+ this.outUpdateWidth.emit(1);
1541
+ });
1542
+ this.timeouts.update(ids => [...ids, timeoutId]);
1543
+ }
1544
+ renderRanges() {
1545
+ if (this.isSingle()) {
1546
+ return;
1547
+ }
1548
+ const rangesDefault = getDateRangeDefault();
1549
+ const ranges = this.isSingle() ? {} : this.dateOptions()?.ranges;
1550
+ this.quickRangesArray.set([]);
1551
+ for (const key in ranges) {
1552
+ const rangeValue = rangesDefault[key];
1553
+ const start = dayjs(rangeValue[0]);
1554
+ const end = dayjs(rangeValue[1]);
1555
+ this.quickRangesArray.update(current => {
1556
+ current.push({
1557
+ id: key,
1558
+ label: ranges[key],
1559
+ values: [start, end]
1560
+ });
1561
+ return current;
1562
+ });
1563
+ }
1564
+ if (this.showCustomRangeLabel() && this.dateOptions()?.customRangeLabel) {
1565
+ this.quickRangesArray.update(current => {
1566
+ current.push({
1567
+ id: this.dateOptions()?.customRangeLabel || '',
1568
+ label: this.dateOptions()?.customRangeLabel || ''
1569
+ });
1570
+ return current;
1571
+ });
1572
+ }
1573
+ if (this.extendRanges()) {
1574
+ this.quickRangesArray.update(current => {
1575
+ current.unshift(...this.extendRanges());
1576
+ return current;
1577
+ });
1578
+ }
1579
+ if (!this.quickRangesArray().length) {
1580
+ this.showCalTableInRanges.set(true);
1581
+ }
1582
+ }
1583
+ handlerCancel() {
1584
+ this.outCancel.emit('');
1585
+ }
1586
+ handlerPickerDate(event) {
1587
+ console.log('handlerPickerDate', event);
1588
+ this.chosenSingleDate.set({
1589
+ displayLabel: event.displayLabel,
1590
+ date: event.startDate,
1591
+ values: event.detailDatePicker.start()
1592
+ });
1593
+ // if (!this.isSingle() && event.startDate && !event.endDate) {
1594
+ // const endTime = event.detailDatePicker.end();
1595
+ // event.endDate = event.startDate.clone().hour(endTime.hour as number).minute(endTime.minute as number).second(59);
1596
+ // }
1597
+ this.chosenDateRange.set({
1598
+ quickRangeId: this.chosenQuickRange(),
1599
+ ...event
1600
+ });
1601
+ const chosenSingleDate = this.chosenSingleDate();
1602
+ const chosenDateRange = this.chosenDateRange();
1603
+ if (this.isSingle() && chosenSingleDate) {
1604
+ this.outSelectSingleDate.emit(chosenSingleDate);
1605
+ return;
1606
+ }
1607
+ if (!chosenDateRange || (!chosenDateRange.startDate && !chosenDateRange.endDate)) {
1608
+ return;
1609
+ }
1610
+ this.outSelectDateRange.emit(chosenDateRange);
1611
+ }
1612
+ handlerClickRange(e, range) {
1613
+ e.stopPropagation();
1614
+ this.updateWidth();
1615
+ this.chosenQuickRange.set(range.id);
1616
+ if (range.id === this.dateOptions()?.customRangeLabel) {
1617
+ this.calendarShowing.set(true);
1618
+ this.showCalTableInRanges.set(true);
1619
+ return;
1620
+ }
1621
+ if (this.extendRanges()) {
1622
+ const findExternalRange = this.extendRanges().find(item => item.label === range.id);
1623
+ if (findExternalRange && range.id === findExternalRange.label) {
1624
+ if (findExternalRange.values) {
1625
+ this.outSelectDateRange.emit({ quickRangeId: findExternalRange.id, displayLabel: findExternalRange.label, startDate: findExternalRange.values[0], endDate: findExternalRange.values[1] });
1626
+ return;
1627
+ }
1628
+ this.outSelectDateRange.emit({ quickRangeId: findExternalRange.id, displayLabel: findExternalRange.label, startDate: undefined, endDate: undefined });
1629
+ return;
1630
+ }
1631
+ }
1632
+ const dates = range.values ?? [];
1633
+ // this.startDate.set(dates[0].clone().hour(0).minute(0).second(0));
1634
+ // this.endDate.set(dates[1].clone().hour(23).minute(59).second(59));
1635
+ // this.timeValue = { hour: 0, toHour: 0, minute: 23, toMinute: 59 };
1636
+ // this.timepickerVariables.left.selectedHour = 0;
1637
+ // this.timepickerVariables.left.selectedMinute = 0;
1638
+ // this.timepickerVariables.right.selectedHour = 23;
1639
+ // this.timepickerVariables.right.selectedMinute = 59;
1640
+ // this.showRangeLabelOnInput && label !== this.localeDay.customRangeLabel ? this.chosenLabel = label : this.calculateChosenLabel();
1641
+ // // this.autoApply.set(true);
1642
+ // if (!this.hasTimePicker()) {
1643
+ // if(this.startDate()) {
1644
+ // this.startDate.set(this.startDate()?.startOf('day'));
1645
+ // }
1646
+ // if(this.endDate()) {
1647
+ // this.endDate.set(this.endDate()?.endOf('day'));
1648
+ // }
1649
+ // }
1650
+ // if (!this.alwaysShowCalendars()) {
1651
+ // this.calendarShowing.set(false);
1652
+ // }
1653
+ // this.outClickRange.emit(range);
1654
+ if (!this.keepCalendarOpeningWithRange() || !this.alwaysShowCalendars()) {
1655
+ this.outSelectDateRange.emit({ quickRangeId: range.id, displayLabel: range.label, startDate: range.values?.[0], endDate: range.values?.[1] });
1656
+ return;
1657
+ }
1658
+ // if (this.timePicker) {
1659
+ // this.renderTimePicker(SideEnum.left);
1660
+ // this.renderTimePicker(SideEnum.right);
1661
+ // }
1662
+ // if (this.getMaxDate() && this.getMaxDate().isSame(dates[0], 'month')) {
1663
+ // this.rightCalendar.month = this.rightCalendar.month && this.rightCalendar.month.month(dates[0].month());
1664
+ // this.rightCalendar.month = this.rightCalendar.month && this.rightCalendar.month.year(dates[0].year());
1665
+ // this.leftCalendar.month = this.leftCalendar.month && this.leftCalendar.month.month(dates[0].month() - 1);
1666
+ // this.leftCalendar.month = this.leftCalendar.month && this.leftCalendar.month.year(dates[1].year());
1667
+ // return this.updateCalendars();
1668
+ // }
1669
+ // this.leftCalendar.month = this.leftCalendar.month && this.leftCalendar.month.month(dates[0].month());
1670
+ // this.leftCalendar.month = this.leftCalendar.month && this.leftCalendar.month.year(dates[0].year());
1671
+ // const nextMonth = dates[0].clone().add(1, 'month');
1672
+ // this.rightCalendar.month = this.rightCalendar.month && this.rightCalendar.month.month(nextMonth.month());
1673
+ // this.rightCalendar.month = this.rightCalendar.month && this.rightCalendar.month.year(nextMonth.year());
1674
+ // this.updateCalendars();
1675
+ return;
1676
+ }
1677
+ handlerClickCancel(event) {
1678
+ event.stopPropagation();
1679
+ // this.startDate.set(dayjs(0));
1680
+ // this.endDate.set(dayjs(0));
1681
+ this.outCancel.emit('');
1682
+ }
1683
+ handlerChangeFlagMouse(flagMouse) {
1684
+ this.outChangStageFlagMouse.emit(flagMouse);
1685
+ }
1686
+ handlerFunctionsControl(event) {
1687
+ this.calendarFunctionControlEvent.set(event);
1688
+ }
1689
+ ngOnDestroy() {
1690
+ this.timeouts().forEach(item => clearTimeout(item));
1691
+ // this.onDestroy.next();
1692
+ // this.onDestroy.complete();
1693
+ }
1694
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsDatetimePickerCustomRangesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1695
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsDatetimePickerCustomRangesComponent, isStandalone: true, selector: "libs_ui-components-datetime-picker-custom_ranges", inputs: { zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, classInclude: { classPropertyName: "classInclude", publicName: "classInclude", isSignal: true, isRequired: false, transformFunction: null }, extendRanges: { classPropertyName: "extendRanges", publicName: "extendRanges", isSignal: true, isRequired: false, transformFunction: null }, widthByParent: { classPropertyName: "widthByParent", publicName: "widthByParent", isSignal: true, isRequired: false, transformFunction: null }, autoApply: { classPropertyName: "autoApply", publicName: "autoApply", isSignal: true, isRequired: false, transformFunction: null }, positionQuickRanges: { classPropertyName: "positionQuickRanges", publicName: "positionQuickRanges", isSignal: true, isRequired: false, transformFunction: null }, isSingle: { classPropertyName: "isSingle", publicName: "isSingle", isSignal: true, isRequired: false, transformFunction: null }, hasTimePicker: { classPropertyName: "hasTimePicker", publicName: "hasTimePicker", isSignal: true, isRequired: false, transformFunction: null }, flagMouse: { classPropertyName: "flagMouse", publicName: "flagMouse", isSignal: true, isRequired: false, transformFunction: null }, dateOptions: { classPropertyName: "dateOptions", publicName: "dateOptions", isSignal: true, isRequired: false, transformFunction: null }, alwaysShowCalendars: { classPropertyName: "alwaysShowCalendars", publicName: "alwaysShowCalendars", isSignal: true, isRequired: false, transformFunction: null }, startDate: { classPropertyName: "startDate", publicName: "startDate", isSignal: true, isRequired: false, transformFunction: null }, endDate: { classPropertyName: "endDate", publicName: "endDate", isSignal: true, isRequired: false, transformFunction: null }, showCustomRangeLabel: { classPropertyName: "showCustomRangeLabel", publicName: "showCustomRangeLabel", isSignal: true, isRequired: false, transformFunction: null }, keepCalendarOpeningWithRange: { classPropertyName: "keepCalendarOpeningWithRange", publicName: "keepCalendarOpeningWithRange", isSignal: true, isRequired: false, transformFunction: null }, singleDateSelected: { classPropertyName: "singleDateSelected", publicName: "singleDateSelected", isSignal: true, isRequired: false, transformFunction: null }, dateRangeSelected: { classPropertyName: "dateRangeSelected", publicName: "dateRangeSelected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { startDate: "startDateChange", endDate: "endDateChange", outChangStageFlagMouse: "outChangStageFlagMouse", outUpdateWidth: "outUpdateWidth", outCancel: "outCancel", outSelectSingleDate: "outSelectSingleDate", outSelectDateRange: "outSelectDateRange", outClickRange: "outClickRange" }, ngImport: i0, template: "<div #pickerContainer\n class=\"libs-ui-component-custom_ranges flex rounded-[4px] bg-[#ffffff] z-[1000] overflow-[hidden] relative inline\"\n [class.flex-row-reverse]=\"positionQuickRanges() === 'right'\">\n @if (!isSingle()) {\n <div class=\"libs-ui-component-custom_ranges-ranges {{ classInclude() || '' }}\"\n [class.border-l-[#e6e8ed]]=\"positionQuickRanges() === 'right' && showCalTableInRanges()\"\n [class.border-l]=\"positionQuickRanges() === 'right' && showCalTableInRanges()\"\n [class.border-r-[#e6e8ed]]=\"positionQuickRanges() === 'left' && showCalTableInRanges()\"\n [class.border-r]=\"positionQuickRanges() === 'left' && showCalTableInRanges()\"\n [class.!min-h-[260px]]=\"showCalTableInRanges() && !isSingle()\"\n [class.!min-h-[300px]]=\"hasTimePicker() && !isSingle()\"\n [class.!w-[160px]]=\"!widthByParent()\"\n [class.!w-full]=\"widthByParent()\">\n @for (range of quickRangesArray(); track range.id) {\n <div class=\"flex items-center hover:bg-[var(--libs-ui-color-light-3)] cursor-pointer px-[16px] py-[8px]\"\n [class.libs-ui-selected-range]=\"range.id === chosenQuickRange() && showCustomRangeLabel()\"\n [class.bg-[var(--libs-ui-color-light-3)]]=\"range.id === chosenQuickRange() || range.id === selectedQuickRange()\"\n (click)=\"handlerClickRange($event, range)\">\n <div class=\"libs-ui-font-h5r flex text-[#333333] min-w-0 w-full\">\n <div LibsUiComponentsPopoverDirective\n type=\"text\"\n [config]=\"{maxWidth:160,direction:'top',zIndex:(zIndex() ||1000) + 1}\"\n [innerHTML]=\"range.label\"\n (click)=\"handlerClickRange($event, range)\">\n </div>\n </div>\n <i class=\"text-[12px] ml-[16px]\"\n [class.libs-ui-icon-check]=\"range.id === selectedQuickRange()\"\n [class.text-[var(--libs-ui-color-default)]]=\"range.id === selectedQuickRange()\"></i>\n </div>\n }\n </div>\n }\n @if (showCalTableInRanges()) {\n <div class=\"m-[16px] w-full\">\n <libs_ui-components-datetime-picker-custom_ranges-calendar [isSingle]=\"isSingle()\"\n [autoApply]=\"autoApply()\"\n [zIndex]=\"zIndex()\"\n [flagMouse]=\"flagMouse()\"\n [dateOptions]=\"dateOptions()\"\n [hasTimePicker]=\"hasTimePicker()\"\n [quickRangesArray]=\"quickRangesArray()\"\n [startDate]=\"startDate()\"\n [endDate]=\"endDate()\"\n [classInclude]=\"'w-full'\"\n (outCancel)=\"handlerCancel()\"\n (outPickerDate)=\"handlerPickerDate($event)\"\n (outFunctionsControl)=\"handlerFunctionsControl($event)\"\n (outChangStageFlagMouse)=\"handlerChangeFlagMouse($event)\" />\n </div>\n }\n</div>\n", styles: [".libs-ui-component-custom_ranges{position:absolute;box-shadow:0 2px 4px #00000029,0 2px 8px #0000001f}.libs-ui-component-custom_ranges .libs-ui-component-custom_ranges-ranges{width:159px;flex-shrink:0}.libs-ui-component-custom_ranges .libs-ui-component-custom_ranges-ranges .libs-ui-selected-range{position:relative}.libs-ui-component-custom_ranges .libs-ui-component-custom_ranges-ranges .libs-ui-selected-range:after{content:\"\";position:absolute;right:0;top:0;bottom:0;width:2px;background-color:var(--libs-ui-color-default)!important}@media (min-width: 564px){.libs-ui-component-custom_ranges{width:auto}}\n"], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "component", type: LibsUiComponentsDatetimePickerCustomRangesCalendarComponent, selector: "libs_ui-components-datetime-picker-custom_ranges-calendar", inputs: ["quickRangesArray", "zIndex", "classInclude", "isSingle", "showDropdownsSelect", "hasTimePicker", "flagMouse", "dateOptions", "autoApply", "hasSecondPicker", "showRangeLabelOnInput", "startDate", "endDate", "minDate", "maxDate"], outputs: ["startDateChange", "endDateChange", "outChangStageFlagMouse", "outPickerDate", "outCancel", "outUpdateWidth", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["debugId", "flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1696
+ }
1697
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsDatetimePickerCustomRangesComponent, decorators: [{
1698
+ type: Component,
1699
+ args: [{ selector: 'libs_ui-components-datetime-picker-custom_ranges', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
1700
+ TranslateModule,
1701
+ LibsUiComponentsDatetimePickerCustomRangesCalendarComponent,
1702
+ LibsUiComponentsPopoverComponent,
1703
+ LibsUiComponentsButtonsButtonComponent
1704
+ ], template: "<div #pickerContainer\n class=\"libs-ui-component-custom_ranges flex rounded-[4px] bg-[#ffffff] z-[1000] overflow-[hidden] relative inline\"\n [class.flex-row-reverse]=\"positionQuickRanges() === 'right'\">\n @if (!isSingle()) {\n <div class=\"libs-ui-component-custom_ranges-ranges {{ classInclude() || '' }}\"\n [class.border-l-[#e6e8ed]]=\"positionQuickRanges() === 'right' && showCalTableInRanges()\"\n [class.border-l]=\"positionQuickRanges() === 'right' && showCalTableInRanges()\"\n [class.border-r-[#e6e8ed]]=\"positionQuickRanges() === 'left' && showCalTableInRanges()\"\n [class.border-r]=\"positionQuickRanges() === 'left' && showCalTableInRanges()\"\n [class.!min-h-[260px]]=\"showCalTableInRanges() && !isSingle()\"\n [class.!min-h-[300px]]=\"hasTimePicker() && !isSingle()\"\n [class.!w-[160px]]=\"!widthByParent()\"\n [class.!w-full]=\"widthByParent()\">\n @for (range of quickRangesArray(); track range.id) {\n <div class=\"flex items-center hover:bg-[var(--libs-ui-color-light-3)] cursor-pointer px-[16px] py-[8px]\"\n [class.libs-ui-selected-range]=\"range.id === chosenQuickRange() && showCustomRangeLabel()\"\n [class.bg-[var(--libs-ui-color-light-3)]]=\"range.id === chosenQuickRange() || range.id === selectedQuickRange()\"\n (click)=\"handlerClickRange($event, range)\">\n <div class=\"libs-ui-font-h5r flex text-[#333333] min-w-0 w-full\">\n <div LibsUiComponentsPopoverDirective\n type=\"text\"\n [config]=\"{maxWidth:160,direction:'top',zIndex:(zIndex() ||1000) + 1}\"\n [innerHTML]=\"range.label\"\n (click)=\"handlerClickRange($event, range)\">\n </div>\n </div>\n <i class=\"text-[12px] ml-[16px]\"\n [class.libs-ui-icon-check]=\"range.id === selectedQuickRange()\"\n [class.text-[var(--libs-ui-color-default)]]=\"range.id === selectedQuickRange()\"></i>\n </div>\n }\n </div>\n }\n @if (showCalTableInRanges()) {\n <div class=\"m-[16px] w-full\">\n <libs_ui-components-datetime-picker-custom_ranges-calendar [isSingle]=\"isSingle()\"\n [autoApply]=\"autoApply()\"\n [zIndex]=\"zIndex()\"\n [flagMouse]=\"flagMouse()\"\n [dateOptions]=\"dateOptions()\"\n [hasTimePicker]=\"hasTimePicker()\"\n [quickRangesArray]=\"quickRangesArray()\"\n [startDate]=\"startDate()\"\n [endDate]=\"endDate()\"\n [classInclude]=\"'w-full'\"\n (outCancel)=\"handlerCancel()\"\n (outPickerDate)=\"handlerPickerDate($event)\"\n (outFunctionsControl)=\"handlerFunctionsControl($event)\"\n (outChangStageFlagMouse)=\"handlerChangeFlagMouse($event)\" />\n </div>\n }\n</div>\n", styles: [".libs-ui-component-custom_ranges{position:absolute;box-shadow:0 2px 4px #00000029,0 2px 8px #0000001f}.libs-ui-component-custom_ranges .libs-ui-component-custom_ranges-ranges{width:159px;flex-shrink:0}.libs-ui-component-custom_ranges .libs-ui-component-custom_ranges-ranges .libs-ui-selected-range{position:relative}.libs-ui-component-custom_ranges .libs-ui-component-custom_ranges-ranges .libs-ui-selected-range:after{content:\"\";position:absolute;right:0;top:0;bottom:0;width:2px;background-color:var(--libs-ui-color-default)!important}@media (min-width: 564px){.libs-ui-component-custom_ranges{width:auto}}\n"] }]
1705
+ }], ctorParameters: () => [] });
1706
+
1707
+ class LibsUiComponentsDatetimePickerComponent {
1708
+ /** PROPERTY */
1709
+ ERROR_MESSAGE_EMPTY_VALID = ERROR_MESSAGE_EMPTY_VALID;
1710
+ showRangesPopup = signal(false);
1711
+ width = computed(this.computedWidth.bind(this));
1712
+ singleError = signal({ message: undefined });
1713
+ chosenDateFromRanges = signal({});
1714
+ selectedDateFromCalendar;
1715
+ displayRangeTitle = computed(() => {
1716
+ const selectedLabel = this.chosenDateFromRanges().selectedLabel;
1717
+ if (this.isSingle() || !selectedLabel) {
1718
+ return;
1719
+ }
1720
+ return selectedLabel;
1721
+ });
1722
+ dateOptions = signal({ ...defaultLocaleConfig(), ...getDateOptions() });
1723
+ popoverFunctionControlEvent = signal(undefined);
1724
+ /** INPUT */
1725
+ showCustomRangeLabel = input(true, { transform: (value) => value ?? true });
1726
+ labelConfig = input();
1727
+ disable = input(false);
1728
+ readonly = input(false);
1729
+ classInclude = input('');
1730
+ classPickerInclude = input('');
1731
+ classPickerContentInclude = input('');
1732
+ ignoreBorderQuickRange = input(false);
1733
+ useColorModeExist = input(false);
1734
+ hasTimePicker = input(true);
1735
+ allowReset = input(true);
1736
+ widthByLabel = input(true, { transform: (value) => value ?? true });
1737
+ defaultWidth = input(undefined);
1738
+ isSingle = input(false);
1739
+ extendRanges = input([]);
1740
+ validRequired = input(undefined);
1741
+ ignoreStopPropagationEvent = input(false);
1742
+ flagMouse = model({ isMouseEnter: false, isMouseEnterContent: false });
1743
+ widthByParent = input(false);
1744
+ zIndex = input(1200, { transform: (value) => value ?? 1200 });
1745
+ rangesPopoverPosition = input('start', { transform: (value) => value ?? 'start' });
1746
+ isNgContent = input(false);
1747
+ classIncludeCustomRanges = input('');
1748
+ autoApply = input(false);
1749
+ positionQuickRanges = input('left'); // vị trí list chọn nhanh khoảng thời gian
1750
+ singleDateSelected = model();
1751
+ dateRangeSelected = model();
1752
+ /** OUTPUT */
1753
+ outChangStageFlagMouse = output();
1754
+ outReset = output();
1755
+ outSelectSingleDate = output();
1756
+ outSelectDateRange = output();
1757
+ outFunctionsControl = output();
1758
+ constructor() {
1759
+ // this.dateOptions.set(getDateOptions());
1760
+ }
1761
+ ngOnInit() {
1762
+ this.outFunctionsControl.emit({ checkIsValid: this.checkIsValid.bind(this) });
1763
+ }
1764
+ handlerSelectRanges(event) {
1765
+ event.stopPropagation();
1766
+ }
1767
+ handlerChangStageFlagMouse(flagMouse) {
1768
+ this.flagMouse.set(flagMouse);
1769
+ }
1770
+ handlerChangStagePopoverFlagMouse(flagMouse) {
1771
+ if (this.flagMouse()?.isMouseEnterContent) {
1772
+ flagMouse.isMouseEnterContent = true;
1773
+ }
1774
+ this.outChangStageFlagMouse.emit(flagMouse);
1775
+ }
1776
+ handlerFunctionControl(event) {
1777
+ this.popoverFunctionControlEvent.set(event);
1778
+ }
1779
+ handlerPopoverEvent(event) {
1780
+ if (event === 'remove') {
1781
+ this.showRangesPopup.set(false);
1782
+ }
1783
+ }
1784
+ handlerPickerSingleDate(data) {
1785
+ this.outSelectSingleDate.emit(data);
1786
+ }
1787
+ handlerPickerDateRange(data) {
1788
+ console.log(data);
1789
+ if ((data.displayLabel?.indexOf('Invalid Date') ?? -1) > -1) {
1790
+ return;
1791
+ }
1792
+ // this.selectedKey = data.selectedLabel;
1793
+ this.chosenDateFromRanges.set({ selectedLabel: data.displayLabel });
1794
+ // this.selected.start = dayjs(data.startDate);
1795
+ // this.selected.end = dayjs(data.endDate);
1796
+ if (this.hasTimePicker()) {
1797
+ const startTime = dayjs(data.startDate).format('DD/MM/YYYY HH:mm');
1798
+ const endTime = dayjs(data.endDate).format('DD/MM/YYYY HH:mm');
1799
+ this.chosenDateFromRanges.update(current => {
1800
+ current.selectedLabel = `${!this.isSingle() ? `${startTime} - ${endTime}` : startTime}`;
1801
+ return current;
1802
+ });
1803
+ }
1804
+ // this.moDatePicker.emit(this.singleDatePicker ? { chosenLabel: this.dateValue.chosenLabel, singleDate: this.dateValue.startDate?.utc(), startDate: this.dateValue.startDate?.utc(), endDate: this.dateValue.endDate?.utc() } : { chosenLabel: this.dateValue.chosenLabel, startDate: this.dateValue.startDate?.utc(), endDate: this.dateValue.endDate?.utc() });
1805
+ const showViewExternalRangeLabel = this.extendRanges()?.find(item => item.id === this.chosenDateFromRanges().selectedLabel);
1806
+ if (this.extendRanges() && showViewExternalRangeLabel) {
1807
+ this.chosenDateFromRanges.update(current => {
1808
+ current.selectedLabel = showViewExternalRangeLabel && showViewExternalRangeLabel.label;
1809
+ return current;
1810
+ });
1811
+ }
1812
+ this.dateRangeSelected.set({ quickRangeId: data.quickRangeId, startDate: data.startDate, endDate: data.endDate });
1813
+ this.outSelectDateRange.emit({ quickRangeId: data.quickRangeId, startDate: data.startDate, endDate: data.endDate });
1814
+ this.popoverFunctionControlEvent()?.removePopoverOverlay();
1815
+ this.checkIsValid();
1816
+ }
1817
+ handlerReset(event) {
1818
+ event?.stopPropagation();
1819
+ this.chosenDateFromRanges.set({});
1820
+ // this.selected = { start: dayjs().hour(0).minute(0).second(0), end: dayjs().hour(23).minute(59).second(59) };
1821
+ this.outReset.emit(undefined);
1822
+ }
1823
+ handlerUpdateWidth() {
1824
+ this.popoverFunctionControlEvent()?.updatePopoverOverlayPosition();
1825
+ }
1826
+ handlerCancel() {
1827
+ this.popoverFunctionControlEvent()?.removePopoverOverlay();
1828
+ }
1829
+ async checkIsValid() {
1830
+ if (this.readonly() || this.disable()) {
1831
+ return true;
1832
+ }
1833
+ await this.validate();
1834
+ return this.singleError().message ? true : false;
1835
+ }
1836
+ async validate() {
1837
+ this.singleError.set({ message: undefined });
1838
+ if (!this.validRequired()) {
1839
+ return;
1840
+ }
1841
+ if (this.validRequired() && !this.chosenDateFromRanges().selectedLabel) {
1842
+ this.singleError.set({
1843
+ message: this.validRequired()?.message || ERROR_MESSAGE_EMPTY_VALID,
1844
+ interpolateParams: this.validRequired()?.interpolateParams || {}
1845
+ });
1846
+ return;
1847
+ }
1848
+ }
1849
+ computedWidth() {
1850
+ if (this.widthByLabel()) {
1851
+ return;
1852
+ }
1853
+ if (this.defaultWidth()) {
1854
+ return this.defaultWidth();
1855
+ }
1856
+ if (this.hasTimePicker()) {
1857
+ return !this.isSingle() ? 322 : 190;
1858
+ }
1859
+ return !this.isSingle() ? 232 : 152;
1860
+ }
1861
+ ngOnDestroy() {
1862
+ console.log('ngOnDestroy');
1863
+ }
1864
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsDatetimePickerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1865
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: LibsUiComponentsDatetimePickerComponent, isStandalone: true, selector: "libs_ui-components-datetime-picker", inputs: { showCustomRangeLabel: { classPropertyName: "showCustomRangeLabel", publicName: "showCustomRangeLabel", isSignal: true, isRequired: false, transformFunction: null }, labelConfig: { classPropertyName: "labelConfig", publicName: "labelConfig", isSignal: true, isRequired: false, transformFunction: null }, disable: { classPropertyName: "disable", publicName: "disable", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, classInclude: { classPropertyName: "classInclude", publicName: "classInclude", isSignal: true, isRequired: false, transformFunction: null }, classPickerInclude: { classPropertyName: "classPickerInclude", publicName: "classPickerInclude", isSignal: true, isRequired: false, transformFunction: null }, classPickerContentInclude: { classPropertyName: "classPickerContentInclude", publicName: "classPickerContentInclude", isSignal: true, isRequired: false, transformFunction: null }, ignoreBorderQuickRange: { classPropertyName: "ignoreBorderQuickRange", publicName: "ignoreBorderQuickRange", isSignal: true, isRequired: false, transformFunction: null }, useColorModeExist: { classPropertyName: "useColorModeExist", publicName: "useColorModeExist", isSignal: true, isRequired: false, transformFunction: null }, hasTimePicker: { classPropertyName: "hasTimePicker", publicName: "hasTimePicker", isSignal: true, isRequired: false, transformFunction: null }, allowReset: { classPropertyName: "allowReset", publicName: "allowReset", isSignal: true, isRequired: false, transformFunction: null }, widthByLabel: { classPropertyName: "widthByLabel", publicName: "widthByLabel", isSignal: true, isRequired: false, transformFunction: null }, defaultWidth: { classPropertyName: "defaultWidth", publicName: "defaultWidth", isSignal: true, isRequired: false, transformFunction: null }, isSingle: { classPropertyName: "isSingle", publicName: "isSingle", isSignal: true, isRequired: false, transformFunction: null }, extendRanges: { classPropertyName: "extendRanges", publicName: "extendRanges", isSignal: true, isRequired: false, transformFunction: null }, validRequired: { classPropertyName: "validRequired", publicName: "validRequired", isSignal: true, isRequired: false, transformFunction: null }, ignoreStopPropagationEvent: { classPropertyName: "ignoreStopPropagationEvent", publicName: "ignoreStopPropagationEvent", isSignal: true, isRequired: false, transformFunction: null }, flagMouse: { classPropertyName: "flagMouse", publicName: "flagMouse", isSignal: true, isRequired: false, transformFunction: null }, widthByParent: { classPropertyName: "widthByParent", publicName: "widthByParent", isSignal: true, isRequired: false, transformFunction: null }, zIndex: { classPropertyName: "zIndex", publicName: "zIndex", isSignal: true, isRequired: false, transformFunction: null }, rangesPopoverPosition: { classPropertyName: "rangesPopoverPosition", publicName: "rangesPopoverPosition", isSignal: true, isRequired: false, transformFunction: null }, isNgContent: { classPropertyName: "isNgContent", publicName: "isNgContent", isSignal: true, isRequired: false, transformFunction: null }, classIncludeCustomRanges: { classPropertyName: "classIncludeCustomRanges", publicName: "classIncludeCustomRanges", isSignal: true, isRequired: false, transformFunction: null }, autoApply: { classPropertyName: "autoApply", publicName: "autoApply", isSignal: true, isRequired: false, transformFunction: null }, positionQuickRanges: { classPropertyName: "positionQuickRanges", publicName: "positionQuickRanges", isSignal: true, isRequired: false, transformFunction: null }, singleDateSelected: { classPropertyName: "singleDateSelected", publicName: "singleDateSelected", isSignal: true, isRequired: false, transformFunction: null }, dateRangeSelected: { classPropertyName: "dateRangeSelected", publicName: "dateRangeSelected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { flagMouse: "flagMouseChange", singleDateSelected: "singleDateSelectedChange", dateRangeSelected: "dateRangeSelectedChange", outChangStageFlagMouse: "outChangStageFlagMouse", outReset: "outReset", outSelectSingleDate: "outSelectSingleDate", outSelectDateRange: "outSelectDateRange", outFunctionsControl: "outFunctionsControl" }, ngImport: i0, template: "<div class=\"{{ classInclude() }}\">\n @if (labelConfig(); as labelConfig) {\n <libs_ui-components-label [classInclude]=\"labelConfig.classInclude\"\n [labelLeft]=\"labelConfig.labelLeft\"\n [labelLeftClass]=\"labelConfig.labelLeftClass\"\n [required]=\"labelConfig.required \"\n [description]=\"labelConfig.description\"\n [descriptionClass]=\"labelConfig.descriptionClass\"\n [labelRight]=\"labelConfig.labelRight\"\n [labelRightClass]=\"labelConfig.labelRightClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [buttonsLeft]=\"labelConfig.buttonsLeft\"\n [buttonsRight]=\"labelConfig.buttonsRight\"\n [disableButtonsLeft]=\"labelConfig.disableButtonsLeft || disable()\"\n [disableButtonsRight]=\"labelConfig.disableButtonsRight || disable()\"\n [hasToggle]=\"labelConfig.hasToggle\"\n [toggleActive]=\"labelConfig.toggleActive\"\n [toggleDisable]=\"labelConfig.toggleDisable || disable()\"\n [popover]=\"labelConfig.popover\"\n [iconPopoverClass]=\"labelConfig.iconPopoverClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [limitLength]=\"labelConfig.limitLength\"\n [buttonsDescription]=\"labelConfig.buttonsDescription\"\n [disableButtonsDescription]=\"labelConfig.disableButtonsDescription || disable()\"\n [buttonsDescriptionContainerClass]=\"labelConfig.buttonsDescriptionContainerClass\"\n [count]=\"labelConfig.count\" />\n }\n <div class=\"flex w-full\">\n <libs_ui-components-popover [classInclude]=\"classPickerInclude()\"\n [ignoreShowPopover]=\"disable() || readonly()\"\n [mode]=\"'click'\"\n [ignoreHiddenPopoverContentWhenMouseLeave]=\"true\"\n [ignoreStopPropagationEvent]=\"ignoreStopPropagationEvent()\"\n [flagMouse]=\"flagMouse()\"\n [config]=\"{\n animationConfig:{},\n maxWidth: 770,\n maxHeight: 420,\n directionDistance:2,\n template: customRangesRef,\n widthByParent: widthByParent(),\n whiteTheme: true,\n ignoreArrow: true,\n zIndex: zIndex(),\n classInclude: 'rounded-[4px] ',\n position: {mode: rangesPopoverPosition(),distance: 0}}\"\n (outChangStageFlagMouse)=\"handlerChangStagePopoverFlagMouse($event)\"\n (outFunctionsControl)=\"handlerFunctionControl($event)\"\n (outEvent)=\"handlerPopoverEvent($event)\">\n @if (!isNgContent()) {\n <div #containerRef\n class=\"flex items-center px-[12px] h-[32px] rounded-[4px] bg-[#ffffff] cursor-pointer libs-ui-font-h5r {{ classPickerContentInclude() }}\"\n [class.libs-ui-disable]=\"disable()\"\n [class.!border-none]=\"ignoreBorderQuickRange()\"\n [class.libs-ui-border-general]=\"!singleError().message && !ignoreBorderQuickRange()\"\n [class.libs-ui-border-error-general]=\"singleError().message && !ignoreBorderQuickRange()\"\n [class.min-w-[284px]]=\"!chosenDateFromRanges().selectedLabel && !isSingle() && hasTimePicker()\"\n [class.!border]=\"showRangesPopup() && !ignoreBorderQuickRange() && !readonly()\"\n [class.!border-[#4e8cf7]]=\"showRangesPopup() && !ignoreBorderQuickRange() && !readonly()\"\n [class.libs-ui-readonly]=\"readonly() || false\"\n [style.width.px]=\"width()\"\n (click)=\"handlerSelectRanges($event)\">\n <div class=\"libs-ui-icon-calendar text-[#9ca2ad] text-[16px]\"></div>\n <div class=\"ml-[8px]\"\n [class.!text-[#071631]]=\"!disable()\"\n [class.!text-[#9ca2ad]]=\"disable()\">\n @if (!chosenDateFromRanges().selectedLabel) {\n @if (!isSingle()) {\n <span class=\"text-[#9ca2ad]\">dd/mm/yyyy@if (hasTimePicker()) {<span>&nbsp;hh:mm</span>} - dd/mm/yyyy@if (hasTimePicker()) {<span>&nbsp;hh:mm</span>}</span>\n }\n @if (isSingle()) {\n <span class=\"text-[#9ca2ad]\">dd/mm/yyyy@if (hasTimePicker()) {<span>&nbsp;hh:mm</span>}</span>\n }\n }\n @if (chosenDateFromRanges().selectedLabel && !isSingle()) {\n {{ displayRangeTitle() }}\n }\n @if (chosenDateFromRanges().selectedLabel && isSingle()) {\n <span [class.text-[#29c7cc]]=\"useColorModeExist() || false\">\n {{ chosenDateFromRanges().selectedLabel }}\n </span>\n }\n </div>\n @if (chosenDateFromRanges().selectedLabel && allowReset() && !disable() && !readonly()) {\n <div class=\"pl-[12px] ml-auto h-full flex items-center\">\n <i class=\"libs-ui-icon-close-circle-solid text-[16px] text-[#cdd0d6]\"\n (click)=\"handlerReset($event)\"></i>\n </div>\n }\n </div>\n }\n @if (isNgContent()) {\n <div (click)=\"handlerSelectRanges($event)\">\n <ng-content></ng-content>\n </div>\n }\n </libs_ui-components-popover>\n </div>\n @if (singleError().message && !validRequired()?.ignoreMessage) {\n <div class=\"mt-[8px] text-[#ee2d41] libs-ui-font-h7r\">\n {{ (singleError().message || ERROR_MESSAGE_EMPTY_VALID)| translate:validRequired()?.interpolateParams }}\n </div>\n }\n</div>\n\n<ng-template #customRangesRef>\n <libs_ui-components-datetime-picker-custom_ranges [zIndex]=\"zIndex()\"\n [classInclude]=\"classIncludeCustomRanges()\"\n [widthByParent]=\"widthByParent()\"\n [dateOptions]=\"dateOptions()\"\n [positionQuickRanges]=\"positionQuickRanges()\"\n [showCustomRangeLabel]=\"showCustomRangeLabel()\"\n [autoApply]=\"autoApply()\"\n [isSingle]=\"isSingle()\"\n [singleDateSelected]=\"singleDateSelected()\"\n [dateRangeSelected]=\"dateRangeSelected()\"\n [extendRanges]=\"extendRanges()\"\n [hasTimePicker]=\"hasTimePicker()\"\n (outUpdateWidth)=\"handlerUpdateWidth()\"\n (outCancel)=\"handlerCancel()\"\n (outSelectSingleDate)=\"handlerPickerSingleDate($event)\"\n (outSelectDateRange)=\"handlerPickerDateRange($event)\"\n (outChangStageFlagMouse)=\"handlerChangStageFlagMouse($event)\" />\n</ng-template>\n", styles: [""], dependencies: [{ kind: "ngmodule", type: TranslateModule }, { kind: "pipe", type: i1.TranslatePipe, name: "translate" }, { kind: "component", type: LibsUiComponentsLabelComponent, selector: "libs_ui-components-label", inputs: ["iconPopoverClass", "classInclude", "labelLeft", "labelLeftClass", "labelLeftBehindToggleButton", "popover", "required", "buttonsLeft", "disableButtonsLeft", "buttonsRight", "disableButtonsRight", "labelRight", "labelRightClass", "labelRightRequired", "hasToggle", "toggleSize", "toggleActive", "toggleDisable", "description", "descriptionClass", "buttonsDescription", "disableButtonsDescription", "buttonsDescriptionContainerClass", "onlyShowCount", "zIndexPopover", "timerDestroyPopover", "count", "limitLength"], outputs: ["outClickButton", "outSwitchEvent", "outLabelRightClick", "outLabelLeftClick"] }, { kind: "component", type: LibsUiComponentsPopoverComponent, selector: "libs_ui-components-popover,[LibsUiComponentsPopoverDirective]", inputs: ["debugId", "flagMouse", "type", "mode", "config", "ignoreShowPopover", "elementRefCustom", "classInclude", "ignoreHiddenPopoverContentWhenMouseLeave", "ignoreStopPropagationEvent", "ignoreCursorPointerModeLikeClick", "isAddContentToParentDocument", "ignoreClickOutside"], outputs: ["outEvent", "outChangStageFlagMouse", "outEventPopoverContent", "outFunctionsControl"] }, { kind: "component", type: LibsUiComponentsDatetimePickerCustomRangesComponent, selector: "libs_ui-components-datetime-picker-custom_ranges", inputs: ["zIndex", "classInclude", "extendRanges", "widthByParent", "autoApply", "positionQuickRanges", "isSingle", "hasTimePicker", "flagMouse", "dateOptions", "alwaysShowCalendars", "startDate", "endDate", "showCustomRangeLabel", "keepCalendarOpeningWithRange", "singleDateSelected", "dateRangeSelected"], outputs: ["startDateChange", "endDateChange", "outChangStageFlagMouse", "outUpdateWidth", "outCancel", "outSelectSingleDate", "outSelectDateRange", "outClickRange"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1866
+ }
1867
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: LibsUiComponentsDatetimePickerComponent, decorators: [{
1868
+ type: Component,
1869
+ args: [{ selector: 'libs_ui-components-datetime-picker', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
1870
+ TranslateModule,
1871
+ LibsUiComponentsLabelComponent,
1872
+ LibsUiComponentsPopoverComponent,
1873
+ LibsUiComponentsDatetimePickerCustomRangesComponent
1874
+ ], template: "<div class=\"{{ classInclude() }}\">\n @if (labelConfig(); as labelConfig) {\n <libs_ui-components-label [classInclude]=\"labelConfig.classInclude\"\n [labelLeft]=\"labelConfig.labelLeft\"\n [labelLeftClass]=\"labelConfig.labelLeftClass\"\n [required]=\"labelConfig.required \"\n [description]=\"labelConfig.description\"\n [descriptionClass]=\"labelConfig.descriptionClass\"\n [labelRight]=\"labelConfig.labelRight\"\n [labelRightClass]=\"labelConfig.labelRightClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [buttonsLeft]=\"labelConfig.buttonsLeft\"\n [buttonsRight]=\"labelConfig.buttonsRight\"\n [disableButtonsLeft]=\"labelConfig.disableButtonsLeft || disable()\"\n [disableButtonsRight]=\"labelConfig.disableButtonsRight || disable()\"\n [hasToggle]=\"labelConfig.hasToggle\"\n [toggleActive]=\"labelConfig.toggleActive\"\n [toggleDisable]=\"labelConfig.toggleDisable || disable()\"\n [popover]=\"labelConfig.popover\"\n [iconPopoverClass]=\"labelConfig.iconPopoverClass\"\n [onlyShowCount]=\"labelConfig.onlyShowCount\"\n [limitLength]=\"labelConfig.limitLength\"\n [buttonsDescription]=\"labelConfig.buttonsDescription\"\n [disableButtonsDescription]=\"labelConfig.disableButtonsDescription || disable()\"\n [buttonsDescriptionContainerClass]=\"labelConfig.buttonsDescriptionContainerClass\"\n [count]=\"labelConfig.count\" />\n }\n <div class=\"flex w-full\">\n <libs_ui-components-popover [classInclude]=\"classPickerInclude()\"\n [ignoreShowPopover]=\"disable() || readonly()\"\n [mode]=\"'click'\"\n [ignoreHiddenPopoverContentWhenMouseLeave]=\"true\"\n [ignoreStopPropagationEvent]=\"ignoreStopPropagationEvent()\"\n [flagMouse]=\"flagMouse()\"\n [config]=\"{\n animationConfig:{},\n maxWidth: 770,\n maxHeight: 420,\n directionDistance:2,\n template: customRangesRef,\n widthByParent: widthByParent(),\n whiteTheme: true,\n ignoreArrow: true,\n zIndex: zIndex(),\n classInclude: 'rounded-[4px] ',\n position: {mode: rangesPopoverPosition(),distance: 0}}\"\n (outChangStageFlagMouse)=\"handlerChangStagePopoverFlagMouse($event)\"\n (outFunctionsControl)=\"handlerFunctionControl($event)\"\n (outEvent)=\"handlerPopoverEvent($event)\">\n @if (!isNgContent()) {\n <div #containerRef\n class=\"flex items-center px-[12px] h-[32px] rounded-[4px] bg-[#ffffff] cursor-pointer libs-ui-font-h5r {{ classPickerContentInclude() }}\"\n [class.libs-ui-disable]=\"disable()\"\n [class.!border-none]=\"ignoreBorderQuickRange()\"\n [class.libs-ui-border-general]=\"!singleError().message && !ignoreBorderQuickRange()\"\n [class.libs-ui-border-error-general]=\"singleError().message && !ignoreBorderQuickRange()\"\n [class.min-w-[284px]]=\"!chosenDateFromRanges().selectedLabel && !isSingle() && hasTimePicker()\"\n [class.!border]=\"showRangesPopup() && !ignoreBorderQuickRange() && !readonly()\"\n [class.!border-[#4e8cf7]]=\"showRangesPopup() && !ignoreBorderQuickRange() && !readonly()\"\n [class.libs-ui-readonly]=\"readonly() || false\"\n [style.width.px]=\"width()\"\n (click)=\"handlerSelectRanges($event)\">\n <div class=\"libs-ui-icon-calendar text-[#9ca2ad] text-[16px]\"></div>\n <div class=\"ml-[8px]\"\n [class.!text-[#071631]]=\"!disable()\"\n [class.!text-[#9ca2ad]]=\"disable()\">\n @if (!chosenDateFromRanges().selectedLabel) {\n @if (!isSingle()) {\n <span class=\"text-[#9ca2ad]\">dd/mm/yyyy@if (hasTimePicker()) {<span>&nbsp;hh:mm</span>} - dd/mm/yyyy@if (hasTimePicker()) {<span>&nbsp;hh:mm</span>}</span>\n }\n @if (isSingle()) {\n <span class=\"text-[#9ca2ad]\">dd/mm/yyyy@if (hasTimePicker()) {<span>&nbsp;hh:mm</span>}</span>\n }\n }\n @if (chosenDateFromRanges().selectedLabel && !isSingle()) {\n {{ displayRangeTitle() }}\n }\n @if (chosenDateFromRanges().selectedLabel && isSingle()) {\n <span [class.text-[#29c7cc]]=\"useColorModeExist() || false\">\n {{ chosenDateFromRanges().selectedLabel }}\n </span>\n }\n </div>\n @if (chosenDateFromRanges().selectedLabel && allowReset() && !disable() && !readonly()) {\n <div class=\"pl-[12px] ml-auto h-full flex items-center\">\n <i class=\"libs-ui-icon-close-circle-solid text-[16px] text-[#cdd0d6]\"\n (click)=\"handlerReset($event)\"></i>\n </div>\n }\n </div>\n }\n @if (isNgContent()) {\n <div (click)=\"handlerSelectRanges($event)\">\n <ng-content></ng-content>\n </div>\n }\n </libs_ui-components-popover>\n </div>\n @if (singleError().message && !validRequired()?.ignoreMessage) {\n <div class=\"mt-[8px] text-[#ee2d41] libs-ui-font-h7r\">\n {{ (singleError().message || ERROR_MESSAGE_EMPTY_VALID)| translate:validRequired()?.interpolateParams }}\n </div>\n }\n</div>\n\n<ng-template #customRangesRef>\n <libs_ui-components-datetime-picker-custom_ranges [zIndex]=\"zIndex()\"\n [classInclude]=\"classIncludeCustomRanges()\"\n [widthByParent]=\"widthByParent()\"\n [dateOptions]=\"dateOptions()\"\n [positionQuickRanges]=\"positionQuickRanges()\"\n [showCustomRangeLabel]=\"showCustomRangeLabel()\"\n [autoApply]=\"autoApply()\"\n [isSingle]=\"isSingle()\"\n [singleDateSelected]=\"singleDateSelected()\"\n [dateRangeSelected]=\"dateRangeSelected()\"\n [extendRanges]=\"extendRanges()\"\n [hasTimePicker]=\"hasTimePicker()\"\n (outUpdateWidth)=\"handlerUpdateWidth()\"\n (outCancel)=\"handlerCancel()\"\n (outSelectSingleDate)=\"handlerPickerSingleDate($event)\"\n (outSelectDateRange)=\"handlerPickerDateRange($event)\"\n (outChangStageFlagMouse)=\"handlerChangStageFlagMouse($event)\" />\n</ng-template>\n" }]
1875
+ }], ctorParameters: () => [] });
1876
+
1877
+ /**
1878
+ * Generated bundle index. Do not edit.
1879
+ */
1880
+
1881
+ export { LibsUiComponentsDatetimePickerComponent };
1882
+ //# sourceMappingURL=libs-ui-components-datetime-picker.mjs.map