@lesterarte/sefin-ui 0.0.81 → 0.0.83

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.
@@ -6582,7 +6582,11 @@ class TableComponent {
6582
6582
  /** Column definitions */
6583
6583
  columns = [];
6584
6584
  /** Table data */
6585
- data = [];
6585
+ set data(value) {
6586
+ this.dataSignal.set(value ?? []);
6587
+ }
6588
+ /** Internal signal for data so computed signals react to Input changes (OnPush + computed require signal deps) */
6589
+ dataSignal = signal([], ...(ngDevMode ? [{ debugName: "dataSignal" }] : []));
6586
6590
  /** Property key used for tracking rows (default: 'id') */
6587
6591
  trackByKey = 'id';
6588
6592
  /** Empty state message */
@@ -6657,24 +6661,25 @@ class TableComponent {
6657
6661
  currentPageSize = signal(this.pageSize, ...(ngDevMode ? [{ debugName: "currentPageSize" }] : []));
6658
6662
  // Computed sorted and paginated data
6659
6663
  sortedData = computed(() => {
6664
+ const data = this.dataSignal();
6660
6665
  // Early returns for performance
6661
6666
  if (!this.sort || !this.currentSortColumn() || this.serverSide) {
6662
- return this.data;
6667
+ return data;
6663
6668
  }
6664
6669
  const column = this.columns.find((col) => col.key === this.currentSortColumn());
6665
6670
  if (!column || !column.sortable) {
6666
- return this.data;
6671
+ return data;
6667
6672
  }
6668
6673
  const direction = this.currentSortDirection();
6669
6674
  if (!direction) {
6670
- return this.data;
6675
+ return data;
6671
6676
  }
6672
6677
  // Early return if no data to sort
6673
- if (!this.data || this.data.length === 0) {
6674
- return this.data;
6678
+ if (!data || data.length === 0) {
6679
+ return data;
6675
6680
  }
6676
6681
  // Create a copy to avoid mutating original data
6677
- const sorted = [...this.data].sort((a, b) => {
6682
+ const sorted = [...data].sort((a, b) => {
6678
6683
  const aValue = this.getCellValue(a, column);
6679
6684
  const bValue = this.getCellValue(b, column);
6680
6685
  // Handle null/undefined values - place them at the end
@@ -6791,8 +6796,11 @@ class TableComponent {
6791
6796
  else if (page !== undefined && page < 1) {
6792
6797
  this.currentPage.set(1);
6793
6798
  }
6799
+ // OnPush: ensure view updates when parent syncs page (e.g. server-side, navigating back to cached page).
6800
+ this.cdr.markForCheck();
6794
6801
  }
6795
- if (changes['data'] && this.serverSide) {
6802
+ if (changes['data']) {
6803
+ // OnPush: ensure view updates when parent passes new data (e.g. new reference when navigating back to cached page).
6796
6804
  this.cdr.markForCheck();
6797
6805
  }
6798
6806
  if (changes['columns'] || changes['data']) {