szld-libs 0.2.45 → 0.2.47
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/szld-components.es.js +798 -805
- package/dist/szld-components.umd.js +21 -21
- package/es/components/BackHeader/index.d.ts +11 -1
- package/es/components/BackHeader/index.js +3 -12
- package/es/components/SearchTable/index.d.ts +7 -0
- package/es/components/SearchTable/index.js +1 -0
- package/es/index.js +2 -1
- package/lib/components/BackHeader/index.d.ts +11 -1
- package/lib/components/BackHeader/index.js +2 -11
- package/lib/components/SearchTable/index.d.ts +7 -0
- package/lib/components/SearchTable/index.js +1 -0
- package/lib/index.js +1 -0
- package/package.json +1 -1
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
interface BackHeaderProps {
|
|
3
|
+
/** 是否显示返回按钮 */
|
|
3
4
|
isBack?: boolean;
|
|
5
|
+
/** 页头标题 */
|
|
4
6
|
title: string | ReactNode;
|
|
7
|
+
/** 页头副标题 */
|
|
5
8
|
subTitle?: string | ReactNode;
|
|
9
|
+
/** 标题右侧元素 */
|
|
6
10
|
extra?: ReactNode;
|
|
11
|
+
/** 自定义class */
|
|
7
12
|
className?: string;
|
|
13
|
+
/** 自定义页头style */
|
|
8
14
|
style?: CSSProperties;
|
|
15
|
+
/** 自定义标题style */
|
|
9
16
|
titleStyle?: CSSProperties;
|
|
17
|
+
/** 重要程度,相当于 h1、h2、h3、h4、h5 */
|
|
10
18
|
level?: 1 | 2 | 3 | 4 | 5;
|
|
19
|
+
/** 自定义图标 */
|
|
20
|
+
icon?: React.ReactNode;
|
|
11
21
|
}
|
|
12
22
|
declare const BackHeader: (props: BackHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
23
|
export default BackHeader;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Space, Typography } from "antd";
|
|
2
|
+
import { Space, Button, Typography } from "antd";
|
|
3
3
|
import { ArrowLeftOutlined } from "@ant-design/icons";
|
|
4
4
|
import { useNavigate } from "react-router-dom";
|
|
5
5
|
import classNames from "classnames";
|
|
@@ -13,16 +13,7 @@ const styles = {
|
|
|
13
13
|
};
|
|
14
14
|
const { Title, Text } = Typography;
|
|
15
15
|
const BackHeader = (props) => {
|
|
16
|
-
const {
|
|
17
|
-
isBack = true,
|
|
18
|
-
title: title2,
|
|
19
|
-
extra,
|
|
20
|
-
subTitle = null,
|
|
21
|
-
className,
|
|
22
|
-
style,
|
|
23
|
-
titleStyle,
|
|
24
|
-
level = 2
|
|
25
|
-
} = props;
|
|
16
|
+
const { isBack = true, title: title2, extra, subTitle = null, className, style, titleStyle, level = 2, icon } = props;
|
|
26
17
|
const navigate = useNavigate();
|
|
27
18
|
const renderSubtitle = () => {
|
|
28
19
|
if (typeof subTitle === "string") {
|
|
@@ -35,7 +26,7 @@ const BackHeader = (props) => {
|
|
|
35
26
|
};
|
|
36
27
|
return /* @__PURE__ */ jsxs("div", { className: classNames(styles.main, className), style, children: [
|
|
37
28
|
/* @__PURE__ */ jsxs(Space, { children: [
|
|
38
|
-
isBack && /* @__PURE__ */ jsx(ArrowLeftOutlined, { style: { fontSize: 24 }, onClick: goBack }),
|
|
29
|
+
isBack && /* @__PURE__ */ jsx(Button, { type: "text", icon: icon || /* @__PURE__ */ jsx(ArrowLeftOutlined, { style: { fontSize: 24 } }), onClick: goBack }),
|
|
39
30
|
/* @__PURE__ */ jsxs(Title, { level, className: styles.title, style: titleStyle, children: [
|
|
40
31
|
title2,
|
|
41
32
|
renderSubtitle()
|
|
@@ -2,15 +2,22 @@ import { TableProps } from 'antd';
|
|
|
2
2
|
import { ColumnType } from 'antd/es/table';
|
|
3
3
|
import { CreateFormProps } from '../CreateForm';
|
|
4
4
|
export interface TableColumnProps<T> extends ColumnType<T> {
|
|
5
|
+
/** 是否隐藏 */
|
|
5
6
|
hidden?: boolean;
|
|
7
|
+
/** 宽度 */
|
|
6
8
|
width?: number | string;
|
|
9
|
+
/** 最小宽度 */
|
|
7
10
|
minWidth?: number | string;
|
|
8
11
|
}
|
|
9
12
|
export interface MTableProps<T> extends Omit<TableProps<T>, 'columns'> {
|
|
10
13
|
columns?: TableColumnProps<T>[];
|
|
14
|
+
/** 单元格最小width,默认200 */
|
|
11
15
|
minColumnWidth?: number;
|
|
16
|
+
/** 是否可调整列宽度 */
|
|
12
17
|
resizeable?: boolean;
|
|
18
|
+
/** 表格id,用于调整列宽时存储 */
|
|
13
19
|
tableId?: string;
|
|
20
|
+
/** 存储key,默认szld_table_cell_width */
|
|
14
21
|
storageKey?: string;
|
|
15
22
|
}
|
|
16
23
|
export interface SearchTableProps<RecordType> {
|
package/es/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import ReactDOM from "react-dom/client";
|
|
|
4
4
|
import { BrowserRouter } from "react-router-dom";
|
|
5
5
|
import { Table, Button } from "antd";
|
|
6
6
|
import useConfig from "./hooks/useConfig";
|
|
7
|
-
import { useRowSelection, SearchTable } from "./main";
|
|
7
|
+
import { useRowSelection, BackHeader, SearchTable } from "./main";
|
|
8
8
|
let key = "U2FsdGVkX1/dG1NSXNR9hnp3Ech/v6Gh8CDDJxgBm1EPFQel12ySIf84ARXCPwTae7TzwgPvjOyE3S5rAEzl/wAZmId6pbezpFeFcJqxdmIl3FeluYHFxJzQHDETTvrr3G/REvv00kHptOVwg6ecjPH6yk7PNit0sWTBLorROxLxMD8lVDmOA66p7Zp4QnYzqScYJGFbutmfHYXfBRBe1Q2UKummJ798svNY5SIwEwl4spzgyWmhARtuyq4zhysFrj/xODuNDjtwitA6XfX566WcZkj3F+2P+mkYzDYOhXXaomnlybjrZ2hEHfcczQhUfJd89O8PNIuEWo24wjYRgMdKlw5CWSeocFCqV7ZJ/CV/7vNRcaO4awKlFNobLikkwDznxpcX+4UEej+ED+pgfmPQLsKedcfEscStkSAZXaD5pBRTiFU9xGLfDt6seUrEnMBeXkpMIY9j1SZDDK18/G7lSHjDQMZYZP6sfLdBdwY=";
|
|
9
9
|
const Demo = () => {
|
|
10
10
|
useConfig(key);
|
|
@@ -41,6 +41,7 @@ const Demo = () => {
|
|
|
41
41
|
setSelectedKeys([1, 12, 21]);
|
|
42
42
|
}, []);
|
|
43
43
|
return /* @__PURE__ */ jsxs("div", { style: { height: "100vh" }, children: [
|
|
44
|
+
/* @__PURE__ */ jsx(BackHeader, { title: "新增系统", isBack: true }),
|
|
44
45
|
/* @__PURE__ */ jsx(Button, { onClick: () => setList(columns), children: "test" }),
|
|
45
46
|
/* @__PURE__ */ jsx(
|
|
46
47
|
"div",
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
-
import { CSSProperties, ReactNode } from
|
|
1
|
+
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
interface BackHeaderProps {
|
|
3
|
+
/** 是否显示返回按钮 */
|
|
3
4
|
isBack?: boolean;
|
|
5
|
+
/** 页头标题 */
|
|
4
6
|
title: string | ReactNode;
|
|
7
|
+
/** 页头副标题 */
|
|
5
8
|
subTitle?: string | ReactNode;
|
|
9
|
+
/** 标题右侧元素 */
|
|
6
10
|
extra?: ReactNode;
|
|
11
|
+
/** 自定义class */
|
|
7
12
|
className?: string;
|
|
13
|
+
/** 自定义页头style */
|
|
8
14
|
style?: CSSProperties;
|
|
15
|
+
/** 自定义标题style */
|
|
9
16
|
titleStyle?: CSSProperties;
|
|
17
|
+
/** 重要程度,相当于 h1、h2、h3、h4、h5 */
|
|
10
18
|
level?: 1 | 2 | 3 | 4 | 5;
|
|
19
|
+
/** 自定义图标 */
|
|
20
|
+
icon?: React.ReactNode;
|
|
11
21
|
}
|
|
12
22
|
declare const BackHeader: (props: BackHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
23
|
export default BackHeader;
|
|
@@ -14,16 +14,7 @@ const styles = {
|
|
|
14
14
|
};
|
|
15
15
|
const { Title, Text } = antd.Typography;
|
|
16
16
|
const BackHeader = (props) => {
|
|
17
|
-
const {
|
|
18
|
-
isBack = true,
|
|
19
|
-
title: title2,
|
|
20
|
-
extra,
|
|
21
|
-
subTitle = null,
|
|
22
|
-
className,
|
|
23
|
-
style,
|
|
24
|
-
titleStyle,
|
|
25
|
-
level = 2
|
|
26
|
-
} = props;
|
|
17
|
+
const { isBack = true, title: title2, extra, subTitle = null, className, style, titleStyle, level = 2, icon } = props;
|
|
27
18
|
const navigate = reactRouterDom.useNavigate();
|
|
28
19
|
const renderSubtitle = () => {
|
|
29
20
|
if (typeof subTitle === "string") {
|
|
@@ -36,7 +27,7 @@ const BackHeader = (props) => {
|
|
|
36
27
|
};
|
|
37
28
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: classNames(styles.main, className), style, children: [
|
|
38
29
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { children: [
|
|
39
|
-
isBack && /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeftOutlined, { style: { fontSize: 24 }, onClick: goBack }),
|
|
30
|
+
isBack && /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", icon: icon || /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowLeftOutlined, { style: { fontSize: 24 } }), onClick: goBack }),
|
|
40
31
|
/* @__PURE__ */ jsxRuntime.jsxs(Title, { level, className: styles.title, style: titleStyle, children: [
|
|
41
32
|
title2,
|
|
42
33
|
renderSubtitle()
|
|
@@ -2,15 +2,22 @@ import { TableProps } from 'antd';
|
|
|
2
2
|
import { ColumnType } from 'antd/es/table';
|
|
3
3
|
import { CreateFormProps } from '../CreateForm';
|
|
4
4
|
export interface TableColumnProps<T> extends ColumnType<T> {
|
|
5
|
+
/** 是否隐藏 */
|
|
5
6
|
hidden?: boolean;
|
|
7
|
+
/** 宽度 */
|
|
6
8
|
width?: number | string;
|
|
9
|
+
/** 最小宽度 */
|
|
7
10
|
minWidth?: number | string;
|
|
8
11
|
}
|
|
9
12
|
export interface MTableProps<T> extends Omit<TableProps<T>, 'columns'> {
|
|
10
13
|
columns?: TableColumnProps<T>[];
|
|
14
|
+
/** 单元格最小width,默认200 */
|
|
11
15
|
minColumnWidth?: number;
|
|
16
|
+
/** 是否可调整列宽度 */
|
|
12
17
|
resizeable?: boolean;
|
|
18
|
+
/** 表格id,用于调整列宽时存储 */
|
|
13
19
|
tableId?: string;
|
|
20
|
+
/** 存储key,默认szld_table_cell_width */
|
|
14
21
|
storageKey?: string;
|
|
15
22
|
}
|
|
16
23
|
export interface SearchTableProps<RecordType> {
|
|
@@ -44,6 +44,7 @@ function SearchTable(props) {
|
|
|
44
44
|
react.useEffect(() => {
|
|
45
45
|
const list = tableProps.columns || [];
|
|
46
46
|
if (list.length === 0 || !resizeable) {
|
|
47
|
+
setColumns(list);
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
const result = list == null ? void 0 : list.filter((v) => !v.hidden).map((v) => {
|
package/lib/index.js
CHANGED
|
@@ -42,6 +42,7 @@ const Demo = () => {
|
|
|
42
42
|
setSelectedKeys([1, 12, 21]);
|
|
43
43
|
}, []);
|
|
44
44
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { height: "100vh" }, children: [
|
|
45
|
+
/* @__PURE__ */ jsxRuntime.jsx(main.BackHeader, { title: "新增系统", isBack: true }),
|
|
45
46
|
/* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: () => setList(columns), children: "test" }),
|
|
46
47
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
47
48
|
"div",
|