@libs-ui/components-datetime-picker 0.2.77 → 0.2.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-ranges/calendar/calendar.component.d.ts +1 -1
- package/custom-ranges/custom-ranges.component.d.ts +1 -1
- package/defines/common-date.define.d.ts +2 -0
- package/defines/date-options.define.d.ts +0 -2
- package/esm2022/custom-ranges/calendar/calendar.component.mjs +6 -3
- package/esm2022/custom-ranges/custom-ranges.component.mjs +45 -3
- package/esm2022/defines/common-date.define.mjs +3 -0
- package/esm2022/defines/date-options.define.mjs +1 -3
- package/esm2022/index.mjs +2 -1
- package/esm2022/picker.component.mjs +12 -2
- package/fesm2022/libs-ui-components-datetime-picker.mjs +62 -7
- package/fesm2022/libs-ui-components-datetime-picker.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +1 -1
|
@@ -62,8 +62,6 @@ const getDateRangeDefault = () => {
|
|
|
62
62
|
_3months_ago: [dayjs().subtract(89, 'days').hour(0).second(0).minute(0).millisecond(0), dayjs().hour(23).minute(59).second(59)],
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
|
-
const DEFAULT_MIN_YEAR = 1945;
|
|
66
|
-
const DEFAULT_MAX_YEAR = 2100;
|
|
67
65
|
|
|
68
66
|
const getMonthsDefault = () => {
|
|
69
67
|
return [
|
|
@@ -197,6 +195,9 @@ const getYearsDetailById = (listOfYears = []) => {
|
|
|
197
195
|
};
|
|
198
196
|
};
|
|
199
197
|
|
|
198
|
+
const DEFAULT_MIN_YEAR = 1945;
|
|
199
|
+
const DEFAULT_MAX_YEAR = 2100;
|
|
200
|
+
|
|
200
201
|
var SideEnum;
|
|
201
202
|
(function (SideEnum) {
|
|
202
203
|
SideEnum["left"] = "left";
|
|
@@ -233,6 +234,7 @@ class LibsUiComponentsDatetimePickerCustomRangesCalendarComponent {
|
|
|
233
234
|
computedDisplayTimeLeftInputMinute = computed(() => this.computedDisplayTimeInput(SideEnum.left, 'minute'));
|
|
234
235
|
computedDisplayTimeRightInputHour = computed(() => this.computedDisplayTimeInput(SideEnum.right, 'hour'));
|
|
235
236
|
computedDisplayTimeRightInputMinute = computed(() => this.computedDisplayTimeInput(SideEnum.right, 'minute'));
|
|
237
|
+
timepickerValueItem = signal({ lefthour: signal(0), leftminute: signal(0), righthour: signal(0), rightminute: signal(0) });
|
|
236
238
|
functionControls = new Map();
|
|
237
239
|
pickingDate = signal(false);
|
|
238
240
|
isShown = signal(false);
|
|
@@ -241,7 +243,6 @@ class LibsUiComponentsDatetimePickerCustomRangesCalendarComponent {
|
|
|
241
243
|
selectedLabel = signal(undefined);
|
|
242
244
|
keyCodeBackspace = signal(false);
|
|
243
245
|
checkBackspaceFocus = signal({ lefthour: signal(1), leftminute: signal(1), righthour: signal(1), rightminute: signal(1) });
|
|
244
|
-
timepickerValueItem = signal({ lefthour: signal(0), leftminute: signal(0), righthour: signal(0), rightminute: signal(0) });
|
|
245
246
|
isZero = signal(undefined);
|
|
246
247
|
oldDate = signal({ start: dayjs(0), end: dayjs(0) });
|
|
247
248
|
isSelectedData = signal({ leftmonth: false, leftyear: false, rightmonth: false, rightyear: false });
|
|
@@ -287,6 +288,7 @@ class LibsUiComponentsDatetimePickerCustomRangesCalendarComponent {
|
|
|
287
288
|
ngOnInit() {
|
|
288
289
|
const startDate = this.startDate()?.clone();
|
|
289
290
|
const endDate = this.endDate()?.clone();
|
|
291
|
+
console.log(startDate, endDate);
|
|
290
292
|
this.splitPickerDate.update(current => {
|
|
291
293
|
current.start.update(sideCurrent => {
|
|
292
294
|
sideCurrent.day = (startDate ?? dayjs().startOf('day')).date();
|
|
@@ -429,6 +431,7 @@ class LibsUiComponentsDatetimePickerCustomRangesCalendarComponent {
|
|
|
429
431
|
if (!this.hasTimePicker() || !this.timePickerIncrement()) {
|
|
430
432
|
return;
|
|
431
433
|
}
|
|
434
|
+
console.log('vao day');
|
|
432
435
|
this.startDate.update((current) => {
|
|
433
436
|
if (!current) {
|
|
434
437
|
return;
|
|
@@ -1474,7 +1477,21 @@ class LibsUiComponentsDatetimePickerCustomRangesComponent {
|
|
|
1474
1477
|
endDate = model(dayjs().endOf('day'));
|
|
1475
1478
|
showCustomRangeLabel = input(undefined);
|
|
1476
1479
|
keepCalendarOpeningWithRange = input(undefined);
|
|
1477
|
-
singleDateSelected = input(
|
|
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
|
+
});
|
|
1478
1495
|
dateRangeSelected = input(undefined, {
|
|
1479
1496
|
transform: (value) => {
|
|
1480
1497
|
if (!value) {
|
|
@@ -1516,10 +1533,37 @@ class LibsUiComponentsDatetimePickerCustomRangesComponent {
|
|
|
1516
1533
|
this.endDate.set(dayjs().endOf('day'));
|
|
1517
1534
|
}
|
|
1518
1535
|
const dateRangeSelected = this.dateRangeSelected();
|
|
1536
|
+
const singleDateSelected = this.singleDateSelected();
|
|
1519
1537
|
const customRange = {
|
|
1520
1538
|
id: this.dateOptions()?.customRangeLabel || '',
|
|
1521
1539
|
label: this.dateOptions()?.customRangeLabel || ''
|
|
1522
1540
|
};
|
|
1541
|
+
if (this.isSingle()) {
|
|
1542
|
+
if (this.hasTimePicker()) {
|
|
1543
|
+
const now = dayjs();
|
|
1544
|
+
this.startDate.update(current => {
|
|
1545
|
+
if (current) {
|
|
1546
|
+
current.set('hour', 10).set('minute', 30);
|
|
1547
|
+
// current.hour(now.hour()).minute(now.minute());
|
|
1548
|
+
}
|
|
1549
|
+
console.log('current', current, now, now.hour(), now.minute());
|
|
1550
|
+
return current;
|
|
1551
|
+
});
|
|
1552
|
+
this.endDate.update(current => {
|
|
1553
|
+
if (current) {
|
|
1554
|
+
current.hour(now.hour()).minute(now.minute());
|
|
1555
|
+
}
|
|
1556
|
+
return current;
|
|
1557
|
+
});
|
|
1558
|
+
console.log(this.startDate(), this.endDate());
|
|
1559
|
+
}
|
|
1560
|
+
if (singleDateSelected) {
|
|
1561
|
+
this.startDate.set(singleDateSelected.date);
|
|
1562
|
+
this.endDate.set(singleDateSelected.date);
|
|
1563
|
+
}
|
|
1564
|
+
this.renderRanges();
|
|
1565
|
+
return;
|
|
1566
|
+
}
|
|
1523
1567
|
if (dateRangeSelected) {
|
|
1524
1568
|
this.selectedQuickRange.set(dateRangeSelected.quickRangeId ? dateRangeSelected.quickRangeId : customRange.id);
|
|
1525
1569
|
this.chosenQuickRange.set(dateRangeSelected.quickRangeId ?? customRange.id);
|
|
@@ -1543,10 +1587,11 @@ class LibsUiComponentsDatetimePickerCustomRangesComponent {
|
|
|
1543
1587
|
}
|
|
1544
1588
|
renderRanges() {
|
|
1545
1589
|
if (this.isSingle()) {
|
|
1590
|
+
this.showCalTableInRanges.set(true);
|
|
1546
1591
|
return;
|
|
1547
1592
|
}
|
|
1548
1593
|
const rangesDefault = getDateRangeDefault();
|
|
1549
|
-
const ranges = this.
|
|
1594
|
+
const ranges = this.dateOptions()?.ranges;
|
|
1550
1595
|
this.quickRangesArray.set([]);
|
|
1551
1596
|
for (const key in ranges) {
|
|
1552
1597
|
const rangeValue = rangesDefault[key];
|
|
@@ -1783,6 +1828,16 @@ class LibsUiComponentsDatetimePickerComponent {
|
|
|
1783
1828
|
}
|
|
1784
1829
|
handlerPickerSingleDate(data) {
|
|
1785
1830
|
this.outSelectSingleDate.emit(data);
|
|
1831
|
+
this.chosenDateFromRanges.set({ selectedLabel: data.displayLabel });
|
|
1832
|
+
if (this.hasTimePicker()) {
|
|
1833
|
+
const startTime = dayjs(data.date).format('DD/MM/YYYY HH:mm');
|
|
1834
|
+
this.chosenDateFromRanges.update(current => {
|
|
1835
|
+
current.selectedLabel = `${startTime}`;
|
|
1836
|
+
return current;
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
this.singleDateSelected.set(data);
|
|
1840
|
+
this.popoverFunctionControlEvent()?.removePopoverOverlay();
|
|
1786
1841
|
}
|
|
1787
1842
|
handlerPickerDateRange(data) {
|
|
1788
1843
|
console.log(data);
|
|
@@ -1797,7 +1852,7 @@ class LibsUiComponentsDatetimePickerComponent {
|
|
|
1797
1852
|
const startTime = dayjs(data.startDate).format('DD/MM/YYYY HH:mm');
|
|
1798
1853
|
const endTime = dayjs(data.endDate).format('DD/MM/YYYY HH:mm');
|
|
1799
1854
|
this.chosenDateFromRanges.update(current => {
|
|
1800
|
-
current.selectedLabel = `${
|
|
1855
|
+
current.selectedLabel = `${startTime} - ${endTime}`;
|
|
1801
1856
|
return current;
|
|
1802
1857
|
});
|
|
1803
1858
|
}
|
|
@@ -1878,5 +1933,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.13", ngImpo
|
|
|
1878
1933
|
* Generated bundle index. Do not edit.
|
|
1879
1934
|
*/
|
|
1880
1935
|
|
|
1881
|
-
export { LibsUiComponentsDatetimePickerComponent };
|
|
1936
|
+
export { DEFAULT_MAX_YEAR, DEFAULT_MIN_YEAR, LibsUiComponentsDatetimePickerComponent };
|
|
1882
1937
|
//# sourceMappingURL=libs-ui-components-datetime-picker.mjs.map
|