@wavemaker-ai/react-runtime 1.0.0-rc.314 → 1.0.0-rc.319
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/navigation-action.d.ts +1 -0
- package/actions/navigation-action.js +34 -9
- package/components/advanced/carousel/index.d.ts +2 -0
- package/components/advanced/carousel/template.d.ts +2 -0
- package/components/advanced/login/index.d.ts +2 -0
- package/components/advanced/marquee/index.d.ts +2 -0
- package/components/auth/RoleAuthGuard.d.ts +6 -0
- package/components/auth/RoleAuthGuard.js +66 -0
- package/components/basic/anchor/index.d.ts +2 -0
- package/components/basic/anchor/index.js +1 -1
- package/components/basic/audio/index.d.ts +2 -0
- package/components/basic/html/index.d.ts +2 -0
- package/components/basic/icon/index.d.ts +2 -0
- package/components/basic/iframe/index.d.ts +2 -0
- package/components/basic/label/index.d.ts +2 -0
- package/components/basic/label/index.js +17 -3
- package/components/basic/picture/index.d.ts +2 -0
- package/components/basic/picture/index.js +20 -1
- package/components/basic/progress-bar/index.d.ts +2 -0
- package/components/basic/progress-circle/index.d.ts +2 -0
- package/components/basic/progress-circle/index.js +2 -1
- package/components/basic/richtexteditor/index.d.ts +4 -0
- package/components/basic/richtexteditor/index.js +16 -15
- package/components/basic/search/index.d.ts +4 -0
- package/components/basic/search/index.js +2 -1
- package/components/basic/search/providers.js +2 -2
- package/components/basic/spinner/index.d.ts +2 -0
- package/components/basic/tile/index.d.ts +2 -0
- package/components/basic/tree/Components/TreeNodeComponent.d.ts +1 -1
- package/components/basic/tree/Components/TreeNodeComponent.js +14 -8
- package/components/basic/tree/hooks/useTreePersistedState.d.ts +3 -0
- package/components/basic/tree/hooks/useTreePersistedState.js +38 -0
- package/components/basic/tree/index.d.ts +3 -0
- package/components/basic/tree/index.js +105 -30
- package/components/basic/tree/props.d.ts +18 -1
- package/components/basic/tree/utils.d.ts +16 -1
- package/components/basic/tree/utils.js +111 -0
- package/components/basic/video/index.d.ts +2 -0
- package/components/chart/index.d.ts +2 -0
- package/components/chart/src/dataUtils.js +1 -1
- package/components/common/customTemplate/useCustomTemplate.js +1 -1
- package/components/common/index.d.ts +2 -0
- package/components/common/index.js +5 -1
- package/components/common/wm-skeleton.d.ts +95 -0
- package/components/common/wm-skeleton.js +346 -0
- package/components/container/accordion/accordion-pane/index.d.ts +2 -0
- package/components/container/accordion/index.d.ts +4 -0
- package/components/container/accordion/index.js +23 -1
- package/components/container/accordion/props.d.ts +10 -0
- package/components/container/index.d.ts +2 -0
- package/components/container/index.js +2 -4
- package/components/container/layout-grid/grid-column/index.d.ts +2 -0
- package/components/container/layout-grid/grid-column/index.js +2 -1
- package/components/container/layout-grid/grid-row/index.d.ts +2 -0
- package/components/container/layout-grid/index.d.ts +2 -0
- package/components/container/linear-layout/index.d.ts +2 -0
- package/components/container/linear-layout/linear-layout-item/index.d.ts +2 -0
- package/components/container/panel/index.d.ts +2 -0
- package/components/container/repeat-template/index.d.ts +2 -0
- package/components/container/tabs/index.d.ts +4 -0
- package/components/container/tabs/index.js +23 -1
- package/components/container/tabs/props.d.ts +10 -0
- package/components/container/tabs/tab-pane/index.d.ts +2 -0
- package/components/container/wizard/index.d.ts +8 -0
- package/components/container/wizard/index.js +27 -3
- package/components/container/wizard/props.d.ts +10 -0
- package/components/container/wizard/wizard-step/index.d.ts +2 -0
- package/components/data/card/card-actions/index.d.ts +2 -0
- package/components/data/card/card-content/index.d.ts +2 -0
- package/components/data/card/card-footer/index.d.ts +2 -0
- package/components/data/card/index.d.ts +2 -0
- package/components/data/card/index.js +12 -6
- package/components/data/form/base-form/hooks/useFormOperations.d.ts +1 -1
- package/components/data/form/base-form/hooks/useFormOperations.js +3 -3
- package/components/data/form/base-form/index.js +33 -26
- package/components/data/form/base-form/props.d.ts +1 -1
- package/components/data/form/dynamic-fields/index.js +3 -0
- package/components/data/form/form-action/index.d.ts +4 -0
- package/components/data/form/form-controller/hooks/index.js +2 -1
- package/components/data/form/form-controller/withFormController.js +14 -23
- package/components/data/form/form-field/base-field.js +0 -5
- package/components/data/form/form-field/index.js +99 -13
- package/components/data/form/form-field/props.d.ts +8 -0
- package/components/data/form/index.js +13 -0
- package/components/data/list/index.d.ts +7 -0
- package/components/data/list/index.js +18 -0
- package/components/data/list/props.d.ts +7 -0
- package/components/data/pagination/hooks/usePagination.js +0 -1
- package/components/data/table/components/RowCells.js +4 -1
- package/components/data/table/hooks/useDynamicColumns.js +3 -1
- package/components/data/table/hooks/useResponsiveColumns.d.ts +2 -0
- package/components/data/table/index.d.ts +8 -0
- package/components/data/table/index.js +20 -2
- package/components/data/table/live-table/index.d.ts +2 -0
- package/components/data/table/props.d.ts +10 -0
- package/components/data/table/table-action/index.d.ts +2 -0
- package/components/data/table/table-column/index.d.ts +2 -0
- package/components/data/table/table-row/index.d.ts +2 -0
- package/components/data/table/table-row-action/index.d.ts +2 -0
- package/components/data/table/utils/columnBuilder.d.ts +1 -1
- package/components/data/table/utils/columnBuilder.js +7 -4
- package/components/data/table/utils/crud-handlers.js +10 -10
- package/components/data/table/utils/index.d.ts +11 -8
- package/components/data/table/utils/index.js +90 -12
- package/components/dialogs/alert-dialog/index.d.ts +4 -0
- package/components/dialogs/confirm-dialog/index.d.ts +4 -0
- package/components/dialogs/dialog/index.d.ts +4 -0
- package/components/dialogs/dialog-actions/index.d.ts +2 -0
- package/components/dialogs/dialog-body/index.d.ts +2 -0
- package/components/dialogs/dialog-content/index.d.ts +2 -0
- package/components/dialogs/dialog-header/index.d.ts +2 -0
- package/components/dialogs/iframe-dialog/index.d.ts +4 -0
- package/components/dialogs/login-dialog/index.d.ts +4 -0
- package/components/dialogs/page-dialog/index.d.ts +4 -0
- package/components/form/button/index.d.ts +2 -0
- package/components/form/button/index.js +10 -1
- package/components/form/button-group/index.d.ts +2 -0
- package/components/input/calendar/index.d.ts +4 -0
- package/components/input/calendar/index.js +2 -1
- package/components/input/chips/index.d.ts +4 -0
- package/components/input/color-picker/index.d.ts +4 -0
- package/components/input/color-picker/index.js +18 -7
- package/components/input/composite/index.d.ts +2 -0
- package/components/input/currency/index.d.ts +4 -0
- package/components/input/default/checkbox/index.d.ts +4 -0
- package/components/input/default/checkboxset/index.d.ts +4 -0
- package/components/input/default/checkboxset/index.js +7 -5
- package/components/input/default/radioset/index.d.ts +4 -0
- package/components/input/default/radioset/index.js +2 -1
- package/components/input/default/switch/index.d.ts +4 -0
- package/components/input/default/switch/index.js +17 -13
- package/components/input/epoch/date/index.d.ts +2 -0
- package/components/input/epoch/date/index.js +30 -14
- package/components/input/epoch/datetime/index.d.ts +2 -0
- package/components/input/epoch/datetime/index.js +12 -8
- package/components/input/epoch/time/index.d.ts +2 -0
- package/components/input/epoch/time/index.js +21 -15
- package/components/input/fileupload/index.d.ts +2 -0
- package/components/input/number/index.d.ts +4 -0
- package/components/input/number/index.js +4 -3
- package/components/input/rating/index.d.ts +4 -0
- package/components/input/select/index.d.ts +4 -0
- package/components/input/slider/index.d.ts +4 -0
- package/components/input/slider/index.js +4 -2
- package/components/input/text/index.d.ts +4 -0
- package/components/input/text/index.js +16 -8
- package/components/input/textarea/index.d.ts +4 -0
- package/components/input/upload/index.d.ts +4 -0
- package/components/input/upload/index.js +6 -4
- package/components/layout/leftnav/index.js +21 -2
- package/components/layout/leftnav/props.d.ts +9 -0
- package/components/layout/leftnav/utils/page-class-util.d.ts +9 -0
- package/components/layout/leftnav/utils/page-class-util.js +28 -0
- package/components/navbar/index.d.ts +2 -0
- package/components/navbar/nav/index.d.ts +2 -0
- package/components/navbar/nav-item/index.d.ts +2 -0
- package/components/navigation/breadcrumb/index.d.ts +2 -0
- package/components/navigation/menu/index.d.ts +2 -0
- package/components/navigation/menu/index.js +2 -2
- package/components/navigation/popover/index.d.ts +2 -0
- package/components/navigation/popover/index.js +1 -0
- package/components/page/index.js +22 -6
- package/components/page/page-context.d.ts +4 -0
- package/components/page/page-context.js +5 -0
- package/components/page/partial/index.d.ts +2 -0
- package/components/page/partial-container/index.js +1 -4
- package/context/AppContext.d.ts +2 -0
- package/context/AppContext.js +20 -1
- package/context/WidgetProvider.js +0 -3
- package/core/proxy-service.d.ts +2 -0
- package/core/proxy-service.js +25 -0
- package/higherOrder/BaseApp.js +5 -6
- package/higherOrder/BaseAppProps.d.ts +1 -0
- package/higherOrder/BasePage.js +4 -12
- package/higherOrder/props.d.ts +10 -0
- package/higherOrder/withBaseWrapper.js +3 -0
- package/hooks/useAuth.js +3 -0
- package/hooks/useDataSourceSubscription.js +1 -1
- package/hooks/useHttp.js +0 -4
- package/hooks/useLayoutSize.d.ts +6 -0
- package/hooks/useLayoutSize.js +12 -0
- package/package-lock.json +229 -203
- package/package.json +3 -3
- package/runtime-dynamic/app-initializer.js +1 -1
- package/runtime-dynamic/components/use-dynamic-component.js +12 -31
- package/runtime-dynamic/factories/build-base-page-like-component.d.ts +1 -1
- package/runtime-dynamic/factories/dynamic-component.js +9 -1
- package/runtime-dynamic/factories/prefab-factory.d.ts +1 -1
- package/runtime-dynamic/factories/utils.d.ts +1 -1
- package/runtime-dynamic/main.js +1 -3
- package/runtime-dynamic/services/component-ref-provider.d.ts +19 -4
- package/runtime-dynamic/services/component-ref-provider.js +18 -38
- package/runtime-dynamic/services/index.d.ts +2 -3
- package/runtime-dynamic/services/index.js +1 -18
- package/runtime-dynamic/services/resource-manager.d.ts +2 -3
- package/runtime-dynamic/services/resource-manager.js +13 -17
- package/runtime-dynamic/services/script-executor.js +5 -8
- package/runtime-dynamic/services/variable-registry.js +3 -4
- package/utils/attr.js +1 -9
- package/utils/custom-expression/index.js +4 -1
- package/utils/custom-expression/parser.js +4 -2
- package/utils/format-util.js +2 -3
- package/utils/state-persistance.d.ts +1 -1
- package/runtime-dynamic/services/cache.d.ts +0 -29
- package/runtime-dynamic/services/cache.js +0 -51
- package/utils/form-state.util.d.ts +0 -62
- package/utils/form-state.util.js +0 -109
|
@@ -289,6 +289,7 @@ const WmText = memo(
|
|
|
289
289
|
}
|
|
290
290
|
};
|
|
291
291
|
const handleBlur = (e) => {
|
|
292
|
+
var _a;
|
|
292
293
|
if (readonly || disabled) {
|
|
293
294
|
return;
|
|
294
295
|
}
|
|
@@ -306,14 +307,16 @@ const WmText = memo(
|
|
|
306
307
|
setIsTouched(true);
|
|
307
308
|
setIsDirty(true);
|
|
308
309
|
}
|
|
309
|
-
onBlur == null ? void 0 : onBlur(e, listener == null ? void 0 : listener.Widgets[name]);
|
|
310
|
+
onBlur == null ? void 0 : onBlur(e, (_a = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a[name]);
|
|
310
311
|
};
|
|
311
312
|
const handleFocus = (e) => {
|
|
312
|
-
|
|
313
|
+
var _a;
|
|
314
|
+
onFocus == null ? void 0 : onFocus(e, (_a = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a[name]);
|
|
313
315
|
};
|
|
314
316
|
const handleKeyDown = (e) => {
|
|
315
317
|
delay(() => {
|
|
316
|
-
|
|
318
|
+
var _a;
|
|
319
|
+
onKeydown == null ? void 0 : onKeydown(e, (_a = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a[name]);
|
|
317
320
|
if (e.key === "Enter") {
|
|
318
321
|
debouncedUpdateValue(rawValue);
|
|
319
322
|
}
|
|
@@ -321,24 +324,29 @@ const WmText = memo(
|
|
|
321
324
|
};
|
|
322
325
|
const handleKeyPress = (e) => {
|
|
323
326
|
delay(() => {
|
|
324
|
-
|
|
327
|
+
var _a;
|
|
328
|
+
onKeypress == null ? void 0 : onKeypress(e, (_a = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a[name]);
|
|
325
329
|
}, 0);
|
|
326
330
|
};
|
|
327
331
|
const handleKeyUp = (e) => {
|
|
328
332
|
delay(() => {
|
|
329
|
-
|
|
333
|
+
var _a;
|
|
334
|
+
onKeyup == null ? void 0 : onKeyup(e, (_a = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a[name]);
|
|
330
335
|
}, 0);
|
|
331
336
|
};
|
|
332
337
|
const handleLeadingIconClick = (e) => {
|
|
338
|
+
var _a;
|
|
333
339
|
e.preventDefault();
|
|
334
|
-
onLeadingiconclick == null ? void 0 : onLeadingiconclick(e, listener == null ? void 0 : listener.Widgets[name]);
|
|
340
|
+
onLeadingiconclick == null ? void 0 : onLeadingiconclick(e, (_a = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a[name]);
|
|
335
341
|
};
|
|
336
342
|
const handleTrailingIconClick = (e) => {
|
|
343
|
+
var _a;
|
|
337
344
|
e.preventDefault();
|
|
338
|
-
onTrailingiconclick == null ? void 0 : onTrailingiconclick(e, listener == null ? void 0 : listener.Widgets[name]);
|
|
345
|
+
onTrailingiconclick == null ? void 0 : onTrailingiconclick(e, (_a = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a[name]);
|
|
339
346
|
};
|
|
340
347
|
const handleMouseEnter = (e) => {
|
|
341
|
-
|
|
348
|
+
var _a;
|
|
349
|
+
onMouseEnter == null ? void 0 : onMouseEnter(e, (_a = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a[name]);
|
|
342
350
|
setIsTouched(true);
|
|
343
351
|
};
|
|
344
352
|
const events = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
|
|
@@ -63,6 +63,8 @@ declare const WmTextareaStandalone: React.ComponentType<import("../../data/form/
|
|
|
63
63
|
formfield?: boolean;
|
|
64
64
|
dataset?: any;
|
|
65
65
|
prefabName?: string;
|
|
66
|
+
loading?: boolean;
|
|
67
|
+
showSkeleton?: boolean;
|
|
66
68
|
} & import("@wavemaker-ai/react-runtime/higherOrder/withStandalone").WithStandaloneProps>;
|
|
67
69
|
export { WmTextareaStandalone as WmTextarea };
|
|
68
70
|
/**
|
|
@@ -147,5 +149,7 @@ declare const _default: React.ComponentType<{
|
|
|
147
149
|
formfield?: boolean;
|
|
148
150
|
dataset?: any;
|
|
149
151
|
prefabName?: string;
|
|
152
|
+
loading?: boolean;
|
|
153
|
+
showSkeleton?: boolean;
|
|
150
154
|
}>;
|
|
151
155
|
export default _default;
|
|
@@ -58,6 +58,8 @@ declare const WithForm: React.NamedExoticComponent<import("../../data/form/form-
|
|
|
58
58
|
updateon?: string;
|
|
59
59
|
dataset?: any;
|
|
60
60
|
prefabName?: string;
|
|
61
|
+
loading?: boolean;
|
|
62
|
+
showSkeleton?: boolean;
|
|
61
63
|
}>;
|
|
62
64
|
/**
|
|
63
65
|
* The WmUpload component provides a file upload input for form fields with blob support.
|
|
@@ -138,5 +140,7 @@ declare const _default: React.ComponentType<{
|
|
|
138
140
|
updateon?: string;
|
|
139
141
|
dataset?: any;
|
|
140
142
|
prefabName?: string;
|
|
143
|
+
loading?: boolean;
|
|
144
|
+
showSkeleton?: boolean;
|
|
141
145
|
}>;
|
|
142
146
|
export default _default;
|
|
@@ -45,7 +45,7 @@ const WmUpload = memo(
|
|
|
45
45
|
const prevDatavalue = useRef(datavalue);
|
|
46
46
|
const isImage = (formField == null ? void 0 : formField.filetype) === "image";
|
|
47
47
|
const handleFileChange = (event) => {
|
|
48
|
-
var _a, _b, _c;
|
|
48
|
+
var _a, _b, _c, _d;
|
|
49
49
|
const file = ((_a = event.target.files) == null ? void 0 : _a[0]) || null;
|
|
50
50
|
if (type === "file") {
|
|
51
51
|
(_b = listener == null ? void 0 : listener.onChange) == null ? void 0 : _b.call(listener, props.fieldName || props.name, {
|
|
@@ -59,7 +59,7 @@ const WmUpload = memo(
|
|
|
59
59
|
if (onChange) {
|
|
60
60
|
onChange(
|
|
61
61
|
event,
|
|
62
|
-
listener == null ? void 0 : listener.Widgets[name],
|
|
62
|
+
(_d = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _d[name],
|
|
63
63
|
type === "file" ? file : event.target.value,
|
|
64
64
|
prevDatavalue.current
|
|
65
65
|
);
|
|
@@ -67,13 +67,15 @@ const WmUpload = memo(
|
|
|
67
67
|
prevDatavalue.current = file;
|
|
68
68
|
};
|
|
69
69
|
const handleFileFocus = (event) => {
|
|
70
|
+
var _a;
|
|
70
71
|
if (onFocus) {
|
|
71
|
-
onFocus(event, listener == null ? void 0 : listener.Widgets[name]);
|
|
72
|
+
onFocus(event, (_a = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a[name]);
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
75
|
const handleFileBlur = (event) => {
|
|
76
|
+
var _a;
|
|
75
77
|
if (onBlur) {
|
|
76
|
-
onBlur(event, listener == null ? void 0 : listener.Widgets[name]);
|
|
78
|
+
onBlur(event, (_a = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a[name]);
|
|
77
79
|
}
|
|
78
80
|
};
|
|
79
81
|
const renderExistingFile = useCallback(() => {
|
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from "react";
|
|
2
|
+
import { useContext, useEffect } from "react";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import Box from "@mui/material/Box";
|
|
5
|
+
import { PageLayoutContext } from "../../page/page-context";
|
|
6
|
+
import { getLeftPanelPageClasses } from "./utils/page-class-util";
|
|
5
7
|
const DEFAULT_CLASS = "app-nav-drawer app-left-panel left-panel-collapsed ";
|
|
8
|
+
const SLIDE_IN = "slide-in";
|
|
6
9
|
const WmLeftPanel = (props) => {
|
|
10
|
+
const { onLeftPanelPageClassesChange } = useContext(PageLayoutContext);
|
|
7
11
|
const {
|
|
8
12
|
styles,
|
|
9
13
|
children,
|
|
10
14
|
render,
|
|
11
15
|
className,
|
|
12
16
|
columnwidth = 2,
|
|
17
|
+
xscolumnwidth = 10,
|
|
13
18
|
id,
|
|
14
19
|
navtype,
|
|
15
20
|
navheight,
|
|
21
|
+
animation = SLIDE_IN,
|
|
16
22
|
onNavHeightChange
|
|
17
23
|
} = props;
|
|
18
24
|
useEffect(() => {
|
|
@@ -25,6 +31,18 @@ const WmLeftPanel = (props) => {
|
|
|
25
31
|
}
|
|
26
32
|
};
|
|
27
33
|
}, [navheight, onNavHeightChange]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
onLeftPanelPageClassesChange == null ? void 0 : onLeftPanelPageClassesChange(
|
|
36
|
+
getLeftPanelPageClasses({
|
|
37
|
+
animation,
|
|
38
|
+
columnwidth,
|
|
39
|
+
xscolumnwidth
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
return () => {
|
|
43
|
+
onLeftPanelPageClassesChange == null ? void 0 : onLeftPanelPageClassesChange(void 0);
|
|
44
|
+
};
|
|
45
|
+
}, [animation, columnwidth, xscolumnwidth]);
|
|
28
46
|
return /* @__PURE__ */ jsx(
|
|
29
47
|
Box,
|
|
30
48
|
{
|
|
@@ -34,7 +52,8 @@ const WmLeftPanel = (props) => {
|
|
|
34
52
|
className: clsx(
|
|
35
53
|
DEFAULT_CLASS,
|
|
36
54
|
className,
|
|
37
|
-
|
|
55
|
+
animation,
|
|
56
|
+
`col-md-${columnwidth} col-sm-${columnwidth} col-xs-${xscolumnwidth} ${navtype ? `app-nav-${navtype}` : ""} ${navheight ? `app-nav-${navheight}` : ""}`
|
|
38
57
|
),
|
|
39
58
|
children: render ? render(props) : children
|
|
40
59
|
}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
export interface LeftNavProps {
|
|
2
|
+
/**
|
|
3
|
+
* The animation mode used by the left panel.
|
|
4
|
+
*/
|
|
5
|
+
animation?: string;
|
|
2
6
|
/**
|
|
3
7
|
* The number of columns the left panel should span.
|
|
4
8
|
* @default 2
|
|
5
9
|
*/
|
|
6
10
|
columnwidth?: number | string;
|
|
11
|
+
/**
|
|
12
|
+
* The number of columns the left panel should span on extra-small screens.
|
|
13
|
+
* @default 10
|
|
14
|
+
*/
|
|
15
|
+
xscolumnwidth?: number | string;
|
|
7
16
|
/**
|
|
8
17
|
* The height of the navigation panel.
|
|
9
18
|
*/
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type LeftPanelPageLayout = {
|
|
2
|
+
animation?: string;
|
|
3
|
+
columnwidth?: number | string;
|
|
4
|
+
xscolumnwidth?: number | string;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* (slide-in-left-panel-container, left-panel-container-*-*, etc.).
|
|
8
|
+
*/
|
|
9
|
+
export declare const getLeftPanelPageClasses: (layout: LeftPanelPageLayout) => string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import clsx from "clsx";
|
|
2
|
+
const SLIDE_IN = "slide-in";
|
|
3
|
+
const SLIDE_OVER = "slide-over";
|
|
4
|
+
const getPageWidthClass = (device, panelWidth) => {
|
|
5
|
+
const width = Number(panelWidth);
|
|
6
|
+
if (!Number.isFinite(width)) {
|
|
7
|
+
return "";
|
|
8
|
+
}
|
|
9
|
+
return `left-panel-container-${device}-${12 - width}`;
|
|
10
|
+
};
|
|
11
|
+
const getLeftPanelPageClasses = (layout) => {
|
|
12
|
+
if (layout.animation === SLIDE_IN) {
|
|
13
|
+
return clsx(
|
|
14
|
+
"left-panel-collapsed-container",
|
|
15
|
+
"slide-in-left-panel-container",
|
|
16
|
+
getPageWidthClass("md", layout.columnwidth),
|
|
17
|
+
getPageWidthClass("sm", layout.columnwidth),
|
|
18
|
+
getPageWidthClass("xs", layout.xscolumnwidth)
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
if (layout.animation === SLIDE_OVER) {
|
|
22
|
+
return clsx("left-panel-collapsed-container", "slide-over-left-panel-container");
|
|
23
|
+
}
|
|
24
|
+
return "left-panel-collapsed-container";
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
getLeftPanelPageClasses
|
|
28
|
+
};
|
|
@@ -63,6 +63,8 @@ declare const _default: import("react").MemoExoticComponent<import("react").Comp
|
|
|
63
63
|
updateon?: string;
|
|
64
64
|
dataset?: any;
|
|
65
65
|
prefabName?: string;
|
|
66
|
+
loading?: boolean;
|
|
67
|
+
showSkeleton?: boolean;
|
|
66
68
|
title?: string;
|
|
67
69
|
brandHref?: string;
|
|
68
70
|
showToggle?: boolean;
|
|
@@ -31,6 +31,7 @@ declare const _default: React.ComponentType<{
|
|
|
31
31
|
type?: "button" | "anchor";
|
|
32
32
|
prefabName?: string;
|
|
33
33
|
key?: string;
|
|
34
|
+
loading?: boolean;
|
|
34
35
|
id?: string;
|
|
35
36
|
caption?: string;
|
|
36
37
|
ref?: React.RefObject<HTMLElement> | React.RefObject<null>;
|
|
@@ -73,6 +74,7 @@ declare const _default: React.ComponentType<{
|
|
|
73
74
|
formfield?: boolean;
|
|
74
75
|
updateon?: string;
|
|
75
76
|
dataset?: any;
|
|
77
|
+
showSkeleton?: boolean;
|
|
76
78
|
orderby?: string;
|
|
77
79
|
iconclass?: string;
|
|
78
80
|
onSelect?: ($event: React.MouseEvent<HTMLElement>, widget: any, $item: any) => void;
|
|
@@ -366,7 +366,7 @@ const WmMenu = memo((props) => {
|
|
|
366
366
|
);
|
|
367
367
|
const handleMenuItemClick = useCallback(
|
|
368
368
|
(event, item) => {
|
|
369
|
-
var _a2, _b2, _c2, _d, _e;
|
|
369
|
+
var _a2, _b2, _c2, _d, _e, _f;
|
|
370
370
|
event = event.nativeEvent;
|
|
371
371
|
const { label, icon, link } = getNodeProperties(item);
|
|
372
372
|
if (item.children && item.children.length > 0 || !link || link === "#") {
|
|
@@ -396,7 +396,7 @@ const WmMenu = memo((props) => {
|
|
|
396
396
|
if (isFromNav && onNavItemActivate) {
|
|
397
397
|
onNavItemActivate();
|
|
398
398
|
}
|
|
399
|
-
if (name && (listener == null ? void 0 : listener.Widgets[name])) {
|
|
399
|
+
if (name && ((_f = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _f[name])) {
|
|
400
400
|
listener.Widgets[name].displayValue = label;
|
|
401
401
|
}
|
|
402
402
|
if (listener == null ? void 0 : listener.onChange) {
|
package/components/page/index.js
CHANGED
|
@@ -36,6 +36,7 @@ import clsx from "clsx";
|
|
|
36
36
|
import Container from "@mui/material/Container";
|
|
37
37
|
import React from "react";
|
|
38
38
|
import { removeInvalidAttributes } from "../../utils/attr";
|
|
39
|
+
import { PageLayoutContext } from "./page-context";
|
|
39
40
|
import { getCurrentPath } from "../../core/util/utils";
|
|
40
41
|
const getDefaultClass = (pageName) => clsx("app-page", pageName ? `app-page-${pageName.toLowerCase()}` : "", "container");
|
|
41
42
|
function WmPage(props) {
|
|
@@ -48,9 +49,13 @@ function WmPage(props) {
|
|
|
48
49
|
height: window.innerHeight
|
|
49
50
|
}));
|
|
50
51
|
const [hasFullNavHeight, setHasFullNavHeight] = useState(false);
|
|
52
|
+
const [leftPanelPageClasses, setLeftPanelPageClasses] = useState();
|
|
51
53
|
const handleNavHeightChange = useCallback((isFull) => {
|
|
52
54
|
setHasFullNavHeight(isFull);
|
|
53
55
|
}, []);
|
|
56
|
+
const handleLeftPanelPageClassesChange = useCallback((pageClasses) => {
|
|
57
|
+
setLeftPanelPageClasses(pageClasses);
|
|
58
|
+
}, []);
|
|
54
59
|
const handleResize = useCallback(() => {
|
|
55
60
|
const newSize = {
|
|
56
61
|
width: window.innerWidth,
|
|
@@ -118,12 +123,23 @@ function WmPage(props) {
|
|
|
118
123
|
});
|
|
119
124
|
}, [children, handleNavHeightChange]);
|
|
120
125
|
return /* @__PURE__ */ jsx(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
126
|
+
PageLayoutContext.Provider,
|
|
127
|
+
{
|
|
128
|
+
value: { onLeftPanelPageClassesChange: handleLeftPanelPageClassesChange },
|
|
129
|
+
children: /* @__PURE__ */ jsx(
|
|
130
|
+
Container,
|
|
131
|
+
__spreadProps(__spreadValues({}, removeInvalidAttributes(restProps)), {
|
|
132
|
+
className: clsx(
|
|
133
|
+
getDefaultClass(pageName),
|
|
134
|
+
{ "app-nav-full": hasFullNavHeight },
|
|
135
|
+
leftPanelPageClasses,
|
|
136
|
+
className
|
|
137
|
+
),
|
|
138
|
+
sx: __spreadValues({}, styles),
|
|
139
|
+
children: childrenWithCallback
|
|
140
|
+
})
|
|
141
|
+
)
|
|
142
|
+
}
|
|
127
143
|
);
|
|
128
144
|
}
|
|
129
145
|
WmPage.displayName = "WmPage";
|
|
@@ -44,13 +44,10 @@ const MEMO_KEYS = [
|
|
|
44
44
|
"params"
|
|
45
45
|
];
|
|
46
46
|
const arePropsEqual = (prevProps, nextProps) => {
|
|
47
|
-
|
|
47
|
+
return MEMO_KEYS.every((key) => {
|
|
48
48
|
if (key === "styles") return isEqual(prevProps[key], nextProps[key]);
|
|
49
49
|
return prevProps[key] === nextProps[key];
|
|
50
50
|
});
|
|
51
|
-
if (!staticEqual) return false;
|
|
52
|
-
const paramNames = nextProps.params || [];
|
|
53
|
-
return paramNames.every((p) => prevProps[p] === nextProps[p]);
|
|
54
51
|
};
|
|
55
52
|
const CodegenPartialContainer = memo((props) => {
|
|
56
53
|
const { prefab, content, prefabName, onLoad } = props;
|
package/context/AppContext.d.ts
CHANGED
|
@@ -6,4 +6,6 @@ interface AppProviderProps {
|
|
|
6
6
|
declare const AppContext: import("react").Context<AppProviderProps>;
|
|
7
7
|
export declare const useAppContext: () => BaseAppProps;
|
|
8
8
|
export declare const useAppProxy: () => any;
|
|
9
|
+
export declare const useAppNotificationAction: () => any;
|
|
10
|
+
export declare const useNotifyApp: () => any;
|
|
9
11
|
export default AppContext;
|
package/context/AppContext.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createContext, useContext } from "react";
|
|
2
|
+
import get from "lodash-es/get";
|
|
2
3
|
const AppContext = createContext(void 0);
|
|
3
4
|
const useAppContext = () => {
|
|
4
5
|
var _a;
|
|
@@ -16,9 +17,27 @@ const useAppProxy = () => {
|
|
|
16
17
|
}
|
|
17
18
|
return context;
|
|
18
19
|
};
|
|
20
|
+
const useAppNotificationAction = () => {
|
|
21
|
+
var _a;
|
|
22
|
+
const context = (_a = useContext(AppContext)) == null ? void 0 : _a.proxy;
|
|
23
|
+
if (context === void 0) {
|
|
24
|
+
throw new Error("useNotificationAction must be used within an AppProvider");
|
|
25
|
+
}
|
|
26
|
+
return get(context, "Actions.appNotification", null);
|
|
27
|
+
};
|
|
28
|
+
const useNotifyApp = () => {
|
|
29
|
+
var _a;
|
|
30
|
+
const context = (_a = useContext(AppContext)) == null ? void 0 : _a.proxy;
|
|
31
|
+
if (context === void 0) {
|
|
32
|
+
throw new Error("useNotifyApp must be used within an AppProvider");
|
|
33
|
+
}
|
|
34
|
+
return context.notifyApp;
|
|
35
|
+
};
|
|
19
36
|
var AppContext_default = AppContext;
|
|
20
37
|
export {
|
|
21
38
|
AppContext_default as default,
|
|
22
39
|
useAppContext,
|
|
23
|
-
|
|
40
|
+
useAppNotificationAction,
|
|
41
|
+
useAppProxy,
|
|
42
|
+
useNotifyApp
|
|
24
43
|
};
|
|
@@ -32,7 +32,6 @@ import get from "lodash-es/get";
|
|
|
32
32
|
import debounce from "lodash-es/debounce";
|
|
33
33
|
import { useDebounceCallback } from "../hooks/useDebounce";
|
|
34
34
|
import { HttpProvider } from "../hooks/useHttp";
|
|
35
|
-
import { registerFormField, registerFormFieldSafe } from "../utils/form-state.util";
|
|
36
35
|
import { removeWidgetsFromContext } from "../utils/widget-cleanup-util";
|
|
37
36
|
import { EVENTEMITTER_METHODS } from "../core/constants/events";
|
|
38
37
|
import { createWidgetProxy } from "../core/proxy-service";
|
|
@@ -100,7 +99,6 @@ const WidgetProvider = ({
|
|
|
100
99
|
setPageContext,
|
|
101
100
|
registry
|
|
102
101
|
);
|
|
103
|
-
registerFormField(newContext.Widgets, widgetProxy, incomingWidget, newContext);
|
|
104
102
|
registerMethod(newContext, widgetProxy, widgetName);
|
|
105
103
|
}
|
|
106
104
|
});
|
|
@@ -159,7 +157,6 @@ const WidgetProvider = ({
|
|
|
159
157
|
pageContext.App.Widgets[widgetName] = props;
|
|
160
158
|
}
|
|
161
159
|
}
|
|
162
|
-
registerFormFieldSafe(pageContext.Widgets, props);
|
|
163
160
|
};
|
|
164
161
|
}, [isAppWidgetRegisterNeeded]);
|
|
165
162
|
const debouncedEmitRef = useRef(
|
package/core/proxy-service.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { PageContextState, ProxyTarget } from "@wavemaker-ai/react-runtime/types";
|
|
2
2
|
import { OverriddenPropsRegistry } from "@wavemaker-ai/react-runtime/core/script-registry";
|
|
3
3
|
import BaseAppProps from "../higherOrder/BaseAppProps";
|
|
4
|
+
import { FormFieldProps } from "../components/data/form/form-field/props";
|
|
4
5
|
export declare const createWidgetProxy: (widget: any, widgetName: string, setPageContext: any, overriddenPropsRegistry?: OverriddenPropsRegistry) => any;
|
|
5
6
|
export declare const createPageProxy: (target: ProxyTarget, setPageContext: React.Dispatch<React.SetStateAction<PageContextState>>, overriddenPropsRegistry?: OverriddenPropsRegistry) => ProxyTarget;
|
|
6
7
|
export declare const createStateProxy: (obj: PageContextState | BaseAppProps, path: string[], setPageContext: React.Dispatch<React.SetStateAction<PageContextState>> | React.Dispatch<React.SetStateAction<BaseAppProps>>, overriddenPropsRegistry?: OverriddenPropsRegistry) => ProxyTarget;
|
|
8
|
+
export declare const createFormFieldProxy: (formField: FormFieldProps, setState: React.Dispatch<React.SetStateAction<FormFieldProps>>, overriddenItemsRef: React.MutableRefObject<Record<string, any>>, formProxy: any) => any;
|
package/core/proxy-service.js
CHANGED
|
@@ -500,7 +500,32 @@ const createStateProxy = (obj, path = [], setPageContext, overriddenPropsRegistr
|
|
|
500
500
|
}
|
|
501
501
|
});
|
|
502
502
|
};
|
|
503
|
+
const createFormFieldProxy = (formField, setState, overriddenItemsRef, formProxy) => {
|
|
504
|
+
const fieldProxy = new Proxy(formField, {
|
|
505
|
+
get: (target, prop) => {
|
|
506
|
+
return target[prop];
|
|
507
|
+
},
|
|
508
|
+
set: (target, prop, value) => {
|
|
509
|
+
target[prop] = value;
|
|
510
|
+
overriddenItemsRef.current[prop] = value;
|
|
511
|
+
setState(__spreadValues({}, target));
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
});
|
|
515
|
+
const name = formField.name;
|
|
516
|
+
const key = formField.formKey;
|
|
517
|
+
if (key) {
|
|
518
|
+
formProxy.formfields[key] = fieldProxy;
|
|
519
|
+
formProxy.formWidgets[key] = fieldProxy;
|
|
520
|
+
}
|
|
521
|
+
formProxy.formfields[`${name}_formWidget`] = fieldProxy;
|
|
522
|
+
formProxy.formWidgets[`${name}_formWidget`] = fieldProxy;
|
|
523
|
+
formProxy.formfields[`${name}`] = fieldProxy;
|
|
524
|
+
formProxy.formWidgets[`${name}`] = fieldProxy;
|
|
525
|
+
return fieldProxy;
|
|
526
|
+
};
|
|
503
527
|
export {
|
|
528
|
+
createFormFieldProxy,
|
|
504
529
|
createPageProxy,
|
|
505
530
|
createStateProxy,
|
|
506
531
|
createWidgetProxy
|
package/higherOrder/BaseApp.js
CHANGED
|
@@ -44,6 +44,7 @@ import { metadataService } from "../variables/metadata.service";
|
|
|
44
44
|
import { i18nService as i18nServiceActions } from "../store/bindActions/i18nActions";
|
|
45
45
|
import { WmContainer } from "../components/container";
|
|
46
46
|
import WmPartialContainer from "../components/page/partial-container";
|
|
47
|
+
import RoleAuthGuard from "../components/auth/RoleAuthGuard";
|
|
47
48
|
(_a = global.wm) != null ? _a : global.wm = {};
|
|
48
49
|
const BaseApp = (WrappedComponent, addAppScript, getAppVariables, appInfo = {}) => {
|
|
49
50
|
const AppContextComponent = (props) => {
|
|
@@ -340,7 +341,7 @@ const BaseApp = (WrappedComponent, addAppScript, getAppVariables, appInfo = {})
|
|
|
340
341
|
);
|
|
341
342
|
}
|
|
342
343
|
function notifyApp(message, type, showTypeLabel) {
|
|
343
|
-
const notificationAction = get(
|
|
344
|
+
const notificationAction = get(appProxyRef.current, "Actions.appNotification");
|
|
344
345
|
if (notificationAction) {
|
|
345
346
|
const appNotification = notificationAction.config.paramProvider();
|
|
346
347
|
const newParams = () => ({
|
|
@@ -372,9 +373,6 @@ const BaseApp = (WrappedComponent, addAppScript, getAppVariables, appInfo = {})
|
|
|
372
373
|
renderPartial: (props2, onLoad) => /* @__PURE__ */ jsx(
|
|
373
374
|
WmPartialContainer,
|
|
374
375
|
{
|
|
375
|
-
onRender: (commonComponent) => {
|
|
376
|
-
appProxyRef.current.Common = commonComponent;
|
|
377
|
-
},
|
|
378
376
|
onLoad,
|
|
379
377
|
"data-widget-id": "common-partial-container",
|
|
380
378
|
content: props2.content,
|
|
@@ -412,6 +410,7 @@ const BaseApp = (WrappedComponent, addAppScript, getAppVariables, appInfo = {})
|
|
|
412
410
|
wmSetDependency("metadata", metadataService);
|
|
413
411
|
wmSetDependency("appManager", {
|
|
414
412
|
notify,
|
|
413
|
+
notifyApp,
|
|
415
414
|
pushToSessionFailureRequests,
|
|
416
415
|
executeSessionFailureRequests,
|
|
417
416
|
handle401
|
|
@@ -424,10 +423,10 @@ const BaseApp = (WrappedComponent, addAppScript, getAppVariables, appInfo = {})
|
|
|
424
423
|
state: appContext,
|
|
425
424
|
proxy: appProxyRef.current
|
|
426
425
|
},
|
|
427
|
-
children: /* @__PURE__ */ jsx(AppSpinnerProvider, { children: /* @__PURE__ */
|
|
426
|
+
children: /* @__PURE__ */ jsx(AppSpinnerProvider, { children: /* @__PURE__ */ jsx(LayoutProvider, { children: /* @__PURE__ */ jsxs(RoleAuthGuard, { children: [
|
|
428
427
|
/* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props)),
|
|
429
428
|
renderCommonComponents()
|
|
430
|
-
] }) })
|
|
429
|
+
] }) }) })
|
|
431
430
|
}
|
|
432
431
|
);
|
|
433
432
|
};
|
package/higherOrder/BasePage.js
CHANGED
|
@@ -224,22 +224,12 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
224
224
|
securityConfig
|
|
225
225
|
]);
|
|
226
226
|
const shouldInitialize = useMemo(() => {
|
|
227
|
-
var _a2, _b2;
|
|
228
227
|
if (appContext && !appContext.isAppReady) {
|
|
229
228
|
return false;
|
|
230
229
|
}
|
|
231
230
|
if (accessLoading) {
|
|
232
231
|
return false;
|
|
233
232
|
}
|
|
234
|
-
if (!hasAccess && isSecurityEnabled) {
|
|
235
|
-
if (isAuthenticated) {
|
|
236
|
-
appContext == null ? void 0 : appContext.notifyApp(
|
|
237
|
-
((_b2 = (_a2 = pageContext == null ? void 0 : pageContext.appLocale) == null ? void 0 : _a2.LABELS) == null ? void 0 : _b2.ACCESS_DENIED) || "Access Denied",
|
|
238
|
-
"Error"
|
|
239
|
-
);
|
|
240
|
-
}
|
|
241
|
-
return false;
|
|
242
|
-
}
|
|
243
233
|
return true;
|
|
244
234
|
}, [appContext == null ? void 0 : appContext.isAppReady, accessLoading, hasAccess, isSecurityEnabled, isAuthenticated]);
|
|
245
235
|
useEffect(() => {
|
|
@@ -319,9 +309,11 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
319
309
|
appProxy.updateActivePage(pageName2);
|
|
320
310
|
appProxy.activePage = pageProxy;
|
|
321
311
|
appProxy.activePageName = pageName2;
|
|
322
|
-
Object.
|
|
312
|
+
Object.setPrototypeOf(appProxy.Widgets, pageProxy.Widgets);
|
|
323
313
|
} else if ((componentInfo == null ? void 0 : componentInfo.componentName) === "Common" && (componentInfo == null ? void 0 : componentInfo.componentType) === "PARTIAL" && appProxy) {
|
|
324
|
-
Object.
|
|
314
|
+
Object.keys(pageProxy.Widgets).forEach((key) => {
|
|
315
|
+
appProxy.Widgets[key] = pageProxy.Widgets[key];
|
|
316
|
+
});
|
|
325
317
|
}
|
|
326
318
|
addPageScript(appProxy, pageProxy);
|
|
327
319
|
wrapWithThirdPartyErrorGuard(
|
package/higherOrder/props.d.ts
CHANGED
|
@@ -67,6 +67,16 @@ export interface Props {
|
|
|
67
67
|
updateon?: string;
|
|
68
68
|
dataset?: any;
|
|
69
69
|
prefabName?: string;
|
|
70
|
+
/**
|
|
71
|
+
* When true, indicates that the widget's data is being loaded.
|
|
72
|
+
* Used together with `showSkeleton` to display a skeleton placeholder.
|
|
73
|
+
*/
|
|
74
|
+
loading?: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Optional runtime opt-out for skeleton display while loading.
|
|
77
|
+
* Not emitted by codegen — omit (default) to show skeleton when `loading` is true.
|
|
78
|
+
*/
|
|
79
|
+
showSkeleton?: boolean;
|
|
70
80
|
}
|
|
71
81
|
/**
|
|
72
82
|
* Interface for props injected by the BaseDialog (withDialogWrapper) HOC.
|