@hw-component/table 1.9.90 → 1.9.92

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 (64) hide show
  1. package/.eslintcache +1 -1
  2. package/es/HTableBody/HeaderTitle/hooks.d.ts +2 -2
  3. package/es/HTableBody/Options/Content.d.ts +1 -1
  4. package/es/HTableBody/Options/Content.js +103 -48
  5. package/es/HTableBody/Options/ContentTree.d.ts +7 -0
  6. package/es/HTableBody/Options/ContentTree.js +41 -0
  7. package/es/HTableBody/Options/Title.d.ts +1 -1
  8. package/es/HTableBody/Options/hooks.d.ts +17 -0
  9. package/es/HTableBody/Options/hooks.js +53 -1
  10. package/es/HTableBody/Options/index.d.ts +1 -1
  11. package/es/HTableBody/Options/index.js +4 -2
  12. package/es/HTableBody/Options/utils.d.ts +8 -1
  13. package/es/HTableBody/Options/utils.js +29 -2
  14. package/es/HTableBody/RowCheckBox/RowItem.d.ts +1 -1
  15. package/es/HTableBody/RowCheckBox/hooks.d.ts +1 -1
  16. package/es/HTableBody/RowRadioBoxSelection.d.ts +1 -1
  17. package/es/HTableBody/hooks/useColData.d.ts +4 -1
  18. package/es/HTableBody/hooks/useColData.js +8 -3
  19. package/es/HTableBody/index.js +10 -4
  20. package/es/HTableBody/modal.d.ts +2 -1
  21. package/es/index.css +4 -0
  22. package/es/modal.d.ts +2 -1
  23. package/lib/HTableBody/HeaderTitle/hooks.d.ts +2 -2
  24. package/lib/HTableBody/Options/Content.d.ts +1 -1
  25. package/lib/HTableBody/Options/Content.js +101 -46
  26. package/lib/HTableBody/Options/ContentTree.d.ts +7 -0
  27. package/lib/HTableBody/Options/ContentTree.js +44 -0
  28. package/lib/HTableBody/Options/Title.d.ts +1 -1
  29. package/lib/HTableBody/Options/hooks.d.ts +17 -0
  30. package/lib/HTableBody/Options/hooks.js +54 -0
  31. package/lib/HTableBody/Options/index.d.ts +1 -1
  32. package/lib/HTableBody/Options/index.js +4 -2
  33. package/lib/HTableBody/Options/utils.d.ts +8 -1
  34. package/lib/HTableBody/Options/utils.js +29 -1
  35. package/lib/HTableBody/RowCheckBox/RowItem.d.ts +1 -1
  36. package/lib/HTableBody/RowCheckBox/hooks.d.ts +1 -1
  37. package/lib/HTableBody/RowRadioBoxSelection.d.ts +1 -1
  38. package/lib/HTableBody/hooks/useColData.d.ts +4 -1
  39. package/lib/HTableBody/hooks/useColData.js +8 -3
  40. package/lib/HTableBody/index.js +10 -4
  41. package/lib/HTableBody/modal.d.ts +2 -1
  42. package/lib/index.css +4 -0
  43. package/lib/modal.d.ts +2 -1
  44. package/package.json +1 -1
  45. package/src/components/HTableBody/HeaderTitle/hooks.ts +47 -42
  46. package/src/components/HTableBody/HeaderTitle/index.tsx +7 -5
  47. package/src/components/HTableBody/Options/Content.tsx +82 -35
  48. package/src/components/HTableBody/Options/ContentTree.tsx +38 -0
  49. package/src/components/HTableBody/Options/Title.tsx +7 -2
  50. package/src/components/HTableBody/Options/hooks.tsx +79 -0
  51. package/src/components/HTableBody/Options/index.tsx +3 -0
  52. package/src/components/HTableBody/Options/modal.d.ts +2 -0
  53. package/src/components/HTableBody/Options/utils.ts +28 -0
  54. package/src/components/HTableBody/RowCheckBox/RowItem.tsx +1 -1
  55. package/src/components/HTableBody/RowCheckBox/hooks.ts +1 -1
  56. package/src/components/HTableBody/RowRadioBoxSelection.tsx +1 -1
  57. package/src/components/HTableBody/hooks/useColData.tsx +9 -2
  58. package/src/components/HTableBody/index.tsx +14 -9
  59. package/src/components/HTableBody/modal.ts +4 -3
  60. package/src/components/hooks/useRowObj.ts +1 -1
  61. package/src/components/index.less +4 -0
  62. package/src/components/modal.ts +3 -2
  63. package/src/pages/Table/index.tsx +50 -20
  64. package/src/components/HTableBody/Options/hooks.ts +0 -24
@@ -0,0 +1,79 @@
1
+ import React, { useEffect, useMemo, useState } from "react";
2
+ import type { IProps, ItemProps } from "@/components/HTableBody/Options/modal";
3
+ import type { ConfigDataModal } from "@/components/modal";
4
+ import { getItemValue } from "@/components/HTableBody/Options/utils";
5
+ import { useClassName } from "@/components/hooks";
6
+
7
+ export const useCheckKeys = ({
8
+ columns,
9
+ colStatusValue,
10
+ }: Pick<IProps, "colStatusValue" | "columns">) => {
11
+ return useMemo(() => {
12
+ const keys: string[] = [];
13
+ columns.forEach((value) => {
14
+ const { dataIndex, hideInTable } = value;
15
+ if (hideInTable || !dataIndex) {
16
+ return;
17
+ }
18
+ const dataIndexStr = dataIndex.toString();
19
+ const { show = true } = colStatusValue[dataIndexStr] || {};
20
+ if (!show) {
21
+ return;
22
+ }
23
+ keys.push(dataIndexStr);
24
+ });
25
+ return keys;
26
+ }, [colStatusValue, columns]);
27
+ };
28
+
29
+ interface UseContentTreeModal {
30
+ columns: ConfigDataModal;
31
+ matchKey?: "right" | "left";
32
+ }
33
+ interface ColDataNode {
34
+ title: React.ReactNode;
35
+ key: string;
36
+ }
37
+ export const useContentTree = ({ columns, matchKey }: UseContentTreeModal) => {
38
+ const titleClass = useClassName("hw-table-body-option-setting-content-title");
39
+ return useMemo<ColDataNode[]>(() => {
40
+ const treeData: ColDataNode[] = [];
41
+ columns.forEach(({ dataIndex, title, titleStr, fixed }) => {
42
+ if (!dataIndex) {
43
+ return;
44
+ }
45
+ if (fixed !== matchKey) {
46
+ return;
47
+ }
48
+ const { title: cuTitleStr } = getItemValue({
49
+ titleStr,
50
+ title,
51
+ });
52
+ treeData.push({
53
+ title: <div className={titleClass}>{cuTitleStr}</div>,
54
+ key: dataIndex.toString(),
55
+ });
56
+ });
57
+ return treeData;
58
+ }, [columns]);
59
+ };
60
+ interface UseTreeKeysModal {
61
+ treeData:ColDataNode[];
62
+ checkKeys:string[];
63
+ }
64
+
65
+ export const useTreeKeys = ({
66
+ treeData,
67
+ checkKeys,
68
+ }: UseTreeKeysModal) => {
69
+ return useMemo(()=>{
70
+ const newKeys: string[] = [];
71
+ treeData.forEach(({ key }) => {
72
+ const index = checkKeys.indexOf(key);
73
+ if (index !== -1) {
74
+ newKeys.push(key);
75
+ }
76
+ });
77
+ return newKeys;
78
+ },[treeData, checkKeys])
79
+ };
@@ -11,6 +11,7 @@ import { ColsSettingContent } from "./Content";
11
11
  import { Title } from "./Title";
12
12
  import type { IProps } from "./modal";
13
13
  import { useCheckKeys } from "@/components/HTableBody/Options/hooks";
14
+
14
15
  export default ({
15
16
  reload,
16
17
  size = "middle",
@@ -21,6 +22,7 @@ export default ({
21
22
  colStatusValue,
22
23
  reset,
23
24
  settingRender,
25
+ onDrop,
24
26
  }: IProps) => {
25
27
  const pointer = useClassName([
26
28
  "hw-table-pointer",
@@ -84,6 +86,7 @@ export default ({
84
86
  columns={columns}
85
87
  checkKeys={checkKeys}
86
88
  onCheck={onChange}
89
+ onDrop={onDrop}
87
90
  />
88
91
  }
89
92
  title={
@@ -12,6 +12,7 @@ export interface IProps extends OptionConfig {
12
12
  colStatusValue: Record<string, ColumnsState>;
13
13
  reset: VoidFunction;
14
14
  settingRender?: () => React.ReactNode;
15
+ onDrop: (columns: ConfigDataModal) => void;
15
16
  }
16
17
 
17
18
  export interface ItemProps {
@@ -19,4 +20,5 @@ export interface ItemProps {
19
20
  onCheck: (keys: string[], notCheck: string[]) => void;
20
21
  columns: ConfigDataModal;
21
22
  reset?: VoidFunction;
23
+ onDrop: (columns: ConfigDataModal) => void;
22
24
  }
@@ -13,3 +13,31 @@ export const getItemValue = (data: ConfigItemModal) => {
13
13
  ...oData,
14
14
  };
15
15
  };
16
+
17
+ interface MoveColProps {
18
+ startKey: string;
19
+ endKey: string;
20
+ data: ConfigDataModal;
21
+ }
22
+
23
+ export const moveCol = ({ startKey, endKey, data }: MoveColProps) => {
24
+ const indexArray = [-1, -1];
25
+ data.forEach((item, index) => {
26
+ const { dataIndex } = item;
27
+ if (!dataIndex) {
28
+ return;
29
+ }
30
+ if (dataIndex === startKey) {
31
+ indexArray[0] = index;
32
+ }
33
+ if (dataIndex === endKey) {
34
+ indexArray[1] = index;
35
+ }
36
+ });
37
+ const [oldIndex, newIndex] = indexArray;
38
+ const newData = [...data];
39
+ const oldItem = data[oldIndex];
40
+ newData.splice(oldIndex, 1);
41
+ newData.splice(newIndex, 0, oldItem);
42
+ return newData;
43
+ };
@@ -1,6 +1,6 @@
1
1
  import { useHTableContext } from "../../context";
2
2
  import { Checkbox } from "antd";
3
- import {RowRadioSelectionProps} from "@/components/HTableBody/modal";
3
+ import type { RowRadioSelectionProps } from "@/components/HTableBody/modal";
4
4
 
5
5
  export default ({
6
6
  data,
@@ -1,7 +1,7 @@
1
1
  import type { HTableProps } from "@/components/modal";
2
2
  import type { Key } from "react";
3
3
  import { useHTableContext } from "@/components/context";
4
- import {RowRadioSelectionProps} from '../modal';
4
+ import type { RowRadioSelectionProps } from "../modal";
5
5
 
6
6
  const getRowKey = (item: any, index: number, rowKey: HTableProps["rowKey"]) => {
7
7
  return typeof rowKey === "function"
@@ -1,6 +1,6 @@
1
1
  import { useHTableContext } from "@/components/context";
2
2
  import { Radio } from "antd";
3
- import {RowRadioSelectionProps} from './modal';
3
+ import type { RowRadioSelectionProps } from "./modal";
4
4
 
5
5
  export const RowRadioSelection = ({
6
6
  data,
@@ -78,8 +78,13 @@ export const useCols = ({
78
78
  useEffect(() => {
79
79
  setCols(changeConfigData(configData));
80
80
  }, [configData, table, rowSelection]);
81
+ const resetCols = () => {
82
+ setCols(changeConfigData(configData));
83
+ };
81
84
  return {
82
85
  cols,
86
+ setCols,
87
+ resetCols,
83
88
  };
84
89
  };
85
90
 
@@ -98,6 +103,7 @@ export const useColumnsStateType = ({
98
103
  const [selfValue, setSelfValue] = useState<
99
104
  Record<string, ColumnsState> | undefined
100
105
  >(defaultValue);
106
+
101
107
  const initTableColsVal = useMemo(() => {
102
108
  return selfValue || {};
103
109
  }, []);
@@ -118,7 +124,8 @@ export const useColumnsStateType = ({
118
124
  setSelfValue(newObj);
119
125
  onChange?.(newObj);
120
126
  };
121
- const reset = () => {
127
+
128
+ const resetCheckCol = () => {
122
129
  setSelfValue(initTableColsVal);
123
130
  };
124
131
  return {
@@ -126,6 +133,6 @@ export const useColumnsStateType = ({
126
133
  persistenceKey,
127
134
  value: selfValue,
128
135
  onChange: change,
129
- reset,
136
+ resetCheckCol,
130
137
  };
131
138
  }; //设置选项
@@ -65,19 +65,20 @@ export default (bodyProps: HTableBodyProps) => {
65
65
  const bodyConfigData = configData || contextConfigData;
66
66
  const { records } = data || {};
67
67
  const tableInstance = table || contextTableInstance;
68
- const { cols } = useCols({
68
+
69
+ const { cols, setCols, resetCols } = useCols({
69
70
  configData: bodyConfigData,
70
71
  table: tableInstance,
71
72
  rowSelection,
72
73
  bordered,
73
74
  });
74
-
75
- const { value, onChange, reset, ...selfColStatus } = useColumnsStateType({
76
- columnsState,
77
- columns: cols,
78
- });
79
-
75
+ const { value, onChange, resetCheckCol, ...selfColStatus } =
76
+ useColumnsStateType({
77
+ columnsState,
78
+ columns: cols,
79
+ });
80
80
  useSynchronousKeys({ selectedRowKeys, records, rowKey });
81
+
81
82
  const optionsNode = options && (
82
83
  <Options
83
84
  reload={() => {
@@ -89,7 +90,11 @@ export default (bodyProps: HTableBodyProps) => {
89
90
  setSizeChange={setCuSize}
90
91
  colStatusValue={value || {}}
91
92
  onChange={onChange}
92
- reset={reset}
93
+ reset={() => {
94
+ resetCheckCol();
95
+ resetCols();
96
+ }}
97
+ onDrop={setCols}
93
98
  />
94
99
  );
95
100
  const defaultOptionsNode = optionsRender
@@ -131,7 +136,7 @@ export default (bodyProps: HTableBodyProps) => {
131
136
  >
132
137
  <ProTable
133
138
  {...props}
134
- rowClassName={(rowClassNameFn as any)}
139
+ rowClassName={rowClassNameFn as any}
135
140
  bordered={bordered}
136
141
  columnsState={{
137
142
  ...selfColStatus,
@@ -1,5 +1,6 @@
1
1
  import type { OptionConfig } from "@ant-design/pro-table/lib/components/ToolBar";
2
- import React, {Key} from "react";
2
+ import type { Key } from "react";
3
+ import type React from "react";
3
4
  import type { ProTableProps } from "@ant-design/pro-table";
4
5
  import type {
5
6
  ActionRenderFn,
@@ -42,7 +43,7 @@ export interface HTableBodyProps
42
43
 
43
44
  export interface RowRadioSelectionProps {
44
45
  data: any;
45
- onChange?:(keys:Key[],data:any[])=>void;
46
+ onChange?: (keys: Key[], data: any[]) => void;
46
47
  getCheckboxProps?: HRowSelection["getCheckboxProps"];
47
48
  index: number;
48
- }
49
+ }
@@ -1,5 +1,5 @@
1
1
  import type React from "react";
2
- import { useState } from "react";
2
+ import { useState } from "react";
3
3
  import type { RowObj } from "../modal";
4
4
  import type { HRowSelection } from "../modal";
5
5
 
@@ -85,6 +85,10 @@
85
85
  .@{ant-prefix}-hw-table-body-option-setting-content-title{
86
86
  display: flex;
87
87
  }
88
+ .@{ant-prefix}-hw-table-op-tree-content{
89
+ padding: 6px 6px 6px 0px;
90
+ width: 100%;
91
+ }
88
92
  .@{ant-prefix}-hw-table-body-option-tree{
89
93
  .@{ant-prefix}-tree-treenode{
90
94
  width: 100%;
@@ -5,7 +5,8 @@ import type {
5
5
  HFormInstance,
6
6
  } from "@hw-component/form/es/Form/modal";
7
7
  import type { ColProps, FormInstance } from "antd";
8
- import React, {Key} from "react";
8
+ import type { Key } from "react";
9
+ import type React from "react";
9
10
  import type { ModalProps } from "antd";
10
11
  import type { TableProps } from "antd/lib/table";
11
12
  import type { AffixProps } from "antd/lib/affix";
@@ -72,7 +73,7 @@ export type actionFn = (...arg) => void;
72
73
 
73
74
  export interface RowSelectionOuter {
74
75
  allPageCheck?: boolean;
75
- onChange?:(keys:Key[],data:any[])=>void;
76
+ onChange?: (keys: Key[], data: any[]) => void;
76
77
  }
77
78
  export type HRowSelection = RowSelectionOuter &
78
79
  (TableProps<any>["rowSelection"] & {
@@ -5,7 +5,16 @@ import {
5
5
  HTableHeaderSubBtn,
6
6
  HTableHeader,
7
7
  } from "@/components";
8
- import { Button, Card, Tooltip, Typography, Tag, Row, Space } from "antd";
8
+ import {
9
+ Button,
10
+ Card,
11
+ Tooltip,
12
+ Typography,
13
+ Tag,
14
+ Row,
15
+ Space,
16
+ Table,
17
+ } from "antd";
9
18
  import { HFormConfigProvider, HRangePicker } from "@hw-component/form";
10
19
  import { SettingOutlined } from "@ant-design/icons";
11
20
  import ProTable from "@ant-design/pro-table";
@@ -58,11 +67,41 @@ export const configData = [
58
67
  dataIndex: "img",
59
68
  width: 120,
60
69
  valueType: "image",
70
+ },
71
+ {
72
+ title: "图片123",
73
+ dataIndex: "img123",
74
+ width: 120,
75
+ valueType: "image",
61
76
  valueTypeProps: {
62
77
  fallback:
63
78
  "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMIAAADDCAYAAADQvc6UAAABRWlDQ1BJQ0MgUHJvZmlsZQAAKJFjYGASSSwoyGFhYGDIzSspCnJ3UoiIjFJgf8LAwSDCIMogwMCcmFxc4BgQ4ANUwgCjUcG3awyMIPqyLsis7PPOq3QdDFcvjV3jOD1boQVTPQrgSkktTgbSf4A4LbmgqISBgTEFyFYuLykAsTuAbJEioKOA7DkgdjqEvQHEToKwj4DVhAQ5A9k3gGyB5IxEoBmML4BsnSQk8XQkNtReEOBxcfXxUQg1Mjc0dyHgXNJBSWpFCYh2zi+oLMpMzyhRcASGUqqCZ16yno6CkYGRAQMDKMwhqj/fAIcloxgHQqxAjIHBEugw5sUIsSQpBobtQPdLciLEVJYzMPBHMDBsayhILEqEO4DxG0txmrERhM29nYGBddr//5/DGRjYNRkY/l7////39v///y4Dmn+LgeHANwDrkl1AuO+pmgAAADhlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAAqACAAQAAAABAAAAwqADAAQAAAABAAAAwwAAAAD9b/HnAAAHlklEQVR4Ae3dP3PTWBSGcbGzM6GCKqlIBRV0dHRJFarQ0eUT8LH4BnRU0NHR0UEFVdIlFRV7TzRksomPY8uykTk/zewQfKw/9znv4yvJynLv4uLiV2dBoDiBf4qP3/ARuCRABEFAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghggQAQZQKAnYEaQBAQaASKIAQJEkAEEegJmBElAoBEgghgg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kQo1GxDzQkQIWejUogAEQo121BzAkTI2agUIkCEQs021JwAEXI2KoUIEKFQsw01J0CEnI1KIQJEKNRsQ80JECFno1KIABEKNdtQcwJEyNmoFCJAhELNNtScABFyNiqFCBChULMNNSdAhJyNSiEC/wGgKKC4YMA4TAAAAABJRU5ErkJggg==",
64
79
  },
65
80
  },
81
+ {
82
+ title: "操作",
83
+ dataIndex: "op",
84
+ width: 120,
85
+ fixed: "right",
86
+ },
87
+ {
88
+ title: "操作1",
89
+ dataIndex: "op1",
90
+ width: 120,
91
+ fixed: "right",
92
+ },
93
+ {
94
+ title: "操作2",
95
+ dataIndex: "op2",
96
+ width: 120,
97
+ fixed: "left",
98
+ },
99
+ {
100
+ title: "操作3",
101
+ dataIndex: "op3",
102
+ width: 120,
103
+ fixed: "left",
104
+ },
66
105
  ];
67
106
  const maker = (name) => {
68
107
  const data = [];
@@ -77,7 +116,7 @@ const maker = (name) => {
77
116
  };
78
117
  export default () => {
79
118
  const hTable = useHTable();
80
- const [width,setWidth]=useState(0);
119
+ const [width, setWidth] = useState(0);
81
120
  const { loading, data } = useRequest(() => {
82
121
  const arrayData: any[] = [];
83
122
  for (let i = 0; i < 10; i = i + 1) {
@@ -155,29 +194,20 @@ export default () => {
155
194
  headerTitle={
156
195
  <Space size={8}>
157
196
  <Button
158
- onClick={() => {
159
- setTimeout(()=>{
160
- setWidth(1000);
161
- },1000)
162
- console.log(hTable.table.getColSettingKeys());
163
- }}
197
+ onClick={() => {
198
+ setTimeout(() => {
199
+ setWidth(1000);
200
+ }, 1000);
201
+ console.log(hTable.table.getColSettingKeys());
202
+ }}
164
203
  >
165
204
  操作
166
205
  </Button>
167
- <div>
168
- <div style={{width,height:50,backgroundColor:"red"}}></div>
169
- </div>
206
+ <div>
207
+ <div style={{ width, height: 50, backgroundColor: "red" }} />
208
+ </div>
170
209
  </Space>
171
210
  }
172
- options={{
173
- settingRender: () => {
174
- return (
175
- <Tooltip title="321312312312321">
176
- <SettingOutlined width={24} />
177
- </Tooltip>
178
- );
179
- },
180
- }}
181
211
  pagination={false}
182
212
  />
183
213
  </HTableConfig>
@@ -1,24 +0,0 @@
1
- import { useMemo } from "react";
2
- import type { IProps } from "@/components/HTableBody/Options/modal";
3
-
4
- export const useCheckKeys = ({
5
- columns,
6
- colStatusValue,
7
- }: Pick<IProps, "colStatusValue" | "columns">) => {
8
- return useMemo(() => {
9
- const keys: string[] = [];
10
- columns.forEach((value) => {
11
- const { dataIndex, hideInTable } = value;
12
- if (hideInTable || !dataIndex) {
13
- return;
14
- }
15
- const dataIndexStr = dataIndex.toString();
16
- const { show = true } = colStatusValue[dataIndexStr] || {};
17
- if (!show) {
18
- return;
19
- }
20
- keys.push(dataIndexStr);
21
- });
22
- return keys;
23
- }, [colStatusValue, columns]);
24
- };