@kdcloudjs/table 1.2.2-canary.5 → 1.2.2-canary.7
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 +113 -59
- package/dist/@kdcloudjs/table.js.map +1 -1
- package/dist/@kdcloudjs/table.min.css +1 -1
- package/dist/@kdcloudjs/table.min.js +6 -6
- package/dist/@kdcloudjs/table.min.js.map +1 -1
- package/es/table/base/styles.js +1 -1
- package/es/table/pipeline/features/rowDrag.js +113 -59
- package/lib/table/base/styles.js +1 -1
- package/lib/table/pipeline/features/rowDrag.js +113 -59
- package/package.json +1 -1
package/dist/@kdcloudjs/table.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* @kdcloudjs/table v1.2.2-canary.
|
|
3
|
+
* @kdcloudjs/table v1.2.2-canary.6
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2020-present, Kingdee, Inc.
|
|
6
6
|
* All rights reserved.
|
|
@@ -3200,7 +3200,7 @@ var Z = {
|
|
|
3200
3200
|
scrollItem: 30,
|
|
3201
3201
|
loadingIndicator: 40
|
|
3202
3202
|
};
|
|
3203
|
-
var GlobalStyle = Object(styled_components__WEBPACK_IMPORTED_MODULE_4__["createGlobalStyle"])(_templateObject || (_templateObject = _babel_runtime_helpers_taggedTemplateLiteral__WEBPACK_IMPORTED_MODULE_0___default()(["\n .", "{\n position: absolute;\n top:0;\n left:0;\n z-index: 9999;\n pointer-events:none;\n user-select: none;\n\n display:flex;\n opacity: 0.9;\n align-items:center;\n min-width:80px;\n padding: 0px 8px;\n border: 1px solid #d9d9d9;\n box-shadow: 0px 6px 16px 3px rgba(0,0,0,0.08);\n border-radius: 2px;\n background: #fff;\n\n .", "{\n font-size:12px;\n overflow:hidden;\n text-overflow: ellipsis;\n white-space:nowrap;\n }\n \n }\n\n .", "{\n position: absolute;\n top:0;\n left:0;\n z-index: 9998;\n pointer-events:none;\n user-select: none;\n height: 2px;\n background: var(--primary-color);\n }\n .", ":before{\n content: \" \";\n position: absolute;\n width: 8px;\n height: 8px;\n top:-4px;\n border: 2px solid var(--primary-color);\n border-radius: 50%;\n background:#fff;\n }\n"])), Classes.rowDragElement, Classes.rowDragElementLabel, Classes.rowDragLine, Classes.treeTableRowDragLine);
|
|
3203
|
+
var GlobalStyle = Object(styled_components__WEBPACK_IMPORTED_MODULE_4__["createGlobalStyle"])(_templateObject || (_templateObject = _babel_runtime_helpers_taggedTemplateLiteral__WEBPACK_IMPORTED_MODULE_0___default()(["\n .", "{\n position: absolute;\n top:0;\n left:0;\n z-index: 9999;\n pointer-events:none;\n user-select: none;\n\n display:flex;\n opacity: 0.9;\n align-items:center;\n min-width:80px;\n padding: 0px 8px;\n border: 1px solid #d9d9d9;\n box-shadow: 0px 6px 16px 3px rgba(0,0,0,0.08);\n border-radius: 2px;\n background: #fff;\n max-height:48px;\n\n .", "{\n font-size:12px;\n overflow:hidden;\n text-overflow: ellipsis;\n white-space:nowrap;\n }\n \n }\n\n .", "{\n position: absolute;\n top:0;\n left:0;\n z-index: 9998;\n pointer-events:none;\n user-select: none;\n height: 2px;\n background: var(--primary-color);\n }\n .", ":before{\n content: \" \";\n position: absolute;\n width: 8px;\n height: 8px;\n top:-4px;\n border: 2px solid var(--primary-color);\n border-radius: 50%;\n background:#fff;\n }\n"])), Classes.rowDragElement, Classes.rowDragElementLabel, Classes.rowDragLine, Classes.treeTableRowDragLine);
|
|
3204
3204
|
var outerBorderStyleMixin = Object(styled_components__WEBPACK_IMPORTED_MODULE_4__["css"])(_templateObject2 || (_templateObject2 = _babel_runtime_helpers_taggedTemplateLiteral__WEBPACK_IMPORTED_MODULE_0___default()(["\n border-top: 1px solid #cccccc;\n border-right: 1px solid #cccccc;\n border-bottom: 1px solid #cccccc;\n border-left: 1px solid #cccccc;\n\n td.", ",\n th.", " {\n border-left: none;\n }\n td.", ",\n th.", " {\n border-right: none;\n }\n\n thead tr.", " th,\n tbody tr.", " td {\n border-top: none;\n }\n &.has-footer tfoot tr.", " td {\n border-bottom: none;\n }\n &:not(.has-footer) tbody tr.", " td {\n border-bottom: none;\n }\n td.", ":not(.", "){\n border-left: var(---cell-border-vertical);\n }\n td.", ":not(.", "){\n border-right: var(---cell-border-vertical);\n }\n"])), Classes.first, Classes.first, Classes.last, Classes.last, Classes.first, Classes.first, Classes.last, Classes.last, Classes.rowSpan, Classes.first, Classes.rowSpan, Classes.last);
|
|
3205
3205
|
var defaultCSSVariables = {
|
|
3206
3206
|
'--row-height': '48px',
|
|
@@ -8862,7 +8862,7 @@ function rowDrag(opt) {
|
|
|
8862
8862
|
direction = getDirection(cell, event.clientY, allowDragIntoRow);
|
|
8863
8863
|
}
|
|
8864
8864
|
}
|
|
8865
|
-
if (overIndex === -1 && dataSource.length > 0 && event.target
|
|
8865
|
+
if (overIndex === -1 && dataSource.length > 0 && dropZoneTarget.contains(event.target)) {
|
|
8866
8866
|
overIndex = dataSource.length - 1;
|
|
8867
8867
|
direction = 'bottom';
|
|
8868
8868
|
}
|
|
@@ -8968,7 +8968,7 @@ function rowDrag(opt) {
|
|
|
8968
8968
|
timeoutId = setTimeout(function () {
|
|
8969
8969
|
intervalId = setInterval(function () {
|
|
8970
8970
|
tableBody.scrollTop += moveOffset;
|
|
8971
|
-
},
|
|
8971
|
+
}, 50);
|
|
8972
8972
|
}, 500);
|
|
8973
8973
|
};
|
|
8974
8974
|
var handleDragStart = function handleDragStart(mouseDownEvent) {
|
|
@@ -9062,6 +9062,9 @@ function rowDrag(opt) {
|
|
|
9062
9062
|
}
|
|
9063
9063
|
};
|
|
9064
9064
|
var handleDragStop = function handleDragStop(mouseUpEvent) {
|
|
9065
|
+
if (!isValidDrag) {
|
|
9066
|
+
return;
|
|
9067
|
+
}
|
|
9065
9068
|
removeElement(dragElement);
|
|
9066
9069
|
removeElement(dragLine);
|
|
9067
9070
|
artTable.classList.remove(classnames__WEBPACK_IMPORTED_MODULE_11___default()(_base_styles__WEBPACK_IMPORTED_MODULE_12__["Classes"].rowDragging));
|
|
@@ -9069,10 +9072,6 @@ function rowDrag(opt) {
|
|
|
9069
9072
|
clearTimeout(timeoutId);
|
|
9070
9073
|
clearInterval(intervalId);
|
|
9071
9074
|
clearTimeout(expandRowTimeoutId);
|
|
9072
|
-
while (expandRowCallBackList.length > 0) {
|
|
9073
|
-
var callback = expandRowCallBackList.pop();
|
|
9074
|
-
callback();
|
|
9075
|
-
}
|
|
9076
9075
|
var rowDropZones = rowDragApi.getRowDropZone();
|
|
9077
9076
|
rowDropZones.forEach(function (dropzone) {
|
|
9078
9077
|
var container = dropzone.getContainer();
|
|
@@ -9086,6 +9085,10 @@ function rowDrag(opt) {
|
|
|
9086
9085
|
var dragEvent = createDropTargetEvent(dropTarget, mouseUpEvent, startDataItem, currentDropZone);
|
|
9087
9086
|
dropTarget.onDragStop(dragEvent);
|
|
9088
9087
|
}
|
|
9088
|
+
while (expandRowCallBackList.length > 0) {
|
|
9089
|
+
var callback = expandRowCallBackList.pop();
|
|
9090
|
+
callback();
|
|
9091
|
+
}
|
|
9089
9092
|
};
|
|
9090
9093
|
var mousemove$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_9__["fromEvent"])(window, 'mousemove');
|
|
9091
9094
|
var mouseup$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_9__["fromEvent"])(window, 'mouseup');
|
|
@@ -9226,6 +9229,9 @@ function positionDragLine(_ref) {
|
|
|
9226
9229
|
var treeModeOptions = getTreeModeOptions();
|
|
9227
9230
|
var rowDragOptions = getRowDragOptions() || {};
|
|
9228
9231
|
var allowDragIntoRow = rowDragOptions.allowDragIntoRow;
|
|
9232
|
+
var isTreeTable = !!treeModeOptions;
|
|
9233
|
+
var bodyRect = tableContainer.getBoundingClientRect();
|
|
9234
|
+
var offsetParentSize = getElementRectWithOffset(document.body);
|
|
9229
9235
|
if (dataSource.length === 0) {
|
|
9230
9236
|
tableContainer.classList.add(_base_styles__WEBPACK_IMPORTED_MODULE_12__["Classes"].rowDragNoData);
|
|
9231
9237
|
lineElement.style.display = 'none';
|
|
@@ -9235,59 +9241,56 @@ function positionDragLine(_ref) {
|
|
|
9235
9241
|
}
|
|
9236
9242
|
// 鼠标悬停所在的拖拽行信息
|
|
9237
9243
|
var dragItem = getDragRowItem(event.target, tableContainer, dataSource);
|
|
9238
|
-
if (!dragItem)
|
|
9244
|
+
if (!dragItem) {
|
|
9245
|
+
if (dataSource.length > 0 && tableContainer.contains(event.target)) {
|
|
9246
|
+
var _rowIndex = dataSource.length - 1;
|
|
9247
|
+
var _row = dataSource[_rowIndex];
|
|
9248
|
+
var _direction = 'bottom';
|
|
9249
|
+
var _targetCell = isTreeTable ? tableContainer.querySelector("tr[data-rowindex=\"".concat(_rowIndex, "\"] .").concat(_base_styles__WEBPACK_IMPORTED_MODULE_12__["Classes"].tableExtendCell)) : tableContainer.querySelector("tr[data-rowindex=\"".concat(_rowIndex, "\"] .").concat(_base_styles__WEBPACK_IMPORTED_MODULE_12__["Classes"].rowDragCell));
|
|
9250
|
+
if (!_targetCell) return;
|
|
9251
|
+
var _getLinePosition = getLinePosition({
|
|
9252
|
+
treeModeOptions: treeModeOptions,
|
|
9253
|
+
cell: _targetCell,
|
|
9254
|
+
row: _row,
|
|
9255
|
+
direction: _direction,
|
|
9256
|
+
offsetParentSize: offsetParentSize,
|
|
9257
|
+
bodyRect: bodyRect
|
|
9258
|
+
}),
|
|
9259
|
+
_top = _getLinePosition.top,
|
|
9260
|
+
_left = _getLinePosition.left,
|
|
9261
|
+
_width = _getLinePosition.width;
|
|
9262
|
+
lineElement.style.left = "".concat(_left, "px");
|
|
9263
|
+
lineElement.style.top = "".concat(_top, "px");
|
|
9264
|
+
lineElement.style.width = "".concat(_width, "px");
|
|
9265
|
+
}
|
|
9266
|
+
return;
|
|
9267
|
+
}
|
|
9239
9268
|
var cell = dragItem.cell,
|
|
9240
9269
|
rowIndex = dragItem.rowIndex,
|
|
9241
9270
|
row = dragItem.row;
|
|
9242
|
-
var bodyRect = tableContainer.getBoundingClientRect();
|
|
9243
|
-
var offsetParentSize = getElementRectWithOffset(document.body);
|
|
9244
|
-
var isTreeTable = !!treeModeOptions;
|
|
9245
9271
|
var allowDragInto = isTreeTable && allowDragIntoRow;
|
|
9246
9272
|
var direction = getDirection(cell, event.clientY, allowDragInto);
|
|
9247
|
-
|
|
9248
|
-
|
|
9249
|
-
|
|
9250
|
-
|
|
9251
|
-
|
|
9252
|
-
|
|
9253
|
-
|
|
9254
|
-
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
|
|
9259
|
-
|
|
9260
|
-
depth = _row$treeMetaKey.depth,
|
|
9261
|
-
isLeaf = _row$treeMetaKey.isLeaf,
|
|
9262
|
-
expanded = _row$treeMetaKey.expanded;
|
|
9263
|
-
var addWidth = isLeaf ? iconWidth + iconGap : 0;
|
|
9264
|
-
var indent = iconIndent + depth * indentSize + addWidth;
|
|
9265
|
-
var x = expandCellRect.x,
|
|
9266
|
-
_y = expandCellRect.y,
|
|
9267
|
-
_height = expandCellRect.height;
|
|
9268
|
-
var _top = direction === 'bottom' ? _y + _height - offsetParentSize.top : _y - offsetParentSize.top;
|
|
9269
|
-
var offsetX = Math.max(x + paddingLeft + indent - bodyRect.x, 0);
|
|
9270
|
-
var _left = bodyRect.x + offsetX - offsetParentSize.left;
|
|
9271
|
-
lineElement.style.left = "".concat(_left, "px");
|
|
9272
|
-
lineElement.style.top = "".concat(_top, "px");
|
|
9273
|
-
lineElement.style.width = "".concat(bodyRect.width - offsetX, "px");
|
|
9274
|
-
if (direction === 'into') {
|
|
9275
|
-
lineElement.style.display = 'none';
|
|
9276
|
-
} else {
|
|
9277
|
-
lineElement.style.display = 'block';
|
|
9278
|
-
}
|
|
9279
|
-
return;
|
|
9280
|
-
}
|
|
9281
|
-
}
|
|
9282
|
-
// 根据鼠标悬停位置所在单元格和显示位置计算拖拽线的位置
|
|
9283
|
-
var rect = cell.getBoundingClientRect();
|
|
9284
|
-
var y = rect.y,
|
|
9285
|
-
height = rect.height;
|
|
9286
|
-
var top = direction === 'bottom' ? y + height - offsetParentSize.top : y - offsetParentSize.top;
|
|
9287
|
-
var left = bodyRect.x - offsetParentSize.left;
|
|
9273
|
+
var targetCell = isTreeTable ? tableContainer.querySelector("tr[data-rowindex=\"".concat(rowIndex, "\"] .").concat(_base_styles__WEBPACK_IMPORTED_MODULE_12__["Classes"].tableExtendCell)) : cell;
|
|
9274
|
+
if (!targetCell) return;
|
|
9275
|
+
var _getLinePosition2 = getLinePosition({
|
|
9276
|
+
treeModeOptions: treeModeOptions,
|
|
9277
|
+
cell: targetCell,
|
|
9278
|
+
row: row,
|
|
9279
|
+
direction: direction,
|
|
9280
|
+
offsetParentSize: offsetParentSize,
|
|
9281
|
+
bodyRect: bodyRect
|
|
9282
|
+
}),
|
|
9283
|
+
top = _getLinePosition2.top,
|
|
9284
|
+
left = _getLinePosition2.left,
|
|
9285
|
+
width = _getLinePosition2.width;
|
|
9288
9286
|
lineElement.style.left = "".concat(left, "px");
|
|
9289
9287
|
lineElement.style.top = "".concat(top, "px");
|
|
9290
|
-
lineElement.style.width = "".concat(
|
|
9288
|
+
lineElement.style.width = "".concat(width, "px");
|
|
9289
|
+
if (direction === 'into') {
|
|
9290
|
+
lineElement.style.display = 'none';
|
|
9291
|
+
} else {
|
|
9292
|
+
lineElement.style.display = 'block';
|
|
9293
|
+
}
|
|
9291
9294
|
}
|
|
9292
9295
|
function showDragLine(lineElement) {
|
|
9293
9296
|
lineElement.style.display = 'block';
|
|
@@ -9320,11 +9323,11 @@ function positionDragElemment(element, event) {
|
|
|
9320
9323
|
}
|
|
9321
9324
|
function getElementRectWithOffset(el) {
|
|
9322
9325
|
var offsetElementRect = el.getBoundingClientRect();
|
|
9323
|
-
var
|
|
9324
|
-
borderTopWidth =
|
|
9325
|
-
borderLeftWidth =
|
|
9326
|
-
borderRightWidth =
|
|
9327
|
-
borderBottomWidth =
|
|
9326
|
+
var _getElementSize2 = _getElementSize(el),
|
|
9327
|
+
borderTopWidth = _getElementSize2.borderTopWidth,
|
|
9328
|
+
borderLeftWidth = _getElementSize2.borderLeftWidth,
|
|
9329
|
+
borderRightWidth = _getElementSize2.borderRightWidth,
|
|
9330
|
+
borderBottomWidth = _getElementSize2.borderBottomWidth;
|
|
9328
9331
|
return {
|
|
9329
9332
|
top: offsetElementRect.top + (borderTopWidth || 0),
|
|
9330
9333
|
left: offsetElementRect.left + (borderLeftWidth || 0),
|
|
@@ -9451,6 +9454,57 @@ function getDirection(cell, clientY) {
|
|
|
9451
9454
|
}
|
|
9452
9455
|
return direction;
|
|
9453
9456
|
}
|
|
9457
|
+
var getLinePosition = function getLinePosition(_ref2) {
|
|
9458
|
+
var treeModeOptions = _ref2.treeModeOptions,
|
|
9459
|
+
cell = _ref2.cell,
|
|
9460
|
+
row = _ref2.row,
|
|
9461
|
+
direction = _ref2.direction,
|
|
9462
|
+
offsetParentSize = _ref2.offsetParentSize,
|
|
9463
|
+
bodyRect = _ref2.bodyRect;
|
|
9464
|
+
var isTreeTable = !!treeModeOptions;
|
|
9465
|
+
if (isTreeTable) {
|
|
9466
|
+
var iconWidth = treeModeOptions.iconWidth,
|
|
9467
|
+
iconIndent = treeModeOptions.iconIndent,
|
|
9468
|
+
iconGap = treeModeOptions.iconGap,
|
|
9469
|
+
indentSize = treeModeOptions.indentSize,
|
|
9470
|
+
treeMetaKey = treeModeOptions.treeMetaKey;
|
|
9471
|
+
var _getElementSize3 = _getElementSize(cell),
|
|
9472
|
+
paddingLeft = _getElementSize3.paddingLeft;
|
|
9473
|
+
var expandCellRect = cell.getBoundingClientRect();
|
|
9474
|
+
var _row$treeMetaKey = row[treeMetaKey],
|
|
9475
|
+
rowKey = _row$treeMetaKey.rowKey,
|
|
9476
|
+
depth = _row$treeMetaKey.depth,
|
|
9477
|
+
isLeaf = _row$treeMetaKey.isLeaf,
|
|
9478
|
+
expanded = _row$treeMetaKey.expanded;
|
|
9479
|
+
var addWidth = isLeaf ? iconWidth + iconGap : 0;
|
|
9480
|
+
var indent = iconIndent + depth * indentSize + addWidth;
|
|
9481
|
+
var x = expandCellRect.x,
|
|
9482
|
+
_y = expandCellRect.y,
|
|
9483
|
+
_height = expandCellRect.height;
|
|
9484
|
+
var _top2 = direction === 'bottom' ? _y + _height - offsetParentSize.top : _y - offsetParentSize.top;
|
|
9485
|
+
var offsetX = Math.max(x + paddingLeft + indent - bodyRect.x, 0);
|
|
9486
|
+
var _left2 = bodyRect.x + offsetX - offsetParentSize.left;
|
|
9487
|
+
var _width2 = bodyRect.width - offsetX;
|
|
9488
|
+
return {
|
|
9489
|
+
top: _top2,
|
|
9490
|
+
left: _left2,
|
|
9491
|
+
width: _width2
|
|
9492
|
+
};
|
|
9493
|
+
}
|
|
9494
|
+
|
|
9495
|
+
// 根据鼠标悬停位置所在单元格和显示位置计算拖拽线的位置
|
|
9496
|
+
var rect = cell.getBoundingClientRect();
|
|
9497
|
+
var y = rect.y,
|
|
9498
|
+
height = rect.height;
|
|
9499
|
+
var top = direction === 'bottom' ? y + height - offsetParentSize.top : y - offsetParentSize.top;
|
|
9500
|
+
var left = bodyRect.x - offsetParentSize.left;
|
|
9501
|
+
var width = bodyRect.width;
|
|
9502
|
+
return {
|
|
9503
|
+
top: top,
|
|
9504
|
+
left: left,
|
|
9505
|
+
width: width
|
|
9506
|
+
};
|
|
9507
|
+
};
|
|
9454
9508
|
|
|
9455
9509
|
/***/ }),
|
|
9456
9510
|
|