@hw-component/table 1.10.6 → 1.10.7

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.
@@ -4,7 +4,7 @@ import type { TooltipProps } from "antd/lib/tooltip";
4
4
  import type { HTableInstance } from "../modal";
5
5
 
6
6
  type CloseFn = (key: string, tableInstance?: HTableInstance) => void;
7
- type TooltipRender=(item:any)=>TooltipProps;
7
+ type TooltipRender = (item: any) => TooltipProps;
8
8
 
9
9
  interface IProps {
10
10
  data: any[];
@@ -12,7 +12,7 @@ interface IProps {
12
12
  onClose?: CloseFn;
13
13
  color?: string;
14
14
  icon?: React.ReactNode;
15
- tooltip?: boolean | TooltipProps|TooltipRender;
15
+ tooltip?: boolean | TooltipProps | TooltipRender;
16
16
  fieldNames?: { label?: string; value?: string };
17
17
  tableInstance?: HTableInstance;
18
18
  maxLen?: number | null;
@@ -22,9 +22,9 @@ interface IProps {
22
22
  }
23
23
  const getTooltipProps = (
24
24
  item: any,
25
- tooltip?: boolean | TooltipProps|TooltipRender
25
+ tooltip?: boolean | TooltipProps | TooltipRender
26
26
  ): TooltipProps => {
27
- const {title}=item;
27
+ const { title } = item;
28
28
  if (!tooltip) {
29
29
  return {
30
30
  title: null,
@@ -36,7 +36,7 @@ const getTooltipProps = (
36
36
  };
37
37
  }
38
38
  if (typeof tooltip === "function") {
39
- return tooltip(item);
39
+ return tooltip(item);
40
40
  }
41
41
  return {
42
42
  ...tooltip,
@@ -84,7 +84,7 @@ const TagsComponent = (props: IProps) => {
84
84
  };
85
85
  const indexKey = index.toString();
86
86
  if (typeof tagItem === "string") {
87
- const tooltipProps = getTooltipProps({title:tagItem}, tooltip);
87
+ const tooltipProps = getTooltipProps({ title: tagItem }, tooltip);
88
88
  return (
89
89
  <Tooltip {...tooltipProps}>
90
90
  <Tag
@@ -101,7 +101,10 @@ const TagsComponent = (props: IProps) => {
101
101
  );
102
102
  }
103
103
  const { [label]: tagLabel, [value]: tagValue, ...itemProps } = tagItem;
104
- const tooltipProps = getTooltipProps({title:tagLabel,value:tagValue,...itemProps}, tooltip);
104
+ const tooltipProps = getTooltipProps(
105
+ { title: tagLabel, value: tagValue, ...itemProps },
106
+ tooltip
107
+ );
105
108
  const cuTagProps = {
106
109
  ...tagProps,
107
110
  ...itemProps,
@@ -157,11 +157,14 @@ export default () => {
157
157
  const [keys, setKeys] = useState([]);
158
158
  return (
159
159
  <HFormConfigProvider>
160
- <TagsComponent data={["213123"]} tooltip={()=>{
161
- return {
162
- title:"3123"
163
- }
164
- }}/>
160
+ <TagsComponent
161
+ data={["213123"]}
162
+ tooltip={() => {
163
+ return {
164
+ title: "3123",
165
+ };
166
+ }}
167
+ />
165
168
  <div>
166
169
  <div
167
170
  onClick={() => {
@@ -173,12 +176,9 @@ export default () => {
173
176
  <HTableConfig defaultSelectedRowClassName={null}>
174
177
  <HTable
175
178
  configData={configData}
176
- configItemRender={(data)=>{
177
- console.log(data)
178
- return data;
179
- }}
180
- rowKey={(rowData, index) => {
181
- return index;
179
+ configItemRender={(d1) => {
180
+ console.log(d1);
181
+ return d1;
182
182
  }}
183
183
  table={hTable}
184
184
  labelWidth={88}
@@ -189,6 +189,11 @@ export default () => {
189
189
  }}
190
190
  rowSelection={{
191
191
  preserveSelectedRowKeys: true,
192
+ allPageCheck: false,
193
+ onChange: (keys, data)=>{
194
+ console.log(keys, data);
195
+ },
196
+ allCheckType: "batch",
192
197
  }}
193
198
  affixProps={{
194
199
  target: () => document.querySelector(".body"),
@@ -203,10 +208,21 @@ export default () => {
203
208
  formInitValues={{
204
209
  select: "orderNo",
205
210
  }}
206
- dataSource={[{}, {}, {}]}
207
211
  request={(params) => {
208
- console.log(params);
209
- return Promise.resolve({});
212
+ const { current } = params;
213
+ const records = [];
214
+ for (let i = 0; i < 10; i += 1) {
215
+ records.push({
216
+ id: `${current}-${i}`,
217
+ });
218
+ }
219
+ console.log(records);
220
+ return Promise.resolve({
221
+ current: "1",
222
+ size: "10",
223
+ total: "100",
224
+ records,
225
+ });
210
226
  }}
211
227
  headerTitle={
212
228
  <Space size={8}>
@@ -225,7 +241,6 @@ export default () => {
225
241
  </div>
226
242
  </Space>
227
243
  }
228
- pagination={false}
229
244
  />
230
245
  </HTableConfig>
231
246
  </div>