@hw-component/table 1.1.8 → 1.1.9

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.
Files changed (40) hide show
  1. package/.eslintcache +1 -1
  2. package/es/HTableBody/Options/hooks.d.ts +2 -2
  3. package/es/HTableBody/Options/index.d.ts +1 -1
  4. package/es/HTableBody/Options/index.js +23 -22
  5. package/es/HTableBody/hooks.d.ts +3 -3
  6. package/es/HTableBody/index.d.ts +6 -1
  7. package/es/HTableBody/utils.d.ts +2 -2
  8. package/es/HTableHeader/Context.d.ts +1 -1
  9. package/es/HTableHeader/defaultSubComponent.js +5 -1
  10. package/es/HTableHeader/index.d.ts +1 -1
  11. package/es/modal.d.ts +2 -0
  12. package/lib/HTableBody/Options/hooks.d.ts +2 -2
  13. package/lib/HTableBody/Options/index.d.ts +1 -1
  14. package/lib/HTableBody/Options/index.js +23 -22
  15. package/lib/HTableBody/hooks.d.ts +3 -3
  16. package/lib/HTableBody/index.d.ts +6 -1
  17. package/lib/HTableBody/utils.d.ts +2 -2
  18. package/lib/HTableHeader/Context.d.ts +1 -1
  19. package/lib/HTableHeader/defaultSubComponent.js +5 -1
  20. package/lib/HTableHeader/index.d.ts +1 -1
  21. package/lib/modal.d.ts +2 -0
  22. package/package.json +1 -1
  23. package/src/components/HTableBody/Options/Content.tsx +13 -13
  24. package/src/components/HTableBody/Options/Title.tsx +18 -18
  25. package/src/components/HTableBody/Options/hooks.ts +23 -20
  26. package/src/components/HTableBody/Options/index.tsx +23 -18
  27. package/src/components/HTableBody/Options/modal.d.ts +8 -6
  28. package/src/components/HTableBody/Options/utils.ts +2 -2
  29. package/src/components/HTableBody/hooks.tsx +43 -40
  30. package/src/components/HTableBody/index.tsx +19 -4
  31. package/src/components/HTableBody/utils.ts +85 -83
  32. package/src/components/HTableHeader/Context.tsx +7 -7
  33. package/src/components/HTableHeader/defaultSubComponent.tsx +7 -3
  34. package/src/components/HTableHeader/index.tsx +15 -15
  35. package/src/components/HTableHeader/modal.ts +1 -1
  36. package/src/components/Table.tsx +0 -1
  37. package/src/components/hooks/useHTable.tsx +4 -4
  38. package/src/components/modal.ts +4 -8
  39. package/src/pages/Table/index.tsx +25 -12
  40. package/src/pages/TableCustomize/index.tsx +13 -8
@@ -4,14 +4,14 @@ import type {
4
4
  HRowSelection,
5
5
  ConfigDataModal,
6
6
  } from "../modal";
7
- import React, {useEffect, useMemo, useState} from "react";
7
+ import React, { useEffect, useMemo, useState } from "react";
8
8
  import { useHTableContext } from "../context";
9
9
  import type { GetRowKey } from "rc-table/lib/interface";
10
10
  import { RowSelectionBox, RowSelectionTitle } from "./RowSelection";
11
11
  import type { SizeType } from "antd/lib/config-provider/SizeContext";
12
- import {ColumnsStateType} from "@ant-design/pro-table/es/typing";
13
- import {ColumnsState} from "@ant-design/pro-table/es/container";
14
- import {mkChangeValue, outColSetting} from "./utils";
12
+ import type { ColumnsStateType } from "@ant-design/pro-table/es/typing";
13
+ import type { ColumnsState } from "@ant-design/pro-table/es/container";
14
+ import { mkChangeValue, outColSetting } from "./utils";
15
15
  const rowSelectionCol = (rowSelection?: HRowSelection) => {
16
16
  const { allPageCheck, onChange, getCheckboxProps } = rowSelection || {};
17
17
  return {
@@ -62,7 +62,7 @@ export const useCols = ({ configData, rowSelection, table }: HTableProps) => {
62
62
  setCols(changeConfigData(configData));
63
63
  }, [configData, table, rowSelection]);
64
64
  return {
65
- cols
65
+ cols,
66
66
  };
67
67
  };
68
68
  interface FilterKeysModal {
@@ -99,44 +99,47 @@ export const useSize = (size: SizeType) => {
99
99
  };
100
100
  };
101
101
  interface useColumnsStateTypeModal {
102
- columnsState?:ColumnsStateType;
103
- columns:ConfigDataModal
102
+ columnsState?: ColumnsStateType;
103
+ columns: ConfigDataModal;
104
104
  }
105
- export const useColumnsStateType=({columnsState,columns}:useColumnsStateTypeModal)=>{
106
- const {
107
- tableInstance
108
- } = useHTableContext();
109
- const {persistenceType,persistenceKey,value,defaultValue,onChange}=columnsState||{};
110
- const [selfValue,setSelfValue]=useState<Record<string, ColumnsState>|undefined>(defaultValue);
111
- const initTableColsVal = useMemo(() => {
112
- return selfValue;
113
- }, []);
114
- useEffect(() => {
115
- tableInstance.table.getColSettingKeys=()=>{
116
- return outColSetting(columns,selfValue);
117
- }
118
- }, [selfValue]);
105
+ export const useColumnsStateType = ({
106
+ columnsState,
107
+ columns,
108
+ }: useColumnsStateTypeModal) => {
109
+ const { tableInstance } = useHTableContext();
110
+ const { persistenceType, persistenceKey, value, defaultValue, onChange } =
111
+ columnsState || {};
112
+ const [selfValue, setSelfValue] = useState<
113
+ Record<string, ColumnsState> | undefined
114
+ >(defaultValue);
115
+ const initTableColsVal = useMemo(() => {
116
+ return selfValue;
117
+ }, []);
119
118
  useEffect(() => {
120
- setSelfValue(mkChangeValue(columnsState));
119
+ tableInstance.table.getColSettingKeys = () => {
120
+ return outColSetting(columns, selfValue);
121
+ };
122
+ }, [selfValue]);
123
+ useEffect(() => {
124
+ setSelfValue(mkChangeValue(columnsState));
121
125
  }, [value]);
122
126
 
123
-
124
- const change=(keys:string[],notCheck:string[])=>{
125
- const newObj={};
126
- notCheck.forEach((key)=>{
127
- newObj[key]={show:false}
128
- });
129
- setSelfValue(newObj);
130
- onChange?.(newObj);
131
- }
132
- const reset=()=>{
133
- setSelfValue(initTableColsVal);
134
- }
135
- return {
127
+ const change = (keys: string[], notCheck: string[]) => {
128
+ const newObj = {};
129
+ notCheck.forEach((key) => {
130
+ newObj[key] = { show: false };
131
+ });
132
+ setSelfValue(newObj);
133
+ onChange?.(newObj);
134
+ };
135
+ const reset = () => {
136
+ setSelfValue(initTableColsVal);
137
+ };
138
+ return {
136
139
  persistenceType,
137
140
  persistenceKey,
138
- value:selfValue,
139
- onChange:change,
140
- reset
141
- }
142
- }//设置选项
141
+ value: selfValue,
142
+ onChange: change,
143
+ reset,
144
+ };
145
+ }; //设置选项
@@ -7,7 +7,12 @@ import type {
7
7
  HTableInstance,
8
8
  HRowSelection,
9
9
  } from "../modal";
10
- import {useCols, useColumnsStateType, useSize, useSynchronousKeys} from "./hooks";
10
+ import {
11
+ useCols,
12
+ useColumnsStateType,
13
+ useSize,
14
+ useSynchronousKeys,
15
+ } from "./hooks";
11
16
  import { useHTableContext } from "../context";
12
17
  import React from "react";
13
18
  import { ConfigProvider, Empty, Alert } from "antd";
@@ -18,8 +23,13 @@ import AlertMsg from "./AlertMsg";
18
23
  import type { AffixProps } from "antd/lib/affix";
19
24
  import Options from "./Options";
20
25
  import HeaderTitle from "./HeaderTitle";
26
+ import {OptionConfig} from "@ant-design/pro-table/lib/components/ToolBar";
27
+
28
+ export interface OptionModal extends OptionConfig {
29
+ settingRender?:()=>React.ReactNode
30
+ }
21
31
  export interface HTableBodyProps
22
- extends Omit<ProTableProps<any, any>, "dataSource" | "rowSelection"> {
32
+ extends Omit<ProTableProps<any, any>, "dataSource" | "rowSelection"|"options"> {
23
33
  configData?: ConfigDataModal;
24
34
  onPageChange?: (params: ParamsModal) => void;
25
35
  emptyRender?: (tableInstance: HTableInstance) => React.ReactNode;
@@ -36,6 +46,7 @@ export interface HTableBodyProps
36
46
  optionsRender?: (node: React.ReactNode) => React.ReactNode;
37
47
  paginationActionRender?: (tableInstance: HTableInstance) => React.ReactNode;
38
48
  localSorter?: boolean;
49
+ options?:OptionModal|false
39
50
  }
40
51
  const defaultRender = () => {
41
52
  return <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />;
@@ -93,7 +104,10 @@ export default ({
93
104
  rowSelection,
94
105
  });
95
106
 
96
- const {value,onChange,reset,...selfColStatus} = useColumnsStateType({columnsState,columns:cols});
107
+ const { value, onChange, reset, ...selfColStatus } = useColumnsStateType({
108
+ columnsState,
109
+ columns: cols,
110
+ });
97
111
  useSynchronousKeys({ selectedRowKeys, records, rowKey });
98
112
  const optionsNode = options && (
99
113
  <Options
@@ -104,7 +118,7 @@ export default ({
104
118
  size={cuSize}
105
119
  columns={cols}
106
120
  setSizeChange={setCuSize}
107
- colStatusValue={value||{}}
121
+ colStatusValue={value || {}}
108
122
  onChange={onChange}
109
123
  reset={reset}
110
124
  />
@@ -171,6 +185,7 @@ export default ({
171
185
  rowKey={rowKey}
172
186
  dataSource={records}
173
187
  pagination={false}
188
+
174
189
  />
175
190
  {pagination !== false && (
176
191
  <HTablePagination
@@ -1,91 +1,93 @@
1
- import {ColumnsStateType} from "@ant-design/pro-table/es/typing";
2
- import {ConfigDataModal, ConfigItemModal} from "@/components/modal";
3
- import React from "react";
4
- import {getItemValue} from "./Options/utils";
1
+ import type { ColumnsStateType } from "@ant-design/pro-table/es/typing";
2
+ import type { ConfigDataModal, ConfigItemModal } from "@/components/modal";
3
+ import type React from "react";
4
+ import { getItemValue } from "./Options/utils";
5
5
 
6
- const strToJson=(str:string|null)=>{
7
- if (!str){
8
- return {};
6
+ const strToJson = (str: string | null) => {
7
+ if (!str) {
8
+ return {};
9
+ }
10
+ try {
11
+ const result = JSON.parse(str);
12
+ if (typeof result === "object") {
13
+ return result;
9
14
  }
10
- try {
11
- const result=JSON.parse(str);
12
- if (typeof result==="object"){
13
- return result;
14
- }
15
- return {};
16
- }catch (e) {
17
- return {}
18
- }
19
- }
20
-
21
- export const mkChangeValue=(columnsState?:ColumnsStateType)=>{
22
- const {persistenceType,persistenceKey,value,defaultValue,onChange}=columnsState||{};
23
- if (value){
24
- return value
25
- }
26
- if (!persistenceKey){
27
- return {};
28
- }
29
- const cuPersistenceType=persistenceType||"localStorage";
30
- const saveValStr=window[cuPersistenceType].getItem(persistenceKey);
31
- return strToJson(saveValStr);
32
- }//获取默认值
15
+ return {};
16
+ } catch (e) {
17
+ return {};
18
+ }
19
+ };
33
20
 
21
+ export const mkChangeValue = (columnsState?: ColumnsStateType) => {
22
+ const { persistenceType, persistenceKey, value, defaultValue, onChange } =
23
+ columnsState || {};
24
+ if (value) {
25
+ return value;
26
+ }
27
+ if (!persistenceKey) {
28
+ return {};
29
+ }
30
+ const cuPersistenceType = persistenceType || "localStorage";
31
+ const saveValStr = window[cuPersistenceType].getItem(persistenceKey);
32
+ return strToJson(saveValStr);
33
+ }; //获取默认值
34
34
 
35
35
  const childDataIndexProvider = (
36
- data: ConfigItemModal[] | string[],
37
- title?: string | React.ReactNode
36
+ data: ConfigItemModal[] | string[],
37
+ title?: string | React.ReactNode
38
38
  ) => {
39
- const keys: string[] = [];
40
- const cols: ConfigDataModal = [];
41
- data.forEach((value) => {
42
- if (typeof value === "string") {
43
- keys.push(value);
44
- cols.push(
45
- getItemValue({
46
- title,
47
- dataIndex: value,
48
- })
49
- );
50
- return;
51
- }
52
- keys.push(value.dataIndex);
53
- cols.push(getItemValue(value));
54
- });
55
- return {
56
- keys,
57
- cols,
58
- };
39
+ const keys: string[] = [];
40
+ const cols: ConfigDataModal = [];
41
+ data.forEach((value) => {
42
+ if (typeof value === "string") {
43
+ keys.push(value);
44
+ cols.push(
45
+ getItemValue({
46
+ title,
47
+ dataIndex: value,
48
+ })
49
+ );
50
+ return;
51
+ }
52
+ keys.push(value.dataIndex);
53
+ cols.push(getItemValue(value));
54
+ });
55
+ return {
56
+ keys,
57
+ cols,
58
+ };
59
59
  };
60
60
 
61
-
62
- export const outColSetting=(columns:ConfigDataModal,columnsState:ColumnsStateType={})=>{
63
- const keys: string[] = [];
64
- const checkCols:ConfigDataModal=[];
65
- columns.forEach((value) => {
66
- const { dataIndex,titleStr,title, hideInTable, childrenDataIndex } =
67
- value;
68
- if (hideInTable || !dataIndex) {
69
- return;
70
- }
71
- const {show=true}=columnsState[dataIndex.toString()]||{};
72
- if (!show){
73
- return;
74
- }
75
- if (childrenDataIndex) {
76
- const { keys: childKeys, cols: childCols } = childDataIndexProvider(
77
- childrenDataIndex,
78
- titleStr || title
79
- );
80
- keys.push(...childKeys);
81
- checkCols.push(...childCols);
82
- return;
83
- }
84
- keys.push(dataIndex.toString());
85
- checkCols.push(getItemValue(value));
86
- });
87
- return {
88
- checkCols,
89
- keys
90
- };
91
- }
61
+ export const outColSetting = (
62
+ columns: ConfigDataModal,
63
+ columnsState: ColumnsStateType = {}
64
+ ) => {
65
+ const keys: string[] = [];
66
+ const checkCols: ConfigDataModal = [];
67
+ columns.forEach((value) => {
68
+ const { dataIndex, titleStr, title, hideInTable, childrenDataIndex } =
69
+ value;
70
+ if (hideInTable || !dataIndex) {
71
+ return;
72
+ }
73
+ const { show = true } = columnsState[dataIndex.toString()] || {};
74
+ if (!show) {
75
+ return;
76
+ }
77
+ if (childrenDataIndex) {
78
+ const { keys: childKeys, cols: childCols } = childDataIndexProvider(
79
+ childrenDataIndex,
80
+ titleStr || title
81
+ );
82
+ keys.push(...childKeys);
83
+ checkCols.push(...childCols);
84
+ return;
85
+ }
86
+ keys.push(dataIndex.toString());
87
+ checkCols.push(getItemValue(value));
88
+ });
89
+ return {
90
+ checkCols,
91
+ keys,
92
+ };
93
+ };
@@ -1,9 +1,9 @@
1
- import React, {useContext} from "react";
2
- import {IHeaderProps} from "./modal";
3
- const Context=React.createContext<IHeaderProps>({});
1
+ import React, { useContext } from "react";
2
+ import type { IHeaderProps } from "./modal";
3
+ const Context = React.createContext<IHeaderProps>({});
4
4
 
5
- export const HeaderProvider=Context.Provider;
5
+ export const HeaderProvider = Context.Provider;
6
6
 
7
- export const useHeaderContext=()=>{
8
- return useContext(Context);
9
- }
7
+ export const useHeaderContext = () => {
8
+ return useContext(Context);
9
+ };
@@ -4,7 +4,7 @@ import { useHTableContext } from "../context";
4
4
  import React, { useMemo } from "react";
5
5
  import { DownOutlined, UpOutlined } from "@ant-design/icons";
6
6
  import type { RowProps } from "antd/lib/grid/row";
7
- import {useHeaderContext} from "./Context";
7
+ import { useHeaderContext } from "./Context";
8
8
  interface IProps {
9
9
  form: HFormInstance;
10
10
  }
@@ -36,7 +36,7 @@ const OpenComponent = () => {
36
36
  };
37
37
  export const DefaultSubComponent = ({ form }: IProps) => {
38
38
  const { loading, headerOpen } = useHTableContext();
39
- const {onReset}=useHeaderContext();
39
+ const { onReset } = useHeaderContext();
40
40
  const hide = typeof headerOpen === "undefined";
41
41
  const { justify, style } = useMemo(() => {
42
42
  if (headerOpen === true || hide) {
@@ -71,7 +71,11 @@ export const DefaultSubComponent = ({ form }: IProps) => {
71
71
  <Button
72
72
  style={{ borderRadius: 4 }}
73
73
  onClick={() => {
74
- onReset?onReset():form.resetFields();
74
+ if (onReset) {
75
+ onReset();
76
+ return;
77
+ }
78
+ form.resetFields();
75
79
  }}
76
80
  >
77
81
  重置
@@ -5,7 +5,7 @@ import React from "react";
5
5
  import { useClassName } from "../hooks";
6
6
  import type { IHeaderProps } from "./modal";
7
7
  import { useHideMoreTitle } from "./hooks";
8
- import {HeaderProvider} from "./Context";
8
+ import { HeaderProvider } from "./Context";
9
9
 
10
10
  const defaultSearchSpan = {
11
11
  xxl: 4,
@@ -22,7 +22,7 @@ export default ({
22
22
  initValues,
23
23
  hideLabel,
24
24
  labelWidth,
25
- onReset
25
+ onReset,
26
26
  }: IHeaderProps) => {
27
27
  const {
28
28
  tableInstance,
@@ -55,20 +55,20 @@ export default ({
55
55
  className={`hw_table_header ${className}`}
56
56
  bodyStyle={{ paddingBottom: 0 }}
57
57
  >
58
- <HeaderProvider value={{onReset}}>
58
+ <HeaderProvider value={{ onReset }}>
59
59
  <HForm
60
- itemSpan={searchSpan}
61
- onFinish={subOnFinish}
62
- submitLoading={loading}
63
- gutter={[20, 0]}
64
- initialValues={initValues}
65
- hideLabel={
66
- typeof tableHideLabel === "undefined" ? true : tableHideLabel
67
- }
68
- configData={nConfigData}
69
- form={form}
70
- colon={true}
71
- labelWidth={tableLabelWidth}
60
+ itemSpan={searchSpan}
61
+ onFinish={subOnFinish}
62
+ submitLoading={loading}
63
+ gutter={[20, 0]}
64
+ initialValues={initValues}
65
+ hideLabel={
66
+ typeof tableHideLabel === "undefined" ? true : tableHideLabel
67
+ }
68
+ configData={nConfigData}
69
+ form={form}
70
+ colon={true}
71
+ labelWidth={tableLabelWidth}
72
72
  />
73
73
  </HeaderProvider>
74
74
  </Card>
@@ -13,7 +13,7 @@ export interface IHeaderProps {
13
13
  initValues?: Record<string, any>;
14
14
  hideLabel?: boolean;
15
15
  labelWidth?: number;
16
- onReset?:VoidFunction;
16
+ onReset?: VoidFunction;
17
17
  }
18
18
 
19
19
  export interface FormConfigDataItemProviderModal extends ConfigItemModal {
@@ -55,7 +55,6 @@ export default ({
55
55
  },
56
56
  selectedRowData,
57
57
  dataSource: data,
58
-
59
58
  });
60
59
  return (
61
60
  <HTableContext.Provider
@@ -20,12 +20,12 @@ export default (): HTableInstance => {
20
20
  getSelectedRowData: () => {
21
21
  return {};
22
22
  },
23
- getTableSourceData:()=>{
23
+ getTableSourceData: () => {
24
24
  return [];
25
25
  },
26
- getColSettingKeys:()=>{
27
- return {}
28
- }
26
+ getColSettingKeys: () => {
27
+ return {};
28
+ },
29
29
  };
30
30
  }, []);
31
31
  return {
@@ -9,6 +9,7 @@ import type React from "react";
9
9
  import type { ModalProps } from "antd";
10
10
  import type { TableProps } from "antd/lib/table";
11
11
  import type { AffixProps } from "antd/lib/affix";
12
+ import {OptionModal} from "./HTableBody";
12
13
 
13
14
  export interface RowObj {
14
15
  keys?: React.Key[];
@@ -62,12 +63,6 @@ export type FooterBtnRenderFn = (
62
63
  setAllCheck: (row: RowObj) => void
63
64
  ) => React.ReactNode;
64
65
  export type actionFn = (...arg) => void;
65
- type FooterRenderFn = (
66
- tableInstance: HTableInstance,
67
- selectedRowData: RowObj,
68
- data?: ResultModal
69
- ) => React.ReactNode;
70
-
71
66
  export interface RowSelectionOuter {
72
67
  allPageCheck?: boolean;
73
68
  }
@@ -113,11 +108,12 @@ export interface HTableProps
113
108
  formInitValues?: Record<string, any>;
114
109
  labelWidth?: number;
115
110
  hideLabel?: boolean;
111
+ options?:OptionModal|false
116
112
  }
117
113
  interface ColCheckResultKeys {
118
114
  keys?: string[];
119
115
  checkCols?: ConfigDataModal;
120
- };
116
+ }
121
117
  export interface TableInstance {
122
118
  reload: (params?: ParamsModal) => Promise<any>;
123
119
  setSelectedRowData: (keys: React.Key[], data: any) => void;
@@ -126,7 +122,7 @@ export interface TableInstance {
126
122
  getParams: () => any;
127
123
  getSelectedRowData: () => RowObj;
128
124
  getTableSourceData: () => any;
129
- getColSettingKeys:()=>ColCheckResultKeys;
125
+ getColSettingKeys: () => ColCheckResultKeys;
130
126
  }
131
127
  export interface HTableInstance {
132
128
  form: HFormInstance;
@@ -1,6 +1,7 @@
1
1
  import { HTable, useHTable } from "@/components";
2
- import { Button } from "antd";
2
+ import {Button, Tooltip} from "antd";
3
3
  import { HFormConfigProvider } from "@hw-component/form";
4
+ import {SettingOutlined} from "@ant-design/icons";
4
5
 
5
6
  const configData = [
6
7
  {
@@ -79,10 +80,10 @@ export default () => {
79
80
  configData={configData}
80
81
  rowKey={"id"}
81
82
  table={hTable}
82
- onReset={()=>{
83
- hTable.form.setFieldsValue({
84
- name1:"ffff"
85
- })
83
+ onReset={() => {
84
+ hTable.form.setFieldsValue({
85
+ name1: "ffff",
86
+ });
86
87
  }}
87
88
  hideLabel={false}
88
89
  labelWidth={88}
@@ -101,20 +102,27 @@ export default () => {
101
102
  x: 1000,
102
103
  }}
103
104
  columnsState={{
104
- persistenceKey:"test",
105
- persistenceType:"localStorage"
105
+ persistenceKey: "test",
106
+ persistenceType: "localStorage",
106
107
  }}
107
108
  formInitValues={{
108
109
  name2: 1,
109
110
  }}
110
- headerTitle={<Button type={"primary"} onClick={()=>{
111
- console.log(hTable.table.getColSettingKeys());
112
- }}>操作</Button>}
111
+ headerTitle={
112
+ <Button
113
+ type={"primary"}
114
+ onClick={() => {
115
+ console.log(hTable.table.getColSettingKeys());
116
+ }}
117
+ >
118
+ 操作
119
+ </Button>
120
+ }
113
121
  paginationActionRender={() => {
114
122
  return <div>你大爷</div>;
115
123
  }}
116
124
  request={(params) => {
117
- const { current = 1 ,size="10"} = params;
125
+ const { current = 1, size = "10" } = params;
118
126
  const arrayData = [];
119
127
  for (let i = 0; i < 100; i = i + 1) {
120
128
  arrayData.push({
@@ -126,7 +134,7 @@ export default () => {
126
134
  setTimeout(() => {
127
135
  // reject(new Error("错误"));
128
136
  resolve({
129
- size:size,
137
+ size: size,
130
138
  current: current.toString(10),
131
139
  total: "1000",
132
140
  records: arrayData,
@@ -134,6 +142,11 @@ export default () => {
134
142
  }, 2000);
135
143
  });
136
144
  }}
145
+ options={{
146
+ settingRender:()=>{
147
+ return <Tooltip title="321312312312321"><SettingOutlined width={24} /></Tooltip>
148
+ }
149
+ }}
137
150
  />
138
151
  </div>
139
152
  </HFormConfigProvider>
@@ -3,7 +3,8 @@ import {
3
3
  HTableHeader,
4
4
  HTableBody,
5
5
  HTableFooter,
6
- HTablePagination, useHTable,
6
+ HTablePagination,
7
+ useHTable,
7
8
  } from "@/components";
8
9
  import { useRequest } from "ahooks";
9
10
  import { Space } from "antd";
@@ -28,7 +29,7 @@ const AddBtn = (props) => {
28
29
  return <div>fff</div>;
29
30
  };
30
31
  export default () => {
31
- const hTable=useHTable();
32
+ const hTable = useHTable();
32
33
  const { run, loading, error, data } = useRequest(
33
34
  (params) => {
34
35
  const { current = 1 } = params;
@@ -65,14 +66,18 @@ export default () => {
65
66
  <Space direction={"vertical"} style={{ width: "100%" }}>
66
67
  <HTableHeader />
67
68
  <HTableBody
68
- headerTitle={<div onClick={()=>{
69
- console.log( hTable.table.getColSettingKeys())
70
- }}>
69
+ headerTitle={
70
+ <div
71
+ onClick={() => {
72
+ console.log(hTable.table.getColSettingKeys());
73
+ }}
74
+ >
71
75
  点我获取
72
- </div>}
76
+ </div>
77
+ }
73
78
  columnsState={{
74
- persistenceKey:"zd",
75
- persistenceType:"localStorage"
79
+ persistenceKey: "zd",
80
+ persistenceType: "localStorage",
76
81
  }}
77
82
  affixProps={{
78
83
  target: () => document.querySelector(".body"),