@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.
@@ -0,0 +1,76 @@
1
+ /** @LICENSE
2
+ * @hi-ui/table
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
4
+ *
5
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ 'use strict';
11
+
12
+ Object.defineProperty(exports, '__esModule', {
13
+ value: true
14
+ });
15
+
16
+ var React = require('react');
17
+ /** @LICENSE
18
+ * @hi-ui/use-merge-refs
19
+ * https://github.com/XiaoMi/hiui/tree/master/packages/hooks/use-merge-refs#readme
20
+ *
21
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
22
+ *
23
+ * This source code is licensed under the MIT license found in the
24
+ * LICENSE file in the root directory of this source tree.
25
+ */
26
+
27
+ /**
28
+ * A hook to merge multiple refs into a single function ref.
29
+ *
30
+ * @param refs
31
+ */
32
+
33
+
34
+ var useMergeRefs = function useMergeRefs() {
35
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
36
+ refs[_key] = arguments[_key];
37
+ }
38
+
39
+ return React.useMemo(function () {
40
+ return mergeRefs.apply(void 0, refs);
41
+ }, refs);
42
+ };
43
+ /**
44
+ * Merges multiple refs into a single function ref.
45
+ *
46
+ * @param refs
47
+ * @returns
48
+ */
49
+
50
+
51
+ function mergeRefs() {
52
+ for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
53
+ refs[_key2] = arguments[_key2];
54
+ } // Empty check
55
+
56
+
57
+ if (refs.some(function (ref) {
58
+ return ref;
59
+ }) === false) return null;
60
+ return function (value) {
61
+ refs.forEach(function (ref) {
62
+ setRef(ref, value);
63
+ });
64
+ };
65
+ }
66
+
67
+ function setRef(ref, value) {
68
+ if (typeof ref === 'function') {
69
+ ref(value);
70
+ } else if (ref) {
71
+ ref.current = value;
72
+ }
73
+ }
74
+
75
+ exports.mergeRefs = mergeRefs;
76
+ exports.useMergeRefs = useMergeRefs;
@@ -0,0 +1,185 @@
1
+ /** @LICENSE
2
+ * @hi-ui/table
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
4
+ *
5
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ 'use strict';
11
+
12
+ var _typeof = require("@babel/runtime/helpers/typeof");
13
+
14
+ Object.defineProperty(exports, '__esModule', {
15
+ value: true
16
+ });
17
+
18
+ var tslib = require('tslib');
19
+
20
+ var React = require('react');
21
+
22
+ var classname = require('@hi-ui/classname');
23
+
24
+ var env = require('@hi-ui/env');
25
+
26
+ var index$1 = require('../../../../hooks/use-merge-refs/lib/esm/index.js');
27
+
28
+ var perfectScrollbar_esm = require('../../../../../node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js');
29
+
30
+ var index = require('./utils/index.js');
31
+
32
+ function _interopDefaultLegacy(e) {
33
+ return e && _typeof(e) === 'object' && 'default' in e ? e : {
34
+ 'default': e
35
+ };
36
+ }
37
+
38
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
39
+ /** @LICENSE
40
+ * @hi-ui/scrollbar
41
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/scrollbar#readme
42
+ *
43
+ * Copyright (c) HIUI <mi-hiui@xiaomi.com>.
44
+ *
45
+ * This source code is licensed under the MIT license found in the
46
+ * LICENSE file in the root directory of this source tree.
47
+ */
48
+
49
+
50
+ var SCROLLBAR_PREFIX = classname.getPrefixCls('scrollbar');
51
+ var Scrollbar = /*#__PURE__*/React.forwardRef(function (_a, ref) {
52
+ var _cx;
53
+
54
+ var _a$prefixCls = _a.prefixCls,
55
+ prefixCls = _a$prefixCls === void 0 ? SCROLLBAR_PREFIX : _a$prefixCls,
56
+ _a$role = _a.role,
57
+ role = _a$role === void 0 ? 'scrollbar' : _a$role,
58
+ _a$position = _a.position,
59
+ position = _a$position === void 0 ? 'relative' : _a$position,
60
+ _a$axes = _a.axes,
61
+ axes = _a$axes === void 0 ? 'both' : _a$axes,
62
+ _a$keepVisible = _a.keepVisible,
63
+ keepVisible = _a$keepVisible === void 0 ? false : _a$keepVisible,
64
+ _a$onlyScrollVisible = _a.onlyScrollVisible,
65
+ onlyScrollVisible = _a$onlyScrollVisible === void 0 ? false : _a$onlyScrollVisible,
66
+ className = _a.className,
67
+ children = _a.children,
68
+ style = _a.style,
69
+ innerRef = _a.innerRef,
70
+ rest = tslib.__rest(_a, ["prefixCls", "role", "position", "axes", "keepVisible", "onlyScrollVisible", "className", "children", "style", "innerRef"]);
71
+
72
+ var cls = classname.cx(prefixCls, className, 'priority', (_cx = {}, _cx[prefixCls + "--keep-visible"] = keepVisible, _cx[prefixCls + "--only-scroll-visible"] = !keepVisible && onlyScrollVisible, _cx));
73
+
74
+ var _useState = React.useState(undefined),
75
+ ps = _useState[0],
76
+ setPs = _useState[1];
77
+
78
+ var _useState2 = React.useState(null),
79
+ containerElement = _useState2[0],
80
+ setContainer = _useState2[1];
81
+
82
+ var _useState3 = React.useState(null),
83
+ wrapperElement = _useState3[0],
84
+ setWrapperElement = _useState3[1];
85
+
86
+ var eventPropsRef = React.useRef({});
87
+ React.useEffect(function () {
88
+ if (containerElement) {
89
+ setPs(new perfectScrollbar_esm["default"](containerElement));
90
+ }
91
+ }, [containerElement]); // 轴定制
92
+
93
+ React.useEffect(function () {
94
+ if (ps) {
95
+ ps.settings.suppressScrollX = true;
96
+ ps.settings.suppressScrollY = true;
97
+
98
+ if (axes === 'both' || axes === 'x') {
99
+ ps.settings.suppressScrollX = false;
100
+ }
101
+
102
+ if (axes === 'both' || axes === 'y') {
103
+ ps.settings.suppressScrollY = false;
104
+ }
105
+
106
+ ps.update();
107
+ }
108
+ }, [ps, axes]); // 监听容器以及内容尺寸
109
+
110
+ React.useEffect(function () {
111
+ if (ps && wrapperElement && containerElement) {
112
+ var observer = new ResizeObserver(function (entries) {
113
+ ps.update();
114
+ });
115
+ observer.observe(containerElement);
116
+ observer.observe(wrapperElement);
117
+ return function () {
118
+ observer.disconnect();
119
+ };
120
+ }
121
+ }, [ps, wrapperElement, containerElement]);
122
+ React.useImperativeHandle(innerRef, function () {
123
+ return {
124
+ instance: ps,
125
+ containerElement: containerElement || undefined
126
+ };
127
+ }, [ps, containerElement]);
128
+
129
+ var _useMemo = React.useMemo(function () {
130
+ var eventProps = {};
131
+ var injectProps = {};
132
+ var eventNames = Object.keys(index.ScrollbarEventToPsMap);
133
+
134
+ for (var _i = 0, _Object$keys = Object.keys(rest); _i < _Object$keys.length; _i++) {
135
+ var propsName = _Object$keys[_i];
136
+
137
+ if (eventNames.includes(propsName)) {
138
+ eventProps[propsName] = rest[propsName];
139
+ } else {
140
+ injectProps[propsName] = rest[propsName];
141
+ }
142
+ }
143
+
144
+ return {
145
+ eventProps: eventProps,
146
+ injectProps: injectProps
147
+ };
148
+ }, [rest]),
149
+ eventProps = _useMemo.eventProps,
150
+ injectProps = _useMemo.injectProps; // 更新event props引用
151
+
152
+
153
+ React.useEffect(function () {
154
+ eventPropsRef.current = eventProps;
155
+ }, [eventProps]); // 注册监听事件
156
+
157
+ React.useEffect(function () {
158
+ if (containerElement) {
159
+ Object.keys(index.ScrollbarEventToPsMap).forEach(function (event) {
160
+ containerElement.addEventListener(index.ScrollbarEventToPsMap[event], function (e) {
161
+ var _a, _b;
162
+
163
+ (_b = (_a = eventPropsRef.current)[event]) === null || _b === void 0 ? void 0 : _b.call(_a, e);
164
+ });
165
+ });
166
+ }
167
+ }, [containerElement]);
168
+ return /*#__PURE__*/React__default["default"].createElement("div", Object.assign({
169
+ ref: index$1.useMergeRefs(setContainer, ref),
170
+ role: role,
171
+ className: cls,
172
+ style: Object.assign(Object.assign({}, style), {
173
+ position: position
174
+ })
175
+ }, injectProps), /*#__PURE__*/React__default["default"].createElement("div", {
176
+ className: prefixCls + "__wrapper",
177
+ ref: setWrapperElement
178
+ }, children));
179
+ });
180
+
181
+ if (env.__DEV__) {
182
+ Scrollbar.displayName = 'Scrollbar';
183
+ }
184
+
185
+ exports.Scrollbar = Scrollbar;
@@ -0,0 +1,42 @@
1
+ /** @LICENSE
2
+ * @hi-ui/table
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
4
+ *
5
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ 'use strict';
11
+
12
+ var _typeof = require("@babel/runtime/helpers/typeof");
13
+
14
+ Object.defineProperty(exports, '__esModule', {
15
+ value: true
16
+ });
17
+
18
+ var __styleInject__ = require('style-inject');
19
+
20
+ function _interopDefaultLegacy(e) {
21
+ return e && _typeof(e) === 'object' && 'default' in e ? e : {
22
+ 'default': e
23
+ };
24
+ }
25
+
26
+ var __styleInject____default = /*#__PURE__*/_interopDefaultLegacy(__styleInject__);
27
+ /** @LICENSE
28
+ * @hi-ui/scrollbar
29
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/scrollbar#readme
30
+ *
31
+ * Copyright (c) HIUI <mi-hiui@xiaomi.com>.
32
+ *
33
+ * This source code is licensed under the MIT license found in the
34
+ * LICENSE file in the root directory of this source tree.
35
+ */
36
+
37
+
38
+ var css_248z = "/** Container style*/.ps {overflow: hidden !important;overflow-anchor: none;-ms-overflow-style: none;touch-action: auto;-ms-touch-action: auto;}/** Scrollbar rail styles*/.ps__rail-x {display: none;opacity: 0;transition: background-color 0.2s linear, opacity 0.2s linear;-webkit-transition: background-color 0.2s linear, opacity 0.2s linear;height: 15px;/* there must be 'bottom' or 'top' for ps__rail-x */bottom: 0px;/* please don't change 'position' */position: absolute;}.ps__rail-y {display: none;opacity: 0;transition: background-color 0.2s linear, opacity 0.2s linear;-webkit-transition: background-color 0.2s linear, opacity 0.2s linear;width: 15px;/* there must be 'right' or 'left' for ps__rail-y */right: 0;/* please don't change 'position' */position: absolute;}.ps--active-x > .ps__rail-x,.ps--active-y > .ps__rail-y {display: block;background-color: transparent;}.ps:hover > .ps__rail-x,.ps:hover > .ps__rail-y,.ps--focus > .ps__rail-x,.ps--focus > .ps__rail-y,.ps--scrolling-x > .ps__rail-x,.ps--scrolling-y > .ps__rail-y {opacity: 0.6;}.ps .ps__rail-x:hover,.ps .ps__rail-y:hover,.ps .ps__rail-x:focus,.ps .ps__rail-y:focus,.ps .ps__rail-x.ps--clicking,.ps .ps__rail-y.ps--clicking {background-color: #eee;opacity: 0.9;}/** Scrollbar thumb styles*/.ps__thumb-x {background-color: #aaa;border-radius: 6px;transition: background-color 0.2s linear, height 0.2s ease-in-out;-webkit-transition: background-color 0.2s linear, height 0.2s ease-in-out;height: 6px;/* there must be 'bottom' for ps__thumb-x */bottom: 2px;/* please don't change 'position' */position: absolute;}.ps__thumb-y {background-color: #aaa;border-radius: 6px;transition: background-color 0.2s linear, width 0.2s ease-in-out;-webkit-transition: background-color 0.2s linear, width 0.2s ease-in-out;width: 6px;/* there must be 'right' for ps__thumb-y */right: 2px;/* please don't change 'position' */position: absolute;}.ps__rail-x:hover > .ps__thumb-x,.ps__rail-x:focus > .ps__thumb-x,.ps__rail-x.ps--clicking .ps__thumb-x {background-color: #999;height: 11px;}.ps__rail-y:hover > .ps__thumb-y,.ps__rail-y:focus > .ps__thumb-y,.ps__rail-y.ps--clicking .ps__thumb-y {background-color: #999;width: 11px;}/* MS supports */@supports (-ms-overflow-style: none) {.ps {overflow: auto !important;}}@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {.ps {overflow: auto !important;}}.hi-v4-scrollbar {overflow: hidden;width: 100%;height: 100%;}.hi-v4-scrollbar__wrapper {width: -webkit-fit-content;width: -moz-fit-content;width: fit-content;height: -webkit-fit-content;height: -moz-fit-content;height: fit-content;min-width: 100%;min-height: 100%;}.hi-v4-scrollbar--keep-visible.priority > .ps__rail-y, .hi-v4-scrollbar--keep-visible.priority > .ps__rail-x {opacity: 0.8;}.hi-v4-scrollbar--keep-visible.priority .ps__thumb-y,.hi-v4-scrollbar--keep-visible.priority .ps__thumb-x {background-color: var(--hi-v4-color-gray-400, #b5bcc7);}.hi-v4-scrollbar.priority:hover > .ps__rail-y, .hi-v4-scrollbar.priority:hover > .ps__rail-x, .hi-v4-scrollbar.priority:focus > .ps__rail-y, .hi-v4-scrollbar.priority:focus > .ps__rail-x {opacity: 0.8;}.hi-v4-scrollbar.priority > .ps__rail-y,.hi-v4-scrollbar.priority .ps__thumb-y {width: 8px;border-radius: 4px;right: 0;-webkit-transition: opacity var(--hi-v4-motion-duration-normal, 200ms) var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1)), background-color var(--hi-v4-motion-duration-normal, 200ms) var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));transition: opacity var(--hi-v4-motion-duration-normal, 200ms) var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1)), background-color var(--hi-v4-motion-duration-normal, 200ms) var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));}.hi-v4-scrollbar.priority > .ps__rail-y:hover, .hi-v4-scrollbar.priority > .ps__rail-y:focus, .hi-v4-scrollbar.priority > .ps__rail-y.ps--clicking {width: 8px;background-color: var(--hi-v4-color-gray-200, #ebedf0);opacity: 0.8;}.hi-v4-scrollbar.priority > .ps__rail-y:hover .ps__thumb-y, .hi-v4-scrollbar.priority > .ps__rail-y:focus .ps__thumb-y, .hi-v4-scrollbar.priority > .ps__rail-y.ps--clicking .ps__thumb-y {width: 8px;right: 0;background-color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-scrollbar.priority > .ps__rail-x,.hi-v4-scrollbar.priority .ps__thumb-x {height: 8px;border-radius: 4px;bottom: 0;-webkit-transition: opacity var(--hi-v4-motion-duration-normal, 200ms) var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1)), background-color var(--hi-v4-motion-duration-normal, 200ms) var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));transition: opacity var(--hi-v4-motion-duration-normal, 200ms) var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1)), background-color var(--hi-v4-motion-duration-normal, 200ms) var(--hi-v4-motion-bezier-easing, cubic-bezier(0.37, 0.02, 0.34, 1));}.hi-v4-scrollbar.priority > .ps__rail-x:hover, .hi-v4-scrollbar.priority > .ps__rail-x:focus, .hi-v4-scrollbar.priority > .ps__rail-x.ps--clicking {height: 8px;background-color: var(--hi-v4-color-gray-200, #ebedf0);opacity: 0.8;}.hi-v4-scrollbar.priority > .ps__rail-x:hover .ps__thumb-x, .hi-v4-scrollbar.priority > .ps__rail-x:focus .ps__thumb-x, .hi-v4-scrollbar.priority > .ps__rail-x.ps--clicking .ps__thumb-x {height: 8px;bottom: 0;background-color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-scrollbar--only-scroll-visible.priority:not(.ps--scrolling-y) > .ps__rail-y:not(:hover):not(:focus), .hi-v4-scrollbar--only-scroll-visible.priority:not(.ps--scrolling-x) > .ps__rail-x:not(:hover):not(:focus) {opacity: 0;}";
39
+
40
+ __styleInject____default["default"](css_248z);
41
+
42
+ exports["default"] = css_248z;
@@ -0,0 +1,81 @@
1
+ /** @LICENSE
2
+ * @hi-ui/table
3
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/table#readme
4
+ *
5
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
6
+ *
7
+ * This source code is licensed under the MIT license found in the
8
+ * LICENSE file in the root directory of this source tree.
9
+ */
10
+ 'use strict';
11
+
12
+ Object.defineProperty(exports, '__esModule', {
13
+ value: true
14
+ });
15
+ /** @LICENSE
16
+ * @hi-ui/scrollbar
17
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/scrollbar#readme
18
+ *
19
+ * Copyright (c) HIUI <mi-hiui@xiaomi.com>.
20
+ *
21
+ * This source code is licensed under the MIT license found in the
22
+ * LICENSE file in the root directory of this source tree.
23
+ */
24
+
25
+ var ScrollbarPsToEventMatch = {
26
+ /**
27
+ * This event fires when the y-axis is scrolled in either direction
28
+ */
29
+ 'ps-scroll-y': 'onScrollY',
30
+
31
+ /**
32
+ * This event fires when the x-axis is scrolled in either direction.
33
+ */
34
+ 'ps-scroll-x': 'onScrollX',
35
+
36
+ /**
37
+ * This event fires when scrolling upwards.
38
+ */
39
+ 'ps-scroll-up': 'onScrollUp',
40
+
41
+ /**
42
+ * This event fires when scrolling downwards.
43
+ */
44
+ 'ps-scroll-down': 'onScrollDown',
45
+
46
+ /**
47
+ * This event fires when scrolling to the left.
48
+ */
49
+ 'ps-scroll-left': 'onScrollLeft',
50
+
51
+ /**
52
+ * This event fires when scrolling to the right.
53
+ */
54
+ 'ps-scroll-right': 'onScrollRight',
55
+
56
+ /**
57
+ * This event fires when scrolling reaches the start of the y-axis.
58
+ */
59
+ 'ps-y-reach-start': 'onYReachStart',
60
+
61
+ /**
62
+ * This event fires when scrolling reaches the end of the y-axis (useful for infinite scroll).
63
+ */
64
+ 'ps-y-reach-end': 'onYReachEnd',
65
+
66
+ /**
67
+ * This event fires when scrolling reaches the start of the x-axis.
68
+ */
69
+ 'ps-x-reach-start': 'onXReachStart',
70
+
71
+ /**
72
+ * This event fires when scrolling reaches the end of the x-axis.
73
+ */
74
+ 'ps-x-reach-end': 'onXReachEnd'
75
+ };
76
+ var ScrollbarEventToPsMap = Object.keys(ScrollbarPsToEventMatch).reduce(function (acc, key) {
77
+ var value = ScrollbarPsToEventMatch[key];
78
+ acc[value] = key;
79
+ return acc;
80
+ }, {});
81
+ exports.ScrollbarEventToPsMap = ScrollbarEventToPsMap;
@@ -17,15 +17,11 @@ Object.defineProperty(exports, '__esModule', {
17
17
 
18
18
  var tslib = require('tslib');
19
19
 
20
- var treeUtils = require('@hi-ui/tree-utils');
21
-
22
20
  var React = require('react');
23
21
 
24
- var useUncontrolledState = require('@hi-ui/use-uncontrolled-state');
25
-
26
- var useColWidth = require('./hooks/use-col-width.js');
22
+ var treeUtils = require('@hi-ui/tree-utils');
27
23
 
28
- var index = require('./utils/index.js');
24
+ var useUncontrolledState = require('@hi-ui/use-uncontrolled-state');
29
25
 
30
26
  var typeAssertion = require('@hi-ui/type-assertion');
31
27
 
@@ -33,20 +29,24 @@ var useCheck = require('@hi-ui/use-check');
33
29
 
34
30
  var env = require('@hi-ui/env');
35
31
 
32
+ var domUtils = require('@hi-ui/dom-utils');
33
+
34
+ var useCache = require('@hi-ui/use-cache');
35
+
36
+ var useLatest = require('@hi-ui/use-latest');
37
+
38
+ var index = require('./utils/index.js');
39
+
36
40
  var useAsyncSwitch = require('./hooks/use-async-switch.js');
37
41
 
38
42
  var useExpand = require('./hooks/use-expand.js');
39
43
 
40
- var useColgroup = require('./hooks/use-colgroup.js');
41
-
42
- var domUtils = require('@hi-ui/dom-utils');
44
+ var useColWidth = require('./hooks/use-col-width.js');
43
45
 
44
- var useCache = require('@hi-ui/use-cache');
46
+ var useColgroup = require('./hooks/use-colgroup.js');
45
47
 
46
48
  var useDrag = require('./hooks/use-drag.js');
47
49
 
48
- var useLatest = require('@hi-ui/use-latest');
49
-
50
50
  function _interopDefaultLegacy(e) {
51
51
  return e && _typeof(e) === 'object' && 'default' in e ? e : {
52
52
  'default': e
@@ -107,7 +107,8 @@ var useTable = function useTable(_a) {
107
107
  _a$fieldKey = _a.fieldKey,
108
108
  fieldKey = _a$fieldKey === void 0 ? 'key' : _a$fieldKey,
109
109
  virtual = _a.virtual,
110
- rootProps = tslib.__rest(_a, ["data", "columns", "defaultFixedToColumn", "fixedToColumn", "onFixedToColumn", "scrollWidth", "resizable", "errorRowKeys", "highlightedColKeys", "highlightedRowKeys", "showColHighlight", "showRowHighlight", "highlightRowOnDoubleClick", "defaultExpandedRowKeys", "expandedRowKeys", "onExpand", "defaultExpandAll", "onLoadChildren", "maxHeight", "sticky", "stickyTop", "draggable", "onDragStart", "onDrop", "onDropEnd", "showColMenu", "rowSelection", "cellRender", "footerRender", "fieldKey", "virtual"]);
110
+ scrollbar = _a.scrollbar,
111
+ rootProps = tslib.__rest(_a, ["data", "columns", "defaultFixedToColumn", "fixedToColumn", "onFixedToColumn", "scrollWidth", "resizable", "errorRowKeys", "highlightedColKeys", "highlightedRowKeys", "showColHighlight", "showRowHighlight", "highlightRowOnDoubleClick", "defaultExpandedRowKeys", "expandedRowKeys", "onExpand", "defaultExpandAll", "onLoadChildren", "maxHeight", "sticky", "stickyTop", "draggable", "onDragStart", "onDrop", "onDropEnd", "showColMenu", "rowSelection", "cellRender", "footerRender", "fieldKey", "virtual", "scrollbar"]);
111
112
  /**
112
113
  * 获取 key 字段值
113
114
  */
@@ -640,7 +641,8 @@ var useTable = function useTable(_a) {
640
641
  footerRender: footerRender,
641
642
  showColMenu: showColMenu,
642
643
  onLoadChildren: onLoadChildren,
643
- setHeaderTableElement: setHeaderTableElement
644
+ setHeaderTableElement: setHeaderTableElement,
645
+ scrollbar: scrollbar
644
646
  });
645
647
  };
646
648
 
@@ -12,7 +12,9 @@ import List from './node_modules/rc-virtual-list/es/List.js';
12
12
  import { getPrefixCls, cx } from '@hi-ui/classname';
13
13
  import { __DEV__ } from '@hi-ui/env';
14
14
  import { useLatestCallback } from '@hi-ui/use-latest';
15
- import { isArrayNonEmpty } from '@hi-ui/type-assertion';
15
+ import { isArrayNonEmpty, isObject } from '@hi-ui/type-assertion';
16
+ import './packages/ui/scrollbar/lib/esm/styles/index.scss.js';
17
+ import { Scrollbar } from './packages/ui/scrollbar/lib/esm/Scrollbar.js';
16
18
  import { TableRow } from './TableRow.js';
17
19
  import { useTableContext } from './context.js';
18
20
  import { ColGroupContent } from './ColGroupContent.js';
@@ -41,7 +43,8 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
41
43
  scrollWidth = _useTableContext.scrollWidth,
42
44
  colWidths = _useTableContext.colWidths,
43
45
  virtual = _useTableContext.virtual,
44
- measureRowElementRef = _useTableContext.measureRowElementRef;
46
+ measureRowElementRef = _useTableContext.measureRowElementRef,
47
+ scrollbar = _useTableContext.scrollbar;
45
48
 
46
49
  var cls = cx(prefixCls + "-body");
47
50
  var getRequiredProps = useLatestCallback(function (id) {
@@ -134,24 +137,24 @@ var TableBody = /*#__PURE__*/forwardRef(function (_ref, ref) {
134
137
  }, scrollBodyElementRef.current ? {
135
138
  scrollBodyWidth: window.getComputedStyle(scrollBodyElementRef.current).getPropertyValue('width')
136
139
  } : {})));
137
- } // 外层增加 div 作为滚动容器
140
+ }
138
141
 
139
-
140
- return /*#__PURE__*/React__default.createElement("div", {
142
+ var bodyContent = /*#__PURE__*/React__default.createElement("table", {
143
+ ref: bodyTableRef,
144
+ style: {
145
+ width: canScroll && scrollWidth !== undefined ? scrollWidth : '100%'
146
+ }
147
+ }, /*#__PURE__*/React__default.createElement(ColGroupContent, null), /*#__PURE__*/React__default.createElement(TbodyContent, null));
148
+ var scrollBodyProps = {
141
149
  ref: scrollBodyElementRef,
142
150
  className: cls,
143
151
  onScroll: onTableBodyScroll,
144
152
  style: {
145
- maxHeight: maxHeight !== undefined ? maxHeight : undefined,
146
- // 表格宽度大于div宽度才出现横向滚动条
147
- overflowX: canScroll ? 'scroll' : undefined
153
+ maxHeight: maxHeight
148
154
  }
149
- }, /*#__PURE__*/React__default.createElement("table", {
150
- ref: bodyTableRef,
151
- style: {
152
- width: canScroll && scrollWidth !== undefined ? scrollWidth : '100%'
153
- }
154
- }, /*#__PURE__*/React__default.createElement(ColGroupContent, null), /*#__PURE__*/React__default.createElement(TbodyContent, null)));
155
+ }; // 外层增加 div 作为滚动容器
156
+
157
+ return !scrollbar ? /*#__PURE__*/React__default.createElement("div", Object.assign({}, scrollBodyProps), bodyContent) : /*#__PURE__*/React__default.createElement(Scrollbar, Object.assign({}, scrollBodyProps, isObject(scrollbar) ? scrollbar : null), bodyContent);
155
158
  });
156
159
 
157
160
  if (__DEV__) {