@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,68 @@
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
+ import { useMemo } from 'react';
11
+ /** @LICENSE
12
+ * @hi-ui/use-merge-refs
13
+ * https://github.com/XiaoMi/hiui/tree/master/packages/hooks/use-merge-refs#readme
14
+ *
15
+ * Copyright (c) HiUI <mi-hiui@xiaomi.com>.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */
20
+
21
+ /**
22
+ * A hook to merge multiple refs into a single function ref.
23
+ *
24
+ * @param refs
25
+ */
26
+
27
+ var useMergeRefs = function useMergeRefs() {
28
+ for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
29
+ refs[_key] = arguments[_key];
30
+ }
31
+
32
+ return useMemo(function () {
33
+ return mergeRefs.apply(void 0, refs);
34
+ }, refs);
35
+ };
36
+ /**
37
+ * Merges multiple refs into a single function ref.
38
+ *
39
+ * @param refs
40
+ * @returns
41
+ */
42
+
43
+
44
+ function mergeRefs() {
45
+ for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
46
+ refs[_key2] = arguments[_key2];
47
+ } // Empty check
48
+
49
+
50
+ if (refs.some(function (ref) {
51
+ return ref;
52
+ }) === false) return null;
53
+ return function (value) {
54
+ refs.forEach(function (ref) {
55
+ setRef(ref, value);
56
+ });
57
+ };
58
+ }
59
+
60
+ function setRef(ref, value) {
61
+ if (typeof ref === 'function') {
62
+ ref(value);
63
+ } else if (ref) {
64
+ ref.current = value;
65
+ }
66
+ }
67
+
68
+ export { mergeRefs, useMergeRefs };
@@ -0,0 +1,162 @@
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
+ import { __rest } from 'tslib';
11
+ import React__default, { forwardRef, useState, useRef, useEffect, useImperativeHandle, useMemo } from 'react';
12
+ import { getPrefixCls, cx } from '@hi-ui/classname';
13
+ import { __DEV__ } from '@hi-ui/env';
14
+ import { useMergeRefs } from '../../../../hooks/use-merge-refs/lib/esm/index.js';
15
+ import PerfectScrollbar from '../../../../../node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js';
16
+ import { ScrollbarEventToPsMap } from './utils/index.js';
17
+ /** @LICENSE
18
+ * @hi-ui/scrollbar
19
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/scrollbar#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
+ var SCROLLBAR_PREFIX = getPrefixCls('scrollbar');
28
+ var Scrollbar = /*#__PURE__*/forwardRef(function (_a, ref) {
29
+ var _cx;
30
+
31
+ var _a$prefixCls = _a.prefixCls,
32
+ prefixCls = _a$prefixCls === void 0 ? SCROLLBAR_PREFIX : _a$prefixCls,
33
+ _a$role = _a.role,
34
+ role = _a$role === void 0 ? 'scrollbar' : _a$role,
35
+ _a$position = _a.position,
36
+ position = _a$position === void 0 ? 'relative' : _a$position,
37
+ _a$axes = _a.axes,
38
+ axes = _a$axes === void 0 ? 'both' : _a$axes,
39
+ _a$keepVisible = _a.keepVisible,
40
+ keepVisible = _a$keepVisible === void 0 ? false : _a$keepVisible,
41
+ _a$onlyScrollVisible = _a.onlyScrollVisible,
42
+ onlyScrollVisible = _a$onlyScrollVisible === void 0 ? false : _a$onlyScrollVisible,
43
+ className = _a.className,
44
+ children = _a.children,
45
+ style = _a.style,
46
+ innerRef = _a.innerRef,
47
+ rest = __rest(_a, ["prefixCls", "role", "position", "axes", "keepVisible", "onlyScrollVisible", "className", "children", "style", "innerRef"]);
48
+
49
+ var cls = cx(prefixCls, className, 'priority', (_cx = {}, _cx[prefixCls + "--keep-visible"] = keepVisible, _cx[prefixCls + "--only-scroll-visible"] = !keepVisible && onlyScrollVisible, _cx));
50
+
51
+ var _useState = useState(undefined),
52
+ ps = _useState[0],
53
+ setPs = _useState[1];
54
+
55
+ var _useState2 = useState(null),
56
+ containerElement = _useState2[0],
57
+ setContainer = _useState2[1];
58
+
59
+ var _useState3 = useState(null),
60
+ wrapperElement = _useState3[0],
61
+ setWrapperElement = _useState3[1];
62
+
63
+ var eventPropsRef = useRef({});
64
+ useEffect(function () {
65
+ if (containerElement) {
66
+ setPs(new PerfectScrollbar(containerElement));
67
+ }
68
+ }, [containerElement]); // 轴定制
69
+
70
+ useEffect(function () {
71
+ if (ps) {
72
+ ps.settings.suppressScrollX = true;
73
+ ps.settings.suppressScrollY = true;
74
+
75
+ if (axes === 'both' || axes === 'x') {
76
+ ps.settings.suppressScrollX = false;
77
+ }
78
+
79
+ if (axes === 'both' || axes === 'y') {
80
+ ps.settings.suppressScrollY = false;
81
+ }
82
+
83
+ ps.update();
84
+ }
85
+ }, [ps, axes]); // 监听容器以及内容尺寸
86
+
87
+ useEffect(function () {
88
+ if (ps && wrapperElement && containerElement) {
89
+ var observer = new ResizeObserver(function (entries) {
90
+ ps.update();
91
+ });
92
+ observer.observe(containerElement);
93
+ observer.observe(wrapperElement);
94
+ return function () {
95
+ observer.disconnect();
96
+ };
97
+ }
98
+ }, [ps, wrapperElement, containerElement]);
99
+ useImperativeHandle(innerRef, function () {
100
+ return {
101
+ instance: ps,
102
+ containerElement: containerElement || undefined
103
+ };
104
+ }, [ps, containerElement]);
105
+
106
+ var _useMemo = useMemo(function () {
107
+ var eventProps = {};
108
+ var injectProps = {};
109
+ var eventNames = Object.keys(ScrollbarEventToPsMap);
110
+
111
+ for (var _i = 0, _Object$keys = Object.keys(rest); _i < _Object$keys.length; _i++) {
112
+ var propsName = _Object$keys[_i];
113
+
114
+ if (eventNames.includes(propsName)) {
115
+ eventProps[propsName] = rest[propsName];
116
+ } else {
117
+ injectProps[propsName] = rest[propsName];
118
+ }
119
+ }
120
+
121
+ return {
122
+ eventProps: eventProps,
123
+ injectProps: injectProps
124
+ };
125
+ }, [rest]),
126
+ eventProps = _useMemo.eventProps,
127
+ injectProps = _useMemo.injectProps; // 更新event props引用
128
+
129
+
130
+ useEffect(function () {
131
+ eventPropsRef.current = eventProps;
132
+ }, [eventProps]); // 注册监听事件
133
+
134
+ useEffect(function () {
135
+ if (containerElement) {
136
+ Object.keys(ScrollbarEventToPsMap).forEach(function (event) {
137
+ containerElement.addEventListener(ScrollbarEventToPsMap[event], function (e) {
138
+ var _a, _b;
139
+
140
+ (_b = (_a = eventPropsRef.current)[event]) === null || _b === void 0 ? void 0 : _b.call(_a, e);
141
+ });
142
+ });
143
+ }
144
+ }, [containerElement]);
145
+ return /*#__PURE__*/React__default.createElement("div", Object.assign({
146
+ ref: useMergeRefs(setContainer, ref),
147
+ role: role,
148
+ className: cls,
149
+ style: Object.assign(Object.assign({}, style), {
150
+ position: position
151
+ })
152
+ }, injectProps), /*#__PURE__*/React__default.createElement("div", {
153
+ className: prefixCls + "__wrapper",
154
+ ref: setWrapperElement
155
+ }, children));
156
+ });
157
+
158
+ if (__DEV__) {
159
+ Scrollbar.displayName = 'Scrollbar';
160
+ }
161
+
162
+ export { Scrollbar };
@@ -0,0 +1,25 @@
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
+ import __styleInject__ from 'style-inject';
11
+ /** @LICENSE
12
+ * @hi-ui/scrollbar
13
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/scrollbar#readme
14
+ *
15
+ * Copyright (c) HIUI <mi-hiui@xiaomi.com>.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */
20
+
21
+ 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;}";
22
+
23
+ __styleInject__(css_248z);
24
+
25
+ export { css_248z as default };
@@ -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
+
11
+ /** @LICENSE
12
+ * @hi-ui/scrollbar
13
+ * https://github.com/XiaoMi/hiui/tree/master/packages/ui/scrollbar#readme
14
+ *
15
+ * Copyright (c) HIUI <mi-hiui@xiaomi.com>.
16
+ *
17
+ * This source code is licensed under the MIT license found in the
18
+ * LICENSE file in the root directory of this source tree.
19
+ */
20
+ var ScrollbarPsToEventMatch = {
21
+ /**
22
+ * This event fires when the y-axis is scrolled in either direction
23
+ */
24
+ 'ps-scroll-y': 'onScrollY',
25
+
26
+ /**
27
+ * This event fires when the x-axis is scrolled in either direction.
28
+ */
29
+ 'ps-scroll-x': 'onScrollX',
30
+
31
+ /**
32
+ * This event fires when scrolling upwards.
33
+ */
34
+ 'ps-scroll-up': 'onScrollUp',
35
+
36
+ /**
37
+ * This event fires when scrolling downwards.
38
+ */
39
+ 'ps-scroll-down': 'onScrollDown',
40
+
41
+ /**
42
+ * This event fires when scrolling to the left.
43
+ */
44
+ 'ps-scroll-left': 'onScrollLeft',
45
+
46
+ /**
47
+ * This event fires when scrolling to the right.
48
+ */
49
+ 'ps-scroll-right': 'onScrollRight',
50
+
51
+ /**
52
+ * This event fires when scrolling reaches the start of the y-axis.
53
+ */
54
+ 'ps-y-reach-start': 'onYReachStart',
55
+
56
+ /**
57
+ * This event fires when scrolling reaches the end of the y-axis (useful for infinite scroll).
58
+ */
59
+ 'ps-y-reach-end': 'onYReachEnd',
60
+
61
+ /**
62
+ * This event fires when scrolling reaches the start of the x-axis.
63
+ */
64
+ 'ps-x-reach-start': 'onXReachStart',
65
+
66
+ /**
67
+ * This event fires when scrolling reaches the end of the x-axis.
68
+ */
69
+ 'ps-x-reach-end': 'onXReachEnd'
70
+ };
71
+ var ScrollbarEventToPsMap = Object.keys(ScrollbarPsToEventMatch).reduce(function (acc, key) {
72
+ var value = ScrollbarPsToEventMatch[key];
73
+ acc[value] = key;
74
+ return acc;
75
+ }, {});
76
+ export { ScrollbarEventToPsMap };
@@ -8,21 +8,21 @@
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
10
  import { __rest } from 'tslib';
11
- import { cloneTree, flattenTree, getLeafChildren, getNodeRootParent, flattedTreeSort } from '@hi-ui/tree-utils';
12
11
  import React__default, { useMemo, useState, useRef, useCallback, useEffect } from 'react';
12
+ import { cloneTree, flattenTree, getLeafChildren, getNodeRootParent, flattedTreeSort } from '@hi-ui/tree-utils';
13
13
  import { useUncontrolledState } from '@hi-ui/use-uncontrolled-state';
14
- import { useColWidth } from './hooks/use-col-width.js';
15
- import { setColumnsDefaultWidth, parseFixedColumns } from './utils/index.js';
16
14
  import { isNullish, isArrayNonEmpty } from '@hi-ui/type-assertion';
17
15
  import { useCheck, useSelect } from '@hi-ui/use-check';
18
16
  import { invariant } from '@hi-ui/env';
17
+ import { setAttrStatus } from '@hi-ui/dom-utils';
18
+ import { useCache } from '@hi-ui/use-cache';
19
+ import { useLatestCallback } from '@hi-ui/use-latest';
20
+ import { setColumnsDefaultWidth, parseFixedColumns } from './utils/index.js';
19
21
  import { useAsyncSwitch } from './hooks/use-async-switch.js';
20
22
  import { useExpand } from './hooks/use-expand.js';
23
+ import { useColWidth } from './hooks/use-col-width.js';
21
24
  import { useColumns } from './hooks/use-colgroup.js';
22
- import { setAttrStatus } from '@hi-ui/dom-utils';
23
- import { useCache } from '@hi-ui/use-cache';
24
25
  import { useTableDrag } from './hooks/use-drag.js';
25
- import { useLatestCallback } from '@hi-ui/use-latest';
26
26
  var DEFAULT_COLUMNS = [];
27
27
  var DEFAULT_DATA = [];
28
28
  var DEFAULT_ERROR_ROW_KEYS = [];
@@ -75,7 +75,8 @@ var useTable = function useTable(_a) {
75
75
  _a$fieldKey = _a.fieldKey,
76
76
  fieldKey = _a$fieldKey === void 0 ? 'key' : _a$fieldKey,
77
77
  virtual = _a.virtual,
78
- rootProps = __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"]);
78
+ scrollbar = _a.scrollbar,
79
+ rootProps = __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"]);
79
80
  /**
80
81
  * 获取 key 字段值
81
82
  */
@@ -608,7 +609,8 @@ var useTable = function useTable(_a) {
608
609
  footerRender: footerRender,
609
610
  showColMenu: showColMenu,
610
611
  onLoadChildren: onLoadChildren,
611
- setHeaderTableElement: setHeaderTableElement
612
+ setHeaderTableElement: setHeaderTableElement,
613
+ scrollbar: scrollbar
612
614
  });
613
615
  };
614
616
 
@@ -41,6 +41,7 @@ export declare const TableProvider: import("react").Provider<(Omit<{
41
41
  showColMenu: boolean | undefined;
42
42
  onLoadChildren: ((item: import("./types").TableRowEventData) => void | Promise<void | any[]>) | undefined;
43
43
  setHeaderTableElement: import("react").Dispatch<import("react").SetStateAction<HTMLTableRowElement | null>>;
44
+ scrollbar: boolean | import("packages/ui/scrollbar/lib/types").ScrollbarProps | undefined;
44
45
  scrollLeft: number;
45
46
  scrollRight: number;
46
47
  measureRowElementRef: import("react").MutableRefObject<HTMLTableRowElement | null>;
@@ -148,6 +149,7 @@ export declare const useTableContext: () => Omit<{
148
149
  showColMenu: boolean | undefined;
149
150
  onLoadChildren: ((item: import("./types").TableRowEventData) => void | Promise<void | any[]>) | undefined;
150
151
  setHeaderTableElement: import("react").Dispatch<import("react").SetStateAction<HTMLTableRowElement | null>>;
152
+ scrollbar: boolean | import("packages/ui/scrollbar/lib/types").ScrollbarProps | undefined;
151
153
  scrollLeft: number;
152
154
  scrollRight: number;
153
155
  measureRowElementRef: import("react").MutableRefObject<HTMLTableRowElement | null>;
@@ -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, footerRender, 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;
@@ -42,6 +43,7 @@ export declare const useTable: ({ data, columns: columnsProp, defaultFixedToColu
42
43
  showColMenu: boolean | undefined;
43
44
  onLoadChildren: ((item: TableRowEventData) => Promise<any[] | void> | void) | undefined;
44
45
  setHeaderTableElement: React.Dispatch<React.SetStateAction<HTMLTableRowElement | null>>;
46
+ scrollbar: boolean | ScrollbarProps | undefined;
45
47
  scrollLeft: number;
46
48
  scrollRight: number;
47
49
  measureRowElementRef: React.MutableRefObject<HTMLTableRowElement | null>;
@@ -273,5 +275,9 @@ export interface UseTableProps {
273
275
  * 自定义渲染页脚
274
276
  */
275
277
  footerRender?: (...nodes: React.ReactElement[]) => React.ReactNode;
278
+ /**
279
+ * 配置滚动条,滚动条样式使用HiUI自带的滚动条风格
280
+ */
281
+ scrollbar?: boolean | ScrollbarProps;
276
282
  }
277
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.3.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,11 +52,11 @@
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
62
  "@hi-ui/select": "^4.2.2",
@@ -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"