@kdcloudjs/table 1.2.1-canary.6 → 1.2.1-canary.6-hotfix.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +0 -0
- package/dist/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.js +4847 -6022
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +16 -24
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- 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 +84 -147
- 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/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/header.js +30 -81
- 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 +2 -3
- 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.js +0 -9
- package/es/table/base/table.js +110 -199
- package/es/table/base/utils.js +17 -57
- package/es/table/common-views.js +0 -7
- package/es/table/interfaces.d.ts +2 -0
- package/es/table/internals.d.ts +2 -1
- package/es/table/internals.js +0 -13
- 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/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 +6 -43
- package/es/table/pipeline/features/rowDrag.js +39 -78
- package/es/table/pipeline/features/rowGrouping.js +10 -42
- package/es/table/pipeline/features/singleSelect.js +0 -24
- package/es/table/pipeline/features/sort.js +37 -90
- package/es/table/pipeline/features/tips.js +4 -10
- package/es/table/pipeline/features/treeMode.js +14 -49
- package/es/table/pipeline/features/treeSelect.js +2 -28
- package/es/table/pipeline/pipeline.js +12 -53
- 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-table/interfaces.d.ts +1 -1
- 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/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.d.ts +1 -0
- package/es/table/transforms/sort.js +42 -96
- package/es/table/transforms/tips.js +5 -10
- package/es/table/transforms/treeMode.js +39 -80
- 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 +8 -13
- 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 +88 -176
- package/lib/config-provider/ConfigContext.js +2 -6
- package/lib/config-provider/compDefaultProps.js +1 -3
- package/lib/config-provider/configProvider.js +5 -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 +2 -11
- package/lib/locale/locale.js +15 -71
- package/lib/locale/zh-CN.js +1 -2
- package/lib/table/base/calculations.js +25 -86
- package/lib/table/base/colgroup.js +0 -5
- package/lib/table/base/empty.js +7 -20
- package/lib/table/base/header.js +30 -91
- 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 +2 -7
- package/lib/table/base/helpers/__test__/rowHeightManager.test.js +0 -1
- package/lib/table/base/helpers/getRichVisibleRectsStream.js +14 -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 +44 -76
- package/lib/table/base/styles.js +8 -37
- package/lib/table/base/table.js +121 -243
- package/lib/table/base/utils.js +26 -109
- package/lib/table/common-views.js +4 -24
- package/lib/table/index.js +0 -13
- package/lib/table/interfaces.d.ts +2 -0
- package/lib/table/internals.d.ts +2 -1
- package/lib/table/internals.js +2 -17
- 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 +17 -63
- package/lib/table/pipeline/features/contextMenu.js +23 -121
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +16 -52
- package/lib/table/pipeline/features/filter/DefaultFilterIcon.js +1 -4
- package/lib/table/pipeline/features/filter/Filter.js +29 -77
- package/lib/table/pipeline/features/filter/FilterPanel.js +13 -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 +6 -67
- package/lib/table/pipeline/features/rowDrag.js +41 -93
- package/lib/table/pipeline/features/rowGrouping.js +10 -62
- package/lib/table/pipeline/features/singleSelect.js +0 -34
- package/lib/table/pipeline/features/sort.js +37 -110
- package/lib/table/pipeline/features/tips.js +4 -19
- package/lib/table/pipeline/features/treeMode.js +15 -72
- package/lib/table/pipeline/features/treeSelect.js +2 -36
- package/lib/table/pipeline/index.js +1 -10
- package/lib/table/pipeline/pipeline.js +13 -64
- 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-table/interfaces.d.ts +1 -1
- 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/transforms/autoRowSpan.js +1 -21
- package/lib/table/transforms/autoWidth.js +14 -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 +19 -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.d.ts +1 -0
- package/lib/table/transforms/sort.js +43 -122
- package/lib/table/transforms/tips.js +5 -20
- package/lib/table/transforms/treeMode.js +40 -109
- 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 +8 -18
- 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 +3 -2
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
2
2
|
import _taggedTemplateLiteral from "@babel/runtime-corejs3/helpers/taggedTemplateLiteral";
|
|
3
|
-
|
|
4
3
|
var _templateObject;
|
|
5
|
-
|
|
6
4
|
import React from 'react';
|
|
7
5
|
import styled from 'styled-components';
|
|
8
6
|
import { icons } from '../../common-views';
|
|
@@ -13,25 +11,21 @@ export function tips() {
|
|
|
13
11
|
return function tipsSteap(pipeline) {
|
|
14
12
|
var Balloon = pipeline.ctx.components.Balloon;
|
|
15
13
|
var Tooltip = pipeline.ctx.components.Tooltip;
|
|
16
|
-
|
|
17
14
|
if (Balloon == null && Tooltip == null) {
|
|
18
15
|
throw new Error('使用 tips 之前需要通过 pipeline context 设置 components.Balloon / components.Tooltip');
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
return pipeline.mapColumns(makeRecursiveMapper(function (col) {
|
|
22
18
|
var _a;
|
|
23
|
-
|
|
24
19
|
if (!((_a = col.features) === null || _a === void 0 ? void 0 : _a.tips)) {
|
|
25
20
|
return col;
|
|
26
21
|
}
|
|
27
|
-
|
|
28
22
|
var justifyContent = col.align === 'right' ? 'flex-end' : col.align === 'center' ? 'center' : 'flex-start';
|
|
29
23
|
return _extends(_extends({}, col), {
|
|
30
|
-
title: /*#__PURE__*/React.createElement(HeaderCellWithTips, {
|
|
24
|
+
title: (/*#__PURE__*/React.createElement(HeaderCellWithTips, {
|
|
31
25
|
style: {
|
|
32
26
|
justifyContent: justifyContent
|
|
33
27
|
}
|
|
34
|
-
}, internals.safeRenderHeader(col), Balloon ?
|
|
28
|
+
}, internals.safeRenderHeader(col), Balloon ? (
|
|
35
29
|
/*#__PURE__*/
|
|
36
30
|
// fusion/hippo
|
|
37
31
|
React.createElement(Balloon, {
|
|
@@ -41,7 +35,7 @@ export function tips() {
|
|
|
41
35
|
}, /*#__PURE__*/React.createElement(icons.Info, {
|
|
42
36
|
className: "tip-icon"
|
|
43
37
|
}))
|
|
44
|
-
}, col.features.tips) :
|
|
38
|
+
}, col.features.tips)) : (
|
|
45
39
|
/*#__PURE__*/
|
|
46
40
|
// antd
|
|
47
41
|
React.createElement(Tooltip, {
|
|
@@ -50,7 +44,7 @@ export function tips() {
|
|
|
50
44
|
className: "tip-icon-wrapper"
|
|
51
45
|
}, /*#__PURE__*/React.createElement(icons.Info, {
|
|
52
46
|
className: "tip-icon"
|
|
53
|
-
}))))
|
|
47
|
+
}))))))
|
|
54
48
|
});
|
|
55
49
|
}));
|
|
56
50
|
};
|
|
@@ -4,13 +4,9 @@ import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-meth
|
|
|
4
4
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
5
5
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
6
6
|
import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
10
|
-
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); }
|
|
11
|
-
|
|
12
|
-
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; }
|
|
13
|
-
|
|
7
|
+
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; } } }; }
|
|
8
|
+
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; } }
|
|
9
|
+
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; }
|
|
14
10
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
15
11
|
import _Set from "@babel/runtime-corejs3/core-js-stable/set";
|
|
16
12
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
@@ -27,66 +23,54 @@ export function treeMode() {
|
|
|
27
23
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
28
24
|
return function treeModeStep(pipeline) {
|
|
29
25
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
30
|
-
|
|
31
26
|
var stateKey = 'treeMode';
|
|
32
27
|
var ctx = pipeline.ctx;
|
|
33
28
|
var primaryKey = pipeline.ensurePrimaryKey('treeMode');
|
|
34
29
|
var openKeys = (_c = (_b = (_a = opts.openKeys) !== null && _a !== void 0 ? _a : pipeline.getStateAtKey(stateKey)) !== null && _b !== void 0 ? _b : opts.defaultOpenKeys) !== null && _c !== void 0 ? _c : [];
|
|
35
30
|
var openKeySet = new _Set(openKeys);
|
|
36
|
-
|
|
37
31
|
var onChangeOpenKeys = function onChangeOpenKeys(nextKeys, key, action) {
|
|
38
32
|
var _a;
|
|
39
|
-
|
|
40
33
|
(_a = opts.onChangeOpenKeys) === null || _a === void 0 ? void 0 : _a.call(opts, nextKeys, key, action);
|
|
41
34
|
pipeline.setStateAtKey(stateKey, nextKeys, {
|
|
42
35
|
key: key,
|
|
43
36
|
action: action
|
|
44
37
|
});
|
|
45
38
|
};
|
|
46
|
-
|
|
47
39
|
var toggle = function toggle(rowKey) {
|
|
48
40
|
var expanded = openKeySet.has(rowKey);
|
|
49
|
-
|
|
50
41
|
if (expanded) {
|
|
51
42
|
onChangeOpenKeys(_filterInstanceProperty(openKeys).call(openKeys, function (key) {
|
|
52
43
|
return key !== rowKey;
|
|
53
44
|
}), rowKey, 'collapse');
|
|
54
45
|
} else {
|
|
55
46
|
var _context;
|
|
56
|
-
|
|
57
47
|
onChangeOpenKeys(_concatInstanceProperty(_context = []).call(_context, _toConsumableArray(openKeys), [rowKey]), rowKey, 'expand');
|
|
58
48
|
}
|
|
59
49
|
};
|
|
60
|
-
|
|
61
50
|
var isLeafNode = (_d = opts.isLeafNode) !== null && _d !== void 0 ? _d : standardIsLeafNode;
|
|
62
51
|
var clickArea = (_e = opts.clickArea) !== null && _e !== void 0 ? _e : 'cell';
|
|
63
52
|
var treeMetaKey = (_f = opts.treeMetaKey) !== null && _f !== void 0 ? _f : treeMetaSymbol;
|
|
64
|
-
var stopClickEventPropagation = Boolean(opts.stopClickEventPropagation);
|
|
65
|
-
|
|
53
|
+
var stopClickEventPropagation = Boolean(opts.stopClickEventPropagation);
|
|
54
|
+
// indents
|
|
66
55
|
var iconWidth = ctx.indents.iconWidth;
|
|
67
56
|
var iconIndent = (_g = opts.iconIndent) !== null && _g !== void 0 ? _g : ctx.indents.iconIndent;
|
|
68
57
|
var iconGap = (_h = opts.iconGap) !== null && _h !== void 0 ? _h : ctx.indents.iconGap;
|
|
69
58
|
var indentSize = (_j = opts.indentSize) !== null && _j !== void 0 ? _j : ctx.indents.indentSize;
|
|
70
59
|
var Icon = opts.icon;
|
|
71
60
|
return pipeline.mapDataSource(processDataSource).mapColumns(processColumns);
|
|
72
|
-
|
|
73
61
|
function processDataSource(input) {
|
|
74
62
|
if (pipeline.isSameInputDataSource() && openKeys === pipeline.getFeatureOptions('lastOpenKeys')) {
|
|
75
63
|
return pipeline.getFeatureOptions('lastTreeMode');
|
|
76
64
|
}
|
|
77
|
-
|
|
78
65
|
pipeline.setFeatureOptions('lastOpenKeys', pipeline.getStateAtKey(stateKey));
|
|
79
66
|
var result = [];
|
|
80
67
|
dfs(input, 0);
|
|
81
|
-
|
|
82
68
|
function dfs(nodes, depth) {
|
|
83
69
|
if (nodes == null) {
|
|
84
70
|
return;
|
|
85
71
|
}
|
|
86
|
-
|
|
87
72
|
var _iterator = _createForOfIteratorHelper(nodes),
|
|
88
|
-
|
|
89
|
-
|
|
73
|
+
_step;
|
|
90
74
|
try {
|
|
91
75
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
92
76
|
var node = _step.value;
|
|
@@ -104,7 +88,6 @@ export function treeMode() {
|
|
|
104
88
|
rowKey: rowKey
|
|
105
89
|
};
|
|
106
90
|
result.push(_extends(_defineProperty({}, treeMetaKey, treeMeta), node));
|
|
107
|
-
|
|
108
91
|
if (!isLeaf && expanded) {
|
|
109
92
|
dfs(node.children, depth + 1);
|
|
110
93
|
}
|
|
@@ -115,39 +98,31 @@ export function treeMode() {
|
|
|
115
98
|
_iterator.f();
|
|
116
99
|
}
|
|
117
100
|
}
|
|
118
|
-
|
|
119
101
|
pipeline.setFeatureOptions('lastTreeMode', result);
|
|
120
102
|
return result;
|
|
121
103
|
}
|
|
122
|
-
|
|
123
104
|
function processColumns(columns) {
|
|
124
105
|
if (columns.length === 0) {
|
|
125
106
|
return columns;
|
|
126
107
|
}
|
|
127
|
-
|
|
128
108
|
var expandColIndex = _findIndexInstanceProperty(columns).call(columns, function (_ref) {
|
|
129
109
|
var code = _ref.code;
|
|
130
110
|
return code && opts.expandColCode === code;
|
|
131
111
|
});
|
|
132
|
-
|
|
133
112
|
expandColIndex = expandColIndex === -1 ? 0 : expandColIndex;
|
|
134
113
|
var expandCol = columns[expandColIndex];
|
|
135
|
-
|
|
136
114
|
var render = function render(value, record, recordIndex) {
|
|
137
115
|
var content = internals.safeRender(expandCol, record, recordIndex);
|
|
138
|
-
|
|
139
116
|
if (record[treeMetaKey] == null) {
|
|
140
117
|
// 没有 treeMeta 信息的话,就返回原先的渲染结果
|
|
141
118
|
return content;
|
|
142
119
|
}
|
|
143
|
-
|
|
144
120
|
var _record$treeMetaKey = record[treeMetaKey],
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
121
|
+
rowKey = _record$treeMetaKey.rowKey,
|
|
122
|
+
depth = _record$treeMetaKey.depth,
|
|
123
|
+
isLeaf = _record$treeMetaKey.isLeaf,
|
|
124
|
+
expanded = _record$treeMetaKey.expanded;
|
|
149
125
|
var indent = iconIndent + depth * indentSize;
|
|
150
|
-
|
|
151
126
|
if (isLeaf) {
|
|
152
127
|
return /*#__PURE__*/React.createElement(InlineFlexCell, {
|
|
153
128
|
className: cx('expansion-cell', Classes.leaf)
|
|
@@ -157,15 +132,12 @@ export function treeMode() {
|
|
|
157
132
|
}
|
|
158
133
|
}, content));
|
|
159
134
|
}
|
|
160
|
-
|
|
161
135
|
var onClick = function onClick(e) {
|
|
162
136
|
if (stopClickEventPropagation) {
|
|
163
137
|
e.stopPropagation();
|
|
164
138
|
}
|
|
165
|
-
|
|
166
139
|
toggle(rowKey);
|
|
167
140
|
};
|
|
168
|
-
|
|
169
141
|
var expandCls = expanded ? Classes.expanded : Classes.collapsed;
|
|
170
142
|
return /*#__PURE__*/React.createElement(ExpansionCell, {
|
|
171
143
|
className: cx('expansion-cell', expandCls),
|
|
@@ -192,29 +164,23 @@ export function treeMode() {
|
|
|
192
164
|
onClick: clickArea === 'icon' ? onClick : undefined
|
|
193
165
|
}), content);
|
|
194
166
|
};
|
|
195
|
-
|
|
196
167
|
var getCellProps = function getCellProps(value, record, rowIndex) {
|
|
197
168
|
var prevProps = internals.safeGetCellProps(expandCol, record, rowIndex);
|
|
198
|
-
|
|
199
169
|
if (record[treeMetaKey] == null) {
|
|
200
170
|
// 没有 treeMeta 信息的话,就返回原先的 cellProps
|
|
201
171
|
return prevProps;
|
|
202
172
|
}
|
|
203
|
-
|
|
204
173
|
var _record$treeMetaKey2 = record[treeMetaKey],
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
174
|
+
isLeaf = _record$treeMetaKey2.isLeaf,
|
|
175
|
+
rowKey = _record$treeMetaKey2.rowKey;
|
|
208
176
|
if (isLeaf) {
|
|
209
177
|
return prevProps;
|
|
210
178
|
}
|
|
211
|
-
|
|
212
179
|
return mergeCellProps(prevProps, {
|
|
213
180
|
onClick: function onClick(e) {
|
|
214
181
|
if (stopClickEventPropagation) {
|
|
215
182
|
e.stopPropagation();
|
|
216
183
|
}
|
|
217
|
-
|
|
218
184
|
toggle(rowKey);
|
|
219
185
|
},
|
|
220
186
|
style: {
|
|
@@ -222,14 +188,13 @@ export function treeMode() {
|
|
|
222
188
|
}
|
|
223
189
|
});
|
|
224
190
|
};
|
|
225
|
-
|
|
226
191
|
columns[expandColIndex] = _extends(_extends({}, expandCol), {
|
|
227
|
-
title: /*#__PURE__*/React.createElement("span", {
|
|
192
|
+
title: (/*#__PURE__*/React.createElement("span", {
|
|
228
193
|
style: {
|
|
229
194
|
marginLeft: iconIndent + iconWidth + iconGap,
|
|
230
195
|
display: 'flex'
|
|
231
196
|
}
|
|
232
|
-
}, internals.safeRenderHeader(expandCol)),
|
|
197
|
+
}, internals.safeRenderHeader(expandCol))),
|
|
233
198
|
render: render,
|
|
234
199
|
getCellProps: clickArea === 'cell' ? getCellProps : expandCol.getCellProps
|
|
235
200
|
});
|
|
@@ -8,32 +8,24 @@ import TreeDataHelper from '../../utils/tree-data-helpers/TreeDataHelper';
|
|
|
8
8
|
var STATE_KEY = 'treeSelect';
|
|
9
9
|
export function treeSelect(opts) {
|
|
10
10
|
return function treeSelectStep(pipeline) {
|
|
11
|
-
var
|
|
12
|
-
|
|
11
|
+
var _context;
|
|
13
12
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
14
|
-
|
|
15
13
|
var Checkbox = pipeline.ctx.components.Checkbox;
|
|
16
|
-
|
|
17
14
|
if (Checkbox == null) {
|
|
18
15
|
throw new Error('使用 treeSelect 之前需要通过 pipeline context 设置 components.Checkbox');
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
var primaryKey = pipeline.ensurePrimaryKey('treeSelect');
|
|
22
|
-
|
|
23
18
|
if (typeof primaryKey !== 'string') {
|
|
24
19
|
throw new Error('treeSelect 仅支持字符串作为 primaryKey');
|
|
25
20
|
}
|
|
26
|
-
|
|
27
21
|
var clickArea = (_a = opts.clickArea) !== null && _a !== void 0 ? _a : 'checkbox';
|
|
28
22
|
var isDisabled = (_b = opts.isDisabled) !== null && _b !== void 0 ? _b : always(false);
|
|
29
23
|
var isDetached = (_c = opts.idDetached) !== null && _c !== void 0 ? _c : always(false);
|
|
30
24
|
var value = (_f = (_e = (_d = opts.value) !== null && _d !== void 0 ? _d : pipeline.getStateAtKey(STATE_KEY)) !== null && _e !== void 0 ? _e : opts.defaultValue) !== null && _f !== void 0 ? _f : [];
|
|
31
|
-
var tree = opts.rootKey != null ? [(
|
|
32
|
-
|
|
25
|
+
var tree = opts.rootKey != null ? [_defineProperty(_defineProperty({}, primaryKey, opts.rootKey), "children", opts.tree)] : opts.tree;
|
|
33
26
|
var getNodeValue = function getNodeValue(node) {
|
|
34
27
|
return node[primaryKey];
|
|
35
28
|
};
|
|
36
|
-
|
|
37
29
|
var treeDataHelper = opts.checkStrictly ? new StrictTreeDataHelper({
|
|
38
30
|
value: value,
|
|
39
31
|
getNodeValue: getNodeValue,
|
|
@@ -45,15 +37,12 @@ export function treeSelect(opts) {
|
|
|
45
37
|
tree: tree,
|
|
46
38
|
checkedStrategy: (_g = opts.checkedStrategy) !== null && _g !== void 0 ? _g : 'parent'
|
|
47
39
|
});
|
|
48
|
-
|
|
49
40
|
var onToggleKey = function onToggleKey(key) {
|
|
50
41
|
var _a;
|
|
51
|
-
|
|
52
42
|
var nextValue = treeDataHelper.getValueAfterToggle(key);
|
|
53
43
|
pipeline.setStateAtKey(STATE_KEY, nextValue);
|
|
54
44
|
(_a = opts.onChange) === null || _a === void 0 ? void 0 : _a.call(opts, nextValue);
|
|
55
45
|
};
|
|
56
|
-
|
|
57
46
|
var makeCheckbox = function makeCheckbox(key, root, row) {
|
|
58
47
|
return /*#__PURE__*/React.createElement(Checkbox, {
|
|
59
48
|
checked: treeDataHelper.isChecked(key),
|
|
@@ -64,7 +53,6 @@ export function treeSelect(opts) {
|
|
|
64
53
|
} : undefined
|
|
65
54
|
});
|
|
66
55
|
};
|
|
67
|
-
|
|
68
56
|
var checkboxColumn = _extends(_extends({
|
|
69
57
|
name: '',
|
|
70
58
|
width: 50,
|
|
@@ -76,13 +64,10 @@ export function treeSelect(opts) {
|
|
|
76
64
|
},
|
|
77
65
|
getCellProps: function getCellProps(value, row) {
|
|
78
66
|
var rowKey = row[primaryKey];
|
|
79
|
-
|
|
80
67
|
if (clickArea !== 'cell') {
|
|
81
68
|
return;
|
|
82
69
|
}
|
|
83
|
-
|
|
84
70
|
var disabled = isDisabled(row);
|
|
85
|
-
|
|
86
71
|
if (disabled) {
|
|
87
72
|
return {
|
|
88
73
|
style: {
|
|
@@ -90,7 +75,6 @@ export function treeSelect(opts) {
|
|
|
90
75
|
}
|
|
91
76
|
};
|
|
92
77
|
}
|
|
93
|
-
|
|
94
78
|
return {
|
|
95
79
|
style: {
|
|
96
80
|
cursor: 'pointer'
|
|
@@ -99,29 +83,22 @@ export function treeSelect(opts) {
|
|
|
99
83
|
if (opts.stopClickEventPropagation) {
|
|
100
84
|
e.stopPropagation();
|
|
101
85
|
}
|
|
102
|
-
|
|
103
86
|
onToggleKey(rowKey);
|
|
104
87
|
}
|
|
105
88
|
};
|
|
106
89
|
}
|
|
107
90
|
});
|
|
108
|
-
|
|
109
91
|
var nextColumns = _sliceInstanceProperty(_context = pipeline.getColumns()).call(_context);
|
|
110
|
-
|
|
111
92
|
var checkboxPlacement = (_h = opts.checkboxPlacement) !== null && _h !== void 0 ? _h : 'start';
|
|
112
|
-
|
|
113
93
|
if (checkboxPlacement === 'start') {
|
|
114
94
|
nextColumns.unshift(checkboxColumn);
|
|
115
95
|
} else {
|
|
116
96
|
nextColumns.push(checkboxColumn);
|
|
117
97
|
}
|
|
118
|
-
|
|
119
98
|
pipeline.columns(nextColumns);
|
|
120
|
-
|
|
121
99
|
if (clickArea === 'row') {
|
|
122
100
|
pipeline.appendRowPropsGetter(function (row) {
|
|
123
101
|
var disabled = isDisabled(row);
|
|
124
|
-
|
|
125
102
|
if (!disabled) {
|
|
126
103
|
return {
|
|
127
104
|
style: {
|
|
@@ -131,14 +108,12 @@ export function treeSelect(opts) {
|
|
|
131
108
|
if (opts.stopClickEventPropagation) {
|
|
132
109
|
e.stopPropagation();
|
|
133
110
|
}
|
|
134
|
-
|
|
135
111
|
onToggleKey(row[primaryKey]);
|
|
136
112
|
}
|
|
137
113
|
};
|
|
138
114
|
}
|
|
139
115
|
});
|
|
140
116
|
}
|
|
141
|
-
|
|
142
117
|
if (opts.highlightRowWhenSelected) {
|
|
143
118
|
pipeline.appendRowPropsGetter(function (row) {
|
|
144
119
|
if (treeDataHelper.isChecked(row[primaryKey])) {
|
|
@@ -148,7 +123,6 @@ export function treeSelect(opts) {
|
|
|
148
123
|
}
|
|
149
124
|
});
|
|
150
125
|
}
|
|
151
|
-
|
|
152
126
|
return pipeline;
|
|
153
127
|
};
|
|
154
128
|
}
|
|
@@ -21,16 +21,13 @@ import { autoFillTableWidth, tableWidthKey } from './features/autoFill';
|
|
|
21
21
|
*
|
|
22
22
|
* 4. snapshots,调用 pipeline.snapshot(name) 可以记录当前的状态,后续可以通过 name 来读取保存的状态
|
|
23
23
|
* */
|
|
24
|
-
|
|
25
24
|
export var TablePipeline = /*#__PURE__*/function () {
|
|
26
25
|
function TablePipeline(_ref) {
|
|
27
26
|
var state = _ref.state,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
setState = _ref.setState,
|
|
28
|
+
ctx = _ref.ctx,
|
|
29
|
+
ref = _ref.ref;
|
|
32
30
|
_classCallCheck(this, TablePipeline);
|
|
33
|
-
|
|
34
31
|
this._snapshots = {};
|
|
35
32
|
this._rowPropsGetters = [];
|
|
36
33
|
this._tableProps = {};
|
|
@@ -41,25 +38,21 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
41
38
|
this.state = state;
|
|
42
39
|
this.setState = setState;
|
|
43
40
|
this.ref = ref;
|
|
44
|
-
|
|
45
41
|
_extends(this.ctx, ctx);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
_createClass(TablePipeline, [{
|
|
42
|
+
}
|
|
43
|
+
// Generate a pseudo-GUID by concatenating random hexadecimal.
|
|
44
|
+
return _createClass(TablePipeline, [{
|
|
50
45
|
key: "guid",
|
|
51
46
|
value: function guid() {
|
|
52
47
|
function S4() {
|
|
53
48
|
return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
|
|
54
49
|
}
|
|
55
|
-
|
|
56
50
|
return S4() + S4() + '-' + S4() + '-' + S4() + '-' + S4() + '-' + S4() + S4() + S4();
|
|
57
51
|
}
|
|
58
52
|
}, {
|
|
59
53
|
key: "appendRowPropsGetter",
|
|
60
54
|
value: function appendRowPropsGetter(getter) {
|
|
61
55
|
this._rowPropsGetters.push(getter);
|
|
62
|
-
|
|
63
56
|
return this;
|
|
64
57
|
}
|
|
65
58
|
}, {
|
|
@@ -99,11 +92,9 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
99
92
|
key: "getStateAtKey",
|
|
100
93
|
value: function getStateAtKey(stateKey, defaultValue) {
|
|
101
94
|
var _a;
|
|
102
|
-
|
|
103
95
|
return (_a = this.state[stateKey]) !== null && _a !== void 0 ? _a : defaultValue;
|
|
104
96
|
}
|
|
105
97
|
/** 将 stateKey 对应的状态设置为 partialState */
|
|
106
|
-
|
|
107
98
|
}, {
|
|
108
99
|
key: "setStateAtKey",
|
|
109
100
|
value: function setStateAtKey(stateKey, partialState, extraInfo) {
|
|
@@ -112,29 +103,24 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
112
103
|
}, stateKey, partialState, extraInfo);
|
|
113
104
|
}
|
|
114
105
|
/** 确保 primaryKey 已被设置,并返回 primaryKey */
|
|
115
|
-
|
|
116
106
|
}, {
|
|
117
107
|
key: "ensurePrimaryKey",
|
|
118
108
|
value: function ensurePrimaryKey(hint) {
|
|
119
109
|
if (this.ctx.primaryKey == null) {
|
|
120
110
|
throw new Error(hint ? "\u4F7F\u7528 ".concat(hint, " \u4E4B\u524D\u5FC5\u987B\u5148\u8BBE\u7F6E primaryKey") : '必须先设置 primaryKey');
|
|
121
111
|
}
|
|
122
|
-
|
|
123
112
|
return this.ctx.primaryKey;
|
|
124
113
|
}
|
|
125
114
|
/** 设置流水线的输入数据 */
|
|
126
|
-
|
|
127
115
|
}, {
|
|
128
116
|
key: "input",
|
|
129
117
|
value: function input(_input) {
|
|
130
118
|
var _context,
|
|
131
|
-
|
|
132
|
-
|
|
119
|
+
_this = this;
|
|
133
120
|
if (this._dataSource != null || this._columns != null) {
|
|
134
121
|
throw new Error('input 不能调用两次');
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
122
|
+
}
|
|
123
|
+
// 在 pipeline 中识别本次更新是否有数据变化
|
|
138
124
|
this._isSameInputDataSource = _input.dataSource === this.ref.current._lastInputDataSource;
|
|
139
125
|
this._dataSource = _input.dataSource;
|
|
140
126
|
this.ref.current._lastInputDataSource = _input.dataSource;
|
|
@@ -147,7 +133,6 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
147
133
|
return this;
|
|
148
134
|
}
|
|
149
135
|
/** 设置 dataSource */
|
|
150
|
-
|
|
151
136
|
}, {
|
|
152
137
|
key: "dataSource",
|
|
153
138
|
value: function dataSource(rows) {
|
|
@@ -155,7 +140,6 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
155
140
|
return this;
|
|
156
141
|
}
|
|
157
142
|
/** 设置 columns */
|
|
158
|
-
|
|
159
143
|
}, {
|
|
160
144
|
key: "columns",
|
|
161
145
|
value: function columns(cols) {
|
|
@@ -163,7 +147,6 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
163
147
|
return this;
|
|
164
148
|
}
|
|
165
149
|
/** 设置主键 */
|
|
166
|
-
|
|
167
150
|
}, {
|
|
168
151
|
key: "primaryKey",
|
|
169
152
|
value: function primaryKey(key) {
|
|
@@ -171,7 +154,6 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
171
154
|
return this;
|
|
172
155
|
}
|
|
173
156
|
/** 设置页脚数据 */
|
|
174
|
-
|
|
175
157
|
}, {
|
|
176
158
|
key: "footerDataSource",
|
|
177
159
|
value: function footerDataSource(rows) {
|
|
@@ -179,12 +161,10 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
179
161
|
return this;
|
|
180
162
|
}
|
|
181
163
|
/** 保存快照 */
|
|
182
|
-
|
|
183
164
|
}, {
|
|
184
165
|
key: "snapshot",
|
|
185
166
|
value: function snapshot(name) {
|
|
186
167
|
var _context2;
|
|
187
|
-
|
|
188
168
|
this._snapshots[name] = {
|
|
189
169
|
dataSource: this._dataSource,
|
|
190
170
|
columns: this._columns,
|
|
@@ -194,7 +174,6 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
194
174
|
}
|
|
195
175
|
/** @deprecated
|
|
196
176
|
* 应用一个 kd-table Table transform */
|
|
197
|
-
|
|
198
177
|
}, {
|
|
199
178
|
key: "useTransform",
|
|
200
179
|
value: function useTransform(transform) {
|
|
@@ -205,63 +184,52 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
205
184
|
return this.dataSource(next.dataSource).columns(next.columns);
|
|
206
185
|
}
|
|
207
186
|
/** 使用 pipeline 功能拓展 */
|
|
208
|
-
|
|
209
187
|
}, {
|
|
210
188
|
key: "use",
|
|
211
189
|
value: function use(step) {
|
|
212
190
|
return step(this);
|
|
213
191
|
}
|
|
214
192
|
/** 转换 dataSource */
|
|
215
|
-
|
|
216
193
|
}, {
|
|
217
194
|
key: "mapDataSource",
|
|
218
195
|
value: function mapDataSource(mapper) {
|
|
219
196
|
return this.dataSource(mapper(this.getDataSource()));
|
|
220
197
|
}
|
|
221
198
|
/** 转换 columns */
|
|
222
|
-
|
|
223
199
|
}, {
|
|
224
200
|
key: "mapColumns",
|
|
225
201
|
value: function mapColumns(mapper) {
|
|
226
202
|
return this.columns(mapper(this.getColumns()));
|
|
227
203
|
}
|
|
228
204
|
/** 获取featureOptions 内容 */
|
|
229
|
-
|
|
230
205
|
}, {
|
|
231
206
|
key: "getFeatureOptions",
|
|
232
207
|
value: function getFeatureOptions(optionKey) {
|
|
233
208
|
var _a;
|
|
234
|
-
|
|
235
209
|
return (_a = this.ref.current.featureOptions) === null || _a === void 0 ? void 0 : _a[optionKey];
|
|
236
210
|
}
|
|
237
211
|
/** 设置pipelineOptions 内容 */
|
|
238
|
-
|
|
239
212
|
}, {
|
|
240
213
|
key: "setFeatureOptions",
|
|
241
214
|
value: function setFeatureOptions(optionKey, value) {
|
|
242
215
|
this.ref.current.featureOptions[optionKey] = value;
|
|
243
216
|
}
|
|
244
217
|
/** 获取 BaseTable 的 props,结果中包含 dataSource/columns/primaryKey/getRowProps 四个字段 */
|
|
245
|
-
|
|
246
218
|
}, {
|
|
247
219
|
key: "getProps",
|
|
248
220
|
value: function getProps() {
|
|
249
221
|
var _this2 = this;
|
|
250
|
-
|
|
251
222
|
this.use(autoFillTableWidth());
|
|
252
223
|
var result = {
|
|
253
224
|
dataSource: this._dataSource,
|
|
254
225
|
columns: this._columns
|
|
255
226
|
};
|
|
256
|
-
|
|
257
227
|
if (this.ctx.primaryKey) {
|
|
258
228
|
result.primaryKey = this.ctx.primaryKey;
|
|
259
229
|
}
|
|
260
|
-
|
|
261
230
|
if (this._footerDataSource) {
|
|
262
231
|
result.footerDataSource = this._footerDataSource;
|
|
263
232
|
}
|
|
264
|
-
|
|
265
233
|
if (this._rowPropsGetters.length > 0) {
|
|
266
234
|
result.getRowProps = function (row, rowIndex) {
|
|
267
235
|
return _this2._rowPropsGetters.reduce(function (res, get) {
|
|
@@ -269,32 +237,24 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
269
237
|
}, {});
|
|
270
238
|
};
|
|
271
239
|
}
|
|
272
|
-
|
|
273
240
|
result.getTableProps = function () {
|
|
274
241
|
return _this2._tableProps;
|
|
275
242
|
};
|
|
276
|
-
|
|
277
243
|
result.setTableWidth = function (tableWidth) {
|
|
278
244
|
var preTableWidth = _this2.getStateAtKey(tableWidthKey);
|
|
279
|
-
|
|
280
245
|
if (preTableWidth !== tableWidth) {
|
|
281
246
|
tableWidth && _this2.setStateAtKey(tableWidthKey, tableWidth);
|
|
282
247
|
}
|
|
283
248
|
};
|
|
284
|
-
|
|
285
249
|
result.setTableDomHelper = function (domHelper) {
|
|
286
250
|
_this2.ref.current.domHelper = domHelper;
|
|
287
251
|
};
|
|
288
|
-
|
|
289
252
|
result.setRowHeightManager = function (rowHeightManager) {
|
|
290
253
|
_this2.ref.current.rowHeightManager = rowHeightManager;
|
|
291
254
|
};
|
|
292
|
-
|
|
293
255
|
return result;
|
|
294
256
|
}
|
|
295
257
|
}]);
|
|
296
|
-
|
|
297
|
-
return TablePipeline;
|
|
298
258
|
}();
|
|
299
259
|
TablePipeline.defaultIndents = {
|
|
300
260
|
iconIndent: -8,
|
|
@@ -304,10 +264,9 @@ TablePipeline.defaultIndents = {
|
|
|
304
264
|
};
|
|
305
265
|
export function useTablePipeline(ctx) {
|
|
306
266
|
var _useState = useState({}),
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
267
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
268
|
+
state = _useState2[0],
|
|
269
|
+
setState = _useState2[1];
|
|
311
270
|
var ref = useRef({
|
|
312
271
|
featureOptions: {}
|
|
313
272
|
});
|