@aquera/ngx-smart-table 0.0.21 → 0.0.22

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.
@@ -3680,6 +3680,7 @@ class NileSelectEditor {
3680
3680
  this.eventListeners = [];
3681
3681
  this.currentOptions = [];
3682
3682
  this.trackedValues = []; // Track selected values for virtual scroll
3683
+ this.hasChangeOccurred = false; // Whether a nile-change event has fired
3683
3684
  // Handle Observable options
3684
3685
  if (isObservable(options.options)) {
3685
3686
  this.optionsSubscription = options.options.subscribe(opts => {
@@ -3739,6 +3740,7 @@ class NileSelectEditor {
3739
3740
  setInitialValue(value) {
3740
3741
  if (!this.select)
3741
3742
  return;
3743
+ this.hasChangeOccurred = false;
3742
3744
  if (this.options.multiple) {
3743
3745
  // Handle multiple selection - value should be array
3744
3746
  if (Array.isArray(value)) {
@@ -3943,6 +3945,7 @@ class NileSelectEditor {
3943
3945
  const customEvent = e;
3944
3946
  const newValue = customEvent.detail?.value;
3945
3947
  if (newValue !== undefined) {
3948
+ this.hasChangeOccurred = true;
3946
3949
  if (Array.isArray(newValue)) {
3947
3950
  this.trackedValues = [...newValue];
3948
3951
  }
@@ -4081,17 +4084,16 @@ class NileSelectEditor {
4081
4084
  if (!this.select) {
4082
4085
  return (this.options.multiple ? [] : '');
4083
4086
  }
4084
- // For multi-select, prefer tracked values (more reliable for virtual scroll)
4085
4087
  if (this.options.multiple) {
4086
- // Use tracked values if available, otherwise try component value
4087
- let values = this.trackedValues.length > 0 ? this.trackedValues : this.select.value;
4088
+ // If a change event fired, always use trackedValues (even if empty = all unchecked).
4089
+ // Only fall back to the component value when no change has occurred yet.
4090
+ let values = this.hasChangeOccurred ? this.trackedValues : this.select.value;
4088
4091
  if (Array.isArray(values)) {
4089
4092
  return values.filter((v) => v !== undefined && v !== null && v !== '');
4090
4093
  }
4091
4094
  return (values ? [values] : []);
4092
4095
  }
4093
- // For single-select, use tracked values or component value
4094
- let value = this.trackedValues.length > 0 ? this.trackedValues[0] : this.select.value;
4096
+ let value = this.hasChangeOccurred ? (this.trackedValues[0] ?? '') : this.select.value;
4095
4097
  return (Array.isArray(value) ? (value.length > 0 ? value[0] : '') : (value || ''));
4096
4098
  }
4097
4099
  }