@hw-component/table 1.9.35 → 1.9.37
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/.eslintcache +1 -1
- package/es/DialogTable/hooks.js +9 -0
- package/es/HTableBody/index.d.ts +3 -1
- package/es/modal.d.ts +1 -1
- package/es/render/config.d.ts +1 -1
- package/es/render/config.js +4 -0
- package/lib/DialogTable/hooks.js +9 -0
- package/lib/HTableBody/index.d.ts +3 -1
- package/lib/modal.d.ts +1 -1
- package/lib/render/config.d.ts +1 -1
- package/lib/render/config.js +4 -0
- package/package.json +1 -1
- package/src/components/DialogTable/hooks.ts +10 -0
- package/src/components/HTableBody/RowSelection.tsx +10 -16
- package/src/components/HTableBody/hooks.tsx +14 -11
- package/src/components/HTableBody/index.tsx +3 -2
- package/src/components/HTableHeader/defaultSubComponent.tsx +17 -15
- package/src/components/HTablePagination/index.tsx +5 -5
- package/src/components/Table.tsx +4 -4
- package/src/components/modal.ts +3 -3
- package/src/components/render/config.tsx +4 -0
- package/src/pages/ModalTable/index.tsx +9 -5
- package/src/pages/Table/index.tsx +8 -3
package/es/DialogTable/hooks.js
CHANGED
|
@@ -40,6 +40,15 @@ var useTableProps = function useTableProps(_ref) {
|
|
|
40
40
|
_useState2 = _slicedToArray(_useState, 2),
|
|
41
41
|
modalTableParams = _useState2[0],
|
|
42
42
|
setModalTableParams = _useState2[1];
|
|
43
|
+
useEffect(function () {
|
|
44
|
+
if (configData) {
|
|
45
|
+
setModalTableParams(function (oldVal) {
|
|
46
|
+
return _objectSpread(_objectSpread({}, oldVal), {}, {
|
|
47
|
+
configData: configData
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}, [configData]);
|
|
43
52
|
return {
|
|
44
53
|
modalTableParams: modalTableParams,
|
|
45
54
|
setModalTableParams: setModalTableParams
|
package/es/HTableBody/index.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { ProTableProps } from "@ant-design/pro-table";
|
|
2
2
|
import type { ActionRenderFn, ConfigDataModal, ParamsModal, HTableInstance, HRowSelection } from "../modal";
|
|
3
3
|
import React from "react";
|
|
4
|
+
import { IPaginationProps } from "../HTablePagination";
|
|
4
5
|
import type { AffixProps } from "antd/lib/affix";
|
|
5
6
|
import type { OptionConfig } from "@ant-design/pro-table/lib/components/ToolBar";
|
|
6
7
|
export interface OptionModal extends OptionConfig {
|
|
7
8
|
settingRender?: () => React.ReactNode;
|
|
8
9
|
}
|
|
9
|
-
export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSource" | "rowSelection" | "options"> {
|
|
10
|
+
export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSource" | "rowSelection" | "options" | "pagination"> {
|
|
10
11
|
configData?: ConfigDataModal;
|
|
11
12
|
onPageChange?: (params: ParamsModal) => void;
|
|
12
13
|
emptyRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
@@ -22,6 +23,7 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
|
|
|
22
23
|
localSorter?: boolean;
|
|
23
24
|
options?: OptionModal | false;
|
|
24
25
|
table?: HTableInstance;
|
|
26
|
+
pagination?: IPaginationProps | false;
|
|
25
27
|
}
|
|
26
28
|
declare const _default: (bodyProps: HTableBodyProps) => JSX.Element;
|
|
27
29
|
export default _default;
|
package/es/modal.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { TableProps } from "antd/lib/table";
|
|
|
8
8
|
import type { AffixProps } from "antd/lib/affix";
|
|
9
9
|
import type { OptionModal } from "./HTableBody";
|
|
10
10
|
import type { DrawerProps } from "antd";
|
|
11
|
-
import { IPaginationProps } from "@/components/HTablePagination";
|
|
11
|
+
import type { IPaginationProps } from "@/components/HTablePagination";
|
|
12
12
|
export interface RowObj {
|
|
13
13
|
keys?: React.Key[];
|
|
14
14
|
rowData?: any[];
|
package/es/render/config.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare const _default: {
|
|
|
5
5
|
date: (config: ConfigItemModal, itemData: any) => string;
|
|
6
6
|
tags: (config: ConfigItemModal, itemData: any, index: number, tableInstance: HTableInstance) => "-" | JSX.Element;
|
|
7
7
|
copy: (config: ConfigItemModal, itemData: any) => "-" | JSX.Element;
|
|
8
|
-
link: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
|
8
|
+
link: (config: ConfigItemModal, itemData: any) => "-" | JSX.Element;
|
|
9
9
|
text: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
|
10
10
|
image: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
|
11
11
|
avatar: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
package/es/render/config.js
CHANGED
|
@@ -86,6 +86,10 @@ var linkRender = function linkRender(config, itemData) {
|
|
|
86
86
|
if (typeof href === "function") {
|
|
87
87
|
hrefUrl = href(itemData);
|
|
88
88
|
}
|
|
89
|
+
var relUrl = hrefUrl || tableVal;
|
|
90
|
+
if (!relUrl) {
|
|
91
|
+
return "-";
|
|
92
|
+
}
|
|
89
93
|
return jsx(Link, {
|
|
90
94
|
href: hrefUrl || tableVal,
|
|
91
95
|
target: target,
|
package/lib/DialogTable/hooks.js
CHANGED
|
@@ -41,6 +41,15 @@ var useTableProps = function useTableProps(_ref) {
|
|
|
41
41
|
_useState2 = _slicedToArray(_useState, 2),
|
|
42
42
|
modalTableParams = _useState2[0],
|
|
43
43
|
setModalTableParams = _useState2[1];
|
|
44
|
+
React.useEffect(function () {
|
|
45
|
+
if (configData) {
|
|
46
|
+
setModalTableParams(function (oldVal) {
|
|
47
|
+
return _objectSpread(_objectSpread({}, oldVal), {}, {
|
|
48
|
+
configData: configData
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
}, [configData]);
|
|
44
53
|
return {
|
|
45
54
|
modalTableParams: modalTableParams,
|
|
46
55
|
setModalTableParams: setModalTableParams
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { ProTableProps } from "@ant-design/pro-table";
|
|
2
2
|
import type { ActionRenderFn, ConfigDataModal, ParamsModal, HTableInstance, HRowSelection } from "../modal";
|
|
3
3
|
import React from "react";
|
|
4
|
+
import { IPaginationProps } from "../HTablePagination";
|
|
4
5
|
import type { AffixProps } from "antd/lib/affix";
|
|
5
6
|
import type { OptionConfig } from "@ant-design/pro-table/lib/components/ToolBar";
|
|
6
7
|
export interface OptionModal extends OptionConfig {
|
|
7
8
|
settingRender?: () => React.ReactNode;
|
|
8
9
|
}
|
|
9
|
-
export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSource" | "rowSelection" | "options"> {
|
|
10
|
+
export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSource" | "rowSelection" | "options" | "pagination"> {
|
|
10
11
|
configData?: ConfigDataModal;
|
|
11
12
|
onPageChange?: (params: ParamsModal) => void;
|
|
12
13
|
emptyRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
@@ -22,6 +23,7 @@ export interface HTableBodyProps extends Omit<ProTableProps<any, any>, "dataSour
|
|
|
22
23
|
localSorter?: boolean;
|
|
23
24
|
options?: OptionModal | false;
|
|
24
25
|
table?: HTableInstance;
|
|
26
|
+
pagination?: IPaginationProps | false;
|
|
25
27
|
}
|
|
26
28
|
declare const _default: (bodyProps: HTableBodyProps) => JSX.Element;
|
|
27
29
|
export default _default;
|
package/lib/modal.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { TableProps } from "antd/lib/table";
|
|
|
8
8
|
import type { AffixProps } from "antd/lib/affix";
|
|
9
9
|
import type { OptionModal } from "./HTableBody";
|
|
10
10
|
import type { DrawerProps } from "antd";
|
|
11
|
-
import { IPaginationProps } from "@/components/HTablePagination";
|
|
11
|
+
import type { IPaginationProps } from "@/components/HTablePagination";
|
|
12
12
|
export interface RowObj {
|
|
13
13
|
keys?: React.Key[];
|
|
14
14
|
rowData?: any[];
|
package/lib/render/config.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare const _default: {
|
|
|
5
5
|
date: (config: ConfigItemModal, itemData: any) => string;
|
|
6
6
|
tags: (config: ConfigItemModal, itemData: any, index: number, tableInstance: HTableInstance) => "-" | JSX.Element;
|
|
7
7
|
copy: (config: ConfigItemModal, itemData: any) => "-" | JSX.Element;
|
|
8
|
-
link: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
|
8
|
+
link: (config: ConfigItemModal, itemData: any) => "-" | JSX.Element;
|
|
9
9
|
text: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
|
10
10
|
image: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
|
11
11
|
avatar: (config: ConfigItemModal, itemData: any) => JSX.Element;
|
package/lib/render/config.js
CHANGED
|
@@ -89,6 +89,10 @@ var linkRender = function linkRender(config, itemData) {
|
|
|
89
89
|
if (typeof href === "function") {
|
|
90
90
|
hrefUrl = href(itemData);
|
|
91
91
|
}
|
|
92
|
+
var relUrl = hrefUrl || tableVal;
|
|
93
|
+
if (!relUrl) {
|
|
94
|
+
return "-";
|
|
95
|
+
}
|
|
92
96
|
return jsxRuntime.jsx(Link, {
|
|
93
97
|
href: hrefUrl || tableVal,
|
|
94
98
|
target: target,
|
package/package.json
CHANGED
|
@@ -35,6 +35,16 @@ export const useTableProps = ({
|
|
|
35
35
|
request,
|
|
36
36
|
dataSource,
|
|
37
37
|
});
|
|
38
|
+
useEffect(()=>{
|
|
39
|
+
if (configData){
|
|
40
|
+
setModalTableParams((oldVal)=>{
|
|
41
|
+
return {
|
|
42
|
+
...oldVal,
|
|
43
|
+
configData
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
},[configData])
|
|
38
48
|
return {
|
|
39
49
|
modalTableParams,
|
|
40
50
|
setModalTableParams,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useHTableContext } from "../context";
|
|
2
2
|
import { Checkbox, Dropdown, Menu } from "antd";
|
|
3
|
-
import {useEffect, useMemo} from "react";
|
|
3
|
+
import { useEffect, useMemo } from "react";
|
|
4
4
|
import type { HRowSelection } from "../modal";
|
|
5
5
|
export const RowSelectionTitle = ({
|
|
6
6
|
allPageCheck = true,
|
|
@@ -119,38 +119,32 @@ export const RowSelectionBox = ({
|
|
|
119
119
|
const { selectedRowData, rowOnChange, rowKey = "id" } = useHTableContext();
|
|
120
120
|
const { rowData = [], keys = [] } = selectedRowData;
|
|
121
121
|
const key = typeof rowKey === "function" ? rowKey(data, index) : data[rowKey];
|
|
122
|
-
const add=()=>{
|
|
122
|
+
const add = () => {
|
|
123
123
|
const newKeys = [...keys];
|
|
124
124
|
const newRowData = [...rowData];
|
|
125
125
|
newKeys.push(key);
|
|
126
126
|
newRowData.push(data);
|
|
127
127
|
rowOnChange(newKeys, newRowData);
|
|
128
128
|
onChange?.(newKeys, newRowData);
|
|
129
|
-
}
|
|
130
|
-
const cancel=()=>{
|
|
129
|
+
};
|
|
130
|
+
const cancel = () => {
|
|
131
131
|
const newKeys = [...keys];
|
|
132
|
-
const newRowData=[...rowData];
|
|
132
|
+
const newRowData = [...rowData];
|
|
133
133
|
const keyIndex = newKeys.indexOf(key);
|
|
134
134
|
newKeys.splice(keyIndex, 1);
|
|
135
|
-
newRowData.splice(keyIndex,1);
|
|
135
|
+
newRowData.splice(keyIndex, 1);
|
|
136
136
|
rowOnChange(newKeys, newRowData);
|
|
137
137
|
onChange?.(newKeys, newRowData);
|
|
138
|
-
}
|
|
138
|
+
};
|
|
139
139
|
const check = (e) => {
|
|
140
140
|
const checked = e.target.checked;
|
|
141
141
|
if (checked) {
|
|
142
142
|
add();
|
|
143
143
|
return;
|
|
144
144
|
}
|
|
145
|
-
cancel()
|
|
145
|
+
cancel();
|
|
146
146
|
};
|
|
147
147
|
const { disabled = false } = getCheckboxProps?.(data) || {};
|
|
148
|
-
const checked=keys.indexOf(key) !== -1;
|
|
149
|
-
return
|
|
150
|
-
<Checkbox
|
|
151
|
-
checked={checked}
|
|
152
|
-
onChange={check}
|
|
153
|
-
disabled={disabled}
|
|
154
|
-
/>
|
|
155
|
-
);
|
|
148
|
+
const checked = keys.indexOf(key) !== -1;
|
|
149
|
+
return <Checkbox checked={checked} onChange={check} disabled={disabled} />;
|
|
156
150
|
};
|
|
@@ -90,19 +90,22 @@ export const useSynchronousKeys = ({
|
|
|
90
90
|
rowKey,
|
|
91
91
|
}: FilterKeysModal) => {
|
|
92
92
|
const { rowOnChange } = useHTableContext();
|
|
93
|
-
const findId=(key)=>{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
const findId = (key) => {
|
|
94
|
+
const msRecords = records as any[];
|
|
95
|
+
const rowIndex = msRecords.findIndex((item, index) => {
|
|
96
|
+
const id =
|
|
97
|
+
typeof rowKey === "function"
|
|
98
|
+
? rowKey(item, index)
|
|
99
|
+
: item[rowKey as string];
|
|
100
|
+
return id === key;
|
|
101
|
+
});
|
|
102
|
+
return msRecords[rowIndex];
|
|
103
|
+
};
|
|
101
104
|
useEffect(() => {
|
|
102
105
|
if (selectedRowKeys && records && rowKey) {
|
|
103
|
-
const resultData= selectedRowKeys.map((key)=>{
|
|
104
|
-
|
|
105
|
-
})
|
|
106
|
+
const resultData = selectedRowKeys.map((key) => {
|
|
107
|
+
return findId(key);
|
|
108
|
+
});
|
|
106
109
|
rowOnChange(selectedRowKeys, resultData);
|
|
107
110
|
}
|
|
108
111
|
}, [selectedRowKeys, records, rowKey]);
|
|
@@ -17,7 +17,7 @@ import { useHTableContext } from "../context";
|
|
|
17
17
|
import React from "react";
|
|
18
18
|
import { ConfigProvider, Empty, Alert, Space } from "antd";
|
|
19
19
|
import { useHTableConfigContext } from "../TableConfig";
|
|
20
|
-
import HTablePagination from "../HTablePagination";
|
|
20
|
+
import HTablePagination, {IPaginationProps} from "../HTablePagination";
|
|
21
21
|
import { useClassName } from "../hooks";
|
|
22
22
|
import AlertMsg from "./AlertMsg";
|
|
23
23
|
import type { AffixProps } from "antd/lib/affix";
|
|
@@ -31,7 +31,7 @@ export interface OptionModal extends OptionConfig {
|
|
|
31
31
|
export interface HTableBodyProps
|
|
32
32
|
extends Omit<
|
|
33
33
|
ProTableProps<any, any>,
|
|
34
|
-
"dataSource" | "rowSelection" | "options"
|
|
34
|
+
"dataSource" | "rowSelection" | "options"|"pagination"
|
|
35
35
|
> {
|
|
36
36
|
configData?: ConfigDataModal;
|
|
37
37
|
onPageChange?: (params: ParamsModal) => void;
|
|
@@ -51,6 +51,7 @@ export interface HTableBodyProps
|
|
|
51
51
|
localSorter?: boolean;
|
|
52
52
|
options?: OptionModal | false;
|
|
53
53
|
table?: HTableInstance;
|
|
54
|
+
pagination?:IPaginationProps|false;
|
|
54
55
|
}
|
|
55
56
|
const defaultRender = () => {
|
|
56
57
|
return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
|
|
@@ -7,7 +7,7 @@ import type { RowProps } from "antd/lib/grid/row";
|
|
|
7
7
|
import { useHeaderContext } from "./Context";
|
|
8
8
|
interface IProps {
|
|
9
9
|
form: HFormInstance;
|
|
10
|
-
render?:(node:React.ReactNode[])=>React.ReactNode;
|
|
10
|
+
render?: (node: React.ReactNode[]) => React.ReactNode;
|
|
11
11
|
}
|
|
12
12
|
const OpenComponent = () => {
|
|
13
13
|
const { headerOpen, setHeaderOpen } = useHTableContext();
|
|
@@ -35,7 +35,7 @@ const OpenComponent = () => {
|
|
|
35
35
|
</>
|
|
36
36
|
);
|
|
37
37
|
};
|
|
38
|
-
export const DefaultSubComponent = ({ form
|
|
38
|
+
export const DefaultSubComponent = ({ form, render }: IProps) => {
|
|
39
39
|
const { loading, headerOpen } = useHTableContext();
|
|
40
40
|
const { onReset } = useHeaderContext();
|
|
41
41
|
const hide = typeof headerOpen === "undefined";
|
|
@@ -53,17 +53,20 @@ export const DefaultSubComponent = ({ form ,render}: IProps) => {
|
|
|
53
53
|
style: {},
|
|
54
54
|
};
|
|
55
55
|
}, [headerOpen, hide]);
|
|
56
|
-
const subBtn=
|
|
56
|
+
const subBtn = (
|
|
57
|
+
<Button
|
|
57
58
|
type={"primary"}
|
|
58
59
|
style={{ borderRadius: 4 }}
|
|
59
60
|
loading={loading}
|
|
60
61
|
onClick={() => {
|
|
61
62
|
form.submit();
|
|
62
63
|
}}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
64
|
+
>
|
|
65
|
+
查询
|
|
66
|
+
</Button>
|
|
67
|
+
);
|
|
68
|
+
const resetBtn = (
|
|
69
|
+
<Button
|
|
67
70
|
style={{ borderRadius: 4 }}
|
|
68
71
|
onClick={() => {
|
|
69
72
|
if (onReset) {
|
|
@@ -72,14 +75,13 @@ export const DefaultSubComponent = ({ form ,render}: IProps) => {
|
|
|
72
75
|
}
|
|
73
76
|
form.resetFieldsInitValue();
|
|
74
77
|
}}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
</>
|
|
78
|
+
>
|
|
79
|
+
重置
|
|
80
|
+
</Button>
|
|
81
|
+
);
|
|
82
|
+
const showMoreBtn = hide ? null : <OpenComponent />;
|
|
83
|
+
if (render) {
|
|
84
|
+
return <>{render([subBtn, resetBtn, showMoreBtn])}</>;
|
|
83
85
|
}
|
|
84
86
|
return (
|
|
85
87
|
<Row
|
|
@@ -14,11 +14,11 @@ export interface IPaginationProps extends Omit<PaginationProps, "showTotal"> {
|
|
|
14
14
|
goTop?: boolean;
|
|
15
15
|
actionRender?: (tableInstance: HTableInstance) => React.ReactNode;
|
|
16
16
|
table?: HTableInstance;
|
|
17
|
-
showTotal?:false|PaginationProps["showTotal"]
|
|
17
|
+
showTotal?: false | PaginationProps["showTotal"];
|
|
18
18
|
}
|
|
19
|
-
const defaultShowTotal=(totalNum:number, [showCurrent, showCurrentEnd])=>{
|
|
19
|
+
const defaultShowTotal = (totalNum: number, [showCurrent, showCurrentEnd]) => {
|
|
20
20
|
return `第${showCurrent}-${showCurrentEnd}/总共${totalNum}条`;
|
|
21
|
-
}
|
|
21
|
+
};
|
|
22
22
|
export default ({
|
|
23
23
|
onPageChange,
|
|
24
24
|
paginationStyle,
|
|
@@ -26,7 +26,7 @@ export default ({
|
|
|
26
26
|
goTop,
|
|
27
27
|
actionRender,
|
|
28
28
|
table,
|
|
29
|
-
showTotal=defaultShowTotal,
|
|
29
|
+
showTotal = defaultShowTotal,
|
|
30
30
|
...props
|
|
31
31
|
}: IPaginationProps) => {
|
|
32
32
|
const {
|
|
@@ -45,7 +45,7 @@ export default ({
|
|
|
45
45
|
const pageTotal = Number.parseInt(total || "0", 10);
|
|
46
46
|
const className = useClassName("hw-table-pagination");
|
|
47
47
|
const [style, setStyle] = useState({});
|
|
48
|
-
const cuShowTotal=showTotal===false?undefined:showTotal;
|
|
48
|
+
const cuShowTotal = showTotal === false ? undefined : showTotal;
|
|
49
49
|
if (!data) {
|
|
50
50
|
return <></>;
|
|
51
51
|
}
|
package/src/components/Table.tsx
CHANGED
|
@@ -31,8 +31,8 @@ export default ({
|
|
|
31
31
|
style,
|
|
32
32
|
dataSource,
|
|
33
33
|
reload,
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
loading: propsLoading,
|
|
35
|
+
error: propsError,
|
|
36
36
|
...props
|
|
37
37
|
}: HTableProps) => {
|
|
38
38
|
const { run, loading, data, error, saveParams } = useReq({
|
|
@@ -72,8 +72,8 @@ export default ({
|
|
|
72
72
|
selectedRowData,
|
|
73
73
|
rowOnChange,
|
|
74
74
|
data,
|
|
75
|
-
error:propsError||error,
|
|
76
|
-
loading:(propsLoading as boolean)||loading,
|
|
75
|
+
error: propsError || error,
|
|
76
|
+
loading: (propsLoading as boolean) || loading,
|
|
77
77
|
allSelectChange,
|
|
78
78
|
action,
|
|
79
79
|
configData,
|
package/src/components/modal.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { AffixProps } from "antd/lib/affix";
|
|
|
12
12
|
import type { OptionModal } from "./HTableBody";
|
|
13
13
|
import { GetRowKey } from "rc-table/lib/interface";
|
|
14
14
|
import type { DrawerProps } from "antd";
|
|
15
|
-
import {IPaginationProps} from "@/components/HTablePagination";
|
|
15
|
+
import type { IPaginationProps } from "@/components/HTablePagination";
|
|
16
16
|
|
|
17
17
|
export interface RowObj {
|
|
18
18
|
keys?: React.Key[];
|
|
@@ -77,7 +77,7 @@ export type HRowSelection = RowSelectionOuter &
|
|
|
77
77
|
export interface HTableProps
|
|
78
78
|
extends Omit<
|
|
79
79
|
ProTableProps<any, any>,
|
|
80
|
-
"request" | "dataSource" | "rowSelection"|"pagination"
|
|
80
|
+
"request" | "dataSource" | "rowSelection" | "pagination"
|
|
81
81
|
> {
|
|
82
82
|
request?: (params: ParamsModal) => Promise<ResultModal>;
|
|
83
83
|
configData: ConfigDataModal;
|
|
@@ -113,7 +113,7 @@ export interface HTableProps
|
|
|
113
113
|
labelWidth?: number;
|
|
114
114
|
hideLabel?: boolean;
|
|
115
115
|
options?: OptionModal | false;
|
|
116
|
-
pagination?:IPaginationProps
|
|
116
|
+
pagination?: IPaginationProps;
|
|
117
117
|
}
|
|
118
118
|
interface ColCheckResultKeys {
|
|
119
119
|
keys?: string[];
|
|
@@ -69,6 +69,10 @@ const linkRender = (config: ConfigItemModal, itemData: any) => {
|
|
|
69
69
|
if (typeof href === "function") {
|
|
70
70
|
hrefUrl = href(itemData);
|
|
71
71
|
}
|
|
72
|
+
const relUrl=hrefUrl||tableVal;
|
|
73
|
+
if (!relUrl){
|
|
74
|
+
return "-"
|
|
75
|
+
}
|
|
72
76
|
return (
|
|
73
77
|
<Link
|
|
74
78
|
href={hrefUrl || tableVal}
|
|
@@ -138,11 +138,6 @@ export default () => {
|
|
|
138
138
|
onClick={() => {
|
|
139
139
|
dialogTable.show({
|
|
140
140
|
title: "3333",
|
|
141
|
-
dataSource: [
|
|
142
|
-
...maker("第一页"),
|
|
143
|
-
...maker("第二页"),
|
|
144
|
-
...maker("第三页"),
|
|
145
|
-
],
|
|
146
141
|
});
|
|
147
142
|
}}
|
|
148
143
|
>
|
|
@@ -152,6 +147,15 @@ export default () => {
|
|
|
152
147
|
dialogTable={dialogTable}
|
|
153
148
|
width={1200}
|
|
154
149
|
configData={configData}
|
|
150
|
+
request={(value) => {
|
|
151
|
+
console.log(value);
|
|
152
|
+
return {
|
|
153
|
+
records: maker("第一页"),
|
|
154
|
+
size: 10,
|
|
155
|
+
current: 1,
|
|
156
|
+
total: "100",
|
|
157
|
+
};
|
|
158
|
+
}}
|
|
155
159
|
tableProps={{
|
|
156
160
|
headerTitle: (
|
|
157
161
|
<div
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
HTable,
|
|
3
|
+
useHTable,
|
|
4
|
+
HTableConfig,
|
|
5
|
+
HTableHeaderSubBtn,
|
|
6
|
+
} from "@/components";
|
|
2
7
|
import { Button, Card, Tooltip, Typography, Tag, Row } from "antd";
|
|
3
8
|
import { HFormConfigProvider } from "@hw-component/form";
|
|
4
9
|
import { SettingOutlined } from "@ant-design/icons";
|
|
@@ -169,7 +174,7 @@ export default () => {
|
|
|
169
174
|
<HTable
|
|
170
175
|
configData={configData}
|
|
171
176
|
searchSpan={{
|
|
172
|
-
span:24
|
|
177
|
+
span: 24,
|
|
173
178
|
}}
|
|
174
179
|
rowKey={(rowData, index) => {
|
|
175
180
|
return index;
|
|
@@ -182,7 +187,7 @@ export default () => {
|
|
|
182
187
|
},
|
|
183
188
|
}}
|
|
184
189
|
rowSelection={{
|
|
185
|
-
allPageCheck:false
|
|
190
|
+
allPageCheck: false,
|
|
186
191
|
}}
|
|
187
192
|
affixProps={{
|
|
188
193
|
target: () => document.querySelector(".body"),
|