@kdcloudjs/table 1.1.3-canary.7 → 1.1.3-canary.9
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 +285 -57
- 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/html-table.js +1 -1
- package/es/table/base/styles.d.ts +2 -0
- package/es/table/base/styles.js +3 -1
- package/es/table/base/table.js +4 -3
- package/es/table/pipeline/features/columnDrag.js +19 -10
- package/es/table/pipeline/features/footerDataSource.d.ts +9 -0
- package/es/table/pipeline/features/footerDataSource.js +25 -0
- 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 +4 -0
- package/es/table/pipeline/features/rangeSelection.d.ts +1 -1
- package/es/table/pipeline/features/rangeSelection.js +156 -28
- package/es/table/pipeline/features/singleSelect.js +4 -0
- package/es/table/pipeline/pipeline.d.ts +5 -1
- package/es/table/pipeline/pipeline.js +11 -10
- package/lib/table/base/html-table.js +1 -1
- package/lib/table/base/styles.d.ts +2 -0
- package/lib/table/base/styles.js +3 -1
- package/lib/table/base/table.js +4 -3
- package/lib/table/pipeline/features/columnDrag.js +19 -10
- package/lib/table/pipeline/features/footerDataSource.d.ts +9 -0
- package/lib/table/pipeline/features/footerDataSource.js +41 -0
- package/lib/table/pipeline/features/index.d.ts +1 -0
- package/lib/table/pipeline/features/index.js +15 -1
- package/lib/table/pipeline/features/multiSelect.js +4 -0
- package/lib/table/pipeline/features/rangeSelection.d.ts +1 -1
- package/lib/table/pipeline/features/rangeSelection.js +158 -30
- package/lib/table/pipeline/features/singleSelect.js +4 -0
- package/lib/table/pipeline/pipeline.d.ts +5 -1
- package/lib/table/pipeline/pipeline.js +12 -10
- package/package.json +1 -1
package/dist/@kdcloudjs/table.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* @kdcloudjs/table v1.1.3-canary.
|
|
3
|
+
* @kdcloudjs/table v1.1.3-canary.8
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2020-present, Kingdee, Inc.
|
|
6
6
|
* All rights reserved.
|
|
@@ -2664,7 +2664,7 @@ function HtmlTable(_ref) {
|
|
|
2664
2664
|
positionStyle.left = hozInfo.stickyLeftMap.get(colIndex);
|
|
2665
2665
|
} else if (colIndex >= fullFlatCount - rightFlatCount) {
|
|
2666
2666
|
positionStyle.position = 'sticky';
|
|
2667
|
-
positionStyle.right = hozInfo.stickyRightMap.get(colIndex) - stickyRightOffset;
|
|
2667
|
+
positionStyle.right = hozInfo.stickyRightMap.get(colIndex) - (typeof stickyRightOffset === 'number' ? stickyRightOffset : 0);
|
|
2668
2668
|
}
|
|
2669
2669
|
|
|
2670
2670
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_14___default.a.createElement('td', _objectSpread(_objectSpread(_objectSpread({
|
|
@@ -3289,6 +3289,8 @@ var Classes = {
|
|
|
3289
3289
|
button: "".concat(prefix, "btn"),
|
|
3290
3290
|
buttonPrimary: "".concat(prefix, "btn-primary"),
|
|
3291
3291
|
filterIcon: "".concat(prefix, "filter-icon"),
|
|
3292
|
+
rangeSelection: "".concat(prefix, "range-selection"),
|
|
3293
|
+
tableCellRangeSingleCell: "".concat(prefix, "table-cell-range-single-cell"),
|
|
3292
3294
|
tableCellRangeSelected: "".concat(prefix, "table-cell-range-selected"),
|
|
3293
3295
|
tableCellRangeTop: "".concat(prefix, "table-cell-range-top"),
|
|
3294
3296
|
tableCellRangeLeft: "".concat(prefix, "table-cell-range-left"),
|
|
@@ -3356,7 +3358,7 @@ var defaultCSSVariables = {
|
|
|
3356
3358
|
'--header-cell-border-horizontal': '1px solid #dfe3e8'
|
|
3357
3359
|
};
|
|
3358
3360
|
var variableConst = getCssVariableText(defaultCSSVariables);
|
|
3359
|
-
var StyledArtTableWrapper = styled_components__WEBPACK_IMPORTED_MODULE_4__["default"].div(_templateObject2 || (_templateObject2 = _babel_runtime_helpers_taggedTemplateLiteral__WEBPACK_IMPORTED_MODULE_0___default()(["\n :root {\n ", "\n }\n ", "\n\n box-sizing: border-box;\n * {\n box-sizing: border-box;\n }\n cursor: default;\n color: var(--color);\n font-size: var(--font-size);\n line-height: var(--line-height);\n position: relative;\n\n // \u8868\u683C\u5916\u8FB9\u6846\u7531 art-table-wrapper \u63D0\u4F9B\uFF0C\u800C\u4E0D\u662F\u7531\u5355\u5143\u683C\u63D0\u4F9B\n &.use-outer-border {\n ", ";\n }\n\n .no-scrollbar {\n ::-webkit-scrollbar {\n display: none;\n }\n }\n\n .", " {\n overflow: auto;\n flex-shrink: 1;\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n
|
|
3361
|
+
var StyledArtTableWrapper = styled_components__WEBPACK_IMPORTED_MODULE_4__["default"].div(_templateObject2 || (_templateObject2 = _babel_runtime_helpers_taggedTemplateLiteral__WEBPACK_IMPORTED_MODULE_0___default()(["\n :root {\n ", "\n }\n ", "\n\n box-sizing: border-box;\n * {\n box-sizing: border-box;\n }\n cursor: default;\n color: var(--color);\n font-size: var(--font-size);\n line-height: var(--line-height);\n position: relative;\n\n // \u8868\u683C\u5916\u8FB9\u6846\u7531 art-table-wrapper \u63D0\u4F9B\uFF0C\u800C\u4E0D\u662F\u7531\u5355\u5143\u683C\u63D0\u4F9B\n &.use-outer-border {\n ", ";\n }\n\n .no-scrollbar {\n ::-webkit-scrollbar {\n display: none;\n }\n }\n\n .", " {\n overflow: auto;\n flex-shrink: 1;\n flex-grow: 1;\n display: flex;\n flex-direction: column;\n }\n\n .", " {\n overflow: hidden;\n background: var(--header-bgcolor);\n display: flex;\n flex-shrink: 0;\n border-bottom: var(--header-cell-border-horizontal);\n }\n\n .", " {\n display: flex;\n // justify-content: flex-start;\n align-items: center;\n height: inherit;\n }\n\n .", " {\n overflow-x:auto;\n flex-shrink: 0;\n flex-grow: 0;\n scrollbar-width: none; // \u517C\u5BB9\u706B\u72D0\n & {\n ::-webkit-scrollbar {\n display:none;\n }\n }\n }\n\n .", " {\n display: flex;\n flex: none;\n }\n .", ", .", " {\n background: var(--bgcolor);\n overflow: auto;\n overflow-x: hidden;\n overflow-anchor: none;\n position:relative;\n &.empty {\n position: relative;\n }\n }\n\n .", " {\n position: relative;\n }\n .", ", .", " {\n .", "{\n background-color: #e6effb !important;\n }\n .", "{\n border-top: 1px solid #0E5FD8 !important;\n }\n .", "{\n border-left: 1px solid #0E5FD8 !important;\n }\n .", "{\n border-bottom: 1px solid #0E5FD8 !important;\n }\n .", "{\n border-right: 1px solid #0E5FD8 !important;\n }\n }\n \n .", " {\n user-select:none;\n }\n\n\n &.sticky-header .", " {\n position: sticky;\n top: 0;\n z-index: ", ";\n }\n\n &.sticky-footer .", " {\n position: sticky;\n bottom: 0;\n z-index: ", ";\n }\n\n table {\n width: 0;\n table-layout: fixed;\n border-collapse: separate;\n border-spacing: 0;\n display: table;\n margin: 0;\n padding: 0;\n flex-shrink: 0;\n flex-grow: 0;\n position:relative;\n }\n\n // \u5728 tr \u4E0A\u8BBE\u7F6E .no-hover \u53EF\u4EE5\u7981\u7528\u9F20\u6807\u60AC\u505C\u6548\u679C\n tr:not(.no-hover):hover > td {\n background: var(--hover-bgcolor);\n }\n // \u4F7F\u7528 js \u6DFB\u52A0\u60AC\u6D6E\u6548\u679C\n tr:not(.no-hover).row-hover > td {\n background: var(--hover-bgcolor);\n }\n // \u5728 tr \u8BBE\u7F6E highlight \u53EF\u4EE5\u4E3A\u5E95\u4E0B\u7684 td \u8BBE\u7F6E\u4E3A\u9AD8\u4EAE\u8272\n // \u800C\u8BBE\u7F6E .no-highlight \u7684\u8BDD\u5219\u53EF\u4EE5\u7981\u7528\u9AD8\u4EAE\u6548\u679C\uFF1B\n tr:not(.no-highlight).highlight > td {\n background: var(--highlight-bgcolor);\n }\n\n th {\n font-weight: normal;\n text-align: left;\n padding: var(--cell-padding);\n height: var(--header-row-height);\n color: var(--header-color);\n background: var(--header-bgcolor);\n border:1px solid transparent;\n border-right: var(--header-cell-border-vertical);\n border-bottom: var(--header-cell-border-horizontal);\n position: relative;\n }\n\n th.resizeable{\n border-right:none\n }\n\n th.", " {\n border-right: none;\n border-bottom: none;\n }\n\n tr.", " th {\n border-top: var(--header-cell-border-horizontal);\n }\n th.", " {\n border-left: var(--header-cell-border-vertical);\n }\n\n td {\n padding: var(--cell-padding);\n background: var(--bgcolor);\n height: var(--row-height);\n border:1px solid transparent;\n border-right: var(--cell-border-vertical);\n border-bottom: var(--cell-border-horizontal);\n word-break: break-all;\n }\n td.", " {\n border-left: var(--cell-border-vertical);\n }\n tr.", " td {\n border-top: var(--cell-border-horizontal);\n }\n &.has-header tbody tr.", " td {\n border-top: none;\n }\n &.has-footer tbody tr.", " td {\n border-bottom: none;\n }\n\n .", ",\n .", " {\n z-index: ", ";\n }\n\n //#region \u9501\u5217\u9634\u5F71\n .", " {\n position: absolute;\n top: 0;\n bottom: 0;\n z-index: ", ";\n pointer-events: none;\n overflow: hidden;\n\n .", " {\n height: 100%;\n }\n\n .", " {\n margin-right: ", "px;\n box-shadow: none;\n\n &.show-shadow {\n box-shadow: var(--lock-shadow);\n border-right: var(--cell-border-vertical);\n }\n }\n\n .", " {\n margin-left: ", "px;\n box-shadow: none;\n\n &.show-shadow {\n box-shadow: var(--lock-shadow);\n border-left: var(--cell-border-vertical);\n }\n }\n }\n //#endregion\n\n //#region \u7A7A\u8868\u683C\u5C55\u73B0\n .", " {\n pointer-events: none;\n color: #99a3b3;\n font-size: 12px;\n text-align: center;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n\n .empty-image {\n width: 50px;\n height: 50px;\n }\n\n .empty-tips {\n margin-top: 16px;\n line-height: 1.5;\n }\n }\n //#endregion\n\n //#region IE\u517C\u5BB9\n &.ie-polyfill-wrapper {\n //\u9501\u5B9A\u5217\u517C\u5BB9 \u4EC5\u5728\u9501\u5B9A\u5217\u7684\u60C5\u51B5\u4E0B\u751F\u6548\n .", " {\n overflow-x: hidden;\n }\n .", ", .", " {\n position:relative;\n }\n .", " {\n overflow: hidden;\n }\n .", " {\n position: relative;\n }\n\n .", " {\n overflow: auto;\n overflow-x: hidden;\n overflow-anchor: none;\n }\n\n .", ", .", "{\n position: absolute;\n z-index: ", ";\n top: 0;\n }\n .", "{\n left:0;\n }\n .", "{\n right:0;\n }\n\n .", "{\n .", "{\n position: absolute;\n top: 0;\n width: 100%;\n z-index: ", ";\n }\n }\n\n tr:not(.no-hover).row-hover > td {\n background: var(--hover-bgcolor);\n }\n }\n //#endregion\n\n //#region \u7C98\u6027\u6EDA\u52A8\u6761\n .", " {\n overflow-y: hidden;\n overflow-x: auto;\n z-index: ", ";\n flex-shrink: 0;\n flex-grow: 0;\n border-top: 1px solid var(--border-color);\n background: var(--bgcolor);\n }\n\n .", " {\n // \u5FC5\u987B\u6709\u9AD8\u5EA6\u624D\u80FD\u51FA\u73B0\u6EDA\u52A8\u6761\n height: 1px;\n visibility: hidden;\n }\n //#endregion\n\n //#region \u52A0\u8F7D\u6837\u5F0F\n .", " {\n position: relative;\n width: 100%;\n height: 100%;\n overflow: auto;\n\n .", " {\n filter: none;\n width: 100%;\n height: 100%;\n overflow: hidden;//\u5217\u5168\u90E8\u56FA\u5B9A\u65F6\uFF0C\u5B58\u5728\u53CC\u6A2A\u5411\u6EDA\u52A8\u6761\n display: flex;\n position: relative;\n flex-direction: column;\n }\n\n .", " {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n pointer-events: none;\n }\n\n .", " {\n position: sticky;\n z-index: ", ";\n transform: translateY(-50%);\n }\n }\n //#endregion\n\n //#region \u8868\u683C\u8FC7\u6EE4\n .", " {\n color:var(--icon-color);\n &.active{\n color:var(--primary-color);\n }\n }\n //#endregion\n\n //#region \u8868\u683C\u6392\u5E8F\n .", " {\n color:var(--icon-color);\n &.active{\n color:var(--primary-color);\n }\n }\n //#endregion\n\n //#region \u6EDA\u52A8\u6761\u5360\u4F4D\n .", " {\n visibility: hidden;\n flex-shrink: 0;\n }\n .", " .", " {\n border-top: var(--cell-border-horizontal);\n }\n //#endregion\n "])), variableConst, variableConst, outerBorderStyleMixin, Classes.artTable, Classes.tableHeader, Classes.tableHeaderCellContent, Classes.virtual, Classes.tableFooter, Classes.tableBody, Classes.tableFooter, Classes.tableRow, Classes.tableBody, Classes.tableFooter, Classes.tableCellRangeSelected, Classes.tableCellRangeTop, Classes.tableCellRangeLeft, Classes.tableCellRangeBottom, Classes.tableCellRangeRight, Classes.rangeSelection, Classes.tableHeader, Z.header, Classes.tableFooter, Z.footer, Classes.leaf, Classes.first, Classes.first, Classes.first, Classes.first, Classes.first, Classes.last, Classes.lockLeft, Classes.lockRight, Z.lock, Classes.lockShadowMask, Z.lockShadow, Classes.lockShadow, Classes.leftLockShadow, LOCK_SHADOW_PADDING, Classes.rightLockShadow, LOCK_SHADOW_PADDING, Classes.emptyWrapper, Classes.virtual, Classes.tableBody, Classes.tableFooter, Classes.tableHeaderMain, Classes.tableHeader, Classes.tableFooterMain, Classes.fixedLeft, Classes.fixedRight, Z.lock, Classes.fixedLeft, Classes.fixedRight, Classes.rowDetailContainer, Classes.rowDetailItem, Z.rowDetail, Classes.stickyScroll, Z.scrollItem, Classes.stickyScrollItem, Classes.loadingWrapper, Classes.loadingContentWrapper, Classes.loadingIndicatorWrapper, Classes.loadingIndicator, Z.loadingIndicator, Classes.tableFilterTrigger, Classes.tableSortIcon, Classes.verticalScrollPlaceholder, Classes.tableFooter, Classes.verticalScrollPlaceholder);
|
|
3360
3362
|
var ButtonCSS = Object(styled_components__WEBPACK_IMPORTED_MODULE_4__["css"])(_templateObject3 || (_templateObject3 = _babel_runtime_helpers_taggedTemplateLiteral__WEBPACK_IMPORTED_MODULE_0___default()(["\n ", "\n //#region \u6309\u94AE\n .", "{\n color: var(--color);\n background:#ffffff;\n border:1px solid var(--strong-border-color);\n border-radius: 2px;\n cursor: pointer;\n &:hover{\n color: var(--primary-color);\n border:1px solid var(--primary-color);\n }\n }\n .", " {\n color:#ffffff;\n background-color: var(--primary-color);\n border:none;\n &:hover{\n color:#ffffff;\n background-color: var(--primary-color-level2);\n border:none;\n }\n }\n//#endregion\n"])), variableConst, Classes.button, Classes.buttonPrimary);
|
|
3361
3363
|
|
|
3362
3364
|
function getCssVariableText(obj) {
|
|
@@ -3984,13 +3986,14 @@ var BaseTable = /*#__PURE__*/function (_React$Component) {
|
|
|
3984
3986
|
style: style
|
|
3985
3987
|
}, _utils__WEBPACK_IMPORTED_MODULE_39__["STYLED_REF_PROP"], this.artTableWrapperRef);
|
|
3986
3988
|
|
|
3989
|
+
var tableProps = getTableProps() || {};
|
|
3987
3990
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_27___default.a.createElement(_styles__WEBPACK_IMPORTED_MODULE_38__["StyledArtTableWrapper"], artTableWrapperProps, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_27___default.a.createElement(_loading__WEBPACK_IMPORTED_MODULE_37__["default"], {
|
|
3988
3991
|
visible: isLoading,
|
|
3989
3992
|
LoadingIcon: components.LoadingIcon,
|
|
3990
3993
|
LoadingContentWrapper: components.LoadingContentWrapper
|
|
3991
|
-
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_27___default.a.createElement("div", _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_18___default()({
|
|
3992
|
-
className: _styles__WEBPACK_IMPORTED_MODULE_38__["Classes"].artTable
|
|
3993
|
-
}
|
|
3994
|
+
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_27___default.a.createElement("div", _babel_runtime_helpers_extends__WEBPACK_IMPORTED_MODULE_18___default()({}, tableProps, {
|
|
3995
|
+
className: classnames__WEBPACK_IMPORTED_MODULE_26___default()(_styles__WEBPACK_IMPORTED_MODULE_38__["Classes"].artTable, tableProps.className)
|
|
3996
|
+
}), this.renderTableHeader(info), this.renderTableBody(info), this.renderTableFooter(info), this.renderLockShadows(info)), this.renderStickyScroll(info)));
|
|
3994
3997
|
}
|
|
3995
3998
|
}, {
|
|
3996
3999
|
key: "componentDidMount",
|
|
@@ -5272,6 +5275,8 @@ function columnDrag() {
|
|
|
5272
5275
|
var currentTarget = e.currentTarget;
|
|
5273
5276
|
var rect = e.currentTarget.parentElement.getClientRects()[0];
|
|
5274
5277
|
var startX = rect.left;
|
|
5278
|
+
var mouseDownClientX = e.clientX;
|
|
5279
|
+
var mouseDownClientY = e.clientY;
|
|
5275
5280
|
var moveData = [];
|
|
5276
5281
|
var allColumns = Object(_utils__WEBPACK_IMPORTED_MODULE_10__["collectNodes"])(columns);
|
|
5277
5282
|
var tableBodyClientRect = tableBody.getBoundingClientRect();
|
|
@@ -5291,8 +5296,6 @@ function columnDrag() {
|
|
|
5291
5296
|
}
|
|
5292
5297
|
};
|
|
5293
5298
|
|
|
5294
|
-
var stopClickPropagationFlag = false;
|
|
5295
|
-
|
|
5296
5299
|
function handleMouseMove(e) {
|
|
5297
5300
|
var client = {
|
|
5298
5301
|
clientX: e.clientX,
|
|
@@ -5306,12 +5309,6 @@ function columnDrag() {
|
|
|
5306
5309
|
if (e.clientX - leftPosition < 20) {
|
|
5307
5310
|
return;
|
|
5308
5311
|
} else {
|
|
5309
|
-
// 阻止列头点击事件,防止拖动后触发列头过滤事件
|
|
5310
|
-
if (stopClickPropagationFlag === false) {
|
|
5311
|
-
stopClickPropagationFlag = true;
|
|
5312
|
-
currentTarget.addEventListener('click', stopClickPropagation);
|
|
5313
|
-
}
|
|
5314
|
-
|
|
5315
5312
|
e.stopPropagation();
|
|
5316
5313
|
}
|
|
5317
5314
|
|
|
@@ -5431,11 +5428,15 @@ function columnDrag() {
|
|
|
5431
5428
|
e.stopPropagation();
|
|
5432
5429
|
document.body.removeEventListener('mousemove', handleMouseMove);
|
|
5433
5430
|
document.body.removeEventListener('mouseup', handleMouseUp);
|
|
5434
|
-
window.removeEventListener('selectstart', disableSelect);
|
|
5431
|
+
window.removeEventListener('selectstart', disableSelect); // 阻止列头点击事件,防止拖动后触发列头过滤事件
|
|
5432
|
+
|
|
5433
|
+
if (_isMoveWhenClicking(mouseDownClientX, mouseDownClientY, e.clientX, e.clientY)) {
|
|
5434
|
+
currentTarget.addEventListener('click', stopClickPropagation);
|
|
5435
|
+
}
|
|
5436
|
+
|
|
5435
5437
|
window.requestAnimationFrame(function () {
|
|
5436
5438
|
// 取消阻止列头点击事件
|
|
5437
5439
|
currentTarget.removeEventListener('click', stopClickPropagation);
|
|
5438
|
-
stopClickPropagationFlag = false;
|
|
5439
5440
|
currentTarget = null;
|
|
5440
5441
|
|
|
5441
5442
|
var _moveData = moveData,
|
|
@@ -5553,6 +5554,17 @@ function moveAllChildren(cols, cloumnsTranslateData, width, isMinus) {
|
|
|
5553
5554
|
});
|
|
5554
5555
|
}
|
|
5555
5556
|
|
|
5557
|
+
function _isMoveWhenClicking(mouseDownClientX, mouseDownClientY, mouseUpClientX, mouseUpClientY) {
|
|
5558
|
+
var xDiff = mouseUpClientX - mouseDownClientX;
|
|
5559
|
+
var yDiff = mouseUpClientY - mouseDownClientY; // 鼠标点按和松开的偏移量大于5px,认为存在移动
|
|
5560
|
+
|
|
5561
|
+
if (Math.sqrt(xDiff * xDiff + yDiff * yDiff) > 5) {
|
|
5562
|
+
return true;
|
|
5563
|
+
}
|
|
5564
|
+
|
|
5565
|
+
return false;
|
|
5566
|
+
}
|
|
5567
|
+
|
|
5556
5568
|
/***/ }),
|
|
5557
5569
|
|
|
5558
5570
|
/***/ "./components/table/pipeline/features/columnFilter.tsx":
|
|
@@ -7250,13 +7262,83 @@ var DEFAULT_FILTER_OPTIONS = [{
|
|
|
7250
7262
|
}];
|
|
7251
7263
|
|
|
7252
7264
|
|
|
7265
|
+
/***/ }),
|
|
7266
|
+
|
|
7267
|
+
/***/ "./components/table/pipeline/features/footerDataSource.ts":
|
|
7268
|
+
/*!****************************************************************!*\
|
|
7269
|
+
!*** ./components/table/pipeline/features/footerDataSource.ts ***!
|
|
7270
|
+
\****************************************************************/
|
|
7271
|
+
/*! exports provided: footerRowMetaSymbol, footerDataSource */
|
|
7272
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
7273
|
+
|
|
7274
|
+
"use strict";
|
|
7275
|
+
__webpack_require__.r(__webpack_exports__);
|
|
7276
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "footerRowMetaSymbol", function() { return footerRowMetaSymbol; });
|
|
7277
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "footerDataSource", function() { return footerDataSource; });
|
|
7278
|
+
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js");
|
|
7279
|
+
/* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__);
|
|
7280
|
+
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core-js/modules/es.symbol.js */ "./node_modules/core-js/modules/es.symbol.js");
|
|
7281
|
+
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_1__);
|
|
7282
|
+
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.symbol.description.js */ "./node_modules/core-js/modules/es.symbol.description.js");
|
|
7283
|
+
/* harmony import */ var core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_description_js__WEBPACK_IMPORTED_MODULE_2__);
|
|
7284
|
+
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ "./node_modules/core-js/modules/es.object.to-string.js");
|
|
7285
|
+
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_3__);
|
|
7286
|
+
/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.array.map.js */ "./node_modules/core-js/modules/es.array.map.js");
|
|
7287
|
+
/* harmony import */ var core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_map_js__WEBPACK_IMPORTED_MODULE_4__);
|
|
7288
|
+
/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/es.object.keys.js */ "./node_modules/core-js/modules/es.object.keys.js");
|
|
7289
|
+
/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_5__);
|
|
7290
|
+
/* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/es.array.filter.js */ "./node_modules/core-js/modules/es.array.filter.js");
|
|
7291
|
+
/* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_6__);
|
|
7292
|
+
/* harmony import */ var core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ "./node_modules/core-js/modules/es.object.get-own-property-descriptor.js");
|
|
7293
|
+
/* harmony import */ var core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_7__);
|
|
7294
|
+
/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ "./node_modules/core-js/modules/web.dom-collections.for-each.js");
|
|
7295
|
+
/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_8__);
|
|
7296
|
+
/* harmony import */ var core_js_modules_es_object_get_own_property_descriptors_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptors.js */ "./node_modules/core-js/modules/es.object.get-own-property-descriptors.js");
|
|
7297
|
+
/* harmony import */ var core_js_modules_es_object_get_own_property_descriptors_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_own_property_descriptors_js__WEBPACK_IMPORTED_MODULE_9__);
|
|
7298
|
+
|
|
7299
|
+
|
|
7300
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7301
|
+
|
|
7302
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7303
|
+
|
|
7304
|
+
|
|
7305
|
+
|
|
7306
|
+
|
|
7307
|
+
|
|
7308
|
+
|
|
7309
|
+
|
|
7310
|
+
|
|
7311
|
+
|
|
7312
|
+
|
|
7313
|
+
var footerRowMetaSymbol = Symbol('footer-row');
|
|
7314
|
+
function footerDataSource() {
|
|
7315
|
+
var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7316
|
+
return function footerDataSourceStep(pipeline) {
|
|
7317
|
+
var _opts$dataSource, _opts$footerRowMetaKe;
|
|
7318
|
+
|
|
7319
|
+
var footerDataSource = (_opts$dataSource = opts.dataSource) !== null && _opts$dataSource !== void 0 ? _opts$dataSource : pipeline.getFooterDataSource();
|
|
7320
|
+
var footerRowMetaKey = (_opts$footerRowMetaKe = opts.footerRowMetaKey) !== null && _opts$footerRowMetaKe !== void 0 ? _opts$footerRowMetaKe : footerRowMetaSymbol;
|
|
7321
|
+
pipeline.setFeatureOptions('footerRowMetaKey', footerRowMetaKey);
|
|
7322
|
+
|
|
7323
|
+
if (footerDataSource) {
|
|
7324
|
+
pipeline.footerDataSource(footerDataSource.map(function (row) {
|
|
7325
|
+
return _objectSpread(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0___default()({}, footerRowMetaKey, true), row);
|
|
7326
|
+
}));
|
|
7327
|
+
} else {
|
|
7328
|
+
console.warn('调用 pipeline.use(features.footerDataSource()) 前请先设置页脚数据源,设置方法有:pipeline.use(features.footerDataSource({dataSource:any[]})) 或者 pipeline.footerDataSource(any[])');
|
|
7329
|
+
}
|
|
7330
|
+
|
|
7331
|
+
return pipeline;
|
|
7332
|
+
};
|
|
7333
|
+
}
|
|
7334
|
+
|
|
7253
7335
|
/***/ }),
|
|
7254
7336
|
|
|
7255
7337
|
/***/ "./components/table/pipeline/features/index.ts":
|
|
7256
7338
|
/*!*****************************************************!*\
|
|
7257
7339
|
!*** ./components/table/pipeline/features/index.ts ***!
|
|
7258
7340
|
\*****************************************************/
|
|
7259
|
-
/*! exports provided: autoRowSpan, buildTree, columnHover, ColumnHoverFeatureOptions, columnRangeHover, ColumnRangeHoverFeatureOptions, multiSelect, MultiSelectFeatureOptions, rowDetail, RowDetailFeatureOptions, rowGrouping, RowGroupingFeatureOptions, singleSelect, SingleSelectFeatureOptions, sort, SortFeatureOptions, tips, treeMode, TreeModeFeatureOptions, treeMetaSymbol, treeSelect, TreeSelectFeatureOptions, columnDrag, ColumnDragOptions, columnResize, ColumnResizeOptions, contextMenu, ContextMenuFeatureOptions, filter, FilterFeatureOptions, rangeSelection, RangeSelectionFeatureOptions, mergeCellHover */
|
|
7341
|
+
/*! exports provided: autoRowSpan, buildTree, columnHover, ColumnHoverFeatureOptions, columnRangeHover, ColumnRangeHoverFeatureOptions, multiSelect, MultiSelectFeatureOptions, rowDetail, RowDetailFeatureOptions, rowGrouping, RowGroupingFeatureOptions, singleSelect, SingleSelectFeatureOptions, sort, SortFeatureOptions, tips, treeMode, TreeModeFeatureOptions, treeMetaSymbol, treeSelect, TreeSelectFeatureOptions, columnDrag, ColumnDragOptions, columnResize, ColumnResizeOptions, contextMenu, ContextMenuFeatureOptions, filter, FilterFeatureOptions, rangeSelection, RangeSelectionFeatureOptions, mergeCellHover, footerDataSource, FooterDataSourceFeatureOptions, footerRowMetaSymbol */
|
|
7260
7342
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
7261
7343
|
|
|
7262
7344
|
"use strict";
|
|
@@ -7345,6 +7427,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
7345
7427
|
/* harmony import */ var _mergeCellHover__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./mergeCellHover */ "./components/table/pipeline/features/mergeCellHover.tsx");
|
|
7346
7428
|
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeCellHover", function() { return _mergeCellHover__WEBPACK_IMPORTED_MODULE_17__["mergeCellHover"]; });
|
|
7347
7429
|
|
|
7430
|
+
/* harmony import */ var _footerDataSource__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./footerDataSource */ "./components/table/pipeline/features/footerDataSource.ts");
|
|
7431
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "footerDataSource", function() { return _footerDataSource__WEBPACK_IMPORTED_MODULE_18__["footerDataSource"]; });
|
|
7432
|
+
|
|
7433
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FooterDataSourceFeatureOptions", function() { return _footerDataSource__WEBPACK_IMPORTED_MODULE_18__["FooterDataSourceFeatureOptions"]; });
|
|
7434
|
+
|
|
7435
|
+
/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "footerRowMetaSymbol", function() { return _footerDataSource__WEBPACK_IMPORTED_MODULE_18__["footerRowMetaSymbol"]; });
|
|
7436
|
+
|
|
7437
|
+
|
|
7348
7438
|
|
|
7349
7439
|
|
|
7350
7440
|
|
|
@@ -7611,6 +7701,10 @@ function multiSelect() {
|
|
|
7611
7701
|
return Object(_utils__WEBPACK_IMPORTED_MODULE_17__["mergeCellProps"])(preCellProps, checkboxCellProps);
|
|
7612
7702
|
},
|
|
7613
7703
|
render: function render(_, row, rowIndex) {
|
|
7704
|
+
if (row[pipeline.getFeatureOptions('footerRowMetaKey')]) {
|
|
7705
|
+
return null;
|
|
7706
|
+
}
|
|
7707
|
+
|
|
7614
7708
|
var key = _internals__WEBPACK_IMPORTED_MODULE_15__["internals"].safeGetRowKey(primaryKey, row, rowIndex);
|
|
7615
7709
|
var checked = set.has(key);
|
|
7616
7710
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_14___default.a.createElement(Checkbox, {
|
|
@@ -7719,13 +7813,13 @@ function multiSelect() {
|
|
|
7719
7813
|
/*!***************************************************************!*\
|
|
7720
7814
|
!*** ./components/table/pipeline/features/rangeSelection.tsx ***!
|
|
7721
7815
|
\***************************************************************/
|
|
7722
|
-
/*! exports provided: rangeSelectionKey,
|
|
7816
|
+
/*! exports provided: rangeSelectionKey, lastClickCellKey, rangeSelection */
|
|
7723
7817
|
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
7724
7818
|
|
|
7725
7819
|
"use strict";
|
|
7726
7820
|
__webpack_require__.r(__webpack_exports__);
|
|
7727
7821
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rangeSelectionKey", function() { return rangeSelectionKey; });
|
|
7728
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "
|
|
7822
|
+
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lastClickCellKey", function() { return lastClickCellKey; });
|
|
7729
7823
|
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rangeSelection", function() { return rangeSelection; });
|
|
7730
7824
|
/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.object.keys.js */ "./node_modules/core-js/modules/es.object.keys.js");
|
|
7731
7825
|
/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -7779,40 +7873,42 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
7779
7873
|
|
|
7780
7874
|
|
|
7781
7875
|
var rangeSelectionKey = 'rangeSelection';
|
|
7782
|
-
var
|
|
7876
|
+
var lastClickCellKey = 'lastClickCell';
|
|
7783
7877
|
function rangeSelection(opts) {
|
|
7784
7878
|
return function step(pipeline) {
|
|
7785
7879
|
var SCROLL_SIZE = 30;
|
|
7786
7880
|
var tableBody = pipeline.ref.current.domHelper && pipeline.ref.current.domHelper.tableBody;
|
|
7881
|
+
var tableFooter = pipeline.ref.current.domHelper && pipeline.ref.current.domHelper.tableFooter;
|
|
7787
7882
|
|
|
7788
7883
|
if (!tableBody) {
|
|
7789
7884
|
return pipeline;
|
|
7790
7885
|
}
|
|
7791
7886
|
|
|
7792
7887
|
var columns = pipeline.getColumns();
|
|
7888
|
+
var dataSource = pipeline.getDataSource();
|
|
7793
7889
|
|
|
7794
7890
|
var rangeSelectedChange = function rangeSelectedChange(rangeSelection) {
|
|
7795
7891
|
var _opts$rangeSelectedCh;
|
|
7796
7892
|
|
|
7797
7893
|
pipeline.setStateAtKey(rangeSelectionKey, rangeSelection);
|
|
7798
7894
|
opts === null || opts === void 0 ? void 0 : (_opts$rangeSelectedCh = opts.rangeSelectedChange) === null || _opts$rangeSelectedCh === void 0 ? void 0 : _opts$rangeSelectedCh.call(opts, rangeSelection);
|
|
7799
|
-
};
|
|
7800
|
-
// pipeline.setFeatureOptions(rangeSelectionKey, {
|
|
7801
|
-
// optionKey: rangeSelectionKey,
|
|
7802
|
-
// rangeSelectedChange: rangeSelectedChange
|
|
7803
|
-
// })
|
|
7804
|
-
// }
|
|
7805
|
-
|
|
7895
|
+
};
|
|
7806
7896
|
|
|
7807
7897
|
var setRangeSelection = function setRangeSelection(startDragCell, draggingCell) {
|
|
7808
|
-
if (!startDragCell || !draggingCell
|
|
7898
|
+
if (!startDragCell || !draggingCell) return;
|
|
7809
7899
|
var rangeColumns = getRangeColumns(startDragCell, draggingCell, columns);
|
|
7810
|
-
|
|
7900
|
+
|
|
7901
|
+
var _getRangeSelectionRow = getRangeSelectionRowInfo(startDragCell, draggingCell, dataSource),
|
|
7902
|
+
startRow = _getRangeSelectionRow.startRow,
|
|
7903
|
+
endRow = _getRangeSelectionRow.endRow,
|
|
7904
|
+
footerRowRange = _getRangeSelectionRow.footerRowRange;
|
|
7905
|
+
|
|
7811
7906
|
var rangeSelection = {
|
|
7812
|
-
startRow:
|
|
7813
|
-
endRow:
|
|
7907
|
+
startRow: startRow,
|
|
7908
|
+
endRow: endRow,
|
|
7814
7909
|
columns: rangeColumns,
|
|
7815
|
-
startColumn: startDragCell.column
|
|
7910
|
+
startColumn: startDragCell.column,
|
|
7911
|
+
footerRowRange: footerRowRange
|
|
7816
7912
|
};
|
|
7817
7913
|
rangeSelectedChange(rangeSelection);
|
|
7818
7914
|
};
|
|
@@ -7823,23 +7919,23 @@ function rangeSelection(opts) {
|
|
|
7823
7919
|
|
|
7824
7920
|
if (clickCell) {
|
|
7825
7921
|
if (event.shiftKey) {
|
|
7826
|
-
var _lastClickCell = pipeline.getStateAtKey(
|
|
7922
|
+
var _lastClickCell = pipeline.getStateAtKey(lastClickCellKey);
|
|
7827
7923
|
|
|
7828
7924
|
if (_lastClickCell) {
|
|
7829
7925
|
setRangeSelection(_lastClickCell, clickCell);
|
|
7830
7926
|
} else {
|
|
7831
7927
|
// 第一次进来就按住shift键,这时候要记住点击的单元格
|
|
7832
|
-
pipeline.setStateAtKey(
|
|
7928
|
+
pipeline.setStateAtKey(lastClickCellKey, clickCell);
|
|
7833
7929
|
}
|
|
7834
7930
|
} else {
|
|
7835
|
-
pipeline.setStateAtKey(
|
|
7836
|
-
|
|
7931
|
+
pipeline.setStateAtKey(lastClickCellKey, clickCell);
|
|
7932
|
+
setRangeSelection(clickCell, clickCell);
|
|
7837
7933
|
}
|
|
7838
7934
|
}
|
|
7839
7935
|
};
|
|
7840
7936
|
|
|
7841
7937
|
var onMouseDown = function onMouseDown(mouseDownEvent) {
|
|
7842
|
-
if (mouseDownEvent.button !== 0 || !Object(_utils__WEBPACK_IMPORTED_MODULE_11__["isElementInEventPath"])(tableBody, mouseDownEvent.nativeEvent)) return; // mouseDownEvent.preventDefault()
|
|
7938
|
+
if (mouseDownEvent.button !== 0 || !(Object(_utils__WEBPACK_IMPORTED_MODULE_11__["isElementInEventPath"])(tableBody, mouseDownEvent.nativeEvent) || Object(_utils__WEBPACK_IMPORTED_MODULE_11__["isElementInEventPath"])(tableFooter, mouseDownEvent.nativeEvent))) return; // mouseDownEvent.preventDefault()
|
|
7843
7939
|
// shift + 点击选中
|
|
7844
7940
|
|
|
7845
7941
|
shiftKeySelect(mouseDownEvent);
|
|
@@ -7895,10 +7991,11 @@ function rangeSelection(opts) {
|
|
|
7895
7991
|
};
|
|
7896
7992
|
|
|
7897
7993
|
var onKeyDown = function onKeyDown(e) {
|
|
7898
|
-
if (!Object(_utils__WEBPACK_IMPORTED_MODULE_11__["isElementInEventPath"])(tableBody, e.nativeEvent)) return;
|
|
7994
|
+
if (!(Object(_utils__WEBPACK_IMPORTED_MODULE_11__["isElementInEventPath"])(tableBody, e.nativeEvent) || Object(_utils__WEBPACK_IMPORTED_MODULE_11__["isElementInEventPath"])(tableFooter, e.nativeEvent))) return;
|
|
7899
7995
|
|
|
7900
7996
|
if ((e.ctrlKey || e.metaKey) && e.key === 'a') {
|
|
7901
7997
|
var rowLen = pipeline.getDataSource().length;
|
|
7998
|
+
var footerDataSource = pipeline.getFooterDataSource() || [];
|
|
7902
7999
|
|
|
7903
8000
|
if (columns.length && rowLen) {
|
|
7904
8001
|
opts.preventkDefaultOfKeyDownEvent !== false && e.preventDefault();
|
|
@@ -7906,7 +8003,11 @@ function rangeSelection(opts) {
|
|
|
7906
8003
|
startRow: 0,
|
|
7907
8004
|
endRow: rowLen - 1,
|
|
7908
8005
|
columns: columns,
|
|
7909
|
-
startColumn: columns[0]
|
|
8006
|
+
startColumn: columns[0],
|
|
8007
|
+
footerRowRange: footerDataSource.length > 0 ? {
|
|
8008
|
+
startRow: 0,
|
|
8009
|
+
endRow: footerDataSource.length - 1
|
|
8010
|
+
} : null
|
|
7910
8011
|
});
|
|
7911
8012
|
}
|
|
7912
8013
|
}
|
|
@@ -7915,7 +8016,8 @@ function rangeSelection(opts) {
|
|
|
7915
8016
|
pipeline.addTableProps({
|
|
7916
8017
|
onMouseDown: onMouseDown,
|
|
7917
8018
|
onKeyDown: onKeyDown,
|
|
7918
|
-
tabIndex: -1
|
|
8019
|
+
tabIndex: -1,
|
|
8020
|
+
className: classnames__WEBPACK_IMPORTED_MODULE_16___default()([_base_styles__WEBPACK_IMPORTED_MODULE_15__["Classes"].rangeSelection])
|
|
7919
8021
|
}); // todo: 后面可以把mousedown放到一个流里面
|
|
7920
8022
|
|
|
7921
8023
|
return pipeline.mapColumns(Object(_utils__WEBPACK_IMPORTED_MODULE_11__["makeRecursiveMapper"])(function (col) {
|
|
@@ -7929,15 +8031,29 @@ function rangeSelection(opts) {
|
|
|
7929
8031
|
var _cx;
|
|
7930
8032
|
|
|
7931
8033
|
var prevCellProps = prevGetCellProps === null || prevGetCellProps === void 0 ? void 0 : prevGetCellProps(value, record, rowIndex);
|
|
8034
|
+
var isInFooter = record[pipeline.getFeatureOptions('footerRowMetaKey')];
|
|
7932
8035
|
var startRow = rangeSelection.startRow,
|
|
7933
8036
|
endRow = rangeSelection.endRow,
|
|
7934
|
-
columns = rangeSelection.columns
|
|
7935
|
-
|
|
7936
|
-
|
|
8037
|
+
columns = rangeSelection.columns,
|
|
8038
|
+
footerRowRange = rangeSelection.footerRowRange;
|
|
8039
|
+
|
|
8040
|
+
var _getRowIndex = getRowIndex(startRow, endRow),
|
|
8041
|
+
startRowIndex = _getRowIndex.startRowIndex,
|
|
8042
|
+
endRowIndex = _getRowIndex.endRowIndex;
|
|
8043
|
+
|
|
8044
|
+
var _getFooterRowIndex = getFooterRowIndex(footerRowRange),
|
|
8045
|
+
footerStartRowIndex = _getFooterRowIndex.startRowIndex,
|
|
8046
|
+
footerEndRowIndex = _getFooterRowIndex.endRowIndex;
|
|
8047
|
+
|
|
7937
8048
|
var startCol = columns[0];
|
|
7938
8049
|
var endCol = columns[columns.length - 1];
|
|
7939
|
-
var
|
|
7940
|
-
var
|
|
8050
|
+
var bodyMatch = !isInFooter && rowIndex >= startRowIndex && rowIndex <= endRowIndex;
|
|
8051
|
+
var footerMatch = isInFooter && footerRowRange && rowIndex >= footerStartRowIndex && rowIndex <= footerEndRowIndex;
|
|
8052
|
+
var match = footerMatch || bodyMatch;
|
|
8053
|
+
var matchSingleCell = match && isCellRangeSingleCell(rangeSelection); // 单个范围选中单元格不显示样式
|
|
8054
|
+
|
|
8055
|
+
var showCellRangeStyle = match && !matchSingleCell;
|
|
8056
|
+
var className = classnames__WEBPACK_IMPORTED_MODULE_16___default()((_cx = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_15__["Classes"].tableCellRangeSingleCell, matchSingleCell), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_15__["Classes"].tableCellRangeSelected, showCellRangeStyle), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_15__["Classes"].tableCellRangeTop, showCellRangeStyle && (isInFooter ? startRowIndex !== -1 ? false : rowIndex === footerStartRowIndex : rowIndex === startRowIndex)), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_15__["Classes"].tableCellRangeLeft, showCellRangeStyle && col.code === startCol.code), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_15__["Classes"].tableCellRangeBottom, showCellRangeStyle && (isInFooter ? rowIndex === footerEndRowIndex : footerRowRange ? false : rowIndex === endRowIndex)), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_15__["Classes"].tableCellRangeRight, showCellRangeStyle && col.code === endCol.code), _cx));
|
|
7941
8057
|
return Object(_utils__WEBPACK_IMPORTED_MODULE_11__["mergeCellProps"])(prevCellProps, {
|
|
7942
8058
|
className: className
|
|
7943
8059
|
});
|
|
@@ -7963,7 +8079,8 @@ function getTargetCell(target, columns) {
|
|
|
7963
8079
|
rowIndex: parseInt(target.getAttribute('data-rowindex')),
|
|
7964
8080
|
rowSpan: parseInt(target.getAttribute('rowspan') || 1),
|
|
7965
8081
|
code: columnCode,
|
|
7966
|
-
column: column
|
|
8082
|
+
column: column,
|
|
8083
|
+
isInFooter: isEleInFooter(target)
|
|
7967
8084
|
}
|
|
7968
8085
|
};
|
|
7969
8086
|
}();
|
|
@@ -7978,7 +8095,19 @@ function getTargetCell(target, columns) {
|
|
|
7978
8095
|
}
|
|
7979
8096
|
|
|
7980
8097
|
function isSameCell(cell1, cell2) {
|
|
7981
|
-
return cell1.rowIndex === cell2.rowIndex && cell1.code === cell2.code;
|
|
8098
|
+
return cell1.rowIndex === cell2.rowIndex && cell1.code === cell2.code && cell1.isInFooter === cell2.isInFooter;
|
|
8099
|
+
}
|
|
8100
|
+
|
|
8101
|
+
function isEleInFooter(target) {
|
|
8102
|
+
while (target && !target.classList.contains(_base_styles__WEBPACK_IMPORTED_MODULE_15__["Classes"].artTable)) {
|
|
8103
|
+
if (target.classList.contains(_base_styles__WEBPACK_IMPORTED_MODULE_15__["Classes"].tableFooter)) {
|
|
8104
|
+
return true;
|
|
8105
|
+
}
|
|
8106
|
+
|
|
8107
|
+
target = target.parentElement;
|
|
8108
|
+
}
|
|
8109
|
+
|
|
8110
|
+
return false;
|
|
7982
8111
|
}
|
|
7983
8112
|
|
|
7984
8113
|
function getRangeColumns(startCell, endCell, columns) {
|
|
@@ -7997,6 +8126,99 @@ function getRangeColumns(startCell, endCell, columns) {
|
|
|
7997
8126
|
}
|
|
7998
8127
|
}
|
|
7999
8128
|
|
|
8129
|
+
function getRangeSelectionRowInfo(startCell, endCell, dataSource) {
|
|
8130
|
+
var footerRowRange = null;
|
|
8131
|
+
var startRow = -1;
|
|
8132
|
+
var endRow = -1;
|
|
8133
|
+
|
|
8134
|
+
var _getCellRangeRow = getCellRangeRow(startCell, endCell),
|
|
8135
|
+
_startRow = _getCellRangeRow.startRow,
|
|
8136
|
+
_endRow = _getCellRangeRow.endRow; // 两个单元格都在表体
|
|
8137
|
+
|
|
8138
|
+
|
|
8139
|
+
if (!startCell.isInFooter && !endCell.isInFooter) {
|
|
8140
|
+
startRow = _startRow;
|
|
8141
|
+
endRow = _endRow;
|
|
8142
|
+
} else if (startCell.isInFooter && endCell.isInFooter) {
|
|
8143
|
+
// 两个单元格都在表底
|
|
8144
|
+
footerRowRange = {
|
|
8145
|
+
startRow: _startRow,
|
|
8146
|
+
endRow: _endRow
|
|
8147
|
+
};
|
|
8148
|
+
} else {
|
|
8149
|
+
// 一个单元格在表体,一个在表底
|
|
8150
|
+
if (startCell.isInFooter) {
|
|
8151
|
+
startRow = dataSource.length - 1;
|
|
8152
|
+
endRow = endCell.rowIndex;
|
|
8153
|
+
footerRowRange = {
|
|
8154
|
+
startRow: startCell.rowIndex,
|
|
8155
|
+
endRow: 0
|
|
8156
|
+
};
|
|
8157
|
+
} else {
|
|
8158
|
+
startRow = startCell.rowIndex;
|
|
8159
|
+
endRow = dataSource.length - 1;
|
|
8160
|
+
footerRowRange = {
|
|
8161
|
+
startRow: 0,
|
|
8162
|
+
endRow: endCell.rowIndex
|
|
8163
|
+
};
|
|
8164
|
+
}
|
|
8165
|
+
}
|
|
8166
|
+
|
|
8167
|
+
return {
|
|
8168
|
+
startRow: startRow,
|
|
8169
|
+
endRow: endRow,
|
|
8170
|
+
footerRowRange: footerRowRange
|
|
8171
|
+
};
|
|
8172
|
+
}
|
|
8173
|
+
|
|
8174
|
+
function getCellRangeRow(startCell, endCell) {
|
|
8175
|
+
if (isSameCell(startCell, endCell)) {
|
|
8176
|
+
return {
|
|
8177
|
+
startRow: startCell.rowIndex,
|
|
8178
|
+
endRow: startCell.rowIndex
|
|
8179
|
+
};
|
|
8180
|
+
}
|
|
8181
|
+
|
|
8182
|
+
var isTopToBottom = startCell.rowIndex <= endCell.rowIndex;
|
|
8183
|
+
var startRow = isTopToBottom ? startCell.rowIndex : startCell.rowIndex + startCell.rowSpan - 1;
|
|
8184
|
+
var endRow = isTopToBottom ? endCell.rowIndex + endCell.rowSpan - 1 : endCell.rowIndex;
|
|
8185
|
+
return {
|
|
8186
|
+
startRow: startRow,
|
|
8187
|
+
endRow: endRow
|
|
8188
|
+
};
|
|
8189
|
+
}
|
|
8190
|
+
|
|
8191
|
+
function isCellRangeSingleCell(rangeSelection) {
|
|
8192
|
+
var startRow = rangeSelection.startRow,
|
|
8193
|
+
endRow = rangeSelection.endRow,
|
|
8194
|
+
columns = rangeSelection.columns,
|
|
8195
|
+
footerRowRange = rangeSelection.footerRowRange;
|
|
8196
|
+
var isBodySingleCell = !footerRowRange && startRow === endRow && columns.length === 1;
|
|
8197
|
+
var isFooterSingleCell = startRow === -1 && footerRowRange.startRow === footerRowRange.endRow && columns.length === 1;
|
|
8198
|
+
return isBodySingleCell || isFooterSingleCell;
|
|
8199
|
+
}
|
|
8200
|
+
|
|
8201
|
+
function getRowIndex(startRow, endRow) {
|
|
8202
|
+
var isReverse = startRow > endRow;
|
|
8203
|
+
var startRowIndex = isReverse ? endRow : startRow;
|
|
8204
|
+
var endRowIndex = isReverse ? startRow : endRow;
|
|
8205
|
+
return {
|
|
8206
|
+
startRowIndex: startRowIndex,
|
|
8207
|
+
endRowIndex: endRowIndex
|
|
8208
|
+
};
|
|
8209
|
+
}
|
|
8210
|
+
|
|
8211
|
+
function getFooterRowIndex(footerRowRange) {
|
|
8212
|
+
if (footerRowRange) {
|
|
8213
|
+
return getRowIndex(footerRowRange.startRow, footerRowRange.endRow);
|
|
8214
|
+
}
|
|
8215
|
+
|
|
8216
|
+
return {
|
|
8217
|
+
startRowIndex: -1,
|
|
8218
|
+
endRowIndex: -1
|
|
8219
|
+
};
|
|
8220
|
+
}
|
|
8221
|
+
|
|
8000
8222
|
/***/ }),
|
|
8001
8223
|
|
|
8002
8224
|
/***/ "./components/table/pipeline/features/rowDetail.tsx":
|
|
@@ -8721,6 +8943,10 @@ function singleSelect() {
|
|
|
8721
8943
|
return preCellProps;
|
|
8722
8944
|
},
|
|
8723
8945
|
render: function render(_, row, rowIndex) {
|
|
8946
|
+
if (row[pipeline.getFeatureOptions('footerRowMetaKey')]) {
|
|
8947
|
+
return null;
|
|
8948
|
+
}
|
|
8949
|
+
|
|
8724
8950
|
var rowKey = _internals__WEBPACK_IMPORTED_MODULE_10__["internals"].safeGetRowKey(primaryKey, row, rowIndex);
|
|
8725
8951
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_9___default.a.createElement(Radio, {
|
|
8726
8952
|
checked: value === rowKey,
|
|
@@ -9870,6 +10096,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
9870
10096
|
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_15__);
|
|
9871
10097
|
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../utils */ "./components/table/utils/index.tsx");
|
|
9872
10098
|
/* harmony import */ var _features_autoFill__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./features/autoFill */ "./components/table/pipeline/features/autoFill.tsx");
|
|
10099
|
+
/* harmony import */ var _features_rangeSelection__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./features/rangeSelection */ "./components/table/pipeline/features/rangeSelection.tsx");
|
|
9873
10100
|
|
|
9874
10101
|
|
|
9875
10102
|
|
|
@@ -9894,6 +10121,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
9894
10121
|
|
|
9895
10122
|
|
|
9896
10123
|
|
|
10124
|
+
|
|
9897
10125
|
/**
|
|
9898
10126
|
* 表格数据处理流水线。TablePipeline 提供了表格数据处理过程中的一些上下方与工具方法,包括……
|
|
9899
10127
|
*
|
|
@@ -10174,19 +10402,19 @@ var TablePipeline = /*#__PURE__*/function () {
|
|
|
10174
10402
|
|
|
10175
10403
|
result.setTableDomHelper = function (domHelper) {
|
|
10176
10404
|
_this2.ref.current.domHelper = domHelper;
|
|
10177
|
-
};
|
|
10178
|
-
// result.clearRangeSelectionStatus = () => {
|
|
10179
|
-
// const { rangeSelectedChange } = this.getFeatureOptions(rangeSelectionKey)
|
|
10180
|
-
// const rangeSelection = this.getStateAtKey(rangeSelectionKey)
|
|
10181
|
-
// if (rangeSelection) {
|
|
10182
|
-
// rangeSelectedChange?.(null)
|
|
10183
|
-
// }
|
|
10184
|
-
// }
|
|
10185
|
-
// }
|
|
10186
|
-
|
|
10405
|
+
};
|
|
10187
10406
|
|
|
10188
10407
|
return result;
|
|
10189
10408
|
}
|
|
10409
|
+
/**
|
|
10410
|
+
* 清除范围选中内容
|
|
10411
|
+
*/
|
|
10412
|
+
|
|
10413
|
+
}, {
|
|
10414
|
+
key: "clearRangeSelection",
|
|
10415
|
+
value: function clearRangeSelection() {
|
|
10416
|
+
this.setStateAtKey(_features_rangeSelection__WEBPACK_IMPORTED_MODULE_18__["rangeSelectionKey"], null);
|
|
10417
|
+
}
|
|
10190
10418
|
}]);
|
|
10191
10419
|
|
|
10192
10420
|
return TablePipeline;
|