handsontable 0.0.0-next-ecc62fd-20230525 → 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,328 @@
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.regexp.exec.js");
12
+ 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); }
13
+ exports.__esModule = true;
14
+ exports.SelectionManager = void 0;
15
+ require("core-js/modules/es.array.iterator.js");
16
+ require("core-js/modules/es.object.to-string.js");
17
+ require("core-js/modules/es.string.iterator.js");
18
+ require("core-js/modules/es.weak-map.js");
19
+ require("core-js/modules/web.dom-collections.iterator.js");
20
+ require("core-js/modules/es.weak-set.js");
21
+ require("core-js/modules/es.map.js");
22
+ require("core-js/modules/es.set.js");
23
+ require("core-js/modules/es.array.from.js");
24
+ require("core-js/modules/web.dom-collections.for-each.js");
25
+ require("core-js/modules/es.array.flat.js");
26
+ require("core-js/modules/es.array.unscopables.flat.js");
27
+ require("core-js/modules/es.array.map.js");
28
+ require("core-js/modules/es.array.concat.js");
29
+ var _element = require("../../../../helpers/dom/element");
30
+ var _scanner2 = require("./scanner");
31
+ var _border2 = _interopRequireDefault(require("./border/border"));
32
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
34
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
35
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
36
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
37
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
38
+ 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."); }
39
+ 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); }
40
+ 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; }
41
+ 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; } }
42
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
43
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
44
+ 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); } }
45
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
46
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
47
+ 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); }
48
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
49
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
50
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
51
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
52
+ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
53
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
54
+ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
55
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
56
+ 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; } }
57
+ /**
58
+ * Module responsible for rendering selections (CSS classes) and borders based on the
59
+ * collection of the Selection instances provided throughout the `selections` Walkontable
60
+ * setting.
61
+ *
62
+ * @private
63
+ */
64
+ var _activeOverlaysWot = /*#__PURE__*/new WeakMap();
65
+ var _selections = /*#__PURE__*/new WeakMap();
66
+ var _scanner = /*#__PURE__*/new WeakMap();
67
+ var _appliedClasses = /*#__PURE__*/new WeakMap();
68
+ var _destroyListeners = /*#__PURE__*/new WeakMap();
69
+ var _selectionBorders = /*#__PURE__*/new WeakMap();
70
+ var _resetCells = /*#__PURE__*/new WeakSet();
71
+ var SelectionManager = /*#__PURE__*/function () {
72
+ function SelectionManager(selections) {
73
+ _classCallCheck(this, SelectionManager);
74
+ /**
75
+ * Resets the elements to their initial state (remove the CSS classes that are added in the
76
+ * previous render cycle).
77
+ */
78
+ _classPrivateMethodInitSpec(this, _resetCells);
79
+ /**
80
+ * The overlay's Walkontable instance that are currently processed.
81
+ *
82
+ * @type {Walkontable}
83
+ */
84
+ _classPrivateFieldInitSpec(this, _activeOverlaysWot, {
85
+ writable: true,
86
+ value: void 0
87
+ });
88
+ /**
89
+ * The Highlight instance that holds Selections instances within it.
90
+ *
91
+ * @type {Highlight|null}
92
+ */
93
+ _classPrivateFieldInitSpec(this, _selections, {
94
+ writable: true,
95
+ value: void 0
96
+ });
97
+ /**
98
+ * The SelectionScanner allows to scan and collect the cell and header elements that matches
99
+ * to the coords defined in the selections.
100
+ *
101
+ * @type {SelectionScanner}
102
+ */
103
+ _classPrivateFieldInitSpec(this, _scanner, {
104
+ writable: true,
105
+ value: new _scanner2.SelectionScanner()
106
+ });
107
+ /**
108
+ * The Map tracks applied CSS classes. It's used to reset the elements state to their initial state.
109
+ *
110
+ * @type {WeakMap}
111
+ */
112
+ _classPrivateFieldInitSpec(this, _appliedClasses, {
113
+ writable: true,
114
+ value: new WeakMap()
115
+ });
116
+ /**
117
+ * The Map tracks applied "destroy" listeners for Selection instances.
118
+ *
119
+ * @type {WeakMap}
120
+ */
121
+ _classPrivateFieldInitSpec(this, _destroyListeners, {
122
+ writable: true,
123
+ value: new WeakSet()
124
+ });
125
+ /**
126
+ * The Map holds references to Border classes for Selection instances which requires that when
127
+ * the "border" setting is defined.
128
+ *
129
+ * @type {Map}
130
+ */
131
+ _classPrivateFieldInitSpec(this, _selectionBorders, {
132
+ writable: true,
133
+ value: new Map()
134
+ });
135
+ _classPrivateFieldSet(this, _selections, selections);
136
+ }
137
+
138
+ /**
139
+ * Sets the active Walkontable instance.
140
+ *
141
+ * @param {Walkontable} activeWot The overlays or master Walkontable instance.
142
+ * @returns {SelectionManager}
143
+ */
144
+ _createClass(SelectionManager, [{
145
+ key: "setActiveOverlay",
146
+ value: function setActiveOverlay(activeWot) {
147
+ _classPrivateFieldSet(this, _activeOverlaysWot, activeWot);
148
+ _classPrivateFieldGet(this, _scanner).setActiveOverlay(_classPrivateFieldGet(this, _activeOverlaysWot));
149
+ if (!_classPrivateFieldGet(this, _appliedClasses).has(_classPrivateFieldGet(this, _activeOverlaysWot))) {
150
+ _classPrivateFieldGet(this, _appliedClasses).set(_classPrivateFieldGet(this, _activeOverlaysWot), new Set());
151
+ }
152
+ return this;
153
+ }
154
+
155
+ /**
156
+ * Gets the Selection instance of the "focus" type.
157
+ *
158
+ * @returns {Selection|null}
159
+ */
160
+ }, {
161
+ key: "getFocusSelection",
162
+ value: function getFocusSelection() {
163
+ return _classPrivateFieldGet(this, _selections) !== null ? _classPrivateFieldGet(this, _selections).getFocus() : null;
164
+ }
165
+
166
+ /**
167
+ * Gets the Selection instance of the "area" type.
168
+ *
169
+ * @returns {Selection|null}
170
+ */
171
+ }, {
172
+ key: "getAreaSelection",
173
+ value: function getAreaSelection() {
174
+ return _classPrivateFieldGet(this, _selections) !== null ? _classPrivateFieldGet(this, _selections).createLayeredArea() : null;
175
+ }
176
+
177
+ /**
178
+ * Gets the Border instance associated with Selection instance.
179
+ *
180
+ * @param {Selection} selection The selection instance.
181
+ * @returns {Border|null} Returns the Border instance (new for each overlay Walkontable instance).
182
+ */
183
+ }, {
184
+ key: "getBorderInstance",
185
+ value: function getBorderInstance(selection) {
186
+ if (!selection.settings.border) {
187
+ return null;
188
+ }
189
+ if (_classPrivateFieldGet(this, _selectionBorders).has(selection)) {
190
+ var borders = _classPrivateFieldGet(this, _selectionBorders).get(selection);
191
+ if (borders.has(_classPrivateFieldGet(this, _activeOverlaysWot))) {
192
+ return borders.get(_classPrivateFieldGet(this, _activeOverlaysWot));
193
+ }
194
+ var _border = new _border2.default(_classPrivateFieldGet(this, _activeOverlaysWot), selection.settings);
195
+ borders.set(_classPrivateFieldGet(this, _activeOverlaysWot), _border);
196
+ return _border;
197
+ }
198
+ var border = new _border2.default(_classPrivateFieldGet(this, _activeOverlaysWot), selection.settings);
199
+ _classPrivateFieldGet(this, _selectionBorders).set(selection, new Map([[_classPrivateFieldGet(this, _activeOverlaysWot), border]]));
200
+ return border;
201
+ }
202
+
203
+ /**
204
+ * Gets all Border instances associated with Selection instance for all overlays.
205
+ *
206
+ * @param {Selection} selection The selection instance.
207
+ * @returns {Border[]}
208
+ */
209
+ }, {
210
+ key: "getBorderInstances",
211
+ value: function getBorderInstances(selection) {
212
+ var _classPrivateFieldGet2, _classPrivateFieldGet3;
213
+ return Array.from((_classPrivateFieldGet2 = (_classPrivateFieldGet3 = _classPrivateFieldGet(this, _selectionBorders).get(selection)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.values()) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : []);
214
+ }
215
+
216
+ /**
217
+ * Destroys the Border instance associated with Selection instance.
218
+ *
219
+ * @param {Selection} selection The selection instance.
220
+ */
221
+ }, {
222
+ key: "destroyBorders",
223
+ value: function destroyBorders(selection) {
224
+ _classPrivateFieldGet(this, _selectionBorders).get(selection).forEach(function (border) {
225
+ return border.destroy();
226
+ });
227
+ _classPrivateFieldGet(this, _selectionBorders).delete(selection);
228
+ }
229
+
230
+ /**
231
+ * Renders all the selections (add CSS classes to cells and draw borders).
232
+ *
233
+ * @param {boolean} fastDraw Indicates the render cycle type (fast/slow).
234
+ */
235
+ }, {
236
+ key: "render",
237
+ value: function render(fastDraw) {
238
+ var _this = this;
239
+ if (_classPrivateFieldGet(this, _selections) === null) {
240
+ return;
241
+ }
242
+ if (fastDraw) {
243
+ // there was no rerender, so we need to remove classNames by ourselves
244
+ _classPrivateMethodGet(this, _resetCells, _resetCells2).call(this);
245
+ }
246
+ var selections = Array.from(_classPrivateFieldGet(this, _selections));
247
+ var classNamesMap = new Map();
248
+ var _loop = function _loop() {
249
+ var selection = selections[i];
250
+ var _selection$settings = selection.settings,
251
+ className = _selection$settings.className,
252
+ createLayers = _selection$settings.createLayers,
253
+ selectionType = _selection$settings.selectionType;
254
+ if (!_classPrivateFieldGet(_this, _destroyListeners).has(selection)) {
255
+ _classPrivateFieldGet(_this, _destroyListeners).add(selection);
256
+ selection.addLocalHook('destroy', function () {
257
+ return _this.destroyBorders(selection);
258
+ });
259
+ }
260
+ var borderInstance = _this.getBorderInstance(selection);
261
+ if (selection.isEmpty()) {
262
+ borderInstance === null || borderInstance === void 0 ? void 0 : borderInstance.disappear();
263
+ return "continue"; // eslint-disable-line no-continue
264
+ }
265
+ if (className) {
266
+ var elements = _classPrivateFieldGet(_this, _scanner).setActiveSelection(selection).scan();
267
+ elements.forEach(function (element) {
268
+ if (classNamesMap.has(element)) {
269
+ var classNamesLayers = classNamesMap.get(element);
270
+ if (classNamesLayers.has(className) && createLayers === true) {
271
+ classNamesLayers.set(className, classNamesLayers.get(className) + 1);
272
+ } else {
273
+ classNamesLayers.set(className, 1);
274
+ }
275
+ } else {
276
+ classNamesMap.set(element, new Map([[className, 1]]));
277
+ }
278
+ });
279
+ }
280
+ var corners = selection.getCorners();
281
+ _classPrivateFieldGet(_this, _activeOverlaysWot).getSetting('onBeforeDrawBorders', corners, selectionType);
282
+ borderInstance === null || borderInstance === void 0 ? void 0 : borderInstance.appear(corners);
283
+ };
284
+ for (var i = 0; i < selections.length; i++) {
285
+ var _ret = _loop();
286
+ if (_ret === "continue") continue;
287
+ }
288
+ classNamesMap.forEach(function (classNamesLayers, element) {
289
+ var classNames = Array.from(classNamesLayers).map(function (_ref) {
290
+ var _ref2 = _slicedToArray(_ref, 2),
291
+ className = _ref2[0],
292
+ occurrenceCount = _ref2[1];
293
+ if (occurrenceCount === 1) {
294
+ return className;
295
+ }
296
+ return [className].concat(_toConsumableArray(Array.from({
297
+ length: occurrenceCount - 1
298
+ }, function (_, i) {
299
+ return "".concat(className, "-").concat(i + 1);
300
+ })));
301
+ }).flat();
302
+ classNames.forEach(function (className) {
303
+ return _classPrivateFieldGet(_this, _appliedClasses).get(_classPrivateFieldGet(_this, _activeOverlaysWot)).add(className);
304
+ });
305
+ (0, _element.addClass)(element, classNames);
306
+ });
307
+ }
308
+ }]);
309
+ return SelectionManager;
310
+ }();
311
+ exports.SelectionManager = SelectionManager;
312
+ function _resetCells2() {
313
+ var _this2 = this;
314
+ var appliedOverlaysClasses = _classPrivateFieldGet(this, _appliedClasses).get(_classPrivateFieldGet(this, _activeOverlaysWot));
315
+ var classesToRemove = _classPrivateFieldGet(this, _activeOverlaysWot).wtSettings.getSetting('onBeforeRemoveCellClassNames');
316
+ if (Array.isArray(classesToRemove)) {
317
+ for (var i = 0; i < classesToRemove.length; i++) {
318
+ appliedOverlaysClasses.add(classesToRemove[i]);
319
+ }
320
+ }
321
+ appliedOverlaysClasses.forEach(function (className) {
322
+ var nodes = _classPrivateFieldGet(_this2, _activeOverlaysWot).wtTable.TABLE.querySelectorAll(".".concat(className));
323
+ for (var _i2 = 0, len = nodes.length; _i2 < len; _i2++) {
324
+ (0, _element.removeClass)(nodes[_i2], className);
325
+ }
326
+ });
327
+ appliedOverlaysClasses.clear();
328
+ }
@@ -0,0 +1,322 @@
1
+ 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); }
2
+ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
3
+ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
+ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
5
+ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
6
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
7
+ 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."); }
8
+ 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); }
9
+ 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; }
10
+ 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; } }
11
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
+ import "core-js/modules/es.array.iterator.js";
13
+ import "core-js/modules/es.object.to-string.js";
14
+ import "core-js/modules/es.string.iterator.js";
15
+ import "core-js/modules/es.weak-map.js";
16
+ import "core-js/modules/web.dom-collections.iterator.js";
17
+ import "core-js/modules/es.weak-set.js";
18
+ import "core-js/modules/es.map.js";
19
+ import "core-js/modules/es.set.js";
20
+ import "core-js/modules/es.array.from.js";
21
+ import "core-js/modules/web.dom-collections.for-each.js";
22
+ import "core-js/modules/es.array.flat.js";
23
+ import "core-js/modules/es.array.unscopables.flat.js";
24
+ import "core-js/modules/es.array.map.js";
25
+ import "core-js/modules/es.array.concat.js";
26
+ import "core-js/modules/es.symbol.to-primitive.js";
27
+ import "core-js/modules/es.date.to-primitive.js";
28
+ import "core-js/modules/es.symbol.js";
29
+ import "core-js/modules/es.symbol.description.js";
30
+ import "core-js/modules/es.number.constructor.js";
31
+ import "core-js/modules/es.symbol.iterator.js";
32
+ import "core-js/modules/es.array.slice.js";
33
+ import "core-js/modules/es.function.name.js";
34
+ import "core-js/modules/es.regexp.exec.js";
35
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
36
+ 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); } }
37
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
38
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
39
+ 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); }
40
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
41
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
42
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
43
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
44
+ function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
45
+ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
46
+ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
47
+ function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
48
+ 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; } }
49
+ import { removeClass, addClass } from "../../../../helpers/dom/element.mjs";
50
+ import { SelectionScanner } from "./scanner.mjs";
51
+ import Border from "./border/border.mjs";
52
+ /**
53
+ * Module responsible for rendering selections (CSS classes) and borders based on the
54
+ * collection of the Selection instances provided throughout the `selections` Walkontable
55
+ * setting.
56
+ *
57
+ * @private
58
+ */
59
+ var _activeOverlaysWot = /*#__PURE__*/new WeakMap();
60
+ var _selections = /*#__PURE__*/new WeakMap();
61
+ var _scanner = /*#__PURE__*/new WeakMap();
62
+ var _appliedClasses = /*#__PURE__*/new WeakMap();
63
+ var _destroyListeners = /*#__PURE__*/new WeakMap();
64
+ var _selectionBorders = /*#__PURE__*/new WeakMap();
65
+ var _resetCells = /*#__PURE__*/new WeakSet();
66
+ export var SelectionManager = /*#__PURE__*/function () {
67
+ function SelectionManager(selections) {
68
+ _classCallCheck(this, SelectionManager);
69
+ /**
70
+ * Resets the elements to their initial state (remove the CSS classes that are added in the
71
+ * previous render cycle).
72
+ */
73
+ _classPrivateMethodInitSpec(this, _resetCells);
74
+ /**
75
+ * The overlay's Walkontable instance that are currently processed.
76
+ *
77
+ * @type {Walkontable}
78
+ */
79
+ _classPrivateFieldInitSpec(this, _activeOverlaysWot, {
80
+ writable: true,
81
+ value: void 0
82
+ });
83
+ /**
84
+ * The Highlight instance that holds Selections instances within it.
85
+ *
86
+ * @type {Highlight|null}
87
+ */
88
+ _classPrivateFieldInitSpec(this, _selections, {
89
+ writable: true,
90
+ value: void 0
91
+ });
92
+ /**
93
+ * The SelectionScanner allows to scan and collect the cell and header elements that matches
94
+ * to the coords defined in the selections.
95
+ *
96
+ * @type {SelectionScanner}
97
+ */
98
+ _classPrivateFieldInitSpec(this, _scanner, {
99
+ writable: true,
100
+ value: new SelectionScanner()
101
+ });
102
+ /**
103
+ * The Map tracks applied CSS classes. It's used to reset the elements state to their initial state.
104
+ *
105
+ * @type {WeakMap}
106
+ */
107
+ _classPrivateFieldInitSpec(this, _appliedClasses, {
108
+ writable: true,
109
+ value: new WeakMap()
110
+ });
111
+ /**
112
+ * The Map tracks applied "destroy" listeners for Selection instances.
113
+ *
114
+ * @type {WeakMap}
115
+ */
116
+ _classPrivateFieldInitSpec(this, _destroyListeners, {
117
+ writable: true,
118
+ value: new WeakSet()
119
+ });
120
+ /**
121
+ * The Map holds references to Border classes for Selection instances which requires that when
122
+ * the "border" setting is defined.
123
+ *
124
+ * @type {Map}
125
+ */
126
+ _classPrivateFieldInitSpec(this, _selectionBorders, {
127
+ writable: true,
128
+ value: new Map()
129
+ });
130
+ _classPrivateFieldSet(this, _selections, selections);
131
+ }
132
+
133
+ /**
134
+ * Sets the active Walkontable instance.
135
+ *
136
+ * @param {Walkontable} activeWot The overlays or master Walkontable instance.
137
+ * @returns {SelectionManager}
138
+ */
139
+ _createClass(SelectionManager, [{
140
+ key: "setActiveOverlay",
141
+ value: function setActiveOverlay(activeWot) {
142
+ _classPrivateFieldSet(this, _activeOverlaysWot, activeWot);
143
+ _classPrivateFieldGet(this, _scanner).setActiveOverlay(_classPrivateFieldGet(this, _activeOverlaysWot));
144
+ if (!_classPrivateFieldGet(this, _appliedClasses).has(_classPrivateFieldGet(this, _activeOverlaysWot))) {
145
+ _classPrivateFieldGet(this, _appliedClasses).set(_classPrivateFieldGet(this, _activeOverlaysWot), new Set());
146
+ }
147
+ return this;
148
+ }
149
+
150
+ /**
151
+ * Gets the Selection instance of the "focus" type.
152
+ *
153
+ * @returns {Selection|null}
154
+ */
155
+ }, {
156
+ key: "getFocusSelection",
157
+ value: function getFocusSelection() {
158
+ return _classPrivateFieldGet(this, _selections) !== null ? _classPrivateFieldGet(this, _selections).getFocus() : null;
159
+ }
160
+
161
+ /**
162
+ * Gets the Selection instance of the "area" type.
163
+ *
164
+ * @returns {Selection|null}
165
+ */
166
+ }, {
167
+ key: "getAreaSelection",
168
+ value: function getAreaSelection() {
169
+ return _classPrivateFieldGet(this, _selections) !== null ? _classPrivateFieldGet(this, _selections).createLayeredArea() : null;
170
+ }
171
+
172
+ /**
173
+ * Gets the Border instance associated with Selection instance.
174
+ *
175
+ * @param {Selection} selection The selection instance.
176
+ * @returns {Border|null} Returns the Border instance (new for each overlay Walkontable instance).
177
+ */
178
+ }, {
179
+ key: "getBorderInstance",
180
+ value: function getBorderInstance(selection) {
181
+ if (!selection.settings.border) {
182
+ return null;
183
+ }
184
+ if (_classPrivateFieldGet(this, _selectionBorders).has(selection)) {
185
+ var borders = _classPrivateFieldGet(this, _selectionBorders).get(selection);
186
+ if (borders.has(_classPrivateFieldGet(this, _activeOverlaysWot))) {
187
+ return borders.get(_classPrivateFieldGet(this, _activeOverlaysWot));
188
+ }
189
+ var _border = new Border(_classPrivateFieldGet(this, _activeOverlaysWot), selection.settings);
190
+ borders.set(_classPrivateFieldGet(this, _activeOverlaysWot), _border);
191
+ return _border;
192
+ }
193
+ var border = new Border(_classPrivateFieldGet(this, _activeOverlaysWot), selection.settings);
194
+ _classPrivateFieldGet(this, _selectionBorders).set(selection, new Map([[_classPrivateFieldGet(this, _activeOverlaysWot), border]]));
195
+ return border;
196
+ }
197
+
198
+ /**
199
+ * Gets all Border instances associated with Selection instance for all overlays.
200
+ *
201
+ * @param {Selection} selection The selection instance.
202
+ * @returns {Border[]}
203
+ */
204
+ }, {
205
+ key: "getBorderInstances",
206
+ value: function getBorderInstances(selection) {
207
+ var _classPrivateFieldGet2, _classPrivateFieldGet3;
208
+ return Array.from((_classPrivateFieldGet2 = (_classPrivateFieldGet3 = _classPrivateFieldGet(this, _selectionBorders).get(selection)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.values()) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : []);
209
+ }
210
+
211
+ /**
212
+ * Destroys the Border instance associated with Selection instance.
213
+ *
214
+ * @param {Selection} selection The selection instance.
215
+ */
216
+ }, {
217
+ key: "destroyBorders",
218
+ value: function destroyBorders(selection) {
219
+ _classPrivateFieldGet(this, _selectionBorders).get(selection).forEach(function (border) {
220
+ return border.destroy();
221
+ });
222
+ _classPrivateFieldGet(this, _selectionBorders).delete(selection);
223
+ }
224
+
225
+ /**
226
+ * Renders all the selections (add CSS classes to cells and draw borders).
227
+ *
228
+ * @param {boolean} fastDraw Indicates the render cycle type (fast/slow).
229
+ */
230
+ }, {
231
+ key: "render",
232
+ value: function render(fastDraw) {
233
+ var _this = this;
234
+ if (_classPrivateFieldGet(this, _selections) === null) {
235
+ return;
236
+ }
237
+ if (fastDraw) {
238
+ // there was no rerender, so we need to remove classNames by ourselves
239
+ _classPrivateMethodGet(this, _resetCells, _resetCells2).call(this);
240
+ }
241
+ var selections = Array.from(_classPrivateFieldGet(this, _selections));
242
+ var classNamesMap = new Map();
243
+ var _loop = function _loop() {
244
+ var selection = selections[i];
245
+ var _selection$settings = selection.settings,
246
+ className = _selection$settings.className,
247
+ createLayers = _selection$settings.createLayers,
248
+ selectionType = _selection$settings.selectionType;
249
+ if (!_classPrivateFieldGet(_this, _destroyListeners).has(selection)) {
250
+ _classPrivateFieldGet(_this, _destroyListeners).add(selection);
251
+ selection.addLocalHook('destroy', function () {
252
+ return _this.destroyBorders(selection);
253
+ });
254
+ }
255
+ var borderInstance = _this.getBorderInstance(selection);
256
+ if (selection.isEmpty()) {
257
+ borderInstance === null || borderInstance === void 0 ? void 0 : borderInstance.disappear();
258
+ return "continue"; // eslint-disable-line no-continue
259
+ }
260
+ if (className) {
261
+ var elements = _classPrivateFieldGet(_this, _scanner).setActiveSelection(selection).scan();
262
+ elements.forEach(function (element) {
263
+ if (classNamesMap.has(element)) {
264
+ var classNamesLayers = classNamesMap.get(element);
265
+ if (classNamesLayers.has(className) && createLayers === true) {
266
+ classNamesLayers.set(className, classNamesLayers.get(className) + 1);
267
+ } else {
268
+ classNamesLayers.set(className, 1);
269
+ }
270
+ } else {
271
+ classNamesMap.set(element, new Map([[className, 1]]));
272
+ }
273
+ });
274
+ }
275
+ var corners = selection.getCorners();
276
+ _classPrivateFieldGet(_this, _activeOverlaysWot).getSetting('onBeforeDrawBorders', corners, selectionType);
277
+ borderInstance === null || borderInstance === void 0 ? void 0 : borderInstance.appear(corners);
278
+ };
279
+ for (var i = 0; i < selections.length; i++) {
280
+ var _ret = _loop();
281
+ if (_ret === "continue") continue;
282
+ }
283
+ classNamesMap.forEach(function (classNamesLayers, element) {
284
+ var classNames = Array.from(classNamesLayers).map(function (_ref) {
285
+ var _ref2 = _slicedToArray(_ref, 2),
286
+ className = _ref2[0],
287
+ occurrenceCount = _ref2[1];
288
+ if (occurrenceCount === 1) {
289
+ return className;
290
+ }
291
+ return [className].concat(_toConsumableArray(Array.from({
292
+ length: occurrenceCount - 1
293
+ }, function (_, i) {
294
+ return "".concat(className, "-").concat(i + 1);
295
+ })));
296
+ }).flat();
297
+ classNames.forEach(function (className) {
298
+ return _classPrivateFieldGet(_this, _appliedClasses).get(_classPrivateFieldGet(_this, _activeOverlaysWot)).add(className);
299
+ });
300
+ addClass(element, classNames);
301
+ });
302
+ }
303
+ }]);
304
+ return SelectionManager;
305
+ }();
306
+ function _resetCells2() {
307
+ var _this2 = this;
308
+ var appliedOverlaysClasses = _classPrivateFieldGet(this, _appliedClasses).get(_classPrivateFieldGet(this, _activeOverlaysWot));
309
+ var classesToRemove = _classPrivateFieldGet(this, _activeOverlaysWot).wtSettings.getSetting('onBeforeRemoveCellClassNames');
310
+ if (Array.isArray(classesToRemove)) {
311
+ for (var i = 0; i < classesToRemove.length; i++) {
312
+ appliedOverlaysClasses.add(classesToRemove[i]);
313
+ }
314
+ }
315
+ appliedOverlaysClasses.forEach(function (className) {
316
+ var nodes = _classPrivateFieldGet(_this2, _activeOverlaysWot).wtTable.TABLE.querySelectorAll(".".concat(className));
317
+ for (var _i2 = 0, len = nodes.length; _i2 < len; _i2++) {
318
+ removeClass(nodes[_i2], className);
319
+ }
320
+ });
321
+ appliedOverlaysClasses.clear();
322
+ }