Sfoglia il codice sorgente

Dep: use lodash-es instead of lodash

AH-dark 2 anni fa
parent
commit
2e0b0e61d2
6 ha cambiato i file con 89 aggiunte e 60 eliminazioni
  1. 10 12
      .idea/codeStyles/Project.xml
  2. 1 1
      package.json
  3. 8 0
      pnpm-lock.yaml
  4. 7 2
      src/index.tsx
  5. 45 45
      src/themes/overrides/index.ts
  6. 18 0
      src/vite-env.d.ts

+ 10 - 12
.idea/codeStyles/Project.xml

@@ -27,33 +27,31 @@
     <codeStyleSettings language="HTML">
       <option name="SOFT_MARGINS" value="120" />
       <indentOptions>
-        <option name="INDENT_SIZE" value="5" />
-        <option name="CONTINUATION_INDENT_SIZE" value="5" />
-        <option name="TAB_SIZE" value="5" />
+        <option name="INDENT_SIZE" value="2" />
+        <option name="CONTINUATION_INDENT_SIZE" value="2" />
+        <option name="TAB_SIZE" value="2" />
       </indentOptions>
     </codeStyleSettings>
     <codeStyleSettings language="JavaScript">
       <option name="SOFT_MARGINS" value="120" />
       <indentOptions>
-        <option name="INDENT_SIZE" value="5" />
-        <option name="CONTINUATION_INDENT_SIZE" value="5" />
-        <option name="TAB_SIZE" value="5" />
+        <option name="INDENT_SIZE" value="2" />
+        <option name="CONTINUATION_INDENT_SIZE" value="2" />
+        <option name="TAB_SIZE" value="2" />
       </indentOptions>
     </codeStyleSettings>
     <codeStyleSettings language="TypeScript">
       <option name="SOFT_MARGINS" value="120" />
       <indentOptions>
-        <option name="INDENT_SIZE" value="5" />
-        <option name="CONTINUATION_INDENT_SIZE" value="5" />
-        <option name="TAB_SIZE" value="5" />
+        <option name="INDENT_SIZE" value="2" />
+        <option name="CONTINUATION_INDENT_SIZE" value="2" />
+        <option name="TAB_SIZE" value="2" />
       </indentOptions>
     </codeStyleSettings>
     <codeStyleSettings language="Vue">
       <option name="SOFT_MARGINS" value="120" />
       <indentOptions>
-        <option name="INDENT_SIZE" value="5" />
-        <option name="CONTINUATION_INDENT_SIZE" value="5" />
-        <option name="TAB_SIZE" value="5" />
+        <option name="CONTINUATION_INDENT_SIZE" value="2" />
       </indentOptions>
     </codeStyleSettings>
   </code_scheme>

+ 1 - 1
package.json

@@ -70,7 +70,7 @@
   "devDependencies": {
     "@babel/core": "^7.19.3",
     "@babel/eslint-parser": "^7.19.1",
-    "@types/lodash": "^4.14.186",
+    "@types/lodash-es": "^4.17.6",
     "@types/react": "^18.0.26",
     "@types/react-dom": "^18.0.6",
     "@types/uuid": "^8.3.4",

+ 8 - 0
pnpm-lock.yaml

@@ -16,6 +16,7 @@ specifiers:
   '@reduxjs/toolkit': ^1.8.6
   '@rollup/plugin-image': ^3.0.1
   '@types/lodash': ^4.14.186
+  '@types/lodash-es': ^4.17.6
   '@types/react': ^18.0.26
   '@types/react-dom': ^18.0.6
   '@types/uuid': ^8.3.4
@@ -161,6 +162,7 @@ devDependencies:
   '@babel/core': 7.19.3
   '@babel/eslint-parser': 7.19.1_v37dtiefj2fmp2s4n57pt7n35y
   '@types/lodash': 4.14.186
+  '@types/lodash-es': 4.17.6
   '@types/react': 18.0.26
   '@types/react-dom': 18.0.6
   '@types/uuid': 8.3.4
@@ -3292,6 +3294,12 @@ packages:
     resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
     dev: true
 
+  /@types/lodash-es/4.17.6:
+    resolution: {integrity: sha512-R+zTeVUKDdfoRxpAryaQNRKk3105Rrgx2CFRClIgRGaqDTdjsm8h6IYA8ir584W3ePzkZfst5xIgDwYrlh9HLg==}
+    dependencies:
+      '@types/lodash': 4.14.186
+    dev: true
+
   /@types/lodash/4.14.186:
     resolution: {integrity: sha512-eHcVlLXP0c2FlMPm56ITode2AgLMSa6aJ05JTTbYbI+7EMkCEE5qk2E41d5g2lCVTqRe0GnnRFurmlCsDODrPw==}
 

+ 7 - 2
src/index.tsx

@@ -21,17 +21,22 @@ import { store } from "@/store";
 import { ConfigProvider } from "@/contexts/ConfigContext";
 import reportWebVitals from "@/reportWebVitals";
 
+// hash router change to browser router
+if (window.location.hash) {
+  window.location.href = window.location.hash;
+}
+
 const container = document.getElementById("root");
 const root = createRoot(container!);
 
 const ro = new ResizeObserver((entries, observer) =>
   entries.forEach((entry) => {
-    const { left, top, width, height } = entry.contentRect;
+    const { left, top, right, bottom, width, height } = entry.contentRect;
 
     if (import.meta.env.DEV) {
       console.log("Element:", entry.target);
       console.log(`Element's size: ${width}px x ${height}px`);
-      console.log(`Element's paddings: ${top}px ; ${left}px`);
+      console.log(`Element's paddings: ${top}px ${right}px ${bottom}px ${left}px`);
     }
 
     document.documentElement.style.setProperty("--width", `${width - entry.target.clientWidth}px`);

+ 45 - 45
src/themes/overrides/index.ts

@@ -1,53 +1,53 @@
 // material-ui
-import { Theme } from '@mui/material/styles';
+import { Theme } from "@mui/material/styles";
 
 // third-party
-import { merge } from 'lodash';
+import { merge } from "lodash-es";
 
 // project import
-import Accordion from './Accordion';
-import AccordionDetails from './AccordionDetails';
-import AccordionSummary from './AccordionSummary';
-import Alert from './Alert';
-import AlertTitle from './AlertTitle';
-import Autocomplete from './Autocomplete';
-import Badge from './Badge';
-import Button from './Button';
-import ButtonBase from './ButtonBase';
-import ButtonGroup from './ButtonGroup';
-import CardContent from './CardContent';
-import Checkbox from './Checkbox';
-import Chip from './Chip';
-import Dialog from './Dialog';
-import DialogContentText from './DialogContentText';
-import DialogTitle from './DialogTitle';
-import Fab from './Fab';
-import IconButton from './IconButton';
-import InputBase from './InputBase';
-import InputLabel from './InputLabel';
-import LinearProgress from './LinearProgress';
-import Link from './Link';
-import ListItemButton from './ListItemButton';
-import ListItemIcon from './ListItemIcon';
-import LoadingButton from './LoadingButton';
-import OutlinedInput from './OutlinedInput';
-import Pagination from './Pagination';
-import PaginationItem from './PaginationItem';
-import Popover from './Popover';
-import Radio from './Radio';
-import Slider from './Slider';
-import Switch from './Switch';
-import Tab from './Tab';
-import TableBody from './TableBody';
-import TableCell from './TableCell';
-import TableFooter from './TableFooter';
-import TableHead from './TableHead';
-import TablePagination from './TablePagination';
-import TableRow from './TableRow';
-import Tabs from './Tabs';
-import ToggleButton from './ToggleButton';
-import TreeItem from './TreeItem';
-import Typography from './Typography';
+import Accordion from "./Accordion";
+import AccordionDetails from "./AccordionDetails";
+import AccordionSummary from "./AccordionSummary";
+import Alert from "./Alert";
+import AlertTitle from "./AlertTitle";
+import Autocomplete from "./Autocomplete";
+import Badge from "./Badge";
+import Button from "./Button";
+import ButtonBase from "./ButtonBase";
+import ButtonGroup from "./ButtonGroup";
+import CardContent from "./CardContent";
+import Checkbox from "./Checkbox";
+import Chip from "./Chip";
+import Dialog from "./Dialog";
+import DialogContentText from "./DialogContentText";
+import DialogTitle from "./DialogTitle";
+import Fab from "./Fab";
+import IconButton from "./IconButton";
+import InputBase from "./InputBase";
+import InputLabel from "./InputLabel";
+import LinearProgress from "./LinearProgress";
+import Link from "./Link";
+import ListItemButton from "./ListItemButton";
+import ListItemIcon from "./ListItemIcon";
+import LoadingButton from "./LoadingButton";
+import OutlinedInput from "./OutlinedInput";
+import Pagination from "./Pagination";
+import PaginationItem from "./PaginationItem";
+import Popover from "./Popover";
+import Radio from "./Radio";
+import Slider from "./Slider";
+import Switch from "./Switch";
+import Tab from "./Tab";
+import TableBody from "./TableBody";
+import TableCell from "./TableCell";
+import TableFooter from "./TableFooter";
+import TableHead from "./TableHead";
+import TablePagination from "./TablePagination";
+import TableRow from "./TableRow";
+import Tabs from "./Tabs";
+import ToggleButton from "./ToggleButton";
+import TreeItem from "./TreeItem";
+import Typography from "./Typography";
 
 // ==============================|| OVERRIDES - MAIN ||============================== //
 

+ 18 - 0
src/vite-env.d.ts

@@ -7,3 +7,21 @@ interface ImportMetaEnv {
 interface ImportMeta {
   readonly env: ImportMetaEnv;
 }
+
+interface Window {
+  readonly settings: WindowSettings;
+}
+
+interface WindowSettings {
+  title: string;
+  theme_path: string;
+  theme: {
+    sidebar: string;
+    header: string;
+    default: string;
+  };
+  version: string;
+  background_url: string;
+  description: string;
+  logo: string;
+}