@wavemaker-ai/react-runtime 1.0.0-rc.647655 → 1.0.0-rc.647684
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/notification-action.js +3 -3
- package/actions/toast.js +2 -1
- package/components/basic/icon/index.js +36 -5
- package/components/basic/iframe/index.js +18 -8
- package/components/basic/label/index.js +4 -3
- package/components/basic/message/index.js +1 -0
- package/components/basic/search/index.d.ts +72 -3
- package/components/basic/search/index.js +84 -32
- package/components/basic/search/props.d.ts +4 -0
- package/components/basic/search/providers.d.ts +1 -1
- package/components/basic/search/providers.js +6 -3
- package/components/common/WmAppIcon/index.js +11 -8
- package/components/common/WmAppIcon/props.d.ts +2 -0
- package/components/container/accordion/accordion-pane/index.d.ts +1 -0
- package/components/container/accordion/accordion-pane/index.js +7 -3
- package/components/container/accordion/accordion-pane/props.d.ts +1 -0
- package/components/container/index.js +13 -5
- package/components/container/layout-grid/index.js +1 -0
- package/components/container/linear-layout/index.js +0 -1
- package/components/container/panel/components/panel-header/index.js +1 -3
- package/components/container/tabs/tab-pane/index.d.ts +1 -0
- package/components/container/tabs/tab-pane/index.js +2 -2
- package/components/container/tabs/tab-pane/props.d.ts +1 -0
- package/components/container/wizard/index.js +11 -10
- package/components/container/wizard/utils.js +1 -0
- package/components/data/form/base-form/hooks/useFormOperations.js +9 -15
- package/components/data/form/base-form/index.js +17 -14
- package/components/data/form/base-form/utils.js +5 -4
- package/components/data/form/dynamic-fields/WmxDynamicFormField.d.ts +11 -0
- package/components/data/form/dynamic-fields/WmxDynamicFormField.js +77 -0
- package/components/data/form/dynamic-fields/index.js +12 -1
- package/components/data/form/form-action/index.d.ts +2 -2
- package/components/data/form/form-action/index.js +2 -2
- package/components/data/form/form-context.d.ts +12 -13
- package/components/data/form/form-context.js +4 -6
- package/components/data/form/form-controller/withFormController.js +4 -18
- package/components/data/form/form-field/index.js +10 -6
- package/components/data/list/components/ListItems.js +1 -3
- package/components/data/list/index.js +5 -4
- package/components/data/pagination/hooks/usePagination.js +2 -2
- package/components/data/table/components/RowCells.js +3 -1
- package/components/data/table/components/TableBody.js +2 -1
- package/components/data/table/components/TableDataRow.js +1 -1
- package/components/data/table/components/TableHeader.js +5 -1
- package/components/data/table/hooks/useRowHandlers.d.ts +4 -2
- package/components/data/table/hooks/useRowHandlers.js +23 -11
- package/components/data/table/hooks/useRowSelection.d.ts +1 -1
- package/components/data/table/hooks/useRowSelection.js +93 -74
- package/components/data/table/hooks/useTableColumns.js +5 -5
- package/components/data/table/hooks/useTableState.js +14 -2
- package/components/data/table/index.js +54 -50
- package/components/data/table/props.d.ts +12 -8
- package/components/data/table/utils/buildSelectionColumns.js +31 -31
- package/components/data/table/utils/columnBuilder.js +1 -1
- package/components/data/table/utils/index.d.ts +9 -1
- package/components/data/table/utils/index.js +30 -2
- package/components/data/table/utils/selectionUtils.d.ts +7 -0
- package/components/data/table/utils/selectionUtils.js +28 -1
- package/components/dialogs/dialog-actions/index.js +11 -2
- package/components/dialogs/dialog-header/index.js +1 -1
- package/components/dialogs/index.js +14 -2
- package/components/input/chips/index.js +29 -5
- package/components/input/color-picker/index.js +4 -6
- package/components/input/epoch/date/index.js +3 -2
- package/components/input/epoch/date/utils.js +4 -2
- package/components/input/epoch/datetime/index.js +2 -2
- package/components/input/epoch/datetime/props.d.ts +2 -2
- package/components/input/epoch/time/utils.d.ts +1 -1
- package/components/input/epoch/time/utils.js +2 -2
- package/components/input/fileupload/useFileUpload.js +19 -24
- package/components/input/select/index.js +8 -6
- package/components/input/text/index.js +2 -2
- package/components/input/textarea/index.js +41 -16
- package/components/navbar/nav/index.js +10 -5
- package/components/navigation/breadcrumb/index.js +2 -1
- package/components/navigation/popover/index.d.ts +1 -1
- package/components/navigation/popover/index.js +10 -2
- package/components/navigation/popover/props.d.ts +1 -1
- package/components/page/page-content/index.js +24 -4
- package/components/page/page-content/props.d.ts +1 -0
- package/components/page/partial-container/index.js +1 -1
- package/components/wmx/WmxRenderer.d.ts +8 -0
- package/components/wmx/WmxRenderer.js +57 -0
- package/core/appstore.js +1 -1
- package/core/proxy-service.d.ts +16 -1
- package/core/proxy-service.js +39 -12
- package/core/util/index.d.ts +0 -2
- package/core/util/index.js +0 -29
- package/higherOrder/BaseDateTime.js +8 -1
- package/higherOrder/BasePage.js +31 -65
- package/higherOrder/DataNav.js +4 -1
- package/higherOrder/withBaseWrapper.js +3 -4
- package/hooks/useHttp.js +4 -2
- package/hooks/useLayoutSize.js +1 -1
- package/package-lock.json +360 -696
- package/package.json +3 -3
- package/runtime-dynamic/app-initializer.js +2 -1
- package/runtime-dynamic/components/partial-content.js +2 -1
- package/runtime-dynamic/components/wmx-placeholder.d.ts +18 -0
- package/runtime-dynamic/components/wmx-placeholder.js +48 -0
- package/runtime-dynamic/main.js +6 -0
- package/runtime-dynamic/services/compile-render.js +75 -12
- package/store/slices/i18nSlice.d.ts +0 -1
- package/store/slices/i18nSlice.js +0 -2
- package/utils/layoutsize-util.js +12 -7
- package/utils/style-utils.d.ts +6 -0
- package/utils/style-utils.js +10 -0
- package/utils/wmx.utils.d.ts +6 -0
- package/utils/wmx.utils.js +41 -0
- package/variables/crud-variable.js +1 -1
- package/variables/live-variable.js +1 -1
- package/variables/service-variable.js +6 -3
|
@@ -1,25 +1,45 @@
|
|
|
1
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));
|
|
2
21
|
import { jsx } from "react/jsx-runtime";
|
|
3
22
|
import clsx from "clsx";
|
|
4
23
|
import { useAppState } from "../../../context/WidgetProvider";
|
|
5
24
|
import { getCurrentPath } from "../../../core/util/utils";
|
|
6
25
|
const DEFAULT_CLASS = "app-page-content app-content-column";
|
|
7
26
|
function WmPageContent(props) {
|
|
8
|
-
const { className, columnwidth, styles, layoutClassName } = props;
|
|
27
|
+
const { className, columnwidth, styles, layoutClassName, direction } = props;
|
|
9
28
|
const appState = useAppState();
|
|
10
29
|
const pageName = ((appState == null ? void 0 : appState.componentName) || (appState == null ? void 0 : appState.name) || getCurrentPath().split("/").pop() || "").toLowerCase();
|
|
11
30
|
return /* @__PURE__ */ jsx("div", { className: "app-content-column-wrapper", children: /* @__PURE__ */ jsx("div", { className: clsx(pageName && `app-page-${pageName}`), style: { display: "inline" }, children: /* @__PURE__ */ jsx(
|
|
12
31
|
"div",
|
|
13
|
-
{
|
|
32
|
+
__spreadProps(__spreadValues({
|
|
14
33
|
style: styles,
|
|
15
34
|
className: clsx(
|
|
16
35
|
DEFAULT_CLASS,
|
|
17
36
|
className,
|
|
18
37
|
`col-sm-${columnwidth} col-md-${columnwidth}`,
|
|
19
38
|
layoutClassName
|
|
20
|
-
)
|
|
39
|
+
)
|
|
40
|
+
}, direction ? { direction } : {}), {
|
|
21
41
|
children: props.children
|
|
22
|
-
}
|
|
42
|
+
})
|
|
23
43
|
) }) });
|
|
24
44
|
}
|
|
25
45
|
WmPageContent.displayName = "WmPageContent";
|
|
@@ -9,6 +9,7 @@ export interface PageContentProps {
|
|
|
9
9
|
* Utility layout classes from Studio Auto Layout (merged on the page-content root).
|
|
10
10
|
*/
|
|
11
11
|
layoutClassName?: string;
|
|
12
|
+
direction?: string;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* Combined props for the WmPageContent component, including base WaveMaker props.
|
|
@@ -70,7 +70,7 @@ const CodegenPartialContainer = memo((props) => {
|
|
|
70
70
|
const partial = partials.find((p) => p.name === content);
|
|
71
71
|
return partial ? React.createElement(partial.component, __spreadProps(__spreadValues({}, params), { onLoad: handleOnLoad })) : null;
|
|
72
72
|
};
|
|
73
|
-
return /* @__PURE__ */ jsx("div", { className: clsx(content && `app-partial-${content.toLowerCase()}`), children: /* @__PURE__ */ jsx(Container, { className: "partial-container", children: contentToRender() }) });
|
|
73
|
+
return /* @__PURE__ */ jsx("div", { className: clsx(content && `app-partial-${content.toLowerCase()}`), children: /* @__PURE__ */ jsx(Container, { className: "partial-container", style: { height: "inherit" }, children: contentToRender() }) });
|
|
74
74
|
}, arePropsEqual);
|
|
75
75
|
CodegenPartialContainer.displayName = "WmPartialContainer";
|
|
76
76
|
const WmPartialContainer = memo((props) => {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BaseProps } from "@wavemaker-ai/react-runtime/higherOrder/props";
|
|
2
|
+
type WmxRendererProps = {
|
|
3
|
+
componentname: string;
|
|
4
|
+
field?: boolean;
|
|
5
|
+
};
|
|
6
|
+
type WmxRendererExtendedProps = WmxRendererProps & BaseProps;
|
|
7
|
+
declare const WmxRenderer: (props: WmxRendererExtendedProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default WmxRenderer;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
3
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
4
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __spreadValues = (a, b) => {
|
|
7
|
+
for (var prop in b || (b = {}))
|
|
8
|
+
if (__hasOwnProp.call(b, prop))
|
|
9
|
+
__defNormalProp(a, prop, b[prop]);
|
|
10
|
+
if (__getOwnPropSymbols)
|
|
11
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
12
|
+
if (__propIsEnum.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
}
|
|
15
|
+
return a;
|
|
16
|
+
};
|
|
17
|
+
var __objRest = (source, exclude) => {
|
|
18
|
+
var target = {};
|
|
19
|
+
for (var prop in source)
|
|
20
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
21
|
+
target[prop] = source[prop];
|
|
22
|
+
if (source != null && __getOwnPropSymbols)
|
|
23
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
24
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
25
|
+
target[prop] = source[prop];
|
|
26
|
+
}
|
|
27
|
+
return target;
|
|
28
|
+
};
|
|
29
|
+
import { jsx } from "react/jsx-runtime";
|
|
30
|
+
import { useMemo } from "react";
|
|
31
|
+
import { getWmxModule } from "../../utils/wmx.utils";
|
|
32
|
+
import withFormController from "../data/form/form-controller/withFormController";
|
|
33
|
+
import withBaseWrapper from "../../higherOrder/withBaseWrapper";
|
|
34
|
+
const WmxRenderer = (props) => {
|
|
35
|
+
var _b;
|
|
36
|
+
const _a = props, { componentname, field } = _a, restProps = __objRest(_a, ["componentname", "field"]);
|
|
37
|
+
const wmxModule = getWmxModule();
|
|
38
|
+
const RawComponent = (_b = wmxModule == null ? void 0 : wmxModule[`Wmx${componentname}`]) != null ? _b : null;
|
|
39
|
+
const FormFieldComponent = useMemo(
|
|
40
|
+
() => RawComponent ? withBaseWrapper(withFormController(RawComponent)) : null,
|
|
41
|
+
[RawComponent]
|
|
42
|
+
);
|
|
43
|
+
const BaseWrappedComponent = useMemo(
|
|
44
|
+
() => RawComponent ? withBaseWrapper(RawComponent) : null,
|
|
45
|
+
[RawComponent]
|
|
46
|
+
);
|
|
47
|
+
if (!wmxModule || !RawComponent || !FormFieldComponent || !BaseWrappedComponent) return null;
|
|
48
|
+
const isFormField = String(field) === "true";
|
|
49
|
+
if (isFormField) {
|
|
50
|
+
return /* @__PURE__ */ jsx(FormFieldComponent, __spreadValues({ componentname }, restProps));
|
|
51
|
+
}
|
|
52
|
+
return /* @__PURE__ */ jsx(BaseWrappedComponent, __spreadValues({ componentname }, restProps));
|
|
53
|
+
};
|
|
54
|
+
var WmxRenderer_default = WmxRenderer;
|
|
55
|
+
export {
|
|
56
|
+
WmxRenderer_default as default
|
|
57
|
+
};
|
package/core/appstore.js
CHANGED
package/core/proxy-service.d.ts
CHANGED
|
@@ -2,8 +2,23 @@ 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
4
|
import { FormFieldProps } from "../components/data/form/form-field/props";
|
|
5
|
+
import type { UseFormSetValue } from "react-hook-form";
|
|
5
6
|
export declare function clearPageWidgetProxyCache(widgetsProxy: object | null | undefined): void;
|
|
6
7
|
export declare const createWidgetProxy: (widget: any, widgetName: string, setPageContext: any, overriddenPropsRegistry?: OverriddenPropsRegistry) => any;
|
|
7
8
|
export declare const createPageProxy: (target: ProxyTarget, setPageContext: React.Dispatch<React.SetStateAction<PageContextState>>, overriddenPropsRegistry?: OverriddenPropsRegistry) => ProxyTarget;
|
|
8
9
|
export declare const createStateProxy: (obj: PageContextState | BaseAppProps, path: string[], setPageContext: React.Dispatch<React.SetStateAction<PageContextState>> | React.Dispatch<React.SetStateAction<BaseAppProps>>, overriddenPropsRegistry?: OverriddenPropsRegistry) => ProxyTarget;
|
|
9
|
-
|
|
10
|
+
/**
|
|
11
|
+
* Distinct fields with their canonical registry key - a field is stored under several keys,
|
|
12
|
+
* so dedupe by identity and keep the first (canonical) key. Iterate this, not Object.keys().
|
|
13
|
+
*/
|
|
14
|
+
export declare const getFormFieldEntries: (formfields: Record<string, any> | undefined) => {
|
|
15
|
+
key: string;
|
|
16
|
+
field: any;
|
|
17
|
+
}[];
|
|
18
|
+
/** Distinct field objects in registration order. */
|
|
19
|
+
export declare const getFormFieldList: (formfields: Record<string, any> | undefined) => any[];
|
|
20
|
+
/** Hidden `<name>_formWidget` lookup alias, so registry iteration yields one entry per field (as in Angular). */
|
|
21
|
+
export declare const defineFieldAlias: (alias: string, widget: any, ...registries: any[]) => void;
|
|
22
|
+
export declare const createFormFieldProxy: (formField: FormFieldProps, setState: React.Dispatch<React.SetStateAction<FormFieldProps>>, overriddenItemsRef: React.MutableRefObject<Record<string, any>>, formProxy: any, formRef?: {
|
|
23
|
+
setValue?: UseFormSetValue<any>;
|
|
24
|
+
}) => any;
|
package/core/proxy-service.js
CHANGED
|
@@ -550,28 +550,52 @@ const createStateProxy = (obj, path = [], setPageContext, overriddenPropsRegistr
|
|
|
550
550
|
}
|
|
551
551
|
});
|
|
552
552
|
};
|
|
553
|
-
const
|
|
553
|
+
const getFormFieldEntries = (formfields) => {
|
|
554
|
+
const canonicalKeyByField = /* @__PURE__ */ new Map();
|
|
555
|
+
Object.entries(formfields != null ? formfields : {}).forEach(([key, field]) => {
|
|
556
|
+
if (field && !canonicalKeyByField.has(field)) canonicalKeyByField.set(field, key);
|
|
557
|
+
});
|
|
558
|
+
return [...canonicalKeyByField].map(([field, key]) => ({ key, field }));
|
|
559
|
+
};
|
|
560
|
+
const getFormFieldList = (formfields) => getFormFieldEntries(formfields).map(({ field }) => field);
|
|
561
|
+
const defineFieldAlias = (alias, widget, ...registries) => registries.forEach(
|
|
562
|
+
(registry) => registry && Object.defineProperty(registry, alias, {
|
|
563
|
+
value: widget,
|
|
564
|
+
enumerable: false,
|
|
565
|
+
configurable: true,
|
|
566
|
+
writable: true
|
|
567
|
+
})
|
|
568
|
+
);
|
|
569
|
+
const createFormFieldProxy = (formField, setState, overriddenItemsRef, formProxy, formRef) => {
|
|
570
|
+
const { name, formKey } = formField;
|
|
571
|
+
const rhfKey = formKey || name;
|
|
554
572
|
const fieldProxy = new Proxy(formField, {
|
|
555
573
|
get: (target, prop) => {
|
|
574
|
+
if (prop === "setProperty") {
|
|
575
|
+
return function(key, value) {
|
|
576
|
+
fieldProxy[key] = value;
|
|
577
|
+
return this;
|
|
578
|
+
};
|
|
579
|
+
}
|
|
556
580
|
return target[prop];
|
|
557
581
|
},
|
|
558
582
|
set: (target, prop, value) => {
|
|
559
583
|
target[prop] = value;
|
|
560
584
|
overriddenItemsRef.current[prop] = value;
|
|
561
585
|
setState(__spreadValues({}, target));
|
|
586
|
+
if ((prop === "datavalue" || prop === "value") && rhfKey && (formRef == null ? void 0 : formRef.setValue)) {
|
|
587
|
+
formRef.setValue(rhfKey, value, { shouldValidate: false, shouldDirty: true });
|
|
588
|
+
}
|
|
562
589
|
return true;
|
|
563
590
|
}
|
|
564
591
|
});
|
|
565
|
-
const
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
}
|
|
571
|
-
|
|
572
|
-
formProxy.formWidgets[`${name}_formWidget`] = fieldProxy;
|
|
573
|
-
formProxy.formfields[`${name}`] = fieldProxy;
|
|
574
|
-
formProxy.formWidgets[`${name}`] = fieldProxy;
|
|
592
|
+
const { formfields, formWidgets } = formProxy;
|
|
593
|
+
[formKey, name].forEach((fieldKey) => {
|
|
594
|
+
if (!fieldKey) return;
|
|
595
|
+
formfields[fieldKey] = fieldProxy;
|
|
596
|
+
formWidgets[fieldKey] = fieldProxy;
|
|
597
|
+
});
|
|
598
|
+
defineFieldAlias(`${name}_formWidget`, fieldProxy, formfields, formWidgets);
|
|
575
599
|
return fieldProxy;
|
|
576
600
|
};
|
|
577
601
|
export {
|
|
@@ -579,5 +603,8 @@ export {
|
|
|
579
603
|
createFormFieldProxy,
|
|
580
604
|
createPageProxy,
|
|
581
605
|
createStateProxy,
|
|
582
|
-
createWidgetProxy
|
|
606
|
+
createWidgetProxy,
|
|
607
|
+
defineFieldAlias,
|
|
608
|
+
getFormFieldEntries,
|
|
609
|
+
getFormFieldList
|
|
583
610
|
};
|
package/core/util/index.d.ts
CHANGED
|
@@ -38,8 +38,6 @@ export declare const getSessionStorageItem: (key: string) => any;
|
|
|
38
38
|
export declare const getSessionLocaleSafe: () => string | undefined;
|
|
39
39
|
export declare const getTimezone: () => string;
|
|
40
40
|
export declare const formatMessage: (fragment: any, expression: string) => any;
|
|
41
|
-
/** Angular parity: same appLocale object, swap message keys in place so bindings stay valid. */
|
|
42
|
-
export declare function syncLocaleMessages(target: Record<string, any> | undefined, messages: Record<string, any>): boolean;
|
|
43
41
|
export declare function reload(): void;
|
|
44
42
|
export declare const toNumber: (value: any) => number;
|
|
45
43
|
export declare const _get: {
|
package/core/util/index.js
CHANGED
|
@@ -93,34 +93,6 @@ const formatMessage = (fragment, expression) => {
|
|
|
93
93
|
const path = `appLocale.${expression}`;
|
|
94
94
|
return has(fragment, path) ? get(fragment, path) : void 0;
|
|
95
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
|
-
}
|
|
124
96
|
function reload() {
|
|
125
97
|
window.location.reload();
|
|
126
98
|
}
|
|
@@ -216,7 +188,6 @@ export {
|
|
|
216
188
|
reload,
|
|
217
189
|
replace,
|
|
218
190
|
setSessionStorageItem,
|
|
219
|
-
syncLocaleMessages,
|
|
220
191
|
toBoolean,
|
|
221
192
|
toNumber
|
|
222
193
|
};
|
|
@@ -235,7 +235,14 @@ const withBaseDateTime = (WrappedComponent) => {
|
|
|
235
235
|
if (date == "CURRENT_DATE") {
|
|
236
236
|
return /* @__PURE__ */ new Date();
|
|
237
237
|
}
|
|
238
|
-
|
|
238
|
+
if (typeof date === "string") {
|
|
239
|
+
const parsed = moment(date).toDate();
|
|
240
|
+
return isNaN(parsed.getTime()) ? void 0 : parsed;
|
|
241
|
+
}
|
|
242
|
+
if (date instanceof Date) {
|
|
243
|
+
return isNaN(date.getTime()) ? void 0 : date;
|
|
244
|
+
}
|
|
245
|
+
return date;
|
|
239
246
|
}, []);
|
|
240
247
|
const handleKeyDown = useCallback((event) => {
|
|
241
248
|
const arrowKeys = Object.values(ARROW_KEYS);
|
package/higherOrder/BasePage.js
CHANGED
|
@@ -52,7 +52,6 @@ import {
|
|
|
52
52
|
} from "../core/script-registry";
|
|
53
53
|
import formatters from "../core/formatters";
|
|
54
54
|
import { useAppProxy } from "../context/AppContext";
|
|
55
|
-
import { syncLocaleMessages } from "../core/util";
|
|
56
55
|
import {
|
|
57
56
|
computeMergedPageParams,
|
|
58
57
|
computePartialParamKey,
|
|
@@ -67,7 +66,7 @@ import { viewportService } from "../store/viewport.service";
|
|
|
67
66
|
import { formatMessage } from "../core/util";
|
|
68
67
|
const withPageContext = (WrappedComponent, addPageScript, getVariables, componentInfo, prefabInfo) => {
|
|
69
68
|
const PageContextComponent = (props) => {
|
|
70
|
-
var _a, _b, _c
|
|
69
|
+
var _a, _b, _c;
|
|
71
70
|
const dispatch = useAppDispatch();
|
|
72
71
|
const { show, hide } = (_a = useAppSpinner()) != null ? _a : {};
|
|
73
72
|
const i18n = useAppSelector((state) => state.i18n);
|
|
@@ -147,8 +146,7 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
147
146
|
date: i18n.dateFormat,
|
|
148
147
|
time: i18n.timeFormat,
|
|
149
148
|
currency: i18n.currencyCode
|
|
150
|
-
}
|
|
151
|
-
i18n
|
|
149
|
+
}
|
|
152
150
|
}, prefabInfo), props), componentInfo), {
|
|
153
151
|
executeStartup,
|
|
154
152
|
formatters,
|
|
@@ -276,7 +274,6 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
276
274
|
}
|
|
277
275
|
isInitializingRef.current = true;
|
|
278
276
|
const initializeComponent = async () => {
|
|
279
|
-
var _a2;
|
|
280
277
|
try {
|
|
281
278
|
overriddenPropsRegistryRef.current = createOverriddenPropsRegistry();
|
|
282
279
|
const pageProxy = createStateProxy(
|
|
@@ -306,15 +303,12 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
306
303
|
pageProxy.pageParams = newParams;
|
|
307
304
|
if ((componentInfo == null ? void 0 : componentInfo.componentType) !== "PAGE") {
|
|
308
305
|
pageProxy.partialParams = newParams;
|
|
309
|
-
(_a2 = props.onLoad) == null ? void 0 : _a2.call(props, pageProxy);
|
|
310
306
|
}
|
|
311
307
|
const mergedAppLocale = i18n.appLocale || {};
|
|
312
308
|
if (!appProxy.appLocale) {
|
|
313
309
|
appProxy.appLocale = {};
|
|
314
310
|
}
|
|
315
|
-
|
|
316
|
-
appProxy.appLocale = __spreadValues({}, mergedAppLocale);
|
|
317
|
-
}
|
|
311
|
+
appProxy.appLocale = __spreadValues({}, mergedAppLocale);
|
|
318
312
|
const localeFormats = {
|
|
319
313
|
date: i18n.dateFormat,
|
|
320
314
|
time: i18n.timeFormat,
|
|
@@ -395,6 +389,9 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
395
389
|
}
|
|
396
390
|
});
|
|
397
391
|
subscriptionsRef.current = [];
|
|
392
|
+
if ((componentInfo == null ? void 0 : componentInfo.componentName) && (componentInfo == null ? void 0 : componentInfo.componentType) == "PARTIAL" && appProxy && pageProxyRef.current && appProxy[componentInfo.componentName]) {
|
|
393
|
+
appProxy[componentInfo.componentName] = void 0;
|
|
394
|
+
}
|
|
398
395
|
};
|
|
399
396
|
}, [shouldInitialize]);
|
|
400
397
|
useEffect(() => {
|
|
@@ -579,72 +576,37 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
579
576
|
if (isLocaleSwitch && pageProxyRef.current) {
|
|
580
577
|
pageProxyRef.current.Widgets = {};
|
|
581
578
|
}
|
|
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
|
-
}
|
|
623
|
-
}
|
|
624
|
-
useEffect(() => {
|
|
625
579
|
const newAppLocale = merge({}, i18n.appLocale || {}, (prefabInfo == null ? void 0 : prefabInfo.appLocale) || {});
|
|
626
|
-
if (!isEqual(pageContext.appLocale, newAppLocale)) {
|
|
627
|
-
setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
628
|
-
appLocale: newAppLocale
|
|
629
|
-
}));
|
|
630
|
-
}
|
|
631
|
-
}, [i18n.appLocale]);
|
|
632
|
-
useEffect(() => {
|
|
633
580
|
const localeFormats = {
|
|
634
581
|
date: i18n.dateFormat,
|
|
635
582
|
time: i18n.timeFormat,
|
|
636
583
|
currency: i18n.currencyCode
|
|
637
584
|
};
|
|
638
|
-
setPageContext((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
639
|
-
localeFormats
|
|
640
|
-
}));
|
|
641
585
|
if (pageProxyRef.current) {
|
|
586
|
+
const appLocaleChanged = !isEqual(pageProxyRef.current.appLocale, newAppLocale);
|
|
587
|
+
if (appLocaleChanged) {
|
|
588
|
+
appProxy.appLocale = newAppLocale;
|
|
589
|
+
pageProxyRef.current.appLocale = newAppLocale;
|
|
590
|
+
pageProxyRef.current.App.appLocale = newAppLocale;
|
|
591
|
+
}
|
|
642
592
|
pageProxyRef.current.localeFormats = localeFormats;
|
|
643
593
|
if (pageProxyRef.current.App) {
|
|
644
594
|
pageProxyRef.current.App.localeFormats = localeFormats;
|
|
645
595
|
}
|
|
646
596
|
}
|
|
647
|
-
|
|
597
|
+
setPageContext((prev) => {
|
|
598
|
+
const appLocaleChanged = !isEqual(prev.appLocale, newAppLocale);
|
|
599
|
+
if (prev.selectedLocale === i18n.selectedLocale && !appLocaleChanged) {
|
|
600
|
+
return __spreadProps(__spreadValues({}, prev), { localeFormats });
|
|
601
|
+
}
|
|
602
|
+
return __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, prev), {
|
|
603
|
+
selectedLocale: i18n.selectedLocale
|
|
604
|
+
}), isLocaleSwitch && { Widgets: {} }), {
|
|
605
|
+
appLocale: newAppLocale,
|
|
606
|
+
localeFormats
|
|
607
|
+
});
|
|
608
|
+
});
|
|
609
|
+
}, [i18n.selectedLocale, i18n.appLocale, i18n.dateFormat, i18n.timeFormat, i18n.currencyCode]);
|
|
648
610
|
const pageName = (appProxy == null ? void 0 : appProxy.activePageName) || "";
|
|
649
611
|
useEffect(() => {
|
|
650
612
|
if ((componentInfo == null ? void 0 : componentInfo.componentType) === "PARTIAL" && pageName) {
|
|
@@ -658,7 +620,11 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
658
620
|
useEffect(() => {
|
|
659
621
|
if (isInitialized && isPageReady && isMountedRef.current && !onStartupCompletedRef.current && pageProxyRef.current) {
|
|
660
622
|
const runStartup = async () => {
|
|
623
|
+
var _a2;
|
|
661
624
|
if (!isMountedRef.current) return;
|
|
625
|
+
if ((componentInfo == null ? void 0 : componentInfo.componentType) !== "PAGE") {
|
|
626
|
+
(_a2 = props.onLoad) == null ? void 0 : _a2.call(props, pageProxyRef.current);
|
|
627
|
+
}
|
|
662
628
|
if ((securityConfig == null ? void 0 : securityConfig.authenticated) && (appProxy == null ? void 0 : appProxy.executeSessionFailureRequests)) {
|
|
663
629
|
await appProxy.executeSessionFailureRequests();
|
|
664
630
|
}
|
|
@@ -702,14 +668,14 @@ const withPageContext = (WrappedComponent, addPageScript, getVariables, componen
|
|
|
702
668
|
((_a2 = appVariables[value]) == null ? void 0 : _a2.invokeOnParamChange) && ((_b2 = appVariables[value]) == null ? void 0 : _b2.invokeOnParamChange());
|
|
703
669
|
});
|
|
704
670
|
}
|
|
705
|
-
if (((
|
|
671
|
+
if (((_c = componentInfo == null ? void 0 : componentInfo.autoUpdateVariables) == null ? void 0 : _c.length) && onStartupCompletedRef.current) {
|
|
706
672
|
const pageVariables = pageContext.Variables;
|
|
707
673
|
componentInfo.autoUpdateVariables.forEach((value) => {
|
|
708
674
|
var _a2, _b2;
|
|
709
675
|
(_b2 = (_a2 = pageVariables[value]) == null ? void 0 : _a2.invokeOnParamChange) == null ? void 0 : _b2.call(_a2);
|
|
710
676
|
});
|
|
711
677
|
}
|
|
712
|
-
return /* @__PURE__ */ jsx(WidgetProvider, { value: { value: pageContext, proxy: pageProxyRef.current }, children: /* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props)
|
|
678
|
+
return /* @__PURE__ */ jsx(WidgetProvider, { value: { value: pageContext, proxy: pageProxyRef.current }, children: /* @__PURE__ */ jsx(WrappedComponent, __spreadValues({}, props)) });
|
|
713
679
|
};
|
|
714
680
|
PageContextComponent.displayName = `WithPageContext(${WrappedComponent.displayName || WrappedComponent.name || "Component"})`;
|
|
715
681
|
return PageContextComponent;
|
package/higherOrder/DataNav.js
CHANGED
|
@@ -419,13 +419,16 @@ const withDatasetAwareNavigation = (WrappedComponent) => {
|
|
|
419
419
|
if (!navNodes || navNodes.length === 0) {
|
|
420
420
|
return navNodes;
|
|
421
421
|
}
|
|
422
|
+
if (!itemid && !binditemid.current) {
|
|
423
|
+
return navNodes;
|
|
424
|
+
}
|
|
422
425
|
const currentRouteId = getCurrentRouteId();
|
|
423
426
|
if (!currentRouteId) {
|
|
424
427
|
return [];
|
|
425
428
|
}
|
|
426
429
|
const breadcrumbPath = findPathToNode(navNodes, currentRouteId);
|
|
427
430
|
return breadcrumbPath.length > 0 ? breadcrumbPath : [];
|
|
428
|
-
}, [navNodes]);
|
|
431
|
+
}, [navNodes, itemid]);
|
|
429
432
|
return /* @__PURE__ */ jsx(
|
|
430
433
|
WrappedComponent,
|
|
431
434
|
__spreadProps(__spreadValues({}, props), {
|
|
@@ -57,7 +57,6 @@ const withBaseWrapper = (WrappedComponent) => {
|
|
|
57
57
|
}
|
|
58
58
|
}, [name, pageContext == null ? void 0 : pageContext.Widgets, componentWidgetId, props]);
|
|
59
59
|
const mergedProps = useMemo(() => {
|
|
60
|
-
var _a2;
|
|
61
60
|
if (!name || !(pageContext == null ? void 0 : pageContext.Widgets) || (props == null ? void 0 : props.iswidget) === "false") {
|
|
62
61
|
return props;
|
|
63
62
|
}
|
|
@@ -73,8 +72,8 @@ const withBaseWrapper = (WrappedComponent) => {
|
|
|
73
72
|
const widgetOverrides = registry == null ? void 0 : registry.getWidgetOverrides(name, componentWidgetId || "");
|
|
74
73
|
if (widgetOverrides) {
|
|
75
74
|
Object.keys(widgetOverrides).forEach((key) => {
|
|
76
|
-
var
|
|
77
|
-
const internalValue = (
|
|
75
|
+
var _a2;
|
|
76
|
+
const internalValue = (_a2 = registry == null ? void 0 : registry.getLastInternalValue) == null ? void 0 : _a2.call(registry, name, key);
|
|
78
77
|
mergedState[key] = internalValue !== void 0 ? internalValue : widgetOverrides[key];
|
|
79
78
|
if (props.prefab && key !== "inbound" && key !== "outbound" && key !== "show") {
|
|
80
79
|
const updatedInbound = __spreadProps(__spreadValues({}, props.inbound), {
|
|
@@ -95,7 +94,7 @@ const withBaseWrapper = (WrappedComponent) => {
|
|
|
95
94
|
});
|
|
96
95
|
}
|
|
97
96
|
} else if (shouldMergeFromContext) {
|
|
98
|
-
mergedState = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, widget), props), (props == null ? void 0 : props.formfield) ? { datavalue: props.datavalue } : { datavalue:
|
|
97
|
+
mergedState = __spreadValues(__spreadValues(__spreadValues(__spreadValues({}, widget), props), (props == null ? void 0 : props.formfield) ? { datavalue: props.datavalue } : { datavalue: datavalue != null ? datavalue : widgetDatavalue }), component === "WmFormField" && !props["value"] && { value: datavalue, datavalue });
|
|
99
98
|
} else {
|
|
100
99
|
mergedState = __spreadValues(__spreadValues({}, props), component === "WmFormField" && !props["value"] && { value: datavalue, datavalue });
|
|
101
100
|
}
|
package/hooks/useHttp.js
CHANGED
|
@@ -157,7 +157,7 @@ class ModernHttpService {
|
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
159
|
async send(options, variable) {
|
|
160
|
-
var _a, _b;
|
|
160
|
+
var _a, _b, _c, _d;
|
|
161
161
|
const serviceInfo = variable.serviceInfo;
|
|
162
162
|
let headers = new AxiosHeaders(options.headers);
|
|
163
163
|
let requestBody = options.data;
|
|
@@ -178,8 +178,10 @@ class ModernHttpService {
|
|
|
178
178
|
url = variable.config.baseUrl + options.url.replace("./", "/");
|
|
179
179
|
} else if (url === (serviceInfo == null ? void 0 : serviceInfo.directPath) && options.url.startsWith("http")) {
|
|
180
180
|
url = options.url;
|
|
181
|
+
} else if (variable.config.baseUrl.includes("/services") && ((_b = options.url) == null ? void 0 : _b.includes("/services"))) {
|
|
182
|
+
url = variable.config.baseUrl + ((_c = options.url.replace("./services", "")) == null ? void 0 : _c.replace("./", "/"));
|
|
181
183
|
} else {
|
|
182
|
-
url = variable.config.baseUrl + ((
|
|
184
|
+
url = variable.config.baseUrl + ((_d = options.url) == null ? void 0 : _d.replace("./", "/"));
|
|
183
185
|
}
|
|
184
186
|
if (!options.isDirectCall) {
|
|
185
187
|
headers = headers.set("X-Requested-With", "XMLHttpRequest");
|
package/hooks/useLayoutSize.js
CHANGED
|
@@ -3,7 +3,7 @@ import { layoutSizeUtil } from "../utils/layoutsize-util";
|
|
|
3
3
|
function useLayoutSize(ref, layoutWidth, layoutHeight) {
|
|
4
4
|
useLayoutEffect(() => {
|
|
5
5
|
if (ref.current && (layoutWidth || layoutHeight)) {
|
|
6
|
-
layoutSizeUtil(ref.current, layoutWidth, layoutHeight);
|
|
6
|
+
layoutSizeUtil(ref.current, layoutWidth == null ? void 0 : layoutWidth.trim(), layoutHeight == null ? void 0 : layoutHeight.trim());
|
|
7
7
|
}
|
|
8
8
|
}, [layoutWidth, layoutHeight]);
|
|
9
9
|
}
|