@hi-ui/table 4.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @hi-ui/table
2
2
 
3
+ ## 4.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#2654](https://github.com/XiaoMi/hiui/pull/2654) [`dc002a32a`](https://github.com/XiaoMi/hiui/commit/dc002a32a2c6f538b0df37c63d34f603647d9b70) Thanks [@zyprepare](https://github.com/zyprepare)! - feat: 增加 scrollbar 参数,用于在 Windows 环境下优化滚动条样式
8
+
9
+ - Updated dependencies [[`b477d91db`](https://github.com/XiaoMi/hiui/commit/b477d91db15bbc92c8712a9a771af5b332779315)]:
10
+ - @hi-ui/button@4.0.6
11
+ - @hi-ui/icon-button@4.0.5
12
+ - @hi-ui/pagination@4.0.11
13
+
3
14
  ## 4.3.0
4
15
 
5
16
  ### Minor Changes
@@ -27,6 +27,10 @@ var useLatest = require('@hi-ui/use-latest');
27
27
 
28
28
  var typeAssertion = require('@hi-ui/type-assertion');
29
29
 
30
+ require('./packages/ui/scrollbar/lib/esm/styles/index.scss.js');
31
+
32
+ var Scrollbar = require('./packages/ui/scrollbar/lib/esm/Scrollbar.js');
33
+
30
34
  var TableRow = require('./TableRow.js');
31
35
 
32
36
  var context = require('./context.js');
@@ -67,7 +71,8 @@ var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
67
71
  scrollWidth = _useTableContext.scrollWidth,
68
72
  colWidths = _useTableContext.colWidths,
69
73
  virtual = _useTableContext.virtual,
70
- measureRowElementRef = _useTableContext.measureRowElementRef;
74
+ measureRowElementRef = _useTableContext.measureRowElementRef,
75
+ scrollbar = _useTableContext.scrollbar;
71
76
 
72
77
  var cls = classname.cx(prefixCls + "-body");
73
78
  var getRequiredProps = useLatest.useLatestCallback(function (id) {
@@ -160,24 +165,24 @@ var TableBody = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
160
165
  }, scrollBodyElementRef.current ? {
161
166
  scrollBodyWidth: window.getComputedStyle(scrollBodyElementRef.current).getPropertyValue('width')
162
167
  } : {})));
163
- } // 外层增加 div 作为滚动容器
164
-
168
+ }
165
169
 
166
- return /*#__PURE__*/React__default["default"].createElement("div", {
170
+ var bodyContent = /*#__PURE__*/React__default["default"].createElement("table", {
171
+ ref: bodyTableRef,
172
+ style: {
173
+ width: canScroll && scrollWidth !== undefined ? scrollWidth : '100%'
174
+ }
175
+ }, /*#__PURE__*/React__default["default"].createElement(ColGroupContent.ColGroupContent, null), /*#__PURE__*/React__default["default"].createElement(TbodyContent.TbodyContent, null));
176
+ var scrollBodyProps = {
167
177
  ref: scrollBodyElementRef,
168
178
  className: cls,
169
179
  onScroll: onTableBodyScroll,
170
180
  style: {
171
- maxHeight: maxHeight !== undefined ? maxHeight : undefined,
172
- // 表格宽度大于div宽度才出现横向滚动条
173
- overflowX: canScroll ? 'scroll' : undefined
174
- }
175
- }, /*#__PURE__*/React__default["default"].createElement("table", {
176
- ref: bodyTableRef,
177
- style: {
178
- width: canScroll && scrollWidth !== undefined ? scrollWidth : '100%'
181
+ maxHeight: maxHeight
179
182
  }
180
- }, /*#__PURE__*/React__default["default"].createElement(ColGroupContent.ColGroupContent, null), /*#__PURE__*/React__default["default"].createElement(TbodyContent.TbodyContent, null)));
183
+ }; // 外层增加 div 作为滚动容器
184
+
185
+ return !scrollbar ? /*#__PURE__*/React__default["default"].createElement("div", Object.assign({}, scrollBodyProps), bodyContent) : /*#__PURE__*/React__default["default"].createElement(Scrollbar.Scrollbar, Object.assign({}, scrollBodyProps, typeAssertion.isObject(scrollbar) ? scrollbar : null), bodyContent);
181
186
  });
182
187
 
183
188
  if (env.__DEV__) {