@wavemaker/react-runtime 11.14.2-1.245 → 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 +711 -669
  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
@@ -3,165 +3,260 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.applyAutoCapitalize = applyAutoCapitalize;
6
7
  exports.autoCapitalize = autoCapitalize;
7
- exports.removeDisplayFormat = exports.formatInput = void 0;
8
- var formatInput = exports.formatInput = function formatInput(value, format) {
9
- if (!format || !value) return value;
10
- value = value.toString();
11
- var digitsOnly = value.replace(/\D/g, "");
12
- var formatDigits = format.replace(/[^9]/g, "");
13
- var maxDigits = formatDigits.length;
14
- if (format === "999-99-9999") {
15
- if (digitsOnly.length === 0) return "";
16
- var result = digitsOnly.substring(0, Math.min(3, digitsOnly.length));
17
- if (digitsOnly.length > 3) {
18
- result += "-" + digitsOnly.substring(3, Math.min(5, digitsOnly.length));
19
- }
20
- if (digitsOnly.length > 5) {
21
- result += "-" + digitsOnly.substring(5, Math.min(9, digitsOnly.length));
22
- }
23
- return result;
24
- }
25
- if (format === "(999) 999-9999") {
26
- if (digitsOnly.length === 0) return "";
27
- var _result = "(" + digitsOnly.substring(0, Math.min(3, digitsOnly.length));
28
- if (digitsOnly.length > 3) {
29
- _result += ") " + digitsOnly.substring(3, Math.min(6, digitsOnly.length));
30
- }
31
- if (digitsOnly.length > 6) {
32
- _result += "-" + digitsOnly.substring(6, Math.min(10, digitsOnly.length));
33
- }
34
- return _result;
35
- }
36
- if (format === "(999) 999-9999 ext. 999") {
37
- if (digitsOnly.length === 0) return "";
38
- var _result2 = "(" + digitsOnly.substring(0, Math.min(3, digitsOnly.length));
39
- if (digitsOnly.length > 3) {
40
- _result2 += ") " + digitsOnly.substring(3, Math.min(6, digitsOnly.length));
41
- }
42
- if (digitsOnly.length > 6) {
43
- _result2 += "-" + digitsOnly.substring(6, Math.min(10, digitsOnly.length));
44
- }
45
- if (digitsOnly.length > 10) {
46
- _result2 += " ext. " + digitsOnly.substring(10);
8
+ exports.removeDisplayFormat = exports.getFormatMaxLength = exports.formatInput = void 0;
9
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
10
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
11
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
12
+ /**
13
+ * Format placeholders:
14
+ * - 9: Any digit (0-9)
15
+ * - A: Any letter (A-Z, a-z) - will be uppercased
16
+ * - a: Any letter (A-Z, a-z) - will be lowercased
17
+ * - X: Any alphanumeric character (preserves case)
18
+ * - ?: Makes the preceding placeholder optional
19
+ * - All other characters (including *, -, (, ), etc.) are treated as literal separators/static text
20
+ *
21
+ * Examples:
22
+ * 999-99-9999 → SSN format
23
+ * (999) 999-9999 → US phone
24
+ * AA-9999 → License plate (letters uppercased)
25
+ * XXX-XXX → Any 6 alphanumeric chars with dash
26
+ * (***: AAA-999) Literal asterisks with letters and digits
27
+ */
28
+
29
+ /**
30
+ * Parse format string into tokens for processing
31
+ */
32
+ var parseFormatTokens = function parseFormatTokens(format) {
33
+ var tokens = [];
34
+ var i = 0;
35
+ while (i < format.length) {
36
+ var _char = format[i];
37
+ var nextChar = format[i + 1];
38
+ var isOptional = nextChar === "?";
39
+ if (_char === "9") {
40
+ tokens.push({
41
+ type: "digit",
42
+ "char": _char,
43
+ optional: isOptional
44
+ });
45
+ i += isOptional ? 2 : 1;
46
+ } else if (_char === "A") {
47
+ tokens.push({
48
+ type: "letter-upper",
49
+ "char": _char,
50
+ optional: isOptional
51
+ });
52
+ i += isOptional ? 2 : 1;
53
+ } else if (_char === "a") {
54
+ tokens.push({
55
+ type: "letter-lower",
56
+ "char": _char,
57
+ optional: isOptional
58
+ });
59
+ i += isOptional ? 2 : 1;
60
+ } else if (_char === "X") {
61
+ // X = alphanumeric placeholder (use X instead of * to avoid conflicts with literal asterisks)
62
+ tokens.push({
63
+ type: "alphanumeric",
64
+ "char": _char,
65
+ optional: isOptional
66
+ });
67
+ i += isOptional ? 2 : 1;
68
+ } else if (_char === "?") {
69
+ // Standalone ? without preceding placeholder - treat as literal
70
+ tokens.push({
71
+ type: "literal",
72
+ "char": _char,
73
+ optional: false
74
+ });
75
+ i++;
76
+ } else {
77
+ // All other characters are literals (including *, -, (, ), spaces, etc.)
78
+ tokens.push({
79
+ type: "literal",
80
+ "char": _char,
81
+ optional: false
82
+ });
83
+ i++;
47
84
  }
48
- return _result2;
49
85
  }
50
- if (format === "(9?9?9?) 9?9?9?-9?9?9?9?9?9?") {
51
- var _result3 = "";
52
- var areaCode = "";
53
- var prefix = "";
54
- var number = "";
55
- if (digitsOnly.length > 0) {
56
- areaCode = "(" + digitsOnly.substring(0, Math.min(3, digitsOnly.length));
57
- if (digitsOnly.length < 3) {
58
- return areaCode;
59
- }
60
- areaCode += ") ";
61
- }
62
- if (digitsOnly.length > 3) {
63
- prefix = digitsOnly.substring(3, Math.min(6, digitsOnly.length));
64
- if (digitsOnly.length < 6) {
65
- return areaCode + prefix;
86
+ return tokens;
87
+ };
88
+
89
+ /**
90
+ * Extract input characters that can be used for formatting
91
+ * Returns an array of characters with their types
92
+ */
93
+ var extractInputChars = function extractInputChars(value) {
94
+ var chars = [];
95
+ var _iterator = _createForOfIteratorHelper(value),
96
+ _step;
97
+ try {
98
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
99
+ var _char2 = _step.value;
100
+ var isDigit = /\d/.test(_char2);
101
+ var isLetter = /[A-Za-z]/.test(_char2);
102
+ if (isDigit || isLetter) {
103
+ chars.push({
104
+ "char": _char2,
105
+ isDigit: isDigit,
106
+ isLetter: isLetter
107
+ });
66
108
  }
67
- prefix += "-";
68
- }
69
- if (digitsOnly.length > 6) {
70
- number = digitsOnly.substring(6);
71
- }
72
- _result3 = areaCode + prefix + number;
73
- return _result3;
74
- }
75
- if (format === "9999 9999 9999 9999") {
76
- // Credit card format
77
- var _result4 = "";
78
- for (var i = 0; i < digitsOnly.length && i < 16; i += 4) {
79
- if (i > 0) _result4 += " ";
80
- _result4 += digitsOnly.substring(i, Math.min(i + 4, digitsOnly.length));
81
109
  }
82
- return _result4;
110
+ } catch (err) {
111
+ _iterator.e(err);
112
+ } finally {
113
+ _iterator.f();
83
114
  }
84
- if (format === "AA-9999") {
85
- var _value$match;
86
- // Alpha-numeric format
87
- var _result5 = "";
88
- var alphaOnly = ((_value$match = value.match(/[A-Za-z]*/g)) === null || _value$match === void 0 ? void 0 : _value$match.join("")) || "";
89
- if (alphaOnly.length > 0) {
90
- _result5 = alphaOnly.substring(0, Math.min(2, alphaOnly.length)).toUpperCase();
91
- }
92
- if (digitsOnly.length > 0 && _result5.length > 0) {
93
- _result5 += "-";
94
- }
95
- if (digitsOnly.length > 0) {
96
- _result5 += digitsOnly.substring(0, Math.min(4, digitsOnly.length));
97
- }
98
- return _result5;
99
- }
100
- if (format === "(***: AAA-999)") {
101
- var _value$match2;
102
- // Special format with asterisks
103
- var _result6 = "(";
104
- _result6 += "***";
105
- _result6 += ": ";
106
- var _alphaOnly = ((_value$match2 = value.match(/[A-Za-z]*/g)) === null || _value$match2 === void 0 ? void 0 : _value$match2.join("")) || "";
107
- if (_alphaOnly.length > 0) {
108
- _result6 += _alphaOnly.substring(0, Math.min(3, _alphaOnly.length)).toUpperCase();
115
+ return chars;
116
+ };
117
+
118
+ /**
119
+ * Count the maximum number of input characters the format can accept
120
+ */
121
+ var getMaxInputLength = function getMaxInputLength(tokens) {
122
+ return tokens.filter(function (t) {
123
+ return t.type === "digit" || t.type === "letter-upper" || t.type === "letter-lower" || t.type === "alphanumeric";
124
+ }).length;
125
+ };
126
+
127
+ /**
128
+ * Universal format input function that handles any display format pattern
129
+ */
130
+ var formatInput = exports.formatInput = function formatInput(value, format) {
131
+ if (!format || value === null || value === undefined) return value !== null && value !== void 0 ? value : "";
132
+ if (value === "") return "";
133
+ value = value.toString();
134
+ var tokens = parseFormatTokens(format);
135
+ var inputChars = extractInputChars(value);
136
+ if (inputChars.length === 0) return "";
137
+ var result = "";
138
+ var inputIndex = 0;
139
+ var pendingLiterals = "";
140
+ for (var tokenIndex = 0; tokenIndex < tokens.length; tokenIndex++) {
141
+ var token = tokens[tokenIndex];
142
+
143
+ // No more input characters - stop processing
144
+ if (inputIndex >= inputChars.length) {
145
+ break;
109
146
  }
110
- if (digitsOnly.length > 0) {
111
- _result6 += "-";
112
- _result6 += digitsOnly.substring(0, Math.min(3, digitsOnly.length));
147
+ if (token.type === "literal") {
148
+ // Collect literals but don't add them yet
149
+ pendingLiterals += token["char"];
150
+ continue;
113
151
  }
114
- _result6 += ")";
115
- return _result6;
116
- }
117
152
 
118
- // Generic formatter for other patterns
119
- if (format.includes("9")) {
120
- var _result7 = "";
121
- var digitIndex = 0;
122
- var _formatDigits = format.replace(/[^9]/g, "");
123
- var _maxDigits = _formatDigits.length;
153
+ // Find a matching input character for this token
154
+ var matched = false;
155
+ var inputChar = inputChars[inputIndex];
156
+ if (token.type === "digit" && inputChar !== null && inputChar !== void 0 && inputChar.isDigit) {
157
+ // Flush pending literals before adding the matched character
158
+ result += pendingLiterals + inputChar["char"];
159
+ pendingLiterals = "";
160
+ inputIndex++;
161
+ matched = true;
162
+ } else if (token.type === "letter-upper" && inputChar !== null && inputChar !== void 0 && inputChar.isLetter) {
163
+ result += pendingLiterals + inputChar["char"].toUpperCase();
164
+ pendingLiterals = "";
165
+ inputIndex++;
166
+ matched = true;
167
+ } else if (token.type === "letter-lower" && inputChar !== null && inputChar !== void 0 && inputChar.isLetter) {
168
+ result += pendingLiterals + inputChar["char"].toLowerCase();
169
+ pendingLiterals = "";
170
+ inputIndex++;
171
+ matched = true;
172
+ } else if (token.type === "alphanumeric" && (inputChar !== null && inputChar !== void 0 && inputChar.isDigit || inputChar !== null && inputChar !== void 0 && inputChar.isLetter)) {
173
+ result += pendingLiterals + inputChar["char"];
174
+ pendingLiterals = "";
175
+ inputIndex++;
176
+ matched = true;
177
+ }
124
178
 
125
- // Limit digitsOnly to maxDigits from format
126
- var limitedDigits = digitsOnly.substring(0, _maxDigits);
127
- for (var _i2 = 0; _i2 < format.length && digitIndex < limitedDigits.length; _i2++) {
128
- if (format[_i2] === "9") {
129
- _result7 += limitedDigits[digitIndex++] || "";
130
- } else {
131
- // Only add separator if there are more digits to come
132
- if (digitIndex < limitedDigits.length) {
133
- _result7 += format[_i2];
179
+ // If no match and token is not optional, try to skip input chars to find match
180
+ if (!matched && !token.optional) {
181
+ // Look ahead in input to find a matching character
182
+ var foundMatch = false;
183
+ for (var lookAhead = inputIndex; lookAhead < inputChars.length; lookAhead++) {
184
+ var lookAheadChar = inputChars[lookAhead];
185
+ if (token.type === "digit" && lookAheadChar.isDigit) {
186
+ result += pendingLiterals + lookAheadChar["char"];
187
+ pendingLiterals = "";
188
+ inputIndex = lookAhead + 1;
189
+ foundMatch = true;
190
+ break;
191
+ } else if (token.type === "letter-upper" && lookAheadChar.isLetter) {
192
+ result += pendingLiterals + lookAheadChar["char"].toUpperCase();
193
+ pendingLiterals = "";
194
+ inputIndex = lookAhead + 1;
195
+ foundMatch = true;
196
+ break;
197
+ } else if (token.type === "letter-lower" && lookAheadChar.isLetter) {
198
+ result += pendingLiterals + lookAheadChar["char"].toLowerCase();
199
+ pendingLiterals = "";
200
+ inputIndex = lookAhead + 1;
201
+ foundMatch = true;
202
+ break;
203
+ } else if (token.type === "alphanumeric") {
204
+ result += pendingLiterals + lookAheadChar["char"];
205
+ pendingLiterals = "";
206
+ inputIndex = lookAhead + 1;
207
+ foundMatch = true;
208
+ break;
134
209
  }
135
210
  }
211
+
212
+ // If still no match found, stop processing
213
+ if (!foundMatch) {
214
+ break;
215
+ }
136
216
  }
137
- return _result7;
138
217
  }
139
-
140
- // Fallback: return original value
141
- return value;
218
+ return result;
142
219
  };
143
220
 
144
221
  /**
145
222
  * Removes display format characters from the value
146
- * Keeps only alphanumeric characters based on the format type
223
+ * Intelligently extracts only the meaningful input characters based on format type
147
224
  */
148
225
  var removeDisplayFormat = exports.removeDisplayFormat = function removeDisplayFormat(value, format) {
149
226
  if (!format || !value) return value;
150
227
  value = value.toString();
228
+ var tokens = parseFormatTokens(format);
151
229
 
152
- // For alphanumeric formats (like AA-9999), keep both letters and numbers
153
- if (format.includes("A")) {
230
+ // Determine what character types the format accepts
231
+ var acceptsDigits = tokens.some(function (t) {
232
+ return t.type === "digit" || t.type === "alphanumeric";
233
+ });
234
+ var acceptsLetters = tokens.some(function (t) {
235
+ return t.type === "letter-upper" || t.type === "letter-lower" || t.type === "alphanumeric";
236
+ });
237
+ if (acceptsDigits && acceptsLetters) {
238
+ // Mixed format: keep both letters and numbers
154
239
  return value.replace(/[^A-Za-z0-9]/g, "");
155
- }
156
-
157
- // For numeric-only formats, keep only digits
158
- if (format.includes("9")) {
240
+ } else if (acceptsLetters) {
241
+ // Letters only format
242
+ return value.replace(/[^A-Za-z]/g, "");
243
+ } else if (acceptsDigits) {
244
+ // Digits only format
159
245
  return value.replace(/\D/g, "");
160
246
  }
161
247
 
162
- // Default: return the value as-is
248
+ // Default: return the value as-is (no placeholders in format)
163
249
  return value;
164
250
  };
251
+
252
+ /**
253
+ * Get the maximum number of input characters allowed by the format
254
+ */
255
+ var getFormatMaxLength = exports.getFormatMaxLength = function getFormatMaxLength(format) {
256
+ if (!format) return Infinity;
257
+ var tokens = parseFormatTokens(format);
258
+ return getMaxInputLength(tokens);
259
+ };
165
260
  function autoCapitalize(value, type) {
166
261
  if (!value) return value;
167
262
  switch (type) {
@@ -178,4 +273,62 @@ function autoCapitalize(value, type) {
178
273
  default:
179
274
  return value;
180
275
  }
276
+ }
277
+
278
+ /**
279
+ * Applies autocapitalize logic to a character being inserted in real-time
280
+ * @param newValue - The complete new value after character insertion
281
+ * @param previousValue - The value before character insertion
282
+ * @param cursorPosition - The cursor position after insertion
283
+ * @param mode - The autocapitalize mode: "words", "sentence", "characters", or "none"
284
+ * @returns Object with capitalized value and whether capitalization was applied
285
+ */
286
+ function applyAutoCapitalize(newValue, previousValue, cursorPosition, mode) {
287
+ // Only process if a character was inserted (not deleted)
288
+ if (mode === "none" || newValue.length <= previousValue.length) {
289
+ return {
290
+ value: newValue,
291
+ wasCapitalized: false
292
+ };
293
+ }
294
+ var insertedChar = newValue[cursorPosition - 1];
295
+ var shouldCapitalize = false;
296
+
297
+ // Only capitalize alphabetic characters
298
+ if (!/[a-zA-Z]/.test(insertedChar)) {
299
+ return {
300
+ value: newValue,
301
+ wasCapitalized: false
302
+ };
303
+ }
304
+ if (mode === "characters") {
305
+ // Capitalize every character
306
+ shouldCapitalize = true;
307
+ } else if (mode === "words") {
308
+ // Capitalize first letter of each word (after space or at start)
309
+ shouldCapitalize = cursorPosition === 1 || newValue[cursorPosition - 2] === " ";
310
+ } else if (mode === "sentences") {
311
+ // Capitalize first letter after sentence-ending punctuation (. ! ?)
312
+ if (cursorPosition === 1) {
313
+ shouldCapitalize = true;
314
+ } else {
315
+ // Check if we're at the start of a sentence
316
+ var textBefore = newValue.substring(0, cursorPosition - 1);
317
+ // Match sentence-ending punctuation followed by optional spaces
318
+ var sentenceEndPattern = /[.!?]\s*$/;
319
+ shouldCapitalize = sentenceEndPattern.test(textBefore);
320
+ }
321
+ }
322
+ if (shouldCapitalize && insertedChar === insertedChar.toLowerCase()) {
323
+ // Replace the lowercase character with uppercase
324
+ var capitalizedValue = newValue.substring(0, cursorPosition - 1) + insertedChar.toUpperCase() + newValue.substring(cursorPosition);
325
+ return {
326
+ value: capitalizedValue,
327
+ wasCapitalized: true
328
+ };
329
+ }
330
+ return {
331
+ value: newValue,
332
+ wasCapitalized: false
333
+ };
181
334
  }
@@ -16,6 +16,7 @@ var lodash = _interopRequireWildcard(require("lodash-es"));
16
16
  var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWrapper");
17
17
  var _withFormController = _interopRequireDefault(require("@wavemaker/react-runtime/components/data/form/form-controller/withFormController"));
18
18
  var _delay = _interopRequireDefault(require("lodash/delay"));
19
+ var _util = require("../util");
19
20
  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); }
20
21
  var __jsx = _react["default"].createElement;
21
22
  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; }
@@ -295,18 +296,22 @@ var WmTextarea = /*#__PURE__*/(0, _react.memo)(function (props) {
295
296
  } : {}), props.onClick ? {
296
297
  onClick: props.onClick
297
298
  } : {});
299
+ var value = (0, _util.sanitizeInputValue)(displayValue);
300
+ var isEditable = !readonly && !disabled;
298
301
  return __jsx(_react["default"].Fragment, null, __jsx(_TextField["default"], (0, _extends2["default"])({
302
+ hidden: props.hidden,
299
303
  multiline: true,
300
304
  variant: "standard",
301
305
  name: name,
302
306
  title: props.hint,
303
307
  id: id || name,
304
308
  placeholder: placeholder || "Place your text here",
305
- value: displayValue,
309
+ value: value,
306
310
  required: required,
307
311
  disabled: disabled,
308
312
  error: isDirty && error.show,
309
313
  className: (0, _clsx["default"])("app-input-wrapper", isTouched ? "ng-touched" : "ng-untouched", isDirty && "ng-invalid"),
314
+ style: styles,
310
315
  "aria-readonly": readonly,
311
316
  slotProps: {
312
317
  htmlInput: {
@@ -320,23 +325,21 @@ var WmTextarea = /*#__PURE__*/(0, _react.memo)(function (props) {
320
325
  ref: textareaRef,
321
326
  onKeyDown: handleKeyDown,
322
327
  onKeyUp: handleKeyUp,
323
- className: (0, _clsx["default"])(DEFAULT_CLASS, className, isTouched ? "ng-touched" : "ng-untouched", isDirty && "ng-invalid"),
324
- pattern: regexp,
325
- style: _objectSpread({
326
- height: "none",
327
- resize: "both",
328
- overflow: "auto"
329
- }, styles)
328
+ className: (0, _clsx["default"])(DEFAULT_CLASS, className, isTouched ? "ng-touched" : "ng-untouched", isDirty && "ng-invalid", isEditable ? "wm-textarea-editable" : ""),
329
+ pattern: regexp
330
330
  }
331
331
  },
332
332
  sx: {
333
- width: "100%"
333
+ width: "100%",
334
+ "& .MuiInputBase-input": _objectSpread({}, styles.height ? {
335
+ height: "".concat(styles.height, " !important")
336
+ } : {})
334
337
  }
335
338
  }, events)), maxchars && __jsx(_Box["default"], {
336
339
  className: "textarea-count"
337
340
  }, limitdisplaytext.replaceAll("undefined", "".concat((displayValue === null || displayValue === void 0 ? void 0 : displayValue.length) || 0))));
338
341
  }, function (prev, current) {
339
- var keys = ["datavalue", "disabled", "required", "readonly", "placeholder", "maxchars", "tabindex", "shortcutkey", "autofocus", "arialabel", "limitdisplaytext"];
342
+ var keys = ["datavalue", "disabled", "required", "readonly", "placeholder", "maxchars", "tabindex", "shortcutkey", "autofocus", "arialabel", "limitdisplaytext", "hidden"];
340
343
  return keys.every(function (key) {
341
344
  return prev[key] === current[key];
342
345
  });
@@ -0,0 +1,124 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ var _typeof = require("@babel/runtime/helpers/typeof");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _react = _interopRequireWildcard(require("react"));
11
+ var _link = _interopRequireDefault(require("next/link"));
12
+ var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWrapper");
13
+ var _withFormController = _interopRequireDefault(require("../../data/form/form-controller/withFormController"));
14
+ var _image = _interopRequireDefault(require("next/image"));
15
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
16
+ var __jsx = _react["default"].createElement;
17
+ var WmUpload = /*#__PURE__*/(0, _react.memo)(function (props) {
18
+ var name = props.name,
19
+ formField = props.formField,
20
+ datavalue = props.datavalue,
21
+ _props$readonly = props.readonly,
22
+ readonly = _props$readonly === void 0 ? false : _props$readonly,
23
+ _props$required = props.required,
24
+ required = _props$required === void 0 ? false : _props$required,
25
+ type = props.type,
26
+ onChange = props.onChange,
27
+ className = props.className,
28
+ style = props.style,
29
+ onFocus = props.onFocus,
30
+ onBlur = props.onBlur,
31
+ _props$disabled = props.disabled,
32
+ disabled = _props$disabled === void 0 ? false : _props$disabled,
33
+ listener = props.listener;
34
+ var fileInputRef = (0, _react.useRef)(null);
35
+ var prevDatavalue = (0, _react.useRef)(datavalue);
36
+
37
+ // Check if we have existing file data
38
+ var isImage = (formField === null || formField === void 0 ? void 0 : formField.filetype) === "image";
39
+ var handleFileChange = function handleFileChange(event) {
40
+ var _event$target$files;
41
+ var file = ((_event$target$files = event.target.files) === null || _event$target$files === void 0 ? void 0 : _event$target$files[0]) || null;
42
+
43
+ // For blob type, we need to call listener.onChange to update the form data
44
+ // The form controller will handle the actual value from the event.target.value
45
+ if (type === "file") {
46
+ var _listener$onChange;
47
+ listener === null || listener === void 0 || (_listener$onChange = listener.onChange) === null || _listener$onChange === void 0 || _listener$onChange.call(listener, props.fieldName || props.name, {
48
+ datavalue: file
49
+ });
50
+ } else {
51
+ var _listener$onChange2;
52
+ // For blob type, pass the file name/path from the input value
53
+ listener === null || listener === void 0 || (_listener$onChange2 = listener.onChange) === null || _listener$onChange2 === void 0 || _listener$onChange2.call(listener, props.fieldName || props.name, {
54
+ datavalue: event.target.value
55
+ });
56
+ }
57
+ if (onChange) {
58
+ onChange(event, listener === null || listener === void 0 ? void 0 : listener.Widgets[name], type === "file" ? file : event.target.value, prevDatavalue.current);
59
+ }
60
+ prevDatavalue.current = file;
61
+ };
62
+ var handleFileFocus = function handleFileFocus(event) {
63
+ if (onFocus) {
64
+ onFocus(event, listener === null || listener === void 0 ? void 0 : listener.Widgets[name]);
65
+ }
66
+ };
67
+ var handleFileBlur = function handleFileBlur(event) {
68
+ if (onBlur) {
69
+ onBlur(event, listener === null || listener === void 0 ? void 0 : listener.Widgets[name]);
70
+ }
71
+ };
72
+
73
+ // Render existing file display
74
+ var renderExistingFile = (0, _react.useCallback)(function () {
75
+ var fileUrl = (formField === null || formField === void 0 ? void 0 : formField.href) || (formField === null || formField === void 0 ? void 0 : formField.datavalue);
76
+ if (!fileUrl || type !== "file") return null;
77
+ return __jsx("div", {
78
+ className: "existing-file-display"
79
+ }, isImage ? __jsx(_link["default"], {
80
+ className: "form-control-static",
81
+ href: fileUrl
82
+ }, __jsx(_image["default"], {
83
+ style: {
84
+ height: "2em"
85
+ },
86
+ className: "wi wi-file",
87
+ src: fileUrl,
88
+ alt: "Existing file"
89
+ })) : __jsx(_link["default"], {
90
+ className: "form-control-static",
91
+ href: fileUrl
92
+ }, __jsx("i", {
93
+ className: "wi wi-file"
94
+ })));
95
+ }, [formField === null || formField === void 0 ? void 0 : formField.href, formField === null || formField === void 0 ? void 0 : formField.datavalue, isImage, type]);
96
+ (0, _react.useEffect)(function () {
97
+ if (!datavalue) {
98
+ // clear field input value
99
+ fileInputRef.current && (fileInputRef.current.value = "");
100
+ }
101
+ }, [datavalue]);
102
+ return __jsx("div", {
103
+ className: className,
104
+ style: style
105
+ }, renderExistingFile(), __jsx("input", (0, _extends2["default"])({}, props, {
106
+ hidden: props.hidden,
107
+ ref: fileInputRef,
108
+ type: "file",
109
+ name: "".concat(name, "_formWidget"),
110
+ className: "app-blob-upload",
111
+ required: required,
112
+ readOnly: readonly,
113
+ disabled: disabled,
114
+ onChange: handleFileChange,
115
+ onFocus: handleFileFocus,
116
+ onBlur: handleFileBlur
117
+ })));
118
+ }, function (prev, current) {
119
+ var keys = ["name", "formField", "datavalue", "readonly", "required", "type", "onChange", "className", "style"];
120
+ return keys.every(function (key) {
121
+ return prev[key] === current[key];
122
+ });
123
+ });
124
+ var _default = exports["default"] = (0, _withBaseWrapper.withBaseWrapper)((0, _withFormController["default"])(WmUpload));
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });