@wavemaker-ai/react-runtime 1.0.0-rc.324 → 1.0.0-rc.326

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.
Files changed (67) hide show
  1. package/components/basic/anchor/index.js +3 -0
  2. package/components/container/index.js +6 -1
  3. package/components/container/layout-grid/grid-row/index.js +1 -1
  4. package/components/data/form/base-form/hooks/useFormSubmission.d.ts +1 -1
  5. package/components/data/form/base-form/hooks/useFormSubmission.js +3 -1
  6. package/components/data/form/base-form/index.js +11 -14
  7. package/components/data/form/base-form/props.d.ts +3 -0
  8. package/components/data/form/form-controller/withFormController.js +19 -2
  9. package/components/data/form/form-field/base-field.js +8 -5
  10. package/components/data/form/form-field/index.js +11 -7
  11. package/components/data/form/form-field/props.d.ts +1 -0
  12. package/components/data/list/components/ListItemWithTemplate.js +5 -2
  13. package/components/data/list/hooks/useListEffects.js +1 -1
  14. package/components/data/list/index.js +11 -3
  15. package/components/data/list/utils/constants.d.ts +0 -1
  16. package/components/data/list/utils/constants.js +0 -2
  17. package/components/data/table/components/RowCells.js +18 -4
  18. package/components/data/table/components/TableBody.js +5 -3
  19. package/components/data/table/components/TableHeader.js +9 -7
  20. package/components/data/table/components/TablePanelHeading.js +1 -1
  21. package/components/data/table/hooks/useDynamicColumns.js +1 -1
  22. package/components/data/table/hooks/useRowExpansion.js +41 -31
  23. package/components/data/table/hooks/useRowHandlers.js +0 -1
  24. package/components/data/table/hooks/useServerSideSorting.js +0 -1
  25. package/components/data/table/hooks/useTableColumns.js +16 -8
  26. package/components/data/table/hooks/useTableData.js +0 -1
  27. package/components/data/table/hooks/useTableEdit.js +0 -1
  28. package/components/data/table/index.js +47 -18
  29. package/components/data/table/live-table/index.js +0 -1
  30. package/components/data/table/props.d.ts +4 -0
  31. package/components/data/table/utils/buildSelectionColumns.js +0 -2
  32. package/components/data/table/utils/columnBuilder.d.ts +16 -2
  33. package/components/data/table/utils/columnBuilder.js +13 -8
  34. package/components/data/table/utils/columnWidthDistribution.js +10 -0
  35. package/components/data/table/utils/constants.d.ts +0 -4
  36. package/components/data/table/utils/constants.js +0 -7
  37. package/components/data/table/utils/dynamic-columns.d.ts +1 -1
  38. package/components/data/table/utils/dynamic-columns.js +3 -8
  39. package/components/data/table/utils/expansionColumn.d.ts +23 -0
  40. package/components/data/table/utils/expansionColumn.js +56 -0
  41. package/components/data/table/utils/index.d.ts +14 -2
  42. package/components/data/table/utils/index.js +45 -19
  43. package/components/dialogs/dialog/index.js +3 -2
  44. package/components/input/default/radioset/index.js +2 -1
  45. package/components/input/select/index.js +1 -2
  46. package/components/input/textarea/index.js +1 -1
  47. package/components/navigation/popover/index.js +15 -7
  48. package/components/page/index.js +1 -1
  49. package/components/page/page-content/index.js +6 -2
  50. package/components/page/partial-container/index.js +2 -1
  51. package/components/prefab/index.js +3 -2
  52. package/components/prefab/props.d.ts +1 -0
  53. package/context/WidgetProvider.js +2 -1
  54. package/core/proxy-service.d.ts +1 -0
  55. package/core/proxy-service.js +53 -2
  56. package/core/util/index.js +3 -1
  57. package/higherOrder/BasePage.js +25 -4
  58. package/higherOrder/withBaseWrapper.js +9 -7
  59. package/package-lock.json +127 -138
  60. package/package.json +3 -3
  61. package/runtime-dynamic/components/partial-content.js +3 -1
  62. package/runtime-dynamic/factories/dynamic-component.js +26 -3
  63. package/runtime-dynamic/services/css-scoping.d.ts +2 -0
  64. package/runtime-dynamic/services/css-scoping.js +39 -20
  65. package/utils/custom-expression/parser.js +11 -8
  66. package/utils/transformedDataset-utils.d.ts +3 -3
  67. package/utils/transformedDataset-utils.js +1 -2
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useEffect, useRef, useState } from "react";
2
- import { cleanRowData } from "../utils";
2
+ import { cleanRowData, getRowExpansionConfig } from "../utils";
3
3
  const useRowExpansion = ({
4
4
  rowExpansionConfig,
5
5
  internalDataset
@@ -8,36 +8,48 @@ const useRowExpansion = ({
8
8
  const expandedRowsRef = useRef(expandedRows);
9
9
  const rowDefInstancesRef = useRef({});
10
10
  const pendingRowExpandRef = useRef(/* @__PURE__ */ new Set());
11
+ const indexExpandedInstances = useCallback(() => {
12
+ const instances = rowDefInstancesRef.current;
13
+ Object.keys(instances).forEach((key) => {
14
+ if (/^\d+$/.test(key)) delete instances[key];
15
+ });
16
+ Array.from(expandedRowsRef.current).forEach((rowId, index) => {
17
+ if (instances[rowId]) instances[index] = instances[rowId];
18
+ });
19
+ }, []);
11
20
  useEffect(() => {
12
21
  expandedRowsRef.current = expandedRows;
13
- }, [expandedRows]);
22
+ indexExpandedInstances();
23
+ }, [expandedRows, indexExpandedInstances]);
14
24
  useEffect(() => {
15
- const instances = rowDefInstancesRef.current;
16
- Object.keys(instances).forEach((k) => delete instances[k]);
25
+ rowDefInstancesRef.current = {};
17
26
  pendingRowExpandRef.current = /* @__PURE__ */ new Set();
18
27
  }, [internalDataset]);
19
28
  const registerRowDefInstance = useCallback(
20
29
  (rowId, instance, rowData) => {
21
30
  rowDefInstancesRef.current[rowId] = instance;
22
- if (pendingRowExpandRef.current.has(rowId) && expandedRowsRef.current.has(rowId)) {
31
+ indexExpandedInstances();
32
+ if ((rowExpansionConfig == null ? void 0 : rowExpansionConfig.closeothers) || pendingRowExpandRef.current.has(rowId) && expandedRowsRef.current.has(rowId)) {
23
33
  pendingRowExpandRef.current.delete(rowId);
24
34
  if (rowExpansionConfig == null ? void 0 : rowExpansionConfig.onRowexpand) {
25
35
  setTimeout(() => {
26
36
  var _a;
27
37
  (_a = rowExpansionConfig.onRowexpand) == null ? void 0 : _a.call(rowExpansionConfig, {}, {}, cleanRowData(rowData), instance);
28
- }, 500);
38
+ }, 0);
29
39
  }
30
40
  }
31
41
  },
32
- [rowExpansionConfig]
42
+ [rowExpansionConfig, indexExpandedInstances]
33
43
  );
34
44
  const toggleRowExpansion = useCallback(
35
45
  (rowId, rowData) => {
36
46
  var _a, _b;
37
- if (!rowExpansionConfig || !rowExpansionConfig.show) return;
47
+ if (!rowExpansionConfig) return;
48
+ const rowConfig = getRowExpansionConfig(rowExpansionConfig, rowId, rowData);
49
+ if (!(rowConfig == null ? void 0 : rowConfig.show)) return;
38
50
  const isCurrentlyExpanded = expandedRowsRef.current.has(rowId);
39
51
  if (!isCurrentlyExpanded) {
40
- if (rowExpansionConfig.onBeforerowexpand) {
52
+ if (rowConfig.onBeforerowexpand) {
41
53
  let defaultPrevented = false;
42
54
  const event = {
43
55
  preventDefault: () => {
@@ -47,8 +59,8 @@ const useRowExpansion = ({
47
59
  return defaultPrevented;
48
60
  }
49
61
  };
50
- (_a = rowExpansionConfig.onBeforerowexpand) == null ? void 0 : _a.call(
51
- rowExpansionConfig,
62
+ (_a = rowConfig.onBeforerowexpand) == null ? void 0 : _a.call(
63
+ rowConfig,
52
64
  event,
53
65
  {},
54
66
  cleanRowData(rowData),
@@ -58,33 +70,31 @@ const useRowExpansion = ({
58
70
  }
59
71
  setExpandedRows((prev) => {
60
72
  const newExpandedRows = new Set(prev);
61
- if (rowExpansionConfig.closeothers) {
73
+ if (rowConfig.closeothers) {
62
74
  newExpandedRows.forEach((otherId) => {
63
75
  pendingRowExpandRef.current.delete(otherId);
64
76
  });
65
77
  newExpandedRows.clear();
66
78
  }
67
79
  newExpandedRows.add(rowId);
68
- if (rowExpansionConfig.renderPartial) {
80
+ if (rowConfig.renderPartial) {
69
81
  pendingRowExpandRef.current.add(rowId);
70
- } else {
71
- if (rowExpansionConfig.onRowexpand) {
72
- setTimeout(() => {
73
- var _a2;
74
- (_a2 = rowExpansionConfig.onRowexpand) == null ? void 0 : _a2.call(
75
- rowExpansionConfig,
76
- {},
77
- {},
78
- cleanRowData(rowData),
79
- rowDefInstancesRef.current[rowId] || {}
80
- );
81
- }, 0);
82
- }
82
+ } else if (rowConfig.onRowexpand) {
83
+ setTimeout(() => {
84
+ var _a2;
85
+ (_a2 = rowConfig.onRowexpand) == null ? void 0 : _a2.call(
86
+ rowConfig,
87
+ {},
88
+ {},
89
+ cleanRowData(rowData),
90
+ rowDefInstancesRef.current[rowId] || {}
91
+ );
92
+ }, 0);
83
93
  }
84
94
  return newExpandedRows;
85
95
  });
86
96
  } else {
87
- if (rowExpansionConfig.onBeforerowcollapse) {
97
+ if (rowConfig.onBeforerowcollapse) {
88
98
  let defaultPrevented = false;
89
99
  const event = {
90
100
  preventDefault: () => {
@@ -94,8 +104,8 @@ const useRowExpansion = ({
94
104
  return defaultPrevented;
95
105
  }
96
106
  };
97
- (_b = rowExpansionConfig.onBeforerowcollapse) == null ? void 0 : _b.call(
98
- rowExpansionConfig,
107
+ (_b = rowConfig.onBeforerowcollapse) == null ? void 0 : _b.call(
108
+ rowConfig,
99
109
  event,
100
110
  {},
101
111
  cleanRowData(rowData),
@@ -107,10 +117,10 @@ const useRowExpansion = ({
107
117
  const newExpandedRows = new Set(prev);
108
118
  newExpandedRows.delete(rowId);
109
119
  pendingRowExpandRef.current.delete(rowId);
110
- if (rowExpansionConfig.onRowcollapse) {
120
+ if (rowConfig.onRowcollapse) {
111
121
  setTimeout(() => {
112
122
  var _a2;
113
- (_a2 = rowExpansionConfig.onRowcollapse) == null ? void 0 : _a2.call(rowExpansionConfig, {}, {}, cleanRowData(rowData));
123
+ (_a2 = rowConfig.onRowcollapse) == null ? void 0 : _a2.call(rowConfig, {}, {}, cleanRowData(rowData));
114
124
  }, 0);
115
125
  }
116
126
  return newExpandedRows;
@@ -46,7 +46,6 @@ const useRowHandlers = ({
46
46
  useRadioSelect,
47
47
  useMultiSelect,
48
48
  isrowselectable,
49
- listener,
50
49
  name
51
50
  ]
52
51
  );
@@ -70,7 +70,6 @@ const useServerSideSorting = ({
70
70
  onError,
71
71
  filterFields,
72
72
  logicalOp,
73
- listener,
74
73
  name
75
74
  ]
76
75
  );
@@ -39,7 +39,8 @@ import {
39
39
  createRowIndexColumn,
40
40
  createDataColumns,
41
41
  createEditingActionButtons,
42
- getActionColumnSize
42
+ getActionColumnSize,
43
+ ActionCell
43
44
  } from "../utils/columnBuilder";
44
45
  import { distributeColumnWidths } from "../utils/columnWidthDistribution";
45
46
  import { useResponsiveColumns } from "./useResponsiveColumns";
@@ -210,11 +211,14 @@ const useTableColumns = ({
210
211
  const shouldRenderEditableCell = (editmode === "inline" || editmode === "quickedit") && isEditingThisRow && !wmColumn.readonly;
211
212
  return /* @__PURE__ */ jsx("span", { "data-col-identifier": wmColumn.field, children: shouldRenderEditableCell ? renderEditableCell(wmColumn, row.original, rowId) : renderDisplayCell(wmColumn, row.original, listener, cellState) });
212
213
  },
213
- [editmode, isRowEditing, renderEditableCell, cellState, listener]
214
+ [editmode, isRowEditing, renderEditableCell, cellState]
214
215
  );
215
216
  const filteredRowActions = useMemo(() => {
216
217
  if (editmode === "quickedit") {
217
- return filter(rowActions, (action) => action.key === "deleterow" || action.action === "delete");
218
+ return filter(
219
+ rowActions,
220
+ (action) => action.key === "deleterow" || action.action === "delete" || action.key === "updaterow"
221
+ );
218
222
  }
219
223
  return rowActions;
220
224
  }, [rowActions, editmode]);
@@ -256,7 +260,6 @@ const useTableColumns = ({
256
260
  saveEditing,
257
261
  cancelEditing,
258
262
  deleteRowAction,
259
- listener,
260
263
  selectionHandlers
261
264
  ]
262
265
  );
@@ -277,13 +280,15 @@ const useTableColumns = ({
277
280
  size: columnSize,
278
281
  minSize,
279
282
  enableResizing: true,
280
- cell: renderActionCell,
283
+ cell: ActionCell,
281
284
  enableSorting: manualActionColumn.sortable !== false,
282
- meta: __spreadValues({
285
+ meta: __spreadProps(__spreadValues({
283
286
  textAlign: manualActionColumn.textalignment,
284
287
  backgroundColor: manualActionColumn.backgroundcolor,
285
288
  className: manualActionColumn.colClass
286
- }, manualActionColumn.styles)
289
+ }, manualActionColumn.styles), {
290
+ _actions: { renderActionCell }
291
+ })
287
292
  };
288
293
  } else if (rowActions.length > 0 && (isDynamicTable || editmode !== "none")) {
289
294
  return {
@@ -293,7 +298,10 @@ const useTableColumns = ({
293
298
  minSize,
294
299
  maxSize: size,
295
300
  enableResizing: false,
296
- cell: renderActionCell
301
+ cell: ActionCell,
302
+ meta: {
303
+ _actions: { renderActionCell }
304
+ }
297
305
  };
298
306
  }
299
307
  return null;
@@ -118,7 +118,6 @@ const useTableData = ({
118
118
  deletemessage,
119
119
  errormessage,
120
120
  isServerSidePagination,
121
- listener,
122
121
  widgetName
123
122
  ]);
124
123
  const handleCancelDelete = useCallback(() => {
@@ -586,7 +586,6 @@ const useTableEdit = ({
586
586
  cancelEditing,
587
587
  resetValidationState,
588
588
  incrementSessionKey,
589
- listener,
590
589
  sessionKey,
591
590
  hasRowExpansion,
592
591
  expansionPosition
@@ -89,9 +89,14 @@ import {
89
89
  saveTableState,
90
90
  clearTableState,
91
91
  addUniqueRowIds,
92
- cleanRowData
92
+ cleanRowData,
93
+ getDomHiddenColStyle
93
94
  } from "./utils";
94
95
  import { hasTableGroups } from "./utils/groupHeaderUtils";
96
+ import {
97
+ buildExpansionColSpec,
98
+ getExpansionColumnInsertIndex
99
+ } from "./utils/expansionColumn";
95
100
  import { handleNewRowNavigation } from "./utils";
96
101
  import {
97
102
  TablePanelHeading,
@@ -473,14 +478,7 @@ const WmTableComponent = memo(
473
478
  children,
474
479
  listener
475
480
  });
476
- const {
477
- wmTableColumns,
478
- tableStructure,
479
- rowActions,
480
- headerActions,
481
- footerActions,
482
- rowExpansionConfig
483
- } = useMemo(() => {
481
+ const { wmTableColumns, tableStructure, headerActions, footerActions, rowExpansionConfig } = useMemo(() => {
484
482
  const allTableActions = parseTableActions(children);
485
483
  const headerActions2 = allTableActions.filter((action) => {
486
484
  const position = action.position || "footer";
@@ -498,13 +496,13 @@ const WmTableComponent = memo(
498
496
  return {
499
497
  wmTableColumns: finalColumns,
500
498
  tableStructure: structure,
501
- rowActions: parseTableRowActions(children),
502
499
  tableActions: allTableActions,
503
500
  headerActions: headerActions2,
504
501
  footerActions: footerActions2,
505
502
  rowExpansionConfig: parseTableRowExpansion(children)
506
503
  };
507
504
  }, [children, internalDataset, isDynamicTable, dynamicColumns]);
505
+ const rowActions = useMemo(() => parseTableRowActions(children), [children]);
508
506
  const [columnsVersion, setColumnsVersion] = useState(0);
509
507
  const [columnOverrides, setColumnOverrides] = useState(
510
508
  {}
@@ -558,7 +556,7 @@ const WmTableComponent = memo(
558
556
  updatemessage,
559
557
  errormessage,
560
558
  showToast,
561
- hasRowExpansion: rowExpansionConfig ? rowExpansionConfig.show : false,
559
+ hasRowExpansion: rowExpansionConfig ? true : false,
562
560
  expansionPosition: rowExpansionConfig ? parseInt(String(rowExpansionConfig.position || "0"), 10) : 0,
563
561
  datasource,
564
562
  binddataset,
@@ -956,7 +954,7 @@ const WmTableComponent = memo(
956
954
  listener.Widgets[name].dataNavigator = paginationWidget;
957
955
  }
958
956
  },
959
- [name, listener]
957
+ [name]
960
958
  );
961
959
  const sortInfoForExport = useMemo(() => {
962
960
  if (sorting.length > 0) {
@@ -1275,7 +1273,7 @@ const WmTableComponent = memo(
1275
1273
  }
1276
1274
  deleteRecord(row, tableRef.current);
1277
1275
  },
1278
- [deleteRecord, onBeforerowdelete, listener, name, internalDataset]
1276
+ [deleteRecord, onBeforerowdelete, name, internalDataset]
1279
1277
  );
1280
1278
  const refresh = useCallback(
1281
1279
  async (newData = false) => {
@@ -1420,17 +1418,47 @@ const WmTableComponent = memo(
1420
1418
  const leafHeaderGroup = headerGroups.length ? headerGroups[headerGroups.length - 1] : void 0;
1421
1419
  const leafHeaders = ((leafHeaderGroup == null ? void 0 : leafHeaderGroup.headers) || []).filter((h) => !h.isPlaceholder);
1422
1420
  const base = leafHeaders.map((h) => {
1421
+ const meta = h.column.columnDef.meta;
1422
+ const hiddenColStyle = getDomHiddenColStyle(meta);
1423
1423
  const w = `${h.column.getSize()}px`;
1424
- return { key: h.column.id, width: w, style: { width: w } };
1424
+ return {
1425
+ key: h.column.id,
1426
+ width: hiddenColStyle ? void 0 : w,
1427
+ style: hiddenColStyle != null ? hiddenColStyle : { width: w },
1428
+ domHidden: !!hiddenColStyle
1429
+ };
1425
1430
  });
1431
+ if (rowExpansionConfig) {
1432
+ const expansionInsertIndex = getExpansionColumnInsertIndex(
1433
+ leafHeaders,
1434
+ rowExpansionConfig,
1435
+ {
1436
+ appendForGroupedTable: !!(tableStructure && hasTableGroups(tableStructure))
1437
+ }
1438
+ );
1439
+ if (expansionInsertIndex >= 0) {
1440
+ base.splice(expansionInsertIndex, 0, __spreadProps(__spreadValues({}, buildExpansionColSpec(rowExpansionConfig.columnwidth)), {
1441
+ domHidden: false
1442
+ }));
1443
+ }
1444
+ }
1426
1445
  return base;
1427
- }, [table, columnSizing, columnsVersion, showheader, ColClassSignature]);
1446
+ }, [
1447
+ table,
1448
+ columnSizing,
1449
+ columnsVersion,
1450
+ showheader,
1451
+ ColClassSignature,
1452
+ rowExpansionConfig,
1453
+ tableStructure
1454
+ ]);
1428
1455
  return /* @__PURE__ */ jsxs(
1429
1456
  Box,
1430
1457
  __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
1431
1458
  ref: tableContainerRef,
1432
1459
  hidden: props.hidden,
1433
- className: `app-grid app-panel panel app-datagrid ${className}`.trim()
1460
+ className: `app-grid app-panel panel app-datagrid ${className}`.trim(),
1461
+ "data-widget-id": props["data-widget-id"]
1434
1462
  }, { name }), { editmode }), { navigation }), { title }), {
1435
1463
  currentpage: table.getState().pagination.pageIndex + 1
1436
1464
  }), {
@@ -1520,7 +1548,7 @@ const WmTableComponent = memo(
1520
1548
  ),
1521
1549
  /* @__PURE__ */ jsx("colgroup", { children: colGroupSpec.map((c) => /* @__PURE__ */ jsx("col", { style: c.style, width: c.width }, c.key)) })
1522
1550
  ] }),
1523
- internalDataset.length > 0 && /* @__PURE__ */ jsx(
1551
+ (internalDataset.length > 0 || !isTableLoading) && /* @__PURE__ */ jsx(
1524
1552
  TableBodyComponent,
1525
1553
  {
1526
1554
  table,
@@ -1547,7 +1575,8 @@ const WmTableComponent = memo(
1547
1575
  isAddingNewRow,
1548
1576
  customExpressionColumns: customColumns,
1549
1577
  customColumnsRevision,
1550
- columnsVersion
1578
+ columnsVersion,
1579
+ registerRowDefInstance
1551
1580
  }
1552
1581
  ),
1553
1582
  summaryRowEnabled && summaryRowDefs.length > 0 && /* @__PURE__ */ jsx(
@@ -34,7 +34,6 @@ import Box from "@mui/material/Box";
34
34
  import { useWidgetProxy } from "../../../../context/WidgetProvider";
35
35
  import withStandalone from "../../../../higherOrder/withStandalone";
36
36
  function isWmTableChildType(displayName) {
37
- console.log("displayName", displayName);
38
37
  return displayName === "WmTable" || displayName === "WmTableStandalone" || displayName === "withStandalone(WmTable)";
39
38
  }
40
39
  const WmLiveTable = (props) => {
@@ -752,6 +752,10 @@ export interface TableRowProps {
752
752
  * Rendering function for content.
753
753
  */
754
754
  renderPartial?: (props: Record<string, any>, onLoad: () => void, currentItem: any) => ReactNode;
755
+ /**
756
+ * Per-row callback from codegen for row-bound attrs (e.g. show, disabled).
757
+ */
758
+ tableRowProps?: (rowData: any) => Partial<TableRowProps>;
755
759
  /**
756
760
  * Children components.
757
761
  */
@@ -64,13 +64,11 @@ MultiSelectCell.displayName = "MultiSelectCell";
64
64
  function MultiSelectHeader({ table, column }) {
65
65
  var _a, _b;
66
66
  const isAllSelected = table.getIsAllRowsSelected();
67
- const isSomeSelected = table.getIsSomeRowsSelected();
68
67
  const { handleSelectAll } = (_b = (_a = column.columnDef.meta) == null ? void 0 : _a.selection) != null ? _b : {};
69
68
  return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx(Box, { className: "app-checkbox checkbox", children: /* @__PURE__ */ jsx(
70
69
  Checkbox,
71
70
  {
72
71
  checked: isAllSelected,
73
- indeterminate: isSomeSelected && !isAllSelected,
74
72
  onChange: (e) => handleSelectAll == null ? void 0 : handleSelectAll(e.target.checked),
75
73
  size: "small",
76
74
  inputProps: {
@@ -1,5 +1,5 @@
1
- import React from "react";
2
- import { ColumnDef } from "@tanstack/react-table";
1
+ import React, { type ReactElement } from "react";
2
+ import { ColumnDef, CellContext } from "@tanstack/react-table";
3
3
  import { WmTableColumnProps, ActionButtonConfig } from "../props";
4
4
  /**
5
5
  * Per-column render config stored in `meta._cell`.
@@ -14,6 +14,20 @@ export interface DataCellMeta {
14
14
  wmColumn: WmTableColumnProps;
15
15
  renderCell: (wmColumn: WmTableColumnProps, row: any) => React.ReactNode;
16
16
  }
17
+ /** Actions-column render config stored in `meta._actions` (namespaced like `_cell`). */
18
+ export interface ActionCellMeta {
19
+ renderActionCell: (ctx: CellContext<any, unknown>) => React.ReactNode;
20
+ }
21
+ /**
22
+ * Stable cell renderer for the actions column. Same motivation as DataCell: flexRender
23
+ * uses `cell` as the component TYPE, so a changing renderActionCell identity would
24
+ * unmount/remount the row action buttons. Read the renderer from `meta._actions` instead.
25
+ */
26
+ declare function ActionCell(ctx: CellContext<any, unknown>): ReactElement;
27
+ declare namespace ActionCell {
28
+ var displayName: string;
29
+ }
30
+ export { ActionCell };
17
31
  /**
18
32
  * Creates row index column definition
19
33
  */
@@ -41,6 +41,12 @@ function DataCell(ctx) {
41
41
  return /* @__PURE__ */ jsx(Fragment, { children: renderCell(wmColumn, ctx.row) });
42
42
  }
43
43
  DataCell.displayName = "DataCell";
44
+ function ActionCell(ctx) {
45
+ var _a;
46
+ const { renderActionCell } = (_a = ctx.column.columnDef.meta) == null ? void 0 : _a._actions;
47
+ return /* @__PURE__ */ jsx(Fragment, { children: renderActionCell(ctx) });
48
+ }
49
+ ActionCell.displayName = "ActionCell";
44
50
  const createRowIndexColumn = () => ({
45
51
  id: "rowIndex",
46
52
  header: "S. No.",
@@ -61,6 +67,7 @@ const createDataColumn = (wmColumn, renderCell, index = 0) => {
61
67
  columnSize = parseWidth(wmColumn.styles.width);
62
68
  }
63
69
  const accessorKey = wmColumn.field || wmColumn.name;
70
+ const isDomHidden = wmColumn.show === false;
64
71
  const columnId = (accessorKey == null ? void 0 : accessorKey.replace(/\./g, "_")) || (typeof wmColumn.caption === "string" && wmColumn.caption ? wmColumn.caption : void 0) || `column_${index}`;
65
72
  return __spreadProps(__spreadValues({
66
73
  id: columnId,
@@ -69,12 +76,10 @@ const createDataColumn = (wmColumn, renderCell, index = 0) => {
69
76
  // Supports nested properties like "department.store.employee"
70
77
  accessorFn: wmColumn.sortby ? (row) => get(row, wmColumn.sortby || "") : void 0,
71
78
  header: wmColumn.caption,
72
- size: columnSize,
73
- minSize: 50
74
- }, columnSize ? {} : { maxSize: 500 }), {
75
- // Only set maxSize for auto-sized columns
79
+ size: isDomHidden ? 0 : columnSize,
80
+ minSize: isDomHidden ? 0 : 50
81
+ }, isDomHidden ? { maxSize: 0 } : columnSize ? {} : { maxSize: 500 }), {
76
82
  enableResizing: true,
77
- // Enable resizing for all data columns
78
83
  cell: DataCell,
79
84
  enableSorting: wmColumn.sortable,
80
85
  // Pass column styles and properties through meta for TableCell styling and filtering
@@ -84,6 +89,7 @@ const createDataColumn = (wmColumn, renderCell, index = 0) => {
84
89
  className: wmColumn == null ? void 0 : wmColumn.className,
85
90
  colClass: colClassProp
86
91
  }, wmColumn.styles), {
92
+ domHidden: isDomHidden,
87
93
  // Include widget types for filter rendering
88
94
  widgetType: wmColumn.widgetType,
89
95
  editWidgetType: wmColumn.editWidgetType,
@@ -102,9 +108,7 @@ const createDataColumn = (wmColumn, renderCell, index = 0) => {
102
108
  const createDataColumns = (wmTableColumns, renderCell) => {
103
109
  const columns = [];
104
110
  wmTableColumns.forEach((wmColumn, index) => {
105
- if (wmColumn.show) {
106
- columns.push(createDataColumn(wmColumn, renderCell, index));
107
- }
111
+ columns.push(createDataColumn(wmColumn, renderCell, index));
108
112
  });
109
113
  return columns;
110
114
  };
@@ -186,6 +190,7 @@ const getActionColumnSize = (editmode) => {
186
190
  return editmode === "quickedit" ? { size: 80, minSize: 60 } : { size: 100, minSize: 80 };
187
191
  };
188
192
  export {
193
+ ActionCell,
189
194
  createDataColumn,
190
195
  createDataColumns,
191
196
  createDefaultColumnProps,
@@ -18,7 +18,14 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  const NON_DATA_COLUMN_IDS = ["radioSelect", "multiSelect", "rowIndex", "actions"];
21
+ const isDomHiddenColumn = (column) => {
22
+ var _a;
23
+ return !!((_a = column.meta) == null ? void 0 : _a.domHidden);
24
+ };
21
25
  const isDataColumn = (column) => {
26
+ if (isDomHiddenColumn(column)) {
27
+ return false;
28
+ }
22
29
  return !NON_DATA_COLUMN_IDS.includes(column.id || "");
23
30
  };
24
31
  const hasExplicitWidth = (column) => {
@@ -31,6 +38,9 @@ const distributeColumnWidths = (columns, tableWidth) => {
31
38
  let usedWidth = 0;
32
39
  let dataColumnsNeedingWidth = 0;
33
40
  columns.forEach((column) => {
41
+ if (isDomHiddenColumn(column)) {
42
+ return;
43
+ }
34
44
  if (!isDataColumn(column)) {
35
45
  const size = column.size || getDefaultColumnSize(column.id || "");
36
46
  usedWidth += size;
@@ -45,8 +45,4 @@ export declare const INTERACTIVE_CLASSES: readonly ["MuiInputBase", "MuiSelect",
45
45
  export declare const INTERACTIVE_ROLES: readonly ["button", "textbox", "combobox", "listbox"];
46
46
  export declare const INTERACTIVE_DATA_ROLES: readonly ["input", "select", "date", "time", "color", "editor", "checkbox", "radio", "slider", "chips", "rating"];
47
47
  export declare const INTERACTIVE_TAG_NAMES: readonly ["INPUT", "BUTTON", "SELECT", "TEXTAREA", "A", "LABEL"];
48
- export declare const DYNAMIC_COLUMNS_CONFIG: {
49
- readonly maxColumns: 20;
50
- readonly sampleSize: 3;
51
- };
52
48
  export declare const UNSUPPORTED_STATE_PERSISTENCE_TYPES: readonly string[];
@@ -112,19 +112,12 @@ const INTERACTIVE_TAG_NAMES = [
112
112
  "A",
113
113
  "LABEL"
114
114
  ];
115
- const DYNAMIC_COLUMNS_CONFIG = {
116
- maxColumns: 20,
117
- // Maximum number of columns to generate from data (matching Angular behavior)
118
- sampleSize: 3
119
- // Number of rows to sample for column detection
120
- };
121
115
  const UNSUPPORTED_STATE_PERSISTENCE_TYPES = [
122
116
  "Scroll",
123
117
  "On-Demand",
124
118
  "Inline"
125
119
  ];
126
120
  export {
127
- DYNAMIC_COLUMNS_CONFIG,
128
121
  INTERACTIVE_CLASSES,
129
122
  INTERACTIVE_DATA_ROLES,
130
123
  INTERACTIVE_ROLES,
@@ -25,7 +25,7 @@ export interface PreparedFieldTerminal {
25
25
  *
26
26
  * Uses lodash `pickBy` to drop internal keys in one pass per object; recursion stays shallow.
27
27
  */
28
- export declare const prepareFieldsFromMergedRow: (mergedRow: Record<string, any>, upperBound?: number) => PreparedFieldTerminal[];
28
+ export declare const prepareFieldsFromMergedRow: (mergedRow: Record<string, any>) => PreparedFieldTerminal[];
29
29
  /**
30
30
  * Generate column definitions from data array.
31
31
  * Uses Angular-style nested flattening (prepareFieldDefs) so dynamic tables and
@@ -21,7 +21,6 @@ import isArray from "lodash-es/isArray";
21
21
  import pickBy from "lodash-es/pickBy";
22
22
  import startCase from "lodash-es/startCase";
23
23
  import { createDefaultColumnProps } from "./columnBuilder";
24
- import { DYNAMIC_COLUMNS_CONFIG } from "./constants";
25
24
  import { INTERNAL_PROPERTIES } from "./index";
26
25
  const INTERNAL_FIELD_PATTERNS = [
27
26
  "_wm",
@@ -93,11 +92,9 @@ function relatedFieldsFromKey(rawKey) {
93
92
  function isLeafColumnValue(value) {
94
93
  return value === null || value === void 0 || typeof value !== "object" || value instanceof Date || isArray(value) && !value[0];
95
94
  }
96
- const prepareFieldsFromMergedRow = (mergedRow, upperBound = DYNAMIC_COLUMNS_CONFIG.maxColumns) => {
95
+ const prepareFieldsFromMergedRow = (mergedRow) => {
97
96
  const terminals = [];
98
- let columnCount = 0;
99
97
  const pushTerminal = (fieldPath, relatedTable, relatedField) => {
100
- if (columnCount >= upperBound) return;
101
98
  const displayName = displayNameForFieldPath(fieldPath);
102
99
  terminals.push({
103
100
  displayName,
@@ -106,14 +103,12 @@ const prepareFieldsFromMergedRow = (mergedRow, upperBound = DYNAMIC_COLUMNS_CONF
106
103
  relatedTable,
107
104
  relatedField: relatedField != null ? relatedField : displayName
108
105
  });
109
- columnCount += 1;
110
106
  };
111
107
  const pushFieldDef = (node, prefix, depth) => {
112
- if (columnCount >= upperBound || depth > MAX_FIELD_DEPTH || node == null) return;
108
+ if (depth > MAX_FIELD_DEPTH || node == null) return;
113
109
  if (!isPlainRecord(node)) return;
114
110
  const visible = pickBy(node, (_v, k) => !isInternalField(String(k)));
115
111
  forEach(visible, (value, rawKey) => {
116
- if (columnCount >= upperBound) return;
117
112
  const path = prefix ? `${prefix}.${rawKey}` : rawKey;
118
113
  const rel = relatedFieldsFromKey(rawKey);
119
114
  if (isLeafColumnValue(value)) {
@@ -155,7 +150,7 @@ const generateColumnsFromData = (data) => {
155
150
  if (!merged) {
156
151
  return [];
157
152
  }
158
- const terminals = prepareFieldsFromMergedRow(merged, DYNAMIC_COLUMNS_CONFIG.maxColumns);
153
+ const terminals = prepareFieldsFromMergedRow(merged);
159
154
  if (terminals.length === 0) {
160
155
  return [];
161
156
  }
@@ -0,0 +1,23 @@
1
+ import type { CSSProperties } from "react";
2
+ /** Minimal header shape for expansion insert-index calculation (TanStack Header-compatible). */
3
+ export type ExpansionColumnHeaderLike = {
4
+ id: string;
5
+ column: {
6
+ id: string;
7
+ columnDef?: unknown;
8
+ };
9
+ };
10
+ /**
11
+ * Index at which the row-expansion `<th>` / `<td>` / `<col>` is inserted.
12
+ * Mirrors Angular datatable.js preparedHeaderData row-expansion placement.
13
+ */
14
+ export declare function getExpansionColumnInsertIndex(headers: ReadonlyArray<ExpansionColumnHeaderLike>, rowExpansionConfig: {
15
+ position?: string | number;
16
+ } | null | undefined, options?: {
17
+ appendForGroupedTable?: boolean;
18
+ }): number;
19
+ export declare function buildExpansionColSpec(columnwidth?: string): {
20
+ key: string;
21
+ width: string;
22
+ style: CSSProperties;
23
+ };