@wavemaker-ai/react-runtime 1.0.0-rc.647684 → 12.0.0-rc.335

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 (215) hide show
  1. package/components/advanced/carousel/index.d.ts +1 -0
  2. package/components/advanced/carousel/template.d.ts +1 -0
  3. package/components/advanced/login/index.d.ts +1 -0
  4. package/components/advanced/marquee/index.d.ts +1 -0
  5. package/components/basic/anchor/index.d.ts +1 -0
  6. package/components/basic/anchor/index.js +3 -5
  7. package/components/basic/audio/index.d.ts +1 -0
  8. package/components/basic/html/index.d.ts +1 -0
  9. package/components/basic/icon/index.d.ts +1 -0
  10. package/components/basic/iframe/index.d.ts +1 -0
  11. package/components/basic/label/index.d.ts +1 -0
  12. package/components/basic/picture/index.d.ts +1 -0
  13. package/components/basic/progress-bar/index.d.ts +1 -0
  14. package/components/basic/progress-circle/index.d.ts +1 -0
  15. package/components/basic/richtexteditor/index.d.ts +3 -0
  16. package/components/basic/search/index.js +5 -4
  17. package/components/basic/search/utils.d.ts +1 -0
  18. package/components/basic/search/utils.js +9 -0
  19. package/components/basic/spinner/index.d.ts +1 -0
  20. package/components/basic/tile/index.d.ts +1 -0
  21. package/components/basic/tree/index.d.ts +1 -0
  22. package/components/basic/video/index.d.ts +1 -0
  23. package/components/chart/index.d.ts +1 -0
  24. package/components/common/index.d.ts +2 -0
  25. package/components/common/index.js +2 -0
  26. package/components/common/partial-content-wrapper.d.ts +15 -0
  27. package/components/common/partial-content-wrapper.js +11 -0
  28. package/components/container/accordion/accordion-pane/index.d.ts +1 -0
  29. package/components/container/accordion/index.d.ts +1 -0
  30. package/components/container/index.d.ts +4 -0
  31. package/components/container/index.js +38 -11
  32. package/components/container/layout-grid/grid-column/index.d.ts +1 -0
  33. package/components/container/layout-grid/grid-row/index.d.ts +1 -0
  34. package/components/container/layout-grid/index.d.ts +1 -0
  35. package/components/container/layout-grid/index.js +1 -1
  36. package/components/container/linear-layout/index.d.ts +1 -0
  37. package/components/container/linear-layout/linear-layout-item/index.d.ts +1 -0
  38. package/components/container/panel/index.d.ts +1 -0
  39. package/components/container/props.d.ts +1 -0
  40. package/components/container/repeat-template/index.d.ts +1 -0
  41. package/components/container/repeat-template/index.js +1 -1
  42. package/components/container/tabs/index.d.ts +1 -0
  43. package/components/container/tabs/index.js +12 -8
  44. package/components/container/tabs/tab-pane/index.d.ts +1 -0
  45. package/components/container/tabs/tab-pane/index.js +2 -2
  46. package/components/container/wizard/index.d.ts +2 -0
  47. package/components/container/wizard/index.js +92 -43
  48. package/components/container/wizard/props.d.ts +2 -2
  49. package/components/container/wizard/wizard-step/index.d.ts +1 -0
  50. package/components/data/card/card-actions/index.d.ts +1 -0
  51. package/components/data/card/card-content/index.d.ts +1 -0
  52. package/components/data/card/card-footer/index.d.ts +1 -0
  53. package/components/data/card/index.d.ts +1 -0
  54. package/components/data/form/base-form/hooks/useFormOperations.d.ts +1 -1
  55. package/components/data/form/base-form/hooks/useFormOperations.js +5 -2
  56. package/components/data/form/base-form/index.js +10 -14
  57. package/components/data/form/base-form/props.d.ts +1 -0
  58. package/components/data/form/dynamic-fields/WmxDynamicFormField.js +9 -23
  59. package/components/data/form/form-action/index.d.ts +2 -0
  60. package/components/data/form/form-controller/props.d.ts +2 -0
  61. package/components/data/form/form-controller/utils.js +3 -2
  62. package/components/data/form/form-controller/validation-contrustor.js +112 -1
  63. package/components/data/form/form-controller/withFormController.js +16 -3
  64. package/components/data/form/form-field/index.js +38 -11
  65. package/components/data/form/form-field/props.d.ts +8 -2
  66. package/components/data/list/components/ListItemWithTemplate.js +1 -1
  67. package/components/data/list/index.d.ts +2 -0
  68. package/components/data/list/index.js +5 -10
  69. package/components/data/pagination/hooks/usePagination.js +6 -6
  70. package/components/data/table/components/EditableCell.js +47 -24
  71. package/components/data/table/components/FieldValidationError.js +1 -1
  72. package/components/data/table/components/RowExpansionButton.js +5 -1
  73. package/components/data/table/components/TableBody.js +2 -0
  74. package/components/data/table/components/TableHeader.js +12 -4
  75. package/components/data/table/hooks/useFormWidget.js +13 -2
  76. package/components/data/table/hooks/usePanelStructure.js +6 -1
  77. package/components/data/table/hooks/useResponsiveColumns.d.ts +1 -0
  78. package/components/data/table/hooks/useRowHandlers.js +1 -1
  79. package/components/data/table/hooks/useRowSelection.js +65 -4
  80. package/components/data/table/hooks/useTableData.js +10 -2
  81. package/components/data/table/hooks/useTableEdit.d.ts +1 -1
  82. package/components/data/table/hooks/useTableEdit.js +115 -75
  83. package/components/data/table/hooks/useTableEditForms.d.ts +25 -0
  84. package/components/data/table/hooks/useTableEditForms.js +30 -0
  85. package/components/data/table/index.d.ts +2 -0
  86. package/components/data/table/index.js +82 -45
  87. package/components/data/table/live-table/index.d.ts +1 -0
  88. package/components/data/table/props.d.ts +43 -23
  89. package/components/data/table/table-action/index.d.ts +1 -0
  90. package/components/data/table/table-column/index.d.ts +1 -0
  91. package/components/data/table/table-row/index.d.ts +1 -0
  92. package/components/data/table/table-row-action/index.d.ts +1 -0
  93. package/components/data/table/utils/buildSelectionColumns.js +19 -24
  94. package/components/data/table/utils/columnProxy.d.ts +7 -1
  95. package/components/data/table/utils/columnProxy.js +21 -1
  96. package/components/data/table/utils/columnValidation.d.ts +19 -0
  97. package/components/data/table/utils/columnValidation.js +76 -0
  98. package/components/data/table/utils/constants.d.ts +2 -0
  99. package/components/data/table/utils/constants.js +2 -0
  100. package/components/data/table/utils/crud-handlers.js +3 -1
  101. package/components/data/table/utils/expansionColumn.js +1 -1
  102. package/components/data/table/utils/index.d.ts +14 -15
  103. package/components/data/table/utils/index.js +18 -85
  104. package/components/data/table/utils/selectionUtils.d.ts +12 -0
  105. package/components/data/table/utils/selectionUtils.js +23 -5
  106. package/components/dialogs/alert-dialog/index.d.ts +2 -0
  107. package/components/dialogs/confirm-dialog/index.d.ts +2 -0
  108. package/components/dialogs/dialog/index.d.ts +2 -0
  109. package/components/dialogs/dialog-actions/index.d.ts +1 -0
  110. package/components/dialogs/dialog-body/index.d.ts +1 -0
  111. package/components/dialogs/dialog-content/index.d.ts +1 -0
  112. package/components/dialogs/dialog-header/index.d.ts +1 -0
  113. package/components/dialogs/iframe-dialog/index.d.ts +2 -0
  114. package/components/dialogs/login-dialog/index.d.ts +2 -0
  115. package/components/dialogs/page-dialog/index.d.ts +2 -0
  116. package/components/dialogs/withDialogWrapper.js +12 -2
  117. package/components/form/button/index.d.ts +1 -0
  118. package/components/form/button-group/index.d.ts +1 -0
  119. package/components/input/calendar/index.d.ts +2 -0
  120. package/components/input/chips/index.d.ts +3 -0
  121. package/components/input/color-picker/index.d.ts +3 -0
  122. package/components/input/composite/index.d.ts +1 -0
  123. package/components/input/composite/index.js +32 -6
  124. package/components/input/currency/index.d.ts +1 -0
  125. package/components/input/default/checkbox/index.d.ts +3 -0
  126. package/components/input/default/checkboxset/index.d.ts +3 -0
  127. package/components/input/default/radioset/index.d.ts +3 -0
  128. package/components/input/default/switch/index.d.ts +3 -0
  129. package/components/input/epoch/date/index.d.ts +1 -0
  130. package/components/input/epoch/datetime/index.d.ts +1 -0
  131. package/components/input/epoch/datetime/index.js +13 -3
  132. package/components/input/epoch/time/index.d.ts +1 -0
  133. package/components/input/fileupload/index.d.ts +1 -0
  134. package/components/input/fileupload/index.js +2 -1
  135. package/components/input/number/index.d.ts +3 -0
  136. package/components/input/rating/index.d.ts +3 -0
  137. package/components/input/select/index.d.ts +1 -0
  138. package/components/input/slider/index.d.ts +3 -0
  139. package/components/input/text/index.d.ts +3 -0
  140. package/components/input/text/index.js +9 -2
  141. package/components/input/textarea/index.d.ts +3 -0
  142. package/components/input/upload/index.d.ts +3 -0
  143. package/components/layout/footer/index.js +4 -2
  144. package/components/layout/footer/props.d.ts +1 -0
  145. package/components/layout/header/index.js +29 -3
  146. package/components/layout/header/props.d.ts +1 -0
  147. package/components/layout/leftnav/index.js +22 -6
  148. package/components/layout/leftnav/props.d.ts +1 -0
  149. package/components/layout/leftnav/utils/page-class-util.d.ts +1 -0
  150. package/components/layout/leftnav/utils/page-class-util.js +4 -3
  151. package/components/layout/rightnav/index.js +4 -2
  152. package/components/layout/rightnav/props.d.ts +1 -0
  153. package/components/layout/topnav/index.js +4 -2
  154. package/components/layout/topnav/props.d.ts +1 -0
  155. package/components/navbar/index.d.ts +1 -0
  156. package/components/navbar/index.js +32 -7
  157. package/components/navbar/nav-item/index.d.ts +1 -0
  158. package/components/navigation/breadcrumb/index.d.ts +1 -0
  159. package/components/navigation/menu/index.d.ts +1 -0
  160. package/components/navigation/menu/index.js +19 -11
  161. package/components/navigation/menu/props.d.ts +1 -0
  162. package/components/navigation/popover/index.d.ts +1 -0
  163. package/components/navigation/popover/index.js +15 -3
  164. package/components/page/index.js +60 -19
  165. package/components/page/page-context.d.ts +4 -0
  166. package/components/page/partial/index.d.ts +1 -0
  167. package/context/PopoverContext.d.ts +5 -0
  168. package/context/PopoverContext.js +5 -0
  169. package/context/WidgetProvider.js +9 -2
  170. package/core/proxy-service.d.ts +2 -0
  171. package/core/proxy-service.js +132 -22
  172. package/higherOrder/BaseApp.js +3 -2
  173. package/higherOrder/BasePage.js +4 -10
  174. package/higherOrder/props.d.ts +1 -0
  175. package/higherOrder/useActivePageReactivity.js +1 -4
  176. package/higherOrder/withBaseWrapper.js +12 -3
  177. package/hooks/useHttp.d.ts +14 -4
  178. package/hooks/useHttp.js +47 -9
  179. package/package-lock.json +332 -325
  180. package/package.json +3 -3
  181. package/runtime-dynamic/App.js +21 -2
  182. package/runtime-dynamic/app-initializer.js +8 -1
  183. package/runtime-dynamic/components/PageWrapper.js +1 -1
  184. package/runtime-dynamic/components/PrefabPreview.js +1 -1
  185. package/runtime-dynamic/components/partial-content.js +17 -1
  186. package/runtime-dynamic/factories/build-base-page-like-component.js +11 -7
  187. package/runtime-dynamic/factories/dynamic-component.js +5 -10
  188. package/runtime-dynamic/main.d.ts +1 -0
  189. package/runtime-dynamic/main.js +9 -1
  190. package/runtime-dynamic/routes.js +17 -8
  191. package/runtime-dynamic/services/compile-render.js +7 -0
  192. package/runtime-dynamic/services/css-scoping.d.ts +1 -1
  193. package/runtime-dynamic/services/css-scoping.js +2 -2
  194. package/runtime-dynamic/services/variable-factory.js +2 -1
  195. package/runtime-dynamic/services/variable-transpiler.js +4 -1
  196. package/runtime-dynamic/wmx-shared.d.ts +40 -0
  197. package/runtime-dynamic/wmx-shared.js +33 -0
  198. package/utils/page-params-util.js +22 -1
  199. package/utils/partial-host-util.d.ts +40 -0
  200. package/utils/partial-host-util.js +41 -0
  201. package/utils/style-utils.js +1 -1
  202. package/utils/wmx.utils.d.ts +0 -1
  203. package/utils/wmx.utils.js +0 -25
  204. package/variables/crud-variable.d.ts +10 -0
  205. package/variables/crud-variable.js +53 -2
  206. package/variables/live-variable.d.ts +1 -0
  207. package/variables/live-variable.js +2 -1
  208. package/variables/model-variable.d.ts +2 -0
  209. package/variables/model-variable.js +14 -0
  210. package/variables/operation-params.d.ts +29 -0
  211. package/variables/operation-params.js +69 -0
  212. package/variables/service-variable.d.ts +9 -0
  213. package/variables/service-variable.js +21 -2
  214. package/components/data/table/utils/validation.d.ts +0 -13
  215. package/components/data/table/utils/validation.js +0 -82
@@ -27,7 +27,35 @@ import { ServiceVariable } from "../variables/service-variable";
27
27
  import LiveVariable from "../variables/live-variable";
28
28
  import { ModelVariable } from "../variables/model-variable";
29
29
  import CrudVariable from "../variables/crud-variable";
30
+ const NON_PROXYABLE_TAGS = /* @__PURE__ */ new Set([
31
+ "[object AbortController]",
32
+ "[object AbortSignal]",
33
+ "[object ArrayBuffer]",
34
+ "[object Blob]",
35
+ "[object Date]",
36
+ "[object Error]",
37
+ "[object File]",
38
+ "[object FileList]",
39
+ "[object FormData]",
40
+ "[object Headers]",
41
+ "[object Map]",
42
+ "[object Promise]",
43
+ "[object RegExp]",
44
+ "[object Request]",
45
+ "[object Response]",
46
+ "[object Set]",
47
+ "[object SharedArrayBuffer]",
48
+ "[object URL]",
49
+ "[object URLSearchParams]",
50
+ "[object WeakMap]",
51
+ "[object WeakRef]",
52
+ "[object WeakSet]"
53
+ ]);
54
+ const isNonProxyableBuiltin = (value) => NON_PROXYABLE_TAGS.has(Object.prototype.toString.call(value)) || // Covers every TypedArray flavour plus DataView in one check.
55
+ ArrayBuffer.isView(value);
30
56
  const proxyMap = /* @__PURE__ */ new WeakMap();
57
+ const stateProxyMap = /* @__PURE__ */ new WeakMap();
58
+ const isKnownProxy = (value) => proxyMap.has(value) || stateProxyMap.has(value);
31
59
  const pageWidgetProxyCaches = /* @__PURE__ */ new WeakMap();
32
60
  function clearPageWidgetProxyCache(widgetsProxy) {
33
61
  var _a;
@@ -92,6 +120,7 @@ function queueBatchedWidgetContextUpdate(widgetName, widget, prop, value, setPag
92
120
  }
93
121
  }
94
122
  const originalTargets = /* @__PURE__ */ new WeakMap();
123
+ const objectsBeingProxied = /* @__PURE__ */ new WeakSet();
95
124
  const MUTATING_ARRAY_METHODS = [
96
125
  "push",
97
126
  "pop",
@@ -209,6 +238,7 @@ const createWidgetProxy = (widget, widgetName, setPageContext, overriddenPropsRe
209
238
  widget.__isProxy = true;
210
239
  const proxy = new Proxy(widget, {
211
240
  set(target, prop, value, receiver) {
241
+ var _a;
212
242
  if (typeof prop === "symbol" || prop === "prototype") {
213
243
  return Reflect.set(target, prop, value, receiver);
214
244
  }
@@ -224,10 +254,21 @@ const createWidgetProxy = (widget, widgetName, setPageContext, overriddenPropsRe
224
254
  }
225
255
  Reflect.set(target, prop, value, receiver);
226
256
  queueBatchedWidgetContextUpdate(widgetName, widget, prop, value, setPageContext);
257
+ if (prop === "className") {
258
+ Reflect.set(target, "class", value);
259
+ (_a = overriddenPropsRegistry == null ? void 0 : overriddenPropsRegistry.trackOverriddenProps) == null ? void 0 : _a.call(
260
+ overriddenPropsRegistry,
261
+ widgetName,
262
+ "class",
263
+ value,
264
+ widget["data-widget-id"]
265
+ );
266
+ queueBatchedWidgetContextUpdate(widgetName, widget, "class", value, setPageContext);
267
+ }
227
268
  return true;
228
269
  },
229
270
  get(target, prop, receiver) {
230
- var _a;
271
+ var _a, _b, _c, _d;
231
272
  if (typeof prop === "symbol" || prop === "prototype") {
232
273
  return Reflect.get(target, prop, receiver);
233
274
  }
@@ -302,6 +343,10 @@ const createWidgetProxy = (widget, widgetName, setPageContext, overriddenPropsRe
302
343
  );
303
344
  return internalValue !== void 0 ? internalValue : widgetOverrides[prop];
304
345
  }
346
+ if (prop === "class" || prop === "className") {
347
+ const resolved = (_d = (_c = (_b = widgetOverrides == null ? void 0 : widgetOverrides.class) != null ? _b : Reflect.get(target, "class", receiver)) != null ? _c : widgetOverrides == null ? void 0 : widgetOverrides.className) != null ? _d : Reflect.get(target, "className", receiver);
348
+ return resolved != null ? resolved : "";
349
+ }
305
350
  if (isDOMElement(value)) {
306
351
  return value;
307
352
  }
@@ -347,7 +392,10 @@ const createPageProxy = (target, setPageContext, overriddenPropsRegistry) => {
347
392
  }
348
393
  return proxy2;
349
394
  }
350
- const proxy = widget ? createWidgetProxy(widget, widgetName, setPageContext, overriddenPropsRegistry) : void 0;
395
+ if (!widget) {
396
+ return void 0;
397
+ }
398
+ const proxy = createWidgetProxy(widget, widgetName, setPageContext, overriddenPropsRegistry);
351
399
  widgetProxies.set(widgetName, proxy);
352
400
  return proxy;
353
401
  },
@@ -356,24 +404,23 @@ const createPageProxy = (target, setPageContext, overriddenPropsRegistry) => {
356
404
  return true;
357
405
  }
358
406
  widgetsTarget[widgetName] = widgetValue;
359
- if (widgetProxies.has(widgetName)) {
360
- const proxy = widgetProxies.get(widgetName);
361
- const originalTarget = originalTargets.get(proxy);
362
- if (widgetValue && typeof widgetValue === "object") {
363
- for (const key in widgetValue) {
364
- const newVal = widgetValue[key];
365
- const oldVal = originalTarget[key];
366
- if (oldVal !== newVal) {
367
- Reflect.defineProperty(originalTarget, key, {
368
- value: newVal,
369
- writable: true,
370
- configurable: true,
371
- enumerable: true
372
- });
373
- }
407
+ const isObjectValue = !!widgetValue && typeof widgetValue === "object";
408
+ const cachedProxy = widgetProxies.get(widgetName);
409
+ const originalTarget = cachedProxy ? originalTargets.get(cachedProxy) : void 0;
410
+ if (originalTarget && isObjectValue) {
411
+ for (const key in widgetValue) {
412
+ const newVal = widgetValue[key];
413
+ const oldVal = originalTarget[key];
414
+ if (oldVal !== newVal) {
415
+ Reflect.defineProperty(originalTarget, key, {
416
+ value: newVal,
417
+ writable: true,
418
+ configurable: true,
419
+ enumerable: true
420
+ });
374
421
  }
375
422
  }
376
- } else if (widgetValue && typeof widgetValue === "object") {
423
+ } else if (isObjectValue) {
377
424
  const proxy = createWidgetProxy(
378
425
  widgetValue,
379
426
  widgetName,
@@ -381,6 +428,8 @@ const createPageProxy = (target, setPageContext, overriddenPropsRegistry) => {
381
428
  overriddenPropsRegistry
382
429
  );
383
430
  widgetProxies.set(widgetName, proxy);
431
+ } else {
432
+ widgetProxies.delete(widgetName);
384
433
  }
385
434
  return true;
386
435
  }
@@ -388,15 +437,68 @@ const createPageProxy = (target, setPageContext, overriddenPropsRegistry) => {
388
437
  pageWidgetProxyCaches.set(widgetsProxy, widgetProxies);
389
438
  return widgetsProxy;
390
439
  };
440
+ const dataSetRaw = /* @__PURE__ */ new WeakMap();
391
441
  const wrapVariableProxy = (variable, path, varName, setPageContext) => {
392
442
  if (proxyMap.has(variable)) {
393
443
  return variable;
394
444
  }
395
- const varProxy = new Proxy(variable, {
445
+ const dataSetProxies = /* @__PURE__ */ new WeakMap();
446
+ let varProxy;
447
+ const refreshDataSet = () => {
448
+ const dataSet = variable.dataSet;
449
+ varProxy.dataSet = Array.isArray(dataSet) ? [...dataSet] : __spreadValues({}, dataSet);
450
+ };
451
+ const createDataSetProxy = (value, isRootDataSet = false) => {
452
+ if (typeof value !== "object" || value === null || isNonProxyableBuiltin(value)) {
453
+ return value;
454
+ }
455
+ const cached = dataSetProxies.get(value);
456
+ if (cached) return cached;
457
+ const proxy = new Proxy(value, {
458
+ get(target, prop, receiver) {
459
+ const nestedValue = Reflect.get(target, prop, receiver);
460
+ if (Array.isArray(target) && typeof prop === "string" && MUTATING_ARRAY_METHODS.includes(prop) && typeof nestedValue === "function") {
461
+ return (...args) => {
462
+ const mutationTarget = isRootDataSet ? variable.dataSet : target;
463
+ const result = Reflect.get(mutationTarget, prop).apply(mutationTarget, args);
464
+ refreshDataSet();
465
+ return result;
466
+ };
467
+ }
468
+ return createDataSetProxy(nestedValue);
469
+ },
470
+ set(target, prop, value2) {
471
+ const mutationTarget = isRootDataSet ? variable.dataSet : target;
472
+ if (Reflect.get(mutationTarget, prop) === value2) {
473
+ return true;
474
+ }
475
+ const result = Reflect.set(mutationTarget, prop, value2);
476
+ refreshDataSet();
477
+ return result;
478
+ },
479
+ deleteProperty(target, prop) {
480
+ const result = Reflect.deleteProperty(isRootDataSet ? variable.dataSet : target, prop);
481
+ refreshDataSet();
482
+ return result;
483
+ }
484
+ });
485
+ dataSetProxies.set(value, proxy);
486
+ dataSetRaw.set(proxy, value);
487
+ return proxy;
488
+ };
489
+ varProxy = new Proxy(variable, {
490
+ get(target, prop, receiver) {
491
+ const value = Reflect.get(target, prop, receiver);
492
+ return prop === "dataSet" ? createDataSetProxy(value, true) : value;
493
+ },
396
494
  set(target, prop, value, receiver) {
397
495
  if (typeof prop === "symbol") {
398
496
  return Reflect.set(target, prop, value, receiver);
399
497
  }
498
+ if (prop === "dataSet" && dataSetRaw.has(value)) {
499
+ const raw = dataSetRaw.get(value);
500
+ value = Array.isArray(raw) ? [...raw] : __spreadValues({}, raw);
501
+ }
400
502
  const prevVal = Reflect.get(target, prop, receiver);
401
503
  const result = Reflect.set(target, prop, value, receiver);
402
504
  if (prevVal !== value) {
@@ -420,8 +522,12 @@ const wrapVariableProxy = (variable, path, varName, setPageContext) => {
420
522
  return varProxy;
421
523
  };
422
524
  const createStateProxy = (obj, path = [], setPageContext, overriddenPropsRegistry) => {
525
+ if (isKnownProxy(obj) || objectsBeingProxied.has(obj)) {
526
+ return obj;
527
+ }
423
528
  const nestedProxies = /* @__PURE__ */ new Map();
424
- return new Proxy(obj, {
529
+ objectsBeingProxied.add(obj);
530
+ const proxy = new Proxy(obj, {
425
531
  get(target, prop, receiver) {
426
532
  if (prop === "eval") {
427
533
  return (fn, failOnError = false) => {
@@ -487,7 +593,7 @@ const createStateProxy = (obj, path = [], setPageContext, overriddenPropsRegistr
487
593
  if (isDOMElement(value)) {
488
594
  return value;
489
595
  }
490
- if (value instanceof Map || value instanceof Date) {
596
+ if (isNonProxyableBuiltin(value)) {
491
597
  return value;
492
598
  }
493
599
  if (Array.isArray(value)) {
@@ -549,6 +655,9 @@ const createStateProxy = (obj, path = [], setPageContext, overriddenPropsRegistr
549
655
  return true;
550
656
  }
551
657
  });
658
+ stateProxyMap.set(proxy, true);
659
+ objectsBeingProxied.delete(obj);
660
+ return proxy;
552
661
  };
553
662
  const getFormFieldEntries = (formfields) => {
554
663
  const canonicalKeyByField = /* @__PURE__ */ new Map();
@@ -606,5 +715,6 @@ export {
606
715
  createWidgetProxy,
607
716
  defineFieldAlias,
608
717
  getFormFieldEntries,
609
- getFormFieldList
718
+ getFormFieldList,
719
+ isNonProxyableBuiltin
610
720
  };
@@ -79,7 +79,8 @@ const BaseApp = (WrappedComponent, addAppScript, getAppVariables, appInfo = {})
79
79
  subscribe,
80
80
  targetPlatform: "WEB",
81
81
  hasOwnObjectProperty,
82
- formatters
82
+ formatters,
83
+ i18nService
83
84
  }), appInfo), i18nServiceActions), i18nService));
84
85
  const appProxyRef = useRef(null);
85
86
  const sessionFailureRequestsRef = useRef([]);
@@ -353,7 +354,7 @@ const BaseApp = (WrappedComponent, addAppScript, getAppVariables, appInfo = {})
353
354
  showTypeLabel: showTypeLabel != null ? showTypeLabel : false
354
355
  });
355
356
  notificationAction.config.paramProvider = newParams;
356
- notificationAction.invoke();
357
+ notificationAction.invoke(__spreadValues({ message }, newParams()));
357
358
  } else {
358
359
  console.warn(
359
360
  `The default Action "appNotification" doesn't exist in the app. App notified following error:
@@ -154,7 +154,8 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
154
154
  formatMessage,
155
155
  overriddenPropsRegistryRef: overriddenPropsRegistryRef.current,
156
156
  layoutReady,
157
- activePageName: componentInfo == null ? void 0 : componentInfo.componentName
157
+ activePageName: componentInfo == null ? void 0 : componentInfo.componentName,
158
+ pageName: componentInfo == null ? void 0 : componentInfo.componentName
158
159
  }));
159
160
  useActivePageReactivity({
160
161
  componentType: componentInfo == null ? void 0 : componentInfo.componentType,
@@ -259,10 +260,7 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
259
260
  pageProxyRef.current.Variables = updatedVariables;
260
261
  pageProxyRef.current.Actions = updatedActions;
261
262
  return __spreadProps(__spreadValues({}, prev), {
262
- App: __spreadProps(__spreadValues({}, prev.App), {
263
- Variables: appContext.Variables || {},
264
- Actions: appContext.Actions || {}
265
- }),
263
+ App: appProxy != null ? appProxy : prev.App,
266
264
  Variables: updatedVariables,
267
265
  Actions: updatedActions
268
266
  });
@@ -610,11 +608,7 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
610
608
  const pageName = (appProxy == null ? void 0 : appProxy.activePageName) || "";
611
609
  useEffect(() => {
612
610
  if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PARTIAL" && pageName) {
613
- setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
614
- App: __spreadProps(__spreadValues({}, prev.App), {
615
- activePageName: pageName
616
- })
617
- }));
611
+ setPageContext((prev) => __spreadValues({}, prev));
618
612
  }
619
613
  }, [pageName]);
620
614
  useEffect(() => {
@@ -15,6 +15,7 @@ export interface Props {
15
15
  width?: number | string;
16
16
  height?: number | string;
17
17
  className?: string;
18
+ class?: string;
18
19
  conditionalstyle?: CSSProperties;
19
20
  conditionalclass?: string;
20
21
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -1,7 +1,5 @@
1
1
  "use client";
2
2
  var __defProp = Object.defineProperty;
3
- var __defProps = Object.defineProperties;
4
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
5
3
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
@@ -17,7 +15,6 @@ var __spreadValues = (a, b) => {
17
15
  }
18
16
  return a;
19
17
  };
20
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
21
18
  import { useEffect, useRef } from "react";
22
19
  import { EVENTEMITTER_METHODS } from "../core/constants/events";
23
20
  const resolvePath = (root, path) => path.split(".").reduce((obj, key) => obj == null ? void 0 : obj[key], root);
@@ -41,7 +38,7 @@ const useActivePageReactivity = ({
41
38
  const next = readValues();
42
39
  if (next.some((value, i) => !Object.is(value, snapshotRef.current[i]))) {
43
40
  snapshotRef.current = next;
44
- setPageContext((prev) => __spreadProps(__spreadValues({}, prev), { App: __spreadValues({}, prev.App) }));
41
+ setPageContext((prev) => __spreadValues({}, prev));
45
42
  }
46
43
  };
47
44
  EVENTEMITTER_METHODS.ACTIVE_PAGE_SYNC_ON(onActivePageChange);
@@ -31,7 +31,7 @@ var __objRest = (source, exclude) => {
31
31
  return target;
32
32
  };
33
33
  import { createElement } from "react";
34
- import React, { useEffect, useMemo, useCallback } from "react";
34
+ import React, { useEffect, useMemo, useCallback, useRef } from "react";
35
35
  import isEqual from "lodash-es/isEqual";
36
36
  import { useDeviceVisibility } from "../hooks/useDeviceVisibility";
37
37
  import { usePageContext } from "../context/WidgetProvider";
@@ -40,11 +40,19 @@ const withBaseWrapper = (WrappedComponent) => {
40
40
  const WithBaseComponent = (props) => {
41
41
  var _b, _c, _d;
42
42
  const _a = props, { show = true, deferload, standalone = false } = _a, rest = __objRest(_a, ["show", "deferload", "standalone"]);
43
+ const previousDataValueRef = useRef(props.datavalue);
43
44
  const name = props["item-id"] || props.name;
44
45
  const { pageContext, updateWidgetState, destroy, proxy } = usePageContext(standalone);
45
46
  const { isHidden } = useDeviceVisibility(props.showindevice || ["all"]);
46
47
  const componentWidgetId = useMemo(() => props == null ? void 0 : props["data-widget-id"], [props == null ? void 0 : props["data-widget-id"]]);
47
48
  const widgetFromContext = name ? (_b = pageContext == null ? void 0 : pageContext.Widgets) == null ? void 0 : _b[name] : void 0;
49
+ const previousDataValueHasChanged = useMemo(() => {
50
+ if (previousDataValueRef.current != props.datavalue) {
51
+ previousDataValueRef.current = props.datavalue;
52
+ return true;
53
+ }
54
+ return false;
55
+ }, [props.datavalue]);
48
56
  useEffect(() => {
49
57
  if (name && (props == null ? void 0 : props.iswidget) !== "false" && (pageContext == null ? void 0 : pageContext.Widgets)) {
50
58
  const widget = (widgetFromContext == null ? void 0 : widgetFromContext["data-widget-id"]) === componentWidgetId ? widgetFromContext : {};
@@ -67,7 +75,7 @@ const withBaseWrapper = (WrappedComponent) => {
67
75
  let mergedState = __spreadValues({}, props);
68
76
  const registry = pageContext == null ? void 0 : pageContext.overriddenPropsRegistry;
69
77
  const widgetDatavalue = widget.datavalue;
70
- const datavalue = widgetDatavalue != null ? widgetDatavalue : props.datavalue;
78
+ const datavalue = props["item-id"] || previousDataValueHasChanged ? props.datavalue : widgetDatavalue != null ? widgetDatavalue : props.datavalue;
71
79
  if (shouldMergeFromContext && (registry == null ? void 0 : registry.isWidgetOverridden(name, componentWidgetId || "")) && !props.formfield) {
72
80
  const widgetOverrides = registry == null ? void 0 : registry.getWidgetOverrides(name, componentWidgetId || "");
73
81
  if (widgetOverrides) {
@@ -141,10 +149,11 @@ const withBaseWrapper = (WrappedComponent) => {
141
149
  const computedClassName = useMemo(() => {
142
150
  return [
143
151
  props.className,
152
+ mergedProps.class,
144
153
  props.conditionalclass,
145
154
  props.animation && `animated ${props.animation}`
146
155
  ].filter(Boolean).join(" ");
147
- }, [props.className, props.conditionalclass, props.animation]);
156
+ }, [props.className, mergedProps.class, props.conditionalclass, props.animation]);
148
157
  if (isHidden) return null;
149
158
  const isDeferLoad = deferload === true;
150
159
  const showValue = ((_c = mergedProps == null ? void 0 : mergedProps.show) == null ? void 0 : _c.toString()) !== "false";
@@ -22,12 +22,21 @@ declare class ModernHttpService implements HttpClientService {
22
22
  * Get the currently stored context
23
23
  * @returns The stored context object
24
24
  */
25
+ /**
26
+ * The axios instance carrying every interceptor setupInterceptors() attaches.
27
+ *
28
+ * For module-scope callers that build their own request config and cannot use the useHttp()
29
+ * hook — the generated service classes in an app's `services/` folder. Without this they had to
30
+ * own a separate instance and re-implement each interceptor, which drifted (the app's
31
+ * onBeforeServiceCall stopped firing). Prefer send()/sendCall() for the normal variable flow.
32
+ */
33
+ getAxiosInstance(): AxiosInstance;
25
34
  getContext(): any;
26
35
  getAppManager(): any;
27
36
  private handleSessionFailure;
28
37
  private setupInterceptors;
29
- send(options: any, variable: any): Promise<any>;
30
- sendCall(requestParams: any, variable: any): Promise<any>;
38
+ send(options: any, variable: any, params?: any): Promise<any>;
39
+ sendCall(requestParams: any, variable: any, params?: any): Promise<any>;
31
40
  setLocale(locale: string): void;
32
41
  getLocale(): any;
33
42
  cancel(variable: any): void;
@@ -46,13 +55,14 @@ export declare const useHttp: () => HttpContextType;
46
55
  export declare const getHttpService: () => ModernHttpService;
47
56
  export declare const httpService: {
48
57
  readonly instance: ModernHttpService;
49
- send: (options: any, variable: any) => Promise<any>;
50
- sendCall: (requestParams: any, variable: any) => Promise<any>;
58
+ send: (options: any, variable: any, params?: any) => Promise<any>;
59
+ sendCall: (requestParams: any, variable: any, params?: any) => Promise<any>;
51
60
  cancel: (variable: any) => void;
52
61
  uploadFile: (url: string, data: any, variable: any, options?: any) => Promise<any>;
53
62
  setLocale: (locale: string) => void;
54
63
  getLocale: () => any;
55
64
  setContext: (context: any) => void;
56
65
  getContext: () => any;
66
+ getAxiosInstance: () => AxiosInstance;
57
67
  };
58
68
  export default httpService;
package/hooks/useHttp.js CHANGED
@@ -28,12 +28,16 @@ import { createContext, useContext, useRef, useMemo } from "react";
28
28
  import { WS_CONSTANTS } from "../variables/constants";
29
29
  import { store } from "../store";
30
30
  import { XSRF_HEADER_NAME } from "../store/slices/authSlice";
31
+ import { getActiveRoutingBasePath, PREVIEW_ROUTING_BASEPATH } from "../core/constants";
31
32
  class ModernHttpService {
32
33
  constructor(baseURL = "") {
33
34
  __publicField(this, "axiosInstance");
34
35
  __publicField(this, "_context", null);
35
36
  __publicField(this, "localeObject", store.getState().i18n.appLocale);
36
- this.axiosInstance = axios.create({ baseURL });
37
+ this.axiosInstance = axios.create({
38
+ baseURL,
39
+ formSerializer: { indexes: null }
40
+ });
37
41
  this.setupInterceptors();
38
42
  }
39
43
  /**
@@ -47,6 +51,17 @@ class ModernHttpService {
47
51
  * Get the currently stored context
48
52
  * @returns The stored context object
49
53
  */
54
+ /**
55
+ * The axios instance carrying every interceptor setupInterceptors() attaches.
56
+ *
57
+ * For module-scope callers that build their own request config and cannot use the useHttp()
58
+ * hook — the generated service classes in an app's `services/` folder. Without this they had to
59
+ * own a separate instance and re-implement each interceptor, which drifted (the app's
60
+ * onBeforeServiceCall stopped firing). Prefer send()/sendCall() for the normal variable flow.
61
+ */
62
+ getAxiosInstance() {
63
+ return this.axiosInstance;
64
+ }
50
65
  getContext() {
51
66
  return this._context;
52
67
  }
@@ -156,8 +171,8 @@ class ModernHttpService {
156
171
  }
157
172
  );
158
173
  }
159
- async send(options, variable) {
160
- var _a, _b, _c, _d;
174
+ async send(options, variable, params) {
175
+ var _a, _b, _c, _d, _e, _f, _g;
161
176
  const serviceInfo = variable.serviceInfo;
162
177
  let headers = new AxiosHeaders(options.headers);
163
178
  let requestBody = options.data;
@@ -186,12 +201,19 @@ class ModernHttpService {
186
201
  if (!options.isDirectCall) {
187
202
  headers = headers.set("X-Requested-With", "XMLHttpRequest");
188
203
  }
204
+ const plainHeaders = {};
205
+ const rawHeaders = typeof headers.toJSON === "function" ? headers.toJSON() : headers;
206
+ if (rawHeaders && typeof rawHeaders === "object") {
207
+ for (const [k, v] of Object.entries(rawHeaders)) {
208
+ if (v != null && typeof v !== "function") plainHeaders[k] = String(v);
209
+ }
210
+ }
189
211
  const methodType = ((serviceInfo == null ? void 0 : serviceInfo.methodType) || options.method || "get").toLowerCase();
190
212
  const isNonDataMethod = WS_CONSTANTS.NON_DATA_AXIOS_METHODS.indexOf(methodType.toUpperCase()) > -1;
191
213
  const axiosConfig = __spreadProps(__spreadValues({
192
214
  url: url.endsWith("/") ? url.slice(0, -1) : url,
193
215
  method: methodType,
194
- headers,
216
+ headers: plainHeaders,
195
217
  cancelToken: variable.cancelTokenSource.token,
196
218
  withCredentials: (options == null ? void 0 : options.withCredentials) !== false
197
219
  }, isNonDataMethod ? {} : { data: requestBody || {} }), {
@@ -200,7 +222,8 @@ class ModernHttpService {
200
222
  owner: variable.config._context.name,
201
223
  operation: variable.operation
202
224
  // Add operation to the context
203
- }
225
+ },
226
+ __axiosInstance: this.axiosInstance
204
227
  });
205
228
  if (variable.operation === "getDownloadFile" || (serviceInfo == null ? void 0 : serviceInfo.operationId) === "FileController_getDownloadFile") {
206
229
  axiosConfig.responseType = "blob";
@@ -209,7 +232,21 @@ class ModernHttpService {
209
232
  axiosConfig.onUploadProgress = options.onUploadProgress;
210
233
  }
211
234
  try {
212
- const response = await this.axiosInstance.request(axiosConfig);
235
+ const isPreview = getActiveRoutingBasePath() === PREVIEW_ROUTING_BASEPATH;
236
+ let response;
237
+ if (isPreview || variable.invokeHttp == void 0) {
238
+ response = await this.axiosInstance.request(axiosConfig);
239
+ } else {
240
+ response = await variable.invokeHttp(
241
+ __spreadProps(__spreadValues({}, axiosConfig), { serviceInfo }),
242
+ (_g = (_f = (_e = params != null ? params : variable.resolvedParams) != null ? _e : variable.lastInvokedParams) != null ? _f : variable.inputFields) != null ? _g : variable.params,
243
+ // CrudVariable only: it sets lastInvokedOperation per call. Not `variable.operation`
244
+ // (for a CrudVariable that is the entity name, "Loan") and not axiosConfig.method
245
+ // (that is the HTTP verb, "get") — either hits the generated switch's default and
246
+ // throws. The generated glue defaults an undefined value to its own operationType.
247
+ variable.lastInvokedOperation
248
+ );
249
+ }
213
250
  if (variable.operation === "getDownloadFile" || (serviceInfo == null ? void 0 : serviceInfo.operationId) === "FileController_getDownloadFile") {
214
251
  return this.handleFileDownload(response, options, variable);
215
252
  }
@@ -218,9 +255,9 @@ class ModernHttpService {
218
255
  throw error.response || error;
219
256
  }
220
257
  }
221
- async sendCall(requestParams, variable) {
258
+ async sendCall(requestParams, variable, params) {
222
259
  try {
223
- const response = await this.send(requestParams, variable);
260
+ const response = await this.send(requestParams, variable, params);
224
261
  return response;
225
262
  } catch (error) {
226
263
  throw error;
@@ -342,7 +379,8 @@ const httpService = {
342
379
  setLocale: (...args) => getHttpService().setLocale(...args),
343
380
  getLocale: () => getHttpService().getLocale(),
344
381
  setContext: (...args) => getHttpService().setContext(...args),
345
- getContext: () => getHttpService().getContext()
382
+ getContext: () => getHttpService().getContext(),
383
+ getAxiosInstance: () => getHttpService().getAxiosInstance()
346
384
  };
347
385
  var useHttp_default = httpService;
348
386
  export {