@wavemaker/react-runtime 11.14.2-rc.6311 → 11.15.0-1.246

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 (245) 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 +73 -18
  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 +31 -11
  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 +4 -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/repeat-template/index.js +33 -0
  44. package/components/container/tabs/index.js +83 -14
  45. package/components/container/tabs/tab-pane/index.js +33 -10
  46. package/components/container/tabs/utils.js +51 -0
  47. package/components/container/wizard/components/StepComponents.js +2 -1
  48. package/components/container/wizard/components/WizardStep.js +2 -1
  49. package/components/container/wizard/index.js +64 -35
  50. package/components/container/wizard/utils.js +46 -1
  51. package/components/container/wizard/wizard-step/index.js +11 -1
  52. package/components/data/card/card-content/index.js +1 -1
  53. package/components/data/form/base-form/index.js +985 -183
  54. package/components/data/form/base-form/props.js +3 -1
  55. package/components/data/form/base-form/utils.js +159 -1
  56. package/components/data/form/dynamic-fields/constant.js +53 -0
  57. package/components/data/form/dynamic-fields/index.js +10 -45
  58. package/components/data/form/dynamic-fields/utils.js +37 -2
  59. package/components/data/form/form-action/index.js +5 -4
  60. package/components/data/form/form-context.js +5 -1
  61. package/components/data/form/form-controller/utils.js +84 -0
  62. package/components/data/form/form-controller/validation-contrustor.js +402 -189
  63. package/components/data/form/form-controller/withFormController.js +191 -52
  64. package/components/data/form/form-field/base-field.js +67 -45
  65. package/components/data/form/form-field/index.js +28 -5
  66. package/components/data/form/form-header/index.js +3 -4
  67. package/components/data/form/index.js +20 -1
  68. package/components/data/list/components/ListDND.js +2 -1
  69. package/components/data/list/components/ListItem.js +6 -2
  70. package/components/data/list/components/ListItemWithTemplate.js +46 -2
  71. package/components/data/list/components/ListItems.js +17 -26
  72. package/components/data/list/components/ListPagination.js +3 -3
  73. package/components/data/list/components/StandardListItems.js +3 -4
  74. package/components/data/list/hooks/useListEffects.js +55 -14
  75. package/components/data/list/hooks/useListEventHandlers.js +3 -1
  76. package/components/data/list/hooks/useListState.js +3 -1
  77. package/components/data/list/hooks/usePaginatedGroupedData.js +18 -5
  78. package/components/data/list/index.js +74 -55
  79. package/components/data/list/utils/list-helpers.js +73 -35
  80. package/components/data/list/utils/list-widget-methods.js +138 -95
  81. package/components/data/live-filter/index.js +26 -15
  82. package/components/data/live-form/index.js +51 -18
  83. package/components/data/live-form/props.js +1 -1
  84. package/components/data/pagination/components/BasicPagination.js +71 -16
  85. package/components/data/pagination/components/PageSizeSelector.js +8 -3
  86. package/components/data/pagination/components/TotalRecords.js +1 -5
  87. package/components/data/pagination/hooks/usePagination.js +349 -66
  88. package/components/data/pagination/index.js +137 -19
  89. package/components/data/table/components/AddNewRow.js +5 -1
  90. package/components/data/table/components/EditableCell.js +2 -2
  91. package/components/data/table/components/RowCells.js +64 -0
  92. package/components/data/table/components/RowExpansionButton.js +2 -2
  93. package/components/data/table/components/SummaryCell.js +111 -0
  94. package/components/data/table/components/SummaryRow.js +54 -0
  95. package/components/data/table/components/SummaryRowFooter.js +46 -0
  96. package/components/data/table/components/TableBody.js +61 -59
  97. package/components/data/table/components/TableDataRow.js +109 -0
  98. package/components/data/table/components/TableFilters.js +225 -121
  99. package/components/data/table/components/TableHeader.js +291 -23
  100. package/components/data/table/components/TablePanelHeading.js +139 -8
  101. package/components/data/table/components/index.js +22 -1
  102. package/components/data/table/hooks/use-edited-rows.js +141 -0
  103. package/components/data/table/hooks/useCellState.js +5 -12
  104. package/components/data/table/hooks/useFormWidget.js +58 -52
  105. package/components/data/table/hooks/usePaginationState.js +45 -24
  106. package/components/data/table/hooks/usePanelStructure.js +4 -4
  107. package/components/data/table/hooks/useRowHandlers.js +39 -5
  108. package/components/data/table/hooks/useRowSelection.js +244 -50
  109. package/components/data/table/hooks/useServerSideSorting.js +81 -37
  110. package/components/data/table/hooks/useTableColumns.js +211 -118
  111. package/components/data/table/hooks/useTableData.js +54 -9
  112. package/components/data/table/hooks/useTableEdit.js +272 -97
  113. package/components/data/table/hooks/useTableEffects.js +31 -13
  114. package/components/data/table/hooks/useTableFilter.js +1 -1
  115. package/components/data/table/hooks/useTableInitialization.js +23 -22
  116. package/components/data/table/hooks/useTableState.js +11 -5
  117. package/components/data/table/hooks/useTableStateManager.js +140 -65
  118. package/components/data/table/index.js +637 -274
  119. package/components/data/table/live-table/index.js +54 -22
  120. package/components/data/table/table-action/index.js +1 -1
  121. package/components/data/table/table-group/index.js +26 -0
  122. package/components/data/table/table-row-action/index.js +32 -18
  123. package/components/data/table/utils/buildSelectionColumns.js +12 -21
  124. package/components/data/table/utils/columnBuilder.js +29 -14
  125. package/components/data/table/utils/columnProxy.js +68 -1
  126. package/components/data/table/utils/constants.js +6 -2
  127. package/components/data/table/utils/crud-handlers.js +68 -63
  128. package/components/data/table/utils/groupHeaderUtils.js +102 -0
  129. package/components/data/table/utils/index.js +210 -21
  130. package/components/data/table/utils/renderDisplayCell.js +6 -6
  131. package/components/data/table/utils/selectionUtils.js +25 -26
  132. package/components/data/table/utils/validation.js +1 -0
  133. package/components/data/utils/filter-field-util.js +3 -3
  134. package/components/dialogs/alert-dialog/index.js +1 -1
  135. package/components/dialogs/confirm-dialog/index.js +1 -1
  136. package/components/dialogs/dialog/index.js +4 -1
  137. package/components/dialogs/dialog-content/index.js +3 -1
  138. package/components/dialogs/dialog-header/index.js +2 -2
  139. package/components/dialogs/iframe-dialog/index.js +11 -5
  140. package/components/dialogs/index.js +1 -1
  141. package/components/dialogs/login-dialog/index.js +1 -1
  142. package/components/dialogs/page-dialog/index.js +1 -1
  143. package/components/form/button/index.js +33 -7
  144. package/components/input/calendar/index.js +18 -6
  145. package/components/input/chips/index.js +99 -28
  146. package/components/input/chips/utils.js +34 -4
  147. package/components/input/color-picker/index.js +74 -25
  148. package/components/input/composite/index.js +3 -3
  149. package/components/input/currency/index.js +35 -49
  150. package/components/input/default/checkbox/index.js +23 -28
  151. package/components/input/default/checkboxset/index.js +38 -18
  152. package/components/input/default/checkboxset/utils.js +30 -0
  153. package/components/input/default/radioset/index.js +36 -39
  154. package/components/input/default/switch/index.js +30 -13
  155. package/components/input/epoch/date/index.js +130 -69
  156. package/components/input/epoch/date/utils.js +94 -1
  157. package/components/input/epoch/datetime/index.js +72 -22
  158. package/components/input/epoch/datetime/utils.js +49 -10
  159. package/components/input/epoch/time/index.js +68 -19
  160. package/components/input/epoch/time/utils.js +62 -14
  161. package/components/input/fileupload/Utils.js +12 -7
  162. package/components/input/fileupload/components/MultiUpload.js +2 -6
  163. package/components/input/fileupload/components/SingleUpload.js +3 -7
  164. package/components/input/fileupload/index.js +6 -10
  165. package/components/input/fileupload/useFileUpload.js +16 -5
  166. package/components/input/number/index.js +158 -43
  167. package/components/input/rating/index.js +90 -7
  168. package/components/input/select/index.js +209 -72
  169. package/components/input/slider/index.js +84 -26
  170. package/components/input/text/index.js +38 -18
  171. package/components/input/text/util.js +283 -130
  172. package/components/input/textarea/index.js +13 -10
  173. package/components/input/upload/index.js +124 -0
  174. package/components/input/upload/props.js +5 -0
  175. package/components/input/util/index.js +11 -0
  176. package/components/navbar/index.js +51 -3
  177. package/components/navbar/nav/index.js +46 -16
  178. package/components/navbar/nav-item/index.js +11 -5
  179. package/components/navigation/menu/components/ListItems.js +3 -0
  180. package/components/navigation/menu/constants.js +2 -1
  181. package/components/navigation/menu/hooks/useHoverState.hook.js +48 -0
  182. package/components/navigation/menu/hooks/useKeyboardMovements.hook.js +37 -0
  183. package/components/navigation/menu/hooks/useTransformedDataset.hook.js +15 -0
  184. package/components/navigation/menu/index.js +326 -188
  185. package/components/navigation/menu/utils/action-task.js +14 -0
  186. package/components/navigation/menu/utils/role-filter.js +76 -0
  187. package/components/navigation/popover/index.js +105 -32
  188. package/components/page/partial-container/index.js +34 -5
  189. package/components/prefab/index.js +2 -4
  190. package/context/PrefabContext.js +10 -6
  191. package/context/WidgetProvider.js +30 -31
  192. package/core/app.service.js +1 -1
  193. package/core/constants/events.js +57 -1
  194. package/core/dialog.service.js +1 -2
  195. package/core/event-notifier.js +1 -2
  196. package/core/formatter/array-formatters.js +33 -0
  197. package/core/formatter/date-formatters.js +2 -4
  198. package/core/formatter/index.js +2 -1
  199. package/core/formatter/number-formatters.js +5 -10
  200. package/core/formatter/security-formatters.js +2 -4
  201. package/core/formatter/string-formatters.js +3 -6
  202. package/core/proxy-service.js +85 -13
  203. package/core/script-registry.js +108 -48
  204. package/core/util/common.js +4 -4
  205. package/core/util/compare.js +30 -0
  206. package/core/util/dom.js +8 -8
  207. package/core/util/index.js +16 -6
  208. package/core/util/safe-is-equal.js +156 -0
  209. package/core/util/security.js +1 -2
  210. package/core/util/utils.js +16 -7
  211. package/higherOrder/BaseApp.js +108 -65
  212. package/higherOrder/BaseDateTime.js +31 -13
  213. package/higherOrder/BasePage.js +268 -144
  214. package/higherOrder/BasePartial.js +1 -1
  215. package/higherOrder/BasePrefab.js +33 -15
  216. package/higherOrder/DataNav.js +99 -16
  217. package/higherOrder/helper.js +41 -3
  218. package/higherOrder/withBaseWrapper.js +41 -28
  219. package/hooks/useAuth.js +11 -5
  220. package/hooks/useHttp.js +280 -94
  221. package/mui-config/theme-provider.js +1 -1
  222. package/mui-config/theme.js +1 -1
  223. package/package-lock.json +840 -740
  224. package/package.json +8 -8
  225. package/store/bindActions/i18nActions.js +18 -0
  226. package/store/index.js +3 -1
  227. package/store/slices/appConfigSlice.js +2 -2
  228. package/store/slices/authSlice.js +31 -28
  229. package/store/slices/i18nSlice.js +2 -2
  230. package/store/slices/navigationSlice.js +35 -0
  231. package/store/viewport.service.js +255 -0
  232. package/utils/attr.js +35 -0
  233. package/utils/dataset-util.js +1 -2
  234. package/utils/form-state.util.js +43 -12
  235. package/utils/form-utils.js +47 -2
  236. package/utils/format-util.js +28 -13
  237. package/utils/page-params-util.js +33 -1
  238. package/utils/state-persistance.js +72 -13
  239. package/utils/transformedDataset-utils.js +35 -24
  240. package/variables/base-variable.js +12 -14
  241. package/variables/crud-variable.js +225 -0
  242. package/variables/live-variable.js +56 -20
  243. package/variables/metadata.service.js +123 -0
  244. package/variables/model-variable.js +21 -15
  245. package/variables/service-variable.js +88 -83
@@ -17,7 +17,6 @@ var useTableInitialization = exports.useTableInitialization = function useTableI
17
17
  useRadioSelect = _ref.useRadioSelect,
18
18
  useMultiSelect = _ref.useMultiSelect,
19
19
  setActiveRow = _ref.setActiveRow,
20
- selectedRowId = _ref.selectedRowId,
21
20
  selectedRowIds = _ref.selectedRowIds,
22
21
  activeRowIds = _ref.activeRowIds,
23
22
  formName = _ref.formName,
@@ -53,49 +52,51 @@ var useTableInitialization = exports.useTableInitialization = function useTableI
53
52
  }, [gridfirstrowselect, useRadioSelect, useMultiSelect, internalDataset, setActiveRow]);
54
53
 
55
54
  /**
56
- * Sync active rows with selected rows for multiselect mode
57
- * When multiselect is enabled, all selected rows should be marked as active
55
+ * Sync active rows with selected rows
56
+ * Works for both radio select (single item) and multiselect (multiple items)
58
57
  */
59
58
  (0, _react.useEffect)(function () {
60
- if (useMultiSelect) {
61
- // Set all selected rows as active
59
+ if ((useMultiSelect || useRadioSelect) && selectedRowIds.length > 0) {
60
+ // Set all selected rows as active (for radio select, this will be just one)
62
61
  setActiveRow(selectedRowIds);
63
62
  }
64
- }, [selectedRowIds, useMultiSelect, setActiveRow]);
65
-
66
- /**
67
- * Sync active row with selected row for radioselect mode
68
- * When radioselect is enabled, the selected row should be marked as active
69
- */
70
- (0, _react.useEffect)(function () {
71
- if (useRadioSelect && selectedRowId) {
72
- // Set the selected row as active
73
- setActiveRow(selectedRowId);
74
- }
75
- }, [selectedRowId, useRadioSelect, setActiveRow]);
63
+ }, [selectedRowIds, useMultiSelect, useRadioSelect, setActiveRow]);
76
64
 
77
65
  // Monitor when there are no active rows
78
66
  (0, _react.useEffect)(function () {
79
67
  // Check if there are no active rows
80
68
  var hasNoActiveRows = !activeRowIds || activeRowIds.length === 0;
81
- if (hasNoActiveRows && internalDataset.length > 0) {
69
+ if (hasNoActiveRows) {
82
70
  // Handle the case when there are no active rows
83
71
  // You can customize this logic based on your requirements
84
- if (listener && editmode === "form" && formName) {
72
+ if (listener && (editmode === "form" || editmode === "none") && formName) {
85
73
  setTimeout(function () {
86
74
  var _listener$Widgets$for;
87
75
  (_listener$Widgets$for = listener.Widgets[formName]) === null || _listener$Widgets$for === void 0 || _listener$Widgets$for.setShowViewMode(true);
88
76
  }, 10);
89
77
  }
90
78
  } else {
91
- if (activeRowIds.length > 0 && listener && editmode === "form" && formName) {
79
+ if (activeRowIds.length > 0 && listener && formName) {
92
80
  setTimeout(function () {
93
81
  var formWidget = listener.Widgets[formName];
94
82
  var getRow = internalDataset.find(function (row) {
95
83
  if (row._wmTableRowId === activeRowIds[0]) return true;
96
84
  });
97
- formWidget === null || formWidget === void 0 || formWidget.edit(getRow);
98
- formWidget === null || formWidget === void 0 || formWidget.setShowViewMode(true);
85
+
86
+ // For readonly mode (editmode === "none"), always show view mode
87
+ // For form mode (editmode === "form"), only update form data without changing view/edit state
88
+ // Edit mode should only be triggered by clicking the edit icon (via editRow method)
89
+ if (editmode === "none") {
90
+ var _formWidget$setFormDa;
91
+ formWidget === null || formWidget === void 0 || (_formWidget$setFormDa = formWidget.setFormData) === null || _formWidget$setFormDa === void 0 || _formWidget$setFormDa.call(formWidget, getRow);
92
+ formWidget === null || formWidget === void 0 || formWidget.setShowViewMode(true);
93
+ } else if (editmode === "form") {
94
+ var _formWidget$setFormDa2;
95
+ // Only update form data, preserve current view/edit mode
96
+ formWidget === null || formWidget === void 0 || (_formWidget$setFormDa2 = formWidget.setFormData) === null || _formWidget$setFormDa2 === void 0 || _formWidget$setFormDa2.call(formWidget, getRow);
97
+ } else {
98
+ formWidget === null || formWidget === void 0 || formWidget.edit(getRow);
99
+ }
99
100
  }, 10);
100
101
  }
101
102
  }
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.useTableState = void 0;
8
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
7
9
  var _react = require("react");
8
10
  var useTableState = exports.useTableState = function useTableState(_ref) {
9
11
  var _ref$editMode = _ref.editMode,
@@ -38,7 +40,7 @@ var useTableState = exports.useTableState = function useTableState(_ref) {
38
40
  // Check if a row is active
39
41
  var isRowActive = (0, _react.useCallback)(function (rowId, isSelected) {
40
42
  // Check if the row is in the active rows array
41
- return activeRowIds.includes(rowId);
43
+ return activeRowIds && Array.isArray(activeRowIds) && activeRowIds.includes(rowId);
42
44
  }, [activeRowIds]);
43
45
 
44
46
  // Clear active rows
@@ -50,15 +52,19 @@ var useTableState = exports.useTableState = function useTableState(_ref) {
50
52
  var setActiveRow = (0, _react.useCallback)(function (rowIds) {
51
53
  if (rowIds === null) {
52
54
  setActiveRowIds([]);
53
- } else if (typeof rowIds === "string") {
54
- setActiveRowIds([rowIds]);
55
- } else {
55
+ } else if (typeof rowIds === "string" || typeof rowIds === "number") {
56
+ setActiveRowIds([String(rowIds)]);
57
+ } else if (Array.isArray(rowIds)) {
56
58
  setActiveRowIds(rowIds);
59
+ } else {
60
+ // Fallback for unexpected types
61
+ console.warn("Unexpected type for rowIds:", (0, _typeof2["default"])(rowIds), rowIds);
62
+ setActiveRowIds([]);
57
63
  }
58
64
  }, []);
59
65
 
60
66
  // For backwards compatibility, provide activeRowId as the first active row
61
- var activeRowId = activeRowIds.length > 0 ? activeRowIds[0] : null;
67
+ var activeRowId = activeRowIds && activeRowIds.length > 0 ? activeRowIds[0] : null;
62
68
  return {
63
69
  activeRowIds: activeRowIds,
64
70
  setActiveRow: setActiveRow,
@@ -9,16 +9,14 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _react = require("react");
10
10
  var _tableHelpers = require("../utils/table-helpers");
11
11
  var _lodashEs = require("lodash-es");
12
+ var _constants = require("../utils/constants");
12
13
  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; }
13
14
  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; }
14
- // Unsupported navigation types for state persistence
15
- var UNSUPPORTED_STATE_PERSISTENCE_TYPES = ["Scroll", "On-Demand", "Inline"];
16
15
  var useTableStateManager = exports.useTableStateManager = function useTableStateManager(props) {
17
16
  var name = props.name,
18
17
  storage = props.storage,
19
18
  currentPage = props.currentPage,
20
19
  currentPageSize = props.currentPageSize,
21
- selectedRowId = props.selectedRowId,
22
20
  selectedRowIds = props.selectedRowIds,
23
21
  internalDataset = props.internalDataset,
24
22
  initialActualPageSize = props.initialActualPageSize,
@@ -55,8 +53,21 @@ var useTableStateManager = exports.useTableStateManager = function useTableState
55
53
  // Track previous sort data to detect changes
56
54
  var prevSortDataRef = (0, _react.useRef)(undefined);
57
55
 
56
+ // Track if filter state needs to be saved after loading completes
57
+ var filterStatePendingRef = (0, _react.useRef)(false);
58
+
59
+ // Track if sort state needs to be saved after loading completes
60
+ var sortStatePendingRef = (0, _react.useRef)(false);
61
+
62
+ // Check if state persistence is disabled for this navigation type
63
+ var isStatePersistenceDisabled = _constants.UNSUPPORTED_STATE_PERSISTENCE_TYPES.includes(navigation);
64
+
58
65
  // Build the current state object
59
66
  var currentState = (0, _react.useMemo)(function () {
67
+ // Completely disable state calculation for unsupported navigation types
68
+ if (isStatePersistenceDisabled) {
69
+ return {};
70
+ }
60
71
  var isLoading = !!(datasource !== null && datasource !== void 0 && datasource.loading);
61
72
 
62
73
  // Detect first calculation after loading becomes false
@@ -83,9 +94,12 @@ var useTableStateManager = exports.useTableStateManager = function useTableState
83
94
  selectionStateRef.current = [];
84
95
  }
85
96
  // Return minimal state for first calculation after loading to avoid stale data
86
- return {
87
- pagination: currentPage
88
- };
97
+ // Only include pagination if not on page 1 (consistent with normal calculation path)
98
+ var minimalState = {};
99
+ if (currentPage !== 1) {
100
+ minimalState.pagination = currentPage;
101
+ }
102
+ return minimalState;
89
103
  }
90
104
 
91
105
  // Otherwise, calculate the new state
@@ -127,8 +141,9 @@ var useTableStateManager = exports.useTableStateManager = function useTableState
127
141
  state.pagination = currentPage;
128
142
  }
129
143
 
130
- // Get selected items based on multiselect mode
131
- var selectedIds = multiselect ? selectedRowIds || [] : selectedRowId ? [selectedRowId] : [];
144
+ // Get selected items from unified selectedRowIds array
145
+ // Works for both radio select (1 item) and multiselect (multiple items)
146
+ var selectedIds = selectedRowIds || [];
132
147
  if (multiselect) {
133
148
  // For multiselect, we need to maintain selections across pages
134
149
  // Get all currently selected IDs
@@ -213,10 +228,15 @@ var useTableStateManager = exports.useTableStateManager = function useTableState
213
228
  state.pagesize = currentPageSize;
214
229
  }
215
230
  return state;
216
- }, [currentPage, currentPageSize, selectedRowId, selectedRowIds, internalDataset, initialActualPageSize, multiselect, datasource === null || datasource === void 0 ? void 0 : datasource.loading, filterData, sortData, defaultPageSize, initialSortState, initialFilterState]);
231
+ }, [currentPage, currentPageSize, selectedRowIds, internalDataset, initialActualPageSize, multiselect, datasource === null || datasource === void 0 ? void 0 : datasource.loading, filterData, sortData, defaultPageSize, initialSortState, initialFilterState, isStatePersistenceDisabled]);
217
232
 
218
233
  // Get state for page size change
219
234
  var getStateForPageSizeChange = (0, _react.useCallback)(function (newPageSize, existingSelectedItems, oldPageSize) {
235
+ // Completely disable for unsupported navigation types
236
+ if (isStatePersistenceDisabled) {
237
+ return {};
238
+ }
239
+
220
240
  // Check if filtering is currently active and different from initial
221
241
  var hasActiveFilter = filterData !== undefined && filterData.length > 0 && JSON.stringify(filterData) !== JSON.stringify(initialFilterState || []);
222
242
  var state = {};
@@ -279,11 +299,15 @@ var useTableStateManager = exports.useTableStateManager = function useTableState
279
299
  state.selectedItem = recalculatedItems;
280
300
  }
281
301
  return state;
282
- }, [initialActualPageSize, multiselect, filterData, sortData, defaultPageSize, initialSortState, initialFilterState]);
302
+ }, [initialActualPageSize, multiselect, filterData, sortData, defaultPageSize, initialSortState, initialFilterState, isStatePersistenceDisabled]);
283
303
 
284
304
  // Check if current state is default (no need to persist)
285
305
  var isDefaultState = (0, _react.useCallback)(function () {
286
- var hasSelection = selectedRowId !== null && selectedRowId !== undefined || selectedRowIds && selectedRowIds.length > 0;
306
+ // For unsupported navigation types, always return true (treat as default, no persistence)
307
+ if (isStatePersistenceDisabled) {
308
+ return true;
309
+ }
310
+ var hasSelection = selectedRowIds && selectedRowIds.length > 0;
287
311
 
288
312
  // Check if filter differs from initial
289
313
  var hasFilterChange = filterData && filterData.length > 0 && JSON.stringify(filterData) !== JSON.stringify(initialFilterState || []);
@@ -296,10 +320,14 @@ var useTableStateManager = exports.useTableStateManager = function useTableState
296
320
 
297
321
  // If nothing has changed from defaults, it's default state
298
322
  return currentPage === 1 && !hasSelection && !hasFilterChange && !hasSortChange && !hasPageSizeChange;
299
- }, [currentPage, currentPageSize, selectedRowId, selectedRowIds, filterData, sortData, defaultPageSize, initialSortState, initialFilterState]);
323
+ }, [currentPage, currentPageSize, selectedRowIds, filterData, sortData, defaultPageSize, isStatePersistenceDisabled, initialSortState, initialFilterState]);
300
324
 
301
325
  // Merge with existing state
302
326
  var mergeWithExisting = (0, _react.useCallback)(function (newState, existingState) {
327
+ // Completely disable for unsupported navigation types
328
+ if (isStatePersistenceDisabled) {
329
+ return {};
330
+ }
303
331
  if (!existingState) {
304
332
  return newState;
305
333
  }
@@ -357,25 +385,22 @@ var useTableStateManager = exports.useTableStateManager = function useTableState
357
385
  merged.actualpagesize = existingState.actualpagesize;
358
386
  }
359
387
 
360
- // Preserve pagination if not in new state and no filter AND not on page 1
361
- if (!merged.pagination && existingState.pagination && !hasActiveFilter && existingState.pagination !== 1) {
362
- merged.pagination = existingState.pagination;
363
- }
388
+ // Note: We intentionally do NOT preserve pagination from existingState when newState doesn't have it.
389
+ // When newState omits pagination, it means the current page is 1 (the default).
390
+ // The old logic checked `existingState.pagination !== 1` which validates the stored value,
391
+ // not the current page. This caused stale pagination values (e.g., 2) to persist when on page 1.
364
392
 
365
393
  // Preserve sort if not in new state
366
394
  if (!merged.sort && existingState.sort) {
367
395
  merged.sort = existingState.sort;
368
396
  }
369
397
  return merged;
370
- }, [multiselect, defaultPageSize]);
398
+ }, [multiselect, defaultPageSize, isStatePersistenceDisabled]);
371
399
 
372
400
  // Handle filter state changes
373
401
  var handleFilterStateChange = (0, _react.useCallback)(function () {
374
- // Check if state persistence is supported for this navigation type
375
- if (!isStateConfigured || storage === "none" || UNSUPPORTED_STATE_PERSISTENCE_TYPES.includes(navigation)) {
376
- if (navigation && UNSUPPORTED_STATE_PERSISTENCE_TYPES.includes(navigation)) {
377
- console.warn("Retain State handling on Widget ".concat(name, " is not supported for ").concat(navigation, " navigation type."));
378
- }
402
+ // Completely disable for unsupported navigation types
403
+ if (isStatePersistenceDisabled || !isStateConfigured || storage === "none") {
379
404
  return;
380
405
  }
381
406
 
@@ -420,50 +445,56 @@ var useTableStateManager = exports.useTableStateManager = function useTableState
420
445
  if (multiselect) {
421
446
  selectionStateRef.current = [];
422
447
  }
423
- } else if (!hasFilterData && initialFilterState && initialFilterState.length > 0) {
424
- // When filter is cleared but there was an initial filter, we need to update state
448
+ } else if (!hasFilterData) {
449
+ // When filter is cleared, we need to update/clear the state
425
450
  var _currentFullState = (0, _tableHelpers.getTableState)(name, storage);
426
- var _newState = {};
427
451
 
428
- // Include actualPageSize if available
429
- if ((_currentFullState === null || _currentFullState === void 0 ? void 0 : _currentFullState.actualpagesize) !== undefined) {
430
- _newState.actualpagesize = _currentFullState.actualpagesize;
431
- } else if (initialActualPageSize !== undefined) {
432
- _newState.actualpagesize = initialActualPageSize;
433
- }
452
+ // Check if there was a stored filter that needs to be cleared
453
+ var hadStoredFilter = (_currentFullState === null || _currentFullState === void 0 ? void 0 : _currentFullState.search) && _currentFullState.search.length > 0;
454
+ var hadInitialFilter = initialFilterState && initialFilterState.length > 0;
434
455
 
435
- // Only include pagesize if it differs from default
436
- if ((_currentFullState === null || _currentFullState === void 0 ? void 0 : _currentFullState.pagesize) !== undefined && defaultPageSize && _currentFullState.pagesize !== defaultPageSize) {
437
- _newState.pagesize = _currentFullState.pagesize;
438
- }
456
+ // Only proceed if there was a stored filter or initial filter to clear
457
+ if (hadStoredFilter || hadInitialFilter) {
458
+ var _newState = {};
439
459
 
440
- // Only include sort if it differs from initial
441
- if ((_currentFullState === null || _currentFullState === void 0 ? void 0 : _currentFullState.sort) !== undefined) {
442
- var _isSortChanged2 = JSON.stringify(_currentFullState.sort) !== JSON.stringify(initialSortState);
443
- if (_isSortChanged2) {
444
- _newState.sort = _currentFullState.sort;
460
+ // Include actualPageSize if available
461
+ if ((_currentFullState === null || _currentFullState === void 0 ? void 0 : _currentFullState.actualpagesize) !== undefined) {
462
+ _newState.actualpagesize = _currentFullState.actualpagesize;
463
+ } else if (initialActualPageSize !== undefined) {
464
+ _newState.actualpagesize = initialActualPageSize;
445
465
  }
446
- }
447
466
 
448
- // Clear and save if there's anything to save
449
- if (Object.keys(_newState).length > 0) {
450
- (0, _tableHelpers.clearTableState)(name, storage);
451
- (0, _tableHelpers.saveTableState)(name, storage, _newState);
452
- } else {
467
+ // Only include pagesize if it differs from default
468
+ if ((_currentFullState === null || _currentFullState === void 0 ? void 0 : _currentFullState.pagesize) !== undefined && defaultPageSize && _currentFullState.pagesize !== defaultPageSize) {
469
+ _newState.pagesize = _currentFullState.pagesize;
470
+ }
471
+
472
+ // Only include sort if it differs from initial
473
+ if ((_currentFullState === null || _currentFullState === void 0 ? void 0 : _currentFullState.sort) !== undefined) {
474
+ var _isSortChanged2 = JSON.stringify(_currentFullState.sort) !== JSON.stringify(initialSortState);
475
+ if (_isSortChanged2) {
476
+ _newState.sort = _currentFullState.sort;
477
+ }
478
+ }
479
+
480
+ // Clear and save if there's anything to save (excluding the search which we want to remove)
453
481
  (0, _tableHelpers.clearTableState)(name, storage);
454
- }
482
+ if (Object.keys(_newState).length > 0) {
483
+ (0, _tableHelpers.saveTableState)(name, storage, _newState);
484
+ }
455
485
 
456
- // Clear the selection state ref for multiselect
457
- if (multiselect) {
458
- selectionStateRef.current = [];
486
+ // Clear the selection state ref for multiselect
487
+ if (multiselect) {
488
+ selectionStateRef.current = [];
489
+ }
459
490
  }
460
491
  }
461
- }, [filterData, isStateConfigured, storage, navigation, name, multiselect, defaultPageSize, initialSortState, initialFilterState]);
492
+ }, [filterData, isStateConfigured, storage, isStatePersistenceDisabled, name, multiselect, defaultPageSize, initialSortState, initialFilterState]);
462
493
 
463
494
  // Handle sort state changes
464
495
  var handleSortStateChange = (0, _react.useCallback)(function () {
465
- // Check if state persistence is supported for this navigation type
466
- if (!isStateConfigured || storage === "none" || UNSUPPORTED_STATE_PERSISTENCE_TYPES.includes(navigation)) {
496
+ // Completely disable for unsupported navigation types
497
+ if (isStatePersistenceDisabled || !isStateConfigured || storage === "none") {
467
498
  return;
468
499
  }
469
500
 
@@ -505,7 +536,7 @@ var useTableStateManager = exports.useTableStateManager = function useTableState
505
536
  }
506
537
 
507
538
  // Only include selectedItem if there are selections
508
- var hasSelection = selectedRowId !== null && selectedRowId !== undefined || selectedRowIds && selectedRowIds.length > 0;
539
+ var hasSelection = selectedRowIds && selectedRowIds.length > 0;
509
540
  if (hasSelection && currentState.selectedItem && currentState.selectedItem.length > 0) {
510
541
  newState.selectedItem = currentState.selectedItem;
511
542
  }
@@ -517,36 +548,80 @@ var useTableStateManager = exports.useTableStateManager = function useTableState
517
548
  }
518
549
  }
519
550
  }
520
- }, [sortData, isStateConfigured, storage, navigation, name, currentState, initialSortState, isDefaultState, currentPage, currentPageSize, defaultPageSize, filterData, initialFilterState, selectedRowId, selectedRowIds]);
551
+ }, [sortData, isStateConfigured, storage, isStatePersistenceDisabled, name, currentState, initialSortState, isDefaultState, currentPage, currentPageSize, defaultPageSize, filterData, initialFilterState, selectedRowIds]);
521
552
 
522
- // Detect filter data changes and handle state persistence
553
+ // Detect filter data changes and mark for pending state persistence
523
554
  (0, _react.useEffect)(function () {
555
+ // Skip for unsupported navigation types
556
+ if (isStatePersistenceDisabled) {
557
+ return;
558
+ }
559
+
524
560
  // Check if filter data has changed
525
561
  var filterDataChanged = JSON.stringify(filterData) !== JSON.stringify(prevFilterDataRef.current);
526
562
  if (filterDataChanged) {
527
563
  // Reset the flag when filter data changes
528
564
  filterStatePersistenceTriggeredRef.current = false;
529
565
 
530
- // Handle the filter state change
531
- handleFilterStateChange();
532
-
533
566
  // Update the previous filter data reference
534
567
  prevFilterDataRef.current = filterData;
568
+
569
+ // If datasource is loading, mark as pending to save after loading completes
570
+ if (datasource !== null && datasource !== void 0 && datasource.loading) {
571
+ filterStatePendingRef.current = true;
572
+ } else {
573
+ // Handle the filter state change immediately if not loading
574
+ handleFilterStateChange();
575
+ }
576
+ }
577
+ }, [filterData, handleFilterStateChange, datasource === null || datasource === void 0 ? void 0 : datasource.loading, isStatePersistenceDisabled]);
578
+
579
+ // Save pending filter state when loading completes
580
+ (0, _react.useEffect)(function () {
581
+ // Skip for unsupported navigation types
582
+ if (isStatePersistenceDisabled) {
583
+ return;
584
+ }
585
+ if (!(datasource !== null && datasource !== void 0 && datasource.loading) && filterStatePendingRef.current) {
586
+ filterStatePendingRef.current = false;
587
+ handleFilterStateChange();
535
588
  }
536
- }, [filterData, handleFilterStateChange]);
589
+ }, [datasource === null || datasource === void 0 ? void 0 : datasource.loading, handleFilterStateChange, isStatePersistenceDisabled]);
537
590
 
538
- // Detect sort data changes and handle state persistence
591
+ // Detect sort data changes and mark for pending state persistence
539
592
  (0, _react.useEffect)(function () {
593
+ // Skip for unsupported navigation types
594
+ if (isStatePersistenceDisabled) {
595
+ return;
596
+ }
597
+
540
598
  // Check if sort data has changed
541
599
  var sortDataChanged = JSON.stringify(sortData) !== JSON.stringify(prevSortDataRef.current);
542
600
  if (sortDataChanged) {
543
- // Handle the sort state change
544
- handleSortStateChange();
545
-
546
601
  // Update the previous sort data reference
547
602
  prevSortDataRef.current = sortData;
603
+
604
+ // If datasource is loading, mark as pending to save after loading completes
605
+ if (datasource !== null && datasource !== void 0 && datasource.loading) {
606
+ sortStatePendingRef.current = true;
607
+ } else {
608
+ // Handle the sort state change immediately if not loading
609
+ handleSortStateChange();
610
+ }
611
+ }
612
+ }, [sortData, handleSortStateChange, datasource === null || datasource === void 0 ? void 0 : datasource.loading, isStatePersistenceDisabled]);
613
+
614
+ // Save pending sort state when loading completes
615
+ (0, _react.useEffect)(function () {
616
+ // Skip for unsupported navigation types
617
+ if (isStatePersistenceDisabled) {
618
+ return;
619
+ }
620
+ if (!(datasource !== null && datasource !== void 0 && datasource.loading) && sortStatePendingRef.current) {
621
+ sortStatePendingRef.current = false;
622
+ handleSortStateChange();
548
623
  }
549
- }, [sortData, handleSortStateChange]);
624
+ }, [datasource === null || datasource === void 0 ? void 0 : datasource.loading, handleSortStateChange, isStatePersistenceDisabled]);
550
625
  return {
551
626
  currentState: currentState,
552
627
  getStateForPageSizeChange: getStateForPageSizeChange,