sevago-sso-fe 1.0.12 → 1.0.13

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.esm.js CHANGED
@@ -3,7 +3,7 @@ import { createAsyncThunk, createSlice, configureStore, combineReducers } from "
3
3
  import { useDispatch, useSelector } from "react-redux";
4
4
  import * as React from "react";
5
5
  import React__default, { useMemo, useState, createContext, useContext, useEffect, useCallback, forwardRef, useImperativeHandle, createElement, Children, useRef, useLayoutEffect, Fragment as Fragment$1, useId, useInsertionEffect, Component as Component$1 } from "react";
6
- import { useLocation, useNavigate, Outlet, Route, Navigate } from "react-router-dom";
6
+ import { useLocation, useNavigate, Outlet, Link, Route, Navigate } from "react-router-dom";
7
7
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
8
8
  import { Alert, Stack as Stack$1, styled as styled$2, TableCell, tableCellClasses, LinearProgress, linearProgressClasses, useTheme as useTheme$2, Skeleton, Box, Icon, Tooltip, tooltipClasses, Avatar, Typography, ClickAwayListener as ClickAwayListener$1, Fade, Badge, List, ListItem, FormControl, InputLabel, RadioGroup, FormControlLabel, Radio, Menu, Divider, MenuItem, Button, IconButton, TextField, InputAdornment } from "@mui/material";
9
9
  import { unstable_createGetCssVar, createSpacing as createSpacing$1, useTheme as useTheme$1, unstable_memoTheme, Stack as Stack$2, css, keyframes as keyframes$1 } from "@mui/system";
@@ -21244,8 +21244,32 @@ const MonitorPart = ({
21244
21244
  const DashboardLayout = ({
21245
21245
  children
21246
21246
  }) => {
21247
- useUpdateCurrentAccess();
21248
- return /* @__PURE__ */ jsx(MonitorPart, { children });
21247
+ const isSystemMonitor = useIsSystemMonitor();
21248
+ const { sidebarWidth } = useSidebar();
21249
+ if (isSystemMonitor) return /* @__PURE__ */ jsx(MonitorPart, { children });
21250
+ return /* @__PURE__ */ jsx(
21251
+ Stack$1,
21252
+ {
21253
+ sx: {
21254
+ minHeight: "100vh",
21255
+ width: "100%"
21256
+ },
21257
+ children: /* @__PURE__ */ jsx(Stack$1, { p: 0, gap: 0, children: /* @__PURE__ */ jsx(StackRow, { children: /* @__PURE__ */ jsx(
21258
+ Stack$1,
21259
+ {
21260
+ sx: {
21261
+ overflowY: "auto",
21262
+ marginLeft: sidebarWidth,
21263
+ width: "100%",
21264
+ transition: "margin-left 0.3s ease",
21265
+ background: "#F5F6F8",
21266
+ minHeight: `calc(100vh - ${STYLE.HEIGHT_HEADER}px)`
21267
+ },
21268
+ children
21269
+ }
21270
+ ) }) })
21271
+ }
21272
+ );
21249
21273
  };
21250
21274
  const DefaultLayout = ({ children }) => {
21251
21275
  return /* @__PURE__ */ jsx(
@@ -33497,7 +33521,7 @@ const MotionBox = ({
33497
33521
  } : {};
33498
33522
  return /* @__PURE__ */ jsx(motion.div, { ...motionProps, ...getAnimationProps(), ...hoverProps, onClick, style: { ...sx }, children });
33499
33523
  };
33500
- const IconRight = (props) => /* @__PURE__ */ jsx(
33524
+ const IconLeft = (props) => /* @__PURE__ */ jsx(
33501
33525
  "svg",
33502
33526
  {
33503
33527
  width: "20",
@@ -33509,7 +33533,7 @@ const IconRight = (props) => /* @__PURE__ */ jsx(
33509
33533
  children: /* @__PURE__ */ jsx(
33510
33534
  "path",
33511
33535
  {
33512
- d: "M12 1L19 8M19 8L12 15M19 8L1 8",
33536
+ d: "M8 15L1 8M1 8L8 1M1 8L19 8",
33513
33537
  stroke: "currentColor",
33514
33538
  "stroke-width": "2",
33515
33539
  "stroke-linecap": "round",
@@ -33518,7 +33542,7 @@ const IconRight = (props) => /* @__PURE__ */ jsx(
33518
33542
  )
33519
33543
  }
33520
33544
  );
33521
- const IconLeft = (props) => /* @__PURE__ */ jsx(
33545
+ const IconRight = (props) => /* @__PURE__ */ jsx(
33522
33546
  "svg",
33523
33547
  {
33524
33548
  width: "20",
@@ -33530,7 +33554,7 @@ const IconLeft = (props) => /* @__PURE__ */ jsx(
33530
33554
  children: /* @__PURE__ */ jsx(
33531
33555
  "path",
33532
33556
  {
33533
- d: "M8 15L1 8M1 8L8 1M1 8L19 8",
33557
+ d: "M12 1L19 8M19 8L12 15M19 8L1 8",
33534
33558
  stroke: "currentColor",
33535
33559
  "stroke-width": "2",
33536
33560
  "stroke-linecap": "round",
@@ -33559,12 +33583,25 @@ const AppGrid = ({
33559
33583
  const pageSize = Math.max(1, columns * Math.max(1, rows));
33560
33584
  const totalPages = Math.max(1, Math.ceil(apps.length / pageSize));
33561
33585
  const [page, setPage] = React__default.useState(0);
33586
+ const { user } = useSelector((state) => state.account);
33562
33587
  React__default.useEffect(() => {
33563
33588
  setPage((prev) => prev >= totalPages ? totalPages - 1 : prev);
33564
33589
  }, [totalPages, columns, rows, apps.length]);
33565
33590
  const start = page * pageSize;
33566
33591
  const end = start + pageSize;
33567
33592
  const visibleApps = totalPages > 1 ? apps.slice(start, end) : apps;
33593
+ const findLink = (app2) => {
33594
+ if (!app2.children?.length) {
33595
+ return app2.path;
33596
+ }
33597
+ for (const i of app2.children || []) {
33598
+ if (user?.type && i.allowUserTypes.includes(user?.type)) {
33599
+ if (i.path) {
33600
+ return `${i.path}`;
33601
+ }
33602
+ }
33603
+ }
33604
+ };
33568
33605
  return /* @__PURE__ */ jsxs(Box, { sx: { position: "relative" }, children: [
33569
33606
  /* @__PURE__ */ jsx(
33570
33607
  Box,
@@ -33576,62 +33613,73 @@ const AppGrid = ({
33576
33613
  },
33577
33614
  children: visibleApps.map((app2, index) => {
33578
33615
  const isSelected = selectedAppId === app2.key;
33579
- return /* @__PURE__ */ jsxs(
33580
- MotionBox,
33616
+ return /* @__PURE__ */ jsx(
33617
+ Link,
33581
33618
  {
33582
- preset: "staggerItem",
33583
- index,
33584
- hover: true,
33585
- onClick: () => onClickItem?.(app2),
33586
- sx: {
33587
- cursor: "pointer",
33588
- display: "flex",
33589
- flex: 1,
33590
- alignItems: "center",
33591
- flexDirection: "column"
33619
+ to: findLink(app2) || "#",
33620
+ style: {
33621
+ textDecoration: "none",
33622
+ color: "inherit",
33623
+ width: "100%"
33592
33624
  },
33593
- children: [
33594
- /* @__PURE__ */ jsx(
33595
- Box,
33596
- {
33597
- sx: {
33598
- width: iconSize,
33599
- height: iconSize,
33600
- borderRadius: iconRadius,
33601
- mb: 1.5,
33602
- display: "flex",
33603
- alignItems: "center",
33604
- justifyContent: "center",
33605
- background: getAppColor(app2.category),
33606
- boxShadow: isSelected ? `0 0 0 1px ${theme.palette.primary.main}, ${iconShadow}` : iconShadow
33607
- },
33608
- children: app2.icon.startsWith("/") && /* @__PURE__ */ jsx(
33609
- ImageElement,
33625
+ children: /* @__PURE__ */ jsxs(
33626
+ MotionBox,
33627
+ {
33628
+ preset: "staggerItem",
33629
+ index,
33630
+ hover: true,
33631
+ onClick: () => onClickItem?.(app2),
33632
+ sx: {
33633
+ cursor: "pointer",
33634
+ display: "flex",
33635
+ flex: 1,
33636
+ alignItems: "center",
33637
+ flexDirection: "column"
33638
+ },
33639
+ children: [
33640
+ /* @__PURE__ */ jsx(
33641
+ Box,
33610
33642
  {
33611
- sx: { width: iconSize * 0.56, height: iconSize * 0.56 },
33612
- url: app2.icon,
33613
- sizeType: ImageSizeType.SQUARE
33643
+ sx: {
33644
+ width: iconSize,
33645
+ height: iconSize,
33646
+ borderRadius: iconRadius,
33647
+ mb: 1.5,
33648
+ display: "flex",
33649
+ alignItems: "center",
33650
+ justifyContent: "center",
33651
+ background: getAppColor(app2.category),
33652
+ boxShadow: isSelected ? `0 0 0 1px ${theme.palette.primary.main}, ${iconShadow}` : iconShadow
33653
+ },
33654
+ children: app2.icon.startsWith("/") && /* @__PURE__ */ jsx(
33655
+ ImageElement,
33656
+ {
33657
+ sx: { width: iconSize * 0.56, height: iconSize * 0.56 },
33658
+ url: app2.icon,
33659
+ sizeType: ImageSizeType.SQUARE
33660
+ }
33661
+ )
33662
+ }
33663
+ ),
33664
+ /* @__PURE__ */ jsx(
33665
+ Typography,
33666
+ {
33667
+ variant: titleVariant,
33668
+ sx: { color: titleColor ?? theme.palette.common.white },
33669
+ children: app2.title
33670
+ }
33671
+ ),
33672
+ /* @__PURE__ */ jsx(
33673
+ Typography,
33674
+ {
33675
+ variant: captionVariant,
33676
+ sx: { color: captionColor ?? theme.palette.common.white },
33677
+ children: app2.caption
33614
33678
  }
33615
33679
  )
33616
- }
33617
- ),
33618
- /* @__PURE__ */ jsx(
33619
- Typography,
33620
- {
33621
- variant: titleVariant,
33622
- sx: { color: titleColor ?? theme.palette.common.white },
33623
- children: app2.title
33624
- }
33625
- ),
33626
- /* @__PURE__ */ jsx(
33627
- Typography,
33628
- {
33629
- variant: captionVariant,
33630
- sx: { color: captionColor ?? theme.palette.common.white },
33631
- children: app2.caption
33632
- }
33633
- )
33634
- ]
33680
+ ]
33681
+ }
33682
+ )
33635
33683
  },
33636
33684
  app2.key
33637
33685
  );