szld-libs 0.2.28 → 0.2.30
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/style.css +1 -1
- package/dist/szld-components.es.js +16817 -14886
- package/dist/szld-components.umd.js +58 -55
- package/es/components/EditTable/index.js +1 -1
- package/es/components/SearchTable/index.css +13 -0
- package/es/components/SearchTable/index.d.ts +5 -4
- package/es/components/SearchTable/index.js +46 -8
- package/es/index.js +28 -14
- package/lib/components/EditTable/index.js +1 -1
- package/lib/components/SearchTable/index.css +13 -0
- package/lib/components/SearchTable/index.d.ts +5 -4
- package/lib/components/SearchTable/index.js +46 -8
- package/lib/index.js +26 -12
- package/package.json +3 -1
|
@@ -62,7 +62,7 @@ function EditableCell(props) {
|
|
|
62
62
|
}
|
|
63
63
|
);
|
|
64
64
|
}
|
|
65
|
-
return /* @__PURE__ */ jsx("td", { children: childNode });
|
|
65
|
+
return /* @__PURE__ */ jsx("td", { ...restProps, children: childNode });
|
|
66
66
|
}
|
|
67
67
|
function EditTable(props) {
|
|
68
68
|
const { columns, onChange, ...rest } = props;
|
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
.search-table-module_search_17add {
|
|
2
2
|
margin-bottom: 20px;
|
|
3
3
|
}
|
|
4
|
+
.search-table-module_table_5f652 .react-resizable {
|
|
5
|
+
position: relative;
|
|
6
|
+
background-clip: padding-box;
|
|
7
|
+
}
|
|
8
|
+
.search-table-module_table_5f652 .react-resizable-handle {
|
|
9
|
+
position: absolute;
|
|
10
|
+
width: 10px;
|
|
11
|
+
height: 100%;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
right: -5px;
|
|
14
|
+
cursor: col-resize;
|
|
15
|
+
z-index: 1;
|
|
16
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { TableProps } from
|
|
2
|
-
import { ColumnType } from
|
|
3
|
-
import { CreateFormProps } from
|
|
1
|
+
import { TableProps } from 'antd';
|
|
2
|
+
import { ColumnType } from 'antd/es/table';
|
|
3
|
+
import { CreateFormProps } from '../CreateForm';
|
|
4
4
|
export interface TableColumnProps<T> extends ColumnType<T> {
|
|
5
5
|
hidden?: boolean;
|
|
6
6
|
width?: number;
|
|
7
7
|
}
|
|
8
|
-
export interface MTableProps<T> extends Omit<TableProps<T>,
|
|
8
|
+
export interface MTableProps<T> extends Omit<TableProps<T>, 'columns'> {
|
|
9
9
|
columns?: TableColumnProps<T>[];
|
|
10
10
|
minColumnWidth?: number;
|
|
11
|
+
resizeable?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export interface SearchTableProps<RecordType> {
|
|
13
14
|
searchProps?: CreateFormProps;
|
|
@@ -1,27 +1,65 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Table } from "antd";
|
|
3
3
|
import classNames from "classnames";
|
|
4
|
+
import _ from "lodash";
|
|
5
|
+
import { useState, useMemo } from "react";
|
|
6
|
+
import { Resizable } from "react-resizable";
|
|
4
7
|
import CreateForm from "../CreateForm";
|
|
5
8
|
const search = "search-table-module_search_17add";
|
|
9
|
+
const table = "search-table-module_table_5f652";
|
|
6
10
|
const classes = {
|
|
7
|
-
search
|
|
11
|
+
search,
|
|
12
|
+
table
|
|
13
|
+
};
|
|
14
|
+
const ResizeableTitle = (props) => {
|
|
15
|
+
const { onResize, width, resizeable, ...restProps } = props;
|
|
16
|
+
if (!width || !resizeable) {
|
|
17
|
+
return /* @__PURE__ */ jsx("th", { ...restProps });
|
|
18
|
+
}
|
|
19
|
+
return /* @__PURE__ */ jsx(Resizable, { width: width || 200, height: 0, onResize, draggableOpts: { enableUserSelectHack: false }, children: /* @__PURE__ */ jsx("th", { ...restProps }) });
|
|
8
20
|
};
|
|
9
21
|
function SearchTable(props) {
|
|
10
22
|
const { tableProps = {}, searchProps } = props;
|
|
11
|
-
const {
|
|
23
|
+
const { minColumnWidth = 200, resizeable = true, ...rest } = tableProps;
|
|
24
|
+
const [columns, setColumns] = useState(tableProps.columns || []);
|
|
25
|
+
const handleResize = (column, size) => {
|
|
26
|
+
const list = _.cloneDeep(columns);
|
|
27
|
+
const index = list.findIndex((v) => v.dataIndex === column.dataIndex);
|
|
28
|
+
list[index] = {
|
|
29
|
+
...list[index],
|
|
30
|
+
width: size.width
|
|
31
|
+
};
|
|
32
|
+
setColumns(list);
|
|
33
|
+
};
|
|
34
|
+
const realColumns = useMemo(() => {
|
|
35
|
+
const result = columns.filter((v) => !v.hidden).map((v) => ({
|
|
36
|
+
...v,
|
|
37
|
+
width: v.width || minColumnWidth,
|
|
38
|
+
onHeaderCell: (column, index) => ({
|
|
39
|
+
width: column.width,
|
|
40
|
+
resizeable,
|
|
41
|
+
onResize: (_e, { size }) => handleResize(column, size)
|
|
42
|
+
})
|
|
43
|
+
}));
|
|
44
|
+
result[result.length - 1].width = void 0;
|
|
45
|
+
return result;
|
|
46
|
+
}, [resizeable, columns, minColumnWidth]);
|
|
47
|
+
const components = {
|
|
48
|
+
header: {
|
|
49
|
+
cell: ResizeableTitle
|
|
50
|
+
}
|
|
51
|
+
};
|
|
12
52
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
13
53
|
searchProps && /* @__PURE__ */ jsx(CreateForm, { hiddenTitle: true, ...searchProps, items: searchProps.items }),
|
|
14
54
|
/* @__PURE__ */ jsx(
|
|
15
55
|
Table,
|
|
16
56
|
{
|
|
17
|
-
|
|
57
|
+
...rest,
|
|
58
|
+
columns: realColumns,
|
|
18
59
|
scroll: {
|
|
19
|
-
x:
|
|
20
|
-
(a, b) => a + (typeof b.width === "number" ? b.width : minColumnWidth),
|
|
21
|
-
0
|
|
22
|
-
)
|
|
60
|
+
x: realColumns.reduce((a, b) => a + (typeof b.width === "number" ? b.width : minColumnWidth), 0)
|
|
23
61
|
},
|
|
24
|
-
|
|
62
|
+
components,
|
|
25
63
|
className: classNames(classes.table, tableProps == null ? void 0 : tableProps.className),
|
|
26
64
|
pagination: typeof (tableProps == null ? void 0 : tableProps.pagination) === "boolean" ? tableProps.pagination : {
|
|
27
65
|
showPrevNextJumpers: true,
|
package/es/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect } from "react";
|
|
3
3
|
import ReactDOM from "react-dom/client";
|
|
4
4
|
import { BrowserRouter } from "react-router-dom";
|
|
5
5
|
import useConfig from "./hooks/useConfig";
|
|
6
|
-
import { AES,
|
|
6
|
+
import { AES, SearchTable } from "./main";
|
|
7
7
|
let key = "U2FsdGVkX1/dG1NSXNR9hnp3Ech/v6Gh8CDDJxgBm1EPFQel12ySIf84ARXCPwTae7TzwgPvjOyE3S5rAEzl/wAZmId6pbezpFeFcJqxdmIl3FeluYHFxJzQHDETTvrr3G/REvv00kHptOVwg6ecjPH6yk7PNit0sWTBLorROxLxMD8lVDmOA66p7Zp4QnYzqScYJGFbutmfHYXfBRBe1Q2UKummJ798svNY5SIwEwl4spzgyWmhARtuyq4zhysFrj/xODuNDjtwitA6XfX566WcZkj3F+2P+mkYzDYOhXXaomnlybjrZ2hEHfcczQhUfJd89O8PNIuEWo24wjYRgMdKlw5CWSeocFCqV7ZJ/CV/7vNRcaO4awKlFNobLikkwDznxpcX+4UEej+ED+pgfmPQLsKedcfEscStkSAZXaD5pBRTiFU9xGLfDt6seUrEnMBeXkpMIY9j1SZDDK18/G7lSHjDQMZYZP6sfLdBdwY=";
|
|
8
8
|
const Demo = () => {
|
|
9
9
|
useConfig(key);
|
|
@@ -12,19 +12,33 @@ const Demo = () => {
|
|
|
12
12
|
}, []);
|
|
13
13
|
const jiami = () => {
|
|
14
14
|
const aes = new AES();
|
|
15
|
-
aes.encrypt(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
aes.encrypt(
|
|
16
|
+
JSON.stringify({
|
|
17
|
+
AppID: "GZY_SZLD_GZYDP",
|
|
18
|
+
Password: "GZY_SZLD_GZYDP2557013",
|
|
19
|
+
copyright: " © 云雁科技有限公司 2023 版权所有",
|
|
20
|
+
icp: 'ICP备案/许可证号:<a href="https://beian.miit.gov.cn/#/Integrated/index" target="_blank">湘B2-20090059</a> 公网安备号 44030502008569 隐私政策',
|
|
21
|
+
tel: "400-607-0705",
|
|
22
|
+
Salt: "HnSzldjt#2557013#"
|
|
23
|
+
})
|
|
24
|
+
);
|
|
23
25
|
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
const columns = [
|
|
27
|
+
{
|
|
28
|
+
dataIndex: "a",
|
|
29
|
+
title: "a"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
dataIndex: "b",
|
|
33
|
+
title: "b",
|
|
34
|
+
width: 400
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
dataIndex: "c",
|
|
38
|
+
title: "c"
|
|
39
|
+
}
|
|
40
|
+
];
|
|
41
|
+
return /* @__PURE__ */ jsx("div", { style: { height: "100vh" }, children: /* @__PURE__ */ jsx(SearchTable, { tableProps: { columns, dataSource: [], resizeable: false } }) });
|
|
28
42
|
};
|
|
29
43
|
ReactDOM.createRoot(document.getElementById("root")).render(
|
|
30
44
|
/* @__PURE__ */ jsx(BrowserRouter, { children: /* @__PURE__ */ jsx(Demo, {}) })
|
|
@@ -63,7 +63,7 @@ function EditableCell(props) {
|
|
|
63
63
|
}
|
|
64
64
|
);
|
|
65
65
|
}
|
|
66
|
-
return /* @__PURE__ */ jsxRuntime.jsx("td", { children: childNode });
|
|
66
|
+
return /* @__PURE__ */ jsxRuntime.jsx("td", { ...restProps, children: childNode });
|
|
67
67
|
}
|
|
68
68
|
function EditTable(props) {
|
|
69
69
|
const { columns, onChange, ...rest } = props;
|
|
@@ -1,3 +1,16 @@
|
|
|
1
1
|
.search-table-module_search_17add {
|
|
2
2
|
margin-bottom: 20px;
|
|
3
3
|
}
|
|
4
|
+
.search-table-module_table_5f652 .react-resizable {
|
|
5
|
+
position: relative;
|
|
6
|
+
background-clip: padding-box;
|
|
7
|
+
}
|
|
8
|
+
.search-table-module_table_5f652 .react-resizable-handle {
|
|
9
|
+
position: absolute;
|
|
10
|
+
width: 10px;
|
|
11
|
+
height: 100%;
|
|
12
|
+
bottom: 0;
|
|
13
|
+
right: -5px;
|
|
14
|
+
cursor: col-resize;
|
|
15
|
+
z-index: 1;
|
|
16
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { TableProps } from
|
|
2
|
-
import { ColumnType } from
|
|
3
|
-
import { CreateFormProps } from
|
|
1
|
+
import { TableProps } from 'antd';
|
|
2
|
+
import { ColumnType } from 'antd/es/table';
|
|
3
|
+
import { CreateFormProps } from '../CreateForm';
|
|
4
4
|
export interface TableColumnProps<T> extends ColumnType<T> {
|
|
5
5
|
hidden?: boolean;
|
|
6
6
|
width?: number;
|
|
7
7
|
}
|
|
8
|
-
export interface MTableProps<T> extends Omit<TableProps<T>,
|
|
8
|
+
export interface MTableProps<T> extends Omit<TableProps<T>, 'columns'> {
|
|
9
9
|
columns?: TableColumnProps<T>[];
|
|
10
10
|
minColumnWidth?: number;
|
|
11
|
+
resizeable?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export interface SearchTableProps<RecordType> {
|
|
13
14
|
searchProps?: CreateFormProps;
|
|
@@ -2,27 +2,65 @@
|
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const antd = require("antd");
|
|
4
4
|
const classNames = require("classnames");
|
|
5
|
+
const _ = require("lodash");
|
|
6
|
+
const react = require("react");
|
|
7
|
+
const reactResizable = require("react-resizable");
|
|
5
8
|
const CreateForm = require("../CreateForm");
|
|
6
9
|
const search = "search-table-module_search_17add";
|
|
10
|
+
const table = "search-table-module_table_5f652";
|
|
7
11
|
const classes = {
|
|
8
|
-
search
|
|
12
|
+
search,
|
|
13
|
+
table
|
|
14
|
+
};
|
|
15
|
+
const ResizeableTitle = (props) => {
|
|
16
|
+
const { onResize, width, resizeable, ...restProps } = props;
|
|
17
|
+
if (!width || !resizeable) {
|
|
18
|
+
return /* @__PURE__ */ jsxRuntime.jsx("th", { ...restProps });
|
|
19
|
+
}
|
|
20
|
+
return /* @__PURE__ */ jsxRuntime.jsx(reactResizable.Resizable, { width: width || 200, height: 0, onResize, draggableOpts: { enableUserSelectHack: false }, children: /* @__PURE__ */ jsxRuntime.jsx("th", { ...restProps }) });
|
|
9
21
|
};
|
|
10
22
|
function SearchTable(props) {
|
|
11
23
|
const { tableProps = {}, searchProps } = props;
|
|
12
|
-
const {
|
|
24
|
+
const { minColumnWidth = 200, resizeable = true, ...rest } = tableProps;
|
|
25
|
+
const [columns, setColumns] = react.useState(tableProps.columns || []);
|
|
26
|
+
const handleResize = (column, size) => {
|
|
27
|
+
const list = _.cloneDeep(columns);
|
|
28
|
+
const index = list.findIndex((v) => v.dataIndex === column.dataIndex);
|
|
29
|
+
list[index] = {
|
|
30
|
+
...list[index],
|
|
31
|
+
width: size.width
|
|
32
|
+
};
|
|
33
|
+
setColumns(list);
|
|
34
|
+
};
|
|
35
|
+
const realColumns = react.useMemo(() => {
|
|
36
|
+
const result = columns.filter((v) => !v.hidden).map((v) => ({
|
|
37
|
+
...v,
|
|
38
|
+
width: v.width || minColumnWidth,
|
|
39
|
+
onHeaderCell: (column, index) => ({
|
|
40
|
+
width: column.width,
|
|
41
|
+
resizeable,
|
|
42
|
+
onResize: (_e, { size }) => handleResize(column, size)
|
|
43
|
+
})
|
|
44
|
+
}));
|
|
45
|
+
result[result.length - 1].width = void 0;
|
|
46
|
+
return result;
|
|
47
|
+
}, [resizeable, columns, minColumnWidth]);
|
|
48
|
+
const components = {
|
|
49
|
+
header: {
|
|
50
|
+
cell: ResizeableTitle
|
|
51
|
+
}
|
|
52
|
+
};
|
|
13
53
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
14
54
|
searchProps && /* @__PURE__ */ jsxRuntime.jsx(CreateForm, { hiddenTitle: true, ...searchProps, items: searchProps.items }),
|
|
15
55
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16
56
|
antd.Table,
|
|
17
57
|
{
|
|
18
|
-
|
|
58
|
+
...rest,
|
|
59
|
+
columns: realColumns,
|
|
19
60
|
scroll: {
|
|
20
|
-
x:
|
|
21
|
-
(a, b) => a + (typeof b.width === "number" ? b.width : minColumnWidth),
|
|
22
|
-
0
|
|
23
|
-
)
|
|
61
|
+
x: realColumns.reduce((a, b) => a + (typeof b.width === "number" ? b.width : minColumnWidth), 0)
|
|
24
62
|
},
|
|
25
|
-
|
|
63
|
+
components,
|
|
26
64
|
className: classNames(classes.table, tableProps == null ? void 0 : tableProps.className),
|
|
27
65
|
pagination: typeof (tableProps == null ? void 0 : tableProps.pagination) === "boolean" ? tableProps.pagination : {
|
|
28
66
|
showPrevNextJumpers: true,
|
package/lib/index.js
CHANGED
|
@@ -13,19 +13,33 @@ const Demo = () => {
|
|
|
13
13
|
}, []);
|
|
14
14
|
const jiami = () => {
|
|
15
15
|
const aes = new main.AES();
|
|
16
|
-
aes.encrypt(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
16
|
+
aes.encrypt(
|
|
17
|
+
JSON.stringify({
|
|
18
|
+
AppID: "GZY_SZLD_GZYDP",
|
|
19
|
+
Password: "GZY_SZLD_GZYDP2557013",
|
|
20
|
+
copyright: " © 云雁科技有限公司 2023 版权所有",
|
|
21
|
+
icp: 'ICP备案/许可证号:<a href="https://beian.miit.gov.cn/#/Integrated/index" target="_blank">湘B2-20090059</a> 公网安备号 44030502008569 隐私政策',
|
|
22
|
+
tel: "400-607-0705",
|
|
23
|
+
Salt: "HnSzldjt#2557013#"
|
|
24
|
+
})
|
|
25
|
+
);
|
|
24
26
|
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const columns = [
|
|
28
|
+
{
|
|
29
|
+
dataIndex: "a",
|
|
30
|
+
title: "a"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
dataIndex: "b",
|
|
34
|
+
title: "b",
|
|
35
|
+
width: 400
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
dataIndex: "c",
|
|
39
|
+
title: "c"
|
|
40
|
+
}
|
|
41
|
+
];
|
|
42
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { height: "100vh" }, children: /* @__PURE__ */ jsxRuntime.jsx(main.SearchTable, { tableProps: { columns, dataSource: [], resizeable: false } }) });
|
|
29
43
|
};
|
|
30
44
|
ReactDOM.createRoot(document.getElementById("root")).render(
|
|
31
45
|
/* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.BrowserRouter, { children: /* @__PURE__ */ jsxRuntime.jsx(Demo, {}) })
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "szld-libs",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.30",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "vite",
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"pako": "^2.1.0",
|
|
17
17
|
"react": "^18.2.0",
|
|
18
18
|
"react-dom": "^18.2.0",
|
|
19
|
+
"react-resizable": "^3.0.5",
|
|
19
20
|
"react-router-dom": "^6.6.1",
|
|
20
21
|
"react-window": "^1.8.9"
|
|
21
22
|
},
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
"@types/node": "^18.11.15",
|
|
26
27
|
"@types/react": "^18.2.45",
|
|
27
28
|
"@types/react-dom": "^18.2.18",
|
|
29
|
+
"@types/react-resizable": "^3.0.8",
|
|
28
30
|
"@types/react-window": "^1.8.5",
|
|
29
31
|
"@vitejs/plugin-react": "^3.0.0",
|
|
30
32
|
"less": "^4.1.3",
|