@kdcloudjs/table 1.0.0 → 1.0.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 +1 -1
- package/README.md +34 -33
- package/dist/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.css.map +1 -1
- package/dist/@kdcloudjs/table.js +6554 -3389
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +32 -24
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/es/_utils/hooks.js +1 -2
- package/es/_utils/numberUtil.js +3 -4
- package/es/locale/locale.js +1 -2
- package/es/table/base/calculations.js +3 -4
- package/es/table/base/empty.js +2 -2
- package/es/table/base/header.d.ts +6 -2
- package/es/table/base/header.js +41 -22
- package/es/table/base/helpers/SpanManager.js +1 -1
- package/es/table/base/helpers/TableDOMUtils.d.ts +3 -0
- package/es/table/base/helpers/TableDOMUtils.js +23 -5
- package/es/table/base/helpers/getRichVisibleRectsStream.d.ts +23 -0
- package/es/table/base/helpers/getRichVisibleRectsStream.js +216 -0
- package/es/table/base/html-table.d.ts +3 -1
- package/es/table/base/html-table.js +43 -26
- package/es/table/base/interfaces.d.ts +1 -0
- package/es/table/base/renderTemplates.d.ts +1 -0
- package/es/table/base/renderTemplates.js +344 -0
- package/es/table/base/styles.d.ts +24 -0
- package/es/table/base/styles.js +31 -9
- package/es/table/base/table.d.ts +12 -4
- package/es/table/base/table.js +183 -136
- package/es/table/base/utils.d.ts +6 -3
- package/es/table/base/utils.js +27 -6
- package/es/table/common-views.js +3 -3
- package/es/table/pipeline/features/__test__/treeMode.test.js +2 -1
- package/es/table/pipeline/features/autoFill.js +7 -1
- package/es/table/pipeline/features/columnDrag.js +168 -59
- package/es/table/pipeline/features/columnFilter.js +7 -9
- package/es/table/pipeline/features/columnResizeWidth.d.ts +3 -0
- package/es/table/pipeline/features/columnResizeWidth.js +11 -4
- package/es/table/pipeline/features/contextMenu.js +78 -31
- package/es/table/pipeline/features/filter/Filter.js +74 -37
- package/es/table/pipeline/features/index.d.ts +1 -0
- package/es/table/pipeline/features/index.js +2 -1
- package/es/table/pipeline/features/multiSelect.js +83 -79
- package/es/table/pipeline/features/rangeSelection.d.ts +10 -0
- package/es/table/pipeline/features/rangeSelection.js +231 -0
- package/es/table/pipeline/features/rowDetail.js +39 -16
- package/es/table/pipeline/features/rowGrouping.js +2 -1
- package/es/table/pipeline/features/singleSelect.js +4 -1
- package/es/table/pipeline/features/sort.js +2 -3
- package/es/table/pipeline/features/treeMode.js +4 -4
- package/es/table/pipeline/pipeline.d.ts +8 -0
- package/es/table/pipeline/pipeline.js +49 -5
- package/es/table/pivot/cross-table/buildCrossTable.js +1 -2
- package/es/table/pivot/cross-tree-table/buildCrossTreeTable.js +1 -2
- package/es/table/pivot/pivot-utils/builders.js +1 -2
- package/es/table/pivot/pivot-utils/convert-utils.js +5 -4
- package/es/table/transforms/autoWidth.js +1 -2
- package/es/table/transforms/sort.js +1 -2
- package/es/table/transforms/treeMode.js +1 -2
- package/es/table/utils/applyTransforms.js +1 -3
- package/es/table/utils/browserType.d.ts +6 -0
- package/es/table/utils/browserType.js +6 -0
- package/es/table/utils/buildTree.js +4 -5
- package/es/table/utils/collectNodes.js +1 -2
- package/es/table/utils/exportTableAsExcel.js +1 -2
- package/es/table/utils/getTreeDepth.js +1 -2
- package/es/table/utils/groupBy.js +1 -2
- package/es/table/utils/index.d.ts +1 -0
- package/es/table/utils/index.js +2 -1
- package/es/table/utils/layeredSort.js +5 -2
- package/es/table/utils/makeRecursiveMapper.js +4 -5
- package/es/table/utils/others.d.ts +1 -1
- package/es/table/utils/others.js +20 -14
- package/es/table/utils/traverseColumn.js +1 -2
- package/es/table/utils/tree-data-helpers/StrictTreeDataHelper.js +4 -5
- package/es/table/utils/tree-data-helpers/TreeDataHelper.js +4 -5
- package/lib/_utils/formatUtil.js +1 -1
- package/lib/_utils/hooks.js +2 -4
- package/lib/_utils/numberUtil.js +7 -9
- package/lib/_utils/usePopper.js +9 -1
- package/lib/config-provider/configProvider.js +9 -1
- package/lib/config-provider/index.js +5 -5
- package/lib/locale/index.js +14 -6
- package/lib/locale/locale.js +2 -4
- package/lib/table/base/calculations.js +4 -6
- package/lib/table/base/empty.js +11 -3
- package/lib/table/base/header.d.ts +6 -2
- package/lib/table/base/header.js +39 -19
- package/lib/table/base/helpers/SpanManager.js +1 -1
- package/lib/table/base/helpers/TableDOMUtils.d.ts +3 -0
- package/lib/table/base/helpers/TableDOMUtils.js +21 -5
- package/lib/table/base/helpers/getRichVisibleRectsStream.d.ts +23 -0
- package/lib/table/base/helpers/getRichVisibleRectsStream.js +246 -0
- package/lib/table/base/html-table.d.ts +3 -1
- package/lib/table/base/html-table.js +44 -26
- package/lib/table/base/index.js +4 -4
- package/lib/table/base/interfaces.d.ts +1 -0
- package/lib/table/base/renderTemplates.d.ts +1 -0
- package/lib/table/base/renderTemplates.js +370 -0
- package/lib/table/base/styles.d.ts +24 -0
- package/lib/table/base/styles.js +42 -13
- package/lib/table/base/table.d.ts +12 -4
- package/lib/table/base/table.js +191 -137
- package/lib/table/base/utils.d.ts +6 -3
- package/lib/table/base/utils.js +47 -10
- package/lib/table/common-views.js +3 -3
- package/lib/table/pipeline/features/__test__/sort.test.js +5 -3
- package/lib/table/pipeline/features/__test__/treeMode.test.js +3 -1
- package/lib/table/pipeline/features/autoFill.js +9 -2
- package/lib/table/pipeline/features/columnDrag.js +168 -59
- package/lib/table/pipeline/features/columnFilter.js +6 -9
- package/lib/table/pipeline/features/columnResizeWidth.d.ts +3 -0
- package/lib/table/pipeline/features/columnResizeWidth.js +21 -5
- package/lib/table/pipeline/features/contextMenu.js +89 -32
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +10 -2
- package/lib/table/pipeline/features/filter/Filter.js +88 -37
- package/lib/table/pipeline/features/filter/FilterPanel.js +10 -2
- package/lib/table/pipeline/features/filter/index.js +4 -4
- package/lib/table/pipeline/features/index.d.ts +1 -0
- package/lib/table/pipeline/features/index.js +37 -27
- package/lib/table/pipeline/features/multiSelect.js +79 -75
- package/lib/table/pipeline/features/rangeSelection.d.ts +10 -0
- package/lib/table/pipeline/features/rangeSelection.js +256 -0
- package/lib/table/pipeline/features/rowDetail.js +42 -16
- package/lib/table/pipeline/features/rowGrouping.js +3 -1
- package/lib/table/pipeline/features/singleSelect.js +4 -1
- package/lib/table/pipeline/features/sort.js +2 -4
- package/lib/table/pipeline/features/treeMode.js +6 -6
- package/lib/table/pipeline/index.js +11 -3
- package/lib/table/pipeline/pipeline.d.ts +8 -0
- package/lib/table/pipeline/pipeline.js +50 -7
- package/lib/table/pivot/cross-table/buildCrossTable.js +1 -3
- package/lib/table/pivot/cross-table/index.js +4 -4
- package/lib/table/pivot/cross-tree-table/buildCrossTreeTable.js +1 -3
- package/lib/table/pivot/pivot-utils/builders.js +2 -4
- package/lib/table/pivot/pivot-utils/convert-utils.js +7 -5
- package/lib/table/pivot/pivot-utils/index.js +4 -4
- package/lib/table/transforms/autoWidth.js +10 -4
- package/lib/table/transforms/columnResize.js +10 -2
- package/lib/table/transforms/index.js +32 -32
- package/lib/table/transforms/sort.js +10 -4
- package/lib/table/transforms/treeMode.js +9 -3
- package/lib/table/utils/applyTransforms.js +1 -5
- package/lib/table/utils/browserType.d.ts +6 -0
- package/lib/table/utils/browserType.js +13 -0
- package/lib/table/utils/buildTree.js +1 -3
- package/lib/table/utils/collectNodes.js +1 -3
- package/lib/table/utils/copyToClipboard.js +1 -1
- package/lib/table/utils/element.js +3 -3
- package/lib/table/utils/exportTableAsExcel.js +1 -3
- package/lib/table/utils/getTreeDepth.js +1 -3
- package/lib/table/utils/groupBy.js +1 -3
- package/lib/table/utils/index.d.ts +1 -0
- package/lib/table/utils/index.js +57 -49
- package/lib/table/utils/layeredSort.js +6 -2
- package/lib/table/utils/makeRecursiveMapper.js +1 -3
- package/lib/table/utils/others.d.ts +1 -1
- package/lib/table/utils/others.js +23 -18
- package/lib/table/utils/traverseColumn.js +1 -3
- package/lib/table/utils/tree-data-helpers/StrictTreeDataHelper.js +5 -7
- package/lib/table/utils/tree-data-helpers/TreeDataHelper.js +5 -7
- package/package.json +7 -2
- package/dist/kd-table.css +0 -422
- package/dist/kd-table.css.map +0 -1
- package/dist/kd-table.js +0 -38578
- package/dist/kd-table.js.map +0 -1
- package/dist/kd-table.min.css +0 -9
- package/dist/kd-table.min.js +0 -208
- package/dist/kd-table.min.js.map +0 -1
- package/es/table/base/helpers/__test__/visible-part.test.d.ts +0 -1
- package/es/table/base/helpers/__test__/visible-part.test.js +0 -28
- package/es/table/base/helpers/visible-part.d.ts +0 -23
- package/es/table/base/helpers/visible-part.js +0 -58
- package/lib/table/base/helpers/__test__/visible-part.test.d.ts +0 -1
- package/lib/table/base/helpers/__test__/visible-part.test.js +0 -31
- package/lib/table/base/helpers/visible-part.d.ts +0 -23
- package/lib/table/base/helpers/visible-part.js +0 -72
|
@@ -16,6 +16,8 @@ import { internals } from '../../internals';
|
|
|
16
16
|
import { collectNodes, mergeCellProps } from '../../utils';
|
|
17
17
|
import { always, flatMap } from '../../utils/others';
|
|
18
18
|
import console from '../../utils/console';
|
|
19
|
+
import getTableRenderTemplate from '../../base/renderTemplates';
|
|
20
|
+
import { Classes } from '../../base';
|
|
19
21
|
|
|
20
22
|
var rowDetailSymbol = _Symbol('row-detail');
|
|
21
23
|
|
|
@@ -39,23 +41,18 @@ export function rowDetail() {
|
|
|
39
41
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
40
42
|
|
|
41
43
|
var stateKey = 'rowDetail';
|
|
42
|
-
var primaryKey = pipeline.ensurePrimaryKey('rowDetail');
|
|
43
|
-
|
|
44
|
-
if (typeof primaryKey !== 'string') {
|
|
45
|
-
throw new Error('rowDetail 仅支持字符串作为 primaryKey');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
44
|
var rowDetailMetaKey = (_a = opts.rowDetailMetaKey) !== null && _a !== void 0 ? _a : rowDetailSymbol;
|
|
45
|
+
var primaryKey = pipeline.ensurePrimaryKey('rowDetail');
|
|
49
46
|
var indents = pipeline.ctx.indents;
|
|
50
47
|
var textOffset = indents.iconIndent + indents.iconWidth + indents.iconGap;
|
|
51
48
|
var clickArea = (_b = opts.clickArea) !== null && _b !== void 0 ? _b : 'cell';
|
|
52
|
-
var getDetailKey = (_c = opts.getDetailKey) !== null && _c !== void 0 ? _c : function (row) {
|
|
53
|
-
return
|
|
49
|
+
var getDetailKey = (_c = opts.getDetailKey) !== null && _c !== void 0 ? _c : function (row, rowIndex) {
|
|
50
|
+
return internals.safeGetRowKey(primaryKey, row, rowIndex) + '_detail';
|
|
54
51
|
};
|
|
55
52
|
var renderDetail = (_d = opts.renderDetail) !== null && _d !== void 0 ? _d : fallbackRenderDetail;
|
|
56
53
|
var hasDetail = (_e = opts.hasDetail) !== null && _e !== void 0 ? _e : always(true);
|
|
57
|
-
var openKeys = (_h = (_g = (_f = opts.openKeys) !== null && _f !== void 0 ? _f : pipeline.getStateAtKey(stateKey)) !== null && _g !== void 0 ? _g : opts.defaultOpenAll ? _mapInstanceProperty(_context = _filterInstanceProperty(_context2 = pipeline.getDataSource()).call(_context2, hasDetail)).call(_context, function (row) {
|
|
58
|
-
return row
|
|
54
|
+
var openKeys = (_h = (_g = (_f = opts.openKeys) !== null && _f !== void 0 ? _f : pipeline.getStateAtKey(stateKey)) !== null && _g !== void 0 ? _g : opts.defaultOpenAll ? _mapInstanceProperty(_context = _filterInstanceProperty(_context2 = pipeline.getDataSource()).call(_context2, hasDetail)).call(_context, function (row, rowIndex) {
|
|
55
|
+
return internals.safeGetRowKey(primaryKey, row, rowIndex);
|
|
59
56
|
}) : opts.defaultOpenKeys) !== null && _h !== void 0 ? _h : [];
|
|
60
57
|
|
|
61
58
|
var onChangeOpenKeys = function onChangeOpenKeys(nextKeys, key, action) {
|
|
@@ -84,16 +81,18 @@ export function rowDetail() {
|
|
|
84
81
|
}
|
|
85
82
|
};
|
|
86
83
|
|
|
84
|
+
var detailPrimaryKey = typeof primaryKey === 'string' ? primaryKey : rowDetailMetaKey.toString() + 'PrimaryKey';
|
|
87
85
|
return pipeline.dataSource(flatMap(pipeline.getDataSource(), function (row, rowIndex) {
|
|
88
|
-
if (openKeySet.has(row
|
|
89
|
-
return [row, _extends(_extends(_defineProperty({}, rowDetailMetaKey, true), row), _defineProperty({},
|
|
86
|
+
if (openKeySet.has(internals.safeGetRowKey(primaryKey, row, rowIndex))) {
|
|
87
|
+
return [row, _extends(_extends(_defineProperty({}, rowDetailMetaKey, true), row), _defineProperty({}, detailPrimaryKey, getDetailKey(row, rowIndex)))];
|
|
90
88
|
} else {
|
|
91
89
|
return [row];
|
|
92
90
|
}
|
|
93
91
|
})).columns(processColumns(pipeline.getColumns())).appendRowPropsGetter(function (row) {
|
|
94
92
|
if (row[rowDetailMetaKey]) {
|
|
95
93
|
return {
|
|
96
|
-
className: 'no-hover'
|
|
94
|
+
className: 'no-hover',
|
|
95
|
+
'data-row-detail-key': row[detailPrimaryKey]
|
|
97
96
|
};
|
|
98
97
|
}
|
|
99
98
|
});
|
|
@@ -122,6 +121,19 @@ export function rowDetail() {
|
|
|
122
121
|
|
|
123
122
|
var render = function render(value, row, rowIndex) {
|
|
124
123
|
if (row[rowDetailMetaKey]) {
|
|
124
|
+
// 第一列内容已经渲染
|
|
125
|
+
if (expandColumnIndex !== 0) return;
|
|
126
|
+
var renderRowDetail = getTableRenderTemplate('rowDetail');
|
|
127
|
+
|
|
128
|
+
if (typeof renderRowDetail === 'function') {
|
|
129
|
+
return renderRowDetail({
|
|
130
|
+
row: row,
|
|
131
|
+
rowIndex: rowIndex,
|
|
132
|
+
domHelper: pipeline.ref.current.domHelper,
|
|
133
|
+
renderDetail: renderDetail
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
125
137
|
return renderDetail(row, rowIndex);
|
|
126
138
|
}
|
|
127
139
|
|
|
@@ -135,7 +147,7 @@ export function rowDetail() {
|
|
|
135
147
|
}, content);
|
|
136
148
|
}
|
|
137
149
|
|
|
138
|
-
var rowKey = row
|
|
150
|
+
var rowKey = internals.safeGetRowKey(primaryKey, row, rowIndex);
|
|
139
151
|
var expanded = openKeySet.has(rowKey);
|
|
140
152
|
|
|
141
153
|
var onClick = function onClick(e) {
|
|
@@ -146,7 +158,7 @@ export function rowDetail() {
|
|
|
146
158
|
toggle(rowKey);
|
|
147
159
|
};
|
|
148
160
|
|
|
149
|
-
var expandCls = expanded ?
|
|
161
|
+
var expandCls = expanded ? Classes.expanded : Classes.collapsed;
|
|
150
162
|
var ExpandIcon = opts.expandIcon;
|
|
151
163
|
return /*#__PURE__*/React.createElement(ExpansionCell, {
|
|
152
164
|
className: cx('expansion-cell', expandCls),
|
|
@@ -192,7 +204,7 @@ export function rowDetail() {
|
|
|
192
204
|
e.stopPropagation();
|
|
193
205
|
}
|
|
194
206
|
|
|
195
|
-
toggle(row
|
|
207
|
+
toggle(internals.safeGetRowKey(primaryKey, row, rowIndex));
|
|
196
208
|
},
|
|
197
209
|
style: {
|
|
198
210
|
cursor: 'pointer'
|
|
@@ -206,6 +218,17 @@ export function rowDetail() {
|
|
|
206
218
|
|
|
207
219
|
var firstColRender = function firstColRender(value, row, rowIndex) {
|
|
208
220
|
if (row[rowDetailMetaKey]) {
|
|
221
|
+
var renderRowDetail = getTableRenderTemplate('rowDetail');
|
|
222
|
+
|
|
223
|
+
if (typeof renderRowDetail === 'function') {
|
|
224
|
+
return renderRowDetail({
|
|
225
|
+
row: row,
|
|
226
|
+
rowIndex: rowIndex,
|
|
227
|
+
domHelper: pipeline.ref.current.domHelper,
|
|
228
|
+
renderDetail: renderDetail
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
|
|
209
232
|
return renderDetail(row, rowIndex);
|
|
210
233
|
}
|
|
211
234
|
|
|
@@ -14,6 +14,7 @@ import { ExpansionCell, icons, InlineFlexCell } from '../../common-views';
|
|
|
14
14
|
import { internals } from '../../internals';
|
|
15
15
|
import { collectNodes, isLeafNode, mergeCellProps } from '../../utils';
|
|
16
16
|
import { flatMap } from '../../utils/others';
|
|
17
|
+
import { Classes } from '../../base';
|
|
17
18
|
|
|
18
19
|
var groupingMetaSymbol = _Symbol('row-grouping-meta');
|
|
19
20
|
|
|
@@ -122,7 +123,7 @@ export function rowGrouping() {
|
|
|
122
123
|
}
|
|
123
124
|
|
|
124
125
|
var expanded = openKeySet.has(row[primaryKey]);
|
|
125
|
-
var expandCls = expanded ?
|
|
126
|
+
var expandCls = expanded ? Classes.expanded : Classes.collapsed;
|
|
126
127
|
return /*#__PURE__*/React.createElement(ExpansionCell, {
|
|
127
128
|
className: cx('expansion-cell', expandCls)
|
|
128
129
|
}, /*#__PURE__*/React.createElement(icons.CaretRight, {
|
|
@@ -38,10 +38,11 @@ export function singleSelect() {
|
|
|
38
38
|
getCellProps: function getCellProps(value, row, rowIndex) {
|
|
39
39
|
var _a, _b;
|
|
40
40
|
|
|
41
|
+
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
|
+
|
|
41
43
|
if (clickArea === 'cell') {
|
|
42
44
|
var rowKey = internals.safeGetRowKey(primaryKey, row, rowIndex);
|
|
43
45
|
var disabled = isDisabled(row, rowIndex);
|
|
44
|
-
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);
|
|
45
46
|
return mergeCellProps(preCellProps, {
|
|
46
47
|
style: {
|
|
47
48
|
cursor: disabled ? 'not-allowed' : 'pointer'
|
|
@@ -55,6 +56,8 @@ export function singleSelect() {
|
|
|
55
56
|
}
|
|
56
57
|
});
|
|
57
58
|
}
|
|
59
|
+
|
|
60
|
+
return preCellProps;
|
|
58
61
|
},
|
|
59
62
|
render: function render(_, row, rowIndex) {
|
|
60
63
|
var rowKey = internals.safeGetRowKey(primaryKey, row, rowIndex);
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
2
2
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
3
3
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
4
|
-
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
5
4
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
6
5
|
import _taggedTemplateLiteral from "@babel/runtime-corejs3/helpers/taggedTemplateLiteral";
|
|
7
6
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
8
7
|
|
|
9
8
|
var _templateObject;
|
|
10
9
|
|
|
11
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it
|
|
10
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
12
11
|
|
|
13
12
|
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); }
|
|
14
13
|
|
|
@@ -99,7 +98,7 @@ function hasAnySortableColumns(cols) {
|
|
|
99
98
|
});
|
|
100
99
|
}
|
|
101
100
|
|
|
102
|
-
var TableHeaderCell = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n display: flex;\n align-items: center;\n"])));
|
|
101
|
+
var TableHeaderCell = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n display: flex;\n align-items: center;\n // flex: auto;\n"])));
|
|
103
102
|
var stateKey = 'sort';
|
|
104
103
|
export function sort() {
|
|
105
104
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
2
2
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
3
|
-
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
4
3
|
import _toArray from "@babel/runtime-corejs3/helpers/toArray";
|
|
5
4
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
6
5
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
7
6
|
import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
8
7
|
|
|
9
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it
|
|
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(_e2) { throw _e2; }, 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(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
10
9
|
|
|
11
10
|
function _unsupportedIterableToArray(o, minLen) { var _context3; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context3 = Object.prototype.toString.call(o)).call(_context3, 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); }
|
|
12
11
|
|
|
@@ -22,6 +21,7 @@ import React from 'react';
|
|
|
22
21
|
import { ExpansionCell, icons, InlineFlexCell } from '../../common-views';
|
|
23
22
|
import { internals } from '../../internals';
|
|
24
23
|
import { isLeafNode as standardIsLeafNode, mergeCellProps } from '../../utils';
|
|
24
|
+
import { Classes } from '../../base/styles';
|
|
25
25
|
export var treeMetaSymbol = _Symbol('treeMetaSymbol');
|
|
26
26
|
export function treeMode() {
|
|
27
27
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -147,7 +147,7 @@ export function treeMode() {
|
|
|
147
147
|
|
|
148
148
|
if (isLeaf) {
|
|
149
149
|
return /*#__PURE__*/React.createElement(InlineFlexCell, {
|
|
150
|
-
className:
|
|
150
|
+
className: cx('expansion-cell', Classes.leaf)
|
|
151
151
|
}, /*#__PURE__*/React.createElement("span", {
|
|
152
152
|
style: {
|
|
153
153
|
marginLeft: indent + iconWidth + iconGap
|
|
@@ -163,7 +163,7 @@ export function treeMode() {
|
|
|
163
163
|
toggle(rowKey);
|
|
164
164
|
};
|
|
165
165
|
|
|
166
|
-
var expandCls = expanded ?
|
|
166
|
+
var expandCls = expanded ? Classes.expanded : Classes.collapsed;
|
|
167
167
|
return /*#__PURE__*/React.createElement(ExpansionCell, {
|
|
168
168
|
className: cx('expansion-cell', expandCls),
|
|
169
169
|
style: {
|
|
@@ -36,6 +36,7 @@ export declare class TablePipeline {
|
|
|
36
36
|
private _tableProps;
|
|
37
37
|
private _dataSource;
|
|
38
38
|
private _columns;
|
|
39
|
+
private _footerDataSource;
|
|
39
40
|
static defaultIndents: TablePipelineIndentsConfig;
|
|
40
41
|
readonly ctx: TablePipelineCtx;
|
|
41
42
|
private readonly state;
|
|
@@ -51,6 +52,7 @@ export declare class TablePipeline {
|
|
|
51
52
|
addTableProps(props: React.HTMLAttributes<HTMLTableElement>): void;
|
|
52
53
|
getDataSource(name?: string): any[];
|
|
53
54
|
getColumns(name?: string): any[];
|
|
55
|
+
getFooterDataSource(): any[];
|
|
54
56
|
getStateAtKey<T = any>(stateKey: string, defaultValue?: T): T;
|
|
55
57
|
/** 将 stateKey 对应的状态设置为 partialState */
|
|
56
58
|
setStateAtKey(stateKey: string, partialState: any, extraInfo?: any): void;
|
|
@@ -67,6 +69,8 @@ export declare class TablePipeline {
|
|
|
67
69
|
columns(cols: ArtColumn[]): this;
|
|
68
70
|
/** 设置主键 */
|
|
69
71
|
primaryKey(key: PrimaryKey): this;
|
|
72
|
+
/** 设置页脚数据 */
|
|
73
|
+
footerDataSource(rows: any[]): this;
|
|
70
74
|
/** 保存快照 */
|
|
71
75
|
snapshot(name: string): this;
|
|
72
76
|
/** @deprecated
|
|
@@ -78,6 +82,10 @@ export declare class TablePipeline {
|
|
|
78
82
|
mapDataSource(mapper: Transform<any[]>): this;
|
|
79
83
|
/** 转换 columns */
|
|
80
84
|
mapColumns(mapper: Transform<ArtColumn[]>): this;
|
|
85
|
+
/** 获取featureOptions 内容 */
|
|
86
|
+
getFeatureOptions(optionKey: string): any;
|
|
87
|
+
/** 设置pipelineOptions 内容 */
|
|
88
|
+
setFeatureOptions(optionKey: string, value: any): void;
|
|
81
89
|
/** 获取 BaseTable 的 props,结果中包含 dataSource/columns/primaryKey/getRowProps 四个字段 */
|
|
82
90
|
getProps(this: TablePipeline): TableProps;
|
|
83
91
|
}
|
|
@@ -5,7 +5,6 @@ import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
|
5
5
|
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
6
6
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
7
7
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
8
|
-
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
9
8
|
import { useState, useRef } from 'react';
|
|
10
9
|
import { mergeCellProps } from '../utils';
|
|
11
10
|
import { autoFillTableWidth, tableWidthKey } from './features/autoFill';
|
|
@@ -66,7 +65,7 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
66
65
|
}, {
|
|
67
66
|
key: "addTableProps",
|
|
68
67
|
value: function addTableProps(props) {
|
|
69
|
-
this._tableProps =
|
|
68
|
+
this._tableProps = mergeCellProps(this._tableProps, props);
|
|
70
69
|
}
|
|
71
70
|
}, {
|
|
72
71
|
key: "getDataSource",
|
|
@@ -86,6 +85,11 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
86
85
|
return this._snapshots[name].columns;
|
|
87
86
|
}
|
|
88
87
|
}
|
|
88
|
+
}, {
|
|
89
|
+
key: "getFooterDataSource",
|
|
90
|
+
value: function getFooterDataSource() {
|
|
91
|
+
return this._footerDataSource;
|
|
92
|
+
}
|
|
89
93
|
}, {
|
|
90
94
|
key: "getStateAtKey",
|
|
91
95
|
value: function getStateAtKey(stateKey, defaultValue) {
|
|
@@ -158,6 +162,14 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
158
162
|
this.ctx.primaryKey = key;
|
|
159
163
|
return this;
|
|
160
164
|
}
|
|
165
|
+
/** 设置页脚数据 */
|
|
166
|
+
|
|
167
|
+
}, {
|
|
168
|
+
key: "footerDataSource",
|
|
169
|
+
value: function footerDataSource(rows) {
|
|
170
|
+
this._footerDataSource = rows;
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
161
173
|
/** 保存快照 */
|
|
162
174
|
|
|
163
175
|
}, {
|
|
@@ -205,6 +217,22 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
205
217
|
value: function mapColumns(mapper) {
|
|
206
218
|
return this.columns(mapper(this.getColumns()));
|
|
207
219
|
}
|
|
220
|
+
/** 获取featureOptions 内容 */
|
|
221
|
+
|
|
222
|
+
}, {
|
|
223
|
+
key: "getFeatureOptions",
|
|
224
|
+
value: function getFeatureOptions(optionKey) {
|
|
225
|
+
var _a;
|
|
226
|
+
|
|
227
|
+
return (_a = this.ref.current.featureOptions) === null || _a === void 0 ? void 0 : _a[optionKey];
|
|
228
|
+
}
|
|
229
|
+
/** 设置pipelineOptions 内容 */
|
|
230
|
+
|
|
231
|
+
}, {
|
|
232
|
+
key: "setFeatureOptions",
|
|
233
|
+
value: function setFeatureOptions(optionKey, value) {
|
|
234
|
+
this.ref.current.featureOptions[optionKey] = value;
|
|
235
|
+
}
|
|
208
236
|
/** 获取 BaseTable 的 props,结果中包含 dataSource/columns/primaryKey/getRowProps 四个字段 */
|
|
209
237
|
|
|
210
238
|
}, {
|
|
@@ -222,11 +250,13 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
222
250
|
result.primaryKey = this.ctx.primaryKey;
|
|
223
251
|
}
|
|
224
252
|
|
|
253
|
+
if (this._footerDataSource) {
|
|
254
|
+
result.footerDataSource = this._footerDataSource;
|
|
255
|
+
}
|
|
256
|
+
|
|
225
257
|
if (this._rowPropsGetters.length > 0) {
|
|
226
258
|
result.getRowProps = function (row, rowIndex) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
return _reduceInstanceProperty(_context3 = _this2._rowPropsGetters).call(_context3, function (res, get) {
|
|
259
|
+
return _this2._rowPropsGetters.reduce(function (res, get) {
|
|
230
260
|
return mergeCellProps(res, get(row, rowIndex));
|
|
231
261
|
}, {});
|
|
232
262
|
};
|
|
@@ -244,6 +274,19 @@ export var TablePipeline = /*#__PURE__*/function () {
|
|
|
244
274
|
}
|
|
245
275
|
};
|
|
246
276
|
|
|
277
|
+
result.setTableDomHelper = function (domHelper) {
|
|
278
|
+
_this2.ref.current.domHelper = domHelper;
|
|
279
|
+
}; // if (this.getFeatureOptions(rangeSelectionKey)) {
|
|
280
|
+
// result.clearRangeSelectionStatus = () => {
|
|
281
|
+
// const { rangeSelectedChange } = this.getFeatureOptions(rangeSelectionKey)
|
|
282
|
+
// const rangeSelection = this.getStateAtKey(rangeSelectionKey)
|
|
283
|
+
// if (rangeSelection) {
|
|
284
|
+
// rangeSelectedChange?.(null)
|
|
285
|
+
// }
|
|
286
|
+
// }
|
|
287
|
+
// }
|
|
288
|
+
|
|
289
|
+
|
|
247
290
|
return result;
|
|
248
291
|
}
|
|
249
292
|
}]);
|
|
@@ -263,6 +306,7 @@ export function useTablePipeline(ctx) {
|
|
|
263
306
|
setState = _useState2[1];
|
|
264
307
|
|
|
265
308
|
var ref = useRef({});
|
|
309
|
+
ref.current.featureOptions = {};
|
|
266
310
|
return new TablePipeline({
|
|
267
311
|
state: state,
|
|
268
312
|
setState: setState,
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
4
4
|
|
|
5
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it
|
|
5
|
+
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; } } }; }
|
|
6
6
|
|
|
7
7
|
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); }
|
|
8
8
|
|
|
@@ -14,7 +14,6 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
|
14
14
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
15
15
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
16
16
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
17
|
-
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
18
17
|
|
|
19
18
|
var __rest = this && this.__rest || function (s, e) {
|
|
20
19
|
var t = {};
|
|
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
|
2
2
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
3
3
|
import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
4
4
|
|
|
5
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it
|
|
5
|
+
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; } } }; }
|
|
6
6
|
|
|
7
7
|
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); }
|
|
8
8
|
|
|
@@ -14,7 +14,6 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
|
14
14
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
15
15
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
16
16
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
17
|
-
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
18
17
|
|
|
19
18
|
var __rest = this && this.__rest || function (s, e) {
|
|
20
19
|
var t = {};
|
|
@@ -2,10 +2,9 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
|
2
2
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
3
3
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
4
4
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
5
|
-
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
6
5
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
7
6
|
|
|
8
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it
|
|
7
|
+
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; } } }; }
|
|
9
8
|
|
|
10
9
|
function _unsupportedIterableToArray(o, minLen) { var _context5; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context5 = Object.prototype.toString.call(o)).call(_context5, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
10
|
|
|
@@ -2,13 +2,12 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
|
2
2
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
3
3
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
4
4
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
5
|
-
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
6
5
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
7
6
|
import _taggedTemplateLiteral from "@babel/runtime-corejs3/helpers/taggedTemplateLiteral";
|
|
8
7
|
|
|
9
8
|
var _templateObject;
|
|
10
9
|
|
|
11
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it
|
|
10
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
12
11
|
|
|
13
12
|
function _unsupportedIterableToArray(o, minLen) { var _context3; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context3 = Object.prototype.toString.call(o)).call(_context3, 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); }
|
|
14
13
|
|
|
@@ -21,10 +20,12 @@ import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/insta
|
|
|
21
20
|
import React from 'react';
|
|
22
21
|
import { noop } from 'rxjs';
|
|
23
22
|
import styled from 'styled-components';
|
|
23
|
+
import cx from 'classnames';
|
|
24
24
|
import { icons } from '../../common-views';
|
|
25
25
|
import { isLeafNode } from '../../utils';
|
|
26
26
|
import simpleEncode from './simpleEncode';
|
|
27
|
-
|
|
27
|
+
import { Classes } from '../../base/styles';
|
|
28
|
+
var ExpandSpan = styled.span(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-flex;\n align-items: center;\n padding: 2px 8px 2px 0;\n cursor: pointer;\n\n .icon {\n fill: #999;\n margin-right: 4px;\n\n &.", " {\n transform-origin: center center;\n transform: rotate(90deg);\n }\n }\n"])), Classes.expanded);
|
|
28
29
|
export function convertDrillTreeToCrossTree(drillTree) {
|
|
29
30
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
30
31
|
indicators = _ref.indicators,
|
|
@@ -116,7 +117,7 @@ export function convertDrillTreeToCrossTree(drillTree) {
|
|
|
116
117
|
}), node, 'collapse');
|
|
117
118
|
}
|
|
118
119
|
}, /*#__PURE__*/React.createElement(icons.CaretRight, {
|
|
119
|
-
className:
|
|
120
|
+
className: cx('icon', Classes.expanded)
|
|
120
121
|
}), node.value);
|
|
121
122
|
crossTreeNode.children = dfs(node.children, depth + 1);
|
|
122
123
|
} else {
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
2
2
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
3
3
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
4
|
-
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
5
4
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
6
5
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
7
6
|
import _taggedTemplateLiteral from "@babel/runtime-corejs3/helpers/taggedTemplateLiteral";
|
|
8
7
|
|
|
9
8
|
var _templateObject;
|
|
10
9
|
|
|
11
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it
|
|
10
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
12
11
|
|
|
13
12
|
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); }
|
|
14
13
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
2
2
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
3
3
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
4
|
-
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
5
4
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
6
5
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
7
6
|
import _taggedTemplateLiteral from "@babel/runtime-corejs3/helpers/taggedTemplateLiteral";
|
|
8
7
|
|
|
9
8
|
var _templateObject;
|
|
10
9
|
|
|
11
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it
|
|
10
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
12
11
|
|
|
13
12
|
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); }
|
|
14
13
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
2
2
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
3
3
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
4
|
-
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
5
4
|
import _slicedToArray from "@babel/runtime-corejs3/helpers/slicedToArray";
|
|
6
5
|
import _toArray from "@babel/runtime-corejs3/helpers/toArray";
|
|
7
6
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
8
7
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
9
8
|
import _toConsumableArray from "@babel/runtime-corejs3/helpers/toConsumableArray";
|
|
10
9
|
|
|
11
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it
|
|
10
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
12
11
|
|
|
13
12
|
function _unsupportedIterableToArray(o, minLen) { var _context3; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context3 = Object.prototype.toString.call(o)).call(_context3, 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); }
|
|
14
13
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* 以 input 作为输入,按序使用 transform.
|
|
5
3
|
*
|
|
@@ -9,7 +7,7 @@ export default function applyTransforms(input) {
|
|
|
9
7
|
transforms[_key - 1] = arguments[_key];
|
|
10
8
|
}
|
|
11
9
|
|
|
12
|
-
return
|
|
10
|
+
return transforms.reduce(function (v, fn) {
|
|
13
11
|
return fn(v);
|
|
14
12
|
}, input);
|
|
15
13
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export var browserType = {
|
|
2
|
+
isEdge: !!window.navigator.userAgent.match(/Edge\/(\d+)/),
|
|
3
|
+
isIE: !!window.navigator.userAgent.match(/Trident\/(\d+)/),
|
|
4
|
+
isFireFox: !!window.navigator.userAgent.match(/Firefox\/(\d+)/),
|
|
5
|
+
isChrome: !!window.navigator.userAgent.match(/Chrome\/(\d+)/)
|
|
6
|
+
};
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
2
|
-
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
3
|
-
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
4
|
-
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
5
1
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
6
2
|
|
|
7
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it
|
|
3
|
+
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; } } }; }
|
|
8
4
|
|
|
9
5
|
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); }
|
|
10
6
|
|
|
@@ -14,6 +10,9 @@ import _Map from "@babel/runtime-corejs3/core-js-stable/map";
|
|
|
14
10
|
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
15
11
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
16
12
|
import _valuesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/values";
|
|
13
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
14
|
+
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
15
|
+
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
17
16
|
import { flatMap } from './others';
|
|
18
17
|
/**
|
|
19
18
|
* 根据 idProp 与 parentIdProp 从对象数组中构建对应的树
|
|
@@ -2,9 +2,8 @@ import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instan
|
|
|
2
2
|
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
3
3
|
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
4
4
|
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
5
|
-
import _getIterator from "@babel/runtime-corejs3/core-js/get-iterator";
|
|
6
5
|
|
|
7
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it
|
|
6
|
+
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; } } }; }
|
|
8
7
|
|
|
9
8
|
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); }
|
|
10
9
|
|