@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
@@ -26,6 +26,7 @@ import React, {
26
26
  useCallback,
27
27
  useContext,
28
28
  useEffect,
29
+ useLayoutEffect,
29
30
  useMemo,
30
31
  useRef,
31
32
  useState
@@ -165,10 +166,11 @@ const WmTabs = memo(
165
166
  return newSet;
166
167
  });
167
168
  }
168
- }, [selectedIndex, type, dataset]);
169
+ }, [selectedIndex, type, dataset, dataset == null ? void 0 : dataset.length]);
169
170
  const changeTab = (newIndex) => {
170
171
  if (newIndex >= 0 && newIndex < panesCount.current && newIndex !== currentSelectedIndex.current) {
171
172
  prevSelectedIndex.current = currentSelectedIndex.current;
173
+ currentSelectedIndex.current = newIndex;
172
174
  setSelectedIndex(newIndex);
173
175
  saveStateToStorage(newIndex);
174
176
  return true;
@@ -257,7 +259,7 @@ const WmTabs = memo(
257
259
  activeTab: getActiveTab(activeIndex)
258
260
  });
259
261
  };
260
- useEffect(() => {
262
+ useLayoutEffect(() => {
261
263
  updateListener();
262
264
  }, [prev, next, goToTab]);
263
265
  const getStateFromStorage = () => {
@@ -304,7 +306,7 @@ const WmTabs = memo(
304
306
  item.onHeaderclick(e, Widgets == null ? void 0 : Widgets[name], index);
305
307
  }
306
308
  },
307
- [Widgets, name]
309
+ [name]
308
310
  );
309
311
  const renderTabHeader = React.useCallback(
310
312
  (item, index) => /* @__PURE__ */ createElement(
@@ -370,7 +372,7 @@ const WmTabs = memo(
370
372
  const headers = [];
371
373
  let tabIndex = 0;
372
374
  const addTabHeader = (itemProps) => {
373
- const paneName = itemProps == null ? void 0 : itemProps.name;
375
+ const paneName = itemProps["item-id"] || itemProps.name;
374
376
  const latestWidgetState = paneName ? (Widgets == null ? void 0 : Widgets[paneName]) || {} : {};
375
377
  const headerOverrides = paneName ? paneHeaderOverrides[paneName] || {} : {};
376
378
  const resolvedItemProps = __spreadValues(__spreadValues(__spreadValues({}, itemProps), latestWidgetState), headerOverrides);
@@ -395,7 +397,7 @@ const WmTabs = memo(
395
397
  });
396
398
  panesCount.current = tabIndex;
397
399
  return headers;
398
- }, [dataset, render, renderTabHeader, Widgets, paneHeaderOverrides]);
400
+ }, [dataset, paneHeaderOverrides, renderTabHeader]);
399
401
  const renderStaticTabs = React.useCallback(() => {
400
402
  const visibleChildren = filterVisibleChildren(children, hiddenTabNames);
401
403
  panesCount.current = visibleChildren.length;
@@ -468,7 +470,10 @@ const WmTabs = memo(
468
470
  setSelectedIndex(newIndex);
469
471
  saveStateToStorage(newIndex);
470
472
  updateListener(newIndex);
471
- onChange == null ? void 0 : onChange(null, getLatestTabsWidget(newIndex), newIndex, oldIndex);
473
+ setTimeout(
474
+ () => onChange == null ? void 0 : onChange(null, getLatestTabsWidget(newIndex), newIndex, oldIndex),
475
+ 0
476
+ );
472
477
  },
473
478
  orientation,
474
479
  className: clsx("app-tabs clearfix", className, {
@@ -542,7 +547,6 @@ const WmTabs = memo(
542
547
  "transition",
543
548
  "type",
544
549
  "iconposition",
545
- "render",
546
550
  "selectedindex",
547
551
  "children",
548
552
  "loading",
@@ -553,7 +557,7 @@ const WmTabs = memo(
553
557
  "styles"
554
558
  ];
555
559
  return keys.every((key) => {
556
- if (key === "children") {
560
+ if (key === "children" || key === "dataset") {
557
561
  return prev[key] === next[key];
558
562
  }
559
563
  return isEqual(prev[key], next[key]);
@@ -49,6 +49,7 @@ declare const _default: React.ComponentType<{
49
49
  width?: number | string;
50
50
  height?: number | string;
51
51
  className?: string;
52
+ class?: string;
52
53
  conditionalstyle?: React.CSSProperties;
53
54
  conditionalclass?: string;
54
55
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -47,7 +47,7 @@ const WmTabpane = (props) => {
47
47
  listener.onChange(tabsContainerName, { activeTab: widgetInstance });
48
48
  }
49
49
  if (isActive) {
50
- if (!loadedRef.current) {
50
+ if (!loadedRef.current && !renderPartial) {
51
51
  (_c = props == null ? void 0 : props.onLoad) == null ? void 0 : _c.call(props, null, widgetInstance);
52
52
  loadedRef.current = true;
53
53
  }
@@ -95,7 +95,7 @@ const WmTabpane = (props) => {
95
95
  return;
96
96
  }
97
97
  updatePaneHeader(name, headerProps);
98
- }, [name, headerProps, updatePaneHeader]);
98
+ }, [name, updatePaneHeader]);
99
99
  return /* @__PURE__ */ jsx(
100
100
  Tabs.Panel,
101
101
  __spreadProps(__spreadValues(__spreadValues({
@@ -38,6 +38,7 @@ declare const WmWizardStandalone: React.ComponentType<{
38
38
  padding?: string;
39
39
  margin?: string;
40
40
  className?: string;
41
+ class?: string;
41
42
  conditionalstyle?: React.CSSProperties;
42
43
  conditionalclass?: string;
43
44
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -130,6 +131,7 @@ declare const _default: React.ComponentType<{
130
131
  padding?: string;
131
132
  margin?: string;
132
133
  className?: string;
134
+ class?: string;
133
135
  conditionalstyle?: React.CSSProperties;
134
136
  conditionalclass?: string;
135
137
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -51,6 +51,7 @@ import { getFormData } from "../../../utils/form-utils";
51
51
  import { useParentFormData } from "../../data/form/form-context";
52
52
  import isEqual from "lodash-es/isEqual";
53
53
  import withStandalone from "../../../higherOrder/withStandalone";
54
+ import { publishPartialNamespaces, toHostWidgetProps } from "../../../utils/partial-host-util";
54
55
  import {
55
56
  WmSkeleton,
56
57
  SKELETON_REGISTRY,
@@ -89,7 +90,9 @@ const WmWizardComponent = memo(
89
90
  width,
90
91
  height,
91
92
  render,
92
- standalone = false
93
+ standalone = false,
94
+ viewParent,
95
+ prefab
93
96
  } = props;
94
97
  const [steps, setSteps] = useState([]);
95
98
  const [wizardMessage, setWizardMessage] = useState(message || { caption: "", type: "" });
@@ -99,6 +102,34 @@ const WmWizardComponent = memo(
99
102
  const navIndexRef = useRef(-1);
100
103
  const loadedStepNameRef = useRef(null);
101
104
  const [formReady, setFormReady] = useState(false);
105
+ const loadedStepPartialKeysRef = useRef(/* @__PURE__ */ new Set());
106
+ const currentStepRef = useRef(null);
107
+ const currentStepIndexRef = useRef(-1);
108
+ const handleStepPartialOnLoad = useCallback(
109
+ (widget, partialName) => {
110
+ var _a, _b, _c, _d;
111
+ if (!viewParent || !viewParent.Widgets) return;
112
+ const hostKey = ((_a = currentStepRef.current) == null ? void 0 : _a.name) || partialName;
113
+ if (!hostKey || loadedStepPartialKeysRef.current.has(hostKey)) return;
114
+ loadedStepPartialKeysRef.current.add(hostKey);
115
+ if (!widget || prefab) {
116
+ viewParent.Widgets[hostKey] = widget || props;
117
+ } else {
118
+ if (!viewParent.Widgets[hostKey]) {
119
+ viewParent.Widgets[hostKey] = toHostWidgetProps(props);
120
+ }
121
+ publishPartialNamespaces(viewParent.Widgets[hostKey], widget);
122
+ }
123
+ if (((_b = currentStepRef.current) == null ? void 0 : _b.name) === hostKey) {
124
+ (_d = (_c = currentStepRef.current) == null ? void 0 : _c.onLoad) == null ? void 0 : _d.call(
125
+ _c,
126
+ viewParent.Widgets[hostKey],
127
+ currentStepIndexRef.current
128
+ );
129
+ }
130
+ },
131
+ [viewParent, prefab]
132
+ );
102
133
  const parentFormContext = useParentFormData();
103
134
  const isInsideOuterForm = !!parentFormContext && Object.keys(parentFormContext).length > 0;
104
135
  const createDynamicSteps = useCallback(
@@ -146,13 +177,19 @@ const WmWizardComponent = memo(
146
177
  [defaultstepindex]
147
178
  );
148
179
  const currentStep = useMemo(() => steps.find((step) => step.active) || null, [steps]);
180
+ currentStepRef.current = currentStep;
149
181
  const visibleSteps = useMemo(() => steps.filter((step) => step.show), [steps]);
182
+ const visibleStepsRef = useRef(visibleSteps);
183
+ visibleStepsRef.current = visibleSteps;
184
+ const stepsRef = useRef(steps);
185
+ stepsRef.current = steps;
150
186
  const currentStepIndex = useMemo(() => {
151
187
  if (!currentStep) return -1;
152
188
  return visibleSteps.findIndex((step) => step.name === currentStep.name);
153
189
  }, [currentStep, visibleSteps]);
154
190
  useEffect(() => {
155
191
  navIndexRef.current = currentStepIndex;
192
+ currentStepIndexRef.current = currentStepIndex;
156
193
  }, [currentStepIndex]);
157
194
  const hasNextStep = useMemo(
158
195
  () => currentStepIndex < visibleSteps.length - 1,
@@ -284,27 +321,34 @@ const WmWizardComponent = memo(
284
321
  () => stepstyle === "justified" ? "justified" : "auto",
285
322
  [stepstyle]
286
323
  );
324
+ const activateStep = useCallback(
325
+ (step) => {
326
+ if (!step.show || step.disabled) return;
327
+ setSteps(
328
+ (prevSteps) => prevSteps.map((s) => {
329
+ const stepIndex = prevSteps.findIndex((ps) => ps.name === s.name);
330
+ const targetIndex = prevSteps.findIndex((ps) => ps.name === step.name);
331
+ return __spreadProps(__spreadValues({}, s), {
332
+ active: s.name === step.name,
333
+ isDone: type === "dynamic" ? stepIndex < targetIndex : stepIndex < targetIndex,
334
+ done: type === "dynamic" ? stepIndex < targetIndex : stepIndex < targetIndex || s.name === step.name && targetIndex > 0,
335
+ disabled: false,
336
+ // Ensure enableNext and isValid are preserved when activating a step
337
+ enableNext: s.name === step.name ? true : s.enableNext,
338
+ isValid: s.name === step.name ? true : s.isValid
339
+ });
340
+ })
341
+ );
342
+ },
343
+ [type]
344
+ );
287
345
  const onStepHeaderClick = useCallback(
288
346
  (event, step) => {
289
- if ((step.done || step.isDone || nonLinear && type === "dynamic") && step.show && !step.disabled) {
290
- setSteps(
291
- (prevSteps) => prevSteps.map((s) => {
292
- const stepIndex = prevSteps.findIndex((ps) => ps.name === s.name);
293
- const targetIndex = prevSteps.findIndex((ps) => ps.name === step.name);
294
- return __spreadProps(__spreadValues({}, s), {
295
- active: s.name === step.name,
296
- isDone: type === "dynamic" ? stepIndex < targetIndex : stepIndex < targetIndex,
297
- done: type === "dynamic" ? stepIndex < targetIndex : stepIndex < targetIndex || s.name === step.name && targetIndex > 0,
298
- disabled: false,
299
- // Ensure enableNext and isValid are preserved when activating a step
300
- enableNext: s.name === step.name ? true : s.enableNext,
301
- isValid: s.name === step.name ? true : s.isValid
302
- });
303
- })
304
- );
347
+ if (step.done || step.isDone || nonLinear && type === "dynamic") {
348
+ activateStep(step);
305
349
  }
306
350
  },
307
- [nonLinear, type]
351
+ [nonLinear, type, activateStep]
308
352
  );
309
353
  const handleStepClick = useCallback(
310
354
  (index) => {
@@ -334,62 +378,64 @@ const WmWizardComponent = memo(
334
378
  const next = useCallback(
335
379
  async (eventName = "next") => {
336
380
  var _a, _b;
381
+ const currentVisibleSteps = visibleStepsRef.current;
337
382
  const fromIndex = navIndexRef.current >= 0 ? navIndexRef.current : currentStepIndex;
338
- const fromStep = getStepByIndex(fromIndex, visibleSteps);
383
+ const fromStep = getStepByIndex(fromIndex, currentVisibleSteps);
339
384
  if (!fromStep) return;
340
- const nextStep = getNextValidStep(fromIndex + 1, visibleSteps);
385
+ const nextStep = getNextValidStep(fromIndex + 1, currentVisibleSteps);
341
386
  if (!nextStep) return;
342
- const nextIndex = visibleSteps.findIndex((s) => s.name === nextStep.name);
387
+ const nextIndex = currentVisibleSteps.findIndex((s) => s.name === nextStep.name);
343
388
  if (eventName === "skip") {
344
389
  const response = (_a = fromStep.onSkip) == null ? void 0 : _a.call(fromStep, fromStep, fromStep, fromIndex);
345
390
  if (response !== void 0) {
346
391
  await handleNavigation(
347
392
  response,
348
- () => extendNextFn(fromStep, fromIndex, visibleSteps, setSteps)
393
+ () => extendNextFn(fromStep, fromIndex, currentVisibleSteps, setSteps)
349
394
  );
350
395
  } else {
351
- extendNextFn(fromStep, fromIndex, visibleSteps, setSteps);
396
+ extendNextFn(fromStep, fromIndex, currentVisibleSteps, setSteps);
352
397
  }
353
398
  } else if (fromStep.isValid && eventName === "next") {
354
399
  const response = (_b = fromStep.onNext) == null ? void 0 : _b.call(fromStep, fromStep, fromStep, fromIndex);
355
400
  if (response !== void 0) {
356
401
  await handleNavigation(
357
402
  response,
358
- () => extendNextFn(fromStep, fromIndex, visibleSteps, setSteps)
403
+ () => extendNextFn(fromStep, fromIndex, currentVisibleSteps, setSteps)
359
404
  );
360
405
  } else {
361
- extendNextFn(fromStep, fromIndex, visibleSteps, setSteps);
406
+ extendNextFn(fromStep, fromIndex, currentVisibleSteps, setSteps);
362
407
  }
363
408
  } else if (enablenext && !fromStep.isValid) {
364
409
  console.warn("Cannot proceed: current step is invalid");
365
410
  } else {
366
- extendNextFn(fromStep, fromIndex, visibleSteps, setSteps);
411
+ extendNextFn(fromStep, fromIndex, currentVisibleSteps, setSteps);
367
412
  }
368
413
  navIndexRef.current = nextIndex;
369
414
  setFormReady(false);
370
415
  },
371
- [currentStepIndex, visibleSteps, enablenext]
416
+ [currentStepIndex, enablenext]
372
417
  );
373
418
  const prev = useCallback(async () => {
374
419
  var _a;
420
+ const currentVisibleSteps = visibleStepsRef.current;
375
421
  const fromIndex = navIndexRef.current >= 0 ? navIndexRef.current : currentStepIndex;
376
- const fromStep = getStepByIndex(fromIndex, visibleSteps);
422
+ const fromStep = getStepByIndex(fromIndex, currentVisibleSteps);
377
423
  if (!fromStep) return;
378
- const targetStep = getPrevValidStep(fromIndex - 1, visibleSteps);
424
+ const targetStep = getPrevValidStep(fromIndex - 1, currentVisibleSteps);
379
425
  if (!targetStep) return;
380
- const prevIndex = visibleSteps.findIndex((s) => s.name === targetStep.name);
426
+ const prevIndex = currentVisibleSteps.findIndex((s) => s.name === targetStep.name);
381
427
  const response = (_a = fromStep.onPrev) == null ? void 0 : _a.call(fromStep, fromStep, fromStep, fromIndex);
382
428
  if (response !== void 0) {
383
429
  await handleNavigation(
384
430
  response,
385
- () => extendPrevFn(fromStep, fromIndex, visibleSteps, setSteps)
431
+ () => extendPrevFn(fromStep, fromIndex, currentVisibleSteps, setSteps)
386
432
  );
387
433
  } else {
388
- extendPrevFn(fromStep, fromIndex, visibleSteps, setSteps);
434
+ extendPrevFn(fromStep, fromIndex, currentVisibleSteps, setSteps);
389
435
  }
390
436
  navIndexRef.current = prevIndex;
391
437
  setFormReady(false);
392
- }, [currentStepIndex, visibleSteps]);
438
+ }, [currentStepIndex]);
393
439
  const registerStep = useCallback((stepData) => {
394
440
  setSteps((prevSteps) => {
395
441
  const existingIndex = prevSteps.findIndex((step) => step.name === stepData.name);
@@ -426,31 +472,33 @@ const WmWizardComponent = memo(
426
472
  }, [onCancel, steps]);
427
473
  const gotoStep = useCallback(
428
474
  (step) => {
475
+ const currentSteps = stepsRef.current;
476
+ const currentVisibleSteps = visibleStepsRef.current;
429
477
  let gotoStepIndex;
430
478
  let targetStep = null;
431
479
  if (typeof step === "string") {
432
- gotoStepIndex = steps.map((s) => s.name).indexOf(step);
480
+ gotoStepIndex = currentSteps.map((s) => s.name).indexOf(step);
433
481
  if (gotoStepIndex === -1) {
434
482
  console.error(`Could not find step '${step}'`);
435
483
  return;
436
484
  }
437
- targetStep = steps[gotoStepIndex];
485
+ targetStep = currentSteps[gotoStepIndex];
438
486
  } else if (typeof step === "number" && step >= 0) {
439
487
  gotoStepIndex = step;
440
- targetStep = getStepByIndex(step, visibleSteps);
488
+ targetStep = getStepByIndex(step, currentVisibleSteps);
441
489
  } else {
442
490
  console.error("Invalid step name or index provided");
443
491
  return;
444
492
  }
445
493
  if (targetStep == null ? void 0 : targetStep.show) {
446
- const visIndex = visibleSteps.findIndex((s) => s.name === (targetStep == null ? void 0 : targetStep.name));
494
+ const visIndex = currentVisibleSteps.findIndex((s) => s.name === (targetStep == null ? void 0 : targetStep.name));
447
495
  if (visIndex >= 0) navIndexRef.current = visIndex;
448
- onStepHeaderClick({}, targetStep);
496
+ activateStep(targetStep);
449
497
  } else {
450
498
  console.error("The gotoStep function cannot navigate to hidden steps");
451
499
  }
452
500
  },
453
- [steps, visibleSteps, onStepHeaderClick]
501
+ [activateStep]
454
502
  );
455
503
  const setDefaultStep = useCallback(
456
504
  (step) => {
@@ -547,7 +595,8 @@ const WmWizardComponent = memo(
547
595
  currentStepIndex,
548
596
  isFirstStep,
549
597
  isLastStep,
550
- visibleSteps
598
+ visibleSteps,
599
+ gotoStep
551
600
  ]);
552
601
  useEffect(() => {
553
602
  updateListener();
@@ -754,7 +803,7 @@ const WmWizardComponent = memo(
754
803
  className: clsx("app-wizard-step-container", {
755
804
  active: step.active
756
805
  }),
757
- hidden: !step.active,
806
+ hidden: !step.active || step.show === false || step.show === "false",
758
807
  name: step.name,
759
808
  children: isInsideOuterForm ? (
760
809
  // Inside outer form - use div, fields/forms pass through to outer form context
@@ -764,7 +813,7 @@ const WmWizardComponent = memo(
764
813
  className: clsx("app-wizard-step-content", {
765
814
  active: step.active
766
815
  }),
767
- children: (currentStep == null ? void 0 : currentStep.name) && step.active && currentStep.render ? currentStep.render(step, index) : step.children
816
+ children: (currentStep == null ? void 0 : currentStep.name) && step.active && currentStep.render ? currentStep.render(step, handleStepPartialOnLoad) : step.children
768
817
  }
769
818
  )
770
819
  ) : (
@@ -780,7 +829,7 @@ const WmWizardComponent = memo(
780
829
  }),
781
830
  listener,
782
831
  isInsideWizard: true,
783
- children: (currentStep == null ? void 0 : currentStep.name) && step.active && currentStep.render ? currentStep.render(step, index) : step.children
832
+ children: (currentStep == null ? void 0 : currentStep.name) && step.active && currentStep.render ? currentStep.render(step, handleStepPartialOnLoad) : step.children
784
833
  }
785
834
  )
786
835
  )
@@ -49,7 +49,7 @@ export interface WizardStepData extends Record<string, unknown> {
49
49
  isValid: boolean;
50
50
  isInitialized: boolean;
51
51
  content?: ReactNode;
52
- render?: (step: WizardStepData, stepIndex?: number, dataset?: Record<string, unknown>[]) => ReactNode;
52
+ render?: (step: WizardStepData, onLoad?: (widget?: Record<string, unknown>, partialName?: string) => void) => ReactNode;
53
53
  dynamicStepIndex?: number;
54
54
  isdynamic?: boolean;
55
55
  onLoad?: (step: WizardStepData, stepIndex: number) => void;
@@ -256,7 +256,7 @@ export interface WmWizardStepProps {
256
256
  ref?: React.Ref<unknown>;
257
257
  className?: string;
258
258
  props?: Record<string, unknown>;
259
- render?: (item: Record<string, unknown>, index?: number, dataset?: Record<string, unknown>[]) => ReactNode;
259
+ render?: (props: Record<string, unknown>, onLoad?: (widget?: Record<string, unknown>, partialName?: string) => void) => ReactNode;
260
260
  listener?: Record<string, unknown>;
261
261
  }
262
262
  /**
@@ -19,6 +19,7 @@ declare const _default: import("react").ComponentType<{
19
19
  width?: number | string;
20
20
  height?: number | string;
21
21
  className?: string;
22
+ class?: string;
22
23
  conditionalstyle?: import("react").CSSProperties;
23
24
  conditionalclass?: string;
24
25
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -23,6 +23,7 @@ declare const _default: React.ComponentType<{
23
23
  width?: number | string;
24
24
  height?: number | string;
25
25
  className?: string;
26
+ class?: string;
26
27
  conditionalstyle?: React.CSSProperties;
27
28
  conditionalclass?: string;
28
29
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -23,6 +23,7 @@ declare const _default: React.ComponentType<{
23
23
  width?: number | string;
24
24
  height?: number | string;
25
25
  className?: string;
26
+ class?: string;
26
27
  conditionalstyle?: React.CSSProperties;
27
28
  conditionalclass?: string;
28
29
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -23,6 +23,7 @@ declare const _default: React.ComponentType<{
23
23
  width?: number | string;
24
24
  height?: number | string;
25
25
  className?: string;
26
+ class?: string;
26
27
  conditionalstyle?: React.CSSProperties;
27
28
  conditionalclass?: string;
28
29
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -46,6 +46,7 @@ declare const _default: React.ComponentType<{
46
46
  width?: number | string;
47
47
  height?: number | string;
48
48
  className?: string;
49
+ class?: string;
49
50
  conditionalstyle?: React.CSSProperties;
50
51
  conditionalclass?: string;
51
52
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -10,4 +10,4 @@ import { UseFormOperationsOptions, UseFormOperationsReturn } from "../props";
10
10
  * - Save and new / Save and view actions
11
11
  * - View mode state management
12
12
  */
13
- export declare function useFormOperations({ formName, formfields, formRef, formReff, formType, fullDataPath, parentFormDataContext, clearFormData, resetFormData, trigger, submit, formProxy, widgetFormType, debouncedFilter, }: UseFormOperationsOptions): UseFormOperationsReturn;
13
+ export declare function useFormOperations({ formName, formfields, formRef, formReff, formType, fullDataPath, parentFormDataContext, clearFormData, resetFormData, trigger, submit, formProxy, widgetFormType, debouncedFilter, onReset, }: UseFormOperationsOptions): UseFormOperationsReturn;
@@ -16,7 +16,8 @@ function useFormOperations({
16
16
  submit,
17
17
  formProxy,
18
18
  widgetFormType,
19
- debouncedFilter
19
+ debouncedFilter,
20
+ onReset
20
21
  }) {
21
22
  const hasPrefixedFields = usesPrefixedFields(formType);
22
23
  const [showViewMode, setShowViewMode] = useState(false);
@@ -53,6 +54,7 @@ function useFormOperations({
53
54
  return (_a = childForm == null ? void 0 : childForm.formreset) == null ? void 0 : _a.call(childForm);
54
55
  });
55
56
  }
57
+ onReset == null ? void 0 : onReset();
56
58
  }, [
57
59
  formName,
58
60
  formfields,
@@ -62,7 +64,8 @@ function useFormOperations({
62
64
  fullDataPath,
63
65
  parentFormDataContext,
64
66
  formRef,
65
- formReff
67
+ formReff,
68
+ onReset
66
69
  ]);
67
70
  const create = useCallback(() => {
68
71
  formreset();
@@ -325,7 +325,7 @@ const BaseForm = (WrappedComponent) => {
325
325
  e == null ? void 0 : e.preventDefault();
326
326
  e == null ? void 0 : e.stopPropagation();
327
327
  const transformedData = transformRangeFilterData(data);
328
- return livefilterFn(transformedData, false, formfieldsRef.current);
328
+ return livefilterFn(transformedData, false, formProxy == null ? void 0 : formProxy.formfields);
329
329
  }),
330
330
  [handleSubmit, livefilterFn]
331
331
  );
@@ -334,7 +334,7 @@ const BaseForm = (WrappedComponent) => {
334
334
  debouncedFn();
335
335
  }, [filter]);
336
336
  const {
337
- formreset: formresetFn,
337
+ formreset,
338
338
  create,
339
339
  edit,
340
340
  setFormData,
@@ -356,18 +356,14 @@ const BaseForm = (WrappedComponent) => {
356
356
  submit,
357
357
  formProxy: formProxy || {},
358
358
  widgetFormType: props["form-type"],
359
- debouncedFilter
359
+ debouncedFilter,
360
+ onReset: props.onReset
360
361
  });
361
- const formreset = useCallback(async () => {
362
- var _a2;
363
- await formresetFn();
364
- (_a2 = props.onReset) == null ? void 0 : _a2.call(props);
365
- }, [formresetFn, props.onReset]);
366
362
  const clearFilter = useMemo(
367
363
  () => handleSubmit((data, e) => {
368
364
  e == null ? void 0 : e.preventDefault();
369
365
  e == null ? void 0 : e.stopPropagation();
370
- formresetFn();
366
+ formreset();
371
367
  const transformedData = transformRangeFilterData(data);
372
368
  livefilterFn(transformedData, true, formfieldsRef.current);
373
369
  }),
@@ -384,8 +380,8 @@ const BaseForm = (WrappedComponent) => {
384
380
  return;
385
381
  }
386
382
  setShowViewMode(true);
387
- formresetFn();
388
- }, [setShowViewMode, props.cancel, formresetFn]);
383
+ formreset();
384
+ }, [setShowViewMode, props.cancel, formreset]);
389
385
  const highlightInvalidFields = useCallback(async () => {
390
386
  await validateFieldsOnSubmit();
391
387
  }, [validateFieldsOnSubmit]);
@@ -452,7 +448,7 @@ const BaseForm = (WrappedComponent) => {
452
448
  var _a2;
453
449
  if (!formName || !formRef.current) return;
454
450
  (_a2 = props == null ? void 0 : props.destroy) == null ? void 0 : _a2.call(props, formName);
455
- formresetFn();
451
+ formreset();
456
452
  };
457
453
  }, []);
458
454
  useEffect(() => {
@@ -559,7 +555,7 @@ const BaseForm = (WrappedComponent) => {
559
555
  }
560
556
  const formId = formIdRef.current;
561
557
  parentFormRef.current[formId] = {
562
- formreset: formresetFn,
558
+ formreset,
563
559
  validateFieldsOnSubmit
564
560
  };
565
561
  return () => {
@@ -567,7 +563,7 @@ const BaseForm = (WrappedComponent) => {
567
563
  delete parentFormRef.current[formId];
568
564
  }
569
565
  };
570
- }, [parentFormRef, formresetFn, validateFieldsOnSubmit]);
566
+ }, [parentFormRef, formreset, validateFieldsOnSubmit]);
571
567
  const computedFormdata = widgetFormData || childFormData || formdata;
572
568
  const ref = useMemo(
573
569
  () => ({
@@ -252,6 +252,7 @@ export interface UseFormOperationsOptions {
252
252
  widgetFormType?: string;
253
253
  autoupdate?: string;
254
254
  debouncedFilter?: () => void;
255
+ onReset?: () => void;
255
256
  }
256
257
  export interface UseFormOperationsReturn {
257
258
  formreset: () => Promise<void>;
@@ -30,38 +30,24 @@ var __objRest = (source, exclude) => {
30
30
  return target;
31
31
  };
32
32
  import { jsx } from "react/jsx-runtime";
33
- import { useEffect, useMemo, useState } from "react";
33
+ import { useMemo } from "react";
34
34
  import WmText from "../../../input/text";
35
35
  import withFormController from "../form-controller/withFormController";
36
- import { loadWmxComponent, getWmxComponentName } from "../../../../utils/wmx.utils";
36
+ import { getWmxComponentName, getWmxModule } from "../../../../utils/wmx.utils";
37
37
  const WmxDynamicFormField = ({ field, fieldProps }) => {
38
- var _b;
38
+ var _b, _c, _d;
39
39
  const componentName = getWmxComponentName(String((field == null ? void 0 : field.widget) || ""));
40
40
  const _a = fieldProps, { class: className } = _a, restProps = __objRest(_a, ["class"]);
41
41
  const resolvedClassName = className || fieldProps.className;
42
- const [RawComponent, setRawComponent] = useState(null);
43
- useEffect(() => {
44
- if (!componentName) return;
45
- let isActive = true;
46
- loadWmxComponent(componentName).then((component) => {
47
- if (isActive) {
48
- setRawComponent(component);
49
- }
50
- }).catch((e) => {
51
- console.error(e);
52
- });
53
- return () => {
54
- isActive = false;
55
- };
56
- }, [componentName]);
57
- const EnhancedWmxComponent = useMemo(() => {
58
- if (!RawComponent) return null;
59
- return withFormController(RawComponent);
60
- }, [RawComponent]);
42
+ const RawComponent = componentName ? (_c = (_b = getWmxModule()) == null ? void 0 : _b[`Wmx${componentName}`]) != null ? _c : null : null;
43
+ const EnhancedWmxComponent = useMemo(
44
+ () => RawComponent ? withFormController(RawComponent) : null,
45
+ [RawComponent]
46
+ );
61
47
  if (!EnhancedWmxComponent) {
62
48
  return /* @__PURE__ */ jsx(WmText, __spreadProps(__spreadValues({ name: field == null ? void 0 : field.name }, restProps), { className: resolvedClassName }));
63
49
  }
64
- const dataset = (_b = field == null ? void 0 : field.dataset) != null ? _b : fieldProps == null ? void 0 : fieldProps.dataset;
50
+ const dataset = (_d = field == null ? void 0 : field.dataset) != null ? _d : fieldProps == null ? void 0 : fieldProps.dataset;
65
51
  return /* @__PURE__ */ jsx(
66
52
  EnhancedWmxComponent,
67
53
  __spreadProps(__spreadValues({
@@ -22,6 +22,7 @@ declare const WmFormActionsStandalone: import("react").ComponentType<{
22
22
  margin?: string;
23
23
  width?: number | string;
24
24
  height?: number | string;
25
+ class?: string;
25
26
  conditionalstyle?: import("react").CSSProperties;
26
27
  conditionalclass?: string;
27
28
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];
@@ -98,6 +99,7 @@ declare const _default: import("react").ComponentType<{
98
99
  margin?: string;
99
100
  width?: number | string;
100
101
  height?: number | string;
102
+ class?: string;
101
103
  conditionalstyle?: import("react").CSSProperties;
102
104
  conditionalclass?: string;
103
105
  showindevice?: ("xs" | "sm" | "md" | "lg" | "all")[];