@hw-component/table 1.9.92 → 1.9.94

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 (77) hide show
  1. package/.eslintcache +1 -1
  2. package/es/DialogTable/Content.d.ts +4 -3
  3. package/es/DialogTable/Content.js +52 -3
  4. package/es/DialogTable/DwTable.js +2 -2
  5. package/es/DialogTable/ModalEditTable.d.ts +5 -0
  6. package/es/DialogTable/ModalEditTable.js +120 -0
  7. package/es/DialogTable/ModalTable.js +2 -2
  8. package/es/DialogTable/hooks.d.ts +4 -15
  9. package/es/DialogTable/hooks.js +9 -2
  10. package/es/EditTable/hooks.d.ts +9 -0
  11. package/es/EditTable/hooks.js +76 -0
  12. package/es/EditTable/index.d.ts +4 -0
  13. package/es/EditTable/index.js +181 -0
  14. package/es/EditTable/modal.d.ts +19 -0
  15. package/es/HTableBody/Options/hooks.d.ts +1 -1
  16. package/es/HTableBody/defaultRender.d.ts +7 -1
  17. package/es/HTableBody/defaultRender.js +11 -4
  18. package/es/HTableBody/index.js +4 -1
  19. package/es/HTableBody/modal.d.ts +3 -3
  20. package/es/HTablePagination/index.d.ts +2 -1
  21. package/es/HTablePagination/index.js +6 -4
  22. package/es/Table.js +1 -1
  23. package/es/TableConfig.d.ts +5 -5
  24. package/es/index.d.ts +2 -0
  25. package/es/index.js +2 -0
  26. package/es/modal.d.ts +14 -5
  27. package/lib/DialogTable/Content.d.ts +4 -3
  28. package/lib/DialogTable/Content.js +53 -5
  29. package/lib/DialogTable/DwTable.js +1 -1
  30. package/lib/DialogTable/ModalEditTable.d.ts +5 -0
  31. package/lib/DialogTable/ModalEditTable.js +123 -0
  32. package/lib/DialogTable/ModalTable.js +1 -1
  33. package/lib/DialogTable/hooks.d.ts +4 -15
  34. package/lib/DialogTable/hooks.js +9 -2
  35. package/lib/EditTable/hooks.d.ts +9 -0
  36. package/lib/EditTable/hooks.js +78 -0
  37. package/lib/EditTable/index.d.ts +4 -0
  38. package/lib/EditTable/index.js +184 -0
  39. package/lib/EditTable/modal.d.ts +19 -0
  40. package/lib/HTableBody/Options/hooks.d.ts +1 -1
  41. package/lib/HTableBody/defaultRender.d.ts +7 -1
  42. package/lib/HTableBody/defaultRender.js +11 -4
  43. package/lib/HTableBody/index.js +4 -1
  44. package/lib/HTableBody/modal.d.ts +3 -3
  45. package/lib/HTablePagination/index.d.ts +2 -1
  46. package/lib/HTablePagination/index.js +6 -4
  47. package/lib/Table.js +1 -1
  48. package/lib/TableConfig.d.ts +5 -5
  49. package/lib/index.d.ts +2 -0
  50. package/lib/index.js +4 -0
  51. package/lib/modal.d.ts +14 -5
  52. package/package.json +4 -3
  53. package/src/components/DialogTable/Content.tsx +25 -2
  54. package/src/components/DialogTable/DwTable.tsx +3 -2
  55. package/src/components/DialogTable/ModalEditTable.tsx +99 -0
  56. package/src/components/DialogTable/ModalTable.tsx +3 -2
  57. package/src/components/DialogTable/hooks.ts +15 -4
  58. package/src/components/EditTable/hooks.ts +43 -0
  59. package/src/components/EditTable/index.tsx +118 -0
  60. package/src/components/EditTable/modal.ts +26 -0
  61. package/src/components/HTableBody/Options/Content.tsx +11 -11
  62. package/src/components/HTableBody/Options/ContentTree.tsx +1 -5
  63. package/src/components/HTableBody/Options/hooks.tsx +5 -8
  64. package/src/components/HTableBody/defaultRender.tsx +17 -7
  65. package/src/components/HTableBody/index.tsx +1 -1
  66. package/src/components/HTableBody/modal.ts +6 -7
  67. package/src/components/HTablePagination/index.tsx +7 -3
  68. package/src/components/Table.tsx +2 -2
  69. package/src/components/TableConfig.tsx +7 -3
  70. package/src/components/index.tsx +2 -0
  71. package/src/components/modal.ts +19 -8
  72. package/src/components/render/index.tsx +1 -0
  73. package/src/pages/DwTable/index.tsx +1 -0
  74. package/src/pages/EditTable/index.tsx +70 -0
  75. package/src/pages/ModalEditTable/index.tsx +84 -0
  76. package/src/pages/Table/index.tsx +30 -1
  77. package/src/routes.tsx +12 -0
@@ -0,0 +1,84 @@
1
+ import { ModalEditTable, useHDialogTable } from "@/components";
2
+ import { useState } from "react";
3
+
4
+ const dataSource = [
5
+ {
6
+ id: 1,
7
+ title: "1",
8
+ },
9
+ {
10
+ id: 2,
11
+ title: "2",
12
+ },
13
+ {
14
+ id: 3,
15
+ title: "3",
16
+ },
17
+ {
18
+ id: 4,
19
+ title: "4",
20
+ },
21
+ {
22
+ id: 5,
23
+ title: "5",
24
+ },
25
+ ];
26
+
27
+ export default () => {
28
+ const dialogTable = useHDialogTable();
29
+ const [cuData, setCuData] = useState(dataSource);
30
+
31
+ return (
32
+ <div>
33
+ <div
34
+ onClick={() => {
35
+ dialogTable.show();
36
+ }}
37
+ >
38
+ 点我
39
+ </div>
40
+ <ModalEditTable
41
+ title="编辑"
42
+ dataSource={cuData}
43
+ editTableProps={{
44
+ onAdd: (data) => {
45
+ console.log("addd");
46
+ const newData = [...cuData];
47
+ newData.push({
48
+ id: newData.length + 1,
49
+ ...data,
50
+ });
51
+ setCuData(newData);
52
+ },
53
+ onEdit: (data) => {
54
+ const index = cuData.findIndex((e) => e.id === data.id);
55
+ cuData[index] = data;
56
+ setCuData([...cuData]);
57
+ },
58
+ }}
59
+ dialogTable={dialogTable}
60
+ configData={[
61
+ { title: "标题", dataIndex: "title" },
62
+ { title: "标题2", dataIndex: "title1" },
63
+ {
64
+ title: "操作",
65
+ valueType: "option",
66
+ align: "center",
67
+ render: (text: any, record: any, _: any, action: any) => [
68
+ <a
69
+ key="editable"
70
+ type={"link"}
71
+ onClick={() => {
72
+ console.log(action);
73
+ action?.startEditable?.(record.id);
74
+ }}
75
+ >
76
+ 编辑
77
+ </a>,
78
+ ],
79
+ },
80
+ ]}
81
+ />
82
+ </div>
83
+ );
84
+ };
@@ -51,6 +51,31 @@ const Testd = (props) => {
51
51
  );
52
52
  };
53
53
  export const configData = [
54
+ {
55
+ title: "订单编号",
56
+ dataIndex: "childOrderNo",
57
+ showSearch: true,
58
+ valueType: "copy",
59
+ width: 120,
60
+ searchType: "selectInput",
61
+ name: "selectInput",
62
+ itemProps: {
63
+ placeholder: "请输入",
64
+ selectProps: {
65
+ options: [
66
+ {
67
+ label: "订单编号",
68
+ value: "orderNo",
69
+ },
70
+ {
71
+ label: "用户id",
72
+ value: "userId",
73
+ },
74
+ ],
75
+ style: { width: 88 },
76
+ },
77
+ },
78
+ },
54
79
  {
55
80
  title: "短信接收手机号",
56
81
  dataIndex: "mobileList",
@@ -188,9 +213,13 @@ export default () => {
188
213
  persistenceType: "localStorage",
189
214
  }}
190
215
  formInitValues={{
191
- deviceType: "1",
216
+ select: "orderNo",
192
217
  }}
193
218
  dataSource={[{}, {}, {}]}
219
+ request={(params) => {
220
+ console.log(params);
221
+ return Promise.resolve({});
222
+ }}
194
223
  headerTitle={
195
224
  <Space size={8}>
196
225
  <Button
package/src/routes.tsx CHANGED
@@ -4,6 +4,8 @@ import Table from "./pages/Table";
4
4
  import ModalTable from "./pages/ModalTable";
5
5
  import TableCustomize from "./pages/TableCustomize";
6
6
  import DwTable from "./pages/DwTable";
7
+ import EditTable from "./pages/EditTable";
8
+ import ModalEditTable from "./pages/ModalEditTable";
7
9
 
8
10
  export interface RouteModal {
9
11
  path?: string;
@@ -39,6 +41,16 @@ const routes: RouteModal[] = [
39
41
  name: "dwTable",
40
42
  element: <DwTable />,
41
43
  },
44
+ {
45
+ path: "/editTable",
46
+ name: "editTable",
47
+ element: <EditTable />,
48
+ },
49
+ {
50
+ path: "/modalEditTable",
51
+ name: "modalEditTable",
52
+ element: <ModalEditTable />,
53
+ },
42
54
  ];
43
55
 
44
56
  export default routes;