@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.
- package/components/advanced/carousel/index.d.ts +1 -0
- package/components/advanced/carousel/template.d.ts +1 -0
- package/components/advanced/login/index.d.ts +1 -0
- package/components/advanced/marquee/index.d.ts +1 -0
- package/components/basic/anchor/index.d.ts +1 -0
- package/components/basic/anchor/index.js +3 -5
- package/components/basic/audio/index.d.ts +1 -0
- package/components/basic/html/index.d.ts +1 -0
- package/components/basic/icon/index.d.ts +1 -0
- package/components/basic/iframe/index.d.ts +1 -0
- package/components/basic/label/index.d.ts +1 -0
- package/components/basic/picture/index.d.ts +1 -0
- package/components/basic/progress-bar/index.d.ts +1 -0
- package/components/basic/progress-circle/index.d.ts +1 -0
- package/components/basic/richtexteditor/index.d.ts +3 -0
- package/components/basic/search/index.js +5 -4
- package/components/basic/search/utils.d.ts +1 -0
- package/components/basic/search/utils.js +9 -0
- package/components/basic/spinner/index.d.ts +1 -0
- package/components/basic/tile/index.d.ts +1 -0
- package/components/basic/tree/index.d.ts +1 -0
- package/components/basic/video/index.d.ts +1 -0
- package/components/chart/index.d.ts +1 -0
- package/components/common/index.d.ts +2 -0
- package/components/common/index.js +2 -0
- package/components/common/partial-content-wrapper.d.ts +15 -0
- package/components/common/partial-content-wrapper.js +11 -0
- package/components/container/accordion/accordion-pane/index.d.ts +1 -0
- package/components/container/accordion/index.d.ts +1 -0
- package/components/container/index.d.ts +4 -0
- package/components/container/index.js +38 -11
- package/components/container/layout-grid/grid-column/index.d.ts +1 -0
- package/components/container/layout-grid/grid-row/index.d.ts +1 -0
- package/components/container/layout-grid/index.d.ts +1 -0
- package/components/container/layout-grid/index.js +1 -1
- package/components/container/linear-layout/index.d.ts +1 -0
- package/components/container/linear-layout/linear-layout-item/index.d.ts +1 -0
- package/components/container/panel/index.d.ts +1 -0
- package/components/container/props.d.ts +1 -0
- package/components/container/repeat-template/index.d.ts +1 -0
- package/components/container/repeat-template/index.js +1 -1
- package/components/container/tabs/index.d.ts +1 -0
- package/components/container/tabs/index.js +12 -8
- package/components/container/tabs/tab-pane/index.d.ts +1 -0
- package/components/container/tabs/tab-pane/index.js +2 -2
- package/components/container/wizard/index.d.ts +2 -0
- package/components/container/wizard/index.js +92 -43
- package/components/container/wizard/props.d.ts +2 -2
- package/components/container/wizard/wizard-step/index.d.ts +1 -0
- package/components/data/card/card-actions/index.d.ts +1 -0
- package/components/data/card/card-content/index.d.ts +1 -0
- package/components/data/card/card-footer/index.d.ts +1 -0
- package/components/data/card/index.d.ts +1 -0
- package/components/data/form/base-form/hooks/useFormOperations.d.ts +1 -1
- package/components/data/form/base-form/hooks/useFormOperations.js +5 -2
- package/components/data/form/base-form/index.js +10 -14
- package/components/data/form/base-form/props.d.ts +1 -0
- package/components/data/form/dynamic-fields/WmxDynamicFormField.js +9 -23
- package/components/data/form/form-action/index.d.ts +2 -0
- package/components/data/form/form-controller/props.d.ts +2 -0
- package/components/data/form/form-controller/utils.js +3 -2
- package/components/data/form/form-controller/validation-contrustor.js +112 -1
- package/components/data/form/form-controller/withFormController.js +16 -3
- package/components/data/form/form-field/index.js +38 -11
- package/components/data/form/form-field/props.d.ts +8 -2
- package/components/data/list/components/ListItemWithTemplate.js +1 -1
- package/components/data/list/index.d.ts +2 -0
- package/components/data/list/index.js +5 -10
- package/components/data/pagination/hooks/usePagination.js +6 -6
- package/components/data/table/components/EditableCell.js +47 -24
- package/components/data/table/components/FieldValidationError.js +1 -1
- package/components/data/table/components/RowExpansionButton.js +5 -1
- package/components/data/table/components/TableBody.js +2 -0
- package/components/data/table/components/TableHeader.js +12 -4
- package/components/data/table/hooks/useFormWidget.js +13 -2
- package/components/data/table/hooks/usePanelStructure.js +6 -1
- package/components/data/table/hooks/useResponsiveColumns.d.ts +1 -0
- package/components/data/table/hooks/useRowHandlers.js +1 -1
- package/components/data/table/hooks/useRowSelection.js +65 -4
- package/components/data/table/hooks/useTableData.js +10 -2
- package/components/data/table/hooks/useTableEdit.d.ts +1 -1
- package/components/data/table/hooks/useTableEdit.js +115 -75
- package/components/data/table/hooks/useTableEditForms.d.ts +25 -0
- package/components/data/table/hooks/useTableEditForms.js +30 -0
- package/components/data/table/index.d.ts +2 -0
- package/components/data/table/index.js +82 -45
- package/components/data/table/live-table/index.d.ts +1 -0
- package/components/data/table/props.d.ts +43 -23
- package/components/data/table/table-action/index.d.ts +1 -0
- package/components/data/table/table-column/index.d.ts +1 -0
- package/components/data/table/table-row/index.d.ts +1 -0
- package/components/data/table/table-row-action/index.d.ts +1 -0
- package/components/data/table/utils/buildSelectionColumns.js +19 -24
- package/components/data/table/utils/columnProxy.d.ts +7 -1
- package/components/data/table/utils/columnProxy.js +21 -1
- package/components/data/table/utils/columnValidation.d.ts +19 -0
- package/components/data/table/utils/columnValidation.js +76 -0
- package/components/data/table/utils/constants.d.ts +2 -0
- package/components/data/table/utils/constants.js +2 -0
- package/components/data/table/utils/crud-handlers.js +3 -1
- package/components/data/table/utils/expansionColumn.js +1 -1
- package/components/data/table/utils/index.d.ts +14 -15
- package/components/data/table/utils/index.js +18 -85
- package/components/data/table/utils/selectionUtils.d.ts +12 -0
- package/components/data/table/utils/selectionUtils.js +23 -5
- package/components/dialogs/alert-dialog/index.d.ts +2 -0
- package/components/dialogs/confirm-dialog/index.d.ts +2 -0
- package/components/dialogs/dialog/index.d.ts +2 -0
- package/components/dialogs/dialog-actions/index.d.ts +1 -0
- package/components/dialogs/dialog-body/index.d.ts +1 -0
- package/components/dialogs/dialog-content/index.d.ts +1 -0
- package/components/dialogs/dialog-header/index.d.ts +1 -0
- package/components/dialogs/iframe-dialog/index.d.ts +2 -0
- package/components/dialogs/login-dialog/index.d.ts +2 -0
- package/components/dialogs/page-dialog/index.d.ts +2 -0
- package/components/dialogs/withDialogWrapper.js +12 -2
- package/components/form/button/index.d.ts +1 -0
- package/components/form/button-group/index.d.ts +1 -0
- package/components/input/calendar/index.d.ts +2 -0
- package/components/input/chips/index.d.ts +3 -0
- package/components/input/color-picker/index.d.ts +3 -0
- package/components/input/composite/index.d.ts +1 -0
- package/components/input/composite/index.js +32 -6
- package/components/input/currency/index.d.ts +1 -0
- package/components/input/default/checkbox/index.d.ts +3 -0
- package/components/input/default/checkboxset/index.d.ts +3 -0
- package/components/input/default/radioset/index.d.ts +3 -0
- package/components/input/default/switch/index.d.ts +3 -0
- package/components/input/epoch/date/index.d.ts +1 -0
- package/components/input/epoch/datetime/index.d.ts +1 -0
- package/components/input/epoch/datetime/index.js +13 -3
- package/components/input/epoch/time/index.d.ts +1 -0
- package/components/input/fileupload/index.d.ts +1 -0
- package/components/input/fileupload/index.js +2 -1
- package/components/input/number/index.d.ts +3 -0
- package/components/input/rating/index.d.ts +3 -0
- package/components/input/select/index.d.ts +1 -0
- package/components/input/slider/index.d.ts +3 -0
- package/components/input/text/index.d.ts +3 -0
- package/components/input/text/index.js +9 -2
- package/components/input/textarea/index.d.ts +3 -0
- package/components/input/upload/index.d.ts +3 -0
- package/components/layout/footer/index.js +4 -2
- package/components/layout/footer/props.d.ts +1 -0
- package/components/layout/header/index.js +29 -3
- package/components/layout/header/props.d.ts +1 -0
- package/components/layout/leftnav/index.js +22 -6
- package/components/layout/leftnav/props.d.ts +1 -0
- package/components/layout/leftnav/utils/page-class-util.d.ts +1 -0
- package/components/layout/leftnav/utils/page-class-util.js +4 -3
- package/components/layout/rightnav/index.js +4 -2
- package/components/layout/rightnav/props.d.ts +1 -0
- package/components/layout/topnav/index.js +4 -2
- package/components/layout/topnav/props.d.ts +1 -0
- package/components/navbar/index.d.ts +1 -0
- package/components/navbar/index.js +32 -7
- package/components/navbar/nav-item/index.d.ts +1 -0
- package/components/navigation/breadcrumb/index.d.ts +1 -0
- package/components/navigation/menu/index.d.ts +1 -0
- package/components/navigation/menu/index.js +19 -11
- package/components/navigation/menu/props.d.ts +1 -0
- package/components/navigation/popover/index.d.ts +1 -0
- package/components/navigation/popover/index.js +15 -3
- package/components/page/index.js +60 -19
- package/components/page/page-context.d.ts +4 -0
- package/components/page/partial/index.d.ts +1 -0
- package/context/PopoverContext.d.ts +5 -0
- package/context/PopoverContext.js +5 -0
- package/context/WidgetProvider.js +9 -2
- package/core/proxy-service.d.ts +2 -0
- package/core/proxy-service.js +132 -22
- package/higherOrder/BaseApp.js +3 -2
- package/higherOrder/BasePage.js +4 -10
- package/higherOrder/props.d.ts +1 -0
- package/higherOrder/useActivePageReactivity.js +1 -4
- package/higherOrder/withBaseWrapper.js +12 -3
- package/hooks/useHttp.d.ts +14 -4
- package/hooks/useHttp.js +47 -9
- package/package-lock.json +332 -325
- package/package.json +3 -3
- package/runtime-dynamic/App.js +21 -2
- package/runtime-dynamic/app-initializer.js +8 -1
- package/runtime-dynamic/components/PageWrapper.js +1 -1
- package/runtime-dynamic/components/PrefabPreview.js +1 -1
- package/runtime-dynamic/components/partial-content.js +17 -1
- package/runtime-dynamic/factories/build-base-page-like-component.js +11 -7
- package/runtime-dynamic/factories/dynamic-component.js +5 -10
- package/runtime-dynamic/main.d.ts +1 -0
- package/runtime-dynamic/main.js +9 -1
- package/runtime-dynamic/routes.js +17 -8
- package/runtime-dynamic/services/compile-render.js +7 -0
- package/runtime-dynamic/services/css-scoping.d.ts +1 -1
- package/runtime-dynamic/services/css-scoping.js +2 -2
- package/runtime-dynamic/services/variable-factory.js +2 -1
- package/runtime-dynamic/services/variable-transpiler.js +4 -1
- package/runtime-dynamic/wmx-shared.d.ts +40 -0
- package/runtime-dynamic/wmx-shared.js +33 -0
- package/utils/page-params-util.js +22 -1
- package/utils/partial-host-util.d.ts +40 -0
- package/utils/partial-host-util.js +41 -0
- package/utils/style-utils.js +1 -1
- package/utils/wmx.utils.d.ts +0 -1
- package/utils/wmx.utils.js +0 -25
- package/variables/crud-variable.d.ts +10 -0
- package/variables/crud-variable.js +53 -2
- package/variables/live-variable.d.ts +1 -0
- package/variables/live-variable.js +2 -1
- package/variables/model-variable.d.ts +2 -0
- package/variables/model-variable.js +14 -0
- package/variables/operation-params.d.ts +29 -0
- package/variables/operation-params.js +69 -0
- package/variables/service-variable.d.ts +9 -0
- package/variables/service-variable.js +21 -2
- package/components/data/table/utils/validation.d.ts +0 -13
- package/components/data/table/utils/validation.js +0 -82
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavemaker-ai/react-runtime",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0-rc.335",
|
|
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": "
|
|
62
|
-
"@wavemaker-ai/variables": "
|
|
61
|
+
"@wavemaker-ai/react-codegen": "12.0.0-rc.335",
|
|
62
|
+
"@wavemaker-ai/variables": "12.0.0-rc.335",
|
|
63
63
|
"@wavemaker/nvd3": "1.8.16",
|
|
64
64
|
"axios": "1.15.1",
|
|
65
65
|
"d3": "7.8.5",
|
package/runtime-dynamic/App.js
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
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 { Fragment, jsx } from "react/jsx-runtime";
|
|
2
21
|
import { Provider } from "react-redux";
|
|
3
22
|
import { RouterProvider } from "react-router-dom";
|
|
@@ -93,7 +112,7 @@ function initPreviewRuntimeRouter(router) {
|
|
|
93
112
|
pathname: pathname || "/",
|
|
94
113
|
search: search ? `?${search}` : ""
|
|
95
114
|
};
|
|
96
|
-
router.navigate(navigationPayload, options);
|
|
115
|
+
router.navigate(navigationPayload, __spreadProps(__spreadValues({}, options), { flushSync: true }));
|
|
97
116
|
}
|
|
98
117
|
setRouter({
|
|
99
118
|
push: (path) => navigateWithSearchParams(path),
|
|
@@ -108,7 +127,7 @@ function App() {
|
|
|
108
127
|
"initPreviewRuntimeRouter() must be called after initializeApp() and before render."
|
|
109
128
|
);
|
|
110
129
|
}
|
|
111
|
-
return /* @__PURE__ */ jsx(Provider, { store, children: /* @__PURE__ */ jsx(LocalizationProvider, { children: /* @__PURE__ */ jsx(WmThemeProvider, { children: /* @__PURE__ */ jsx(
|
|
130
|
+
return /* @__PURE__ */ jsx(Provider, { store, children: /* @__PURE__ */ jsx(LocalizationProvider, { children: /* @__PURE__ */ jsx(WmThemeProvider, { children: /* @__PURE__ */ jsx(WmApp, { children: /* @__PURE__ */ jsx(ToastProvider, { children: /* @__PURE__ */ jsx(RouterProvider, { router: previewRouter }) }) }) }) }) });
|
|
112
131
|
}
|
|
113
132
|
export {
|
|
114
133
|
App,
|
|
@@ -228,11 +228,18 @@ async function initializeApp() {
|
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
230
|
function getIconCssPathsFromFontConfig() {
|
|
231
|
+
var _a;
|
|
231
232
|
const source = projectConfig.fontConfig;
|
|
232
233
|
if (!source) {
|
|
233
234
|
return [];
|
|
234
235
|
}
|
|
235
|
-
|
|
236
|
+
try {
|
|
237
|
+
const normalized = source.replace(/^\s*export\s+default\s+/m, "").replace(/;?\s*$/, "");
|
|
238
|
+
const fontConfig = new Function(`return (${normalized});`)();
|
|
239
|
+
return ((_a = fontConfig == null ? void 0 : fontConfig.fonts) != null ? _a : []).filter((font) => !!font.csspath).map((font) => font.csspath);
|
|
240
|
+
} catch (e) {
|
|
241
|
+
return [];
|
|
242
|
+
}
|
|
236
243
|
}
|
|
237
244
|
function resolvePreviewIconStylesheetUrl(csspath) {
|
|
238
245
|
if (/^https?:\/\//i.test(csspath) || csspath.startsWith("//")) {
|
|
@@ -9,7 +9,7 @@ function PageWrapper() {
|
|
|
9
9
|
const { pageName } = useParams();
|
|
10
10
|
const { Component, isLoading, error } = useDynamicComponent(pageName, ComponentType.PAGE);
|
|
11
11
|
if (isLoading) {
|
|
12
|
-
return /* @__PURE__ */ jsx(
|
|
12
|
+
return /* @__PURE__ */ jsx("div", { className: "app-loader", children: /* @__PURE__ */ jsx(AppSpinner, { show: true }) });
|
|
13
13
|
}
|
|
14
14
|
if (error) {
|
|
15
15
|
return /* @__PURE__ */ jsx(
|
|
@@ -33,7 +33,7 @@ function PrefabPreview() {
|
|
|
33
33
|
ComponentType.PREFAB
|
|
34
34
|
);
|
|
35
35
|
if (isLoading) {
|
|
36
|
-
return /* @__PURE__ */ jsx(
|
|
36
|
+
return /* @__PURE__ */ jsx("div", { className: "app-loader", children: /* @__PURE__ */ jsx(AppSpinner, { show: true }) });
|
|
37
37
|
}
|
|
38
38
|
if (error) {
|
|
39
39
|
return /* @__PURE__ */ jsx(
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import { jsx } from "react/jsx-runtime";
|
|
21
|
-
import { memo, useCallback } from "react";
|
|
21
|
+
import { memo, useCallback, useContext, useEffect } from "react";
|
|
22
22
|
import clsx from "clsx";
|
|
23
23
|
import Container from "@mui/material/Container";
|
|
24
24
|
import isEqual from "lodash-es/isEqual";
|
|
@@ -26,10 +26,26 @@ import { registerComponent } from "../registry/store";
|
|
|
26
26
|
import { ComponentType } from "../services/fragment-url";
|
|
27
27
|
import { ComponentErrorBoundary } from "./ErrorBoundary";
|
|
28
28
|
import { useDynamicComponent } from "./use-dynamic-component";
|
|
29
|
+
import { WmContainerContext } from "../../components/container";
|
|
29
30
|
const WmPartialContent = memo(
|
|
30
31
|
(props) => {
|
|
31
32
|
var _a;
|
|
32
33
|
const { Component } = useDynamicComponent(props == null ? void 0 : props.content, ComponentType.PARTIAL);
|
|
34
|
+
const containerContext = useContext(WmContainerContext);
|
|
35
|
+
const partialKey = props.partialName || props.prefabName;
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
var _a2;
|
|
38
|
+
if (partialKey) {
|
|
39
|
+
const pageParams = {};
|
|
40
|
+
(_a2 = props.params) == null ? void 0 : _a2.forEach((param) => {
|
|
41
|
+
pageParams[param] = props[param];
|
|
42
|
+
});
|
|
43
|
+
containerContext == null ? void 0 : containerContext.registerPartial(partialKey, __spreadProps(__spreadValues({}, props), {
|
|
44
|
+
pageParams,
|
|
45
|
+
partialParams: pageParams
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
}, [containerContext, partialKey]);
|
|
33
49
|
const handleOnLoad = useCallback(
|
|
34
50
|
(widget) => {
|
|
35
51
|
if (props.onLoad) {
|
|
@@ -21,6 +21,7 @@ import React from "react";
|
|
|
21
21
|
import BasePage from "../../higherOrder/BasePage";
|
|
22
22
|
import { ScriptScope } from "../services/script-executor";
|
|
23
23
|
import { buildDynamicComponent } from "./utils";
|
|
24
|
+
import { store } from "../../store";
|
|
24
25
|
async function buildBasePageLikeComponent(kind, name, fragment) {
|
|
25
26
|
const isPage = kind === "page";
|
|
26
27
|
const WrappedComponent = await buildDynamicComponent(fragment, {
|
|
@@ -28,13 +29,16 @@ async function buildBasePageLikeComponent(kind, name, fragment) {
|
|
|
28
29
|
componentType: isPage ? "page" : "partial",
|
|
29
30
|
scriptScope: isPage ? ScriptScope.PAGE : ScriptScope.PARTIAL,
|
|
30
31
|
hoc: BasePage,
|
|
31
|
-
componentInfo: (startupInfo) =>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
componentInfo: (startupInfo) => {
|
|
33
|
+
var _a;
|
|
34
|
+
return __spreadProps(__spreadValues({
|
|
35
|
+
componentName: name,
|
|
36
|
+
componentType: isPage ? "PAGE" : "PARTIAL"
|
|
37
|
+
}, startupInfo), {
|
|
38
|
+
isPartOfPrefab: false,
|
|
39
|
+
appLocale: (_a = store.getState().i18n) == null ? void 0 : _a.appLocale
|
|
40
|
+
});
|
|
41
|
+
}
|
|
38
42
|
});
|
|
39
43
|
const MemoizedComponent = React.memo(WrappedComponent);
|
|
40
44
|
MemoizedComponent.displayName = isPage ? `BasePage(${name})` : `BasePage_Partial(${name})`;
|
|
@@ -18,7 +18,7 @@ var __spreadValues = (a, b) => {
|
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import { jsx } from "react/jsx-runtime";
|
|
21
|
-
import React, { useEffect, useReducer, useRef } from "react";
|
|
21
|
+
import React, { useEffect, useId, useReducer, useRef } from "react";
|
|
22
22
|
import WmPrefab from "../../components/prefab";
|
|
23
23
|
import { useAppState } from "../../context/WidgetProvider";
|
|
24
24
|
import { useAppContext } from "../../context/AppContext";
|
|
@@ -76,26 +76,21 @@ function createDynamicComponent({
|
|
|
76
76
|
const InnerComponent = (props) => {
|
|
77
77
|
const appState = useAppState();
|
|
78
78
|
usePageEvents(appState, componentType);
|
|
79
|
+
const uniqueId = useId();
|
|
79
80
|
const appContext = useAppContext();
|
|
80
81
|
useCrossScopeDataRefresh(appContext, componentType);
|
|
81
82
|
const notification = appContext == null ? void 0 : appContext.notification;
|
|
82
83
|
useEffect(() => {
|
|
83
84
|
if (styles) {
|
|
84
|
-
scopeComponentStyles(componentName, componentType, styles);
|
|
85
|
+
scopeComponentStyles(componentName, componentType, styles, uniqueId);
|
|
85
86
|
}
|
|
86
87
|
let id = null;
|
|
87
88
|
if (appState) {
|
|
88
|
-
|
|
89
|
-
id = setTimeout(() => {
|
|
90
|
-
appState.pageReady();
|
|
91
|
-
}, 1e3);
|
|
92
|
-
} else {
|
|
93
|
-
appState.pageReady();
|
|
94
|
-
}
|
|
89
|
+
appState.pageReady();
|
|
95
90
|
}
|
|
96
91
|
return () => {
|
|
97
92
|
if (id) clearTimeout(id);
|
|
98
|
-
removeComponentStyles(componentName
|
|
93
|
+
removeComponentStyles(`${componentType}-${componentName}-${uniqueId}`, componentType);
|
|
99
94
|
};
|
|
100
95
|
}, []);
|
|
101
96
|
if (!transpiled) return null;
|
package/runtime-dynamic/main.js
CHANGED
|
@@ -4,11 +4,18 @@ 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
6
|
import { registerCustomWidget, getCustomWidget, hasCustomWidget } from "./registry";
|
|
7
|
+
import { registerWmxComponents } from "../utils/wmx.utils";
|
|
7
8
|
import { createAppRouter } from "./routes";
|
|
9
|
+
import { __wmxShared } from "./wmx-shared";
|
|
8
10
|
window.WMPreview = {
|
|
9
11
|
registerCustomWidget,
|
|
10
12
|
getCustomWidget,
|
|
11
|
-
hasCustomWidget
|
|
13
|
+
hasCustomWidget,
|
|
14
|
+
registerWmxComponents
|
|
15
|
+
// React,
|
|
16
|
+
// ReactDOM,
|
|
17
|
+
// ReactDOMClient,
|
|
18
|
+
// jsxRuntime: ReactJsxRuntime,
|
|
12
19
|
};
|
|
13
20
|
function injectGlobalStyles() {
|
|
14
21
|
if (document.querySelector('style[data-wm-scope="globals"]')) return;
|
|
@@ -56,5 +63,6 @@ const noop = () => {
|
|
|
56
63
|
};
|
|
57
64
|
var main_default = noop;
|
|
58
65
|
export {
|
|
66
|
+
__wmxShared,
|
|
59
67
|
main_default as default
|
|
60
68
|
};
|
|
@@ -18,24 +18,28 @@ function getBasename() {
|
|
|
18
18
|
var _a;
|
|
19
19
|
const baseEl = document.querySelector("base");
|
|
20
20
|
const baseHref = ((_a = baseEl == null ? void 0 : baseEl.getAttribute("href")) == null ? void 0 : _a.trim()) || "";
|
|
21
|
-
if (baseHref &&
|
|
21
|
+
if (baseHref && !baseHref.startsWith(".")) {
|
|
22
22
|
return baseHref.endsWith("/") ? baseHref.slice(0, -1) : baseHref;
|
|
23
23
|
}
|
|
24
24
|
const pathname = window.location.pathname;
|
|
25
|
+
const marker = `/${PREVIEW_ROUTING_BASEPATH}`;
|
|
26
|
+
const markerIndex = pathname.indexOf(`${marker}/`);
|
|
27
|
+
if (markerIndex >= 0) {
|
|
28
|
+
return pathname.slice(0, markerIndex) || "/";
|
|
29
|
+
}
|
|
30
|
+
if (pathname.endsWith(marker)) {
|
|
31
|
+
return pathname.slice(0, pathname.length - marker.length) || "/";
|
|
32
|
+
}
|
|
25
33
|
const segments = pathname.split("/").filter(Boolean);
|
|
26
34
|
const isRoot = pathname.endsWith("/");
|
|
27
|
-
|
|
28
|
-
return "/" + segments.join("/");
|
|
29
|
-
}
|
|
30
|
-
return "/" + segments.slice(0, -1).join("/");
|
|
35
|
+
return isRoot ? "/" + segments.join("/") : "/" + segments.slice(0, -1).join("/");
|
|
31
36
|
}
|
|
32
37
|
function HomeRedirect() {
|
|
33
38
|
var _a, _b, _c;
|
|
34
39
|
const homePage = ((_c = (_b = (_a = store.getState().info) == null ? void 0 : _a.appConfig) == null ? void 0 : _b.appProperties) == null ? void 0 : _c.homePage) || FALLBACK_PAGE;
|
|
35
|
-
const
|
|
36
|
-
const hashPageMatch = hash.match(/^#\/([^?&/]+)/);
|
|
40
|
+
const hashPageMatch = window.location.hash.match(/^#\/([^?&/]+)/);
|
|
37
41
|
const targetPage = hashPageMatch ? hashPageMatch[1] : homePage;
|
|
38
|
-
const search =
|
|
42
|
+
const search = window.location.search;
|
|
39
43
|
const redirectTo = `/${PREVIEW_ROUTING_BASEPATH}/${targetPage}${search}`;
|
|
40
44
|
return React.createElement(Navigate, {
|
|
41
45
|
to: redirectTo,
|
|
@@ -63,6 +67,11 @@ function buildPreviewRouteTree() {
|
|
|
63
67
|
} else {
|
|
64
68
|
root.children = [
|
|
65
69
|
{ index: true, element: React.createElement(HomeRedirect) },
|
|
70
|
+
{
|
|
71
|
+
// pageName omitted — fall back to the same homePage redirect as the app root.
|
|
72
|
+
path: PREVIEW_ROUTING_BASEPATH,
|
|
73
|
+
element: React.createElement(HomeRedirect)
|
|
74
|
+
},
|
|
66
75
|
{
|
|
67
76
|
path: `${PREVIEW_ROUTING_BASEPATH}/:pageName`,
|
|
68
77
|
element: React.createElement(PageWrapper)
|
|
@@ -24,6 +24,7 @@ import { getCustomWidget } from "../registry/custom-widget-registry";
|
|
|
24
24
|
import {
|
|
25
25
|
WmxComponentPlaceholder
|
|
26
26
|
} from "../components/wmx-placeholder";
|
|
27
|
+
import WmxRenderer from "../../components/wmx/WmxRenderer";
|
|
27
28
|
import { formatMessage, _get, toNumber } from "../../core/util";
|
|
28
29
|
import { getPartialNames } from "../app-initializer";
|
|
29
30
|
import { createLazyPartial } from "./variable-registry";
|
|
@@ -75,6 +76,12 @@ function tryAddWmxScopeComponent(scopeName, seen, names, values) {
|
|
|
75
76
|
values.push(registered);
|
|
76
77
|
return true;
|
|
77
78
|
}
|
|
79
|
+
if (scopeName === "WmxRenderer") {
|
|
80
|
+
seen.add(scopeName);
|
|
81
|
+
names.push(scopeName);
|
|
82
|
+
values.push(WmxRenderer);
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
78
85
|
const component = (props) => {
|
|
79
86
|
var _a, _b;
|
|
80
87
|
return React.createElement(WmxComponentPlaceholder, __spreadProps(__spreadValues({}, props), {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/** Resolves the prefab name used for CSS scope classes and `app-prefab-{name}` wrappers. */
|
|
2
2
|
export declare function resolvePrefabScopeName(componentName: string, prefabname?: string): string;
|
|
3
|
-
export declare function scopeComponentStyles(componentName: string, componentType: string, styles: string): string;
|
|
3
|
+
export declare function scopeComponentStyles(componentName: string, componentType: string, styles: string, uniqueId: string): string;
|
|
4
4
|
export declare function removeComponentStyles(componentName: string, componentType: string): void;
|
|
@@ -35,7 +35,7 @@ function getCssScopeOptions(componentType, componentName) {
|
|
|
35
35
|
}
|
|
36
36
|
return void 0;
|
|
37
37
|
}
|
|
38
|
-
function scopeComponentStyles(componentName, componentType, styles) {
|
|
38
|
+
function scopeComponentStyles(componentName, componentType, styles, uniqueId) {
|
|
39
39
|
var _a;
|
|
40
40
|
if (!styles) return "";
|
|
41
41
|
const scopeOptions = getCssScopeOptions(componentType, componentName);
|
|
@@ -48,7 +48,7 @@ function scopeComponentStyles(componentName, componentType, styles) {
|
|
|
48
48
|
scopedCssCache.set(cacheKey, scopedCss);
|
|
49
49
|
}
|
|
50
50
|
const styleElement = document.createElement("style");
|
|
51
|
-
styleElement.setAttribute("data-wm-scope", scopeAttribute);
|
|
51
|
+
styleElement.setAttribute("data-wm-scope", `${scopeAttribute}-${uniqueId}`);
|
|
52
52
|
styleElement.textContent = scopedCss;
|
|
53
53
|
const existing = document.querySelector(`style[data-wm-scope="${scopeAttribute}"]`);
|
|
54
54
|
if (existing) {
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
EMPTY_RESULT,
|
|
24
24
|
createLazyPartial
|
|
25
25
|
} from "./variable-registry";
|
|
26
|
+
import { getPartialNames } from "../app-initializer";
|
|
26
27
|
const EVENT_HANDLER_REGEX = /^(\w+)\(([^)]*)\)$/;
|
|
27
28
|
const RETURN_VALUE_HANDLERS = /* @__PURE__ */ new Set([
|
|
28
29
|
"onBeforeUpdate",
|
|
@@ -126,7 +127,7 @@ const enhanceNotification = (config, variable, scopeProxy) => {
|
|
|
126
127
|
const dataBindings = variable.dataBinding;
|
|
127
128
|
const pageBinding = dataBindings == null ? void 0 : dataBindings.find((b) => b.target === "page");
|
|
128
129
|
if (pageBinding == null ? void 0 : pageBinding.value) {
|
|
129
|
-
const partialName =
|
|
130
|
+
const partialName = getPartialNames().find((p) => p.toLowerCase() === pageBinding.value.toLowerCase()) || pageBinding.value;
|
|
130
131
|
config.partialContent = { component: createLazyPartial(partialName) };
|
|
131
132
|
}
|
|
132
133
|
};
|
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
EMPTY_RESULT,
|
|
24
24
|
createLazyPartial
|
|
25
25
|
} from "./variable-registry";
|
|
26
|
+
import { getPartialNames } from "../app-initializer";
|
|
26
27
|
function buildEntityProviderShims(rawVariables) {
|
|
27
28
|
const entityMap = /* @__PURE__ */ new Map();
|
|
28
29
|
for (const config of Object.values(rawVariables || {})) {
|
|
@@ -99,8 +100,10 @@ function transpileAndBuildGetVariables(variablesCodeString, rawVariables) {
|
|
|
99
100
|
getEntityPropertyMap,
|
|
100
101
|
getEntityRelatedTables
|
|
101
102
|
});
|
|
103
|
+
const knownPartials = getPartialNames();
|
|
102
104
|
for (const name of extractPartialImports(variablesCodeString)) {
|
|
103
|
-
|
|
105
|
+
const partialName = knownPartials.find((p) => p.toLowerCase() === name.toLowerCase()) || name;
|
|
106
|
+
scopeWithShims[name] = createLazyPartial(partialName);
|
|
104
107
|
}
|
|
105
108
|
const scopeNames = Object.keys(scopeWithShims);
|
|
106
109
|
const scopeValues = Object.values(scopeWithShims);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Packages the app's WMX bundle must borrow from this one instead of bundling
|
|
3
|
+
* its own copy.
|
|
4
|
+
*
|
|
5
|
+
* A WMX component is built separately and loaded as its own <script>, so any
|
|
6
|
+
* package used on both sides ends up loaded twice. For most packages that is
|
|
7
|
+
* harmless -- two copies of lodash or embla-carousel just cost bundle size,
|
|
8
|
+
* because everything they hold lives on the values they hand back.
|
|
9
|
+
*
|
|
10
|
+
* The ones below are different. Each keeps something private inside the package
|
|
11
|
+
* itself that both sides have to agree on:
|
|
12
|
+
*
|
|
13
|
+
* react / react-dom a second copy makes every hook throw "Invalid hook call"
|
|
14
|
+
* @emotion/* two copies write conflicting stylesheets
|
|
15
|
+
* @mui/* the app's <ThemeProvider> cannot be seen by a second copy
|
|
16
|
+
* react-redux,
|
|
17
|
+
* @reduxjs/toolkit the store cannot be seen by a second copy
|
|
18
|
+
* react-hook-form the form provider cannot be seen by a second copy
|
|
19
|
+
* react-router-dom the router cannot be seen by a second copy
|
|
20
|
+
* @dnd-kit/core,
|
|
21
|
+
* @base-ui-components same problem, their own providers
|
|
22
|
+
*
|
|
23
|
+
* Everything except React fails QUIETLY -- the component reads an empty default
|
|
24
|
+
* instead of the app's real value, with no error anywhere. That is why the list
|
|
25
|
+
* is written out by hand rather than guessed.
|
|
26
|
+
*
|
|
27
|
+
* It only needs to cover packages THIS runtime ships. A package a WMX component
|
|
28
|
+
* adds that the runtime does not have exists only once on the page, so there is
|
|
29
|
+
* nothing to share and nothing to break -- which is what stops this list from
|
|
30
|
+
* growing every time someone writes a new component.
|
|
31
|
+
*
|
|
32
|
+
* Handed over as a plain module export, not on `window`. The app's WMX bundle
|
|
33
|
+
* imports it straight out of wm-react-loader.js, so the browser reuses the file
|
|
34
|
+
* it already loaded for the page and there is only ever one copy.
|
|
35
|
+
*
|
|
36
|
+
* Adding a package here is half the job -- the name must also go into
|
|
37
|
+
* SHARED_MODULES in the app's config/esbuild.wmx.config.mjs. If it is only
|
|
38
|
+
* listed there, the bundle throws a clear message when it loads.
|
|
39
|
+
*/
|
|
40
|
+
export declare const __wmxShared: Record<string, unknown>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ReactJsxRuntime from "react/jsx-runtime";
|
|
3
|
+
import * as ReactDOM from "react-dom";
|
|
4
|
+
import * as ReactDOMClient from "react-dom/client";
|
|
5
|
+
import * as EmotionReact from "@emotion/react";
|
|
6
|
+
import * as EmotionStyled from "@emotion/styled";
|
|
7
|
+
import * as MuiMaterial from "@mui/material";
|
|
8
|
+
import * as MuiXDatePickers from "@mui/x-date-pickers";
|
|
9
|
+
import * as ReactRedux from "react-redux";
|
|
10
|
+
import * as ReduxToolkit from "@reduxjs/toolkit";
|
|
11
|
+
import * as ReactHookForm from "react-hook-form";
|
|
12
|
+
import * as ReactRouterDom from "react-router-dom";
|
|
13
|
+
import * as DndKitCore from "@dnd-kit/core";
|
|
14
|
+
import * as BaseUiComponents from "@base-ui-components/react";
|
|
15
|
+
const __wmxShared = {
|
|
16
|
+
react: React,
|
|
17
|
+
"react/jsx-runtime": ReactJsxRuntime,
|
|
18
|
+
"react-dom": ReactDOM,
|
|
19
|
+
"react-dom/client": ReactDOMClient,
|
|
20
|
+
"@emotion/react": EmotionReact,
|
|
21
|
+
"@emotion/styled": EmotionStyled,
|
|
22
|
+
"@mui/material": MuiMaterial,
|
|
23
|
+
"@mui/x-date-pickers": MuiXDatePickers,
|
|
24
|
+
"react-redux": ReactRedux,
|
|
25
|
+
"@reduxjs/toolkit": ReduxToolkit,
|
|
26
|
+
"react-hook-form": ReactHookForm,
|
|
27
|
+
"react-router-dom": ReactRouterDom,
|
|
28
|
+
"@dnd-kit/core": DndKitCore,
|
|
29
|
+
"@base-ui-components/react": BaseUiComponents
|
|
30
|
+
};
|
|
31
|
+
export {
|
|
32
|
+
__wmxShared
|
|
33
|
+
};
|
|
@@ -53,11 +53,32 @@ const extractPartialParamValues = (params, props) => {
|
|
|
53
53
|
return acc;
|
|
54
54
|
}, {});
|
|
55
55
|
};
|
|
56
|
+
let nextRefTag = 1;
|
|
57
|
+
const refTags = /* @__PURE__ */ new WeakMap();
|
|
58
|
+
const tagForRef = (value) => {
|
|
59
|
+
let tag = refTags.get(value);
|
|
60
|
+
if (tag === void 0) {
|
|
61
|
+
tag = nextRefTag++;
|
|
62
|
+
refTags.set(value, tag);
|
|
63
|
+
}
|
|
64
|
+
return tag;
|
|
65
|
+
};
|
|
66
|
+
const fingerprintParamValue = (value) => {
|
|
67
|
+
if (value === null || typeof value !== "object" && typeof value !== "function") {
|
|
68
|
+
return value;
|
|
69
|
+
}
|
|
70
|
+
return `#ref${tagForRef(value)}`;
|
|
71
|
+
};
|
|
56
72
|
const computePartialParamKey = (componentType, params, props) => {
|
|
57
73
|
if (componentType !== "PARTIAL") {
|
|
58
74
|
return null;
|
|
59
75
|
}
|
|
60
|
-
|
|
76
|
+
const paramValues = extractPartialParamValues(params || [], props);
|
|
77
|
+
const fingerprint = Object.keys(paramValues).reduce((acc, key) => {
|
|
78
|
+
acc[key] = fingerprintParamValue(paramValues[key]);
|
|
79
|
+
return acc;
|
|
80
|
+
}, {});
|
|
81
|
+
return JSON.stringify(fingerprint);
|
|
61
82
|
};
|
|
62
83
|
export {
|
|
63
84
|
computeMergedPageParams,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a loaded partial is published onto its host page's widget registry.
|
|
3
|
+
*
|
|
4
|
+
* Angular's `BasePartialComponent` keeps `Page.Widgets[<containerName>]` as the *container
|
|
5
|
+
* widget* and hangs a fixed set of namespaces off it (`registerWidgets` / `initVariables` in
|
|
6
|
+
* runtime-base/src/components/base-partial.component.ts):
|
|
7
|
+
*
|
|
8
|
+
* containerWidget.Widgets = this.Widgets;
|
|
9
|
+
* containerWidget.Variables = this.Variables;
|
|
10
|
+
* containerWidget.Actions = this.Actions;
|
|
11
|
+
* containerWidget.pageParams = this.pageParams;
|
|
12
|
+
*
|
|
13
|
+
* So `Page.Widgets.foo.Widgets.bar` resolves, while the partial *scope*'s own members stay
|
|
14
|
+
* private to the partial. Publishing the whole scope instead makes every scope method
|
|
15
|
+
* visible on the container, which breaks host-side capability checks: a script that calls
|
|
16
|
+
* `Widgets[name].handler?.(...)` to hand off to a *different* partial then finds the
|
|
17
|
+
* calling partial's own identically-named handler and recurses until the stack overflows.
|
|
18
|
+
*
|
|
19
|
+
* `pageParams` is published as the live object reference (not copied), so a host script that
|
|
20
|
+
* mutates `Widgets[name].pageParams.foo = bar` after load is mutating the same object the
|
|
21
|
+
* partial reads via `Partial.pageParams.foo` - no extra plumbing needed for updates to flow.
|
|
22
|
+
*/
|
|
23
|
+
/** The only namespaces a partial publishes onto its host container widget. */
|
|
24
|
+
export declare const PARTIAL_HOST_NAMESPACES: readonly ["Widgets", "Variables", "Actions", "pageParams"];
|
|
25
|
+
/** A container's own props, minus the React plumbing, for use as its registry entry. */
|
|
26
|
+
export declare const toHostWidgetProps: (containerProps: Record<string, any>) => Record<string, any>;
|
|
27
|
+
/**
|
|
28
|
+
* Mutates `hostEntry` in place to expose the partial's namespaces, mirroring Angular's
|
|
29
|
+
* `containerWidget.Widgets = ...` assignments. Mutating (rather than replacing the entry)
|
|
30
|
+
* keeps the container widget's identity and any properties other registrars put there.
|
|
31
|
+
*
|
|
32
|
+
* @returns false when there is no entry to publish onto, so callers can fall back.
|
|
33
|
+
*/
|
|
34
|
+
export declare const publishPartialNamespaces: (hostEntry: any, partialScope: Record<string, any> | undefined | null) => boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Prefabs still publish their whole scope. Angular exposes a prefab's *declared* methods on
|
|
37
|
+
* its container through an explicit metadata-driven allowlist (base-prefab.component.ts),
|
|
38
|
+
* and React has no equivalent yet, so narrowing a prefab here would hide those methods.
|
|
39
|
+
*/
|
|
40
|
+
export declare const isPrefabScope: (scope: Record<string, any> | undefined | null) => boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
const PARTIAL_HOST_NAMESPACES = ["Widgets", "Variables", "Actions", "pageParams"];
|
|
18
|
+
const NON_WIDGET_PROPS = ["listener", "renderPartial", "children", "onLoad"];
|
|
19
|
+
const toHostWidgetProps = (containerProps) => {
|
|
20
|
+
const entry = __spreadValues({}, containerProps);
|
|
21
|
+
NON_WIDGET_PROPS.forEach((key) => delete entry[key]);
|
|
22
|
+
return entry;
|
|
23
|
+
};
|
|
24
|
+
const publishPartialNamespaces = (hostEntry, partialScope) => {
|
|
25
|
+
if (!hostEntry || typeof hostEntry !== "object" || !partialScope) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
PARTIAL_HOST_NAMESPACES.forEach((namespace) => {
|
|
29
|
+
if (partialScope[namespace] !== void 0) {
|
|
30
|
+
hostEntry[namespace] = partialScope[namespace];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return true;
|
|
34
|
+
};
|
|
35
|
+
const isPrefabScope = (scope) => typeof (scope == null ? void 0 : scope.componentType) === "string" && scope.componentType.toLowerCase() === "prefab";
|
|
36
|
+
export {
|
|
37
|
+
PARTIAL_HOST_NAMESPACES,
|
|
38
|
+
isPrefabScope,
|
|
39
|
+
publishPartialNamespaces,
|
|
40
|
+
toHostWidgetProps
|
|
41
|
+
};
|
package/utils/style-utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCurrentPath } from "../core/util/utils";
|
|
2
2
|
const sanitizeStyleObject = (styleObj) => {
|
|
3
|
-
if (!styleObj || typeof styleObj !== "object") {
|
|
3
|
+
if (!styleObj || typeof styleObj !== "object" || Array.isArray(styleObj)) {
|
|
4
4
|
return {};
|
|
5
5
|
}
|
|
6
6
|
const validStyles = {};
|
package/utils/wmx.utils.d.ts
CHANGED
|
@@ -3,4 +3,3 @@ export type WmxComponentModule = Record<string, ComponentType<any>>;
|
|
|
3
3
|
export declare const registerWmxComponents: (module: WmxComponentModule) => void;
|
|
4
4
|
export declare const getWmxModule: () => WmxComponentModule | null;
|
|
5
5
|
export declare const getWmxComponentName: (widgetName: string) => string | null;
|
|
6
|
-
export declare const loadWmxComponent: (componentName: string) => Promise<ComponentType<any> | null>;
|
package/utils/wmx.utils.js
CHANGED
|
@@ -9,33 +9,8 @@ const getWmxComponentName = (widgetName) => {
|
|
|
9
9
|
const componentName = (_a = widgetName.split("-")) == null ? void 0 : _a[1];
|
|
10
10
|
return componentName || null;
|
|
11
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
12
|
export {
|
|
37
13
|
getWmxComponentName,
|
|
38
14
|
getWmxModule,
|
|
39
|
-
loadWmxComponent,
|
|
40
15
|
registerWmxComponents
|
|
41
16
|
};
|
|
@@ -22,8 +22,18 @@ declare class CrudVariable extends CrudVariable_base {
|
|
|
22
22
|
config: CrudVariableConfig;
|
|
23
23
|
params: any;
|
|
24
24
|
filters: any;
|
|
25
|
+
/**
|
|
26
|
+
* The by-name params a generated invokeHttp receives. Same field name ServiceVariable uses, so
|
|
27
|
+
* useHttp's call site needs no per-kind chain. NOT `lastInvokedParams`: that name is
|
|
28
|
+
* ServiceVariable's RAW provider snapshot (compared against by invokeOnParamChange), and it is
|
|
29
|
+
* private there — reading it cross-object would also be reading a different thing.
|
|
30
|
+
*/
|
|
31
|
+
resolvedParams: any;
|
|
25
32
|
constructor(config: CrudVariableConfig);
|
|
26
33
|
setFilterExpValue(filter: any): void;
|
|
34
|
+
lastInvokedOperation: string | undefined;
|
|
35
|
+
private captureLastInvokedParams;
|
|
36
|
+
private resolveParams;
|
|
27
37
|
invokeOnParamChange(): Promise<this>;
|
|
28
38
|
listRecords(options?: any, onSuccess?: Function, onError?: Function): any;
|
|
29
39
|
updateRecord(options?: any, success?: any, error?: any): any;
|