@kdcloudjs/table 1.2.1-canary.6 → 1.2.2-canary.3
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 +5480 -6087
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +18 -16
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/dist/kd-ui-complete.less +777 -777
- package/es/_utils/arrayUtil.js +0 -3
- package/es/_utils/devwarning.js +0 -1
- package/es/_utils/formatUtil.js +36 -101
- package/es/_utils/hooks.js +21 -45
- package/es/_utils/index.js +0 -2
- package/es/_utils/numberUtil.js +32 -55
- package/es/_utils/omit.js +0 -2
- package/es/_utils/type.js +0 -2
- package/es/_utils/usePopper.js +81 -144
- package/es/config-provider/compDefaultProps.js +0 -1
- package/es/config-provider/configProvider.js +2 -7
- package/es/config-provider/defaultConfig.js +0 -1
- package/es/index.js +0 -2
- package/es/locale/locale.js +11 -50
- 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/calculations.js +25 -75
- package/es/table/base/colgroup.js +0 -1
- package/es/table/base/empty.js +6 -6
- package/es/table/base/globalStyleComponent.d.ts +4 -0
- package/es/table/base/globalStyleComponent.js +24 -0
- package/es/table/base/header.js +21 -76
- package/es/table/base/helpers/SpanManager.js +4 -11
- package/es/table/base/helpers/TableDOMUtils.js +9 -34
- package/es/table/base/helpers/__test__/SpanManager.test.js +2 -2
- package/es/table/base/helpers/__test__/TableDOMUtils.test.js +0 -1
- package/es/table/base/helpers/getRichVisibleRectsStream.js +13 -45
- package/es/table/base/helpers/rowHeightManager.js +0 -28
- package/es/table/base/html-table.js +17 -39
- package/es/table/base/loading.js +8 -10
- package/es/table/base/renderTemplates.js +42 -60
- package/es/table/base/styles.d.ts +10 -0
- package/es/table/base/styles.js +17 -16
- package/es/table/base/table.js +113 -201
- package/es/table/base/utils.js +17 -57
- package/es/table/common-views.js +0 -7
- package/es/table/interfaces.d.ts +38 -0
- package/es/table/internals.js +0 -13
- package/es/table/pipeline/const.d.ts +3 -0
- package/es/table/pipeline/const.js +3 -0
- package/es/table/pipeline/features/autoFill.js +11 -40
- package/es/table/pipeline/features/autoRowSpan.js +1 -14
- package/es/table/pipeline/features/colGroupExtendable.js +4 -19
- package/es/table/pipeline/features/columnDrag.js +41 -97
- package/es/table/pipeline/features/columnFilter.js +12 -51
- package/es/table/pipeline/features/columnHover.js +1 -7
- package/es/table/pipeline/features/columnRangeHover.js +1 -8
- package/es/table/pipeline/features/columnResizeWidth.js +13 -39
- package/es/table/pipeline/features/contextMenu.js +22 -95
- package/es/table/pipeline/features/featureApi/RowDragApi.d.ts +15 -0
- package/es/table/pipeline/features/featureApi/RowDragApi.js +66 -0
- package/es/table/pipeline/features/featureApi/utils.d.ts +2 -0
- package/es/table/pipeline/features/featureApi/utils.js +10 -0
- package/es/table/pipeline/features/filter/DefaultFilterContent.js +14 -30
- package/es/table/pipeline/features/filter/DefaultFilterIcon.js +1 -1
- package/es/table/pipeline/features/filter/Filter.js +27 -51
- package/es/table/pipeline/features/filter/FilterPanel.js +11 -25
- package/es/table/pipeline/features/filter/util.js +0 -4
- package/es/table/pipeline/features/footerDataSource.js +0 -3
- package/es/table/pipeline/features/mergeCellHover.js +0 -1
- package/es/table/pipeline/features/multiSelect.js +15 -57
- package/es/table/pipeline/features/rangeSelection.js +73 -152
- package/es/table/pipeline/features/rowDetail.js +4 -43
- package/es/table/pipeline/features/rowDrag.d.ts +10 -12
- package/es/table/pipeline/features/rowDrag.js +491 -236
- package/es/table/pipeline/features/rowGrouping.js +4 -37
- package/es/table/pipeline/features/singleSelect.js +0 -24
- package/es/table/pipeline/features/sort.js +38 -96
- package/es/table/pipeline/features/tips.js +4 -10
- package/es/table/pipeline/features/treeMode.d.ts +1 -0
- package/es/table/pipeline/features/treeMode.js +38 -57
- package/es/table/pipeline/features/treeSelect.js +2 -28
- package/es/table/pipeline/pipeline.d.ts +3 -0
- package/es/table/pipeline/pipeline.js +35 -54
- package/es/table/pivot/cross-table/buildCrossTable.js +21 -72
- package/es/table/pivot/cross-table/cross-table.js +23 -31
- package/es/table/pivot/cross-tree-table/buildCrossTreeTable.js +22 -57
- package/es/table/pivot/cross-tree-table/cross-tree-table.js +36 -61
- package/es/table/pivot/pivot-utils/buildDrillTree.js +10 -23
- package/es/table/pivot/pivot-utils/builders.js +34 -74
- package/es/table/pivot/pivot-utils/convert-utils.js +16 -42
- package/es/table/pivot/pivot-utils/simpleEncode.js +0 -1
- package/es/table/style/index.less +1 -1
- package/es/table/transforms/autoRowSpan.js +1 -15
- package/es/table/transforms/autoWidth.js +13 -35
- package/es/table/transforms/buildTree.js +1 -2
- package/es/table/transforms/columnHover.js +9 -15
- package/es/table/transforms/columnRangeHover.js +12 -19
- package/es/table/transforms/columnResize.js +18 -42
- package/es/table/transforms/flatten.js +0 -3
- package/es/table/transforms/orderField.js +0 -3
- package/es/table/transforms/sort.js +42 -101
- package/es/table/transforms/tips.js +5 -10
- package/es/table/transforms/treeMode.js +36 -77
- package/es/table/transforms/visible.js +0 -2
- package/es/table/use/useResizeObserver.js +1 -4
- package/es/table/utils/applyTransforms.js +0 -1
- package/es/table/utils/browserType.js +12 -19
- package/es/table/utils/buildTree.js +7 -22
- package/es/table/utils/collectNodes.js +4 -13
- package/es/table/utils/console.js +0 -14
- package/es/table/utils/copyToClipboard.js +0 -4
- package/es/table/utils/element.js +14 -41
- package/es/table/utils/exportTableAsExcel.js +7 -43
- package/es/table/utils/getTreeDepth.js +4 -12
- package/es/table/utils/groupBy.js +4 -13
- package/es/table/utils/layeredFilter.js +0 -4
- package/es/table/utils/layeredSort.js +0 -5
- package/es/table/utils/makeRecursiveMapper.js +4 -15
- package/es/table/utils/mergeCellProps.js +6 -14
- package/es/table/utils/others.js +6 -19
- package/es/table/utils/proto.js +2 -30
- package/es/table/utils/smartCompare.js +4 -12
- package/es/table/utils/traverseColumn.js +5 -18
- package/es/table/utils/tree-data-helpers/StrictTreeDataHelper.js +8 -30
- package/es/table/utils/tree-data-helpers/TreeDataHelper.js +19 -74
- package/es/table/utils/uiDegrade.js +0 -5
- package/lib/_utils/arrayUtil.js +2 -8
- package/lib/_utils/devwarning.js +0 -5
- package/lib/_utils/formatUtil.js +36 -105
- package/lib/_utils/hooks.js +21 -56
- package/lib/_utils/index.js +2 -9
- package/lib/_utils/numberUtil.js +32 -63
- package/lib/_utils/omit.js +0 -5
- package/lib/_utils/react-children.js +0 -5
- package/lib/_utils/type.js +3 -11
- package/lib/_utils/usePopper.js +86 -173
- package/lib/config-provider/ConfigContext.js +2 -6
- package/lib/config-provider/compDefaultProps.js +1 -3
- package/lib/config-provider/configProvider.js +6 -22
- package/lib/config-provider/defaultConfig.js +1 -7
- package/lib/config-provider/index.js +1 -8
- package/lib/index.js +2 -8
- package/lib/locale/index.js +3 -11
- package/lib/locale/locale.js +15 -71
- package/lib/locale/zh-CN.js +1 -2
- 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/calculations.js +25 -86
- package/lib/table/base/colgroup.js +0 -5
- package/lib/table/base/empty.js +8 -20
- package/lib/table/base/globalStyleComponent.d.ts +4 -0
- package/lib/table/base/globalStyleComponent.js +35 -0
- package/lib/table/base/header.js +21 -86
- package/lib/table/base/helpers/SpanManager.js +6 -16
- package/lib/table/base/helpers/TableDOMUtils.js +9 -37
- package/lib/table/base/helpers/__test__/SpanManager.test.js +2 -4
- package/lib/table/base/helpers/__test__/TableDOMUtils.test.js +0 -5
- package/lib/table/base/helpers/__test__/rowHeightManager.test.js +0 -1
- package/lib/table/base/helpers/getRichVisibleRectsStream.js +15 -65
- package/lib/table/base/helpers/rowHeightManager.js +0 -33
- package/lib/table/base/html-table.js +17 -49
- package/lib/table/base/index.js +0 -2
- package/lib/table/base/loading.js +8 -14
- package/lib/table/base/renderTemplates.js +45 -76
- package/lib/table/base/styles.d.ts +10 -0
- package/lib/table/base/styles.js +24 -42
- package/lib/table/base/table.js +125 -245
- package/lib/table/base/utils.js +27 -109
- package/lib/table/common-views.js +4 -24
- package/lib/table/index.js +0 -13
- package/lib/table/interfaces.d.ts +38 -0
- package/lib/table/internals.js +2 -17
- package/lib/table/pipeline/const.d.ts +3 -0
- package/lib/table/pipeline/const.js +9 -0
- package/lib/table/pipeline/features/autoFill.js +14 -53
- package/lib/table/pipeline/features/autoRowSpan.js +1 -19
- package/lib/table/pipeline/features/buildTree.js +0 -2
- package/lib/table/pipeline/features/colGroupExtendable.js +6 -35
- package/lib/table/pipeline/features/columnDrag.js +41 -103
- package/lib/table/pipeline/features/columnFilter.js +12 -65
- package/lib/table/pipeline/features/columnHover.js +1 -11
- package/lib/table/pipeline/features/columnRangeHover.js +1 -13
- package/lib/table/pipeline/features/columnResizeWidth.js +18 -63
- package/lib/table/pipeline/features/contextMenu.js +24 -121
- package/lib/table/pipeline/features/featureApi/RowDragApi.d.ts +15 -0
- package/lib/table/pipeline/features/featureApi/RowDragApi.js +72 -0
- package/lib/table/pipeline/features/featureApi/utils.d.ts +2 -0
- package/lib/table/pipeline/features/featureApi/utils.js +17 -0
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +17 -52
- package/lib/table/pipeline/features/filter/DefaultFilterIcon.js +1 -4
- package/lib/table/pipeline/features/filter/Filter.js +30 -77
- package/lib/table/pipeline/features/filter/FilterPanel.js +14 -44
- package/lib/table/pipeline/features/filter/index.js +0 -5
- package/lib/table/pipeline/features/filter/util.js +2 -10
- package/lib/table/pipeline/features/footerDataSource.js +1 -12
- package/lib/table/pipeline/features/index.js +0 -23
- package/lib/table/pipeline/features/mergeCellHover.js +0 -5
- package/lib/table/pipeline/features/multiSelect.js +15 -71
- package/lib/table/pipeline/features/rangeSelection.js +75 -173
- package/lib/table/pipeline/features/rowDetail.js +4 -67
- package/lib/table/pipeline/features/rowDrag.d.ts +10 -12
- package/lib/table/pipeline/features/rowDrag.js +494 -252
- package/lib/table/pipeline/features/rowGrouping.js +4 -57
- package/lib/table/pipeline/features/singleSelect.js +0 -34
- package/lib/table/pipeline/features/sort.js +37 -115
- package/lib/table/pipeline/features/tips.js +4 -19
- package/lib/table/pipeline/features/treeMode.d.ts +1 -0
- package/lib/table/pipeline/features/treeMode.js +40 -80
- package/lib/table/pipeline/features/treeSelect.js +2 -36
- package/lib/table/pipeline/index.js +2 -10
- package/lib/table/pipeline/pipeline.d.ts +3 -0
- package/lib/table/pipeline/pipeline.js +36 -65
- package/lib/table/pivot/cross-table/buildCrossTable.js +21 -83
- package/lib/table/pivot/cross-table/constants.js +1 -2
- package/lib/table/pivot/cross-table/cross-table.js +25 -42
- package/lib/table/pivot/cross-table/index.js +0 -4
- package/lib/table/pivot/cross-tree-table/buildCrossTreeTable.js +22 -70
- package/lib/table/pivot/cross-tree-table/cross-tree-table.js +37 -73
- package/lib/table/pivot/cross-tree-table/index.js +0 -3
- package/lib/table/pivot/pivot-utils/buildDrillTree.js +10 -29
- package/lib/table/pivot/pivot-utils/builders.js +34 -85
- package/lib/table/pivot/pivot-utils/convert-utils.js +16 -60
- package/lib/table/pivot/pivot-utils/index.js +0 -7
- package/lib/table/pivot/pivot-utils/simpleEncode.js +0 -2
- package/lib/table/style/css.js +0 -1
- package/lib/table/style/index.js +0 -1
- package/lib/table/style/index.less +1 -1
- package/lib/table/transforms/autoRowSpan.js +1 -21
- package/lib/table/transforms/autoWidth.js +15 -58
- package/lib/table/transforms/buildTree.js +1 -4
- package/lib/table/transforms/columnHover.js +9 -22
- package/lib/table/transforms/columnRangeHover.js +12 -27
- package/lib/table/transforms/columnResize.js +20 -63
- package/lib/table/transforms/flatten.js +0 -5
- package/lib/table/transforms/index.js +0 -12
- package/lib/table/transforms/orderField.js +0 -7
- package/lib/table/transforms/sort.js +44 -127
- package/lib/table/transforms/tips.js +5 -20
- package/lib/table/transforms/treeMode.js +38 -106
- package/lib/table/transforms/visible.js +0 -7
- package/lib/table/transforms/warnTransformsDeprecated.js +0 -4
- package/lib/table/use/useResizeObserver.js +2 -10
- package/lib/table/utils/applyTransforms.js +0 -2
- package/lib/table/utils/browserType.js +14 -23
- package/lib/table/utils/buildTree.js +7 -33
- package/lib/table/utils/collectNodes.js +4 -18
- package/lib/table/utils/console.js +2 -19
- package/lib/table/utils/copyToClipboard.js +1 -8
- package/lib/table/utils/element.js +14 -46
- package/lib/table/utils/exportTableAsExcel.js +7 -52
- package/lib/table/utils/getTreeDepth.js +4 -17
- package/lib/table/utils/groupBy.js +4 -17
- package/lib/table/utils/index.js +0 -22
- package/lib/table/utils/isGroupColumn.js +0 -3
- package/lib/table/utils/isLeafNode.js +0 -1
- package/lib/table/utils/keyCode.js +1 -2
- package/lib/table/utils/layeredFilter.js +0 -10
- package/lib/table/utils/layeredSort.js +0 -10
- package/lib/table/utils/makeRecursiveMapper.js +4 -24
- package/lib/table/utils/mergeCellProps.js +6 -18
- package/lib/table/utils/others.js +7 -36
- package/lib/table/utils/proto.js +3 -35
- package/lib/table/utils/selectColumn.js +2 -5
- package/lib/table/utils/smartCompare.js +4 -13
- package/lib/table/utils/traverseColumn.js +5 -25
- package/lib/table/utils/tree-data-helpers/StrictTreeDataHelper.js +10 -41
- package/lib/table/utils/tree-data-helpers/TreeDataHelper.js +21 -90
- package/lib/table/utils/uiDegrade.js +1 -8
- package/package.json +218 -218
|
@@ -1,101 +1,80 @@
|
|
|
1
1
|
import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
|
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
3
|
+
import _readOnlyError from "@babel/runtime-corejs3/helpers/readOnlyError";
|
|
3
4
|
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
4
5
|
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
5
|
-
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
6
6
|
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
8
|
-
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
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; } }
|
|
12
|
-
|
|
8
|
+
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
9
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
10
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
11
|
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
14
|
-
|
|
15
12
|
var __rest = this && this.__rest || function (s, e) {
|
|
16
13
|
var t = {};
|
|
17
|
-
|
|
18
|
-
for (var p in s) {
|
|
19
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
20
|
-
}
|
|
21
|
-
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
22
15
|
if (s != null && typeof _Object$getOwnPropertySymbols === "function") for (var i = 0, p = _Object$getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
16
|
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
24
17
|
}
|
|
25
18
|
return t;
|
|
26
19
|
};
|
|
27
|
-
|
|
28
20
|
import React from 'react';
|
|
29
21
|
import { noop } from 'rxjs';
|
|
30
22
|
import { Table } from '../../base';
|
|
31
23
|
import { ROW_KEY } from '../cross-table';
|
|
32
24
|
import buildCrossTreeTable from './buildCrossTreeTable';
|
|
33
|
-
|
|
34
25
|
var CrossTreeTable = /*#__PURE__*/function (_React$Component) {
|
|
35
|
-
_inherits(CrossTreeTable, _React$Component);
|
|
36
|
-
|
|
37
|
-
var _super = _createSuper(CrossTreeTable);
|
|
38
|
-
|
|
39
26
|
function CrossTreeTable(props) {
|
|
40
27
|
var _this;
|
|
41
|
-
|
|
42
28
|
_classCallCheck(this, CrossTreeTable);
|
|
43
|
-
|
|
44
|
-
_this = _super.call(this, props);
|
|
45
|
-
|
|
29
|
+
_this = _callSuper(this, CrossTreeTable, [props]);
|
|
46
30
|
_this.onChangeOpenKeys = function (nextOpenKeys) {
|
|
47
31
|
_this.props.onChangeOpenKeys(nextOpenKeys);
|
|
48
|
-
|
|
49
32
|
if (!('openKeys' in _this.props)) {
|
|
50
33
|
_this.setState({
|
|
51
34
|
openKeys: nextOpenKeys
|
|
52
35
|
});
|
|
53
36
|
}
|
|
54
37
|
};
|
|
55
|
-
|
|
56
38
|
_this.state = {
|
|
57
39
|
openKeys: props.defaultOpenKeys
|
|
58
40
|
};
|
|
59
41
|
return _this;
|
|
60
42
|
}
|
|
61
|
-
|
|
62
|
-
_createClass(CrossTreeTable, [{
|
|
43
|
+
_inherits(CrossTreeTable, _React$Component);
|
|
44
|
+
return _createClass(CrossTreeTable, [{
|
|
63
45
|
key: "render",
|
|
64
46
|
value: function render() {
|
|
65
47
|
var _a = this.props,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
48
|
+
_a$BaseTableComponent = _a.BaseTableComponent,
|
|
49
|
+
BaseTableComponent = _a$BaseTableComponent === void 0 ? Table : _a$BaseTableComponent,
|
|
50
|
+
leftTree = _a.leftTree,
|
|
51
|
+
topTree = _a.topTree,
|
|
52
|
+
getValue = _a.getValue,
|
|
53
|
+
getCellProps = _a.getCellProps,
|
|
54
|
+
primaryColumn = _a.primaryColumn,
|
|
55
|
+
render = _a.render,
|
|
56
|
+
openKeysProp = _a.openKeys,
|
|
57
|
+
defaultOpenKeys = _a.defaultOpenKeys,
|
|
58
|
+
onChangeOpenKeys = _a.onChangeOpenKeys,
|
|
59
|
+
indentSize = _a.indentSize,
|
|
60
|
+
isLeafNode = _a.isLeafNode,
|
|
61
|
+
baseTableRef = _a.baseTableRef,
|
|
62
|
+
others = __rest(_a, ["BaseTableComponent", "leftTree", "topTree", "getValue", "getCellProps", "primaryColumn", "render", "openKeys", "defaultOpenKeys", "onChangeOpenKeys", "indentSize", "isLeafNode", "baseTableRef"]);
|
|
82
63
|
var openKeys = openKeysProp !== null && openKeysProp !== void 0 ? openKeysProp : this.state.openKeys;
|
|
83
|
-
|
|
84
64
|
var _buildCrossTreeTable = buildCrossTreeTable({
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
65
|
+
leftTree: leftTree,
|
|
66
|
+
topTree: topTree,
|
|
67
|
+
getValue: getValue,
|
|
68
|
+
getCellProps: getCellProps,
|
|
69
|
+
render: render,
|
|
70
|
+
primaryColumn: primaryColumn,
|
|
71
|
+
openKeys: openKeys,
|
|
72
|
+
onChangeOpenKeys: this.onChangeOpenKeys,
|
|
73
|
+
indentSize: indentSize,
|
|
74
|
+
isLeafNode: isLeafNode
|
|
75
|
+
}),
|
|
76
|
+
dataSource = _buildCrossTreeTable.dataSource,
|
|
77
|
+
columns = _buildCrossTreeTable.columns;
|
|
99
78
|
return /*#__PURE__*/React.createElement(BaseTableComponent, _extends({
|
|
100
79
|
ref: baseTableRef
|
|
101
80
|
}, others, {
|
|
@@ -112,14 +91,10 @@ var CrossTreeTable = /*#__PURE__*/function (_React$Component) {
|
|
|
112
91
|
openKeys: nextProps.openKeys
|
|
113
92
|
};
|
|
114
93
|
}
|
|
115
|
-
|
|
116
94
|
return null;
|
|
117
95
|
}
|
|
118
96
|
}]);
|
|
119
|
-
|
|
120
|
-
return CrossTreeTable;
|
|
121
97
|
}(React.Component);
|
|
122
|
-
|
|
123
98
|
export { CrossTreeTable as default };
|
|
124
99
|
CrossTreeTable.defaultProps = {
|
|
125
100
|
defaultOpenKeys: [],
|
|
@@ -4,25 +4,22 @@ import { groupBy } from '../../utils';
|
|
|
4
4
|
import { always } from '../../utils/others';
|
|
5
5
|
import simpleEncode from './simpleEncode';
|
|
6
6
|
/** 根据指定的 code 序列计算下钻树 */
|
|
7
|
-
|
|
8
7
|
export default function buildDrillTree(data, codes) {
|
|
9
8
|
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
_ref$encode = _ref.encode,
|
|
10
|
+
encode = _ref$encode === void 0 ? simpleEncode : _ref$encode,
|
|
11
|
+
_ref$totalValue = _ref.totalValue,
|
|
12
|
+
totalValue = _ref$totalValue === void 0 ? '总计' : _ref$totalValue,
|
|
13
|
+
_ref$includeTopWrappe = _ref.includeTopWrapper,
|
|
14
|
+
includeTopWrapper = _ref$includeTopWrappe === void 0 ? false : _ref$includeTopWrappe,
|
|
15
|
+
_ref$isExpand = _ref.isExpand,
|
|
16
|
+
isExpand = _ref$isExpand === void 0 ? always(true) : _ref$isExpand,
|
|
17
|
+
_ref$enforceExpandTot = _ref.enforceExpandTotalNode,
|
|
18
|
+
enforceExpandTotalNode = _ref$enforceExpandTot === void 0 ? true : _ref$enforceExpandTot;
|
|
21
19
|
var emptyPath = [];
|
|
22
20
|
var totalKey = encode(emptyPath);
|
|
23
21
|
var array;
|
|
24
22
|
var hasChild = false;
|
|
25
|
-
|
|
26
23
|
if (codes.length === 0) {
|
|
27
24
|
array = [];
|
|
28
25
|
} else if (!enforceExpandTotalNode && !isExpand(totalKey)) {
|
|
@@ -31,7 +28,6 @@ export default function buildDrillTree(data, codes) {
|
|
|
31
28
|
} else {
|
|
32
29
|
array = dfs(data, []);
|
|
33
30
|
}
|
|
34
|
-
|
|
35
31
|
if (includeTopWrapper) {
|
|
36
32
|
var rootNode = {
|
|
37
33
|
key: totalKey,
|
|
@@ -39,14 +35,11 @@ export default function buildDrillTree(data, codes) {
|
|
|
39
35
|
path: emptyPath,
|
|
40
36
|
children: array
|
|
41
37
|
};
|
|
42
|
-
|
|
43
38
|
if (hasChild) {
|
|
44
39
|
rootNode.hasChild = hasChild;
|
|
45
40
|
}
|
|
46
|
-
|
|
47
41
|
return [rootNode];
|
|
48
42
|
}
|
|
49
|
-
|
|
50
43
|
if (includeTopWrapper) {
|
|
51
44
|
return [{
|
|
52
45
|
key: totalKey,
|
|
@@ -55,9 +48,7 @@ export default function buildDrillTree(data, codes) {
|
|
|
55
48
|
children: array
|
|
56
49
|
}];
|
|
57
50
|
}
|
|
58
|
-
|
|
59
51
|
return array;
|
|
60
|
-
|
|
61
52
|
function dfs(slice, path) {
|
|
62
53
|
var depth = path.length;
|
|
63
54
|
var array = [];
|
|
@@ -65,7 +56,6 @@ export default function buildDrillTree(data, codes) {
|
|
|
65
56
|
var groups = groupBy(slice, function (row) {
|
|
66
57
|
return row[code];
|
|
67
58
|
});
|
|
68
|
-
|
|
69
59
|
for (var _i = 0, _Object$keys = _Object$keys2(groups); _i < _Object$keys.length; _i++) {
|
|
70
60
|
var groupKey = _Object$keys[_i];
|
|
71
61
|
path.push(groupKey);
|
|
@@ -76,7 +66,6 @@ export default function buildDrillTree(data, codes) {
|
|
|
76
66
|
};
|
|
77
67
|
array.push(node);
|
|
78
68
|
var group = groups[groupKey];
|
|
79
|
-
|
|
80
69
|
if (group.length > 0 && depth < codes.length - 1) {
|
|
81
70
|
if (isExpand(node.key)) {
|
|
82
71
|
node.children = dfs(group, path);
|
|
@@ -84,10 +73,8 @@ export default function buildDrillTree(data, codes) {
|
|
|
84
73
|
node.hasChild = true;
|
|
85
74
|
}
|
|
86
75
|
}
|
|
87
|
-
|
|
88
76
|
path.pop();
|
|
89
77
|
}
|
|
90
|
-
|
|
91
78
|
return array;
|
|
92
79
|
}
|
|
93
80
|
}
|
|
@@ -3,13 +3,9 @@ import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
|
3
3
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
4
4
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
5
5
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
function _unsupportedIterableToArray(o, minLen) { var _context5; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context5 = Object.prototype.toString.call(o)).call(_context5, 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); }
|
|
10
|
-
|
|
11
|
-
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; }
|
|
12
|
-
|
|
6
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof _Symbol && _getIteratorMethod(r) || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, 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 o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
7
|
+
function _unsupportedIterableToArray(r, a) { if (r) { var _context5; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_context5 = {}.toString.call(r)).call(_context5, 8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? _Array$from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
8
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
9
|
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
14
10
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
15
11
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
@@ -18,54 +14,46 @@ import { groupBy, isLeafNode } from '../../utils';
|
|
|
18
14
|
import { always, fromEntries } from '../../utils/others';
|
|
19
15
|
import buildDrillTree from './buildDrillTree';
|
|
20
16
|
import simpleEncode from './simpleEncode';
|
|
21
|
-
|
|
22
17
|
function fallbackAggregate(slice) {
|
|
23
18
|
return slice.length === 1 ? slice[0] : {};
|
|
24
19
|
}
|
|
25
20
|
/** 根据表格左侧与上方的下钻树,从全量明细数据中计算对应的数据立方 */
|
|
26
|
-
|
|
27
|
-
|
|
28
21
|
export function buildRecordMatrix(_ref) {
|
|
29
22
|
var data = _ref.data,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
23
|
+
leftCodes = _ref.leftCodes,
|
|
24
|
+
topCodes = _ref.topCodes,
|
|
25
|
+
_ref$aggregate = _ref.aggregate,
|
|
26
|
+
aggregate = _ref$aggregate === void 0 ? fallbackAggregate : _ref$aggregate,
|
|
27
|
+
_ref$encode = _ref.encode,
|
|
28
|
+
encode = _ref$encode === void 0 ? simpleEncode : _ref$encode,
|
|
29
|
+
_ref$isLeftExpand = _ref.isLeftExpand,
|
|
30
|
+
isLeftExpand = _ref$isLeftExpand === void 0 ? always(true) : _ref$isLeftExpand,
|
|
31
|
+
_ref$isTopExpand = _ref.isTopExpand,
|
|
32
|
+
isTopExpand = _ref$isTopExpand === void 0 ? always(true) : _ref$isTopExpand,
|
|
33
|
+
prebuiltLeftTree = _ref.prebuiltLeftTree,
|
|
34
|
+
prebuiltTopTree = _ref.prebuiltTopTree;
|
|
42
35
|
var ctx = {
|
|
43
36
|
peculiarity: new _Set()
|
|
44
37
|
};
|
|
45
|
-
|
|
46
38
|
var _ref2 = prebuiltLeftTree !== null && prebuiltLeftTree !== void 0 ? prebuiltLeftTree : buildDrillTree(data, leftCodes, {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
encode: encode,
|
|
40
|
+
includeTopWrapper: true,
|
|
41
|
+
isExpand: isLeftExpand
|
|
42
|
+
}),
|
|
43
|
+
_ref3 = _slicedToArray(_ref2, 1),
|
|
44
|
+
leftRootDrillNode = _ref3[0];
|
|
54
45
|
var _ref4 = prebuiltTopTree !== null && prebuiltTopTree !== void 0 ? prebuiltTopTree : buildDrillTree(data, topCodes, {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
46
|
+
encode: encode,
|
|
47
|
+
includeTopWrapper: true,
|
|
48
|
+
isExpand: isTopExpand
|
|
49
|
+
}),
|
|
50
|
+
_ref5 = _slicedToArray(_ref4, 1),
|
|
51
|
+
topRootDrillNode = _ref5[0];
|
|
62
52
|
var transientMatrixRow = buildByLeft(ctx, data, leftRootDrillNode, 0);
|
|
63
53
|
return makeMatrix(transientMatrixRow);
|
|
64
|
-
|
|
65
54
|
function buildByLeft(ctx, slice, drillNode, depth) {
|
|
66
55
|
var children = null;
|
|
67
56
|
var col;
|
|
68
|
-
|
|
69
57
|
if (isLeafNode(drillNode)) {
|
|
70
58
|
col = buildByTop(ctx, slice, topRootDrillNode, 0);
|
|
71
59
|
} else {
|
|
@@ -75,15 +63,12 @@ export function buildRecordMatrix(_ref) {
|
|
|
75
63
|
return dwdRow[code];
|
|
76
64
|
});
|
|
77
65
|
ctx.peculiarity.add(code);
|
|
78
|
-
|
|
79
66
|
var _iterator = _createForOfIteratorHelper(drillNode.children),
|
|
80
|
-
|
|
81
|
-
|
|
67
|
+
_step;
|
|
82
68
|
try {
|
|
83
69
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
84
70
|
var child = _step.value;
|
|
85
71
|
var group = groups[child.value];
|
|
86
|
-
|
|
87
72
|
if (group) {
|
|
88
73
|
children.push(buildByLeft(ctx, group, child, depth + 1));
|
|
89
74
|
}
|
|
@@ -93,24 +78,20 @@ export function buildRecordMatrix(_ref) {
|
|
|
93
78
|
} finally {
|
|
94
79
|
_iterator.f();
|
|
95
80
|
}
|
|
96
|
-
|
|
97
81
|
ctx.peculiarity.delete(code);
|
|
98
82
|
col = mergeColsByTopTree(ctx, _mapInstanceProperty(children).call(children, function (child) {
|
|
99
83
|
return child.col;
|
|
100
84
|
}));
|
|
101
85
|
}
|
|
102
|
-
|
|
103
86
|
return {
|
|
104
87
|
leftKey: drillNode.key,
|
|
105
88
|
children: children,
|
|
106
89
|
col: col
|
|
107
90
|
};
|
|
108
91
|
}
|
|
109
|
-
|
|
110
92
|
function buildByTop(ctx, slice, drillNode, depth) {
|
|
111
93
|
var children = null;
|
|
112
94
|
var record;
|
|
113
|
-
|
|
114
95
|
if (isLeafNode(drillNode)) {
|
|
115
96
|
record = aggregate(slice, ctx);
|
|
116
97
|
} else {
|
|
@@ -120,15 +101,12 @@ export function buildRecordMatrix(_ref) {
|
|
|
120
101
|
return dwdRow[code];
|
|
121
102
|
});
|
|
122
103
|
ctx.peculiarity.add(code);
|
|
123
|
-
|
|
124
104
|
var _iterator2 = _createForOfIteratorHelper(drillNode.children),
|
|
125
|
-
|
|
126
|
-
|
|
105
|
+
_step2;
|
|
127
106
|
try {
|
|
128
107
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
129
108
|
var child = _step2.value;
|
|
130
109
|
var group = groups[child.value];
|
|
131
|
-
|
|
132
110
|
if (group) {
|
|
133
111
|
children.push(buildByTop(ctx, group, child, depth + 1));
|
|
134
112
|
}
|
|
@@ -138,13 +116,11 @@ export function buildRecordMatrix(_ref) {
|
|
|
138
116
|
} finally {
|
|
139
117
|
_iterator2.f();
|
|
140
118
|
}
|
|
141
|
-
|
|
142
119
|
ctx.peculiarity.delete(code);
|
|
143
120
|
record = aggregate(_mapInstanceProperty(children).call(children, function (child) {
|
|
144
121
|
return child.record;
|
|
145
122
|
}), ctx);
|
|
146
123
|
}
|
|
147
|
-
|
|
148
124
|
return {
|
|
149
125
|
topKey: drillNode.key,
|
|
150
126
|
topValue: drillNode.value,
|
|
@@ -152,45 +128,35 @@ export function buildRecordMatrix(_ref) {
|
|
|
152
128
|
record: record
|
|
153
129
|
};
|
|
154
130
|
}
|
|
155
|
-
|
|
156
131
|
function mergeColsByTopTree(ctx, colsToMerge) {
|
|
157
132
|
return dfs(ctx, colsToMerge, topRootDrillNode, 0);
|
|
158
|
-
|
|
159
133
|
function dfs(ctx, cols, topDrillNode, depth) {
|
|
160
134
|
var children = null;
|
|
161
135
|
var record = aggregate(_mapInstanceProperty(cols).call(cols, function (c) {
|
|
162
136
|
return c.record;
|
|
163
137
|
}), ctx);
|
|
164
|
-
|
|
165
138
|
if (!isLeafNode(topDrillNode)) {
|
|
166
139
|
var _context, _context3;
|
|
167
|
-
|
|
168
140
|
var topCode = topCodes[depth];
|
|
169
141
|
ctx.peculiarity.add(topCode);
|
|
170
142
|
var drillChildDict = fromEntries(_mapInstanceProperty(_context = topDrillNode.children).call(_context, function (child) {
|
|
171
143
|
return [child.value, child];
|
|
172
144
|
}));
|
|
173
|
-
|
|
174
145
|
var colChildDictArray = _mapInstanceProperty(cols).call(cols, function (col) {
|
|
175
146
|
var _context2;
|
|
176
|
-
|
|
177
147
|
return fromEntries(_mapInstanceProperty(_context2 = col.children).call(_context2, function (child) {
|
|
178
148
|
return [child.topValue, child];
|
|
179
149
|
}));
|
|
180
150
|
});
|
|
181
|
-
|
|
182
151
|
children = _mapInstanceProperty(_context3 = topDrillNode.children).call(_context3, function (item) {
|
|
183
152
|
var _context4;
|
|
184
|
-
|
|
185
153
|
var childCols = _filterInstanceProperty(_context4 = _mapInstanceProperty(colChildDictArray).call(colChildDictArray, function (colChildDict) {
|
|
186
154
|
return colChildDict[item.value];
|
|
187
155
|
})).call(_context4, Boolean);
|
|
188
|
-
|
|
189
156
|
return dfs(ctx, childCols, drillChildDict[item.value], depth + 1);
|
|
190
157
|
});
|
|
191
158
|
ctx.peculiarity.delete(topCode);
|
|
192
159
|
}
|
|
193
|
-
|
|
194
160
|
return {
|
|
195
161
|
topKey: topDrillNode.key,
|
|
196
162
|
topValue: topDrillNode.value,
|
|
@@ -199,27 +165,22 @@ export function buildRecordMatrix(_ref) {
|
|
|
199
165
|
};
|
|
200
166
|
}
|
|
201
167
|
}
|
|
202
|
-
|
|
203
168
|
function makeMatrix(rootRow) {
|
|
204
169
|
var result = new _Map();
|
|
205
170
|
dfsRow(result, rootRow);
|
|
206
171
|
return result;
|
|
207
|
-
|
|
208
172
|
function dfsRow(matrix, row) {
|
|
209
173
|
var subMap = new _Map();
|
|
210
174
|
matrix.set(row.leftKey, subMap);
|
|
211
175
|
dfsCol(subMap, row.col);
|
|
212
|
-
|
|
213
176
|
if (!isLeafNode(row)) {
|
|
214
177
|
row.children.forEach(function (childRow) {
|
|
215
178
|
dfsRow(matrix, childRow);
|
|
216
179
|
});
|
|
217
180
|
}
|
|
218
181
|
}
|
|
219
|
-
|
|
220
182
|
function dfsCol(subMap, col) {
|
|
221
183
|
subMap.set(col.topKey, col.record);
|
|
222
|
-
|
|
223
184
|
if (!isLeafNode(col)) {
|
|
224
185
|
col.children.forEach(function (childCol) {
|
|
225
186
|
dfsCol(subMap, childCol);
|
|
@@ -230,14 +191,13 @@ export function buildRecordMatrix(_ref) {
|
|
|
230
191
|
}
|
|
231
192
|
/** buildRecordMatrix 的简化版本,只能处理一个维度序列,返回一个 Map。
|
|
232
193
|
* 相当于只处理 matrix 的第一行(汇总行) */
|
|
233
|
-
|
|
234
194
|
export function buildRecordMap(_ref6) {
|
|
235
195
|
var codes = _ref6.codes,
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
196
|
+
_ref6$encode = _ref6.encode,
|
|
197
|
+
encode = _ref6$encode === void 0 ? simpleEncode : _ref6$encode,
|
|
198
|
+
data = _ref6.data,
|
|
199
|
+
aggregate = _ref6.aggregate,
|
|
200
|
+
isExpand = _ref6.isExpand;
|
|
241
201
|
var matrix = buildRecordMatrix({
|
|
242
202
|
data: data,
|
|
243
203
|
leftCodes: [],
|