@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.
- package/CHANGELOG.md +26 -0
- package/lib/cjs/BaseTable.js +127 -71
- package/lib/cjs/ColGroupContent.js +56 -0
- package/lib/cjs/Table.js +14 -3
- package/lib/cjs/TableBody.js +22 -75
- package/lib/cjs/TableHeader.js +5 -71
- package/lib/cjs/TbodyContent.js +129 -0
- package/lib/cjs/TheadContent.js +120 -0
- package/lib/cjs/hooks/use-col-width.js +27 -22
- package/lib/cjs/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js +1286 -0
- package/lib/cjs/packages/hooks/use-merge-refs/lib/esm/index.js +76 -0
- package/lib/cjs/packages/ui/scrollbar/lib/esm/Scrollbar.js +185 -0
- package/lib/cjs/packages/ui/scrollbar/lib/esm/styles/index.scss.js +42 -0
- package/lib/cjs/packages/ui/scrollbar/lib/esm/utils/index.js +81 -0
- package/lib/cjs/styles/index.scss.js +1 -1
- package/lib/cjs/use-table.js +39 -23
- package/lib/esm/BaseTable.js +124 -71
- package/lib/esm/ColGroupContent.js +37 -0
- package/lib/esm/Table.js +14 -3
- package/lib/esm/TableBody.js +19 -75
- package/lib/esm/TableHeader.js +5 -69
- package/lib/esm/TbodyContent.js +105 -0
- package/lib/esm/TheadContent.js +96 -0
- package/lib/esm/hooks/use-col-width.js +27 -22
- package/lib/esm/node_modules/perfect-scrollbar/dist/perfect-scrollbar.esm.js +1281 -0
- package/lib/esm/packages/hooks/use-merge-refs/lib/esm/index.js +68 -0
- package/lib/esm/packages/ui/scrollbar/lib/esm/Scrollbar.js +162 -0
- package/lib/esm/packages/ui/scrollbar/lib/esm/styles/index.scss.js +25 -0
- package/lib/esm/packages/ui/scrollbar/lib/esm/utils/index.js +76 -0
- package/lib/esm/styles/index.scss.js +1 -1
- package/lib/esm/use-table.js +33 -17
- package/lib/types/BaseTable.d.ts +4 -0
- package/lib/types/ColGroupContent.d.ts +8 -0
- package/lib/types/TbodyContent.d.ts +18 -0
- package/lib/types/TheadContent.d.ts +9 -0
- package/lib/types/context.d.ts +14 -8
- package/lib/types/hooks/use-col-width.d.ts +1 -1
- package/lib/types/use-table.d.ts +18 -6
- package/package.json +6 -6
|
@@ -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,7 +8,7 @@
|
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
9
|
*/
|
|
10
10
|
import __styleInject__ from 'style-inject';
|
|
11
|
-
var css_248z = ".hi-v4-table {-webkit-box-sizing: border-box;box-sizing: border-box;font-size: 14px;position: relative;}.hi-v4-table table {width: 100%;text-align: left;background-color: var(--hi-v4-color-static-white, #fff);border-radius: 2px 2px 0 0;border-spacing: 0;border-collapse: separate;display: table;table-layout: fixed;}.hi-v4-table__wrapper {position: relative;z-index: 0;}.hi-v4-table__switcher.hi-v4-icon-button {color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-table__switcher--expanded.hi-v4-icon-button {color: var(--hi-v4-color-primary-400, var(--hi-v4-color-brandblue-400, #4a9eff));}.hi-v4-table--size-md table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-7, 14px);}.hi-v4-table--size-md table tbody > tr:not(.hi-v4-table-empty-content) > td.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-md table thead > tr > th {padding: var(--hi-v4-spacing-7, 14px);}.hi-v4-table--size-md table thead > tr > th.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-sm table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-sm table tbody > tr:not(.hi-v4-table-empty-content) > td.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-sm table thead > tr > th {padding: var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-sm table thead > tr > th.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-lg table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-9, 18px);}.hi-v4-table--size-lg table tbody > tr:not(.hi-v4-table-empty-content) > td.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-9, 18px) var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-lg table thead > tr > th {padding: var(--hi-v4-spacing-9, 18px);}.hi-v4-table--size-lg table thead > tr > th.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-9, 18px) var(--hi-v4-spacing-5, 10px);}.hi-v4-table--bordered table thead > tr > th {border-right: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);}.hi-v4-table--bordered table td {border-right: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);}.hi-v4-table--bordered .hi-v4-table-header {border-top: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);}.hi-v4-table--bordered .hi-v4-table-body {border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);}.hi-v4-table--sticky {position: -webkit-sticky;position: sticky;top: 0;}.hi-v4-table--virtual {width: 100%;overflow: hidden;}.hi-v4-table--virtual .hi-v4-table-cell {-webkit-box-sizing: border-box;box-sizing: border-box;}.hi-v4-table-header {position: relative;-webkit-box-sizing: border-box;box-sizing: border-box;overflow: hidden;}.hi-v4-table-header__resizable {position: relative;background-clip: padding-box;}.hi-v4-table-header__resizable-handle {-webkit-box-sizing: content-box;box-sizing: content-box;position: absolute;width: 2px;height: 100%;bottom: 0;right: 0;border-left: 2px solid var(--hi-v4-color-gray-50, #f5f7fa);cursor: col-resize;z-index: 1;}.hi-v4-table-header__resizable:hover .hi-v4-table-header__resizable-handle {background-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-table-header-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa);color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem);font-weight: var(--hi-v4-text-weight-medium, 500);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-8, 16px);border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);}.hi-v4-table-header-cell.hi-v4-table__embed-col, .hi-v4-table-header-cell.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px);}.hi-v4-table-header-cell.hi-v4-table-header-cell__col--highlight, .hi-v4-table-header-cell.hi-v4-table-header-cell__col--hovered-highlight, .hi-v4-table-header-cell.hi-v4-table-header-cell__col--active {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-table-header-cell.hi-v4-table-header-cell__col--highlight[data-sticky], .hi-v4-table-header-cell.hi-v4-table-header-cell__col--hovered-highlight[data-sticky], .hi-v4-table-header-cell.hi-v4-table-header-cell__col--active[data-sticky] {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-table-row--hover:hover > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-row--striped > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa);}.hi-v4-table-row--expanded > .hi-v4-table-cell {color: var(--hi-v4-color-gray-800, #1f2937);}.hi-v4-table-row--error > .hi-v4-table-cell {color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959));}.hi-v4-table-row--highlight > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-row--dragging > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-row--drag-top > .hi-v4-table-cell {border-top: 2px dashed var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-table-row--drag-bottom > .hi-v4-table-cell {border-bottom: 2px dashed var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-table-row--avg > .hi-v4-table-cell, .hi-v4-table-row--total > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa);}.hi-v4-table-row--avg:hover > .hi-v4-table-cell, .hi-v4-table-row--total:hover > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa);}.hi-v4-table-row--virtual {display: -webkit-box;display: -ms-flexbox;display: flex;}.hi-v4-table-header .hi-v4-table-header-col, .hi-v4-table-header .hi-v4-table-col {background-color: var(--hi-v4-color-gray-50, #f5f7fa);}.hi-v4-table-body .hi-v4-table-header-col[data-hover-highlight], .hi-v4-table-body .hi-v4-table-col[data-hover-highlight] {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-header .hi-v4-table-header-col[data-hover-highlight], .hi-v4-table-header .hi-v4-table-col[data-hover-highlight] {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-table-body {position: relative;overflow: auto;}.hi-v4-table-cell {word-break: break-word;border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);font-size: var(--hi-v4-text-size-md, 0.875rem);font-weight: var(--hi-v4-text-weight-normal, 400);color: var(--hi-v4-color-gray-700, #1f2733);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-8, 16px);background-color: var(--hi-v4-color-static-white, #fff);}.hi-v4-table-cell__indent {display: inline-block;width: 14px;height: 100%;margin-right: var(--hi-v4-spacing-1, 2px);}.hi-v4-table-cell__switcher.hi-v4-icon-button {margin-right: var(--hi-v4-spacing-1, 2px);color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-table-cell.hi-v4-table__embed-col, .hi-v4-table-cell.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px);}.hi-v4-table-cell.hi-v4-table-cell__col--highlight {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-cell.hi-v4-table-cell__col--hovered-highlight {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-freeze-shadow {position: absolute;top: 0;bottom: 0;z-index: 20;pointer-events: none;overflow: hidden;height: 100%;width: 200px;}.hi-v4-table-freeze-shadow--left {margin-right: 10px;left: 0;-webkit-box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15);box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15);}.hi-v4-table-freeze-shadow--right {margin-left: 10px;right: 0;-webkit-box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.15);box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.15);}.hi-v4-table-header-filter-dropdown__trigger.hi-v4-icon-button {margin-left: 4px;}.hi-v4-table-header-filter-dropdown__content {width: 124px;padding: var(--hi-v4-spacing-6, 12px) var(--hi-v4-spacing-4, 8px);font-weight: var(--hi-v4-text-weight-normal, 400);}.hi-v4-table-header-filter-dropdown__item {margin-top: var(--hi-v4-spacing-4, 8px);padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);border-radius: var(--hi-v4-border-radius-md, 4px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;cursor: pointer;color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem);}.hi-v4-table-header-filter-dropdown__item:first-child {margin-top: 0;}.hi-v4-table-header-filter-dropdown__item:hover {background-color: var(--hi-v4-color-gray-50, #f5f7fa);}.hi-v4-table-header-filter-dropdown__item--active {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-header-filter-dropdown__item--active:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-header-filter-sorter {display: -webkit-inline-box;display: -ms-inline-flexbox;display: inline-flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;height: 20px;vertical-align: middle;margin-left: 6px;}.hi-v4-table-header-filter-sorter__icon {display: inline-block;height: 8px;cursor: pointer;overflow: hidden;font-weight: var(--hi-v4-text-weight-normal, 400);color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-table-header-filter-sorter__icon svg {position: relative;top: -5px;}.hi-v4-table-header-filter-sorter__icon--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-table-header-filter-custom__trigger {margin-left: 6px;color: var(--hi-v4-color-gray-500, #929aa6);cursor: pointer;}.hi-v4-table-header-filter-custom__content {padding: 12px 8px;}.hi-v4-table-embed-row {position: relative;z-index: 0;}.hi-v4-table-embed-row > td {background-color: var(--hi-v4-color-gray-200, #ebedf0);padding: var(--hi-v4-spacing-10, 20px);}.hi-v4-table-setting {position: absolute;height: 100%;z-index: 11;-webkit-box-sizing: border-box;box-sizing: border-box;right: 0;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);border-bottom: none;border-top: none;color: var(--hi-v4-color-gray-500, #929aa6);cursor: pointer;font-size: var(--hi-v4-text-size-sm, 0.75rem);width: 18px;background: var(--hi-v4-color-gray-50, #f5f7fa);}.hi-v4-table-setting__btn-group {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end;}.hi-v4-table-setting-item {position: relative;padding-top: var(--hi-v4-spacing-1, 2px);padding-bottom: var(--hi-v4-spacing-1, 2px);-webkit-box-sizing: border-box;box-sizing: border-box;}.hi-v4-table-setting-item__wrap {-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: move;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-orient: horizontal;-webkit-box-direction: normal;-ms-flex-direction: row;flex-direction: row;padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);border-radius: var(--hi-v4-border-radius-md, 4px);}.hi-v4-table-setting-item__wrap:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-setting-item--dragging .hi-v4-table-setting-item__wrap {opacity: 0.6;}.hi-v4-table-setting-item::before {position: absolute;left: 0;z-index: 9999;display: none;-webkit-box-sizing: border-box;box-sizing: border-box;width: 8px;height: 8px;content: \"\";background-color: var(--hi-v4-color-static-white, #fff);border: 1px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));border-radius: 100%;}.hi-v4-table-setting-item::after {position: absolute;content: \"\";z-index: 9998;display: block;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom-width: 0;border-bottom-style: solid;border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));left: 0;width: 100%;}.hi-v4-table-setting-item::before, .hi-v4-table-setting-item::after {margin-left: -10px;margin-right: -10px;}.hi-v4-table-setting-item--direction-before::before {display: block;top: -0.5px;-webkit-transform: translateY(-4px);transform: translateY(-4px);}.hi-v4-table-setting-item--direction-before::after {top: -0.5px;border-bottom-width: 1px;}.hi-v4-table-setting-item--direction-after::before {display: block;bottom: 0.5px;-webkit-transform: translateY(4px);transform: translateY(4px);}.hi-v4-table-setting-item--direction-after::after {bottom: 0.5px;border-bottom-width: 1px;}.hi-v4-table-pagination {display: -webkit-box;display: -ms-flexbox;display: flex;-ms-flex-wrap: wrap;flex-wrap: wrap;row-gap: 8px;padding: var(--hi-v4-spacing-6, 12px) 0;background-color: var(--hi-v4-color-static-white, #fff);}.hi-v4-table-pagination--placement-left {-webkit-box-pack: start;-ms-flex-pack: start;justify-content: flex-start;}.hi-v4-table-pagination--placement-right {-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end;}.hi-v4-table-pagination--placement-middle {-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;}.hi-v4-table-empty-content td {text-align: center;padding: var(--hi-v4-spacing-12, 24px) 0;}.hi-v4-table--bordered .hi-v4-table-empty-content td {border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);}.hi-v4-setting-drawer .hi-v4-setting__btn-group {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end;}.hi-v4-setting-item {position: relative;padding-top: var(--hi-v4-spacing-1, 2px);padding-bottom: var(--hi-v4-spacing-1, 2px);-webkit-box-sizing: border-box;box-sizing: border-box;}.hi-v4-setting-item__wrap {-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: move;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-orient: horizontal;-webkit-box-direction: normal;-ms-flex-direction: row;flex-direction: row;padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);border-radius: var(--hi-v4-border-radius-md, 4px);}.hi-v4-setting-item__wrap:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-setting-item--dragging .hi-v4-setting-item__wrap {opacity: 0.6;}.hi-v4-setting-item::before {position: absolute;left: 0;z-index: 9999;display: none;-webkit-box-sizing: border-box;box-sizing: border-box;width: 8px;height: 8px;content: \"\";background-color: var(--hi-v4-color-static-white, #fff);border: 1px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));border-radius: 100%;}.hi-v4-setting-item::after {position: absolute;content: \"\";z-index: 9998;display: block;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom-width: 0;border-bottom-style: solid;border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));left: 0;width: 100%;}.hi-v4-setting-item::before, .hi-v4-setting-item::after {margin-left: -10px;margin-right: -10px;}.hi-v4-setting-item--direction-before::before {display: block;top: -0.5px;-webkit-transform: translateY(-4px);transform: translateY(-4px);}.hi-v4-setting-item--direction-before::after {top: -0.5px;border-bottom-width: 1px;}.hi-v4-setting-item--direction-after::before {display: block;bottom: 0.5px;-webkit-transform: translateY(4px);transform: translateY(4px);}.hi-v4-setting-item--direction-after::after {bottom: 0.5px;border-bottom-width: 1px;}";
|
|
11
|
+
var css_248z = ".hi-v4-table {-webkit-box-sizing: border-box;box-sizing: border-box;font-size: 14px;position: relative;}.hi-v4-table table {width: 100%;text-align: left;background-color: var(--hi-v4-color-static-white, #fff);border-radius: 2px 2px 0 0;border-spacing: 0;border-collapse: separate;display: table;table-layout: fixed;}.hi-v4-table__wrapper {position: relative;z-index: 0;}.hi-v4-table__switcher.hi-v4-icon-button {color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-table__switcher--expanded.hi-v4-icon-button {color: var(--hi-v4-color-primary-400, var(--hi-v4-color-brandblue-400, #4a9eff));}.hi-v4-table--size-md table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-7, 14px);}.hi-v4-table--size-md table tbody > tr:not(.hi-v4-table-empty-content) > td.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-md table thead > tr > th {padding: var(--hi-v4-spacing-7, 14px);}.hi-v4-table--size-md table thead > tr > th.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-sm table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-sm table tbody > tr:not(.hi-v4-table-empty-content) > td.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-sm table thead > tr > th {padding: var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-sm table thead > tr > th.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-lg table tbody > tr:not(.hi-v4-table-empty-content) > td {padding: var(--hi-v4-spacing-9, 18px);}.hi-v4-table--size-lg table tbody > tr:not(.hi-v4-table-empty-content) > td.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-9, 18px) var(--hi-v4-spacing-5, 10px);}.hi-v4-table--size-lg table thead > tr > th {padding: var(--hi-v4-spacing-9, 18px);}.hi-v4-table--size-lg table thead > tr > th.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-9, 18px) var(--hi-v4-spacing-5, 10px);}.hi-v4-table--bordered table thead > tr > th {border-right: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);}.hi-v4-table--bordered table td {border-right: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);}.hi-v4-table--bordered .hi-v4-table-header {border-top: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);}.hi-v4-table--bordered .hi-v4-table-body {border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-200, #ebedf0);}.hi-v4-table--sticky {position: -webkit-sticky;position: sticky;top: 0;}.hi-v4-table--virtual {width: 100%;overflow: hidden;}.hi-v4-table--virtual .hi-v4-table-cell {-webkit-box-sizing: border-box;box-sizing: border-box;}.hi-v4-table-header {position: relative;-webkit-box-sizing: border-box;box-sizing: border-box;overflow: hidden;}.hi-v4-table-header__resizable {position: relative;background-clip: padding-box;}.hi-v4-table-header__resizable-handle {-webkit-box-sizing: content-box;box-sizing: content-box;position: absolute;width: 2px;height: 100%;bottom: 0;right: 0;border-left: 2px solid var(--hi-v4-color-gray-50, #f5f7fa);cursor: col-resize;z-index: 1;}.hi-v4-table-header__resizable:hover .hi-v4-table-header__resizable-handle {background-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-table-header-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa);color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem);font-weight: var(--hi-v4-text-weight-medium, 500);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-8, 16px);border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);}.hi-v4-table-header-cell.hi-v4-table__embed-col, .hi-v4-table-header-cell.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px);}.hi-v4-table-header-cell.hi-v4-table-header-cell__col--highlight, .hi-v4-table-header-cell.hi-v4-table-header-cell__col--hovered-highlight, .hi-v4-table-header-cell.hi-v4-table-header-cell__col--active {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-table-header-cell.hi-v4-table-header-cell__col--highlight[data-sticky], .hi-v4-table-header-cell.hi-v4-table-header-cell__col--hovered-highlight[data-sticky], .hi-v4-table-header-cell.hi-v4-table-header-cell__col--active[data-sticky] {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-table-row--hover:hover > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-row--striped > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa);}.hi-v4-table-row--expanded > .hi-v4-table-cell {color: var(--hi-v4-color-gray-800, #1f2937);}.hi-v4-table-row--error > .hi-v4-table-cell {color: var(--hi-v4-color-danger-500, var(--hi-v4-color-red-500, #ff5959));}.hi-v4-table-row--highlight > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-row--dragging > .hi-v4-table-cell {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-row--drag-top > .hi-v4-table-cell {border-top: 2px dashed var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-table-row--drag-bottom > .hi-v4-table-cell {border-bottom: 2px dashed var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-table-row--avg > .hi-v4-table-cell, .hi-v4-table-row--total > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa);}.hi-v4-table-row--avg:hover > .hi-v4-table-cell, .hi-v4-table-row--total:hover > .hi-v4-table-cell {background-color: var(--hi-v4-color-gray-50, #f5f7fa);}.hi-v4-table-row--virtual {display: -webkit-box;display: -ms-flexbox;display: flex;}.hi-v4-table-header .hi-v4-table-header-col, .hi-v4-table-header .hi-v4-table-col {background-color: var(--hi-v4-color-gray-50, #f5f7fa);}.hi-v4-table-body .hi-v4-table-header-col[data-hover-highlight], .hi-v4-table-body .hi-v4-table-col[data-hover-highlight] {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-header .hi-v4-table-header-col[data-hover-highlight], .hi-v4-table-header .hi-v4-table-col[data-hover-highlight] {background-color: var(--hi-v4-color-gray-100, #f2f4f7);}.hi-v4-table-body, .hi-v4-table-content {position: relative;overflow: auto;}.hi-v4-table-cell {word-break: break-word;border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);font-size: var(--hi-v4-text-size-md, 0.875rem);font-weight: var(--hi-v4-text-weight-normal, 400);color: var(--hi-v4-color-gray-700, #1f2733);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-8, 16px);background-color: var(--hi-v4-color-static-white, #fff);}.hi-v4-table-cell__indent {display: inline-block;width: 14px;height: 100%;margin-right: var(--hi-v4-spacing-1, 2px);}.hi-v4-table-cell__switcher.hi-v4-icon-button {margin-right: var(--hi-v4-spacing-1, 2px);color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-table-cell.hi-v4-table__embed-col, .hi-v4-table-cell.hi-v4-table__selection-col {padding: var(--hi-v4-spacing-7, 14px) var(--hi-v4-spacing-5, 10px);}.hi-v4-table-cell.hi-v4-table-cell__col--highlight {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-cell.hi-v4-table-cell__col--hovered-highlight {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-freeze-shadow {position: absolute;top: 0;bottom: 0;z-index: 20;pointer-events: none;overflow: hidden;height: 100%;width: 200px;}.hi-v4-table-freeze-shadow--left {margin-right: 10px;left: 0;-webkit-box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15);box-shadow: 6px 0 6px -4px rgba(0, 0, 0, 0.15);}.hi-v4-table-freeze-shadow--right {margin-left: 10px;right: 0;-webkit-box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.15);box-shadow: -6px 0 6px -4px rgba(0, 0, 0, 0.15);}.hi-v4-table-header-filter-dropdown__trigger.hi-v4-icon-button {margin-left: 4px;}.hi-v4-table-header-filter-dropdown__content {width: 124px;padding: var(--hi-v4-spacing-6, 12px) var(--hi-v4-spacing-4, 8px);font-weight: var(--hi-v4-text-weight-normal, 400);}.hi-v4-table-header-filter-dropdown__item {margin-top: var(--hi-v4-spacing-4, 8px);padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);border-radius: var(--hi-v4-border-radius-md, 4px);display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;cursor: pointer;color: var(--hi-v4-color-gray-700, #1f2733);font-size: var(--hi-v4-text-size-md, 0.875rem);}.hi-v4-table-header-filter-dropdown__item:first-child {margin-top: 0;}.hi-v4-table-header-filter-dropdown__item:hover {background-color: var(--hi-v4-color-gray-50, #f5f7fa);}.hi-v4-table-header-filter-dropdown__item--active {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-header-filter-dropdown__item--active:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-header-filter-sorter {display: -webkit-inline-box;display: -ms-inline-flexbox;display: inline-flex;-webkit-box-orient: vertical;-webkit-box-direction: normal;-ms-flex-direction: column;flex-direction: column;height: 20px;vertical-align: middle;margin-left: 6px;}.hi-v4-table-header-filter-sorter__icon {display: inline-block;height: 8px;cursor: pointer;overflow: hidden;font-weight: var(--hi-v4-text-weight-normal, 400);color: var(--hi-v4-color-gray-500, #929aa6);}.hi-v4-table-header-filter-sorter__icon svg {position: relative;top: -5px;}.hi-v4-table-header-filter-sorter__icon--active {color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));}.hi-v4-table-header-filter-custom__trigger {margin-left: 6px;color: var(--hi-v4-color-gray-500, #929aa6);cursor: pointer;}.hi-v4-table-header-filter-custom__content {padding: 12px 8px;}.hi-v4-table-embed-row {position: relative;z-index: 0;}.hi-v4-table-embed-row > td {background-color: var(--hi-v4-color-gray-200, #ebedf0);padding: var(--hi-v4-spacing-10, 20px);}.hi-v4-table-setting {position: absolute;height: 100%;z-index: 11;-webkit-box-sizing: border-box;box-sizing: border-box;right: 0;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;border-left: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);border-bottom: none;border-top: none;color: var(--hi-v4-color-gray-500, #929aa6);cursor: pointer;font-size: var(--hi-v4-text-size-sm, 0.75rem);width: 18px;background: var(--hi-v4-color-gray-50, #f5f7fa);}.hi-v4-table-setting__btn-group {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end;}.hi-v4-table-setting-item {position: relative;padding-top: var(--hi-v4-spacing-1, 2px);padding-bottom: var(--hi-v4-spacing-1, 2px);-webkit-box-sizing: border-box;box-sizing: border-box;}.hi-v4-table-setting-item__wrap {-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: move;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-orient: horizontal;-webkit-box-direction: normal;-ms-flex-direction: row;flex-direction: row;padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);border-radius: var(--hi-v4-border-radius-md, 4px);}.hi-v4-table-setting-item__wrap:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-table-setting-item--dragging .hi-v4-table-setting-item__wrap {opacity: 0.6;}.hi-v4-table-setting-item::before {position: absolute;left: 0;z-index: 9999;display: none;-webkit-box-sizing: border-box;box-sizing: border-box;width: 8px;height: 8px;content: \"\";background-color: var(--hi-v4-color-static-white, #fff);border: 1px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));border-radius: 100%;}.hi-v4-table-setting-item::after {position: absolute;content: \"\";z-index: 9998;display: block;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom-width: 0;border-bottom-style: solid;border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));left: 0;width: 100%;}.hi-v4-table-setting-item::before, .hi-v4-table-setting-item::after {margin-left: -10px;margin-right: -10px;}.hi-v4-table-setting-item--direction-before::before {display: block;top: -0.5px;-webkit-transform: translateY(-4px);transform: translateY(-4px);}.hi-v4-table-setting-item--direction-before::after {top: -0.5px;border-bottom-width: 1px;}.hi-v4-table-setting-item--direction-after::before {display: block;bottom: 0.5px;-webkit-transform: translateY(4px);transform: translateY(4px);}.hi-v4-table-setting-item--direction-after::after {bottom: 0.5px;border-bottom-width: 1px;}.hi-v4-table-pagination {display: -webkit-box;display: -ms-flexbox;display: flex;-ms-flex-wrap: wrap;flex-wrap: wrap;row-gap: 8px;padding: var(--hi-v4-spacing-6, 12px) 0;background-color: var(--hi-v4-color-static-white, #fff);}.hi-v4-table-pagination--placement-left {-webkit-box-pack: start;-ms-flex-pack: start;justify-content: flex-start;}.hi-v4-table-pagination--placement-right {-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end;}.hi-v4-table-pagination--placement-middle {-webkit-box-pack: center;-ms-flex-pack: center;justify-content: center;}.hi-v4-table-empty-content td {text-align: center;padding: var(--hi-v4-spacing-12, 24px) 0;}.hi-v4-table--bordered .hi-v4-table-empty-content td {border-bottom: var(--hi-v4-border-size-normal, 1px solid) var(--hi-v4-color-gray-300, #dfe2e8);}.hi-v4-setting-drawer .hi-v4-setting__btn-group {display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-pack: end;-ms-flex-pack: end;justify-content: flex-end;}.hi-v4-setting-item {position: relative;padding-top: var(--hi-v4-spacing-1, 2px);padding-bottom: var(--hi-v4-spacing-1, 2px);-webkit-box-sizing: border-box;box-sizing: border-box;}.hi-v4-setting-item__wrap {-webkit-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;cursor: move;display: -webkit-box;display: -ms-flexbox;display: flex;-webkit-box-pack: justify;-ms-flex-pack: justify;justify-content: space-between;-webkit-box-align: center;-ms-flex-align: center;align-items: center;-webkit-box-orient: horizontal;-webkit-box-direction: normal;-ms-flex-direction: row;flex-direction: row;padding: var(--hi-v4-spacing-3, 6px) var(--hi-v4-spacing-4, 8px);line-height: var(--hi-v4-text-lineheight-sm, 1.25rem);border-radius: var(--hi-v4-border-radius-md, 4px);}.hi-v4-setting-item__wrap:hover {background-color: var(--hi-v4-color-primary-50, var(--hi-v4-color-brandblue-50, #e2f3fe));}.hi-v4-setting-item--dragging .hi-v4-setting-item__wrap {opacity: 0.6;}.hi-v4-setting-item::before {position: absolute;left: 0;z-index: 9999;display: none;-webkit-box-sizing: border-box;box-sizing: border-box;width: 8px;height: 8px;content: \"\";background-color: var(--hi-v4-color-static-white, #fff);border: 1px solid var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));border-radius: 100%;}.hi-v4-setting-item::after {position: absolute;content: \"\";z-index: 9998;display: block;-webkit-box-sizing: border-box;box-sizing: border-box;border-bottom-width: 0;border-bottom-style: solid;border-bottom-color: var(--hi-v4-color-primary-500, var(--hi-v4-color-brandblue-500, #237ffa));left: 0;width: 100%;}.hi-v4-setting-item::before, .hi-v4-setting-item::after {margin-left: -10px;margin-right: -10px;}.hi-v4-setting-item--direction-before::before {display: block;top: -0.5px;-webkit-transform: translateY(-4px);transform: translateY(-4px);}.hi-v4-setting-item--direction-before::after {top: -0.5px;border-bottom-width: 1px;}.hi-v4-setting-item--direction-after::before {display: block;bottom: 0.5px;-webkit-transform: translateY(4px);transform: translateY(4px);}.hi-v4-setting-item--direction-after::after {bottom: 0.5px;border-bottom-width: 1px;}";
|
|
12
12
|
|
|
13
13
|
__styleInject__(css_248z);
|
|
14
14
|
|
package/lib/esm/use-table.js
CHANGED
|
@@ -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 = [];
|
|
@@ -71,10 +71,12 @@ var useTable = function useTable(_a) {
|
|
|
71
71
|
showColMenu = _a.showColMenu,
|
|
72
72
|
rowSelection = _a.rowSelection,
|
|
73
73
|
cellRender = _a.cellRender,
|
|
74
|
+
footerRender = _a.footerRender,
|
|
74
75
|
_a$fieldKey = _a.fieldKey,
|
|
75
76
|
fieldKey = _a$fieldKey === void 0 ? 'key' : _a$fieldKey,
|
|
76
77
|
virtual = _a.virtual,
|
|
77
|
-
|
|
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"]);
|
|
78
80
|
/**
|
|
79
81
|
* 获取 key 字段值
|
|
80
82
|
*/
|
|
@@ -186,7 +188,8 @@ var useTable = function useTable(_a) {
|
|
|
186
188
|
measureRowElementRef = _useColWidth.measureRowElementRef,
|
|
187
189
|
getColgroupProps = _useColWidth.getColgroupProps,
|
|
188
190
|
onColumnResizable = _useColWidth.onColumnResizable,
|
|
189
|
-
colWidths = _useColWidth.colWidths
|
|
191
|
+
colWidths = _useColWidth.colWidths,
|
|
192
|
+
setHeaderTableElement = _useColWidth.setHeaderTableElement; // ************************ 列冻结 ************************ //
|
|
190
193
|
|
|
191
194
|
|
|
192
195
|
var bodyTableRef = useRef(null);
|
|
@@ -217,6 +220,14 @@ var useTable = function useTable(_a) {
|
|
|
217
220
|
}, [setFixedToColumn]);
|
|
218
221
|
|
|
219
222
|
var _React$useMemo = React__default.useMemo(function () {
|
|
223
|
+
if (!leftFreezeColumn && !rightFreezeColumn) {
|
|
224
|
+
return {
|
|
225
|
+
leftFrozenColKeys: [],
|
|
226
|
+
rightFrozenColKeys: [],
|
|
227
|
+
columns: mergedColumns2
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
220
231
|
var leftFrozenColKey = leftFreezeColumn;
|
|
221
232
|
var rightFrozenKey = rightFreezeColumn; // 获取左右冻结列的下标
|
|
222
233
|
// 获取左右冻结列的下标
|
|
@@ -435,16 +446,18 @@ var useTable = function useTable(_a) {
|
|
|
435
446
|
return !isArrayNonEmpty(col.children);
|
|
436
447
|
});
|
|
437
448
|
}, [mergedColumns1]);
|
|
438
|
-
var groupedColumns =
|
|
439
|
-
|
|
449
|
+
var groupedColumns = React__default.useMemo(function () {
|
|
450
|
+
return mergedColumns1.reduce(function (acc, cur) {
|
|
451
|
+
var depth = cur.depth;
|
|
440
452
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
453
|
+
if (!acc[depth]) {
|
|
454
|
+
acc[depth] = [];
|
|
455
|
+
}
|
|
444
456
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
457
|
+
acc[depth].push(cur);
|
|
458
|
+
return acc;
|
|
459
|
+
}, []);
|
|
460
|
+
}, [mergedColumns1]);
|
|
448
461
|
var getStickyColProps = useLatestCallback(function (column) {
|
|
449
462
|
var rightStickyWidth = column.rightStickyWidth,
|
|
450
463
|
leftStickyWidth = column.leftStickyWidth,
|
|
@@ -593,8 +606,11 @@ var useTable = function useTable(_a) {
|
|
|
593
606
|
onColumnResizable: onColumnResizable,
|
|
594
607
|
isTree: isTreeView,
|
|
595
608
|
cellRender: cellRender,
|
|
609
|
+
footerRender: footerRender,
|
|
596
610
|
showColMenu: showColMenu,
|
|
597
|
-
onLoadChildren: onLoadChildren
|
|
611
|
+
onLoadChildren: onLoadChildren,
|
|
612
|
+
setHeaderTableElement: setHeaderTableElement,
|
|
613
|
+
scrollbar: scrollbar
|
|
598
614
|
});
|
|
599
615
|
};
|
|
600
616
|
|
package/lib/types/BaseTable.d.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HiBaseHTMLProps } from '@hi-ui/core';
|
|
3
|
+
export declare const TbodyContent: React.ForwardRefExoticComponent<TbodyContentProps & React.RefAttributes<HTMLDivElement | null>>;
|
|
4
|
+
export interface TbodyContentProps extends HiBaseHTMLProps<'div'> {
|
|
5
|
+
/**
|
|
6
|
+
* 数据为空时的展示内容
|
|
7
|
+
*/
|
|
8
|
+
emptyContent?: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* 负责空状态渲染
|
|
12
|
+
*/
|
|
13
|
+
export declare const renderEmptyContent: ({ className, colSpan, emptyContent, scrollBodyWidth, }: {
|
|
14
|
+
colSpan?: number | undefined;
|
|
15
|
+
className?: string | undefined;
|
|
16
|
+
emptyContent: React.ReactNode;
|
|
17
|
+
scrollBodyWidth?: string | number | undefined;
|
|
18
|
+
}) => JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { HiBaseHTMLProps } from '@hi-ui/core';
|
|
3
|
+
export declare const TheadContent: React.ForwardRefExoticComponent<TheadContentProps & React.RefAttributes<HTMLDivElement | null>>;
|
|
4
|
+
export interface TheadContentProps extends HiBaseHTMLProps<'thead'> {
|
|
5
|
+
/**
|
|
6
|
+
* 组件默认的选择器类
|
|
7
|
+
*/
|
|
8
|
+
prefixCls?: string;
|
|
9
|
+
}
|
package/lib/types/context.d.ts
CHANGED
|
@@ -37,8 +37,11 @@ export declare const TableProvider: import("react").Provider<(Omit<{
|
|
|
37
37
|
onColumnResizable: (_: any, { size }: any, index: number) => void;
|
|
38
38
|
isTree: boolean;
|
|
39
39
|
cellRender: ((text: any) => import("react").ReactNode) | undefined;
|
|
40
|
+
footerRender: ((...nodes: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[]) => import("react").ReactNode) | undefined;
|
|
40
41
|
showColMenu: boolean | undefined;
|
|
41
42
|
onLoadChildren: ((item: import("./types").TableRowEventData) => void | Promise<void | any[]>) | undefined;
|
|
43
|
+
setHeaderTableElement: import("react").Dispatch<import("react").SetStateAction<HTMLTableRowElement | null>>;
|
|
44
|
+
scrollbar: boolean | import("packages/ui/scrollbar/lib/types").ScrollbarProps | undefined;
|
|
42
45
|
scrollLeft: number;
|
|
43
46
|
scrollRight: number;
|
|
44
47
|
measureRowElementRef: import("react").MutableRefObject<HTMLTableRowElement | null>;
|
|
@@ -82,10 +85,10 @@ export declare const TableProvider: import("react").Provider<(Omit<{
|
|
|
82
85
|
scrollLeft: number;
|
|
83
86
|
scrollRight: number;
|
|
84
87
|
};
|
|
85
|
-
leftFrozenColKeys: any[];
|
|
86
|
-
rightFrozenColKeys: any[];
|
|
87
|
-
leftFixedColumnsWidth: number;
|
|
88
|
-
rightFixedColumnsWidth: number;
|
|
88
|
+
leftFrozenColKeys: any[] | never[];
|
|
89
|
+
rightFrozenColKeys: any[] | never[];
|
|
90
|
+
leftFixedColumnsWidth: number | undefined;
|
|
91
|
+
rightFixedColumnsWidth: number | undefined;
|
|
89
92
|
}, "rootProps"> & {
|
|
90
93
|
embedExpandable: boolean | {
|
|
91
94
|
rowExpandable: true | ((row: import("./types").TableColumnItem) => import("react").ReactNode);
|
|
@@ -142,8 +145,11 @@ export declare const useTableContext: () => Omit<{
|
|
|
142
145
|
onColumnResizable: (_: any, { size }: any, index: number) => void;
|
|
143
146
|
isTree: boolean;
|
|
144
147
|
cellRender: ((text: any) => import("react").ReactNode) | undefined;
|
|
148
|
+
footerRender: ((...nodes: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>[]) => import("react").ReactNode) | undefined;
|
|
145
149
|
showColMenu: boolean | undefined;
|
|
146
150
|
onLoadChildren: ((item: import("./types").TableRowEventData) => void | Promise<void | any[]>) | undefined;
|
|
151
|
+
setHeaderTableElement: import("react").Dispatch<import("react").SetStateAction<HTMLTableRowElement | null>>;
|
|
152
|
+
scrollbar: boolean | import("packages/ui/scrollbar/lib/types").ScrollbarProps | undefined;
|
|
147
153
|
scrollLeft: number;
|
|
148
154
|
scrollRight: number;
|
|
149
155
|
measureRowElementRef: import("react").MutableRefObject<HTMLTableRowElement | null>;
|
|
@@ -187,10 +193,10 @@ export declare const useTableContext: () => Omit<{
|
|
|
187
193
|
scrollLeft: number;
|
|
188
194
|
scrollRight: number;
|
|
189
195
|
};
|
|
190
|
-
leftFrozenColKeys: any[];
|
|
191
|
-
rightFrozenColKeys: any[];
|
|
192
|
-
leftFixedColumnsWidth: number;
|
|
193
|
-
rightFixedColumnsWidth: number;
|
|
196
|
+
leftFrozenColKeys: any[] | never[];
|
|
197
|
+
rightFrozenColKeys: any[] | never[];
|
|
198
|
+
leftFixedColumnsWidth: number | undefined;
|
|
199
|
+
rightFixedColumnsWidth: number | undefined;
|
|
194
200
|
}, "rootProps"> & {
|
|
195
201
|
embedExpandable: boolean | {
|
|
196
202
|
rowExpandable: true | ((row: import("./types").TableColumnItem) => import("react").ReactNode);
|
|
@@ -14,6 +14,6 @@ export declare const useColWidth: ({ resizable, data, columns, virtual, }: {
|
|
|
14
14
|
minWidth: number | undefined;
|
|
15
15
|
};
|
|
16
16
|
};
|
|
17
|
-
setHeaderTableElement: React.Dispatch<React.SetStateAction<
|
|
17
|
+
setHeaderTableElement: React.Dispatch<React.SetStateAction<HTMLTableRowElement | null>>;
|
|
18
18
|
colWidths: number[];
|
|
19
19
|
};
|