@kdcloudjs/table 1.2.2-canary.11 → 1.2.2-canary.13
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/LICENSE +568 -568
- package/README.md +111 -111
- package/dist/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.js +3628 -3483
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +11 -13
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/dist/kd-ui-complete.less +777 -777
- package/es/_utils/formatUtil.js +5 -1
- package/es/_utils/hooks.js +3 -3
- package/es/_utils/usePopper.js +13 -13
- package/es/locale/locale.js +7 -6
- package/es/style/color/colors.less +1 -1
- package/es/style/core/index.less +1 -1
- package/es/style/core/motion/other.less +27 -27
- package/es/style/core/motion/slide.less +53 -53
- package/es/style/core/motion.less +1 -1
- package/es/style/core/reset.less +185 -185
- package/es/style/index.less +1 -1
- package/es/style/mixins/index.less +18 -18
- package/es/style/mixins/overlay.less +21 -21
- package/es/style/mixins/reset.less +12 -12
- package/es/style/themes/default.less +445 -445
- package/es/table/base/BlankComponent.d.ts +11 -0
- package/es/table/base/BlankComponent.js +61 -0
- package/es/table/base/calculations.js +3 -3
- package/es/table/base/empty.js +2 -2
- package/es/table/base/globalStyleComponent.d.ts +5 -1
- package/es/table/base/globalStyleComponent.js +11 -7
- package/es/table/base/header.js +19 -8
- package/es/table/base/helpers/FastScrollManager.d.ts +96 -0
- package/es/table/base/helpers/FastScrollManager.js +167 -0
- package/es/table/base/helpers/SpanManager.js +2 -1
- package/es/table/base/helpers/TableDOMUtils.js +6 -5
- package/es/table/base/html-table.d.ts +1 -1
- package/es/table/base/html-table.js +16 -5
- package/es/table/base/interfaces.d.ts +2 -0
- package/es/table/base/loading.js +2 -2
- package/es/table/base/renderTemplates.js +16 -16
- package/es/table/base/styles.d.ts +2 -2
- package/es/table/base/styles.js +59 -4
- package/es/table/base/table.d.ts +14 -0
- package/es/table/base/table.js +163 -98
- package/es/table/base/utils.d.ts +1 -0
- package/es/table/base/utils.js +9 -3
- package/es/table/pipeline/features/colGroupExtendable.d.ts +1 -1
- package/es/table/pipeline/features/colGroupExtendable.js +7 -3
- package/es/table/pipeline/features/columnDrag.js +21 -12
- package/es/table/pipeline/features/columnFilter.js +5 -2
- package/es/table/pipeline/features/columnResizeWidth.js +11 -4
- package/es/table/pipeline/features/contextMenu.js +15 -8
- package/es/table/pipeline/features/featureApi/RowDragApi.js +2 -1
- package/es/table/pipeline/features/filter/DefaultFilterContent.js +5 -4
- package/es/table/pipeline/features/filter/Filter.d.ts +2 -1
- package/es/table/pipeline/features/filter/Filter.js +13 -8
- package/es/table/pipeline/features/filter/FilterPanel.d.ts +3 -1
- package/es/table/pipeline/features/filter/FilterPanel.js +15 -5
- package/es/table/pipeline/features/rangeSelection.js +10 -10
- package/es/table/pipeline/features/rowDetail.js +2 -2
- package/es/table/pipeline/features/rowDrag.js +47 -19
- package/es/table/pipeline/features/rowGrouping.js +2 -2
- package/es/table/pipeline/features/sort.js +7 -6
- package/es/table/pipeline/features/tips.js +10 -6
- package/es/table/pipeline/features/treeMode.js +5 -5
- package/es/table/pipeline/features/treeSelect.js +2 -2
- package/es/table/pipeline/pipeline.js +2 -1
- package/es/table/pivot/cross-table/buildCrossTable.js +8 -6
- package/es/table/pivot/cross-table/cross-table.js +3 -1
- package/es/table/pivot/cross-table/interfaces.d.ts +1 -1
- package/es/table/pivot/cross-tree-table/buildCrossTreeTable.js +10 -8
- package/es/table/pivot/cross-tree-table/cross-tree-table.js +11 -8
- package/es/table/pivot/pivot-utils/builders.js +3 -3
- package/es/table/pivot/pivot-utils/convert-utils.js +3 -3
- package/es/table/style/index.less +1 -1
- package/es/table/transforms/autoWidth.js +3 -3
- package/es/table/transforms/columnResize.js +5 -3
- package/es/table/transforms/sort.js +8 -6
- package/es/table/transforms/tips.js +4 -4
- package/es/table/transforms/treeMode.js +8 -6
- package/es/table/utils/buildTree.js +3 -3
- package/es/table/utils/collectNodes.js +3 -3
- package/es/table/utils/element.d.ts +1 -1
- package/es/table/utils/element.js +5 -3
- package/es/table/utils/exportTableAsExcel.js +3 -3
- package/es/table/utils/getTreeDepth.js +3 -3
- package/es/table/utils/groupBy.js +3 -3
- package/es/table/utils/makeRecursiveMapper.js +3 -3
- package/es/table/utils/mergeCellProps.js +1 -0
- package/es/table/utils/others.js +3 -3
- package/es/table/utils/traverseColumn.js +3 -3
- package/es/table/utils/tree-data-helpers/StrictTreeDataHelper.js +8 -7
- package/es/table/utils/tree-data-helpers/TreeDataHelper.js +5 -4
- package/lib/_utils/arrayUtil.js +3 -2
- package/lib/_utils/formatUtil.js +5 -1
- package/lib/_utils/hooks.js +3 -3
- package/lib/_utils/index.js +3 -2
- package/lib/_utils/type.js +5 -3
- package/lib/_utils/usePopper.js +21 -18
- package/lib/config-provider/ConfigContext.js +2 -1
- package/lib/config-provider/compDefaultProps.js +2 -1
- package/lib/config-provider/configProvider.js +4 -3
- package/lib/config-provider/defaultConfig.js +2 -1
- package/lib/config-provider/index.js +2 -1
- package/lib/locale/index.js +4 -3
- package/lib/locale/locale.js +14 -10
- package/lib/locale/zh-CN.js +2 -1
- package/lib/style/color/colors.less +1 -1
- package/lib/style/components.less +1 -1
- package/lib/style/core/index.less +1 -1
- package/lib/style/core/motion/other.less +27 -27
- package/lib/style/core/motion/slide.less +53 -53
- package/lib/style/core/motion.less +1 -1
- package/lib/style/core/reset.less +185 -185
- package/lib/style/index.less +1 -1
- package/lib/style/mixins/index.less +18 -18
- package/lib/style/mixins/overlay.less +21 -21
- package/lib/style/mixins/reset.less +12 -12
- package/lib/style/themes/default.less +445 -445
- package/lib/table/base/BlankComponent.d.ts +11 -0
- package/lib/table/base/BlankComponent.js +75 -0
- package/lib/table/base/calculations.js +3 -3
- package/lib/table/base/empty.js +4 -4
- package/lib/table/base/globalStyleComponent.d.ts +5 -1
- package/lib/table/base/globalStyleComponent.js +16 -11
- package/lib/table/base/header.js +19 -8
- package/lib/table/base/helpers/FastScrollManager.d.ts +96 -0
- package/lib/table/base/helpers/FastScrollManager.js +175 -0
- package/lib/table/base/helpers/SpanManager.js +5 -3
- package/lib/table/base/helpers/TableDOMUtils.js +9 -7
- package/lib/table/base/helpers/getRichVisibleRectsStream.js +2 -2
- package/lib/table/base/html-table.d.ts +1 -1
- package/lib/table/base/html-table.js +16 -5
- package/lib/table/base/interfaces.d.ts +2 -0
- package/lib/table/base/loading.js +2 -2
- package/lib/table/base/renderTemplates.js +18 -18
- package/lib/table/base/styles.d.ts +2 -2
- package/lib/table/base/styles.js +74 -11
- package/lib/table/base/table.d.ts +14 -0
- package/lib/table/base/table.js +173 -109
- package/lib/table/base/utils.d.ts +1 -0
- package/lib/table/base/utils.js +28 -13
- package/lib/table/common-views.js +8 -4
- package/lib/table/internals.js +3 -2
- package/lib/table/pipeline/const.js +3 -2
- package/lib/table/pipeline/features/autoFill.js +6 -3
- package/lib/table/pipeline/features/colGroupExtendable.d.ts +1 -1
- package/lib/table/pipeline/features/colGroupExtendable.js +10 -5
- package/lib/table/pipeline/features/columnDrag.js +21 -12
- package/lib/table/pipeline/features/columnFilter.js +5 -2
- package/lib/table/pipeline/features/columnResizeWidth.js +19 -9
- package/lib/table/pipeline/features/contextMenu.js +16 -9
- package/lib/table/pipeline/features/featureApi/RowDragApi.js +5 -3
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +9 -7
- package/lib/table/pipeline/features/filter/Filter.d.ts +2 -1
- package/lib/table/pipeline/features/filter/Filter.js +17 -11
- package/lib/table/pipeline/features/filter/FilterPanel.d.ts +3 -1
- package/lib/table/pipeline/features/filter/FilterPanel.js +19 -8
- package/lib/table/pipeline/features/filter/util.js +3 -2
- package/lib/table/pipeline/features/footerDataSource.js +2 -1
- package/lib/table/pipeline/features/rangeSelection.js +14 -12
- package/lib/table/pipeline/features/rowDetail.js +2 -2
- package/lib/table/pipeline/features/rowDrag.js +53 -22
- package/lib/table/pipeline/features/rowGrouping.js +2 -2
- package/lib/table/pipeline/features/sort.js +7 -6
- package/lib/table/pipeline/features/tips.js +10 -6
- package/lib/table/pipeline/features/treeMode.js +9 -7
- package/lib/table/pipeline/features/treeSelect.js +2 -2
- package/lib/table/pipeline/index.js +2 -2
- package/lib/table/pipeline/pipeline.js +4 -2
- package/lib/table/pivot/cross-table/buildCrossTable.js +8 -6
- package/lib/table/pivot/cross-table/constants.js +2 -1
- package/lib/table/pivot/cross-table/cross-table.js +6 -3
- package/lib/table/pivot/cross-table/interfaces.d.ts +1 -1
- package/lib/table/pivot/cross-tree-table/buildCrossTreeTable.js +10 -8
- package/lib/table/pivot/cross-tree-table/cross-tree-table.js +13 -9
- package/lib/table/pivot/pivot-utils/builders.js +3 -3
- package/lib/table/pivot/pivot-utils/convert-utils.js +3 -3
- package/lib/table/style/index.less +1 -1
- package/lib/table/transforms/autoWidth.js +5 -5
- package/lib/table/transforms/columnResize.js +7 -5
- package/lib/table/transforms/sort.js +10 -8
- package/lib/table/transforms/tips.js +4 -4
- package/lib/table/transforms/treeMode.js +10 -8
- package/lib/table/use/useResizeObserver.js +2 -1
- package/lib/table/utils/browserType.js +4 -2
- package/lib/table/utils/buildTree.js +3 -3
- package/lib/table/utils/collectNodes.js +3 -3
- package/lib/table/utils/console.js +3 -2
- package/lib/table/utils/copyToClipboard.js +2 -1
- package/lib/table/utils/element.d.ts +1 -1
- package/lib/table/utils/element.js +5 -3
- package/lib/table/utils/exportTableAsExcel.js +3 -3
- package/lib/table/utils/getTreeDepth.js +3 -3
- package/lib/table/utils/groupBy.js +3 -3
- package/lib/table/utils/keyCode.js +2 -1
- package/lib/table/utils/makeRecursiveMapper.js +3 -3
- package/lib/table/utils/mergeCellProps.js +1 -0
- package/lib/table/utils/others.js +5 -4
- package/lib/table/utils/proto.js +2 -1
- package/lib/table/utils/selectColumn.js +4 -2
- package/lib/table/utils/traverseColumn.js +3 -3
- package/lib/table/utils/tree-data-helpers/StrictTreeDataHelper.js +11 -9
- package/lib/table/utils/tree-data-helpers/TreeDataHelper.js +8 -6
- package/package.json +218 -218
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface BlankProps {
|
|
3
|
+
height: number;
|
|
4
|
+
className?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface BlankRef {
|
|
7
|
+
updateHeight: (newHeight: number) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const TopBlank: React.MemoExoticComponent<React.ForwardRefExoticComponent<BlankProps & React.RefAttributes<BlankRef>>>;
|
|
10
|
+
export declare const BottomBlank: React.MemoExoticComponent<React.ForwardRefExoticComponent<BlankProps & React.RefAttributes<BlankRef>>>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
2
|
+
import React, { useState, useImperativeHandle, forwardRef, memo } from 'react';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import { Classes } from './styles';
|
|
5
|
+
var TopBlankComponent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
6
|
+
var initialHeight = _ref.height;
|
|
7
|
+
var _useState = useState(initialHeight),
|
|
8
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
9
|
+
height = _useState2[0],
|
|
10
|
+
setHeight = _useState2[1];
|
|
11
|
+
useImperativeHandle(ref, function () {
|
|
12
|
+
return {
|
|
13
|
+
updateHeight: function updateHeight(newHeight) {
|
|
14
|
+
if (height !== newHeight) {
|
|
15
|
+
setHeight(newHeight);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}, [height]);
|
|
20
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
21
|
+
style: {
|
|
22
|
+
height: height
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
TopBlankComponent.displayName = 'TopBlank';
|
|
27
|
+
var BottomBlankComponent = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
28
|
+
var initialHeight = _ref2.height,
|
|
29
|
+
className = _ref2.className;
|
|
30
|
+
var _useState3 = useState(initialHeight),
|
|
31
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
32
|
+
height = _useState4[0],
|
|
33
|
+
setHeight = _useState4[1];
|
|
34
|
+
useImperativeHandle(ref, function () {
|
|
35
|
+
return {
|
|
36
|
+
updateHeight: function updateHeight(newHeight) {
|
|
37
|
+
if (height !== newHeight) {
|
|
38
|
+
setHeight(newHeight);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}, [height]);
|
|
43
|
+
if (height <= 0) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
47
|
+
key: "bottom-blank",
|
|
48
|
+
className: cx(Classes.virtualBlank, 'bottom', className),
|
|
49
|
+
style: {
|
|
50
|
+
height: height
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
BottomBlankComponent.displayName = 'BottomBlank';
|
|
55
|
+
// 使用 memo 优化,只有当 height 或 className 改变时才重新渲染
|
|
56
|
+
export var TopBlank = /*#__PURE__*/memo(TopBlankComponent, function (prevProps, nextProps) {
|
|
57
|
+
return prevProps.height === nextProps.height && prevProps.className === nextProps.className;
|
|
58
|
+
});
|
|
59
|
+
export var BottomBlank = /*#__PURE__*/memo(BottomBlankComponent, function (prevProps, nextProps) {
|
|
60
|
+
return prevProps.height === nextProps.height && prevProps.className === nextProps.className;
|
|
61
|
+
});
|
|
@@ -10,9 +10,9 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
|
10
10
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
11
11
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
12
12
|
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
13
|
-
function _createForOfIteratorHelper(
|
|
14
|
-
function _unsupportedIterableToArray(
|
|
15
|
-
function _arrayLikeToArray(
|
|
13
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
14
|
+
function _unsupportedIterableToArray(o, minLen) { var _context10; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context10 = Object.prototype.toString.call(o)).call(_context10, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
15
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
16
16
|
import { collectNodes, isLeafNode, console } from '../utils';
|
|
17
17
|
import { AUTO_VIRTUAL_THRESHOLD, OVERSCAN_SIZE, sum } from './utils';
|
|
18
18
|
function resolveVirtualEnabled(virtualEnum, defaultValue) {
|
package/es/table/base/empty.js
CHANGED
|
@@ -31,8 +31,8 @@ export function EmptyHtmlTable(_ref) {
|
|
|
31
31
|
style: {
|
|
32
32
|
height: emptyCellHeight !== null && emptyCellHeight !== void 0 ? emptyCellHeight : 200
|
|
33
33
|
}
|
|
34
|
-
})))), show &&
|
|
34
|
+
})))), show && /*#__PURE__*/React.createElement("div", {
|
|
35
35
|
className: Classes.emptyWrapper,
|
|
36
36
|
key: "empty"
|
|
37
|
-
}, /*#__PURE__*/React.createElement(EmptyContent, null)))
|
|
37
|
+
}, /*#__PURE__*/React.createElement(EmptyContent, null)));
|
|
38
38
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { PureComponent } from 'react';
|
|
2
|
-
|
|
2
|
+
interface GlobalStyleComponentProps {
|
|
3
|
+
direction: string;
|
|
4
|
+
}
|
|
5
|
+
export default class GlobalStyleComponent extends PureComponent<GlobalStyleComponentProps> {
|
|
3
6
|
render(): JSX.Element;
|
|
4
7
|
}
|
|
8
|
+
export {};
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
|
|
2
2
|
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
3
3
|
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
4
|
+
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
4
5
|
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
5
6
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
7
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
9
9
|
import React, { PureComponent } from 'react';
|
|
10
10
|
import { GlobalStyle } from './styles';
|
|
11
11
|
var GlobalStyleComponent = /*#__PURE__*/function (_PureComponent) {
|
|
12
|
+
_inherits(GlobalStyleComponent, _PureComponent);
|
|
13
|
+
var _super = _createSuper(GlobalStyleComponent);
|
|
12
14
|
function GlobalStyleComponent() {
|
|
13
15
|
_classCallCheck(this, GlobalStyleComponent);
|
|
14
|
-
return
|
|
16
|
+
return _super.apply(this, arguments);
|
|
15
17
|
}
|
|
16
|
-
|
|
17
|
-
return _createClass(GlobalStyleComponent, [{
|
|
18
|
+
_createClass(GlobalStyleComponent, [{
|
|
18
19
|
key: "render",
|
|
19
20
|
value: function render() {
|
|
20
|
-
return /*#__PURE__*/React.createElement(GlobalStyle,
|
|
21
|
+
return /*#__PURE__*/React.createElement(GlobalStyle, {
|
|
22
|
+
direction: this.props.direction
|
|
23
|
+
});
|
|
21
24
|
}
|
|
22
25
|
}]);
|
|
26
|
+
return GlobalStyleComponent;
|
|
23
27
|
}(PureComponent);
|
|
24
28
|
export { GlobalStyleComponent as default };
|
package/es/table/base/header.js
CHANGED
|
@@ -8,9 +8,9 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
|
8
8
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
9
9
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
10
10
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
11
|
-
function _createForOfIteratorHelper(
|
|
12
|
-
function _unsupportedIterableToArray(
|
|
13
|
-
function _arrayLikeToArray(
|
|
11
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
12
|
+
function _unsupportedIterableToArray(o, minLen) { var _context6; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context6 = Object.prototype.toString.call(o)).call(_context6, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
14
14
|
import cx from 'classnames';
|
|
15
15
|
import React from 'react';
|
|
16
16
|
import { getTreeDepth, isLeafNode } from '../utils';
|
|
@@ -193,13 +193,15 @@ export default function TableHeader(_ref2) {
|
|
|
193
193
|
var nested = info.nested,
|
|
194
194
|
flat = _flatInstanceProperty(info),
|
|
195
195
|
stickyLeftMap = info.stickyLeftMap,
|
|
196
|
-
stickyRightMap = info.stickyRightMap
|
|
196
|
+
stickyRightMap = info.stickyRightMap,
|
|
197
|
+
direction = info.direction;
|
|
197
198
|
var rowCount = _rowCount !== null && _rowCount !== void 0 ? _rowCount : getTreeDepth(nested.full) + 1;
|
|
198
199
|
var headerRenderInfo = calculateHeaderRenderInfo(info, rowCount);
|
|
199
200
|
var fullFlatCount = flat.full.length;
|
|
200
201
|
var leftFlatCount = flat.left.length;
|
|
201
202
|
var rightFlatCount = flat.right.length;
|
|
202
203
|
var thead = _mapInstanceProperty(_context4 = headerRenderInfo.leveled).call(_context4, function (wrappedCols, level) {
|
|
204
|
+
var _cx2;
|
|
203
205
|
var _wrappedCols = _concatInstanceProperty(wrappedCols).call(wrappedCols);
|
|
204
206
|
// 左中右区域渲染,分组列可能单独位于一个区域,此时其他区域也需要适配分组的高度
|
|
205
207
|
// rowspan 需要空白的列头去占位, 需要补充额外的空白列头
|
|
@@ -214,6 +216,7 @@ export default function TableHeader(_ref2) {
|
|
|
214
216
|
var headerCells = _mapInstanceProperty(_wrappedCols).call(_wrappedCols, function (wrapped, index) {
|
|
215
217
|
var _a, _b, _c;
|
|
216
218
|
if (wrapped.type === 'normal') {
|
|
219
|
+
var _cx;
|
|
217
220
|
var colIndex = wrapped.colIndex,
|
|
218
221
|
colSpan = wrapped.colSpan,
|
|
219
222
|
isLeaf = wrapped.isLeaf,
|
|
@@ -222,17 +225,25 @@ export default function TableHeader(_ref2) {
|
|
|
222
225
|
var positionStyle = {};
|
|
223
226
|
if (colIndex < leftFlatCount) {
|
|
224
227
|
positionStyle.position = 'sticky';
|
|
225
|
-
|
|
228
|
+
if (direction === 'rtl') {
|
|
229
|
+
positionStyle.right = stickyLeftMap.get(colIndex);
|
|
230
|
+
} else {
|
|
231
|
+
positionStyle.left = stickyLeftMap.get(colIndex);
|
|
232
|
+
}
|
|
226
233
|
} else if (colIndex >= fullFlatCount - rightFlatCount) {
|
|
227
234
|
positionStyle.position = 'sticky';
|
|
228
235
|
var stickyRightIndex = colSpan > 1 ? colIndex + colSpan - 1 : colIndex;
|
|
229
|
-
|
|
236
|
+
if (direction === 'rtl') {
|
|
237
|
+
positionStyle.left = stickyRightMap.get(stickyRightIndex) + (typeof stickyRightOffset === 'number' ? stickyRightOffset : 0);
|
|
238
|
+
} else {
|
|
239
|
+
positionStyle.right = stickyRightMap.get(stickyRightIndex) + (typeof stickyRightOffset === 'number' ? stickyRightOffset : 0);
|
|
240
|
+
}
|
|
230
241
|
}
|
|
231
242
|
var justifyContent = col.align === 'right' ? 'flex-end' : col.align === 'center' ? 'center' : 'flex-start';
|
|
232
243
|
var cell = /*#__PURE__*/React.createElement("th", _extends({
|
|
233
244
|
key: colIndex
|
|
234
245
|
}, headerCellProps, {
|
|
235
|
-
className: cx(Classes.tableHeaderCell, headerCellProps.className,
|
|
246
|
+
className: cx(Classes.tableHeaderCell, headerCellProps.className, (_cx = {}, _defineProperty(_cx, Classes.first, colIndex === 0), _defineProperty(_cx, Classes.last, colIndex + colSpan === fullFlatCount), _defineProperty(_cx, Classes.lockLeft, colIndex < leftFlatCount || theaderPosition === 'left'), _defineProperty(_cx, Classes.lockRight, colIndex >= fullFlatCount - rightFlatCount || theaderPosition === 'right'), _defineProperty(_cx, Classes.leaf, wrapped.isLeaf), _cx)),
|
|
236
247
|
colSpan: colSpan,
|
|
237
248
|
rowSpan: isLeaf ? rowCount - level : undefined,
|
|
238
249
|
style: _extends(_extends({
|
|
@@ -262,7 +273,7 @@ export default function TableHeader(_ref2) {
|
|
|
262
273
|
});
|
|
263
274
|
return /*#__PURE__*/React.createElement("tr", {
|
|
264
275
|
key: level,
|
|
265
|
-
className: cx(Classes.tableHeaderRow,
|
|
276
|
+
className: cx(Classes.tableHeaderRow, (_cx2 = {}, _defineProperty(_cx2, Classes.first, level === 0), _defineProperty(_cx2, Classes.last, level === rowCount - 1), _cx2))
|
|
266
277
|
}, headerCells);
|
|
267
278
|
});
|
|
268
279
|
var colgroup = _mapInstanceProperty(_context5 = _flatInstanceProperty(headerRenderInfo)).call(_context5, function (wrapped) {
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 快速滚动管理器
|
|
3
|
+
* 抽取 BaseTable 中的快速滚动相关逻辑
|
|
4
|
+
*/
|
|
5
|
+
export interface FastScrollConfig {
|
|
6
|
+
/** 预渲染缓冲区大小,用于快速滚动判断 */
|
|
7
|
+
overscanSize?: number;
|
|
8
|
+
/** 快速滚动速度阈值 (像素/毫秒) */
|
|
9
|
+
velocityThreshold?: number;
|
|
10
|
+
/** 快速滚动距离倍数阈值 */
|
|
11
|
+
distanceMultiplier?: number;
|
|
12
|
+
/** 快速滚动结束等待时间 (毫秒) - 高速滚动 */
|
|
13
|
+
fastScrollEndDelayHigh?: number;
|
|
14
|
+
/** 快速滚动结束等待时间 (毫秒) - 普通滚动 */
|
|
15
|
+
fastScrollEndDelayNormal?: number;
|
|
16
|
+
/** 高速滚动速度阈值 (像素/毫秒) */
|
|
17
|
+
highVelocityThreshold?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface FastScrollState {
|
|
20
|
+
lastScrollTime: number;
|
|
21
|
+
scrollVelocity: number;
|
|
22
|
+
lastOffsetY: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ScrollEventData {
|
|
25
|
+
offsetY: number;
|
|
26
|
+
maxRenderHeight: number;
|
|
27
|
+
maxRenderWidth: number;
|
|
28
|
+
}
|
|
29
|
+
export interface VerticalRenderRange {
|
|
30
|
+
topIndex: number;
|
|
31
|
+
bottomIndex: number;
|
|
32
|
+
topBlank: number;
|
|
33
|
+
bottomBlank: number;
|
|
34
|
+
}
|
|
35
|
+
export interface FastScrollCallbacks {
|
|
36
|
+
onFastScrollStart: (renderData: {
|
|
37
|
+
offsetY: number;
|
|
38
|
+
maxRenderHeight: number;
|
|
39
|
+
maxRenderWidth: number;
|
|
40
|
+
verticalRenderRange: VerticalRenderRange;
|
|
41
|
+
}) => void;
|
|
42
|
+
onFastScrollEnd: (scrollData: ScrollEventData) => void;
|
|
43
|
+
getCurrentRenderRange: (offsetY: number, maxRenderHeight: number, dataLength: number) => VerticalRenderRange;
|
|
44
|
+
}
|
|
45
|
+
export declare class FastScrollManager {
|
|
46
|
+
private state;
|
|
47
|
+
private isFastScrolling;
|
|
48
|
+
private fastScrollEndTimer?;
|
|
49
|
+
private config;
|
|
50
|
+
private callbacks;
|
|
51
|
+
constructor(callbacks: FastScrollCallbacks, config?: FastScrollConfig);
|
|
52
|
+
/**
|
|
53
|
+
* 检测是否接近底部(剩余滚动距离少于两屏)
|
|
54
|
+
*/
|
|
55
|
+
private isNearBottom;
|
|
56
|
+
/**
|
|
57
|
+
* 处理滚动事件 - 检测和处理快速滚动
|
|
58
|
+
*/
|
|
59
|
+
handleScrollEvent(sizeAndOffset: ScrollEventData, currentState: {
|
|
60
|
+
offsetY: number;
|
|
61
|
+
maxRenderHeight: number;
|
|
62
|
+
maxRenderWidth: number;
|
|
63
|
+
}, dataLength: number, totalScrollHeight: number): void;
|
|
64
|
+
/**
|
|
65
|
+
* 开始快速滚动
|
|
66
|
+
*/
|
|
67
|
+
private startFastScrolling;
|
|
68
|
+
/**
|
|
69
|
+
* 重置快速滚动结束定时器
|
|
70
|
+
*/
|
|
71
|
+
private resetFastScrollEndTimer;
|
|
72
|
+
/**
|
|
73
|
+
* 结束快速滚动
|
|
74
|
+
*/
|
|
75
|
+
private endFastScrolling;
|
|
76
|
+
/**
|
|
77
|
+
* 清理资源
|
|
78
|
+
*/
|
|
79
|
+
cleanup(): void;
|
|
80
|
+
/**
|
|
81
|
+
* 获取当前是否处于快速滚动状态
|
|
82
|
+
*/
|
|
83
|
+
getIsFastScrolling(): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* 获取当前滚动速度
|
|
86
|
+
*/
|
|
87
|
+
getScrollVelocity(): number;
|
|
88
|
+
/**
|
|
89
|
+
* 清理资源
|
|
90
|
+
*/
|
|
91
|
+
destroy(): void;
|
|
92
|
+
/**
|
|
93
|
+
* 获取当前配置
|
|
94
|
+
*/
|
|
95
|
+
getConfig(): Readonly<Required<FastScrollConfig>>;
|
|
96
|
+
}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
3
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
4
|
+
/**
|
|
5
|
+
* 快速滚动管理器
|
|
6
|
+
* 抽取 BaseTable 中的快速滚动相关逻辑
|
|
7
|
+
*/
|
|
8
|
+
export var FastScrollManager = /*#__PURE__*/function () {
|
|
9
|
+
function FastScrollManager(callbacks) {
|
|
10
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
11
|
+
_classCallCheck(this, FastScrollManager);
|
|
12
|
+
// 快速滚动状态
|
|
13
|
+
this.state = {
|
|
14
|
+
lastScrollTime: 0,
|
|
15
|
+
scrollVelocity: 0,
|
|
16
|
+
lastOffsetY: 0
|
|
17
|
+
};
|
|
18
|
+
// 快速滚动标志 - 作为私有属性立即更新
|
|
19
|
+
this.isFastScrolling = false;
|
|
20
|
+
this.callbacks = callbacks;
|
|
21
|
+
// 合并默认配置
|
|
22
|
+
this.config = _extends({
|
|
23
|
+
overscanSize: 100,
|
|
24
|
+
velocityThreshold: 3,
|
|
25
|
+
distanceMultiplier: 3,
|
|
26
|
+
fastScrollEndDelayHigh: 200,
|
|
27
|
+
fastScrollEndDelayNormal: 150,
|
|
28
|
+
highVelocityThreshold: 5
|
|
29
|
+
}, config);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 检测是否接近底部(剩余滚动距离少于两屏)
|
|
33
|
+
*/
|
|
34
|
+
_createClass(FastScrollManager, [{
|
|
35
|
+
key: "isNearBottom",
|
|
36
|
+
value: function isNearBottom(currentScrollTop, maxRenderHeight, totalScrollHeight) {
|
|
37
|
+
var remainingScrollDistance = totalScrollHeight - currentScrollTop - maxRenderHeight;
|
|
38
|
+
return remainingScrollDistance < maxRenderHeight;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* 处理滚动事件 - 检测和处理快速滚动
|
|
42
|
+
*/
|
|
43
|
+
}, {
|
|
44
|
+
key: "handleScrollEvent",
|
|
45
|
+
value: function handleScrollEvent(sizeAndOffset, currentState, dataLength, totalScrollHeight) {
|
|
46
|
+
var currentTime = performance.now();
|
|
47
|
+
var deltaY = Math.abs(sizeAndOffset.offsetY - this.state.lastOffsetY);
|
|
48
|
+
var deltaTime = currentTime - this.state.lastScrollTime;
|
|
49
|
+
// 计算滚动速度 (像素/毫秒)
|
|
50
|
+
this.state.scrollVelocity = deltaTime > 0 ? deltaY / deltaTime : 0;
|
|
51
|
+
// 检测是否接近底部
|
|
52
|
+
var isNearBottom = this.isNearBottom(sizeAndOffset.offsetY, sizeAndOffset.maxRenderHeight, totalScrollHeight);
|
|
53
|
+
// 如果正在快速滚动但接近底部,提前结束快速滚动
|
|
54
|
+
if (this.isFastScrolling && isNearBottom) {
|
|
55
|
+
this.endFastScrolling(sizeAndOffset);
|
|
56
|
+
return; // 让正常渲染逻辑接管
|
|
57
|
+
}
|
|
58
|
+
// 快速滚动判断条件:
|
|
59
|
+
// 1. 滚动距离超过阈值 && 滚动速度超过阈值
|
|
60
|
+
// 2. 当前未在快速滚动状态
|
|
61
|
+
// 3. 未接近底部边界
|
|
62
|
+
var isSignificantChange = deltaY > this.config.overscanSize * this.config.distanceMultiplier;
|
|
63
|
+
var isHighVelocity = this.state.scrollVelocity > this.config.velocityThreshold;
|
|
64
|
+
var shouldStartFastScroll = (isSignificantChange || isHighVelocity) && !this.isFastScrolling && !isNearBottom; // 接近底部时不启动快速滚动
|
|
65
|
+
if (shouldStartFastScroll) {
|
|
66
|
+
this.startFastScrolling(currentState, dataLength);
|
|
67
|
+
}
|
|
68
|
+
// 重置快速滚动结束定时器
|
|
69
|
+
if (this.isFastScrolling) {
|
|
70
|
+
this.resetFastScrollEndTimer(sizeAndOffset);
|
|
71
|
+
}
|
|
72
|
+
// 更新记录
|
|
73
|
+
this.state.lastOffsetY = sizeAndOffset.offsetY;
|
|
74
|
+
this.state.lastScrollTime = currentTime;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 开始快速滚动
|
|
78
|
+
*/
|
|
79
|
+
}, {
|
|
80
|
+
key: "startFastScrolling",
|
|
81
|
+
value: function startFastScrolling(currentState, dataLength) {
|
|
82
|
+
this.isFastScrolling = true;
|
|
83
|
+
// 获取当前渲染范围作为缓存
|
|
84
|
+
var currentVerticalRange = this.callbacks.getCurrentRenderRange(currentState.offsetY, currentState.maxRenderHeight, dataLength);
|
|
85
|
+
// 通知外部开始快速滚动
|
|
86
|
+
this.callbacks.onFastScrollStart({
|
|
87
|
+
offsetY: currentState.offsetY,
|
|
88
|
+
maxRenderHeight: currentState.maxRenderHeight,
|
|
89
|
+
maxRenderWidth: currentState.maxRenderWidth,
|
|
90
|
+
verticalRenderRange: currentVerticalRange
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* 重置快速滚动结束定时器
|
|
95
|
+
*/
|
|
96
|
+
}, {
|
|
97
|
+
key: "resetFastScrollEndTimer",
|
|
98
|
+
value: function resetFastScrollEndTimer(sizeAndOffset) {
|
|
99
|
+
var _this = this;
|
|
100
|
+
if (this.fastScrollEndTimer) {
|
|
101
|
+
clearTimeout(this.fastScrollEndTimer);
|
|
102
|
+
}
|
|
103
|
+
var waitTime = this.state.scrollVelocity > this.config.highVelocityThreshold ? this.config.fastScrollEndDelayHigh : this.config.fastScrollEndDelayNormal;
|
|
104
|
+
this.fastScrollEndTimer = window.setTimeout(function () {
|
|
105
|
+
_this.endFastScrolling(sizeAndOffset);
|
|
106
|
+
}, waitTime);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* 结束快速滚动
|
|
110
|
+
*/
|
|
111
|
+
}, {
|
|
112
|
+
key: "endFastScrolling",
|
|
113
|
+
value: function endFastScrolling(sizeAndOffset) {
|
|
114
|
+
this.isFastScrolling = false;
|
|
115
|
+
this.fastScrollEndTimer = undefined;
|
|
116
|
+
// 通知外部结束快速滚动
|
|
117
|
+
this.callbacks.onFastScrollEnd(sizeAndOffset);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* 清理资源
|
|
121
|
+
*/
|
|
122
|
+
}, {
|
|
123
|
+
key: "cleanup",
|
|
124
|
+
value: function cleanup() {
|
|
125
|
+
if (this.fastScrollEndTimer) {
|
|
126
|
+
clearTimeout(this.fastScrollEndTimer);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* 获取当前是否处于快速滚动状态
|
|
131
|
+
*/
|
|
132
|
+
}, {
|
|
133
|
+
key: "getIsFastScrolling",
|
|
134
|
+
value: function getIsFastScrolling() {
|
|
135
|
+
return this.isFastScrolling;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* 获取当前滚动速度
|
|
139
|
+
*/
|
|
140
|
+
}, {
|
|
141
|
+
key: "getScrollVelocity",
|
|
142
|
+
value: function getScrollVelocity() {
|
|
143
|
+
return this.state.scrollVelocity;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 清理资源
|
|
147
|
+
*/
|
|
148
|
+
}, {
|
|
149
|
+
key: "destroy",
|
|
150
|
+
value: function destroy() {
|
|
151
|
+
if (this.fastScrollEndTimer) {
|
|
152
|
+
clearTimeout(this.fastScrollEndTimer);
|
|
153
|
+
this.fastScrollEndTimer = undefined;
|
|
154
|
+
}
|
|
155
|
+
this.isFastScrolling = false;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* 获取当前配置
|
|
159
|
+
*/
|
|
160
|
+
}, {
|
|
161
|
+
key: "getConfig",
|
|
162
|
+
value: function getConfig() {
|
|
163
|
+
return _extends({}, this.config);
|
|
164
|
+
}
|
|
165
|
+
}]);
|
|
166
|
+
return FastScrollManager;
|
|
167
|
+
}();
|
|
@@ -9,7 +9,7 @@ var SpanManager = /*#__PURE__*/function () {
|
|
|
9
9
|
_classCallCheck(this, SpanManager);
|
|
10
10
|
this.rects = [];
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
_createClass(SpanManager, [{
|
|
13
13
|
key: "testSkip",
|
|
14
14
|
value: function testSkip(rowIndex, colIndex) {
|
|
15
15
|
return this.rects.some(function (_ref) {
|
|
@@ -39,5 +39,6 @@ var SpanManager = /*#__PURE__*/function () {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
}]);
|
|
42
|
+
return SpanManager;
|
|
42
43
|
}();
|
|
43
44
|
export { SpanManager as default };
|
|
@@ -59,17 +59,17 @@ export var TableDOMHelper = /*#__PURE__*/function () {
|
|
|
59
59
|
this.getInRangeRowByCellEvent = function (e) {
|
|
60
60
|
var _context;
|
|
61
61
|
var _a;
|
|
62
|
-
var
|
|
62
|
+
var getParentNode = function getParentNode(ele, target) {
|
|
63
63
|
if (ele.parentNode.nodeName === target) {
|
|
64
64
|
return ele.parentNode;
|
|
65
65
|
}
|
|
66
|
-
return
|
|
66
|
+
return getParentNode(ele.parentNode, target);
|
|
67
67
|
};
|
|
68
68
|
e = e instanceof Array ? e[0] : e;
|
|
69
69
|
var curCell = e === null || e === void 0 ? void 0 : e.currentTarget;
|
|
70
|
-
var curRow =
|
|
70
|
+
var curRow = getParentNode(curCell, 'TR');
|
|
71
71
|
var curRowSpan = parseInt(e.currentTarget.getAttribute('rowspan')) || 1;
|
|
72
|
-
var rows = (_a =
|
|
72
|
+
var rows = (_a = getParentNode(curCell, 'TABLE')) === null || _a === void 0 ? void 0 : _a.rows;
|
|
73
73
|
return _sliceInstanceProperty(_context = _Array$from(rows)).call(_context, curRow.rowIndex, curRow.rowIndex + curRowSpan);
|
|
74
74
|
};
|
|
75
75
|
this.artTableWrapper = artTableWrapper;
|
|
@@ -86,7 +86,7 @@ export var TableDOMHelper = /*#__PURE__*/function () {
|
|
|
86
86
|
this.stickyScroll = stickyScrolls[stickyScrolls.length - 1]; // 当嵌套多层表格时,需要查找最后一个,否则会查找到父表格内嵌套的子表格的
|
|
87
87
|
this.stickyScrollItem = this.stickyScroll.querySelector(".".concat(Classes.stickyScrollItem));
|
|
88
88
|
}
|
|
89
|
-
|
|
89
|
+
_createClass(TableDOMHelper, [{
|
|
90
90
|
key: "getVirtualTop",
|
|
91
91
|
value: function getVirtualTop() {
|
|
92
92
|
return this.tableBody.querySelector(".".concat(Classes.virtualBlank, ".top"));
|
|
@@ -137,4 +137,5 @@ export var TableDOMHelper = /*#__PURE__*/function () {
|
|
|
137
137
|
return rowOffsetTop + tableOffsetTop;
|
|
138
138
|
}
|
|
139
139
|
}]);
|
|
140
|
+
return TableDOMHelper;
|
|
140
141
|
}();
|
|
@@ -5,7 +5,7 @@ export interface HtmlTableProps extends Required<Pick<BaseTableProps, 'getRowPro
|
|
|
5
5
|
tbodyHtmlTag: 'tbody' | 'tfoot';
|
|
6
6
|
data: any[];
|
|
7
7
|
stickyRightOffset?: number;
|
|
8
|
-
horizontalRenderInfo: Pick<RenderInfo, 'flat' | 'visible' | 'horizontalRenderRange' | 'stickyLeftMap' | 'stickyRightMap'>;
|
|
8
|
+
horizontalRenderInfo: Pick<RenderInfo, 'flat' | 'visible' | 'horizontalRenderRange' | 'stickyLeftMap' | 'stickyRightMap' | 'direction'>;
|
|
9
9
|
verticalRenderInfo: {
|
|
10
10
|
offset: number;
|
|
11
11
|
first: number;
|
|
@@ -19,7 +19,8 @@ export function HtmlTable(_ref) {
|
|
|
19
19
|
hozInfo = _ref.horizontalRenderInfo,
|
|
20
20
|
tbodyPosition = _ref.tbodyPosition;
|
|
21
21
|
var flat = _flatInstanceProperty(hozInfo),
|
|
22
|
-
hoz = hozInfo.horizontalRenderRange
|
|
22
|
+
hoz = hozInfo.horizontalRenderRange,
|
|
23
|
+
direction = hozInfo.direction;
|
|
23
24
|
var spanManager = new SpanManager();
|
|
24
25
|
var fullFlatCount = flat.full.length;
|
|
25
26
|
var leftFlatCount = flat.left.length;
|
|
@@ -28,11 +29,11 @@ export function HtmlTable(_ref) {
|
|
|
28
29
|
descriptors: hozInfo.visible
|
|
29
30
|
}), /*#__PURE__*/React.createElement(tbodyHtmlTag, null, _mapInstanceProperty(data).call(data, renderRow)));
|
|
30
31
|
function renderRow(record, i) {
|
|
31
|
-
var _context;
|
|
32
|
+
var _cx, _context;
|
|
32
33
|
var rowIndex = verInfo.offset + i;
|
|
33
34
|
spanManager.stripUpwards(rowIndex);
|
|
34
35
|
var rowProps = getRowProps(record, rowIndex);
|
|
35
|
-
var rowClass = cx(Classes.tableRow,
|
|
36
|
+
var rowClass = cx(Classes.tableRow, (_cx = {}, _defineProperty(_cx, Classes.first, rowIndex === verInfo.first), _defineProperty(_cx, Classes.last, rowIndex === verInfo.last), _defineProperty(_cx, Classes.even, rowIndex % 2 === 0), _defineProperty(_cx, Classes.odd, rowIndex % 2 === 1), _cx), rowProps === null || rowProps === void 0 ? void 0 : rowProps.className);
|
|
36
37
|
var visibleColumnDescriptor = _concatInstanceProperty(_context = hozInfo.visible).call(_context);
|
|
37
38
|
// 左中右区域渲染,存在融合单元格时需要适配rowspan属性
|
|
38
39
|
// 如果固定的列均存在融合单元格,需空白一列做占位,否则融合的单元格不会渲染,导致显示异常
|
|
@@ -63,6 +64,7 @@ export function HtmlTable(_ref) {
|
|
|
63
64
|
}));
|
|
64
65
|
}
|
|
65
66
|
function renderBodyCell(record, rowIndex, column, colIndex) {
|
|
67
|
+
var _cx2;
|
|
66
68
|
var _a, _b, _c;
|
|
67
69
|
if (spanManager.testSkip(rowIndex, colIndex)) {
|
|
68
70
|
return null;
|
|
@@ -101,14 +103,23 @@ export function HtmlTable(_ref) {
|
|
|
101
103
|
if (colIndex < leftFlatCount) {
|
|
102
104
|
positionStyle.position = 'sticky';
|
|
103
105
|
positionStyle.left = hozInfo.stickyLeftMap.get(colIndex);
|
|
106
|
+
if (direction === 'rtl') {
|
|
107
|
+
positionStyle.right = hozInfo.stickyLeftMap.get(colIndex);
|
|
108
|
+
} else {
|
|
109
|
+
positionStyle.left = hozInfo.stickyLeftMap.get(colIndex);
|
|
110
|
+
}
|
|
104
111
|
} else if (colIndex >= fullFlatCount - rightFlatCount) {
|
|
105
112
|
positionStyle.position = 'sticky';
|
|
106
|
-
|
|
113
|
+
if (direction === 'rtl') {
|
|
114
|
+
positionStyle.left = hozInfo.stickyRightMap.get(colIndex) + (typeof stickyRightOffset === 'number' ? stickyRightOffset : 0);
|
|
115
|
+
} else {
|
|
116
|
+
positionStyle.right = hozInfo.stickyRightMap.get(colIndex) + (typeof stickyRightOffset === 'number' ? stickyRightOffset : 0);
|
|
117
|
+
}
|
|
107
118
|
}
|
|
108
119
|
return /*#__PURE__*/React.createElement('td', _extends(_extends(_extends(_extends({
|
|
109
120
|
key: colIndex
|
|
110
121
|
}, cellProps), {
|
|
111
|
-
className: cx(Classes.tableCell, cellProps.className,
|
|
122
|
+
className: cx(Classes.tableCell, cellProps.className, (_cx2 = {}, _defineProperty(_cx2, Classes.first, colIndex === 0), _defineProperty(_cx2, Classes.last, colIndex + colSpan === fullFlatCount), _defineProperty(_cx2, Classes.lockLeft, colIndex < leftFlatCount || tbodyPosition === 'left'), _defineProperty(_cx2, Classes.lockRight, colIndex >= fullFlatCount - rightFlatCount), _defineProperty(_cx2, Classes.rowSpan, rowSpan > 1), _cx2))
|
|
112
123
|
}), hasSpan ? {
|
|
113
124
|
colSpan: colSpan,
|
|
114
125
|
rowSpan: rowSpan
|
package/es/table/base/loading.js
CHANGED
|
@@ -47,11 +47,11 @@ export default function Loading(_ref2) {
|
|
|
47
47
|
LoadingIcon = _ref2$LoadingIcon === void 0 ? DefaultLoadingIcon : _ref2$LoadingIcon;
|
|
48
48
|
return /*#__PURE__*/React.createElement("div", {
|
|
49
49
|
className: Classes.loadingWrapper
|
|
50
|
-
}, visible &&
|
|
50
|
+
}, visible && /*#__PURE__*/React.createElement("div", {
|
|
51
51
|
className: Classes.loadingIndicatorWrapper
|
|
52
52
|
}, /*#__PURE__*/React.createElement("div", {
|
|
53
53
|
className: Classes.loadingIndicator
|
|
54
|
-
}, /*#__PURE__*/React.createElement(LoadingIcon, null)))
|
|
54
|
+
}, /*#__PURE__*/React.createElement(LoadingIcon, null))), /*#__PURE__*/React.createElement(LoadingContentWrapper, {
|
|
55
55
|
visible: visible,
|
|
56
56
|
children: children
|
|
57
57
|
}));
|