@libs-ui/components-datetime-picker 0.2.10-6.2

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