@hw-component/table 0.0.7-beta-v8 → 0.0.7-beta-v9

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 (48) hide show
  1. package/.eslintcache +1 -1
  2. package/es/HTableBody/Options/Content.d.ts +2 -0
  3. package/es/HTableBody/Options/Content.js +83 -0
  4. package/es/HTableBody/Options/Title.d.ts +2 -0
  5. package/es/HTableBody/Options/Title.js +71 -0
  6. package/es/HTableBody/Options/index.d.ts +3 -0
  7. package/es/HTableBody/Options/index.js +124 -0
  8. package/es/HTableBody/Options/utils.d.ts +5 -0
  9. package/es/HTableBody/Options/utils.js +31 -0
  10. package/es/HTableBody/hooks.d.ts +9 -1149
  11. package/es/HTableBody/hooks.js +39 -9
  12. package/es/HTableBody/index.d.ts +2 -2
  13. package/es/HTableBody/index.js +27 -14
  14. package/es/HTableHeader/hooks.js +6 -3
  15. package/es/hooks/useHTable.d.ts +1 -0
  16. package/es/hooks/useHTable.js +2 -1
  17. package/es/index.css +43 -0
  18. package/es/modal.d.ts +6 -1
  19. package/lib/HTableBody/Options/Content.d.ts +2 -0
  20. package/lib/HTableBody/Options/Content.js +84 -0
  21. package/lib/HTableBody/Options/Title.d.ts +2 -0
  22. package/lib/HTableBody/Options/Title.js +72 -0
  23. package/lib/HTableBody/Options/index.d.ts +3 -0
  24. package/lib/HTableBody/Options/index.js +127 -0
  25. package/lib/HTableBody/Options/utils.d.ts +5 -0
  26. package/lib/HTableBody/Options/utils.js +32 -0
  27. package/lib/HTableBody/hooks.d.ts +9 -1149
  28. package/lib/HTableBody/hooks.js +38 -7
  29. package/lib/HTableBody/index.d.ts +2 -2
  30. package/lib/HTableBody/index.js +28 -15
  31. package/lib/HTableHeader/hooks.js +6 -3
  32. package/lib/hooks/useHTable.d.ts +1 -0
  33. package/lib/hooks/useHTable.js +2 -1
  34. package/lib/index.css +43 -0
  35. package/lib/modal.d.ts +6 -1
  36. package/package.json +1 -1
  37. package/src/components/HTableBody/Options/Content.tsx +58 -0
  38. package/src/components/HTableBody/Options/Title.tsx +48 -0
  39. package/src/components/HTableBody/Options/index.tsx +108 -0
  40. package/src/components/HTableBody/Options/modal.d.ts +14 -0
  41. package/src/components/HTableBody/Options/utils.ts +22 -0
  42. package/src/components/HTableBody/hooks.tsx +34 -8
  43. package/src/components/HTableBody/index.tsx +22 -17
  44. package/src/components/HTableHeader/hooks.tsx +3 -0
  45. package/src/components/hooks/useHTable.tsx +1 -0
  46. package/src/components/index.less +41 -0
  47. package/src/components/modal.ts +8 -1
  48. package/src/pages/Table/index.tsx +18 -25
@@ -1,7 +1,7 @@
1
1
  import type { ProTableProps } from "@ant-design/pro-table";
2
2
  import ProTable from "@ant-design/pro-table";
3
3
  import type { ActionRenderFn, ConfigDataModal, ParamsModal } from "../modal";
4
- import { useCols, useSynchronousKeys } from "./hooks";
4
+ import { useCols, useSize, useSynchronousKeys } from "./hooks";
5
5
  import { useHTableContext } from "../context";
6
6
  import type { DetailedReactHTMLElement } from "react";
7
7
  import React from "react";
@@ -13,8 +13,8 @@ import { useClassName } from "../hooks";
13
13
  import AlertMsg from "./AlertMsg";
14
14
  import type { HRowSelection } from "../modal";
15
15
  import type { AffixProps } from "antd/lib/affix";
16
- import GoTop from "../GoTop";
17
- interface HTableBodyProps
16
+ import Options from "./Options";
17
+ export interface HTableBodyProps
18
18
  extends Omit<ProTableProps<any, any>, "dataSource" | "rowSelection"> {
19
19
  configData?: ConfigDataModal;
20
20
  onPageChange?: (params: ParamsModal) => void;
@@ -49,10 +49,11 @@ export default ({
49
49
  tableStyle,
50
50
  paginationStyle,
51
51
  headerTitle,
52
- options,
52
+ options = {},
53
53
  actionRender,
54
54
  affixProps,
55
55
  goTop = true,
56
+ size,
56
57
  ...props
57
58
  }: HTableBodyProps) => {
58
59
  // @ts-ignore
@@ -71,14 +72,13 @@ export default ({
71
72
  emptyRender: tableEmptyRender = defaultRender,
72
73
  errorRender: tableErrorRender = defaultRender,
73
74
  } = useHTableConfigContext({ emptyRender, errorRender });
75
+ const { cuSize, setCuSize } = useSize(size);
74
76
  const bodyConfigData = configData || contextConfigData;
75
77
  const { records } = data || {};
76
- const cols = useCols({
78
+ const { cols, changeCols } = useCols({
77
79
  configData: bodyConfigData,
78
- rowSelection,
79
80
  table: tableInstance,
80
81
  });
81
-
82
82
  useSynchronousKeys({ selectedRowKeys, records, rowKey });
83
83
 
84
84
  const { keys = [], selectAll } = selectedRowData;
@@ -103,6 +103,18 @@ export default ({
103
103
  />
104
104
  </div>
105
105
  )}
106
+ {options && (
107
+ <Options
108
+ reload={() => {
109
+ tableInstance.table.reloadWithParams();
110
+ }}
111
+ {...options}
112
+ size={cuSize}
113
+ columns={cols}
114
+ setSizeChange={setCuSize}
115
+ onChange={changeCols}
116
+ />
117
+ )}
106
118
  <ConfigProvider
107
119
  renderEmpty={() => {
108
120
  if (error) {
@@ -113,17 +125,10 @@ export default ({
113
125
  >
114
126
  <ProTable
115
127
  {...props}
116
- columns={cols}
128
+ columns={(cols as any)}
129
+ size={cuSize}
117
130
  search={false}
118
- options={
119
- options
120
- ? options
121
- : {
122
- reload: () => {
123
- tableInstance.table.reloadWithParams();
124
- },
125
- }
126
- }
131
+ options={false}
127
132
  tableStyle={{
128
133
  paddingBottom: 0,
129
134
  }}
@@ -63,6 +63,9 @@ const formConfigDataItemProvider = ({
63
63
  dataIndex,
64
64
  itemProps = {},
65
65
  searchRender,
66
+ childrenDataIndex,
67
+ showSearch,
68
+ hideInTable,
66
69
  ...props
67
70
  }: FormConfigDataItemProviderModal): HItemProps => {
68
71
  const { allowClear = true } = itemProps as any;
@@ -17,6 +17,7 @@ export default () => {
17
17
  getParams: () => {
18
18
  return {} as any;
19
19
  },
20
+ settingKeys: [],
20
21
  };
21
22
  }, []);
22
23
  return {
@@ -44,3 +44,44 @@
44
44
  }
45
45
  }
46
46
 
47
+ .@{ant-prefix}-hw-table-body-option{
48
+ padding: 0px 24px 16px 24px;
49
+
50
+ }
51
+ .@{ant-prefix}-hw-table-body-option-icon{
52
+ font-size: 16px;
53
+ }
54
+ .@{ant-prefix}-hw-table-body-option-setting-content{
55
+ width: 198px;
56
+ margin: -10px -16px;
57
+ }
58
+ .@{ant-prefix}-hw-table-body-option-setting-title{
59
+ width: 198px;
60
+ margin: 0px -16px;
61
+ padding: 6px 8px;
62
+ }
63
+ .@{ant-prefix}-hw-table-body-option-setting-content-title{
64
+ display: flex;
65
+ }
66
+ .@{ant-prefix}-hw-table-body-option-tree{
67
+ .@{ant-prefix}-tree-treenode{
68
+ width: 100%;
69
+ padding-left: 24px !important;
70
+ }
71
+ .@{ant-prefix}-tree-node-content-wrapper{
72
+ flex: 1;
73
+ }
74
+ .@{ant-prefix}-tree-switcher{
75
+ width: 0px;
76
+ }
77
+ .@{ant-prefix}-tree-treenode-draggable{
78
+ padding-left: 0px !important;
79
+ }
80
+ }
81
+ .@{ant-prefix}-hw-table-pointer{
82
+ cursor: pointer;
83
+ &:hover{
84
+ color:#1890ff;
85
+ }
86
+ }
87
+
@@ -35,8 +35,14 @@ interface HColumns extends Omit<ProColumns, "render"> {
35
35
  showSearch?: boolean;
36
36
  searchType?: HItemProps["type"];
37
37
  searchRender?: HItemProps["render"];
38
+ rowSelectionTitle?: boolean;
38
39
  }
39
- export type ConfigItemModal = Omit<HItemProps, "render" | "type"> & HColumns;
40
+ interface BcItemModal {
41
+ childrenDataIndex?: string[];
42
+ }
43
+ export type ConfigItemModal = Omit<HItemProps, "render" | "type"> &
44
+ HColumns &
45
+ BcItemModal;
40
46
  export type ConfigDataModal = ConfigItemModal[];
41
47
  export type ActionRenderFn = (
42
48
  selectedRowKeys: RowObj,
@@ -100,6 +106,7 @@ export interface TableInstance {
100
106
  dispatch: (key: string, params: any) => void;
101
107
  reloadWithParams: (params?: ParamsModal) => Promise<any>;
102
108
  getParams: () => any;
109
+ settingKeys: string[];
103
110
  }
104
111
  export interface HTableInstance {
105
112
  form: HFormInstance;
@@ -4,9 +4,10 @@ import { HFormConfigProvider } from "@hw-component/form";
4
4
 
5
5
  const configData = [
6
6
  {
7
- title: "座位",
7
+ title: "座位21321",
8
8
  showSearch: true,
9
9
  searchType: "select",
10
+ hideInTable: true,
10
11
  dataIndex: "name",
11
12
  itemProps: {
12
13
  options: [{ label: "1", value: 1 }],
@@ -15,7 +16,8 @@ const configData = [
15
16
  {
16
17
  title: "座位断开",
17
18
  showSearch: true,
18
- dataIndex: "name",
19
+ dataIndex: "name1",
20
+ childrenDataIndex: ["name5", "name3"],
19
21
  itemProps: {
20
22
  options: [{ label: "1", value: 1 }],
21
23
  },
@@ -23,16 +25,7 @@ const configData = [
23
25
  {
24
26
  title: "座位",
25
27
  showSearch: true,
26
- dataIndex: "name",
27
- itemProps: {
28
- options: [{ label: "1", value: 1 }],
29
- },
30
- },
31
- {
32
- title: "座位",
33
- showSearch: true,
34
- searchType: "select",
35
- dataIndex: "name",
28
+ dataIndex: "name2",
36
29
  itemProps: {
37
30
  options: [{ label: "1", value: 1 }],
38
31
  },
@@ -61,23 +54,23 @@ export default () => {
61
54
  configData={configData}
62
55
  rowKey={"id"}
63
56
  table={hTable}
64
- rowSelection={{
65
- getCheckboxProps: (item) => {
66
- return {
67
- disabled: item.id === 2,
68
- };
69
- },
70
- }}
57
+ rowSelection={{}}
71
58
  affixProps={{
72
59
  target: () => document.querySelector(".body"),
73
60
  }}
74
- options={{
75
- reload: false,
76
- setting: false,
77
- density: false,
78
- }}
79
61
  actionRender={() => {
80
- return <Button>你大爷</Button>;
62
+ return (
63
+ <Button
64
+ onClick={() => {
65
+ console.log(hTable.table.settingKeys);
66
+ }}
67
+ >
68
+ 你大爷
69
+ </Button>
70
+ );
71
+ }}
72
+ scroll={{
73
+ x: 1000,
81
74
  }}
82
75
  headerTitle={<Button type={"primary"}>操作</Button>}
83
76
  request={(params) => {