@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,68 +1,51 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
11
|
-
|
|
12
9
|
function isOutput() {
|
|
13
10
|
return true;
|
|
14
11
|
}
|
|
15
|
-
|
|
16
12
|
function log() {
|
|
17
13
|
if (isOutput()) {
|
|
18
14
|
var _console, _context;
|
|
19
|
-
|
|
20
15
|
for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
16
|
msg[_key] = arguments[_key];
|
|
22
17
|
}
|
|
23
|
-
|
|
24
18
|
(_console = console).log.apply(_console, (0, _concat.default)(_context = ['[kd-table]']).call(_context, msg));
|
|
25
19
|
}
|
|
26
20
|
}
|
|
27
|
-
|
|
28
21
|
function warn() {
|
|
29
22
|
if (isOutput()) {
|
|
30
23
|
var _console2, _context2;
|
|
31
|
-
|
|
32
24
|
for (var _len2 = arguments.length, msg = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
33
25
|
msg[_key2] = arguments[_key2];
|
|
34
26
|
}
|
|
35
|
-
|
|
36
27
|
(_console2 = console).warn.apply(_console2, (0, _concat.default)(_context2 = ['[kd-table]']).call(_context2, msg));
|
|
37
28
|
}
|
|
38
29
|
}
|
|
39
|
-
|
|
40
30
|
function error() {
|
|
41
31
|
var _console3, _context3;
|
|
42
|
-
|
|
43
32
|
for (var _len3 = arguments.length, msg = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
44
33
|
msg[_key3] = arguments[_key3];
|
|
45
34
|
}
|
|
46
|
-
|
|
47
35
|
(_console3 = console).error.apply(_console3, (0, _concat.default)(_context3 = ['[kd-table]']).call(_context3, msg));
|
|
48
36
|
}
|
|
49
|
-
|
|
50
37
|
function table() {
|
|
51
38
|
if (isOutput()) {
|
|
52
39
|
var _console4, _context4;
|
|
53
|
-
|
|
54
40
|
for (var _len4 = arguments.length, msg = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
55
41
|
msg[_key4] = arguments[_key4];
|
|
56
42
|
}
|
|
57
|
-
|
|
58
43
|
(_console4 = console).table.apply(_console4, (0, _concat.default)(_context4 = ['[kd-table]']).call(_context4, msg));
|
|
59
44
|
}
|
|
60
45
|
}
|
|
61
|
-
|
|
62
|
-
var _default = {
|
|
46
|
+
var _default = exports.default = {
|
|
63
47
|
log: log,
|
|
64
48
|
warn: warn,
|
|
65
49
|
error: error,
|
|
66
50
|
table: table
|
|
67
|
-
};
|
|
68
|
-
exports.default = _default;
|
|
51
|
+
};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.copyDataToClipboard = void 0;
|
|
9
8
|
exports.executeOnTempElement = executeOnTempElement;
|
|
10
|
-
|
|
11
9
|
var _console = _interopRequireDefault(require("./console"));
|
|
12
|
-
|
|
13
|
-
var copyDataToClipboard = function copyDataToClipboard(data) {
|
|
10
|
+
var copyDataToClipboard = exports.copyDataToClipboard = function copyDataToClipboard(data) {
|
|
14
11
|
return function (element) {
|
|
15
12
|
element.value = data;
|
|
16
13
|
element.select();
|
|
@@ -19,9 +16,6 @@ var copyDataToClipboard = function copyDataToClipboard(data) {
|
|
|
19
16
|
document.body.removeChild(element);
|
|
20
17
|
};
|
|
21
18
|
};
|
|
22
|
-
|
|
23
|
-
exports.copyDataToClipboard = copyDataToClipboard;
|
|
24
|
-
|
|
25
19
|
function executeOnTempElement(callback) {
|
|
26
20
|
var eTempInput = document.createElement('textarea');
|
|
27
21
|
eTempInput.style.width = '1px';
|
|
@@ -31,7 +25,6 @@ function executeOnTempElement(callback) {
|
|
|
31
25
|
eTempInput.style.position = 'absolute';
|
|
32
26
|
eTempInput.style.opacity = '0.0';
|
|
33
27
|
document.body.appendChild(eTempInput);
|
|
34
|
-
|
|
35
28
|
try {
|
|
36
29
|
callback(eTempInput);
|
|
37
30
|
} catch (err) {
|
|
@@ -10,7 +10,6 @@ exports.getTargetEleInEventPath = getTargetEleInEventPath;
|
|
|
10
10
|
exports.hasScroll = hasScroll;
|
|
11
11
|
exports.isElementInEventPath = isElementInEventPath;
|
|
12
12
|
exports.keepWithinBounds = keepWithinBounds;
|
|
13
|
-
|
|
14
13
|
/** elementUtil html元素用的工具函数 */
|
|
15
14
|
// 获取面板相对屏幕的位置 panel - 面板 trigger - 触发器
|
|
16
15
|
// export function getPanelScreenByTrigger ({ panel, trigger, defaultAlign }) {
|
|
@@ -70,34 +69,27 @@ function getEventPath(event) {
|
|
|
70
69
|
// Firefox supports composePath
|
|
71
70
|
return event.composedPath();
|
|
72
71
|
}
|
|
73
|
-
|
|
74
72
|
return createEventPath(event);
|
|
75
73
|
}
|
|
76
|
-
|
|
77
74
|
function createEventPath(event) {
|
|
78
75
|
var res = [];
|
|
79
76
|
var pointer = event.target;
|
|
80
|
-
|
|
81
77
|
while (pointer) {
|
|
82
78
|
res.push(pointer);
|
|
83
79
|
pointer = pointer.parentElement;
|
|
84
80
|
}
|
|
85
|
-
|
|
86
81
|
return res;
|
|
87
82
|
}
|
|
88
|
-
|
|
89
83
|
;
|
|
90
84
|
/**
|
|
91
85
|
* 获取点击事件是否发生在元素内部
|
|
92
86
|
* @param ele
|
|
93
87
|
* @param event
|
|
94
88
|
*/
|
|
95
|
-
|
|
96
89
|
function isElementInEventPath(ele, event) {
|
|
97
90
|
if (!ele || !event) {
|
|
98
91
|
return false;
|
|
99
92
|
}
|
|
100
|
-
|
|
101
93
|
var path = getEventPath(event);
|
|
102
94
|
return path.indexOf(ele) >= 0;
|
|
103
95
|
}
|
|
@@ -106,22 +98,16 @@ function isElementInEventPath(ele, event) {
|
|
|
106
98
|
* @param path
|
|
107
99
|
* @param isTargetCb
|
|
108
100
|
*/
|
|
109
|
-
|
|
110
|
-
|
|
111
101
|
function getTargetEleInEventPath(path, isTargetCb) {
|
|
112
102
|
var target;
|
|
113
103
|
var l = 0;
|
|
114
|
-
|
|
115
104
|
while (!target && l < path.length) {
|
|
116
105
|
var ele = path[l];
|
|
117
|
-
|
|
118
106
|
if (isTargetCb(ele)) {
|
|
119
107
|
target = ele;
|
|
120
108
|
}
|
|
121
|
-
|
|
122
109
|
l++;
|
|
123
110
|
}
|
|
124
|
-
|
|
125
111
|
return target;
|
|
126
112
|
}
|
|
127
113
|
/**
|
|
@@ -129,8 +115,6 @@ function getTargetEleInEventPath(path, isTargetCb) {
|
|
|
129
115
|
* @param event
|
|
130
116
|
* @param popupParent
|
|
131
117
|
*/
|
|
132
|
-
|
|
133
|
-
|
|
134
118
|
function calculatePointerRelative(event, popupParent) {
|
|
135
119
|
var parentRect = popupParent.getBoundingClientRect();
|
|
136
120
|
var documentRect = document.documentElement.getBoundingClientRect();
|
|
@@ -144,8 +128,6 @@ function calculatePointerRelative(event, popupParent) {
|
|
|
144
128
|
* @param event
|
|
145
129
|
* @param popupParent
|
|
146
130
|
*/
|
|
147
|
-
|
|
148
|
-
|
|
149
131
|
function calculatePopupRelative(trigger, popupParent, offset) {
|
|
150
132
|
var triggerRect = trigger.getBoundingClientRect();
|
|
151
133
|
var parent = popupParent === document.body ? document.documentElement : popupParent;
|
|
@@ -155,48 +137,39 @@ function calculatePopupRelative(trigger, popupParent, offset) {
|
|
|
155
137
|
y: triggerRect.top - parentRect.top - (offset ? offset.y : 0)
|
|
156
138
|
};
|
|
157
139
|
}
|
|
158
|
-
|
|
159
140
|
function getPerfectX(_ref) {
|
|
160
141
|
var x = _ref.x,
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
142
|
+
maxX = _ref.maxX,
|
|
143
|
+
width = _ref.width,
|
|
144
|
+
isPerfectX = _ref.isPerfectX;
|
|
165
145
|
if (isPerfectX && Math.max(x, 0) > Math.abs(maxX)) {
|
|
166
146
|
//看左侧空间是否足够
|
|
167
147
|
var parentAvailableWidth = x;
|
|
168
|
-
|
|
169
148
|
if (width <= parentAvailableWidth) {
|
|
170
149
|
return x - width; //空间足够,往左侧偏移
|
|
171
150
|
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
151
|
+
}
|
|
152
|
+
//目前位置,最大支持的位置
|
|
175
153
|
return Math.min(Math.max(x, 0), Math.abs(maxX));
|
|
176
154
|
}
|
|
177
|
-
|
|
178
155
|
function getPerfectY(_ref2) {
|
|
179
156
|
var y = _ref2.y,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
157
|
+
maxY = _ref2.maxY,
|
|
158
|
+
height = _ref2.height,
|
|
159
|
+
scrollTop = _ref2.scrollTop,
|
|
160
|
+
isBody = _ref2.isBody,
|
|
161
|
+
isPerfectY = _ref2.isPerfectY;
|
|
186
162
|
if (isPerfectY && Math.max(y, 0) > Math.abs(maxY)) {
|
|
187
163
|
//看下上方空间是否足够
|
|
188
164
|
var parentAvailableHeight = isBody ? y - scrollTop : y;
|
|
189
|
-
|
|
190
165
|
if (height <= parentAvailableHeight) {
|
|
191
166
|
//上方空间足够,向上展示
|
|
192
167
|
return y - height;
|
|
193
168
|
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
|
|
169
|
+
}
|
|
170
|
+
//目前位置,最大支持的位置
|
|
197
171
|
return Math.min(Math.max(y, 0), Math.abs(maxY));
|
|
198
172
|
}
|
|
199
|
-
|
|
200
173
|
function keepWithinBounds(popupParent, popup, x, y, isPerfect) {
|
|
201
174
|
var parentRect = popupParent.getBoundingClientRect();
|
|
202
175
|
var docElement = document.documentElement;
|
|
@@ -205,14 +178,12 @@ function keepWithinBounds(popupParent, popup, x, y, isPerfect) {
|
|
|
205
178
|
var parentAvailableWidth = parentRect.width;
|
|
206
179
|
var parentAvailableHeight = parentRect.height;
|
|
207
180
|
var isBody = popupParent === document.body;
|
|
208
|
-
|
|
209
181
|
if (isBody) {
|
|
210
182
|
//ducument的宽度减去 父元素到document边界的的宽度,就是剩余可显示的宽度
|
|
211
|
-
parentAvailableWidth = docRect.width - Math.abs(docRect.left - parentRect.left);
|
|
212
|
-
|
|
183
|
+
parentAvailableWidth = docRect.width - Math.abs(docRect.left - parentRect.left);
|
|
184
|
+
//ducument的高度加上滚动条的高度减去 父元素到document边界的的宽度,就是剩余可显示的高度
|
|
213
185
|
parentAvailableHeight = docRect.height + docElement.scrollTop - Math.abs(docRect.top - parentRect.top);
|
|
214
186
|
}
|
|
215
|
-
|
|
216
187
|
if (x) {
|
|
217
188
|
var width = popupRect.width;
|
|
218
189
|
var maxX = parentAvailableWidth - width;
|
|
@@ -223,7 +194,6 @@ function keepWithinBounds(popupParent, popup, x, y, isPerfect) {
|
|
|
223
194
|
isPerfectX: isPerfect
|
|
224
195
|
});
|
|
225
196
|
}
|
|
226
|
-
|
|
227
197
|
if (y) {
|
|
228
198
|
var height = popupRect.height;
|
|
229
199
|
var maxY = parentAvailableHeight - height;
|
|
@@ -236,13 +206,11 @@ function keepWithinBounds(popupParent, popup, x, y, isPerfect) {
|
|
|
236
206
|
isPerfectY: isPerfect
|
|
237
207
|
});
|
|
238
208
|
}
|
|
239
|
-
|
|
240
209
|
return {
|
|
241
210
|
x: x,
|
|
242
211
|
y: y
|
|
243
212
|
};
|
|
244
213
|
}
|
|
245
|
-
|
|
246
214
|
function hasScroll(ele) {
|
|
247
215
|
var isHorizontal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
248
216
|
return isHorizontal ? ele.scrollWidth > ele.clientWidth : ele.scrollHeight > ele.clientHeight;
|
|
@@ -1,63 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
4
|
-
|
|
5
4
|
var _Array$from = require("@babel/runtime-corejs3/core-js-stable/array/from");
|
|
6
|
-
|
|
7
5
|
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
8
|
-
|
|
9
6
|
var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
|
|
10
|
-
|
|
11
7
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
12
|
-
|
|
13
8
|
Object.defineProperty(exports, "__esModule", {
|
|
14
9
|
value: true
|
|
15
10
|
});
|
|
16
11
|
exports.default = exportTableAsExcel;
|
|
17
|
-
|
|
18
12
|
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
19
|
-
|
|
20
13
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
21
|
-
|
|
22
14
|
var _SpanManager = _interopRequireDefault(require("../base/helpers/SpanManager"));
|
|
23
|
-
|
|
24
15
|
var _internals = require("../internals");
|
|
25
|
-
|
|
26
16
|
var _collectNodes = _interopRequireDefault(require("./collectNodes"));
|
|
27
|
-
|
|
28
17
|
var _getTreeDepth = _interopRequireDefault(require("./getTreeDepth"));
|
|
29
|
-
|
|
30
18
|
var _isLeafNode = _interopRequireDefault(require("./isLeafNode"));
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function _unsupportedIterableToArray(o, minLen) { var _context2; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context2 = Object.prototype.toString.call(o)).call(_context2, 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); }
|
|
35
|
-
|
|
36
|
-
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; }
|
|
37
|
-
|
|
19
|
+
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; } } }; }
|
|
20
|
+
function _unsupportedIterableToArray(r, a) { if (r) { var _context2; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_context2 = {}.toString.call(r)).call(_context2, 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; } }
|
|
21
|
+
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; }
|
|
38
22
|
function safeGetSpanRect(column, record, rowIndex, colIndex) {
|
|
39
23
|
var colSpan = 1;
|
|
40
24
|
var rowSpan = 1;
|
|
41
|
-
|
|
42
25
|
if (column.getSpanRect) {
|
|
43
26
|
var value = _internals.internals.safeGetValue(column, record, rowIndex);
|
|
44
|
-
|
|
45
27
|
var spanRect = column.getSpanRect(value, record, rowIndex);
|
|
46
28
|
colSpan = spanRect == null ? 1 : spanRect.right - colIndex;
|
|
47
29
|
rowSpan = spanRect == null ? 1 : spanRect.bottom - rowIndex;
|
|
48
30
|
} else {
|
|
49
31
|
var cellProps = _internals.internals.safeGetCellProps(column, record, rowIndex);
|
|
50
|
-
|
|
51
32
|
if (cellProps.colSpan != null) {
|
|
52
33
|
colSpan = cellProps.colSpan;
|
|
53
34
|
}
|
|
54
|
-
|
|
55
35
|
if (cellProps.rowSpan != null) {
|
|
56
36
|
rowSpan = cellProps.rowSpan;
|
|
57
37
|
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
38
|
+
}
|
|
39
|
+
// 注意这里没有考虑「rowSpan/colSpan 不能过大,避免 rowSpan/colSpan 影响因虚拟滚动而未渲染的单元格」
|
|
61
40
|
return {
|
|
62
41
|
top: rowIndex,
|
|
63
42
|
bottom: rowIndex + rowSpan,
|
|
@@ -65,16 +44,14 @@ function safeGetSpanRect(column, record, rowIndex, colIndex) {
|
|
|
65
44
|
right: colIndex + colSpan
|
|
66
45
|
};
|
|
67
46
|
}
|
|
68
|
-
|
|
69
47
|
function move(_ref, dx, dy) {
|
|
70
48
|
var c = _ref.c,
|
|
71
|
-
|
|
49
|
+
r = _ref.r;
|
|
72
50
|
return {
|
|
73
51
|
c: c + dx,
|
|
74
52
|
r: r + dy
|
|
75
53
|
};
|
|
76
54
|
}
|
|
77
|
-
|
|
78
55
|
function sanitizeCellDatum(value) {
|
|
79
56
|
if (value === Infinity || value === -Infinity || typeof value === 'number' && isNaN(value)) {
|
|
80
57
|
return null;
|
|
@@ -83,8 +60,6 @@ function sanitizeCellDatum(value) {
|
|
|
83
60
|
}
|
|
84
61
|
}
|
|
85
62
|
/** 根据 BaseTable 的 dataSource 和 column,将表格数据导出为 Excel 文件 */
|
|
86
|
-
|
|
87
|
-
|
|
88
63
|
function exportTableAsExcel(xlsxPackage, dataSource, columns, filename) {
|
|
89
64
|
var sheet = xlsxPackage.utils.aoa_to_sheet([]);
|
|
90
65
|
var topHeaderHeight = (0, _getTreeDepth.default)(columns) + 1;
|
|
@@ -100,30 +75,22 @@ function exportTableAsExcel(xlsxPackage, dataSource, columns, filename) {
|
|
|
100
75
|
Sheet1: sheet
|
|
101
76
|
}
|
|
102
77
|
}, filename);
|
|
103
|
-
|
|
104
78
|
function addTopHeaders(origin) {
|
|
105
79
|
dfs(columns, 0, 0);
|
|
106
|
-
|
|
107
80
|
function dfs(cols, startDx, startDy) {
|
|
108
81
|
var _a;
|
|
109
|
-
|
|
110
82
|
var start = move(origin, startDx, startDy);
|
|
111
83
|
var offsetX = 0;
|
|
112
|
-
|
|
113
84
|
var _iterator = _createForOfIteratorHelper(cols),
|
|
114
|
-
|
|
115
|
-
|
|
85
|
+
_step;
|
|
116
86
|
try {
|
|
117
87
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
118
88
|
var col = _step.value;
|
|
119
|
-
|
|
120
89
|
if ((_a = col.features) === null || _a === void 0 ? void 0 : _a.noExport) {
|
|
121
90
|
continue;
|
|
122
91
|
}
|
|
123
|
-
|
|
124
92
|
var current = move(start, offsetX, 0);
|
|
125
93
|
addOne(col.name, current);
|
|
126
|
-
|
|
127
94
|
if ((0, _isLeafNode.default)(col)) {
|
|
128
95
|
offsetX += 1;
|
|
129
96
|
mergeCells(current, 1, topHeaderHeight - startDy);
|
|
@@ -138,17 +105,13 @@ function exportTableAsExcel(xlsxPackage, dataSource, columns, filename) {
|
|
|
138
105
|
} finally {
|
|
139
106
|
_iterator.f();
|
|
140
107
|
}
|
|
141
|
-
|
|
142
108
|
return offsetX;
|
|
143
109
|
}
|
|
144
110
|
}
|
|
145
|
-
|
|
146
111
|
function addDataPart(origin) {
|
|
147
112
|
var _context;
|
|
148
|
-
|
|
149
113
|
var leafColumns = (0, _filter.default)(_context = (0, _collectNodes.default)(columns, 'leaf-only')).call(_context, function (col) {
|
|
150
114
|
var _a;
|
|
151
|
-
|
|
152
115
|
return !((_a = col.features) === null || _a === void 0 ? void 0 : _a.noExport);
|
|
153
116
|
});
|
|
154
117
|
var spanManager = new _SpanManager.default();
|
|
@@ -158,43 +121,35 @@ function exportTableAsExcel(xlsxPackage, dataSource, columns, filename) {
|
|
|
158
121
|
if (spanManager.testSkip(rowIndex, colIndex)) {
|
|
159
122
|
return null;
|
|
160
123
|
}
|
|
161
|
-
|
|
162
124
|
var spanRect = safeGetSpanRect(col, record, rowIndex, colIndex);
|
|
163
125
|
var rowSpan = spanRect.bottom - spanRect.top;
|
|
164
126
|
var colSpan = spanRect.right - spanRect.left;
|
|
165
|
-
|
|
166
127
|
if (rowSpan > 1 || colSpan > 1) {
|
|
167
128
|
spanManager.add(spanRect.top, spanRect.left, colSpan, rowSpan);
|
|
168
129
|
mergeCells(move(origin, spanRect.left, spanRect.top), colSpan, rowSpan);
|
|
169
130
|
}
|
|
170
|
-
|
|
171
131
|
return sanitizeCellDatum(_internals.internals.safeGetValue(col, record, rowIndex));
|
|
172
132
|
});
|
|
173
133
|
});
|
|
174
134
|
add(dataPart, origin);
|
|
175
135
|
}
|
|
176
|
-
|
|
177
136
|
function add(data, origin) {
|
|
178
137
|
xlsxPackage.utils.sheet_add_aoa(sheet, data, {
|
|
179
138
|
origin: origin
|
|
180
139
|
});
|
|
181
140
|
}
|
|
182
|
-
|
|
183
141
|
function addOne(datum, origin) {
|
|
184
142
|
xlsxPackage.utils.sheet_add_aoa(sheet, [[datum]], {
|
|
185
143
|
origin: origin
|
|
186
144
|
});
|
|
187
145
|
}
|
|
188
|
-
|
|
189
146
|
function mergeCells(addr, width, height) {
|
|
190
147
|
if (width === 1 && height === 1) {
|
|
191
148
|
return;
|
|
192
149
|
}
|
|
193
|
-
|
|
194
150
|
if (sheet['!merges'] == null) {
|
|
195
151
|
sheet['!merges'] = [];
|
|
196
152
|
}
|
|
197
|
-
|
|
198
153
|
sheet['!merges'].push({
|
|
199
154
|
s: addr,
|
|
200
155
|
e: move(addr, width - 1, height - 1)
|
|
@@ -1,42 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
4
|
-
|
|
5
4
|
var _Array$from = require("@babel/runtime-corejs3/core-js-stable/array/from");
|
|
6
|
-
|
|
7
5
|
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
8
|
-
|
|
9
6
|
var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
|
|
10
|
-
|
|
11
7
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
12
|
-
|
|
13
8
|
Object.defineProperty(exports, "__esModule", {
|
|
14
9
|
value: true
|
|
15
10
|
});
|
|
16
11
|
exports.default = getTreeDepth;
|
|
17
|
-
|
|
18
12
|
var _isLeafNode = _interopRequireDefault(require("./isLeafNode"));
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
function _unsupportedIterableToArray(o, minLen) { var _context; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 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); }
|
|
23
|
-
|
|
24
|
-
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; }
|
|
25
|
-
|
|
13
|
+
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; } } }; }
|
|
14
|
+
function _unsupportedIterableToArray(r, a) { if (r) { var _context; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_context = {}.toString.call(r)).call(_context, 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; } }
|
|
15
|
+
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; }
|
|
26
16
|
/** 获取一棵树的高度/深度 (0-based) */
|
|
27
17
|
function getTreeDepth(nodes) {
|
|
28
18
|
var maxDepth = -1;
|
|
29
19
|
dfs(nodes, 0);
|
|
30
20
|
return maxDepth;
|
|
31
|
-
|
|
32
21
|
function dfs(columns, depth) {
|
|
33
22
|
var _iterator = _createForOfIteratorHelper(columns),
|
|
34
|
-
|
|
35
|
-
|
|
23
|
+
_step;
|
|
36
24
|
try {
|
|
37
25
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
38
26
|
var column = _step.value;
|
|
39
|
-
|
|
40
27
|
if ((0, _isLeafNode.default)(column)) {
|
|
41
28
|
maxDepth = Math.max(maxDepth, depth);
|
|
42
29
|
} else {
|
|
@@ -1,39 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
|
|
4
|
-
|
|
5
4
|
var _Array$from = require("@babel/runtime-corejs3/core-js-stable/array/from");
|
|
6
|
-
|
|
7
5
|
var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
|
|
8
|
-
|
|
9
6
|
var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
|
|
10
|
-
|
|
11
7
|
Object.defineProperty(exports, "__esModule", {
|
|
12
8
|
value: true
|
|
13
9
|
});
|
|
14
10
|
exports.default = groupBy;
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function _unsupportedIterableToArray(o, minLen) { var _context; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context = Object.prototype.toString.call(o)).call(_context, 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); }
|
|
19
|
-
|
|
20
|
-
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; }
|
|
21
|
-
|
|
11
|
+
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; } } }; }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { var _context; if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = _sliceInstanceProperty(_context = {}.toString.call(r)).call(_context, 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; } }
|
|
13
|
+
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; }
|
|
22
14
|
function groupBy(list, iteratee) {
|
|
23
15
|
var groups = {};
|
|
24
|
-
|
|
25
16
|
var _iterator = _createForOfIteratorHelper(list),
|
|
26
|
-
|
|
27
|
-
|
|
17
|
+
_step;
|
|
28
18
|
try {
|
|
29
19
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
30
20
|
var item = _step.value;
|
|
31
21
|
var key = iteratee(item);
|
|
32
|
-
|
|
33
22
|
if (groups[key] == null) {
|
|
34
23
|
groups[key] = [];
|
|
35
24
|
}
|
|
36
|
-
|
|
37
25
|
groups[key].push(item);
|
|
38
26
|
}
|
|
39
27
|
} catch (err) {
|
|
@@ -41,6 +29,5 @@ function groupBy(list, iteratee) {
|
|
|
41
29
|
} finally {
|
|
42
30
|
_iterator.f();
|
|
43
31
|
}
|
|
44
|
-
|
|
45
32
|
return groups;
|
|
46
33
|
}
|
package/lib/table/utils/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
@@ -179,45 +178,24 @@ Object.defineProperty(exports, "traverseColumn", {
|
|
|
179
178
|
return _traverseColumn.default;
|
|
180
179
|
}
|
|
181
180
|
});
|
|
182
|
-
|
|
183
181
|
var _collectNodes = _interopRequireDefault(require("./collectNodes"));
|
|
184
|
-
|
|
185
182
|
var _getTreeDepth = _interopRequireDefault(require("./getTreeDepth"));
|
|
186
|
-
|
|
187
183
|
var _groupBy = _interopRequireDefault(require("./groupBy"));
|
|
188
|
-
|
|
189
184
|
var _isLeafNode = _interopRequireDefault(require("./isLeafNode"));
|
|
190
|
-
|
|
191
185
|
var _isGroupColumn = _interopRequireDefault(require("./isGroupColumn"));
|
|
192
|
-
|
|
193
186
|
var _applyTransforms = _interopRequireDefault(require("./applyTransforms"));
|
|
194
|
-
|
|
195
187
|
var _buildTree = _interopRequireDefault(require("./buildTree"));
|
|
196
|
-
|
|
197
188
|
var _exportTableAsExcel = _interopRequireDefault(require("./exportTableAsExcel"));
|
|
198
|
-
|
|
199
189
|
var _layeredSort = _interopRequireDefault(require("./layeredSort"));
|
|
200
|
-
|
|
201
190
|
var _mergeCellProps = _interopRequireDefault(require("./mergeCellProps"));
|
|
202
|
-
|
|
203
191
|
var _proto = _interopRequireDefault(require("./proto"));
|
|
204
|
-
|
|
205
192
|
var _makeRecursiveMapper = _interopRequireDefault(require("./makeRecursiveMapper"));
|
|
206
|
-
|
|
207
193
|
var _smartCompare = _interopRequireDefault(require("./smartCompare"));
|
|
208
|
-
|
|
209
194
|
var _traverseColumn = _interopRequireDefault(require("./traverseColumn"));
|
|
210
|
-
|
|
211
195
|
var _copyToClipboard = require("./copyToClipboard");
|
|
212
|
-
|
|
213
196
|
var _layeredFilter = _interopRequireDefault(require("./layeredFilter"));
|
|
214
|
-
|
|
215
197
|
var _element = require("./element");
|
|
216
|
-
|
|
217
198
|
var _console = _interopRequireDefault(require("./console"));
|
|
218
|
-
|
|
219
199
|
var _browserType = require("./browserType");
|
|
220
|
-
|
|
221
200
|
var _selectColumn = require("./selectColumn");
|
|
222
|
-
|
|
223
201
|
var _uiDegrade = require("./uiDegrade");
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = isGroupColumn;
|
|
9
|
-
|
|
10
8
|
var _findIndex = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
|
|
11
|
-
|
|
12
9
|
// 是否是叶子节点
|
|
13
10
|
function isGroupColumn(columns) {
|
|
14
11
|
return (0, _findIndex.default)(columns).call(columns, function (col) {
|