@hw-component/table 0.0.1-beta-v1

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 (80) hide show
  1. package/.babelrc +23 -0
  2. package/.eslintrc.js +8 -0
  3. package/.husky/pre-commit +4 -0
  4. package/.stylelintrc.js +5 -0
  5. package/README.en.md +36 -0
  6. package/README.md +37 -0
  7. package/es/Body/hooks.d.ts +1167 -0
  8. package/es/Body/hooks.js +51 -0
  9. package/es/Body/index.d.ts +12 -0
  10. package/es/Body/index.js +117 -0
  11. package/es/Footer/index.d.ts +6 -0
  12. package/es/Footer/index.js +65 -0
  13. package/es/Header/index.d.ts +9 -0
  14. package/es/Header/index.js +42 -0
  15. package/es/Header/utils.d.ts +7 -0
  16. package/es/Header/utils.js +67 -0
  17. package/es/Table.d.ts +3 -0
  18. package/es/Table.js +98 -0
  19. package/es/TableConfig.d.ts +13 -0
  20. package/es/TableConfig.js +29 -0
  21. package/es/context.d.ts +12 -0
  22. package/es/context.js +11 -0
  23. package/es/hooks/useCurrentTable.d.ts +7 -0
  24. package/es/hooks/useCurrentTable.js +17 -0
  25. package/es/hooks/useHTable.d.ts +8 -0
  26. package/es/hooks/useHTable.js +21 -0
  27. package/es/hooks/useRowObj.d.ts +7 -0
  28. package/es/hooks/useRowObj.js +23 -0
  29. package/es/index.d.ts +3 -0
  30. package/es/index.js +5 -0
  31. package/es/modal.d.ts +45 -0
  32. package/lib/Body/hooks.d.ts +1167 -0
  33. package/lib/Body/hooks.js +53 -0
  34. package/lib/Body/index.d.ts +12 -0
  35. package/lib/Body/index.js +120 -0
  36. package/lib/Footer/index.d.ts +6 -0
  37. package/lib/Footer/index.js +68 -0
  38. package/lib/Header/index.d.ts +9 -0
  39. package/lib/Header/index.js +45 -0
  40. package/lib/Header/utils.d.ts +7 -0
  41. package/lib/Header/utils.js +69 -0
  42. package/lib/Table.d.ts +3 -0
  43. package/lib/Table.js +101 -0
  44. package/lib/TableConfig.d.ts +13 -0
  45. package/lib/TableConfig.js +34 -0
  46. package/lib/context.d.ts +12 -0
  47. package/lib/context.js +13 -0
  48. package/lib/hooks/useCurrentTable.d.ts +7 -0
  49. package/lib/hooks/useCurrentTable.js +20 -0
  50. package/lib/hooks/useHTable.d.ts +8 -0
  51. package/lib/hooks/useHTable.js +24 -0
  52. package/lib/hooks/useRowObj.d.ts +7 -0
  53. package/lib/hooks/useRowObj.js +26 -0
  54. package/lib/index.d.ts +3 -0
  55. package/lib/index.js +12 -0
  56. package/lib/modal.d.ts +45 -0
  57. package/package.json +89 -0
  58. package/public/index.html +19 -0
  59. package/scripts/rollup.config.js +90 -0
  60. package/scripts/webpack.config.js +75 -0
  61. package/src/Layout.tsx +61 -0
  62. package/src/app.tsx +33 -0
  63. package/src/components/Body/hooks.ts +44 -0
  64. package/src/components/Body/index.tsx +85 -0
  65. package/src/components/Footer/index.tsx +43 -0
  66. package/src/components/Header/index.tsx +45 -0
  67. package/src/components/Header/utils.ts +58 -0
  68. package/src/components/Table.tsx +65 -0
  69. package/src/components/TableConfig.tsx +30 -0
  70. package/src/components/context.ts +17 -0
  71. package/src/components/hooks/useCurrentTable.ts +16 -0
  72. package/src/components/hooks/useHTable.tsx +18 -0
  73. package/src/components/hooks/useRowObj.ts +17 -0
  74. package/src/components/index.tsx +3 -0
  75. package/src/components/modal.ts +58 -0
  76. package/src/index.less +20 -0
  77. package/src/index.tsx +12 -0
  78. package/src/pages/Test/index.tsx +55 -0
  79. package/src/routes.tsx +26 -0
  80. package/tsconfig.json +29 -0
package/es/modal.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ import type { ProColumns } from "@ant-design/pro-table/lib/typing";
2
+ import type { ProTableProps } from "@ant-design/pro-table";
3
+ import type { HItemProps, HFormInstance } from "@hw-component/form/es/Form/modal";
4
+ import type { ColProps } from "antd";
5
+ import type React from "react";
6
+ export interface RowObj {
7
+ keys?: React.Key[];
8
+ rowData?: any[];
9
+ }
10
+ export interface ResultModal {
11
+ records: any[];
12
+ current: string;
13
+ size: string;
14
+ total: string;
15
+ }
16
+ export interface ParamsModal extends Record<string, any> {
17
+ size?: number;
18
+ current?: number;
19
+ }
20
+ interface HColumns extends Omit<ProColumns, "render"> {
21
+ render?: (dom: React.ReactNode, data: any, index: number, table: HTableInstance) => React.ReactNode;
22
+ showSearch?: boolean;
23
+ searchType?: HItemProps["type"];
24
+ searchRender?: HItemProps["render"];
25
+ }
26
+ export type ConfigItemModal = Omit<HItemProps, "render" | "type"> & HColumns;
27
+ export type ConfigDataModal = ConfigItemModal[];
28
+ export type ActionRenderFn = (allCheck: boolean, selectedRowKeys: RowObj, xjTable: HTableInstance) => React.ReactNode;
29
+ export interface HTableProps extends Omit<ProTableProps<any, any>, "request"> {
30
+ request: (params: ParamsModal) => Promise<ResultModal>;
31
+ configData: ConfigDataModal;
32
+ searchSpan?: ColProps;
33
+ table?: HTableInstance;
34
+ actionRender?: ActionRenderFn;
35
+ emptyRender?: (table: HTableInstance) => React.ReactNode;
36
+ errorRender?: (table: HTableInstance) => React.ReactNode;
37
+ }
38
+ export interface TableInstance {
39
+ reload: (params: ParamsModal) => void;
40
+ }
41
+ export interface HTableInstance {
42
+ form: HFormInstance;
43
+ table: TableInstance;
44
+ }
45
+ export {};