@owp/core 1.25.0 → 1.26.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 (113) hide show
  1. package/colors.d.ts +1 -0
  2. package/colors.js +1 -0
  3. package/context.d.ts +1 -0
  4. package/context.js +1 -0
  5. package/dist/OwpAppProvider-F48yHfyI.js +22 -0
  6. package/dist/OwpAppProvider-F48yHfyI.js.map +1 -0
  7. package/dist/OwpStoreProvider-CqHkIIUm.js +34 -0
  8. package/dist/OwpStoreProvider-CqHkIIUm.js.map +1 -0
  9. package/dist/OwpUtils-DxEd-Pjo.js +618 -0
  10. package/dist/OwpUtils-DxEd-Pjo.js.map +1 -0
  11. package/dist/{QuickPanel-uWtPXsYC.js → QuickPanel-DNAisp_R.js} +3 -3
  12. package/dist/{QuickPanel-uWtPXsYC.js.map → QuickPanel-DNAisp_R.js.map} +1 -1
  13. package/dist/colors.js +38 -0
  14. package/dist/colors.js.map +1 -0
  15. package/dist/constants.js +9 -8
  16. package/dist/constants.js.map +1 -1
  17. package/dist/context.js +28 -0
  18. package/dist/context.js.map +1 -0
  19. package/dist/emotion-react-jsx-runtime.browser.esm-Cb9H5d3i.js +1751 -0
  20. package/dist/emotion-react-jsx-runtime.browser.esm-Cb9H5d3i.js.map +1 -0
  21. package/dist/hooks.js +76 -33
  22. package/dist/hooks.js.map +1 -1
  23. package/dist/{index-DvBno1rF.js → index-fDrAKBzK.js} +18170 -20983
  24. package/dist/index-fDrAKBzK.js.map +1 -0
  25. package/dist/index.js +125 -233
  26. package/dist/index.js.map +1 -1
  27. package/dist/isTypedArray-DPyC49cI.js +411 -0
  28. package/dist/isTypedArray-DPyC49cI.js.map +1 -0
  29. package/dist/lazyLoadedSlices-CsgnywgU.js +2815 -0
  30. package/dist/lazyLoadedSlices-CsgnywgU.js.map +1 -0
  31. package/dist/owp-app.css +1 -1
  32. package/dist/storageKeys-DRzte9LZ.js +15 -0
  33. package/dist/storageKeys-DRzte9LZ.js.map +1 -0
  34. package/dist/store.js +7 -0
  35. package/dist/store.js.map +1 -0
  36. package/dist/toUpper-BhzrnIm3.js +16 -0
  37. package/dist/toUpper-BhzrnIm3.js.map +1 -0
  38. package/dist/treeGrid-CjB04cBq.js +35 -0
  39. package/dist/treeGrid-CjB04cBq.js.map +1 -0
  40. package/dist/treeGridUtil-DaqTz5v3.js +771 -0
  41. package/dist/treeGridUtil-DaqTz5v3.js.map +1 -0
  42. package/dist/types/colors/index.d.ts +2 -0
  43. package/dist/types/components/ErrorBoundary/ErrorBoundary.d.ts +1 -1
  44. package/dist/types/components/OwpAutoLogoutDialog/index.d.ts +1 -0
  45. package/dist/types/components/OwpBarcodeInput/OwpBarcodeInput.d.ts +1 -0
  46. package/dist/types/components/OwpBarcodeInput/index.d.ts +1 -0
  47. package/dist/types/components/OwpButtonDelete/OwpButtonDelete.d.ts +12 -0
  48. package/dist/types/components/OwpButtonDelete/index.d.ts +1 -12
  49. package/dist/types/components/OwpButtonSave/OwpButtonSave.d.ts +12 -0
  50. package/dist/types/components/OwpButtonSave/index.d.ts +1 -12
  51. package/dist/types/components/OwpCommonDialog/OwpCommonDialog.d.ts +26 -0
  52. package/dist/types/components/OwpCommonDialog/index.d.ts +1 -26
  53. package/dist/types/components/OwpExportExcelButton/index.d.ts +1 -0
  54. package/dist/types/components/OwpFileUploadButton/index.d.ts +1 -0
  55. package/dist/types/components/OwpMrtTable/OwpMrtTable.d.ts +9 -0
  56. package/dist/types/components/OwpMrtTable/index.d.ts +1 -9
  57. package/dist/types/components/OwpNumberField/OwpNumberField.d.ts +12 -0
  58. package/dist/types/components/OwpNumberField/index.d.ts +1 -12
  59. package/dist/types/components/OwpOptionSelector/OwpOptionSelector.d.ts +22 -0
  60. package/dist/types/components/OwpOptionSelector/index.d.ts +1 -22
  61. package/dist/types/components/OwpPageContent/OwpPageContent.d.ts +17 -0
  62. package/dist/types/components/OwpPageContent/index.d.ts +1 -17
  63. package/dist/types/components/OwpPageLockLoading/OwpPageLockLoading.d.ts +11 -0
  64. package/dist/types/components/OwpPageLockLoading/index.d.ts +1 -11
  65. package/dist/types/components/OwpPageTitle/OwpPageTitle.d.ts +15 -0
  66. package/dist/types/components/OwpPageTitle/index.d.ts +1 -15
  67. package/dist/types/components/OwpPicker/index.d.ts +5 -0
  68. package/dist/types/components/OwpSearchFilter/OwpSearchFilter.d.ts +17 -0
  69. package/dist/types/components/OwpSearchFilter/index.d.ts +1 -17
  70. package/dist/types/components/OwpSection/OwpSection.d.ts +24 -0
  71. package/dist/types/components/OwpSection/index.d.ts +1 -24
  72. package/dist/types/components/OwpTable/index.d.ts +3 -0
  73. package/dist/types/components/OwpTextField/index.d.ts +1 -0
  74. package/dist/types/components/OwpTreeGridExcelButton/OwpTreeGridExcelButton.d.ts +12 -0
  75. package/dist/types/components/OwpTreeGridExcelButton/index.d.ts +1 -12
  76. package/dist/types/components/OwpTreeView/index.d.ts +1 -0
  77. package/dist/types/components/OwpYesNoSelector/OwpYesNoSelector.d.ts +16 -0
  78. package/dist/types/components/OwpYesNoSelector/index.d.ts +1 -16
  79. package/dist/types/components/OwpZoomImageSlider/index.d.ts +1 -0
  80. package/dist/types/components/shared-components/tabs/OwpTab.d.ts +1 -1
  81. package/dist/types/components/shared-components/tabs/OwpTabs.d.ts +1 -1
  82. package/dist/types/context/OwpCoreProvider.d.ts +21 -0
  83. package/dist/types/context/index.d.ts +2 -0
  84. package/dist/types/hooks/useCommonCodeList.d.ts +4 -4
  85. package/dist/types/hooks/useNavigation.d.ts +4 -4
  86. package/dist/types/index.d.ts +2 -9
  87. package/dist/types/store/OwpStoreProvider.d.ts +12 -0
  88. package/dist/types/store/index.d.ts +3 -0
  89. package/dist/useStorage-B4ZrPct1.js +65 -0
  90. package/dist/useStorage-B4ZrPct1.js.map +1 -0
  91. package/dist/useTreeGridExcelExport-BjyBdpz1.js +360 -0
  92. package/dist/useTreeGridExcelExport-BjyBdpz1.js.map +1 -0
  93. package/dist/utils.js +6934 -64
  94. package/dist/utils.js.map +1 -1
  95. package/package.json +7 -1
  96. package/store.d.ts +1 -0
  97. package/store.js +1 -0
  98. package/dist/index-DvBno1rF.js.map +0 -1
  99. package/dist/treeGrid-CPgV7yMG.js +0 -46
  100. package/dist/treeGrid-CPgV7yMG.js.map +0 -1
  101. package/dist/treeGridUtil-mbjQrrTs.js +0 -1176
  102. package/dist/treeGridUtil-mbjQrrTs.js.map +0 -1
  103. package/dist/types/components/layouts/index.d.ts +0 -8
  104. package/dist/types/components/layouts/layout1/components/RightSideLayout1.d.ts +0 -6
  105. package/dist/types/components/layouts/shared-components/DemoLayoutFooterContent.d.ts +0 -5
  106. package/dist/types/components/layouts/shared-components/DocumentationButton.d.ts +0 -8
  107. package/dist/types/components/layouts/shared-components/PoweredByLinks.d.ts +0 -5
  108. package/dist/types/components/layouts/shared-components/PurchaseButton.d.ts +0 -8
  109. package/dist/types/components/layouts/shared-components/UserNavbarHeader.d.ts +0 -5
  110. package/dist/useTreeGridExcelExport-BPWeY2Oq.js +0 -2201
  111. package/dist/useTreeGridExcelExport-BPWeY2Oq.js.map +0 -1
  112. package/dist/zipUtil-Dmq4Gna2.js +0 -7505
  113. package/dist/zipUtil-Dmq4Gna2.js.map +0 -1
@@ -0,0 +1,24 @@
1
+ import { IconProps } from '@mui/material';
2
+ interface OwpSectionProps {
3
+ className?: string;
4
+ headerProps?: React.HTMLAttributes<HTMLDivElement>;
5
+ disableTitleIcon?: boolean;
6
+ usePageTitle?: boolean;
7
+ title?: React.ReactNode;
8
+ actions?: React.ReactNode;
9
+ leftSlot?: React.ReactNode;
10
+ centerSlot?: React.ReactNode;
11
+ children?: React.ReactNode;
12
+ iconSize?: IconProps['fontSize'];
13
+ }
14
+ /**
15
+ * OwpSection 컴포넌트
16
+ * @param className CSS 클래스명
17
+ * @param title 제목
18
+ * @param disableTitleIcon disableTitleIcon 값
19
+ * @param headerProps headerProps props
20
+ * @param usePageTitle usePageTitle 값
21
+ * @param actions 액션 영역
22
+ */
23
+ declare const OwpSection: ({ className, title, disableTitleIcon, headerProps, usePageTitle, actions, leftSlot, centerSlot, children, iconSize, }: OwpSectionProps) => import("react/jsx-runtime").JSX.Element;
24
+ export { OwpSection };
@@ -1,24 +1 @@
1
- import { IconProps } from '@mui/material';
2
- interface OwpSectionProps {
3
- className?: string;
4
- headerProps?: React.HTMLAttributes<HTMLDivElement>;
5
- disableTitleIcon?: boolean;
6
- usePageTitle?: boolean;
7
- title?: React.ReactNode;
8
- actions?: React.ReactNode;
9
- leftSlot?: React.ReactNode;
10
- centerSlot?: React.ReactNode;
11
- children?: React.ReactNode;
12
- iconSize?: IconProps['fontSize'];
13
- }
14
- /**
15
- * OwpSection 컴포넌트
16
- * @param className CSS 클래스명
17
- * @param title 제목
18
- * @param disableTitleIcon disableTitleIcon 값
19
- * @param headerProps headerProps props
20
- * @param usePageTitle usePageTitle 값
21
- * @param actions 액션 영역
22
- */
23
- declare const OwpSection: ({ className, title, disableTitleIcon, headerProps, usePageTitle, actions, leftSlot, centerSlot, children, iconSize, }: OwpSectionProps) => import("react/jsx-runtime").JSX.Element;
24
- export { OwpSection };
1
+ export * from './OwpSection';
@@ -0,0 +1,3 @@
1
+ export * from './OwpDataTable';
2
+ export * from './OwpTable';
3
+ export * from './OwpVerticalTable';
@@ -0,0 +1 @@
1
+ export * from './OwpTextMaskField';
@@ -0,0 +1,12 @@
1
+ import { type ButtonProps } from '@mui/material';
2
+ export interface OwpTreeGridExcelButtonProps extends ButtonProps {
3
+ gridId: string;
4
+ exportName?: string;
5
+ }
6
+ /**
7
+ * TreeGrid 엑셀 내보내기 버튼
8
+ * @param gridId TreeGrid 인스턴스 ID
9
+ * @param exportName 다운로드 파일명
10
+ */
11
+ declare const OwpTreeGridExcelButton: ({ gridId, exportName, children, loading, loadingPosition, onClick, ...buttonProps }: OwpTreeGridExcelButtonProps) => import("react/jsx-runtime").JSX.Element;
12
+ export { OwpTreeGridExcelButton };
@@ -1,12 +1 @@
1
- import { type ButtonProps } from '@mui/material';
2
- export interface OwpTreeGridExcelButtonProps extends ButtonProps {
3
- gridId: string;
4
- exportName?: string;
5
- }
6
- /**
7
- * TreeGrid 엑셀 내보내기 버튼
8
- * @param gridId TreeGrid 인스턴스 ID
9
- * @param exportName 다운로드 파일명
10
- */
11
- declare const OwpTreeGridExcelButton: ({ gridId, exportName, children, loading, loadingPosition, onClick, ...buttonProps }: OwpTreeGridExcelButtonProps) => import("react/jsx-runtime").JSX.Element;
12
- export { OwpTreeGridExcelButton };
1
+ export * from './OwpTreeGridExcelButton';
@@ -0,0 +1 @@
1
+ export * from './OwpSlotTreeView';
@@ -0,0 +1,16 @@
1
+ import { type OwpOptionSelectorProps } from '@/components/OwpOptionSelector';
2
+ import { type ReactNode } from 'react';
3
+ export interface OwpYesNoSelectorProps extends Omit<OwpOptionSelectorProps, 'options'> {
4
+ yesLabel?: ReactNode;
5
+ noLabel?: ReactNode;
6
+ }
7
+ /**
8
+ * Y/N 선택 Select
9
+ * @param label 입력 라벨
10
+ * @param disableAllValueItem 전체 옵션 노출 여부
11
+ * @param helperText 하단 안내 문구
12
+ * @param yesLabel Y 항목 라벨
13
+ * @param noLabel N 항목 라벨
14
+ */
15
+ declare const OwpYesNoSelector: ({ yesLabel, noLabel, ...optionSelectorProps }: OwpYesNoSelectorProps) => import("react/jsx-runtime").JSX.Element;
16
+ export { OwpYesNoSelector };
@@ -1,16 +1 @@
1
- import { type OwpOptionSelectorProps } from '@/components/OwpOptionSelector';
2
- import { type ReactNode } from 'react';
3
- export interface OwpYesNoSelectorProps extends Omit<OwpOptionSelectorProps, 'options'> {
4
- yesLabel?: ReactNode;
5
- noLabel?: ReactNode;
6
- }
7
- /**
8
- * Y/N 선택 Select
9
- * @param label 입력 라벨
10
- * @param disableAllValueItem 전체 옵션 노출 여부
11
- * @param helperText 하단 안내 문구
12
- * @param yesLabel Y 항목 라벨
13
- * @param noLabel N 항목 라벨
14
- */
15
- declare const OwpYesNoSelector: ({ yesLabel, noLabel, ...optionSelectorProps }: OwpYesNoSelectorProps) => import("react/jsx-runtime").JSX.Element;
16
- export { OwpYesNoSelector };
1
+ export * from './OwpYesNoSelector';
@@ -0,0 +1 @@
1
+ export * from './OwpZoomImageSlider';
@@ -3,7 +3,7 @@
3
3
  */
4
4
  declare const OwpTab: import("@emotion/styled").StyledComponent<import("@mui/material").TabOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
5
5
  ref?: import("react").Ref<HTMLDivElement>;
6
- }, "children" | "sx" | "icon" | "disabled" | "classes" | "style" | "action" | "className" | "label" | "tabIndex" | "value" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "iconPosition" | "wrapped"> & {
6
+ }, "children" | "sx" | "icon" | "disabled" | "classes" | "style" | "value" | "action" | "className" | "label" | "tabIndex" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "iconPosition" | "wrapped"> & {
7
7
  component?: React.ElementType;
8
8
  } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
9
9
  export { OwpTab };
@@ -3,7 +3,7 @@
3
3
  */
4
4
  declare const OwpTabs: import("@emotion/styled").StyledComponent<import("@mui/material").TabsOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
5
5
  ref?: import("react").Ref<HTMLDivElement>;
6
- }, "children" | "sx" | "classes" | "style" | "action" | "className" | "variant" | "aria-label" | "aria-labelledby" | "onChange" | "slots" | "slotProps" | "value" | "orientation" | "allowScrollButtonsMobile" | "centered" | "indicatorColor" | "ScrollButtonComponent" | "scrollButtons" | "selectionFollowsFocus" | "TabIndicatorProps" | "TabScrollButtonProps" | "textColor" | "visibleScrollbar"> & {
6
+ }, "children" | "sx" | "classes" | "style" | "onChange" | "value" | "action" | "className" | "variant" | "aria-label" | "aria-labelledby" | "orientation" | "slots" | "slotProps" | "allowScrollButtonsMobile" | "centered" | "indicatorColor" | "ScrollButtonComponent" | "scrollButtons" | "selectionFollowsFocus" | "TabIndicatorProps" | "TabScrollButtonProps" | "textColor" | "visibleScrollbar"> & {
7
7
  component?: React.ElementType;
8
8
  } & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
9
9
  export { OwpTabs };
@@ -0,0 +1,21 @@
1
+ import { StyledEngineProvider } from '@mui/material/styles';
2
+ import { QueryClient, QueryClientConfig } from '@tanstack/react-query';
3
+ import { ComponentProps } from 'react';
4
+ import { OwpStoreProviderProps } from '../store/OwpStoreProvider';
5
+ import { OwpAppProviderProps } from './OwpAppProvider';
6
+ type OwpStyledEngineProviderProps = Omit<ComponentProps<typeof StyledEngineProvider>, 'children'>;
7
+ export interface OwpCoreProviderProps extends OwpAppProviderProps {
8
+ queryClient?: QueryClient;
9
+ queryClientConfig?: QueryClientConfig;
10
+ storePreloadedState?: OwpStoreProviderProps['preloadedState'];
11
+ styledEngineProviderProps?: OwpStyledEngineProviderProps;
12
+ }
13
+ /**
14
+ * App, Redux, React Query provider composition
15
+ * @param queryClient 외부 QueryClient 인스턴스
16
+ * @param queryClientConfig QueryClient 생성 옵션
17
+ * @param storePreloadedState 초기 Redux 상태
18
+ * @param styledEngineProviderProps StyledEngineProvider 옵션
19
+ */
20
+ export declare function OwpCoreProvider({ children, queryClient, queryClientConfig, storePreloadedState, styledEngineProviderProps, ...appProviderProps }: OwpCoreProviderProps): import("react/jsx-runtime").JSX.Element;
21
+ export {};
@@ -0,0 +1,2 @@
1
+ export * from './OwpAppProvider';
2
+ export * from './OwpCoreProvider';
@@ -8,10 +8,10 @@ export declare const useGetCommonCodeList: () => {
8
8
  /**
9
9
  * 공통코드 목록 설정 훅
10
10
  */
11
- export declare const useSetCommonCodeList: () => (args_0: {
11
+ export declare const useSetCommonCodeList: () => (args_0: typeof import("jotai/utils").RESET | {
12
12
  [codeId: string]: CommonCode[];
13
- } | typeof import("jotai/utils").RESET | ((prev: {
13
+ } | ((prev: {
14
14
  [codeId: string]: CommonCode[];
15
- }) => {
15
+ }) => typeof import("jotai/utils").RESET | {
16
16
  [codeId: string]: CommonCode[];
17
- } | typeof import("jotai/utils").RESET)) => void;
17
+ })) => void;
@@ -14,11 +14,11 @@ export declare const useGetNavigationList: () => (Navigation & {
14
14
  /**
15
15
  * 내비게이션 목록 설정 훅
16
16
  */
17
- export declare const useSetNavigationList: () => (args_0: typeof import("jotai/utils").RESET | (Navigation & {
17
+ export declare const useSetNavigationList: () => (args_0: (Navigation & {
18
18
  children?: Array<Navigation>;
19
- })[] | ((prev: (Navigation & {
19
+ })[] | typeof import("jotai/utils").RESET | ((prev: (Navigation & {
20
20
  children?: Array<Navigation>;
21
- })[]) => typeof import("jotai/utils").RESET | (Navigation & {
21
+ })[]) => (Navigation & {
22
22
  children?: Array<Navigation>;
23
- })[])) => void;
23
+ })[] | typeof import("jotai/utils").RESET)) => void;
24
24
  export {};
@@ -1,12 +1,5 @@
1
1
  export * from './auth/authRoles';
2
- export * from './colors/owpDark';
3
- export * from './colors/skyBlue';
4
2
  export { DialogsProvider } from '@toolpad/core/useDialogs';
5
- export * from './context/OwpAppProvider';
6
- export * from './store/store';
7
- export * from './constants';
8
- export * from './hooks';
9
- export * from './utils';
10
3
  export * from './components/layouts/themeLayouts';
11
4
  export * from './components/layouts/shared-components/OwpLanguageSwitcherSelect';
12
5
  export * from './components/layouts/shared-components/OwpSettingsViewerDialog';
@@ -18,8 +11,8 @@ export * from './components/OwpCommonDialog';
18
11
  export * from './components/OwpCommonCode';
19
12
  export * from './components/OwpDialog';
20
13
  export * from './components/OwpExportExcelButton/OwpExportExcelButton';
21
- export * from './components/ErrorBoundary';
22
- export * from './components/EventEmitter';
14
+ export { ErrorBoundary as OwpErrorBoundary } from './components/ErrorBoundary';
15
+ export { EventEmitter as OwpEventEmitter } from './components/EventEmitter';
23
16
  export * from './components/OwpFileUploadButton/OwpFileUploadButton';
24
17
  export * from './components/OwpLayout';
25
18
  export * from './components/OwpLoading';
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ import { RootState } from './store';
3
+ export interface OwpStoreProviderProps {
4
+ children?: ReactNode;
5
+ preloadedState?: Partial<RootState>;
6
+ }
7
+ /**
8
+ * Owp Redux store provider
9
+ * @param children 하위 콘텐츠
10
+ * @param preloadedState 초기 Redux 상태
11
+ */
12
+ export declare function OwpStoreProvider({ children, preloadedState }: OwpStoreProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ export * from './OwpStoreProvider';
2
+ export { createAppSelector, makeStore } from './store';
3
+ export type { AppAction, AppDispatch, AppStore, AppThunk, RootState } from './store';
@@ -0,0 +1,65 @@
1
+ var g = Object.defineProperty;
2
+ var u = (n, o) => g(n, "name", { value: o, configurable: !0 });
3
+ import { S as e } from "./storageKeys-DRzte9LZ.js";
4
+ import { useCallback as c, useMemo as f } from "react";
5
+ import { i as l } from "./isTypedArray-DPyC49cI.js";
6
+ const p = [
7
+ e.currentLanguage,
8
+ e.currentShortcuts,
9
+ e.currentUserId,
10
+ e.currentLogoSrc,
11
+ e.owpEnv
12
+ ], a = /* @__PURE__ */ u(() => typeof window > "u" ? null : window.localStorage, "getLocalStorage"), m = /* @__PURE__ */ u((n, o) => {
13
+ if (!n)
14
+ return o;
15
+ try {
16
+ return JSON.parse(n);
17
+ } catch {
18
+ return o;
19
+ }
20
+ }, "safeParseJson"), I = /* @__PURE__ */ u(() => {
21
+ const n = c(() => {
22
+ const t = a();
23
+ if (!t)
24
+ return;
25
+ const r = p.map((s) => [s, t.getItem(s)]);
26
+ t.clear(), r.forEach(([s, i]) => {
27
+ i !== null && t.setItem(s, i);
28
+ });
29
+ }, []), o = c(() => {
30
+ const t = a(), r = m(
31
+ (t == null ? void 0 : t.getItem(e.currentUser)) ?? null,
32
+ null
33
+ );
34
+ return l(r) ? {
35
+ role: ["admin"],
36
+ data: {
37
+ displayName: r.USERNAME,
38
+ email: r.EMAIL,
39
+ MES_STARTPAGE: r.MES_STARTPAGE,
40
+ STARTPAGE: r.STARTPAGE,
41
+ USERSEQ: r.USERSEQ,
42
+ photoURL: ""
43
+ }
44
+ } : null;
45
+ }, []), E = c((t) => {
46
+ const r = a();
47
+ r && r.setItem(e.owpEnv, JSON.stringify(t ?? {}));
48
+ }, []), S = c(() => {
49
+ const t = a(), r = m((t == null ? void 0 : t.getItem(e.owpEnv)) ?? null, {});
50
+ return l(r) ? r : {};
51
+ }, []);
52
+ return f(
53
+ () => ({
54
+ resetStorage: n,
55
+ getCurrentUser: o,
56
+ setEnv: E,
57
+ getEnv: S
58
+ }),
59
+ [o, S, n, E]
60
+ );
61
+ }, "useStorage");
62
+ export {
63
+ I as u
64
+ };
65
+ //# sourceMappingURL=useStorage-B4ZrPct1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useStorage-B4ZrPct1.js","sources":["../src/hooks/useStorage.ts"],"sourcesContent":["import { STORAGE_KEYS } from '@/constants/storageKeys';\nimport { isPlainObject } from 'es-toolkit';\nimport { useCallback, useMemo } from 'react';\n\ntype 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 */\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 const setEnv = useCallback((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 const getEnv = useCallback((): 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 return useMemo(\n () => ({\n resetStorage,\n getCurrentUser,\n setEnv,\n getEnv,\n }),\n [getCurrentUser, getEnv, resetStorage, setEnv],\n );\n};\n"],"names":["PRESERVED_STORAGE_KEYS","STORAGE_KEYS","getLocalStorage","__name","safeParseJson","raw","fallback","useStorage","resetStorage","useCallback","storage","preservedEntries","key","value","getCurrentUser","userData","isPlainObject","setEnv","env","getEnv","envData","useMemo"],"mappings":";;;;;AA0BA,MAAMA,IAAyB;AAAA,EAC7BC,EAAa;AAAA,EACbA,EAAa;AAAA,EACbA,EAAa;AAAA,EACbA,EAAa;AAAA,EACbA,EAAa;AACf,GAKMC,IAAkB,gBAAAC,EAAA,MAClB,OAAO,SAAW,MACb,OAGF,OAAO,cALQ,oBAalBC,IAAgB,gBAAAD,EAAA,CAAIE,GAAoBC,MAAmB;AAC/D,MAAI,CAACD;AACH,WAAOC;AAGT,MAAI;AACF,WAAO,KAAK,MAAMD,CAAG;AAAA,EACvB,QAAQ;AACN,WAAOC;AAAA,EACT;AACF,GAVsB,kBAeTC,IAAa,gBAAAJ,EAAA,MAAM;AAC9B,QAAMK,IAAeC,EAAY,MAAM;AACrC,UAAMC,IAAUR,EAAA;AAEhB,QAAI,CAACQ;AACH;AAGF,UAAMC,IAAmBX,EAAuB,IAAI,CAACY,MAAQ,CAACA,GAAKF,EAAQ,QAAQE,CAAG,CAAC,CAAU;AAEjG,IAAAF,EAAQ,MAAA,GAERC,EAAiB,QAAQ,CAAC,CAACC,GAAKC,CAAK,MAAM;AACzC,MAAIA,MAAU,QAIdH,EAAQ,QAAQE,GAAKC,CAAK;AAAA,IAC5B,CAAC;AAAA,EACH,GAAG,CAAA,CAAE,GAECC,IAAiBL,EAAY,MAAgC;AACjE,UAAMC,IAAUR,EAAA,GACVa,IAAWX;AAAA,OACfM,KAAA,gBAAAA,EAAS,QAAQT,EAAa,iBAAgB;AAAA,MAC9C;AAAA,IAAA;AAGF,WAAKe,EAAcD,CAAQ,IAIpB;AAAA,MACL,MAAM,CAAC,OAAO;AAAA,MACd,MAAM;AAAA,QACJ,aAAaA,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,GAECE,IAASR,EAAY,CAACS,MAAoB;AAC9C,UAAMR,IAAUR,EAAA;AAEhB,IAAKQ,KAILA,EAAQ,QAAQT,EAAa,QAAQ,KAAK,UAAUiB,KAAO,CAAA,CAAE,CAAC;AAAA,EAChE,GAAG,CAAA,CAAE,GAECC,IAASV,EAAY,MAAkB;AAC3C,UAAMC,IAAUR,EAAA,GACVkB,IAAUhB,GAAiCM,KAAA,gBAAAA,EAAS,QAAQT,EAAa,YAAW,MAAM,EAAE;AAElG,WAAOe,EAAcI,CAAO,IAAIA,IAAU,CAAA;AAAA,EAC5C,GAAG,CAAA,CAAE;AAEL,SAAOC;AAAA,IACL,OAAO;AAAA,MACL,cAAAb;AAAA,MACA,gBAAAM;AAAA,MACA,QAAAG;AAAA,MACA,QAAAE;AAAA,IAAA;AAAA,IAEF,CAACL,GAAgBK,GAAQX,GAAcS,CAAM;AAAA,EAAA;AAEjD,GAvE0B;"}