@shival99/z-ui 1.9.20 → 1.9.21

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.
@@ -3321,8 +3321,11 @@ class ZTableComponent {
3321
3321
  const columns = this.zConfig().columns ?? [];
3322
3322
  const findActionColumn = (cols) => {
3323
3323
  for (const col of cols) {
3324
- if (isBodyConfig(col.body) && col.body.actions && col.body.actions.actions?.length > 0) {
3325
- return { columnId: col.id, config: col.body.actions };
3324
+ if (isBodyConfig(col.body)) {
3325
+ const actionConfig = this._getActionColumnConfig(col.body);
3326
+ if (actionConfig) {
3327
+ return { columnId: col.id, config: actionConfig };
3328
+ }
3326
3329
  }
3327
3330
  if (col.columns?.length) {
3328
3331
  const found = findActionColumn(col.columns);
@@ -3341,7 +3344,7 @@ class ZTableComponent {
3341
3344
  const maxVisible = config.maxVisible ?? 3;
3342
3345
  let totalActions = maxVisible;
3343
3346
  if (typeof config.actions !== 'function') {
3344
- totalActions = config.actions.filter(a => !a.hidden).length;
3347
+ totalActions = config.actions.filter(a => a.hidden !== true).length;
3345
3348
  }
3346
3349
  const visibleCount = Math.min(totalActions, maxVisible);
3347
3350
  const hasOverflow = totalActions > maxVisible;
@@ -5168,6 +5171,31 @@ class ZTableComponent {
5168
5171
  _filterServerModeSorting(sorting) {
5169
5172
  return sorting.filter(sort => !this._isColumnSortModeLocal(sort.id));
5170
5173
  }
5174
+ _getActionColumnConfig(body) {
5175
+ const { actions } = body;
5176
+ if (!actions) {
5177
+ return null;
5178
+ }
5179
+ if (Array.isArray(actions)) {
5180
+ if (actions.length === 0) {
5181
+ return null;
5182
+ }
5183
+ return {
5184
+ actions,
5185
+ maxVisible: body.actionMaxVisible,
5186
+ };
5187
+ }
5188
+ if (typeof actions === 'function') {
5189
+ return {
5190
+ actions,
5191
+ maxVisible: body.actionMaxVisible,
5192
+ };
5193
+ }
5194
+ if (Array.isArray(actions.actions) && actions.actions.length === 0) {
5195
+ return null;
5196
+ }
5197
+ return actions;
5198
+ }
5171
5199
  // ─── Column Config Lookup (Cached) ────────────────────────────────────────
5172
5200
  /**
5173
5201
  * Recursively finds a column config by ID with caching.