@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
@@ -15,6 +15,8 @@ var _joditReact = _interopRequireDefault(require("jodit-react"));
15
15
  var _dompurify = _interopRequireDefault(require("dompurify"));
16
16
  var _withBaseWrapper = require("@wavemaker/react-runtime/higherOrder/withBaseWrapper");
17
17
  var lodash = _interopRequireWildcard(require("lodash-es"));
18
+ var _withFormController = _interopRequireDefault(require("@wavemaker/react-runtime/components/data/form/form-controller/withFormController"));
19
+ var _util = require("@wavemaker/react-runtime/core/util");
18
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); }
19
21
  var __jsx = _react["default"].createElement;
20
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; }
@@ -57,7 +59,8 @@ var EditorContainer = (0, _styles.styled)(_material.Box)(function (_ref) {
57
59
  // Reset problematic global styles that override rich text editor
58
60
  "& .jodit-wysiwyg": {
59
61
  padding: "unset !important",
60
- margin: "unset !important"
62
+ margin: "unset !important",
63
+ minHeight: "100px !important "
61
64
  },
62
65
  "& .jodit-wysiwyg ul, & .jodit-wysiwyg li": {
63
66
  paddingLeft: "2em !important",
@@ -84,7 +87,7 @@ var PreviewContainer = (0, _styles.styled)(_material.Box)(function (_ref2) {
84
87
  borderRadius: theme.shape.borderRadius,
85
88
  backgroundColor: theme.palette.background.paper,
86
89
  color: theme.palette.text.primary,
87
- minHeight: "100px",
90
+ minHeight: "100px !important",
88
91
  overflowY: "auto",
89
92
  "& img": {
90
93
  maxWidth: "100%"
@@ -103,7 +106,7 @@ var PreviewContainer = (0, _styles.styled)(_material.Box)(function (_ref2) {
103
106
  var HiddenInput = (0, _styles.styled)("input")({
104
107
  display: "none"
105
108
  });
106
- var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
109
+ var WmRichTextEditorBase = function WmRichTextEditorBase(props) {
107
110
  var name = props.name,
108
111
  className = props.className,
109
112
  _props$placeholder = props.placeholder,
@@ -125,7 +128,9 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
125
128
  onBeforerender = props.onBeforerender,
126
129
  hint = props.hint,
127
130
  arialabel = props.arialabel,
128
- listener = props.listener;
131
+ listener = props.listener,
132
+ _props$updateon = props.updateon,
133
+ updateon = _props$updateon === void 0 ? "keypress" : _props$updateon;
129
134
 
130
135
  // Extract dimensions from props or styles, converting numbers to pixel strings
131
136
  var getDimension = function getDimension(value) {
@@ -159,6 +164,7 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
159
164
  var hiddenInputRef = (0, _react.useRef)(null);
160
165
  var lastValueRef = (0, _react.useRef)(actualValue || "");
161
166
  var isMountedRef = (0, _react.useRef)(true);
167
+ var internalValueRef = (0, _react.useRef)(actualValue || "");
162
168
  var widgetInstance = listener === null || listener === void 0 ? void 0 : listener.Widgets[name];
163
169
 
164
170
  // Memoize editor options
@@ -166,16 +172,15 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
166
172
  return {
167
173
  toolbar: true,
168
174
  placeholder: placeholder,
169
- // minHeight: height ? (typeof height === 'string' && height.endsWith('px') ? parseInt(height, 10) : 100) : 100,
175
+ minHeight: height ? typeof height === "string" && height.endsWith("px") ? parseInt(height, 10) : 100 : 100,
170
176
  width: width,
171
- readOnly: readonly,
172
- disabled: readonly || disabled,
177
+ readonly: readonly,
178
+ disabled: disabled,
173
179
  statusbar: true,
174
- toolbarAdaptive: true,
180
+ toolbarAdaptive: false,
175
181
  askBeforePasteHTML: false,
176
182
  askBeforePasteFromWord: false,
177
- buttons: ["source", "|", "bold", "italic", "underline", "strikethrough", "|", "font", "fontsize", "brush", "paragraph", "|", "superscript", "subscript", "|", "ul", "ol", "|", "outdent", "indent", "|", "align", "undo", "redo", "|", "hr", "eraser", "fullsize", "|", "table", "link", "image", "video"],
178
- removeButtons: ["about"],
183
+ buttons: ["source", "|", "bold", "italic", "underline", "strikethrough", "|", "font", "fontsize", "brush", "paragraph", "|", "superscript", "subscript", "|", "ul", "ol", "|", "outdent", "indent", "|", "align", "undo", "redo", "|", "hr", "eraser", "fullsize", "|", "table", "link", "image", "video", "|", "about"],
179
184
  showXPathInStatusbar: false,
180
185
  showCharsCounter: false,
181
186
  showWordsCounter: false,
@@ -205,8 +210,24 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
205
210
  if (hiddenInputRef.current) {
206
211
  hiddenInputRef.current.value = sanitizedContent;
207
212
  }
213
+ if (props.datavalue === sanitizedContent) {
214
+ return;
215
+ }
216
+ if (onChange && updateon !== "keypress") {
217
+ var _editorRef$current;
218
+ // tempDiv.innerHTML = lastValueRef.current;
219
+ // const old_text_context = tempDiv.textContent || tempDiv.innerText || "";
220
+ var syntheticEvent = {
221
+ target: {
222
+ value: sanitizedContent,
223
+ name: name
224
+ },
225
+ currentTarget: (_editorRef$current = editorRef.current) === null || _editorRef$current === void 0 || (_editorRef$current = _editorRef$current.editor) === null || _editorRef$current === void 0 ? void 0 : _editorRef$current.workplace
226
+ };
227
+ onChange(syntheticEvent, widgetInstance, newContent, sanitizedContent);
228
+ }
208
229
  if (listener !== null && listener !== void 0 && listener.onChange) {
209
- listener.onChange(props.name, {
230
+ listener.onChange(props.fieldName || props.name, {
210
231
  datavalue: sanitizedContent
211
232
  });
212
233
  }
@@ -219,8 +240,8 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
219
240
 
220
241
  // Memoize performEditorOperation
221
242
  var performEditorOperation = (0, _react.useCallback)(function (operation, value) {
222
- var _editorRef$current;
223
- if (!isEditorLoaded || !((_editorRef$current = editorRef.current) !== null && _editorRef$current !== void 0 && _editorRef$current.editor)) {
243
+ var _editorRef$current2;
244
+ if (!isEditorLoaded || !((_editorRef$current2 = editorRef.current) !== null && _editorRef$current2 !== void 0 && _editorRef$current2.editor)) {
224
245
  setOperationStack(function (prev) {
225
246
  return [].concat((0, _toConsumableArray2["default"])(prev), [{
226
247
  type: operation,
@@ -291,20 +312,18 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
291
312
  console.error("Error performing editor operation ".concat(operation, ":"), error);
292
313
  }
293
314
  }, [isEditorLoaded, sanitizeHtml]);
294
-
295
- // Memoize handleOnBeforeRender
296
- var handleOnBeforeRender = (0, _react.useCallback)(function () {
315
+ (0, _react.useEffect)(function () {
297
316
  if (onBeforerender) {
298
- var _editorRef$current2;
317
+ var _editorRef$current3;
299
318
  var syntheticEvent = {
300
319
  target: {
301
320
  value: ""
302
321
  },
303
- currentTarget: (_editorRef$current2 = editorRef.current) === null || _editorRef$current2 === void 0 || (_editorRef$current2 = _editorRef$current2.editor) === null || _editorRef$current2 === void 0 ? void 0 : _editorRef$current2.workplace
322
+ currentTarget: (_editorRef$current3 = editorRef.current) === null || _editorRef$current3 === void 0 || (_editorRef$current3 = _editorRef$current3.editor) === null || _editorRef$current3 === void 0 ? void 0 : _editorRef$current3.workplace
304
323
  };
305
324
  onBeforerender(syntheticEvent, widgetInstance);
306
325
  }
307
- }, [onBeforerender]);
326
+ }, []);
308
327
 
309
328
  // Create a debounced version of handleOnChange
310
329
  var debouncedHandleOnChange = (0, _react.useMemo)(function () {
@@ -313,31 +332,34 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
313
332
  var tempDiv = document.createElement("div");
314
333
  tempDiv.innerHTML = newContent;
315
334
  var new_text_content = tempDiv.textContent || tempDiv.innerText || "";
335
+ internalValueRef.current = new_text_content;
316
336
  if (name && widgetInstance) {
317
337
  widgetInstance.displayValue = new_text_content;
318
338
  }
319
- if (onChange) {
320
- var _editorRef$current3;
321
- tempDiv.innerHTML = lastValueRef.current;
322
- var old_text_context = tempDiv.textContent || tempDiv.innerText || "";
323
- var syntheticEvent = {
324
- target: {
325
- value: new_text_content,
326
- name: name
327
- },
328
- currentTarget: (_editorRef$current3 = editorRef.current) === null || _editorRef$current3 === void 0 || (_editorRef$current3 = _editorRef$current3.editor) === null || _editorRef$current3 === void 0 ? void 0 : _editorRef$current3.workplace
329
- };
330
- onChange(syntheticEvent, widgetInstance, new_text_content, old_text_context);
331
- }
332
- if (name && widgetInstance) {
333
- widgetInstance.datavalue = new_text_content;
334
- }
335
- lastValueRef.current = sanitizedContent;
336
- if (hiddenInputRef.current) {
337
- hiddenInputRef.current.value = sanitizedContent;
339
+ if (updateon === "keypress") {
340
+ if (onChange) {
341
+ var _editorRef$current4;
342
+ tempDiv.innerHTML = lastValueRef.current;
343
+ var old_text_context = tempDiv.textContent || tempDiv.innerText || "";
344
+ var syntheticEvent = {
345
+ target: {
346
+ value: new_text_content,
347
+ name: name
348
+ },
349
+ currentTarget: (_editorRef$current4 = editorRef.current) === null || _editorRef$current4 === void 0 || (_editorRef$current4 = _editorRef$current4.editor) === null || _editorRef$current4 === void 0 ? void 0 : _editorRef$current4.workplace
350
+ };
351
+ onChange(syntheticEvent, widgetInstance, new_text_content, old_text_context);
352
+ }
353
+ if (name && widgetInstance) {
354
+ widgetInstance.datavalue = new_text_content;
355
+ }
356
+ lastValueRef.current = sanitizedContent;
357
+ if (hiddenInputRef.current) {
358
+ hiddenInputRef.current.value = sanitizedContent;
359
+ }
338
360
  }
339
- });
340
- }, [name, listener, onChange, sanitizeHtml]);
361
+ }, parseInt(props.updatedelay || "10"));
362
+ }, [onChange]);
341
363
 
342
364
  // Cleanup debounced function on unmount
343
365
  (0, _react.useEffect)(function () {
@@ -348,9 +370,13 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
348
370
 
349
371
  // Memoize handleEditorInit
350
372
  var handleEditorInit = (0, _react.useCallback)(function () {
351
- var _editorRef$current4;
373
+ var _editorRef$current5;
352
374
  setIsEditorLoaded(true);
353
- if ((_editorRef$current4 = editorRef.current) !== null && _editorRef$current4 !== void 0 && _editorRef$current4.editor) {
375
+ if ((_editorRef$current5 = editorRef.current) !== null && _editorRef$current5 !== void 0 && _editorRef$current5.editor) {
376
+ // Initialize content explicitly to avoid relying on value prop
377
+ if (content !== undefined && content !== null) {
378
+ editorRef.current.editor.value = content === null || content === void 0 ? void 0 : content.toString();
379
+ }
354
380
  if (height) {
355
381
  var heightValue = typeof height === "string" && height.endsWith("px") ? parseInt(height, 10) : height;
356
382
  performEditorOperation("height", heightValue);
@@ -372,11 +398,11 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
372
398
  return _objectSpread(_objectSpread({}, editorOptions), {}, {
373
399
  tabIndex: tabindex,
374
400
  events: {
375
- change: debouncedHandleOnChange,
376
- beforeInit: handleOnBeforeRender
401
+ ready: handleEditorInit
402
+ // afterInit: handleEditorInit,
377
403
  }
378
404
  });
379
- }, [editorOptions, tabindex, debouncedHandleOnChange, handleOnBeforeRender]);
405
+ }, [editorOptions, tabindex, handleEditorInit]);
380
406
 
381
407
  // Memoize the component's JSX
382
408
  var editorJSX = (0, _react.useMemo)(function () {
@@ -386,23 +412,23 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
386
412
  style: {
387
413
  width: width
388
414
  },
389
- height: styles === null || styles === void 0 ? void 0 : styles.height
415
+ height: styles === null || styles === void 0 ? void 0 : styles.height,
416
+ "aria-readonly": readonly,
417
+ hidden: props.hidden
390
418
  }, __jsx(_joditReact["default"], {
391
419
  ref: editorRef,
392
- value: content.toString(),
420
+ value: content === null || content === void 0 ? void 0 : content.toString(),
393
421
  config: editorConfig,
394
422
  onBlur: handleEditorBlur,
395
- onChange: function onChange() {} // Empty onChange as we handle it in config
396
- ,
397
- onReady: handleEditorInit
423
+ onChange: debouncedHandleOnChange
398
424
  }), __jsx(HiddenInput, {
399
425
  ref: hiddenInputRef,
400
426
  className: "model-holder",
401
427
  disabled: disabled,
402
- value: content.toString(),
428
+ value: content === null || content === void 0 ? void 0 : content.toString(),
403
429
  name: name,
404
430
  readOnly: true
405
- })), showpreview && __jsx(PreviewContainer, {
431
+ })), (0, _util.toBoolean)(showpreview) && __jsx(PreviewContainer, {
406
432
  className: "ta-preview",
407
433
  style: {
408
434
  width: width
@@ -442,16 +468,16 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
442
468
 
443
469
  // Handle datavalue changes
444
470
  (0, _react.useEffect)(function () {
445
- if (datavalue != lastValueRef.current) {
471
+ if (datavalue != internalValueRef.current) {
446
472
  setContent(datavalue);
447
- lastValueRef.current = datavalue;
473
+ internalValueRef.current = datavalue;
448
474
  }
449
475
  }, [datavalue]);
450
476
 
451
477
  // Initialize editor and handle prop changes
452
478
  (0, _react.useEffect)(function () {
453
- var _editorRef$current5;
454
- if ((_editorRef$current5 = editorRef.current) !== null && _editorRef$current5 !== void 0 && _editorRef$current5.editor && isEditorLoaded) {
479
+ var _editorRef$current6;
480
+ if ((_editorRef$current6 = editorRef.current) !== null && _editorRef$current6 !== void 0 && _editorRef$current6.editor && isEditorLoaded) {
455
481
  // Handle readonly/disabled state changes
456
482
  if (readonly || disabled) {
457
483
  performEditorOperation("disable");
@@ -477,41 +503,6 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
477
503
  }
478
504
  }, [readonly, disabled, placeholder, height, width, performEditorOperation, isEditorLoaded]);
479
505
 
480
- // Expose editor methods to parent components
481
- (0, _react.useImperativeHandle)(ref, function () {
482
- return {
483
- // Get current HTML content
484
- htmlcontent: function htmlcontent() {
485
- return performEditorOperation("code");
486
- },
487
- // Get current selection position
488
- getCurrentPosition: function getCurrentPosition() {
489
- return performEditorOperation("createRange");
490
- },
491
- // Undo last operation
492
- undo: function undo() {
493
- return performEditorOperation("undo");
494
- },
495
- // Focus the editor
496
- focus: function focus() {
497
- return performEditorOperation("focus");
498
- },
499
- // Get editor instance
500
- getEditor: function getEditor() {
501
- var _editorRef$current6;
502
- return (_editorRef$current6 = editorRef.current) === null || _editorRef$current6 === void 0 ? void 0 : _editorRef$current6.editor;
503
- },
504
- // Set editor content
505
- setContent: function setContent(newContent) {
506
- performEditorOperation("code", newContent);
507
- },
508
- // Perform custom editor operation
509
- performOperation: function performOperation(operation, value) {
510
- return performEditorOperation(operation, value);
511
- }
512
- };
513
- });
514
-
515
506
  // Clean up on unmount
516
507
  (0, _react.useEffect)(function () {
517
508
  isMountedRef.current = true;
@@ -520,7 +511,8 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
520
511
  isMountedRef.current = false;
521
512
  if ((_editorRef$current7 = editorRef.current) !== null && _editorRef$current7 !== void 0 && _editorRef$current7.editor) {
522
513
  try {
523
- editorRef.current.editor.destruct();
514
+ var _editorRef$current8;
515
+ editorRef === null || editorRef === void 0 || (_editorRef$current8 = editorRef.current) === null || _editorRef$current8 === void 0 || (_editorRef$current8 = _editorRef$current8.editor) === null || _editorRef$current8 === void 0 || _editorRef$current8.destruct();
524
516
  } catch (error) {
525
517
  console.error("Error destructing editor:", error);
526
518
  }
@@ -528,6 +520,15 @@ var WmRichTextEditor = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref)
528
520
  };
529
521
  }, []);
530
522
  return editorJSX;
523
+ };
524
+ WmRichTextEditorBase.displayName = "WmRichTextEditor";
525
+
526
+ // Memoize editor to avoid unnecessary re-renders from changing handler identities
527
+ var WmRichTextEditor = /*#__PURE__*/_react["default"].memo(WmRichTextEditorBase, function (prev, next) {
528
+ // Core props that should trigger a re-render when changed
529
+ var keys = ["datavalue", "readonly", "disabled", "placeholder", "tabindex", "showpreview", "hint", "arialabel", "hidden", "name"];
530
+ return keys.every(function (key) {
531
+ return lodash.isEqual(prev[key], next[key]);
532
+ });
531
533
  });
532
- WmRichTextEditor.displayName = "WmRichTextEditor";
533
- var _default = exports["default"] = /*#__PURE__*/_react["default"].memo((0, _withBaseWrapper.withBaseWrapper)(WmRichTextEditor));
534
+ var _default = exports["default"] = (0, _withBaseWrapper.withBaseWrapper)((0, _withFormController["default"])(WmRichTextEditor));