@kdcloudjs/table 1.2.0-canary.1 → 1.2.0-canary.11
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/dist/@kdcloudjs/table.css +1 -1
- package/dist/@kdcloudjs/table.js +528 -51
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +8 -8
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/es/locale/locale.d.ts +8 -4
- package/es/locale/zh-CN.d.ts +8 -4
- package/es/locale/zh-CN.js +10 -4
- package/es/table/base/helpers/TableDOMUtils.js +17 -14
- package/es/table/base/styles.d.ts +10 -0
- package/es/table/base/styles.js +12 -2
- package/es/table/base/table.js +38 -7
- package/es/table/common-views.js +3 -1
- package/es/table/interfaces.d.ts +5 -0
- package/es/table/pipeline/features/autoFill.js +10 -4
- package/es/table/pipeline/features/columnDrag.js +6 -1
- package/es/table/pipeline/features/columnFilter.js +17 -5
- package/es/table/pipeline/features/columnResizeWidth.js +3 -1
- package/es/table/pipeline/features/filter/DefaultFilterContent.d.ts +1 -1
- package/es/table/pipeline/features/filter/DefaultFilterContent.js +11 -5
- package/es/table/pipeline/features/filter/Filter.d.ts +4 -1
- package/es/table/pipeline/features/filter/Filter.js +4 -2
- 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 +31 -12
- package/es/table/pipeline/features/rowDrag.d.ts +30 -0
- package/es/table/pipeline/features/rowDrag.js +327 -0
- package/es/table/pipeline/features/sort.js +22 -3
- package/lib/locale/locale.d.ts +8 -4
- package/lib/locale/zh-CN.d.ts +8 -4
- package/lib/locale/zh-CN.js +10 -4
- package/lib/table/base/helpers/TableDOMUtils.js +17 -14
- package/lib/table/base/styles.d.ts +10 -0
- package/lib/table/base/styles.js +12 -2
- package/lib/table/base/table.js +38 -7
- package/lib/table/common-views.js +3 -1
- package/lib/table/interfaces.d.ts +5 -0
- package/lib/table/pipeline/features/autoFill.js +10 -4
- package/lib/table/pipeline/features/columnDrag.js +6 -1
- package/lib/table/pipeline/features/columnFilter.js +18 -6
- package/lib/table/pipeline/features/columnResizeWidth.js +3 -1
- package/lib/table/pipeline/features/filter/DefaultFilterContent.d.ts +1 -1
- package/lib/table/pipeline/features/filter/DefaultFilterContent.js +11 -5
- package/lib/table/pipeline/features/filter/Filter.d.ts +4 -1
- package/lib/table/pipeline/features/filter/Filter.js +4 -2
- package/lib/table/pipeline/features/index.d.ts +1 -0
- package/lib/table/pipeline/features/index.js +9 -1
- package/lib/table/pipeline/features/multiSelect.js +33 -12
- package/lib/table/pipeline/features/rowDrag.d.ts +30 -0
- package/lib/table/pipeline/features/rowDrag.js +349 -0
- package/lib/table/pipeline/features/sort.js +22 -3
- package/package.json +1 -1
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _mapInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/map");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.ROW_DRAG_COLUMN_CODE = void 0;
|
|
11
|
+
exports.rowDrag = rowDrag;
|
|
12
|
+
exports.rowDragKey = void 0;
|
|
13
|
+
|
|
14
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
15
|
+
|
|
16
|
+
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
17
|
+
|
|
18
|
+
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
19
|
+
|
|
20
|
+
var _react = _interopRequireDefault(require("react"));
|
|
21
|
+
|
|
22
|
+
var _rxjs = require("rxjs");
|
|
23
|
+
|
|
24
|
+
var _operators = require("rxjs/operators");
|
|
25
|
+
|
|
26
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
27
|
+
|
|
28
|
+
var _styles = require("../../base/styles");
|
|
29
|
+
|
|
30
|
+
var ROW_DRAG_COLUMN_CODE = '$_row_drag_column_&';
|
|
31
|
+
exports.ROW_DRAG_COLUMN_CODE = ROW_DRAG_COLUMN_CODE;
|
|
32
|
+
var rowDragKey = 'rowDragKey';
|
|
33
|
+
exports.rowDragKey = rowDragKey;
|
|
34
|
+
var SCROLL_OFFSET = 30;
|
|
35
|
+
var defaultRowDragColumn = {
|
|
36
|
+
name: '拖拽列',
|
|
37
|
+
code: ROW_DRAG_COLUMN_CODE,
|
|
38
|
+
lock: true,
|
|
39
|
+
title: '',
|
|
40
|
+
width: 40,
|
|
41
|
+
align: 'center',
|
|
42
|
+
getCellProps: function getCellProps(value, row, rowIndex) {
|
|
43
|
+
return {
|
|
44
|
+
className: (0, _classnames.default)(_styles.Classes.rowDragCell)
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
render: function render(value, row, rowIndex) {
|
|
48
|
+
return /*#__PURE__*/_react.default.createElement("svg", {
|
|
49
|
+
viewBox: '0 0 1024 1024',
|
|
50
|
+
version: '1.1',
|
|
51
|
+
xmlns: 'http://www.w3.org/1999/xlink',
|
|
52
|
+
"data-icon": 'drag',
|
|
53
|
+
width: '16',
|
|
54
|
+
height: '16'
|
|
55
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
56
|
+
d: 'M298.688 192a64 64 0 1 0 128 0 64 64 0 0 0-128 0z m298.624 0a64 64 0 1 0 128 0 64 64 0 0 0-128 0zM298.688 512a64 64 0 1 0 128 0 64 64 0 0 0-128 0z m298.624 0a64 64 0 1 0 128 0 64 64 0 0 0-128 0z m-298.624 320a64 64 0 1 0 128 0 64 64 0 0 0-128 0z m298.624 0a64 64 0 1 0 128 0 64 64 0 0 0-128 0z',
|
|
57
|
+
"p-id": '4278'
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
function rowDrag(opt) {
|
|
63
|
+
return function rowDragStep(pipeline) {
|
|
64
|
+
var _context;
|
|
65
|
+
|
|
66
|
+
var tableBody = pipeline.ref.current.domHelper && pipeline.ref.current.domHelper.tableBody;
|
|
67
|
+
var artTable = pipeline.ref.current.domHelper && pipeline.ref.current.domHelper.artTable;
|
|
68
|
+
if (!tableBody) return pipeline;
|
|
69
|
+
var dataSource = pipeline.getDataSource();
|
|
70
|
+
var rowHeight = (opt === null || opt === void 0 ? void 0 : opt.rowHeight) || 48;
|
|
71
|
+
|
|
72
|
+
var handleDragStrat = function handleDragStrat(event) {
|
|
73
|
+
var _a; // 开始拖拽
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
artTable.classList.add((0, _classnames.default)(_styles.Classes.rowDragging));
|
|
77
|
+
(_a = opt === null || opt === void 0 ? void 0 : opt.onDragStart) === null || _a === void 0 ? void 0 : _a.call(opt, event);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
var handleDragMove = function handleDragMove(event) {
|
|
81
|
+
var _a;
|
|
82
|
+
|
|
83
|
+
(_a = opt === null || opt === void 0 ? void 0 : opt.onDragMove) === null || _a === void 0 ? void 0 : _a.call(opt, event);
|
|
84
|
+
pipeline.setStateAtKey(rowDragKey, event);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
var handleDragEnd = function handleDragEnd(event, isOutOfRange) {
|
|
88
|
+
var _a;
|
|
89
|
+
|
|
90
|
+
artTable.classList.remove((0, _classnames.default)(_styles.Classes.rowDragging));
|
|
91
|
+
pipeline.setStateAtKey(rowDragKey, event); // 超出拖拽范围不触发dragend事件
|
|
92
|
+
|
|
93
|
+
if (!isOutOfRange) {
|
|
94
|
+
(_a = opt === null || opt === void 0 ? void 0 : opt.onDragEnd) === null || _a === void 0 ? void 0 : _a.call(opt, event);
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
var getDragEvent = function getDragEvent(startRowInfo, endRowInfo, _ref) {
|
|
99
|
+
var isFinished = _ref.isFinished,
|
|
100
|
+
_ref$dragPosition = _ref.dragPosition,
|
|
101
|
+
dragPosition = _ref$dragPosition === void 0 ? 'bottom' : _ref$dragPosition;
|
|
102
|
+
return {
|
|
103
|
+
startRowIndex: startRowInfo.rowIndex,
|
|
104
|
+
startRow: startRowInfo.row,
|
|
105
|
+
endRowIndex: endRowInfo.rowIndex,
|
|
106
|
+
endRow: endRowInfo.row,
|
|
107
|
+
dragPosition: dragPosition,
|
|
108
|
+
isFinished: isFinished
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
var updateScrollPosition = function updateScrollPosition(mouseMoveEvent) {
|
|
113
|
+
if (opt === null || opt === void 0 ? void 0 : opt.suppressScrollMove) return;
|
|
114
|
+
var clientY = mouseMoveEvent.clientY;
|
|
115
|
+
var tableBodyClientRect = tableBody.getBoundingClientRect();
|
|
116
|
+
var top = tableBodyClientRect.top,
|
|
117
|
+
height = tableBodyClientRect.height;
|
|
118
|
+
|
|
119
|
+
if (clientY + SCROLL_OFFSET >= top + height) {
|
|
120
|
+
pipeline.ref.current.domHelper.tableBody.scrollTop += SCROLL_OFFSET;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (clientY + SCROLL_OFFSET <= top) {
|
|
124
|
+
pipeline.ref.current.domHelper.tableBody.scrollTop -= SCROLL_OFFSET;
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
var onMouseDown = function onMouseDown(mouseDownEvent) {
|
|
129
|
+
var _a;
|
|
130
|
+
|
|
131
|
+
var startRowInfo = getTargetRowInfo(mouseDownEvent.target, tableBody, dataSource);
|
|
132
|
+
var endRowInfo = startRowInfo;
|
|
133
|
+
if (!startRowInfo || startRowInfo.code !== rowDragColumn.code) return;
|
|
134
|
+
if ((_a = opt === null || opt === void 0 ? void 0 : opt.isDisabled) === null || _a === void 0 ? void 0 : _a.call(opt, startRowInfo.row, startRowInfo.rowIndex)) return; // 默认拖拽插入的位置是向下
|
|
135
|
+
|
|
136
|
+
var dragPosition = 'bottom';
|
|
137
|
+
var isOutOfRange = false;
|
|
138
|
+
var dragStartEvent = getDragEvent(startRowInfo, endRowInfo, {
|
|
139
|
+
isFinished: false,
|
|
140
|
+
dragPosition: 'bottom'
|
|
141
|
+
});
|
|
142
|
+
handleDragStrat(dragStartEvent);
|
|
143
|
+
var tableWidth = tableBody.clientWidth;
|
|
144
|
+
var startRowRects = startRowInfo.cell.getBoundingClientRect(); // 光标位置距离初始拖拽行的偏移量
|
|
145
|
+
|
|
146
|
+
var startOffset = mouseDownEvent.clientY - startRowRects.y;
|
|
147
|
+
var dragElement = createDragElement(startRowRects, tableWidth, rowHeight); // 可拖拽的范围
|
|
148
|
+
|
|
149
|
+
var dragRange = getDragRange(tableBody, {
|
|
150
|
+
startOffset: startOffset,
|
|
151
|
+
rowHeight: startRowRects.height
|
|
152
|
+
});
|
|
153
|
+
var mousemove$ = (0, _rxjs.fromEvent)(window, 'mousemove');
|
|
154
|
+
var mouseup$ = (0, _rxjs.fromEvent)(window, 'mouseup');
|
|
155
|
+
var rowDrag$ = mousemove$.pipe((0, _mapInstanceProperty(_operators))(function (mouseMoveEvent) {
|
|
156
|
+
var clientX = mouseMoveEvent.clientX,
|
|
157
|
+
clientY = mouseMoveEvent.clientY;
|
|
158
|
+
var tagretRow = getTargetRowInfo(mouseMoveEvent.target, tableBody, dataSource);
|
|
159
|
+
|
|
160
|
+
if (tagretRow) {
|
|
161
|
+
endRowInfo = tagretRow;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
var targetRowRects = endRowInfo.cell.getBoundingClientRect(); // 判断拖拽插入的位置,拖拽框上边框位于目标行之上则向上插入,否则向下插入
|
|
165
|
+
|
|
166
|
+
var isMoveToTop = clientY - startOffset < targetRowRects.y;
|
|
167
|
+
dragPosition = isMoveToTop ? 'top' : 'bottom';
|
|
168
|
+
isOutOfRange = isOutOfDragRange({
|
|
169
|
+
x: clientX,
|
|
170
|
+
y: clientY
|
|
171
|
+
}, dragRange);
|
|
172
|
+
updateScrollPosition(mouseMoveEvent); // 拖拽到底时让滚动条可以滚动
|
|
173
|
+
|
|
174
|
+
updateDragElementPosition(dragElement, dragRange, {
|
|
175
|
+
x: clientX,
|
|
176
|
+
y: clientY,
|
|
177
|
+
startOffset: startOffset
|
|
178
|
+
});
|
|
179
|
+
updateCurSorStyle(isOutOfRange);
|
|
180
|
+
return {
|
|
181
|
+
startRowInfo: startRowInfo,
|
|
182
|
+
endRowInfo: endRowInfo,
|
|
183
|
+
dragPosition: dragPosition
|
|
184
|
+
};
|
|
185
|
+
}), (0, _operators.takeUntil)(mouseup$));
|
|
186
|
+
rowDrag$.subscribe({
|
|
187
|
+
next: function next(_ref2) {
|
|
188
|
+
var startRowInfo = _ref2.startRowInfo,
|
|
189
|
+
endRowInfo = _ref2.endRowInfo,
|
|
190
|
+
dragPosition = _ref2.dragPosition;
|
|
191
|
+
var dragMoveEvent = getDragEvent(startRowInfo, endRowInfo, {
|
|
192
|
+
isFinished: false,
|
|
193
|
+
dragPosition: dragPosition
|
|
194
|
+
});
|
|
195
|
+
handleDragMove(dragMoveEvent);
|
|
196
|
+
},
|
|
197
|
+
complete: function complete() {
|
|
198
|
+
var dragEndEvent = getDragEvent(startRowInfo, endRowInfo, {
|
|
199
|
+
isFinished: true,
|
|
200
|
+
dragPosition: dragPosition
|
|
201
|
+
});
|
|
202
|
+
handleDragEnd(dragEndEvent, isOutOfRange);
|
|
203
|
+
removeDragElement(dragElement);
|
|
204
|
+
removeCurSorStyle();
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
var rowDragColumn = (opt === null || opt === void 0 ? void 0 : opt.rowDragColumn) || defaultRowDragColumn;
|
|
210
|
+
pipeline.setFeatureOptions('rowDragColumnKey', rowDragColumn.code);
|
|
211
|
+
var nextColumns = (0, _slice.default)(_context = pipeline.getColumns()).call(_context);
|
|
212
|
+
nextColumns.unshift(rowDragColumn);
|
|
213
|
+
pipeline.columns(nextColumns);
|
|
214
|
+
pipeline.addTableProps({
|
|
215
|
+
onMouseDown: onMouseDown
|
|
216
|
+
});
|
|
217
|
+
pipeline.appendRowPropsGetter(function (row, rowIndex) {
|
|
218
|
+
var _cx;
|
|
219
|
+
|
|
220
|
+
var rowDragEvent = pipeline.getStateAtKey(rowDragKey) || {};
|
|
221
|
+
var startRowIndex = rowDragEvent.startRowIndex,
|
|
222
|
+
endRowIndex = rowDragEvent.endRowIndex,
|
|
223
|
+
isFinished = rowDragEvent.isFinished,
|
|
224
|
+
dragPosition = rowDragEvent.dragPosition;
|
|
225
|
+
var isFooterCell = row[pipeline.getFeatureOptions('footerRowMetaKey')];
|
|
226
|
+
if (isFooterCell || isFinished || rowIndex !== startRowIndex && rowIndex !== endRowIndex) return;
|
|
227
|
+
var className = (0, _classnames.default)((_cx = {}, (0, _defineProperty2.default)(_cx, _styles.Classes.rowDragStart, rowIndex === startRowIndex), (0, _defineProperty2.default)(_cx, _styles.Classes.rowDragEnd, rowIndex === endRowIndex), (0, _defineProperty2.default)(_cx, _styles.Classes.rowDragEndToTop, rowIndex === endRowIndex && dragPosition === 'top'), (0, _defineProperty2.default)(_cx, _styles.Classes.rowDragEndToBottom, rowIndex === endRowIndex && dragPosition === 'bottom'), _cx));
|
|
228
|
+
return {
|
|
229
|
+
className: className
|
|
230
|
+
};
|
|
231
|
+
});
|
|
232
|
+
return pipeline;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function getTargetRowInfo(target, tableBody, record) {
|
|
237
|
+
while (target && tableBody.contains(target)) {
|
|
238
|
+
if (target.getAttribute('data-role') === 'table-cell') {
|
|
239
|
+
var code = target.getAttribute('data-code');
|
|
240
|
+
var rowIndex = parseInt(target.getAttribute('data-rowindex'));
|
|
241
|
+
var row = record[rowIndex];
|
|
242
|
+
var isFooterCell = isEleInFooter(target);
|
|
243
|
+
if (!row || isFooterCell) return null;
|
|
244
|
+
return {
|
|
245
|
+
rowIndex: rowIndex,
|
|
246
|
+
row: row,
|
|
247
|
+
code: code,
|
|
248
|
+
cell: target
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
target = target.parentElement;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
function isEleInFooter(target) {
|
|
259
|
+
while (target && !target.classList.contains(_styles.Classes.artTable)) {
|
|
260
|
+
if (target.classList.contains(_styles.Classes.tableFooter)) {
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
target = target.parentElement;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function createDragElement(rects, tableWidth, rowHeight) {
|
|
271
|
+
var _context2, _context3, _context4;
|
|
272
|
+
|
|
273
|
+
var x = rects.x,
|
|
274
|
+
y = rects.y;
|
|
275
|
+
var dragMoveElement = document.createElement('div');
|
|
276
|
+
dragMoveElement.className = (0, _classnames.default)(_styles.Classes.rowDragElement);
|
|
277
|
+
dragMoveElement.style.cssText = (0, _concat.default)(_context2 = (0, _concat.default)(_context3 = (0, _concat.default)(_context4 = "position:fixed;z-index:9999;left:".concat(x, "px;top:")).call(_context4, y, "px;pointer-events:none;width:")).call(_context3, tableWidth, "px;height:")).call(_context2, rowHeight, "px;background:var(--primary-color);opacity: 0.1;");
|
|
278
|
+
document.body.appendChild(dragMoveElement);
|
|
279
|
+
return dragMoveElement;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function updateDragElementPosition(element, dragRange, _ref3) {
|
|
283
|
+
var x = _ref3.x,
|
|
284
|
+
y = _ref3.y,
|
|
285
|
+
startOffset = _ref3.startOffset;
|
|
286
|
+
var validPosition = getValidPosition({
|
|
287
|
+
x: x,
|
|
288
|
+
y: y
|
|
289
|
+
}, dragRange);
|
|
290
|
+
element.style.top = validPosition.y - startOffset + 'px';
|
|
291
|
+
return element;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
function removeDragElement(element) {
|
|
295
|
+
document.body.removeChild(element);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function updateCurSorStyle(isOutOfRange) {
|
|
299
|
+
if (isOutOfRange) {
|
|
300
|
+
document.body.style.cursor = 'no-drop';
|
|
301
|
+
} else {
|
|
302
|
+
document.body.style.cursor = 'move';
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
function removeCurSorStyle() {
|
|
307
|
+
document.body.style.cursor = 'default';
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function getDragRange(tableBody, _ref4) {
|
|
311
|
+
var startOffset = _ref4.startOffset,
|
|
312
|
+
rowHeight = _ref4.rowHeight;
|
|
313
|
+
var tableBodyClientRect = tableBody.getBoundingClientRect();
|
|
314
|
+
var height = tableBodyClientRect.height,
|
|
315
|
+
width = tableBodyClientRect.width,
|
|
316
|
+
x = tableBodyClientRect.x,
|
|
317
|
+
y = tableBodyClientRect.y;
|
|
318
|
+
return {
|
|
319
|
+
minX: x,
|
|
320
|
+
maxX: x + width,
|
|
321
|
+
minY: y - rowHeight + startOffset,
|
|
322
|
+
maxY: y + height + startOffset
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function getValidPosition(position, dragRange) {
|
|
327
|
+
var x = position.x,
|
|
328
|
+
y = position.y;
|
|
329
|
+
var minX = dragRange.minX,
|
|
330
|
+
maxX = dragRange.maxX,
|
|
331
|
+
minY = dragRange.minY,
|
|
332
|
+
maxY = dragRange.maxY;
|
|
333
|
+
var newX = x < minX ? minX : x > maxX ? maxX : x;
|
|
334
|
+
var newY = y < minY ? minY : y > maxY ? maxY : y;
|
|
335
|
+
return {
|
|
336
|
+
x: newX,
|
|
337
|
+
y: newY
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
function isOutOfDragRange(position, dragRange) {
|
|
342
|
+
var x = position.x,
|
|
343
|
+
y = position.y;
|
|
344
|
+
var minX = dragRange.minX,
|
|
345
|
+
maxX = dragRange.maxX,
|
|
346
|
+
minY = dragRange.minY,
|
|
347
|
+
maxY = dragRange.maxY;
|
|
348
|
+
return x > maxX || x < minX || y > maxY || y < minY;
|
|
349
|
+
}
|
|
@@ -338,10 +338,29 @@ function sort() {
|
|
|
338
338
|
title: col.title && col.title[0] ? col.title[0] : col.title
|
|
339
339
|
})));
|
|
340
340
|
|
|
341
|
-
|
|
342
|
-
|
|
341
|
+
var _sortNodeWithoutTitle = /*#__PURE__*/_react.default.createElement(SortHeaderCell, {
|
|
342
|
+
onToggle: function onToggle(e) {
|
|
343
|
+
if (stopClickEventPropagation) {
|
|
344
|
+
e.stopPropagation();
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
toggle(col.code);
|
|
348
|
+
},
|
|
349
|
+
sortOrder: sortOrder,
|
|
350
|
+
column: col,
|
|
351
|
+
sortIndex: sortIndex,
|
|
352
|
+
sortOptions: sortOptions
|
|
353
|
+
}); // 开启标题行高自适应后,修改表头的渲染结构
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
if (col.renderHeader) {
|
|
357
|
+
result.title = col.renderHeader(result.title, _sortNodeWithoutTitle);
|
|
343
358
|
} else {
|
|
344
|
-
result.title
|
|
359
|
+
if (result.title && result.title[0]) {
|
|
360
|
+
result.title[0] = sortNode;
|
|
361
|
+
} else {
|
|
362
|
+
result.title = sortNode;
|
|
363
|
+
}
|
|
345
364
|
}
|
|
346
365
|
}
|
|
347
366
|
|