szld-libs 0.2.19 → 0.2.22

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.
@@ -3,7 +3,7 @@ interface AuthProps {
3
3
  PId: number;
4
4
  }
5
5
  export interface CoralButtonProps extends ButtonProps {
6
- PId: number;
6
+ PId: number | number[];
7
7
  auths?: AuthProps[];
8
8
  }
9
9
  declare const CoralButton: (props: CoralButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -4,7 +4,13 @@ import AuthButton from "../AuthButton";
4
4
  const CoralButton = (props) => {
5
5
  const { PId, auths, ...rest } = props;
6
6
  const auth = useMemo(() => {
7
- if (auths && auths.find((v) => v.PId === PId)) {
7
+ if (!auths) {
8
+ return false;
9
+ }
10
+ if (typeof PId === "number" && auths.find((v) => v.PId === PId)) {
11
+ return true;
12
+ }
13
+ if (Array.isArray(PId) && auths.filter((v) => PId.includes(v.PId)).length > 0) {
8
14
  return true;
9
15
  }
10
16
  return false;
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * 解密前端配置文件信息
4
+ * @export
5
+ * @param {string} value
6
+ * @return {*}
7
+ */
8
+ export default function useConfig(value: string): any;
@@ -0,0 +1,21 @@
1
+ import CryptoJS from "crypto-js";
2
+ import { useState, useEffect } from "react";
3
+ const salt = "SzlDJd#4202";
4
+ function useConfig(value) {
5
+ const [config, setConfig] = useState(null);
6
+ useEffect(() => {
7
+ init();
8
+ }, []);
9
+ const init = () => {
10
+ const bytes = CryptoJS.AES.decrypt(value, salt);
11
+ try {
12
+ const result = JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
13
+ setConfig(result);
14
+ } catch (error) {
15
+ }
16
+ };
17
+ return config;
18
+ }
19
+ export {
20
+ useConfig as default
21
+ };
package/es/index.js CHANGED
@@ -1,115 +1,26 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { useEffect, useState } from "react";
2
+ import CryptoJS from "crypto-js";
3
+ import { useEffect } from "react";
3
4
  import ReactDOM from "react-dom/client";
4
5
  import { BrowserRouter } from "react-router-dom";
5
- import { HmacSHA512, EditTable } from "./main";
6
- import { Form } from "antd";
7
- import "./utils/compression-file";
6
+ import useConfig from "./hooks/useConfig";
7
+ let key = "U2FsdGVkX1/dG1NSXNR9hnp3Ech/v6Gh8CDDJxgBm1EPFQel12ySIf84ARXCPwTae7TzwgPvjOyE3S5rAEzl/wAZmId6pbezpFeFcJqxdmIl3FeluYHFxJzQHDETTvrr3G/REvv00kHptOVwg6ecjPH6yk7PNit0sWTBLorROxLxMD8lVDmOA66p7Zp4QnYzqScYJGFbutmfHYXfBRBe1Q2UKummJ798svNY5SIwEwl4spzgyWmhARtuyq4zhysFrj/xODuNDjtwitA6XfX566WcZkj3F+2P+mkYzDYOhXXaomnlybjrZ2hEHfcczQhUfJd89O8PNIuEWo24wjYRgMdKlw5CWSeocFCqV7ZJ/CV/7vNRcaO4awKlFNobLikkwDznxpcX+4UEej+ED+pgfmPQLsKedcfEscStkSAZXaD5pBRTiFU9xGLfDt6seUrEnMBeXkpMIY9j1SZDDK18/G7lSHjDQMZYZP6sfLdBdwY=";
8
8
  const Demo = () => {
9
+ useConfig(key);
9
10
  useEffect(() => {
10
- new HmacSHA512("17283");
11
+ jiami();
11
12
  }, []);
12
- Form.useForm();
13
- const [list, setList] = useState([
14
- {
15
- PNOrderNo: 1,
16
- PNName: "未分配",
17
- PlanFinishDate: "",
18
- Remark: ""
19
- },
20
- {
21
- PNOrderNo: 2,
22
- PNName: "未分配2",
23
- PlanFinishDate: "",
24
- Remark: "123"
25
- },
26
- {
27
- PNOrderNo: 3,
28
- PNName: "未分4",
29
- PlanFinishDate: "",
30
- Remark: ""
31
- }
32
- ]);
33
- const columns = [
34
- {
35
- dataIndex: "PNOrderNo",
36
- title: "序号",
37
- width: 80
38
- },
39
- {
40
- dataIndex: "PNName",
41
- title: "节点名称"
42
- },
43
- {
44
- dataIndex: "PlanFinishDate",
45
- title: "预计完成时间",
46
- editable: true,
47
- width: 400,
48
- type: "datePicker",
49
- valueProps: {
50
- placeholder: "请输入内容"
51
- }
52
- },
53
- {
54
- dataIndex: "Remark",
55
- title: "备注",
56
- editable: true,
57
- type: "textarea",
58
- width: 400,
59
- initialValue: "123444",
60
- valueProps: {
61
- placeholder: "请输入内容",
62
- autoSize: {
63
- minRows: 3
64
- }
65
- }
66
- }
67
- ];
68
- useState(
69
- Array.from({ length: 1e5 }, (_, key) => ({
70
- key,
71
- age: key,
72
- title: `title-${key}`
73
- }))
74
- );
75
- useState(false);
76
- useState("");
77
- useState("");
78
- useState([
79
- {
80
- uid: "-1",
81
- name: "image.png",
82
- status: "done",
83
- url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
84
- },
85
- {
86
- uid: "-2",
87
- name: "image.png",
88
- status: "done",
89
- url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
90
- },
91
- {
92
- uid: "-3",
93
- name: "image.png",
94
- status: "done",
95
- url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
96
- }
97
- ]);
98
- return /* @__PURE__ */ jsx("div", { style: { height: "100vh" }, children: /* @__PURE__ */ jsx(
99
- EditTable,
100
- {
101
- columns,
102
- rowKey: "PNOrderNo",
103
- onChange: (row) => {
104
- const index = list.findIndex((v) => v.PNOrderNo === row.PNOrderNo);
105
- const arr = [...list];
106
- arr[index] = row;
107
- setList(arr);
108
- },
109
- dataSource: list,
110
- pagination: false
111
- }
112
- ) });
13
+ const jiami = () => {
14
+ CryptoJS.AES.encrypt(JSON.stringify({
15
+ AppID: "GZY_SZLD_GZYDP",
16
+ Password: "GZY_SZLD_GZYDP2557013",
17
+ copyright: " © 云雁科技有限公司 2023 版权所有",
18
+ icp: 'ICP备案/许可证号:<a href="https://beian.miit.gov.cn/#/Integrated/index" target="_blank">湘B2-20090059</a> 公网安备号 44030502008569 隐私政策',
19
+ tel: "400-607-0705",
20
+ Salt: "HnSzldjt#2557013#"
21
+ }), "SzlDJd#4202");
22
+ };
23
+ return /* @__PURE__ */ jsx("div", { style: { height: "100vh" }, children: "测试页面" });
113
24
  };
114
25
  ReactDOM.createRoot(document.getElementById("root")).render(
115
26
  /* @__PURE__ */ jsx(BrowserRouter, { children: /* @__PURE__ */ jsx(Demo, {}) })
package/es/main.d.ts CHANGED
@@ -13,7 +13,8 @@ import * as utils from "./utils/index";
13
13
  import * as verfyCode from "./utils/verify-code";
14
14
  import useCaptcha from "./hooks/useCaptcha";
15
15
  import useChangePwd from "./hooks/useChangePwd";
16
+ import useConfig from "./hooks/useConfig";
16
17
  import useRemember from "./hooks/useRemember";
17
18
  import useRowSelection from "./hooks/useRowSelection";
18
19
  import HmacSHA512 from './utils/hmacSHA512';
19
- export { AuthButton, BackHeader, CoralButton, CreateForm, EditTable, FormRules, HmacSHA512, SearchTable, UploadFile, download, fileType, showWorkFlow, useCaptcha, useChangePwd, useRemember, useRowSelection, utils, verfyCode };
20
+ export { AuthButton, BackHeader, CoralButton, CreateForm, EditTable, FormRules, HmacSHA512, SearchTable, UploadFile, download, fileType, showWorkFlow, useCaptcha, useChangePwd, useConfig, useRemember, useRowSelection, utils, verfyCode };
package/es/main.js CHANGED
@@ -13,9 +13,10 @@ import * as index from "./utils/index";
13
13
  import * as verifyCode from "./utils/verify-code";
14
14
  import { default as default10 } from "./hooks/useCaptcha";
15
15
  import { default as default11 } from "./hooks/useChangePwd";
16
- import { default as default12 } from "./hooks/useRemember";
17
- import { default as default13 } from "./hooks/useRowSelection";
18
- import { default as default14 } from "./utils/hmacSHA512";
16
+ import { default as default12 } from "./hooks/useConfig";
17
+ import { default as default13 } from "./hooks/useRemember";
18
+ import { default as default14 } from "./hooks/useRowSelection";
19
+ import { default as default15 } from "./utils/hmacSHA512";
19
20
  export {
20
21
  default7 as AuthButton,
21
22
  default2 as BackHeader,
@@ -23,7 +24,7 @@ export {
23
24
  default3 as CreateForm,
24
25
  default6 as EditTable,
25
26
  formRules as FormRules,
26
- default14 as HmacSHA512,
27
+ default15 as HmacSHA512,
27
28
  default4 as SearchTable,
28
29
  default5 as UploadFile,
29
30
  download,
@@ -31,8 +32,9 @@ export {
31
32
  default9 as showWorkFlow,
32
33
  default10 as useCaptcha,
33
34
  default11 as useChangePwd,
34
- default12 as useRemember,
35
- default13 as useRowSelection,
35
+ default12 as useConfig,
36
+ default13 as useRemember,
37
+ default14 as useRowSelection,
36
38
  index as utils,
37
39
  verifyCode as verfyCode
38
40
  };
@@ -3,7 +3,7 @@ interface AuthProps {
3
3
  PId: number;
4
4
  }
5
5
  export interface CoralButtonProps extends ButtonProps {
6
- PId: number;
6
+ PId: number | number[];
7
7
  auths?: AuthProps[];
8
8
  }
9
9
  declare const CoralButton: (props: CoralButtonProps) => import("react/jsx-runtime").JSX.Element;
@@ -5,7 +5,13 @@ const AuthButton = require("../AuthButton");
5
5
  const CoralButton = (props) => {
6
6
  const { PId, auths, ...rest } = props;
7
7
  const auth = react.useMemo(() => {
8
- if (auths && auths.find((v) => v.PId === PId)) {
8
+ if (!auths) {
9
+ return false;
10
+ }
11
+ if (typeof PId === "number" && auths.find((v) => v.PId === PId)) {
12
+ return true;
13
+ }
14
+ if (Array.isArray(PId) && auths.filter((v) => PId.includes(v.PId)).length > 0) {
9
15
  return true;
10
16
  }
11
17
  return false;
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * 解密前端配置文件信息
4
+ * @export
5
+ * @param {string} value
6
+ * @return {*}
7
+ */
8
+ export default function useConfig(value: string): any;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ const CryptoJS = require("crypto-js");
3
+ const react = require("react");
4
+ const salt = "SzlDJd#4202";
5
+ function useConfig(value) {
6
+ const [config, setConfig] = react.useState(null);
7
+ react.useEffect(() => {
8
+ init();
9
+ }, []);
10
+ const init = () => {
11
+ const bytes = CryptoJS.AES.decrypt(value, salt);
12
+ try {
13
+ const result = JSON.parse(bytes.toString(CryptoJS.enc.Utf8));
14
+ setConfig(result);
15
+ } catch (error) {
16
+ }
17
+ };
18
+ return config;
19
+ }
20
+ module.exports = useConfig;
package/lib/index.js CHANGED
@@ -1,116 +1,27 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
+ const CryptoJS = require("crypto-js");
3
4
  const react = require("react");
4
5
  const ReactDOM = require("react-dom/client");
5
6
  const reactRouterDom = require("react-router-dom");
6
- const main = require("./main");
7
- const antd = require("antd");
8
- require("./utils/compression-file");
7
+ const useConfig = require("./hooks/useConfig");
8
+ let key = "U2FsdGVkX1/dG1NSXNR9hnp3Ech/v6Gh8CDDJxgBm1EPFQel12ySIf84ARXCPwTae7TzwgPvjOyE3S5rAEzl/wAZmId6pbezpFeFcJqxdmIl3FeluYHFxJzQHDETTvrr3G/REvv00kHptOVwg6ecjPH6yk7PNit0sWTBLorROxLxMD8lVDmOA66p7Zp4QnYzqScYJGFbutmfHYXfBRBe1Q2UKummJ798svNY5SIwEwl4spzgyWmhARtuyq4zhysFrj/xODuNDjtwitA6XfX566WcZkj3F+2P+mkYzDYOhXXaomnlybjrZ2hEHfcczQhUfJd89O8PNIuEWo24wjYRgMdKlw5CWSeocFCqV7ZJ/CV/7vNRcaO4awKlFNobLikkwDznxpcX+4UEej+ED+pgfmPQLsKedcfEscStkSAZXaD5pBRTiFU9xGLfDt6seUrEnMBeXkpMIY9j1SZDDK18/G7lSHjDQMZYZP6sfLdBdwY=";
9
9
  const Demo = () => {
10
+ useConfig(key);
10
11
  react.useEffect(() => {
11
- new main.HmacSHA512("17283");
12
+ jiami();
12
13
  }, []);
13
- antd.Form.useForm();
14
- const [list, setList] = react.useState([
15
- {
16
- PNOrderNo: 1,
17
- PNName: "未分配",
18
- PlanFinishDate: "",
19
- Remark: ""
20
- },
21
- {
22
- PNOrderNo: 2,
23
- PNName: "未分配2",
24
- PlanFinishDate: "",
25
- Remark: "123"
26
- },
27
- {
28
- PNOrderNo: 3,
29
- PNName: "未分4",
30
- PlanFinishDate: "",
31
- Remark: ""
32
- }
33
- ]);
34
- const columns = [
35
- {
36
- dataIndex: "PNOrderNo",
37
- title: "序号",
38
- width: 80
39
- },
40
- {
41
- dataIndex: "PNName",
42
- title: "节点名称"
43
- },
44
- {
45
- dataIndex: "PlanFinishDate",
46
- title: "预计完成时间",
47
- editable: true,
48
- width: 400,
49
- type: "datePicker",
50
- valueProps: {
51
- placeholder: "请输入内容"
52
- }
53
- },
54
- {
55
- dataIndex: "Remark",
56
- title: "备注",
57
- editable: true,
58
- type: "textarea",
59
- width: 400,
60
- initialValue: "123444",
61
- valueProps: {
62
- placeholder: "请输入内容",
63
- autoSize: {
64
- minRows: 3
65
- }
66
- }
67
- }
68
- ];
69
- react.useState(
70
- Array.from({ length: 1e5 }, (_, key) => ({
71
- key,
72
- age: key,
73
- title: `title-${key}`
74
- }))
75
- );
76
- react.useState(false);
77
- react.useState("");
78
- react.useState("");
79
- react.useState([
80
- {
81
- uid: "-1",
82
- name: "image.png",
83
- status: "done",
84
- url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
85
- },
86
- {
87
- uid: "-2",
88
- name: "image.png",
89
- status: "done",
90
- url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
91
- },
92
- {
93
- uid: "-3",
94
- name: "image.png",
95
- status: "done",
96
- url: "https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png"
97
- }
98
- ]);
99
- return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100vh" }, children: /* @__PURE__ */ jsxRuntime.jsx(
100
- main.EditTable,
101
- {
102
- columns,
103
- rowKey: "PNOrderNo",
104
- onChange: (row) => {
105
- const index = list.findIndex((v) => v.PNOrderNo === row.PNOrderNo);
106
- const arr = [...list];
107
- arr[index] = row;
108
- setList(arr);
109
- },
110
- dataSource: list,
111
- pagination: false
112
- }
113
- ) });
14
+ const jiami = () => {
15
+ CryptoJS.AES.encrypt(JSON.stringify({
16
+ AppID: "GZY_SZLD_GZYDP",
17
+ Password: "GZY_SZLD_GZYDP2557013",
18
+ copyright: " © 云雁科技有限公司 2023 版权所有",
19
+ icp: 'ICP备案/许可证号:<a href="https://beian.miit.gov.cn/#/Integrated/index" target="_blank">湘B2-20090059</a> 公网安备号 44030502008569 隐私政策',
20
+ tel: "400-607-0705",
21
+ Salt: "HnSzldjt#2557013#"
22
+ }), "SzlDJd#4202");
23
+ };
24
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100vh" }, children: "测试页面" });
114
25
  };
115
26
  ReactDOM.createRoot(document.getElementById("root")).render(
116
27
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.BrowserRouter, { children: /* @__PURE__ */ jsxRuntime.jsx(Demo, {}) })
package/lib/main.d.ts CHANGED
@@ -13,7 +13,8 @@ import * as utils from "./utils/index";
13
13
  import * as verfyCode from "./utils/verify-code";
14
14
  import useCaptcha from "./hooks/useCaptcha";
15
15
  import useChangePwd from "./hooks/useChangePwd";
16
+ import useConfig from "./hooks/useConfig";
16
17
  import useRemember from "./hooks/useRemember";
17
18
  import useRowSelection from "./hooks/useRowSelection";
18
19
  import HmacSHA512 from './utils/hmacSHA512';
19
- export { AuthButton, BackHeader, CoralButton, CreateForm, EditTable, FormRules, HmacSHA512, SearchTable, UploadFile, download, fileType, showWorkFlow, useCaptcha, useChangePwd, useRemember, useRowSelection, utils, verfyCode };
20
+ export { AuthButton, BackHeader, CoralButton, CreateForm, EditTable, FormRules, HmacSHA512, SearchTable, UploadFile, download, fileType, showWorkFlow, useCaptcha, useChangePwd, useConfig, useRemember, useRowSelection, utils, verfyCode };
package/lib/main.js CHANGED
@@ -15,6 +15,7 @@ const index = require("./utils/index");
15
15
  const verifyCode = require("./utils/verify-code");
16
16
  const useCaptcha = require("./hooks/useCaptcha");
17
17
  const useChangePwd = require("./hooks/useChangePwd");
18
+ const useConfig = require("./hooks/useConfig");
18
19
  const useRemember = require("./hooks/useRemember");
19
20
  const useRowSelection = require("./hooks/useRowSelection");
20
21
  const hmacSHA512 = require("./utils/hmacSHA512");
@@ -54,6 +55,7 @@ exports.utils = index__namespace;
54
55
  exports.verfyCode = verifyCode__namespace;
55
56
  exports.useCaptcha = useCaptcha;
56
57
  exports.useChangePwd = useChangePwd;
58
+ exports.useConfig = useConfig;
57
59
  exports.useRemember = useRemember;
58
60
  exports.useRowSelection = useRowSelection;
59
61
  exports.HmacSHA512 = hmacSHA512;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.2.19",
4
+ "version": "0.2.22",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",