@wavemaker-ai/react-runtime 1.0.0-rc.322 → 1.0.0-rc.326
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/actions/login-action.js +1 -1
- 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 +19 -14
- 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/icon/index.js +13 -16
- package/components/basic/iframe/index.d.ts +1 -0
- package/components/basic/label/index.d.ts +1 -0
- package/components/basic/label/index.js +5 -3
- package/components/basic/label/props.d.ts +1 -1
- package/components/basic/picture/index.d.ts +1 -0
- package/components/basic/picture/index.js +3 -2
- 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/search/index.d.ts +6 -0
- package/components/basic/search/index.js +69 -9
- package/components/basic/search/props.d.ts +4 -0
- package/components/basic/spinner/index.d.ts +2 -0
- package/components/basic/spinner/index.js +11 -9
- package/components/basic/spinner/props.d.ts +5 -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 +2 -0
- package/components/chart/props.d.ts +1 -0
- package/components/chart/src/chart.js +12 -1
- package/components/chart/src/types.d.ts +2 -0
- package/components/common/WmAppIcon/index.d.ts +15 -0
- package/components/common/WmAppIcon/index.js +130 -0
- package/components/common/WmAppIcon/props.d.ts +17 -0
- package/components/common/WmAppIcon/props.js +0 -0
- package/components/common/index.d.ts +3 -1
- package/components/common/index.js +10 -2
- package/components/common/wm-skeleton.d.ts +7 -0
- package/components/common/wm-skeleton.js +11 -1
- package/components/container/accordion/accordion-pane/index.d.ts +2 -0
- package/components/container/accordion/accordion-pane/index.js +10 -1
- package/components/container/accordion/accordion-pane/props.d.ts +1 -0
- package/components/container/accordion/index.d.ts +1 -0
- package/components/container/accordion/index.js +2 -2
- package/components/container/index.d.ts +1 -0
- package/components/container/index.js +6 -1
- 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/grid-row/index.js +1 -1
- package/components/container/layout-grid/index.d.ts +1 -0
- 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/components/panel-header/index.js +16 -16
- package/components/container/panel/index.d.ts +1 -0
- package/components/container/repeat-template/index.d.ts +1 -0
- package/components/container/tabs/index.d.ts +1 -0
- package/components/container/tabs/index.js +18 -18
- package/components/container/tabs/props.d.ts +1 -0
- package/components/container/tabs/tab-pane/index.d.ts +2 -0
- package/components/container/tabs/tab-pane/index.js +2 -0
- package/components/container/tabs/tab-pane/props.d.ts +1 -0
- package/components/container/wizard/components/StepComponents.js +14 -6
- package/components/container/wizard/index.d.ts +2 -0
- package/components/container/wizard/index.js +2 -2
- package/components/container/wizard/props.d.ts +4 -0
- package/components/container/wizard/wizard-step/index.d.ts +1 -0
- package/components/container/wizard/wizard-step/index.js +6 -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/card/index.js +13 -6
- package/components/data/form/base-form/hooks/useFormSubmission.d.ts +1 -1
- package/components/data/form/base-form/hooks/useFormSubmission.js +3 -1
- package/components/data/form/base-form/index.js +11 -14
- package/components/data/form/base-form/props.d.ts +3 -0
- package/components/data/form/dynamic-fields/index.js +1 -0
- package/components/data/form/form-action/index.d.ts +2 -0
- package/components/data/form/form-action/index.js +6 -4
- package/components/data/form/form-controller/withFormController.js +19 -2
- package/components/data/form/form-field/base-field.js +8 -5
- package/components/data/form/form-field/index.js +14 -9
- package/components/data/form/form-field/props.d.ts +1 -0
- package/components/data/form/form-header/index.d.ts +1 -1
- package/components/data/form/form-header/index.js +10 -1
- package/components/data/form/index.js +5 -3
- package/components/data/form/props.d.ts +1 -0
- package/components/data/list/components/ListHeader.js +19 -3
- package/components/data/list/components/ListItemWithTemplate.js +10 -3
- package/components/data/list/components/ListItems.d.ts +1 -1
- package/components/data/list/components/ListItems.js +5 -1
- package/components/data/list/components/LoadMoreButton.js +14 -2
- package/components/data/list/components/StandardListItems.js +1 -1
- package/components/data/list/components/props.d.ts +11 -5
- package/components/data/list/hooks/props.d.ts +2 -2
- package/components/data/list/hooks/useListEffects.js +1 -1
- package/components/data/list/hooks/useListEventHandlers.js +3 -2
- package/components/data/list/index.d.ts +5 -1
- package/components/data/list/index.js +28 -7
- package/components/data/list/props.d.ts +14 -2
- package/components/data/list/utils/constants.d.ts +0 -1
- package/components/data/list/utils/constants.js +0 -2
- package/components/data/list/utils/list-helpers.d.ts +5 -1
- package/components/data/list/utils/list-helpers.js +10 -0
- package/components/data/pagination/components/PageSizeSelector.js +49 -155
- package/components/data/pagination/hooks/usePagination.js +24 -1
- package/components/data/table/components/RowCells.js +18 -4
- package/components/data/table/components/TableBody.js +5 -3
- package/components/data/table/components/TableDataRow.js +16 -3
- package/components/data/table/components/TableHeader.js +10 -8
- package/components/data/table/components/TablePanelHeading.js +15 -3
- package/components/data/table/hooks/useDynamicColumns.js +1 -1
- package/components/data/table/hooks/useResponsiveColumns.d.ts +1 -0
- package/components/data/table/hooks/useRowExpansion.js +41 -31
- package/components/data/table/hooks/useRowHandlers.js +0 -1
- package/components/data/table/hooks/useServerSideSorting.js +0 -1
- package/components/data/table/hooks/useTableColumns.js +17 -9
- package/components/data/table/hooks/useTableData.js +30 -2
- package/components/data/table/hooks/useTableEdit.js +0 -1
- package/components/data/table/index.d.ts +4 -0
- package/components/data/table/index.js +93 -47
- package/components/data/table/live-table/index.d.ts +1 -0
- package/components/data/table/live-table/index.js +0 -1
- package/components/data/table/props.d.ts +15 -2
- 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.d.ts +1 -1
- package/components/data/table/utils/buildSelectionColumns.js +95 -71
- package/components/data/table/utils/columnBuilder.d.ts +29 -2
- package/components/data/table/utils/columnBuilder.js +40 -26
- package/components/data/table/utils/columnWidthDistribution.d.ts +1 -1
- package/components/data/table/utils/columnWidthDistribution.js +14 -1
- package/components/data/table/utils/constants.d.ts +0 -4
- package/components/data/table/utils/constants.js +0 -7
- package/components/data/table/utils/dynamic-columns.d.ts +1 -1
- package/components/data/table/utils/dynamic-columns.js +3 -8
- package/components/data/table/utils/expansionColumn.d.ts +23 -0
- package/components/data/table/utils/expansionColumn.js +56 -0
- package/components/data/table/utils/index.d.ts +14 -2
- package/components/data/table/utils/index.js +45 -19
- 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/index.js +3 -2
- 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/dialog-header/index.js +11 -12
- package/components/dialogs/iframe-dialog/index.d.ts +2 -0
- package/components/dialogs/login-dialog/index.d.ts +4 -0
- package/components/dialogs/login-dialog/index.js +2 -1
- package/components/dialogs/login-dialog/props.d.ts +1 -0
- package/components/dialogs/page-dialog/index.d.ts +4 -0
- package/components/dialogs/page-dialog/index.js +2 -1
- package/components/dialogs/page-dialog/props.d.ts +1 -0
- package/components/form/button/index.d.ts +1 -0
- package/components/form/button/index.js +29 -33
- 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/chips/index.js +9 -3
- package/components/input/chips/utils.d.ts +5 -0
- package/components/input/chips/utils.js +29 -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 +1 -0
- package/components/input/currency/index.d.ts +2 -0
- package/components/input/default/checkbox/index.d.ts +6 -0
- package/components/input/default/checkbox/index.js +48 -18
- package/components/input/default/checkbox/props.d.ts +8 -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/radioset/index.js +2 -1
- package/components/input/default/switch/index.d.ts +6 -0
- package/components/input/default/switch/index.js +36 -9
- package/components/input/default/switch/prop.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/time/index.d.ts +1 -0
- package/components/input/fileupload/components/ListItems.d.ts +5 -1
- package/components/input/fileupload/components/ListItems.js +27 -5
- package/components/input/fileupload/components/MultiUpload.js +12 -1
- package/components/input/fileupload/components/SingleUpload.js +12 -1
- package/components/input/fileupload/index.d.ts +3 -0
- package/components/input/fileupload/index.js +11 -0
- package/components/input/fileupload/props.d.ts +10 -0
- package/components/input/number/index.d.ts +2 -0
- package/components/input/rating/index.d.ts +6 -0
- package/components/input/rating/index.js +10 -5
- package/components/input/rating/props.d.ts +8 -0
- package/components/input/select/index.d.ts +2 -0
- package/components/input/select/index.js +1 -2
- package/components/input/slider/index.d.ts +6 -0
- package/components/input/slider/index.js +19 -2
- package/components/input/slider/props.d.ts +2 -0
- package/components/input/text/index.d.ts +7 -1
- package/components/input/text/index.js +25 -6
- package/components/input/text/props.d.ts +8 -0
- package/components/input/textarea/index.d.ts +2 -0
- package/components/input/textarea/index.js +10 -5
- package/components/input/textarea/util.d.ts +1 -0
- package/components/input/textarea/util.js +17 -0
- package/components/input/upload/index.d.ts +2 -0
- package/components/navbar/index.d.ts +7 -0
- package/components/navbar/index.js +21 -7
- package/components/navbar/nav/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 +3 -1
- package/components/navigation/menu/index.js +22 -4
- package/components/navigation/menu/props.d.ts +1 -0
- package/components/navigation/popover/index.d.ts +1 -0
- package/components/navigation/popover/index.js +23 -9
- package/components/page/index.js +1 -1
- package/components/page/page-content/index.js +6 -2
- package/components/page/partial/index.d.ts +1 -0
- package/components/page/partial-container/index.js +2 -1
- package/components/prefab/index.js +3 -2
- package/components/prefab/props.d.ts +1 -0
- package/context/WidgetProvider.js +2 -1
- package/core/appstore.d.ts +10 -0
- package/core/appstore.js +9 -1
- package/core/constants/events.d.ts +3 -0
- package/core/constants/events.js +13 -1
- package/core/proxy-service.d.ts +1 -0
- package/core/proxy-service.js +54 -3
- package/core/util/index.d.ts +2 -0
- package/core/util/index.js +32 -1
- package/higherOrder/BasePage.js +106 -30
- package/higherOrder/props.d.ts +1 -0
- package/higherOrder/useActivePageReactivity.d.ts +21 -0
- package/higherOrder/useActivePageReactivity.js +57 -0
- package/higherOrder/withBaseWrapper.js +11 -7
- package/higherOrder/withRenderLogger.d.ts +15 -0
- package/higherOrder/withRenderLogger.js +53 -0
- package/hooks/useAuth.js +7 -1
- package/package-lock.json +273 -263
- package/package.json +4 -3
- package/runtime-dynamic/components/partial-content.js +3 -1
- package/runtime-dynamic/factories/dynamic-component.js +44 -8
- package/runtime-dynamic/factories/utils.js +7 -1
- package/runtime-dynamic/services/compile-render.js +2 -1
- package/runtime-dynamic/services/css-scoping.d.ts +2 -0
- package/runtime-dynamic/services/css-scoping.js +39 -20
- package/store/slices/i18nSlice.d.ts +2 -0
- package/store/slices/i18nSlice.js +3 -1
- package/types/index.d.ts +6 -0
- package/utils/attr.js +4 -1
- package/utils/custom-expression/parser.js +11 -8
- package/utils/svg-icon.d.ts +27 -0
- package/utils/svg-icon.js +75 -0
- package/utils/transformedDataset-utils.d.ts +3 -3
- package/utils/transformedDataset-utils.js +1 -2
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.326",
|
|
4
4
|
"description": "React runtime package for Wavemaker",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"build:lib": "node scripts/build.js post-build",
|
|
22
22
|
"sync-docs": "node scripts/sync-docs.js",
|
|
23
23
|
"build:local": "npm run build:lib -- --production=false",
|
|
24
|
+
"build:watch": "node scripts/build.js watch",
|
|
24
25
|
"format": "prettier --write .",
|
|
25
26
|
"start": "next start",
|
|
26
27
|
"lint": "next lint",
|
|
@@ -57,8 +58,8 @@
|
|
|
57
58
|
"@mui/x-date-pickers": "8.5.3",
|
|
58
59
|
"@reduxjs/toolkit": "2.9.1",
|
|
59
60
|
"@tanstack/react-table": "8.21.3",
|
|
60
|
-
"@wavemaker-ai/react-codegen": "1.0.0-rc.
|
|
61
|
-
"@wavemaker-ai/variables": "1.0.0-rc.
|
|
61
|
+
"@wavemaker-ai/react-codegen": "1.0.0-rc.326",
|
|
62
|
+
"@wavemaker-ai/variables": "1.0.0-rc.326",
|
|
62
63
|
"@wavemaker/nvd3": "1.8.16",
|
|
63
64
|
"axios": "1.15.1",
|
|
64
65
|
"d3": "7.8.5",
|
|
@@ -19,6 +19,8 @@ var __spreadValues = (a, b) => {
|
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
import { jsx } from "react/jsx-runtime";
|
|
21
21
|
import { memo, useCallback } from "react";
|
|
22
|
+
import clsx from "clsx";
|
|
23
|
+
import Container from "@mui/material/Container";
|
|
22
24
|
import isEqual from "lodash-es/isEqual";
|
|
23
25
|
import { registerComponent } from "../registry/store";
|
|
24
26
|
import { ComponentType } from "../services/fragment-url";
|
|
@@ -38,7 +40,7 @@ const WmPartialContent = memo(
|
|
|
38
40
|
const mergedProps = __spreadProps(__spreadValues({}, props), {
|
|
39
41
|
onLoad: handleOnLoad
|
|
40
42
|
});
|
|
41
|
-
return /* @__PURE__ */ jsx(ComponentErrorBoundary, { scope: "partial", componentName: props.content, children: Component && /* @__PURE__ */ jsx(Component, __spreadValues({}, mergedProps)) });
|
|
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)) }) }) });
|
|
42
44
|
},
|
|
43
45
|
(prevProps, nextProps) => {
|
|
44
46
|
const staticKeys = [
|
|
@@ -18,11 +18,30 @@ 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, useRef } from "react";
|
|
21
|
+
import React, { useEffect, useReducer, useRef } from "react";
|
|
22
|
+
import WmPrefab from "../../components/prefab";
|
|
22
23
|
import { useAppState } from "../../context/WidgetProvider";
|
|
23
24
|
import { useAppContext } from "../../context/AppContext";
|
|
24
25
|
import { renderTranspiledMarkup } from "../services/markup-transpiler";
|
|
25
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
scopeComponentStyles,
|
|
28
|
+
removeComponentStyles,
|
|
29
|
+
resolvePrefabScopeName
|
|
30
|
+
} from "../services/css-scoping";
|
|
31
|
+
function useCrossScopeDataRefresh(appContext, componentType) {
|
|
32
|
+
const [, forceRender] = useReducer((count) => count + 1, 0);
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
if (componentType === "page") return;
|
|
35
|
+
const subscribe = appContext == null ? void 0 : appContext.subscribe;
|
|
36
|
+
if (typeof subscribe !== "function") return;
|
|
37
|
+
const unsubscribePage = subscribe("page-variables-data-loaded", forceRender);
|
|
38
|
+
const unsubscribeApp = subscribe("app-variables-data-loaded", forceRender);
|
|
39
|
+
return () => {
|
|
40
|
+
unsubscribePage == null ? void 0 : unsubscribePage();
|
|
41
|
+
unsubscribeApp == null ? void 0 : unsubscribeApp();
|
|
42
|
+
};
|
|
43
|
+
}, [appContext, componentType]);
|
|
44
|
+
}
|
|
26
45
|
function usePageEvents(appState, componentType) {
|
|
27
46
|
const appStateRef = useRef(appState);
|
|
28
47
|
appStateRef.current = appState;
|
|
@@ -54,13 +73,12 @@ function createDynamicComponent({
|
|
|
54
73
|
transpiled,
|
|
55
74
|
styles
|
|
56
75
|
}) {
|
|
57
|
-
const InnerComponent = () => {
|
|
58
|
-
var _a;
|
|
76
|
+
const InnerComponent = (props) => {
|
|
59
77
|
const appState = useAppState();
|
|
60
78
|
usePageEvents(appState, componentType);
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
const notification =
|
|
79
|
+
const appContext = useAppContext();
|
|
80
|
+
useCrossScopeDataRefresh(appContext, componentType);
|
|
81
|
+
const notification = appContext == null ? void 0 : appContext.notification;
|
|
64
82
|
useEffect(() => {
|
|
65
83
|
if (styles) {
|
|
66
84
|
scopeComponentStyles(componentName, componentType, styles);
|
|
@@ -82,7 +100,25 @@ function createDynamicComponent({
|
|
|
82
100
|
}, []);
|
|
83
101
|
if (!transpiled) return null;
|
|
84
102
|
const renderState = notification ? __spreadProps(__spreadValues({}, appState), { notification }) : appState;
|
|
85
|
-
|
|
103
|
+
const markup = renderTranspiledMarkup(transpiled, renderState);
|
|
104
|
+
if (componentType === "prefab") {
|
|
105
|
+
return /* @__PURE__ */ jsx(
|
|
106
|
+
WmPrefab,
|
|
107
|
+
{
|
|
108
|
+
prefabname: resolvePrefabScopeName(componentName, props.prefabname),
|
|
109
|
+
onLoad: props.onLoad,
|
|
110
|
+
onDestroy: props.onDestroy,
|
|
111
|
+
onRender: props.onRender,
|
|
112
|
+
styles: props.styles,
|
|
113
|
+
width: props.width,
|
|
114
|
+
height: props.height,
|
|
115
|
+
listener: props.listener,
|
|
116
|
+
show: props.show,
|
|
117
|
+
children: markup
|
|
118
|
+
}
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
return /* @__PURE__ */ jsx(React.Fragment, { children: markup });
|
|
86
122
|
};
|
|
87
123
|
return InnerComponent;
|
|
88
124
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
2
4
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
6
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -14,6 +16,7 @@ var __spreadValues = (a, b) => {
|
|
|
14
16
|
}
|
|
15
17
|
return a;
|
|
16
18
|
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
17
20
|
import { buildAddPageScript } from "../services/script-executor";
|
|
18
21
|
import { transpileAndBuildGetVariables } from "../services/variable-transpiler";
|
|
19
22
|
import { transpileFragment } from "../services/markup-transpiler";
|
|
@@ -21,6 +24,7 @@ import { yieldToMain } from "../utils";
|
|
|
21
24
|
import { buildStartupInfo } from "./startup-info";
|
|
22
25
|
import { createDynamicComponent } from "./dynamic-component";
|
|
23
26
|
async function buildDynamicComponent(fragment, config) {
|
|
27
|
+
var _a;
|
|
24
28
|
const { markup, script, styles, variables } = fragment;
|
|
25
29
|
const { componentName, componentType, scriptScope, hoc, componentInfo, transpileOptions } = config;
|
|
26
30
|
const addPageScript = buildAddPageScript(script, scriptScope, componentName);
|
|
@@ -40,7 +44,9 @@ async function buildDynamicComponent(fragment, config) {
|
|
|
40
44
|
});
|
|
41
45
|
InnerComponent.displayName = config.displayName || `Dynamic${componentType.charAt(0).toUpperCase() + componentType.slice(1)}(${componentName})`;
|
|
42
46
|
const startupInfo = buildStartupInfo(variables);
|
|
43
|
-
const info = componentInfo(startupInfo)
|
|
47
|
+
const info = __spreadProps(__spreadValues({}, componentInfo(startupInfo)), {
|
|
48
|
+
activePageDeps: (_a = transpiled == null ? void 0 : transpiled.activePageDeps) != null ? _a : []
|
|
49
|
+
});
|
|
44
50
|
return hoc(InnerComponent, addPageScript, getVariables, info);
|
|
45
51
|
}
|
|
46
52
|
export {
|
|
@@ -13,7 +13,8 @@ const UTIL_SCOPE = {
|
|
|
13
13
|
};
|
|
14
14
|
const lazyPartialCache = /* @__PURE__ */ new Map();
|
|
15
15
|
function markupErrorNode(className, message) {
|
|
16
|
-
|
|
16
|
+
console.error(`[markup-transpiler] ${className}: ${message}`);
|
|
17
|
+
return null;
|
|
17
18
|
}
|
|
18
19
|
function extractMarkupComponents(markup) {
|
|
19
20
|
const cached = componentNameCache.get(markup);
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
/** Resolves the prefab name used for CSS scope classes and `app-prefab-{name}` wrappers. */
|
|
2
|
+
export declare function resolvePrefabScopeName(componentName: string, prefabname?: string): string;
|
|
1
3
|
export declare function scopeComponentStyles(componentName: string, componentType: string, styles: string): string;
|
|
2
4
|
export declare function removeComponentStyles(componentName: string, componentType: string): void;
|
|
@@ -1,32 +1,50 @@
|
|
|
1
|
+
import { fixURLPathAndScope } from "@wavemaker-ai/react-codegen/transpiler";
|
|
2
|
+
import { store } from "../../store";
|
|
3
|
+
import { getProjectConfig } from "../app-initializer";
|
|
4
|
+
import { isPrefabSelfPreview } from "./fragment-url";
|
|
5
|
+
function resolvePrefabScopeName(componentName, prefabname) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
if (prefabname) {
|
|
8
|
+
return prefabname;
|
|
9
|
+
}
|
|
10
|
+
if (isPrefabSelfPreview(componentName)) {
|
|
11
|
+
const appProps = (_b = (_a = store.getState().info) == null ? void 0 : _a.appConfig) == null ? void 0 : _b.appProperties;
|
|
12
|
+
return (appProps == null ? void 0 : appProps.displayName) || (appProps == null ? void 0 : appProps.name) || componentName;
|
|
13
|
+
}
|
|
14
|
+
return componentName;
|
|
15
|
+
}
|
|
1
16
|
const scopedCssCache = /* @__PURE__ */ new Map();
|
|
2
|
-
function
|
|
3
|
-
|
|
17
|
+
function getPreviewCssBasePath() {
|
|
18
|
+
var _a;
|
|
19
|
+
const deployUrl = ((_a = getProjectConfig().deployUrl) == null ? void 0 : _a.replace(/\/+$/, "")) || "";
|
|
20
|
+
if (!deployUrl || deployUrl === ".") {
|
|
21
|
+
return void 0;
|
|
22
|
+
}
|
|
23
|
+
return deployUrl;
|
|
4
24
|
}
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return `${prefixed.join(", ")} {`;
|
|
18
|
-
});
|
|
25
|
+
function getCssScopeOptions(componentType, componentName) {
|
|
26
|
+
const normalizedType = componentType.toLowerCase();
|
|
27
|
+
if (normalizedType === "page") {
|
|
28
|
+
return { scopeType: "page", name: componentName };
|
|
29
|
+
}
|
|
30
|
+
if (normalizedType === "partial") {
|
|
31
|
+
return { scopeType: "partial", name: componentName };
|
|
32
|
+
}
|
|
33
|
+
if (normalizedType === "prefab") {
|
|
34
|
+
return { scopeType: "prefab", name: resolvePrefabScopeName(componentName) };
|
|
35
|
+
}
|
|
36
|
+
return void 0;
|
|
19
37
|
}
|
|
20
38
|
function scopeComponentStyles(componentName, componentType, styles) {
|
|
21
39
|
var _a;
|
|
22
40
|
if (!styles) return "";
|
|
23
|
-
const
|
|
24
|
-
const
|
|
41
|
+
const scopeOptions = getCssScopeOptions(componentType, componentName);
|
|
42
|
+
const basePath = getPreviewCssBasePath();
|
|
25
43
|
const scopeAttribute = `${componentType}-${componentName}`;
|
|
26
|
-
const cacheKey = `${
|
|
44
|
+
const cacheKey = `${scopeAttribute}::${basePath != null ? basePath : ""}::${styles}`;
|
|
27
45
|
let scopedCss = scopedCssCache.get(cacheKey);
|
|
28
46
|
if (!scopedCss) {
|
|
29
|
-
scopedCss =
|
|
47
|
+
scopedCss = fixURLPathAndScope(styles, basePath, true, scopeOptions);
|
|
30
48
|
scopedCssCache.set(cacheKey, scopedCss);
|
|
31
49
|
}
|
|
32
50
|
const styleElement = document.createElement("style");
|
|
@@ -48,5 +66,6 @@ function removeComponentStyles(componentName, componentType) {
|
|
|
48
66
|
}
|
|
49
67
|
export {
|
|
50
68
|
removeComponentStyles,
|
|
69
|
+
resolvePrefabScopeName,
|
|
51
70
|
scopeComponentStyles
|
|
52
71
|
};
|
|
@@ -70,6 +70,7 @@ const RTL_LANGUAGE_CODES = [
|
|
|
70
70
|
];
|
|
71
71
|
const initialState = {
|
|
72
72
|
selectedLocale: "",
|
|
73
|
+
localeRevision: 0,
|
|
73
74
|
defaultSupportedLocale: "en",
|
|
74
75
|
appLocale: {},
|
|
75
76
|
dateFormat: "MMM d, y",
|
|
@@ -126,7 +127,7 @@ const loadLocaleBundle = createAsyncThunk(
|
|
|
126
127
|
i18nService.selectedLocale = locale;
|
|
127
128
|
}
|
|
128
129
|
updateLocaleDirection(locale);
|
|
129
|
-
appstore.set("i18nService", __spreadProps(__spreadValues({}, response.data), { selectedLocale: locale }));
|
|
130
|
+
appstore.set("i18nService", __spreadProps(__spreadValues(__spreadValues({}, i18nService), response.data), { selectedLocale: locale }));
|
|
130
131
|
return { data: response.data, locale };
|
|
131
132
|
} catch (error) {
|
|
132
133
|
console.warn(`Error loading locale resource: ${error}`);
|
|
@@ -188,6 +189,7 @@ const i18nSlice = createSlice({
|
|
|
188
189
|
state.dateTimeFormat = `${state.dateFormat} ${state.timeFormat}`;
|
|
189
190
|
state.prefabMessages = action.payload.data.prefabMessages || {};
|
|
190
191
|
state.selectedLocale = action.payload.locale || state.selectedLocale;
|
|
192
|
+
state.localeRevision += 1;
|
|
191
193
|
}).addCase(loadLocaleBundle.rejected, (state, action) => {
|
|
192
194
|
state.error = action.payload;
|
|
193
195
|
});
|
package/types/index.d.ts
CHANGED
|
@@ -60,5 +60,11 @@ export type ComponentInfo = {
|
|
|
60
60
|
startUpVariables: string[];
|
|
61
61
|
startUpActions: string[];
|
|
62
62
|
autoUpdateVariables: string[];
|
|
63
|
+
/**
|
|
64
|
+
* Dependency paths this component reads cross-context from the active page, e.g.
|
|
65
|
+
* `Variables.PageDataInvoke1.dataSet.content` or `Widgets.button1.caption`. Declared at codegen
|
|
66
|
+
* time; the runtime value-gates re-renders to exactly these when the active page changes.
|
|
67
|
+
*/
|
|
68
|
+
activePageDeps?: string[];
|
|
63
69
|
isPartOfPrefab: boolean;
|
|
64
70
|
};
|
package/utils/attr.js
CHANGED
|
@@ -215,10 +215,13 @@ const removeInvalidAttributes = (attributes, explicitRemoveAttributes) => {
|
|
|
215
215
|
const filteredAttributes = {};
|
|
216
216
|
Object.keys(attributes).forEach((key) => {
|
|
217
217
|
var _a;
|
|
218
|
+
const value = attributes[key];
|
|
218
219
|
if ((explicitRemoveAttributes == null ? void 0 : explicitRemoveAttributes.includes(key)) || INTERNAL_ATTRIBUTES.has(key) || !isSafeAttributeName(key)) {
|
|
220
|
+
if (key === "ref") {
|
|
221
|
+
filteredAttributes[key] = value;
|
|
222
|
+
}
|
|
219
223
|
return;
|
|
220
224
|
}
|
|
221
|
-
const value = attributes[key];
|
|
222
225
|
if (Array.isArray(value) || typeof value === "object" && value !== null) {
|
|
223
226
|
return;
|
|
224
227
|
}
|
|
@@ -2,11 +2,19 @@ import React from "react";
|
|
|
2
2
|
import { transform } from "sucrase";
|
|
3
3
|
import { getComponent } from "../../runtime-dynamic/registry";
|
|
4
4
|
import { formatMessage, _get, toNumber } from "../../core/util";
|
|
5
|
+
import { useAppState } from "../../context/WidgetProvider";
|
|
5
6
|
const UTIL_SCOPE = {
|
|
6
7
|
formatMessage,
|
|
7
8
|
_get,
|
|
8
|
-
toNumber
|
|
9
|
+
toNumber,
|
|
10
|
+
useAppState
|
|
9
11
|
};
|
|
12
|
+
function wrapCustomExpressionComponentBody(jsxInner) {
|
|
13
|
+
return `function __render__() {
|
|
14
|
+
const fragment = useAppState();
|
|
15
|
+
return (<React.Fragment>${jsxInner.trim() || "null"}</React.Fragment>);
|
|
16
|
+
}`;
|
|
17
|
+
}
|
|
10
18
|
function stripLeadingArrow(markup) {
|
|
11
19
|
const trimmed = markup.trim();
|
|
12
20
|
const arrow = trimmed.match(/^\([^)]*\)\s*=>\s*/);
|
|
@@ -67,7 +75,7 @@ async function parseCustomExpressionToJsx(transformedMarkup, fragment) {
|
|
|
67
75
|
return cache.get(markup);
|
|
68
76
|
}
|
|
69
77
|
const jsxInner = stripLeadingArrow(markup);
|
|
70
|
-
const jsxWrapped =
|
|
78
|
+
const jsxWrapped = wrapCustomExpressionComponentBody(jsxInner);
|
|
71
79
|
let compiledCode;
|
|
72
80
|
try {
|
|
73
81
|
compiledCode = compileJsxToRenderBody(jsxWrapped);
|
|
@@ -106,7 +114,6 @@ ${jsxInner}`
|
|
|
106
114
|
cache.set(markup, fallback);
|
|
107
115
|
return fallback;
|
|
108
116
|
}
|
|
109
|
-
const stopPropagation = (e) => e.stopPropagation();
|
|
110
117
|
const renderComponent = (rowData) => {
|
|
111
118
|
try {
|
|
112
119
|
const args = templateValues.slice();
|
|
@@ -116,11 +123,7 @@ ${jsxInner}`
|
|
|
116
123
|
if (fragmentIdx >= 0) args[fragmentIdx] = fragment;
|
|
117
124
|
if (widgetsIdx >= 0) args[widgetsIdx] = fr == null ? void 0 : fr.Widgets;
|
|
118
125
|
if (variablesIdx >= 0) args[variablesIdx] = fr == null ? void 0 : fr.Variables;
|
|
119
|
-
return React.createElement(
|
|
120
|
-
"span",
|
|
121
|
-
{ className: "custom-expr-wrapper", onClick: stopPropagation },
|
|
122
|
-
renderFn(...args)
|
|
123
|
-
);
|
|
126
|
+
return React.createElement("span", { className: "custom-expr-wrapper" }, renderFn(...args));
|
|
124
127
|
} catch (err) {
|
|
125
128
|
console.error("[customExpressionParser] Render error:", err);
|
|
126
129
|
return null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Check if the url is an SVG icon url (path ends with .svg, ignoring query/hash). */
|
|
2
|
+
export declare function isSvgIconUrl(url: string | null | undefined): boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve a raw icon URL the same way image sources are resolved in React runtime
|
|
5
|
+
* (prefab resource prefixing for relative `resources/` paths).
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolveIconUrl(rawUrl: string | null | undefined, prefabName?: string): string | null;
|
|
8
|
+
/**
|
|
9
|
+
* Make fetched SVG behave like a font icon:
|
|
10
|
+
* - replace non-"none" fill/stroke attributes with currentColor
|
|
11
|
+
* - replace non-"none" inline fill:/stroke: style values with currentColor
|
|
12
|
+
* - on the root <svg>, set width/height to 1em and default fill to currentColor
|
|
13
|
+
*/
|
|
14
|
+
export declare function normalizeSvg(svg: string): string;
|
|
15
|
+
export declare function sanitizeSvgMarkup(svg: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Returns cached normalized SVG markup synchronously
|
|
18
|
+
* Use before async fetch so remounts render the icon on the first paint.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getCachedSvgIcon(resolvedUrl: string): string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Fetch and normalize SVG markup for the given resolved URL.
|
|
23
|
+
* Results are cached module-wide; concurrent requests for the same URL share one fetch.
|
|
24
|
+
*/
|
|
25
|
+
export declare function fetchSvgIcon(resolvedUrl: string): Promise<string>;
|
|
26
|
+
/** @internal Test helper */
|
|
27
|
+
export declare function clearSvgIconCache(): void;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import DOMPurify from "dompurify";
|
|
2
|
+
import { prefixPrefabResourceUrl } from "./resource-url";
|
|
3
|
+
function isSvgIconUrl(url) {
|
|
4
|
+
if (!url) {
|
|
5
|
+
return false;
|
|
6
|
+
}
|
|
7
|
+
const path = url.split(/[?#]/)[0];
|
|
8
|
+
return /\.svg$/i.test(path);
|
|
9
|
+
}
|
|
10
|
+
function resolveIconUrl(rawUrl, prefabName) {
|
|
11
|
+
if (!rawUrl) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const resolved = prefixPrefabResourceUrl(rawUrl, prefabName);
|
|
15
|
+
return resolved || null;
|
|
16
|
+
}
|
|
17
|
+
function normalizeSvg(svg) {
|
|
18
|
+
if (!svg) return "";
|
|
19
|
+
let out = svg;
|
|
20
|
+
out = out.replace(/fill\s*=\s*"(?!\s*none\s*")[^"]*"/gi, 'fill="currentColor"').replace(/fill\s*=\s*'(?!\s*none\s*')[^']*'/gi, "fill='currentColor'").replace(/stroke\s*=\s*"(?!\s*none\s*")[^"]*"/gi, 'stroke="currentColor"').replace(/stroke\s*=\s*'(?!\s*none\s*')[^']*'/gi, "stroke='currentColor'").replace(/(fill|stroke)\s*:\s*(?!\s*none\b)[^;"']+/gi, "$1: currentColor");
|
|
21
|
+
out = out.replace(/<svg\b([^>]*)>/i, (_match, attrs) => {
|
|
22
|
+
let updated = attrs;
|
|
23
|
+
updated = updated.replace(/\swidth\s*=\s*("[^"]*"|'[^']*')/gi, "").replace(/\s+$/, "") + ' width="1em"';
|
|
24
|
+
updated = updated.replace(/\sheight\s*=\s*("[^"]*"|'[^']*')/gi, "").replace(/\s+$/, "") + ' height="1em"';
|
|
25
|
+
updated += ' fill="currentColor"';
|
|
26
|
+
return `<svg${updated}>`;
|
|
27
|
+
});
|
|
28
|
+
return out;
|
|
29
|
+
}
|
|
30
|
+
function sanitizeSvgMarkup(svg) {
|
|
31
|
+
return DOMPurify.sanitize(svg, { USE_PROFILES: { svg: true, svgFilters: true } });
|
|
32
|
+
}
|
|
33
|
+
const svgCache = /* @__PURE__ */ new Map();
|
|
34
|
+
const inFlightRequests = /* @__PURE__ */ new Map();
|
|
35
|
+
function getCachedSvgIcon(resolvedUrl) {
|
|
36
|
+
return svgCache.get(resolvedUrl);
|
|
37
|
+
}
|
|
38
|
+
async function fetchSvgIcon(resolvedUrl) {
|
|
39
|
+
const cached = svgCache.get(resolvedUrl);
|
|
40
|
+
if (cached !== void 0) {
|
|
41
|
+
return cached;
|
|
42
|
+
}
|
|
43
|
+
let request = inFlightRequests.get(resolvedUrl);
|
|
44
|
+
if (!request) {
|
|
45
|
+
request = fetch(resolvedUrl).then((response) => {
|
|
46
|
+
if (!response.ok) {
|
|
47
|
+
throw new Error(`Failed to fetch SVG: ${response.status}`);
|
|
48
|
+
}
|
|
49
|
+
return response.text();
|
|
50
|
+
}).then((raw) => {
|
|
51
|
+
const normalized = sanitizeSvgMarkup(normalizeSvg(raw));
|
|
52
|
+
svgCache.set(resolvedUrl, normalized);
|
|
53
|
+
inFlightRequests.delete(resolvedUrl);
|
|
54
|
+
return normalized;
|
|
55
|
+
}).catch((error) => {
|
|
56
|
+
inFlightRequests.delete(resolvedUrl);
|
|
57
|
+
throw error;
|
|
58
|
+
});
|
|
59
|
+
inFlightRequests.set(resolvedUrl, request);
|
|
60
|
+
}
|
|
61
|
+
return request;
|
|
62
|
+
}
|
|
63
|
+
function clearSvgIconCache() {
|
|
64
|
+
svgCache.clear();
|
|
65
|
+
inFlightRequests.clear();
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
clearSvgIconCache,
|
|
69
|
+
fetchSvgIcon,
|
|
70
|
+
getCachedSvgIcon,
|
|
71
|
+
isSvgIconUrl,
|
|
72
|
+
normalizeSvg,
|
|
73
|
+
resolveIconUrl,
|
|
74
|
+
sanitizeSvgMarkup
|
|
75
|
+
};
|
|
@@ -14,7 +14,7 @@ export declare class DataSetItem {
|
|
|
14
14
|
match?: string;
|
|
15
15
|
dateformat?: string;
|
|
16
16
|
}
|
|
17
|
-
export declare const transformDataset: (
|
|
17
|
+
export declare const transformDataset: (dataset: any, datafield: any, displayfield: any, displaylabel: any, displayexpression: any, orderby: any, groupby: any, dataPath: any, itemchildren?: any, match?: string) => DataSetItem[];
|
|
18
18
|
/**
|
|
19
19
|
* function to get the ordered dataset based on the given orderby
|
|
20
20
|
*/
|
|
@@ -27,10 +27,10 @@ export declare const extractDataAsArray: (data: any) => any[];
|
|
|
27
27
|
export declare const convertDataToObject: (dataResult: any) => any;
|
|
28
28
|
export declare const transformFormData: (context: any, dataSet: any, myDataField: string, displayOptions?: any, startIndex?: number, scope?: any, dataPath?: string) => Array<DataSetItem>;
|
|
29
29
|
export declare const getUniqObjsByDataField: (data: Array<DataSetItem>, dataField: string, displayField: string, allowEmptyFields?: boolean) => any;
|
|
30
|
-
export declare const setItemByCompare: (datasetItems: Array<DataSetItem>, compareWithDataObj:
|
|
30
|
+
export declare const setItemByCompare: (datasetItems: Array<DataSetItem>, compareWithDataObj: object, compareByField: string) => DataSetItem | undefined;
|
|
31
31
|
export declare const datasetItems: (dataset: any, datafield: string, displayfield: string, displaylabel: string, displayexpression: string, orderby: string, groupby?: string, dataPath?: string, itemchildren?: any, match?: string) => DataSetItem[];
|
|
32
32
|
export declare const groupData: (compRef: any, // In React, this would likely be component props or state
|
|
33
|
-
data: Array<
|
|
33
|
+
data: Array<object | DataSetItem>, groupby: string, match: string, orderby: string, dateformat?: string, innerItem?: string, AppDefaults?: any) => any[];
|
|
34
34
|
/**
|
|
35
35
|
* Utility functions for list group operations
|
|
36
36
|
*/
|
|
@@ -24,7 +24,6 @@ import {
|
|
|
24
24
|
includes,
|
|
25
25
|
isArray,
|
|
26
26
|
isEqual,
|
|
27
|
-
memoize,
|
|
28
27
|
isNull,
|
|
29
28
|
isObject,
|
|
30
29
|
isString,
|
|
@@ -116,7 +115,7 @@ const resolver = (...args) => {
|
|
|
116
115
|
return JSON.stringify(arg);
|
|
117
116
|
}).join("|");
|
|
118
117
|
};
|
|
119
|
-
const transformDataset =
|
|
118
|
+
const transformDataset = _internalTransformDataset;
|
|
120
119
|
const getOrderedDataset = (dataSet, orderBy, innerItem) => {
|
|
121
120
|
if (!orderBy) {
|
|
122
121
|
return cloneDeep(dataSet);
|