@kdcloudjs/table 1.1.6-canary.4 → 1.2.0-canary.1

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * @kdcloudjs/table v1.1.6-canary.3
3
+ * @kdcloudjs/table v1.1.6-canary.4
4
4
  *
5
5
  * Copyright 2020-present, Kingdee, Inc.
6
6
  * All rights reserved.
@@ -8252,7 +8252,7 @@ function multiSelect() {
8252
8252
  /*!***************************************************************!*\
8253
8253
  !*** ./components/table/pipeline/features/rangeSelection.tsx ***!
8254
8254
  \***************************************************************/
8255
- /*! exports provided: rangeSelectionKey, lastClickCellKey, rangeSelection */
8255
+ /*! exports provided: rangeSelectionKey, lastClickCellKey, rangeSelection, getCellRangeId */
8256
8256
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
8257
8257
 
8258
8258
  "use strict";
@@ -8260,38 +8260,40 @@ __webpack_require__.r(__webpack_exports__);
8260
8260
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rangeSelectionKey", function() { return rangeSelectionKey; });
8261
8261
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "lastClickCellKey", function() { return lastClickCellKey; });
8262
8262
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rangeSelection", function() { return rangeSelection; });
8263
+ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCellRangeId", function() { return getCellRangeId; });
8263
8264
  /* 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");
8264
8265
  /* 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__);
8265
8266
  /* 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");
8266
8267
  /* 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__);
8267
- /* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.array.filter.js */ "./node_modules/core-js/modules/es.array.filter.js");
8268
- /* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_2__);
8269
- /* 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");
8270
- /* 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__);
8271
- /* harmony import */ var core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ "./node_modules/core-js/modules/es.object.get-own-property-descriptor.js");
8272
- /* harmony import */ var core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_4__);
8273
- /* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ "./node_modules/core-js/modules/web.dom-collections.for-each.js");
8274
- /* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_5__);
8275
- /* harmony import */ var core_js_modules_es_object_get_own_property_descriptors_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptors.js */ "./node_modules/core-js/modules/es.object.get-own-property-descriptors.js");
8276
- /* harmony import */ var core_js_modules_es_object_get_own_property_descriptors_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_own_property_descriptors_js__WEBPACK_IMPORTED_MODULE_6__);
8277
- /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
8278
- /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_7__);
8279
- /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js");
8280
- /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8__);
8281
- /* harmony import */ var core_js_modules_es_array_find_index_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! core-js/modules/es.array.find-index.js */ "./node_modules/core-js/modules/es.array.find-index.js");
8282
- /* harmony import */ var core_js_modules_es_array_find_index_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_find_index_js__WEBPACK_IMPORTED_MODULE_9__);
8283
- /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! core-js/modules/es.array.slice.js */ "./node_modules/core-js/modules/es.array.slice.js");
8284
- /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_10__);
8285
- /* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! core-js/modules/es.array.includes.js */ "./node_modules/core-js/modules/es.array.includes.js");
8286
- /* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_11__);
8287
- /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../../utils */ "./components/table/utils/index.tsx");
8288
- /* harmony import */ var _utils_others__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../utils/others */ "./components/table/utils/others.ts");
8289
- /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js");
8290
- /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js");
8291
- /* harmony import */ var _base_styles__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../../base/styles */ "./components/table/base/styles.ts");
8292
- /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js");
8293
- /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_17__);
8294
-
8268
+ /* harmony import */ var core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ "./node_modules/core-js/modules/es.object.get-own-property-descriptor.js");
8269
+ /* harmony import */ var core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_2__);
8270
+ /* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ "./node_modules/core-js/modules/web.dom-collections.for-each.js");
8271
+ /* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_3__);
8272
+ /* harmony import */ var core_js_modules_es_object_get_own_property_descriptors_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptors.js */ "./node_modules/core-js/modules/es.object.get-own-property-descriptors.js");
8273
+ /* harmony import */ var core_js_modules_es_object_get_own_property_descriptors_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_own_property_descriptors_js__WEBPACK_IMPORTED_MODULE_4__);
8274
+ /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
8275
+ /* harmony import */ var _babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_5__);
8276
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/defineProperty.js");
8277
+ /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6__);
8278
+ /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! @babel/runtime/helpers/toConsumableArray */ "./node_modules/@babel/runtime/helpers/toConsumableArray.js");
8279
+ /* harmony import */ var _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_7__);
8280
+ /* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! core-js/modules/es.array.filter.js */ "./node_modules/core-js/modules/es.array.filter.js");
8281
+ /* harmony import */ var core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_filter_js__WEBPACK_IMPORTED_MODULE_8__);
8282
+ /* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ "./node_modules/core-js/modules/es.object.to-string.js");
8283
+ /* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_9___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_9__);
8284
+ /* harmony import */ var core_js_modules_es_array_find_index_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! core-js/modules/es.array.find-index.js */ "./node_modules/core-js/modules/es.array.find-index.js");
8285
+ /* harmony import */ var core_js_modules_es_array_find_index_js__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_find_index_js__WEBPACK_IMPORTED_MODULE_10__);
8286
+ /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! core-js/modules/es.array.slice.js */ "./node_modules/core-js/modules/es.array.slice.js");
8287
+ /* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_11__);
8288
+ /* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! core-js/modules/es.array.includes.js */ "./node_modules/core-js/modules/es.array.includes.js");
8289
+ /* harmony import */ var core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_includes_js__WEBPACK_IMPORTED_MODULE_12__);
8290
+ /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../../utils */ "./components/table/utils/index.tsx");
8291
+ /* harmony import */ var _utils_others__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../../utils/others */ "./components/table/utils/others.ts");
8292
+ /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js");
8293
+ /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js");
8294
+ /* harmony import */ var _base_styles__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../../base/styles */ "./components/table/base/styles.ts");
8295
+ /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! classnames */ "./node_modules/classnames/index.js");
8296
+ /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_18__);
8295
8297
 
8296
8298
 
8297
8299
 
@@ -8303,7 +8305,9 @@ __webpack_require__.r(__webpack_exports__);
8303
8305
 
8304
8306
  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; }
8305
8307
 
8306
- 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_8___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; }
8308
+ 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_6___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; }
8309
+
8310
+
8307
8311
 
8308
8312
 
8309
8313
 
@@ -8316,9 +8320,10 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
8316
8320
 
8317
8321
  var rangeSelectionKey = 'rangeSelection';
8318
8322
  var lastClickCellKey = 'lastClickCell';
8323
+ var startSelectedCellRangesKey = 'startSelectedCellRanges';
8324
+ var SCROLL_OFFSET = 30;
8319
8325
  function rangeSelection(opts) {
8320
8326
  return function step(pipeline) {
8321
- var SCROLL_SIZE = 30;
8322
8327
  var tableBody = pipeline.ref.current.domHelper && pipeline.ref.current.domHelper.tableBody;
8323
8328
  var tableFooter = pipeline.ref.current.domHelper && pipeline.ref.current.domHelper.tableFooter;
8324
8329
  var artTable = pipeline.ref.current.domHelper && pipeline.ref.current.domHelper.artTable;
@@ -8330,14 +8335,18 @@ function rangeSelection(opts) {
8330
8335
  var columns = pipeline.getColumns();
8331
8336
  var dataSource = pipeline.getDataSource();
8332
8337
 
8333
- var rangeSelectedChange = function rangeSelectedChange(rangeSelection) {
8338
+ var rangeSelectedChange = function rangeSelectedChange(rangeSelection, isFinished) {
8334
8339
  var _opts$rangeSelectedCh;
8335
8340
 
8341
+ if (isFinished) {
8342
+ pipeline.setFeatureOptions(startSelectedCellRangesKey, rangeSelection);
8343
+ }
8344
+
8336
8345
  pipeline.setStateAtKey(rangeSelectionKey, rangeSelection);
8337
- opts === null || opts === void 0 ? void 0 : (_opts$rangeSelectedCh = opts.rangeSelectedChange) === null || _opts$rangeSelectedCh === void 0 ? void 0 : _opts$rangeSelectedCh.call(opts, rangeSelection);
8346
+ opts === null || opts === void 0 ? void 0 : (_opts$rangeSelectedCh = opts.rangeSelectedChange) === null || _opts$rangeSelectedCh === void 0 ? void 0 : _opts$rangeSelectedCh.call(opts, rangeSelection, isFinished);
8338
8347
  };
8339
8348
 
8340
- var setRangeSelection = function setRangeSelection(startDragCell, draggingCell) {
8349
+ var setRangeSelection = function setRangeSelection(startDragCell, draggingCell, isFinished) {
8341
8350
  if (!startDragCell || !draggingCell) return;
8342
8351
  var rangeColumns = getRangeColumns(startDragCell, draggingCell, columns);
8343
8352
 
@@ -8346,21 +8355,31 @@ function rangeSelection(opts) {
8346
8355
  endRow = _getRangeSelectionRow.endRow,
8347
8356
  footerRowRange = _getRangeSelectionRow.footerRowRange;
8348
8357
 
8349
- var rangeSelection = {
8358
+ var cellRange = {
8350
8359
  startRow: startRow,
8351
8360
  endRow: endRow,
8352
8361
  columns: rangeColumns,
8353
8362
  startColumn: startDragCell.column,
8354
8363
  footerRowRange: footerRowRange
8355
8364
  };
8365
+ var cellRanges = pipeline.getFeatureOptions(startSelectedCellRangesKey) ? _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_7___default()(pipeline.getFeatureOptions(startSelectedCellRangesKey)) : [];
8366
+
8367
+ if (isCellRangeSingleCell([cellRange])) {
8368
+ var singleCellRangeId = getCellRangeId(cellRange);
8369
+ cellRanges = cellRanges.filter(function (item) {
8370
+ return getCellRangeId(item) !== singleCellRangeId;
8371
+ });
8372
+ }
8373
+
8374
+ cellRanges.push(cellRange);
8356
8375
 
8357
- if (isCellRangeSingleCell(rangeSelection)) {
8358
- artTable.classList.remove(classnames__WEBPACK_IMPORTED_MODULE_17___default()(_base_styles__WEBPACK_IMPORTED_MODULE_16__["Classes"].rangeSelection));
8376
+ if (isCellRangeSingleCell(cellRanges)) {
8377
+ artTable.classList.remove(classnames__WEBPACK_IMPORTED_MODULE_18___default()(_base_styles__WEBPACK_IMPORTED_MODULE_17__["Classes"].rangeSelection));
8359
8378
  } else {
8360
- artTable.classList.add(classnames__WEBPACK_IMPORTED_MODULE_17___default()(_base_styles__WEBPACK_IMPORTED_MODULE_16__["Classes"].rangeSelection));
8379
+ artTable.classList.add(classnames__WEBPACK_IMPORTED_MODULE_18___default()(_base_styles__WEBPACK_IMPORTED_MODULE_17__["Classes"].rangeSelection));
8361
8380
  }
8362
8381
 
8363
- rangeSelectedChange(rangeSelection);
8382
+ rangeSelectedChange(cellRanges, isFinished);
8364
8383
  };
8365
8384
 
8366
8385
  var shiftKeySelect = function shiftKeySelect(event) {
@@ -8368,81 +8387,117 @@ function rangeSelection(opts) {
8368
8387
  var clickCell = getTargetCell(target, columns);
8369
8388
 
8370
8389
  if (clickCell) {
8371
- if (event.shiftKey) {
8372
- var _lastClickCell = pipeline.getFeatureOptions(lastClickCellKey);
8390
+ var _lastClickCell = pipeline.getFeatureOptions(lastClickCellKey);
8373
8391
 
8374
- if (_lastClickCell) {
8375
- setRangeSelection(_lastClickCell, clickCell);
8376
- } else {
8377
- // 第一次进来就按住shift键,这时候要记住点击的单元格
8378
- pipeline.setFeatureOptions(lastClickCellKey, clickCell);
8379
- }
8392
+ if (_lastClickCell) {
8393
+ setRangeSelection(_lastClickCell, clickCell, true);
8380
8394
  } else {
8395
+ // 第一次进来就按住shift键,这时候要记住点击的单元格
8381
8396
  pipeline.setFeatureOptions(lastClickCellKey, clickCell);
8382
- setRangeSelection(clickCell, clickCell);
8383
8397
  }
8384
8398
  }
8385
8399
  };
8386
8400
 
8387
- var onMouseDown = function onMouseDown(mouseDownEvent) {
8388
- if (mouseDownEvent.button !== 0 || !(Object(_utils__WEBPACK_IMPORTED_MODULE_12__["isElementInEventPath"])(tableBody, mouseDownEvent.nativeEvent) || Object(_utils__WEBPACK_IMPORTED_MODULE_12__["isElementInEventPath"])(tableFooter, mouseDownEvent.nativeEvent))) return; // mouseDownEvent.preventDefault()
8389
- // shift + 点击选中
8390
-
8391
- shiftKeySelect(mouseDownEvent);
8392
- if (mouseDownEvent.shiftKey) return;
8393
- var target = mouseDownEvent.target;
8394
- var startDragCell = getTargetCell(target, columns);
8395
- var mousemove$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_14__["fromEvent"])(window, 'mousemove');
8396
- var mouseup$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_14__["fromEvent"])(window, 'mouseup');
8401
+ var updateScrollPosition = function updateScrollPosition(client) {
8402
+ var clientX = client.clientX,
8403
+ clientY = client.clientY;
8397
8404
  var tableBodyClientRect = tableBody.getBoundingClientRect();
8405
+ var left = tableBodyClientRect.left,
8406
+ top = tableBodyClientRect.top,
8407
+ height = tableBodyClientRect.height,
8408
+ width = tableBodyClientRect.width;
8398
8409
 
8399
- var updateScrollPosition = function updateScrollPosition(client) {
8400
- var clientX = client.clientX,
8401
- clientY = client.clientY;
8402
- var left = tableBodyClientRect.left,
8403
- top = tableBodyClientRect.top,
8404
- height = tableBodyClientRect.height,
8405
- width = tableBodyClientRect.width;
8410
+ if (clientX + SCROLL_OFFSET >= left + width) {
8411
+ pipeline.ref.current.domHelper.virtual.scrollLeft += SCROLL_OFFSET;
8412
+ }
8406
8413
 
8407
- if (clientX + SCROLL_SIZE >= left + width) {
8408
- pipeline.ref.current.domHelper.virtual.scrollLeft += SCROLL_SIZE;
8409
- }
8414
+ if (clientX - SCROLL_OFFSET <= left) {
8415
+ pipeline.ref.current.domHelper.virtual.scrollLeft -= SCROLL_OFFSET;
8416
+ }
8410
8417
 
8411
- if (clientX - SCROLL_SIZE <= left) {
8412
- pipeline.ref.current.domHelper.virtual.scrollLeft -= SCROLL_SIZE;
8413
- }
8418
+ if (clientY + SCROLL_OFFSET >= top + height) {
8419
+ pipeline.ref.current.domHelper.tableBody.scrollTop += SCROLL_OFFSET;
8420
+ }
8414
8421
 
8415
- if (clientY + SCROLL_SIZE >= top + height) {
8416
- pipeline.ref.current.domHelper.tableBody.scrollTop += SCROLL_SIZE;
8417
- }
8422
+ if (clientY + SCROLL_OFFSET <= top) {
8423
+ pipeline.ref.current.domHelper.tableBody.scrollTop -= SCROLL_OFFSET;
8424
+ }
8425
+ };
8418
8426
 
8419
- if (clientY + SCROLL_SIZE <= top) {
8420
- pipeline.ref.current.domHelper.tableBody.scrollTop -= SCROLL_SIZE;
8421
- }
8422
- };
8427
+ var setStartSelectedCellRanges = function setStartSelectedCellRanges(isCtrlKey, isShiftKey) {
8428
+ if (opts !== null && opts !== void 0 && opts.suppressMultiRangeSelection) {
8429
+ pipeline.setFeatureOptions(startSelectedCellRangesKey, []);
8430
+ return;
8431
+ } // ctrl 和shift 同时按时,优先生效shift
8432
+ // 没有点击ctrl 或者shift时,每次点击开始时都清空选中范围
8433
+
8434
+
8435
+ if (!isCtrlKey && !isShiftKey) {
8436
+ pipeline.setFeatureOptions(startSelectedCellRangesKey, []);
8437
+ } // shift 点击框选,要保留之前的选中结果。最新的框选范围覆盖最后一次的框选范围
8438
+
8439
+
8440
+ if (isShiftKey) {
8441
+ var _startDragCellRanges = pipeline.getFeatureOptions(startSelectedCellRangesKey) ? _babel_runtime_helpers_toConsumableArray__WEBPACK_IMPORTED_MODULE_7___default()(pipeline.getFeatureOptions(startSelectedCellRangesKey)) : [];
8442
+
8443
+ _startDragCellRanges.pop();
8444
+
8445
+ pipeline.setFeatureOptions(startSelectedCellRangesKey, _startDragCellRanges);
8446
+ }
8447
+ };
8448
+
8449
+ var onMouseDown = function onMouseDown(mouseDownEvent) {
8450
+ if (mouseDownEvent.button !== 0 || !(Object(_utils__WEBPACK_IMPORTED_MODULE_13__["isElementInEventPath"])(tableBody, mouseDownEvent.nativeEvent) || Object(_utils__WEBPACK_IMPORTED_MODULE_13__["isElementInEventPath"])(tableFooter, mouseDownEvent.nativeEvent))) return; // mouseDownEvent.preventDefault()
8451
+
8452
+ var isCtrlKey = mouseDownEvent.ctrlKey || mouseDownEvent.metaKey;
8453
+ var isShiftKey = mouseDownEvent.shiftKey;
8454
+ var target = mouseDownEvent.target; // 每次点击时先确认初始生效的框选范围
8455
+
8456
+ setStartSelectedCellRanges(isCtrlKey, isShiftKey);
8457
+
8458
+ if (isShiftKey) {
8459
+ shiftKeySelect(mouseDownEvent);
8460
+ return;
8461
+ }
8462
+
8463
+ var startDragCell = getTargetCell(target, columns);
8464
+ pipeline.setFeatureOptions(lastClickCellKey, startDragCell);
8465
+ var draggingCell = startDragCell;
8466
+ var mousemove$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_15__["fromEvent"])(window, 'mousemove');
8467
+ var mouseup$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_15__["fromEvent"])(window, 'mouseup');
8468
+ var rangeSelected$ = mousemove$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_16__["map"])(function (mouseMoveEvent) {
8469
+ var _draggingCell;
8423
8470
 
8424
- var rangeSelected$ = mousemove$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_15__["map"])(function (mouseMoveEvent) {
8425
8471
  var target = mouseMoveEvent.target || mouseMoveEvent.srcElement;
8426
- var draggingCell = getTargetCell(target, columns);
8472
+ draggingCell = getTargetCell(target, columns);
8427
8473
  var client = {
8428
8474
  clientX: mouseMoveEvent.clientX,
8429
8475
  clientY: mouseMoveEvent.clientY
8430
8476
  };
8431
- updateScrollPosition(client);
8477
+
8478
+ if (!((_draggingCell = draggingCell) !== null && _draggingCell !== void 0 && _draggingCell.isFooterCell)) {
8479
+ updateScrollPosition(client);
8480
+ }
8481
+
8432
8482
  return {
8433
8483
  startDragCell: startDragCell,
8434
8484
  draggingCell: draggingCell
8435
8485
  };
8436
- }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_15__["takeUntil"])(mouseup$));
8437
- rangeSelected$.subscribe(function (_ref) {
8438
- var startDragCell = _ref.startDragCell,
8439
- draggingCell = _ref.draggingCell;
8440
- setRangeSelection(startDragCell, draggingCell);
8486
+ }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_16__["takeUntil"])(mouseup$));
8487
+ rangeSelected$.subscribe({
8488
+ next: function next(_ref) {
8489
+ var startDragCell = _ref.startDragCell,
8490
+ draggingCell = _ref.draggingCell;
8491
+ setRangeSelection(startDragCell, draggingCell, false);
8492
+ },
8493
+ complete: function complete() {
8494
+ setRangeSelection(startDragCell, draggingCell, true);
8495
+ }
8441
8496
  });
8442
8497
  };
8443
8498
 
8444
8499
  var onKeyDown = function onKeyDown(e) {
8445
- if (!(Object(_utils__WEBPACK_IMPORTED_MODULE_12__["isElementInEventPath"])(tableBody, e.nativeEvent) || Object(_utils__WEBPACK_IMPORTED_MODULE_12__["isElementInEventPath"])(tableFooter, e.nativeEvent))) return;
8500
+ if (!(Object(_utils__WEBPACK_IMPORTED_MODULE_13__["isElementInEventPath"])(tableBody, e.nativeEvent) || Object(_utils__WEBPACK_IMPORTED_MODULE_13__["isElementInEventPath"])(tableFooter, e.nativeEvent))) return;
8446
8501
 
8447
8502
  if ((e.ctrlKey || e.metaKey) && e.key === 'a') {
8448
8503
  var rowLen = pipeline.getDataSource().length;
@@ -8450,17 +8505,17 @@ function rangeSelection(opts) {
8450
8505
 
8451
8506
  if (columns.length && rowLen && !getElementEditable(e.target)) {
8452
8507
  opts.preventkDefaultOfKeyDownEvent !== false && e.preventDefault();
8453
- artTable.classList.add(classnames__WEBPACK_IMPORTED_MODULE_17___default()(_base_styles__WEBPACK_IMPORTED_MODULE_16__["Classes"].rangeSelection));
8454
- rangeSelectedChange({
8508
+ artTable.classList.add(classnames__WEBPACK_IMPORTED_MODULE_18___default()(_base_styles__WEBPACK_IMPORTED_MODULE_17__["Classes"].rangeSelection));
8509
+ rangeSelectedChange([{
8455
8510
  startRow: 0,
8456
8511
  endRow: rowLen - 1,
8457
- columns: Object(_utils__WEBPACK_IMPORTED_MODULE_12__["collectNodes"])(columns, 'leaf-only'),
8512
+ columns: Object(_utils__WEBPACK_IMPORTED_MODULE_13__["collectNodes"])(columns, 'leaf-only'),
8458
8513
  startColumn: columns[0],
8459
8514
  footerRowRange: footerDataSource.length > 0 ? {
8460
8515
  startRow: 0,
8461
8516
  endRow: footerDataSource.length - 1
8462
8517
  } : null
8463
- });
8518
+ }], true);
8464
8519
  }
8465
8520
  }
8466
8521
  };
@@ -8469,44 +8524,26 @@ function rangeSelection(opts) {
8469
8524
  onMouseDown: onMouseDown,
8470
8525
  onKeyDown: onKeyDown,
8471
8526
  tabIndex: -1,
8472
- className: classnames__WEBPACK_IMPORTED_MODULE_17___default()([_base_styles__WEBPACK_IMPORTED_MODULE_16__["Classes"].rangeSelection])
8527
+ className: classnames__WEBPACK_IMPORTED_MODULE_18___default()([_base_styles__WEBPACK_IMPORTED_MODULE_17__["Classes"].rangeSelection])
8473
8528
  }); // todo: 后面可以把mousedown放到一个流里面
8474
8529
 
8475
- return pipeline.mapColumns(Object(_utils__WEBPACK_IMPORTED_MODULE_12__["makeRecursiveMapper"])(function (col) {
8476
- var rangeSelection = pipeline.getStateAtKey(rangeSelectionKey);
8477
- if (!rangeSelection || rangeSelection.columns.findIndex(function (selectedCol) {
8478
- return selectedCol.code === col.code;
8479
- }) === -1) return col;
8530
+ return pipeline.mapColumns(Object(_utils__WEBPACK_IMPORTED_MODULE_13__["makeRecursiveMapper"])(function (col) {
8531
+ var cellRanges = pipeline.getStateAtKey(rangeSelectionKey) || [];
8480
8532
  var prevGetCellProps = col.getCellProps;
8481
8533
  return _objectSpread(_objectSpread({}, col), {}, {
8482
8534
  getCellProps: function getCellProps(value, record, rowIndex) {
8483
- var _cx;
8484
-
8485
8535
  var prevCellProps = prevGetCellProps === null || prevGetCellProps === void 0 ? void 0 : prevGetCellProps(value, record, rowIndex);
8486
- var isInFooter = record[pipeline.getFeatureOptions('footerRowMetaKey')];
8487
- var startRow = rangeSelection.startRow,
8488
- endRow = rangeSelection.endRow,
8489
- columns = rangeSelection.columns,
8490
- footerRowRange = rangeSelection.footerRowRange;
8491
-
8492
- var _getRowIndex = getRowIndex(startRow, endRow),
8493
- startRowIndex = _getRowIndex.startRowIndex,
8494
- endRowIndex = _getRowIndex.endRowIndex;
8495
-
8496
- var _getFooterRowIndex = getFooterRowIndex(footerRowRange),
8497
- footerStartRowIndex = _getFooterRowIndex.startRowIndex,
8498
- footerEndRowIndex = _getFooterRowIndex.endRowIndex;
8499
-
8500
- var startCol = columns[0];
8501
- var endCol = columns[columns.length - 1];
8502
- var bodyMatch = !isInFooter && rowIndex >= startRowIndex && rowIndex <= endRowIndex;
8503
- var footerMatch = isInFooter && footerRowRange && rowIndex >= footerStartRowIndex && rowIndex <= footerEndRowIndex;
8504
- var match = footerMatch || bodyMatch;
8505
- var matchSingleCell = match && isCellRangeSingleCell(rangeSelection); // 单个范围选中单元格不显示样式
8506
-
8507
- var showCellRangeStyle = match && !matchSingleCell;
8508
- var className = classnames__WEBPACK_IMPORTED_MODULE_17___default()((_cx = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_16__["Classes"].tableCellRangeSingleCell, matchSingleCell), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_16__["Classes"].tableCellRangeSelected, showCellRangeStyle), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_16__["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_16__["Classes"].tableCellRangeLeft, showCellRangeStyle && col.code === startCol.code), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_8___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_16__["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_16__["Classes"].tableCellRangeRight, showCellRangeStyle && col.code === endCol.code), _cx));
8509
- return Object(_utils__WEBPACK_IMPORTED_MODULE_12__["mergeCellProps"])(prevCellProps, {
8536
+ var isFooterCell = record[pipeline.getFeatureOptions('footerRowMetaKey')];
8537
+ if (!cellRanges.some(function (cellRange) {
8538
+ return isCellInRange(cellRange, rowIndex, col, isFooterCell);
8539
+ })) return prevCellProps;
8540
+ var className = getCellRangesClassName(cellRanges, {
8541
+ isFooterCell: isFooterCell,
8542
+ rowIndex: rowIndex,
8543
+ col: col,
8544
+ record: record
8545
+ });
8546
+ return Object(_utils__WEBPACK_IMPORTED_MODULE_13__["mergeCellProps"])(prevCellProps, {
8510
8547
  className: className
8511
8548
  });
8512
8549
  }
@@ -8520,7 +8557,7 @@ function getTargetCell(target, columns) {
8520
8557
  if (target.getAttribute('data-role') === 'table-cell') {
8521
8558
  var _ret = function () {
8522
8559
  var columnCode = target.getAttribute('data-code');
8523
- var column = Object(_utils_others__WEBPACK_IMPORTED_MODULE_13__["findByTree"])(columns, function (item, index) {
8560
+ var column = Object(_utils_others__WEBPACK_IMPORTED_MODULE_14__["findByTree"])(columns, function (item, index) {
8524
8561
  return item.code === columnCode;
8525
8562
  });
8526
8563
  if (!column) return {
@@ -8532,12 +8569,12 @@ function getTargetCell(target, columns) {
8532
8569
  rowSpan: parseInt(target.getAttribute('rowspan') || 1),
8533
8570
  code: columnCode,
8534
8571
  column: column,
8535
- isInFooter: isEleInFooter(target)
8572
+ isFooterCell: isEleInFooter(target)
8536
8573
  }
8537
8574
  };
8538
8575
  }();
8539
8576
 
8540
- if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_7___default()(_ret) === "object") return _ret.v;
8577
+ if (_babel_runtime_helpers_typeof__WEBPACK_IMPORTED_MODULE_5___default()(_ret) === "object") return _ret.v;
8541
8578
  }
8542
8579
 
8543
8580
  target = target.parentElement;
@@ -8547,12 +8584,12 @@ function getTargetCell(target, columns) {
8547
8584
  }
8548
8585
 
8549
8586
  function isSameCell(cell1, cell2) {
8550
- return cell1.rowIndex === cell2.rowIndex && cell1.code === cell2.code && cell1.isInFooter === cell2.isInFooter;
8587
+ return cell1.rowIndex === cell2.rowIndex && cell1.code === cell2.code && cell1.isFooterCell === cell2.isFooterCell;
8551
8588
  }
8552
8589
 
8553
8590
  function isEleInFooter(target) {
8554
- while (target && !target.classList.contains(_base_styles__WEBPACK_IMPORTED_MODULE_16__["Classes"].artTable)) {
8555
- if (target.classList.contains(_base_styles__WEBPACK_IMPORTED_MODULE_16__["Classes"].tableFooter)) {
8591
+ while (target && !target.classList.contains(_base_styles__WEBPACK_IMPORTED_MODULE_17__["Classes"].artTable)) {
8592
+ if (target.classList.contains(_base_styles__WEBPACK_IMPORTED_MODULE_17__["Classes"].tableFooter)) {
8556
8593
  return true;
8557
8594
  }
8558
8595
 
@@ -8563,7 +8600,7 @@ function isEleInFooter(target) {
8563
8600
  }
8564
8601
 
8565
8602
  function getRangeColumns(startCell, endCell, columns) {
8566
- var flatColumns = Object(_utils__WEBPACK_IMPORTED_MODULE_12__["collectNodes"])(columns, 'leaf-only');
8603
+ var flatColumns = Object(_utils__WEBPACK_IMPORTED_MODULE_13__["collectNodes"])(columns, 'leaf-only');
8567
8604
  var startIndex = flatColumns.findIndex(function (col) {
8568
8605
  return col.code === startCell.code;
8569
8606
  });
@@ -8588,10 +8625,10 @@ function getRangeSelectionRowInfo(startCell, endCell, dataSource) {
8588
8625
  _endRow = _getCellRangeRow.endRow; // 两个单元格都在表体
8589
8626
 
8590
8627
 
8591
- if (!startCell.isInFooter && !endCell.isInFooter) {
8628
+ if (!startCell.isFooterCell && !endCell.isFooterCell) {
8592
8629
  startRow = _startRow;
8593
8630
  endRow = _endRow;
8594
- } else if (startCell.isInFooter && endCell.isInFooter) {
8631
+ } else if (startCell.isFooterCell && endCell.isFooterCell) {
8595
8632
  // 两个单元格都在表底
8596
8633
  footerRowRange = {
8597
8634
  startRow: _startRow,
@@ -8599,7 +8636,7 @@ function getRangeSelectionRowInfo(startCell, endCell, dataSource) {
8599
8636
  };
8600
8637
  } else {
8601
8638
  // 一个单元格在表体,一个在表底
8602
- if (startCell.isInFooter) {
8639
+ if (startCell.isFooterCell) {
8603
8640
  startRow = dataSource.length - 1;
8604
8641
  endRow = endCell.rowIndex;
8605
8642
  footerRowRange = {
@@ -8622,6 +8659,13 @@ function getRangeSelectionRowInfo(startCell, endCell, dataSource) {
8622
8659
  footerRowRange: footerRowRange
8623
8660
  };
8624
8661
  }
8662
+ /**
8663
+ * 获取框选范围的起始结束行
8664
+ * @param startCell 起始单元格
8665
+ * @param endCell 结束单元格
8666
+ * @returns
8667
+ */
8668
+
8625
8669
 
8626
8670
  function getCellRangeRow(startCell, endCell) {
8627
8671
  if (isSameCell(startCell, endCell)) {
@@ -8639,12 +8683,20 @@ function getCellRangeRow(startCell, endCell) {
8639
8683
  endRow: endRow
8640
8684
  };
8641
8685
  }
8686
+ /**
8687
+ * 框选范围是否只包含单个单元格
8688
+ * @param cellRanges
8689
+ * @returns
8690
+ */
8691
+
8642
8692
 
8643
- function isCellRangeSingleCell(rangeSelection) {
8644
- var startRow = rangeSelection.startRow,
8645
- endRow = rangeSelection.endRow,
8646
- columns = rangeSelection.columns,
8647
- footerRowRange = rangeSelection.footerRowRange;
8693
+ function isCellRangeSingleCell(cellRanges) {
8694
+ if (cellRanges.length !== 1) return false;
8695
+ var _cellRanges$ = cellRanges[0],
8696
+ startRow = _cellRanges$.startRow,
8697
+ endRow = _cellRanges$.endRow,
8698
+ columns = _cellRanges$.columns,
8699
+ footerRowRange = _cellRanges$.footerRowRange;
8648
8700
  var isBodySingleCell = !footerRowRange && startRow === endRow && columns.length === 1;
8649
8701
  var isFooterSingleCell = startRow === -1 && footerRowRange.startRow === footerRowRange.endRow && columns.length === 1;
8650
8702
  return isBodySingleCell || isFooterSingleCell;
@@ -8679,6 +8731,134 @@ function getElementEditable(target) {
8679
8731
  return !target.disabled && !target.readOnly;
8680
8732
  }
8681
8733
  }
8734
+ /**
8735
+ * 判断单元格是否在框选范围内
8736
+ * @param cellRange
8737
+ * @param rowIndex
8738
+ * @param col
8739
+ * @param isFooterCell
8740
+ * @returns
8741
+ */
8742
+
8743
+
8744
+ function isCellInRange(cellRange, rowIndex, col, isFooterCell) {
8745
+ var startRow = cellRange.startRow,
8746
+ endRow = cellRange.endRow,
8747
+ columns = cellRange.columns,
8748
+ footerRowRange = cellRange.footerRowRange;
8749
+ var isColInRanges = columns.findIndex(function (item) {
8750
+ return item.code === col.code;
8751
+ }) !== -1;
8752
+ if (!isColInRanges) return false;
8753
+
8754
+ var _getRowIndex = getRowIndex(startRow, endRow),
8755
+ startRowIndex = _getRowIndex.startRowIndex,
8756
+ endRowIndex = _getRowIndex.endRowIndex;
8757
+
8758
+ var _getFooterRowIndex = getFooterRowIndex(footerRowRange),
8759
+ footerStartRowIndex = _getFooterRowIndex.startRowIndex,
8760
+ footerEndRowIndex = _getFooterRowIndex.endRowIndex;
8761
+
8762
+ var bodyMatch = !isFooterCell && rowIndex >= startRowIndex && rowIndex <= endRowIndex;
8763
+ var footerMatch = isFooterCell && footerRowRange && rowIndex >= footerStartRowIndex && rowIndex <= footerEndRowIndex;
8764
+ var isRowInRange = footerMatch || bodyMatch;
8765
+ return isRowInRange;
8766
+ }
8767
+ /**
8768
+ * 获取框选范围唯一标识
8769
+ * @param {*} cellRange
8770
+ * @returns
8771
+ */
8772
+
8773
+
8774
+ function getCellRangeId(cellRange) {
8775
+ var startRow = cellRange.startRow,
8776
+ endRow = cellRange.endRow,
8777
+ footerRowRange = cellRange.footerRowRange,
8778
+ columns = cellRange.columns;
8779
+
8780
+ var _getRowIndex2 = getRowIndex(startRow, endRow),
8781
+ startRowIndex = _getRowIndex2.startRowIndex,
8782
+ endRowIndex = _getRowIndex2.endRowIndex;
8783
+
8784
+ var _getFooterRowIndex2 = getFooterRowIndex(footerRowRange),
8785
+ footerStartRowIndex = _getFooterRowIndex2.startRowIndex,
8786
+ footerEndRowIndex = _getFooterRowIndex2.endRowIndex;
8787
+
8788
+ var firstColId = columns[0].code;
8789
+ var endColId = columns[columns.length - 1].code;
8790
+ return startRowIndex + '_' + endRowIndex + '_' + footerStartRowIndex + '_' + footerEndRowIndex + '_' + firstColId + '_' + endColId;
8791
+ }
8792
+ /**
8793
+ * 获取框选范围中单元格的样式
8794
+ * @param cellRanges
8795
+ * @param param1
8796
+ * @returns
8797
+ */
8798
+
8799
+ function getCellRangesClassName(cellRanges, _ref2) {
8800
+ var _cx;
8801
+
8802
+ var isFooterCell = _ref2.isFooterCell,
8803
+ rowIndex = _ref2.rowIndex,
8804
+ col = _ref2.col,
8805
+ record = _ref2.record;
8806
+
8807
+ var _getMatchBorderStyle = getMatchBorderStyle(cellRanges, {
8808
+ isFooterCell: isFooterCell,
8809
+ rowIndex: rowIndex,
8810
+ col: col,
8811
+ record: record
8812
+ }),
8813
+ matchCellRangeTop = _getMatchBorderStyle.matchCellRangeTop,
8814
+ matchCellRangeLeft = _getMatchBorderStyle.matchCellRangeLeft,
8815
+ matchCellRangeBottom = _getMatchBorderStyle.matchCellRangeBottom,
8816
+ matchCellRangeRight = _getMatchBorderStyle.matchCellRangeRight;
8817
+
8818
+ var isSingleCell = isCellRangeSingleCell(cellRanges);
8819
+ var className = classnames__WEBPACK_IMPORTED_MODULE_18___default()((_cx = {}, _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_17__["Classes"].tableCellRangeSingleCell, isSingleCell), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_17__["Classes"].tableCellRangeSelected, !isSingleCell), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_17__["Classes"].tableCellRangeTop, !isSingleCell && matchCellRangeTop), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_17__["Classes"].tableCellRangeLeft, !isSingleCell && matchCellRangeLeft), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_17__["Classes"].tableCellRangeBottom, !isSingleCell && matchCellRangeBottom), _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_6___default()(_cx, _base_styles__WEBPACK_IMPORTED_MODULE_17__["Classes"].tableCellRangeRight, !isSingleCell && matchCellRangeRight), _cx));
8820
+ return className;
8821
+ }
8822
+
8823
+ function getMatchBorderStyle(cellRanges, _ref3) {
8824
+ var isFooterCell = _ref3.isFooterCell,
8825
+ rowIndex = _ref3.rowIndex,
8826
+ col = _ref3.col,
8827
+ record = _ref3.record;
8828
+ return cellRanges.reduce(function (obj, cellRange) {
8829
+ if (!isCellInRange(cellRange, rowIndex, col, isFooterCell)) return obj;
8830
+ var startRow = cellRange.startRow,
8831
+ endRow = cellRange.endRow,
8832
+ columns = cellRange.columns,
8833
+ footerRowRange = cellRange.footerRowRange;
8834
+
8835
+ var _getRowIndex3 = getRowIndex(startRow, endRow),
8836
+ startRowIndex = _getRowIndex3.startRowIndex,
8837
+ endRowIndex = _getRowIndex3.endRowIndex;
8838
+
8839
+ var _getFooterRowIndex3 = getFooterRowIndex(footerRowRange),
8840
+ footerStartRowIndex = _getFooterRowIndex3.startRowIndex,
8841
+ footerEndRowIndex = _getFooterRowIndex3.endRowIndex;
8842
+
8843
+ var startCol = columns[0];
8844
+ var endCol = columns[columns.length - 1];
8845
+ var matchCellRangeTop = isFooterCell ? startRowIndex !== -1 ? false : rowIndex === footerStartRowIndex : rowIndex === startRowIndex;
8846
+ var matchCellRangeLeft = col.code === startCol.code;
8847
+ var matchCellRangeBottom = isFooterCell ? rowIndex === footerEndRowIndex : footerRowRange ? false : rowIndex === endRowIndex;
8848
+ var matchCellRangeRight = col.code === endCol.code; // 如果样式已经匹配上了,就不需要再取计算的样式
8849
+
8850
+ obj.matchCellRangeTop = obj.matchCellRangeTop || matchCellRangeTop;
8851
+ obj.matchCellRangeLeft = obj.matchCellRangeLeft || matchCellRangeLeft;
8852
+ obj.matchCellRangeBottom = obj.matchCellRangeBottom || matchCellRangeBottom;
8853
+ obj.matchCellRangeRight = obj.matchCellRangeRight || matchCellRangeRight;
8854
+ return obj;
8855
+ }, {
8856
+ matchCellRangeTop: false,
8857
+ matchCellRangeLeft: false,
8858
+ matchCellRangeBottom: false,
8859
+ matchCellRangeRight: false
8860
+ });
8861
+ }
8682
8862
 
8683
8863
  /***/ }),
8684
8864