@owp/core 1.28.0 → 1.30.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.
Files changed (94) hide show
  1. package/dist/{Close-DnXhM4Ms.js → Close-DnXyQZKh.js} +435 -378
  2. package/dist/Close-DnXyQZKh.js.map +1 -0
  3. package/dist/OwpStoreProvider-Bx5p7ooQ.js +30 -0
  4. package/dist/OwpStoreProvider-Bx5p7ooQ.js.map +1 -0
  5. package/dist/{OwpUtils-9lHSCdan.js → OwpUtils-C81bM1Gz.js} +2 -2
  6. package/dist/OwpUtils-C81bM1Gz.js.map +1 -0
  7. package/dist/{QuickPanel-BOgEYOAw.js → QuickPanel-CO7Tyc8C.js} +2 -2
  8. package/dist/{QuickPanel-BOgEYOAw.js.map → QuickPanel-CO7Tyc8C.js.map} +1 -1
  9. package/dist/colors.js +3 -18
  10. package/dist/colors.js.map +1 -1
  11. package/dist/constants.js +17 -20
  12. package/dist/constants.js.map +1 -1
  13. package/dist/context.js +64 -36
  14. package/dist/context.js.map +1 -1
  15. package/dist/hooks.js +70 -70
  16. package/dist/hooks.js.map +1 -1
  17. package/dist/{index-B8tZAW8i.js → index-KlA5Es4t.js} +11931 -12745
  18. package/dist/index-KlA5Es4t.js.map +1 -0
  19. package/dist/index.js +88 -115
  20. package/dist/{isTypedArray-xp-fB7W4.js → isTypedArray-DPyC49cI.js} +3 -3
  21. package/dist/{isTypedArray-xp-fB7W4.js.map → isTypedArray-DPyC49cI.js.map} +1 -1
  22. package/dist/{lazyLoadedSlices-BAbcXcEU.js → lazyLoadedSlices-DC7yg4GT.js} +885 -845
  23. package/dist/lazyLoadedSlices-DC7yg4GT.js.map +1 -0
  24. package/dist/localStorageKeys-Che0CNci.js +10 -0
  25. package/dist/localStorageKeys-Che0CNci.js.map +1 -0
  26. package/dist/owp-app.css +1 -1
  27. package/dist/owpDark-DAY0F6Ph.js +21 -0
  28. package/dist/owpDark-DAY0F6Ph.js.map +1 -0
  29. package/dist/storageKeys-C6xHFiTo.js +42 -0
  30. package/dist/storageKeys-C6xHFiTo.js.map +1 -0
  31. package/dist/store.js +37 -3
  32. package/dist/store.js.map +1 -1
  33. package/dist/{toUpper-CilZrxEa.js → toUpper-i_I6Tyuv.js} +2 -2
  34. package/dist/{toUpper-CilZrxEa.js.map → toUpper-i_I6Tyuv.js.map} +1 -1
  35. package/dist/treeGrid-DtKg-9uf.js +8 -0
  36. package/dist/treeGrid-DtKg-9uf.js.map +1 -0
  37. package/dist/{treeGridUtil-_FDvRzzt.js → treeGridUtil-WTM_djsN.js} +62 -61
  38. package/dist/{treeGridUtil-_FDvRzzt.js.map → treeGridUtil-WTM_djsN.js.map} +1 -1
  39. package/dist/types/components/OwpErrorBoundary/OwpErrorBoundary.d.ts +1 -1
  40. package/dist/types/components/OwpLayout/OwpLayout.d.ts +1 -1
  41. package/dist/types/components/OwpTable/OwpTable.d.ts +1 -1
  42. package/dist/types/components/OwpTabs/OwpTab.d.ts +1 -1
  43. package/dist/types/components/OwpTabs/OwpTabs.d.ts +1 -1
  44. package/dist/types/components/OwpThemeSelector/SchemePreview.d.ts +1 -1
  45. package/dist/types/components/OwpThemeSelector/ThemePreview.d.ts +1 -1
  46. package/dist/types/components/layouts/shared-components/navigation/store/navigationSlice.d.ts +5 -5
  47. package/dist/types/components/layouts/themeLayoutConfigs.d.ts +1 -1
  48. package/dist/types/context/OwpAppProvider.d.ts +4 -3
  49. package/dist/types/default-settings/OwpDefaultSettings.d.ts +25 -171
  50. package/dist/types/hooks/index.d.ts +1 -0
  51. package/dist/types/hooks/useAccessTokenGuard.d.ts +12 -0
  52. package/dist/types/hooks/useStorage.d.ts +0 -13
  53. package/dist/types/index.d.ts +1 -5
  54. package/dist/types/store/index.d.ts +1 -0
  55. package/dist/types/{components/OwpSettings → store}/owpSettingsSlice.d.ts +1 -456
  56. package/dist/types/{components/OwpSettings/OwpSettings.d.ts → types/OwpSettingsTypes.d.ts} +0 -12
  57. package/dist/types/utils/common/OwpUtils.d.ts +1 -1
  58. package/dist/usePageLockLoading-BUI_3PlR.js +39 -0
  59. package/dist/usePageLockLoading-BUI_3PlR.js.map +1 -0
  60. package/dist/useShortcuts-CCf98L8m.js +241 -0
  61. package/dist/useShortcuts-CCf98L8m.js.map +1 -0
  62. package/dist/useStorage-CuUmH4fD.js +50 -0
  63. package/dist/useStorage-CuUmH4fD.js.map +1 -0
  64. package/dist/useTreeGridExcelExport-N2nOKmkz.js +138 -0
  65. package/dist/useTreeGridExcelExport-N2nOKmkz.js.map +1 -0
  66. package/dist/utils.js +294 -293
  67. package/dist/utils.js.map +1 -1
  68. package/package.json +2 -11
  69. package/dist/Close-DnXhM4Ms.js.map +0 -1
  70. package/dist/OwpStoreProvider-B7W25pkq.js +0 -34
  71. package/dist/OwpStoreProvider-B7W25pkq.js.map +0 -1
  72. package/dist/OwpUtils-9lHSCdan.js.map +0 -1
  73. package/dist/index-B8tZAW8i.js.map +0 -1
  74. package/dist/language-CwsGUe4C.js +0 -5
  75. package/dist/language-CwsGUe4C.js.map +0 -1
  76. package/dist/lazyLoadedSlices-BAbcXcEU.js.map +0 -1
  77. package/dist/storageKeys-DRzte9LZ.js +0 -15
  78. package/dist/storageKeys-DRzte9LZ.js.map +0 -1
  79. package/dist/treeGrid-CjB04cBq.js +0 -35
  80. package/dist/treeGrid-CjB04cBq.js.map +0 -1
  81. package/dist/types/components/OwpSettings/OwpLayoutConfig.d.ts +0 -16
  82. package/dist/types/components/OwpSettings/OwpLayoutConfigs.d.ts +0 -14
  83. package/dist/types/components/OwpSettings/index.d.ts +0 -1
  84. package/dist/types/components/OwpSettings/palette-generator/PalettePreview.d.ts +0 -14
  85. package/dist/types/components/OwpSettings/palette-generator/PaletteSelector.d.ts +0 -15
  86. package/dist/types/components/OwpSettings/palette-generator/SectionPreview.d.ts +0 -12
  87. package/dist/types/store/apiService.d.ts +0 -6
  88. package/dist/useOwpTranslation-BelpX-fd.js +0 -174
  89. package/dist/useOwpTranslation-BelpX-fd.js.map +0 -1
  90. package/dist/useStorage-BA0D8KA7.js +0 -67
  91. package/dist/useStorage-BA0D8KA7.js.map +0 -1
  92. package/dist/useTreeGridExcelExport-QNcWzx5v.js +0 -195
  93. package/dist/useTreeGridExcelExport-QNcWzx5v.js.map +0 -1
  94. /package/dist/types/{components/OwpSettings → types}/ThemeFormConfigTypes.d.ts +0 -0
@@ -1,15 +0,0 @@
1
- const r = {
2
- commonCodeList: "commonCodeList",
3
- navigationList: "navigationList",
4
- lockLoadingProps: "lockLoadingProps",
5
- currentLogoSrc: "CurrentLogoSrc",
6
- currentLanguage: "CurrentLanguage",
7
- currentUser: "currentUser",
8
- currentUserId: "CurrentUserId",
9
- currentShortcuts: "CurrentShortcuts",
10
- owpEnv: "owpEnv"
11
- };
12
- export {
13
- r as S
14
- };
15
- //# sourceMappingURL=storageKeys-DRzte9LZ.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storageKeys-DRzte9LZ.js","sources":["../src/constants/storageKeys.ts"],"sourcesContent":["/**\n * 스토리지 키 목록\n */\nexport const STORAGE_KEYS = {\n commonCodeList: 'commonCodeList',\n navigationList: 'navigationList',\n lockLoadingProps: 'lockLoadingProps',\n currentLogoSrc: 'CurrentLogoSrc',\n currentLanguage: 'CurrentLanguage',\n currentUser: 'currentUser',\n currentUserId: 'CurrentUserId',\n currentShortcuts: 'CurrentShortcuts',\n owpEnv: 'owpEnv',\n} as const;\n"],"names":["STORAGE_KEYS"],"mappings":"AAGO,MAAMA,IAAe;AAAA,EAC1B,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,eAAe;AAAA,EACf,kBAAkB;AAAA,EAClB,QAAQ;AACV;"}
@@ -1,35 +0,0 @@
1
- const t = {
2
- vertical: "middle",
3
- horizontal: "center"
4
- }, E = {
5
- ...t,
6
- wrapText: !0
7
- }, s = {
8
- size: 11,
9
- bold: !0
10
- }, L = {
11
- size: 10,
12
- bold: !1
13
- }, _ = {
14
- top: { style: "thin" },
15
- left: { style: "thin" },
16
- bottom: { style: "thin" },
17
- right: { style: "thin" }
18
- }, e = {
19
- type: "pattern",
20
- pattern: "solid",
21
- fgColor: { argb: "FFE0E0E0" }
22
- }, o = "#f44336", T = "#ffd6a8", a = "text-white text-xl font-semibold", n = "#ff8904";
23
- export {
24
- t as D,
25
- o as T,
26
- E as a,
27
- s as b,
28
- L as c,
29
- _ as d,
30
- e,
31
- T as f,
32
- a as g,
33
- n as h
34
- };
35
- //# sourceMappingURL=treeGrid-CjB04cBq.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"treeGrid-CjB04cBq.js","sources":["../src/constants/excel.ts","../src/constants/treeGrid.ts"],"sourcesContent":["import type ExcelJS from 'exceljs';\n\ntype ExcelCellFont = ExcelJS.Cell['font'];\ntype ExcelCellAlignment = ExcelJS.Cell['alignment'];\ntype ExcelCellFill = ExcelJS.Cell['fill'];\ntype ExcelCellBorder = ExcelJS.Cell['border'];\n\nexport const DEFAULT_CELL_ALIGNMENT = {\n vertical: 'middle',\n horizontal: 'center',\n} as ExcelCellAlignment;\n\nexport const DEFAULT_WRAP_CELL_ALIGNMENT = {\n ...DEFAULT_CELL_ALIGNMENT,\n wrapText: true,\n} as ExcelCellAlignment;\n\nexport const DEFAULT_HEADER_FONT = {\n size: 11,\n bold: true,\n} as ExcelCellFont;\n\nexport const DEFAULT_VALUE_FONT = {\n size: 10,\n bold: false,\n} as ExcelCellFont;\n\nexport const DEFAULT_THIN_BORDER = {\n top: { style: 'thin' },\n left: { style: 'thin' },\n bottom: { style: 'thin' },\n right: { style: 'thin' },\n} as ExcelCellBorder;\n\nexport const DEFAULT_HEADER_FILL = {\n type: 'pattern',\n pattern: 'solid',\n fgColor: { argb: 'FFE0E0E0' },\n} as ExcelCellFill;\n","export const TREEGRID_WARNING_CELL_COLOR = '#f44336';\nexport const TREEGRID_INPUT_CELL_COLOR = '#ffd6a8';\n\nexport const TREEGRID_CELL_HIGHLIGHT_CLASS = 'text-white text-xl font-semibold';\nexport const TREEGRID_CELL_HIGHLIGHT_COLOR = '#ff8904';\n"],"names":["DEFAULT_CELL_ALIGNMENT","DEFAULT_WRAP_CELL_ALIGNMENT","DEFAULT_HEADER_FONT","DEFAULT_VALUE_FONT","DEFAULT_THIN_BORDER","DEFAULT_HEADER_FILL","TREEGRID_WARNING_CELL_COLOR","TREEGRID_INPUT_CELL_COLOR","TREEGRID_CELL_HIGHLIGHT_CLASS","TREEGRID_CELL_HIGHLIGHT_COLOR"],"mappings":"AAOO,MAAMA,IAAyB;AAAA,EACpC,UAAU;AAAA,EACV,YAAY;AACd,GAEaC,IAA8B;AAAA,EACzC,GAAGD;AAAA,EACH,UAAU;AACZ,GAEaE,IAAsB;AAAA,EACjC,MAAM;AAAA,EACN,MAAM;AACR,GAEaC,IAAqB;AAAA,EAChC,MAAM;AAAA,EACN,MAAM;AACR,GAEaC,IAAsB;AAAA,EACjC,KAAK,EAAE,OAAO,OAAA;AAAA,EACd,MAAM,EAAE,OAAO,OAAA;AAAA,EACf,QAAQ,EAAE,OAAO,OAAA;AAAA,EACjB,OAAO,EAAE,OAAO,OAAA;AAClB,GAEaC,IAAsB;AAAA,EACjC,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS,EAAE,MAAM,WAAA;AACnB,GCtCaC,IAA8B,WAC9BC,IAA4B,WAE5BC,IAAgC,oCAChCC,IAAgC;"}
@@ -1,16 +0,0 @@
1
- import { OwpSettingsConfigType } from '@/components/OwpSettings/OwpSettings';
2
- import { AnyFormFieldType } from '@/components/OwpSettings/ThemeFormConfigTypes';
3
- import { Control } from 'react-hook-form';
4
- type OwpSettingsControllerProps = {
5
- key?: string;
6
- name: keyof OwpSettingsConfigType;
7
- control: Control<OwpSettingsConfigType>;
8
- title?: string;
9
- item: AnyFormFieldType;
10
- };
11
- /**
12
- * OwpLayoutConfig 컴포넌트
13
- * @param props 컴포넌트 props
14
- */
15
- declare function OwpLayoutConfig(props: OwpSettingsControllerProps): import("react/jsx-runtime").JSX.Element | "";
16
- export { OwpLayoutConfig };
@@ -1,14 +0,0 @@
1
- import { Control } from 'react-hook-form';
2
- import { OwpSettingsConfigType } from './OwpSettings';
3
- import { ThemeFormConfigTypes } from './ThemeFormConfigTypes';
4
- type OwpSettingsControllersProps = {
5
- value: ThemeFormConfigTypes;
6
- prefix: string;
7
- control: Control<OwpSettingsConfigType>;
8
- };
9
- /**
10
- * OwpLayoutConfigs 컴포넌트
11
- * @param props 컴포넌트 props
12
- */
13
- declare function OwpLayoutConfigs(props: OwpSettingsControllersProps): import("react/jsx-runtime").JSX.Element[];
14
- export { OwpLayoutConfigs };
@@ -1 +0,0 @@
1
- export { OwpSettings } from './OwpSettings';
@@ -1,14 +0,0 @@
1
- import { Palette } from '@mui/material/styles/createPalette';
2
- import { PartialDeep } from 'type-fest';
3
- /**
4
- * Props for PalettePreview component
5
- */
6
- type PalettePreviewProps = {
7
- className?: string;
8
- palette: PartialDeep<Palette>;
9
- };
10
- /**
11
- * PalettePreview component
12
- */
13
- declare function PalettePreview(props: PalettePreviewProps): import("react/jsx-runtime").JSX.Element;
14
- export default PalettePreview;
@@ -1,15 +0,0 @@
1
- import { ReactNode } from 'react';
2
- import { OwpThemeType } from '../OwpSettings';
3
- /**
4
- * Props for PaletteSelector component
5
- */
6
- type PaletteSelectorProps = {
7
- triggerElement: ReactNode;
8
- value: OwpThemeType;
9
- onChange: (value: OwpThemeType) => void;
10
- };
11
- /**
12
- * PaletteSelector component
13
- */
14
- declare function PaletteSelector(props: PaletteSelectorProps): import("react/jsx-runtime").JSX.Element;
15
- export default PaletteSelector;
@@ -1,12 +0,0 @@
1
- /**
2
- * Props for SectionPreview component
3
- */
4
- type SectionPreviewProps = {
5
- className?: string;
6
- section?: 'main' | 'navbar' | 'toolbar' | 'footer';
7
- };
8
- /**
9
- * SectionPreview component
10
- */
11
- declare function SectionPreview(props: SectionPreviewProps): import("react/jsx-runtime").JSX.Element;
12
- export default SectionPreview;
@@ -1,6 +0,0 @@
1
- import { BaseQueryFn } from '@reduxjs/toolkit/query/react';
2
- import { AxiosError, AxiosRequestConfig } from 'axios';
3
- /**
4
- * Internal RTK Query api service
5
- */
6
- export declare const apiService: import("@reduxjs/toolkit/query").Api<BaseQueryFn<AxiosRequestConfig<unknown>, unknown, AxiosError<unknown, any>>, {}, "apiService", never, typeof import("@reduxjs/toolkit/query").coreModuleName | typeof import("@reduxjs/toolkit/query/react").reactHooksModuleName>;
@@ -1,174 +0,0 @@
1
- var K = Object.defineProperty;
2
- var a = (e, t) => K(e, "name", { value: t, configurable: !0 });
3
- import { a as b, j as d } from "./emotion-react-jsx-runtime.browser.esm-Cb9H5d3i.js";
4
- import { Typography as T, DialogContent as O, DialogActions as x, Button as g, Dialog as V } from "@mui/material";
5
- import { useDialogs as _ } from "@toolpad/core/useDialogs";
6
- import { useTranslation as k } from "react-i18next";
7
- import { a as h } from "./isTypedArray-xp-fB7W4.js";
8
- function v(e, t) {
9
- if (t === void 0)
10
- return e.trimEnd();
11
- let n = e.length;
12
- switch (typeof t) {
13
- case "string": {
14
- if (t.length !== 1)
15
- throw new Error("The 'chars' parameter should be a single character string.");
16
- for (; n > 0 && e[n - 1] === t; )
17
- n--;
18
- break;
19
- }
20
- case "object":
21
- for (; n > 0 && t.includes(e[n - 1]); )
22
- n--;
23
- }
24
- return e.substring(0, n);
25
- }
26
- a(v, "trimEnd$1");
27
- function w(e, t, n) {
28
- return e == null ? "" : v(e, t.toString().split(""));
29
- }
30
- a(w, "trimEnd");
31
- const s = {
32
- infoTitle: {
33
- primaryKey: "message.would_you_like_to_proceed",
34
- fallbackKey: "Message.처리하시겠습니까",
35
- defaultValue: "처리하시겠습니까?"
36
- },
37
- infoOk: {
38
- primaryKey: "button.ok",
39
- fallbackKey: "Button.확인",
40
- defaultValue: "확인"
41
- },
42
- saveTitle: {
43
- primaryKey: "message.do_you_want_to_save",
44
- fallbackKey: "Message.저장하시겠습니까?",
45
- defaultValue: "저장하시겠습니까?"
46
- },
47
- saveOk: {
48
- primaryKey: "button.save",
49
- fallbackKey: "Button.저장",
50
- defaultValue: "저장"
51
- },
52
- updateTitle: {
53
- primaryKey: "message.would_you_like_to_edit",
54
- fallbackKey: "Message.수정하시겠습니까?",
55
- defaultValue: "수정하시겠습니까?"
56
- },
57
- updateOk: {
58
- primaryKey: "button.edit",
59
- fallbackKey: "Button.수정",
60
- defaultValue: "수정"
61
- },
62
- deleteTitle: {
63
- primaryKey: "message.are_you_sure_you_want_to_delete",
64
- fallbackKey: "Message.삭제하시겠습니까?",
65
- defaultValue: "삭제하시겠습니까?"
66
- },
67
- deleteOk: {
68
- primaryKey: "button.delete",
69
- fallbackKey: "Button.삭제",
70
- defaultValue: "삭제"
71
- },
72
- cancel: {
73
- primaryKey: "button.cancel",
74
- fallbackKey: "Button.취소",
75
- defaultValue: "취소"
76
- }
77
- }, p = /* @__PURE__ */ a((e, t) => e ? {
78
- color: e,
79
- ...t
80
- } : t, "mergeOkButtonProps"), E = /* @__PURE__ */ a(() => {
81
- const e = _(), { t, i18n: n } = k("owp"), i = /* @__PURE__ */ a(({
82
- primaryKey: o,
83
- fallbackKey: r,
84
- defaultValue: l
85
- }) => t(n.exists(o) ? o : r, { defaultValue: l }), "translateConfirmText"), u = /* @__PURE__ */ a((o) => e.open(B, o), "confirmBase");
86
- return {
87
- confirm: u,
88
- confirmInfo: /* @__PURE__ */ a(async ({ title: o, okText: r, severity: l } = {}) => u({
89
- title: o ?? i(s.infoTitle),
90
- okText: r ?? i(s.infoOk),
91
- severity: l ?? "primary",
92
- useInfo: !0
93
- }), "confirmInfo"),
94
- confirmSave: /* @__PURE__ */ a(async ({
95
- title: o,
96
- okText: r,
97
- cancelText: l,
98
- okButtonProps: c
99
- } = {}) => u({
100
- title: o ?? i(s.saveTitle),
101
- okText: r ?? i(s.saveOk),
102
- cancelText: l,
103
- okButtonProps: p("secondary", c)
104
- }), "confirmSave"),
105
- confirmUpdate: /* @__PURE__ */ a(async ({
106
- title: o,
107
- okText: r,
108
- cancelText: l,
109
- okButtonProps: c
110
- } = {}) => u({
111
- title: o ?? i(s.updateTitle),
112
- okText: r ?? i(s.updateOk),
113
- cancelText: l,
114
- okButtonProps: p("secondary", c)
115
- }), "confirmUpdate"),
116
- confirmDelete: /* @__PURE__ */ a(async ({
117
- title: o,
118
- okText: r,
119
- cancelText: l,
120
- okButtonProps: c
121
- } = {}) => u({
122
- title: o ?? i(s.deleteTitle),
123
- okText: r ?? i(s.deleteOk),
124
- cancelText: l,
125
- okButtonProps: p("error", c)
126
- }), "confirmDelete")
127
- };
128
- }, "useConfirm"), B = /* @__PURE__ */ a(({ payload: e, open: t, onClose: n }) => {
129
- const { title: i, okButtonProps: u, cancelButtonProps: o, severity: r, useInfo: l } = e, { t: c, i18n: m } = k("owp"), f = (e == null ? void 0 : e.okText) ?? c(m.exists(s.infoOk.primaryKey) ? "button.ok" : "Button.확인", {
130
- defaultValue: s.infoOk.defaultValue
131
- }), y = (e == null ? void 0 : e.cancelText) ?? c(
132
- m.exists(s.cancel.primaryKey) ? s.cancel.primaryKey : s.cancel.fallbackKey,
133
- { defaultValue: s.cancel.defaultValue }
134
- );
135
- return /* @__PURE__ */ b(V, { fullWidth: !0, maxWidth: "xs", open: t, onClose: /* @__PURE__ */ a(() => n(!1), "onClose"), children: [
136
- /* @__PURE__ */ d(O, { children: /* @__PURE__ */ d(T, { className: "mb-12", variant: "h6", children: i }) }),
137
- /* @__PURE__ */ b(x, { children: [
138
- !l && /* @__PURE__ */ d(g, { ...o, variant: "outlined", onClick: /* @__PURE__ */ a(() => n(!1), "onClick"), children: y }),
139
- /* @__PURE__ */ d(
140
- g,
141
- {
142
- color: r || "primary",
143
- variant: "contained",
144
- ...u,
145
- onClick: /* @__PURE__ */ a(() => n(!0), "onClick"),
146
- children: f
147
- }
148
- )
149
- ] })
150
- ] });
151
- }, "ConfirmDialog"), j = /* @__PURE__ */ a((e) => {
152
- if (!e.includes("."))
153
- return;
154
- const n = w(e, ".").lastIndexOf(".");
155
- return n < 0 ? e : e.slice(n + 1);
156
- }, "getDefaultValueFromKey"), N = /* @__PURE__ */ a(() => {
157
- const { t: e, ...t } = k("owp");
158
- return { t: /* @__PURE__ */ a((...i) => {
159
- const [u, o] = i, r = h(o) ? o : void 0, l = !!r, c = l && Object.prototype.hasOwnProperty.call(r, "defaultValue");
160
- if ((o == null || l) && !c && typeof u == "string") {
161
- const f = j(u);
162
- if (f) {
163
- const y = l ? { ...r, defaultValue: f } : { defaultValue: f };
164
- return e(u, y, ...i.slice(2));
165
- }
166
- }
167
- return e(...i);
168
- }, "t"), ...t };
169
- }, "useOwpTranslation");
170
- export {
171
- N as a,
172
- E as u
173
- };
174
- //# sourceMappingURL=useOwpTranslation-BelpX-fd.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useOwpTranslation-BelpX-fd.js","sources":["../../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/string/trimEnd.mjs","../../../node_modules/.pnpm/es-toolkit@1.39.10/node_modules/es-toolkit/dist/compat/string/trimEnd.mjs","../src/hooks/useConfirm.tsx","../src/hooks/useOwpTranslation.ts"],"sourcesContent":["function trimEnd(str, chars) {\n if (chars === undefined) {\n return str.trimEnd();\n }\n let endIndex = str.length;\n switch (typeof chars) {\n case 'string': {\n if (chars.length !== 1) {\n throw new Error(`The 'chars' parameter should be a single character string.`);\n }\n while (endIndex > 0 && str[endIndex - 1] === chars) {\n endIndex--;\n }\n break;\n }\n case 'object': {\n while (endIndex > 0 && chars.includes(str[endIndex - 1])) {\n endIndex--;\n }\n }\n }\n return str.substring(0, endIndex);\n}\n\nexport { trimEnd };\n","import { trimEnd as trimEnd$1 } from '../../string/trimEnd.mjs';\n\nfunction trimEnd(str, chars, guard) {\n if (str == null) {\n return '';\n }\n if (guard != null || chars == null) {\n return str.toString().trimEnd();\n }\n return trimEnd$1(str, chars.toString().split(''));\n}\n\nexport { trimEnd };\n","import {\n Button,\n ButtonProps,\n Dialog,\n DialogActions,\n DialogContent,\n Typography,\n} from '@mui/material';\nimport { DialogProps, useDialogs } from '@toolpad/core/useDialogs';\nimport { ReactNode } from 'react';\nimport { useTranslation } from 'react-i18next';\n\nexport interface ConfirmProps {\n title?: ReactNode | string;\n okText?: string;\n cancelText?: string;\n severity?: 'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning';\n useInfo?: boolean;\n okButtonProps?: ButtonProps;\n onClose?: (result: boolean) => Promise<void>;\n}\ninterface ConfirmBaseProps extends ConfirmProps {\n okButtonProps?: ButtonProps;\n cancelButtonProps?: ButtonProps;\n}\n\ninterface ConfirmTranslationConfig {\n primaryKey: string;\n fallbackKey: string;\n defaultValue: string;\n}\n\n/**\n * 확인 대화상자 번역 설정\n */\nconst CONFIRM_TRANSLATIONS = {\n infoTitle: {\n primaryKey: 'message.would_you_like_to_proceed',\n fallbackKey: 'Message.처리하시겠습니까',\n defaultValue: '처리하시겠습니까?',\n },\n infoOk: {\n primaryKey: 'button.ok',\n fallbackKey: 'Button.확인',\n defaultValue: '확인',\n },\n saveTitle: {\n primaryKey: 'message.do_you_want_to_save',\n fallbackKey: 'Message.저장하시겠습니까?',\n defaultValue: '저장하시겠습니까?',\n },\n saveOk: {\n primaryKey: 'button.save',\n fallbackKey: 'Button.저장',\n defaultValue: '저장',\n },\n updateTitle: {\n primaryKey: 'message.would_you_like_to_edit',\n fallbackKey: 'Message.수정하시겠습니까?',\n defaultValue: '수정하시겠습니까?',\n },\n updateOk: {\n primaryKey: 'button.edit',\n fallbackKey: 'Button.수정',\n defaultValue: '수정',\n },\n deleteTitle: {\n primaryKey: 'message.are_you_sure_you_want_to_delete',\n fallbackKey: 'Message.삭제하시겠습니까?',\n defaultValue: '삭제하시겠습니까?',\n },\n deleteOk: {\n primaryKey: 'button.delete',\n fallbackKey: 'Button.삭제',\n defaultValue: '삭제',\n },\n cancel: {\n primaryKey: 'button.cancel',\n fallbackKey: 'Button.취소',\n defaultValue: '취소',\n },\n} as const;\n\n/**\n * 확인 버튼 속성 병합\n * @param defaultColor 기본 버튼 색상\n * @param okButtonProps 사용자 버튼 속성\n */\nconst mergeOkButtonProps = (\n defaultColor: ButtonProps['color'] | undefined,\n okButtonProps?: ButtonProps,\n) => {\n if (!defaultColor) {\n return okButtonProps;\n }\n\n return {\n color: defaultColor,\n ...okButtonProps,\n } as ButtonProps;\n};\n/**\n * 확인 대화상자 훅\n */\nexport const useConfirm = () => {\n const dialogs = useDialogs();\n const { t, i18n } = useTranslation('owp');\n\n const translateConfirmText = ({\n primaryKey,\n fallbackKey,\n defaultValue,\n }: ConfirmTranslationConfig) => {\n return t(i18n.exists(primaryKey) ? primaryKey : fallbackKey, { defaultValue });\n };\n\n const confirmBase = (props: ConfirmBaseProps) => dialogs.open(ConfirmDialog, props);\n\n return {\n confirm: confirmBase,\n confirmInfo: async ({ title, okText, severity }: ConfirmProps | undefined = {}) => {\n return confirmBase({\n title:\n title ?? translateConfirmText(CONFIRM_TRANSLATIONS.infoTitle),\n okText: okText ?? translateConfirmText(CONFIRM_TRANSLATIONS.infoOk),\n severity: severity ?? 'primary',\n useInfo: true,\n });\n },\n confirmSave: async ({\n title,\n okText,\n cancelText,\n okButtonProps,\n }: ConfirmProps | undefined = {}) => {\n return confirmBase({\n title: title ?? translateConfirmText(CONFIRM_TRANSLATIONS.saveTitle),\n okText: okText ?? translateConfirmText(CONFIRM_TRANSLATIONS.saveOk),\n cancelText,\n okButtonProps: mergeOkButtonProps('secondary', okButtonProps),\n });\n },\n confirmUpdate: async ({\n title,\n okText,\n cancelText,\n okButtonProps,\n }: ConfirmProps | undefined = {}) => {\n return confirmBase({\n title: title ?? translateConfirmText(CONFIRM_TRANSLATIONS.updateTitle),\n okText: okText ?? translateConfirmText(CONFIRM_TRANSLATIONS.updateOk),\n cancelText,\n okButtonProps: mergeOkButtonProps('secondary', okButtonProps),\n });\n },\n confirmDelete: async ({\n title,\n okText,\n cancelText,\n okButtonProps,\n }: ConfirmProps | undefined = {}) => {\n return confirmBase({\n title: title ?? translateConfirmText(CONFIRM_TRANSLATIONS.deleteTitle),\n okText: okText ?? translateConfirmText(CONFIRM_TRANSLATIONS.deleteOk),\n cancelText,\n okButtonProps: mergeOkButtonProps('error', okButtonProps),\n });\n },\n };\n};\n\nconst ConfirmDialog = ({ payload, open, onClose }: DialogProps<ConfirmBaseProps, boolean>) => {\n const { title, okButtonProps, cancelButtonProps, severity, useInfo } = payload;\n\n const { t, i18n } = useTranslation('owp');\n\n const okText =\n payload?.okText ??\n t(i18n.exists(CONFIRM_TRANSLATIONS.infoOk.primaryKey) ? 'button.ok' : 'Button.확인', {\n defaultValue: CONFIRM_TRANSLATIONS.infoOk.defaultValue,\n });\n const cancelText =\n payload?.cancelText ??\n t(\n i18n.exists(CONFIRM_TRANSLATIONS.cancel.primaryKey)\n ? CONFIRM_TRANSLATIONS.cancel.primaryKey\n : CONFIRM_TRANSLATIONS.cancel.fallbackKey,\n { defaultValue: CONFIRM_TRANSLATIONS.cancel.defaultValue },\n );\n\n return (\n <Dialog fullWidth maxWidth=\"xs\" open={open} onClose={() => onClose(false)}>\n <DialogContent>\n <Typography className=\"mb-12\" variant=\"h6\">\n {title}\n </Typography>\n </DialogContent>\n <DialogActions>\n {!useInfo && (\n <Button {...cancelButtonProps} variant=\"outlined\" onClick={() => onClose(false)}>\n {cancelText}\n </Button>\n )}\n <Button\n color={severity ? severity : 'primary'}\n variant=\"contained\"\n {...okButtonProps}\n onClick={() => onClose(true)}\n >\n {okText}\n </Button>\n </DialogActions>\n </Dialog>\n );\n};\n","import { isPlainObject, trimEnd } from 'es-toolkit/compat';\nimport { useTranslation } from 'react-i18next';\n\n/**\n * 번역 키 기본 라벨 추출\n * @param key 번역 키\n */\nconst getDefaultValueFromKey = (key: string) => {\n if (!key.includes('.')) {\n return undefined;\n }\n\n const normalizedKey = trimEnd(key, '.');\n const lastSeparatorIndex = normalizedKey.lastIndexOf('.');\n\n if (lastSeparatorIndex < 0) {\n return key;\n }\n\n return key.slice(lastSeparatorIndex + 1);\n};\n\n/**\n * OWP 번역 훅\n */\nexport const useOwpTranslation = () => {\n const { t: i18nT, ...restProps } = useTranslation('owp');\n\n const t: typeof i18nT = ((...args: Parameters<typeof i18nT>) => {\n const [key, options] = args;\n const optionsObject = isPlainObject(options) ? (options as Record<string, unknown>) : undefined;\n const isOptionsObject = Boolean(optionsObject);\n const hasDefaultValue =\n isOptionsObject && Object.prototype.hasOwnProperty.call(optionsObject, 'defaultValue');\n const canInjectDefaultValue = options == null || isOptionsObject;\n\n if (canInjectDefaultValue && !hasDefaultValue && typeof key === 'string') {\n const defaultValue = getDefaultValueFromKey(key);\n\n if (defaultValue) {\n const nextOptions = isOptionsObject ? { ...optionsObject, defaultValue } : { defaultValue };\n\n return i18nT(...([key, nextOptions, ...args.slice(2)] as Parameters<typeof i18nT>));\n }\n }\n\n return i18nT(...args);\n }) as typeof i18nT;\n\n return { t, ...restProps };\n};\n"],"names":["trimEnd","str","chars","endIndex","guard","trimEnd$1","__name","CONFIRM_TRANSLATIONS","mergeOkButtonProps","defaultColor","okButtonProps","useConfirm","dialogs","useDialogs","i18n","useTranslation","translateConfirmText","primaryKey","fallbackKey","defaultValue","confirmBase","props","ConfirmDialog","title","okText","severity","cancelText","payload","open","onClose","cancelButtonProps","useInfo","t","jsxs","Dialog","jsx","DialogContent","Typography","DialogActions","Button","getDefaultValueFromKey","key","lastSeparatorIndex","useOwpTranslation","i18nT","restProps","args","options","optionsObject","isPlainObject","isOptionsObject","hasDefaultValue","nextOptions"],"mappings":";;;;;;;AAAA,SAASA,EAAQC,GAAKC,GAAO;AACzB,MAAIA,MAAU;AACV,WAAOD,EAAI,QAAO;AAEtB,MAAIE,IAAWF,EAAI;AACnB,UAAQ,OAAOC,GAAK;AAAA,IAChB,KAAK,UAAU;AACX,UAAIA,EAAM,WAAW;AACjB,cAAM,IAAI,MAAM,4DAA4D;AAEhF,aAAOC,IAAW,KAAKF,EAAIE,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7B,EAAA,IAAiB,EAAE,cAAAA,EAAA;AAE7E,eAAOyB,EAAWH,GAAKW,GAAa,GAAGN,EAAK,MAAM,CAAC,CAA+B;AAAA,MACpF;AAAA,IACF;AAEA,WAAOF,EAAM,GAAGE,CAAI;AAAA,EACtB,GAnByB,MAqBb,GAAGD,EAAA;AACjB,GAzBiC;","x_google_ignoreList":[0,1]}
@@ -1,67 +0,0 @@
1
- var l = Object.defineProperty;
2
- var s = (t, r) => l(t, "name", { value: r, configurable: !0 });
3
- import { S as o } from "./storageKeys-DRzte9LZ.js";
4
- import { useCallback as E, useMemo as m } from "react";
5
- import { i as S } from "./isTypedArray-xp-fB7W4.js";
6
- const g = [
7
- o.currentLanguage,
8
- o.currentShortcuts,
9
- o.currentUserId,
10
- o.currentLogoSrc,
11
- o.owpEnv
12
- ], a = /* @__PURE__ */ s(() => typeof window > "u" ? null : window.localStorage, "getLocalStorage"), i = /* @__PURE__ */ s((t, r) => {
13
- if (!t)
14
- return r;
15
- try {
16
- return JSON.parse(t);
17
- } catch {
18
- return r;
19
- }
20
- }, "safeParseJson"), f = /* @__PURE__ */ s((t) => {
21
- const r = a();
22
- r && r.setItem(o.owpEnv, JSON.stringify(t ?? {}));
23
- }, "setEnv"), p = /* @__PURE__ */ s(() => {
24
- const t = a(), r = i((t == null ? void 0 : t.getItem(o.owpEnv)) ?? null, {});
25
- return S(r) ? r : {};
26
- }, "getEnv"), I = /* @__PURE__ */ s(() => {
27
- const t = E(() => {
28
- const e = a();
29
- if (!e)
30
- return;
31
- const n = g.map((u) => [u, e.getItem(u)]);
32
- e.clear(), n.forEach(([u, c]) => {
33
- c !== null && e.setItem(u, c);
34
- });
35
- }, []), r = E(() => {
36
- const e = a(), n = i(
37
- (e == null ? void 0 : e.getItem(o.currentUser)) ?? null,
38
- null
39
- );
40
- return S(n) ? {
41
- role: ["admin"],
42
- data: {
43
- displayName: n.USERNAME,
44
- email: n.EMAIL,
45
- MES_STARTPAGE: n.MES_STARTPAGE,
46
- STARTPAGE: n.STARTPAGE,
47
- USERSEQ: n.USERSEQ,
48
- photoURL: ""
49
- }
50
- } : null;
51
- }, []);
52
- return m(
53
- () => ({
54
- resetStorage: t,
55
- getCurrentUser: r,
56
- setEnv: f,
57
- getEnv: p
58
- }),
59
- [r, t]
60
- );
61
- }, "useStorage");
62
- export {
63
- p as g,
64
- f as s,
65
- I as u
66
- };
67
- //# sourceMappingURL=useStorage-BA0D8KA7.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useStorage-BA0D8KA7.js","sources":["../src/hooks/useStorage.ts"],"sourcesContent":["import { STORAGE_KEYS } from '@/constants/storageKeys';\nimport { isPlainObject } from 'es-toolkit';\nimport { useCallback, useMemo } from 'react';\n\nexport type StorageEnv = { [key: string]: any };\n\ntype StoredCurrentUserRaw = {\n USERNAME?: string;\n EMAIL?: string;\n MES_STARTPAGE?: string;\n STARTPAGE?: string;\n USERSEQ?: any;\n};\n\ntype StoredCurrentUser = {\n role: string[];\n data: {\n displayName?: string;\n email?: string;\n MES_STARTPAGE?: string;\n STARTPAGE?: string;\n USERSEQ?: any;\n photoURL: string;\n };\n};\n\nconst PRESERVED_STORAGE_KEYS = [\n STORAGE_KEYS.currentLanguage,\n STORAGE_KEYS.currentShortcuts,\n STORAGE_KEYS.currentUserId,\n STORAGE_KEYS.currentLogoSrc,\n STORAGE_KEYS.owpEnv,\n] as const;\n\n/**\n * 브라우저 스토리지 조회\n */\nconst getLocalStorage = () => {\n if (typeof window === 'undefined') {\n return null;\n }\n\n return window.localStorage;\n};\n\n/**\n * 스토리지 문자열 안전 파싱\n * @param raw 스토리지 원본 문자열\n * @param fallback 파싱 실패 시 기본값\n */\nconst safeParseJson = <T>(raw: string | null, fallback: T): T => {\n if (!raw) {\n return fallback;\n }\n\n try {\n return JSON.parse(raw) as T;\n } catch {\n return fallback;\n }\n};\n\n/**\n * 앱 환경값 저장\n * @param env 저장할 환경값\n */\nexport const setEnv = (env: StorageEnv) => {\n const storage = getLocalStorage();\n\n if (!storage) {\n return;\n }\n\n storage.setItem(STORAGE_KEYS.owpEnv, JSON.stringify(env ?? {}));\n};\n\n/**\n * 앱 환경값 조회\n */\nexport const getEnv = (): StorageEnv => {\n const storage = getLocalStorage();\n const envData = safeParseJson<StorageEnv | null>(storage?.getItem(STORAGE_KEYS.owpEnv) ?? null, {});\n\n return isPlainObject(envData) ? envData : {};\n};\n\n/**\n * 스토리지 유틸 훅\n */\nexport const useStorage = () => {\n const resetStorage = useCallback(() => {\n const storage = getLocalStorage();\n\n if (!storage) {\n return;\n }\n\n const preservedEntries = PRESERVED_STORAGE_KEYS.map((key) => [key, storage.getItem(key)] as const);\n\n storage.clear();\n\n preservedEntries.forEach(([key, value]) => {\n if (value === null) {\n return;\n }\n\n storage.setItem(key, value);\n });\n }, []);\n\n const getCurrentUser = useCallback((): StoredCurrentUser | null => {\n const storage = getLocalStorage();\n const userData = safeParseJson<StoredCurrentUserRaw | null>(\n storage?.getItem(STORAGE_KEYS.currentUser) ?? null,\n null,\n );\n\n if (!isPlainObject(userData)) {\n return null;\n }\n\n return {\n role: ['admin'],\n data: {\n displayName: userData.USERNAME,\n email: userData.EMAIL,\n MES_STARTPAGE: userData.MES_STARTPAGE,\n STARTPAGE: userData.STARTPAGE,\n USERSEQ: userData.USERSEQ,\n photoURL: '',\n },\n };\n }, []);\n\n return useMemo(\n () => ({\n resetStorage,\n getCurrentUser,\n setEnv,\n getEnv,\n }),\n [getCurrentUser, resetStorage],\n );\n};\n"],"names":["PRESERVED_STORAGE_KEYS","STORAGE_KEYS","getLocalStorage","__name","safeParseJson","raw","fallback","setEnv","env","storage","getEnv","envData","isPlainObject","useStorage","resetStorage","useCallback","preservedEntries","key","value","getCurrentUser","userData","useMemo"],"mappings":";;;;;AA0BA,MAAMA,IAAyB;AAAA,EAC7BC,EAAa;AAAA,EACbA,EAAa;AAAA,EACbA,EAAa;AAAA,EACbA,EAAa;AAAA,EACbA,EAAa;AACf,GAKMC,IAAkB,gBAAAC,EAA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aA,EAAS;AAAA,QACtB,OAAOA,EAAS;AAAA,QAChB,eAAeA,EAAS;AAAA,QACxB,WAAWA,EAAS;AAAA,QACpB,SAASA,EAAS;AAAA,QAClB,UAAU;AAAA,MAAA;AAAA,IACZ,IAZO;AAAA,EAcX,GAAG,CAAA,CAAE;AAEL,SAAOC;AAAA,IACL,OAAO;AAAA,MACL,cAAAP;AAAA,MACA,gBAAAK;AAAA,MACA,QAAAZ;AAAA,MACA,QAAAG;AAAA,IAAA;AAAA,IAEF,CAACS,GAAgBL,CAAY;AAAA,EAAA;AAEjC,GAtD0B;"}
@@ -1,195 +0,0 @@
1
- var _ = Object.defineProperty;
2
- var t = (e, n) => _(e, "name", { value: n, configurable: !0 });
3
- import { S as h } from "./storageKeys-DRzte9LZ.js";
4
- import { useAtomValue as g, useSetAtom as E } from "jotai";
5
- import { atomWithStorage as C } from "jotai/utils";
6
- import { useTranslation as q } from "react-i18next";
7
- import p, { useRef as T, useEffect as d, useCallback as B, useState as v } from "react";
8
- import { b as I } from "./isTypedArray-xp-fB7W4.js";
9
- import { useTheme as K } from "@mui/material/styles";
10
- import { g as O, e as y } from "./treeGridUtil-_FDvRzzt.js";
11
- import { a as P } from "./useOwpTranslation-BelpX-fd.js";
12
- function j(e, n, { signal: r, edges: o } = {}) {
13
- let s, i = null;
14
- const u = o != null && o.includes("leading"), c = o == null || o.includes("trailing"), f = /* @__PURE__ */ t(() => {
15
- i !== null && (e.apply(s, i), s = void 0, i = null);
16
- }, "invoke"), l = /* @__PURE__ */ t(() => {
17
- c && f(), w();
18
- }, "onTimerEnd");
19
- let a = null;
20
- const L = /* @__PURE__ */ t(() => {
21
- a != null && clearTimeout(a), a = setTimeout(() => {
22
- a = null, l();
23
- }, n);
24
- }, "schedule"), m = /* @__PURE__ */ t(() => {
25
- a !== null && (clearTimeout(a), a = null);
26
- }, "cancelTimer"), w = /* @__PURE__ */ t(() => {
27
- m(), s = void 0, i = null;
28
- }, "cancel"), M = /* @__PURE__ */ t(() => {
29
- f();
30
- }, "flush"), S = /* @__PURE__ */ t(function(...N) {
31
- if (r != null && r.aborted)
32
- return;
33
- s = this, i = N;
34
- const V = a == null;
35
- L(), u && V && f();
36
- }, "debounced");
37
- return S.schedule = L, S.cancel = w, S.flush = M, r == null || r.addEventListener("abort", w, { once: !0 }), S;
38
- }
39
- t(j, "debounce$1");
40
- function k(e, n = 0, r = {}) {
41
- typeof r != "object" && (r = {});
42
- const { leading: o = !1, trailing: s = !0, maxWait: i } = r, u = Array(2);
43
- o && (u[0] = "leading"), s && (u[1] = "trailing");
44
- let c, f = null;
45
- const l = j(function(...m) {
46
- c = e.apply(this, m), f = null;
47
- }, n, { edges: u }), a = /* @__PURE__ */ t(function(...m) {
48
- return i != null && (f === null && (f = Date.now()), Date.now() - f >= i) ? (c = e.apply(this, m), f = Date.now(), l.cancel(), l.schedule(), c) : (l.apply(this, m), c);
49
- }, "debounced"), L = /* @__PURE__ */ t(() => (l.flush(), c), "flush");
50
- return a.cancel = l.cancel, a.flush = L, a;
51
- }
52
- t(k, "debounce");
53
- const R = C(h.commonCodeList, void 0), te = /* @__PURE__ */ t(() => g(R), "useGetCommonCodeList"), ne = /* @__PURE__ */ t(() => E(R), "useSetCommonCodeList"), b = C(h.currentLanguage, {
54
- id: "kr",
55
- title: "한국어",
56
- flag: "KR"
57
- }), re = /* @__PURE__ */ t(() => {
58
- const { t: e } = q("owp");
59
- return [
60
- { id: "kr", title: e("Common.한국어", { defaultValue: "한국어" }), flag: "KR" },
61
- {
62
- id: "en",
63
- title: e("Common.English", { defaultValue: "English" }),
64
- flag: "EN"
65
- },
66
- { id: "lc", title: e("Common.Etc", { defaultValue: "Etc" }), flag: "LC" }
67
- ];
68
- }, "useGetLanguageList"), oe = /* @__PURE__ */ t(() => g(b), "useGetCurrentLanguage"), ue = /* @__PURE__ */ t(() => E(b), "useSetCurrentLanguage"), x = C(
69
- h.currentLogoSrc,
70
- "assets/images/logo/daedong-door-logo-b.png"
71
- ), se = /* @__PURE__ */ t(() => g(x), "useGetCurrentLogoSrc"), ce = /* @__PURE__ */ t(() => E(x), "useSetCurrentLogoSrc");
72
- function ie(e, n) {
73
- const r = T(e);
74
- d(() => {
75
- r.current = e;
76
- }, [e]);
77
- const o = B(
78
- k((...s) => {
79
- r.current(...s);
80
- }, n),
81
- [n]
82
- );
83
- return d(() => () => {
84
- o.cancel();
85
- }, [o]), o;
86
- }
87
- t(ie, "useDebounce");
88
- function F(e) {
89
- if (!e || !e.length)
90
- throw new Error(
91
- "useDeepCompareEffect should not be used with no dependencies. Use React.useEffect instead."
92
- );
93
- if (e.every(Q))
94
- throw new Error(
95
- "useDeepCompareEffect should not be used with dependencies that are all primitive values. Use React.useEffect instead."
96
- );
97
- }
98
- t(F, "checkDeps");
99
- function Q(e) {
100
- return e == null || /^[sbn]/.test(typeof e);
101
- }
102
- t(Q, "isPrimitive");
103
- function G(e) {
104
- const n = p.useRef(e), r = p.useRef(0);
105
- return I(e, n.current) || (n.current = e, r.current += 1), p.useMemo(() => n.current, [r.current]);
106
- }
107
- t(G, "useDeepCompareMemoize");
108
- function ae(e, n) {
109
- return process.env.NODE_ENV !== "production" && F(n), p.useEffect(e, G(n));
110
- }
111
- t(ae, "useDeepCompareEffect");
112
- function fe(e, n) {
113
- return p.useEffect(e, G(n));
114
- }
115
- t(fe, "useDeepCompareEffectNoCheck");
116
- const A = C(h.navigationList, void 0), le = /* @__PURE__ */ t(() => g(A), "useGetNavigationList"), me = /* @__PURE__ */ t(() => E(A), "useSetNavigationList");
117
- function de(e) {
118
- const n = T();
119
- return d(() => {
120
- n.current = e;
121
- }, [e]), n.current;
122
- }
123
- t(de, "usePrevious");
124
- const D = C(h.currentShortcuts, []), pe = /* @__PURE__ */ t(() => g(D), "useGetShortcuts"), he = /* @__PURE__ */ t(() => E(D), "useSetShortcuts");
125
- function ge(e) {
126
- const n = K(), r = e(n).replace("@media ", "");
127
- function o(u) {
128
- return window.matchMedia(u).matches;
129
- }
130
- t(o, "getMatches");
131
- const [s, i] = v(o(r));
132
- return d(
133
- () => {
134
- const u = window.matchMedia(r);
135
- i(o(r));
136
- const c = /* @__PURE__ */ t((f) => i(f.matches), "handler");
137
- return u.addEventListener("change", c), () => u.removeEventListener("change", c);
138
- },
139
- [r]
140
- // Empty array ensures effect is only run on mount and unmount
141
- ), s;
142
- }
143
- t(ge, "useThemeMediaQuery");
144
- function Ee(e, n) {
145
- const r = T(e);
146
- d(() => {
147
- r.current = e;
148
- }, [e]), d(() => {
149
- let o;
150
- return n !== null && e && typeof e == "function" && (o = setTimeout(r.current, n)), () => {
151
- o && clearTimeout(o);
152
- };
153
- }, [e, n]);
154
- }
155
- t(Ee, "useTimeout");
156
- const Ce = /* @__PURE__ */ t((e) => {
157
- const { t: n } = P(), r = T(!1), [o, s] = v(!1);
158
- return { exportByTreeGrid: /* @__PURE__ */ t(async (u) => {
159
- if (r.current)
160
- return;
161
- r.current = !0, s(!0);
162
- const c = O(e);
163
- try {
164
- return typeof u == "string" ? await y(c, { exportName: u, t: n }) : await y(c, {
165
- ...u,
166
- t: n
167
- });
168
- } finally {
169
- r.current = !1, s(!1);
170
- }
171
- }, "exportByTreeGrid"), isExporting: o };
172
- }, "useTreeGridExcelExport");
173
- export {
174
- ne as a,
175
- re as b,
176
- oe as c,
177
- ue as d,
178
- se as e,
179
- ce as f,
180
- ie as g,
181
- G as h,
182
- ae as i,
183
- fe as j,
184
- le as k,
185
- me as l,
186
- de as m,
187
- pe as n,
188
- he as o,
189
- ge as p,
190
- Ee as q,
191
- Ce as r,
192
- k as s,
193
- te as u
194
- };
195
- //# sourceMappingURL=useTreeGridExcelExport-QNcWzx5v.js.map