handsontable 0.0.0-next-59715d3-20230523 → 0.0.0-next-93e34dc-20230601

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of handsontable might be problematic. Click here for more details.

Files changed (216) hide show
  1. package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
  2. package/3rdparty/walkontable/src/cell/coords.js +61 -12
  3. package/3rdparty/walkontable/src/cell/coords.mjs +61 -12
  4. package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
  5. package/3rdparty/walkontable/src/cell/range.js +44 -7
  6. package/3rdparty/walkontable/src/cell/range.mjs +44 -7
  7. package/3rdparty/walkontable/src/core/_base.js +9 -3
  8. package/3rdparty/walkontable/src/core/_base.mjs +9 -3
  9. package/3rdparty/walkontable/src/core/clone.js +2 -2
  10. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  11. package/3rdparty/walkontable/src/core/core.js +3 -2
  12. package/3rdparty/walkontable/src/core/core.mjs +3 -2
  13. package/3rdparty/walkontable/src/event.js +7 -7
  14. package/3rdparty/walkontable/src/event.mjs +7 -7
  15. package/3rdparty/walkontable/src/facade/core.js +2 -2
  16. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  17. package/3rdparty/walkontable/src/index.js +10 -2
  18. package/3rdparty/walkontable/src/index.mjs +2 -2
  19. package/3rdparty/walkontable/src/overlay/_base.js +1 -1
  20. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
  21. package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -4
  22. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -4
  23. package/3rdparty/walkontable/src/overlay/top.js +2 -4
  24. package/3rdparty/walkontable/src/overlay/top.mjs +2 -4
  25. package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
  26. package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
  27. package/3rdparty/walkontable/src/selection/border/constants.js +18 -0
  28. package/3rdparty/walkontable/src/selection/border/constants.mjs +13 -0
  29. package/3rdparty/walkontable/src/selection/constants.js +63 -0
  30. package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
  31. package/3rdparty/walkontable/src/selection/index.js +30 -0
  32. package/3rdparty/walkontable/src/selection/index.mjs +5 -0
  33. package/3rdparty/walkontable/src/selection/manager.js +328 -0
  34. package/3rdparty/walkontable/src/selection/manager.mjs +322 -0
  35. package/3rdparty/walkontable/src/selection/scanner.js +363 -0
  36. package/3rdparty/walkontable/src/selection/scanner.mjs +359 -0
  37. package/3rdparty/walkontable/src/selection/selection.js +133 -0
  38. package/3rdparty/walkontable/src/selection/selection.mjs +127 -0
  39. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
  40. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
  41. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
  42. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
  43. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
  44. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
  45. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
  46. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
  47. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
  48. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
  49. package/3rdparty/walkontable/src/table.js +7 -79
  50. package/3rdparty/walkontable/src/table.mjs +8 -80
  51. package/base.js +2 -2
  52. package/base.mjs +2 -2
  53. package/core.d.ts +5 -3
  54. package/core.js +82 -300
  55. package/core.mjs +82 -300
  56. package/dataMap/metaManager/metaSchema.js +15 -0
  57. package/dataMap/metaManager/metaSchema.mjs +15 -0
  58. package/dist/handsontable.css +8 -3
  59. package/dist/handsontable.full.css +8 -3
  60. package/dist/handsontable.full.js +12245 -9953
  61. package/dist/handsontable.full.min.css +3 -3
  62. package/dist/handsontable.full.min.js +120 -120
  63. package/dist/handsontable.js +15898 -13606
  64. package/dist/handsontable.min.css +3 -3
  65. package/dist/handsontable.min.js +4 -4
  66. package/editorManager.js +20 -82
  67. package/editorManager.mjs +25 -86
  68. package/editors/textEditor/textEditor.js +3 -11
  69. package/editors/textEditor/textEditor.mjs +4 -12
  70. package/helpers/mixed.js +1 -1
  71. package/helpers/mixed.mjs +1 -1
  72. package/helpers/number.d.ts +1 -0
  73. package/helpers/number.js +18 -0
  74. package/helpers/number.mjs +17 -0
  75. package/package.json +1 -1
  76. package/pluginHooks.js +1 -1
  77. package/pluginHooks.mjs +1 -1
  78. package/plugins/copyPaste/copyPaste.js +5 -1
  79. package/plugins/copyPaste/copyPaste.mjs +5 -1
  80. package/plugins/customBorders/customBorders.js +18 -52
  81. package/plugins/customBorders/customBorders.mjs +19 -53
  82. package/plugins/mergeCells/mergeCells.js +5 -18
  83. package/plugins/mergeCells/mergeCells.mjs +5 -18
  84. package/plugins/nestedHeaders/nestedHeaders.js +89 -9
  85. package/plugins/nestedHeaders/nestedHeaders.mjs +89 -9
  86. package/plugins/nestedHeaders/stateManager/index.js +37 -0
  87. package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
  88. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  89. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  90. package/selection/highlight/highlight.js +311 -88
  91. package/selection/highlight/highlight.mjs +301 -84
  92. package/selection/highlight/types/activeHeader.js +10 -9
  93. package/selection/highlight/types/activeHeader.mjs +10 -8
  94. package/selection/highlight/types/area.js +12 -27
  95. package/selection/highlight/types/area.mjs +16 -30
  96. package/selection/highlight/types/areaLayered.js +54 -0
  97. package/selection/highlight/types/areaLayered.mjs +49 -0
  98. package/selection/highlight/types/column.js +50 -0
  99. package/selection/highlight/types/column.mjs +45 -0
  100. package/selection/highlight/types/customSelection.js +7 -10
  101. package/selection/highlight/types/customSelection.mjs +7 -9
  102. package/selection/highlight/types/fill.js +5 -8
  103. package/selection/highlight/types/fill.mjs +5 -7
  104. package/selection/highlight/types/{cell.js → focus.js} +5 -8
  105. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  106. package/selection/highlight/types/header.js +10 -20
  107. package/selection/highlight/types/header.mjs +10 -19
  108. package/selection/highlight/types/{index.js → row.js} +27 -31
  109. package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
  110. package/selection/highlight/visualSelection.js +23 -28
  111. package/selection/highlight/visualSelection.mjs +23 -28
  112. package/selection/index.js +4 -7
  113. package/selection/index.mjs +2 -3
  114. package/selection/mouseEventHandler.js +1 -1
  115. package/selection/mouseEventHandler.mjs +1 -1
  116. package/selection/range.js +8 -8
  117. package/selection/range.mjs +8 -8
  118. package/selection/selection.js +296 -180
  119. package/selection/selection.mjs +291 -179
  120. package/selection/transformation.js +233 -96
  121. package/selection/transformation.mjs +230 -93
  122. package/selection/utils.js +12 -35
  123. package/selection/utils.mjs +13 -35
  124. package/settings.d.ts +1 -0
  125. package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
  126. package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
  127. package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
  128. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  129. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  130. package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
  131. package/shortcutContexts/commands/editor/index.js +16 -0
  132. package/shortcutContexts/commands/editor/index.mjs +12 -0
  133. package/shortcutContexts/commands/editor/open.js +29 -0
  134. package/shortcutContexts/commands/editor/open.mjs +24 -0
  135. package/shortcutContexts/commands/emptySelectedCells.js +12 -0
  136. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  137. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  138. package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
  139. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
  140. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
  141. package/shortcutContexts/commands/extendCellsSelection/index.js +24 -0
  142. package/shortcutContexts/commands/extendCellsSelection/index.mjs +20 -0
  143. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  144. package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
  145. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  146. package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
  147. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
  148. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
  149. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
  150. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
  151. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
  152. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
  153. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +39 -0
  154. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +34 -0
  155. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +39 -0
  156. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +34 -0
  157. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
  158. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
  159. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  160. package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
  161. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
  162. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
  163. package/shortcutContexts/commands/index.js +51 -0
  164. package/shortcutContexts/commands/index.mjs +47 -0
  165. package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
  166. package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
  167. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +11 -0
  168. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +6 -0
  169. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  170. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  171. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
  172. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  173. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
  174. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  175. package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
  176. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  177. package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
  178. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  179. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
  180. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
  181. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
  182. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
  183. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
  184. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
  185. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
  186. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
  187. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +35 -0
  188. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +30 -0
  189. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +35 -0
  190. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +30 -0
  191. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
  192. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
  193. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
  194. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
  195. package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
  196. package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
  197. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +11 -0
  198. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +6 -0
  199. package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
  200. package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
  201. package/shortcutContexts/commands/selectAll.js +11 -0
  202. package/shortcutContexts/commands/selectAll.mjs +6 -0
  203. package/shortcutContexts/constants.js +19 -0
  204. package/shortcutContexts/constants.mjs +12 -0
  205. package/shortcutContexts/editor.js +29 -0
  206. package/shortcutContexts/editor.mjs +25 -0
  207. package/shortcutContexts/grid.js +232 -0
  208. package/shortcutContexts/grid.mjs +228 -0
  209. package/shortcutContexts/index.js +29 -0
  210. package/shortcutContexts/index.mjs +15 -0
  211. package/tableView.js +58 -9
  212. package/tableView.mjs +58 -9
  213. package/3rdparty/walkontable/src/selection.js +0 -354
  214. package/3rdparty/walkontable/src/selection.mjs +0 -348
  215. package/selection/highlight/constants.js +0 -16
  216. package/selection/highlight/constants.mjs +0 -6
@@ -0,0 +1,363 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.symbol.to-primitive.js");
4
+ require("core-js/modules/es.date.to-primitive.js");
5
+ require("core-js/modules/es.symbol.js");
6
+ require("core-js/modules/es.symbol.description.js");
7
+ require("core-js/modules/es.number.constructor.js");
8
+ require("core-js/modules/es.symbol.iterator.js");
9
+ require("core-js/modules/es.array.slice.js");
10
+ require("core-js/modules/es.function.name.js");
11
+ require("core-js/modules/es.array.from.js");
12
+ require("core-js/modules/es.regexp.exec.js");
13
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
14
+ exports.__esModule = true;
15
+ exports.SelectionScanner = void 0;
16
+ require("core-js/modules/es.array.iterator.js");
17
+ require("core-js/modules/es.object.to-string.js");
18
+ require("core-js/modules/es.set.js");
19
+ require("core-js/modules/es.string.iterator.js");
20
+ require("core-js/modules/web.dom-collections.iterator.js");
21
+ require("core-js/modules/es.weak-map.js");
22
+ require("core-js/modules/es.weak-set.js");
23
+ var _element = require("../../../../helpers/dom/element");
24
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
+ 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."); }
26
+ 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); }
27
+ 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; }
28
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
29
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
30
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
31
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
32
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
33
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
34
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
35
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
36
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
37
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
38
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
39
+ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
40
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
41
+ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
42
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
43
+ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } } /* eslint-disable no-continue */
44
+ /**
45
+ * Selection scanner module scans the rendered cells and headers and if it finds an intersection with
46
+ * the coordinates of the Selection class (highlight) it returns the DOM elements.
47
+ *
48
+ * @private
49
+ */
50
+ var _selection = /*#__PURE__*/new WeakMap();
51
+ var _activeOverlaysWot = /*#__PURE__*/new WeakMap();
52
+ var _scanCellsRange = /*#__PURE__*/new WeakSet();
53
+ var SelectionScanner = /*#__PURE__*/function () {
54
+ function SelectionScanner() {
55
+ _classCallCheck(this, SelectionScanner);
56
+ /**
57
+ * The method triggers a callback for each rendered cell.
58
+ *
59
+ * @param {function(number, number): void} callback The callback function to trigger.
60
+ */
61
+ _classPrivateMethodInitSpec(this, _scanCellsRange);
62
+ /**
63
+ * Active Selection instance to process.
64
+ *
65
+ * @type {Selection}
66
+ */
67
+ _classPrivateFieldInitSpec(this, _selection, {
68
+ writable: true,
69
+ value: void 0
70
+ });
71
+ /**
72
+ * The Walkontable instance that the scans depends on.
73
+ *
74
+ * @type {Walkontable}
75
+ */
76
+ _classPrivateFieldInitSpec(this, _activeOverlaysWot, {
77
+ writable: true,
78
+ value: void 0
79
+ });
80
+ }
81
+ _createClass(SelectionScanner, [{
82
+ key: "setActiveOverlay",
83
+ value:
84
+ /**
85
+ * Sets the Walkontable instance that will be taking into account while scanning the table.
86
+ *
87
+ * @param {Walkontable} activeOverlaysWot The Walkontable instance.
88
+ * @returns {SelectionScanner}
89
+ */
90
+ function setActiveOverlay(activeOverlaysWot) {
91
+ _classPrivateFieldSet(this, _activeOverlaysWot, activeOverlaysWot);
92
+ return this;
93
+ }
94
+
95
+ /**
96
+ * Sets the Selection instance to process.
97
+ *
98
+ * @param {Selection} selection The Selection instance.
99
+ * @returns {SelectionScanner}
100
+ */
101
+ }, {
102
+ key: "setActiveSelection",
103
+ value: function setActiveSelection(selection) {
104
+ _classPrivateFieldSet(this, _selection, selection);
105
+ return this;
106
+ }
107
+
108
+ /**
109
+ * Scans the rendered table with selection and returns elements that intersects
110
+ * with selection coordinates.
111
+ *
112
+ * @returns {HTMLTableElement[]}
113
+ */
114
+ }, {
115
+ key: "scan",
116
+ value: function scan() {
117
+ var selectionType = _classPrivateFieldGet(this, _selection).settings.selectionType;
118
+ var elements = new Set();
119
+
120
+ // TODO(improvement): use heuristics from coords to detect what type of scan
121
+ // the Selection needs instead of using `selectionType` property.
122
+ if (selectionType === 'active-header') {
123
+ this.scanColumnsInHeadersRange(function (element) {
124
+ return elements.add(element);
125
+ });
126
+ this.scanRowsInHeadersRange(function (element) {
127
+ return elements.add(element);
128
+ });
129
+ } else if (selectionType === 'area') {
130
+ this.scanCellsRange(function (element) {
131
+ return elements.add(element);
132
+ });
133
+ } else if (selectionType === 'focus') {
134
+ this.scanColumnsInHeadersRange(function (element) {
135
+ return elements.add(element);
136
+ });
137
+ this.scanRowsInHeadersRange(function (element) {
138
+ return elements.add(element);
139
+ });
140
+ this.scanCellsRange(function (element) {
141
+ return elements.add(element);
142
+ });
143
+ } else if (selectionType === 'fill') {
144
+ this.scanCellsRange(function (element) {
145
+ return elements.add(element);
146
+ });
147
+ } else if (selectionType === 'header') {
148
+ this.scanColumnsInHeadersRange(function (element) {
149
+ return elements.add(element);
150
+ });
151
+ this.scanRowsInHeadersRange(function (element) {
152
+ return elements.add(element);
153
+ });
154
+ } else if (selectionType === 'row') {
155
+ this.scanRowsInHeadersRange(function (element) {
156
+ return elements.add(element);
157
+ });
158
+ this.scanRowsInCellsRange(function (element) {
159
+ return elements.add(element);
160
+ });
161
+ } else if (selectionType === 'column') {
162
+ this.scanColumnsInHeadersRange(function (element) {
163
+ return elements.add(element);
164
+ });
165
+ this.scanColumnsInCellsRange(function (element) {
166
+ return elements.add(element);
167
+ });
168
+ }
169
+ return elements;
170
+ }
171
+
172
+ /**
173
+ * Scans the table (only rendered headers) and collect all column headers (TH) that match
174
+ * the coordinates passed in the Selection instance.
175
+ *
176
+ * @param {function(HTMLTableElement): void} callback The callback function to trigger.
177
+ */
178
+ }, {
179
+ key: "scanColumnsInHeadersRange",
180
+ value: function scanColumnsInHeadersRange(callback) {
181
+ var _classPrivateFieldGet2 = _classPrivateFieldGet(this, _selection).getCorners(),
182
+ _classPrivateFieldGet3 = _slicedToArray(_classPrivateFieldGet2, 4),
183
+ topRow = _classPrivateFieldGet3[0],
184
+ topColumn = _classPrivateFieldGet3[1],
185
+ bottomRow = _classPrivateFieldGet3[2],
186
+ bottomColumn = _classPrivateFieldGet3[3];
187
+ var _classPrivateFieldGet4 = _classPrivateFieldGet(this, _activeOverlaysWot),
188
+ wtTable = _classPrivateFieldGet4.wtTable;
189
+ var renderedColumnsCount = wtTable.getRenderedColumnsCount();
190
+ var columnHeadersCount = wtTable.getColumnHeadersCount();
191
+ var cursor = 0;
192
+ for (var column = -wtTable.getRowHeadersCount(); column < renderedColumnsCount; column++) {
193
+ var sourceColumn = wtTable.columnFilter.renderedToSource(column);
194
+ if (sourceColumn < topColumn || sourceColumn > bottomColumn) {
195
+ continue;
196
+ }
197
+ for (var headerLevel = -columnHeadersCount; headerLevel < 0; headerLevel++) {
198
+ if (headerLevel < topRow || headerLevel > bottomRow) {
199
+ continue;
200
+ }
201
+ var positiveBasedHeaderLevel = headerLevel + columnHeadersCount;
202
+ var TH = wtTable.getColumnHeader(sourceColumn, positiveBasedHeaderLevel);
203
+ var newSourceCol = _classPrivateFieldGet(this, _activeOverlaysWot).getSetting('onBeforeHighlightingColumnHeader', sourceColumn, positiveBasedHeaderLevel, {
204
+ selectionType: _classPrivateFieldGet(this, _selection).settings.selectionType,
205
+ columnCursor: cursor,
206
+ selectionWidth: bottomColumn - topColumn + 1
207
+ });
208
+ if (newSourceCol === null) {
209
+ continue;
210
+ }
211
+ if (newSourceCol !== sourceColumn) {
212
+ TH = wtTable.getColumnHeader(newSourceCol, positiveBasedHeaderLevel);
213
+ }
214
+ callback(TH);
215
+ }
216
+ cursor += 1;
217
+ }
218
+ }
219
+
220
+ /**
221
+ * Scans the table (only rendered headers) and collect all row headers (TH) that match
222
+ * the coordinates passed in the Selection instance.
223
+ *
224
+ * @param {function(HTMLTableElement): void} callback The callback function to trigger.
225
+ */
226
+ }, {
227
+ key: "scanRowsInHeadersRange",
228
+ value: function scanRowsInHeadersRange(callback) {
229
+ var _classPrivateFieldGet5 = _classPrivateFieldGet(this, _selection).getCorners(),
230
+ _classPrivateFieldGet6 = _slicedToArray(_classPrivateFieldGet5, 4),
231
+ topRow = _classPrivateFieldGet6[0],
232
+ topColumn = _classPrivateFieldGet6[1],
233
+ bottomRow = _classPrivateFieldGet6[2],
234
+ bottomColumn = _classPrivateFieldGet6[3];
235
+ var _classPrivateFieldGet7 = _classPrivateFieldGet(this, _activeOverlaysWot),
236
+ wtTable = _classPrivateFieldGet7.wtTable;
237
+ var renderedRowsCount = wtTable.getRenderedRowsCount();
238
+ var rowHeadersCount = wtTable.getRowHeadersCount();
239
+ var cursor = 0;
240
+ for (var row = -wtTable.getColumnHeadersCount(); row < renderedRowsCount; row++) {
241
+ var sourceRow = wtTable.rowFilter.renderedToSource(row);
242
+ if (sourceRow < topRow || sourceRow > bottomRow) {
243
+ continue;
244
+ }
245
+ for (var headerLevel = -rowHeadersCount; headerLevel < 0; headerLevel++) {
246
+ if (headerLevel < topColumn || headerLevel > bottomColumn) {
247
+ continue;
248
+ }
249
+ var positiveBasedHeaderLevel = headerLevel + rowHeadersCount;
250
+ var TH = wtTable.getRowHeader(sourceRow, positiveBasedHeaderLevel);
251
+ var newSourceRow = _classPrivateFieldGet(this, _activeOverlaysWot).getSetting('onBeforeHighlightingRowHeader', sourceRow, positiveBasedHeaderLevel, {
252
+ selectionType: _classPrivateFieldGet(this, _selection).settings.selectionType,
253
+ rowCursor: cursor,
254
+ selectionHeight: bottomRow - topRow + 1
255
+ });
256
+ if (newSourceRow === null) {
257
+ continue;
258
+ }
259
+ if (newSourceRow !== sourceRow) {
260
+ TH = wtTable.getRowHeader(newSourceRow, positiveBasedHeaderLevel);
261
+ }
262
+ callback(TH);
263
+ }
264
+ cursor += 1;
265
+ }
266
+ }
267
+
268
+ /**
269
+ * Scans the table (only rendered cells) and collect all cells (TR) that match
270
+ * the coordinates passed in the Selection instance.
271
+ *
272
+ * @param {function(HTMLTableElement): void} callback The callback function to trigger.
273
+ */
274
+ }, {
275
+ key: "scanCellsRange",
276
+ value: function scanCellsRange(callback) {
277
+ var _this = this;
278
+ var _classPrivateFieldGet8 = _classPrivateFieldGet(this, _selection).getCorners(),
279
+ _classPrivateFieldGet9 = _slicedToArray(_classPrivateFieldGet8, 4),
280
+ topRow = _classPrivateFieldGet9[0],
281
+ topColumn = _classPrivateFieldGet9[1],
282
+ bottomRow = _classPrivateFieldGet9[2],
283
+ bottomColumn = _classPrivateFieldGet9[3];
284
+ var _classPrivateFieldGet10 = _classPrivateFieldGet(this, _activeOverlaysWot),
285
+ wtTable = _classPrivateFieldGet10.wtTable;
286
+ _classPrivateMethodGet(this, _scanCellsRange, _scanCellsRange2).call(this, function (sourceRow, sourceColumn) {
287
+ if (sourceRow >= topRow && sourceRow <= bottomRow && sourceColumn >= topColumn && sourceColumn <= bottomColumn) {
288
+ var cell = wtTable.getCell(_classPrivateFieldGet(_this, _activeOverlaysWot).createCellCoords(sourceRow, sourceColumn));
289
+
290
+ // support for old API
291
+ var additionalSelectionClass = _classPrivateFieldGet(_this, _activeOverlaysWot).getSetting('onAfterDrawSelection', sourceRow, sourceColumn, _classPrivateFieldGet(_this, _selection).settings.layerLevel);
292
+ if (typeof additionalSelectionClass === 'string') {
293
+ (0, _element.addClass)(cell, additionalSelectionClass);
294
+ }
295
+ callback(cell);
296
+ }
297
+ });
298
+ }
299
+
300
+ /**
301
+ * Scans the table (only rendered cells) and collects all cells (TR) that match the coordinates
302
+ * passed in the Selection instance but only for the X axis (rows).
303
+ *
304
+ * @param {function(HTMLTableElement): void} callback The callback function to trigger.
305
+ */
306
+ }, {
307
+ key: "scanRowsInCellsRange",
308
+ value: function scanRowsInCellsRange(callback) {
309
+ var _this2 = this;
310
+ // eslint-disable-next-line comma-spacing
311
+ var _classPrivateFieldGet11 = _classPrivateFieldGet(this, _selection).getCorners(),
312
+ _classPrivateFieldGet12 = _slicedToArray(_classPrivateFieldGet11, 3),
313
+ topRow = _classPrivateFieldGet12[0],
314
+ bottomRow = _classPrivateFieldGet12[2];
315
+ var _classPrivateFieldGet13 = _classPrivateFieldGet(this, _activeOverlaysWot),
316
+ wtTable = _classPrivateFieldGet13.wtTable;
317
+ _classPrivateMethodGet(this, _scanCellsRange, _scanCellsRange2).call(this, function (sourceRow, sourceColumn) {
318
+ if (sourceRow >= topRow && sourceRow <= bottomRow) {
319
+ var cell = wtTable.getCell(_classPrivateFieldGet(_this2, _activeOverlaysWot).createCellCoords(sourceRow, sourceColumn));
320
+ callback(cell);
321
+ }
322
+ });
323
+ }
324
+
325
+ /**
326
+ * Scans the table (only rendered cells) and collects all cells (TR) that match the coordinates
327
+ * passed in the Selection instance but only for the Y axis (columns).
328
+ *
329
+ * @param {function(HTMLTableElement): void} callback The callback function to trigger.
330
+ */
331
+ }, {
332
+ key: "scanColumnsInCellsRange",
333
+ value: function scanColumnsInCellsRange(callback) {
334
+ var _this3 = this;
335
+ var _classPrivateFieldGet14 = _classPrivateFieldGet(this, _selection).getCorners(),
336
+ _classPrivateFieldGet15 = _slicedToArray(_classPrivateFieldGet14, 4),
337
+ topColumn = _classPrivateFieldGet15[1],
338
+ bottomColumn = _classPrivateFieldGet15[3];
339
+ var _classPrivateFieldGet16 = _classPrivateFieldGet(this, _activeOverlaysWot),
340
+ wtTable = _classPrivateFieldGet16.wtTable;
341
+ _classPrivateMethodGet(this, _scanCellsRange, _scanCellsRange2).call(this, function (sourceRow, sourceColumn) {
342
+ if (sourceColumn >= topColumn && sourceColumn <= bottomColumn) {
343
+ var cell = wtTable.getCell(_classPrivateFieldGet(_this3, _activeOverlaysWot).createCellCoords(sourceRow, sourceColumn));
344
+ callback(cell);
345
+ }
346
+ });
347
+ }
348
+ }]);
349
+ return SelectionScanner;
350
+ }();
351
+ exports.SelectionScanner = SelectionScanner;
352
+ function _scanCellsRange2(callback) {
353
+ var _classPrivateFieldGet17 = _classPrivateFieldGet(this, _activeOverlaysWot),
354
+ wtTable = _classPrivateFieldGet17.wtTable;
355
+ var renderedRowsCount = wtTable.getRenderedRowsCount();
356
+ var renderedColumnsCount = wtTable.getRenderedColumnsCount();
357
+ for (var row = 0; row < renderedRowsCount; row += 1) {
358
+ var sourceRow = wtTable.rowFilter.renderedToSource(row);
359
+ for (var column = 0; column < renderedColumnsCount; column += 1) {
360
+ callback(sourceRow, wtTable.columnFilter.renderedToSource(column));
361
+ }
362
+ }
363
+ }