@wavemaker/react-runtime 11.14.3-rc.6401 → 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 +307 -266
  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
@@ -6,9 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports["default"] = void 0;
9
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
10
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
11
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
12
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
13
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
12
14
  var _react = _interopRequireWildcard(require("react"));
13
15
  var _clsx = _interopRequireDefault(require("clsx"));
14
16
  var _NativeSelect = _interopRequireDefault(require("@mui/material/NativeSelect"));
@@ -21,7 +23,7 @@ var __jsx = _react["default"].createElement;
21
23
  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; }
22
24
  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; }
23
25
  var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
24
- var _ref;
26
+ var _ref2, _key;
25
27
  var autofocus = props.autofocus,
26
28
  className = props.className,
27
29
  _props$datafield = props.datafield,
@@ -30,7 +32,7 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
30
32
  datavalue = props.datavalue,
31
33
  _props$disabled = props.disabled,
32
34
  disabled = _props$disabled === void 0 ? false : _props$disabled,
33
- displayexpression = props.displayexpression,
35
+ displayExpression = props.displayExpression,
34
36
  displaylabel = props.displaylabel,
35
37
  _props$displayfield = props.displayfield,
36
38
  displayfield = _props$displayfield === void 0 ? "value" : _props$displayfield,
@@ -52,6 +54,7 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
52
54
  listener = props.listener,
53
55
  _props$tabindex = props.tabindex,
54
56
  tabindex = _props$tabindex === void 0 ? 0 : _props$tabindex,
57
+ match = props.match,
55
58
  onClick = props.onClick,
56
59
  onChange = props.onChange,
57
60
  onBlur = props.onBlur,
@@ -63,6 +66,8 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
63
66
  onKeyUp = props.onKeyUp;
64
67
  var DEFAULT_CLASS = "app-select-wrapper ng-dirty";
65
68
  var selectRef = (0, _react.useRef)(null);
69
+ var lastDatavalueRef = (0, _react.useRef)(datavalue);
70
+ var externalDatavalueRef = (0, _react.useRef)(null);
66
71
  var _useState = (0, _react.useState)(""),
67
72
  displayValue = _useState[0],
68
73
  setDisplayValue = _useState[1];
@@ -81,7 +86,9 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
81
86
  var _useState6 = (0, _react.useState)(datavalue),
82
87
  prevDatavalue = _useState6[0],
83
88
  setPrevDatavalue = _useState6[1];
84
- var transformedDataset = (0, _transformedDatasetUtils.transformDataset)(dataset, datafield, displayfield, displaylabel, displayexpression, orderby, groupby, dataPath);
89
+ // Check if dataset is a function and call it to get the actual dataset value
90
+ var resolvedDataset = typeof dataset === "function" ? dataset() : dataset;
91
+ var transformedDataset = (0, _transformedDatasetUtils.transformDataset)(resolvedDataset, datafield, displayfield, displaylabel, displayExpression, orderby, groupby, dataPath, "", match);
85
92
  var validateInput = (0, _react.useCallback)(function (value) {
86
93
  // Handle special case value
87
94
  if (value === "") {
@@ -103,71 +110,112 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
103
110
  }, [required]);
104
111
 
105
112
  // Handle value change
106
- var handleValueChange = function handleValueChange(event) {
107
- var _listener$Widgets, _transformedDataset;
108
- var newValue = multiple ? Array.from(event.target.selectedOptions, function (option) {
109
- return option.value;
110
- }) : event.target.selectedIndex;
111
- if (multiple) {
112
- // Filter out placeholder value from multiple selection
113
- var filteredValues = newValue.filter(function (val) {
114
- return val !== placeholder;
115
- });
116
- setLocalDatavalue(filteredValues);
117
- var selectedTexts = Array.from(event.target.selectedOptions, function (option) {
118
- return option.text;
119
- }).filter(function (text) {
120
- return text !== placeholder;
121
- });
122
- setDisplayValue(selectedTexts.join(", "));
123
- if (listener !== null && listener !== void 0 && listener.onChange) {
124
- if (filteredValues.length === 0) {
125
- // If only placeholder is selected or no valid selections, return empty array
126
- listener.onChange(props.fieldName || name, {
127
- datavalue: [],
128
- displayValue: []
129
- });
130
- } else {
131
- var findItem = function findItem(val) {
132
- return transformedDataset.find(function (item) {
133
- return (0, _typeof2["default"])(item.value) === "object" ? String(item.key) === String(val) : String(item.value) === String(val);
113
+ var handleValueChange = /*#__PURE__*/function () {
114
+ var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(event) {
115
+ var _listener$Widgets, _transformedDataset;
116
+ var newValue, filteredValues, selectedTexts, findItem, selectedValues, selectedDisplayValues, _event$target$options;
117
+ return _regenerator["default"].wrap(function _callee$(_context) {
118
+ while (1) switch (_context.prev = _context.next) {
119
+ case 0:
120
+ if (!(props.readonly || disabled)) {
121
+ _context.next = 2;
122
+ break;
123
+ }
124
+ return _context.abrupt("return");
125
+ case 2:
126
+ newValue = multiple ? Array.from(event.target.selectedOptions, function (option) {
127
+ return option.value;
128
+ }) : event.target.selectedIndex;
129
+ if (!multiple) {
130
+ _context.next = 20;
131
+ break;
132
+ }
133
+ // Filter out placeholder value from multiple selection
134
+ filteredValues = newValue.filter(function (val) {
135
+ return val !== placeholder;
134
136
  });
135
- };
136
- var selectedValues = filteredValues.map(function (val) {
137
- var item = findItem(val);
138
- return item ? item.value : val;
139
- });
140
- var selectedDisplayValues = filteredValues.map(function (val) {
141
- var item = findItem(val);
142
- return item ? item.label : val;
143
- });
144
- listener.onChange(props.fieldName || name, {
145
- datavalue: selectedValues,
146
- displayValue: selectedDisplayValues
147
- });
148
- }
149
- }
150
- } else {
151
- var _event$target$options;
152
- setLocalDatavalue(event.target.value);
153
- setDisplayValue(((_event$target$options = event.target.options[event.target.selectedIndex]) === null || _event$target$options === void 0 ? void 0 : _event$target$options.text) || "");
154
- if (listener !== null && listener !== void 0 && listener.onChange) {
155
- if (newValue === 0 || event.target.value === placeholder) {
156
- listener.onChange(props.fieldName || name, {
157
- datavalue: "",
158
- displayValue: ""
159
- });
160
- } else {
161
- listener.onChange(props.fieldName || name, {
162
- datavalue: transformedDataset[newValue - 1].value,
163
- displayValue: transformedDataset[newValue - 1].label
164
- });
137
+ setLocalDatavalue(filteredValues);
138
+ selectedTexts = Array.from(event.target.selectedOptions, function (option) {
139
+ return option.text;
140
+ }).filter(function (text) {
141
+ return text !== placeholder;
142
+ });
143
+ setDisplayValue(selectedTexts.join(", "));
144
+ if (!(listener !== null && listener !== void 0 && listener.onChange)) {
145
+ _context.next = 18;
146
+ break;
147
+ }
148
+ if (!(filteredValues.length === 0)) {
149
+ _context.next = 14;
150
+ break;
151
+ }
152
+ _context.next = 12;
153
+ return listener.onChange(props.fieldName || name, {
154
+ datavalue: [],
155
+ displayValue: []
156
+ });
157
+ case 12:
158
+ _context.next = 18;
159
+ break;
160
+ case 14:
161
+ findItem = function findItem(val) {
162
+ return transformedDataset.find(function (item) {
163
+ return (0, _typeof2["default"])(item.value) === "object" ? String(item.key) === String(val) : String(item.value) === String(val);
164
+ });
165
+ };
166
+ selectedValues = filteredValues.map(function (val) {
167
+ var item = findItem(val);
168
+ return item ? item.value : val;
169
+ });
170
+ selectedDisplayValues = filteredValues.map(function (val) {
171
+ var item = findItem(val);
172
+ return item ? item.label : val;
173
+ });
174
+ listener.onChange(props.fieldName || name, {
175
+ datavalue: selectedValues,
176
+ displayValue: selectedDisplayValues
177
+ });
178
+ case 18:
179
+ _context.next = 30;
180
+ break;
181
+ case 20:
182
+ setLocalDatavalue(event.target.value);
183
+ setDisplayValue(((_event$target$options = event.target.options[event.target.selectedIndex]) === null || _event$target$options === void 0 ? void 0 : _event$target$options.text) || "");
184
+ if (!(listener !== null && listener !== void 0 && listener.onChange)) {
185
+ _context.next = 30;
186
+ break;
187
+ }
188
+ if (!(newValue === 0 || event.target.value === placeholder)) {
189
+ _context.next = 28;
190
+ break;
191
+ }
192
+ _context.next = 26;
193
+ return listener.onChange(props.fieldName || name, {
194
+ datavalue: "",
195
+ displayValue: ""
196
+ });
197
+ case 26:
198
+ _context.next = 30;
199
+ break;
200
+ case 28:
201
+ _context.next = 30;
202
+ return listener.onChange(props.fieldName || name, {
203
+ datavalue: transformedDataset[newValue - 1].value,
204
+ displayValue: transformedDataset[newValue - 1].label
205
+ });
206
+ case 30:
207
+ if (onChange) onChange === null || onChange === void 0 || onChange(event, listener === null || listener === void 0 || (_listener$Widgets = listener.Widgets) === null || _listener$Widgets === void 0 ? void 0 : _listener$Widgets[name], (transformedDataset === null || transformedDataset === void 0 || (_transformedDataset = transformedDataset[newValue - 1]) === null || _transformedDataset === void 0 ? void 0 : _transformedDataset.value) || "en", prevDatavalue);
208
+ setPrevDatavalue(newValue);
209
+ case 32:
210
+ case "end":
211
+ return _context.stop();
165
212
  }
166
- }
167
- }
168
- if (onChange) onChange === null || onChange === void 0 || onChange(event, listener === null || listener === void 0 || (_listener$Widgets = listener.Widgets) === null || _listener$Widgets === void 0 ? void 0 : _listener$Widgets[name], (transformedDataset === null || transformedDataset === void 0 || (_transformedDataset = transformedDataset[newValue - 1]) === null || _transformedDataset === void 0 ? void 0 : _transformedDataset.value) || "en", prevDatavalue);
169
- setPrevDatavalue(newValue);
170
- };
213
+ }, _callee);
214
+ }));
215
+ return function handleValueChange(_x) {
216
+ return _ref.apply(this, arguments);
217
+ };
218
+ }();
171
219
  var handleBlur = function handleBlur(e) {
172
220
  var newValue = e.target.value;
173
221
  var selectedItem = transformedDataset.find(function (item) {
@@ -231,9 +279,13 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
231
279
  }
232
280
  }
233
281
  }, [transformedDataset, datavalue, multiple]);
234
-
235
282
  // Sync localDatavalue with incoming datavalue prop
236
283
  (0, _react.useEffect)(function () {
284
+ if (lastDatavalueRef.current !== datavalue) {
285
+ lastDatavalueRef.current = datavalue;
286
+ } else {
287
+ return;
288
+ }
237
289
  if (multiple) {
238
290
  var normalizedValue = Array.isArray(datavalue) ? datavalue : datavalue ? [datavalue] : [];
239
291
  if (JSON.stringify(normalizedValue) !== JSON.stringify(localDatavalue)) {
@@ -241,10 +293,33 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
241
293
  }
242
294
  } else {
243
295
  if (datavalue !== localDatavalue) {
296
+ var _listener$onChange;
297
+ // Compute displayValue for the external value
298
+ var computedDisplayValue = "";
299
+ if ((0, _typeof2["default"])(datavalue) === "object" && datavalue !== null) {
300
+ var matchingItem = transformedDataset.find(function (item) {
301
+ return item.value === datavalue || JSON.stringify(item.value) === JSON.stringify(datavalue);
302
+ });
303
+ computedDisplayValue = (matchingItem === null || matchingItem === void 0 ? void 0 : matchingItem.label) || "";
304
+ } else {
305
+ var _matchingItem = transformedDataset.find(function (item) {
306
+ return item.value == datavalue;
307
+ });
308
+ computedDisplayValue = (_matchingItem === null || _matchingItem === void 0 ? void 0 : _matchingItem.label) || "";
309
+ }
310
+
311
+ // Store the DATAVALUE so listener useEffect can skip until localDatavalue matches
312
+ externalDatavalueRef.current = datavalue;
244
313
  setLocalDatavalue(datavalue);
314
+
315
+ // Call listener.onChange with BOTH datavalue and displayValue in a single call
316
+ listener === null || listener === void 0 || (_listener$onChange = listener.onChange) === null || _listener$onChange === void 0 || _listener$onChange.call(listener, props.fieldName || name, {
317
+ datavalue: datavalue,
318
+ displayValue: computedDisplayValue
319
+ });
245
320
  }
246
321
  }
247
- }, [datavalue, multiple]);
322
+ }, [datavalue, multiple, transformedDataset]);
248
323
  var handleClick = (0, _react.useCallback)(function (event) {
249
324
  onClick === null || onClick === void 0 || onClick(event);
250
325
  }, [onClick]);
@@ -279,7 +354,68 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
279
354
  } : {}), onMouseLeave ? {
280
355
  onMouseLeave: handleMouseLeave
281
356
  } : {});
357
+
358
+ // Memoize the computed select value to prevent re-renders
359
+ var computedSelectValue = (0, _react.useMemo)(function () {
360
+ if (multiple) {
361
+ return Array.isArray(localDatavalue) ? localDatavalue : [];
362
+ }
363
+ if ((0, _typeof2["default"])(localDatavalue) === "object" && localDatavalue !== null) {
364
+ var _matchingItem2 = transformedDataset.find(function (item) {
365
+ return item.value === localDatavalue || JSON.stringify(item.value) === JSON.stringify(localDatavalue);
366
+ });
367
+ if (_matchingItem2) {
368
+ return {
369
+ key: _matchingItem2.key,
370
+ displayValue: _matchingItem2.label
371
+ };
372
+ }
373
+ }
374
+ var matchingItem = transformedDataset.find(function (item) {
375
+ return item.value == localDatavalue;
376
+ });
377
+ var displayLabel = (matchingItem === null || matchingItem === void 0 ? void 0 : matchingItem.label) || "";
378
+ return {
379
+ key: localDatavalue,
380
+ displayValue: displayLabel
381
+ };
382
+ }, [localDatavalue, transformedDataset, multiple]);
383
+
384
+ // Track previous computed value to avoid unnecessary listener calls
385
+ var prevComputedValueRef = (0, _react.useRef)(null);
386
+
387
+ // Handle side effect (listener.onChange) in useEffect, not during render
388
+ // This effect ONLY handles displayValue updates for INTERNAL state changes
389
+ // External prop changes are handled in sync useEffect above
390
+ (0, _react.useEffect)(function () {
391
+ if (multiple) return;
392
+ var currentValue = computedSelectValue;
393
+
394
+ // Check if localDatavalue matches the external datavalue (final state reached)
395
+ var isExternalChange = externalDatavalueRef.current !== null && (localDatavalue === externalDatavalueRef.current || (0, _typeof2["default"])(localDatavalue) === "object" && (0, _typeof2["default"])(externalDatavalueRef.current) === "object" && JSON.stringify(localDatavalue) === JSON.stringify(externalDatavalueRef.current));
396
+
397
+ // Skip if we have a pending external change (already handled in sync useEffect)
398
+ if (externalDatavalueRef.current !== null) {
399
+ // Only clear when localDatavalue has been updated to match the external value
400
+ if (isExternalChange) {
401
+ externalDatavalueRef.current = null;
402
+ }
403
+ prevComputedValueRef.current = currentValue;
404
+ return;
405
+ }
406
+ var prevValue = prevComputedValueRef.current;
407
+
408
+ // Only call listener if the computed value actually changed
409
+ if (currentValue.displayValue && (!prevValue || prevValue.key !== currentValue.key || prevValue.displayValue !== currentValue.displayValue)) {
410
+ var _listener$onChange2;
411
+ listener === null || listener === void 0 || (_listener$onChange2 = listener.onChange) === null || _listener$onChange2 === void 0 || _listener$onChange2.call(listener, props.fieldName || name, {
412
+ displayValue: currentValue.displayValue
413
+ });
414
+ }
415
+ prevComputedValueRef.current = currentValue;
416
+ }, [computedSelectValue, multiple, listener, props.fieldName, name, localDatavalue]);
282
417
  return __jsx(_material.Box, {
418
+ hidden: props.hidden,
283
419
  sx: {
284
420
  display: "inherit !important"
285
421
  },
@@ -289,7 +425,7 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
289
425
  IconComponent: function IconComponent() {
290
426
  return null;
291
427
  },
292
- value: multiple ? Array.isArray(localDatavalue) ? localDatavalue : [] : (_ref = localDatavalue !== null && localDatavalue !== void 0 ? localDatavalue : placeholder) !== null && _ref !== void 0 ? _ref : ""
428
+ value: multiple ? computedSelectValue : (_ref2 = (_key = computedSelectValue.key) !== null && _key !== void 0 ? _key : placeholder) !== null && _ref2 !== void 0 ? _ref2 : ""
293
429
  }, events, {
294
430
  sx: {
295
431
  "& .MuiNativeSelect-select": _objectSpread(_objectSpread({}, styles), {}, {
@@ -304,12 +440,13 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
304
440
  tabIndex: tabindex,
305
441
  "aria-label": arialabel,
306
442
  multiple: multiple,
307
- disabled: disabled || readonly,
443
+ disabled: disabled,
308
444
  "aria-readonly": readonly,
309
445
  className: "app-select ".concat(className, " form-control ng-valid ng-touched ng-dirty wm-app "),
310
446
  accessKey: shortcutkey,
311
447
  title: hint
312
- }
448
+ },
449
+ readOnly: readonly
313
450
  }), __jsx("option", {
314
451
  value: placeholder,
315
452
  id: "placeholderOption",
@@ -335,7 +472,7 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
335
472
  }, item.label);
336
473
  })));
337
474
  }, function (prevProps, nextProps) {
338
- var keys = ["dataset", "datafield", "displayfield", "displaylabel", "displayexpression", "orderby", "groupby", "dataPath", "arialabel", "multiple", "styles", "autofocus", "disabled", "readonly", "required", "datavalue"];
475
+ var keys = ["dataset", "datafield", "displayfield", "displaylabel", "displayExpression", "orderby", "groupby", "dataPath", "arialabel", "multiple", "styles", "autofocus", "disabled", "readonly", "required", "datavalue", "hidden", "className"];
339
476
  return keys.every(function (key) {
340
477
  return prevProps[key] === nextProps[key];
341
478
  });
@@ -1,11 +1,12 @@
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["default"] = void 0;
9
+ var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
9
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
11
  var _react = _interopRequireWildcard(require("react"));
11
12
  var _clsx = _interopRequireDefault(require("clsx"));
@@ -13,13 +14,14 @@ var _Box = _interopRequireDefault(require("@mui/material/Box"));
13
14
  var _input = require("@base-ui-components/react/input");
14
15
  var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWrapper");
15
16
  var _withFormController = _interopRequireDefault(require("@wavemaker/react-runtime/components/data/form/form-controller/withFormController"));
16
- 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
+ var _transformedDatasetUtils = require("@wavemaker/react-runtime/utils/transformedDataset-utils");
18
+ 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); }
17
19
  var __jsx = _react["default"].createElement;
18
20
  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; }
19
21
  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; }
20
22
  var DEFAULT_CLASS = "app-slider slider";
21
23
  var WmSlider = /*#__PURE__*/(0, _react.memo)(function (props) {
22
- var className = props["class"],
24
+ var className = props.className,
23
25
  _props$disabled = props.disabled,
24
26
  disabled = _props$disabled === void 0 ? false : _props$disabled,
25
27
  hint = props.hint,
@@ -29,8 +31,7 @@ var WmSlider = /*#__PURE__*/(0, _react.memo)(function (props) {
29
31
  readonly = _props$readonly === void 0 ? false : _props$readonly,
30
32
  _props$tabindex = props.tabindex,
31
33
  tabindex = _props$tabindex === void 0 ? 0 : _props$tabindex,
32
- _props$datavalue = props.datavalue,
33
- datavalue = _props$datavalue === void 0 ? 0 : _props$datavalue,
34
+ datavalue = props.datavalue,
34
35
  _props$minvalue = props.minvalue,
35
36
  minvalue = _props$minvalue === void 0 ? 0 : _props$minvalue,
36
37
  _props$maxvalue = props.maxvalue,
@@ -40,13 +41,17 @@ var WmSlider = /*#__PURE__*/(0, _react.memo)(function (props) {
40
41
  onChange = props.onChange,
41
42
  styles = props.styles,
42
43
  listener = props.listener,
43
- height = props.height,
44
- width = props.width,
45
- arialabel = props.arialabel;
46
- var _useState = (0, _react.useState)(datavalue),
44
+ arialabel = props.arialabel,
45
+ _props$showmarkers = props.showmarkers,
46
+ showmarkers = _props$showmarkers === void 0 ? false : _props$showmarkers,
47
+ markerlabeltext = props.markerlabeltext;
48
+
49
+ // Always provide a number value to keep the input controlled
50
+ var initialValue = datavalue !== undefined ? datavalue : (minvalue + maxvalue) / 2;
51
+ var _useState = (0, _react.useState)(initialValue),
47
52
  value = _useState[0],
48
53
  setValue = _useState[1];
49
- var prevDatavalueRef = (0, _react.useRef)(datavalue);
54
+ var prevDatavalueRef = (0, _react.useRef)(initialValue);
50
55
  var sliderRef = (0, _react.useRef)(null);
51
56
  var _useState2 = (0, _react.useState)(false),
52
57
  isTouched = _useState2[0],
@@ -54,15 +59,19 @@ var WmSlider = /*#__PURE__*/(0, _react.memo)(function (props) {
54
59
  var _useState3 = (0, _react.useState)(false),
55
60
  isDirty = _useState3[0],
56
61
  setIsDirty = _useState3[1];
62
+ var _useState4 = (0, _react.useState)([]),
63
+ markerItems = _useState4[0],
64
+ setMarkerItems = _useState4[1];
57
65
  (0, _react.useEffect)(function () {
66
+ var newValue = datavalue !== undefined ? datavalue : (minvalue + maxvalue) / 2;
58
67
  if (datavalue !== prevDatavalueRef.current) {
59
- setValue(datavalue);
60
- prevDatavalueRef.current = datavalue;
68
+ setValue(newValue);
69
+ prevDatavalueRef.current = newValue;
61
70
  }
62
- }, [datavalue, listener]);
71
+ }, [datavalue, listener, minvalue, maxvalue]);
63
72
  (0, _react.useEffect)(function () {
64
- if (props.datavalue !== value) {
65
- setValue(props.datavalue || 0);
73
+ if (props.datavalue !== undefined && props.datavalue !== value) {
74
+ setValue(props.datavalue);
66
75
  }
67
76
  }, [props.datavalue]);
68
77
 
@@ -120,18 +129,50 @@ var WmSlider = /*#__PURE__*/(0, _react.memo)(function (props) {
120
129
  };
121
130
  }
122
131
  }, [sliderRef, disabled, readonly]);
132
+ var getMarkersItems = (0, _react.useCallback)(function () {
133
+ var sliderTrack = sliderRef.current;
134
+ if (!sliderTrack) return;
135
+ var trackWidth = sliderTrack.offsetWidth - 9 || 0;
136
+
137
+ // Calculate tick count based on min/max/step values
138
+ var tickCount = 0;
139
+ if (props.minvalue !== undefined && props.maxvalue !== undefined) {
140
+ tickCount = step > 0 ? Math.floor((props.maxvalue - props.minvalue) / step) + 1 : 0;
141
+ } else {
142
+ tickCount = step > 0 ? Math.floor(100 / step) + 1 : 0;
143
+ }
144
+
145
+ // Convert marker label text to object format
146
+ var labels = (0, _transformedDatasetUtils.convertDataToObject)(markerlabeltext);
147
+ var newMarkerItems = [];
148
+ for (var i = 0; i < tickCount; i++) {
149
+ var _labels$i$dataValue, _labels$i, _labels$i2, _labels$i3;
150
+ var left = trackWidth / (tickCount - 1) * i;
151
+ var label = (_labels$i$dataValue = labels === null || labels === void 0 || (_labels$i = labels[i]) === null || _labels$i === void 0 ? void 0 : _labels$i.dataValue) !== null && _labels$i$dataValue !== void 0 ? _labels$i$dataValue : Array.isArray(labels) ? (0, _typeof2["default"])(labels[i]) === "object" && (_labels$i2 = labels[i]) !== null && _labels$i2 !== void 0 && _labels$i2.title ? labels[i].title : labels[i] : "".concat(i);
152
+ var position = Array.isArray(labels) && (0, _typeof2["default"])(labels[i]) === "object" && (_labels$i3 = labels[i]) !== null && _labels$i3 !== void 0 && _labels$i3.position ? labels[i].position : "up";
153
+ newMarkerItems.push({
154
+ label: label,
155
+ position: position,
156
+ left: left
157
+ });
158
+ }
159
+ setMarkerItems(newMarkerItems);
160
+ }, [props.minvalue, props.maxvalue, step, markerlabeltext]);
161
+ (0, _react.useEffect)(function () {
162
+ if (showmarkers) {
163
+ getMarkersItems();
164
+ }
165
+ }, [props.minvalue, props.maxvalue, step, markerlabeltext, showmarkers]);
123
166
  return __jsx(_Box["default"], {
167
+ hidden: props.hidden,
124
168
  className: (0, _clsx["default"])(DEFAULT_CLASS, className, isTouched ? "ng-touched" : "ng-untouched", isDirty ? "ng-invalid" : "ng-valid"),
125
- sx: _objectSpread(_objectSpread({}, styles), {}, {
126
- height: height,
127
- width: width
128
- })
129
- }, (minvalue || maxvalue) && __jsx(_react["default"].Fragment, null, __jsx(_Box["default"], {
169
+ style: styles
170
+ }, !showmarkers && (minvalue || maxvalue) && __jsx(_react["default"].Fragment, null, __jsx(_Box["default"], {
130
171
  component: "span",
131
- className: "app-slider-value pull-left"
172
+ className: "app-slider-value fa-pull-left"
132
173
  }, minvalue || minvalue == 0 ? minvalue : null), __jsx(_Box["default"], {
133
174
  component: "span",
134
- className: "app-slider-value pull-right"
175
+ className: "app-slider-value fa-pull-right"
135
176
  }, maxvalue || maxvalue == 0 ? maxvalue : null)), __jsx(_input.Input, {
136
177
  type: "range",
137
178
  ref: sliderRef,
@@ -143,22 +184,39 @@ var WmSlider = /*#__PURE__*/(0, _react.memo)(function (props) {
143
184
  max: maxvalue,
144
185
  disabled: disabled // Only disabled when explicitly disabled, not when readonly
145
186
  ,
146
- "aria-label": name || "slider",
187
+ "aria-label": arialabel,
147
188
  "aria-orientation": "horizontal",
148
189
  role: "slider",
149
190
  "aria-valuenow": value,
150
191
  "aria-valuemin": minvalue,
151
192
  "aria-valuemax": maxvalue,
152
193
  tabIndex: tabindex,
153
- title: hint,
194
+ title: props.datavalue !== undefined ? String(value) : "undefined",
154
195
  onBlur: handleBlur
155
196
  }), readonly && __jsx(_Box["default"], {
156
197
  className: "readonly-wrapper",
157
198
  "aria-readonly": "true"
158
- }));
199
+ }), showmarkers && __jsx(_Box["default"], {
200
+ className: "marker-container"
201
+ }, markerItems.map(function (marker, index) {
202
+ return __jsx("span", {
203
+ key: index,
204
+ className: "marker-wrapper",
205
+ style: {
206
+ left: marker.left + "px"
207
+ },
208
+ title: marker.label
209
+ }, __jsx("span", {
210
+ className: "marker-label ".concat(marker.position),
211
+ title: marker.label
212
+ }, marker.label), __jsx("span", {
213
+ className: "marker-dot",
214
+ title: marker.label
215
+ }));
216
+ })));
159
217
  }, function (prev, current) {
160
218
  // Enhanced memo comparison
161
- var keys = ["datavalue", "disabled", "readonly", "minvalue", "maxvalue", "step", "class", "styles"];
219
+ var keys = ["datavalue", "disabled", "readonly", "minvalue", "maxvalue", "step", "className", "styles", "hidden", "showmarkers", "markerlabeltext"];
162
220
  return keys.every(function (key) {
163
221
  return prev[key] === current[key];
164
222
  });