@wavemaker-ai/react-runtime 1.0.0-rc.332 → 1.0.0-rc.334
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 +2 -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/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 +33 -9
- 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 +8 -6
- 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 +56 -40
- 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/form-action/index.d.ts +2 -0
- package/components/data/form/form-controller/withFormController.js +16 -3
- package/components/data/form/form-field/index.js +35 -11
- package/components/data/form/form-field/props.d.ts +7 -2
- package/components/data/list/index.d.ts +2 -0
- package/components/data/list/index.js +4 -9
- package/components/data/pagination/hooks/usePagination.js +6 -6
- 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 +3 -1
- package/components/data/table/hooks/useFormWidget.js +2 -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 +7 -3
- package/components/data/table/hooks/useTableData.js +10 -2
- package/components/data/table/index.d.ts +2 -0
- package/components/data/table/index.js +14 -13
- package/components/data/table/live-table/index.d.ts +1 -0
- package/components/data/table/props.d.ts +1 -0
- 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 +17 -22
- 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 +10 -3
- package/components/data/table/utils/index.js +5 -8
- package/components/data/table/utils/selectionUtils.d.ts +12 -0
- package/components/data/table/utils/selectionUtils.js +10 -0
- 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 +2 -0
- package/components/input/color-picker/index.d.ts +2 -0
- package/components/input/composite/index.d.ts +1 -0
- package/components/input/composite/index.js +32 -6
- package/components/input/default/checkbox/index.d.ts +2 -0
- package/components/input/default/checkboxset/index.d.ts +2 -0
- package/components/input/default/radioset/index.d.ts +2 -0
- package/components/input/default/switch/index.d.ts +2 -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 +3 -1
- 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 +2 -0
- package/components/input/rating/index.d.ts +2 -0
- package/components/input/slider/index.d.ts +2 -0
- package/components/input/text/index.d.ts +2 -0
- package/components/input/text/index.js +9 -2
- package/components/input/textarea/index.d.ts +2 -0
- package/components/input/upload/index.d.ts +2 -0
- package/components/navbar/index.d.ts +1 -0
- 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 +13 -9
- 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/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 +46 -3
- package/higherOrder/BaseApp.js +2 -1
- package/higherOrder/BasePage.js +2 -9
- package/higherOrder/props.d.ts +1 -0
- package/higherOrder/useActivePageReactivity.js +1 -4
- package/higherOrder/withBaseWrapper.js +3 -2
- package/package-lock.json +168 -167
- package/package.json +3 -3
- 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 +1 -7
- package/runtime-dynamic/routes.js +17 -8
- 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/variables/model-variable.d.ts +2 -0
- package/variables/model-variable.js +14 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wavemaker-ai/react-runtime",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.334",
|
|
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.
|
|
62
|
-
"@wavemaker-ai/variables": "1.0.0-rc.
|
|
61
|
+
"@wavemaker-ai/react-codegen": "1.0.0-rc.334",
|
|
62
|
+
"@wavemaker-ai/variables": "1.0.0-rc.334",
|
|
63
63
|
"@wavemaker/nvd3": "1.8.16",
|
|
64
64
|
"axios": "1.15.1",
|
|
65
65
|
"d3": "7.8.5",
|
|
@@ -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})`;
|
|
@@ -85,13 +85,7 @@ function createDynamicComponent({
|
|
|
85
85
|
}
|
|
86
86
|
let id = null;
|
|
87
87
|
if (appState) {
|
|
88
|
-
|
|
89
|
-
id = setTimeout(() => {
|
|
90
|
-
appState.pageReady();
|
|
91
|
-
}, 1e3);
|
|
92
|
-
} else {
|
|
93
|
-
appState.pageReady();
|
|
94
|
-
}
|
|
88
|
+
appState.pageReady();
|
|
95
89
|
}
|
|
96
90
|
return () => {
|
|
97
91
|
if (id) clearTimeout(id);
|
|
@@ -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)
|
|
@@ -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
|
+
};
|
|
@@ -8,5 +8,7 @@ export declare class ModelVariable extends ModelVariable_base {
|
|
|
8
8
|
constructor(config: VariableConfig);
|
|
9
9
|
invoke(params?: any, onSuccess?: Function, onError?: Function): any;
|
|
10
10
|
invokeOnParamChange(obj?: any, newVal?: any, oldVal?: any): Promise<this>;
|
|
11
|
+
addItem(value: any, options?: any): any;
|
|
12
|
+
removeItem(index: any, options?: any): any;
|
|
11
13
|
}
|
|
12
14
|
export {};
|
|
@@ -70,6 +70,20 @@ class ModelVariable extends _ModelVariable {
|
|
|
70
70
|
}
|
|
71
71
|
return Promise.resolve(this);
|
|
72
72
|
}
|
|
73
|
+
// addItem/removeItem (inherited from @wavemaker-ai/variables) mutate `dataSet` in place
|
|
74
|
+
// and return it, with no notification - that's precisely the bug being fixed here.
|
|
75
|
+
addItem(value, options) {
|
|
76
|
+
this.dataSet = Array.isArray(this.dataSet) ? [...this.dataSet] : __spreadValues({}, this.dataSet);
|
|
77
|
+
const result = super.addItem(value, options);
|
|
78
|
+
this.notify(VariableEvents.AFTER_INVOKE, [this, this.dataSet]);
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
removeItem(index, options) {
|
|
82
|
+
this.dataSet = Array.isArray(this.dataSet) ? [...this.dataSet] : __spreadValues({}, this.dataSet);
|
|
83
|
+
const result = super.removeItem(index, options);
|
|
84
|
+
this.notify(VariableEvents.AFTER_INVOKE, [this, this.dataSet]);
|
|
85
|
+
return result;
|
|
86
|
+
}
|
|
73
87
|
}
|
|
74
88
|
export {
|
|
75
89
|
ModelVariable
|