@hw-component/table 0.0.9-beta-v2 → 0.0.9-beta-v6

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 (36) hide show
  1. package/.eslintcache +1 -1
  2. package/es/HTableBody/HeaderTitle/index.d.ts +9 -0
  3. package/es/HTableBody/HeaderTitle/index.js +38 -0
  4. package/es/HTableBody/Options/index.js +0 -2
  5. package/es/HTableBody/Options/utils.d.ts +1 -1
  6. package/es/HTableBody/index.js +17 -18
  7. package/es/HTableHeader/hooks.d.ts +1 -1
  8. package/es/HTableHeader/hooks.js +15 -7
  9. package/es/HTableHeader/index.js +2 -1
  10. package/es/HTableHeader/modal.d.ts +2 -0
  11. package/es/index.css +12 -3
  12. package/es/modal.d.ts +2 -2
  13. package/lib/HTableBody/HeaderTitle/index.d.ts +9 -0
  14. package/lib/HTableBody/HeaderTitle/index.js +41 -0
  15. package/lib/HTableBody/Options/index.js +0 -2
  16. package/lib/HTableBody/Options/utils.d.ts +1 -1
  17. package/lib/HTableBody/index.js +18 -19
  18. package/lib/HTableHeader/hooks.d.ts +1 -1
  19. package/lib/HTableHeader/hooks.js +15 -7
  20. package/lib/HTableHeader/index.js +2 -1
  21. package/lib/HTableHeader/modal.d.ts +2 -0
  22. package/lib/index.css +12 -3
  23. package/lib/modal.d.ts +2 -2
  24. package/package.json +1 -1
  25. package/src/components/HTableBody/HeaderTitle/index.tsx +31 -0
  26. package/src/components/HTableBody/Options/index.tsx +1 -2
  27. package/src/components/HTableBody/index.tsx +9 -12
  28. package/src/components/HTableHeader/hooks.tsx +13 -6
  29. package/src/components/HTableHeader/index.tsx +1 -0
  30. package/src/components/HTableHeader/modal.ts +3 -1
  31. package/src/components/Table.tsx +2 -2
  32. package/src/components/index.less +6 -4
  33. package/src/components/modal.ts +2 -2
  34. package/src/pages/ModalTable/index.tsx +1 -1
  35. package/src/pages/Table/index.tsx +7 -15
  36. package/src/pages/TableCustomize/index.tsx +1 -1
@@ -6,6 +6,7 @@ import { useClassName } from "../hooks";
6
6
  import type { HFormInstance } from "@hw-component/form/es/Form/modal";
7
7
  import { DefaultSubComponent } from "../HTableHeader/defaultSubComponent";
8
8
  import { useHTableContext } from "../context";
9
+ import {HTableInstance} from "@/components/modal";
9
10
  const sizeObj = {
10
11
  xl: {
11
12
  min: 1200,
@@ -68,7 +69,7 @@ const formConfigDataItemProvider = ({
68
69
  hideInTable,
69
70
  align,
70
71
  ...props
71
- }: FormConfigDataItemProviderModal): HItemProps => {
72
+ }: FormConfigDataItemProviderModal,table:HTableInstance): HItemProps => {
72
73
  const { allowClear = true } = itemProps as any;
73
74
  return {
74
75
  ...props,
@@ -80,10 +81,15 @@ const formConfigDataItemProvider = ({
80
81
  colon,
81
82
  type: searchType,
82
83
  name: name || (dataIndex as string),
83
- render: searchRender,
84
+ render:(item,node,form)=>{
85
+ if (searchRender){
86
+ return searchRender(item,node,form,table);
87
+ }
88
+ return node;
89
+ },
84
90
  };
85
91
  };
86
- const mkNewConfig = ({ configData = [] }: IHeaderProps) => {
92
+ const mkNewConfig = ({ configData = [] ,table}: IHeaderProps) => {
87
93
  let subConfigData: HItemProps | undefined;
88
94
  const realConfigData: HItemProps[] = [];
89
95
  configData.forEach((value) => {
@@ -92,10 +98,10 @@ const mkNewConfig = ({ configData = [] }: IHeaderProps) => {
92
98
  return false;
93
99
  }
94
100
  if (searchType === "submit") {
95
- subConfigData = formConfigDataItemProvider(value);
101
+ subConfigData = formConfigDataItemProvider(value,(table as HTableInstance));
96
102
  return false;
97
103
  }
98
- realConfigData.push(formConfigDataItemProvider(value));
104
+ realConfigData.push(formConfigDataItemProvider(value,(table as HTableInstance)));
99
105
  });
100
106
  return {
101
107
  realConfigData,
@@ -130,7 +136,7 @@ const filterHideFormItem = (
130
136
  hideData,
131
137
  };
132
138
  };
133
- export const useHideMoreTitle = ({ searchSpan, configData }: IHeaderProps) => {
139
+ export const useHideMoreTitle = ({ searchSpan, configData ,table}: IHeaderProps) => {
134
140
  const [formConfigData, setFormConfigData] = useState<HItemProps[]>([]);
135
141
  const [subData, setSubData] = useState<HItemProps>(defaultSubItem as any);
136
142
  const { headerOpen, setHeaderOpen } = useHTableContext();
@@ -139,6 +145,7 @@ export const useHideMoreTitle = ({ searchSpan, configData }: IHeaderProps) => {
139
145
  const { realConfigData, subConfigData } = mkNewConfig({
140
146
  searchSpan,
141
147
  configData,
148
+ table
142
149
  });
143
150
  const changeClassName = headerOpen ? "" : className;
144
151
  const { lessData, hideData } = filterHideFormItem(
@@ -31,6 +31,7 @@ export default ({
31
31
  const nConfigData = useHideMoreTitle({
32
32
  searchSpan,
33
33
  configData: headerConfigData,
34
+ table:tableInstance
34
35
  });
35
36
  const className = useClassName("hw-table-header");
36
37
  return (
@@ -1,6 +1,7 @@
1
- import type { ConfigDataModal, ConfigItemModal } from "../modal";
1
+ import type {ConfigDataModal, ConfigItemModal} from "../modal";
2
2
  import type { ColProps } from "antd";
3
3
  import type React from "react";
4
+ import {HTableInstance} from "../modal";
4
5
 
5
6
  export interface IHeaderProps {
6
7
  configData?: ConfigDataModal;
@@ -8,6 +9,7 @@ export interface IHeaderProps {
8
9
  searchSpan?: ColProps;
9
10
  loading?: boolean;
10
11
  headerStyle?: React.CSSProperties;
12
+ table?:HTableInstance;
11
13
  }
12
14
 
13
15
  export interface FormConfigDataItemProviderModal extends ConfigItemModal {
@@ -22,10 +22,10 @@ export default ({
22
22
  paginationStyle,
23
23
  rowKey = "id",
24
24
  onFinish,
25
- manual,
25
+ manual,
26
26
  ...props
27
27
  }: HTableProps) => {
28
- const { run, loading, data, error, saveParams } = useReq({ request,manual });
28
+ const { run, loading, data, error, saveParams } = useReq({ request, manual });
29
29
  const dispatch = useDispatch(action);
30
30
  const { selectedRowData, rowOnChange, allSelectChange, setSelectedRowData } =
31
31
  useRowObj();
@@ -44,10 +44,6 @@
44
44
  }
45
45
  }
46
46
 
47
- .@{ant-prefix}-hw-table-body-option{
48
- padding: 0px 24px 16px 24px;
49
-
50
- }
51
47
  .@{ant-prefix}-hw-table-body-option-icon{
52
48
  font-size: 16px;
53
49
  }
@@ -84,4 +80,10 @@
84
80
  color:#1890ff;
85
81
  }
86
82
  }
83
+ .@{ant-prefix}-hw-table-header-title-box{
84
+ flex: 1;
85
+ display: flex;
86
+ position: relative;
87
+ margin-right: 12px;
88
+ }
87
89
 
@@ -4,7 +4,7 @@ import type {
4
4
  HItemProps,
5
5
  HFormInstance,
6
6
  } from "@hw-component/form/es/Form/modal";
7
- import type { ColProps } from "antd";
7
+ import type {ColProps, FormInstance} from "antd";
8
8
  import type React from "react";
9
9
  import type { ModalProps } from "antd";
10
10
  import type { TableProps } from "antd/lib/table";
@@ -34,7 +34,7 @@ interface HColumns extends Omit<ProColumns, "render" | "title"> {
34
34
  ) => React.ReactNode;
35
35
  showSearch?: boolean;
36
36
  searchType?: HItemProps["type"];
37
- searchRender?: HItemProps["render"];
37
+ searchRender?:(item:HItemProps,node:React.ReactNode,form:FormInstance,tableInstance:HTableInstance)=>React.ReactNode;
38
38
  rowSelectionTitle?: boolean;
39
39
  title?: string | React.ReactNode;
40
40
  }
@@ -98,7 +98,7 @@ export default () => {
98
98
  request={req2}
99
99
  configData={configData}
100
100
  tableProps={{
101
- manual:true,
101
+ manual: true,
102
102
  headerTitle: (
103
103
  <div
104
104
  onClick={() => {
@@ -7,8 +7,8 @@ const configData = [
7
7
  title: "座位21321",
8
8
  showSearch: true,
9
9
  searchType: "select",
10
- hideInTable: true,
11
10
  dataIndex: "name",
11
+ sorter: true,
12
12
  itemProps: {
13
13
  options: [{ label: "1", value: 1 }],
14
14
  },
@@ -64,32 +64,24 @@ export default () => {
64
64
  configData={configData}
65
65
  rowKey={"id"}
66
66
  table={hTable}
67
- optionsRender={(node) => {
68
- return <Space>ffff{node}</Space>;
67
+ action={{
68
+ test:(params)=>{
69
+ console.log(params,"lllll")
70
+ }
69
71
  }}
70
72
  rowSelection={{
71
- alwaysShowAlert:true,
72
73
  allPageCheck: false,
73
74
  }}
74
75
  affixProps={{
75
76
  target: () => document.querySelector(".body"),
76
77
  }}
77
- actionRender={() => {
78
- return (
79
- <Button
80
- onClick={() => {
81
- console.log(hTable.table.settingKeys);
82
- }}
83
- >
84
- 你大爷
85
- </Button>
86
- );
87
- }}
88
78
  scroll={{
89
79
  x: 1000,
90
80
  }}
91
81
  headerTitle={<Button type={"primary"}>操作</Button>}
82
+ options={false}
92
83
  request={(params) => {
84
+ console.log(params,".....");
93
85
  const { current = 1 } = params;
94
86
  const arrayData = [];
95
87
  for (let i = 0; i < 100; i = i + 1) {
@@ -72,7 +72,7 @@ export default () => {
72
72
  onChange: () => {
73
73
  console.log("rowSelection");
74
74
  },
75
- alwaysShowAlert:true
75
+ alwaysShowAlert: true,
76
76
  }}
77
77
  />
78
78
  </Space>