@hi-ui/table 4.2.0 → 4.3.1

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 (39) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/lib/cjs/BaseTable.js +127 -71
  3. package/lib/cjs/ColGroupContent.js +56 -0
  4. package/lib/cjs/Table.js +14 -3
  5. package/lib/cjs/TableBody.js +22 -75
  6. package/lib/cjs/TableHeader.js +5 -71
  7. package/lib/cjs/TbodyContent.js +129 -0
  8. package/lib/cjs/TheadContent.js +120 -0
  9. package/lib/cjs/hooks/use-col-width.js +27 -22
  10. package/lib/cjs/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js +1286 -0
  11. package/lib/cjs/packages/hooks/use-merge-refs/lib/esm/index.js +76 -0
  12. package/lib/cjs/packages/ui/scrollbar/lib/esm/Scrollbar.js +185 -0
  13. package/lib/cjs/packages/ui/scrollbar/lib/esm/styles/index.scss.js +42 -0
  14. package/lib/cjs/packages/ui/scrollbar/lib/esm/utils/index.js +81 -0
  15. package/lib/cjs/styles/index.scss.js +1 -1
  16. package/lib/cjs/use-table.js +39 -23
  17. package/lib/esm/BaseTable.js +124 -71
  18. package/lib/esm/ColGroupContent.js +37 -0
  19. package/lib/esm/Table.js +14 -3
  20. package/lib/esm/TableBody.js +19 -75
  21. package/lib/esm/TableHeader.js +5 -69
  22. package/lib/esm/TbodyContent.js +105 -0
  23. package/lib/esm/TheadContent.js +96 -0
  24. package/lib/esm/hooks/use-col-width.js +27 -22
  25. package/lib/esm/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js +1281 -0
  26. package/lib/esm/packages/hooks/use-merge-refs/lib/esm/index.js +68 -0
  27. package/lib/esm/packages/ui/scrollbar/lib/esm/Scrollbar.js +162 -0
  28. package/lib/esm/packages/ui/scrollbar/lib/esm/styles/index.scss.js +25 -0
  29. package/lib/esm/packages/ui/scrollbar/lib/esm/utils/index.js +76 -0
  30. package/lib/esm/styles/index.scss.js +1 -1
  31. package/lib/esm/use-table.js +33 -17
  32. package/lib/types/BaseTable.d.ts +4 -0
  33. package/lib/types/ColGroupContent.d.ts +8 -0
  34. package/lib/types/TbodyContent.d.ts +18 -0
  35. package/lib/types/TheadContent.d.ts +9 -0
  36. package/lib/types/context.d.ts +14 -8
  37. package/lib/types/hooks/use-col-width.d.ts +1 -1
  38. package/lib/types/use-table.d.ts +18 -6
  39. package/package.json +6 -6
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import { TableColumnItem, TableFrozenColumnOptions, TableRowEventData, TableRowSelection, FlattedTableColumnItemData, FlattedTableRowData } from './types';
3
2
  import { PaginationProps } from '@hi-ui/pagination';
4
- export declare const useTable: ({ data, columns: columnsProp, defaultFixedToColumn, fixedToColumn: fixedToColumnProp, onFixedToColumn, scrollWidth, resizable, errorRowKeys, highlightedColKeys: highlightedColKeysProp, highlightedRowKeys: highlightedRowKeysProp, showColHighlight, showRowHighlight, highlightRowOnDoubleClick, defaultExpandedRowKeys, expandedRowKeys: expandRowKeysProp, onExpand, defaultExpandAll, onLoadChildren, maxHeight, sticky, stickyTop, draggable, onDragStart, onDrop: onDropProp, onDropEnd, showColMenu, rowSelection, cellRender, fieldKey, virtual, ...rootProps }: UseTableProps) => {
3
+ import { ScrollbarProps } from '@hi-ui/scrollbar';
4
+ import { TableColumnItem, TableFrozenColumnOptions, TableRowEventData, TableRowSelection, FlattedTableColumnItemData, FlattedTableRowData } from './types';
5
+ export declare const useTable: ({ data, columns: columnsProp, defaultFixedToColumn, fixedToColumn: fixedToColumnProp, onFixedToColumn, scrollWidth, resizable, errorRowKeys, highlightedColKeys: highlightedColKeysProp, highlightedRowKeys: highlightedRowKeysProp, showColHighlight, showRowHighlight, highlightRowOnDoubleClick, defaultExpandedRowKeys, expandedRowKeys: expandRowKeysProp, onExpand, defaultExpandAll, onLoadChildren, maxHeight, sticky, stickyTop, draggable, onDragStart, onDrop: onDropProp, onDropEnd, showColMenu, rowSelection, cellRender, footerRender, fieldKey, virtual, scrollbar, ...rootProps }: UseTableProps) => {
5
6
  getColgroupProps: (column: FlattedTableColumnItemData, index: number) => {
6
7
  style: {
7
8
  width: number | undefined;
@@ -38,8 +39,11 @@ export declare const useTable: ({ data, columns: columnsProp, defaultFixedToColu
38
39
  onColumnResizable: (_: any, { size }: any, index: number) => void;
39
40
  isTree: boolean;
40
41
  cellRender: ((text: any) => React.ReactNode) | undefined;
42
+ footerRender: ((...nodes: React.ReactElement[]) => React.ReactNode) | undefined;
41
43
  showColMenu: boolean | undefined;
42
44
  onLoadChildren: ((item: TableRowEventData) => Promise<any[] | void> | void) | undefined;
45
+ setHeaderTableElement: React.Dispatch<React.SetStateAction<HTMLTableRowElement | null>>;
46
+ scrollbar: boolean | ScrollbarProps | undefined;
43
47
  scrollLeft: number;
44
48
  scrollRight: number;
45
49
  measureRowElementRef: React.MutableRefObject<HTMLTableRowElement | null>;
@@ -98,10 +102,10 @@ export declare const useTable: ({ data, columns: columnsProp, defaultFixedToColu
98
102
  scrollLeft: number;
99
103
  scrollRight: number;
100
104
  };
101
- leftFrozenColKeys: any[];
102
- rightFrozenColKeys: any[];
103
- leftFixedColumnsWidth: number;
104
- rightFixedColumnsWidth: number;
105
+ leftFrozenColKeys: any[] | never[];
106
+ rightFrozenColKeys: any[] | never[];
107
+ leftFixedColumnsWidth: number | undefined;
108
+ rightFixedColumnsWidth: number | undefined;
105
109
  };
106
110
  export interface UseTableProps {
107
111
  /**
@@ -267,5 +271,13 @@ export interface UseTableProps {
267
271
  * 点击异步加载子项
268
272
  */
269
273
  onLoadChildren?: (item: TableRowEventData) => Promise<any[] | void> | void;
274
+ /**
275
+ * 自定义渲染页脚
276
+ */
277
+ footerRender?: (...nodes: React.ReactElement[]) => React.ReactNode;
278
+ /**
279
+ * 配置滚动条,滚动条样式使用HiUI自带的滚动条风格
280
+ */
281
+ scrollbar?: boolean | ScrollbarProps;
270
282
  }
271
283
  export declare type UseTableReturn = ReturnType<typeof useTable>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/table",
3
- "version": "4.2.0",
3
+ "version": "4.3.1",
4
4
  "description": "A sub-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HiUI <mi-hiui@xiaomi.com>",
@@ -44,7 +44,7 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@hi-ui/array-utils": "^4.0.1",
47
- "@hi-ui/button": "^4.0.5",
47
+ "@hi-ui/button": "^4.0.6",
48
48
  "@hi-ui/checkbox": "^4.0.5",
49
49
  "@hi-ui/classname": "^4.0.1",
50
50
  "@hi-ui/dom-utils": "^4.0.4",
@@ -52,14 +52,14 @@
52
52
  "@hi-ui/empty-state": "^4.0.4",
53
53
  "@hi-ui/env": "^4.0.1",
54
54
  "@hi-ui/func-utils": "^4.0.1",
55
- "@hi-ui/icon-button": "^4.0.4",
55
+ "@hi-ui/icon-button": "^4.0.5",
56
56
  "@hi-ui/icons": "^4.0.14",
57
57
  "@hi-ui/loading": "^4.1.0",
58
58
  "@hi-ui/object-utils": "^4.0.1",
59
- "@hi-ui/pagination": "^4.0.8",
59
+ "@hi-ui/pagination": "^4.0.11",
60
60
  "@hi-ui/popper": "^4.1.0",
61
61
  "@hi-ui/react-utils": "^4.0.1",
62
- "@hi-ui/select": "^4.2.0",
62
+ "@hi-ui/select": "^4.2.2",
63
63
  "@hi-ui/spinner": "^4.0.4",
64
64
  "@hi-ui/times": "^4.0.1",
65
65
  "@hi-ui/tree-utils": "^4.1.1",
@@ -82,7 +82,7 @@
82
82
  },
83
83
  "devDependencies": {
84
84
  "@hi-ui/core": "^4.0.4",
85
- "@hi-ui/core-css": "^4.1.1",
85
+ "@hi-ui/core-css": "^4.1.2",
86
86
  "@types/react-resizable": "^1.7.4",
87
87
  "react": "^17.0.1",
88
88
  "react-dom": "^17.0.1"