@owp/core 2.3.0 → 2.4.0
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/dist/_virtual/index10.js +2 -2
- package/dist/_virtual/index12.js +2 -2
- package/dist/_virtual/index13.js +2 -2
- package/dist/_virtual/index14.js +2 -2
- package/dist/_virtual/index15.js +2 -2
- package/dist/_virtual/index5.js +2 -2
- package/dist/components/OwpDialog/OwpDialog.js +30 -32
- package/dist/components/OwpDialog/OwpDialog.js.map +1 -1
- package/dist/components/OwpLayout/OwpLayout.js +39 -39
- package/dist/components/OwpLayout/OwpLayout.js.map +1 -1
- package/dist/components/OwpMrtTable/OwpMrtTable.js +393 -255
- package/dist/components/OwpMrtTable/OwpMrtTable.js.map +1 -1
- package/dist/components/OwpTable/OwpDataTable.js +45 -45
- package/dist/components/OwpTable/OwpDataTable.js.map +1 -1
- package/dist/components/OwpTable/OwpTable.js +6 -6
- package/dist/components/OwpTable/OwpTable.js.map +1 -1
- package/dist/components/OwpTable/OwpVerticalTable.js +55 -53
- package/dist/components/OwpTable/OwpVerticalTable.js.map +1 -1
- package/dist/components/OwpTreeGrid/OwpTreeGrid.js +169 -148
- package/dist/components/OwpTreeGrid/OwpTreeGrid.js.map +1 -1
- package/dist/components/OwpTreeGrid/internal/OwpTreeGridLoadingOverlay.js +1 -1
- package/dist/components/OwpTreeGrid/internal/OwpTreeGridLoadingOverlay.js.map +1 -1
- package/dist/components/OwpTreeGrid/internal/OwpTreeGridNoDataOverlay.js +1 -1
- package/dist/components/OwpTreeGrid/internal/OwpTreeGridNoDataOverlay.js.map +1 -1
- package/dist/components/OwpTreeGrid/{hooks → internal/hooks}/useOwpTreeGridOverlayFrame.js +1 -1
- package/dist/components/OwpTreeGrid/internal/hooks/useOwpTreeGridOverlayFrame.js.map +1 -0
- package/dist/components/OwpTreeGrid/internal/treeGridColumnEditRules.js +84 -0
- package/dist/components/OwpTreeGrid/internal/treeGridColumnEditRules.js.map +1 -0
- package/dist/components/OwpTreeGrid/internal/treeGridRuntime.js +114 -103
- package/dist/components/OwpTreeGrid/internal/treeGridRuntime.js.map +1 -1
- package/dist/components/OwpTreeGrid/internal/utils/perf.js.map +1 -0
- package/dist/constants/storageKeys.js +1 -0
- package/dist/constants/storageKeys.js.map +1 -1
- package/dist/hooks/useCurrentUserSeq.js +11 -0
- package/dist/hooks/useCurrentUserSeq.js.map +1 -0
- package/dist/hooks.js +67 -64
- package/dist/hooks.js.map +1 -1
- package/dist/index.js +58 -59
- package/dist/layout/Layout.js +24 -24
- package/dist/layout/Layout.js.map +1 -1
- package/dist/layout/themeLayouts.js.map +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE128/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE39/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/CODE93/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/EAN_UPC/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/GenericBarcode/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/ITF/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/MSI/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/codabar/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/barcodes/pharmacode/index.js +1 -1
- package/dist/node_modules/.pnpm/jsbarcode@3.12.1/node_modules/jsbarcode/bin/renderers/index.js +1 -1
- package/dist/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +1 -1
- package/dist/owp-app.css +1 -1
- package/dist/types/components/OwpDialog/OwpDialog.d.ts +1 -9
- package/dist/types/components/OwpMrtTable/OwpMrtTable.d.ts +9 -0
- package/dist/types/components/OwpTable/OwpVerticalTable.d.ts +3 -1
- package/dist/types/components/OwpTreeGrid/OwpTreeGrid.d.ts +7 -1
- package/dist/types/components/OwpTreeGrid/index.d.ts +1 -1
- package/dist/types/components/OwpTreeGrid/internal/OwpTreeGridLoadingOverlay.d.ts +1 -1
- package/dist/types/components/OwpTreeGrid/internal/OwpTreeGridNoDataOverlay.d.ts +1 -1
- package/dist/types/components/OwpTreeGrid/internal/treeGridColumnEditRules.d.ts +60 -0
- package/dist/types/components/OwpTreeGrid/internal/treeGridRuntime.d.ts +7 -2
- package/dist/types/constants/storageKeys.d.ts +1 -0
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/useCurrentUserSeq.d.ts +8 -0
- package/dist/types/layout/Layout.d.ts +2 -0
- package/dist/types/layout/themeLayouts.d.ts +2 -0
- package/dist/types/utils/treeGridExportExcelUtil.d.ts +0 -4
- package/dist/types/utils/treeGridUtil.d.ts +0 -59
- package/dist/utils/treeGridExportExcelUtil.js +57 -58
- package/dist/utils/treeGridExportExcelUtil.js.map +1 -1
- package/dist/utils/treeGridUtil.js +69 -83
- package/dist/utils/treeGridUtil.js.map +1 -1
- package/dist/utils.js +71 -86
- package/package.json +2 -2
- package/dist/components/OwpTreeGrid/hooks/useOwpTreeGridOverlayFrame.js.map +0 -1
- package/dist/components/OwpTreeGrid/utils/perf.js.map +0 -1
- /package/dist/components/OwpTreeGrid/{utils → internal/utils}/perf.js +0 -0
- /package/dist/types/components/OwpTreeGrid/{hooks → internal/hooks}/useOwpTreeGridOverlayFrame.d.ts +0 -0
- /package/dist/types/components/OwpTreeGrid/{utils → internal/utils}/perf.d.ts +0 -0
package/dist/_virtual/index10.js
CHANGED
package/dist/_virtual/index12.js
CHANGED
package/dist/_virtual/index13.js
CHANGED
package/dist/_virtual/index14.js
CHANGED
package/dist/_virtual/index15.js
CHANGED
package/dist/_virtual/index5.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
var v = Object.defineProperty;
|
|
2
2
|
var c = (i, e) => v(i, "name", { value: e, configurable: !0 });
|
|
3
3
|
import { jsxs as l, jsx as r } from "../../node_modules/.pnpm/@emotion_react@11.14.0_@types_react@19.2.14_react@19.2.4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
|
|
4
|
-
import { useOwpTranslation as
|
|
5
|
-
import { DialogContent as
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
const
|
|
4
|
+
import { useOwpTranslation as s } from "../../hooks/useOwpTranslation.js";
|
|
5
|
+
import { DialogContent as O, DialogActions as j, Dialog as K, DialogTitle as N, Box as b, Button as m } from "@mui/material";
|
|
6
|
+
import { forwardRef as A } from "react";
|
|
7
|
+
const R = A(
|
|
8
8
|
({
|
|
9
9
|
title: i,
|
|
10
10
|
children: e,
|
|
11
|
-
canCancel:
|
|
11
|
+
canCancel: x = !0,
|
|
12
12
|
canConfirm: a = !0,
|
|
13
|
-
confirmText:
|
|
14
|
-
cancelText:
|
|
15
|
-
onConfirm:
|
|
16
|
-
onCancel:
|
|
13
|
+
confirmText: D,
|
|
14
|
+
cancelText: h,
|
|
15
|
+
onConfirm: f,
|
|
16
|
+
onCancel: o,
|
|
17
17
|
onClose: t,
|
|
18
18
|
useSubmit: n,
|
|
19
|
-
actions:
|
|
20
|
-
contentProps:
|
|
19
|
+
actions: u,
|
|
20
|
+
contentProps: w,
|
|
21
21
|
...y
|
|
22
|
-
},
|
|
23
|
-
const { t:
|
|
22
|
+
}, g) => {
|
|
23
|
+
const { t: d } = s(), T = D ?? d("Button.저장"), B = h ?? d(a ? "Button.취소" : "Button.닫기");
|
|
24
24
|
return /* @__PURE__ */ l(
|
|
25
|
-
|
|
25
|
+
K,
|
|
26
26
|
{
|
|
27
|
-
ref:
|
|
27
|
+
ref: g,
|
|
28
28
|
fullWidth: !0,
|
|
29
29
|
component: n ? "form" : void 0,
|
|
30
|
-
onClose: /* @__PURE__ */ c((
|
|
31
|
-
|
|
30
|
+
onClose: /* @__PURE__ */ c((k, p) => {
|
|
31
|
+
p !== "backdropClick" && (t == null || t(k, p));
|
|
32
32
|
}, "onClose"),
|
|
33
33
|
...y,
|
|
34
34
|
children: [
|
|
35
|
-
i && /* @__PURE__ */ r(
|
|
36
|
-
/* @__PURE__ */ r(
|
|
37
|
-
/* @__PURE__ */ l(
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
i && /* @__PURE__ */ r(N, { children: i }),
|
|
36
|
+
/* @__PURE__ */ r(O, { dividers: !0, ...w, children: e }),
|
|
37
|
+
/* @__PURE__ */ l(j, { children: [
|
|
38
|
+
u && /* @__PURE__ */ r(b, { className: "flex w-full items-start", children: u }),
|
|
39
|
+
x && /* @__PURE__ */ r(
|
|
40
40
|
m,
|
|
41
41
|
{
|
|
42
42
|
variant: "outlined",
|
|
43
43
|
onClick: /* @__PURE__ */ c(() => {
|
|
44
|
-
if (typeof
|
|
45
|
-
|
|
44
|
+
if (typeof o == "function") {
|
|
45
|
+
o();
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
t == null || t({}, "escapeKeyDown");
|
|
49
49
|
}, "onClick"),
|
|
50
|
-
children:
|
|
50
|
+
children: B
|
|
51
51
|
}
|
|
52
52
|
),
|
|
53
53
|
a && /* @__PURE__ */ r(
|
|
@@ -58,14 +58,14 @@ const x = R(
|
|
|
58
58
|
type: n ? "submit" : "button",
|
|
59
59
|
onClick: /* @__PURE__ */ c(() => {
|
|
60
60
|
if (!n) {
|
|
61
|
-
if (typeof
|
|
62
|
-
|
|
61
|
+
if (typeof f == "function") {
|
|
62
|
+
f();
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
65
|
t == null || t({}, "escapeKeyDown");
|
|
66
66
|
}
|
|
67
67
|
}, "onClick"),
|
|
68
|
-
children:
|
|
68
|
+
children: T
|
|
69
69
|
}
|
|
70
70
|
)
|
|
71
71
|
] })
|
|
@@ -74,10 +74,8 @@ const x = R(
|
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
);
|
|
77
|
-
|
|
78
|
-
const G = x;
|
|
77
|
+
R.displayName = "OwpDialog";
|
|
79
78
|
export {
|
|
80
|
-
|
|
81
|
-
x as OwpDialog
|
|
79
|
+
R as OwpDialog
|
|
82
80
|
};
|
|
83
81
|
//# sourceMappingURL=OwpDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OwpDialog.js","sources":["../../../src/components/OwpDialog/OwpDialog.tsx"],"sourcesContent":["import { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport {\n Box,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentProps,\n DialogProps,\n DialogTitle,\n} from '@mui/material';\nimport { forwardRef, ReactNode } from 'react';\n\nexport interface OwpDialogProps extends Omit<DialogProps, 'title'> {\n title?: ReactNode;\n children?: ReactNode;\n canConfirm?: boolean;\n canCancel?: boolean;\n confirmText?: string;\n cancelText?: string;\n useSubmit?: boolean;\n actions?: ReactNode;\n contentProps?: DialogContentProps;\n onConfirm?: () => void;\n onCancel?: () => void;\n}\n\n/**\n * OwpDialog 컴포넌트\n * @param title 제목\n * @param children 하위 콘텐츠\n * @param canCancel canCancel 값\n * @param canConfirm canConfirm 값\n * @param onConfirm onConfirm 핸들러\n * @param onCancel onCancel 핸들러\n */\nconst OwpDialog = forwardRef<HTMLDivElement, OwpDialogProps>(\n (\n {\n title,\n children,\n canCancel = true,\n canConfirm = true,\n confirmText: confirmTextProp,\n cancelText: cancelTextProp,\n onConfirm,\n onCancel,\n onClose,\n useSubmit,\n actions,\n contentProps,\n ...dialogProps\n },\n ref,\n ) => {\n const { t } = useOwpTranslation();\n const confirmText = confirmTextProp ?? t('Button.저장');\n const cancelText = cancelTextProp ?? t(canConfirm ? 'Button.취소' : 'Button.닫기');\n\n return (\n <Dialog\n ref={ref}\n fullWidth\n component={useSubmit ? 'form' : undefined}\n onClose={(event, reason) => {\n if (reason === 'backdropClick') {\n return;\n }\n\n onClose?.(event, reason);\n }}\n {...dialogProps}\n >\n {title && <DialogTitle>{title}</DialogTitle>}\n <DialogContent dividers {...contentProps}>\n {children}\n </DialogContent>\n <DialogActions>\n {actions && <Box className=\"flex w-full items-start\">{actions}</Box>}\n {canCancel && (\n <Button\n variant=\"outlined\"\n onClick={() => {\n if (typeof onCancel === 'function') {\n onCancel();\n return;\n }\n\n onClose?.({}, 'escapeKeyDown');\n }}\n >\n {cancelText}\n </Button>\n )}\n {canConfirm && (\n <Button\n variant=\"contained\"\n color=\"secondary\"\n type={useSubmit ? 'submit' : 'button'}\n onClick={() => {\n if (useSubmit) {\n return;\n }\n\n if (typeof onConfirm === 'function') {\n onConfirm();\n return;\n }\n\n onClose?.({}, 'escapeKeyDown');\n }}\n >\n {confirmText}\n </Button>\n )}\n </DialogActions>\n </Dialog>\n );\n },\n);\n\nOwpDialog.displayName = 'OwpDialog';\
|
|
1
|
+
{"version":3,"file":"OwpDialog.js","sources":["../../../src/components/OwpDialog/OwpDialog.tsx"],"sourcesContent":["import { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport {\n Box,\n Button,\n Dialog,\n DialogActions,\n DialogContent,\n DialogContentProps,\n DialogProps,\n DialogTitle,\n} from '@mui/material';\nimport { forwardRef, ReactNode } from 'react';\n\nexport interface OwpDialogProps extends Omit<DialogProps, 'title'> {\n title?: ReactNode;\n children?: ReactNode;\n canConfirm?: boolean;\n canCancel?: boolean;\n confirmText?: string;\n cancelText?: string;\n useSubmit?: boolean;\n actions?: ReactNode;\n contentProps?: DialogContentProps;\n onConfirm?: () => void;\n onCancel?: () => void;\n}\n\n/**\n * OwpDialog 컴포넌트\n * @param title 제목\n * @param children 하위 콘텐츠\n * @param canCancel canCancel 값\n * @param canConfirm canConfirm 값\n * @param onConfirm onConfirm 핸들러\n * @param onCancel onCancel 핸들러\n */\nconst OwpDialog = forwardRef<HTMLDivElement, OwpDialogProps>(\n (\n {\n title,\n children,\n canCancel = true,\n canConfirm = true,\n confirmText: confirmTextProp,\n cancelText: cancelTextProp,\n onConfirm,\n onCancel,\n onClose,\n useSubmit,\n actions,\n contentProps,\n ...dialogProps\n },\n ref,\n ) => {\n const { t } = useOwpTranslation();\n const confirmText = confirmTextProp ?? t('Button.저장');\n const cancelText = cancelTextProp ?? t(canConfirm ? 'Button.취소' : 'Button.닫기');\n\n return (\n <Dialog\n ref={ref}\n fullWidth\n component={useSubmit ? 'form' : undefined}\n onClose={(event, reason) => {\n if (reason === 'backdropClick') {\n return;\n }\n\n onClose?.(event, reason);\n }}\n {...dialogProps}\n >\n {title && <DialogTitle>{title}</DialogTitle>}\n <DialogContent dividers {...contentProps}>\n {children}\n </DialogContent>\n <DialogActions>\n {actions && <Box className=\"flex w-full items-start\">{actions}</Box>}\n {canCancel && (\n <Button\n variant=\"outlined\"\n onClick={() => {\n if (typeof onCancel === 'function') {\n onCancel();\n return;\n }\n\n onClose?.({}, 'escapeKeyDown');\n }}\n >\n {cancelText}\n </Button>\n )}\n {canConfirm && (\n <Button\n variant=\"contained\"\n color=\"secondary\"\n type={useSubmit ? 'submit' : 'button'}\n onClick={() => {\n if (useSubmit) {\n return;\n }\n\n if (typeof onConfirm === 'function') {\n onConfirm();\n return;\n }\n\n onClose?.({}, 'escapeKeyDown');\n }}\n >\n {confirmText}\n </Button>\n )}\n </DialogActions>\n </Dialog>\n );\n },\n);\n\nOwpDialog.displayName = 'OwpDialog';\nexport { OwpDialog };\n"],"names":["OwpDialog","forwardRef","title","children","canCancel","canConfirm","confirmTextProp","cancelTextProp","onConfirm","onCancel","onClose","useSubmit","actions","contentProps","dialogProps","ref","t","useOwpTranslation","confirmText","cancelText","jsxs","Dialog","__name","event","reason","jsx","DialogTitle","DialogContent","DialogActions","Box","Button"],"mappings":";;;;;;AAoCA,MAAMA,IAAYC;AAAA,EAChB,CACE;AAAA,IACE,OAAAC;AAA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AA,gBACC,SAAQ;AAAA,gBACR,OAAM;AAAA,gBACN,MAAMnB,IAAY,WAAW;AAAA,gBAC7B,SAAS,gBAAAW,EAAA,MAAM;AACb,sBAAI,CAAAX,GAIJ;AAAA,wBAAI,OAAOH,KAAc,YAAY;AACnC,sBAAAA,EAAA;AACA;AAAA,oBACF;AAEA,oBAAAE,KAAA,QAAAA,EAAU,CAAA,GAAI;AAAA;AAAA,gBAChB,GAXS;AAAA,gBAaR,UAAAQ;AAAA,cAAA;AAAA,YAAA;AAAA,UACH,EAAA,CAEJ;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AACF;AAEAlB,EAAU,cAAc;"}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
var
|
|
2
|
-
var g = (
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { themeLayouts as
|
|
5
|
-
import { useOwpAppContext as
|
|
6
|
-
import { generateSettings as
|
|
7
|
-
import { useOwpTranslation as
|
|
8
|
-
import { useSetSettings as
|
|
9
|
-
import { useRef as
|
|
10
|
-
import { useLocation as
|
|
11
|
-
import { isEqual as
|
|
12
|
-
import { merge as
|
|
13
|
-
import { OwpLoading as
|
|
14
|
-
function
|
|
15
|
-
var
|
|
16
|
-
const { routesConfig:
|
|
17
|
-
() =>
|
|
18
|
-
[
|
|
19
|
-
),
|
|
20
|
-
() =>
|
|
21
|
-
[
|
|
22
|
-
);
|
|
23
|
-
return
|
|
24
|
-
|
|
25
|
-
}, [
|
|
1
|
+
var O = Object.defineProperty;
|
|
2
|
+
var g = (a, e) => O(a, "name", { value: e, configurable: !0 });
|
|
3
|
+
import { jsx as z } from "../../node_modules/.pnpm/@emotion_react@11.14.0_@types_react@19.2.14_react@19.2.4/node_modules/@emotion/react/jsx-runtime/dist/emotion-react-jsx-runtime.browser.esm.js";
|
|
4
|
+
import { themeLayouts as P } from "../../layout/themeLayouts.js";
|
|
5
|
+
import { useOwpAppContext as v } from "../../contexts/OwpAppProvider.js";
|
|
6
|
+
import { generateSettings as x } from "../../configs/defaultConfig.js";
|
|
7
|
+
import { useOwpTranslation as j } from "../../hooks/useOwpTranslation.js";
|
|
8
|
+
import { useSetSettings as B, useGetCurrentSettings as E, useGetDefaultSettings as F } from "../../hooks/useOwpSettings.js";
|
|
9
|
+
import { useRef as G, useMemo as l, useEffect as h } from "react";
|
|
10
|
+
import { useLocation as M, matchRoutes as T } from "react-router-dom";
|
|
11
|
+
import { isEqual as b } from "../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/predicate/isEqual.js";
|
|
12
|
+
import { merge as k } from "../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/object/merge.js";
|
|
13
|
+
import { OwpLoading as q } from "../OwpLoading/OwpLoading.js";
|
|
14
|
+
function $(a) {
|
|
15
|
+
var L, w;
|
|
16
|
+
const { routesConfig: e } = v(), { i18n: n } = j(), { layouts: f = P, children: c } = a, m = B(), r = E(), i = F(), d = M(), { pathname: t } = d, y = G(!1), p = l(
|
|
17
|
+
() => A(e, t, "settings", !0),
|
|
18
|
+
[t, e]
|
|
19
|
+
), s = l(() => p === void 0 ? i : x(i, p), [i, p]), o = l(
|
|
20
|
+
() => r === s || b(s, r),
|
|
21
|
+
[s, r]
|
|
22
|
+
), u = o ? r : s, S = (L = u == null ? void 0 : u.layout) == null ? void 0 : L.style, I = (w = u == null ? void 0 : u.layout) == null ? void 0 : w.config;
|
|
23
|
+
return h(() => {
|
|
24
|
+
o || m(s);
|
|
25
|
+
}, [s, o, m]), h(() => {
|
|
26
26
|
window.scrollTo(0, 0);
|
|
27
|
-
}, [
|
|
28
|
-
|
|
29
|
-
}, [
|
|
27
|
+
}, [t]), h(() => {
|
|
28
|
+
o && n.isInitialized && (y.current = !0);
|
|
29
|
+
}, [n.isInitialized, o]), l(() => !n.isInitialized || !o && !y.current ? /* @__PURE__ */ z(q, {}) : Object.entries(f).map(([R, C]) => R === S ? /* @__PURE__ */ z(C, { layoutConfig: I, children: c }, R) : null), [c, n.isInitialized, o, I, S, f]);
|
|
30
30
|
}
|
|
31
|
-
g(
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
if (!
|
|
31
|
+
g($, "OwpLayout");
|
|
32
|
+
function A(a, e, n, f = !0) {
|
|
33
|
+
const c = T(a, e);
|
|
34
|
+
if (!c)
|
|
35
35
|
return;
|
|
36
|
-
let
|
|
37
|
-
const
|
|
38
|
-
const
|
|
39
|
-
return
|
|
36
|
+
let m = !1;
|
|
37
|
+
const r = c.reduce((i, d) => {
|
|
38
|
+
const t = d.route[n];
|
|
39
|
+
return t === void 0 ? i : (m = !0, !f || t === null ? t : k(i ?? {}, t));
|
|
40
40
|
}, void 0);
|
|
41
|
-
return
|
|
41
|
+
return m ? r : void 0;
|
|
42
42
|
}
|
|
43
|
-
g(
|
|
43
|
+
g(A, "getRouteParamUtil");
|
|
44
44
|
export {
|
|
45
|
-
|
|
45
|
+
$ as OwpLayout
|
|
46
46
|
};
|
|
47
47
|
//# sourceMappingURL=OwpLayout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OwpLayout.js","sources":["../../../src/components/OwpLayout/OwpLayout.tsx"],"sourcesContent":["import { themeLayouts, themeLayoutsType } from '@/layout/themeLayouts';\nimport { useOwpAppContext } from '@/contexts/OwpAppProvider';\nimport { generateSettings } from '@/configs/defaultConfig';\nimport { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport {\n useGetCurrentSettings,\n useGetDefaultSettings,\n useSetSettings,\n} from '@/hooks/useOwpSettings';\nimport type { OwpSettingsConfigType } from '@/types/OwpSettingsTypes';\nimport { OwpRoutesType } from '@/utils/common/OwpUtils';\nimport { isEqual, merge } from 'es-toolkit/compat';\nimport { type ReactNode, useEffect, useMemo, useRef } from 'react';\nimport { matchRoutes, RouteMatch, RouteObject, useLocation } from 'react-router-dom';\nimport { OwpLoading } from '../OwpLoading';\n\nexport type OwpRouteObjectType = RouteObject & {\n settings?: OwpSettingsConfigType;\n auth?: string[] | [] | null | undefined;\n};\n\nexport type OwpRouteMatchType = RouteMatch & {\n route: OwpRouteObjectType;\n};\n\ntype OwpLayoutProps = {\n layouts?: themeLayoutsType;\n children?: ReactNode;\n};\n\n/**\n * OwpLayout\n * React frontend component in a React project that is used for layouting the user interface. The component\n * handles generating user interface settings related to current routes, merged with default settings, and uses\n * the new settings to generate layouts.\n */\nfunction OwpLayout(props: OwpLayoutProps) {\n const { routesConfig } = useOwpAppContext();\n const { i18n } = useOwpTranslation();\n\n const { layouts = themeLayouts, children } = props;\n const setSettings = useSetSettings();\n const settings = useGetCurrentSettings();\n const defaultSettings = useGetDefaultSettings();\n
|
|
1
|
+
{"version":3,"file":"OwpLayout.js","sources":["../../../src/components/OwpLayout/OwpLayout.tsx"],"sourcesContent":["import { themeLayouts, themeLayoutsType } from '@/layout/themeLayouts';\nimport { useOwpAppContext } from '@/contexts/OwpAppProvider';\nimport { generateSettings } from '@/configs/defaultConfig';\nimport { LayoutConfigDefaultsType } from '@/configs/layoutConfig';\nimport { useOwpTranslation } from '@/hooks/useOwpTranslation';\nimport {\n useGetCurrentSettings,\n useGetDefaultSettings,\n useSetSettings,\n} from '@/hooks/useOwpSettings';\nimport type { OwpSettingsConfigType } from '@/types/OwpSettingsTypes';\nimport { OwpRoutesType } from '@/utils/common/OwpUtils';\nimport { isEqual, merge } from 'es-toolkit/compat';\nimport { type ReactNode, useEffect, useMemo, useRef } from 'react';\nimport { matchRoutes, RouteMatch, RouteObject, useLocation } from 'react-router-dom';\nimport { OwpLoading } from '../OwpLoading';\n\nexport type OwpRouteObjectType = RouteObject & {\n settings?: OwpSettingsConfigType;\n auth?: string[] | [] | null | undefined;\n};\n\nexport type OwpRouteMatchType = RouteMatch & {\n route: OwpRouteObjectType;\n};\n\ntype OwpLayoutProps = {\n layouts?: themeLayoutsType;\n children?: ReactNode;\n};\n\n/**\n * OwpLayout\n * React frontend component in a React project that is used for layouting the user interface. The component\n * handles generating user interface settings related to current routes, merged with default settings, and uses\n * the new settings to generate layouts.\n */\nfunction OwpLayout(props: OwpLayoutProps) {\n const { routesConfig } = useOwpAppContext();\n const { i18n } = useOwpTranslation();\n\n const { layouts = themeLayouts, children } = props;\n const setSettings = useSetSettings();\n const settings = useGetCurrentSettings();\n const defaultSettings = useGetDefaultSettings();\n const location = useLocation();\n const { pathname } = location;\n const hasCompletedInitialLayoutSyncRef = useRef(false);\n\n const matchedSettings = useMemo(\n () => getRouteParamUtil(routesConfig, pathname, 'settings', true),\n [pathname, routesConfig],\n );\n const currentSettings = useMemo(() => {\n if (matchedSettings === undefined) {\n return defaultSettings;\n }\n\n return generateSettings(defaultSettings, matchedSettings);\n }, [defaultSettings, matchedSettings]);\n const isSettingsSynchronized = useMemo(\n () => settings === currentSettings || isEqual(currentSettings, settings),\n [currentSettings, settings],\n );\n const resolvedSettings = isSettingsSynchronized ? settings : currentSettings;\n const layoutStyle = resolvedSettings?.layout?.style;\n const layoutConfig = resolvedSettings?.layout?.config as LayoutConfigDefaultsType | undefined;\n\n useEffect(() => {\n if (isSettingsSynchronized) {\n return;\n }\n\n setSettings(currentSettings);\n }, [currentSettings, isSettingsSynchronized, setSettings]);\n\n useEffect(() => {\n window.scrollTo(0, 0);\n }, [pathname]);\n\n useEffect(() => {\n if (isSettingsSynchronized && i18n.isInitialized) {\n hasCompletedInitialLayoutSyncRef.current = true;\n }\n }, [i18n.isInitialized, isSettingsSynchronized]);\n\n return useMemo(() => {\n const shouldBlockForInitialLoading =\n !i18n.isInitialized ||\n (!isSettingsSynchronized && !hasCompletedInitialLayoutSyncRef.current);\n\n if (shouldBlockForInitialLoading) {\n return <OwpLoading />;\n }\n\n return Object.entries(layouts).map(([key, Layout]) => {\n if (key === layoutStyle) {\n return (\n <Layout key={key} layoutConfig={layoutConfig}>\n {children}\n </Layout>\n );\n }\n\n return null;\n });\n }, [children, i18n.isInitialized, isSettingsSynchronized, layoutConfig, layoutStyle, layouts]);\n}\n\nexport { OwpLayout };\n\n/**\n * Utility function to retrieve and merge or replace a specific route parameter from matched routes.\n *\n * @param pathname The current pathname\n * @param key The key of the parameter to merge or replace (e.g., 'settings', 'auth')\n * @param useMerge Whether to merge the parameter (using es-toolkit merge) or replace it\n * @returns The merged or replaced parameter data of type T\n */\nfunction getRouteParamUtil<T>(\n routes: OwpRoutesType,\n pathname: string,\n key: keyof OwpRouteObjectType,\n useMerge: boolean = true,\n): T | undefined {\n const matchedRoutes = matchRoutes(routes, pathname) as OwpRouteMatchType[] | null;\n\n if (!matchedRoutes) {\n return undefined;\n }\n\n let hasMatchedParam = false;\n\n const resolvedRouteParam = matchedRoutes.reduce<T | undefined>((acc, match) => {\n const routeParam = match.route[key] as T | undefined;\n\n if (routeParam === undefined) {\n return acc;\n }\n\n hasMatchedParam = true;\n\n if (!useMerge) {\n return routeParam;\n }\n\n if (routeParam === null) {\n return routeParam;\n }\n\n return merge(acc ?? {}, routeParam);\n }, undefined);\n\n return hasMatchedParam ? resolvedRouteParam : undefined;\n}\n"],"names":["OwpLayout","props","routesConfig","useOwpAppContext","i18n","useOwpTranslation","layouts","themeLayouts","children","setSettings","useSetSettings","settings","useGetCurrentSettings","defaultSettings","useGetDefaultSettings","location","useLocation","pathname","hasCompletedInitialLayoutSyncRef","useRef","matchedSettings","useMemo","getRouteParamUtil","currentSettings","generateSettings","isSettingsSynchronized","isEqual","resolvedSettings","layoutStyle","_a","layoutConfig","_b","useEffect","OwpLoading","key","Layout","jsx","__name","routes","useMerge","matchedRoutes","matchRoutes","hasMatchedParam","resolvedRouteParam","acc","match","routeParam","merge"],"mappings":";;;;;;;;;;;;;AAqCA,SAASA,EAAUC,GAAuB;;AACxC,QAAM,EAAE,cAAAC,EAAA,IAAiBC,EAAA,GACnB,EAAE,MAAAC,EAAA,IAASC,EAAA,GAEX,EAAE,SAAAC,IAAUC,GAAc,UAAAC,EAAA,IAAaP,GACvCQ,IAAcC,EAAA,GACdC,IAAWC,EAAA,GACXC,IAAkBC,EAAA,GAClBC,IAAW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