@wavemaker-ai/react-runtime 1.0.0-rc.326 → 1.0.0-rc.330

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 (80) hide show
  1. package/components/basic/icon/index.js +36 -5
  2. package/components/basic/iframe/index.js +18 -8
  3. package/components/basic/label/index.js +4 -3
  4. package/components/basic/search/index.d.ts +72 -3
  5. package/components/basic/search/index.js +75 -21
  6. package/components/basic/search/props.d.ts +4 -0
  7. package/components/common/WmAppIcon/index.js +11 -8
  8. package/components/common/WmAppIcon/props.d.ts +2 -0
  9. package/components/container/accordion/accordion-pane/index.d.ts +1 -0
  10. package/components/container/accordion/accordion-pane/index.js +7 -3
  11. package/components/container/accordion/accordion-pane/props.d.ts +1 -0
  12. package/components/container/index.js +13 -5
  13. package/components/container/panel/components/panel-header/index.js +1 -3
  14. package/components/container/tabs/tab-pane/index.d.ts +1 -0
  15. package/components/container/tabs/tab-pane/index.js +2 -2
  16. package/components/container/tabs/tab-pane/props.d.ts +1 -0
  17. package/components/container/wizard/index.js +11 -10
  18. package/components/container/wizard/utils.js +1 -0
  19. package/components/data/form/dynamic-fields/WmxDynamicFormField.d.ts +11 -0
  20. package/components/data/form/dynamic-fields/WmxDynamicFormField.js +77 -0
  21. package/components/data/form/dynamic-fields/index.js +12 -1
  22. package/components/data/form/form-controller/withFormController.js +0 -14
  23. package/components/data/form/form-field/index.js +10 -7
  24. package/components/data/list/index.js +3 -2
  25. package/components/data/table/components/RowCells.js +3 -1
  26. package/components/data/table/components/TableHeader.js +5 -1
  27. package/components/data/table/hooks/useRowHandlers.d.ts +4 -2
  28. package/components/data/table/hooks/useRowHandlers.js +23 -11
  29. package/components/data/table/hooks/useRowSelection.d.ts +1 -1
  30. package/components/data/table/hooks/useRowSelection.js +80 -66
  31. package/components/data/table/hooks/useTableState.js +14 -2
  32. package/components/data/table/index.js +52 -48
  33. package/components/data/table/props.d.ts +4 -0
  34. package/components/data/table/utils/buildSelectionColumns.js +2 -2
  35. package/components/data/table/utils/columnBuilder.js +1 -1
  36. package/components/data/table/utils/index.d.ts +9 -1
  37. package/components/data/table/utils/index.js +15 -1
  38. package/components/data/table/utils/selectionUtils.d.ts +5 -0
  39. package/components/data/table/utils/selectionUtils.js +5 -0
  40. package/components/dialogs/dialog-header/index.js +1 -1
  41. package/components/dialogs/index.js +14 -2
  42. package/components/input/chips/index.js +29 -5
  43. package/components/input/color-picker/index.js +4 -6
  44. package/components/input/epoch/date/index.js +1 -1
  45. package/components/input/select/index.js +3 -4
  46. package/components/input/text/index.js +2 -2
  47. package/components/input/textarea/index.js +41 -16
  48. package/components/navbar/nav/index.js +10 -5
  49. package/components/navigation/breadcrumb/index.js +2 -1
  50. package/components/navigation/popover/index.js +9 -1
  51. package/components/page/page-content/index.js +24 -4
  52. package/components/page/page-content/props.d.ts +1 -0
  53. package/components/page/partial-container/index.js +1 -1
  54. package/components/wmx/WmxRenderer.d.ts +8 -0
  55. package/components/wmx/WmxRenderer.js +57 -0
  56. package/core/appstore.js +1 -1
  57. package/core/util/index.d.ts +0 -2
  58. package/core/util/index.js +0 -29
  59. package/higherOrder/BasePage.js +24 -63
  60. package/higherOrder/DataNav.js +4 -1
  61. package/hooks/useHttp.js +4 -2
  62. package/hooks/useLayoutSize.js +1 -1
  63. package/package-lock.json +327 -680
  64. package/package.json +3 -3
  65. package/runtime-dynamic/app-initializer.js +2 -1
  66. package/runtime-dynamic/components/partial-content.js +2 -1
  67. package/runtime-dynamic/components/wmx-placeholder.d.ts +18 -0
  68. package/runtime-dynamic/components/wmx-placeholder.js +48 -0
  69. package/runtime-dynamic/main.js +6 -0
  70. package/runtime-dynamic/services/compile-render.js +75 -12
  71. package/store/slices/i18nSlice.d.ts +0 -1
  72. package/store/slices/i18nSlice.js +0 -2
  73. package/utils/layoutsize-util.js +12 -7
  74. package/utils/style-utils.d.ts +6 -0
  75. package/utils/style-utils.js +10 -0
  76. package/utils/wmx.utils.d.ts +6 -0
  77. package/utils/wmx.utils.js +41 -0
  78. package/variables/crud-variable.js +1 -1
  79. package/variables/live-variable.js +1 -1
  80. package/variables/service-variable.js +6 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wavemaker-ai/react-runtime",
3
- "version": "1.0.0-rc.326",
3
+ "version": "1.0.0-rc.330",
4
4
  "description": "React runtime package for Wavemaker",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -58,8 +58,8 @@
58
58
  "@mui/x-date-pickers": "8.5.3",
59
59
  "@reduxjs/toolkit": "2.9.1",
60
60
  "@tanstack/react-table": "8.21.3",
61
- "@wavemaker-ai/react-codegen": "1.0.0-rc.326",
62
- "@wavemaker-ai/variables": "1.0.0-rc.326",
61
+ "@wavemaker-ai/react-codegen": "1.0.0-rc.330",
62
+ "@wavemaker-ai/variables": "1.0.0-rc.330",
63
63
  "@wavemaker/nvd3": "1.8.16",
64
64
  "axios": "1.15.1",
65
65
  "d3": "7.8.5",
@@ -36,6 +36,7 @@ import { isRuntimePreviewPrefab } from "./preview-mode";
36
36
  import { createLazyPartial } from "./services/variable-registry";
37
37
  import { resolvePreviewFetchUrl } from "./preview-resource-base";
38
38
  import { fetchResource } from "./services/resource-manager";
39
+ import { loadAppExtensions } from "./services/app-extension-provider";
39
40
  async function fetchOptionalText(url) {
40
41
  var _a;
41
42
  try {
@@ -207,6 +208,7 @@ async function initializeApp() {
207
208
  initAppModes();
208
209
  setupAxiosInterceptors();
209
210
  await dispatchInitialConfig();
211
+ await loadAppExtensions();
210
212
  const isPrefabPreview = isRuntimePreviewPrefab();
211
213
  syncAppstoreCommonPartial(isPrefabPreview);
212
214
  if (!isPrefabPreview) {
@@ -217,7 +219,6 @@ async function initializeApp() {
217
219
  loadAppVariables(),
218
220
  loadAppScript(),
219
221
  isPrefabPreview ? Promise.resolve({}) : loadCustomFormatters()
220
- // loadAppExtensions(),
221
222
  ]);
222
223
  appVariablesJson = loadedVariables;
223
224
  customFormatters = loadedFormatters;
@@ -28,6 +28,7 @@ import { ComponentErrorBoundary } from "./ErrorBoundary";
28
28
  import { useDynamicComponent } from "./use-dynamic-component";
29
29
  const WmPartialContent = memo(
30
30
  (props) => {
31
+ var _a;
31
32
  const { Component } = useDynamicComponent(props == null ? void 0 : props.content, ComponentType.PARTIAL);
32
33
  const handleOnLoad = useCallback(
33
34
  (widget) => {
@@ -40,7 +41,7 @@ const WmPartialContent = memo(
40
41
  const mergedProps = __spreadProps(__spreadValues({}, props), {
41
42
  onLoad: handleOnLoad
42
43
  });
43
- return /* @__PURE__ */ jsx("div", { className: clsx(props.content && `app-partial-${props.content}`), children: /* @__PURE__ */ jsx(Container, { className: "partial-container", children: /* @__PURE__ */ jsx(ComponentErrorBoundary, { scope: "partial", componentName: props.content, children: Component && /* @__PURE__ */ jsx(Component, __spreadValues({}, mergedProps)) }) }) });
44
+ return /* @__PURE__ */ jsx("div", { className: clsx(props.content && `app-partial-${(_a = props.content) == null ? void 0 : _a.toLocaleLowerCase()}`), children: /* @__PURE__ */ jsx(Container, { className: "partial-container", style: { height: "inherit" }, children: /* @__PURE__ */ jsx(ComponentErrorBoundary, { scope: "partial", componentName: props.content, children: Component && /* @__PURE__ */ jsx(Component, __spreadValues({}, mergedProps)) }) }) });
44
45
  },
45
46
  (prevProps, nextProps) => {
46
47
  const staticKeys = [
@@ -0,0 +1,18 @@
1
+ export type WmxComponentPlaceholderProps = {
2
+ /** Studio markup: componentname="MultiSelect" → renders as `<MultiSelect/>` */
3
+ componentname?: string;
4
+ componentName?: string;
5
+ name?: string;
6
+ className?: string;
7
+ class?: string;
8
+ };
9
+ /** Short widget label for placeholder text (e.g. MultiSelect, not WmxMultiSelect). */
10
+ export declare function resolveWmxPlaceholderLabel(props: WmxComponentPlaceholderProps, scopeTag?: string): string;
11
+ /**
12
+ * Generic fallback when a WMX widget is not registered in preview.
13
+ * Matches Studio placeholder: dashed box + `<ComponentName/>` in serif gray type.
14
+ */
15
+ export declare function WmxComponentPlaceholder(props: WmxComponentPlaceholderProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare namespace WmxComponentPlaceholder {
17
+ var displayName: string;
18
+ }
@@ -0,0 +1,48 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import Box from "@mui/material/Box";
3
+ function resolveWmxPlaceholderLabel(props, scopeTag) {
4
+ var _a;
5
+ const fromProp = (_a = props.componentname) != null ? _a : props.componentName;
6
+ if (fromProp) return String(fromProp);
7
+ if (scopeTag == null ? void 0 : scopeTag.startsWith("Wmx")) return scopeTag.slice(3);
8
+ if (scopeTag) return scopeTag;
9
+ return "Component";
10
+ }
11
+ const PLACEHOLDER_SX = {
12
+ display: "flex",
13
+ alignItems: "center",
14
+ justifyContent: "center",
15
+ width: "100%",
16
+ minHeight: 120,
17
+ boxSizing: "border-box",
18
+ padding: 3,
19
+ backgroundColor: "#f2f2f2",
20
+ border: "1px dashed #8c8c8c",
21
+ fontFamily: 'Georgia, "Times New Roman", Times, serif',
22
+ fontSize: "2.25rem",
23
+ fontWeight: 400,
24
+ color: "#b8b8b8",
25
+ lineHeight: 1.2,
26
+ textAlign: "center"
27
+ };
28
+ function WmxComponentPlaceholder(props) {
29
+ const label = resolveWmxPlaceholderLabel(props);
30
+ const tagText = `<${label}/>`;
31
+ const className = ["wm-wmx-component-placeholder", props.className, props.class].filter(Boolean).join(" ");
32
+ return /* @__PURE__ */ jsx(
33
+ Box,
34
+ {
35
+ className,
36
+ "data-wmx-component": label,
37
+ role: "status",
38
+ "aria-label": `WMX component placeholder: ${tagText}`,
39
+ sx: PLACEHOLDER_SX,
40
+ children: tagText
41
+ }
42
+ );
43
+ }
44
+ WmxComponentPlaceholder.displayName = "WmxComponentPlaceholder";
45
+ export {
46
+ WmxComponentPlaceholder,
47
+ resolveWmxPlaceholderLabel
48
+ };
@@ -3,7 +3,13 @@ import { createRoot } from "react-dom/client";
3
3
  import wmGlobalsCss from "@wavemaker-ai/react-codegen/styles/wm-styles.css";
4
4
  import { App, initPreviewRuntimeRouter } from "./App";
5
5
  import { initializeApp } from "./app-initializer";
6
+ import { registerCustomWidget, getCustomWidget, hasCustomWidget } from "./registry";
6
7
  import { createAppRouter } from "./routes";
8
+ window.WMPreview = {
9
+ registerCustomWidget,
10
+ getCustomWidget,
11
+ hasCustomWidget
12
+ };
7
13
  function injectGlobalStyles() {
8
14
  if (document.querySelector('style[data-wm-scope="globals"]')) return;
9
15
  const style = document.createElement("style");
@@ -1,11 +1,35 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
1
20
  import React from "react";
2
21
  import { transform } from "sucrase";
3
22
  import { getComponent } from "../registry/component-registry";
23
+ import { getCustomWidget } from "../registry/custom-widget-registry";
24
+ import {
25
+ WmxComponentPlaceholder
26
+ } from "../components/wmx-placeholder";
4
27
  import { formatMessage, _get, toNumber } from "../../core/util";
5
28
  import { getPartialNames } from "../app-initializer";
6
29
  import { createLazyPartial } from "./variable-registry";
7
30
  const compiledCache = /* @__PURE__ */ new Map();
8
31
  const componentNameCache = /* @__PURE__ */ new Map();
32
+ const wmxComponentNameCache = /* @__PURE__ */ new Map();
9
33
  const UTIL_SCOPE = {
10
34
  formatMessage,
11
35
  _get,
@@ -24,6 +48,47 @@ function extractMarkupComponents(markup) {
24
48
  componentNameCache.set(markup, result);
25
49
  return result;
26
50
  }
51
+ function extractWmxComponents(markup) {
52
+ const cached = wmxComponentNameCache.get(markup);
53
+ if (cached) return cached;
54
+ const matches = markup.match(/\bWmx[A-Z]\w*/g);
55
+ const result = matches ? [...new Set(matches)] : [];
56
+ wmxComponentNameCache.set(markup, result);
57
+ return result;
58
+ }
59
+ function tryAddScopeComponent(name, seen, names, values) {
60
+ var _a;
61
+ if (seen.has(name)) return false;
62
+ const component = (_a = getComponent(name)) != null ? _a : getCustomWidget(name);
63
+ if (!component) return false;
64
+ seen.add(name);
65
+ names.push(name);
66
+ values.push(component);
67
+ return true;
68
+ }
69
+ function tryAddWmxScopeComponent(scopeName, seen, names, values) {
70
+ if (seen.has(scopeName)) return false;
71
+ const registered = getCustomWidget(scopeName);
72
+ if (registered) {
73
+ seen.add(scopeName);
74
+ names.push(scopeName);
75
+ values.push(registered);
76
+ return true;
77
+ }
78
+ const component = (props) => {
79
+ var _a, _b;
80
+ return React.createElement(WmxComponentPlaceholder, __spreadProps(__spreadValues({}, props), {
81
+ componentname: (_b = (_a = props.componentname) != null ? _a : props.componentName) != null ? _b : scopeName.replace(/^Wmx/, "")
82
+ }));
83
+ };
84
+ seen.add(scopeName);
85
+ names.push(scopeName);
86
+ values.push(component);
87
+ console.warn(
88
+ `[markup-transpiler] WMX "${scopeName}" not registered \u2014 placeholder shown. Load app.extensions.js.`
89
+ );
90
+ return true;
91
+ }
27
92
  function resolveScope(imports, appState, markup) {
28
93
  const fragment = appState;
29
94
  const names = ["React", "fragment", "Widgets", "Variables"];
@@ -33,11 +98,11 @@ function resolveScope(imports, appState, markup) {
33
98
  for (const importDef of imports) {
34
99
  const name = importDef.as || importDef.name;
35
100
  if (seen.has(name)) continue;
36
- const component = getComponent(name);
37
- if (component) {
38
- seen.add(name);
39
- names.push(name);
40
- values.push(component);
101
+ if (name.startsWith("Wmx")) {
102
+ tryAddWmxScopeComponent(name, seen, names, values);
103
+ continue;
104
+ }
105
+ if (tryAddScopeComponent(name, seen, names, values)) {
41
106
  continue;
42
107
  }
43
108
  const partialName = [...knownPartials].find((p) => p.toLowerCase() === name.toLowerCase());
@@ -52,13 +117,10 @@ function resolveScope(imports, appState, markup) {
52
117
  }
53
118
  if (markup) {
54
119
  for (const name of extractMarkupComponents(markup)) {
55
- if (seen.has(name)) continue;
56
- const component = getComponent(name);
57
- if (component) {
58
- seen.add(name);
59
- names.push(name);
60
- values.push(component);
61
- }
120
+ tryAddScopeComponent(name, seen, names, values);
121
+ }
122
+ for (const name of extractWmxComponents(markup)) {
123
+ tryAddWmxScopeComponent(name, seen, names, values);
62
124
  }
63
125
  }
64
126
  for (const [name, value] of Object.entries(UTIL_SCOPE)) {
@@ -133,6 +195,7 @@ return __render__();`;
133
195
  function clearCompiledCache() {
134
196
  compiledCache.clear();
135
197
  componentNameCache.clear();
198
+ wmxComponentNameCache.clear();
136
199
  lazyPartialCache.clear();
137
200
  }
138
201
  export {
@@ -1,7 +1,6 @@
1
1
  export interface I18nState {
2
2
  selectedLocale: string;
3
3
  /** Bumped on each bundle load so React trees can re-bind locale labels globally. */
4
- localeRevision: number;
5
4
  defaultSupportedLocale: string;
6
5
  appLocale: any;
7
6
  dateFormat: string;
@@ -70,7 +70,6 @@ const RTL_LANGUAGE_CODES = [
70
70
  ];
71
71
  const initialState = {
72
72
  selectedLocale: "",
73
- localeRevision: 0,
74
73
  defaultSupportedLocale: "en",
75
74
  appLocale: {},
76
75
  dateFormat: "MMM d, y",
@@ -189,7 +188,6 @@ const i18nSlice = createSlice({
189
188
  state.dateTimeFormat = `${state.dateFormat} ${state.timeFormat}`;
190
189
  state.prefabMessages = action.payload.data.prefabMessages || {};
191
190
  state.selectedLocale = action.payload.locale || state.selectedLocale;
192
- state.localeRevision += 1;
193
191
  }).addCase(loadLocaleBundle.rejected, (state, action) => {
194
192
  state.error = action.payload;
195
193
  });
@@ -1,12 +1,15 @@
1
1
  function applySize(el, key, nv) {
2
2
  const parent = el.parentElement;
3
3
  const parentStyle = parent ? getComputedStyle(parent) : null;
4
- const isParentFlex = !!parentStyle && ["flex", "inline-flex"].includes(parentStyle.display);
5
- let isMainAxis = false;
4
+ const isLayoutWrapper = !!parent && (parent.classList.contains("app-page-content") || parent.classList.contains("app-content-column"));
5
+ const isParentFlex = !isLayoutWrapper && !!parentStyle && ["flex", "inline-flex"].includes(parentStyle.display);
6
+ let isWidthMainAxis = false;
7
+ let isHeightMainAxis = false;
6
8
  if (isParentFlex) {
7
9
  const flexDir = parentStyle.flexDirection;
8
10
  const isRow = ["row", "row-reverse"].includes(flexDir);
9
- isMainAxis = key === "width" && isRow || key === "height" && !isRow;
11
+ isWidthMainAxis = key === "width" && isRow;
12
+ isHeightMainAxis = key === "height" && !isRow;
10
13
  }
11
14
  const minKey = key === "width" ? "minWidth" : "minHeight";
12
15
  if (nv === "fill") {
@@ -14,9 +17,10 @@ function applySize(el, key, nv) {
14
17
  el.style[key] = "100%";
15
18
  } else {
16
19
  el.style[key] = "";
17
- if (isMainAxis) {
20
+ if (isWidthMainAxis || isHeightMainAxis) {
18
21
  el.style.flexGrow = "1";
19
- el.style.flexShrink = "";
22
+ el.style.flexShrink = "0";
23
+ el.style.flexBasis = isHeightMainAxis ? "" : "0";
20
24
  el.style[minKey] = "0";
21
25
  } else {
22
26
  el.style.alignSelf = "stretch";
@@ -27,8 +31,8 @@ function applySize(el, key, nv) {
27
31
  el.style[key] = "fit-content";
28
32
  }
29
33
  if (isParentFlex) {
30
- if (isMainAxis) {
31
- el.style.flexGrow = "";
34
+ if (isWidthMainAxis || isHeightMainAxis) {
35
+ el.style.flexBasis = "";
32
36
  el.style.flexShrink = "0";
33
37
  el.style[minKey] = "";
34
38
  } else {
@@ -37,6 +41,7 @@ function applySize(el, key, nv) {
37
41
  } else {
38
42
  el.style.flexGrow = "";
39
43
  el.style.flexShrink = "0";
44
+ el.style.flexBasis = "";
40
45
  el.style.alignSelf = "";
41
46
  el.style[minKey] = "";
42
47
  }
@@ -28,3 +28,9 @@ export declare const filterAutoLayoutClasses: (layoutClassName: string | undefin
28
28
  export declare const toCssLength: (value: string | number) => string;
29
29
  /** Ensures a CSS `background-image` value is wrapped in `url(...)` when needed. */
30
30
  export declare const normalizeBackgroundImage: (value: string) => string;
31
+ export declare function getFragmentCssScopeClass(appState: {
32
+ componentName?: string;
33
+ name?: string;
34
+ componentType?: string;
35
+ type?: string;
36
+ } | null): string | undefined;
@@ -1,3 +1,4 @@
1
+ import { getCurrentPath } from "../core/util/utils";
1
2
  const sanitizeStyleObject = (styleObj) => {
2
3
  if (!styleObj || typeof styleObj !== "object") {
3
4
  return {};
@@ -33,8 +34,17 @@ const filterAutoLayoutClasses = (layoutClassName, prefixesToGet, mode = "include
33
34
  };
34
35
  const toCssLength = (value) => typeof value === "number" ? `${value}px` : String(value);
35
36
  const normalizeBackgroundImage = (value) => value.includes("url(") ? value : `url(${value})`;
37
+ function getFragmentCssScopeClass(appState) {
38
+ const name = ((appState == null ? void 0 : appState.componentName) || (appState == null ? void 0 : appState.name) || getCurrentPath().split("/").pop() || "").toLowerCase();
39
+ if (!name) return void 0;
40
+ const type = String((appState == null ? void 0 : appState.componentType) || (appState == null ? void 0 : appState.type) || "PAGE").toUpperCase();
41
+ if (type === "PARTIAL") return `app-partial-${name}`;
42
+ if (type === "PREFAB") return `app-prefab-${name}`;
43
+ return `app-page-${name}`;
44
+ }
36
45
  export {
37
46
  filterAutoLayoutClasses,
47
+ getFragmentCssScopeClass,
38
48
  isValidStyleObject,
39
49
  mergeStyleObjects,
40
50
  normalizeBackgroundImage,
@@ -0,0 +1,6 @@
1
+ import { ComponentType } from "react";
2
+ export type WmxComponentModule = Record<string, ComponentType<any>>;
3
+ export declare const registerWmxComponents: (module: WmxComponentModule) => void;
4
+ export declare const getWmxModule: () => WmxComponentModule | null;
5
+ export declare const getWmxComponentName: (widgetName: string) => string | null;
6
+ export declare const loadWmxComponent: (componentName: string) => Promise<ComponentType<any> | null>;
@@ -0,0 +1,41 @@
1
+ let _registeredModule = null;
2
+ const registerWmxComponents = (module) => {
3
+ _registeredModule = module;
4
+ };
5
+ const getWmxModule = () => _registeredModule;
6
+ const getWmxComponentName = (widgetName) => {
7
+ var _a;
8
+ if (!(widgetName == null ? void 0 : widgetName.includes("wmx-"))) return null;
9
+ const componentName = (_a = widgetName.split("-")) == null ? void 0 : _a[1];
10
+ return componentName || null;
11
+ };
12
+ const resolveWmxComponent = (module, componentName) => {
13
+ const prefixedComponentName = `Wmx${componentName}`;
14
+ const namedExport = module[prefixedComponentName];
15
+ return namedExport;
16
+ };
17
+ const loadWmxComponent = async (componentName) => {
18
+ try {
19
+ const module = _registeredModule;
20
+ if (!module) {
21
+ console.warn("wmx modules not found");
22
+ const fallbackModule = await import("../components/input/text");
23
+ return fallbackModule.default;
24
+ }
25
+ const component = resolveWmxComponent(module, componentName);
26
+ if (!component) {
27
+ throw new Error(`WMX component "${componentName}" has no default export.`);
28
+ }
29
+ return component;
30
+ } catch (error) {
31
+ console.warn(`WMX component "${componentName}" failed to load, falling back to WmText.`, error);
32
+ const fallbackModule = await import("../components/input/text");
33
+ return fallbackModule.default;
34
+ }
35
+ };
36
+ export {
37
+ getWmxComponentName,
38
+ getWmxModule,
39
+ loadWmxComponent,
40
+ registerWmxComponents
41
+ };
@@ -59,7 +59,7 @@ class CrudVariable extends _CrudVariable {
59
59
  onError: (context, args) => {
60
60
  this.notify(VariableEvents.AFTER_INVOKE, [args.variable, args.data, args.options]);
61
61
  this.notify(VariableEvents.ERROR, [args.variable, args.data, args.options]);
62
- if (args.data.includes("Violation")) {
62
+ if (args.data.includes("Violation") && !config.onError) {
63
63
  EventNotifier.ROOT.notify("SERVICE_ERROR", [args.variable, args.data, args.options]);
64
64
  }
65
65
  return config.onError && config.onError(args.variable, args.data, args.options);
@@ -62,7 +62,7 @@ class LiveVariable extends _LiveVariable {
62
62
  onError: (context, args) => {
63
63
  this.notify(VariableEvents.AFTER_INVOKE, [args.variable, args.data, args.options]);
64
64
  this.notify(VariableEvents.ERROR, [args.variable, args.data, args.options]);
65
- if (args.data.includes("Violation")) {
65
+ if (args.data.includes("Violation") && !config.onError) {
66
66
  EventNotifier.ROOT.notify("SERVICE_ERROR", [args.variable, args.data, args.options]);
67
67
  }
68
68
  return config.onError && config.onError(args.variable, args.data, args.options);
@@ -20,8 +20,11 @@ class ServiceVariable extends _ServiceVariable {
20
20
  }
21
21
  let variableConfig = {
22
22
  name: config.name,
23
- dataSet: config.paramProvider(),
24
- // Default empty value
23
+ // List variables must start empty ([]), not with the request-parameter object
24
+ // paramProvider() builds (filters/offset/limit/sort etc.) — otherwise a table bound
25
+ // to this variable briefly renders that params object as a phantom row before the
26
+ // real response arrives. Non-list variables (e.g. forms) still seed from paramProvider.
27
+ dataSet: config.isList !== false ? [] : config.paramProvider(),
25
28
  dataBinding: {},
26
29
  firstRecord: {},
27
30
  lastRecord: {},
@@ -49,7 +52,7 @@ class ServiceVariable extends _ServiceVariable {
49
52
  onError: (context, args) => {
50
53
  this.notify(VariableEvents.AFTER_INVOKE, [args.variable, args.data, args.options]);
51
54
  this.notify(VariableEvents.ERROR, [args.variable, args.data, args.options]);
52
- if (args.data.includes("Violation")) {
55
+ if (args.data.includes("Violation") || !config.onError) {
53
56
  EventNotifier.ROOT.notify("SERVICE_ERROR", [args.variable, args.data, args.options]);
54
57
  }
55
58
  return config.onError && config.onError(args.variable, args.data, args.options);