@wavemaker/react-runtime 11.14.2-rc.6311 → 12.0.0-next.28533

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 (244) hide show
  1. package/actions/base-action.js +5 -7
  2. package/actions/login-action.js +7 -8
  3. package/actions/logout-action.js +5 -7
  4. package/actions/navigation-action.js +32 -10
  5. package/actions/notification-action.js +22 -8
  6. package/actions/timer-action.js +13 -15
  7. package/actions/toast.js +4 -2
  8. package/actions/toast.service.js +1 -2
  9. package/components/advanced/carousel/index.js +1 -1
  10. package/components/advanced/carousel/template.js +1 -1
  11. package/components/basic/anchor/index.js +26 -9
  12. package/components/basic/html/index.js +115 -24
  13. package/components/basic/icon/index.js +2 -1
  14. package/components/basic/iframe/index.js +2 -1
  15. package/components/basic/label/index.js +12 -9
  16. package/components/basic/message/index.js +12 -3
  17. package/components/basic/picture/index.js +11 -4
  18. package/components/basic/progress-bar/index.js +1 -1
  19. package/components/basic/progress-circle/index.js +34 -28
  20. package/components/basic/progress-circle/props.js +10 -2
  21. package/components/basic/richtexteditor/index.js +95 -94
  22. package/components/basic/search/index.js +401 -156
  23. package/components/basic/search/providers.js +126 -61
  24. package/components/basic/spinner/index.js +2 -1
  25. package/components/basic/tree/index.js +34 -34
  26. package/components/basic/tree/utils.js +10 -4
  27. package/components/chart/components/barColumnChart/index.js +36 -33
  28. package/components/chart/components/bubbleChart/index.js +35 -25
  29. package/components/chart/components/chartLegend/utils.js +2 -1
  30. package/components/chart/components/cumulativeLineChart/index.js +30 -26
  31. package/components/chart/components/lineAreaChart/index.js +50 -32
  32. package/components/chart/components/pieDonutChart/index.js +13 -4
  33. package/components/chart/hooks/useXAxisConfig.js +15 -8
  34. package/components/chart/index.js +223 -53
  35. package/components/chart/utils.js +12 -1
  36. package/components/constants.js +5 -2
  37. package/components/container/accordion/accordion-pane/index.js +17 -12
  38. package/components/container/accordion/index.js +9 -4
  39. package/components/container/alignment-utils.js +56 -1
  40. package/components/container/index.js +49 -20
  41. package/components/container/panel/components/panel-header/index.js +3 -4
  42. package/components/container/panel/index.js +15 -10
  43. package/components/container/tabs/index.js +92 -14
  44. package/components/container/tabs/tab-pane/index.js +15 -8
  45. package/components/container/tabs/utils.js +51 -0
  46. package/components/container/wizard/components/StepComponents.js +2 -1
  47. package/components/container/wizard/components/WizardStep.js +2 -1
  48. package/components/container/wizard/index.js +64 -35
  49. package/components/container/wizard/utils.js +46 -1
  50. package/components/container/wizard/wizard-step/index.js +11 -1
  51. package/components/data/card/card-content/index.js +1 -1
  52. package/components/data/form/base-form/index.js +991 -180
  53. package/components/data/form/base-form/props.js +3 -1
  54. package/components/data/form/base-form/utils.js +159 -1
  55. package/components/data/form/dynamic-fields/constant.js +53 -0
  56. package/components/data/form/dynamic-fields/index.js +10 -45
  57. package/components/data/form/dynamic-fields/utils.js +37 -2
  58. package/components/data/form/form-action/index.js +5 -4
  59. package/components/data/form/form-context.js +5 -1
  60. package/components/data/form/form-controller/utils.js +84 -0
  61. package/components/data/form/form-controller/validation-contrustor.js +402 -189
  62. package/components/data/form/form-controller/withFormController.js +191 -52
  63. package/components/data/form/form-field/base-field.js +54 -33
  64. package/components/data/form/form-field/index.js +28 -5
  65. package/components/data/form/form-header/index.js +3 -4
  66. package/components/data/form/index.js +20 -1
  67. package/components/data/list/components/ListDND.js +2 -1
  68. package/components/data/list/components/ListItem.js +6 -2
  69. package/components/data/list/components/ListItemWithTemplate.js +46 -2
  70. package/components/data/list/components/ListItems.js +17 -26
  71. package/components/data/list/components/ListPagination.js +3 -3
  72. package/components/data/list/components/StandardListItems.js +3 -4
  73. package/components/data/list/hooks/useListEffects.js +55 -14
  74. package/components/data/list/hooks/useListEventHandlers.js +3 -1
  75. package/components/data/list/hooks/useListState.js +3 -1
  76. package/components/data/list/hooks/usePaginatedGroupedData.js +18 -5
  77. package/components/data/list/index.js +74 -55
  78. package/components/data/list/utils/list-helpers.js +73 -35
  79. package/components/data/list/utils/list-widget-methods.js +138 -95
  80. package/components/data/live-filter/index.js +26 -15
  81. package/components/data/live-form/index.js +23 -7
  82. package/components/data/live-form/props.js +1 -1
  83. package/components/data/pagination/components/BasicPagination.js +71 -16
  84. package/components/data/pagination/components/PageSizeSelector.js +8 -3
  85. package/components/data/pagination/components/TotalRecords.js +1 -5
  86. package/components/data/pagination/hooks/usePagination.js +349 -66
  87. package/components/data/pagination/index.js +137 -19
  88. package/components/data/table/components/AddNewRow.js +5 -1
  89. package/components/data/table/components/EditableCell.js +2 -2
  90. package/components/data/table/components/RowCells.js +64 -0
  91. package/components/data/table/components/RowExpansionButton.js +2 -2
  92. package/components/data/table/components/SummaryCell.js +111 -0
  93. package/components/data/table/components/SummaryRow.js +54 -0
  94. package/components/data/table/components/SummaryRowFooter.js +46 -0
  95. package/components/data/table/components/TableBody.js +61 -59
  96. package/components/data/table/components/TableDataRow.js +109 -0
  97. package/components/data/table/components/TableFilters.js +225 -121
  98. package/components/data/table/components/TableHeader.js +291 -23
  99. package/components/data/table/components/TablePanelHeading.js +139 -8
  100. package/components/data/table/components/index.js +22 -1
  101. package/components/data/table/hooks/use-edited-rows.js +141 -0
  102. package/components/data/table/hooks/useCellState.js +5 -12
  103. package/components/data/table/hooks/useFormWidget.js +58 -51
  104. package/components/data/table/hooks/usePaginationState.js +45 -24
  105. package/components/data/table/hooks/usePanelStructure.js +4 -4
  106. package/components/data/table/hooks/useRowHandlers.js +39 -5
  107. package/components/data/table/hooks/useRowSelection.js +244 -50
  108. package/components/data/table/hooks/useServerSideSorting.js +81 -37
  109. package/components/data/table/hooks/useTableColumns.js +211 -118
  110. package/components/data/table/hooks/useTableData.js +54 -9
  111. package/components/data/table/hooks/useTableEdit.js +272 -97
  112. package/components/data/table/hooks/useTableEffects.js +31 -13
  113. package/components/data/table/hooks/useTableFilter.js +1 -1
  114. package/components/data/table/hooks/useTableInitialization.js +23 -22
  115. package/components/data/table/hooks/useTableState.js +11 -5
  116. package/components/data/table/hooks/useTableStateManager.js +140 -65
  117. package/components/data/table/index.js +637 -274
  118. package/components/data/table/live-table/index.js +54 -22
  119. package/components/data/table/table-action/index.js +1 -1
  120. package/components/data/table/table-group/index.js +26 -0
  121. package/components/data/table/table-row-action/index.js +32 -18
  122. package/components/data/table/utils/buildSelectionColumns.js +12 -21
  123. package/components/data/table/utils/columnBuilder.js +29 -14
  124. package/components/data/table/utils/columnProxy.js +68 -1
  125. package/components/data/table/utils/constants.js +6 -2
  126. package/components/data/table/utils/crud-handlers.js +68 -63
  127. package/components/data/table/utils/groupHeaderUtils.js +102 -0
  128. package/components/data/table/utils/index.js +210 -21
  129. package/components/data/table/utils/renderDisplayCell.js +6 -6
  130. package/components/data/table/utils/selectionUtils.js +25 -26
  131. package/components/data/table/utils/validation.js +1 -0
  132. package/components/data/utils/filter-field-util.js +3 -3
  133. package/components/dialogs/alert-dialog/index.js +1 -1
  134. package/components/dialogs/confirm-dialog/index.js +1 -1
  135. package/components/dialogs/dialog/index.js +4 -1
  136. package/components/dialogs/dialog-content/index.js +3 -1
  137. package/components/dialogs/dialog-header/index.js +2 -2
  138. package/components/dialogs/iframe-dialog/index.js +11 -5
  139. package/components/dialogs/index.js +1 -1
  140. package/components/dialogs/login-dialog/index.js +1 -1
  141. package/components/dialogs/page-dialog/index.js +1 -1
  142. package/components/form/button/index.js +33 -7
  143. package/components/input/calendar/index.js +18 -6
  144. package/components/input/chips/index.js +99 -28
  145. package/components/input/chips/utils.js +34 -4
  146. package/components/input/color-picker/index.js +74 -25
  147. package/components/input/composite/index.js +3 -3
  148. package/components/input/currency/index.js +35 -49
  149. package/components/input/default/checkbox/index.js +23 -28
  150. package/components/input/default/checkboxset/index.js +38 -18
  151. package/components/input/default/checkboxset/utils.js +30 -0
  152. package/components/input/default/radioset/index.js +36 -39
  153. package/components/input/default/switch/index.js +30 -13
  154. package/components/input/epoch/date/index.js +130 -69
  155. package/components/input/epoch/date/utils.js +94 -1
  156. package/components/input/epoch/datetime/index.js +72 -22
  157. package/components/input/epoch/datetime/utils.js +49 -10
  158. package/components/input/epoch/time/index.js +68 -19
  159. package/components/input/epoch/time/utils.js +62 -14
  160. package/components/input/fileupload/Utils.js +12 -7
  161. package/components/input/fileupload/components/MultiUpload.js +2 -6
  162. package/components/input/fileupload/components/SingleUpload.js +3 -7
  163. package/components/input/fileupload/index.js +6 -10
  164. package/components/input/fileupload/useFileUpload.js +16 -5
  165. package/components/input/number/index.js +158 -43
  166. package/components/input/rating/index.js +90 -7
  167. package/components/input/select/index.js +147 -70
  168. package/components/input/slider/index.js +84 -26
  169. package/components/input/text/index.js +38 -18
  170. package/components/input/text/util.js +283 -130
  171. package/components/input/textarea/index.js +13 -10
  172. package/components/input/upload/index.js +124 -0
  173. package/components/input/upload/props.js +5 -0
  174. package/components/input/util/index.js +11 -0
  175. package/components/navbar/index.js +51 -3
  176. package/components/navbar/nav/index.js +46 -16
  177. package/components/navbar/nav-item/index.js +11 -5
  178. package/components/navigation/menu/components/ListItems.js +3 -0
  179. package/components/navigation/menu/constants.js +2 -1
  180. package/components/navigation/menu/hooks/useHoverState.hook.js +48 -0
  181. package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +37 -0
  182. package/components/navigation/menu/hooks/useTransformedDataset.hook.js +15 -0
  183. package/components/navigation/menu/index.js +326 -188
  184. package/components/navigation/menu/utils/action-task.js +14 -0
  185. package/components/navigation/menu/utils/role-filter.js +76 -0
  186. package/components/navigation/popover/index.js +99 -26
  187. package/components/page/partial-container/index.js +34 -5
  188. package/components/prefab/index.js +2 -4
  189. package/context/PrefabContext.js +10 -6
  190. package/context/WidgetProvider.js +30 -31
  191. package/core/app.service.js +1 -1
  192. package/core/constants/events.js +57 -1
  193. package/core/dialog.service.js +1 -2
  194. package/core/event-notifier.js +1 -2
  195. package/core/formatter/array-formatters.js +33 -0
  196. package/core/formatter/date-formatters.js +2 -4
  197. package/core/formatter/index.js +2 -1
  198. package/core/formatter/number-formatters.js +5 -10
  199. package/core/formatter/security-formatters.js +2 -4
  200. package/core/formatter/string-formatters.js +3 -6
  201. package/core/proxy-service.js +84 -13
  202. package/core/script-registry.js +108 -48
  203. package/core/util/common.js +4 -4
  204. package/core/util/compare.js +30 -0
  205. package/core/util/dom.js +8 -8
  206. package/core/util/index.js +16 -6
  207. package/core/util/safe-is-equal.js +156 -0
  208. package/core/util/security.js +1 -2
  209. package/core/util/utils.js +16 -7
  210. package/higherOrder/BaseApp.js +108 -65
  211. package/higherOrder/BaseDateTime.js +31 -13
  212. package/higherOrder/BasePage.js +268 -144
  213. package/higherOrder/BasePartial.js +1 -1
  214. package/higherOrder/BasePrefab.js +33 -15
  215. package/higherOrder/DataNav.js +99 -16
  216. package/higherOrder/helper.js +5 -0
  217. package/higherOrder/withBaseWrapper.js +41 -28
  218. package/hooks/useAuth.js +11 -5
  219. package/hooks/useHttp.js +280 -94
  220. package/mui-config/theme-provider.js +1 -1
  221. package/mui-config/theme.js +1 -1
  222. package/package-lock.json +824 -724
  223. package/package.json +8 -8
  224. package/store/bindActions/i18nActions.js +18 -0
  225. package/store/index.js +3 -1
  226. package/store/slices/appConfigSlice.js +2 -2
  227. package/store/slices/authSlice.js +31 -28
  228. package/store/slices/i18nSlice.js +2 -2
  229. package/store/slices/navigationSlice.js +35 -0
  230. package/store/viewport.service.js +255 -0
  231. package/utils/attr.js +35 -0
  232. package/utils/dataset-util.js +1 -2
  233. package/utils/form-state.util.js +43 -12
  234. package/utils/form-utils.js +47 -2
  235. package/utils/format-util.js +28 -13
  236. package/utils/page-params-util.js +33 -1
  237. package/utils/state-persistance.js +72 -13
  238. package/utils/transformedDataset-utils.js +35 -24
  239. package/variables/base-variable.js +12 -14
  240. package/variables/crud-variable.js +225 -0
  241. package/variables/live-variable.js +56 -20
  242. package/variables/metadata.service.js +123 -0
  243. package/variables/model-variable.js +21 -15
  244. package/variables/service-variable.js +88 -83
@@ -7,7 +7,9 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.useTableColumns = void 0;
9
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
12
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
13
  var _react = _interopRequireWildcard(require("react"));
12
14
  var _material = require("@mui/material");
13
15
  var _lodashEs = require("lodash-es");
@@ -17,26 +19,71 @@ var _columnBuilder = require("../utils/columnBuilder");
17
19
  var _columnWidthDistribution = require("../utils/columnWidthDistribution");
18
20
  var _useResponsiveColumns = require("./useResponsiveColumns");
19
21
  var _tableRowAction = _interopRequireDefault(require("../table-row-action"));
22
+ var _excluded = ["action", "index", "rowData", "rowIndex", "rowId", "listener"],
23
+ _excluded2 = ["onSave", "onCancel", "rowData", "rowIndex", "rowId", "listener", "deleteRowAction"];
20
24
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
21
25
  var __jsx = _react["default"].createElement;
22
26
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
23
27
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
24
- // Extract action button rendering to reduce re-renders
28
+ /**
29
+ * Handles row selection for action buttons
30
+ * Since action buttons are interactive elements, they bypass normal selection logic
31
+ * This function explicitly triggers the appropriate selection handler
32
+ */
33
+ var handleActionSelection = function handleActionSelection(rowId, rowData, handlers) {
34
+ var useMultiSelect = handlers.useMultiSelect,
35
+ handleMultiSelection = handlers.handleMultiSelection,
36
+ isRowSelected = handlers.isRowSelected,
37
+ useRadioSelect = handlers.useRadioSelect,
38
+ handleRadioSelection = handlers.handleRadioSelection;
39
+ if (useMultiSelect && handleMultiSelection && isRowSelected) {
40
+ var currentlySelected = isRowSelected(rowId);
41
+ handleMultiSelection(rowId, rowData, !currentlySelected);
42
+ } else if (useRadioSelect && handleRadioSelection) {
43
+ handleRadioSelection(rowId, rowData);
44
+ }
45
+ };
46
+
47
+ /**
48
+ * Creates a unified click handler for action buttons
49
+ * Triggers: onRowclick → selection → action-specific onClick
50
+ */
51
+ var createActionClickHandler = function createActionClickHandler(rowData, rowId, handlers, actionOnClick) {
52
+ return function (event, widget, newVal) {
53
+ // 1. Trigger row click handler (includes onRowclick callback)
54
+ if (handlers.handleRowClick && event) {
55
+ handlers.handleRowClick(event, rowData, rowId);
56
+ }
57
+
58
+ // 2. Explicitly handle selection (bypasses interactive element check)
59
+ handleActionSelection(rowId, rowData, handlers);
60
+
61
+ // 3. Trigger action-specific onClick
62
+ actionOnClick === null || actionOnClick === void 0 || actionOnClick(event, widget, newVal);
63
+ };
64
+ };
65
+
66
+ /**
67
+ * Renders a single action button for a table row
68
+ * Memoized to prevent unnecessary re-renders
69
+ */
25
70
  var ActionButton = /*#__PURE__*/_react["default"].memo(function (_ref) {
26
71
  var action = _ref.action,
27
72
  index = _ref.index,
28
73
  rowData = _ref.rowData,
29
74
  rowIndex = _ref.rowIndex,
30
75
  rowId = _ref.rowId,
31
- listener = _ref.listener;
76
+ listener = _ref.listener,
77
+ selectionHandlers = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
32
78
  var actionKey = action.key || action.name;
33
79
  var btnClass = (0, _utils.getActionButtonClass)(action);
80
+ var handleClick = createActionClickHandler(rowData, rowId, selectionHandlers, action.onClick);
34
81
  return __jsx(_tableRowAction["default"], {
35
82
  key: "row-action-".concat(index, "-").concat(actionKey),
36
83
  name: action.name || "table-row-action-".concat(index, "-").concat(actionKey),
37
84
  className: btnClass,
38
85
  "data-action-key": actionKey,
39
- displayName: action["displayName"] || "",
86
+ displayName: action.displayName || "",
40
87
  title: action.title,
41
88
  iconclass: action.iconclass,
42
89
  action: action.action,
@@ -44,20 +91,51 @@ var ActionButton = /*#__PURE__*/_react["default"].memo(function (_ref) {
44
91
  rowIndex: rowIndex,
45
92
  listener: listener,
46
93
  show: action.show,
47
- onClick: action.onClick,
94
+ onClick: handleClick,
48
95
  widgettype: action.widgettype
49
96
  });
50
97
  });
51
98
  ActionButton.displayName = "ActionButton";
52
99
 
53
- // Extract editing action buttons
100
+ /**
101
+ * Renders editing mode action buttons (save, cancel, delete)
102
+ * Memoized to prevent unnecessary re-renders
103
+ */
54
104
  var EditingActionButtons = /*#__PURE__*/_react["default"].memo(function (_ref2) {
55
105
  var onSave = _ref2.onSave,
56
106
  onCancel = _ref2.onCancel,
57
107
  rowData = _ref2.rowData,
58
108
  rowIndex = _ref2.rowIndex,
59
- listener = _ref2.listener;
109
+ rowId = _ref2.rowId,
110
+ listener = _ref2.listener,
111
+ deleteRowAction = _ref2.deleteRowAction,
112
+ selectionHandlers = (0, _objectWithoutProperties2["default"])(_ref2, _excluded2);
60
113
  var buttons = (0, _columnBuilder.createEditingActionButtons)();
114
+ var handleButtonClick = (0, _react.useCallback)(function (button, event, widget) {
115
+ var _deleteRowAction$onCl;
116
+ event === null || event === void 0 || event.preventDefault();
117
+ event === null || event === void 0 || event.stopPropagation();
118
+ var isDeleteButton = button.key === "delete-edit";
119
+
120
+ // Trigger row click and selection for delete button only
121
+ if (isDeleteButton && event) {
122
+ var _selectionHandlers$ha;
123
+ (_selectionHandlers$ha = selectionHandlers.handleRowClick) === null || _selectionHandlers$ha === void 0 || _selectionHandlers$ha.call(selectionHandlers, event, rowData, rowId);
124
+ handleActionSelection(rowId, rowData, selectionHandlers);
125
+ }
126
+
127
+ // Execute button-specific action
128
+ switch (button.key) {
129
+ case "save-edit":
130
+ onSave();
131
+ break;
132
+ case "delete-edit":
133
+ deleteRowAction === null || deleteRowAction === void 0 || (_deleteRowAction$onCl = deleteRowAction.onClick) === null || _deleteRowAction$onCl === void 0 || _deleteRowAction$onCl.call(deleteRowAction, event, rowData);
134
+ break;
135
+ default:
136
+ onCancel();
137
+ }
138
+ }, [onSave, onCancel, deleteRowAction, rowData, rowId, selectionHandlers]);
61
139
  return __jsx(_react["default"].Fragment, null, buttons.map(function (button) {
62
140
  return __jsx(_tableRowAction["default"], {
63
141
  key: button.key,
@@ -73,9 +151,7 @@ var EditingActionButtons = /*#__PURE__*/_react["default"].memo(function (_ref2)
73
151
  listener: listener,
74
152
  show: button.show,
75
153
  onClick: function onClick(event, widget) {
76
- event === null || event === void 0 || event.preventDefault();
77
- event === null || event === void 0 || event.stopPropagation();
78
- button.key === "save-edit" ? onSave() : onCancel();
154
+ return handleButtonClick(button, event, widget);
79
155
  },
80
156
  widgettype: button.widgettype
81
157
  });
@@ -91,23 +167,45 @@ var useTableColumns = exports.useTableColumns = function useTableColumns(_ref3)
91
167
  editmode = _ref3.editmode,
92
168
  renderEditableCell = _ref3.renderEditableCell,
93
169
  isRowEditing = _ref3.isRowEditing,
170
+ editingRowId = _ref3.editingRowId,
94
171
  startEditing = _ref3.startEditing,
95
172
  cancelEditing = _ref3.cancelEditing,
96
173
  saveEditing = _ref3.saveEditing,
97
174
  cellState = _ref3.cellState,
98
- isResizing = _ref3.isResizing;
175
+ isResizing = _ref3.isResizing,
176
+ handleRowClick = _ref3.handleRowClick,
177
+ handleRadioSelection = _ref3.handleRadioSelection,
178
+ handleMultiSelection = _ref3.handleMultiSelection,
179
+ useRadioSelect = _ref3.useRadioSelect,
180
+ useMultiSelect = _ref3.useMultiSelect,
181
+ isRowSelected = _ref3.isRowSelected;
99
182
  // Filter columns based on viewport
100
183
  var visibleColumns = (0, _useResponsiveColumns.useResponsiveColumns)(wmTableColumns);
101
184
 
185
+ // Group selection handlers for easier prop passing
186
+ var selectionHandlers = (0, _react.useMemo)(function () {
187
+ return {
188
+ handleRowClick: handleRowClick,
189
+ handleRadioSelection: handleRadioSelection,
190
+ handleMultiSelection: handleMultiSelection,
191
+ useRadioSelect: useRadioSelect,
192
+ useMultiSelect: useMultiSelect,
193
+ isRowSelected: isRowSelected
194
+ };
195
+ }, [handleRowClick, handleRadioSelection, handleMultiSelection, useRadioSelect, useMultiSelect, isRowSelected]);
196
+
102
197
  // Memoize the cell render function to prevent re-renders
103
198
  var renderCell = (0, _react.useCallback)(function (wmColumn, row) {
104
- var rowId = row.original._wmTableRowId || row.id;
199
+ var _row$original;
200
+ var rowId = (row === null || row === void 0 || (_row$original = row.original) === null || _row$original === void 0 ? void 0 : _row$original._wmTableRowId) || (row === null || row === void 0 ? void 0 : row.id);
201
+ var isEditingThisRow = isRowEditing(rowId);
202
+ var shouldRenderEditableCell = (editmode === "inline" || editmode === "quickedit") && isEditingThisRow && !wmColumn.readonly;
105
203
  return __jsx(_material.Box, {
106
204
  "data-col-identifier": wmColumn.field
107
- }, (editmode === "inline" || editmode === "quickedit") && isRowEditing(rowId) && !wmColumn.readonly ? renderEditableCell(wmColumn, row.original, rowId) : (0, _renderDisplayCell.renderDisplayCell)(wmColumn, row.original, listener, cellState));
108
- }, [editmode, isRowEditing, renderEditableCell, cellState, listener]);
205
+ }, shouldRenderEditableCell ? renderEditableCell(wmColumn, row.original, rowId) : (0, _renderDisplayCell.renderDisplayCell)(wmColumn, row.original, listener, cellState));
206
+ }, [editmode, editingRowId, isRowEditing, renderEditableCell, cellState, listener]);
109
207
 
110
- // Filter row actions once
208
+ // Filter row actions based on edit mode
111
209
  var filteredRowActions = (0, _react.useMemo)(function () {
112
210
  if (editmode === "quickedit") {
113
211
  return (0, _lodashEs.filter)(rowActions, function (action) {
@@ -117,39 +215,113 @@ var useTableColumns = exports.useTableColumns = function useTableColumns(_ref3)
117
215
  return rowActions;
118
216
  }, [rowActions, editmode]);
119
217
 
218
+ // Find delete action once (used in editing mode)
219
+ var deleteRowAction = (0, _react.useMemo)(function () {
220
+ return filteredRowActions.find(function (action) {
221
+ return action.key === "deleterow" || action.action === "delete";
222
+ });
223
+ }, [filteredRowActions]);
224
+
120
225
  // Create action column cell renderer
121
226
  var renderActionCell = (0, _react.useCallback)(function (_ref4) {
227
+ var _row$original$_wmTabl, _row$original2;
122
228
  var row = _ref4.row;
123
- var rowId = row.original._wmTableRowId || row.id;
229
+ var rowId = (_row$original$_wmTabl = row === null || row === void 0 || (_row$original2 = row.original) === null || _row$original2 === void 0 ? void 0 : _row$original2._wmTableRowId) !== null && _row$original$_wmTabl !== void 0 ? _row$original$_wmTabl : row === null || row === void 0 ? void 0 : row.id;
124
230
  var isEditing = isRowEditing(rowId);
231
+ var commonProps = _objectSpread({
232
+ rowData: row.original,
233
+ rowIndex: row.index,
234
+ rowId: rowId,
235
+ listener: listener
236
+ }, selectionHandlers);
125
237
  return __jsx(_material.Box, {
126
238
  component: "span",
127
239
  className: "actions-column",
128
240
  "data-identifier": "actionButtons"
129
- }, isEditing && editmode !== "quickedit" ? __jsx(EditingActionButtons, {
241
+ }, isEditing && editmode !== "quickedit" ? __jsx(EditingActionButtons, (0, _extends2["default"])({}, commonProps, {
130
242
  onSave: saveEditing,
131
243
  onCancel: cancelEditing,
132
- rowData: row.original,
133
- rowIndex: row.index,
134
- listener: listener
135
- }) : (0, _lodashEs.map)(filteredRowActions, function (action, index) {
136
- return __jsx(ActionButton, {
137
- key: "".concat(row.id, "-").concat(index),
244
+ deleteRowAction: deleteRowAction
245
+ })) : (0, _lodashEs.map)(filteredRowActions, function (action, index) {
246
+ return __jsx(ActionButton, (0, _extends2["default"])({
247
+ key: "".concat(row.id, "-").concat(index)
248
+ }, commonProps, {
138
249
  action: action,
139
- index: index,
140
- rowData: row.original,
141
- rowIndex: row.index,
142
- rowId: rowId,
143
- listener: listener
144
- });
250
+ index: index
251
+ }));
145
252
  }));
146
- }, [isRowEditing, editmode, filteredRowActions, saveEditing, cancelEditing, listener]);
253
+ }, [isRowEditing, editmode, filteredRowActions, saveEditing, cancelEditing, deleteRowAction, listener, selectionHandlers]);
254
+
255
+ /**
256
+ * Creates the action column definition based on configuration
257
+ */
258
+ var createActionColumnDef = (0, _react.useCallback)(function (manualActionColumn) {
259
+ var _getActionColumnSize = (0, _columnBuilder.getActionColumnSize)(editmode),
260
+ size = _getActionColumnSize.size,
261
+ minSize = _getActionColumnSize.minSize;
262
+ if (manualActionColumn) {
263
+ var _manualActionColumn$s;
264
+ // Custom action column with manual configuration
265
+ var columnSize = size;
266
+ if (manualActionColumn.width) {
267
+ columnSize = parseInt(manualActionColumn.width);
268
+ } else if ((_manualActionColumn$s = manualActionColumn.styles) !== null && _manualActionColumn$s !== void 0 && _manualActionColumn$s.width) {
269
+ columnSize = (0, _utils.parseWidth)(manualActionColumn.styles.width);
270
+ }
271
+ return {
272
+ id: "actions",
273
+ header: manualActionColumn.caption || "Actions",
274
+ size: columnSize,
275
+ minSize: minSize,
276
+ enableResizing: true,
277
+ cell: renderActionCell,
278
+ enableSorting: manualActionColumn.sortable !== false,
279
+ meta: _objectSpread({
280
+ textAlign: manualActionColumn.textalignment,
281
+ backgroundColor: manualActionColumn.backgroundcolor,
282
+ className: manualActionColumn.colClass
283
+ }, manualActionColumn.styles)
284
+ };
285
+ } else if (rowActions.length > 0 && editmode !== "none") {
286
+ // Default action column
287
+ return {
288
+ id: "actions",
289
+ header: "Actions",
290
+ size: size,
291
+ minSize: minSize,
292
+ maxSize: size,
293
+ enableResizing: false,
294
+ cell: renderActionCell
295
+ };
296
+ }
297
+ return null;
298
+ }, [editmode, rowActions.length, renderActionCell]);
299
+
300
+ /**
301
+ * Inserts action column at the specified position among data columns
302
+ */
303
+ var insertActionColumnAtPosition = (0, _react.useCallback)(function (columnDefs, dataColumns, actionColumnDef, position) {
304
+ if (position === 0) {
305
+ // Right after system columns, before data columns
306
+ columnDefs.push(actionColumnDef);
307
+ columnDefs.push.apply(columnDefs, (0, _toConsumableArray2["default"])((0, _columnBuilder.createDataColumns)(dataColumns, renderCell)));
308
+ } else if (position > 0 && position <= dataColumns.length) {
309
+ // At specific index among data columns
310
+ columnDefs.push.apply(columnDefs, (0, _toConsumableArray2["default"])((0, _columnBuilder.createDataColumns)(dataColumns.slice(0, position), renderCell)));
311
+ columnDefs.push(actionColumnDef);
312
+ columnDefs.push.apply(columnDefs, (0, _toConsumableArray2["default"])((0, _columnBuilder.createDataColumns)(dataColumns.slice(position), renderCell)));
313
+ } else {
314
+ // Default: at the end
315
+ columnDefs.push.apply(columnDefs, (0, _toConsumableArray2["default"])((0, _columnBuilder.createDataColumns)(dataColumns, renderCell)));
316
+ columnDefs.push(actionColumnDef);
317
+ }
318
+ }, [renderCell]);
147
319
 
148
320
  // Create TanStack table column definitions
149
321
  var columns = (0, _react.useMemo)(function () {
150
322
  var columnDefs = [];
151
323
 
152
- // Separate manual action column (binding="rowOperations") from regular columns
324
+ // Separate manual action column from regular data columns
153
325
  var manualActionColumn = visibleColumns.find(function (col) {
154
326
  return col.binding === "rowOperations";
155
327
  });
@@ -157,104 +329,25 @@ var useTableColumns = exports.useTableColumns = function useTableColumns(_ref3)
157
329
  return col.binding !== "rowOperations";
158
330
  });
159
331
 
160
- // Add row index column if showrowindex is true
332
+ // Add row index column if enabled
161
333
  if (showrowindex) {
162
334
  columnDefs.push((0, _columnBuilder.createRowIndexColumn)());
163
335
  }
164
336
 
165
- // Determine where to insert the actions column
166
- var insertActionColumn = function insertActionColumn() {
167
- // If we have a manual action column, create a custom action column with its properties
168
- if (manualActionColumn) {
169
- var _manualActionColumn$s;
170
- var _getActionColumnSize = (0, _columnBuilder.getActionColumnSize)(editmode),
171
- size = _getActionColumnSize.size,
172
- minSize = _getActionColumnSize.minSize;
173
-
174
- // Extract width from manual action column styles or width prop
175
- var columnSize = size;
176
- if (manualActionColumn.width) {
177
- columnSize = parseInt(manualActionColumn.width);
178
- } else if ((_manualActionColumn$s = manualActionColumn.styles) !== null && _manualActionColumn$s !== void 0 && _manualActionColumn$s.width) {
179
- columnSize = (0, _utils.parseWidth)(manualActionColumn.styles.width);
180
- }
181
- columnDefs.push({
182
- id: "actions",
183
- header: manualActionColumn.caption || "Actions",
184
- size: columnSize,
185
- minSize: minSize,
186
- enableResizing: true,
187
- cell: renderActionCell,
188
- enableSorting: manualActionColumn.sortable !== false,
189
- meta: _objectSpread({
190
- textAlign: manualActionColumn.textalignment,
191
- backgroundColor: manualActionColumn.backgroundcolor,
192
- className: manualActionColumn.colClass
193
- }, manualActionColumn.styles)
194
- });
195
- }
196
- // If no manual action column but we have row actions and editmode is not 'none'
197
- else if (rowActions.length > 0 && editmode !== "none") {
198
- var _getActionColumnSize2 = (0, _columnBuilder.getActionColumnSize)(editmode),
199
- _size = _getActionColumnSize2.size,
200
- _minSize = _getActionColumnSize2.minSize;
201
- columnDefs.push({
202
- id: "actions",
203
- header: "Actions",
204
- size: _size,
205
- minSize: _minSize,
206
- maxSize: _size,
207
- // Fix the width for default action columns
208
- enableResizing: false,
209
- // Disable resizing for default action columns
210
- cell: renderActionCell
211
- });
212
- }
213
- };
214
-
215
- // Handle action column positioning
216
- if (manualActionColumn || rowActions.length > 0 && editmode !== "none") {
217
- // For manual action column, use its rowactionsposition property
337
+ // Create action column definition
338
+ var actionColumnDef = createActionColumnDef(manualActionColumn);
339
+ if (actionColumnDef) {
340
+ // Determine position for action column
218
341
  var position = (manualActionColumn === null || manualActionColumn === void 0 ? void 0 : manualActionColumn.rowactionsposition) !== undefined ? Number(manualActionColumn.rowactionsposition) : -1;
219
-
220
- // Position 0 means right after system columns (row index, selection) but before data columns
221
- if (position === 0) {
222
- // Insert action column immediately after system columns
223
- insertActionColumn();
224
- // Then add all data columns
225
- columnDefs.push.apply(columnDefs, (0, _toConsumableArray2["default"])((0, _columnBuilder.createDataColumns)(dataColumns, renderCell)));
226
- }
227
- // Positive position means insert at specific index among data columns
228
- else if (position > 0 && position <= dataColumns.length) {
229
- // Add data columns before position
230
- var columnsBeforePosition = dataColumns.slice(0, position);
231
- columnDefs.push.apply(columnDefs, (0, _toConsumableArray2["default"])((0, _columnBuilder.createDataColumns)(columnsBeforePosition, renderCell)));
232
-
233
- // Insert action column
234
- insertActionColumn();
235
-
236
- // Add remaining data columns
237
- var columnsAfterPosition = dataColumns.slice(position);
238
- columnDefs.push.apply(columnDefs, (0, _toConsumableArray2["default"])((0, _columnBuilder.createDataColumns)(columnsAfterPosition, renderCell)));
239
- }
240
- // Default or -1: add action column at the end
241
- else {
242
- // Add all data columns first
243
- columnDefs.push.apply(columnDefs, (0, _toConsumableArray2["default"])((0, _columnBuilder.createDataColumns)(dataColumns, renderCell)));
244
- // Then add action column
245
- insertActionColumn();
246
- }
342
+ insertActionColumnAtPosition(columnDefs, dataColumns, actionColumnDef, position);
247
343
  } else {
248
- // No actions column needed, just add data columns
344
+ // No action column, just add data columns
249
345
  columnDefs.push.apply(columnDefs, (0, _toConsumableArray2["default"])((0, _columnBuilder.createDataColumns)(dataColumns, renderCell)));
250
346
  }
251
347
 
252
- // Apply equal width distribution for data columns without explicit widths
253
- // This ensures non-data columns (S.No, Actions, MultiSelect, RadioSelect) take minimum space
254
- // while data columns without explicit widths share the remaining space equally
255
- // Skip width distribution during active resizing to prevent infinite loops
348
+ // Apply width distribution (skip during active resizing to prevent loops)
256
349
  return isResizing ? columnDefs : (0, _columnWidthDistribution.distributeColumnWidths)(columnDefs);
257
- }, [visibleColumns, rowActions, showrowindex, editmode, renderCell, renderActionCell, isResizing]);
350
+ }, [visibleColumns, showrowindex, createActionColumnDef, insertActionColumnAtPosition, renderCell, isResizing]);
258
351
  return {
259
352
  columns: columns,
260
353
  wmTableColumns: wmTableColumns,
@@ -1,18 +1,55 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
4
+ var _typeof3 = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.useTableData = void 0;
9
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
10
10
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
11
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
11
12
  var _react = _interopRequireWildcard(require("react"));
13
+ var _lodashEs = require("lodash-es");
12
14
  var _utils = require("../utils");
13
- var _confirmDialog = _interopRequireDefault(require("../../../dialogs/confirm-dialog"));
15
+ var _confirmDialog = _interopRequireDefault(require("@wavemaker/react-runtime/components/dialogs/confirm-dialog"));
14
16
  var _crudHandlers = require("../utils/crud-handlers");
15
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
17
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
18
+ /**
19
+ * Check if a record is completely empty (all data fields are null/undefined/empty string)
20
+ * Excludes internal properties from the check
21
+ */
22
+ var isEmptyRecord = function isEmptyRecord(record) {
23
+ if (!record || (0, _typeof2["default"])(record) !== "object") {
24
+ return true;
25
+ }
26
+
27
+ // Get all properties except internal ones
28
+ var properties = Object.keys(record).filter(function (prop) {
29
+ return !_utils.INTERNAL_PROPERTIES.includes(prop) && !prop.startsWith("_wm");
30
+ });
31
+
32
+ // Check if ALL data properties are empty
33
+ return properties.every(function (prop) {
34
+ var data = record[prop];
35
+ return data === null || data === undefined || data === "";
36
+ });
37
+ };
38
+
39
+ /**
40
+ * Remove empty records from the dataset
41
+ * Similar to Angular's removeEmptyRecords functionality
42
+ */
43
+ var removeEmptyRecords = function removeEmptyRecords(records) {
44
+ if (!records || !records.length) {
45
+ return [];
46
+ }
47
+
48
+ // Filter out completely empty records
49
+ return records.filter(function (record) {
50
+ return record && !isEmptyRecord(record);
51
+ });
52
+ };
16
53
  var useTableData = exports.useTableData = function useTableData(_ref) {
17
54
  var dataset = _ref.dataset,
18
55
  onRowDelete = _ref.onRowDelete,
@@ -32,10 +69,14 @@ var useTableData = exports.useTableData = function useTableData(_ref) {
32
69
  onSuccess = _ref.onSuccess,
33
70
  onError = _ref.onError,
34
71
  onRowdelete = _ref.onRowdelete,
35
- isServerSidePagination = _ref.isServerSidePagination;
36
- // Add unique row IDs to the dataset if they don't already have them
72
+ isServerSidePagination = _ref.isServerSidePagination,
73
+ listener = _ref.listener,
74
+ widgetName = _ref.widgetName;
75
+ // Add unique row IDs and filter out empty records
37
76
  var processedDataset = (0, _react.useMemo)(function () {
38
- return (0, _utils.addUniqueRowIds)(dataset || []);
77
+ var withIds = (0, _utils.addUniqueRowIds)(dataset || []);
78
+ // Remove completely empty records from display
79
+ return removeEmptyRecords(withIds);
39
80
  }, [dataset]);
40
81
  var _useState = (0, _react.useState)(processedDataset),
41
82
  internalDataset = _useState[0],
@@ -43,7 +84,9 @@ var useTableData = exports.useTableData = function useTableData(_ref) {
43
84
 
44
85
  // Update internalDataset when dataset prop changes
45
86
  (0, _react.useEffect)(function () {
46
- setInternalDataset(processedDataset);
87
+ if (!(0, _lodashEs.isEqual)(internalDataset, processedDataset)) {
88
+ setInternalDataset(processedDataset);
89
+ }
47
90
  }, [processedDataset]);
48
91
  var _useState2 = (0, _react.useState)(false),
49
92
  showDeleteConfirm = _useState2[0],
@@ -76,7 +119,9 @@ var useTableData = exports.useTableData = function useTableData(_ref) {
76
119
  onRowdelete: onRowdelete,
77
120
  deletemessage: deletemessage,
78
121
  errormessage: errormessage,
79
- isServerSidePagination: isServerSidePagination
122
+ isServerSidePagination: isServerSidePagination,
123
+ listener: listener,
124
+ widgetName: widgetName
80
125
  });
81
126
  case 4:
82
127
  result = _context.sent;
@@ -89,7 +134,7 @@ var useTableData = exports.useTableData = function useTableData(_ref) {
89
134
  return _context.stop();
90
135
  }
91
136
  }, _callee);
92
- })), [internalDataset, setInternalDataset, datasource, binddataset, onRowDelete, showToast, onSuccess, onError, onRowdelete, deletemessage, errormessage, isServerSidePagination]);
137
+ })), [internalDataset, setInternalDataset, datasource, binddataset, onRowDelete, showToast, onSuccess, onError, onRowdelete, deletemessage, errormessage, isServerSidePagination, listener, widgetName]);
93
138
 
94
139
  // Handle cancel deletion
95
140
  var handleCancelDelete = (0, _react.useCallback)(function () {