canvas-datagrid 0.3.12 → 0.3.17

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.
@@ -1016,7 +1016,7 @@ __webpack_require__.r(__webpack_exports__);
1016
1016
 
1017
1017
  /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(self) {
1018
1018
  self.defaults = {
1019
- attributes: [['allowColumnReordering', true], ['allowColumnResize', true], ['allowColumnResizeFromCell', false], ['allowFreezingRows', false], ['allowFreezingColumns', false], ['allowMovingSelection', true], ['allowRowHeaderResize', true], ['allowRowReordering', false], ['allowRowResize', true], ['allowRowResizeFromCell', false], ['allowSorting', true], ['autoGenerateSchema', false], ['autoResizeColumns', false], ['autoResizeRows', false], ['autoScrollOnMousemove', false], ['autoScrollMargin', 5], ['blanksText', '(Blanks)'], ['borderDragBehavior', 'none'], ['borderResizeZone', 10], ['clearSettingsOptionText', 'Clear saved settings'], ['columnHeaderClickBehavior', 'sort'], ['columnSelectorHiddenText', '   '], ['columnSelectorText', 'Add/Remove columns'], ['columnSelectorVisibleText', "\u2713"], ['contextHoverScrollAmount', 2], ['contextHoverScrollRateMs', 5], ['copyHeadersOnSelectAll', true], ['copyText', 'Copy'], ['debug', false], ['editable', true], ['ellipsisText', '...'], ['filterOptionText', 'Filter %s'], ['filterTextPrefix', '(filtered) '], ['filterFrozenRows', true], ['globalRowResize', false], ['hideColumnText', 'Hide %s'], ['hoverMode', 'cell'], ['maxAutoCompleteItems', 200], ['multiLine', false], ['name', ''], ['pageUpDownOverlap', 1], ['pasteText', 'Paste'], ['persistantSelectionMode', false], ['removeFilterOptionText', 'Remove filter on %s'], ['reorderDeadZone', 3], ['resizeScrollZone', 20], ['rowGrabZoneSize', 5], ['saveAppearance', true], ['scrollAnimationPPSThreshold', 0.75], ['scrollPointerLock', false], ['scrollRepeatRate', 75], ['selectionFollowsActiveCell', false], ['selectionHandleBehavior', 'none'], ['selectionMode', 'cell'], ['selectionScrollIncrement', 20], ['selectionScrollZone', 20], ['showClearSettingsOption', true], ['showColumnHeaders', true], ['showColumnSelector', true], ['showCopy', false], ['showFilter', true], ['showNewRow', false], ['showOrderByOption', true], ['showOrderByOptionTextAsc', 'Order by %s ascending'], ['showOrderByOptionTextDesc', 'Order by %s descending'], ['showPaste', false], ['showPerformance', false], ['showRowHeaders', true], ['showRowNumbers', true], ['showRowNumberGaps', true], ['singleSelectionMode', false], ['snapToRow', false], ['sortFrozenRows', true], ['touchContextMenuTimeMs', 800], ['touchDeadZone', 3], ['touchEasingMethod', 'easeOutQuad'], ['touchReleaseAcceleration', 1000], ['touchReleaseAnimationDurationMs', 2000], ['touchScrollZone', 20], ['touchSelectHandleZone', 20], ['touchZoomSensitivity', 0.005], ['touchZoomMin', 0.5], ['touchZoomMax', 1.75], ['maxPixelRatio', 2], ['tree', false], ['treeHorizontalScroll', false]],
1019
+ attributes: [['allowColumnReordering', true], ['allowColumnResize', true], ['allowColumnResizeFromCell', false], ['allowFreezingRows', false], ['allowFreezingColumns', false], ['allowMovingSelection', true], ['allowRowHeaderResize', true], ['allowRowReordering', false], ['allowRowResize', true], ['allowRowResizeFromCell', false], ['allowSorting', true], ['autoGenerateSchema', false], ['autoResizeColumns', false], ['autoResizeRows', false], ['autoScrollOnMousemove', false], ['autoScrollMargin', 5], ['blanksText', '(Blanks)'], ['borderDragBehavior', 'none'], ['borderResizeZone', 10], ['clearSettingsOptionText', 'Clear saved settings'], ['columnHeaderClickBehavior', 'sort'], ['columnSelectorHiddenText', '   '], ['columnSelectorText', 'Add/Remove columns'], ['columnSelectorVisibleText', "\u2713"], ['contextHoverScrollAmount', 2], ['contextHoverScrollRateMs', 5], ['copyHeadersOnSelectAll', true], ['copyText', 'Copy'], ['debug', false], ['editable', true], ['ellipsisText', '...'], ['filterOptionText', 'Filter %s'], ['filterTextPrefix', '(filtered) '], ['filterFrozenRows', true], ['globalRowResize', false], ['hideColumnText', 'Hide %s'], ['hoverMode', 'cell'], ['keepFocusOnMouseOut', false], ['maxAutoCompleteItems', 200], ['multiLine', false], ['name', ''], ['pageUpDownOverlap', 1], ['pasteText', 'Paste'], ['persistantSelectionMode', false], ['removeFilterOptionText', 'Remove filter on %s'], ['reorderDeadZone', 3], ['resizeScrollZone', 20], ['rowGrabZoneSize', 5], ['saveAppearance', true], ['scrollAnimationPPSThreshold', 0.75], ['scrollPointerLock', false], ['scrollRepeatRate', 75], ['selectionFollowsActiveCell', false], ['selectionHandleBehavior', 'none'], ['selectionMode', 'cell'], ['selectionScrollIncrement', 20], ['selectionScrollZone', 20], ['showClearSettingsOption', true], ['showColumnHeaders', true], ['showColumnSelector', true], ['showCopy', false], ['showFilter', true], ['showNewRow', false], ['showOrderByOption', true], ['showOrderByOptionTextAsc', 'Order by %s ascending'], ['showOrderByOptionTextDesc', 'Order by %s descending'], ['showPaste', false], ['showPerformance', false], ['showRowHeaders', true], ['showRowNumbers', true], ['showRowNumberGaps', true], ['singleSelectionMode', false], ['snapToRow', false], ['sortFrozenRows', true], ['touchContextMenuTimeMs', 800], ['touchDeadZone', 3], ['touchEasingMethod', 'easeOutQuad'], ['touchReleaseAcceleration', 1000], ['touchReleaseAnimationDurationMs', 2000], ['touchScrollZone', 20], ['touchSelectHandleZone', 20], ['touchZoomSensitivity', 0.005], ['touchZoomMin', 0.5], ['touchZoomMax', 1.75], ['maxPixelRatio', 2], ['tree', false], ['treeHorizontalScroll', false]],
1020
1020
  styles: [['activeCellBackgroundColor', 'rgba(255, 255, 255, 1)'], ['activeCellBorderColor', 'rgba(110, 168, 255, 1)'], ['activeCellBorderWidth', 1], ['activeCellColor', 'rgba(0, 0, 0, 1)'], ['activeCellFont', '16px sans-serif'], ['activeCellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'], ['activeCellHorizontalAlignment', 'left'], ['activeCellHoverColor', 'rgba(0, 0, 0, 1)'], ['activeCellOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['activeCellOverlayBorderWidth', 1], ['activeCellPaddingBottom', 5], ['activeCellPaddingLeft', 5], ['activeCellPaddingRight', 5], ['activeCellPaddingTop', 5], ['activeCellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'], ['activeCellSelectedColor', 'rgba(0, 0, 0, 1)'], ['activeCellVerticalAlignment', 'center'], ['activeColumnHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'], ['activeColumnHeaderCellColor', 'rgba(0, 0, 0, 1)'], ['activeRowHeaderCellBackgroundColor', 'rgba(225, 225, 225, 1)'], ['activeRowHeaderCellColor', 'rgba(0, 0, 0, 1)'], ['autocompleteBottomMargin', 60], ['autosizeHeaderCellPadding', 8], ['autosizePadding', 5], ['cellAutoResizePadding', 13], ['cellBackgroundColor', 'rgba(255, 255, 255, 1)'], ['cellBorderColor', 'rgba(195, 199, 202, 1)'], ['cellBorderWidth', 1], ['cellColor', 'rgba(0, 0, 0, 1)'], ['cellFont', '16px sans-serif'], ['cellGridHeight', 250], ['cellHeight', 24], ['cellHeightWithChildGrid', 150], ['cellHorizontalAlignment', 'left'], ['cellHoverBackgroundColor', 'rgba(255, 255, 255, 1)'], ['cellHoverColor', 'rgba(0, 0, 0, 1)'], ['cellPaddingBottom', 5], ['cellPaddingLeft', 5], ['cellPaddingRight', 5], ['cellPaddingTop', 5], ['cellSelectedBackgroundColor', 'rgba(236, 243, 255, 1)'], ['cellSelectedColor', 'rgba(0, 0, 0, 1)'], ['cellVerticalAlignment', 'center'], ['cellWidth', 250], ['cellWidthWithChildGrid', 250], ['cellWhiteSpace', 'nowrap'], ['cellLineHeight', 1], ['cellLineSpacing', 3], ['childContextMenuArrowColor', 'rgba(43, 48, 43, 1)'], ['childContextMenuArrowHTML', '►'], ['childContextMenuMarginLeft', -11], ['childContextMenuMarginTop', -6], ['columnHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['columnHeaderCellBorderColor', 'rgba(172, 172, 172, 1)'], ['columnHeaderCellBorderWidth', 1], ['columnHeaderCellCapBackgroundColor', 'rgba(240, 240, 240, 1)'], ['columnHeaderCellCapBorderColor', 'rgba(172, 172, 172, 1)'], ['columnHeaderCellCapBorderWidth', 1], ['columnHeaderCellColor', 'rgba(50, 50, 50, 1)'], ['columnHeaderCellFont', '16px sans-serif'], ['columnHeaderCellHeight', 25], ['columnHeaderCellHorizontalAlignment', 'left'], ['columnHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'], ['columnHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'], ['columnHeaderCellPaddingBottom', 5], ['columnHeaderCellPaddingLeft', 5], ['columnHeaderCellPaddingRight', 5], ['columnHeaderCellPaddingTop', 5], ['columnHeaderCellVerticalAlignment', 'center'], ['columnHeaderOrderByArrowBorderColor', 'rgba(195, 199, 202, 1)'], ['columnHeaderOrderByArrowBorderWidth', 1], ['columnHeaderOrderByArrowColor', 'rgba(155, 155, 155, 1)'], ['columnHeaderOrderByArrowHeight', 8], ['columnHeaderOrderByArrowMarginLeft', 0], ['columnHeaderOrderByArrowMarginRight', 5], ['columnHeaderOrderByArrowMarginTop', 6], ['columnHeaderOrderByArrowWidth', 13], ['contextFilterButtonBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextFilterButtonBorderRadius', '3px'], ['contextFilterButtonHTML', '▼'], ['contextFilterInputBackground', 'rgba(255,255,255,1)'], ['contextFilterInputBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextFilterInputBorderRadius', '0'], ['contextFilterInputColor', 'rgba(0,0,0,1)'], ['contextFilterInputFontFamily', 'sans-serif'], ['contextFilterInputFontSize', '14px'], ['contextFilterInvalidRegExpBackground', 'rgba(180, 6, 1, 1)'], ['contextFilterInvalidRegExpColor', 'rgba(255, 255, 255, 1)'], ['contextMenuArrowColor', 'rgba(43, 48, 43, 1)'], ['contextMenuArrowDownHTML', '▼'], ['contextMenuArrowUpHTML', '▲'], ['contextMenuBackground', 'rgba(240, 240, 240, 1)'], ['contextMenuBorder', 'solid 1px rgba(158, 163, 169, 1)'], ['contextMenuBorderRadius', '3px'], ['contextMenuChildArrowFontSize', '12px'], ['contextMenuColor', 'rgba(43, 48, 43, 1)'], ['contextMenuCursor', 'default'], ['contextMenuFilterButtonFontFamily', 'sans-serif'], ['contextMenuFilterButtonFontSize', '10px'], ['contextMenuFilterInvalidExpresion', 'rgba(237, 155, 156, 1)'], ['contextMenuFontFamily', 'sans-serif'], ['contextMenuFontSize', '16px'], ['contextMenuHoverBackground', 'rgba(182, 205, 250, 1)'], ['contextMenuHoverColor', 'rgba(43, 48, 153, 1)'], ['contextMenuItemBorderRadius', '3px'], ['contextMenuItemMargin', '2px'], ['contextMenuLabelDisplay', 'inline-block'], ['contextMenuLabelMargin', '0 3px 0 0'], ['contextMenuLabelMaxWidth', '700px'], ['contextMenuLabelMinWidth', '75px'], ['contextMenuMarginLeft', 3], ['contextMenuMarginTop', -3], ['contextMenuOpacity', '0.98'], ['contextMenuPadding', '2px'], ['contextMenuWindowMargin', 30], ['contextMenuZIndex', 10000], ['cornerCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['cornerCellBorderColor', 'rgba(202, 202, 202, 1)'], ['debugBackgroundColor', 'rgba(0, 0, 0, .0)'], ['debugColor', 'rgba(255, 15, 24, 1)'], ['debugEntitiesColor', 'rgba(76, 231, 239, 1.00)'], ['debugFont', '11px sans-serif'], ['debugPerfChartBackground', 'rgba(29, 25, 26, 1.00)'], ['debugPerfChartTextColor', 'rgba(255, 255, 255, 0.8)'], ['debugPerformanceColor', 'rgba(252, 255, 37, 1.00)'], ['debugScrollHeightColor', 'rgba(248, 33, 103, 1.00)'], ['debugScrollWidthColor', 'rgba(66, 255, 27, 1.00)'], ['debugTouchPPSXColor', 'rgba(246, 102, 24, 1.00)'], ['debugTouchPPSYColor', 'rgba(186, 0, 255, 1.00)'], ['display', 'inline-block'], ['editCellBackgroundColor', 'white'], ['editCellBorder', 'solid 1px rgba(110, 168, 255, 1)'], ['editCellBoxShadow', '0 2px 5px rgba(0,0,0,0.4)'], ['editCellColor', 'black'], ['editCellFontFamily', 'sans-serif'], ['editCellFontSize', '16px'], ['editCellPaddingLeft', 4], ['editCellZIndex', 10000], ['frozenMarkerHoverColor', 'rgba(236, 243, 255, 1)'], ['frozenMarkerHoverBorderColor', 'rgba(110, 168, 255, 1)'], ['frozenMarkerActiveColor', 'rgba(236, 243, 255, 1)'], ['frozenMarkerActiveBorderColor', 'rgba(110, 168, 255, 1)'], ['frozenMarkerColor', 'rgba(222, 222, 222, 1)'], ['frozenMarkerBorderColor', 'rgba(168, 168, 168, 1)'], ['frozenMarkerBorderWidth', 1], ['frozenMarkerWidth', 2], ['gridBackgroundColor', 'rgba(240, 240, 240, 1)'], ['gridBorderCollapse', 'collapse'], ['gridBorderColor', 'rgba(202, 202, 202, 1)'], ['gridBorderWidth', 1], ['height', 'auto'], ['maxHeight', 'inherit'], ['maxWidth', 'inherit'], ['minColumnWidth', 45], ['minHeight', 'inherit'], ['minRowHeight', 24], ['minWidth', 'inherit'], ['mobileContextMenuMargin', 10], ['mobileEditInputHeight', 30], ['mobileEditFontFamily', 'sans-serif'], ['mobileEditFontSize', '16px'], ['moveOverlayBorderWidth', 1], ['moveOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['moveOverlayBorderSegments', '12, 7'], ['name', 'default'], ['overflowY', 'auto'], ['overflowX', 'auto'], ['reorderMarkerBackgroundColor', 'rgba(0, 0, 0, 0.1)'], ['reorderMarkerBorderColor', 'rgba(0, 0, 0, 0.2)'], ['reorderMarkerBorderWidth', 1.25], ['reorderMarkerIndexBorderColor', 'rgba(66, 133, 244, 1)'], ['reorderMarkerIndexBorderWidth', 2.75], ['rowHeaderCellBackgroundColor', 'rgba(240, 240, 240, 1)'], ['rowHeaderCellBorderColor', 'rgba(200, 200, 200, 1)'], ['rowHeaderCellBorderWidth', 1], ['rowHeaderCellColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellFont', '16px sans-serif'], ['rowHeaderCellHeight', 25], ['rowHeaderCellHorizontalAlignment', 'left'], ['rowHeaderCellHoverBackgroundColor', 'rgba(235, 235, 235, 1)'], ['rowHeaderCellHoverColor', 'rgba(0, 0, 0, 1)'], ['rowHeaderCellPaddingBottom', 5], ['rowHeaderCellPaddingLeft', 5], ['rowHeaderCellPaddingRight', 5], ['rowHeaderCellPaddingTop', 5], ['rowHeaderCellRowNumberGapHeight', 5], ['rowHeaderCellRowNumberGapColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellSelectedBackgroundColor', 'rgba(217, 217, 217, 1)'], ['rowHeaderCellSelectedColor', 'rgba(50, 50, 50, 1)'], ['rowHeaderCellVerticalAlignment', 'center'], ['rowHeaderCellWidth', 57], ['scrollBarActiveColor', 'rgba(125, 125, 125, 1)'], ['scrollBarBackgroundColor', 'rgba(240, 240, 240, 1)'], ['scrollBarBorderColor', 'rgba(202, 202, 202, 1)'], ['scrollBarBorderWidth', 0.5], ['scrollBarBoxBorderRadius', 4.125], ['scrollBarBoxColor', 'rgba(192, 192, 192, 1)'], ['scrollBarBoxMargin', 2], ['scrollBarBoxMinSize', 15], ['scrollBarBoxWidth', 8], ['scrollBarCornerBackgroundColor', 'rgba(240, 240, 240, 1)'], ['scrollBarCornerBorderColor', 'rgba(202, 202, 202, 1)'], ['scrollBarWidth', 11], ['selectionHandleBorderColor', 'rgba(255, 255, 255, 1)'], ['selectionHandleBorderWidth', 1.5], ['selectionHandleColor', 'rgba(66, 133, 244, 1)'], ['selectionHandleSize', 8], ['selectionHandleType', 'square'], ['selectionOverlayBorderColor', 'rgba(66, 133, 244, 1)'], ['selectionOverlayBorderWidth', 1], ['treeArrowBorderColor', 'rgba(195, 199, 202, 1)'], ['treeArrowBorderWidth', 1], ['treeArrowClickRadius', 5], ['treeArrowColor', 'rgba(155, 155, 155, 1)'], ['treeArrowHeight', 8], ['treeArrowMarginLeft', 0], ['treeArrowMarginRight', 5], ['treeArrowMarginTop', 6], ['treeArrowWidth', 13], ['treeGridHeight', 250], ['width', 'auto']]
1021
1021
  };
1022
1022
  }
@@ -1892,15 +1892,15 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
1892
1892
  y = y + mt;
1893
1893
 
1894
1894
  if (self.orderDirection === 'asc') {
1895
- self.ctx.moveTo(x, y);
1896
- self.ctx.lineTo(x + aw, y);
1897
- self.ctx.lineTo(x + aw * 0.5, y + ah);
1898
- self.ctx.moveTo(x, y);
1899
- } else {
1900
1895
  self.ctx.lineTo(x, y + ah);
1901
1896
  self.ctx.lineTo(x + aw, y + ah);
1902
1897
  self.ctx.lineTo(x + aw * 0.5, y);
1903
1898
  self.ctx.lineTo(x, y + ah);
1899
+ } else {
1900
+ self.ctx.moveTo(x, y);
1901
+ self.ctx.lineTo(x + aw, y);
1902
+ self.ctx.lineTo(x + aw * 0.5, y + ah);
1903
+ self.ctx.moveTo(x, y);
1904
1904
  }
1905
1905
 
1906
1906
  self.ctx.stroke();
@@ -2611,7 +2611,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
2611
2611
  viewRowIndex: rowOrderIndex,
2612
2612
  viewColumnIndex: columnOrderIndex,
2613
2613
  boundRowIndex: self.getBoundRowIndexFromViewRowIndex(rowOrderIndex),
2614
- boundColumnIndex: columnOrderIndex,
2614
+ boundColumnIndex: self.getBoundColumnIndexFromViewColumnIndex(columnOrderIndex),
2615
2615
  sortColumnIndex: headerIndex,
2616
2616
  sortRowIndex: rowIndex,
2617
2617
  isGrid: isGrid,
@@ -2796,9 +2796,13 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
2796
2796
 
2797
2797
  self.ctx.restore(); // Gaps may occur in row numbers between consecutively rendered rows
2798
2798
  // when we are filtering. We draw attention to this by drawing a thick
2799
- // border overlapping the two consecutive row headers.
2799
+ // border overlapping the two consecutive row headers. If sorting, visible
2800
+ // row numbers stay the same (i.e. they don't correspond to the underlying
2801
+ // data's row number), so we do not show row gaps in that case.
2802
+
2803
+ var isSorting = self.orderings.columns && self.orderings.columns.length > 0;
2800
2804
 
2801
- if (isRowHeader && self.attributes.showRowNumbers && self.attributes.showRowNumberGaps) {
2805
+ if (isRowHeader && self.attributes.showRowNumbers && self.attributes.showRowNumberGaps && isSorting === false) {
2802
2806
  var previousRowNumber = self.getBoundRowIndexFromViewRowIndex(rowOrderIndex - 1);
2803
2807
  var hasRowGap = previousRowNumber !== undefined && cell.boundRowIndex > 0 && cell.boundRowIndex - previousRowNumber > 1;
2804
2808
 
@@ -3515,10 +3519,10 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
3515
3519
 
3516
3520
  /***/ }),
3517
3521
 
3518
- /***/ "./lib/events.js":
3519
- /*!***********************!*\
3520
- !*** ./lib/events.js ***!
3521
- \***********************/
3522
+ /***/ "./lib/events/index.js":
3523
+ /*!*****************************!*\
3524
+ !*** ./lib/events/index.js ***!
3525
+ \*****************************/
3522
3526
  /*! namespace exports */
3523
3527
  /*! export default [provided] [no usage info] [missing usage info prevents renaming] */
3524
3528
  /*! other exports [not provided] [no usage info] */
@@ -3532,18 +3536,28 @@ __webpack_require__.r(__webpack_exports__);
3532
3536
  /* harmony export */ });
3533
3537
  /* harmony import */ var is_printable_key_event__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! is-printable-key-event */ "./node_modules/is-printable-key-event/dist/index.js");
3534
3538
  /* harmony import */ var is_printable_key_event__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(is_printable_key_event__WEBPACK_IMPORTED_MODULE_0__);
3539
+ /* harmony import */ var _util__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util */ "./lib/events/util.js");
3535
3540
  /*jslint browser: true, unparam: true, todo: true, plusplus: true*/
3536
3541
 
3537
3542
  /*globals define: true, MutationObserver: false, requestAnimationFrame: false, performance: false, btoa: false*/
3538
3543
 
3539
3544
 
3540
- function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
3545
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3546
+
3547
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3548
+
3549
+ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
3550
+
3551
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3552
+
3553
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
3541
3554
 
3542
3555
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3543
3556
 
3544
3557
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3545
3558
 
3546
3559
 
3560
+
3547
3561
  /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(self) {
3548
3562
  var wheeling;
3549
3563
 
@@ -4031,6 +4045,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4031
4045
  var event = {
4032
4046
  selections: self.selections,
4033
4047
  selectedData: self.getSelectedData(),
4048
+ selectedCells: self.getSelectedCells(),
4034
4049
  selectionBounds: self.getSelectionBounds()
4035
4050
  };
4036
4051
  self.dispatchEvent('selectionchanged', event);
@@ -4089,7 +4104,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4089
4104
 
4090
4105
  ev = {
4091
4106
  selections: self.selections,
4092
- selectionBounds: self.getSelectionBounds()
4107
+ selectionBounds: self.getSelectionBounds(),
4108
+ selectedCells: self.getSelectedCells()
4093
4109
  };
4094
4110
  Object.defineProperty(ev, 'selectedData', {
4095
4111
  get: function get() {
@@ -4353,6 +4369,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4353
4369
  self.stopDragReorder = function (e) {
4354
4370
  var oIndex,
4355
4371
  tIndex,
4372
+ odata,
4356
4373
  cr = {
4357
4374
  'row-reorder': self.orders.rows,
4358
4375
  'column-reorder': self.orders.columns
@@ -4373,13 +4390,16 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4373
4390
  self.ignoreNextClick = true;
4374
4391
  oIndex = cr[self.dragMode].indexOf(self.reorderObject[i]);
4375
4392
  tIndex = cr[self.dragMode].indexOf(self.reorderTarget[i]);
4376
- cr[self.dragMode].splice(oIndex, 1);
4377
- cr[self.dragMode].splice(tIndex, 0, self.reorderObject[i]);
4378
4393
 
4379
4394
  if (self.dragMode === 'column-reorder') {
4395
+ cr[self.dragMode].splice(oIndex, 1);
4396
+ cr[self.dragMode].splice(tIndex, 0, self.reorderObject[i]);
4380
4397
  self.orders.columns = cr[self.dragMode];
4381
4398
  } else {
4382
- self.orders.rows = cr[self.dragMode];
4399
+ // self.orders.rows = cr[self.dragMode];
4400
+ odata = self.viewData[oIndex];
4401
+ self.viewData[oIndex] = self.viewData[tIndex];
4402
+ self.viewData[tIndex] = odata;
4383
4403
  }
4384
4404
 
4385
4405
  self.resize();
@@ -4605,6 +4625,12 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4605
4625
 
4606
4626
  if (['row-reorder', 'column-reorder'].indexOf(self.dragMode) !== -1) {
4607
4627
  self.draggingItem = self.dragStartObject;
4628
+
4629
+ if (self.dragMode === 'column-reorder' && self.attributes.columnHeaderClickBehavior === 'select') {
4630
+ self.selectColumn(self.currentCell.header.index, ctrl, e.shiftKey);
4631
+ self.draw();
4632
+ }
4633
+
4608
4634
  document.body.addEventListener('mousemove', self.dragReorder, false);
4609
4635
  document.body.addEventListener('mouseup', self.stopDragReorder, false);
4610
4636
  return;
@@ -4613,9 +4639,16 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4613
4639
 
4614
4640
  self.mouseup = function (e) {
4615
4641
  clearTimeout(self.scrollTimer);
4642
+ var ctrl = e.ctrlKey || e.metaKey;
4616
4643
  self.cellBoundaryCrossed = true;
4617
4644
  self.rowBoundaryCrossed = true;
4618
4645
  self.columnBoundaryCrossed = true;
4646
+
4647
+ if (self.draggingItem) {
4648
+ self.selectColumn(self.currentCell.header.index, ctrl, e.shiftKey);
4649
+ self.draw();
4650
+ }
4651
+
4619
4652
  self.selecting = undefined;
4620
4653
  self.draggingItem = undefined;
4621
4654
  self.dragStartObject = undefined;
@@ -4700,7 +4733,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4700
4733
  return;
4701
4734
  }
4702
4735
 
4703
- if (!self.hasFocus) {
4736
+ if (!self.attributes.keepFocusOnMouseOut && !self.hasFocus) {
4704
4737
  return;
4705
4738
  } // If a user starts typing content, switch to "Enter" mode
4706
4739
 
@@ -4856,7 +4889,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4856
4889
  ev = {
4857
4890
  selectedData: self.getSelectedData(),
4858
4891
  selections: self.selections,
4859
- selectionBounds: self.getSelectionBounds()
4892
+ selectionBounds: self.getSelectionBounds(),
4893
+ selectedCells: self.getSelectedCells()
4860
4894
  };
4861
4895
  Object.defineProperty(ev, 'selectedData', {
4862
4896
  get: function get() {
@@ -4961,64 +4995,17 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
4961
4995
  };
4962
4996
 
4963
4997
  self.pasteData = function (pasteValue, mimeType, startRowIndex, startColIndex) {
4964
- var schema = self.getSchema();
4965
-
4966
- var isSupportedHtmlTable = function isSupportedHtmlTable(htmlString) {
4967
- return /(?:^(<meta[^>]+>)?<table.*?>)|(?:<!--StartFragment-->\s*<table.*?>)/.test(htmlString);
4968
- }; // TODO: support pasting tables from Excel
4969
-
4970
-
4971
- if (mimeType === 'text/html' && isSupportedHtmlTable(pasteValue) === false) {
4998
+ if (mimeType === 'text/html' && !(0,_util__WEBPACK_IMPORTED_MODULE_1__.isSupportedHtml)(pasteValue)) {
4972
4999
  console.warn('Unrecognized HTML format. HTML must be a simple table, e.g.: <table><tr><td>data</td></tr></table>.');
4973
5000
  console.warn('Data with the mime type text/html not in this format will not be imported as row data.');
4974
5001
  return;
4975
5002
  }
4976
5003
 
4977
- function parseData(data, mimeType) {
4978
- // TODO: use DOMParser
4979
- if (mimeType === 'text/html') {
4980
- var doc = new DOMParser().parseFromString(data, 'text/html');
4981
- var trs = doc.querySelectorAll('table tr');
4982
- var _rows = [];
4983
- trs.forEach(function (tr) {
4984
- var row = [];
4985
- tr.childNodes.forEach(function (td) {
4986
- if (td.nodeName === '#text') return;
4987
- var col = {
4988
- // style: {}, // keep style if need
4989
- value: []
4990
- };
4991
- td.childNodes.forEach(function (ele) {
4992
- col.value.push({
4993
- // style: {}, // keep style if need
4994
- value: ele.nodeType === 1 ? ele.innerText : ele.data
4995
- });
4996
- });
4997
- row.push(col);
4998
- });
4999
-
5000
- _rows.push(row);
5001
- });
5002
- return _rows;
5003
- } // Default data format is string, so split on new line,
5004
- // and then enclose in an array (a row with one cell):
5005
-
5006
-
5007
- return data.split('\n').map(function (item) {
5008
- return item.split('\t').map(function (value) {
5009
- return {
5010
- value: [{
5011
- value: value
5012
- }]
5013
- };
5014
- });
5015
- });
5016
- }
5017
-
5018
- var rows = parseData(pasteValue, mimeType); // selected cell. This mimics Excel's paste functionality, and works
5004
+ var schema = self.getSchema();
5005
+ var rows = (0,_util__WEBPACK_IMPORTED_MODULE_1__.parseData)(pasteValue, mimeType); // selected cell. This mimics Excel's paste functionality, and works
5019
5006
  // as a poor-man's fill-down.
5020
5007
 
5021
- if (rows.length === 1) {
5008
+ if (rows.length === 1 && rows[0].length === 1) {
5022
5009
  var cellData = rows[0][0].value.map(function (item) {
5023
5010
  return item.value;
5024
5011
  }).join();
@@ -5075,7 +5062,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5075
5062
  self.selections.forEach(function (row, rowIndex) {
5076
5063
  if (rowIndex === undefined) return;
5077
5064
  row.forEach(function (columnIndex) {
5078
- affectedCells.push([rowIndex, columnIndex, self.getVisibleCellByIndex(columnIndex, rowIndex)]);
5065
+ affectedCells.push([rowIndex, columnIndex, self.getBoundRowIndexFromViewRowIndex(rowIndex), self.getBoundColumnIndexFromViewColumnIndex(columnIndex)]);
5079
5066
  });
5080
5067
  });
5081
5068
  self.dispatchEvent('afterpaste', {
@@ -5167,9 +5154,50 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5167
5154
 
5168
5155
  self.cut = function (e) {
5169
5156
  self.copy(e);
5170
- self.forEachSelectedCell(function (data, index, colName) {
5171
- data[index][colName] = '';
5172
- });
5157
+ var schema = self.getSchema();
5158
+ var affectedCells = [];
5159
+
5160
+ var _iterator2 = _createForOfIteratorHelper(self.selections.entries()),
5161
+ _step2;
5162
+
5163
+ try {
5164
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
5165
+ var _step2$value = _slicedToArray(_step2.value, 2),
5166
+ rowIndex = _step2$value[0],
5167
+ row = _step2$value[1];
5168
+
5169
+ if (!row) continue;
5170
+ var boundRowIndex = self.getBoundRowIndexFromViewRowIndex(rowIndex);
5171
+
5172
+ var _iterator3 = _createForOfIteratorHelper(row),
5173
+ _step3;
5174
+
5175
+ try {
5176
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
5177
+ var columnIndex = _step3.value;
5178
+ var boundColumnIndex = self.getBoundColumnIndexFromViewColumnIndex(columnIndex);
5179
+ var colName = schema[boundColumnIndex].name;
5180
+ self.viewData[rowIndex][colName] = '';
5181
+ affectedCells.push([rowIndex, columnIndex, boundRowIndex, boundColumnIndex]);
5182
+ }
5183
+ } catch (err) {
5184
+ _iterator3.e(err);
5185
+ } finally {
5186
+ _iterator3.f();
5187
+ }
5188
+ }
5189
+ } catch (err) {
5190
+ _iterator2.e(err);
5191
+ } finally {
5192
+ _iterator2.f();
5193
+ }
5194
+
5195
+ if (self.dispatchEvent('cut', {
5196
+ NativeEvent: e,
5197
+ cells: affectedCells
5198
+ })) {
5199
+ return;
5200
+ }
5173
5201
  };
5174
5202
 
5175
5203
  self.copy = function (e) {
@@ -5257,6 +5285,156 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
5257
5285
  return;
5258
5286
  }
5259
5287
 
5288
+ /***/ }),
5289
+
5290
+ /***/ "./lib/events/util.js":
5291
+ /*!****************************!*\
5292
+ !*** ./lib/events/util.js ***!
5293
+ \****************************/
5294
+ /*! namespace exports */
5295
+ /*! export isSupportedHtml [provided] [no usage info] [missing usage info prevents renaming] */
5296
+ /*! export parseData [provided] [no usage info] [missing usage info prevents renaming] */
5297
+ /*! export parseHtmlTable [provided] [no usage info] [missing usage info prevents renaming] */
5298
+ /*! export parseHtmlText [provided] [no usage info] [missing usage info prevents renaming] */
5299
+ /*! export parseText [provided] [no usage info] [missing usage info prevents renaming] */
5300
+ /*! export sanitizeElementData [provided] [no usage info] [missing usage info prevents renaming] */
5301
+ /*! other exports [not provided] [no usage info] */
5302
+ /*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
5303
+ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
5304
+
5305
+ "use strict";
5306
+ __webpack_require__.r(__webpack_exports__);
5307
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5308
+ /* harmony export */ "isSupportedHtml": function() { return /* binding */ isSupportedHtml; },
5309
+ /* harmony export */ "sanitizeElementData": function() { return /* binding */ sanitizeElementData; },
5310
+ /* harmony export */ "parseData": function() { return /* binding */ parseData; },
5311
+ /* harmony export */ "parseHtmlTable": function() { return /* binding */ parseHtmlTable; },
5312
+ /* harmony export */ "parseHtmlText": function() { return /* binding */ parseHtmlText; },
5313
+ /* harmony export */ "parseText": function() { return /* binding */ parseText; }
5314
+ /* harmony export */ });
5315
+
5316
+
5317
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
5318
+
5319
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5320
+
5321
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
5322
+
5323
+ var isSupportedHtml = function isSupportedHtml(pasteValue) {
5324
+ // We need to match new lines in the HTML, .* won't match new line characters.
5325
+ // `s` regex modifier can't be used with `ecmaVersion === 2017`.
5326
+ // As a workaround using [\s\S]*. Fix when we upgrade `ecmaVersion`.
5327
+ var genericDiv = /(?:^(<meta[^>]*>)?[\s\S]*<div[^>]*>)/;
5328
+ var genericSpan = /(?:^(<meta[^>]*>)?[\s\S]*<span[^>]*>)/;
5329
+ var genericTable = /(?:^(<meta[^>]*>)?[\s\S]*<table[^>]*>)/; // Matches Google Sheets format clipboard data format too.
5330
+
5331
+ var excelTable = /(?:<!--StartFragment-->[\s\S]*<tr[^>]*>)/;
5332
+ var excelTableRow = /(?:<!--StartFragment-->[\s\S]*<td[^>]*>)/;
5333
+ return [genericDiv, genericTable, genericSpan, excelTable, excelTableRow].some(function (expression) {
5334
+ return expression.test(pasteValue);
5335
+ });
5336
+ }; // Explanation of nodeType here: https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType
5337
+
5338
+
5339
+ var IGNORE_NODETYPES = [8, 3]; // '#text' and '#comment'
5340
+
5341
+ var isHtmlTable = function isHtmlTable(pasteValue) {
5342
+ return /(?:<table[^>]*>)|(?:<tr[^]*>)/.test(pasteValue);
5343
+ };
5344
+
5345
+ var sanitizeElementData = function sanitizeElementData(element) {
5346
+ // It is not entirely clear if this check on nodeType is required.
5347
+ var elementData = element.nodeType === 1 ? element.innerText : element.data;
5348
+ return String(elementData).replace(/\s+/g, ' ').trim();
5349
+ };
5350
+
5351
+ var parseHtmlText = function parseHtmlText(data) {
5352
+ var doc = new DOMParser().parseFromString(data, 'text/html');
5353
+ var element = doc.querySelector('div') || doc.querySelector('span');
5354
+ var elementData = sanitizeElementData(element);
5355
+ return elementData.split('\n').map(function (item) {
5356
+ return item.split('\t').map(function (value) {
5357
+ return {
5358
+ value: [{
5359
+ value: value
5360
+ }]
5361
+ };
5362
+ });
5363
+ });
5364
+ };
5365
+
5366
+ var parseHtmlTable = function parseHtmlTable(data) {
5367
+ var doc = new DOMParser().parseFromString(data, 'text/html');
5368
+ var trs = doc.querySelectorAll('table tr');
5369
+ var rows = [];
5370
+
5371
+ var _iterator = _createForOfIteratorHelper(trs),
5372
+ _step;
5373
+
5374
+ try {
5375
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
5376
+ var tr = _step.value;
5377
+ var row = [];
5378
+
5379
+ var _iterator2 = _createForOfIteratorHelper(tr.childNodes),
5380
+ _step2;
5381
+
5382
+ try {
5383
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
5384
+ var childNode = _step2.value;
5385
+ if (IGNORE_NODETYPES.includes(childNode.nodeType)) continue;
5386
+ var col = {
5387
+ value: []
5388
+ };
5389
+ var value = sanitizeElementData(childNode);
5390
+ if (value) col.value.push({
5391
+ value: value
5392
+ });
5393
+ row.push(col);
5394
+ }
5395
+ } catch (err) {
5396
+ _iterator2.e(err);
5397
+ } finally {
5398
+ _iterator2.f();
5399
+ }
5400
+
5401
+ rows.push(row);
5402
+ }
5403
+ } catch (err) {
5404
+ _iterator.e(err);
5405
+ } finally {
5406
+ _iterator.f();
5407
+ }
5408
+
5409
+ return rows;
5410
+ };
5411
+
5412
+ var parseText = function parseText(data) {
5413
+ return data.split('\n').map(function (item) {
5414
+ return item.split('\t').map(function (value) {
5415
+ return {
5416
+ value: [{
5417
+ value: value
5418
+ }]
5419
+ };
5420
+ });
5421
+ });
5422
+ };
5423
+
5424
+ var parseData = function parseData(data, mimeType) {
5425
+ if (mimeType === 'text/html' && isHtmlTable(data)) {
5426
+ return parseHtmlTable(data);
5427
+ } else if (mimeType === 'text/html') {
5428
+ return parseHtmlText(data);
5429
+ } // Default data format is string, so split on new line,
5430
+ // and then enclose in an array (a row with one cell):
5431
+
5432
+
5433
+ return parseText(data);
5434
+ };
5435
+
5436
+
5437
+
5260
5438
  /***/ }),
5261
5439
 
5262
5440
  /***/ "./lib/intf.js":
@@ -5281,20 +5459,20 @@ __webpack_require__.r(__webpack_exports__);
5281
5459
 
5282
5460
  function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
5283
5461
 
5284
- function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
5285
-
5286
5462
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
5287
5463
 
5288
5464
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
5289
5465
 
5290
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5291
-
5292
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
5293
-
5294
5466
  function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
5295
5467
 
5296
5468
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
5297
5469
 
5470
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
5471
+
5472
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
5473
+
5474
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
5475
+
5298
5476
  /* harmony default export */ function __WEBPACK_DEFAULT_EXPORT__(self, ctor) {
5299
5477
  self.scale = 1;
5300
5478
  self.orders = {
@@ -5423,6 +5601,74 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
5423
5601
  return selectedData;
5424
5602
  };
5425
5603
 
5604
+ self.getSelectedCells = function (expandToRow) {
5605
+ var selectedCells = [];
5606
+ var schema = self.getSchema();
5607
+ var viewDataLength = self.viewData.length;
5608
+
5609
+ if (viewDataLength === 0) {
5610
+ return [];
5611
+ }
5612
+
5613
+ var _iterator = _createForOfIteratorHelper(self.selections.entries()),
5614
+ _step;
5615
+
5616
+ try {
5617
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
5618
+ var _step$value = _slicedToArray(_step.value, 2),
5619
+ viewRowIndex = _step$value[0],
5620
+ row = _step$value[1];
5621
+
5622
+ if (!row || row.length === 0) continue;
5623
+
5624
+ var _iterator2 = _createForOfIteratorHelper(row.entries()),
5625
+ _step2;
5626
+
5627
+ try {
5628
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
5629
+ var _step2$value = _slicedToArray(_step2.value, 2),
5630
+ viewColumnIndex = _step2$value[1];
5631
+
5632
+ if (viewColumnIndex === -1 || !schema[viewColumnIndex]) {
5633
+ continue;
5634
+ }
5635
+
5636
+ var boundColumnIndex = self.getBoundColumnIndexFromViewColumnIndex(viewColumnIndex);
5637
+
5638
+ if (!expandToRow && schema[boundColumnIndex].hidden) {
5639
+ continue;
5640
+ }
5641
+
5642
+ if (self.viewData[viewRowIndex]) {
5643
+ var header = schema[boundColumnIndex];
5644
+ var value = self.viewData[viewRowIndex][header.name];
5645
+ var boundRowIndex = self.getBoundRowIndexFromViewRowIndex(viewRowIndex);
5646
+ var cell = {
5647
+ value: value,
5648
+ header: header,
5649
+ boundRowIndex: boundRowIndex,
5650
+ boundColumnIndex: boundColumnIndex,
5651
+ viewRowIndex: viewRowIndex,
5652
+ viewColumnIndex: viewColumnIndex
5653
+ };
5654
+ selectedCells.push(cell);
5655
+ }
5656
+ }
5657
+ } catch (err) {
5658
+ _iterator2.e(err);
5659
+ } finally {
5660
+ _iterator2.f();
5661
+ }
5662
+ }
5663
+ } catch (err) {
5664
+ _iterator.e(err);
5665
+ } finally {
5666
+ _iterator.f();
5667
+ }
5668
+
5669
+ return selectedCells;
5670
+ };
5671
+
5426
5672
  self.getBoundRowIndexFromViewRowIndex = function (viewRowIndex) {
5427
5673
  if (self.boundRowIndexMap && self.boundRowIndexMap.has(viewRowIndex)) {
5428
5674
  return self.boundRowIndexMap.get(viewRowIndex);
@@ -5431,6 +5677,10 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
5431
5677
  return undefined;
5432
5678
  };
5433
5679
 
5680
+ self.getBoundColumnIndexFromViewColumnIndex = function (viewColumnIndex) {
5681
+ return self.orders.columns[viewColumnIndex];
5682
+ };
5683
+
5434
5684
  self.getColumnHeaderCellHeight = function () {
5435
5685
  if (!self.attributes.showColumnHeaders) {
5436
5686
  return 0;
@@ -5561,7 +5811,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
5561
5811
  }); // Apply filtering
5562
5812
 
5563
5813
  var _loop = function _loop() {
5564
- var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
5814
+ var _Object$entries$_i = _slicedToArray(_Object$entries[_i2], 2),
5565
5815
  headerName = _Object$entries$_i[0],
5566
5816
  filterText = _Object$entries$_i[1];
5567
5817
 
@@ -5582,19 +5832,19 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
5582
5832
  });
5583
5833
  };
5584
5834
 
5585
- for (var _i = 0, _Object$entries = Object.entries(self.columnFilters); _i < _Object$entries.length; _i++) {
5835
+ for (var _i2 = 0, _Object$entries = Object.entries(self.columnFilters); _i2 < _Object$entries.length; _i2++) {
5586
5836
  var _ret = _loop();
5587
5837
 
5588
5838
  if (_ret === "continue") continue;
5589
5839
  } // Apply sorting
5590
5840
 
5591
5841
 
5592
- var _iterator = _createForOfIteratorHelper(self.orderings.columns),
5593
- _step;
5842
+ var _iterator3 = _createForOfIteratorHelper(self.orderings.columns),
5843
+ _step3;
5594
5844
 
5595
5845
  try {
5596
5846
  var _loop2 = function _loop2() {
5597
- var column = _step.value;
5847
+ var column = _step3.value;
5598
5848
  var sortFn = column.sortFunction(column.orderBy, column.orderDirection);
5599
5849
  newViewData.sort(function (_ref7, _ref8) {
5600
5850
  var _ref9 = _slicedToArray(_ref7, 1),
@@ -5609,13 +5859,13 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
5609
5859
  });
5610
5860
  };
5611
5861
 
5612
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
5862
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
5613
5863
  _loop2();
5614
5864
  }
5615
5865
  } catch (err) {
5616
- _iterator.e(err);
5866
+ _iterator3.e(err);
5617
5867
  } finally {
5618
- _iterator.f();
5868
+ _iterator3.f();
5619
5869
  }
5620
5870
 
5621
5871
  return {
@@ -6024,6 +6274,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
6024
6274
  self.intf.clearPxColorAssertions = self.clearPxColorAssertions;
6025
6275
  self.intf.integerToAlpha = self.integerToAlpha;
6026
6276
  self.intf.copy = self.copy;
6277
+ self.intf.cut = self.cut;
6027
6278
  self.intf.paste = self.paste;
6028
6279
  self.intf.setStyleProperty = self.setStyleProperty;
6029
6280
  Object.defineProperty(self.intf, 'defaults', {
@@ -6913,7 +7164,7 @@ __webpack_require__.r(__webpack_exports__);
6913
7164
  /* harmony import */ var _component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./component */ "./lib/component.js");
6914
7165
  /* harmony import */ var _defaults__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./defaults */ "./lib/defaults.js");
6915
7166
  /* harmony import */ var _draw__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./draw */ "./lib/draw.js");
6916
- /* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./events */ "./lib/events.js");
7167
+ /* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./events */ "./lib/events/index.js");
6917
7168
  /* harmony import */ var _touch__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./touch */ "./lib/touch.js");
6918
7169
  /* harmony import */ var _intf__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./intf */ "./lib/intf.js");
6919
7170
  /* harmony import */ var _contextMenu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./contextMenu */ "./lib/contextMenu.js");
@@ -7454,7 +7705,8 @@ __webpack_require__.r(__webpack_exports__);
7454
7705
  self.dispatchEvent('selectionchanged', {
7455
7706
  selectedData: self.getSelectedData(),
7456
7707
  selections: self.selections,
7457
- selectionBounds: self.selectionBounds
7708
+ selectionBounds: self.selectionBounds,
7709
+ selectedCells: self.getSelectedCells()
7458
7710
  });
7459
7711
 
7460
7712
  if (dontDraw) {
@@ -7605,7 +7857,8 @@ __webpack_require__.r(__webpack_exports__);
7605
7857
  self.dispatchEvent('selectionchanged', {
7606
7858
  selectedData: self.getSelectedData(),
7607
7859
  selections: self.selections,
7608
- selectionBounds: self.getSelectionBounds()
7860
+ selectionBounds: self.getSelectionBounds(),
7861
+ selectedCells: self.getSelectedCells()
7609
7862
  });
7610
7863
  };
7611
7864
  /**
@@ -7634,7 +7887,8 @@ __webpack_require__.r(__webpack_exports__);
7634
7887
  self.dispatchEvent('selectionchanged', {
7635
7888
  selectedData: self.getSelectedData(),
7636
7889
  selections: self.selections,
7637
- selectionBounds: self.selectionBounds
7890
+ selectionBounds: self.selectionBounds,
7891
+ selectedCells: self.getSelectedCells()
7638
7892
  });
7639
7893
  }
7640
7894
 
@@ -8377,7 +8631,8 @@ __webpack_require__.r(__webpack_exports__);
8377
8631
 
8378
8632
  ev = {
8379
8633
  selections: self.selections,
8380
- selectionBounds: self.selectionBounds
8634
+ selectionBounds: self.selectionBounds,
8635
+ selectedCells: self.getSelectedCells()
8381
8636
  };
8382
8637
  Object.defineProperty(ev, 'selectedData', {
8383
8638
  get: function get() {
@@ -8483,27 +8738,22 @@ __webpack_require__.r(__webpack_exports__);
8483
8738
  self.sorters.string = function (columnName, direction) {
8484
8739
  var asc = direction === 'asc';
8485
8740
  return function (a, b) {
8486
- if (a[columnName] === undefined || a[columnName] === null) {
8487
- return 1;
8488
- }
8489
-
8490
- if (b[columnName] === undefined || b[columnName] === null) {
8491
- return 0;
8492
- }
8741
+ var aValue = a[columnName] || '';
8742
+ var bValue = b[columnName] || '';
8493
8743
 
8494
8744
  if (asc) {
8495
- if (!a[columnName].localeCompare) {
8745
+ if (!aValue.localeCompare) {
8496
8746
  return 1;
8497
8747
  }
8498
8748
 
8499
- return a[columnName].localeCompare(b[columnName]);
8749
+ return aValue.localeCompare(bValue);
8500
8750
  }
8501
8751
 
8502
- if (!b[columnName].localeCompare) {
8752
+ if (!bValue.localeCompare) {
8503
8753
  return 1;
8504
8754
  }
8505
8755
 
8506
- return b[columnName].localeCompare(a[columnName]);
8756
+ return bValue.localeCompare(aValue);
8507
8757
  };
8508
8758
  };
8509
8759