@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
@@ -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, _isLocalDatavalueObje;
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,
@@ -81,7 +84,9 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
81
84
  var _useState6 = (0, _react.useState)(datavalue),
82
85
  prevDatavalue = _useState6[0],
83
86
  setPrevDatavalue = _useState6[1];
84
- var transformedDataset = (0, _transformedDatasetUtils.transformDataset)(dataset, datafield, displayfield, displaylabel, displayexpression, orderby, groupby, dataPath);
87
+ // Check if dataset is a function and call it to get the actual dataset value
88
+ var resolvedDataset = typeof dataset === "function" ? dataset() : dataset;
89
+ var transformedDataset = (0, _transformedDatasetUtils.transformDataset)(resolvedDataset, datafield, displayfield, displaylabel, displayExpression, orderby, groupby, dataPath, "", match);
85
90
  var validateInput = (0, _react.useCallback)(function (value) {
86
91
  // Handle special case value
87
92
  if (value === "") {
@@ -103,71 +108,112 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
103
108
  }, [required]);
104
109
 
105
110
  // 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);
111
+ var handleValueChange = /*#__PURE__*/function () {
112
+ var _ref = (0, _asyncToGenerator2["default"])(/*#__PURE__*/_regenerator["default"].mark(function _callee(event) {
113
+ var _listener$Widgets, _transformedDataset;
114
+ var newValue, filteredValues, selectedTexts, findItem, selectedValues, selectedDisplayValues, _event$target$options;
115
+ return _regenerator["default"].wrap(function _callee$(_context) {
116
+ while (1) switch (_context.prev = _context.next) {
117
+ case 0:
118
+ if (!(props.readonly || disabled)) {
119
+ _context.next = 2;
120
+ break;
121
+ }
122
+ return _context.abrupt("return");
123
+ case 2:
124
+ newValue = multiple ? Array.from(event.target.selectedOptions, function (option) {
125
+ return option.value;
126
+ }) : event.target.selectedIndex;
127
+ if (!multiple) {
128
+ _context.next = 20;
129
+ break;
130
+ }
131
+ // Filter out placeholder value from multiple selection
132
+ filteredValues = newValue.filter(function (val) {
133
+ return val !== placeholder;
134
134
  });
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
- });
135
+ setLocalDatavalue(filteredValues);
136
+ selectedTexts = Array.from(event.target.selectedOptions, function (option) {
137
+ return option.text;
138
+ }).filter(function (text) {
139
+ return text !== placeholder;
140
+ });
141
+ setDisplayValue(selectedTexts.join(", "));
142
+ if (!(listener !== null && listener !== void 0 && listener.onChange)) {
143
+ _context.next = 18;
144
+ break;
145
+ }
146
+ if (!(filteredValues.length === 0)) {
147
+ _context.next = 14;
148
+ break;
149
+ }
150
+ _context.next = 12;
151
+ return listener.onChange(props.fieldName || name, {
152
+ datavalue: [],
153
+ displayValue: []
154
+ });
155
+ case 12:
156
+ _context.next = 18;
157
+ break;
158
+ case 14:
159
+ findItem = function findItem(val) {
160
+ return transformedDataset.find(function (item) {
161
+ return (0, _typeof2["default"])(item.value) === "object" ? String(item.key) === String(val) : String(item.value) === String(val);
162
+ });
163
+ };
164
+ selectedValues = filteredValues.map(function (val) {
165
+ var item = findItem(val);
166
+ return item ? item.value : val;
167
+ });
168
+ selectedDisplayValues = filteredValues.map(function (val) {
169
+ var item = findItem(val);
170
+ return item ? item.label : val;
171
+ });
172
+ listener.onChange(props.fieldName || name, {
173
+ datavalue: selectedValues,
174
+ displayValue: selectedDisplayValues
175
+ });
176
+ case 18:
177
+ _context.next = 30;
178
+ break;
179
+ case 20:
180
+ setLocalDatavalue(event.target.value);
181
+ setDisplayValue(((_event$target$options = event.target.options[event.target.selectedIndex]) === null || _event$target$options === void 0 ? void 0 : _event$target$options.text) || "");
182
+ if (!(listener !== null && listener !== void 0 && listener.onChange)) {
183
+ _context.next = 30;
184
+ break;
185
+ }
186
+ if (!(newValue === 0 || event.target.value === placeholder)) {
187
+ _context.next = 28;
188
+ break;
189
+ }
190
+ _context.next = 26;
191
+ return listener.onChange(props.fieldName || name, {
192
+ datavalue: "",
193
+ displayValue: ""
194
+ });
195
+ case 26:
196
+ _context.next = 30;
197
+ break;
198
+ case 28:
199
+ _context.next = 30;
200
+ return listener.onChange(props.fieldName || name, {
201
+ datavalue: transformedDataset[newValue - 1].value,
202
+ displayValue: transformedDataset[newValue - 1].label
203
+ });
204
+ case 30:
205
+ 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);
206
+ setPrevDatavalue(newValue);
207
+ case 32:
208
+ case "end":
209
+ return _context.stop();
165
210
  }
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
- };
211
+ }, _callee);
212
+ }));
213
+ return function handleValueChange(_x) {
214
+ return _ref.apply(this, arguments);
215
+ };
216
+ }();
171
217
  var handleBlur = function handleBlur(e) {
172
218
  var newValue = e.target.value;
173
219
  var selectedItem = transformedDataset.find(function (item) {
@@ -241,7 +287,11 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
241
287
  }
242
288
  } else {
243
289
  if (datavalue !== localDatavalue) {
290
+ var _listener$onChange;
244
291
  setLocalDatavalue(datavalue);
292
+ listener === null || listener === void 0 || (_listener$onChange = listener.onChange) === null || _listener$onChange === void 0 || _listener$onChange.call(listener, props.fieldName || name, {
293
+ datavalue: datavalue
294
+ });
245
295
  }
246
296
  }
247
297
  }, [datavalue, multiple]);
@@ -279,7 +329,33 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
279
329
  } : {}), onMouseLeave ? {
280
330
  onMouseLeave: handleMouseLeave
281
331
  } : {});
332
+ var isLocalDatavalueObject = function isLocalDatavalueObject() {
333
+ var _transformedDataset$f;
334
+ if ((0, _typeof2["default"])(localDatavalue) === "object" && localDatavalue !== null) {
335
+ var matchingItem = transformedDataset.find(function (item) {
336
+ return item.value === localDatavalue || JSON.stringify(item.value) === JSON.stringify(localDatavalue);
337
+ });
338
+ if (matchingItem) {
339
+ var _listener$onChange2;
340
+ listener === null || listener === void 0 || (_listener$onChange2 = listener.onChange) === null || _listener$onChange2 === void 0 || _listener$onChange2.call(listener, props.fieldName || name, {
341
+ displayValue: matchingItem.label
342
+ });
343
+ return matchingItem.key;
344
+ }
345
+ }
346
+ var displayValue = transformedDataset.length > 0 && ((_transformedDataset$f = transformedDataset.find(function (item) {
347
+ return item.value == localDatavalue;
348
+ })) === null || _transformedDataset$f === void 0 ? void 0 : _transformedDataset$f.label) || "";
349
+ if (displayValue) {
350
+ var _listener$onChange3;
351
+ listener === null || listener === void 0 || (_listener$onChange3 = listener.onChange) === null || _listener$onChange3 === void 0 || _listener$onChange3.call(listener, props.fieldName || name, {
352
+ displayValue: displayValue
353
+ });
354
+ }
355
+ return localDatavalue;
356
+ };
282
357
  return __jsx(_material.Box, {
358
+ hidden: props.hidden,
283
359
  sx: {
284
360
  display: "inherit !important"
285
361
  },
@@ -289,7 +365,7 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
289
365
  IconComponent: function IconComponent() {
290
366
  return null;
291
367
  },
292
- value: multiple ? Array.isArray(localDatavalue) ? localDatavalue : [] : (_ref = localDatavalue !== null && localDatavalue !== void 0 ? localDatavalue : placeholder) !== null && _ref !== void 0 ? _ref : ""
368
+ value: multiple ? Array.isArray(localDatavalue) ? localDatavalue : [] : (_ref2 = (_isLocalDatavalueObje = isLocalDatavalueObject()) !== null && _isLocalDatavalueObje !== void 0 ? _isLocalDatavalueObje : placeholder) !== null && _ref2 !== void 0 ? _ref2 : ""
293
369
  }, events, {
294
370
  sx: {
295
371
  "& .MuiNativeSelect-select": _objectSpread(_objectSpread({}, styles), {}, {
@@ -304,12 +380,13 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
304
380
  tabIndex: tabindex,
305
381
  "aria-label": arialabel,
306
382
  multiple: multiple,
307
- disabled: disabled || readonly,
383
+ disabled: disabled,
308
384
  "aria-readonly": readonly,
309
385
  className: "app-select ".concat(className, " form-control ng-valid ng-touched ng-dirty wm-app "),
310
386
  accessKey: shortcutkey,
311
387
  title: hint
312
- }
388
+ },
389
+ readOnly: readonly
313
390
  }), __jsx("option", {
314
391
  value: placeholder,
315
392
  id: "placeholderOption",
@@ -335,7 +412,7 @@ var WmSelect = /*#__PURE__*/_react["default"].memo(function (props) {
335
412
  }, item.label);
336
413
  })));
337
414
  }, function (prevProps, nextProps) {
338
- var keys = ["dataset", "datafield", "displayfield", "displaylabel", "displayexpression", "orderby", "groupby", "dataPath", "arialabel", "multiple", "styles", "autofocus", "disabled", "readonly", "required", "datavalue"];
415
+ var keys = ["dataset", "datafield", "displayfield", "displaylabel", "displayExpression", "orderby", "groupby", "dataPath", "arialabel", "multiple", "styles", "autofocus", "disabled", "readonly", "required", "datavalue", "hidden", "className"];
339
416
  return keys.every(function (key) {
340
417
  return prevProps[key] === nextProps[key];
341
418
  });
@@ -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
  });
@@ -17,6 +17,7 @@ var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWra
17
17
  var _withFormController = _interopRequireDefault(require("@wavemaker/react-runtime/components/data/form/form-controller/withFormController"));
18
18
  var _util = require("./util");
19
19
  var _delay = _interopRequireDefault(require("lodash/delay"));
20
+ var _util2 = require("../util");
20
21
  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
22
  var __jsx = _react["default"].createElement;
22
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; }
@@ -52,7 +53,8 @@ var WmText = /*#__PURE__*/(0, _react.memo)(function (props) {
52
53
  regexp = props.regexp,
53
54
  _props$updateon = props.updateon,
54
55
  updateon = _props$updateon === void 0 ? "blur" : _props$updateon,
55
- autocapitalize = props.autocapitalize,
56
+ _props$autocapitalize = props.autocapitalize,
57
+ autocapitalize = _props$autocapitalize === void 0 ? "none" : _props$autocapitalize,
56
58
  autotrim = props.autotrim,
57
59
  onChange = props.onChange,
58
60
  onBlur = props.onBlur,
@@ -245,55 +247,71 @@ var WmText = /*#__PURE__*/(0, _react.memo)(function (props) {
245
247
  isInternalChange.current = true;
246
248
  var inputEl = e.target;
247
249
  var newValue = inputEl.value;
250
+ var previousValue = rawValue;
248
251
  cursorPositionRef.current = inputEl.selectionStart || 0;
249
252
 
250
- // Extract digits for validation if displayformat is present
251
- var digitsOnly = displayformat ? newValue.replace(/\D/g, "") : newValue;
253
+ // Manual autocapitalize implementation
254
+ var capitalizeResult = (0, _util.applyAutoCapitalize)(newValue, previousValue, cursorPositionRef.current, autocapitalize);
255
+ newValue = capitalizeResult.value;
256
+
257
+ // Extract meaningful characters for validation if displayformat is present
258
+ var cleanValue = displayformat ? (0, _util.removeDisplayFormat)(newValue, displayformat) : newValue;
252
259
 
253
260
  // Enforce maxchars constraint BEFORE setting state
254
- if (maxchars && digitsOnly.length > maxchars) {
261
+ if (maxchars && cleanValue.length > maxchars) {
255
262
  // Prevent input that exceeds maxchars
256
263
  return;
257
264
  }
258
265
 
259
- // Enforce displayformat digit limit
266
+ // Enforce displayformat character limit using the generic format parser
260
267
  if (displayformat) {
261
- var formatDigits = displayformat.replace(/[^9]/g, "");
262
- var maxDigits = formatDigits.length;
263
- if (digitsOnly.length > maxDigits) {
264
- // Prevent input that exceeds format digit limit
268
+ var maxFormatLength = (0, _util.getFormatMaxLength)(displayformat);
269
+ if (cleanValue.length > maxFormatLength) {
270
+ // Prevent input that exceeds format character limit
265
271
  return;
266
272
  }
267
273
  }
268
274
 
269
275
  // Enforce min/max value constraints for number type
270
276
  if (props.type === "number") {
271
- var numValue = (0, _toNumber["default"])(digitsOnly);
277
+ var numValue = (0, _toNumber["default"])(cleanValue);
272
278
  if (props.maxvalue !== undefined && numValue > props.maxvalue) {
273
279
  // Prevent input that exceeds maxvalue
274
280
  return;
275
281
  }
276
- if (props.minvalue !== undefined && numValue < props.minvalue && digitsOnly.length >= String(props.minvalue).length) {
282
+ if (props.minvalue !== undefined && numValue < props.minvalue && cleanValue.length >= String(props.minvalue).length) {
277
283
  // Only prevent if the number length is complete and still below minvalue
278
284
  // This allows typing "1" when minvalue is 10
279
285
  var minLength = String(props.minvalue).length;
280
- if (digitsOnly.length >= minLength) {
286
+ if (cleanValue.length >= minLength) {
281
287
  return;
282
288
  }
283
289
  }
284
290
  }
285
291
  setRawValue(newValue);
286
292
 
293
+ // Restore cursor position after capitalization
294
+ if (capitalizeResult.wasCapitalized) {
295
+ setTimeout(function () {
296
+ if (ref.current && cursorPositionRef.current !== null) {
297
+ ref.current.setSelectionRange(cursorPositionRef.current, cursorPositionRef.current);
298
+ }
299
+ }, 0);
300
+ }
301
+
287
302
  // Handle cursor position for formatted input
288
303
  if (displayformat && showdisplayformaton === "keypress") {
289
304
  setTimeout(function () {
290
305
  if (ref.current) {
291
306
  var formatted = (0, _util.formatInput)(newValue, displayformat);
292
- var digitsBefore = newValue.substring(0, cursorPositionRef.current).replace(/\D/g, "").length;
307
+ // Count meaningful characters (not separators) before cursor
308
+ var charsBefore = (0, _util.removeDisplayFormat)(newValue.substring(0, cursorPositionRef.current), displayformat).length;
309
+
310
+ // Find position in formatted string where we have the same number of meaningful chars
293
311
  var newPos = formatted.split("").reduce(function (pos, _char, index) {
294
312
  if (pos !== -1) return pos;
295
- var digitsSoFar = formatted.substring(0, index).replace(/\D/g, "").length;
296
- return digitsSoFar >= digitsBefore ? index : -1;
313
+ var charsSoFar = (0, _util.removeDisplayFormat)(formatted.substring(0, index + 1), displayformat).length;
314
+ return charsSoFar >= charsBefore ? index + 1 : -1;
297
315
  }, -1);
298
316
  if (newPos !== -1) {
299
317
  ref.current.setSelectionRange(newPos, newPos);
@@ -382,6 +400,7 @@ var WmText = /*#__PURE__*/(0, _react.memo)(function (props) {
382
400
  onMouseLeave: props.onMouseLeave
383
401
  } : {});
384
402
  return __jsx(_TextField["default"], (0, _extends2["default"])({}, events, {
403
+ hidden: props.hidden,
385
404
  title: hint || "Text Input",
386
405
  name: name,
387
406
  id: id || name,
@@ -391,7 +410,7 @@ var WmText = /*#__PURE__*/(0, _react.memo)(function (props) {
391
410
  disabled: disabled,
392
411
  required: required,
393
412
  placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : "Enter text",
394
- value: displayValue,
413
+ value: (0, _util2.sanitizeInputValue)(displayValue),
395
414
  type: type,
396
415
  inputRef: ref,
397
416
  error: displayError,
@@ -401,11 +420,12 @@ var WmText = /*#__PURE__*/(0, _react.memo)(function (props) {
401
420
  htmlInput: {
402
421
  tabIndex: tabindex,
403
422
  readOnly: readonly,
423
+ autoCapitalize: autocapitalize,
404
424
  className: (0, _clsx["default"])(DEFAULT_CLASS, className, isTouched ? "ng-touched" : "ng-untouched", displayError && "ng-invalid"),
405
425
  style: styles,
406
426
  "aria-label": arialabel,
407
427
  maxLength: maxchars,
408
- pattern: new RegExp(regexp || ".*", "g"),
428
+ pattern: regexp,
409
429
  min: props.minvalue,
410
430
  max: props.maxvalue,
411
431
  step: props.step
@@ -425,7 +445,7 @@ var WmText = /*#__PURE__*/(0, _react.memo)(function (props) {
425
445
  }
426
446
  }));
427
447
  }, function (prev, current) {
428
- var keys = ["datavalue", "disabled", "required", "readonly", "placeholder", "maxchars", "tabindex", "shortcutkey", "autofocus", "arialabel", "error", "className"];
448
+ var keys = ["datavalue", "disabled", "required", "readonly", "placeholder", "maxchars", "tabindex", "shortcutkey", "autofocus", "arialabel", "error", "className", "hidden"];
429
449
  return keys.every(function (key) {
430
450
  return prev[key] === current[key];
431
451
  });