@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
|
@@ -6,55 +6,46 @@ import { makeRecursiveMapper, mergeCellProps, collectNodes, isLeafNode } from '.
|
|
|
6
6
|
import { FILL_COLUMN_CODE } from './autoFill';
|
|
7
7
|
var stateKey = 'columnDrag';
|
|
8
8
|
var SCROLL_SIZE = 30;
|
|
9
|
-
|
|
10
9
|
function disableSelect(event) {
|
|
11
10
|
event.preventDefault();
|
|
12
11
|
}
|
|
13
|
-
|
|
14
12
|
function sortColumns(columns, sort) {
|
|
15
13
|
var res = new Array(columns.length);
|
|
16
|
-
|
|
17
14
|
var lastColumns = _toConsumableArray(columns);
|
|
18
|
-
|
|
19
15
|
while (columns.length) {
|
|
20
16
|
var cloumn = columns.pop();
|
|
21
17
|
res[sort[cloumn.code]] = cloumn;
|
|
22
18
|
}
|
|
23
|
-
|
|
24
19
|
if (_filterInstanceProperty(res).call(res, Boolean).length !== lastColumns.length) {
|
|
25
20
|
return lastColumns;
|
|
26
21
|
}
|
|
27
|
-
|
|
28
22
|
return res;
|
|
29
23
|
}
|
|
30
|
-
|
|
31
24
|
function stopClickPropagation(e) {
|
|
32
25
|
e.stopPropagation();
|
|
33
26
|
}
|
|
34
|
-
|
|
35
27
|
export function columnDrag() {
|
|
36
28
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
37
29
|
return function (pipeline) {
|
|
38
30
|
var _pipeline$getStateAtK = pipeline.getStateAtKey(stateKey, {}),
|
|
39
|
-
|
|
40
|
-
|
|
31
|
+
cloumnsTranslateData = _pipeline$getStateAtK.cloumnsTranslateData;
|
|
41
32
|
var columns = pipeline.getColumns();
|
|
42
|
-
var tableBody = pipeline.ref.current.domHelper && pipeline.ref.current.domHelper.tableBody;
|
|
33
|
+
var tableBody = pipeline.ref.current.domHelper && pipeline.ref.current.domHelper.tableBody;
|
|
34
|
+
// if (cloumnsSortData) {
|
|
43
35
|
// columns = sortColumns(columns, cloumnsSortData)
|
|
44
36
|
// }
|
|
45
|
-
|
|
46
37
|
pipeline.columns(_filterInstanceProperty(columns).call(columns, function (column) {
|
|
47
38
|
return column;
|
|
48
39
|
}));
|
|
49
40
|
return pipeline.mapColumns(makeRecursiveMapper(function (col, recursiveFlatMapInfo) {
|
|
50
41
|
var path = recursiveFlatMapInfo.path,
|
|
51
|
-
|
|
42
|
+
isLeaf = recursiveFlatMapInfo.isLeaf;
|
|
52
43
|
var style = cloumnsTranslateData ? {
|
|
53
44
|
transition: '.3s',
|
|
54
45
|
transform: "translate3d(".concat(cloumnsTranslateData[col.code], "px, 0px, 0px)")
|
|
55
46
|
} : {};
|
|
56
|
-
var prevGetCellProps = col.getCellProps;
|
|
57
|
-
|
|
47
|
+
var prevGetCellProps = col.getCellProps;
|
|
48
|
+
// !col.code: 选择列 col.lock: 固定列 不允许拖拽
|
|
58
49
|
if (col.lock || !col.code) return col;
|
|
59
50
|
return _extends(_extends({}, col), {
|
|
60
51
|
getCellProps: function getCellProps(value, record, rowIndex) {
|
|
@@ -68,8 +59,8 @@ export function columnDrag() {
|
|
|
68
59
|
if (e.button !== 0 || !e.currentTarget.contains(e.target)) {
|
|
69
60
|
return;
|
|
70
61
|
}
|
|
71
|
-
|
|
72
|
-
|
|
62
|
+
window.addEventListener('selectstart', disableSelect);
|
|
63
|
+
// const cx = e.clientX
|
|
73
64
|
// const width = col.width
|
|
74
65
|
// const a = startIndex
|
|
75
66
|
// const b = endIndex
|
|
@@ -77,13 +68,10 @@ export function columnDrag() {
|
|
|
77
68
|
// let newColumn = [...columns]
|
|
78
69
|
// let newStartIndex = startIndex
|
|
79
70
|
// let endIdx = endIndex
|
|
80
|
-
|
|
81
71
|
var columnMoved = false;
|
|
82
72
|
var columns = pipeline.getColumns();
|
|
83
|
-
|
|
84
73
|
var _pipeline$getStateAtK2 = pipeline.getStateAtKey(stateKey, {}),
|
|
85
|
-
|
|
86
|
-
|
|
74
|
+
cloumnsTranslateData = _pipeline$getStateAtK2.cloumnsTranslateData;
|
|
87
75
|
var cloumnsSortData = {};
|
|
88
76
|
columns.forEach(function (item, index) {
|
|
89
77
|
cloumnsSortData[item.code] = index;
|
|
@@ -97,21 +85,17 @@ export function columnDrag() {
|
|
|
97
85
|
var allColumns = collectNodes(columns);
|
|
98
86
|
var tableBodyClientRect = tableBody.getBoundingClientRect();
|
|
99
87
|
var startScrollLeft = pipeline.ref.current.domHelper.virtual.scrollLeft;
|
|
100
|
-
|
|
101
88
|
var updateScrollPosition = function updateScrollPosition(client) {
|
|
102
89
|
var clientX = client.clientX;
|
|
103
90
|
var left = tableBodyClientRect.left,
|
|
104
|
-
|
|
105
|
-
|
|
91
|
+
width = tableBodyClientRect.width;
|
|
106
92
|
if (clientX + SCROLL_SIZE >= left + width) {
|
|
107
93
|
pipeline.ref.current.domHelper.virtual.scrollLeft += SCROLL_SIZE;
|
|
108
94
|
}
|
|
109
|
-
|
|
110
95
|
if (clientX - SCROLL_SIZE <= left) {
|
|
111
96
|
pipeline.ref.current.domHelper.virtual.scrollLeft -= SCROLL_SIZE;
|
|
112
97
|
}
|
|
113
98
|
};
|
|
114
|
-
|
|
115
99
|
function handleMouseMove(e) {
|
|
116
100
|
var client = {
|
|
117
101
|
clientX: e.clientX,
|
|
@@ -119,17 +103,15 @@ export function columnDrag() {
|
|
|
119
103
|
};
|
|
120
104
|
var scrollDistance = pipeline.ref.current.domHelper.virtual.scrollLeft - startScrollLeft;
|
|
121
105
|
var leftPosition = startX - scrollDistance; // 表头最左边起点
|
|
122
|
-
|
|
123
106
|
updateScrollPosition(client);
|
|
124
|
-
|
|
125
107
|
if (e.clientX - leftPosition < 20) {
|
|
126
108
|
return;
|
|
127
109
|
} else {
|
|
128
110
|
e.stopPropagation();
|
|
129
111
|
}
|
|
130
|
-
|
|
131
112
|
document.body.style.userSelect = 'none';
|
|
132
|
-
currentTarget.style.cursor = 'move';
|
|
113
|
+
currentTarget.style.cursor = 'move';
|
|
114
|
+
// 循环计算每一个的位置
|
|
133
115
|
// if (startIndex !== replaceIndex) {
|
|
134
116
|
// const optionColumn = columns[startIndex]
|
|
135
117
|
// const move = startIndex > replaceIndex ? 1 : -1
|
|
@@ -152,21 +134,18 @@ export function columnDrag() {
|
|
|
152
134
|
// index++
|
|
153
135
|
// }
|
|
154
136
|
// 重置位置信息
|
|
155
|
-
|
|
156
137
|
cloumnsTranslateData = {};
|
|
157
138
|
allColumns.forEach(function (item) {
|
|
158
139
|
cloumnsTranslateData[item.code] = 0;
|
|
159
|
-
});
|
|
160
|
-
|
|
140
|
+
});
|
|
141
|
+
// 计算平移位置
|
|
161
142
|
var replaceIndex = 0;
|
|
162
143
|
var totalWitdth = getColumnWidth(columns[replaceIndex]);
|
|
163
|
-
|
|
164
144
|
while (totalWitdth < e.clientX - leftPosition && replaceIndex < columns.length - 1) {
|
|
165
145
|
replaceIndex++;
|
|
166
146
|
totalWitdth += getColumnWidth(columns[replaceIndex]);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
147
|
+
}
|
|
148
|
+
// 需要取最新startIndex, 不能直接用makeRecursiveMapper提供的startIndex(因为map时还没添加选择列、充满列等后面use添加的列)
|
|
170
149
|
var startIndex;
|
|
171
150
|
columns.forEach(function (column, index) {
|
|
172
151
|
if (column.code === col.code) {
|
|
@@ -175,63 +154,53 @@ export function columnDrag() {
|
|
|
175
154
|
});
|
|
176
155
|
var optionColumn = columns[startIndex];
|
|
177
156
|
var index = replaceIndex;
|
|
178
|
-
|
|
179
157
|
if (startIndex > replaceIndex) {
|
|
180
158
|
// 左移
|
|
181
159
|
while (index < startIndex) {
|
|
182
160
|
var _columns$index = columns[index],
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
161
|
+
code = _columns$index.code,
|
|
162
|
+
lock = _columns$index.lock,
|
|
163
|
+
width = _columns$index.width,
|
|
164
|
+
children = _columns$index.children;
|
|
188
165
|
if (enableMove({
|
|
189
166
|
code: code,
|
|
190
167
|
lock: lock
|
|
191
168
|
})) {
|
|
192
169
|
cloumnsTranslateData[code] += optionColumn.width;
|
|
193
|
-
|
|
194
170
|
if (isLeafNode(columns[index])) {
|
|
195
171
|
cloumnsTranslateData[optionColumn.code] -= width;
|
|
196
172
|
} else {
|
|
197
173
|
cloumnsTranslateData[optionColumn.code] -= getColumnWidth(columns[index]);
|
|
198
174
|
moveAllChildren(children, cloumnsTranslateData, optionColumn.width);
|
|
199
175
|
}
|
|
200
|
-
|
|
201
176
|
columnMoved = true;
|
|
202
177
|
}
|
|
203
|
-
|
|
204
178
|
index++;
|
|
205
179
|
}
|
|
206
180
|
} else if (startIndex < replaceIndex) {
|
|
207
181
|
// 右移
|
|
208
182
|
while (startIndex < index) {
|
|
209
183
|
var _columns$index2 = columns[index],
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
184
|
+
_code = _columns$index2.code,
|
|
185
|
+
_lock = _columns$index2.lock,
|
|
186
|
+
_width = _columns$index2.width,
|
|
187
|
+
_children = _columns$index2.children;
|
|
215
188
|
if (enableMove({
|
|
216
189
|
code: _code,
|
|
217
190
|
lock: _lock
|
|
218
191
|
})) {
|
|
219
192
|
cloumnsTranslateData[_code] -= optionColumn.width;
|
|
220
|
-
|
|
221
193
|
if (isLeafNode(columns[index])) {
|
|
222
194
|
cloumnsTranslateData[optionColumn.code] += _width;
|
|
223
195
|
} else {
|
|
224
196
|
cloumnsTranslateData[optionColumn.code] += getColumnWidth(columns[index]);
|
|
225
197
|
moveAllChildren(_children, cloumnsTranslateData, optionColumn.width, true);
|
|
226
198
|
}
|
|
227
|
-
|
|
228
199
|
columnMoved = true;
|
|
229
200
|
}
|
|
230
|
-
|
|
231
201
|
index--;
|
|
232
202
|
}
|
|
233
203
|
}
|
|
234
|
-
|
|
235
204
|
window.requestAnimationFrame(function () {
|
|
236
205
|
pipeline.setStateAtKey(stateKey, {
|
|
237
206
|
cloumnsTranslateData: cloumnsTranslateData
|
|
@@ -239,15 +208,12 @@ export function columnDrag() {
|
|
|
239
208
|
moveData = [startIndex, replaceIndex];
|
|
240
209
|
});
|
|
241
210
|
}
|
|
242
|
-
|
|
243
211
|
function handleMouseUp(e) {
|
|
244
212
|
document.body.removeEventListener('mousemove', handleMouseMove);
|
|
245
213
|
document.body.removeEventListener('mouseup', handleMouseUp);
|
|
246
214
|
window.removeEventListener('selectstart', disableSelect);
|
|
247
|
-
|
|
248
215
|
if (_isMoveWhenClicking(mouseDownClientX, mouseDownClientY, e.clientX, e.clientY)) {
|
|
249
216
|
e.stopPropagation(); // 存在移动就阻止冒泡
|
|
250
|
-
|
|
251
217
|
currentTarget.addEventListener('click', stopClickPropagation); // 阻止列头点击事件,防止拖动后触发列头过滤事件
|
|
252
218
|
}
|
|
253
219
|
|
|
@@ -255,13 +221,12 @@ export function columnDrag() {
|
|
|
255
221
|
// 取消阻止列头点击事件
|
|
256
222
|
currentTarget.removeEventListener('click', stopClickPropagation);
|
|
257
223
|
currentTarget = null;
|
|
258
|
-
|
|
259
224
|
var _moveData = moveData,
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
225
|
+
_moveData2 = _slicedToArray(_moveData, 2),
|
|
226
|
+
startIndex = _moveData2[0],
|
|
227
|
+
replaceIndex = _moveData2[1];
|
|
228
|
+
var optionColumn = columns[startIndex];
|
|
229
|
+
// const move = startIndex > replaceIndex ? 1 : -1
|
|
265
230
|
// let index = Math.min(startIndex, replaceIndex)
|
|
266
231
|
// while (index < Math.max(startIndex, replaceIndex) && index > 0) {
|
|
267
232
|
// const code = columns[index].code
|
|
@@ -269,16 +234,13 @@ export function columnDrag() {
|
|
|
269
234
|
// cloumnsSortData[code] += move
|
|
270
235
|
// index += move
|
|
271
236
|
// }
|
|
272
|
-
|
|
273
237
|
var index = replaceIndex;
|
|
274
|
-
|
|
275
238
|
if (startIndex > replaceIndex) {
|
|
276
239
|
// 左移
|
|
277
240
|
while (index < startIndex) {
|
|
278
241
|
var _columns$index3 = columns[index],
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
242
|
+
code = _columns$index3.code,
|
|
243
|
+
lock = _columns$index3.lock;
|
|
282
244
|
if (enableMove({
|
|
283
245
|
code: code,
|
|
284
246
|
lock: lock
|
|
@@ -287,16 +249,14 @@ export function columnDrag() {
|
|
|
287
249
|
cloumnsSortData[optionColumn.code] -= 1;
|
|
288
250
|
columnMoved = true;
|
|
289
251
|
}
|
|
290
|
-
|
|
291
252
|
index++;
|
|
292
253
|
}
|
|
293
254
|
} else if (startIndex < replaceIndex) {
|
|
294
255
|
// 右移
|
|
295
256
|
while (index > startIndex) {
|
|
296
257
|
var _columns$index4 = columns[index],
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
258
|
+
_code2 = _columns$index4.code,
|
|
259
|
+
_lock2 = _columns$index4.lock;
|
|
300
260
|
if (enableMove({
|
|
301
261
|
code: _code2,
|
|
302
262
|
lock: _lock2
|
|
@@ -305,25 +265,20 @@ export function columnDrag() {
|
|
|
305
265
|
cloumnsSortData[optionColumn.code] += 1;
|
|
306
266
|
columnMoved = true;
|
|
307
267
|
}
|
|
308
|
-
|
|
309
268
|
index--;
|
|
310
269
|
}
|
|
311
270
|
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
271
|
+
var onColumnDragStopped = opts.onColumnDragStopped;
|
|
272
|
+
// 拖拽结束返回列顺序
|
|
315
273
|
if (onColumnDragStopped) {
|
|
316
274
|
var _context;
|
|
317
|
-
|
|
318
275
|
var newColumns = _filterInstanceProperty(_context = sortColumns(columns, cloumnsSortData)).call(_context, function (_ref) {
|
|
319
276
|
var code = _ref.code;
|
|
320
277
|
return code !== FILL_COLUMN_CODE;
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
|
|
278
|
+
});
|
|
279
|
+
// TODO drag需要在resize之后use,否则这里返回的列对应的宽度不是拖拽后的
|
|
324
280
|
onColumnDragStopped(columnMoved, newColumns);
|
|
325
281
|
}
|
|
326
|
-
|
|
327
282
|
pipeline.setStateAtKey(stateKey, {
|
|
328
283
|
cloumnsTranslateData: null
|
|
329
284
|
});
|
|
@@ -332,7 +287,6 @@ export function columnDrag() {
|
|
|
332
287
|
currentTarget.style.opacity = '';
|
|
333
288
|
currentTarget.style.cursor = '';
|
|
334
289
|
}
|
|
335
|
-
|
|
336
290
|
document.body.addEventListener('mousemove', handleMouseMove);
|
|
337
291
|
document.body.addEventListener('mouseup', handleMouseUp);
|
|
338
292
|
},
|
|
@@ -342,45 +296,37 @@ export function columnDrag() {
|
|
|
342
296
|
}));
|
|
343
297
|
};
|
|
344
298
|
}
|
|
345
|
-
|
|
346
299
|
function enableMove(_ref2) {
|
|
347
300
|
var lock = _ref2.lock,
|
|
348
|
-
|
|
301
|
+
code = _ref2.code;
|
|
349
302
|
return code && code !== FILL_COLUMN_CODE && !lock;
|
|
350
303
|
}
|
|
351
|
-
|
|
352
304
|
function getColumnWidth(col) {
|
|
353
305
|
if (col.children) {
|
|
354
306
|
return col.children.reduce(function (acc, col) {
|
|
355
307
|
return acc + getColumnWidth(col);
|
|
356
308
|
}, 0);
|
|
357
309
|
}
|
|
358
|
-
|
|
359
310
|
return col.width;
|
|
360
311
|
}
|
|
361
|
-
|
|
362
312
|
function moveAllChildren(cols, cloumnsTranslateData, width, isMinus) {
|
|
363
313
|
cols.forEach(function (col) {
|
|
364
314
|
var _a;
|
|
365
|
-
|
|
366
315
|
var code = col.code,
|
|
367
|
-
|
|
316
|
+
children = col.children;
|
|
368
317
|
var movedWidth = (_a = cloumnsTranslateData[code]) !== null && _a !== void 0 ? _a : 0;
|
|
369
318
|
cloumnsTranslateData[code] = movedWidth + (isMinus ? -width : width);
|
|
370
|
-
|
|
371
319
|
if (!isLeafNode(col)) {
|
|
372
320
|
moveAllChildren(children, cloumnsTranslateData, width);
|
|
373
321
|
}
|
|
374
322
|
});
|
|
375
323
|
}
|
|
376
|
-
|
|
377
324
|
function _isMoveWhenClicking(mouseDownClientX, mouseDownClientY, mouseUpClientX, mouseUpClientY) {
|
|
378
325
|
var xDiff = mouseUpClientX - mouseDownClientX;
|
|
379
|
-
var yDiff = mouseUpClientY - mouseDownClientY;
|
|
380
|
-
|
|
326
|
+
var yDiff = mouseUpClientY - mouseDownClientY;
|
|
327
|
+
// 鼠标点按和松开的偏移量大于5px,认为存在移动
|
|
381
328
|
if (Math.sqrt(xDiff * xDiff + yDiff * yDiff) > 5) {
|
|
382
329
|
return true;
|
|
383
330
|
}
|
|
384
|
-
|
|
385
331
|
return false;
|
|
386
332
|
}
|
|
@@ -19,63 +19,50 @@ export function filter() {
|
|
|
19
19
|
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
20
20
|
return function step(pipeline) {
|
|
21
21
|
var _a, _b;
|
|
22
|
-
|
|
23
22
|
var dataSource = pipeline.getDataSource();
|
|
24
23
|
var columns = pipeline.getColumns();
|
|
25
24
|
var filters = opts.filters,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
25
|
+
defaultFilters = opts.defaultFilters,
|
|
26
|
+
onChangeFilters = opts.onChangeFilters,
|
|
27
|
+
keepDataSource = opts.keepDataSource,
|
|
28
|
+
mode = opts.mode,
|
|
29
|
+
filterIcon = opts.filterIcon,
|
|
30
|
+
stopClickEventPropagation = opts.stopClickEventPropagation,
|
|
31
|
+
stopESCKeyDownEventPropagation = opts.stopESCKeyDownEventPropagation,
|
|
32
|
+
hideFilterPopupHeader = opts.hideFilterPopupHeader,
|
|
33
|
+
getPopupParent = opts.getPopupParent;
|
|
35
34
|
var inputFilters = (_b = (_a = filters !== null && filters !== void 0 ? filters : pipeline.getStateAtKey(stateKey)) !== null && _a !== void 0 ? _a : defaultFilters) !== null && _b !== void 0 ? _b : [];
|
|
36
35
|
inputFilters = mode === 'single' ? _sliceInstanceProperty(inputFilters).call(inputFilters, 0, 1) : inputFilters;
|
|
37
36
|
var inputFiltersMap = new _Map(_mapInstanceProperty(inputFilters).call(inputFilters, function (filterItem) {
|
|
38
37
|
return [filterItem.code, _extends({}, filterItem)];
|
|
39
38
|
}));
|
|
40
39
|
var localeText = pipeline.ctx.localeText;
|
|
41
|
-
|
|
42
40
|
function processColumns(columns) {
|
|
43
41
|
return _mapInstanceProperty(columns).call(columns, dfs);
|
|
44
|
-
|
|
45
42
|
function dfs(col) {
|
|
46
43
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
47
|
-
|
|
48
44
|
var result = _extends({}, col);
|
|
49
|
-
|
|
50
45
|
var filterable = col.code && ((_a = col.features) === null || _a === void 0 ? void 0 : _a.filterable);
|
|
51
46
|
var filterActive = filterable && ((_c = (_b = inputFiltersMap === null || inputFiltersMap === void 0 ? void 0 : inputFiltersMap.get(col.code)) === null || _b === void 0 ? void 0 : _filterInstanceProperty(_b)) === null || _c === void 0 ? void 0 : _c.length) > 0;
|
|
52
|
-
|
|
53
47
|
if (filterable) {
|
|
54
48
|
var _context, _context2, _cx;
|
|
55
|
-
|
|
56
49
|
var handleFilterChanged = function handleFilterChanged(filterItem) {
|
|
57
50
|
var nextFiltersMap = new _Map(inputFiltersMap);
|
|
58
|
-
|
|
59
51
|
var currentFilter = _extends({
|
|
60
52
|
code: col.code
|
|
61
53
|
}, filterItem);
|
|
62
|
-
|
|
63
54
|
if (filterItem == null) {
|
|
64
55
|
nextFiltersMap.delete(col.code);
|
|
65
56
|
} else {
|
|
66
57
|
if (mode === 'single') {
|
|
67
58
|
nextFiltersMap.clear();
|
|
68
59
|
}
|
|
69
|
-
|
|
70
60
|
nextFiltersMap.set(col.code, currentFilter);
|
|
71
61
|
}
|
|
72
|
-
|
|
73
62
|
var nextFilters = _Array$from(_valuesInstanceProperty(nextFiltersMap).call(nextFiltersMap));
|
|
74
|
-
|
|
75
63
|
onChangeFilters === null || onChangeFilters === void 0 ? void 0 : onChangeFilters(nextFilters, currentFilter);
|
|
76
64
|
pipeline.setStateAtKey(stateKey, nextFilters);
|
|
77
65
|
};
|
|
78
|
-
|
|
79
66
|
var setFilter = function setFilter(filter, filterCondition) {
|
|
80
67
|
handleFilterChanged(!filter ? undefined : {
|
|
81
68
|
code: col.code,
|
|
@@ -83,7 +70,6 @@ export function filter() {
|
|
|
83
70
|
filterCondition: filterCondition
|
|
84
71
|
});
|
|
85
72
|
};
|
|
86
|
-
|
|
87
73
|
var filterPanel = (_d = col.features) === null || _d === void 0 ? void 0 : _d.filterPanel;
|
|
88
74
|
var colFilterIcon = (_f = (_e = col.features) === null || _e === void 0 ? void 0 : _e.filterIcon) !== null && _f !== void 0 ? _f : filterIcon;
|
|
89
75
|
result.title = _concatInstanceProperty(_context = []).call(_context, _toConsumableArray(_concatInstanceProperty(_context2 = []).call(_context2, (_g = result.title) !== null && _g !== void 0 ? _g : [internals.safeRenderHeader(_extends({}, col))])), [/*#__PURE__*/React.createElement(Filter, {
|
|
@@ -100,7 +86,8 @@ export function filter() {
|
|
|
100
86
|
hideFilterPopupHeader: hideFilterPopupHeader,
|
|
101
87
|
getPopupParent: getPopupParent,
|
|
102
88
|
localeText: localeText
|
|
103
|
-
})]);
|
|
89
|
+
})]);
|
|
90
|
+
// result.headerCellProps = mergeCellProps(col.headerCellProps, {
|
|
104
91
|
// style: {
|
|
105
92
|
// paddingRight: '18px'
|
|
106
93
|
// }
|
|
@@ -109,30 +96,23 @@ export function filter() {
|
|
|
109
96
|
|
|
110
97
|
if (!isLeafNode(col)) {
|
|
111
98
|
var _context3;
|
|
112
|
-
|
|
113
99
|
result.children = _mapInstanceProperty(_context3 = col.children).call(_context3, dfs);
|
|
114
100
|
}
|
|
115
|
-
|
|
116
101
|
return result;
|
|
117
102
|
}
|
|
118
103
|
}
|
|
119
|
-
|
|
120
104
|
function processDataSource(dataSource) {
|
|
121
105
|
var _context4, _context5;
|
|
122
|
-
|
|
123
106
|
var filtersKeys = [];
|
|
124
107
|
inputFiltersMap.forEach(function (value, key) {
|
|
125
108
|
filtersKeys.push(key);
|
|
126
109
|
});
|
|
127
|
-
|
|
128
110
|
if (keepDataSource || filtersKeys.length <= 0) {
|
|
129
111
|
return dataSource;
|
|
130
112
|
}
|
|
131
|
-
|
|
132
113
|
var columns = pipeline.getColumns();
|
|
133
114
|
var columnsMap = new _Map(_mapInstanceProperty(_context4 = _filterInstanceProperty(_context5 = collectNodes(columns, 'leaf-only')).call(_context5, function (col) {
|
|
134
115
|
var _a, _b;
|
|
135
|
-
|
|
136
116
|
return ((_a = col.features) === null || _a === void 0 ? void 0 : _a.filterable) !== false && ((_b = col.features) === null || _b === void 0 ? void 0 : _b.filterable) != null;
|
|
137
117
|
})).call(_context4, function (col) {
|
|
138
118
|
return [col.code, col];
|
|
@@ -140,15 +120,12 @@ export function filter() {
|
|
|
140
120
|
var defaultFilterOptionsMap = new _Map(_mapInstanceProperty(DEFAULT_FILTER_OPTIONS).call(DEFAULT_FILTER_OPTIONS, function (item) {
|
|
141
121
|
return [item.key, _extends({}, item)];
|
|
142
122
|
}));
|
|
143
|
-
|
|
144
123
|
function isMatchedFilterCondition(record) {
|
|
145
124
|
return filtersKeys.every(function (key) {
|
|
146
125
|
var _a, _b;
|
|
147
|
-
|
|
148
126
|
var filterItem = inputFiltersMap.get(key);
|
|
149
127
|
var filterable = (_b = (_a = columnsMap.get(key)) === null || _a === void 0 ? void 0 : _a.features) === null || _b === void 0 ? void 0 : _b.filterable;
|
|
150
128
|
var comparisonFn;
|
|
151
|
-
|
|
152
129
|
if (typeof filterable === 'function') {
|
|
153
130
|
comparisonFn = filterable;
|
|
154
131
|
} else if (defaultFilterOptionsMap.get(filterItem.filterCondition)) {
|
|
@@ -157,40 +134,30 @@ export function filter() {
|
|
|
157
134
|
console.warn("\u5217[".concat(key, "]\u672A\u914D\u7F6E\u7B5B\u9009\u51FD\u6570\uFF0C\u8BF7\u8BBE\u7F6E column.features.filterable \u6765\u4F5C\u4E3A\u8BE5\u5217\u7684\u7B5B\u9009\u51FD\u6570, \u76EE\u524D\u4F7F\u7528\u9ED8\u8BA4\u5305\u542B\u7B5B\u9009\u51FD\u6570"));
|
|
158
135
|
comparisonFn = _filterInstanceProperty(defaultFilterOptionsMap.get('contain'));
|
|
159
136
|
}
|
|
160
|
-
|
|
161
137
|
return comparisonFn(_filterInstanceProperty(filterItem), filterItem)(internals.safeGetValue(columnsMap.get(key), record, -1), record);
|
|
162
138
|
});
|
|
163
139
|
}
|
|
164
|
-
|
|
165
140
|
return layeredFilter(dataSource, isMatchedFilterCondition);
|
|
166
141
|
}
|
|
167
|
-
|
|
168
142
|
pipeline.dataSource(processDataSource(dataSource));
|
|
169
143
|
pipeline.columns(processColumns(columns));
|
|
170
144
|
return pipeline;
|
|
171
145
|
};
|
|
172
146
|
}
|
|
173
|
-
|
|
174
147
|
function layeredFilter(array, matchFn) {
|
|
175
148
|
return dfs(array);
|
|
176
|
-
|
|
177
149
|
function dfs(rows) {
|
|
178
150
|
var _context6;
|
|
179
|
-
|
|
180
151
|
var parentMatched = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
181
152
|
return _filterInstanceProperty(_context6 = _mapInstanceProperty(rows).call(rows, function (row) {
|
|
182
153
|
var currentMatched = matchFn(row);
|
|
183
|
-
|
|
184
154
|
if (isLeafNode(row)) {
|
|
185
155
|
return (parentMatched || currentMatched) && _extends({}, row);
|
|
186
156
|
}
|
|
187
|
-
|
|
188
157
|
var children = row.children;
|
|
189
|
-
|
|
190
158
|
var rowAfterFilterChildren = _extends(_extends({}, row), {
|
|
191
159
|
children: dfs(children, parentMatched || currentMatched)
|
|
192
160
|
});
|
|
193
|
-
|
|
194
161
|
var matchedByChildren = !isLeafNode(rowAfterFilterChildren);
|
|
195
162
|
return (parentMatched || currentMatched || matchedByChildren) && rowAfterFilterChildren;
|
|
196
163
|
})).call(_context6, Boolean);
|
|
@@ -5,29 +5,23 @@ export function columnHover() {
|
|
|
5
5
|
var stateKey = 'columnHover';
|
|
6
6
|
return function (pipeline) {
|
|
7
7
|
var _a, _b, _c, _d;
|
|
8
|
-
|
|
9
8
|
var hoverColor = (_a = opts.hoverColor) !== null && _a !== void 0 ? _a : 'var(--hover-bgcolor)';
|
|
10
9
|
var hoverColIndex = (_d = (_c = (_b = opts.hoverColIndex) !== null && _b !== void 0 ? _b : pipeline.getStateAtKey(stateKey)) !== null && _c !== void 0 ? _c : opts.defaultHoverColIndex) !== null && _d !== void 0 ? _d : -1;
|
|
11
|
-
|
|
12
10
|
var onChangeHoverColIndex = function onChangeHoverColIndex(nextColIndex) {
|
|
13
11
|
var _a;
|
|
14
|
-
|
|
15
12
|
pipeline.setStateAtKey(stateKey, nextColIndex);
|
|
16
13
|
(_a = opts.onChangeHoverColIndex) === null || _a === void 0 ? void 0 : _a.call(opts, nextColIndex);
|
|
17
14
|
};
|
|
18
|
-
|
|
19
15
|
return pipeline.mapColumns(makeRecursiveMapper(function (col, _ref) {
|
|
20
16
|
var startIndex = _ref.startIndex,
|
|
21
|
-
|
|
17
|
+
endIndex = _ref.endIndex;
|
|
22
18
|
var range = {
|
|
23
19
|
start: startIndex,
|
|
24
20
|
end: endIndex
|
|
25
21
|
};
|
|
26
|
-
|
|
27
22
|
if (!isLeafNode(col)) {
|
|
28
23
|
return col;
|
|
29
24
|
}
|
|
30
|
-
|
|
31
25
|
var colIndexMatched = range.start <= hoverColIndex && hoverColIndex < range.end;
|
|
32
26
|
var prevGetCellProps = col.getCellProps;
|
|
33
27
|
return _extends(_extends({}, col), {
|
|
@@ -9,32 +9,26 @@ export function columnRangeHover() {
|
|
|
9
9
|
var stateKey = 'columnHover';
|
|
10
10
|
return function columnRangeHoverStep(pipeline) {
|
|
11
11
|
var _a, _b, _c, _d, _e;
|
|
12
|
-
|
|
13
12
|
var hoverRange = (_c = (_b = (_a = opts.hoverRange) !== null && _a !== void 0 ? _a : pipeline.getStateAtKey(stateKey)) !== null && _b !== void 0 ? _b : opts.defaultHoverRange) !== null && _c !== void 0 ? _c : EMPTY_RANGE;
|
|
14
13
|
var hoverColor = (_d = opts.hoverColor) !== null && _d !== void 0 ? _d : 'var(--hover-bgcolor)';
|
|
15
14
|
var headerHoverColor = (_e = opts.headerHoverColor) !== null && _e !== void 0 ? _e : 'var(--header-hover-bgcolor)';
|
|
16
|
-
|
|
17
15
|
var onChangeHoverRange = function onChangeHoverRange(nextColIndexRange) {
|
|
18
16
|
var _a;
|
|
19
|
-
|
|
20
17
|
pipeline.setStateAtKey(stateKey, nextColIndexRange);
|
|
21
18
|
(_a = opts.onChangeHoverRange) === null || _a === void 0 ? void 0 : _a.call(opts, nextColIndexRange);
|
|
22
19
|
};
|
|
23
|
-
|
|
24
20
|
return pipeline.mapColumns(makeRecursiveMapper(function (col, _ref) {
|
|
25
21
|
var startIndex = _ref.startIndex,
|
|
26
|
-
|
|
22
|
+
endIndex = _ref.endIndex;
|
|
27
23
|
var colRange = {
|
|
28
24
|
start: startIndex,
|
|
29
25
|
end: endIndex
|
|
30
26
|
};
|
|
31
27
|
var match = colRange.end > hoverRange.start && hoverRange.end > colRange.start;
|
|
32
|
-
|
|
33
28
|
if (!isLeafNode(col)) {
|
|
34
29
|
if (headerHoverColor == null) {
|
|
35
30
|
return col;
|
|
36
31
|
}
|
|
37
|
-
|
|
38
32
|
return _extends(_extends({}, col), {
|
|
39
33
|
headerCellProps: mergeCellProps(col.headerCellProps, {
|
|
40
34
|
onMouseEnter: function onMouseEnter() {
|
|
@@ -49,7 +43,6 @@ export function columnRangeHover() {
|
|
|
49
43
|
})
|
|
50
44
|
});
|
|
51
45
|
}
|
|
52
|
-
|
|
53
46
|
var prevGetCellProps = col.getCellProps;
|
|
54
47
|
return _extends(_extends({}, col), {
|
|
55
48
|
headerCellProps: mergeCellProps(col.headerCellProps, {
|