@hi-ui/table 4.0.2 → 4.0.5

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.
@@ -64,6 +64,7 @@ var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
64
64
  onTableBodyScroll = _useTableContext.onTableBodyScroll,
65
65
  maxHeight = _useTableContext.maxHeight,
66
66
  canScroll = _useTableContext.canScroll,
67
+ scrollWidth = _useTableContext.scrollWidth,
67
68
  hasAvgColumn = _useTableContext.hasAvgColumn,
68
69
  avgRow = _useTableContext.avgRow,
69
70
  hasSumColumn = _useTableContext.hasSumColumn,
@@ -96,7 +97,7 @@ var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
96
97
  }, /*#__PURE__*/React__default["default"].createElement("table", {
97
98
  ref: bodyTableRef,
98
99
  style: {
99
- width: '100%'
100
+ width: canScroll && scrollWidth !== undefined ? scrollWidth : '100%'
100
101
  }
101
102
  }, /*#__PURE__*/React__default["default"].createElement("colgroup", null, leafColumns.map(function (col, idx) {
102
103
  return /*#__PURE__*/React__default["default"].createElement("col", Object.assign({
@@ -529,6 +529,7 @@ var useTable = function useTable(_a) {
529
529
  }, [activeSorterColumn, activeSorterType, transitionData, columns]);
530
530
  return Object.assign(Object.assign({
531
531
  rootProps: rootProps,
532
+ scrollWidth: scrollWidth,
532
533
  activeSorterColumn: activeSorterColumn,
533
534
  setActiveSorterColumn: setActiveSorterColumn,
534
535
  activeSorterType: activeSorterType,
@@ -40,6 +40,7 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
40
40
  onTableBodyScroll = _useTableContext.onTableBodyScroll,
41
41
  maxHeight = _useTableContext.maxHeight,
42
42
  canScroll = _useTableContext.canScroll,
43
+ scrollWidth = _useTableContext.scrollWidth,
43
44
  hasAvgColumn = _useTableContext.hasAvgColumn,
44
45
  avgRow = _useTableContext.avgRow,
45
46
  hasSumColumn = _useTableContext.hasSumColumn,
@@ -72,7 +73,7 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
72
73
  }, /*#__PURE__*/React.createElement("table", {
73
74
  ref: bodyTableRef,
74
75
  style: {
75
- width: '100%'
76
+ width: canScroll && scrollWidth !== undefined ? scrollWidth : '100%'
76
77
  }
77
78
  }, /*#__PURE__*/React.createElement("colgroup", null, leafColumns.map(function (col, idx) {
78
79
  return /*#__PURE__*/React.createElement("col", Object.assign({
@@ -497,6 +497,7 @@ var useTable = function useTable(_a) {
497
497
  }, [activeSorterColumn, activeSorterType, transitionData, columns]);
498
498
  return Object.assign(Object.assign({
499
499
  rootProps: rootProps,
500
+ scrollWidth: scrollWidth,
500
501
  activeSorterColumn: activeSorterColumn,
501
502
  setActiveSorterColumn: setActiveSorterColumn,
502
503
  activeSorterType: activeSorterType,
@@ -48,6 +48,7 @@ export declare const TableProvider: import("react").Provider<(Omit<{
48
48
  loading?: boolean | undefined;
49
49
  uniqueId?: string | undefined;
50
50
  };
51
+ scrollWidth: number | undefined;
51
52
  activeSorterColumn: string | null;
52
53
  setActiveSorterColumn: import("react").Dispatch<import("react").SetStateAction<string | null>>;
53
54
  activeSorterType: string | null;
@@ -151,6 +152,7 @@ export declare const useTableContext: () => Omit<{
151
152
  loading?: boolean | undefined;
152
153
  uniqueId?: string | undefined;
153
154
  };
155
+ scrollWidth: number | undefined;
154
156
  activeSorterColumn: string | null;
155
157
  setActiveSorterColumn: import("react").Dispatch<import("react").SetStateAction<string | null>>;
156
158
  activeSorterType: string | null;
@@ -64,6 +64,7 @@ export declare const useTable: ({ data, columns: columnsProp, defaultFixedToColu
64
64
  */
65
65
  uniqueId?: string | undefined;
66
66
  };
67
+ scrollWidth: number | undefined;
67
68
  activeSorterColumn: string | null;
68
69
  setActiveSorterColumn: React.Dispatch<React.SetStateAction<string | null>>;
69
70
  activeSorterType: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/table",
3
- "version": "4.0.2",
3
+ "version": "4.0.5",
4
4
  "description": "A sub-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HiUI <mi-hiui@xiaomi.com>",
@@ -43,35 +43,35 @@
43
43
  "url": "https://github.com/XiaoMi/hiui/issues"
44
44
  },
45
45
  "dependencies": {
46
- "@hi-ui/array-utils": "^4.0.0",
47
- "@hi-ui/button": "^4.0.1",
48
- "@hi-ui/checkbox": "^4.0.0",
49
- "@hi-ui/classname": "^4.0.0",
50
- "@hi-ui/dom-utils": "^4.0.0",
51
- "@hi-ui/drawer": "^4.0.1",
52
- "@hi-ui/empty-state": "^4.0.0",
53
- "@hi-ui/env": "^4.0.0",
54
- "@hi-ui/func-utils": "^4.0.0",
55
- "@hi-ui/icon-button": "^4.0.0",
56
- "@hi-ui/icons": "^4.0.0",
57
- "@hi-ui/loading": "^4.0.0",
58
- "@hi-ui/object-utils": "^4.0.0",
59
- "@hi-ui/pagination": "^4.0.1",
60
- "@hi-ui/popper": "^4.0.0",
61
- "@hi-ui/react-utils": "^4.0.0",
62
- "@hi-ui/select": "^4.0.1",
63
- "@hi-ui/spinner": "^4.0.0",
64
- "@hi-ui/times": "^4.0.0",
65
- "@hi-ui/tree-utils": "^4.0.0",
66
- "@hi-ui/type-assertion": "^4.0.0",
67
- "@hi-ui/use-cache": "^4.0.0",
68
- "@hi-ui/use-check": "^4.0.0",
69
- "@hi-ui/use-check-state": "^4.0.0",
70
- "@hi-ui/use-drag-sorter": "^4.0.0",
71
- "@hi-ui/use-latest": "^4.0.0",
72
- "@hi-ui/use-toggle": "^4.0.0",
73
- "@hi-ui/use-uncontrolled-state": "^4.0.0",
74
- "@hi-ui/use-update-effect": "^4.0.0",
46
+ "@hi-ui/array-utils": "^4.0.1",
47
+ "@hi-ui/button": "^4.0.3",
48
+ "@hi-ui/checkbox": "^4.0.2",
49
+ "@hi-ui/classname": "^4.0.1",
50
+ "@hi-ui/dom-utils": "^4.0.2",
51
+ "@hi-ui/drawer": "^4.0.3",
52
+ "@hi-ui/empty-state": "^4.0.2",
53
+ "@hi-ui/env": "^4.0.1",
54
+ "@hi-ui/func-utils": "^4.0.1",
55
+ "@hi-ui/icon-button": "^4.0.2",
56
+ "@hi-ui/icons": "^4.0.2",
57
+ "@hi-ui/loading": "^4.0.2",
58
+ "@hi-ui/object-utils": "^4.0.1",
59
+ "@hi-ui/pagination": "^4.0.3",
60
+ "@hi-ui/popper": "^4.0.2",
61
+ "@hi-ui/react-utils": "^4.0.1",
62
+ "@hi-ui/select": "^4.0.3",
63
+ "@hi-ui/spinner": "^4.0.2",
64
+ "@hi-ui/times": "^4.0.1",
65
+ "@hi-ui/tree-utils": "^4.0.1",
66
+ "@hi-ui/type-assertion": "^4.0.1",
67
+ "@hi-ui/use-cache": "^4.0.1",
68
+ "@hi-ui/use-check": "^4.0.1",
69
+ "@hi-ui/use-check-state": "^4.0.1",
70
+ "@hi-ui/use-drag-sorter": "^4.0.1",
71
+ "@hi-ui/use-latest": "^4.0.1",
72
+ "@hi-ui/use-toggle": "^4.0.1",
73
+ "@hi-ui/use-uncontrolled-state": "^4.0.1",
74
+ "@hi-ui/use-update-effect": "^4.0.1",
75
75
  "axios": "^0.24.0",
76
76
  "react-resizable": "^3.0.4"
77
77
  },
@@ -81,12 +81,12 @@
81
81
  "react-dom": ">=16.8.6"
82
82
  },
83
83
  "devDependencies": {
84
- "@hi-ui/core": "^4.0.0",
85
- "@hi-ui/core-css": "^4.0.0",
86
- "@hi-ui/hi-build": "^4.0.0",
84
+ "@hi-ui/core": "^4.0.2",
85
+ "@hi-ui/core-css": "^4.0.1",
86
+ "@hi-ui/hi-build": "^4.0.1",
87
87
  "@types/react-resizable": "^1.7.4",
88
88
  "react": "^17.0.1",
89
89
  "react-dom": "^17.0.1"
90
90
  },
91
- "gitHead": "318d9e83b849d81605731b2c2beaa04df5701072"
91
+ "gitHead": "7d841458bef1853b31426203cb0a9dc2b9820908"
92
92
  }