ngx-lite-form 1.4.0 → 1.4.1
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/README.md +1 -1
- package/fesm2022/ngx-lite-form.mjs +11 -16
- package/fesm2022/ngx-lite-form.mjs.map +1 -1
- package/index.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -511,4 +511,4 @@ This project is licensed under the MIT License - see the [LICENSE](https://githu
|
|
|
511
511
|
|
|
512
512
|
---
|
|
513
513
|
## Changelog
|
|
514
|
-
- See [docs/CHANGELOG.md](https://github.com/liangk/lite-form/blob/main/docs/CHANGELOG.md) for the full historical record, including the latest `v1.4.
|
|
514
|
+
- See [docs/CHANGELOG.md](https://github.com/liangk/lite-form/blob/main/docs/CHANGELOG.md) for the full historical record, including the latest `v1.4.1` release with LiteDateTime selection state fix.
|
|
@@ -1351,12 +1351,12 @@ class LiteDateTime {
|
|
|
1351
1351
|
selectedHour = new Date().getHours();
|
|
1352
1352
|
selectedMinute = 0;
|
|
1353
1353
|
selectedDateTime = null;
|
|
1354
|
-
// Signal to track
|
|
1355
|
-
|
|
1354
|
+
// Signal to track selection changes for reactivity
|
|
1355
|
+
selectionChangeSignal = signal(0, ...(ngDevMode ? [{ debugName: "selectionChangeSignal" }] : []));
|
|
1356
1356
|
// Computed calendar days - only recalculates when dependencies change
|
|
1357
1357
|
calendarDays = computed(() => {
|
|
1358
|
-
// This makes the computed reactive to
|
|
1359
|
-
|
|
1358
|
+
// This makes the computed reactive to selection changes
|
|
1359
|
+
this.selectionChangeSignal();
|
|
1360
1360
|
return this.getMonthDays(this.currentMonth());
|
|
1361
1361
|
}, ...(ngDevMode ? [{ debugName: "calendarDays" }] : []));
|
|
1362
1362
|
getMonthDays(monthDate) {
|
|
@@ -1432,7 +1432,7 @@ class LiteDateTime {
|
|
|
1432
1432
|
const date = new Date(value);
|
|
1433
1433
|
// console.log('Form value changed:', value, date, isNaN(date.getTime()));
|
|
1434
1434
|
if (!isNaN(date.getTime())) {
|
|
1435
|
-
console.log('Formatted Date:', this.formatDate(date, this.format()))
|
|
1435
|
+
// console.log('Formatted Date:', this.formatDate(date, this.format()))
|
|
1436
1436
|
this.formattedValue.set(this.formatDate(date, this.format()));
|
|
1437
1437
|
}
|
|
1438
1438
|
else {
|
|
@@ -1501,10 +1501,6 @@ class LiteDateTime {
|
|
|
1501
1501
|
};
|
|
1502
1502
|
const dateString = this.toLocalISOString(this.selectedDateTime.date);
|
|
1503
1503
|
this.control().formControl.setValue(dateString);
|
|
1504
|
-
const calDate = this.calendarDays().find(d => this.isSameDay(d.date, date));
|
|
1505
|
-
if (calDate) {
|
|
1506
|
-
calDate.isSelected = true;
|
|
1507
|
-
}
|
|
1508
1504
|
}
|
|
1509
1505
|
parseFormattedDate(dateString, format) {
|
|
1510
1506
|
try {
|
|
@@ -1635,17 +1631,16 @@ class LiteDateTime {
|
|
|
1635
1631
|
this.currentMonth.set(newDate);
|
|
1636
1632
|
}
|
|
1637
1633
|
selectDate(day) {
|
|
1634
|
+
// Clear previous selection
|
|
1638
1635
|
if (this.selectedDateTime) {
|
|
1639
1636
|
this.selectedDateTime.isSelected = false;
|
|
1640
1637
|
}
|
|
1641
|
-
//
|
|
1642
|
-
// this.selectedDateTime.isSelected = true;
|
|
1638
|
+
// Set new selection
|
|
1643
1639
|
this.setDateTimeSelected(day.date);
|
|
1644
|
-
//
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
// this.control().formControl.markAsTouched();
|
|
1640
|
+
// Trigger calendar re-render to clear previous visual selection
|
|
1641
|
+
this.selectionChangeSignal.update(v => v + 1);
|
|
1642
|
+
this.control().formControl.markAsDirty();
|
|
1643
|
+
this.control().formControl.markAsTouched();
|
|
1649
1644
|
}
|
|
1650
1645
|
isSameDay(date1, date2) {
|
|
1651
1646
|
if (!date2)
|