nexheal-lib 0.0.60 → 0.0.62

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.
@@ -581,7 +581,8 @@ class CalendarControl {
581
581
  return;
582
582
  }
583
583
  }
584
- // Single date: compute week range via getWeekRange (Sun–Sat default)
584
+ // Single date: trust it as the week start (the parent already computed
585
+ // the correct start day), and add 6 days for the end.
585
586
  const parsed = this.parseDate(parts[0]?.trim()) || this.parseDate(raw);
586
587
  if (!parsed) {
587
588
  this.selectedWeekStart = null;
@@ -590,7 +591,10 @@ class CalendarControl {
590
591
  this.inputControl.setValue("", { emitEvent: false });
591
592
  return;
592
593
  }
593
- const { start, end } = this.getWeekRange(parsed);
594
+ const start = new Date(parsed.getFullYear(), parsed.getMonth(), parsed.getDate());
595
+ const end = new Date(start);
596
+ end.setDate(start.getDate() + 6);
597
+ end.setHours(23, 59, 59, 999);
594
598
  this.selectedWeekStart = start;
595
599
  this.selectedWeekEnd = end;
596
600
  this.selectedDate = start;
@@ -971,7 +975,7 @@ class CalendarControl {
971
975
  this.onChangeFn(out);
972
976
  this.onTouchedFn();
973
977
  this.weekSelected.emit({ start, end });
974
- this.dateSelected.emit(start);
978
+ this.dateSelected.emit(base);
975
979
  this.isOpen = false;
976
980
  return;
977
981
  }
@@ -2655,7 +2659,7 @@ class MultiselectControl {
2655
2659
  // Initialize filteredOptions to match all options
2656
2660
  this.filteredOptions = [...this.options];
2657
2661
  // Sync the input display in case selectedItems was set before init
2658
- this._updateSelectedItemList();
2662
+ this._syncSelectedItemList();
2659
2663
  }
2660
2664
  ngAfterViewChecked() {
2661
2665
  if (this.isDropdownOpen && !this.dropdownInitialized) {
@@ -2674,6 +2678,8 @@ class MultiselectControl {
2674
2678
  // When the parent replaces “options,” we reapply any filtering and “select all” logic
2675
2679
  this.filteredOptions = [...this.options];
2676
2680
  this._recomputeSelectAllState();
2681
+ // Sync input display (selectedItems may already be set from writeValue)
2682
+ this._syncSelectedItemList();
2677
2683
  }
2678
2684
  }
2679
2685
  writeValue(value) {
@@ -2682,7 +2688,7 @@ class MultiselectControl {
2682
2688
  this._isPrimitivePatch = false;
2683
2689
  this._pendingPrimitiveValues = [];
2684
2690
  this.selectedItems = [];
2685
- this._updateSelectedItemList();
2691
+ this._syncSelectedItemList();
2686
2692
  this.selectAllChecked = false;
2687
2693
  return;
2688
2694
  }
@@ -2693,13 +2699,17 @@ class MultiselectControl {
2693
2699
  this._pendingPrimitiveValues = [...value];
2694
2700
  this._mapPrimitivesToObjects();
2695
2701
  this._recomputeSelectAllState();
2702
+ this._syncSelectedItemList();
2696
2703
  return;
2697
2704
  }
2698
2705
  // CASE B: array of full objects (with `id` or whatever `optionValueProperty` is)
2699
2706
  if (value.length > 0 &&
2700
2707
  typeof value[0] === "object" &&
2701
2708
  value[0][this.optionValueProperty] != null) {
2702
- // Convert to an array of IDs, then treat exactly like CASE A
2709
+ // Immediately use the value objects for display
2710
+ this.selectedItems = [...value];
2711
+ this._syncSelectedItemList();
2712
+ // Also set up pending mapping to sync with option references when available
2703
2713
  const idArray = value.map((obj) => obj[this.optionValueProperty]);
2704
2714
  this._isPrimitivePatch = true;
2705
2715
  this._pendingPrimitiveValues = idArray;
@@ -2712,7 +2722,7 @@ class MultiselectControl {
2712
2722
  this._isPrimitivePatch = false;
2713
2723
  this._pendingPrimitiveValues = [];
2714
2724
  this.selectedItems = [...value];
2715
- this._updateSelectedItemList();
2725
+ this._syncSelectedItemList();
2716
2726
  this.onChange(this.selectedItems);
2717
2727
  this._recomputeSelectAllState();
2718
2728
  }
@@ -2725,7 +2735,7 @@ class MultiselectControl {
2725
2735
  // Find matching option‐objects whose ID property is in the pending list
2726
2736
  const matched = this._options.filter((opt) => this._pendingPrimitiveValues.includes(opt[this.optionValueProperty]));
2727
2737
  this.selectedItems = matched;
2728
- this._updateSelectedItemList();
2738
+ this._syncSelectedItemList();
2729
2739
  // Notify “onChange” with the full‐object selection
2730
2740
  this.onChange(this.selectedItems);
2731
2741
  this._isPrimitivePatch = false;
@@ -2813,13 +2823,13 @@ class MultiselectControl {
2813
2823
  // Remove all filtered options from selection
2814
2824
  this.selectedItems = this.selectedItems.filter((item) => !this.filteredOptions.includes(item));
2815
2825
  }
2816
- this._updateSelectedItemList();
2826
+ this._syncSelectedItemList();
2817
2827
  this.onChange(this.selectedItems);
2818
2828
  this.optionsSelected.emit(this.selectedItems);
2819
2829
  }
2820
2830
  removeSelectedOption(option) {
2821
2831
  this.selectedItems = this.selectedItems.filter((item) => item !== option);
2822
- this._updateSelectedItemList();
2832
+ this._syncSelectedItemList();
2823
2833
  this.onChange(this.selectedItems);
2824
2834
  this.onTouched();
2825
2835
  this.optionsSelected.emit(this.selectedItems);
@@ -2831,7 +2841,7 @@ class MultiselectControl {
2831
2841
  else {
2832
2842
  this.selectedItems = [...this.selectedItems, option];
2833
2843
  }
2834
- this._updateSelectedItemList();
2844
+ this._syncSelectedItemList();
2835
2845
  // Update “select all” checkbox
2836
2846
  this._recomputeSelectAllState();
2837
2847
  // Notify form that selection changed
@@ -2945,7 +2955,7 @@ class MultiselectControl {
2945
2955
  }
2946
2956
  resetSelection() {
2947
2957
  this.selectedItems = [];
2948
- this._updateSelectedItemList();
2958
+ this._syncSelectedItemList();
2949
2959
  this.onChange([]);
2950
2960
  this.onTouched();
2951
2961
  this.isDropdownOpen = false;
@@ -2956,17 +2966,16 @@ class MultiselectControl {
2956
2966
  this.isDropdownOpen = false;
2957
2967
  this._recomputeSelectAllState();
2958
2968
  }
2959
- _updateSelectedItemList() {
2969
+ _syncSelectedItemList() {
2960
2970
  if (this._options && this._options.length > 0 && this.selectedItems.length === this._options.length) {
2961
2971
  this.selectedItemList = "All Items Selected";
2962
2972
  }
2963
2973
  else {
2964
- this.selectedItemList = this.selectedItems
2965
- .map((item) => item[this.optionDisplayProperty])
2974
+ this.selectedItemList = (this.selectedItems ?? [])
2975
+ .map((item) => item?.[this.optionDisplayProperty])
2976
+ .filter((label) => !!label)
2966
2977
  .join(", ");
2967
2978
  }
2968
- // Sync the form control value so the input displays the selected items
2969
- // (formControl binding overrides [value], so we must set it explicitly)
2970
2979
  this.inputControl.setValue(this.selectedItemList, { emitEvent: false });
2971
2980
  }
2972
2981
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.25", ngImport: i0, type: MultiselectControl, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });