@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/core/util/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import get from "lodash-es/get";
|
|
2
|
+
import has from "lodash-es/has";
|
|
2
3
|
import { store } from "../../store";
|
|
3
4
|
import { isArray, isObject, isString } from "lodash-es";
|
|
4
5
|
const VALIDATOR = {
|
|
@@ -89,8 +90,37 @@ const getTimezone = () => {
|
|
|
89
90
|
return timezone || "UTC";
|
|
90
91
|
};
|
|
91
92
|
const formatMessage = (fragment, expression) => {
|
|
92
|
-
|
|
93
|
+
const path = `appLocale.${expression}`;
|
|
94
|
+
return has(fragment, path) ? get(fragment, path) : void 0;
|
|
93
95
|
};
|
|
96
|
+
function syncLocaleMessages(target, messages) {
|
|
97
|
+
if (!target || typeof target !== "object") {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
let synced = true;
|
|
101
|
+
Object.keys(target).forEach((key) => {
|
|
102
|
+
if (!(key in messages)) {
|
|
103
|
+
try {
|
|
104
|
+
delete target[key];
|
|
105
|
+
} catch (e) {
|
|
106
|
+
synced = false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
Object.keys(messages).forEach((key) => {
|
|
111
|
+
try {
|
|
112
|
+
const descriptor = Object.getOwnPropertyDescriptor(target, key);
|
|
113
|
+
if (descriptor && !descriptor.configurable && !descriptor.writable) {
|
|
114
|
+
synced = false;
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
target[key] = messages[key];
|
|
118
|
+
} catch (e) {
|
|
119
|
+
synced = false;
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
return synced;
|
|
123
|
+
}
|
|
94
124
|
function reload() {
|
|
95
125
|
window.location.reload();
|
|
96
126
|
}
|
|
@@ -186,6 +216,7 @@ export {
|
|
|
186
216
|
reload,
|
|
187
217
|
replace,
|
|
188
218
|
setSessionStorageItem,
|
|
219
|
+
syncLocaleMessages,
|
|
189
220
|
toBoolean,
|
|
190
221
|
toNumber
|
|
191
222
|
};
|
package/higherOrder/BasePage.js
CHANGED
|
@@ -35,7 +35,10 @@ import { redirectToLogin } from "../store/slices/authSlice";
|
|
|
35
35
|
import {
|
|
36
36
|
VariableEvents
|
|
37
37
|
} from "../types";
|
|
38
|
-
import {
|
|
38
|
+
import {
|
|
39
|
+
clearPageWidgetProxyCache,
|
|
40
|
+
createStateProxy
|
|
41
|
+
} from "../core/proxy-service";
|
|
39
42
|
import {
|
|
40
43
|
accordionExpansionHandler,
|
|
41
44
|
mergeVariablesAndActions,
|
|
@@ -49,6 +52,7 @@ import {
|
|
|
49
52
|
} from "../core/script-registry";
|
|
50
53
|
import formatters from "../core/formatters";
|
|
51
54
|
import { useAppProxy } from "../context/AppContext";
|
|
55
|
+
import { syncLocaleMessages } from "../core/util";
|
|
52
56
|
import {
|
|
53
57
|
computeMergedPageParams,
|
|
54
58
|
computePartialParamKey,
|
|
@@ -57,12 +61,13 @@ import {
|
|
|
57
61
|
import { useAppSpinner } from "../context/AppSpinnerProvider";
|
|
58
62
|
import get from "lodash-es/get";
|
|
59
63
|
import { EVENTEMITTER_METHODS } from "../core/constants/events";
|
|
64
|
+
import { useActivePageReactivity } from "./useActivePageReactivity";
|
|
60
65
|
import { wrapWithThirdPartyErrorGuard } from "../utils/lib-error-skipper";
|
|
61
66
|
import { viewportService } from "../store/viewport.service";
|
|
62
67
|
import { formatMessage } from "../core/util";
|
|
63
68
|
const withPageContext = (WrappedComponent, addPageScript, getVariables, componentInfo, prefabInfo) => {
|
|
64
69
|
const PageContextComponent = (props) => {
|
|
65
|
-
var _a, _b, _c;
|
|
70
|
+
var _a, _b, _c, _d, _e, _f;
|
|
66
71
|
const dispatch = useAppDispatch();
|
|
67
72
|
const { show, hide } = (_a = useAppSpinner()) != null ? _a : {};
|
|
68
73
|
const i18n = useAppSelector((state) => state.i18n);
|
|
@@ -112,6 +117,8 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
112
117
|
const subscribedVariableNamesRef = useRef(/* @__PURE__ */ new Set());
|
|
113
118
|
const overriddenPropsRegistryRef = useRef(null);
|
|
114
119
|
const onStartupCompletedRef = useRef(false);
|
|
120
|
+
const lastSyncedLocaleRevisionRef = useRef(-1);
|
|
121
|
+
const appliedLocaleRef = useRef(void 0);
|
|
115
122
|
const [isPageReady, setIsPageReady] = useState(false);
|
|
116
123
|
const pageReady = useCallback(() => {
|
|
117
124
|
setIsPageReady(true);
|
|
@@ -140,7 +147,8 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
140
147
|
date: i18n.dateFormat,
|
|
141
148
|
time: i18n.timeFormat,
|
|
142
149
|
currency: i18n.currencyCode
|
|
143
|
-
}
|
|
150
|
+
},
|
|
151
|
+
i18n
|
|
144
152
|
}, prefabInfo), props), componentInfo), {
|
|
145
153
|
executeStartup,
|
|
146
154
|
formatters,
|
|
@@ -150,7 +158,18 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
150
158
|
layoutReady,
|
|
151
159
|
activePageName: componentInfo == null ? void 0 : componentInfo.componentName
|
|
152
160
|
}));
|
|
153
|
-
|
|
161
|
+
useActivePageReactivity({
|
|
162
|
+
componentType: componentInfo == null ? void 0 : componentInfo.componentType,
|
|
163
|
+
appProxy,
|
|
164
|
+
setPageContext,
|
|
165
|
+
isMountedRef,
|
|
166
|
+
activePageDeps: componentInfo == null ? void 0 : componentInfo.activePageDeps
|
|
167
|
+
});
|
|
168
|
+
useEffect(() => {
|
|
169
|
+
if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PAGE" && (appProxy == null ? void 0 : appProxy.activePageName) === (componentInfo == null ? void 0 : componentInfo.componentName)) {
|
|
170
|
+
EVENTEMITTER_METHODS.ACTIVE_PAGE_SYNC_EMIT();
|
|
171
|
+
}
|
|
172
|
+
}, [pageContext, componentInfo == null ? void 0 : componentInfo.componentType, componentInfo == null ? void 0 : componentInfo.componentName, appProxy]);
|
|
154
173
|
const partialParamValuesKey = computePartialParamKey(
|
|
155
174
|
componentInfo == null ? void 0 : componentInfo.componentType,
|
|
156
175
|
props.params,
|
|
@@ -289,7 +308,13 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
289
308
|
pageProxy.partialParams = newParams;
|
|
290
309
|
(_a2 = props.onLoad) == null ? void 0 : _a2.call(props, pageProxy);
|
|
291
310
|
}
|
|
292
|
-
|
|
311
|
+
const mergedAppLocale = i18n.appLocale || {};
|
|
312
|
+
if (!appProxy.appLocale) {
|
|
313
|
+
appProxy.appLocale = {};
|
|
314
|
+
}
|
|
315
|
+
if (!syncLocaleMessages(appProxy.appLocale, mergedAppLocale)) {
|
|
316
|
+
appProxy.appLocale = __spreadValues({}, mergedAppLocale);
|
|
317
|
+
}
|
|
293
318
|
const localeFormats = {
|
|
294
319
|
date: i18n.dateFormat,
|
|
295
320
|
time: i18n.timeFormat,
|
|
@@ -300,15 +325,17 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
300
325
|
pageProxy.Variables = Variables;
|
|
301
326
|
pageProxy.Actions = Actions;
|
|
302
327
|
pageProxy.pageReady = pageReady;
|
|
303
|
-
pageProxy.App =
|
|
328
|
+
pageProxy.App = appProxy != null ? appProxy : appContext;
|
|
304
329
|
pageProxy.selectedLocale = i18n.selectedLocale || "en";
|
|
305
330
|
pageProxy.overriddenPropsRegistry = overriddenPropsRegistryRef.current;
|
|
306
331
|
setupVariableSubscriptions(pageVariables.Variables);
|
|
332
|
+
await executeStartupVariables(pageVariables.Variables);
|
|
307
333
|
if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PAGE" && appProxy) {
|
|
308
334
|
const pageName2 = componentInfo == null ? void 0 : componentInfo.componentName;
|
|
309
335
|
appProxy.updateActivePage(pageName2);
|
|
310
336
|
appProxy.activePage = pageProxy;
|
|
311
337
|
appProxy.activePageName = pageName2;
|
|
338
|
+
clearPageWidgetProxyCache(appProxy.Widgets);
|
|
312
339
|
Object.setPrototypeOf(appProxy.Widgets, pageProxy.Widgets);
|
|
313
340
|
} else if ((componentInfo == null ? void 0 : componentInfo.componentName) === "Common" && (componentInfo == null ? void 0 : componentInfo.componentType) === "PARTIAL" && appProxy) {
|
|
314
341
|
Object.keys(pageProxy.Widgets).forEach((key) => {
|
|
@@ -457,21 +484,11 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
457
484
|
setupVariableSubscriptions(appVarsOnly);
|
|
458
485
|
}
|
|
459
486
|
};
|
|
460
|
-
const
|
|
461
|
-
const
|
|
487
|
+
const executeStartupVariables = async (Variables) => {
|
|
488
|
+
const startUpVariables = (componentInfo == null ? void 0 : componentInfo.startUpVariables) || [];
|
|
489
|
+
if (!startUpVariables.length) return;
|
|
462
490
|
startUpVariables.forEach((name) => pendingStartupOpsRef.current.add(name));
|
|
463
|
-
startUpActions.forEach((name) => pendingStartupOpsRef.current.add(name));
|
|
464
|
-
if (startUpActions.length === 0 && startUpVariables.length === 0) {
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
491
|
try {
|
|
468
|
-
startUpActions.forEach((actionName) => {
|
|
469
|
-
var _a2;
|
|
470
|
-
if ((_a2 = Actions[actionName]) == null ? void 0 : _a2.invoke) {
|
|
471
|
-
Actions[actionName].invoke();
|
|
472
|
-
}
|
|
473
|
-
pendingStartupOpsRef.current.delete(String(actionName));
|
|
474
|
-
});
|
|
475
492
|
const variablePromises = startUpVariables.map((varName) => {
|
|
476
493
|
var _a2;
|
|
477
494
|
if ((_a2 = Variables[varName]) == null ? void 0 : _a2.invoke) {
|
|
@@ -493,7 +510,24 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
493
510
|
}
|
|
494
511
|
}, 0);
|
|
495
512
|
} catch (error) {
|
|
496
|
-
console.error("Error during startup
|
|
513
|
+
console.error("Error during startup variables:", error);
|
|
514
|
+
}
|
|
515
|
+
};
|
|
516
|
+
const executeStartupActions = async (Actions) => {
|
|
517
|
+
const startUpActions = (componentInfo == null ? void 0 : componentInfo.startUpActions) || [];
|
|
518
|
+
if (!startUpActions.length) return;
|
|
519
|
+
startUpActions.forEach((name) => pendingStartupOpsRef.current.add(name));
|
|
520
|
+
try {
|
|
521
|
+
startUpActions.forEach((actionName) => {
|
|
522
|
+
var _a2;
|
|
523
|
+
if ((_a2 = Actions[actionName]) == null ? void 0 : _a2.invoke) {
|
|
524
|
+
Actions[actionName].invoke();
|
|
525
|
+
}
|
|
526
|
+
pendingStartupOpsRef.current.delete(String(actionName));
|
|
527
|
+
});
|
|
528
|
+
pendingStartupOpsRef.current.clear();
|
|
529
|
+
} catch (error) {
|
|
530
|
+
console.error("Error during startup actions:", error);
|
|
497
531
|
}
|
|
498
532
|
};
|
|
499
533
|
function layoutReady() {
|
|
@@ -538,19 +572,61 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
538
572
|
async function executeStartup() {
|
|
539
573
|
await (appContext == null ? void 0 : appContext.executeStartAppOperations());
|
|
540
574
|
}
|
|
541
|
-
|
|
542
|
-
|
|
575
|
+
useEffect(() => {
|
|
576
|
+
const prevLocale = appliedLocaleRef.current;
|
|
577
|
+
appliedLocaleRef.current = i18n.selectedLocale;
|
|
578
|
+
const isLocaleSwitch = prevLocale !== void 0 && prevLocale !== i18n.selectedLocale;
|
|
579
|
+
if (isLocaleSwitch && pageProxyRef.current) {
|
|
580
|
+
pageProxyRef.current.Widgets = {};
|
|
581
|
+
}
|
|
582
|
+
setPageContext((prev) => {
|
|
583
|
+
if (prev.selectedLocale === i18n.selectedLocale) {
|
|
584
|
+
return prev;
|
|
585
|
+
}
|
|
586
|
+
return __spreadValues(__spreadProps(__spreadValues({}, prev), {
|
|
587
|
+
selectedLocale: i18n.selectedLocale
|
|
588
|
+
}), isLocaleSwitch && { Widgets: {} });
|
|
589
|
+
});
|
|
590
|
+
}, [i18n.selectedLocale]);
|
|
591
|
+
const applyLocaleToProxies = useCallback(
|
|
592
|
+
(newAppLocale) => {
|
|
593
|
+
var _a2;
|
|
594
|
+
if (appProxy) {
|
|
595
|
+
if (!appProxy.appLocale) {
|
|
596
|
+
appProxy.appLocale = {};
|
|
597
|
+
}
|
|
598
|
+
if (!syncLocaleMessages(appProxy.appLocale, newAppLocale)) {
|
|
599
|
+
appProxy.appLocale = __spreadValues({}, newAppLocale);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
if (pageProxyRef.current) {
|
|
603
|
+
if (!pageProxyRef.current.appLocale) {
|
|
604
|
+
pageProxyRef.current.appLocale = {};
|
|
605
|
+
}
|
|
606
|
+
if (!syncLocaleMessages(pageProxyRef.current.appLocale, newAppLocale)) {
|
|
607
|
+
pageProxyRef.current.appLocale = __spreadValues({}, newAppLocale);
|
|
608
|
+
}
|
|
609
|
+
if (pageProxyRef.current.App) {
|
|
610
|
+
pageProxyRef.current.App.appLocale = (_a2 = appProxy == null ? void 0 : appProxy.appLocale) != null ? _a2 : newAppLocale;
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
},
|
|
614
|
+
[appProxy == null ? void 0 : appProxy.appLocale]
|
|
615
|
+
);
|
|
616
|
+
if (isInitialized && pageProxyRef.current && ((_c = i18n.localeRevision) != null ? _c : 0) !== lastSyncedLocaleRevisionRef.current) {
|
|
617
|
+
const isLocaleChange = lastSyncedLocaleRevisionRef.current >= 0;
|
|
618
|
+
lastSyncedLocaleRevisionRef.current = (_d = i18n.localeRevision) != null ? _d : 0;
|
|
619
|
+
applyLocaleToProxies(i18n.appLocale);
|
|
620
|
+
if (isLocaleChange && (componentInfo == null ? void 0 : componentInfo.componentType) === "PAGE") {
|
|
621
|
+
addPageScript(appProxy, pageProxyRef.current);
|
|
622
|
+
}
|
|
543
623
|
}
|
|
544
624
|
useEffect(() => {
|
|
545
|
-
var _a2;
|
|
546
625
|
const newAppLocale = merge({}, i18n.appLocale || {}, (prefabInfo == null ? void 0 : prefabInfo.appLocale) || {});
|
|
547
626
|
if (!isEqual(pageContext.appLocale, newAppLocale)) {
|
|
548
627
|
setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
549
628
|
appLocale: newAppLocale
|
|
550
629
|
}));
|
|
551
|
-
if ((_a2 = pageProxyRef.current) == null ? void 0 : _a2.App) {
|
|
552
|
-
pageProxyRef.current.App.appLocale = newAppLocale;
|
|
553
|
-
}
|
|
554
630
|
}
|
|
555
631
|
}, [i18n.appLocale]);
|
|
556
632
|
useEffect(() => {
|
|
@@ -586,9 +662,9 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
586
662
|
if ((securityConfig == null ? void 0 : securityConfig.authenticated) && (appProxy == null ? void 0 : appProxy.executeSessionFailureRequests)) {
|
|
587
663
|
await appProxy.executeSessionFailureRequests();
|
|
588
664
|
}
|
|
589
|
-
await
|
|
665
|
+
await (appContext == null ? void 0 : appContext.executeStartAppOperations());
|
|
590
666
|
await onContentReady();
|
|
591
|
-
|
|
667
|
+
executeStartupActions(pageContext.Actions);
|
|
592
668
|
onStartupCompletedRef.current = true;
|
|
593
669
|
if (pendingAccordionExpansion) {
|
|
594
670
|
accordionExpansionHandler(pageProxyRef, pendingAccordionExpansion, dispatch);
|
|
@@ -626,14 +702,14 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
626
702
|
((_a2 = appVariables[value]) == null ? void 0 : _a2.invokeOnParamChange) && ((_b2 = appVariables[value]) == null ? void 0 : _b2.invokeOnParamChange());
|
|
627
703
|
});
|
|
628
704
|
}
|
|
629
|
-
if (((
|
|
705
|
+
if (((_e = componentInfo == null ? void 0 : componentInfo.autoUpdateVariables) == null ? void 0 : _e.length) && onStartupCompletedRef.current) {
|
|
630
706
|
const pageVariables = pageContext.Variables;
|
|
631
707
|
componentInfo.autoUpdateVariables.forEach((value) => {
|
|
632
708
|
var _a2, _b2;
|
|
633
709
|
(_b2 = (_a2 = pageVariables[value]) == null ? void 0 : _a2.invokeOnParamChange) == null ? void 0 : _b2.call(_a2);
|
|
634
710
|
});
|
|
635
711
|
}
|
|
636
|
-
return /* @__PURE__ */ jsx(WidgetProvider, { value: { value: pageContext, proxy: pageProxyRef.current }, children: /* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props)) });
|
|
712
|
+
return /* @__PURE__ */ jsx(WidgetProvider, { value: { value: pageContext, proxy: pageProxyRef.current }, children: /* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props), `locale-${(_f = i18n.localeRevision) != null ? _f : 0}`) });
|
|
637
713
|
};
|
|
638
714
|
PageContextComponent.displayName = `WithPageContext(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
|
|
639
715
|
return PageContextComponent;
|
package/higherOrder/props.d.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { PageContextState } from "@wavemaker-ai/react-runtime/types";
|
|
3
|
+
interface UseActivePageReactivityParams {
|
|
4
|
+
componentType?: string;
|
|
5
|
+
appProxy: any;
|
|
6
|
+
setPageContext: React.Dispatch<React.SetStateAction<PageContextState>>;
|
|
7
|
+
isMountedRef: React.RefObject<boolean>;
|
|
8
|
+
/** Active-page dependency paths this component reads (`App.activePage.*`), declared by codegen. */
|
|
9
|
+
activePageDeps?: string[];
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Cross-context reactivity (value-gated): the active page broadcasts on every commit; this hook
|
|
13
|
+
* re-renders the consuming partial/prefab only when one of its codegen-declared `App.activePage.*`
|
|
14
|
+
* dependency paths actually changed. Works for Variables, Widgets, or anything after `activePage`,
|
|
15
|
+
* since the comparison is on the resolved value (the runtime creates new references on change).
|
|
16
|
+
*
|
|
17
|
+
* Propagation is page -> island only (acyclic). Partials with no declared deps never subscribe, so
|
|
18
|
+
* unrelated partials (header/footer) stay untouched. Re-subscribes/resets on navigation.
|
|
19
|
+
*/
|
|
20
|
+
export declare const useActivePageReactivity: ({ componentType, appProxy, setPageContext, isMountedRef, activePageDeps, }: UseActivePageReactivityParams) => void;
|
|
21
|
+
export default useActivePageReactivity;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __spreadValues = (a, b) => {
|
|
10
|
+
for (var prop in b || (b = {}))
|
|
11
|
+
if (__hasOwnProp.call(b, prop))
|
|
12
|
+
__defNormalProp(a, prop, b[prop]);
|
|
13
|
+
if (__getOwnPropSymbols)
|
|
14
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
15
|
+
if (__propIsEnum.call(b, prop))
|
|
16
|
+
__defNormalProp(a, prop, b[prop]);
|
|
17
|
+
}
|
|
18
|
+
return a;
|
|
19
|
+
};
|
|
20
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
21
|
+
import { useEffect, useRef } from "react";
|
|
22
|
+
import { EVENTEMITTER_METHODS } from "../core/constants/events";
|
|
23
|
+
const resolvePath = (root, path) => path.split(".").reduce((obj, key) => obj == null ? void 0 : obj[key], root);
|
|
24
|
+
const useActivePageReactivity = ({
|
|
25
|
+
componentType,
|
|
26
|
+
appProxy,
|
|
27
|
+
setPageContext,
|
|
28
|
+
isMountedRef,
|
|
29
|
+
activePageDeps
|
|
30
|
+
}) => {
|
|
31
|
+
var _a;
|
|
32
|
+
const snapshotRef = useRef([]);
|
|
33
|
+
const activePage = appProxy == null ? void 0 : appProxy.activePage;
|
|
34
|
+
const declaredKey = (_a = activePageDeps == null ? void 0 : activePageDeps.join("|")) != null ? _a : "";
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (componentType === "PAGE" || !(activePageDeps == null ? void 0 : activePageDeps.length)) return;
|
|
37
|
+
const readValues = () => activePageDeps.map((path) => resolvePath(activePage, path));
|
|
38
|
+
snapshotRef.current = readValues();
|
|
39
|
+
const onActivePageChange = () => {
|
|
40
|
+
if (!isMountedRef.current) return;
|
|
41
|
+
const next = readValues();
|
|
42
|
+
if (next.some((value, i) => !Object.is(value, snapshotRef.current[i]))) {
|
|
43
|
+
snapshotRef.current = next;
|
|
44
|
+
setPageContext((prev) => __spreadProps(__spreadValues({}, prev), { App: __spreadValues({}, prev.App) }));
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
EVENTEMITTER_METHODS.ACTIVE_PAGE_SYNC_ON(onActivePageChange);
|
|
48
|
+
return () => {
|
|
49
|
+
EVENTEMITTER_METHODS.ACTIVE_PAGE_SYNC_OFF(onActivePageChange);
|
|
50
|
+
};
|
|
51
|
+
}, [componentType, activePage, declaredKey]);
|
|
52
|
+
};
|
|
53
|
+
var useActivePageReactivity_default = useActivePageReactivity;
|
|
54
|
+
export {
|
|
55
|
+
useActivePageReactivity_default as default,
|
|
56
|
+
useActivePageReactivity
|
|
57
|
+
};
|
|
@@ -30,7 +30,7 @@ var __objRest = (source, exclude) => {
|
|
|
30
30
|
}
|
|
31
31
|
return target;
|
|
32
32
|
};
|
|
33
|
-
import {
|
|
33
|
+
import { createElement } from "react";
|
|
34
34
|
import React, { useEffect, useMemo, useCallback } from "react";
|
|
35
35
|
import isEqual from "lodash-es/isEqual";
|
|
36
36
|
import { useDeviceVisibility } from "../hooks/useDeviceVisibility";
|
|
@@ -48,7 +48,7 @@ const withBaseWrapper = (WrappedComponent) => {
|
|
|
48
48
|
useEffect(() => {
|
|
49
49
|
if (name && (props == null ? void 0 : props.iswidget) !== "false" && (pageContext == null ? void 0 : pageContext.Widgets)) {
|
|
50
50
|
const widget = (widgetFromContext == null ? void 0 : widgetFromContext["data-widget-id"]) === componentWidgetId ? widgetFromContext : {};
|
|
51
|
-
const registryEntry = __spreadProps(__spreadValues(__spreadValues({},
|
|
51
|
+
const registryEntry = __spreadProps(__spreadValues(__spreadValues({}, widget), props), {
|
|
52
52
|
"data-widget-id": componentWidgetId || void 0,
|
|
53
53
|
// Ensure widget-id is stored
|
|
54
54
|
viewParent: proxy
|
|
@@ -57,6 +57,7 @@ const withBaseWrapper = (WrappedComponent) => {
|
|
|
57
57
|
}
|
|
58
58
|
}, [name, pageContext == null ? void 0 : pageContext.Widgets, componentWidgetId, props]);
|
|
59
59
|
const mergedProps = useMemo(() => {
|
|
60
|
+
var _a2;
|
|
60
61
|
if (!name || !(pageContext == null ? void 0 : pageContext.Widgets) || (props == null ? void 0 : props.iswidget) === "false") {
|
|
61
62
|
return props;
|
|
62
63
|
}
|
|
@@ -72,8 +73,8 @@ const withBaseWrapper = (WrappedComponent) => {
|
|
|
72
73
|
const widgetOverrides = registry == null ? void 0 : registry.getWidgetOverrides(name, componentWidgetId || "");
|
|
73
74
|
if (widgetOverrides) {
|
|
74
75
|
Object.keys(widgetOverrides).forEach((key) => {
|
|
75
|
-
var
|
|
76
|
-
const internalValue = (
|
|
76
|
+
var _a3;
|
|
77
|
+
const internalValue = (_a3 = registry == null ? void 0 : registry.getLastInternalValue) == null ? void 0 : _a3.call(registry, name, key);
|
|
77
78
|
mergedState[key] = internalValue !== void 0 ? internalValue : widgetOverrides[key];
|
|
78
79
|
if (props.prefab && key !== "inbound" && key !== "outbound" && key !== "show") {
|
|
79
80
|
const updatedInbound = __spreadProps(__spreadValues({}, props.inbound), {
|
|
@@ -94,7 +95,7 @@ const withBaseWrapper = (WrappedComponent) => {
|
|
|
94
95
|
});
|
|
95
96
|
}
|
|
96
97
|
} else if (shouldMergeFromContext) {
|
|
97
|
-
mergedState = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, widget), props), (props == null ? void 0 : props.formfield) ? { datavalue: props.datavalue } : { datavalue:
|
|
98
|
+
mergedState = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, widget), props), (props == null ? void 0 : props.formfield) ? { datavalue: props.datavalue } : { datavalue: (_a2 = props.datavalue) != null ? _a2 : widgetDatavalue }), component === "WmFormField" && !props["value"] && { value: datavalue, datavalue });
|
|
98
99
|
} else {
|
|
99
100
|
mergedState = __spreadValues(__spreadValues({}, props), component === "WmFormField" && !props["value"] && { value: datavalue, datavalue });
|
|
100
101
|
}
|
|
@@ -122,6 +123,8 @@ const withBaseWrapper = (WrappedComponent) => {
|
|
|
122
123
|
delete propsForComparison.listener;
|
|
123
124
|
delete stateForComparison.viewParent;
|
|
124
125
|
delete propsForComparison.viewParent;
|
|
126
|
+
delete stateForComparison.children;
|
|
127
|
+
delete propsForComparison.children;
|
|
125
128
|
if (!isEqual(stateForComparison, propsForComparison)) {
|
|
126
129
|
updateWidgetState(name, mergedProps);
|
|
127
130
|
}
|
|
@@ -151,7 +154,7 @@ const withBaseWrapper = (WrappedComponent) => {
|
|
|
151
154
|
}
|
|
152
155
|
const shouldHide = !showValue && !isDeferLoad;
|
|
153
156
|
const updateon = (props == null ? void 0 : props.updateon) === "default" ? "keypress" : props == null ? void 0 : props.updateon;
|
|
154
|
-
return /* @__PURE__ */
|
|
157
|
+
return /* @__PURE__ */ createElement(
|
|
155
158
|
WrappedComponent,
|
|
156
159
|
__spreadProps(__spreadValues(__spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, rest), mergedProps), updateon && { updateon }), shouldHide && { hidden: true }), deferload !== void 0 && { deferload: deferload.toString() }), {
|
|
157
160
|
show: (_d = mergedProps == null ? void 0 : mergedProps.show) == null ? void 0 : _d.toString(),
|
|
@@ -160,7 +163,8 @@ const withBaseWrapper = (WrappedComponent) => {
|
|
|
160
163
|
styles: computedStyles
|
|
161
164
|
}), (props == null ? void 0 : props.dataset) && { dataset: props == null ? void 0 : props.dataset }), {
|
|
162
165
|
destroy,
|
|
163
|
-
viewParent: proxy
|
|
166
|
+
viewParent: proxy,
|
|
167
|
+
key: (pageContext == null ? void 0 : pageContext.selectedLocale) || "en"
|
|
164
168
|
})
|
|
165
169
|
);
|
|
166
170
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ComponentType } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Dev HOC that logs why a component re-rendered.
|
|
4
|
+
*
|
|
5
|
+
* On every render it diffs the current props against the previous render's
|
|
6
|
+
* props (shallow, by reference) and logs which keys changed, with prev/next
|
|
7
|
+
* values. Useful for spotting unstable props (new object/array/fn identity)
|
|
8
|
+
* that cause avoidable re-renders.
|
|
9
|
+
*
|
|
10
|
+
* Pure React (no jsx-runtime patching, no external dep), so it works in any
|
|
11
|
+
* bundler/runtime — unlike why-did-you-render.
|
|
12
|
+
*
|
|
13
|
+
* NOTE: no NODE_ENV gate for now (per request) — logs in all environments.
|
|
14
|
+
*/
|
|
15
|
+
export declare function withRenderLogger<P extends Record<string, any>>(WrappedComponent: ComponentType<P>, label?: string): ComponentType<P>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
6
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
7
|
+
var __spreadValues = (a, b) => {
|
|
8
|
+
for (var prop in b || (b = {}))
|
|
9
|
+
if (__hasOwnProp.call(b, prop))
|
|
10
|
+
__defNormalProp(a, prop, b[prop]);
|
|
11
|
+
if (__getOwnPropSymbols)
|
|
12
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
13
|
+
if (__propIsEnum.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
}
|
|
16
|
+
return a;
|
|
17
|
+
};
|
|
18
|
+
import { jsx } from "react/jsx-runtime";
|
|
19
|
+
import { useRef } from "react";
|
|
20
|
+
function withRenderLogger(WrappedComponent, label) {
|
|
21
|
+
const name = label || WrappedComponent.displayName || WrappedComponent.name || "Component";
|
|
22
|
+
const WithRenderLogger = (props) => {
|
|
23
|
+
const prevProps = useRef(null);
|
|
24
|
+
const renderCount = useRef(0);
|
|
25
|
+
renderCount.current += 1;
|
|
26
|
+
const changed = {};
|
|
27
|
+
if (prevProps.current) {
|
|
28
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(prevProps.current), ...Object.keys(props)]);
|
|
29
|
+
keys.forEach((key) => {
|
|
30
|
+
if (prevProps.current[key] !== props[key]) {
|
|
31
|
+
changed[key] = { prev: prevProps.current[key], next: props[key] };
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const changedKeys = Object.keys(changed);
|
|
36
|
+
if (prevProps.current === null) {
|
|
37
|
+
console.log(`%c[render] ${name} #${renderCount.current} (mount)`, "color:#888");
|
|
38
|
+
} else {
|
|
39
|
+
console.log(
|
|
40
|
+
`%c[render] ${name} #${renderCount.current} \u2014 ${changedKeys.length ? `changed: ${changedKeys.join(", ")}` : "no prop changes (state/context/parent re-render)"}`,
|
|
41
|
+
changedKeys.length ? "color:#d9480f" : "color:#1971c2",
|
|
42
|
+
changedKeys.length ? changed : ""
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
prevProps.current = props;
|
|
46
|
+
return /* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props));
|
|
47
|
+
};
|
|
48
|
+
WithRenderLogger.displayName = `withRenderLogger(${name})`;
|
|
49
|
+
return WithRenderLogger;
|
|
50
|
+
}
|
|
51
|
+
export {
|
|
52
|
+
withRenderLogger
|
|
53
|
+
};
|
package/hooks/useAuth.js
CHANGED
|
@@ -36,6 +36,12 @@ const useAuth = () => {
|
|
|
36
36
|
const { isLoggedIn, loggedInUser, securityConfig, isPageLoading, error } = useAppSelector(
|
|
37
37
|
(state) => state.auth
|
|
38
38
|
);
|
|
39
|
+
const securityEnabled = useAppSelector(
|
|
40
|
+
(state) => {
|
|
41
|
+
var _a, _b, _c;
|
|
42
|
+
return !!((_c = (_b = (_a = state.info) == null ? void 0 : _a.appConfig) == null ? void 0 : _b.appProperties) == null ? void 0 : _c.securityEnabled);
|
|
43
|
+
}
|
|
44
|
+
);
|
|
39
45
|
const handleLogin = async (options) => {
|
|
40
46
|
try {
|
|
41
47
|
const loginResponse = await dispatch(login(options)).unwrap();
|
|
@@ -76,7 +82,7 @@ const useAuth = () => {
|
|
|
76
82
|
return widgetRoles.some((role) => includes(userRoles, role));
|
|
77
83
|
};
|
|
78
84
|
const getLoggedInUserDetails = async (baseURL) => {
|
|
79
|
-
if (!
|
|
85
|
+
if (!securityEnabled) {
|
|
80
86
|
dispatch(setPageLoading(true));
|
|
81
87
|
await dispatch(getServiceDefinitions(baseURL)).unwrap();
|
|
82
88
|
dispatch(setPageLoading(false));
|