@wavemaker-ai/react-runtime 1.0.0-rc.647655 → 1.0.0-rc.647684

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 (112) hide show
  1. package/actions/notification-action.js +3 -3
  2. package/actions/toast.js +2 -1
  3. package/components/basic/icon/index.js +36 -5
  4. package/components/basic/iframe/index.js +18 -8
  5. package/components/basic/label/index.js +4 -3
  6. package/components/basic/message/index.js +1 -0
  7. package/components/basic/search/index.d.ts +72 -3
  8. package/components/basic/search/index.js +84 -32
  9. package/components/basic/search/props.d.ts +4 -0
  10. package/components/basic/search/providers.d.ts +1 -1
  11. package/components/basic/search/providers.js +6 -3
  12. package/components/common/WmAppIcon/index.js +11 -8
  13. package/components/common/WmAppIcon/props.d.ts +2 -0
  14. package/components/container/accordion/accordion-pane/index.d.ts +1 -0
  15. package/components/container/accordion/accordion-pane/index.js +7 -3
  16. package/components/container/accordion/accordion-pane/props.d.ts +1 -0
  17. package/components/container/index.js +13 -5
  18. package/components/container/layout-grid/index.js +1 -0
  19. package/components/container/linear-layout/index.js +0 -1
  20. package/components/container/panel/components/panel-header/index.js +1 -3
  21. package/components/container/tabs/tab-pane/index.d.ts +1 -0
  22. package/components/container/tabs/tab-pane/index.js +2 -2
  23. package/components/container/tabs/tab-pane/props.d.ts +1 -0
  24. package/components/container/wizard/index.js +11 -10
  25. package/components/container/wizard/utils.js +1 -0
  26. package/components/data/form/base-form/hooks/useFormOperations.js +9 -15
  27. package/components/data/form/base-form/index.js +17 -14
  28. package/components/data/form/base-form/utils.js +5 -4
  29. package/components/data/form/dynamic-fields/WmxDynamicFormField.d.ts +11 -0
  30. package/components/data/form/dynamic-fields/WmxDynamicFormField.js +77 -0
  31. package/components/data/form/dynamic-fields/index.js +12 -1
  32. package/components/data/form/form-action/index.d.ts +2 -2
  33. package/components/data/form/form-action/index.js +2 -2
  34. package/components/data/form/form-context.d.ts +12 -13
  35. package/components/data/form/form-context.js +4 -6
  36. package/components/data/form/form-controller/withFormController.js +4 -18
  37. package/components/data/form/form-field/index.js +10 -6
  38. package/components/data/list/components/ListItems.js +1 -3
  39. package/components/data/list/index.js +5 -4
  40. package/components/data/pagination/hooks/usePagination.js +2 -2
  41. package/components/data/table/components/RowCells.js +3 -1
  42. package/components/data/table/components/TableBody.js +2 -1
  43. package/components/data/table/components/TableDataRow.js +1 -1
  44. package/components/data/table/components/TableHeader.js +5 -1
  45. package/components/data/table/hooks/useRowHandlers.d.ts +4 -2
  46. package/components/data/table/hooks/useRowHandlers.js +23 -11
  47. package/components/data/table/hooks/useRowSelection.d.ts +1 -1
  48. package/components/data/table/hooks/useRowSelection.js +93 -74
  49. package/components/data/table/hooks/useTableColumns.js +5 -5
  50. package/components/data/table/hooks/useTableState.js +14 -2
  51. package/components/data/table/index.js +54 -50
  52. package/components/data/table/props.d.ts +12 -8
  53. package/components/data/table/utils/buildSelectionColumns.js +31 -31
  54. package/components/data/table/utils/columnBuilder.js +1 -1
  55. package/components/data/table/utils/index.d.ts +9 -1
  56. package/components/data/table/utils/index.js +30 -2
  57. package/components/data/table/utils/selectionUtils.d.ts +7 -0
  58. package/components/data/table/utils/selectionUtils.js +28 -1
  59. package/components/dialogs/dialog-actions/index.js +11 -2
  60. package/components/dialogs/dialog-header/index.js +1 -1
  61. package/components/dialogs/index.js +14 -2
  62. package/components/input/chips/index.js +29 -5
  63. package/components/input/color-picker/index.js +4 -6
  64. package/components/input/epoch/date/index.js +3 -2
  65. package/components/input/epoch/date/utils.js +4 -2
  66. package/components/input/epoch/datetime/index.js +2 -2
  67. package/components/input/epoch/datetime/props.d.ts +2 -2
  68. package/components/input/epoch/time/utils.d.ts +1 -1
  69. package/components/input/epoch/time/utils.js +2 -2
  70. package/components/input/fileupload/useFileUpload.js +19 -24
  71. package/components/input/select/index.js +8 -6
  72. package/components/input/text/index.js +2 -2
  73. package/components/input/textarea/index.js +41 -16
  74. package/components/navbar/nav/index.js +10 -5
  75. package/components/navigation/breadcrumb/index.js +2 -1
  76. package/components/navigation/popover/index.d.ts +1 -1
  77. package/components/navigation/popover/index.js +10 -2
  78. package/components/navigation/popover/props.d.ts +1 -1
  79. package/components/page/page-content/index.js +24 -4
  80. package/components/page/page-content/props.d.ts +1 -0
  81. package/components/page/partial-container/index.js +1 -1
  82. package/components/wmx/WmxRenderer.d.ts +8 -0
  83. package/components/wmx/WmxRenderer.js +57 -0
  84. package/core/appstore.js +1 -1
  85. package/core/proxy-service.d.ts +16 -1
  86. package/core/proxy-service.js +39 -12
  87. package/core/util/index.d.ts +0 -2
  88. package/core/util/index.js +0 -29
  89. package/higherOrder/BaseDateTime.js +8 -1
  90. package/higherOrder/BasePage.js +31 -65
  91. package/higherOrder/DataNav.js +4 -1
  92. package/higherOrder/withBaseWrapper.js +3 -4
  93. package/hooks/useHttp.js +4 -2
  94. package/hooks/useLayoutSize.js +1 -1
  95. package/package-lock.json +360 -696
  96. package/package.json +3 -3
  97. package/runtime-dynamic/app-initializer.js +2 -1
  98. package/runtime-dynamic/components/partial-content.js +2 -1
  99. package/runtime-dynamic/components/wmx-placeholder.d.ts +18 -0
  100. package/runtime-dynamic/components/wmx-placeholder.js +48 -0
  101. package/runtime-dynamic/main.js +6 -0
  102. package/runtime-dynamic/services/compile-render.js +75 -12
  103. package/store/slices/i18nSlice.d.ts +0 -1
  104. package/store/slices/i18nSlice.js +0 -2
  105. package/utils/layoutsize-util.js +12 -7
  106. package/utils/style-utils.d.ts +6 -0
  107. package/utils/style-utils.js +10 -0
  108. package/utils/wmx.utils.d.ts +6 -0
  109. package/utils/wmx.utils.js +41 -0
  110. package/variables/crud-variable.js +1 -1
  111. package/variables/live-variable.js +1 -1
  112. package/variables/service-variable.js +6 -3
@@ -45,7 +45,7 @@ import {
45
45
  import { distributeColumnWidths } from "../utils/columnWidthDistribution";
46
46
  import { useResponsiveColumns } from "./useResponsiveColumns";
47
47
  import WmTableRowAction from "../table-row-action";
48
- const handleActionSelection = (rowId, rowData, handlers) => {
48
+ const handleActionSelection = (rowId, rowData, handlers, event) => {
49
49
  const {
50
50
  useMultiSelect,
51
51
  handleMultiSelection,
@@ -55,9 +55,9 @@ const handleActionSelection = (rowId, rowData, handlers) => {
55
55
  } = handlers;
56
56
  if (useMultiSelect && handleMultiSelection && isRowSelected) {
57
57
  const currentlySelected = isRowSelected(rowId);
58
- handleMultiSelection(rowId, rowData, !currentlySelected);
58
+ handleMultiSelection(rowId, rowData, !currentlySelected, event);
59
59
  } else if (useRadioSelect && handleRadioSelection) {
60
- handleRadioSelection(rowId, rowData);
60
+ handleRadioSelection(rowId, rowData, event);
61
61
  }
62
62
  };
63
63
  const createActionClickHandler = (rowData, rowId, handlers, actionOnClick) => {
@@ -65,7 +65,7 @@ const createActionClickHandler = (rowData, rowId, handlers, actionOnClick) => {
65
65
  if (handlers.handleRowClick && event) {
66
66
  handlers.handleRowClick(event, rowData, rowId);
67
67
  }
68
- handleActionSelection(rowId, rowData, handlers);
68
+ handleActionSelection(rowId, rowData, handlers, event);
69
69
  actionOnClick == null ? void 0 : actionOnClick(event, widget, newVal);
70
70
  };
71
71
  };
@@ -123,7 +123,7 @@ const EditingActionButtons = React.memo(
123
123
  const isDeleteButton = button.key === "delete-edit";
124
124
  if (isDeleteButton && event) {
125
125
  (_a = selectionHandlers.handleRowClick) == null ? void 0 : _a.call(selectionHandlers, event, rowData, rowId);
126
- handleActionSelection(rowId, rowData, selectionHandlers);
126
+ handleActionSelection(rowId, rowData, selectionHandlers, event);
127
127
  }
128
128
  switch (button.key) {
129
129
  case "save-edit":
@@ -1,10 +1,23 @@
1
- import { useState, useCallback } from "react";
1
+ import { useState, useCallback, useEffect, useRef } from "react";
2
2
  const useTableState = ({
3
3
  editMode = "none",
4
4
  radioselect = false,
5
5
  multiselect = false
6
6
  }) => {
7
7
  const [activeRowIds, setActiveRowIds] = useState([]);
8
+ const prevMultiselectRef = useRef(multiselect);
9
+ const prevRadioselectRef = useRef(radioselect);
10
+ useEffect(() => {
11
+ const prevMultiselect = prevMultiselectRef.current;
12
+ const prevRadioselect = prevRadioselectRef.current;
13
+ prevMultiselectRef.current = multiselect;
14
+ prevRadioselectRef.current = radioselect;
15
+ if (prevMultiselect && !multiselect) {
16
+ setActiveRowIds([]);
17
+ } else if (prevRadioselect && !radioselect && !multiselect) {
18
+ setActiveRowIds([]);
19
+ }
20
+ }, [multiselect, radioselect]);
8
21
  const handleRowActiveClick = useCallback(
9
22
  (rowId, isSelectionHandled, isEditingOrAdding) => {
10
23
  if (isEditingOrAdding) {
@@ -39,7 +52,6 @@ const useTableState = ({
39
52
  setActiveRowIds([]);
40
53
  }
41
54
  }, []);
42
- const activeRowId = activeRowIds && activeRowIds.length > 0 ? activeRowIds[0] : null;
43
55
  return {
44
56
  activeRowIds,
45
57
  setActiveRow,
@@ -82,6 +82,7 @@ import {
82
82
  parseTableRowActions,
83
83
  parseTableActions,
84
84
  parseTableRowExpansion,
85
+ isRowExpansionVisible,
85
86
  getSpacingClasses,
86
87
  TABLE_CSS_CLASSES,
87
88
  TABLE_MESSAGES,
@@ -201,7 +202,8 @@ const WmTableComponent = memo(
201
202
  exportdatasize,
202
203
  onBeforeexport,
203
204
  onAfterexport,
204
- styles
205
+ styles,
206
+ viewParent
205
207
  } = _c, rest = __objRest(_c, [
206
208
  "name",
207
209
  "dataset",
@@ -282,7 +284,8 @@ const WmTableComponent = memo(
282
284
  "exportdatasize",
283
285
  "onBeforeexport",
284
286
  "onAfterexport",
285
- "styles"
287
+ "styles",
288
+ "viewParent"
286
289
  ]);
287
290
  const effectiveStorageKey = useMemo(
288
291
  () => name + ((listener == null ? void 0 : listener.partialName) ? `__${listener == null ? void 0 : listener.partialName}` : ""),
@@ -461,6 +464,8 @@ const WmTableComponent = memo(
461
464
  onRowdeselect,
462
465
  listener,
463
466
  navigation,
467
+ viewParent,
468
+ widgetRegistrationKey,
464
469
  onSyncSelectedItems
465
470
  });
466
471
  const { activeRowIds, setActiveRow, handleRowActiveClick, isRowActive } = useTableState({
@@ -493,15 +498,20 @@ const WmTableComponent = memo(
493
498
  const staticColumns = parseTableColumns(children, internalDataset);
494
499
  const hasGroups = structure.some((item) => "isGroup" in item && item.isGroup);
495
500
  const finalColumns = hasGroups && flatColumns.length > 0 ? flatColumns : staticColumns.length > 0 ? staticColumns : isDynamicTable && dynamicColumns.length > 0 ? dynamicColumns : flatColumns;
501
+ const parsedExpansion = parseTableRowExpansion(children);
496
502
  return {
497
503
  wmTableColumns: finalColumns,
498
504
  tableStructure: structure,
499
505
  tableActions: allTableActions,
500
506
  headerActions: headerActions2,
501
507
  footerActions: footerActions2,
502
- rowExpansionConfig: parseTableRowExpansion(children)
508
+ rowExpansionConfig: parsedExpansion
503
509
  };
504
510
  }, [children, internalDataset, isDynamicTable, dynamicColumns]);
511
+ const visibleRowExpansionConfig = useMemo(
512
+ () => isRowExpansionVisible(rowExpansionConfig, internalDataset) ? rowExpansionConfig : null,
513
+ [rowExpansionConfig, internalDataset]
514
+ );
505
515
  const rowActions = useMemo(() => parseTableRowActions(children), [children]);
506
516
  const [columnsVersion, setColumnsVersion] = useState(0);
507
517
  const [columnOverrides, setColumnOverrides] = useState(
@@ -556,8 +566,8 @@ const WmTableComponent = memo(
556
566
  updatemessage,
557
567
  errormessage,
558
568
  showToast,
559
- hasRowExpansion: rowExpansionConfig ? true : false,
560
- expansionPosition: rowExpansionConfig ? parseInt(String(rowExpansionConfig.position || "0"), 10) : 0,
569
+ hasRowExpansion: visibleRowExpansionConfig ? true : false,
570
+ expansionPosition: visibleRowExpansionConfig ? parseInt(String(visibleRowExpansionConfig.position || "0"), 10) : 0,
561
571
  datasource,
562
572
  binddataset,
563
573
  onSuccess,
@@ -580,7 +590,9 @@ const WmTableComponent = memo(
580
590
  useMultiSelect,
581
591
  isrowselectable,
582
592
  listener,
583
- name
593
+ viewParent,
594
+ name,
595
+ widgetRegistrationKey
584
596
  });
585
597
  useEffect(() => {
586
598
  const currentPage = paginationState.pageIndex;
@@ -766,8 +778,8 @@ const WmTableComponent = memo(
766
778
  if (name && (listener == null ? void 0 : listener.Widgets[name]) && tableContainerRef.current) {
767
779
  listener.Widgets[name].nativeElement = tableContainerRef.current;
768
780
  }
769
- const data = internalDataset;
770
- onDatarender((_a2 = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a2[name], { $data: data, data });
781
+ const data = internalDataset && internalDataset.length > 0 ? internalDataset : table.getRowModel().rows.map((row) => row.original) || [];
782
+ onDatarender((_a2 = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a2[name], data);
771
783
  }, [onDatarender, name]);
772
784
  columnsStateRef.current = columns;
773
785
  const columnsForTable = useMemo(() => {
@@ -1344,23 +1356,33 @@ const WmTableComponent = memo(
1344
1356
  selectPageSize,
1345
1357
  rowDefInstances
1346
1358
  };
1347
- syncSelectedItemsImplRef.current = (newSelectedIds) => {
1359
+ const getRowId = (row) => row._wmTableRowId || String(row.id);
1360
+ const pushSelectedItemsToWidget = (selectedIds) => {
1348
1361
  if (!(listener == null ? void 0 : listener.onChange)) return;
1349
- const getRowId = (row) => row._wmTableRowId || String(row.id);
1350
1362
  const selectedRows = internalDataset.filter(
1351
- (row) => newSelectedIds.includes(getRowId(row))
1363
+ (row) => selectedIds.includes(getRowId(row))
1352
1364
  );
1353
1365
  const selectedItems = cleanRowData(selectedRows);
1354
- if (!isEqual(prevSelectedRow.current, selectedItems)) {
1355
- prevSelectedRow.current = selectedItems;
1356
- if (tableApisRegistered.current) {
1357
- listener.onChange(widgetRegistrationKey, { selectedItems });
1358
- } else {
1359
- tableApisRegistered.current = true;
1360
- listener.onChange(widgetRegistrationKey, __spreadProps(__spreadValues({}, tableApis), { selectedItems }));
1361
- }
1366
+ if (selectedIds.length === 0) {
1367
+ prevSelectedRow.current = null;
1362
1368
  }
1369
+ if (isEqual(prevSelectedRow.current, selectedItems)) {
1370
+ return;
1371
+ }
1372
+ prevSelectedRow.current = selectedItems;
1373
+ const selectionPayload = {
1374
+ selectedItems,
1375
+ selecteditem: selectedItems,
1376
+ selectedItem: selectedItems.length === 1 ? selectedItems[0] : selectedItems
1377
+ };
1378
+ if (tableApisRegistered.current) {
1379
+ listener.onChange(widgetRegistrationKey, selectionPayload);
1380
+ return;
1381
+ }
1382
+ tableApisRegistered.current = true;
1383
+ listener.onChange(widgetRegistrationKey, __spreadValues(__spreadValues({}, tableApis), selectionPayload));
1363
1384
  };
1385
+ syncSelectedItemsImplRef.current = pushSelectedItemsToWidget;
1364
1386
  useEffect(() => {
1365
1387
  var _a2, _b2, _c2;
1366
1388
  if (parentForm && name && ((_a2 = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a2[parentForm])) {
@@ -1384,32 +1406,14 @@ const WmTableComponent = memo(
1384
1406
  }
1385
1407
  }
1386
1408
  }, [parentForm, parentFormColumns]);
1387
- const updateSelectedItem = () => {
1388
- if (!(listener == null ? void 0 : listener.onChange)) return;
1389
- const getRowId = (row) => row._wmTableRowId || String(row.id);
1390
- let selectedRows = [];
1391
- if ((useRadioSelect || useMultiSelect) && selectedRowIds.length > 0) {
1392
- selectedRows = internalDataset.filter((row) => selectedRowIds.includes(getRowId(row)));
1393
- } else if (activeRowIds.length > 0) {
1394
- selectedRows = internalDataset.filter(
1395
- (row) => activeRowIds.includes(getRowId(row))
1396
- );
1397
- }
1398
- const cleanedRows = cleanRowData(selectedRows);
1399
- const selectedItems = cleanedRows.length > 0 ? cleanedRows : [];
1400
- if (!isEqual(prevSelectedRow.current, selectedItems)) {
1401
- prevSelectedRow.current = selectedItems;
1402
- if (tableApisRegistered.current) {
1403
- listener.onChange(widgetRegistrationKey, { selectedItems });
1404
- return;
1405
- }
1406
- tableApisRegistered.current = true;
1407
- listener.onChange(widgetRegistrationKey, __spreadProps(__spreadValues({}, tableApis), { selectedItems }));
1408
- }
1409
- };
1410
1409
  useEffect(() => {
1411
- updateSelectedItem();
1412
- }, [activeRowIds, selectedRowIds, useRadioSelect, useMultiSelect, internalDataset, name]);
1410
+ if (!useRadioSelect && !useMultiSelect) return;
1411
+ pushSelectedItemsToWidget(selectedRowIds);
1412
+ }, [internalDataset, selectedRowIds, useRadioSelect, useMultiSelect]);
1413
+ useEffect(() => {
1414
+ if (useRadioSelect || useMultiSelect) return;
1415
+ pushSelectedItemsToWidget(activeRowIds != null ? activeRowIds : []);
1416
+ }, [activeRowIds, useRadioSelect, useMultiSelect]);
1413
1417
  const isTableLoading = useMemo(() => {
1414
1418
  return loading && navigation !== "On-Demand" && internalDataset.length === 0;
1415
1419
  }, [loading, navigation, internalDataset.length]);
@@ -1428,16 +1432,16 @@ const WmTableComponent = memo(
1428
1432
  domHidden: !!hiddenColStyle
1429
1433
  };
1430
1434
  });
1431
- if (rowExpansionConfig) {
1435
+ if (visibleRowExpansionConfig) {
1432
1436
  const expansionInsertIndex = getExpansionColumnInsertIndex(
1433
1437
  leafHeaders,
1434
- rowExpansionConfig,
1438
+ visibleRowExpansionConfig,
1435
1439
  {
1436
1440
  appendForGroupedTable: !!(tableStructure && hasTableGroups(tableStructure))
1437
1441
  }
1438
1442
  );
1439
1443
  if (expansionInsertIndex >= 0) {
1440
- base.splice(expansionInsertIndex, 0, __spreadProps(__spreadValues({}, buildExpansionColSpec(rowExpansionConfig.columnwidth)), {
1444
+ base.splice(expansionInsertIndex, 0, __spreadProps(__spreadValues({}, buildExpansionColSpec(visibleRowExpansionConfig.columnwidth)), {
1441
1445
  domHidden: false
1442
1446
  }));
1443
1447
  }
@@ -1449,7 +1453,7 @@ const WmTableComponent = memo(
1449
1453
  columnsVersion,
1450
1454
  showheader,
1451
1455
  ColClassSignature,
1452
- rowExpansionConfig,
1456
+ visibleRowExpansionConfig,
1453
1457
  tableStructure
1454
1458
  ]);
1455
1459
  return /* @__PURE__ */ jsxs(
@@ -1532,7 +1536,7 @@ const WmTableComponent = memo(
1532
1536
  sorting,
1533
1537
  columnSizing,
1534
1538
  rowSelection,
1535
- rowExpansionConfig,
1539
+ rowExpansionConfig: visibleRowExpansionConfig,
1536
1540
  columnsVersion,
1537
1541
  filterMode: filtermode,
1538
1542
  columnFilters,
@@ -1562,7 +1566,7 @@ const WmTableComponent = memo(
1562
1566
  nodatamessage,
1563
1567
  loadingdatamsg,
1564
1568
  isLoading: datasource == null ? void 0 : datasource.loading,
1565
- rowExpansionConfig,
1569
+ rowExpansionConfig: visibleRowExpansionConfig,
1566
1570
  expandedRows,
1567
1571
  toggleRowExpansion: handleToggleRowExpansion,
1568
1572
  isRowExpanded,
@@ -942,9 +942,9 @@ export interface BuildSelectionColumnsProps {
942
942
  useMultiSelect: boolean;
943
943
  /** @deprecated Header now reads from table.getIsAllRowsSelected() — no longer used internally. */
944
944
  selectedRowIds?: string[];
945
- handleRadioSelection: (rowId: string, rowData?: any) => void;
946
- handleMultiSelection: (rowId: string, rowData: any, isSelected: boolean) => void;
947
- handleSelectAll: (isSelected: boolean) => void;
945
+ handleRadioSelection: (rowId: string, rowData?: any, event?: any) => void;
946
+ handleMultiSelection: (rowId: string, rowData: any, isSelected: boolean, event?: any) => void;
947
+ handleSelectAll: (isSelected: boolean, event?: any) => void;
948
948
  /** @deprecated Header now reads from table.getIsAllRowsSelected() — no longer used internally. */
949
949
  internalDataset?: any[];
950
950
  radioselecttitle?: string;
@@ -1056,8 +1056,8 @@ export interface UseTableColumnsProps {
1056
1056
  cellState?: CellStateReturn;
1057
1057
  isResizing?: boolean;
1058
1058
  handleRowClick?: (event: React.MouseEvent, rowData: any, rowId: string) => void;
1059
- handleRadioSelection?: (rowId: string, rowData: any) => void;
1060
- handleMultiSelection?: (rowId: string, rowData: any, checked: boolean) => void;
1059
+ handleRadioSelection?: (rowId: string, rowData: any, event?: any) => void;
1060
+ handleMultiSelection?: (rowId: string, rowData: any, checked: boolean, event?: any) => void;
1061
1061
  useRadioSelect?: boolean;
1062
1062
  useMultiSelect?: boolean;
1063
1063
  isRowSelected?: (rowId: string) => boolean;
@@ -1113,15 +1113,17 @@ export interface UseRowSelectionProps {
1113
1113
  onRowdeselect?: (event: any, widget: any, row: any) => void;
1114
1114
  listener?: any;
1115
1115
  navigation?: string;
1116
+ viewParent?: any;
1117
+ widgetRegistrationKey?: string;
1116
1118
  onSyncSelectedItems?: (selectedIds: string[]) => void;
1117
1119
  }
1118
1120
  export interface UseRowSelectionReturn {
1119
1121
  selectedRowIds: string[];
1120
1122
  useMultiSelect: boolean;
1121
1123
  useRadioSelect: boolean;
1122
- handleRadioSelection: (rowId: string, rowData?: any) => void;
1123
- handleMultiSelection: (rowId: string, rowData: any, isSelected: boolean) => void;
1124
- handleSelectAll: (isSelected: boolean) => void;
1124
+ handleRadioSelection: (rowId: string, rowData?: any, event?: any) => void;
1125
+ handleMultiSelection: (rowId: string, rowData: any, isSelected: boolean, event?: any) => void;
1126
+ handleSelectAll: (isSelected: boolean, event?: any) => void;
1125
1127
  handleRowSelectionClick: (event: MouseEvent, rowId: string, rowData: any) => boolean;
1126
1128
  isRowSelected: (rowId: string) => boolean;
1127
1129
  isInteractiveElement: (event: MouseEvent) => boolean;
@@ -1261,7 +1263,9 @@ export interface UseRowHandlersProps {
1261
1263
  useMultiSelect?: boolean;
1262
1264
  isrowselectable?: boolean;
1263
1265
  listener?: any;
1266
+ viewParent?: any;
1264
1267
  name: string;
1268
+ widgetRegistrationKey?: string;
1265
1269
  }
1266
1270
  export interface UseRowHandlersReturn {
1267
1271
  handleRowClick: (event: MouseEvent, rowData: any, rowId: string) => void;
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { Box, Radio, Checkbox, FormControlLabel, Tooltip } from "@mui/material";
2
+ import { Box, Radio, FormControlLabel, Tooltip } from "@mui/material";
3
3
  import { TABLE_MESSAGES } from "./constants";
4
4
  const getSelectionMeta = (ctx) => {
5
5
  var _a, _b, _c, _d;
@@ -17,7 +17,7 @@ function RadioSelectCell(ctx) {
17
17
  Radio,
18
18
  {
19
19
  checked: isSelected,
20
- onChange: () => handleRadioSelection == null ? void 0 : handleRadioSelection(rowId, row.original),
20
+ onChange: (e) => handleRadioSelection == null ? void 0 : handleRadioSelection(rowId, row.original, e),
21
21
  value: rowId,
22
22
  name: `wmRadioselect-${tableName != null ? tableName : "table"}`,
23
23
  inputProps: {
@@ -38,25 +38,24 @@ function MultiSelectCell(ctx) {
38
38
  const rowId = row.id;
39
39
  const isSelected = row.getIsSelected();
40
40
  const { handleMultiSelection, multiselecttitle, multiselectarialabel } = getSelectionMeta(ctx);
41
- return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex", justifyContent: "center" }, children: [
42
- /* @__PURE__ */ jsx(Tooltip, { title: multiselecttitle != null ? multiselecttitle : "", placement: "top", children: /* @__PURE__ */ jsx(Box, { className: "app-checkbox checkbox", children: /* @__PURE__ */ jsx(
43
- Checkbox,
44
- {
45
- checked: isSelected,
46
- onChange: (e) => handleMultiSelection == null ? void 0 : handleMultiSelection(rowId, row.original, e.target.checked),
47
- value: rowId,
48
- name: "gridMultiSelect",
49
- inputProps: {
50
- "aria-label": multiselectarialabel,
41
+ return /* @__PURE__ */ jsxs(Box, { sx: { display: "flex" }, children: [
42
+ /* @__PURE__ */ jsx(Tooltip, { title: multiselecttitle != null ? multiselecttitle : "", placement: "top", children: /* @__PURE__ */ jsx(Box, { className: "app-checkbox checkbox", children: /* @__PURE__ */ jsxs(Box, { component: "label", className: isSelected ? "" : "unchecked", children: [
43
+ /* @__PURE__ */ jsx(Box, { component: "span", className: "sr-only", "aria-live": "assertive", children: "Select row" }),
44
+ /* @__PURE__ */ jsx(
45
+ Box,
46
+ {
47
+ component: "input",
48
+ type: "checkbox",
51
49
  role: "checkbox",
52
- "aria-live": "assertive"
53
- },
54
- size: "small",
55
- sx: {
56
- padding: 0
50
+ checked: isSelected,
51
+ onChange: (e) => handleMultiSelection == null ? void 0 : handleMultiSelection(rowId, row.original, e.target.checked, e),
52
+ value: rowId,
53
+ name: "gridMultiSelect",
54
+ "aria-label": multiselectarialabel
57
55
  }
58
- }
59
- ) }) }),
56
+ ),
57
+ /* @__PURE__ */ jsx(Box, { component: "span", className: "caption" })
58
+ ] }) }) }),
60
59
  isSelected ? /* @__PURE__ */ jsx("span", { className: "sr-only", "aria-live": "assertive", children: "Row Selected" }) : /* @__PURE__ */ jsx("span", { className: "sr-only", "aria-live": "assertive", children: "Row Deselected" })
61
60
  ] });
62
61
  }
@@ -65,20 +64,21 @@ function MultiSelectHeader({ table, column }) {
65
64
  var _a, _b;
66
65
  const isAllSelected = table.getIsAllRowsSelected();
67
66
  const { handleSelectAll } = (_b = (_a = column.columnDef.meta) == null ? void 0 : _a.selection) != null ? _b : {};
68
- return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", justifyContent: "center", width: "100%" }, children: /* @__PURE__ */ jsx(Box, { className: "app-checkbox checkbox", children: /* @__PURE__ */ jsx(
69
- Checkbox,
70
- {
71
- checked: isAllSelected,
72
- onChange: (e) => handleSelectAll == null ? void 0 : handleSelectAll(e.target.checked),
73
- size: "small",
74
- inputProps: {
67
+ return /* @__PURE__ */ jsx(Box, { sx: { display: "flex", width: "100%" }, children: /* @__PURE__ */ jsx(Box, { className: "app-checkbox checkbox", children: /* @__PURE__ */ jsxs(Box, { component: "label", className: isAllSelected ? "" : "unchecked", children: [
68
+ /* @__PURE__ */ jsx(
69
+ Box,
70
+ {
71
+ component: "input",
72
+ type: "checkbox",
73
+ role: "checkbox",
74
+ checked: isAllSelected,
75
+ onChange: (e) => handleSelectAll == null ? void 0 : handleSelectAll(e.target.checked, e),
76
+ name: "gridMultiSelectAll",
75
77
  "aria-label": "Select all rows"
76
- },
77
- sx: {
78
- padding: 0
79
78
  }
80
- }
81
- ) }) });
79
+ ),
80
+ /* @__PURE__ */ jsx(Box, { component: "span", className: "caption" })
81
+ ] }) }) });
82
82
  }
83
83
  MultiSelectHeader.displayName = "MultiSelectHeader";
84
84
  const buildSelectionColumns = ({
@@ -62,7 +62,7 @@ const createDataColumn = (wmColumn, renderCell, index = 0) => {
62
62
  const colClassProp = (_a = wmColumn.colClass) != null ? _a : wmColumn["col-class"];
63
63
  let columnSize;
64
64
  if (wmColumn.width) {
65
- columnSize = parseInt(wmColumn.width);
65
+ columnSize = parseWidth(wmColumn.width);
66
66
  } else if ((_b = wmColumn.styles) == null ? void 0 : _b.width) {
67
67
  columnSize = parseWidth(wmColumn.styles.width);
68
68
  }
@@ -7,7 +7,8 @@ export type EditWidgetType = FormWidgetType;
7
7
  * Angular behavior: when a dataset is a non-array object (e.g. a REST API response
8
8
  * like { users: [...], total: 100 }), return the first array-valued property as the
9
9
  * actual row data. If the value is already an array it is returned as-is; if no
10
- * array property is found (e.g. a params snapshot) an empty array is returned.
10
+ * array property is found, the object itself is a single record (e.g. a get-by-id
11
+ * service response) and is wrapped as a one-row array.
11
12
  */
12
13
  export declare const extractDataArray: (dataset: any) => any[];
13
14
  /**
@@ -48,6 +49,13 @@ export declare const parseTableRowActions: (children: React.ReactNode) => WmTabl
48
49
  export declare const parseTableActions: (children: React.ReactNode) => WmTableActionProps[];
49
50
  /** Resolve row-bound expansion props. Uses precomputed map first, then tableRowProps(rowData) fallback. */
50
51
  export declare const getRowExpansionConfig: (config: WmTableRowProps | null, rowId: string, rowData?: any) => WmTableRowProps | null;
52
+ /**
53
+ * Whether the expansion column should be reserved in the table layout.
54
+ * When tableRowProps gates show per row (e.g. hierarchy children.length), hide the
55
+ * column entirely if no current row would show an expand control — avoids empty
56
+ * row-expansion-cell spacers for leaf-only datasets.
57
+ */
58
+ export declare const isRowExpansionVisible: (config: WmTableRowProps | null | undefined, dataset: any[] | undefined) => boolean;
51
59
  export declare const parseTableRowExpansion: (children: React.ReactNode) => WmTableRowProps | null;
52
60
  export declare const isEditAction: (actionKey: string) => boolean;
53
61
  export declare const isDeleteAction: (actionKey: string) => boolean;
@@ -70,12 +70,26 @@ const hashString = (str, index) => {
70
70
  }
71
71
  return `row_${Math.abs(hash)}_${index}`;
72
72
  };
73
+ const safeStringify = (value) => {
74
+ const seen = /* @__PURE__ */ new WeakSet();
75
+ try {
76
+ return JSON.stringify(value, (_key, val) => {
77
+ if (typeof val === "object" && val !== null) {
78
+ if (seen.has(val)) return "[Circular]";
79
+ seen.add(val);
80
+ }
81
+ return val;
82
+ });
83
+ } catch (e) {
84
+ return String(value);
85
+ }
86
+ };
73
87
  const generateDeterministicHash = (obj, index) => {
74
88
  const hashSource = index.toString() + (isObject(obj) ? transform(
75
89
  omit(obj, "_wmTableRowId"),
76
90
  (result, value, key) => {
77
91
  if (!isNil(value)) {
78
- result.push(`${key}:${isObject(value) ? JSON.stringify(value) : String(value)}`);
92
+ result.push(`${key}:${isObject(value) ? safeStringify(value) : String(value)}`);
79
93
  }
80
94
  },
81
95
  []
@@ -86,7 +100,7 @@ const extractDataArray = (dataset) => {
86
100
  if (isArray(dataset)) return dataset;
87
101
  if (dataset !== null && dataset !== void 0 && typeof dataset === "object") {
88
102
  const firstArray = Object.values(dataset).find((v) => isArray(v));
89
- return firstArray != null ? firstArray : [];
103
+ return firstArray != null ? firstArray : [dataset];
90
104
  }
91
105
  return [];
92
106
  };
@@ -351,6 +365,19 @@ const getRowExpansionConfig = (config, rowId, rowData) => {
351
365
  const overrides = typeof config.tableRowProps === "function" && rowData !== void 0 ? config.tableRowProps(rowData) : {};
352
366
  return __spreadValues(__spreadValues({}, config), overrides);
353
367
  };
368
+ const isRowExpansionVisible = (config, dataset) => {
369
+ if (!config) return false;
370
+ if (typeof config.tableRowProps === "function") {
371
+ if (!Array.isArray(dataset) || dataset.length === 0) return false;
372
+ return dataset.some((row) => {
373
+ var _a;
374
+ const overrides = ((_a = config.tableRowProps) == null ? void 0 : _a.call(config, row)) || {};
375
+ const show = overrides.show !== void 0 ? overrides.show : config.show;
376
+ return show !== false;
377
+ });
378
+ }
379
+ return config.show !== false;
380
+ };
354
381
  const parseTableRowExpansion = (children) => {
355
382
  let rowExpansionConfig = null;
356
383
  React.Children.forEach(children, (child) => {
@@ -714,6 +741,7 @@ export {
714
741
  isDeleteAction,
715
742
  isEditAction,
716
743
  isInteractiveElement,
744
+ isRowExpansionVisible,
717
745
  parseTableActions,
718
746
  parseTableColumns,
719
747
  parseTableRowActions,
@@ -11,6 +11,13 @@ export declare const hasInteractiveAttributes: (element: HTMLElement) => boolean
11
11
  * Check if element or its ancestors are interactive
12
12
  */
13
13
  export declare const isInteractiveElement: (event: React.MouseEvent) => boolean;
14
+ export declare const toNativeEvent: (event: any) => any;
15
+ export declare const createSelectionEventStub: () => any;
16
+ /**
17
+ * Widget passed to user callbacks must come from the page proxy (viewParent), which
18
+ * listener.onChange updates synchronously. listener.Widgets lags one React commit behind.
19
+ */
20
+ export declare const getWidgetForCallback: (listener: any | undefined, viewParent: any | undefined, widgetKey: string) => any;
14
21
  /**
15
22
  * Get row IDs from dataset
16
23
  */
@@ -47,6 +47,30 @@ const isInteractiveElement = (event) => {
47
47
  }
48
48
  return false;
49
49
  };
50
+ const toNativeEvent = (event) => {
51
+ var _a;
52
+ return (_a = event == null ? void 0 : event.nativeEvent) != null ? _a : event;
53
+ };
54
+ const createSelectionEventStub = () => ({
55
+ target: {
56
+ closest: () => null,
57
+ matches: () => false,
58
+ querySelector: () => null
59
+ },
60
+ currentTarget: null,
61
+ preventDefault: () => {
62
+ },
63
+ stopPropagation: () => {
64
+ },
65
+ stopImmediatePropagation: () => {
66
+ },
67
+ isDefaultPrevented: () => false,
68
+ isPropagationStopped: () => false
69
+ });
70
+ const getWidgetForCallback = (listener, viewParent, widgetKey) => {
71
+ var _a, _b, _c;
72
+ return (_c = (_a = viewParent == null ? void 0 : viewParent.Widgets) == null ? void 0 : _a[widgetKey]) != null ? _c : (_b = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _b[widgetKey];
73
+ };
50
74
  const getRowIdsFromDataset = (dataset) => {
51
75
  return dataset.map((row) => row._wmTableRowId || String(row.id));
52
76
  };
@@ -102,10 +126,13 @@ const selectionStateHelpers = {
102
126
  }
103
127
  };
104
128
  export {
129
+ createSelectionEventStub,
105
130
  getRowIdsFromDataset,
131
+ getWidgetForCallback,
106
132
  hasInteractiveAttributes,
107
133
  hasInteractiveClass,
108
134
  isInteractiveElement,
109
135
  rowExistsInDataset,
110
- selectionStateHelpers
136
+ selectionStateHelpers,
137
+ toNativeEvent
111
138
  };
@@ -1,9 +1,18 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import clsx from "clsx";
2
3
  import DialogActions from "@mui/material/DialogActions";
3
4
  import withBaseWrapper from "../../../higherOrder/withBaseWrapper";
4
5
  const WmDialogFooter = (props) => {
5
- const { children } = props;
6
- return /* @__PURE__ */ jsx(DialogActions, { className: "app-dialog-footer modal-footer", children });
6
+ const { children, className, styles, hidden } = props;
7
+ return /* @__PURE__ */ jsx(
8
+ DialogActions,
9
+ {
10
+ className: clsx("app-dialog-footer modal-footer", className),
11
+ style: styles,
12
+ hidden: hidden != null ? hidden : false,
13
+ children
14
+ }
15
+ );
7
16
  };
8
17
  WmDialogFooter.displayName = "WmDialogFooter";
9
18
  var dialog_actions_default = withBaseWrapper(WmDialogFooter);
@@ -38,7 +38,7 @@ const WmDialogHeader = (props) => {
38
38
  variant,
39
39
  id: titleid,
40
40
  component: variant,
41
- sx: { display: "flex", alignItems: "center" },
41
+ sx: { display: "flex", alignItems: "center", fontWeight: "bold" },
42
42
  className: "app-dialog-title modal-title",
43
43
  children: [
44
44
  isDialog ? iconclass && iconclass.trim() !== "" || iconurl && iconurl !== "" ? /* @__PURE__ */ jsx(