@hw-component/table 1.1.7 → 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 (61) hide show
  1. package/.eslintcache +1 -1
  2. package/es/HTableBody/Options/Content.d.ts +1 -1
  3. package/es/HTableBody/Options/Content.js +11 -25
  4. package/es/HTableBody/Options/Title.d.ts +1 -1
  5. package/es/HTableBody/Options/Title.js +25 -32
  6. package/es/HTableBody/Options/hooks.d.ts +2 -0
  7. package/es/HTableBody/Options/hooks.js +32 -0
  8. package/es/HTableBody/Options/index.d.ts +1 -1
  9. package/es/HTableBody/Options/index.js +31 -43
  10. package/es/HTableBody/Options/utils.d.ts +2 -7
  11. package/es/HTableBody/Options/utils.js +2 -57
  12. package/es/HTableBody/hooks.d.ts +13 -1
  13. package/es/HTableBody/hooks.js +52 -8
  14. package/es/HTableBody/index.d.ts +7 -2
  15. package/es/HTableBody/index.js +20 -6
  16. package/es/HTableBody/utils.d.ts +7 -0
  17. package/es/HTableBody/utils.js +99 -0
  18. package/es/HTableHeader/Context.d.ts +1 -1
  19. package/es/HTableHeader/defaultSubComponent.js +5 -1
  20. package/es/HTableHeader/index.d.ts +1 -1
  21. package/es/hooks/useHTable.js +3 -1
  22. package/es/modal.d.ts +7 -4
  23. package/lib/HTableBody/Options/Content.d.ts +1 -1
  24. package/lib/HTableBody/Options/Content.js +11 -25
  25. package/lib/HTableBody/Options/Title.d.ts +1 -1
  26. package/lib/HTableBody/Options/Title.js +25 -32
  27. package/lib/HTableBody/Options/hooks.d.ts +2 -0
  28. package/lib/HTableBody/Options/hooks.js +33 -0
  29. package/lib/HTableBody/Options/index.d.ts +1 -1
  30. package/lib/HTableBody/Options/index.js +30 -42
  31. package/lib/HTableBody/Options/utils.d.ts +2 -7
  32. package/lib/HTableBody/Options/utils.js +1 -57
  33. package/lib/HTableBody/hooks.d.ts +13 -1
  34. package/lib/HTableBody/hooks.js +51 -6
  35. package/lib/HTableBody/index.d.ts +7 -2
  36. package/lib/HTableBody/index.js +19 -5
  37. package/lib/HTableBody/utils.d.ts +7 -0
  38. package/lib/HTableBody/utils.js +101 -0
  39. package/lib/HTableHeader/Context.d.ts +1 -1
  40. package/lib/HTableHeader/defaultSubComponent.js +5 -1
  41. package/lib/HTableHeader/index.d.ts +1 -1
  42. package/lib/hooks/useHTable.js +3 -1
  43. package/lib/modal.d.ts +7 -4
  44. package/package.json +1 -1
  45. package/src/components/HTableBody/Options/Content.tsx +10 -14
  46. package/src/components/HTableBody/Options/Title.tsx +21 -20
  47. package/src/components/HTableBody/Options/hooks.ts +24 -0
  48. package/src/components/HTableBody/Options/index.tsx +23 -26
  49. package/src/components/HTableBody/Options/modal.d.ts +10 -2
  50. package/src/components/HTableBody/Options/utils.ts +1 -54
  51. package/src/components/HTableBody/hooks.tsx +49 -5
  52. package/src/components/HTableBody/index.tsx +29 -6
  53. package/src/components/HTableBody/utils.ts +93 -0
  54. package/src/components/HTableHeader/Context.tsx +7 -7
  55. package/src/components/HTableHeader/defaultSubComponent.tsx +7 -3
  56. package/src/components/HTableHeader/index.tsx +15 -15
  57. package/src/components/HTableHeader/modal.ts +1 -1
  58. package/src/components/hooks/useHTable.tsx +5 -3
  59. package/src/components/modal.ts +7 -10
  60. package/src/pages/Table/index.tsx +27 -9
  61. package/src/pages/TableCustomize/index.tsx +16 -2
@@ -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,6 +108,11 @@ export interface HTableProps
113
108
  formInitValues?: Record<string, any>;
114
109
  labelWidth?: number;
115
110
  hideLabel?: boolean;
111
+ options?:OptionModal|false
112
+ }
113
+ interface ColCheckResultKeys {
114
+ keys?: string[];
115
+ checkCols?: ConfigDataModal;
116
116
  }
117
117
  export interface TableInstance {
118
118
  reload: (params?: ParamsModal) => Promise<any>;
@@ -120,12 +120,9 @@ export interface TableInstance {
120
120
  dispatch: (key: string, params: any) => void;
121
121
  reloadWithParams: (params?: ParamsModal) => Promise<any>;
122
122
  getParams: () => any;
123
- settingKeys: {
124
- keys?: string[];
125
- checkCols?: ConfigDataModal;
126
- };
127
123
  getSelectedRowData: () => RowObj;
128
124
  getTableSourceData: () => any;
125
+ getColSettingKeys: () => ColCheckResultKeys;
129
126
  }
130
127
  export interface HTableInstance {
131
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}
@@ -100,16 +101,28 @@ export default () => {
100
101
  scroll={{
101
102
  x: 1000,
102
103
  }}
104
+ columnsState={{
105
+ persistenceKey: "test",
106
+ persistenceType: "localStorage",
107
+ }}
103
108
  formInitValues={{
104
109
  name2: 1,
105
110
  }}
106
- headerTitle={<Button type={"primary"}>操作</Button>}
107
- options={false}
111
+ headerTitle={
112
+ <Button
113
+ type={"primary"}
114
+ onClick={() => {
115
+ console.log(hTable.table.getColSettingKeys());
116
+ }}
117
+ >
118
+ 操作
119
+ </Button>
120
+ }
108
121
  paginationActionRender={() => {
109
122
  return <div>你大爷</div>;
110
123
  }}
111
124
  request={(params) => {
112
- const { current = 1 ,size="10"} = params;
125
+ const { current = 1, size = "10" } = params;
113
126
  const arrayData = [];
114
127
  for (let i = 0; i < 100; i = i + 1) {
115
128
  arrayData.push({
@@ -121,7 +134,7 @@ export default () => {
121
134
  setTimeout(() => {
122
135
  // reject(new Error("错误"));
123
136
  resolve({
124
- size:size,
137
+ size: size,
125
138
  current: current.toString(10),
126
139
  total: "1000",
127
140
  records: arrayData,
@@ -129,6 +142,11 @@ export default () => {
129
142
  }, 2000);
130
143
  });
131
144
  }}
145
+ options={{
146
+ settingRender:()=>{
147
+ return <Tooltip title="321312312312321"><SettingOutlined width={24} /></Tooltip>
148
+ }
149
+ }}
132
150
  />
133
151
  </div>
134
152
  </HFormConfigProvider>
@@ -4,6 +4,7 @@ import {
4
4
  HTableBody,
5
5
  HTableFooter,
6
6
  HTablePagination,
7
+ useHTable,
7
8
  } from "@/components";
8
9
  import { useRequest } from "ahooks";
9
10
  import { Space } from "antd";
@@ -28,6 +29,7 @@ const AddBtn = (props) => {
28
29
  return <div>fff</div>;
29
30
  };
30
31
  export default () => {
32
+ const hTable = useHTable();
31
33
  const { run, loading, error, data } = useRequest(
32
34
  (params) => {
33
35
  const { current = 1 } = params;
@@ -57,14 +59,26 @@ export default () => {
57
59
  configData={configData}
58
60
  loading={loading}
59
61
  error={error}
62
+ table={hTable}
60
63
  dataSource={data}
61
64
  reload={run}
62
- manual={true}
63
65
  >
64
66
  <Space direction={"vertical"} style={{ width: "100%" }}>
65
67
  <HTableHeader />
66
68
  <HTableBody
67
- headerTitle={<AddBtn />}
69
+ headerTitle={
70
+ <div
71
+ onClick={() => {
72
+ console.log(hTable.table.getColSettingKeys());
73
+ }}
74
+ >
75
+ 点我获取
76
+ </div>
77
+ }
78
+ columnsState={{
79
+ persistenceKey: "zd",
80
+ persistenceType: "localStorage",
81
+ }}
68
82
  affixProps={{
69
83
  target: () => document.querySelector(".body"),
70
84
  }}