@hw-component/table 1.7.3 → 1.7.5

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.
@@ -111,7 +111,7 @@ export const useColumnsStateType = ({
111
111
  Record<string, ColumnsState> | undefined
112
112
  >(defaultValue);
113
113
  const initTableColsVal = useMemo(() => {
114
- return selfValue||{};
114
+ return selfValue || {};
115
115
  }, []);
116
116
  useEffect(() => {
117
117
  tableInstance.table.getColSettingKeys = () => {
@@ -77,7 +77,7 @@ export default (bodyProps: HTableBodyProps) => {
77
77
  columnsState,
78
78
  tableExtraRender,
79
79
  ...props
80
- }=bodyProps;
80
+ } = bodyProps;
81
81
  const { selectedRowKeys, alwaysShowAlert: configAlwaysShowAlert } =
82
82
  rowSelection || {};
83
83
  const {
@@ -133,7 +133,7 @@ export default (bodyProps: HTableBodyProps) => {
133
133
  return (
134
134
  <div style={defaultTableStyle} className={`hw_table_body ${className}`}>
135
135
  <Space size={16} direction={"vertical"} style={{ width: "100%" }}>
136
- {tableExtraRender?tableExtraRender(props,records||[]):null}
136
+ {tableExtraRender ? tableExtraRender(props, records || []) : null}
137
137
  {alwaysShowAlert && (
138
138
  <Alert
139
139
  message={<AlertMsg actionRender={actionRender} />}
@@ -11,7 +11,7 @@ import type { TableProps } from "antd/lib/table";
11
11
  import type { AffixProps } from "antd/lib/affix";
12
12
  import type { OptionModal } from "./HTableBody";
13
13
  import { GetRowKey } from "rc-table/lib/interface";
14
- import {DrawerProps} from "antd";
14
+ import type { DrawerProps } from "antd";
15
15
 
16
16
  export interface RowObj {
17
17
  keys?: React.Key[];
@@ -147,13 +147,13 @@ export interface HDiaLogTableInstance {
147
147
  hide: () => void;
148
148
  params: any;
149
149
  }
150
- export interface DwTableProps extends DrawerProps{
150
+ export interface DwTableProps extends DrawerProps {
151
151
  tableProps?: Omit<HTableProps, "configData" | "request">;
152
152
  dialogTable?: HDiaLogTableInstance;
153
153
  params?: Record<string, any>;
154
154
  configData?: HTableProps["configData"];
155
155
  request?: HTableProps["request"];
156
- contentRender?:(node:React.ReactNode)=>React.ReactNode;
156
+ contentRender?: (node: React.ReactNode) => React.ReactNode;
157
157
  }
158
158
 
159
159
  export interface ModalTableProps extends ModalProps {
@@ -162,7 +162,7 @@ export interface ModalTableProps extends ModalProps {
162
162
  params?: Record<string, any>;
163
163
  configData?: HTableProps["configData"];
164
164
  request?: HTableProps["request"];
165
- contentRender?:(node:React.ReactNode)=>React.ReactNode;
165
+ contentRender?: (node: React.ReactNode) => React.ReactNode;
166
166
  }
167
167
 
168
168
  export type ValueTypeConfigRenderFn = (
@@ -1,24 +1,26 @@
1
1
  import copy from "copy-to-clipboard";
2
- import {message,Typography} from "antd";
3
- import {EllipsisConfig} from "antd/lib/typography/Base";
4
- import {useClassName} from "../hooks";
5
- const {Paragraph}=Typography;
2
+ import { message, Typography } from "antd";
3
+ import type { EllipsisConfig } from "antd/lib/typography/Base";
4
+ import { useClassName } from "../hooks";
5
+ const { Paragraph } = Typography;
6
6
  interface IProps {
7
- text:string;
8
- cpText?:string;
9
- successMsg:string;
10
- ellipsis?:boolean | EllipsisConfig;
7
+ text: string;
8
+ cpText?: string;
9
+ successMsg: string;
10
+ ellipsis?: boolean | EllipsisConfig;
11
11
  }
12
- export default ({cpText,text,successMsg,ellipsis}:IProps)=>{
13
- const className=useClassName("hw-table-render-copy");
14
- return <Paragraph
15
- ellipsis={ellipsis}
16
- className={className}
17
- onClick={() => {
18
- copy(cpText || text);
19
- message.success(successMsg);
20
- }}
12
+ export default ({ cpText, text, successMsg, ellipsis }: IProps) => {
13
+ const className = useClassName("hw-table-render-copy");
14
+ return (
15
+ <Paragraph
16
+ ellipsis={ellipsis}
17
+ className={className}
18
+ onClick={() => {
19
+ copy(cpText || text);
20
+ message.success(successMsg);
21
+ }}
21
22
  >
22
- {text}
23
+ {text}
23
24
  </Paragraph>
24
- }
25
+ );
26
+ };
@@ -1,8 +1,6 @@
1
- import {useClassName} from "@/components/hooks";
1
+ import { useClassName } from "@/components/hooks";
2
2
 
3
- export default ()=>{
4
- const className=useClassName("hw-table-render-text-basic");
5
- return <div className={className}>
6
-
7
- </div>
8
- }
3
+ export default () => {
4
+ const className = useClassName("hw-table-render-text-basic");
5
+ return <div className={className} />;
6
+ };
@@ -42,7 +42,7 @@ const tagsRender = (
42
42
  };
43
43
  const copyRender = (config: ConfigItemModal, itemData: any) => {
44
44
  const { valueTypeProps = {}, title, titleStr } = config;
45
- const { successMsg, text ,ellipsis} = valueTypeProps;
45
+ const { successMsg, text, ellipsis } = valueTypeProps;
46
46
  const msg = successMsg || `复制${title || titleStr}成功!`;
47
47
  const tableVal = getTableVal(config, itemData);
48
48
  if (!tableVal) {
@@ -52,12 +52,14 @@ const copyRender = (config: ConfigItemModal, itemData: any) => {
52
52
  if (typeof text === "function") {
53
53
  cpText = text(itemData);
54
54
  }
55
- return <CopyComponent
56
- ellipsis={ellipsis}
57
- successMsg={msg}
58
- text={tableVal}
59
- cpText={cpText}
60
- />
55
+ return (
56
+ <CopyComponent
57
+ ellipsis={ellipsis}
58
+ successMsg={msg}
59
+ text={tableVal}
60
+ cpText={cpText}
61
+ />
62
+ );
61
63
  };
62
64
  const linkRender = (config: ConfigItemModal, itemData: any) => {
63
65
  const { valueTypeProps = {} } = config;
@@ -82,7 +84,7 @@ const textRender = (config: ConfigItemModal, itemData: any) => {
82
84
  const { addonBefore, addonAfter, type, ellipsis } = valueTypeProps;
83
85
  const tableVal = getTableVal(config, itemData);
84
86
  return (
85
- <Paragraph type={type} ellipsis={ellipsis} style={{marginBottom:0}}>
87
+ <Paragraph type={type} ellipsis={ellipsis} style={{ marginBottom: 0 }}>
86
88
  {addonBefore}
87
89
  {tableVal}
88
90
  {addonAfter}
@@ -1,152 +1,154 @@
1
1
  import { Button } from "antd";
2
2
  import { HDwTable, HTable, useHDialogTable } from "@/components";
3
3
  const configData = [
4
- {
5
- title: "座位",
6
- showSearch: true,
7
- searchType: "select",
8
- dataIndex: "name",
9
- itemProps: {
10
- options: [{ label: "1", value: 1 }],
11
- },
4
+ {
5
+ title: "座位",
6
+ showSearch: true,
7
+ searchType: "select",
8
+ dataIndex: "name",
9
+ itemProps: {
10
+ options: [{ label: "1", value: 1 }],
12
11
  },
13
- {
14
- title: "操作",
15
- name: "aaa",
16
- fixed: "right",
17
- width: 200,
18
- showSearch: true,
19
- render: () => {
20
- return <div>fff</div>;
21
- },
12
+ },
13
+ {
14
+ title: "操作",
15
+ name: "aaa",
16
+ fixed: "right",
17
+ width: 200,
18
+ showSearch: true,
19
+ render: () => {
20
+ return <div>fff</div>;
22
21
  },
22
+ },
23
23
  ];
24
24
  const req1 = (params) => {
25
- console.log(params, "req1");
26
- const { current = 1 } = params;
27
- return new Promise((resolve, reject) => {
28
- setTimeout(() => {
29
- // reject(new Error("错误"));
30
- resolve({
31
- size: "10",
32
- current: current.toString(10),
33
- total: "100",
34
- records: [
35
- {
36
- id: 1,
37
- name: "111",
38
- },
39
- ],
40
- });
41
- }, 2000);
42
- });
25
+ console.log(params, "req1");
26
+ const { current = 1 } = params;
27
+ return new Promise((resolve, reject) => {
28
+ setTimeout(() => {
29
+ // reject(new Error("错误"));
30
+ resolve({
31
+ size: "10",
32
+ current: current.toString(10),
33
+ total: "100",
34
+ records: [
35
+ {
36
+ id: 1,
37
+ name: "111",
38
+ },
39
+ ],
40
+ });
41
+ }, 2000);
42
+ });
43
43
  };
44
44
 
45
45
  const req2 = (params) => {
46
- const { current = 1 } = params;
47
- console.log("请求")
48
- return new Promise((resolve, reject) => {
49
- setTimeout(() => {
50
- // reject(new Error("错误"));
51
- resolve({
52
- size: "10",
53
- current: current.toString(10),
54
- total: "100",
55
- records: [
56
- {
57
- id: 1,
58
- name: "111",
59
- },
60
- {
61
- id: 2,
62
- name: "111",
63
- },
64
- {
65
- id: 3,
66
- name: "111",
67
- },
68
- {
69
- id: 4,
70
- name: "111",
71
- },
72
- {
73
- id: 5,
74
- name: "111",
75
- },
76
- {
77
- id: 6,
78
- name: "111",
79
- },
80
- {
81
- id: 7,
82
- name: "111",
83
- },
84
- {
85
- id: 8,
86
- name: "111",
87
- },
88
- ],
89
- });
90
- }, 2000);
91
- });
46
+ const { current = 1 } = params;
47
+ console.log("请求");
48
+ return new Promise((resolve, reject) => {
49
+ setTimeout(() => {
50
+ // reject(new Error("错误"));
51
+ resolve({
52
+ size: "10",
53
+ current: current.toString(10),
54
+ total: "100",
55
+ records: [
56
+ {
57
+ id: 1,
58
+ name: "111",
59
+ },
60
+ {
61
+ id: 2,
62
+ name: "111",
63
+ },
64
+ {
65
+ id: 3,
66
+ name: "111",
67
+ },
68
+ {
69
+ id: 4,
70
+ name: "111",
71
+ },
72
+ {
73
+ id: 5,
74
+ name: "111",
75
+ },
76
+ {
77
+ id: 6,
78
+ name: "111",
79
+ },
80
+ {
81
+ id: 7,
82
+ name: "111",
83
+ },
84
+ {
85
+ id: 8,
86
+ name: "111",
87
+ },
88
+ ],
89
+ });
90
+ }, 2000);
91
+ });
92
92
  };
93
93
  const Test = () => {
94
- const dialogTable1 = useHDialogTable();
94
+ const dialogTable1 = useHDialogTable();
95
95
 
96
- return (
97
- <>
98
- <HDwTable
99
- dialogTable={dialogTable1}
100
- title="111"
101
- configData={configData}
102
- request={req2}
103
- contentRender={(node)=>{
104
- return <>
105
- <div>fsafsfsa</div>
106
- {node}
107
- </>
108
- }}
109
- />
110
- <Button
111
- onClick={() => {
112
- dialogTable1.show();
113
- }}
114
- >
115
- 点我
116
- </Button>
117
- </>
118
- );
96
+ return (
97
+ <>
98
+ <HDwTable
99
+ dialogTable={dialogTable1}
100
+ title="111"
101
+ configData={configData}
102
+ request={req2}
103
+ contentRender={(node) => {
104
+ return (
105
+ <>
106
+ <div>fsafsfsa</div>
107
+ {node}
108
+ </>
109
+ );
110
+ }}
111
+ />
112
+ <Button
113
+ onClick={() => {
114
+ dialogTable1.show();
115
+ }}
116
+ >
117
+ 点我
118
+ </Button>
119
+ </>
120
+ );
119
121
  };
120
122
  export default () => {
121
- const dialogTable = useHDialogTable();
122
- const dialogTable1 = useHDialogTable();
123
- return (
124
- <>
125
- <Button
126
- onClick={() => {
127
- dialogTable.show({ title: "3333", params: { id: 1 } });
128
- }}
123
+ const dialogTable = useHDialogTable();
124
+ const dialogTable1 = useHDialogTable();
125
+ return (
126
+ <>
127
+ <Button
128
+ onClick={() => {
129
+ dialogTable.show({ title: "3333", params: { id: 1 } });
130
+ }}
131
+ >
132
+ 点我333
133
+ </Button>
134
+ <HDwTable
135
+ dialogTable={dialogTable}
136
+ request={req2}
137
+ width={1200}
138
+ configData={configData}
139
+ tableProps={{
140
+ headerTitle: (
141
+ <div
142
+ onClick={() => {
143
+ console.log(dialogTable.params);
144
+ }}
129
145
  >
130
- 点我333
131
- </Button>
132
- <HDwTable
133
- dialogTable={dialogTable}
134
- request={req2}
135
- width={1200}
136
- configData={configData}
137
- tableProps={{
138
- headerTitle: (
139
- <div
140
- onClick={() => {
141
- console.log(dialogTable.params);
142
- }}
143
- >
144
- 点我
145
- </div>
146
- ),
147
- }}
148
- />
149
- <HTable configData={configData} headerTitle={<Test />} />
150
- </>
151
- );
146
+ 点我
147
+ </div>
148
+ ),
149
+ }}
150
+ />
151
+ <HTable configData={configData} headerTitle={<Test />} />
152
+ </>
153
+ );
152
154
  };
@@ -44,7 +44,7 @@ const req1 = (params) => {
44
44
 
45
45
  const req2 = (params) => {
46
46
  const { current = 1 } = params;
47
- console.log("请求")
47
+ console.log("请求");
48
48
  return new Promise((resolve, reject) => {
49
49
  setTimeout(() => {
50
50
  // reject(new Error("错误"));
@@ -100,11 +100,13 @@ const Test = () => {
100
100
  title="111"
101
101
  configData={configData}
102
102
  request={req2}
103
- contentRender={(node)=>{
104
- return <>
105
- <div>fsafsfsa</div>
106
- {node}
107
- </>
103
+ contentRender={(node) => {
104
+ return (
105
+ <>
106
+ <div>fsafsfsa</div>
107
+ {node}
108
+ </>
109
+ );
108
110
  }}
109
111
  />
110
112
  <Button