nexheal-lib 0.0.61 → 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.
@@ -975,7 +975,7 @@ class CalendarControl {
975
975
  this.onChangeFn(out);
976
976
  this.onTouchedFn();
977
977
  this.weekSelected.emit({ start, end });
978
- this.dateSelected.emit(start);
978
+ this.dateSelected.emit(base);
979
979
  this.isOpen = false;
980
980
  return;
981
981
  }
@@ -2659,7 +2659,7 @@ class MultiselectControl {
2659
2659
  // Initialize filteredOptions to match all options
2660
2660
  this.filteredOptions = [...this.options];
2661
2661
  // Sync the input display in case selectedItems was set before init
2662
- this._updateSelectedItemList();
2662
+ this._syncSelectedItemList();
2663
2663
  }
2664
2664
  ngAfterViewChecked() {
2665
2665
  if (this.isDropdownOpen && !this.dropdownInitialized) {
@@ -2678,6 +2678,8 @@ class MultiselectControl {
2678
2678
  // When the parent replaces “options,” we reapply any filtering and “select all” logic
2679
2679
  this.filteredOptions = [...this.options];
2680
2680
  this._recomputeSelectAllState();
2681
+ // Sync input display (selectedItems may already be set from writeValue)
2682
+ this._syncSelectedItemList();
2681
2683
  }
2682
2684
  }
2683
2685
  writeValue(value) {
@@ -2686,7 +2688,7 @@ class MultiselectControl {
2686
2688
  this._isPrimitivePatch = false;
2687
2689
  this._pendingPrimitiveValues = [];
2688
2690
  this.selectedItems = [];
2689
- this._updateSelectedItemList();
2691
+ this._syncSelectedItemList();
2690
2692
  this.selectAllChecked = false;
2691
2693
  return;
2692
2694
  }
@@ -2697,15 +2699,16 @@ class MultiselectControl {
2697
2699
  this._pendingPrimitiveValues = [...value];
2698
2700
  this._mapPrimitivesToObjects();
2699
2701
  this._recomputeSelectAllState();
2702
+ this._syncSelectedItemList();
2700
2703
  return;
2701
2704
  }
2702
2705
  // CASE B: array of full objects (with `id` or whatever `optionValueProperty` is)
2703
2706
  if (value.length > 0 &&
2704
2707
  typeof value[0] === "object" &&
2705
2708
  value[0][this.optionValueProperty] != null) {
2706
- // Immediately use the value objects for display (they have displayname)
2709
+ // Immediately use the value objects for display
2707
2710
  this.selectedItems = [...value];
2708
- this._updateSelectedItemList();
2711
+ this._syncSelectedItemList();
2709
2712
  // Also set up pending mapping to sync with option references when available
2710
2713
  const idArray = value.map((obj) => obj[this.optionValueProperty]);
2711
2714
  this._isPrimitivePatch = true;
@@ -2719,7 +2722,7 @@ class MultiselectControl {
2719
2722
  this._isPrimitivePatch = false;
2720
2723
  this._pendingPrimitiveValues = [];
2721
2724
  this.selectedItems = [...value];
2722
- this._updateSelectedItemList();
2725
+ this._syncSelectedItemList();
2723
2726
  this.onChange(this.selectedItems);
2724
2727
  this._recomputeSelectAllState();
2725
2728
  }
@@ -2732,7 +2735,7 @@ class MultiselectControl {
2732
2735
  // Find matching option‐objects whose ID property is in the pending list
2733
2736
  const matched = this._options.filter((opt) => this._pendingPrimitiveValues.includes(opt[this.optionValueProperty]));
2734
2737
  this.selectedItems = matched;
2735
- this._updateSelectedItemList();
2738
+ this._syncSelectedItemList();
2736
2739
  // Notify “onChange” with the full‐object selection
2737
2740
  this.onChange(this.selectedItems);
2738
2741
  this._isPrimitivePatch = false;
@@ -2820,13 +2823,13 @@ class MultiselectControl {
2820
2823
  // Remove all filtered options from selection
2821
2824
  this.selectedItems = this.selectedItems.filter((item) => !this.filteredOptions.includes(item));
2822
2825
  }
2823
- this._updateSelectedItemList();
2826
+ this._syncSelectedItemList();
2824
2827
  this.onChange(this.selectedItems);
2825
2828
  this.optionsSelected.emit(this.selectedItems);
2826
2829
  }
2827
2830
  removeSelectedOption(option) {
2828
2831
  this.selectedItems = this.selectedItems.filter((item) => item !== option);
2829
- this._updateSelectedItemList();
2832
+ this._syncSelectedItemList();
2830
2833
  this.onChange(this.selectedItems);
2831
2834
  this.onTouched();
2832
2835
  this.optionsSelected.emit(this.selectedItems);
@@ -2838,7 +2841,7 @@ class MultiselectControl {
2838
2841
  else {
2839
2842
  this.selectedItems = [...this.selectedItems, option];
2840
2843
  }
2841
- this._updateSelectedItemList();
2844
+ this._syncSelectedItemList();
2842
2845
  // Update “select all” checkbox
2843
2846
  this._recomputeSelectAllState();
2844
2847
  // Notify form that selection changed
@@ -2952,7 +2955,7 @@ class MultiselectControl {
2952
2955
  }
2953
2956
  resetSelection() {
2954
2957
  this.selectedItems = [];
2955
- this._updateSelectedItemList();
2958
+ this._syncSelectedItemList();
2956
2959
  this.onChange([]);
2957
2960
  this.onTouched();
2958
2961
  this.isDropdownOpen = false;
@@ -2963,17 +2966,16 @@ class MultiselectControl {
2963
2966
  this.isDropdownOpen = false;
2964
2967
  this._recomputeSelectAllState();
2965
2968
  }
2966
- _updateSelectedItemList() {
2969
+ _syncSelectedItemList() {
2967
2970
  if (this._options && this._options.length > 0 && this.selectedItems.length === this._options.length) {
2968
2971
  this.selectedItemList = "All Items Selected";
2969
2972
  }
2970
2973
  else {
2971
- this.selectedItemList = this.selectedItems
2972
- .map((item) => item[this.optionDisplayProperty])
2974
+ this.selectedItemList = (this.selectedItems ?? [])
2975
+ .map((item) => item?.[this.optionDisplayProperty])
2976
+ .filter((label) => !!label)
2973
2977
  .join(", ");
2974
2978
  }
2975
- // Sync the form control value so the input displays the selected items
2976
- // (formControl binding overrides [value], so we must set it explicitly)
2977
2979
  this.inputControl.setValue(this.selectedItemList, { emitEvent: false });
2978
2980
  }
2979
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 });