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