@kdcloudjs/table 1.2.0-canary.6 → 1.2.0-canary.6-hotfix.2
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 +1877 -3363
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +16 -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 +35 -96
- package/es/_utils/hooks.js +18 -42
- 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 +74 -137
- 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 +5 -43
- 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 +22 -72
- package/es/table/base/colgroup.js +0 -1
- package/es/table/base/empty.js +4 -4
- package/es/table/base/header.d.ts +2 -1
- package/es/table/base/header.js +17 -68
- package/es/table/base/helpers/SpanManager.js +3 -9
- package/es/table/base/helpers/TableDOMUtils.js +3 -26
- 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 +11 -44
- package/es/table/base/helpers/rowHeightManager.js +0 -28
- package/es/table/base/html-table.js +15 -36
- package/es/table/base/loading.js +6 -8
- package/es/table/base/renderTemplates.js +50 -54
- package/es/table/base/styles.js +1 -10
- package/es/table/base/table.js +116 -189
- package/es/table/base/utils.js +14 -54
- package/es/table/common-views.js +0 -7
- package/es/table/internals.js +0 -13
- package/es/table/pipeline/features/autoFill.js +11 -38
- 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 -95
- package/es/table/pipeline/features/columnFilter.js +11 -44
- 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 +11 -37
- package/es/table/pipeline/features/contextMenu.js +18 -89
- package/es/table/pipeline/features/filter/DefaultFilterContent.js +10 -25
- package/es/table/pipeline/features/filter/DefaultFilterIcon.js +1 -1
- package/es/table/pipeline/features/filter/Filter.js +25 -48
- 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 +63 -142
- package/es/table/pipeline/features/rowDetail.js +2 -41
- package/es/table/pipeline/features/rowGrouping.js +2 -35
- package/es/table/pipeline/features/singleSelect.js +0 -24
- package/es/table/pipeline/features/sort.js +29 -79
- package/es/table/pipeline/features/tips.js +0 -6
- package/es/table/pipeline/features/treeMode.js +9 -43
- package/es/table/pipeline/features/treeSelect.js +0 -26
- package/es/table/pipeline/pipeline.js +9 -49
- package/es/table/pivot/cross-table/buildCrossTable.js +15 -64
- package/es/table/pivot/cross-table/cross-table.js +22 -28
- package/es/table/pivot/cross-tree-table/buildCrossTreeTable.js +14 -47
- package/es/table/pivot/cross-tree-table/cross-tree-table.js +28 -50
- package/es/table/pivot/pivot-utils/buildDrillTree.js +10 -23
- package/es/table/pivot/pivot-utils/builders.js +31 -71
- package/es/table/pivot/pivot-utils/convert-utils.js +13 -39
- 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 +10 -32
- 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 +15 -37
- package/es/table/transforms/flatten.js +0 -3
- package/es/table/transforms/orderField.js +0 -3
- package/es/table/transforms/sort.js +36 -88
- package/es/table/transforms/tips.js +1 -6
- package/es/table/transforms/treeMode.js +30 -69
- 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/buildTree.js +4 -19
- package/es/table/utils/collectNodes.js +1 -10
- 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 +4 -40
- package/es/table/utils/getTreeDepth.js +1 -9
- package/es/table/utils/groupBy.js +1 -10
- package/es/table/utils/layeredFilter.js +0 -4
- package/es/table/utils/layeredSort.js +0 -5
- package/es/table/utils/makeRecursiveMapper.js +1 -12
- package/es/table/utils/mergeCellProps.js +6 -13
- package/es/table/utils/others.js +3 -16
- package/es/table/utils/proto.js +2 -30
- package/es/table/utils/smartCompare.js +4 -12
- package/es/table/utils/traverseColumn.js +2 -15
- package/es/table/utils/tree-data-helpers/StrictTreeDataHelper.js +1 -22
- package/es/table/utils/tree-data-helpers/TreeDataHelper.js +15 -69
- package/lib/_utils/arrayUtil.js +0 -5
- package/lib/_utils/devwarning.js +0 -5
- package/lib/_utils/formatUtil.js +35 -100
- package/lib/_utils/hooks.js +18 -53
- package/lib/_utils/index.js +0 -6
- 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 +0 -6
- package/lib/_utils/usePopper.js +74 -158
- package/lib/config-provider/ConfigContext.js +1 -4
- package/lib/config-provider/compDefaultProps.js +0 -1
- package/lib/config-provider/configProvider.js +3 -18
- package/lib/config-provider/defaultConfig.js +0 -5
- package/lib/config-provider/index.js +0 -6
- package/lib/index.js +2 -8
- package/lib/locale/index.js +0 -7
- package/lib/locale/locale.js +5 -57
- 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 +22 -83
- package/lib/table/base/colgroup.js +0 -5
- package/lib/table/base/empty.js +4 -16
- package/lib/table/base/header.d.ts +2 -1
- package/lib/table/base/header.js +17 -78
- package/lib/table/base/helpers/SpanManager.js +3 -11
- package/lib/table/base/helpers/TableDOMUtils.js +1 -26
- 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 +11 -62
- package/lib/table/base/helpers/rowHeightManager.js +0 -33
- package/lib/table/base/html-table.js +15 -46
- package/lib/table/base/index.js +0 -2
- package/lib/table/base/loading.js +6 -12
- package/lib/table/base/renderTemplates.js +51 -68
- package/lib/table/base/styles.js +1 -22
- package/lib/table/base/table.js +116 -222
- package/lib/table/base/utils.js +14 -89
- package/lib/table/common-views.js +0 -16
- package/lib/table/index.js +0 -13
- package/lib/table/internals.js +0 -14
- package/lib/table/pipeline/features/autoFill.js +11 -45
- 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 +4 -32
- package/lib/table/pipeline/features/columnDrag.js +41 -101
- package/lib/table/pipeline/features/columnFilter.js +11 -58
- 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 +11 -53
- package/lib/table/pipeline/features/contextMenu.js +18 -113
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +10 -43
- package/lib/table/pipeline/features/filter/DefaultFilterIcon.js +1 -4
- package/lib/table/pipeline/features/filter/Filter.js +25 -70
- package/lib/table/pipeline/features/filter/FilterPanel.js +11 -40
- package/lib/table/pipeline/features/filter/index.js +0 -5
- package/lib/table/pipeline/features/filter/util.js +0 -7
- package/lib/table/pipeline/features/footerDataSource.js +0 -10
- package/lib/table/pipeline/features/index.js +0 -22
- package/lib/table/pipeline/features/mergeCellHover.js +0 -5
- package/lib/table/pipeline/features/multiSelect.js +15 -70
- package/lib/table/pipeline/features/rangeSelection.js +63 -159
- package/lib/table/pipeline/features/rowDetail.js +2 -65
- package/lib/table/pipeline/features/rowGrouping.js +2 -55
- package/lib/table/pipeline/features/singleSelect.js +0 -33
- package/lib/table/pipeline/features/sort.js +29 -99
- package/lib/table/pipeline/features/tips.js +0 -15
- package/lib/table/pipeline/features/treeMode.js +9 -64
- package/lib/table/pipeline/features/treeSelect.js +0 -34
- package/lib/table/pipeline/index.js +0 -8
- package/lib/table/pipeline/pipeline.js +9 -58
- package/lib/table/pivot/cross-table/buildCrossTable.js +15 -75
- package/lib/table/pivot/cross-table/cross-table.js +22 -36
- package/lib/table/pivot/cross-table/index.js +0 -4
- package/lib/table/pivot/cross-tree-table/buildCrossTreeTable.js +14 -60
- package/lib/table/pivot/cross-tree-table/cross-tree-table.js +28 -60
- 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 +31 -82
- package/lib/table/pivot/pivot-utils/convert-utils.js +13 -57
- 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 +10 -53
- 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 +15 -56
- 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 +36 -112
- package/lib/table/transforms/tips.js +1 -16
- package/lib/table/transforms/treeMode.js +30 -96
- package/lib/table/transforms/visible.js +0 -7
- package/lib/table/transforms/warnTransformsDeprecated.js +0 -4
- package/lib/table/use/useResizeObserver.js +1 -8
- package/lib/table/utils/applyTransforms.js +0 -2
- package/lib/table/utils/buildTree.js +4 -30
- package/lib/table/utils/collectNodes.js +1 -15
- package/lib/table/utils/console.js +0 -16
- package/lib/table/utils/copyToClipboard.js +0 -6
- package/lib/table/utils/element.js +14 -46
- package/lib/table/utils/exportTableAsExcel.js +4 -49
- package/lib/table/utils/getTreeDepth.js +1 -14
- package/lib/table/utils/groupBy.js +1 -14
- package/lib/table/utils/index.js +0 -20
- package/lib/table/utils/isGroupColumn.js +0 -3
- package/lib/table/utils/isLeafNode.js +0 -1
- package/lib/table/utils/layeredFilter.js +0 -10
- package/lib/table/utils/layeredSort.js +0 -10
- package/lib/table/utils/makeRecursiveMapper.js +1 -21
- package/lib/table/utils/mergeCellProps.js +6 -17
- package/lib/table/utils/others.js +3 -31
- package/lib/table/utils/proto.js +2 -33
- package/lib/table/utils/smartCompare.js +4 -13
- package/lib/table/utils/traverseColumn.js +2 -22
- package/lib/table/utils/tree-data-helpers/StrictTreeDataHelper.js +1 -30
- package/lib/table/utils/tree-data-helpers/TreeDataHelper.js +15 -82
- package/package.json +219 -218
|
@@ -15,15 +15,12 @@ import { internals } from '../../internals';
|
|
|
15
15
|
import { collectNodes, isLeafNode, mergeCellProps } from '../../utils';
|
|
16
16
|
import { flatMap } from '../../utils/others';
|
|
17
17
|
import { Classes } from '../../base';
|
|
18
|
-
|
|
19
18
|
var groupingMetaSymbol = _Symbol('row-grouping-meta');
|
|
20
|
-
|
|
21
19
|
function attachGroupingMeta(row) {
|
|
22
20
|
return _extends(_defineProperty({}, groupingMetaSymbol, {
|
|
23
21
|
expandable: !isLeafNode(row)
|
|
24
22
|
}), row);
|
|
25
23
|
}
|
|
26
|
-
|
|
27
24
|
function getGroupingMeta(row) {
|
|
28
25
|
if (row[groupingMetaSymbol] == null) {
|
|
29
26
|
return {
|
|
@@ -31,13 +28,11 @@ function getGroupingMeta(row) {
|
|
|
31
28
|
expandable: false
|
|
32
29
|
};
|
|
33
30
|
}
|
|
34
|
-
|
|
35
31
|
return {
|
|
36
32
|
isGroupHeader: true,
|
|
37
33
|
expandable: row[groupingMetaSymbol].expandable
|
|
38
34
|
};
|
|
39
35
|
}
|
|
40
|
-
|
|
41
36
|
function rowGroupingRowPropsGetter(row) {
|
|
42
37
|
if (getGroupingMeta(row).isGroupHeader) {
|
|
43
38
|
return {
|
|
@@ -45,74 +40,56 @@ function rowGroupingRowPropsGetter(row) {
|
|
|
45
40
|
};
|
|
46
41
|
}
|
|
47
42
|
}
|
|
48
|
-
|
|
49
43
|
export function rowGrouping() {
|
|
50
44
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
51
45
|
return function (pipeline) {
|
|
52
46
|
var _context;
|
|
53
|
-
|
|
54
47
|
var _a, _b, _c;
|
|
55
|
-
|
|
56
48
|
var stateKey = 'rowGrouping';
|
|
57
49
|
var indents = pipeline.ctx.indents;
|
|
58
50
|
var textOffset = indents.iconIndent + indents.iconWidth + indents.iconGap;
|
|
59
51
|
var primaryKey = pipeline.ensurePrimaryKey('rowGrouping');
|
|
60
|
-
|
|
61
52
|
if (typeof primaryKey !== 'string') {
|
|
62
53
|
throw new Error('rowGrouping 仅支持字符串作为 primaryKey');
|
|
63
54
|
}
|
|
64
|
-
|
|
65
55
|
var openKeys = (_c = (_b = (_a = opts.openKeys) !== null && _a !== void 0 ? _a : pipeline.getStateAtKey(stateKey)) !== null && _b !== void 0 ? _b : opts.defaultOpenAll ? _mapInstanceProperty(_context = pipeline.getDataSource()).call(_context, function (row) {
|
|
66
56
|
return row[primaryKey];
|
|
67
57
|
}) : opts.defaultOpenKeys) !== null && _c !== void 0 ? _c : [];
|
|
68
58
|
var openKeySet = new _Set(openKeys);
|
|
69
|
-
|
|
70
59
|
var onChangeOpenKeys = function onChangeOpenKeys(nextKeys, key, action) {
|
|
71
60
|
var _a;
|
|
72
|
-
|
|
73
61
|
(_a = opts.onChangeOpenKeys) === null || _a === void 0 ? void 0 : _a.call(opts, nextKeys, key, action);
|
|
74
62
|
pipeline.setStateAtKey(stateKey, nextKeys, {
|
|
75
63
|
key: key,
|
|
76
64
|
action: action
|
|
77
65
|
});
|
|
78
66
|
};
|
|
79
|
-
|
|
80
67
|
return pipeline.mapDataSource(processDataSource).mapColumns(processColumns).appendRowPropsGetter(rowGroupingRowPropsGetter);
|
|
81
|
-
|
|
82
68
|
function processDataSource(input) {
|
|
83
69
|
return flatMap(input, function (row) {
|
|
84
70
|
var result = [attachGroupingMeta(row)];
|
|
85
71
|
var expanded = openKeySet.has(row[primaryKey]);
|
|
86
|
-
|
|
87
72
|
if (expanded) {
|
|
88
73
|
if (Array.isArray(row.children)) {
|
|
89
74
|
result = _concatInstanceProperty(result).call(result, row.children);
|
|
90
75
|
}
|
|
91
76
|
}
|
|
92
|
-
|
|
93
77
|
return result;
|
|
94
78
|
});
|
|
95
79
|
}
|
|
96
|
-
|
|
97
80
|
function processColumns(columns) {
|
|
98
81
|
var _context3;
|
|
99
|
-
|
|
100
82
|
if (columns.length === 0) {
|
|
101
83
|
return columns;
|
|
102
84
|
}
|
|
103
|
-
|
|
104
85
|
var columnFlatCount = collectNodes(columns, 'leaf-only').length;
|
|
105
|
-
|
|
106
86
|
var _columns = _toArray(columns),
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
87
|
+
firstCol = _columns[0],
|
|
88
|
+
others = _sliceInstanceProperty(_columns).call(_columns, 1);
|
|
110
89
|
var render = function render(value, row, rowIndex) {
|
|
111
90
|
var _a, _b;
|
|
112
|
-
|
|
113
91
|
var content = internals.safeRender(firstCol, row, rowIndex);
|
|
114
92
|
var meta = getGroupingMeta(row);
|
|
115
|
-
|
|
116
93
|
if (!meta.isGroupHeader || !meta.expandable) {
|
|
117
94
|
var marginLeft = textOffset + (meta.isGroupHeader ? 0 : indents.indentSize);
|
|
118
95
|
return /*#__PURE__*/React.createElement(InlineFlexCell, {
|
|
@@ -121,7 +98,6 @@ export function rowGrouping() {
|
|
|
121
98
|
}
|
|
122
99
|
}, meta.isGroupHeader ? (_a = row.groupTitle) !== null && _a !== void 0 ? _a : content : content);
|
|
123
100
|
}
|
|
124
|
-
|
|
125
101
|
var expanded = openKeySet.has(row[primaryKey]);
|
|
126
102
|
var expandCls = expanded ? Classes.expanded : Classes.collapsed;
|
|
127
103
|
return /*#__PURE__*/React.createElement(ExpansionCell, {
|
|
@@ -134,39 +110,31 @@ export function rowGrouping() {
|
|
|
134
110
|
}
|
|
135
111
|
}), (_b = row.groupTitle) !== null && _b !== void 0 ? _b : content);
|
|
136
112
|
};
|
|
137
|
-
|
|
138
113
|
var getCellProps = function getCellProps(value, row, rowIndex) {
|
|
139
114
|
var _a;
|
|
140
|
-
|
|
141
115
|
var meta = getGroupingMeta(row);
|
|
142
|
-
|
|
143
116
|
if (!meta.isGroupHeader) {
|
|
144
117
|
return;
|
|
145
118
|
}
|
|
146
|
-
|
|
147
119
|
var expandable = meta.expandable;
|
|
148
120
|
var rowKey = row[primaryKey];
|
|
149
121
|
var expanded = openKeySet.has(rowKey);
|
|
150
122
|
var onClick;
|
|
151
|
-
|
|
152
123
|
if (expandable) {
|
|
153
124
|
onClick = function onClick(e) {
|
|
154
125
|
if (opts.stopClickEventPropagation) {
|
|
155
126
|
e.stopPropagation();
|
|
156
127
|
}
|
|
157
|
-
|
|
158
128
|
if (expanded) {
|
|
159
129
|
onChangeOpenKeys(_filterInstanceProperty(openKeys).call(openKeys, function (key) {
|
|
160
130
|
return key !== rowKey;
|
|
161
131
|
}), rowKey, 'collapse');
|
|
162
132
|
} else {
|
|
163
133
|
var _context2;
|
|
164
|
-
|
|
165
134
|
onChangeOpenKeys(_concatInstanceProperty(_context2 = []).call(_context2, _toConsumableArray(openKeys), [rowKey]), rowKey, 'expand');
|
|
166
135
|
}
|
|
167
136
|
};
|
|
168
137
|
}
|
|
169
|
-
|
|
170
138
|
var prevProps = (_a = firstCol.getCellProps) === null || _a === void 0 ? void 0 : _a.call(firstCol, value, row, rowIndex);
|
|
171
139
|
return mergeCellProps(prevProps, {
|
|
172
140
|
onClick: onClick,
|
|
@@ -175,7 +143,6 @@ export function rowGrouping() {
|
|
|
175
143
|
}
|
|
176
144
|
});
|
|
177
145
|
};
|
|
178
|
-
|
|
179
146
|
return _concatInstanceProperty(_context3 = [_extends(_extends({}, firstCol), {
|
|
180
147
|
title: /*#__PURE__*/React.createElement("div", {
|
|
181
148
|
style: {
|
|
@@ -8,28 +8,21 @@ export function singleSelect() {
|
|
|
8
8
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9
9
|
return function singleSelectStep(pipeline) {
|
|
10
10
|
var _context;
|
|
11
|
-
|
|
12
11
|
var _a, _b, _c, _d, _e;
|
|
13
|
-
|
|
14
12
|
var Radio = pipeline.ctx.components.Radio;
|
|
15
|
-
|
|
16
13
|
if (Radio == null) {
|
|
17
14
|
throw new Error('使用 singleSelect 之前需要通过 pipeline context 设置 components.Radio');
|
|
18
15
|
}
|
|
19
|
-
|
|
20
16
|
var stateKey = 'singleSelect';
|
|
21
17
|
var clickArea = (_a = opts.clickArea) !== null && _a !== void 0 ? _a : 'radio';
|
|
22
18
|
var isDisabled = (_b = opts.isDisabled) !== null && _b !== void 0 ? _b : always(false);
|
|
23
19
|
var primaryKey = pipeline.ensurePrimaryKey('singleSelect');
|
|
24
20
|
var value = (_d = (_c = opts.value) !== null && _c !== void 0 ? _c : pipeline.getStateAtKey(stateKey)) !== null && _d !== void 0 ? _d : opts.defaultValue;
|
|
25
|
-
|
|
26
21
|
var onChange = function onChange(rowKey) {
|
|
27
22
|
var _a;
|
|
28
|
-
|
|
29
23
|
(_a = opts.onChange) === null || _a === void 0 ? void 0 : _a.call(opts, rowKey);
|
|
30
24
|
pipeline.setStateAtKey(stateKey, rowKey);
|
|
31
25
|
};
|
|
32
|
-
|
|
33
26
|
var radioColumn = _extends(_extends({
|
|
34
27
|
name: '',
|
|
35
28
|
width: 50,
|
|
@@ -37,9 +30,7 @@ export function singleSelect() {
|
|
|
37
30
|
}, opts.radioColumn), {
|
|
38
31
|
getCellProps: function getCellProps(value, row, rowIndex) {
|
|
39
32
|
var _a, _b;
|
|
40
|
-
|
|
41
33
|
var preCellProps = (_b = (_a = opts.radioColumn) === null || _a === void 0 ? void 0 : _a.getCellProps) === null || _b === void 0 ? void 0 : _b.call(_a, value, row, rowIndex);
|
|
42
|
-
|
|
43
34
|
if (clickArea === 'cell') {
|
|
44
35
|
var rowKey = internals.safeGetRowKey(primaryKey, row, rowIndex);
|
|
45
36
|
var disabled = isDisabled(row, rowIndex);
|
|
@@ -51,73 +42,58 @@ export function singleSelect() {
|
|
|
51
42
|
if (opts.stopClickEventPropagation) {
|
|
52
43
|
e.stopPropagation();
|
|
53
44
|
}
|
|
54
|
-
|
|
55
45
|
onChange(rowKey);
|
|
56
46
|
}
|
|
57
47
|
});
|
|
58
48
|
}
|
|
59
|
-
|
|
60
49
|
return preCellProps;
|
|
61
50
|
},
|
|
62
51
|
render: function render(_, row, rowIndex) {
|
|
63
52
|
if (row[pipeline.getFeatureOptions('footerRowMetaKey')]) {
|
|
64
53
|
return null;
|
|
65
54
|
}
|
|
66
|
-
|
|
67
55
|
var rowKey = internals.safeGetRowKey(primaryKey, row, rowIndex);
|
|
68
56
|
return /*#__PURE__*/React.createElement(Radio, {
|
|
69
57
|
checked: value === rowKey,
|
|
70
58
|
disabled: isDisabled(row, rowIndex),
|
|
71
59
|
onChange: clickArea === 'radio' ? function (arg1, arg2) {
|
|
72
60
|
var _a;
|
|
73
|
-
|
|
74
61
|
var nativeEvent = (_a = arg2 === null || arg2 === void 0 ? void 0 : arg2.nativeEvent) !== null && _a !== void 0 ? _a : arg1 === null || arg1 === void 0 ? void 0 : arg1.nativeEvent;
|
|
75
|
-
|
|
76
62
|
if (nativeEvent && opts.stopClickEventPropagation) {
|
|
77
63
|
nativeEvent.stopPropagation();
|
|
78
64
|
}
|
|
79
|
-
|
|
80
65
|
onChange(rowKey);
|
|
81
66
|
} : undefined
|
|
82
67
|
});
|
|
83
68
|
}
|
|
84
69
|
});
|
|
85
|
-
|
|
86
70
|
var nextColumns = _sliceInstanceProperty(_context = pipeline.getColumns()).call(_context);
|
|
87
|
-
|
|
88
71
|
var radioPlacement = (_e = opts.radioPlacement) !== null && _e !== void 0 ? _e : 'start';
|
|
89
|
-
|
|
90
72
|
if (radioPlacement === 'start') {
|
|
91
73
|
nextColumns.unshift(radioColumn);
|
|
92
74
|
} else {
|
|
93
75
|
nextColumns.push(radioColumn);
|
|
94
76
|
}
|
|
95
|
-
|
|
96
77
|
pipeline.columns(nextColumns);
|
|
97
78
|
pipeline.appendRowPropsGetter(function (row, rowIndex) {
|
|
98
79
|
var rowKey = internals.safeGetRowKey(primaryKey, row, rowIndex);
|
|
99
80
|
var style = {};
|
|
100
81
|
var className;
|
|
101
82
|
var onClick;
|
|
102
|
-
|
|
103
83
|
if (opts.highlightRowWhenSelected) {
|
|
104
84
|
if (value === rowKey) {
|
|
105
85
|
className = 'highlight';
|
|
106
86
|
}
|
|
107
87
|
}
|
|
108
|
-
|
|
109
88
|
if (clickArea === 'row' && !isDisabled(row, rowIndex)) {
|
|
110
89
|
style.cursor = 'pointer';
|
|
111
|
-
|
|
112
90
|
onClick = function onClick(e) {
|
|
113
91
|
if (opts.stopClickEventPropagation) {
|
|
114
92
|
e.stopPropagation();
|
|
115
93
|
}
|
|
116
|
-
|
|
117
94
|
onChange(rowKey);
|
|
118
95
|
};
|
|
119
96
|
}
|
|
120
|
-
|
|
121
97
|
return {
|
|
122
98
|
className: className,
|
|
123
99
|
style: style,
|
|
@@ -4,15 +4,10 @@ import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-meth
|
|
|
4
4
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
5
5
|
import _taggedTemplateLiteral from "@babel/runtime-corejs3/helpers/taggedTemplateLiteral";
|
|
6
6
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
7
|
-
|
|
8
7
|
var _templateObject;
|
|
9
|
-
|
|
10
8
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
11
|
-
|
|
12
9
|
function _unsupportedIterableToArray(o, minLen) { var _context4; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context4 = Object.prototype.toString.call(o)).call(_context4, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
-
|
|
14
10
|
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; }
|
|
15
|
-
|
|
16
11
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
17
12
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
18
13
|
import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
@@ -25,13 +20,12 @@ import cx from 'classnames';
|
|
|
25
20
|
import { internals } from '../../internals';
|
|
26
21
|
import { collectNodes, isLeafNode, layeredSort, mergeCellProps, smartCompare, console } from '../../utils';
|
|
27
22
|
import { Classes } from '../../base/styles';
|
|
28
|
-
|
|
29
23
|
function SortIcon(_ref) {
|
|
30
24
|
var _ref$size = _ref.size,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
size = _ref$size === void 0 ? 32 : _ref$size,
|
|
26
|
+
style = _ref.style,
|
|
27
|
+
className = _ref.className,
|
|
28
|
+
order = _ref.order;
|
|
35
29
|
return /*#__PURE__*/React.createElement("svg", {
|
|
36
30
|
style: style,
|
|
37
31
|
className: className,
|
|
@@ -52,16 +46,14 @@ function SortIcon(_ref) {
|
|
|
52
46
|
d: "M24 24L16 32 8 24z "
|
|
53
47
|
}));
|
|
54
48
|
}
|
|
55
|
-
|
|
56
49
|
function DefaultSortHeaderCell(_ref2) {
|
|
57
50
|
var _cx;
|
|
58
|
-
|
|
59
51
|
var children = _ref2.children,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
52
|
+
column = _ref2.column,
|
|
53
|
+
onToggle = _ref2.onToggle,
|
|
54
|
+
sortOrder = _ref2.sortOrder,
|
|
55
|
+
sortIndex = _ref2.sortIndex,
|
|
56
|
+
sortOptions = _ref2.sortOptions;
|
|
65
57
|
// 通过 justify-content 来与 col.align 保持对齐方向一致
|
|
66
58
|
var justifyContent = column.align === 'right' ? 'flex-end' : column.align === 'center' ? 'center' : 'flex-start';
|
|
67
59
|
return /*#__PURE__*/React.createElement(TableHeaderCell, {
|
|
@@ -89,48 +81,39 @@ function DefaultSortHeaderCell(_ref2) {
|
|
|
89
81
|
}
|
|
90
82
|
}, sortIndex + 1));
|
|
91
83
|
}
|
|
92
|
-
|
|
93
84
|
function hasAnySortableColumns(cols) {
|
|
94
85
|
return cols.some(function (col) {
|
|
95
86
|
var _a;
|
|
96
|
-
|
|
97
87
|
return Boolean((_a = col.features) === null || _a === void 0 ? void 0 : _a.sortable) || !isLeafNode(col) && hasAnySortableColumns(col.children);
|
|
98
88
|
});
|
|
99
89
|
}
|
|
100
|
-
|
|
101
90
|
var TableHeaderCell = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n display: flex;\n align-items: center;\n // flex: auto;\n"])));
|
|
102
91
|
var stateKey = 'sort';
|
|
103
92
|
export function sort() {
|
|
104
93
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
105
94
|
return function sortStep(pipeline) {
|
|
106
95
|
var _a, _b, _c;
|
|
107
|
-
|
|
108
96
|
var _opts$orders = opts.orders,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
97
|
+
orders = _opts$orders === void 0 ? ['desc', 'asc', 'none'] : _opts$orders,
|
|
98
|
+
_opts$mode = opts.mode,
|
|
99
|
+
mode = _opts$mode === void 0 ? 'multiple' : _opts$mode,
|
|
100
|
+
_opts$SortHeaderCell = opts.SortHeaderCell,
|
|
101
|
+
SortHeaderCell = _opts$SortHeaderCell === void 0 ? DefaultSortHeaderCell : _opts$SortHeaderCell,
|
|
102
|
+
keepDataSource = opts.keepDataSource,
|
|
103
|
+
highlightColumnWhenActive = opts.highlightColumnWhenActive,
|
|
104
|
+
stopClickEventPropagation = opts.stopClickEventPropagation,
|
|
105
|
+
sortIconHoverShow = opts.sortIconHoverShow;
|
|
118
106
|
var inputSorts = (_c = (_b = (_a = opts.sorts) !== null && _a !== void 0 ? _a : pipeline.getStateAtKey(stateKey)) !== null && _b !== void 0 ? _b : opts.defaultSorts) !== null && _c !== void 0 ? _c : [];
|
|
119
|
-
|
|
120
107
|
var activeSorts = _filterInstanceProperty(inputSorts).call(inputSorts, function (s) {
|
|
121
108
|
return s.order !== 'none';
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
|
|
109
|
+
});
|
|
110
|
+
// 单字段排序的情况下 sorts 中只有第一个排序字段才会生效
|
|
125
111
|
var sorts = mode === 'multiple' ? activeSorts : _sliceInstanceProperty(activeSorts).call(activeSorts, 0, 1);
|
|
126
|
-
|
|
127
112
|
var onChangeSortsInMultipleMode = function onChangeSortsInMultipleMode(nextSorts, currentSort) {
|
|
128
113
|
var _a;
|
|
129
|
-
|
|
130
114
|
(_a = opts.onChangeSorts) === null || _a === void 0 ? void 0 : _a.call(opts, nextSorts, currentSort);
|
|
131
115
|
pipeline.setStateAtKey(stateKey, nextSorts);
|
|
132
116
|
};
|
|
133
|
-
|
|
134
117
|
var onChangeSorts = mode === 'multiple' ? onChangeSortsInMultipleMode : function (nextSorts, currentSort) {
|
|
135
118
|
// 单字段排序的情况下,nextSorts 中只有最后一个排序字段才会生效
|
|
136
119
|
var len = nextSorts.length;
|
|
@@ -153,56 +136,46 @@ export function sort() {
|
|
|
153
136
|
}));
|
|
154
137
|
var dataSource = pipeline.getDataSource();
|
|
155
138
|
var columns = pipeline.getColumns();
|
|
156
|
-
|
|
157
139
|
if (process.env.NODE_ENV !== 'production') {
|
|
158
140
|
if (!hasAnySortableColumns(columns)) {
|
|
159
141
|
console.warn('commonTransform.sort 缺少可排序的列,请通过 column.features.sortable 来指定哪些列可排序', columns);
|
|
160
142
|
}
|
|
161
143
|
}
|
|
162
|
-
|
|
163
144
|
pipeline.dataSource(processDataSource(dataSource));
|
|
164
145
|
pipeline.columns(processColumns(columns));
|
|
165
146
|
return pipeline;
|
|
166
|
-
|
|
167
147
|
function processDataSource(dataSource) {
|
|
168
148
|
var _context, _context2;
|
|
169
|
-
|
|
170
149
|
if (keepDataSource) {
|
|
171
150
|
return dataSource;
|
|
172
151
|
}
|
|
173
|
-
|
|
174
152
|
if (sortMap.size === 0) {
|
|
175
153
|
return dataSource;
|
|
176
154
|
}
|
|
177
|
-
|
|
178
155
|
var sortColumnsMap = new _Map(_mapInstanceProperty(_context = _filterInstanceProperty(_context2 = collectNodes(columns, 'leaf-only')).call(_context2, function (col) {
|
|
179
156
|
var _a, _b;
|
|
180
|
-
|
|
181
157
|
return ((_a = col.features) === null || _a === void 0 ? void 0 : _a.sortable) !== false && ((_b = col.features) === null || _b === void 0 ? void 0 : _b.sortable) != null;
|
|
182
158
|
})).call(_context, function (col) {
|
|
183
159
|
return [col.code, col];
|
|
184
160
|
}));
|
|
185
161
|
return layeredSort(dataSource, function (x, y) {
|
|
186
162
|
var _iterator = _createForOfIteratorHelper(sorts),
|
|
187
|
-
|
|
188
|
-
|
|
163
|
+
_step;
|
|
189
164
|
try {
|
|
190
165
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
191
166
|
var _step$value = _step.value,
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
var column = sortColumnsMap.get(code);
|
|
195
|
-
|
|
167
|
+
code = _step$value.code,
|
|
168
|
+
order = _step$value.order;
|
|
169
|
+
var column = sortColumnsMap.get(code);
|
|
170
|
+
// 如果 code 对应的 column 不可排序,我们跳过该 code
|
|
196
171
|
if (column == null) {
|
|
197
172
|
continue;
|
|
198
173
|
}
|
|
199
|
-
|
|
200
174
|
var sortable = column.features.sortable;
|
|
201
175
|
var compareFn = typeof sortable === 'function' ? sortable : smartCompare;
|
|
202
176
|
var xValue = internals.safeGetValue(column, x, -1);
|
|
203
177
|
var yValue = internals.safeGetValue(column, y, -1);
|
|
204
178
|
var cmp = compareFn(xValue, yValue, x, y);
|
|
205
|
-
|
|
206
179
|
if (cmp !== 0) {
|
|
207
180
|
return cmp * (order === 'asc' ? 1 : -1);
|
|
208
181
|
}
|
|
@@ -212,16 +185,13 @@ export function sort() {
|
|
|
212
185
|
} finally {
|
|
213
186
|
_iterator.f();
|
|
214
187
|
}
|
|
215
|
-
|
|
216
188
|
return 0;
|
|
217
189
|
});
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
|
|
190
|
+
}
|
|
191
|
+
// 在「升序 - 降序 - 不排序」之间不断切换
|
|
221
192
|
function toggle(code) {
|
|
222
193
|
var sort = sortMap.get(code);
|
|
223
194
|
var currentSort;
|
|
224
|
-
|
|
225
195
|
if (sort == null) {
|
|
226
196
|
currentSort = {
|
|
227
197
|
code: code,
|
|
@@ -232,15 +202,12 @@ export function sort() {
|
|
|
232
202
|
var index = _findIndexInstanceProperty(sorts).call(sorts, function (s) {
|
|
233
203
|
return s.code === code;
|
|
234
204
|
});
|
|
235
|
-
|
|
236
205
|
var nextSorts = _sliceInstanceProperty(sorts).call(sorts, 0, index + 1);
|
|
237
|
-
|
|
238
206
|
var nextOrder = getNextOrder(sort.order);
|
|
239
207
|
currentSort = {
|
|
240
208
|
code: code,
|
|
241
209
|
order: nextOrder
|
|
242
210
|
};
|
|
243
|
-
|
|
244
211
|
if (nextOrder === 'none') {
|
|
245
212
|
nextSorts.pop();
|
|
246
213
|
} else {
|
|
@@ -248,41 +215,31 @@ export function sort() {
|
|
|
248
215
|
order: nextOrder
|
|
249
216
|
});
|
|
250
217
|
}
|
|
251
|
-
|
|
252
218
|
onChangeSorts(nextSorts, currentSort);
|
|
253
219
|
}
|
|
254
220
|
}
|
|
255
|
-
|
|
256
221
|
function processColumns(columns) {
|
|
257
222
|
return _mapInstanceProperty(columns).call(columns, dfs);
|
|
258
|
-
|
|
259
223
|
function dfs(col) {
|
|
260
224
|
var _a;
|
|
261
|
-
|
|
262
225
|
var result = _extends({}, col);
|
|
263
|
-
|
|
264
226
|
var sortable = col.code && (((_a = col.features) === null || _a === void 0 ? void 0 : _a.sortable) || sortMap.has(col.code));
|
|
265
227
|
var active = sortable && sortMap.has(col.code);
|
|
266
|
-
|
|
267
228
|
if (sortable) {
|
|
268
229
|
var sortIndex = -1;
|
|
269
230
|
var sortOrder = 'none';
|
|
270
|
-
|
|
271
231
|
if (active) {
|
|
272
232
|
var _sortMap$get = sortMap.get(col.code),
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
233
|
+
order = _sortMap$get.order,
|
|
234
|
+
index = _sortMap$get.index;
|
|
276
235
|
sortOrder = order;
|
|
277
236
|
sortIndex = index;
|
|
278
|
-
|
|
279
237
|
if (highlightColumnWhenActive) {
|
|
280
238
|
result.headerCellProps = mergeCellProps(col.headerCellProps, {
|
|
281
239
|
style: {
|
|
282
240
|
background: 'var(--header-highlight-bgcolor)'
|
|
283
241
|
}
|
|
284
242
|
});
|
|
285
|
-
|
|
286
243
|
result.getCellProps = function (value, row, rowIndex) {
|
|
287
244
|
var prevCellProps = internals.safeGetCellProps(col, row, rowIndex);
|
|
288
245
|
return mergeCellProps(prevCellProps, {
|
|
@@ -293,13 +250,11 @@ export function sort() {
|
|
|
293
250
|
};
|
|
294
251
|
}
|
|
295
252
|
}
|
|
296
|
-
|
|
297
253
|
var sortNode = /*#__PURE__*/React.createElement(SortHeaderCell, {
|
|
298
254
|
onToggle: function onToggle(e) {
|
|
299
255
|
if (stopClickEventPropagation) {
|
|
300
256
|
e.stopPropagation();
|
|
301
257
|
}
|
|
302
|
-
|
|
303
258
|
toggle(col.code);
|
|
304
259
|
},
|
|
305
260
|
sortOrder: sortOrder,
|
|
@@ -309,24 +264,19 @@ export function sort() {
|
|
|
309
264
|
}, internals.safeRenderHeader(_extends(_extends({}, col), {
|
|
310
265
|
title: col.title && col.title[0] ? col.title[0] : col.title
|
|
311
266
|
})));
|
|
312
|
-
|
|
313
267
|
if (result.title && result.title[0]) {
|
|
314
268
|
result.title[0] = sortNode;
|
|
315
269
|
} else {
|
|
316
270
|
result.title = sortNode;
|
|
317
271
|
}
|
|
318
272
|
}
|
|
319
|
-
|
|
320
273
|
if (!isLeafNode(col)) {
|
|
321
274
|
var _context3;
|
|
322
|
-
|
|
323
275
|
result.children = _mapInstanceProperty(_context3 = col.children).call(_context3, dfs);
|
|
324
276
|
}
|
|
325
|
-
|
|
326
277
|
return result;
|
|
327
278
|
}
|
|
328
279
|
}
|
|
329
|
-
|
|
330
280
|
function getNextOrder(order) {
|
|
331
281
|
var idx = orders.indexOf(order);
|
|
332
282
|
return orders[idx === orders.length - 1 ? 0 : idx + 1];
|
|
@@ -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,18 +11,14 @@ 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
24
|
title: /*#__PURE__*/React.createElement(HeaderCellWithTips, {
|