@acorex/components 21.0.0-next.29 → 21.0.0-next.30

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.
@@ -138,6 +138,14 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
138
138
 
139
139
  class AXDataTableColumnComponent {
140
140
  constructor() {
141
+ /**
142
+ * Width of the column.
143
+ * - string: e.g., '180px', '20%'
144
+ * - number: e.g., 180 (treated as pixels)
145
+ * - 'auto': automatically fits to content after data load
146
+ *
147
+ * @defaultValue 'auto'
148
+ */
141
149
  this.width = 'auto';
142
150
  this.allowSorting = false;
143
151
  this.allowResizing = false;
@@ -1430,14 +1438,6 @@ class AXDataTableComponent extends AXBaseDataTable {
1430
1438
  * @defaultValue `true`
1431
1439
  */
1432
1440
  this.alternative = true;
1433
- /**
1434
- * Auto-fits all columns width on initial data load.
1435
- * Only applies to columns with allowResizing=true.
1436
- * Fixed columns are skipped by default.
1437
- *
1438
- * @defaultValue `false`
1439
- */
1440
- this.autoFitColumnsOnLoad = false;
1441
1441
  /**
1442
1442
  * Indicates if the table header should be displayed.
1443
1443
  *
@@ -1650,22 +1650,15 @@ class AXDataTableComponent extends AXBaseDataTable {
1650
1650
  this.columns.changes.pipe(this._unsubscriber.takeUntilDestroy).subscribe((cols) => {
1651
1651
  this.columnsList.set(cols.toArray());
1652
1652
  });
1653
- // Auto-fit columns on init if requested
1654
- if (this.autoFitColumnsOnLoad) {
1655
- // Wait for first data load with a flag to ensure it only runs once
1656
- this.dataSource.onChanged.pipe(this._unsubscriber.takeUntilDestroy).subscribe((data) => {
1657
- if (data.items.length > 0) {
1658
- // Delay to ensure DOM is ready
1659
- setTimeout(() => {
1660
- this.autoFitAllColumns({
1661
- skipFixed: false,
1662
- skipLoading: false,
1663
- maxWidth: 500,
1664
- });
1665
- }, 100);
1666
- }
1667
- });
1668
- }
1653
+ // Auto-fit columns with width='auto' after data load
1654
+ this.dataSource.onChanged.pipe(this._unsubscriber.takeUntilDestroy).subscribe((data) => {
1655
+ if (data.items.length > 0) {
1656
+ // Delay to ensure DOM is ready
1657
+ setTimeout(() => {
1658
+ this.autoFitColumnsWithAutoWidth();
1659
+ }, 100);
1660
+ }
1661
+ });
1669
1662
  }
1670
1663
  /**
1671
1664
  * @ignore
@@ -1920,6 +1913,30 @@ class AXDataTableComponent extends AXBaseDataTable {
1920
1913
  if (firstEndColumn)
1921
1914
  firstEndColumn['isFirstFixedColumn'] = true;
1922
1915
  }
1916
+ /**
1917
+ * Auto-fits columns that have width='auto'.
1918
+ * Called automatically after data load.
1919
+ *
1920
+ * @ignore
1921
+ */
1922
+ autoFitColumnsWithAutoWidth() {
1923
+ const autoWidthColumns = [];
1924
+ this.columns.forEach((column, index) => {
1925
+ // Only auto-fit if width is explicitly set to 'auto'
1926
+ if (column.width === 'auto') {
1927
+ autoWidthColumns.push(index);
1928
+ try {
1929
+ this.autoFitColumn(index, { maxWidth: 500 });
1930
+ }
1931
+ catch (error) {
1932
+ console.error(`Failed to auto-fit column ${index}:`, error);
1933
+ }
1934
+ }
1935
+ });
1936
+ if (autoWidthColumns.length > 0) {
1937
+ console.log(`Auto-fitted ${autoWidthColumns.length} column(s) with width='auto': indices ${autoWidthColumns.join(', ')}`);
1938
+ }
1939
+ }
1923
1940
  /**
1924
1941
  * Auto-fits all columns width based on their content.
1925
1942
  *
@@ -2087,7 +2104,7 @@ class AXDataTableComponent extends AXBaseDataTable {
2087
2104
  }
2088
2105
  }
2089
2106
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.9", ngImport: i0, type: AXDataTableComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
2090
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: AXDataTableComponent, isStandalone: true, selector: "ax-data-table", inputs: { dataSource: "dataSource", selectedRows: "selectedRows", parentField: "parentField", rowTemplate: "rowTemplate", emptyTemplate: "emptyTemplate", noDataTemplate: "noDataTemplate", alternative: "alternative", autoFitColumnsOnLoad: "autoFitColumnsOnLoad", showHeader: "showHeader", fixedHeader: "fixedHeader", showFooter: "showFooter", fixedFooter: "fixedFooter", itemHeight: "itemHeight", allowReordering: "allowReordering", paging: "paging", fetchDataMode: "fetchDataMode", loading: "loading", focusedRow: "focusedRow" }, outputs: { selectedRowsChange: "selectedRowsChange", focusedRowChange: "focusedRowChange", onRowClick: "onRowClick", onRowDbClick: "onRowDbClick", onColumnsOrderChanged: "onColumnsOrderChanged", onColumnSizeChanged: "onColumnSizeChanged", onPageChanged: "onPageChanged" }, host: { attributes: { "ngSkipHydration": "true" } }, providers: [
2107
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.3.9", type: AXDataTableComponent, isStandalone: true, selector: "ax-data-table", inputs: { dataSource: "dataSource", selectedRows: "selectedRows", parentField: "parentField", rowTemplate: "rowTemplate", emptyTemplate: "emptyTemplate", noDataTemplate: "noDataTemplate", alternative: "alternative", showHeader: "showHeader", fixedHeader: "fixedHeader", showFooter: "showFooter", fixedFooter: "fixedFooter", itemHeight: "itemHeight", allowReordering: "allowReordering", paging: "paging", fetchDataMode: "fetchDataMode", loading: "loading", focusedRow: "focusedRow" }, outputs: { selectedRowsChange: "selectedRowsChange", focusedRowChange: "focusedRowChange", onRowClick: "onRowClick", onRowDbClick: "onRowDbClick", onColumnsOrderChanged: "onColumnsOrderChanged", onColumnSizeChanged: "onColumnSizeChanged", onPageChanged: "onPageChanged" }, host: { attributes: { "ngSkipHydration": "true" } }, providers: [
2091
2108
  { provide: AXBaseDataTable, useExisting: AXDataTableComponent },
2092
2109
  AXUnsubscriber,
2093
2110
  { provide: AXComponent, useExisting: AXDataTableComponent },
@@ -2135,8 +2152,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.9", ngImpor
2135
2152
  type: Input
2136
2153
  }], alternative: [{
2137
2154
  type: Input
2138
- }], autoFitColumnsOnLoad: [{
2139
- type: Input
2140
2155
  }], showHeader: [{
2141
2156
  type: Input
2142
2157
  }], fixedHeader: [{