nexheal-lib 0.0.59 → 0.0.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/nexheal-lib.mjs +60 -10
- package/fesm2022/nexheal-lib.mjs.map +1 -1
- package/package.json +1 -1
package/fesm2022/nexheal-lib.mjs
CHANGED
|
@@ -562,11 +562,27 @@ class CalendarControl {
|
|
|
562
562
|
this.writeValueRange(value);
|
|
563
563
|
return;
|
|
564
564
|
}
|
|
565
|
-
// Week mode: value is a "start - end" range string
|
|
565
|
+
// Week mode: value is a "start - end" range string, a single date, or ISO string
|
|
566
566
|
if (this.selectionMode === "week") {
|
|
567
567
|
const raw = String(value);
|
|
568
|
-
const
|
|
569
|
-
|
|
568
|
+
const parts = raw.split(" - ");
|
|
569
|
+
// If we got a proper "start - end" range string, use both dates directly
|
|
570
|
+
// instead of recalculating via getWeekRange (which always does Sun–Sat)
|
|
571
|
+
if (parts.length === 2) {
|
|
572
|
+
const s = this.parseDate(parts[0].trim());
|
|
573
|
+
const e = this.parseDate(parts[1].trim());
|
|
574
|
+
if (s && e) {
|
|
575
|
+
this.selectedWeekStart = s;
|
|
576
|
+
this.selectedWeekEnd = e;
|
|
577
|
+
this.selectedDate = s;
|
|
578
|
+
this.displayMonth = s.getMonth();
|
|
579
|
+
this.displayYear = s.getFullYear();
|
|
580
|
+
this.inputControl.setValue(this.formatWeek(s, e), { emitEvent: false });
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
// Single date: compute week range via getWeekRange (Sun–Sat default)
|
|
585
|
+
const parsed = this.parseDate(parts[0]?.trim()) || this.parseDate(raw);
|
|
570
586
|
if (!parsed) {
|
|
571
587
|
this.selectedWeekStart = null;
|
|
572
588
|
this.selectedWeekEnd = null;
|
|
@@ -739,14 +755,35 @@ class CalendarControl {
|
|
|
739
755
|
this.blurEvent.emit();
|
|
740
756
|
return;
|
|
741
757
|
}
|
|
742
|
-
// typed a different value ->
|
|
743
|
-
const
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
758
|
+
// typed a different value -> try to use both dates from range, else recompute
|
|
759
|
+
const blurParts = rawWeek.split(" - ");
|
|
760
|
+
let start;
|
|
761
|
+
let end;
|
|
762
|
+
if (blurParts.length === 2) {
|
|
763
|
+
const s = this.parseDate(blurParts[0].trim());
|
|
764
|
+
const e = this.parseDate(blurParts[1].trim());
|
|
765
|
+
if (s && e) {
|
|
766
|
+
start = s;
|
|
767
|
+
end = e;
|
|
768
|
+
}
|
|
769
|
+
else if (s) {
|
|
770
|
+
({ start, end } = this.getWeekRange(s));
|
|
771
|
+
}
|
|
772
|
+
else {
|
|
773
|
+
this.inputControl.setValue(current, { emitEvent: false });
|
|
774
|
+
this.blurEvent.emit();
|
|
775
|
+
return;
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
else {
|
|
779
|
+
const parsed = this.parseDate(rawWeek);
|
|
780
|
+
if (!parsed) {
|
|
781
|
+
this.inputControl.setValue(current, { emitEvent: false });
|
|
782
|
+
this.blurEvent.emit();
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
({ start, end } = this.getWeekRange(parsed));
|
|
748
786
|
}
|
|
749
|
-
const { start, end } = this.getWeekRange(parsed);
|
|
750
787
|
this.selectedWeekStart = start;
|
|
751
788
|
this.selectedWeekEnd = end;
|
|
752
789
|
this.selectedDate = start;
|
|
@@ -1143,6 +1180,17 @@ class CalendarControl {
|
|
|
1143
1180
|
}
|
|
1144
1181
|
/** writeValue delegate for range mode. */
|
|
1145
1182
|
writeValueRange(value) {
|
|
1183
|
+
// Handle { start: Date, end: Date } objects directly (e.g. from parent patchValue)
|
|
1184
|
+
if (typeof value === 'object' && value !== null && value.start instanceof Date && value.end instanceof Date) {
|
|
1185
|
+
this.rangeStart = value.start;
|
|
1186
|
+
this.rangeEnd = value.end;
|
|
1187
|
+
this.selectedDate = value.start;
|
|
1188
|
+
this.rangePicking = 'start';
|
|
1189
|
+
this.displayMonth = value.start.getMonth();
|
|
1190
|
+
this.displayYear = value.start.getFullYear();
|
|
1191
|
+
this.inputControl.setValue(this.formatRange(value.start, value.end), { emitEvent: false });
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1146
1194
|
const raw = String(value);
|
|
1147
1195
|
const parts = raw.split(" - ");
|
|
1148
1196
|
if (parts.length === 2) {
|
|
@@ -2606,6 +2654,8 @@ class MultiselectControl {
|
|
|
2606
2654
|
});
|
|
2607
2655
|
// Initialize filteredOptions to match all options
|
|
2608
2656
|
this.filteredOptions = [...this.options];
|
|
2657
|
+
// Sync the input display in case selectedItems was set before init
|
|
2658
|
+
this._updateSelectedItemList();
|
|
2609
2659
|
}
|
|
2610
2660
|
ngAfterViewChecked() {
|
|
2611
2661
|
if (this.isDropdownOpen && !this.dropdownInitialized) {
|