wcz-test 4.6.12 → 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 +182 -191
- package/dist/index.js.map +1 -1
- package/package.json +10 -11
package/dist/index.js
CHANGED
|
@@ -1274,7 +1274,7 @@ var rootRouteHead = ({ title }) => () => ({
|
|
|
1274
1274
|
{ rel: "apple-touch-icon", sizes: "180x180", href: "/apple-touch-icon.png" },
|
|
1275
1275
|
{ rel: "icon", type: "image/png", sizes: "32x32", href: "/favicon-32x32.png" },
|
|
1276
1276
|
{ rel: "icon", type: "image/png", sizes: "16x16", href: "/favicon-16x16.png" },
|
|
1277
|
-
{ rel: "manifest", href: "/
|
|
1277
|
+
{ rel: "manifest", href: "/manifest" },
|
|
1278
1278
|
{ rel: "icon", href: "/favicon.ico" }
|
|
1279
1279
|
]
|
|
1280
1280
|
});
|
|
@@ -1826,6 +1826,9 @@ var RouterError = ({ error }) => {
|
|
|
1826
1826
|
] }) });
|
|
1827
1827
|
};
|
|
1828
1828
|
|
|
1829
|
+
// src/providers/LayoutProvider.tsx
|
|
1830
|
+
import { ThemeProvider } from "@mui/material";
|
|
1831
|
+
|
|
1829
1832
|
// node_modules/@babel/runtime/helpers/esm/extends.js
|
|
1830
1833
|
function _extends() {
|
|
1831
1834
|
return _extends = Object.assign ? Object.assign.bind() : function(n) {
|
|
@@ -2591,93 +2594,10 @@ var AdapterDayjs = class {
|
|
|
2591
2594
|
|
|
2592
2595
|
// src/providers/LayoutProvider.tsx
|
|
2593
2596
|
import { useEffect as useEffect6 } from "react";
|
|
2597
|
+
import { useTranslation as useTranslation7 } from "react-i18next";
|
|
2594
2598
|
import * as z from "zod";
|
|
2595
2599
|
import { cs, en } from "zod/locales";
|
|
2596
2600
|
|
|
2597
|
-
// src/providers/DialogsProvider.tsx
|
|
2598
|
-
import { useCallback, useId, useMemo as useMemo3, useRef as useRef3, useState as useState6 } from "react";
|
|
2599
|
-
import { jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2600
|
-
function DialogsProvider({ children, unmountAfter = 1e3 }) {
|
|
2601
|
-
const [stack, setStack] = useState6([]);
|
|
2602
|
-
const keyPrefix = useId();
|
|
2603
|
-
const nextId = useRef3(0);
|
|
2604
|
-
const dialogMetadata = useRef3(/* @__PURE__ */ new WeakMap());
|
|
2605
|
-
const requestDialog = useEventCallback_default(function open(Component7, payload, options = {}) {
|
|
2606
|
-
const { onClose = async () => {
|
|
2607
|
-
} } = options;
|
|
2608
|
-
let resolve;
|
|
2609
|
-
const promise = new Promise((resolveImpl) => {
|
|
2610
|
-
resolve = resolveImpl;
|
|
2611
|
-
});
|
|
2612
|
-
const key = `${keyPrefix}-${nextId.current}`;
|
|
2613
|
-
nextId.current += 1;
|
|
2614
|
-
const newEntry = {
|
|
2615
|
-
key,
|
|
2616
|
-
open: true,
|
|
2617
|
-
promise,
|
|
2618
|
-
Component: Component7,
|
|
2619
|
-
payload,
|
|
2620
|
-
onClose,
|
|
2621
|
-
resolve
|
|
2622
|
-
};
|
|
2623
|
-
dialogMetadata.current.set(promise, newEntry);
|
|
2624
|
-
setStack((previousStack) => [...previousStack, newEntry]);
|
|
2625
|
-
return promise;
|
|
2626
|
-
});
|
|
2627
|
-
const removeDialogFromStack = useCallback((dialog) => {
|
|
2628
|
-
setStack((previousStack) => previousStack.filter((entry) => entry.promise !== dialog));
|
|
2629
|
-
dialogMetadata.current.delete(dialog);
|
|
2630
|
-
}, []);
|
|
2631
|
-
const closeDialogUi = useEventCallback_default(function closeDialogUi2(dialog) {
|
|
2632
|
-
setStack(
|
|
2633
|
-
(previousStack) => previousStack.map((entry) => entry.promise === dialog ? { ...entry, open: false } : entry)
|
|
2634
|
-
);
|
|
2635
|
-
setTimeout(() => removeDialogFromStack(dialog), unmountAfter);
|
|
2636
|
-
});
|
|
2637
|
-
const closeDialog = useEventCallback_default(async function closeDialog2(dialog, result) {
|
|
2638
|
-
const entryToClose = dialogMetadata.current.get(dialog);
|
|
2639
|
-
if (!entryToClose) {
|
|
2640
|
-
throw new Error("Dialog not found in stack");
|
|
2641
|
-
}
|
|
2642
|
-
try {
|
|
2643
|
-
await entryToClose.onClose(result);
|
|
2644
|
-
} finally {
|
|
2645
|
-
entryToClose.resolve(result);
|
|
2646
|
-
closeDialogUi(dialog);
|
|
2647
|
-
}
|
|
2648
|
-
return dialog;
|
|
2649
|
-
});
|
|
2650
|
-
const contextValue = useMemo3(() => ({ open: requestDialog, close: closeDialog }), [requestDialog, closeDialog]);
|
|
2651
|
-
return /* @__PURE__ */ jsxs13(DialogsContext.Provider, { value: contextValue, children: [
|
|
2652
|
-
children,
|
|
2653
|
-
stack.map(({ key, open, Component: Component7, payload, promise }) => /* @__PURE__ */ jsx22(
|
|
2654
|
-
Component7,
|
|
2655
|
-
{
|
|
2656
|
-
payload,
|
|
2657
|
-
open,
|
|
2658
|
-
onClose: async (result) => {
|
|
2659
|
-
await closeDialog(promise, result);
|
|
2660
|
-
}
|
|
2661
|
-
},
|
|
2662
|
-
key
|
|
2663
|
-
))
|
|
2664
|
-
] });
|
|
2665
|
-
}
|
|
2666
|
-
|
|
2667
|
-
// src/providers/LayoutProvider.tsx
|
|
2668
|
-
import { ThemeProvider } from "@mui/material";
|
|
2669
|
-
|
|
2670
|
-
// src/utils/i18n.ts
|
|
2671
|
-
import i18n from "i18next";
|
|
2672
|
-
import LanguageDetector from "i18next-browser-languagedetector";
|
|
2673
|
-
import HttpBackend from "i18next-http-backend";
|
|
2674
|
-
import { initReactI18next } from "react-i18next";
|
|
2675
|
-
import { default as default2 } from "i18next";
|
|
2676
|
-
i18n.use(HttpBackend).use(LanguageDetector).use(initReactI18next).init({
|
|
2677
|
-
fallbackLng: "en",
|
|
2678
|
-
interpolation: { escapeValue: false }
|
|
2679
|
-
});
|
|
2680
|
-
|
|
2681
2601
|
// src/components/core/Layout.tsx
|
|
2682
2602
|
import Menu3 from "@mui/icons-material/Menu";
|
|
2683
2603
|
import MenuOpen from "@mui/icons-material/MenuOpen";
|
|
@@ -2698,7 +2618,7 @@ import { useNavigate, useRouterState as useRouterState2 } from "@tanstack/react-
|
|
|
2698
2618
|
import Divider3 from "@mui/material/Divider";
|
|
2699
2619
|
import List3 from "@mui/material/List";
|
|
2700
2620
|
import ListSubheader from "@mui/material/ListSubheader";
|
|
2701
|
-
import { Fragment as Fragment5, useEffect as useEffect5, useState as
|
|
2621
|
+
import { Fragment as Fragment5, useEffect as useEffect5, useState as useState7 } from "react";
|
|
2702
2622
|
|
|
2703
2623
|
// src/components/core/navigation/NavigationListItem.tsx
|
|
2704
2624
|
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
|
|
@@ -2712,9 +2632,9 @@ import ListItemText3 from "@mui/material/ListItemText";
|
|
|
2712
2632
|
import Paper2 from "@mui/material/Paper";
|
|
2713
2633
|
import { styled } from "@mui/material/styles";
|
|
2714
2634
|
import Typography7 from "@mui/material/Typography";
|
|
2715
|
-
import { Fragment as Fragment3, useMemo as
|
|
2635
|
+
import { Fragment as Fragment3, useMemo as useMemo3, useState as useState6 } from "react";
|
|
2716
2636
|
import { Collapse } from "@mui/material";
|
|
2717
|
-
import { Fragment as Fragment4, jsx as
|
|
2637
|
+
import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2718
2638
|
var ICON_SIZE = 34;
|
|
2719
2639
|
var StyledNavButton = styled(ListItemButton4)(({ theme }) => ({
|
|
2720
2640
|
borderRadius: 8,
|
|
@@ -2758,12 +2678,12 @@ var StyledRouterButton = styled(RouterListItemButton)(({ theme }) => ({
|
|
|
2758
2678
|
}));
|
|
2759
2679
|
var IconOrAvatar = ({ item, collapsed }) => {
|
|
2760
2680
|
if (item.icon || collapsed) {
|
|
2761
|
-
return /* @__PURE__ */
|
|
2762
|
-
/* @__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: [
|
|
2763
2683
|
item.icon ?? null,
|
|
2764
|
-
!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
|
|
2765
2685
|
] }),
|
|
2766
|
-
collapsed ? /* @__PURE__ */
|
|
2686
|
+
collapsed ? /* @__PURE__ */ jsx22(
|
|
2767
2687
|
Typography7,
|
|
2768
2688
|
{
|
|
2769
2689
|
variant: "caption",
|
|
@@ -2787,7 +2707,7 @@ var IconOrAvatar = ({ item, collapsed }) => {
|
|
|
2787
2707
|
}
|
|
2788
2708
|
return null;
|
|
2789
2709
|
};
|
|
2790
|
-
var MiniPopover = ({ open, anchorEl, children }) => /* @__PURE__ */
|
|
2710
|
+
var MiniPopover = ({ open, anchorEl, children }) => /* @__PURE__ */ jsx22(
|
|
2791
2711
|
Popper,
|
|
2792
2712
|
{
|
|
2793
2713
|
open,
|
|
@@ -2798,7 +2718,7 @@ var MiniPopover = ({ open, anchorEl, children }) => /* @__PURE__ */ jsx23(
|
|
|
2798
2718
|
{ name: "preventOverflow", options: { padding: 8 } },
|
|
2799
2719
|
{ name: "flip", options: { fallbackPlacements: ["right-end", "left-start"] } }
|
|
2800
2720
|
],
|
|
2801
|
-
children: /* @__PURE__ */
|
|
2721
|
+
children: /* @__PURE__ */ jsx22(
|
|
2802
2722
|
Paper2,
|
|
2803
2723
|
{
|
|
2804
2724
|
sx: {
|
|
@@ -2814,9 +2734,9 @@ var MiniPopover = ({ open, anchorEl, children }) => /* @__PURE__ */ jsx23(
|
|
|
2814
2734
|
}
|
|
2815
2735
|
);
|
|
2816
2736
|
var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, onClick, renderNested, onClose }) => {
|
|
2817
|
-
const [hoveredPopoverItem, setHoveredPopoverItem] =
|
|
2818
|
-
const [anchorElement, setAnchorElement] =
|
|
2819
|
-
const chevronSx =
|
|
2737
|
+
const [hoveredPopoverItem, setHoveredPopoverItem] = useState6(null);
|
|
2738
|
+
const [anchorElement, setAnchorElement] = useState6(null);
|
|
2739
|
+
const chevronSx = useMemo3(() => {
|
|
2820
2740
|
if (collapsed && isSidebarFullyCollapsed && item.children) {
|
|
2821
2741
|
return {
|
|
2822
2742
|
fontSize: 18,
|
|
@@ -2840,9 +2760,9 @@ var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSideb
|
|
|
2840
2760
|
disabled,
|
|
2841
2761
|
sx: { px: 1.4, height: collapsed ? 60 : 48 }
|
|
2842
2762
|
};
|
|
2843
|
-
const buttonContent = /* @__PURE__ */
|
|
2844
|
-
/* @__PURE__ */
|
|
2845
|
-
!collapsed && /* @__PURE__ */
|
|
2763
|
+
const buttonContent = /* @__PURE__ */ jsxs13(Fragment4, { children: [
|
|
2764
|
+
/* @__PURE__ */ jsx22(IconOrAvatar, { item, collapsed }),
|
|
2765
|
+
!collapsed && /* @__PURE__ */ jsx22(
|
|
2846
2766
|
ListItemText3,
|
|
2847
2767
|
{
|
|
2848
2768
|
primary: item.title,
|
|
@@ -2850,9 +2770,9 @@ var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSideb
|
|
|
2850
2770
|
sx: { ml: 1.2, flex: 1, minWidth: 0, "& .MuiTypography-root": { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" } }
|
|
2851
2771
|
}
|
|
2852
2772
|
),
|
|
2853
|
-
item.children ? /* @__PURE__ */
|
|
2773
|
+
item.children ? /* @__PURE__ */ jsx22(ExpandMoreIcon, { sx: chevronSx }) : null
|
|
2854
2774
|
] });
|
|
2855
|
-
const listItem = /* @__PURE__ */
|
|
2775
|
+
const listItem = /* @__PURE__ */ jsxs13(
|
|
2856
2776
|
ListItem,
|
|
2857
2777
|
{
|
|
2858
2778
|
...item.children && collapsed ? {
|
|
@@ -2866,7 +2786,7 @@ var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSideb
|
|
|
2866
2786
|
} : {},
|
|
2867
2787
|
sx: { py: 0, px: 1, overflowX: "hidden" },
|
|
2868
2788
|
children: [
|
|
2869
|
-
shouldJustExpand ? /* @__PURE__ */
|
|
2789
|
+
shouldJustExpand ? /* @__PURE__ */ jsx22(StyledNavButton, { ...buttonProps, onClick: () => onClick?.(item), children: buttonContent }) : /* @__PURE__ */ jsx22(
|
|
2870
2790
|
StyledRouterButton,
|
|
2871
2791
|
{
|
|
2872
2792
|
...buttonProps,
|
|
@@ -2878,28 +2798,28 @@ var NavigationListItem = ({ item, isOpen, selected, disabled, collapsed, isSideb
|
|
|
2878
2798
|
children: buttonContent
|
|
2879
2799
|
}
|
|
2880
2800
|
),
|
|
2881
|
-
item.children && collapsed ? /* @__PURE__ */
|
|
2801
|
+
item.children && collapsed ? /* @__PURE__ */ jsx22(MiniPopover, { open: item.title === hoveredPopoverItem, anchorEl: anchorElement, children: renderNested?.(item.children) }) : null
|
|
2882
2802
|
]
|
|
2883
2803
|
}
|
|
2884
2804
|
);
|
|
2885
|
-
return /* @__PURE__ */
|
|
2805
|
+
return /* @__PURE__ */ jsxs13(Fragment3, { children: [
|
|
2886
2806
|
listItem,
|
|
2887
|
-
item.children && !collapsed ? /* @__PURE__ */
|
|
2807
|
+
item.children && !collapsed ? /* @__PURE__ */ jsx22(Collapse, { in: isOpen, timeout: "auto", unmountOnExit: true, children: renderNested?.(item.children) }) : null
|
|
2888
2808
|
] }, item.to);
|
|
2889
2809
|
};
|
|
2890
2810
|
|
|
2891
2811
|
// src/components/core/navigation/NavigationList.tsx
|
|
2892
|
-
import { jsx as
|
|
2812
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2893
2813
|
var isPageItem = (item) => !("kind" in item);
|
|
2894
2814
|
var isDivider = (item) => "kind" in item && item.kind === "divider";
|
|
2895
2815
|
var isHeader = (item) => "kind" in item && item.kind === "header";
|
|
2896
2816
|
var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSidebarFullyExpanded = true, isSidebarFullyCollapsed, expandedWidth, renderItem, activePath, onNavigate, onClose }) => {
|
|
2897
|
-
const [openKeys, setOpenKeys] =
|
|
2817
|
+
const [openKeys, setOpenKeys] = useState7([]);
|
|
2898
2818
|
useEffect5(() => {
|
|
2899
2819
|
if (collapsed) setOpenKeys([]);
|
|
2900
2820
|
}, [collapsed]);
|
|
2901
2821
|
const toggleKey = (key) => setOpenKeys((previous) => previous.includes(key) ? previous.filter((k) => k !== key) : [...previous, key]);
|
|
2902
|
-
const renderNested = (children) => /* @__PURE__ */
|
|
2822
|
+
const renderNested = (children) => /* @__PURE__ */ jsx23(
|
|
2903
2823
|
NavigationList,
|
|
2904
2824
|
{
|
|
2905
2825
|
subNavigation: children,
|
|
@@ -2912,7 +2832,7 @@ var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSideba
|
|
|
2912
2832
|
}
|
|
2913
2833
|
);
|
|
2914
2834
|
const filteredNavigation = subNavigation.filter((nav) => !nav.hidden);
|
|
2915
|
-
return /* @__PURE__ */
|
|
2835
|
+
return /* @__PURE__ */ jsx23(
|
|
2916
2836
|
List3,
|
|
2917
2837
|
{
|
|
2918
2838
|
sx: {
|
|
@@ -2925,7 +2845,7 @@ var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSideba
|
|
|
2925
2845
|
},
|
|
2926
2846
|
children: filteredNavigation.map((navItem, index) => {
|
|
2927
2847
|
if (isHeader(navItem)) {
|
|
2928
|
-
return /* @__PURE__ */
|
|
2848
|
+
return /* @__PURE__ */ jsx23(
|
|
2929
2849
|
ListSubheader,
|
|
2930
2850
|
{
|
|
2931
2851
|
sx: {
|
|
@@ -2948,13 +2868,13 @@ var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSideba
|
|
|
2948
2868
|
}
|
|
2949
2869
|
if (isDivider(navItem)) {
|
|
2950
2870
|
const nextItem = filteredNavigation[index + 1];
|
|
2951
|
-
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}`);
|
|
2952
2872
|
}
|
|
2953
2873
|
if (!isPageItem(navItem)) return null;
|
|
2954
2874
|
const key = `item-${depth}-${index}`;
|
|
2955
2875
|
const uniqueItemKey = `${depth}-${index}-${navItem.title}`;
|
|
2956
|
-
if (renderItem) return /* @__PURE__ */
|
|
2957
|
-
return /* @__PURE__ */
|
|
2876
|
+
if (renderItem) return /* @__PURE__ */ jsx23(Fragment5, { children: renderItem(navItem, { collapsed: !!collapsed }) }, key);
|
|
2877
|
+
return /* @__PURE__ */ jsx23(
|
|
2958
2878
|
NavigationListItem,
|
|
2959
2879
|
{
|
|
2960
2880
|
item: navItem,
|
|
@@ -2975,7 +2895,7 @@ var NavigationList = ({ subNavigation, depth = 0, collapsed, isPopover, isSideba
|
|
|
2975
2895
|
};
|
|
2976
2896
|
|
|
2977
2897
|
// src/components/core/navigation/NavigationRail.tsx
|
|
2978
|
-
import { jsx as
|
|
2898
|
+
import { jsx as jsx24 } from "react/jsx-runtime";
|
|
2979
2899
|
var MINI_WIDTH = 84;
|
|
2980
2900
|
var EXPANDED_WIDTH = 320;
|
|
2981
2901
|
var TOOLBAR_HEIGHT = 64;
|
|
@@ -2984,7 +2904,7 @@ var NavigationRail = ({ navigation, expanded, setExpanded }) => {
|
|
|
2984
2904
|
const routerState = useRouterState2();
|
|
2985
2905
|
const theme = useTheme2();
|
|
2986
2906
|
const showPermanent = useMediaQuery(theme.breakpoints.up("sm"));
|
|
2987
|
-
const drawerContent = (collapsed) => /* @__PURE__ */
|
|
2907
|
+
const drawerContent = (collapsed) => /* @__PURE__ */ jsx24(
|
|
2988
2908
|
Box8,
|
|
2989
2909
|
{
|
|
2990
2910
|
component: "nav",
|
|
@@ -2998,7 +2918,7 @@ var NavigationRail = ({ navigation, expanded, setExpanded }) => {
|
|
|
2998
2918
|
overflowX: "hidden",
|
|
2999
2919
|
pt: navigation[0] && isHeader(navigation[0]) && !collapsed ? 0 : 2
|
|
3000
2920
|
},
|
|
3001
|
-
children: /* @__PURE__ */
|
|
2921
|
+
children: /* @__PURE__ */ jsx24(
|
|
3002
2922
|
NavigationList,
|
|
3003
2923
|
{
|
|
3004
2924
|
subNavigation: navigation,
|
|
@@ -3014,7 +2934,7 @@ var NavigationRail = ({ navigation, expanded, setExpanded }) => {
|
|
|
3014
2934
|
}
|
|
3015
2935
|
);
|
|
3016
2936
|
if (showPermanent)
|
|
3017
|
-
return /* @__PURE__ */
|
|
2937
|
+
return /* @__PURE__ */ jsx24(
|
|
3018
2938
|
Drawer,
|
|
3019
2939
|
{
|
|
3020
2940
|
variant: "permanent",
|
|
@@ -3032,7 +2952,7 @@ var NavigationRail = ({ navigation, expanded, setExpanded }) => {
|
|
|
3032
2952
|
children: drawerContent(!expanded)
|
|
3033
2953
|
}
|
|
3034
2954
|
);
|
|
3035
|
-
return /* @__PURE__ */
|
|
2955
|
+
return /* @__PURE__ */ jsx24(Drawer, { open: expanded, onClose: () => setExpanded(false), children: drawerContent(!expanded) });
|
|
3036
2956
|
};
|
|
3037
2957
|
|
|
3038
2958
|
// src/components/core/ToolbarAccount.tsx
|
|
@@ -3047,17 +2967,17 @@ import Logout from "@mui/icons-material/Logout";
|
|
|
3047
2967
|
import SettingsBrightness from "@mui/icons-material/SettingsBrightness";
|
|
3048
2968
|
import Translate from "@mui/icons-material/Translate";
|
|
3049
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";
|
|
3050
|
-
import { Fragment as Fragment6, useState as
|
|
2970
|
+
import { Fragment as Fragment6, useState as useState8 } from "react";
|
|
3051
2971
|
import { useTranslation as useTranslation5 } from "react-i18next";
|
|
3052
|
-
import { jsx as
|
|
2972
|
+
import { jsx as jsx25, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3053
2973
|
var ToolbarAccount = () => {
|
|
3054
|
-
const [anchorElement, setAnchorElement] =
|
|
3055
|
-
const [tab, setTab] =
|
|
2974
|
+
const [anchorElement, setAnchorElement] = useState8();
|
|
2975
|
+
const [tab, setTab] = useState8("settings");
|
|
3056
2976
|
const open = Boolean(anchorElement);
|
|
3057
|
-
const { t: t2, i18n
|
|
2977
|
+
const { t: t2, i18n } = useTranslation5();
|
|
3058
2978
|
const { mode, setMode } = useColorScheme();
|
|
3059
2979
|
const changeLanguage = (newLanguage) => () => {
|
|
3060
|
-
|
|
2980
|
+
i18n.changeLanguage(newLanguage).finally(() => closeMenu());
|
|
3061
2981
|
};
|
|
3062
2982
|
const changeMode = (newMode) => () => {
|
|
3063
2983
|
setMode(newMode);
|
|
@@ -3092,60 +3012,60 @@ var ToolbarAccount = () => {
|
|
|
3092
3012
|
setTimeout(() => setTab("settings"), 300);
|
|
3093
3013
|
};
|
|
3094
3014
|
const changeTab = (newTab) => () => setTab(newTab);
|
|
3095
|
-
const settings = /* @__PURE__ */
|
|
3096
|
-
/* @__PURE__ */
|
|
3097
|
-
/* @__PURE__ */
|
|
3098
|
-
/* @__PURE__ */
|
|
3099
|
-
/* @__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, {})
|
|
3100
3020
|
] }),
|
|
3101
|
-
/* @__PURE__ */
|
|
3102
|
-
/* @__PURE__ */
|
|
3103
|
-
/* @__PURE__ */
|
|
3104
|
-
/* @__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, {})
|
|
3105
3025
|
] })
|
|
3106
3026
|
] });
|
|
3107
|
-
const theme = /* @__PURE__ */
|
|
3108
|
-
/* @__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" }) }),
|
|
3109
3029
|
" ",
|
|
3110
3030
|
t2("Layout.Appearance")
|
|
3111
3031
|
] }), children: [
|
|
3112
|
-
/* @__PURE__ */
|
|
3113
|
-
/* @__PURE__ */
|
|
3114
|
-
/* @__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") })
|
|
3115
3035
|
] }),
|
|
3116
|
-
/* @__PURE__ */
|
|
3117
|
-
/* @__PURE__ */
|
|
3118
|
-
/* @__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") })
|
|
3119
3039
|
] }),
|
|
3120
|
-
/* @__PURE__ */
|
|
3121
|
-
/* @__PURE__ */
|
|
3122
|
-
/* @__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") })
|
|
3123
3043
|
] })
|
|
3124
3044
|
] });
|
|
3125
|
-
const language = /* @__PURE__ */
|
|
3126
|
-
/* @__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" }) }),
|
|
3127
3047
|
" ",
|
|
3128
3048
|
t2("Layout.Language")
|
|
3129
3049
|
] }), children: [
|
|
3130
|
-
/* @__PURE__ */
|
|
3131
|
-
/* @__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" }) })
|
|
3132
3052
|
] });
|
|
3133
|
-
return /* @__PURE__ */
|
|
3134
|
-
/* @__PURE__ */
|
|
3135
|
-
/* @__PURE__ */
|
|
3136
|
-
/* @__PURE__ */
|
|
3137
|
-
/* @__PURE__ */
|
|
3138
|
-
/* @__PURE__ */
|
|
3139
|
-
/* @__PURE__ */
|
|
3140
|
-
/* @__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 })
|
|
3141
3061
|
] }) }) }),
|
|
3142
|
-
/* @__PURE__ */
|
|
3143
|
-
/* @__PURE__ */
|
|
3144
|
-
/* @__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") })
|
|
3145
3065
|
] })
|
|
3146
|
-
] }) : /* @__PURE__ */
|
|
3147
|
-
/* @__PURE__ */
|
|
3148
|
-
/* @__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") })
|
|
3149
3069
|
] }) }),
|
|
3150
3070
|
tab === "settings" && settings,
|
|
3151
3071
|
tab === "theme" && theme,
|
|
@@ -3155,7 +3075,7 @@ var ToolbarAccount = () => {
|
|
|
3155
3075
|
};
|
|
3156
3076
|
|
|
3157
3077
|
// src/components/core/Layout.tsx
|
|
3158
|
-
import { jsx as
|
|
3078
|
+
import { jsx as jsx26, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3159
3079
|
var DrawerHeader = styled2("div")(({ theme }) => ({
|
|
3160
3080
|
display: "flex",
|
|
3161
3081
|
alignItems: "center",
|
|
@@ -3167,11 +3087,11 @@ var Layout = (props) => {
|
|
|
3167
3087
|
const [navigationOpen, setNavigationOpen] = useLocalStorageState("navigationOpen", { defaultServerValue: false });
|
|
3168
3088
|
const isFetching = !!useIsFetching();
|
|
3169
3089
|
const isMutating = !!useIsMutating();
|
|
3170
|
-
return /* @__PURE__ */
|
|
3171
|
-
/* @__PURE__ */
|
|
3172
|
-
/* @__PURE__ */
|
|
3173
|
-
/* @__PURE__ */
|
|
3174
|
-
/* @__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(
|
|
3175
3095
|
AppBar,
|
|
3176
3096
|
{
|
|
3177
3097
|
color: "transparent",
|
|
@@ -3181,27 +3101,27 @@ var Layout = (props) => {
|
|
|
3181
3101
|
borderColor: theme.vars?.palette.divider,
|
|
3182
3102
|
boxShadow: "none"
|
|
3183
3103
|
}),
|
|
3184
|
-
children: /* @__PURE__ */
|
|
3185
|
-
props.navigation && /* @__PURE__ */
|
|
3104
|
+
children: /* @__PURE__ */ jsxs15(Toolbar, { children: [
|
|
3105
|
+
props.navigation && /* @__PURE__ */ jsx26(
|
|
3186
3106
|
IconButton5,
|
|
3187
3107
|
{
|
|
3188
3108
|
onClick: () => setNavigationOpen((previous) => !previous),
|
|
3189
3109
|
sx: { marginRight: 2 },
|
|
3190
|
-
children: navigationOpen ? /* @__PURE__ */
|
|
3110
|
+
children: navigationOpen ? /* @__PURE__ */ jsx26(MenuOpen, {}) : /* @__PURE__ */ jsx26(Menu3, {})
|
|
3191
3111
|
}
|
|
3192
3112
|
),
|
|
3193
|
-
/* @__PURE__ */
|
|
3194
|
-
/* @__PURE__ */
|
|
3113
|
+
/* @__PURE__ */ jsx26(AppTitle, {}),
|
|
3114
|
+
/* @__PURE__ */ jsx26(ToolbarAccount, {})
|
|
3195
3115
|
] })
|
|
3196
3116
|
}
|
|
3197
3117
|
),
|
|
3198
|
-
props.navigation && /* @__PURE__ */
|
|
3199
|
-
/* @__PURE__ */
|
|
3200
|
-
/* @__PURE__ */
|
|
3201
|
-
/* @__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 })
|
|
3202
3122
|
] })
|
|
3203
3123
|
] }),
|
|
3204
|
-
(isFetching || isMutating) && /* @__PURE__ */
|
|
3124
|
+
(isFetching || isMutating) && /* @__PURE__ */ jsx26(LinearProgress, { sx: { position: "fixed", top: { xs: 56, sm: 64 }, left: 0, right: 0 } })
|
|
3205
3125
|
] });
|
|
3206
3126
|
};
|
|
3207
3127
|
|
|
@@ -3914,7 +3834,7 @@ import { useTranslation as useTranslation6 } from "react-i18next";
|
|
|
3914
3834
|
var WISTRON_PRIMARY_COLOR = "#00506E";
|
|
3915
3835
|
var WISTRON_SECONDARY_COLOR = "#64DC00";
|
|
3916
3836
|
var useGetTheme = (theme) => {
|
|
3917
|
-
const { i18n
|
|
3837
|
+
const { i18n } = useTranslation6();
|
|
3918
3838
|
return createTheme(
|
|
3919
3839
|
{
|
|
3920
3840
|
cssVariables: {
|
|
@@ -3965,27 +3885,98 @@ var useGetTheme = (theme) => {
|
|
|
3965
3885
|
...theme?.components
|
|
3966
3886
|
}
|
|
3967
3887
|
},
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3888
|
+
i18n.resolvedLanguage === "cs" ? csCZ : enUS2,
|
|
3889
|
+
i18n.resolvedLanguage === "cs" ? csCZ2 : enUS,
|
|
3890
|
+
i18n.resolvedLanguage === "cs" ? csCZ3 : enUS3
|
|
3971
3891
|
);
|
|
3972
3892
|
};
|
|
3973
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
|
+
|
|
3974
3964
|
// src/providers/LayoutProvider.tsx
|
|
3975
3965
|
import { jsx as jsx28 } from "react/jsx-runtime";
|
|
3976
3966
|
var LayoutProvider = ({ navigation, theme, children }) => {
|
|
3967
|
+
const { i18n } = useTranslation7();
|
|
3977
3968
|
const createdTheme = useGetTheme(theme);
|
|
3978
3969
|
useEffect6(() => {
|
|
3979
3970
|
const handler = () => {
|
|
3980
|
-
z.config(
|
|
3971
|
+
z.config(i18n.resolvedLanguage === "cs" ? cs() : en());
|
|
3981
3972
|
};
|
|
3982
3973
|
handler();
|
|
3983
|
-
|
|
3974
|
+
i18n.on("languageChanged", handler);
|
|
3984
3975
|
return () => {
|
|
3985
|
-
|
|
3976
|
+
i18n.off("languageChanged", handler);
|
|
3986
3977
|
};
|
|
3987
3978
|
}, []);
|
|
3988
|
-
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 }) }) }) });
|
|
3989
3980
|
};
|
|
3990
3981
|
|
|
3991
3982
|
// src/index.ts
|
|
@@ -4291,8 +4282,8 @@ var { useAppForm: useLayoutForm, withForm: withLayoutForm } = createFormHook({
|
|
|
4291
4282
|
});
|
|
4292
4283
|
|
|
4293
4284
|
// src/index.ts
|
|
4294
|
-
import { default as
|
|
4295
|
-
import { useTranslation as
|
|
4285
|
+
import { default as default2 } from "use-local-storage-state";
|
|
4286
|
+
import { useTranslation as useTranslation8 } from "react-i18next";
|
|
4296
4287
|
import { t } from "i18next";
|
|
4297
4288
|
export {
|
|
4298
4289
|
ChipInputCell,
|
|
@@ -4324,9 +4315,9 @@ export {
|
|
|
4324
4315
|
useGetFileMetas,
|
|
4325
4316
|
useGetFileThumbnail,
|
|
4326
4317
|
useLayoutForm,
|
|
4327
|
-
|
|
4318
|
+
default2 as useLocalStorageState,
|
|
4328
4319
|
useOpenFile,
|
|
4329
|
-
|
|
4320
|
+
useTranslation8 as useTranslation,
|
|
4330
4321
|
useUpdateFileMeta,
|
|
4331
4322
|
useUploadFile,
|
|
4332
4323
|
uuidv72 as uuidv7,
|