wcz-test 4.6.11 → 4.7.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/index.js +194 -213
- package/dist/index.js.map +1 -1
- package/package.json +10 -11
package/dist/index.js
CHANGED
|
@@ -1158,7 +1158,7 @@ import { useState as useState5 } from "react";
|
|
|
1158
1158
|
import MoreVert from "@mui/icons-material/MoreVert";
|
|
1159
1159
|
import { Box as Box3, IconButton, ImageListItem, ImageListItemBar, Stack as Stack4, Tooltip } from "@mui/material";
|
|
1160
1160
|
import { grey } from "@mui/material/colors";
|
|
1161
|
-
import { Fragment, useEffect as
|
|
1161
|
+
import { Fragment, useEffect as useEffect2, useState as useState3 } from "react";
|
|
1162
1162
|
|
|
1163
1163
|
// src/components/file/fileViewer/common/ActionsMenu.tsx
|
|
1164
1164
|
import Delete from "@mui/icons-material/Delete";
|
|
@@ -1179,7 +1179,7 @@ var useFile = () => {
|
|
|
1179
1179
|
|
|
1180
1180
|
// src/hooks/DialogsHooks.tsx
|
|
1181
1181
|
import { Button, Dialog, DialogActions, DialogContent, DialogTitle, useEventCallback } from "@mui/material";
|
|
1182
|
-
import { useContext as useContext2,
|
|
1182
|
+
import { useContext as useContext2, useMemo } from "react";
|
|
1183
1183
|
import { useTranslation as useTranslation2 } from "react-i18next";
|
|
1184
1184
|
|
|
1185
1185
|
// src/contexts/DialogsContext.ts
|
|
@@ -1190,30 +1190,20 @@ var DialogsContext = createContext2({});
|
|
|
1190
1190
|
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1191
1191
|
function AlertDialog({ open, payload, onClose }) {
|
|
1192
1192
|
const { t: t2 } = useTranslation2();
|
|
1193
|
-
|
|
1194
|
-
useEffect2(() => {
|
|
1195
|
-
if (open && buttonRef.current)
|
|
1196
|
-
setTimeout(() => buttonRef.current?.focus());
|
|
1197
|
-
}, [open]);
|
|
1198
|
-
return /* @__PURE__ */ jsxs4(Dialog, { maxWidth: "xs", fullWidth: true, open, onClose: () => onClose(), children: [
|
|
1193
|
+
return /* @__PURE__ */ jsxs4(Dialog, { maxWidth: "xs", fullWidth: true, open, onClose: () => onClose(), disableRestoreFocus: true, children: [
|
|
1199
1194
|
/* @__PURE__ */ jsx5(DialogTitle, { children: payload.title ?? t2("Layout.Dialog.Alert") }),
|
|
1200
1195
|
/* @__PURE__ */ jsx5(DialogContent, { children: payload.message }),
|
|
1201
|
-
/* @__PURE__ */ jsx5(DialogActions, { children: /* @__PURE__ */ jsx5(Button, {
|
|
1196
|
+
/* @__PURE__ */ jsx5(DialogActions, { children: /* @__PURE__ */ jsx5(Button, { onClick: () => onClose(), autoFocus: true, children: t2("Layout.Dialog.Confirm") }) })
|
|
1202
1197
|
] });
|
|
1203
1198
|
}
|
|
1204
1199
|
function ConfirmDialog({ open, payload, onClose }) {
|
|
1205
1200
|
const { t: t2 } = useTranslation2();
|
|
1206
|
-
|
|
1207
|
-
useEffect2(() => {
|
|
1208
|
-
if (open && buttonRef.current)
|
|
1209
|
-
setTimeout(() => buttonRef.current?.focus());
|
|
1210
|
-
}, [open]);
|
|
1211
|
-
return /* @__PURE__ */ jsxs4(Dialog, { maxWidth: "xs", fullWidth: true, open, onClose: () => onClose(false), children: [
|
|
1201
|
+
return /* @__PURE__ */ jsxs4(Dialog, { maxWidth: "xs", fullWidth: true, open, onClose: () => onClose(false), disableRestoreFocus: true, children: [
|
|
1212
1202
|
/* @__PURE__ */ jsx5(DialogTitle, { children: payload.title ?? t2("Layout.Dialog.Confirm") }),
|
|
1213
1203
|
/* @__PURE__ */ jsx5(DialogContent, { children: payload.message }),
|
|
1214
1204
|
/* @__PURE__ */ jsxs4(DialogActions, { children: [
|
|
1215
1205
|
/* @__PURE__ */ jsx5(Button, { onClick: () => onClose(false), children: payload.cancelText ?? t2("Layout.Dialog.Cancel") }),
|
|
1216
|
-
/* @__PURE__ */ jsx5(Button, {
|
|
1206
|
+
/* @__PURE__ */ jsx5(Button, { onClick: () => onClose(true), autoFocus: true, children: t2("Layout.Dialog.Confirm") })
|
|
1217
1207
|
] })
|
|
1218
1208
|
] });
|
|
1219
1209
|
}
|
|
@@ -1284,7 +1274,7 @@ var rootRouteHead = ({ title }) => () => ({
|
|
|
1284
1274
|
{ rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" },
|
|
1285
1275
|
{ rel: "icon", type: "image/png", sizes: "32x32", href: "/favicon-32x32.png" },
|
|
1286
1276
|
{ rel: "icon", type: "image/png", sizes: "16x16", href: "/favicon-16x16.png" },
|
|
1287
|
-
{ rel: "manifest", href: "/
|
|
1277
|
+
{ rel: "manifest", href: "/manifest" },
|
|
1288
1278
|
{ rel: "icon", href: "/favicon.ico" }
|
|
1289
1279
|
]
|
|
1290
1280
|
});
|
|
@@ -1521,7 +1511,7 @@ var GridFileViewerItem = ({ meta, size, itemBar }) => {
|
|
|
1521
1511
|
const { setImageId, actions } = useFile();
|
|
1522
1512
|
const [showItemBar, setShowItemBar] = useState3(itemBar === "always");
|
|
1523
1513
|
const [menu, setMenu] = useState3(null);
|
|
1524
|
-
|
|
1514
|
+
useEffect2(() => {
|
|
1525
1515
|
setShowItemBar(itemBar === "always");
|
|
1526
1516
|
}, [itemBar]);
|
|
1527
1517
|
const { data: source } = useGetFileThumbnail(meta);
|
|
@@ -1645,13 +1635,13 @@ var ListFileViewerItem = ({ meta }) => {
|
|
|
1645
1635
|
// src/components/file/fileViewer/ImageViewer.tsx
|
|
1646
1636
|
import Close from "@mui/icons-material/Close";
|
|
1647
1637
|
import { Box as Box4, Dialog as Dialog2, Fab } from "@mui/material";
|
|
1648
|
-
import { useEffect as
|
|
1638
|
+
import { useEffect as useEffect3 } from "react";
|
|
1649
1639
|
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1650
1640
|
var ImageViewer = ({ metaId }) => {
|
|
1651
1641
|
const { fileMetas, setImageId } = useFile();
|
|
1652
1642
|
const meta = fileMetas.find((m) => m.id === metaId);
|
|
1653
1643
|
const { data: source } = useGetFile(meta);
|
|
1654
|
-
|
|
1644
|
+
useEffect3(() => {
|
|
1655
1645
|
if (metaId)
|
|
1656
1646
|
globalThis.addEventListener("keydown", handleOnKeydown);
|
|
1657
1647
|
return () => {
|
|
@@ -1836,6 +1826,9 @@ var RouterError = ({ error }) => {
|
|
|
1836
1826
|
] }) });
|
|
1837
1827
|
};
|
|
1838
1828
|
|
|
1829
|
+
// src/providers/LayoutProvider.tsx
|
|
1830
|
+
import { ThemeProvider } from "@mui/material";
|
|
1831
|
+
|
|
1839
1832
|
// node_modules/@babel/runtime/helpers/esm/extends.js
|
|
1840
1833
|
function _extends() {
|
|
1841
1834
|
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
@@ -2600,94 +2593,11 @@ var AdapterDayjs = class {
|
|
|
2600
2593
|
};
|
|
2601
2594
|
|
|
2602
2595
|
// src/providers/LayoutProvider.tsx
|
|
2603
|
-
import { useEffect as
|
|
2596
|
+
import { useEffect as useEffect6 } from "react";
|
|
2597
|
+
import { useTranslation as useTranslation7 } from "react-i18next";
|
|
2604
2598
|
import * as z from "zod";
|
|
2605
2599
|
import { cs, en } from "zod/locales";
|
|
2606
2600
|
|
|
2607
|
-
// src/providers/DialogsProvider.tsx
|
|
2608
|
-
import { useCallback, useId, useMemo as useMemo3, useRef as useRef4, useState as useState6 } from "react";
|
|
2609
|
-
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2610
|
-
function DialogsProvider({ children, unmountAfter = 1e3 }) {
|
|
2611
|
-
const [stack, setStack] = useState6([]);
|
|
2612
|
-
const keyPrefix = useId();
|
|
2613
|
-
const nextId = useRef4(0);
|
|
2614
|
-
const dialogMetadata = useRef4(/* @__PURE__ */ new WeakMap());
|
|
2615
|
-
const requestDialog = useEventCallback_default(function open(Component7, payload, options = {}) {
|
|
2616
|
-
const { onClose = async () => {
|
|
2617
|
-
} } = options;
|
|
2618
|
-
let resolve;
|
|
2619
|
-
const promise = new Promise((resolveImpl) => {
|
|
2620
|
-
resolve = resolveImpl;
|
|
2621
|
-
});
|
|
2622
|
-
const key = `${keyPrefix}-${nextId.current}`;
|
|
2623
|
-
nextId.current += 1;
|
|
2624
|
-
const newEntry = {
|
|
2625
|
-
key,
|
|
2626
|
-
open: true,
|
|
2627
|
-
promise,
|
|
2628
|
-
Component: Component7,
|
|
2629
|
-
payload,
|
|
2630
|
-
onClose,
|
|
2631
|
-
resolve
|
|
2632
|
-
};
|
|
2633
|
-
dialogMetadata.current.set(promise, newEntry);
|
|
2634
|
-
setStack((previousStack) => [...previousStack, newEntry]);
|
|
2635
|
-
return promise;
|
|
2636
|
-
});
|
|
2637
|
-
const removeDialogFromStack = useCallback((dialog) => {
|
|
2638
|
-
setStack((previousStack) => previousStack.filter((entry) => entry.promise !== dialog));
|
|
2639
|
-
dialogMetadata.current.delete(dialog);
|
|
2640
|
-
}, []);
|
|
2641
|
-
const closeDialogUi = useEventCallback_default(function closeDialogUi2(dialog) {
|
|
2642
|
-
setStack(
|
|
2643
|
-
(previousStack) => previousStack.map((entry) => entry.promise === dialog ? { ...entry, open: false } : entry)
|
|
2644
|
-
);
|
|
2645
|
-
setTimeout(() => removeDialogFromStack(dialog), unmountAfter);
|
|
2646
|
-
});
|
|
2647
|
-
const closeDialog = useEventCallback_default(async function closeDialog2(dialog, result) {
|
|
2648
|
-
const entryToClose = dialogMetadata.current.get(dialog);
|
|
2649
|
-
if (!entryToClose) {
|
|
2650
|
-
throw new Error("Dialog not found in stack");
|
|
2651
|
-
}
|
|
2652
|
-
try {
|
|
2653
|
-
await entryToClose.onClose(result);
|
|
2654
|
-
} finally {
|
|
2655
|
-
entryToClose.resolve(result);
|
|
2656
|
-
closeDialogUi(dialog);
|
|
2657
|
-
}
|
|
2658
|
-
return dialog;
|
|
2659
|
-
});
|
|
2660
|
-
const contextValue = useMemo3(() => ({ open: requestDialog, close: closeDialog }), [requestDialog, closeDialog]);
|
|
2661
|
-
return /* @__PURE__ */ jsxs13(DialogsContext.Provider, { value: contextValue, children: [
|
|
2662
|
-
children,
|
|
2663
|
-
stack.map(({ key, open, Component: Component7, payload, promise }) => /* @__PURE__ */ jsx22(
|
|
2664
|
-
Component7,
|
|
2665
|
-
{
|
|
2666
|
-
payload,
|
|
2667
|
-
open,
|
|
2668
|
-
onClose: async (result) => {
|
|
2669
|
-
await closeDialog(promise, result);
|
|
2670
|
-
}
|
|
2671
|
-
},
|
|
2672
|
-
key
|
|
2673
|
-
))
|
|
2674
|
-
] });
|
|
2675
|
-
}
|
|
2676
|
-
|
|
2677
|
-
// src/providers/LayoutProvider.tsx
|
|
2678
|
-
import { ThemeProvider } from "@mui/material";
|
|
2679
|
-
|
|
2680
|
-
// src/utils/i18n.ts
|
|
2681
|
-
import i18n from "i18next";
|
|
2682
|
-
import LanguageDetector from "i18next-browser-languagedetector";
|
|
2683
|
-
import HttpBackend from "i18next-http-backend";
|
|
2684
|
-
import { initReactI18next } from "react-i18next";
|
|
2685
|
-
import { default as default2 } from "i18next";
|
|
2686
|
-
i18n.use(HttpBackend).use(LanguageDetector).use(initReactI18next).init({
|
|
2687
|
-
fallbackLng: "en",
|
|
2688
|
-
interpolation: { escapeValue: false }
|
|
2689
|
-
});
|
|
2690
|
-
|
|
2691
2601
|
// src/components/core/Layout.tsx
|
|
2692
2602
|
import Menu3 from "@mui/icons-material/Menu";
|
|
2693
2603
|
import MenuOpen from "@mui/icons-material/MenuOpen";
|
|
@@ -2708,7 +2618,7 @@ import { useNavigate, useRouterState as useRouterState2 } from "@tanstack/react-
|
|
|
2708
2618
|
import Divider3 from "@mui/material/Divider";
|
|
2709
2619
|
import List3 from "@mui/material/List";
|
|
2710
2620
|
import ListSubheader from "@mui/material/ListSubheader";
|
|
2711
|
-
import { Fragment as Fragment5, useEffect as
|
|
2621
|
+
import { Fragment as Fragment5, useEffect as useEffect5, useState as useState7 } from "react";
|
|
2712
2622
|
|
|
2713
2623
|
// src/components/core/navigation/NavigationListItem.tsx
|
|
2714
2624
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
@@ -2722,9 +2632,9 @@ import ListItemText3 from "@mui/material/ListItemText";
|
|
|
2722
2632
|
import Paper2 from "@mui/material/Paper";
|
|
2723
2633
|
import { styled } from "@mui/material/styles";
|
|
2724
2634
|
import Typography7 from "@mui/material/Typography";
|
|
2725
|
-
import { Fragment as Fragment3, useMemo as
|
|
2635
|
+
import { Fragment as Fragment3, useMemo as useMemo3, useState as useState6 } from "react";
|
|
2726
2636
|
import { Collapse } from "@mui/material";
|
|
2727
|
-
import { Fragment as Fragment4, jsx as
|
|
2637
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2728
2638
|
var ICON_SIZE = 34;
|
|
2729
2639
|
var StyledNavButton = styled(ListItemButton4)(({ theme }) => ({
|
|
2730
2640
|
borderRadius: 8,
|
|
@@ -2768,12 +2678,12 @@ var StyledRouterButton = styled(RouterListItemButton)(({ theme }) => ({
|
|
|
2768
2678
|
}));
|
|
2769
2679
|
var IconOrAvatar = ({ item, collapsed }) => {
|
|
2770
2680
|
if (item.icon || collapsed) {
|
|
2771
|
-
return /* @__PURE__ */
|
|
2772
|
-
/* @__PURE__ */
|
|
2681
|
+
return /* @__PURE__ */ jsxs13(Box7, { sx: collapsed ? { position: "absolute", left: "50%", top: "calc(50% - 6px)", transform: "translate(-50%, -50%)" } : {}, children: [
|
|
2682
|
+
/* @__PURE__ */ jsxs13(ListItemIcon3, { sx: { display: "flex", alignItems: "center", justifyContent: "center", minWidth: ICON_SIZE }, children: [
|
|
2773
2683
|
item.icon ?? null,
|
|
2774
|
-
!item.icon && collapsed ? /* @__PURE__ */
|
|
2684
|
+
!item.icon && collapsed ? /* @__PURE__ */ jsx22(Avatar, { sx: { width: ICON_SIZE - 7, height: ICON_SIZE - 7, fontSize: 12 }, children: item.title }) : null
|
|
2775
2685
|
] }),
|
|
2776
|
-
collapsed ? /* @__PURE__ */
|
|
2686
|
+
collapsed ? /* @__PURE__ */ jsx22(
|
|
2777
2687
|
Typography7,
|
|
2778
2688
|
{
|
|
2779
2689
|
variant: "caption",
|
|
@@ -2797,7 +2707,7 @@ var IconOrAvatar = ({ item, collapsed }) => {
|
|
|
2797
2707
|
}
|
|
2798
2708
|
return null;
|
|
2799
2709
|
};
|
|
2800
|
-
var MiniPopover = ({ open, anchorEl, children }) => /* @__PURE__ */
|
|
2710
|
+
var MiniPopover = ({ open, anchorEl, children }) => /* @__PURE__ */ jsx22(
|
|
2801
2711
|
Popper,
|
|
2802
2712
|
{
|
|
2803
2713
|
open,
|
|
@@ -2808,7 +2718,7 @@ var MiniPopover = ({ open, anchorEl, children }) => /* @__PURE__ */ jsx23(
|
|
|
2808
2718
|
{ name: "preventOverflow", options: { padding: 8 } },
|
|
2809
2719
|
{ name: "flip", options: { fallbackPlacements: ["right-end", "left-start"] } }
|
|
2810
2720
|
],
|
|
2811
|
-
children: /* @__PURE__ */
|
|
2721
|
+
children: /* @__PURE__ */ jsx22(
|
|
2812
2722
|
Paper2,
|
|
2813
2723
|
{
|
|
2814
2724
|
sx: {
|
|
@@ -2824,9 +2734,9 @@ var MiniPopover = ({ open, anchorEl, children }) => /* @__PURE__ */ jsx23(
|
|
|
2824
2734
|
}
|
|
2825
2735
|
);
|
|
2826
2736
|
var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, onClick, renderNested, onClose }) => {
|
|
2827
|
-
const [hoveredPopoverItem, setHoveredPopoverItem] =
|
|
2828
|
-
const [anchorElement, setAnchorElement] =
|
|
2829
|
-
const chevronSx =
|
|
2737
|
+
const [hoveredPopoverItem, setHoveredPopoverItem] = useState6(null);
|
|
2738
|
+
const [anchorElement, setAnchorElement] = useState6(null);
|
|
2739
|
+
const chevronSx = useMemo3(() => {
|
|
2830
2740
|
if (collapsed && isSidebarFullyCollapsed && item.children) {
|
|
2831
2741
|
return {
|
|
2832
2742
|
fontSize: 18,
|
|
@@ -2850,9 +2760,9 @@ var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSideb
|
|
|
2850
2760
|
disabled,
|
|
2851
2761
|
sx: { px: 1.4, height: collapsed ? 60 : 48 }
|
|
2852
2762
|
};
|
|
2853
|
-
const buttonContent = /* @__PURE__ */
|
|
2854
|
-
/* @__PURE__ */
|
|
2855
|
-
!collapsed && /* @__PURE__ */
|
|
2763
|
+
const buttonContent = /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
2764
|
+
/* @__PURE__ */ jsx22(IconOrAvatar, { item, collapsed }),
|
|
2765
|
+
!collapsed && /* @__PURE__ */ jsx22(
|
|
2856
2766
|
ListItemText3,
|
|
2857
2767
|
{
|
|
2858
2768
|
primary: item.title,
|
|
@@ -2860,9 +2770,9 @@ var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSideb
|
|
|
2860
2770
|
sx: { ml: 1.2, flex: 1, minWidth: 0, "& .MuiTypography-root": { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }
|
|
2861
2771
|
}
|
|
2862
2772
|
),
|
|
2863
|
-
item.children ? /* @__PURE__ */
|
|
2773
|
+
item.children ? /* @__PURE__ */ jsx22(ExpandMoreIcon, { sx: chevronSx }) : null
|
|
2864
2774
|
] });
|
|
2865
|
-
const listItem = /* @__PURE__ */
|
|
2775
|
+
const listItem = /* @__PURE__ */ jsxs13(
|
|
2866
2776
|
ListItem,
|
|
2867
2777
|
{
|
|
2868
2778
|
...item.children && collapsed ? {
|
|
@@ -2876,7 +2786,7 @@ var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSideb
|
|
|
2876
2786
|
} : {},
|
|
2877
2787
|
sx: { py: 0, px: 1, overflowX: "hidden" },
|
|
2878
2788
|
children: [
|
|
2879
|
-
shouldJustExpand ? /* @__PURE__ */
|
|
2789
|
+
shouldJustExpand ? /* @__PURE__ */ jsx22(StyledNavButton, { ...buttonProps, onClick: () => onClick?.(item), children: buttonContent }) : /* @__PURE__ */ jsx22(
|
|
2880
2790
|
StyledRouterButton,
|
|
2881
2791
|
{
|
|
2882
2792
|
...buttonProps,
|
|
@@ -2888,28 +2798,28 @@ var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSideb
|
|
|
2888
2798
|
children: buttonContent
|
|
2889
2799
|
}
|
|
2890
2800
|
),
|
|
2891
|
-
item.children && collapsed ? /* @__PURE__ */
|
|
2801
|
+
item.children && collapsed ? /* @__PURE__ */ jsx22(MiniPopover, { open: item.title === hoveredPopoverItem, anchorEl: anchorElement, children: renderNested?.(item.children) }) : null
|
|
2892
2802
|
]
|
|
2893
2803
|
}
|
|
2894
2804
|
);
|
|
2895
|
-
return /* @__PURE__ */
|
|
2805
|
+
return /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
2896
2806
|
listItem,
|
|
2897
|
-
item.children && !collapsed ? /* @__PURE__ */
|
|
2807
|
+
item.children && !collapsed ? /* @__PURE__ */ jsx22(Collapse, { in: isOpen, timeout: "auto", unmountOnExit: true, children: renderNested?.(item.children) }) : null
|
|
2898
2808
|
] }, item.to);
|
|
2899
2809
|
};
|
|
2900
2810
|
|
|
2901
2811
|
// src/components/core/navigation/NavigationList.tsx
|
|
2902
|
-
import { jsx as
|
|
2812
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2903
2813
|
var isPageItem = (item) => !("kind" in item);
|
|
2904
2814
|
var isDivider = (item) => "kind" in item && item.kind === "divider";
|
|
2905
2815
|
var isHeader = (item) => "kind" in item && item.kind === "header";
|
|
2906
2816
|
var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, expandedWidth, renderItem, activePath, onNavigate, onClose }) => {
|
|
2907
|
-
const [openKeys, setOpenKeys] =
|
|
2908
|
-
|
|
2817
|
+
const [openKeys, setOpenKeys] = useState7([]);
|
|
2818
|
+
useEffect5(() => {
|
|
2909
2819
|
if (collapsed) setOpenKeys([]);
|
|
2910
2820
|
}, [collapsed]);
|
|
2911
2821
|
const toggleKey = (key) => setOpenKeys((previous) => previous.includes(key) ? previous.filter((k) => k !== key) : [...previous, key]);
|
|
2912
|
-
const renderNested = (children) => /* @__PURE__ */
|
|
2822
|
+
const renderNested = (children) => /* @__PURE__ */ jsx23(
|
|
2913
2823
|
NavigationList,
|
|
2914
2824
|
{
|
|
2915
2825
|
subNavigation: children,
|
|
@@ -2922,7 +2832,7 @@ var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSideba
|
|
|
2922
2832
|
}
|
|
2923
2833
|
);
|
|
2924
2834
|
const filteredNavigation = subNavigation.filter((nav) => !nav.hidden);
|
|
2925
|
-
return /* @__PURE__ */
|
|
2835
|
+
return /* @__PURE__ */ jsx23(
|
|
2926
2836
|
List3,
|
|
2927
2837
|
{
|
|
2928
2838
|
sx: {
|
|
@@ -2935,7 +2845,7 @@ var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSideba
|
|
|
2935
2845
|
},
|
|
2936
2846
|
children: filteredNavigation.map((navItem, index) => {
|
|
2937
2847
|
if (isHeader(navItem)) {
|
|
2938
|
-
return /* @__PURE__ */
|
|
2848
|
+
return /* @__PURE__ */ jsx23(
|
|
2939
2849
|
ListSubheader,
|
|
2940
2850
|
{
|
|
2941
2851
|
sx: {
|
|
@@ -2958,13 +2868,13 @@ var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSideba
|
|
|
2958
2868
|
}
|
|
2959
2869
|
if (isDivider(navItem)) {
|
|
2960
2870
|
const nextItem = filteredNavigation[index + 1];
|
|
2961
|
-
return /* @__PURE__ */
|
|
2871
|
+
return /* @__PURE__ */ jsx23("li", { children: /* @__PURE__ */ jsx23(Divider3, { sx: { mx: 1, mt: 1, mb: isHeader(nextItem) && !collapsed ? 0 : 1 } }) }, `divider-${depth}-${index}`);
|
|
2962
2872
|
}
|
|
2963
2873
|
if (!isPageItem(navItem)) return null;
|
|
2964
2874
|
const key = `item-${depth}-${index}`;
|
|
2965
2875
|
const uniqueItemKey = `${depth}-${index}-${navItem.title}`;
|
|
2966
|
-
if (renderItem) return /* @__PURE__ */
|
|
2967
|
-
return /* @__PURE__ */
|
|
2876
|
+
if (renderItem) return /* @__PURE__ */ jsx23(Fragment5, { children: renderItem(navItem, { collapsed: !!collapsed }) }, key);
|
|
2877
|
+
return /* @__PURE__ */ jsx23(
|
|
2968
2878
|
NavigationListItem,
|
|
2969
2879
|
{
|
|
2970
2880
|
item: navItem,
|
|
@@ -2985,7 +2895,7 @@ var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSideba
|
|
|
2985
2895
|
};
|
|
2986
2896
|
|
|
2987
2897
|
// src/components/core/navigation/NavigationRail.tsx
|
|
2988
|
-
import { jsx as
|
|
2898
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2989
2899
|
var MINI_WIDTH = 84;
|
|
2990
2900
|
var EXPANDED_WIDTH = 320;
|
|
2991
2901
|
var TOOLBAR_HEIGHT = 64;
|
|
@@ -2994,7 +2904,7 @@ var NavigationRail = ({ navigation, expanded, setExpanded }) => {
|
|
|
2994
2904
|
const routerState = useRouterState2();
|
|
2995
2905
|
const theme = useTheme2();
|
|
2996
2906
|
const showPermanent = useMediaQuery(theme.breakpoints.up("sm"));
|
|
2997
|
-
const drawerContent = (collapsed) => /* @__PURE__ */
|
|
2907
|
+
const drawerContent = (collapsed) => /* @__PURE__ */ jsx24(
|
|
2998
2908
|
Box8,
|
|
2999
2909
|
{
|
|
3000
2910
|
component: "nav",
|
|
@@ -3008,7 +2918,7 @@ var NavigationRail = ({ navigation, expanded, setExpanded }) => {
|
|
|
3008
2918
|
overflowX: "hidden",
|
|
3009
2919
|
pt: navigation[0] && isHeader(navigation[0]) && !collapsed ? 0 : 2
|
|
3010
2920
|
},
|
|
3011
|
-
children: /* @__PURE__ */
|
|
2921
|
+
children: /* @__PURE__ */ jsx24(
|
|
3012
2922
|
NavigationList,
|
|
3013
2923
|
{
|
|
3014
2924
|
subNavigation: navigation,
|
|
@@ -3024,7 +2934,7 @@ var NavigationRail = ({ navigation, expanded, setExpanded }) => {
|
|
|
3024
2934
|
}
|
|
3025
2935
|
);
|
|
3026
2936
|
if (showPermanent)
|
|
3027
|
-
return /* @__PURE__ */
|
|
2937
|
+
return /* @__PURE__ */ jsx24(
|
|
3028
2938
|
Drawer,
|
|
3029
2939
|
{
|
|
3030
2940
|
variant: "permanent",
|
|
@@ -3042,7 +2952,7 @@ var NavigationRail = ({ navigation, expanded, setExpanded }) => {
|
|
|
3042
2952
|
children: drawerContent(!expanded)
|
|
3043
2953
|
}
|
|
3044
2954
|
);
|
|
3045
|
-
return /* @__PURE__ */
|
|
2955
|
+
return /* @__PURE__ */ jsx24(Drawer, { open: expanded, onClose: () => setExpanded(false), children: drawerContent(!expanded) });
|
|
3046
2956
|
};
|
|
3047
2957
|
|
|
3048
2958
|
// src/components/core/ToolbarAccount.tsx
|
|
@@ -3057,17 +2967,17 @@ import Logout from "@mui/icons-material/Logout";
|
|
|
3057
2967
|
import SettingsBrightness from "@mui/icons-material/SettingsBrightness";
|
|
3058
2968
|
import Translate from "@mui/icons-material/Translate";
|
|
3059
2969
|
import { Avatar as Avatar2, Box as Box9, IconButton as IconButton4, List as List4, ListItem as ListItem2, ListItemButton as ListItemButton5, ListItemIcon as ListItemIcon4, ListItemText as ListItemText4, ListSubheader as ListSubheader2, Menu as Menu2, Typography as Typography8, useColorScheme } from "@mui/material";
|
|
3060
|
-
import { Fragment as Fragment6, useState as
|
|
2970
|
+
import { Fragment as Fragment6, useState as useState8 } from "react";
|
|
3061
2971
|
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
3062
|
-
import { jsx as
|
|
2972
|
+
import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3063
2973
|
var ToolbarAccount = () => {
|
|
3064
|
-
const [anchorElement, setAnchorElement] =
|
|
3065
|
-
const [tab, setTab] =
|
|
2974
|
+
const [anchorElement, setAnchorElement] = useState8();
|
|
2975
|
+
const [tab, setTab] = useState8("settings");
|
|
3066
2976
|
const open = Boolean(anchorElement);
|
|
3067
|
-
const { t: t2, i18n
|
|
2977
|
+
const { t: t2, i18n } = useTranslation5();
|
|
3068
2978
|
const { mode, setMode } = useColorScheme();
|
|
3069
2979
|
const changeLanguage = (newLanguage) => () => {
|
|
3070
|
-
|
|
2980
|
+
i18n.changeLanguage(newLanguage).finally(() => closeMenu());
|
|
3071
2981
|
};
|
|
3072
2982
|
const changeMode = (newMode) => () => {
|
|
3073
2983
|
setMode(newMode);
|
|
@@ -3102,60 +3012,60 @@ var ToolbarAccount = () => {
|
|
|
3102
3012
|
setTimeout(() => setTab("settings"), 300);
|
|
3103
3013
|
};
|
|
3104
3014
|
const changeTab = (newTab) => () => setTab(newTab);
|
|
3105
|
-
const settings = /* @__PURE__ */
|
|
3106
|
-
/* @__PURE__ */
|
|
3107
|
-
/* @__PURE__ */
|
|
3108
|
-
/* @__PURE__ */
|
|
3109
|
-
/* @__PURE__ */
|
|
3015
|
+
const settings = /* @__PURE__ */ jsxs14(List4, { component: "nav", subheader: /* @__PURE__ */ jsx25(ListSubheader2, { sx: { backgroundColor: "transparent" }, children: t2("Layout.Settings") }), children: [
|
|
3016
|
+
/* @__PURE__ */ jsxs14(ListItemButton5, { onClick: changeTab("theme"), sx: { py: 0.3 }, children: [
|
|
3017
|
+
/* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(Brightness4, {}) }),
|
|
3018
|
+
/* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Appearance"), secondary: getModeText() }),
|
|
3019
|
+
/* @__PURE__ */ jsx25(ChevronRight, {})
|
|
3110
3020
|
] }),
|
|
3111
|
-
/* @__PURE__ */
|
|
3112
|
-
/* @__PURE__ */
|
|
3113
|
-
/* @__PURE__ */
|
|
3114
|
-
/* @__PURE__ */
|
|
3021
|
+
/* @__PURE__ */ jsxs14(ListItemButton5, { onClick: changeTab("language"), sx: { py: 0.3 }, children: [
|
|
3022
|
+
/* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(Translate, {}) }),
|
|
3023
|
+
/* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Language"), secondary: i18n.resolvedLanguage === "en" ? "English" : "\u010Ce\u0161tina" }),
|
|
3024
|
+
/* @__PURE__ */ jsx25(ChevronRight, {})
|
|
3115
3025
|
] })
|
|
3116
3026
|
] });
|
|
3117
|
-
const theme = /* @__PURE__ */
|
|
3118
|
-
/* @__PURE__ */
|
|
3027
|
+
const theme = /* @__PURE__ */ jsxs14(List4, { subheader: /* @__PURE__ */ jsxs14(ListSubheader2, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
|
|
3028
|
+
/* @__PURE__ */ jsx25(IconButton4, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx25(ArrowBack, { fontSize: "small" }) }),
|
|
3119
3029
|
" ",
|
|
3120
3030
|
t2("Layout.Appearance")
|
|
3121
3031
|
] }), children: [
|
|
3122
|
-
/* @__PURE__ */
|
|
3123
|
-
/* @__PURE__ */
|
|
3124
|
-
/* @__PURE__ */
|
|
3032
|
+
/* @__PURE__ */ jsxs14(ListItemButton5, { onClick: changeMode("light"), disabled: mode === "light", children: [
|
|
3033
|
+
/* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(LightMode, {}) }),
|
|
3034
|
+
/* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Light") })
|
|
3125
3035
|
] }),
|
|
3126
|
-
/* @__PURE__ */
|
|
3127
|
-
/* @__PURE__ */
|
|
3128
|
-
/* @__PURE__ */
|
|
3036
|
+
/* @__PURE__ */ jsxs14(ListItemButton5, { onClick: changeMode("dark"), disabled: mode === "dark", children: [
|
|
3037
|
+
/* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(DarkMode, {}) }),
|
|
3038
|
+
/* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Dark") })
|
|
3129
3039
|
] }),
|
|
3130
|
-
/* @__PURE__ */
|
|
3131
|
-
/* @__PURE__ */
|
|
3132
|
-
/* @__PURE__ */
|
|
3040
|
+
/* @__PURE__ */ jsxs14(ListItemButton5, { onClick: changeMode("system"), disabled: mode === "system", children: [
|
|
3041
|
+
/* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(SettingsBrightness, {}) }),
|
|
3042
|
+
/* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.System") })
|
|
3133
3043
|
] })
|
|
3134
3044
|
] });
|
|
3135
|
-
const language = /* @__PURE__ */
|
|
3136
|
-
/* @__PURE__ */
|
|
3045
|
+
const language = /* @__PURE__ */ jsxs14(List4, { subheader: /* @__PURE__ */ jsxs14(ListSubheader2, { onClick: changeTab("settings"), sx: { backgroundColor: "transparent", display: "flex", alignItems: "center", px: 1, cursor: "pointer" }, children: [
|
|
3046
|
+
/* @__PURE__ */ jsx25(IconButton4, { size: "small", sx: { mr: 0.5 }, children: /* @__PURE__ */ jsx25(ArrowBack, { fontSize: "small" }) }),
|
|
3137
3047
|
" ",
|
|
3138
3048
|
t2("Layout.Language")
|
|
3139
3049
|
] }), children: [
|
|
3140
|
-
/* @__PURE__ */
|
|
3141
|
-
/* @__PURE__ */
|
|
3050
|
+
/* @__PURE__ */ jsx25(ListItemButton5, { onClick: changeLanguage("en"), disabled: i18n.resolvedLanguage === "en", children: /* @__PURE__ */ jsx25(ListItemText4, { primary: "English" }) }),
|
|
3051
|
+
/* @__PURE__ */ jsx25(ListItemButton5, { onClick: changeLanguage("cs"), disabled: i18n.resolvedLanguage === "cs", children: /* @__PURE__ */ jsx25(ListItemText4, { primary: "\u010Ce\u0161tina" }) })
|
|
3142
3052
|
] });
|
|
3143
|
-
return /* @__PURE__ */
|
|
3144
|
-
/* @__PURE__ */
|
|
3145
|
-
/* @__PURE__ */
|
|
3146
|
-
/* @__PURE__ */
|
|
3147
|
-
/* @__PURE__ */
|
|
3148
|
-
/* @__PURE__ */
|
|
3149
|
-
/* @__PURE__ */
|
|
3150
|
-
/* @__PURE__ */
|
|
3053
|
+
return /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
3054
|
+
/* @__PURE__ */ jsx25(IconButton4, { size: "small", edge: "end", onClick: openMenu, children: user.name ? /* @__PURE__ */ jsx25(Avatar2, { sx: { width: { xs: 32, sm: 40 }, height: { xs: 32, sm: 40 }, bgcolor: "primary.main" }, children: /* @__PURE__ */ jsx25(Typography8, { variant: "subtitle2", sx: { fontWeight: "bold", lineHeight: 0 }, children: usernameInitials() }) }) : /* @__PURE__ */ jsx25(AccountCircle, { fontSize: "large" }) }),
|
|
3055
|
+
/* @__PURE__ */ jsx25(Menu2, { anchorEl: anchorElement, open, onClose: closeMenu, children: /* @__PURE__ */ jsxs14(Box9, { sx: { width: 240 }, children: [
|
|
3056
|
+
/* @__PURE__ */ jsx25(List4, { children: user.name ? /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
3057
|
+
/* @__PURE__ */ jsx25(ListItem2, { children: /* @__PURE__ */ jsx25(ListItemText4, { primary: user.name, secondary: /* @__PURE__ */ jsxs14("span", { children: [
|
|
3058
|
+
/* @__PURE__ */ jsx25("span", { children: user.employeeId }),
|
|
3059
|
+
/* @__PURE__ */ jsx25("br", {}),
|
|
3060
|
+
/* @__PURE__ */ jsx25("span", { children: user.department })
|
|
3151
3061
|
] }) }) }),
|
|
3152
|
-
/* @__PURE__ */
|
|
3153
|
-
/* @__PURE__ */
|
|
3154
|
-
/* @__PURE__ */
|
|
3062
|
+
/* @__PURE__ */ jsxs14(ListItemButton5, { onClick: () => console.log("Logout"), children: [
|
|
3063
|
+
/* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(Logout, { color: "error" }) }),
|
|
3064
|
+
/* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.Logout") })
|
|
3155
3065
|
] })
|
|
3156
|
-
] }) : /* @__PURE__ */
|
|
3157
|
-
/* @__PURE__ */
|
|
3158
|
-
/* @__PURE__ */
|
|
3066
|
+
] }) : /* @__PURE__ */ jsxs14(ListItemButton5, { onClick: () => console.log("Login"), children: [
|
|
3067
|
+
/* @__PURE__ */ jsx25(ListItemIcon4, { children: /* @__PURE__ */ jsx25(Login, { color: "success" }) }),
|
|
3068
|
+
/* @__PURE__ */ jsx25(ListItemText4, { primary: t2("Layout.LogIn") })
|
|
3159
3069
|
] }) }),
|
|
3160
3070
|
tab === "settings" && settings,
|
|
3161
3071
|
tab === "theme" && theme,
|
|
@@ -3165,7 +3075,7 @@ var ToolbarAccount = () => {
|
|
|
3165
3075
|
};
|
|
3166
3076
|
|
|
3167
3077
|
// src/components/core/Layout.tsx
|
|
3168
|
-
import { jsx as
|
|
3078
|
+
import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3169
3079
|
var DrawerHeader = styled2("div")(({ theme }) => ({
|
|
3170
3080
|
display: "flex",
|
|
3171
3081
|
alignItems: "center",
|
|
@@ -3177,11 +3087,11 @@ var Layout = (props) => {
|
|
|
3177
3087
|
const [navigationOpen, setNavigationOpen] = useLocalStorageState("navigationOpen", { defaultServerValue: false });
|
|
3178
3088
|
const isFetching = !!useIsFetching();
|
|
3179
3089
|
const isMutating = !!useIsMutating();
|
|
3180
|
-
return /* @__PURE__ */
|
|
3181
|
-
/* @__PURE__ */
|
|
3182
|
-
/* @__PURE__ */
|
|
3183
|
-
/* @__PURE__ */
|
|
3184
|
-
/* @__PURE__ */
|
|
3090
|
+
return /* @__PURE__ */ jsxs15(Fragment7, { children: [
|
|
3091
|
+
/* @__PURE__ */ jsx26(InitColorSchemeScript, {}),
|
|
3092
|
+
/* @__PURE__ */ jsx26(CssBaseline, {}),
|
|
3093
|
+
/* @__PURE__ */ jsxs15(Box10, { sx: { display: "flex", height: "100dvh", maxHeight: "100dvh", overflow: "hidden", width: "100%" }, children: [
|
|
3094
|
+
/* @__PURE__ */ jsx26(
|
|
3185
3095
|
AppBar,
|
|
3186
3096
|
{
|
|
3187
3097
|
color: "transparent",
|
|
@@ -3191,27 +3101,27 @@ var Layout = (props) => {
|
|
|
3191
3101
|
borderColor: theme.vars?.palette.divider,
|
|
3192
3102
|
boxShadow: "none"
|
|
3193
3103
|
}),
|
|
3194
|
-
children: /* @__PURE__ */
|
|
3195
|
-
props.navigation && /* @__PURE__ */
|
|
3104
|
+
children: /* @__PURE__ */ jsxs15(Toolbar, { children: [
|
|
3105
|
+
props.navigation && /* @__PURE__ */ jsx26(
|
|
3196
3106
|
IconButton5,
|
|
3197
3107
|
{
|
|
3198
3108
|
onClick: () => setNavigationOpen((previous) => !previous),
|
|
3199
3109
|
sx: { marginRight: 2 },
|
|
3200
|
-
children: navigationOpen ? /* @__PURE__ */
|
|
3110
|
+
children: navigationOpen ? /* @__PURE__ */ jsx26(MenuOpen, {}) : /* @__PURE__ */ jsx26(Menu3, {})
|
|
3201
3111
|
}
|
|
3202
3112
|
),
|
|
3203
|
-
/* @__PURE__ */
|
|
3204
|
-
/* @__PURE__ */
|
|
3113
|
+
/* @__PURE__ */ jsx26(AppTitle, {}),
|
|
3114
|
+
/* @__PURE__ */ jsx26(ToolbarAccount, {})
|
|
3205
3115
|
] })
|
|
3206
3116
|
}
|
|
3207
3117
|
),
|
|
3208
|
-
props.navigation && /* @__PURE__ */
|
|
3209
|
-
/* @__PURE__ */
|
|
3210
|
-
/* @__PURE__ */
|
|
3211
|
-
/* @__PURE__ */
|
|
3118
|
+
props.navigation && /* @__PURE__ */ jsx26(NavigationRail, { navigation: props.navigation, expanded: navigationOpen ?? false, setExpanded: setNavigationOpen }),
|
|
3119
|
+
/* @__PURE__ */ jsxs15(Box10, { component: "main", sx: { flexGrow: 1, display: "flex", flexDirection: "column", minWidth: 0, height: "100%", overflow: "hidden" }, children: [
|
|
3120
|
+
/* @__PURE__ */ jsx26(DrawerHeader, {}),
|
|
3121
|
+
/* @__PURE__ */ jsx26(Box10, { sx: { flex: 1, overflow: "auto", position: "relative" }, children: props.children })
|
|
3212
3122
|
] })
|
|
3213
3123
|
] }),
|
|
3214
|
-
(isFetching || isMutating) && /* @__PURE__ */
|
|
3124
|
+
(isFetching || isMutating) && /* @__PURE__ */ jsx26(LinearProgress, { sx: { position: "fixed", top: { xs: 56, sm: 64 }, left: 0, right: 0 } })
|
|
3215
3125
|
] });
|
|
3216
3126
|
};
|
|
3217
3127
|
|
|
@@ -3924,7 +3834,7 @@ import { useTranslation as useTranslation6 } from "react-i18next";
|
|
|
3924
3834
|
var WISTRON_PRIMARY_COLOR = "#00506E";
|
|
3925
3835
|
var WISTRON_SECONDARY_COLOR = "#64DC00";
|
|
3926
3836
|
var useGetTheme = (theme) => {
|
|
3927
|
-
const { i18n
|
|
3837
|
+
const { i18n } = useTranslation6();
|
|
3928
3838
|
return createTheme(
|
|
3929
3839
|
{
|
|
3930
3840
|
cssVariables: {
|
|
@@ -3975,27 +3885,98 @@ var useGetTheme = (theme) => {
|
|
|
3975
3885
|
...theme?.components
|
|
3976
3886
|
}
|
|
3977
3887
|
},
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3888
|
+
i18n.resolvedLanguage === "cs" ? csCZ : enUS2,
|
|
3889
|
+
i18n.resolvedLanguage === "cs" ? csCZ2 : enUS,
|
|
3890
|
+
i18n.resolvedLanguage === "cs" ? csCZ3 : enUS3
|
|
3981
3891
|
);
|
|
3982
3892
|
};
|
|
3983
3893
|
|
|
3894
|
+
// src/providers/DialogsProvider.tsx
|
|
3895
|
+
import { useCallback, useId, useMemo as useMemo4, useRef as useRef3, useState as useState9 } from "react";
|
|
3896
|
+
import { jsx as jsx27, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
3897
|
+
function DialogsProvider({ children, unmountAfter = 1e3 }) {
|
|
3898
|
+
const [stack, setStack] = useState9([]);
|
|
3899
|
+
const keyPrefix = useId();
|
|
3900
|
+
const nextId = useRef3(0);
|
|
3901
|
+
const dialogMetadata = useRef3(/* @__PURE__ */ new WeakMap());
|
|
3902
|
+
const requestDialog = useEventCallback_default(function open(Component7, payload, options = {}) {
|
|
3903
|
+
const { onClose = async () => {
|
|
3904
|
+
} } = options;
|
|
3905
|
+
let resolve;
|
|
3906
|
+
const promise = new Promise((resolveImpl) => {
|
|
3907
|
+
resolve = resolveImpl;
|
|
3908
|
+
});
|
|
3909
|
+
const key = `${keyPrefix}-${nextId.current}`;
|
|
3910
|
+
nextId.current += 1;
|
|
3911
|
+
const newEntry = {
|
|
3912
|
+
key,
|
|
3913
|
+
open: true,
|
|
3914
|
+
promise,
|
|
3915
|
+
Component: Component7,
|
|
3916
|
+
payload,
|
|
3917
|
+
onClose,
|
|
3918
|
+
resolve
|
|
3919
|
+
};
|
|
3920
|
+
dialogMetadata.current.set(promise, newEntry);
|
|
3921
|
+
setStack((previousStack) => [...previousStack, newEntry]);
|
|
3922
|
+
return promise;
|
|
3923
|
+
});
|
|
3924
|
+
const removeDialogFromStack = useCallback((dialog) => {
|
|
3925
|
+
setStack((previousStack) => previousStack.filter((entry) => entry.promise !== dialog));
|
|
3926
|
+
dialogMetadata.current.delete(dialog);
|
|
3927
|
+
}, []);
|
|
3928
|
+
const closeDialogUi = useEventCallback_default(function closeDialogUi2(dialog) {
|
|
3929
|
+
setStack(
|
|
3930
|
+
(previousStack) => previousStack.map((entry) => entry.promise === dialog ? { ...entry, open: false } : entry)
|
|
3931
|
+
);
|
|
3932
|
+
setTimeout(() => removeDialogFromStack(dialog), unmountAfter);
|
|
3933
|
+
});
|
|
3934
|
+
const closeDialog = useEventCallback_default(async function closeDialog2(dialog, result) {
|
|
3935
|
+
const entryToClose = dialogMetadata.current.get(dialog);
|
|
3936
|
+
if (!entryToClose) {
|
|
3937
|
+
throw new Error("Dialog not found in stack");
|
|
3938
|
+
}
|
|
3939
|
+
try {
|
|
3940
|
+
await entryToClose.onClose(result);
|
|
3941
|
+
} finally {
|
|
3942
|
+
entryToClose.resolve(result);
|
|
3943
|
+
closeDialogUi(dialog);
|
|
3944
|
+
}
|
|
3945
|
+
return dialog;
|
|
3946
|
+
});
|
|
3947
|
+
const contextValue = useMemo4(() => ({ open: requestDialog, close: closeDialog }), [requestDialog, closeDialog]);
|
|
3948
|
+
return /* @__PURE__ */ jsxs16(DialogsContext.Provider, { value: contextValue, children: [
|
|
3949
|
+
children,
|
|
3950
|
+
stack.map(({ key, open, Component: Component7, payload, promise }) => /* @__PURE__ */ jsx27(
|
|
3951
|
+
Component7,
|
|
3952
|
+
{
|
|
3953
|
+
payload,
|
|
3954
|
+
open,
|
|
3955
|
+
onClose: async (result) => {
|
|
3956
|
+
await closeDialog(promise, result);
|
|
3957
|
+
}
|
|
3958
|
+
},
|
|
3959
|
+
key
|
|
3960
|
+
))
|
|
3961
|
+
] });
|
|
3962
|
+
}
|
|
3963
|
+
|
|
3984
3964
|
// src/providers/LayoutProvider.tsx
|
|
3985
3965
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3986
3966
|
var LayoutProvider = ({ navigation, theme, children }) => {
|
|
3967
|
+
const { i18n } = useTranslation7();
|
|
3987
3968
|
const createdTheme = useGetTheme(theme);
|
|
3988
|
-
|
|
3969
|
+
useEffect6(() => {
|
|
3989
3970
|
const handler = () => {
|
|
3990
|
-
z.config(
|
|
3971
|
+
z.config(i18n.resolvedLanguage === "cs" ? cs() : en());
|
|
3991
3972
|
};
|
|
3992
3973
|
handler();
|
|
3993
|
-
|
|
3974
|
+
i18n.on("languageChanged", handler);
|
|
3994
3975
|
return () => {
|
|
3995
|
-
|
|
3976
|
+
i18n.off("languageChanged", handler);
|
|
3996
3977
|
};
|
|
3997
3978
|
}, []);
|
|
3998
|
-
return /* @__PURE__ */ jsx28(ThemeProvider, { theme: createdTheme, children: /* @__PURE__ */ jsx28(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale:
|
|
3979
|
+
return /* @__PURE__ */ jsx28(ThemeProvider, { theme: createdTheme, children: /* @__PURE__ */ jsx28(LocalizationProvider, { dateAdapter: AdapterDayjs, adapterLocale: i18n.resolvedLanguage, children: /* @__PURE__ */ jsx28(DialogsProvider, { children: /* @__PURE__ */ jsx28(Layout, { navigation, children }) }) }) });
|
|
3999
3980
|
};
|
|
4000
3981
|
|
|
4001
3982
|
// src/index.ts
|
|
@@ -4301,8 +4282,8 @@ var { useAppForm: useLayoutForm, withForm: withLayoutForm } = createFormHook({
|
|
|
4301
4282
|
});
|
|
4302
4283
|
|
|
4303
4284
|
// src/index.ts
|
|
4304
|
-
import { default as
|
|
4305
|
-
import { useTranslation as
|
|
4285
|
+
import { default as default2 } from "use-local-storage-state";
|
|
4286
|
+
import { useTranslation as useTranslation8 } from "react-i18next";
|
|
4306
4287
|
import { t } from "i18next";
|
|
4307
4288
|
export {
|
|
4308
4289
|
ChipInputCell,
|
|
@@ -4334,9 +4315,9 @@ export {
|
|
|
4334
4315
|
useGetFileMetas,
|
|
4335
4316
|
useGetFileThumbnail,
|
|
4336
4317
|
useLayoutForm,
|
|
4337
|
-
|
|
4318
|
+
default2 as useLocalStorageState,
|
|
4338
4319
|
useOpenFile,
|
|
4339
|
-
|
|
4320
|
+
useTranslation8 as useTranslation,
|
|
4340
4321
|
useUpdateFileMeta,
|
|
4341
4322
|
useUploadFile,
|
|
4342
4323
|
uuidv72 as uuidv7,
|