@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
|
@@ -20,6 +20,7 @@ import { merge } from "lodash-es";
|
|
|
20
20
|
import { getRouterInstance } from "../store/middleware/navigationMiddleware";
|
|
21
21
|
import { PREVIEW_ROUTING_BASEPATH, getActiveRoutingBasePath } from "../core/constants";
|
|
22
22
|
import { store } from "../store";
|
|
23
|
+
import { checkAccess } from "../store/slices/authSlice";
|
|
23
24
|
import {
|
|
24
25
|
setPendingAccordionExpansion,
|
|
25
26
|
setPendingTabSelection
|
|
@@ -57,19 +58,19 @@ class NavigationAction extends BaseAction {
|
|
|
57
58
|
}
|
|
58
59
|
params = (params == null ? void 0 : params.data) ? merge(this.config.paramProvider(), this.dataBinding, params == null ? void 0 : params.data) : merge(this.config.paramProvider(), this.dataBinding, this.dataSet);
|
|
59
60
|
this.notify(VariableEvents.BEFORE_INVOKE, [this, this.dataSet]);
|
|
60
|
-
return super.invoke(params, onSuccess, onError).then(() => {
|
|
61
|
+
return super.invoke(params, onSuccess, onError).then(async () => {
|
|
61
62
|
switch (config.operation) {
|
|
62
63
|
case "goToPreviousPage":
|
|
63
64
|
this.handleGoToPreviousPage();
|
|
64
65
|
break;
|
|
65
66
|
case "gotoTab":
|
|
66
|
-
this.handleGotoTab(params || {});
|
|
67
|
+
await this.handleGotoTab(params || {});
|
|
67
68
|
break;
|
|
68
69
|
case "gotoAccordion":
|
|
69
|
-
this.handleGotoAccordion(params || {});
|
|
70
|
+
await this.handleGotoAccordion(params || {});
|
|
70
71
|
break;
|
|
71
72
|
case "gotoPage":
|
|
72
|
-
this.handleGotoPage(params || {});
|
|
73
|
+
await this.handleGotoPage(params || {});
|
|
73
74
|
}
|
|
74
75
|
}).then(
|
|
75
76
|
() => {
|
|
@@ -108,7 +109,7 @@ class NavigationAction extends BaseAction {
|
|
|
108
109
|
}
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
|
-
handleGotoTab(params) {
|
|
112
|
+
async handleGotoTab(params) {
|
|
112
113
|
const tabName = params == null ? void 0 : params.tabName;
|
|
113
114
|
const pageName = params == null ? void 0 : params.pageName;
|
|
114
115
|
if (!tabName) {
|
|
@@ -122,7 +123,7 @@ class NavigationAction extends BaseAction {
|
|
|
122
123
|
}
|
|
123
124
|
if (pageName) {
|
|
124
125
|
store.dispatch(setPendingTabSelection(tabName));
|
|
125
|
-
this.handleGotoPage(params);
|
|
126
|
+
await this.handleGotoPage(params);
|
|
126
127
|
return;
|
|
127
128
|
}
|
|
128
129
|
console.warn(
|
|
@@ -137,7 +138,7 @@ class NavigationAction extends BaseAction {
|
|
|
137
138
|
}
|
|
138
139
|
return null;
|
|
139
140
|
}
|
|
140
|
-
handleGotoAccordion(params) {
|
|
141
|
+
async handleGotoAccordion(params) {
|
|
141
142
|
var _a, _b, _c, _d;
|
|
142
143
|
const accordionName = params == null ? void 0 : params.accordionName;
|
|
143
144
|
const pageName = params == null ? void 0 : params.pageName;
|
|
@@ -145,7 +146,7 @@ class NavigationAction extends BaseAction {
|
|
|
145
146
|
(_d = (_c = this.config._context) == null ? void 0 : _c.Widgets[accordionName]) == null ? void 0 : _d.expand();
|
|
146
147
|
} else if (pageName && accordionName) {
|
|
147
148
|
store.dispatch(setPendingAccordionExpansion(accordionName));
|
|
148
|
-
this.handleGotoPage(params);
|
|
149
|
+
await this.handleGotoPage(params);
|
|
149
150
|
} else {
|
|
150
151
|
console.warn(`Unable to expand accordion: ${accordionName}`);
|
|
151
152
|
}
|
|
@@ -253,10 +254,34 @@ class NavigationAction extends BaseAction {
|
|
|
253
254
|
}
|
|
254
255
|
return true;
|
|
255
256
|
}
|
|
256
|
-
|
|
257
|
+
notifyAccessDenied() {
|
|
258
|
+
var _a, _b, _c, _d;
|
|
259
|
+
const state = store.getState();
|
|
260
|
+
const isAuthenticated = (_b = (_a = state.auth) == null ? void 0 : _a.loggedInUser) == null ? void 0 : _b.isAuthenticated;
|
|
261
|
+
if (!isAuthenticated) {
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
const context = this.config._context;
|
|
265
|
+
const message = ((_d = (_c = context == null ? void 0 : context.appLocale) == null ? void 0 : _c.LABELS) == null ? void 0 : _d.ACCESS_DENIED) || "Access Denied";
|
|
266
|
+
const notifyApp = context == null ? void 0 : context.notifyApp;
|
|
267
|
+
notifyApp == null ? void 0 : notifyApp(message, "Error");
|
|
268
|
+
}
|
|
269
|
+
async handleGotoPage(params) {
|
|
257
270
|
const router = getRouterInstance();
|
|
258
271
|
const pageName = params == null ? void 0 : params.pageName;
|
|
259
272
|
if (pageName) {
|
|
273
|
+
try {
|
|
274
|
+
const hasAccess = await store.dispatch(checkAccess({ name: pageName, type: "PAGE" })).unwrap();
|
|
275
|
+
if (!hasAccess) {
|
|
276
|
+
clearPageNavigationPending();
|
|
277
|
+
this.notifyAccessDenied();
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
} catch (e) {
|
|
281
|
+
clearPageNavigationPending();
|
|
282
|
+
this.notifyAccessDenied();
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
260
285
|
const currentPageInfo = this.getCurrentPageInfo();
|
|
261
286
|
if (currentPageInfo) {
|
|
262
287
|
this.rememberPageQueryParams(currentPageInfo.pageName, currentPageInfo.queryParams);
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { usePathname } from "next/navigation";
|
|
5
|
+
import { useAppSelector } from "../../store";
|
|
6
|
+
import { useAuth } from "../../hooks/useAuth";
|
|
7
|
+
import { getActiveRoutingBasePath } from "../../core/constants";
|
|
8
|
+
import { useAppContext } from "../../context/AppContext";
|
|
9
|
+
function getPageNameFromPathname(pathname) {
|
|
10
|
+
const segments = pathname.split("/").filter(Boolean);
|
|
11
|
+
const routingBase = getActiveRoutingBasePath();
|
|
12
|
+
const baseIndex = segments.indexOf(routingBase);
|
|
13
|
+
if (baseIndex >= 0) {
|
|
14
|
+
return segments[baseIndex + 1] || "Main";
|
|
15
|
+
}
|
|
16
|
+
return segments[segments.length - 1] || "Main";
|
|
17
|
+
}
|
|
18
|
+
function RoleAuthGuard({ children }) {
|
|
19
|
+
const pathname = usePathname();
|
|
20
|
+
const { loggedInUser } = useAuth();
|
|
21
|
+
const isSecurityEnabled = useAppSelector(
|
|
22
|
+
(state) => {
|
|
23
|
+
var _a;
|
|
24
|
+
return (_a = state.auth.securityConfig) == null ? void 0 : _a.isSecurityEnabled;
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
const pages = useAppSelector((state) => {
|
|
28
|
+
var _a, _b;
|
|
29
|
+
return ((_b = (_a = state.info) == null ? void 0 : _a.appConfig) == null ? void 0 : _b.pages) || [];
|
|
30
|
+
});
|
|
31
|
+
const i18n = useAppSelector((state) => state.i18n);
|
|
32
|
+
const appContext = useAppContext();
|
|
33
|
+
const [hasAccess, setHasAccess] = useState(false);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
var _a, _b, _c;
|
|
36
|
+
if (isSecurityEnabled === void 0) {
|
|
37
|
+
setHasAccess(true);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (!isSecurityEnabled) {
|
|
41
|
+
setHasAccess(true);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const pageName = getPageNameFromPathname(pathname || "");
|
|
45
|
+
const userRoles = (loggedInUser == null ? void 0 : loggedInUser.roles) || [];
|
|
46
|
+
const allowedRoles = ((_a = pages.find((page) => page.name === pageName)) == null ? void 0 : _a.allowedRoles) || [];
|
|
47
|
+
if (allowedRoles.length === 0) {
|
|
48
|
+
setHasAccess(true);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
const pageAccess = userRoles.some((role) => allowedRoles.includes(role));
|
|
52
|
+
if (!pageAccess) {
|
|
53
|
+
appContext.notifyApp(((_c = (_b = i18n == null ? void 0 : i18n.appLocale) == null ? void 0 : _b.LABELS) == null ? void 0 : _c.ACCESS_DENIED) || "Access Denied", "Error");
|
|
54
|
+
setHasAccess(false);
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
setHasAccess(true);
|
|
58
|
+
}, [pathname, pages, isSecurityEnabled, loggedInUser == null ? void 0 : loggedInUser.roles, appContext.notifyApp]);
|
|
59
|
+
if (!hasAccess) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
63
|
+
}
|
|
64
|
+
export {
|
|
65
|
+
RoleAuthGuard as default
|
|
66
|
+
};
|
|
@@ -227,7 +227,7 @@ const WmAnchor = (props) => {
|
|
|
227
227
|
),
|
|
228
228
|
iconclass && /* @__PURE__ */ jsx("i", { className: clsx("app-icon", "wm-anchor-icon-media", iconclass), "aria-hidden": "true" }),
|
|
229
229
|
caption && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
230
|
-
/* @__PURE__ */ jsx(Box, { component: "span", className: "sr-only", children: `${caption} ${(_b = listener == null ? void 0 : listener.appLocale) == null ? void 0 : _b.LABEL_ICON}` }),
|
|
230
|
+
iconclass && /* @__PURE__ */ jsx(Box, { component: "span", className: "sr-only", children: `${caption} ${(_b = listener == null ? void 0 : listener.appLocale) == null ? void 0 : _b.LABEL_ICON}` }),
|
|
231
231
|
/* @__PURE__ */ jsx(Box, { component: "span", className: "anchor-caption", children: caption })
|
|
232
232
|
] }),
|
|
233
233
|
badgevalue && /* @__PURE__ */ jsx(
|
|
@@ -36,6 +36,11 @@ import DOMPurify from "dompurify";
|
|
|
36
36
|
import Box from "@mui/material/Box";
|
|
37
37
|
import { withBaseWrapper } from "../../../higherOrder/withBaseWrapper";
|
|
38
38
|
import { removeInvalidAttributes } from "../../../utils/attr";
|
|
39
|
+
import {
|
|
40
|
+
WmSkeleton,
|
|
41
|
+
SKELETON_REGISTRY,
|
|
42
|
+
shouldShowSkeleton
|
|
43
|
+
} from "../../common/wm-skeleton";
|
|
39
44
|
const DEFAULT_CLASS = "app-label";
|
|
40
45
|
const containsHTML = (text) => {
|
|
41
46
|
return /<[^>]*>/g.test(text);
|
|
@@ -71,7 +76,9 @@ const WmLabel = memo(
|
|
|
71
76
|
onClick,
|
|
72
77
|
listener,
|
|
73
78
|
variant = "default:p",
|
|
74
|
-
viewParent
|
|
79
|
+
viewParent,
|
|
80
|
+
loading,
|
|
81
|
+
showSkeleton
|
|
75
82
|
} = _a, rest = __objRest(_a, [
|
|
76
83
|
"required",
|
|
77
84
|
"trustAs",
|
|
@@ -85,8 +92,13 @@ const WmLabel = memo(
|
|
|
85
92
|
"onClick",
|
|
86
93
|
"listener",
|
|
87
94
|
"variant",
|
|
88
|
-
"viewParent"
|
|
95
|
+
"viewParent",
|
|
96
|
+
"loading",
|
|
97
|
+
"showSkeleton"
|
|
89
98
|
]);
|
|
99
|
+
if (shouldShowSkeleton(loading, showSkeleton)) {
|
|
100
|
+
return /* @__PURE__ */ jsx(WmSkeleton, __spreadProps(__spreadValues({}, SKELETON_REGISTRY["WmLabel"]), { className, styles }));
|
|
101
|
+
}
|
|
90
102
|
const hasCaptionProp = Object.prototype.hasOwnProperty.call(props, "caption");
|
|
91
103
|
const safeCaption = hasCaptionProp ? caption : "Label";
|
|
92
104
|
const captionString = (_c = typeof safeCaption === "string" ? safeCaption : (_b = JSON.stringify(safeCaption)) != null ? _b : "") == null ? void 0 : _c.replace(/ |undefined|null/gi, " ");
|
|
@@ -154,7 +166,9 @@ const WmLabel = memo(
|
|
|
154
166
|
"styles",
|
|
155
167
|
"className",
|
|
156
168
|
"hint",
|
|
157
|
-
"hidden"
|
|
169
|
+
"hidden",
|
|
170
|
+
"loading",
|
|
171
|
+
"showSkeleton"
|
|
158
172
|
];
|
|
159
173
|
return keys.every((key) => prev[key] === current[key]);
|
|
160
174
|
}
|
|
@@ -33,6 +33,11 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
33
33
|
import { memo, useEffect, useState } from "react";
|
|
34
34
|
import clsx from "clsx";
|
|
35
35
|
import { withBaseWrapper } from "../../../higherOrder/withBaseWrapper";
|
|
36
|
+
import {
|
|
37
|
+
WmSkeleton,
|
|
38
|
+
SKELETON_REGISTRY,
|
|
39
|
+
shouldShowSkeleton
|
|
40
|
+
} from "../../common/wm-skeleton";
|
|
36
41
|
import { prefixPrefabResourceUrl } from "../../../utils/resource-url";
|
|
37
42
|
import { removeInvalidAttributes } from "../../../utils/attr";
|
|
38
43
|
const DEFAULT_CLASS = "app-picture";
|
|
@@ -118,6 +123,14 @@ const WmPicture = memo(
|
|
|
118
123
|
const onMouseLeaveHandler = (event) => {
|
|
119
124
|
onMouseLeave && onMouseLeave(event, props);
|
|
120
125
|
};
|
|
126
|
+
if (shouldShowSkeleton(props.loading, props.showSkeleton))
|
|
127
|
+
return /* @__PURE__ */ jsx(
|
|
128
|
+
WmSkeleton,
|
|
129
|
+
__spreadProps(__spreadValues({}, SKELETON_REGISTRY["WmPicture"]), {
|
|
130
|
+
className: props.className,
|
|
131
|
+
styles: props.styles
|
|
132
|
+
})
|
|
133
|
+
);
|
|
121
134
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
122
135
|
/* @__PURE__ */ jsx(
|
|
123
136
|
"img",
|
|
@@ -148,7 +161,13 @@ const WmPicture = memo(
|
|
|
148
161
|
] });
|
|
149
162
|
},
|
|
150
163
|
(prev, current) => {
|
|
151
|
-
const keysToCompare = [
|
|
164
|
+
const keysToCompare = [
|
|
165
|
+
"picturesource",
|
|
166
|
+
"imgSource",
|
|
167
|
+
"show",
|
|
168
|
+
"loading",
|
|
169
|
+
"showSkeleton"
|
|
170
|
+
];
|
|
152
171
|
return keysToCompare.every((key) => prev[key] === current[key]);
|
|
153
172
|
}
|
|
154
173
|
);
|
|
@@ -65,11 +65,12 @@ const WmProgressCircle = (props) => {
|
|
|
65
65
|
};
|
|
66
66
|
}, [datavalue, minvalue, maxvalue, type, displayformat, props.strokeWidth, props.radius]);
|
|
67
67
|
useEffect(() => {
|
|
68
|
+
var _a;
|
|
68
69
|
if (listener && name) {
|
|
69
70
|
listener.onChange(name, {
|
|
70
71
|
percentagevalue: percentageValue
|
|
71
72
|
});
|
|
72
|
-
onBeforerender == null ? void 0 : onBeforerender(listener, listener == null ? void 0 : listener.Widgets[name]);
|
|
73
|
+
onBeforerender == null ? void 0 : onBeforerender(listener, (_a = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a[name]);
|
|
73
74
|
}
|
|
74
75
|
}, [percentageValue]);
|
|
75
76
|
useEffect(() => {
|
|
@@ -57,6 +57,8 @@ declare const WmRichTextEditorStandalone: React.ComponentType<import("../../data
|
|
|
57
57
|
updateon?: string;
|
|
58
58
|
dataset?: any;
|
|
59
59
|
prefabName?: string;
|
|
60
|
+
loading?: boolean;
|
|
61
|
+
showSkeleton?: boolean;
|
|
60
62
|
} & import("@wavemaker-ai/react-runtime/higherOrder/withStandalone").WithStandaloneProps>;
|
|
61
63
|
export { WmRichTextEditorStandalone as WmRichtexteditor };
|
|
62
64
|
/**
|
|
@@ -139,5 +141,7 @@ declare const _default: React.ComponentType<{
|
|
|
139
141
|
updateon?: string;
|
|
140
142
|
dataset?: any;
|
|
141
143
|
prefabName?: string;
|
|
144
|
+
loading?: boolean;
|
|
145
|
+
showSkeleton?: boolean;
|
|
142
146
|
}>;
|
|
143
147
|
export default _default;
|
|
@@ -50,6 +50,7 @@ const EditorPlaceholder = ({
|
|
|
50
50
|
}
|
|
51
51
|
);
|
|
52
52
|
const WmRichTextEditorBase = (props) => {
|
|
53
|
+
var _a;
|
|
53
54
|
const {
|
|
54
55
|
name,
|
|
55
56
|
className,
|
|
@@ -88,7 +89,7 @@ const WmRichTextEditorBase = (props) => {
|
|
|
88
89
|
const lastValueRef = useRef(actualValue || "");
|
|
89
90
|
const isMountedRef = useRef(true);
|
|
90
91
|
const internalValueRef = useRef(actualValue || "");
|
|
91
|
-
const widgetInstance = listener == null ? void 0 : listener.Widgets[name || ""];
|
|
92
|
+
const widgetInstance = (_a = listener == null ? void 0 : listener.Widgets) == null ? void 0 : _a[name || ""];
|
|
92
93
|
const editorOptions = useMemo(
|
|
93
94
|
() => ({
|
|
94
95
|
toolbar: true,
|
|
@@ -165,7 +166,7 @@ const WmRichTextEditorBase = (props) => {
|
|
|
165
166
|
}, []);
|
|
166
167
|
const handleEditorChange = useCallback(
|
|
167
168
|
(newContent, isFromUser = true) => {
|
|
168
|
-
var
|
|
169
|
+
var _a2, _b;
|
|
169
170
|
if (!isMountedRef.current || isInternalChange) {
|
|
170
171
|
return;
|
|
171
172
|
}
|
|
@@ -184,7 +185,7 @@ const WmRichTextEditorBase = (props) => {
|
|
|
184
185
|
value: sanitizedContent,
|
|
185
186
|
name
|
|
186
187
|
},
|
|
187
|
-
currentTarget: (_b = (
|
|
188
|
+
currentTarget: (_b = (_a2 = editorRef.current) == null ? void 0 : _a2.editor) == null ? void 0 : _b.workplace
|
|
188
189
|
};
|
|
189
190
|
onChange(syntheticEvent, widgetInstance, newContent, sanitizedContent);
|
|
190
191
|
}
|
|
@@ -204,8 +205,8 @@ const WmRichTextEditorBase = (props) => {
|
|
|
204
205
|
);
|
|
205
206
|
const performEditorOperation = useCallback(
|
|
206
207
|
(operation, value) => {
|
|
207
|
-
var
|
|
208
|
-
if (!isEditorLoaded || !((
|
|
208
|
+
var _a2;
|
|
209
|
+
if (!isEditorLoaded || !((_a2 = editorRef.current) == null ? void 0 : _a2.editor)) {
|
|
209
210
|
setOperationStack((prev) => [...prev, { type: operation, value }]);
|
|
210
211
|
return;
|
|
211
212
|
}
|
|
@@ -270,13 +271,13 @@ const WmRichTextEditorBase = (props) => {
|
|
|
270
271
|
[isEditorLoaded, sanitizeHtml]
|
|
271
272
|
);
|
|
272
273
|
useEffect(() => {
|
|
273
|
-
var
|
|
274
|
+
var _a2, _b;
|
|
274
275
|
if (onBeforerender) {
|
|
275
276
|
const syntheticEvent = {
|
|
276
277
|
target: {
|
|
277
278
|
value: ""
|
|
278
279
|
},
|
|
279
|
-
currentTarget: (_b = (
|
|
280
|
+
currentTarget: (_b = (_a2 = editorRef.current) == null ? void 0 : _a2.editor) == null ? void 0 : _b.workplace
|
|
280
281
|
};
|
|
281
282
|
onBeforerender(syntheticEvent, widgetInstance);
|
|
282
283
|
}
|
|
@@ -284,7 +285,7 @@ const WmRichTextEditorBase = (props) => {
|
|
|
284
285
|
const debouncedHandleOnChange = useMemo(
|
|
285
286
|
() => lodash.debounce(
|
|
286
287
|
(newContent) => {
|
|
287
|
-
var
|
|
288
|
+
var _a2, _b;
|
|
288
289
|
const sanitizedContent = sanitizeHtml(newContent);
|
|
289
290
|
const tempDiv = document.createElement("div");
|
|
290
291
|
tempDiv.innerHTML = newContent;
|
|
@@ -302,7 +303,7 @@ const WmRichTextEditorBase = (props) => {
|
|
|
302
303
|
value: new_text_content,
|
|
303
304
|
name
|
|
304
305
|
},
|
|
305
|
-
currentTarget: (_b = (
|
|
306
|
+
currentTarget: (_b = (_a2 = editorRef.current) == null ? void 0 : _a2.editor) == null ? void 0 : _b.workplace
|
|
306
307
|
};
|
|
307
308
|
onChange(syntheticEvent, widgetInstance, new_text_content, old_text_context);
|
|
308
309
|
}
|
|
@@ -325,9 +326,9 @@ const WmRichTextEditorBase = (props) => {
|
|
|
325
326
|
};
|
|
326
327
|
}, [debouncedHandleOnChange]);
|
|
327
328
|
const handleEditorInit = useCallback(() => {
|
|
328
|
-
var
|
|
329
|
+
var _a2;
|
|
329
330
|
setIsEditorLoaded(true);
|
|
330
|
-
if ((
|
|
331
|
+
if ((_a2 = editorRef.current) == null ? void 0 : _a2.editor) {
|
|
331
332
|
if (content !== void 0 && content !== null) {
|
|
332
333
|
editorRef.current.editor.value = content == null ? void 0 : content.toString();
|
|
333
334
|
}
|
|
@@ -483,8 +484,8 @@ const WmRichTextEditorBase = (props) => {
|
|
|
483
484
|
}
|
|
484
485
|
}, [datavalue]);
|
|
485
486
|
useEffect(() => {
|
|
486
|
-
var
|
|
487
|
-
if (((
|
|
487
|
+
var _a2;
|
|
488
|
+
if (((_a2 = editorRef.current) == null ? void 0 : _a2.editor) && isEditorLoaded) {
|
|
488
489
|
if (readonly || disabled) {
|
|
489
490
|
performEditorOperation("disable");
|
|
490
491
|
} else {
|
|
@@ -505,9 +506,9 @@ const WmRichTextEditorBase = (props) => {
|
|
|
505
506
|
useEffect(() => {
|
|
506
507
|
isMountedRef.current = true;
|
|
507
508
|
return () => {
|
|
508
|
-
var
|
|
509
|
+
var _a2, _b, _c;
|
|
509
510
|
isMountedRef.current = false;
|
|
510
|
-
if ((
|
|
511
|
+
if ((_a2 = editorRef.current) == null ? void 0 : _a2.editor) {
|
|
511
512
|
try {
|
|
512
513
|
(_c = (_b = editorRef == null ? void 0 : editorRef.current) == null ? void 0 : _b.editor) == null ? void 0 : _c.destruct();
|
|
513
514
|
} catch (error) {
|
|
@@ -112,6 +112,8 @@ declare const WmSearchStandalone: React.ComponentType<import("../../data/form/fo
|
|
|
112
112
|
updateon?: string;
|
|
113
113
|
dataset?: any;
|
|
114
114
|
prefabName?: string;
|
|
115
|
+
loading?: boolean;
|
|
116
|
+
showSkeleton?: boolean;
|
|
115
117
|
}, "ref"> & React.RefAttributes<any> & import("@wavemaker-ai/react-runtime/higherOrder/withStandalone").WithStandaloneProps>;
|
|
116
118
|
export { WmSearchStandalone as WmSearch };
|
|
117
119
|
/**
|
|
@@ -174,5 +176,7 @@ declare const _default: React.NamedExoticComponent<import("../../data/form/form-
|
|
|
174
176
|
updateon?: string;
|
|
175
177
|
dataset?: any;
|
|
176
178
|
prefabName?: string;
|
|
179
|
+
loading?: boolean;
|
|
180
|
+
showSkeleton?: boolean;
|
|
177
181
|
}>;
|
|
178
182
|
export default _default;
|
|
@@ -1075,7 +1075,8 @@ const Search = React.forwardRef((props, ref) => {
|
|
|
1075
1075
|
"groupedData",
|
|
1076
1076
|
"handleHeaderClick",
|
|
1077
1077
|
"toggleAllHeaders",
|
|
1078
|
-
"isDestroyed"
|
|
1078
|
+
"isDestroyed",
|
|
1079
|
+
"setTemplate"
|
|
1079
1080
|
];
|
|
1080
1081
|
if (!invalidProps.includes(key)) {
|
|
1081
1082
|
acc[key] = value2;
|
|
@@ -196,7 +196,7 @@ class DataProvider {
|
|
|
196
196
|
init(component) {
|
|
197
197
|
var _a, _b, _c;
|
|
198
198
|
let datasource = component == null ? void 0 : component.datasource;
|
|
199
|
-
if (datasource) {
|
|
199
|
+
if (datasource && datasource.execute) {
|
|
200
200
|
return datasource.execute(DataSource.Operation.IS_PAGEABLE) || ((_c = (_b = (_a = datasource == null ? void 0 : datasource.serviceInfo) == null ? void 0 : _a.parameters) == null ? void 0 : _b.length) != null ? _c : 0) > 0;
|
|
201
201
|
}
|
|
202
202
|
return false;
|
|
@@ -224,7 +224,7 @@ class DataProvider {
|
|
|
224
224
|
}
|
|
225
225
|
return new Promise(async (resolve, reject) => {
|
|
226
226
|
try {
|
|
227
|
-
const result = await dataSource.execute(DataSource.Operation.SEARCH_RECORDS, component);
|
|
227
|
+
const result = await (dataSource == null ? void 0 : dataSource.execute(DataSource.Operation.SEARCH_RECORDS, component));
|
|
228
228
|
resolve((result == null ? void 0 : result.data) || []);
|
|
229
229
|
} catch (err) {
|
|
230
230
|
resolve([]);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { TreeNodeComponentProps } from "../props";
|
|
3
|
-
declare const TreeNodeComponent: React.MemoExoticComponent<({ node, treeicons, isCheckboxTree, isRadioTree, selectedItem, handleNodeClick, toggleNodeExpansion, toggleNodeChecked, handleRadioSelect, depth, treeName, template, listener, }: TreeNodeComponentProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
declare const TreeNodeComponent: React.MemoExoticComponent<({ node, treeicons, isCheckboxTree, isRadioTree, selectedItem, handleNodeClick, toggleNodeExpansion, toggleNodeChecked, handleRadioSelect, depth, treeName, template, listener, urlExpansionOverlay, urlSelectedId, }: TreeNodeComponentProps) => import("react/jsx-runtime").JSX.Element>;
|
|
4
4
|
export default TreeNodeComponent;
|