handsontable 0.0.0-next-be250b6-20230621 → 0.0.0-next-dcd0acc-20230621

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 (237) hide show
  1. package/3rdparty/walkontable/src/{selection/border/border.js → border.js} +12 -7
  2. package/3rdparty/walkontable/src/{selection/border/border.mjs → border.mjs} +12 -7
  3. package/3rdparty/walkontable/src/cell/coords.d.ts +1 -6
  4. package/3rdparty/walkontable/src/cell/coords.js +12 -61
  5. package/3rdparty/walkontable/src/cell/coords.mjs +12 -61
  6. package/3rdparty/walkontable/src/cell/range.d.ts +2 -9
  7. package/3rdparty/walkontable/src/cell/range.js +7 -44
  8. package/3rdparty/walkontable/src/cell/range.mjs +7 -44
  9. package/3rdparty/walkontable/src/core/_base.js +3 -9
  10. package/3rdparty/walkontable/src/core/_base.mjs +3 -9
  11. package/3rdparty/walkontable/src/core/clone.js +2 -2
  12. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  13. package/3rdparty/walkontable/src/core/core.js +2 -3
  14. package/3rdparty/walkontable/src/core/core.mjs +2 -3
  15. package/3rdparty/walkontable/src/event.js +7 -7
  16. package/3rdparty/walkontable/src/event.mjs +7 -7
  17. package/3rdparty/walkontable/src/facade/core.js +2 -2
  18. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  19. package/3rdparty/walkontable/src/index.js +2 -10
  20. package/3rdparty/walkontable/src/index.mjs +2 -2
  21. package/3rdparty/walkontable/src/overlay/_base.js +1 -1
  22. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
  23. package/3rdparty/walkontable/src/overlay/inlineStart.js +4 -2
  24. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +4 -2
  25. package/3rdparty/walkontable/src/overlay/top.js +4 -2
  26. package/3rdparty/walkontable/src/overlay/top.mjs +4 -2
  27. package/3rdparty/walkontable/src/selection.js +355 -0
  28. package/3rdparty/walkontable/src/selection.mjs +349 -0
  29. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +0 -9
  30. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +0 -9
  31. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +0 -9
  32. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +0 -9
  33. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +0 -9
  34. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +0 -9
  35. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +0 -9
  36. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +0 -9
  37. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +0 -9
  38. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +0 -9
  39. package/3rdparty/walkontable/src/table.js +79 -7
  40. package/3rdparty/walkontable/src/table.mjs +80 -8
  41. package/base.js +2 -2
  42. package/base.mjs +2 -2
  43. package/core.d.ts +3 -5
  44. package/core.js +309 -127
  45. package/core.mjs +309 -127
  46. package/dataMap/metaManager/metaSchema.js +0 -19
  47. package/dataMap/metaManager/metaSchema.mjs +0 -19
  48. package/dist/handsontable.css +3 -8
  49. package/dist/handsontable.full.css +3 -8
  50. package/dist/handsontable.full.js +9113 -11930
  51. package/dist/handsontable.full.min.css +3 -3
  52. package/dist/handsontable.full.min.js +107 -107
  53. package/dist/handsontable.js +12329 -15146
  54. package/dist/handsontable.min.css +3 -3
  55. package/dist/handsontable.min.js +4 -4
  56. package/editorManager.js +94 -21
  57. package/editorManager.mjs +98 -26
  58. package/editors/textEditor/textEditor.js +11 -3
  59. package/editors/textEditor/textEditor.mjs +12 -4
  60. package/helpers/mixed.js +1 -1
  61. package/helpers/mixed.mjs +1 -1
  62. package/helpers/number.d.ts +0 -1
  63. package/helpers/number.js +0 -18
  64. package/helpers/number.mjs +0 -17
  65. package/package.json +1 -1
  66. package/pluginHooks.d.ts +1 -5
  67. package/pluginHooks.js +1 -89
  68. package/pluginHooks.mjs +1 -89
  69. package/plugins/collapsibleColumns/collapsibleColumns.js +24 -81
  70. package/plugins/collapsibleColumns/collapsibleColumns.mjs +24 -81
  71. package/plugins/columnSorting/columnSorting.js +8 -50
  72. package/plugins/columnSorting/columnSorting.mjs +9 -49
  73. package/plugins/columnSorting/index.js +2 -4
  74. package/plugins/columnSorting/index.mjs +1 -1
  75. package/plugins/copyPaste/copyPaste.js +1 -5
  76. package/plugins/copyPaste/copyPaste.mjs +1 -5
  77. package/plugins/customBorders/customBorders.js +53 -18
  78. package/plugins/customBorders/customBorders.mjs +54 -19
  79. package/plugins/mergeCells/mergeCells.js +18 -5
  80. package/plugins/mergeCells/mergeCells.mjs +18 -5
  81. package/plugins/multiColumnSorting/multiColumnSorting.js +3 -42
  82. package/plugins/multiColumnSorting/multiColumnSorting.mjs +3 -42
  83. package/plugins/nestedHeaders/nestedHeaders.js +10 -132
  84. package/plugins/nestedHeaders/nestedHeaders.mjs +10 -132
  85. package/plugins/nestedHeaders/stateManager/index.js +0 -37
  86. package/plugins/nestedHeaders/stateManager/index.mjs +0 -37
  87. package/plugins/nestedRows/nestedRows.js +7 -52
  88. package/plugins/nestedRows/nestedRows.mjs +7 -52
  89. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  90. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  91. package/selection/highlight/constants.js +16 -0
  92. package/selection/highlight/constants.mjs +6 -0
  93. package/selection/highlight/highlight.js +89 -312
  94. package/selection/highlight/highlight.mjs +85 -302
  95. package/selection/highlight/types/activeHeader.js +9 -10
  96. package/selection/highlight/types/activeHeader.mjs +8 -10
  97. package/selection/highlight/types/area.js +27 -12
  98. package/selection/highlight/types/area.mjs +30 -16
  99. package/selection/highlight/types/{focus.js → cell.js} +8 -5
  100. package/selection/highlight/types/{focus.mjs → cell.mjs} +7 -5
  101. package/selection/highlight/types/customSelection.js +10 -7
  102. package/selection/highlight/types/customSelection.mjs +9 -7
  103. package/selection/highlight/types/fill.js +8 -5
  104. package/selection/highlight/types/fill.mjs +7 -5
  105. package/selection/highlight/types/header.js +20 -10
  106. package/selection/highlight/types/header.mjs +19 -10
  107. package/selection/highlight/types/{row.js → index.js} +31 -27
  108. package/selection/highlight/types/{row.mjs → index.mjs} +29 -24
  109. package/selection/highlight/visualSelection.js +27 -31
  110. package/selection/highlight/visualSelection.mjs +27 -31
  111. package/selection/index.js +7 -4
  112. package/selection/index.mjs +3 -2
  113. package/selection/mouseEventHandler.js +1 -1
  114. package/selection/mouseEventHandler.mjs +1 -1
  115. package/selection/range.js +8 -8
  116. package/selection/range.mjs +8 -8
  117. package/selection/selection.js +181 -315
  118. package/selection/selection.mjs +180 -310
  119. package/selection/transformation.js +96 -233
  120. package/selection/transformation.mjs +93 -230
  121. package/selection/utils.js +36 -12
  122. package/selection/utils.mjs +36 -13
  123. package/settings.d.ts +0 -1
  124. package/shortcuts/manager.js +0 -2
  125. package/shortcuts/manager.mjs +0 -2
  126. package/tableView.js +9 -58
  127. package/tableView.mjs +9 -58
  128. package/translations/indexMapper.js +9 -8
  129. package/translations/indexMapper.mjs +9 -8
  130. package/3rdparty/walkontable/src/selection/border/constants.js +0 -18
  131. package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -13
  132. package/3rdparty/walkontable/src/selection/constants.js +0 -63
  133. package/3rdparty/walkontable/src/selection/constants.mjs +0 -51
  134. package/3rdparty/walkontable/src/selection/index.js +0 -30
  135. package/3rdparty/walkontable/src/selection/index.mjs +0 -5
  136. package/3rdparty/walkontable/src/selection/manager.js +0 -329
  137. package/3rdparty/walkontable/src/selection/manager.mjs +0 -323
  138. package/3rdparty/walkontable/src/selection/scanner.js +0 -364
  139. package/3rdparty/walkontable/src/selection/scanner.mjs +0 -360
  140. package/3rdparty/walkontable/src/selection/selection.js +0 -133
  141. package/3rdparty/walkontable/src/selection/selection.mjs +0 -127
  142. package/selection/highlight/types/areaLayered.js +0 -54
  143. package/selection/highlight/types/areaLayered.mjs +0 -49
  144. package/selection/highlight/types/column.js +0 -50
  145. package/selection/highlight/types/column.mjs +0 -45
  146. package/shortcutContexts/commands/editor/closeAndSave.js +0 -15
  147. package/shortcutContexts/commands/editor/closeAndSave.mjs +0 -10
  148. package/shortcutContexts/commands/editor/closeWithoutSaving.js +0 -13
  149. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +0 -8
  150. package/shortcutContexts/commands/editor/fastOpen.js +0 -16
  151. package/shortcutContexts/commands/editor/fastOpen.mjs +0 -11
  152. package/shortcutContexts/commands/editor/index.js +0 -16
  153. package/shortcutContexts/commands/editor/index.mjs +0 -12
  154. package/shortcutContexts/commands/editor/open.js +0 -29
  155. package/shortcutContexts/commands/editor/open.mjs +0 -24
  156. package/shortcutContexts/commands/emptySelectedCells.js +0 -12
  157. package/shortcutContexts/commands/emptySelectedCells.mjs +0 -7
  158. package/shortcutContexts/commands/extendCellsSelection/down.js +0 -15
  159. package/shortcutContexts/commands/extendCellsSelection/down.mjs +0 -10
  160. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +0 -21
  161. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +0 -16
  162. package/shortcutContexts/commands/extendCellsSelection/index.js +0 -26
  163. package/shortcutContexts/commands/extendCellsSelection/index.mjs +0 -22
  164. package/shortcutContexts/commands/extendCellsSelection/left.js +0 -15
  165. package/shortcutContexts/commands/extendCellsSelection/left.mjs +0 -10
  166. package/shortcutContexts/commands/extendCellsSelection/right.js +0 -15
  167. package/shortcutContexts/commands/extendCellsSelection/right.mjs +0 -10
  168. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +0 -19
  169. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +0 -14
  170. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +0 -22
  171. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +0 -17
  172. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +0 -17
  173. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +0 -12
  174. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +0 -17
  175. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +0 -12
  176. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +0 -40
  177. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +0 -35
  178. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +0 -40
  179. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +0 -35
  180. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +0 -22
  181. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +0 -17
  182. package/shortcutContexts/commands/extendCellsSelection/toRows.js +0 -19
  183. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +0 -14
  184. package/shortcutContexts/commands/extendCellsSelection/up.js +0 -15
  185. package/shortcutContexts/commands/extendCellsSelection/up.mjs +0 -10
  186. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +0 -21
  187. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +0 -16
  188. package/shortcutContexts/commands/index.js +0 -53
  189. package/shortcutContexts/commands/index.mjs +0 -49
  190. package/shortcutContexts/commands/moveCellSelection/down.js +0 -12
  191. package/shortcutContexts/commands/moveCellSelection/down.mjs +0 -7
  192. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +0 -29
  193. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +0 -24
  194. package/shortcutContexts/commands/moveCellSelection/index.js +0 -28
  195. package/shortcutContexts/commands/moveCellSelection/index.mjs +0 -24
  196. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +0 -13
  197. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +0 -8
  198. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +0 -13
  199. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +0 -8
  200. package/shortcutContexts/commands/moveCellSelection/left.js +0 -11
  201. package/shortcutContexts/commands/moveCellSelection/left.mjs +0 -6
  202. package/shortcutContexts/commands/moveCellSelection/right.js +0 -11
  203. package/shortcutContexts/commands/moveCellSelection/right.mjs +0 -6
  204. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +0 -16
  205. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +0 -11
  206. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +0 -17
  207. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +0 -12
  208. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +0 -13
  209. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +0 -8
  210. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +0 -16
  211. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +0 -11
  212. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +0 -36
  213. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +0 -31
  214. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +0 -36
  215. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +0 -31
  216. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +0 -16
  217. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +0 -11
  218. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +0 -18
  219. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +0 -13
  220. package/shortcutContexts/commands/moveCellSelection/up.js +0 -12
  221. package/shortcutContexts/commands/moveCellSelection/up.mjs +0 -7
  222. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +0 -29
  223. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +0 -24
  224. package/shortcutContexts/commands/populateSelectedCellsData.js +0 -35
  225. package/shortcutContexts/commands/populateSelectedCellsData.mjs +0 -30
  226. package/shortcutContexts/commands/scrollToFocusedCell.js +0 -38
  227. package/shortcutContexts/commands/scrollToFocusedCell.mjs +0 -33
  228. package/shortcutContexts/commands/selectAll.js +0 -11
  229. package/shortcutContexts/commands/selectAll.mjs +0 -6
  230. package/shortcutContexts/constants.js +0 -19
  231. package/shortcutContexts/constants.mjs +0 -12
  232. package/shortcutContexts/editor.js +0 -29
  233. package/shortcutContexts/editor.mjs +0 -25
  234. package/shortcutContexts/grid.js +0 -252
  235. package/shortcutContexts/grid.mjs +0 -248
  236. package/shortcutContexts/index.js +0 -29
  237. package/shortcutContexts/index.mjs +0 -15
@@ -0,0 +1,349 @@
1
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
+ 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."); }
3
+ 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); }
4
+ 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; }
5
+ 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; } }
6
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
+ import "core-js/modules/es.array.includes.js";
8
+ import "core-js/modules/es.string.includes.js";
9
+ import "core-js/modules/es.array.concat.js";
10
+ import "core-js/modules/es.object.to-string.js";
11
+ import "core-js/modules/web.dom-collections.for-each.js";
12
+ import "core-js/modules/es.object.values.js";
13
+ import "core-js/modules/es.symbol.to-primitive.js";
14
+ import "core-js/modules/es.date.to-primitive.js";
15
+ import "core-js/modules/es.symbol.js";
16
+ import "core-js/modules/es.symbol.description.js";
17
+ import "core-js/modules/es.number.constructor.js";
18
+ import "core-js/modules/es.symbol.iterator.js";
19
+ import "core-js/modules/es.array.iterator.js";
20
+ import "core-js/modules/es.string.iterator.js";
21
+ import "core-js/modules/web.dom-collections.iterator.js";
22
+ import "core-js/modules/es.array.slice.js";
23
+ import "core-js/modules/es.regexp.to-string.js";
24
+ import "core-js/modules/es.function.name.js";
25
+ import "core-js/modules/es.array.from.js";
26
+ import "core-js/modules/es.regexp.exec.js";
27
+ 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); }
28
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
29
+ 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); } }
30
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
31
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
32
+ 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); }
33
+ import { addClass, hasClass } from "./../../../helpers/dom/element.mjs";
34
+ import Border from "./border.mjs";
35
+ /**
36
+ * @class Selection
37
+ */
38
+ var Selection = /*#__PURE__*/function () {
39
+ /**
40
+ * @param {object} settings The selection settings object. @todo type.
41
+ * @param {CellRange} cellRange The cell range instance.
42
+ */
43
+ function Selection(settings, cellRange) {
44
+ _classCallCheck(this, Selection);
45
+ this.settings = settings;
46
+ this.cellRange = cellRange || null;
47
+ this.instanceBorders = {};
48
+ this.classNames = [this.settings.className];
49
+ this.classNameGenerator = this.linearClassNameGenerator(this.settings.className, this.settings.layerLevel);
50
+ }
51
+
52
+ /**
53
+ * Each Walkontable clone requires it's own border for every selection. This method creates and returns selection
54
+ * borders per instance.
55
+ *
56
+ * @param {WalkontableFacade} wotInstance The Walkontable instance.
57
+ * @returns {Border}
58
+ */
59
+ _createClass(Selection, [{
60
+ key: "getBorder",
61
+ value: function getBorder(wotInstance) {
62
+ if (!this.instanceBorders[wotInstance.guid]) {
63
+ this.instanceBorders[wotInstance.guid] = new Border(wotInstance, this.settings);
64
+ }
65
+ return this.instanceBorders[wotInstance.guid];
66
+ }
67
+
68
+ /**
69
+ * Checks if selection is empty.
70
+ *
71
+ * @returns {boolean}
72
+ */
73
+ }, {
74
+ key: "isEmpty",
75
+ value: function isEmpty() {
76
+ return this.cellRange === null;
77
+ }
78
+
79
+ /**
80
+ * Adds a cell coords to the selection.
81
+ *
82
+ * @param {CellCoords} coords The cell coordinates to add.
83
+ * @returns {Selection}
84
+ */
85
+ }, {
86
+ key: "add",
87
+ value: function add(coords) {
88
+ if (this.isEmpty()) {
89
+ this.cellRange = this.settings.createCellRange(coords);
90
+ } else {
91
+ this.cellRange.expand(coords);
92
+ }
93
+ return this;
94
+ }
95
+
96
+ /**
97
+ * If selection range from or to property equals oldCoords, replace it with newCoords. Return boolean
98
+ * information about success.
99
+ *
100
+ * @param {CellCoords} oldCoords An old cell coordinates to replace.
101
+ * @param {CellCoords} newCoords The new cell coordinates.
102
+ * @returns {boolean}
103
+ */
104
+ }, {
105
+ key: "replace",
106
+ value: function replace(oldCoords, newCoords) {
107
+ if (!this.isEmpty()) {
108
+ if (this.cellRange.from.isEqual(oldCoords)) {
109
+ this.cellRange.from = newCoords;
110
+ return true;
111
+ }
112
+ if (this.cellRange.to.isEqual(oldCoords)) {
113
+ this.cellRange.to = newCoords;
114
+ return true;
115
+ }
116
+ }
117
+ return false;
118
+ }
119
+
120
+ /**
121
+ * Clears selection.
122
+ *
123
+ * @returns {Selection}
124
+ */
125
+ }, {
126
+ key: "clear",
127
+ value: function clear() {
128
+ this.cellRange = null;
129
+ return this;
130
+ }
131
+
132
+ /**
133
+ * Returns the top left (or top right in RTL) and bottom right (or bottom left in RTL) selection coordinates.
134
+ *
135
+ * @returns {Array} Returns array of coordinates for example `[1, 1, 5, 5]`.
136
+ */
137
+ }, {
138
+ key: "getCorners",
139
+ value: function getCorners() {
140
+ var topStart = this.cellRange.getOuterTopStartCorner();
141
+ var bottomEnd = this.cellRange.getOuterBottomEndCorner();
142
+ return [topStart.row, topStart.col, bottomEnd.row, bottomEnd.col];
143
+ }
144
+
145
+ /**
146
+ * Adds class name to cell element at given coords.
147
+ *
148
+ * @param {WalkontableFacade} wotInstance Walkontable instance.
149
+ * @param {number} sourceRow Cell row coord.
150
+ * @param {number} sourceColumn Cell column coord.
151
+ * @param {string} className Class name.
152
+ * @param {boolean} [markIntersections=false] If `true`, linear className generator will be used to add CSS classes
153
+ * in a continuous way.
154
+ * @returns {Selection}
155
+ */
156
+ }, {
157
+ key: "addClassAtCoords",
158
+ value: function addClassAtCoords(wotInstance, sourceRow, sourceColumn, className) {
159
+ var markIntersections = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
160
+ var TD = wotInstance.wtTable.getCell(this.settings.createCellCoords(sourceRow, sourceColumn));
161
+ if (_typeof(TD) === 'object') {
162
+ var cellClassName = className;
163
+ if (markIntersections) {
164
+ cellClassName = this.classNameGenerator(TD);
165
+ if (!this.classNames.includes(cellClassName)) {
166
+ this.classNames.push(cellClassName);
167
+ }
168
+ }
169
+ addClass(TD, cellClassName);
170
+ }
171
+ return this;
172
+ }
173
+
174
+ /**
175
+ * Generate helper for calculating classNames based on previously added base className.
176
+ * The generated className is always generated as a continuation of the previous className. For example, when
177
+ * the currently checked element has 'area-2' className the generated new className will be 'area-3'. When
178
+ * the element doesn't have any classNames than the base className will be returned ('area');.
179
+ *
180
+ * @param {string} baseClassName Base className to be used.
181
+ * @param {number} layerLevelOwner Layer level which the instance of the Selection belongs to.
182
+ * @returns {Function}
183
+ */
184
+ }, {
185
+ key: "linearClassNameGenerator",
186
+ value: function linearClassNameGenerator(baseClassName, layerLevelOwner) {
187
+ // TODO: Make this recursive function Proper Tail Calls (TCO/PTC) friendly.
188
+ return function calcClassName(element) {
189
+ var previousIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
190
+ if (layerLevelOwner === 0 || previousIndex === 0) {
191
+ return baseClassName;
192
+ }
193
+ var index = previousIndex >= 0 ? previousIndex : layerLevelOwner;
194
+ var className = baseClassName;
195
+ index -= 1;
196
+ var previousClassName = index === 0 ? baseClassName : "".concat(baseClassName, "-").concat(index);
197
+ if (hasClass(element, previousClassName)) {
198
+ var currentLayer = index + 1;
199
+ className = "".concat(baseClassName, "-").concat(currentLayer);
200
+ } else {
201
+ className = calcClassName(element, index);
202
+ }
203
+ return className;
204
+ };
205
+ }
206
+
207
+ /**
208
+ * @param {WalkontableFacade} wotInstance The Walkontable instance.
209
+ */
210
+ }, {
211
+ key: "draw",
212
+ value: function draw(wotInstance) {
213
+ if (this.isEmpty()) {
214
+ if (this.settings.border) {
215
+ this.getBorder(wotInstance).disappear();
216
+ }
217
+ return;
218
+ }
219
+ var renderedRows = wotInstance.wtTable.getRenderedRowsCount();
220
+ var renderedColumns = wotInstance.wtTable.getRenderedColumnsCount();
221
+ var corners = this.getCorners();
222
+ var _corners = _slicedToArray(corners, 4),
223
+ topRow = _corners[0],
224
+ topColumn = _corners[1],
225
+ bottomRow = _corners[2],
226
+ bottomColumn = _corners[3];
227
+ var _this$settings = this.settings,
228
+ highlightHeaderClassName = _this$settings.highlightHeaderClassName,
229
+ highlightColumnClassName = _this$settings.highlightColumnClassName,
230
+ highlightRowClassName = _this$settings.highlightRowClassName,
231
+ highlightOnlyClosestHeader = _this$settings.highlightOnlyClosestHeader,
232
+ selectionType = _this$settings.selectionType;
233
+ var isHeaderSelectionType = selectionType === void 0 || ['active-header', 'header'].includes(selectionType);
234
+ if (isHeaderSelectionType && topColumn !== null && bottomColumn !== null) {
235
+ var selectionColumnCursor = 0;
236
+ for (var column = 0; column < renderedColumns; column += 1) {
237
+ var sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(column);
238
+ if (sourceCol >= topColumn && sourceCol <= bottomColumn) {
239
+ var THs = wotInstance.wtTable.getColumnHeaders(sourceCol);
240
+ var closestHeaderLevel = THs.length - 1;
241
+ if (highlightOnlyClosestHeader && THs.length > 1) {
242
+ THs = [THs[closestHeaderLevel]];
243
+ }
244
+ for (var headerLevel = 0; headerLevel < THs.length; headerLevel += 1) {
245
+ var newClasses = [];
246
+ var TH = THs[headerLevel];
247
+ if (highlightHeaderClassName) {
248
+ newClasses.push(highlightHeaderClassName);
249
+ }
250
+ if (highlightColumnClassName) {
251
+ newClasses.push(highlightColumnClassName);
252
+ }
253
+ headerLevel = highlightOnlyClosestHeader ? closestHeaderLevel : headerLevel;
254
+ var newSourceCol = wotInstance.getSetting('onBeforeHighlightingColumnHeader', sourceCol, headerLevel, {
255
+ selectionType: selectionType,
256
+ columnCursor: selectionColumnCursor,
257
+ selectionWidth: bottomColumn - topColumn + 1,
258
+ classNames: newClasses
259
+ });
260
+ if (newSourceCol !== sourceCol) {
261
+ TH = wotInstance.wtTable.getColumnHeader(newSourceCol, headerLevel);
262
+ }
263
+ addClass(TH, newClasses);
264
+ }
265
+ selectionColumnCursor += 1;
266
+ }
267
+ }
268
+ }
269
+ if (topRow !== null && bottomRow !== null) {
270
+ var selectionRowCursor = 0;
271
+ for (var row = 0; row < renderedRows; row += 1) {
272
+ var sourceRow = wotInstance.wtTable.rowFilter.renderedToSource(row);
273
+ if (isHeaderSelectionType && sourceRow >= topRow && sourceRow <= bottomRow) {
274
+ var _THs = wotInstance.wtTable.getRowHeaders(sourceRow);
275
+ var _closestHeaderLevel = _THs.length - 1;
276
+ if (highlightOnlyClosestHeader && _THs.length > 1) {
277
+ _THs = [_THs[_closestHeaderLevel]];
278
+ }
279
+ for (var _headerLevel = 0; _headerLevel < _THs.length; _headerLevel += 1) {
280
+ var _newClasses = [];
281
+ var _TH = _THs[_headerLevel];
282
+ if (highlightHeaderClassName) {
283
+ _newClasses.push(highlightHeaderClassName);
284
+ }
285
+ if (highlightRowClassName) {
286
+ _newClasses.push(highlightRowClassName);
287
+ }
288
+ _headerLevel = highlightOnlyClosestHeader ? _closestHeaderLevel : _headerLevel;
289
+ var newSourceRow = wotInstance.getSetting('onBeforeHighlightingRowHeader', sourceRow, _headerLevel, {
290
+ selectionType: selectionType,
291
+ rowCursor: selectionRowCursor,
292
+ selectionHeight: bottomRow - topRow + 1,
293
+ classNames: _newClasses
294
+ });
295
+ if (newSourceRow !== sourceRow) {
296
+ _TH = wotInstance.wtTable.getRowHeader(newSourceRow, _headerLevel);
297
+ }
298
+ addClass(_TH, _newClasses);
299
+ }
300
+ selectionRowCursor += 1;
301
+ }
302
+ if (topColumn !== null && bottomColumn !== null) {
303
+ for (var _column = 0; _column < renderedColumns; _column += 1) {
304
+ var _sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(_column);
305
+ if (sourceRow >= topRow && sourceRow <= bottomRow && _sourceCol >= topColumn && _sourceCol <= bottomColumn) {
306
+ // selected cell
307
+ if (this.settings.className) {
308
+ this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, this.settings.className, this.settings.markIntersections);
309
+ }
310
+ } else if (sourceRow >= topRow && sourceRow <= bottomRow) {
311
+ // selection is in this row
312
+ if (highlightRowClassName) {
313
+ this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, highlightRowClassName);
314
+ }
315
+ } else if (_sourceCol >= topColumn && _sourceCol <= bottomColumn) {
316
+ // selection is in this column
317
+ if (highlightColumnClassName) {
318
+ this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, highlightColumnClassName);
319
+ }
320
+ }
321
+ var additionalSelectionClass = wotInstance.getSetting('onAfterDrawSelection', sourceRow, _sourceCol, this.settings.layerLevel);
322
+ if (typeof additionalSelectionClass === 'string') {
323
+ this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, additionalSelectionClass);
324
+ }
325
+ }
326
+ }
327
+ }
328
+ }
329
+ wotInstance.getSetting('onBeforeDrawBorders', corners, this.settings.className);
330
+ if (this.settings.border) {
331
+ // warning! border.appear modifies corners!
332
+ this.getBorder(wotInstance).appear(corners);
333
+ }
334
+ }
335
+
336
+ /**
337
+ * Cleans up all the DOM state related to a Selection instance. Call this prior to deleting a Selection instance.
338
+ */
339
+ }, {
340
+ key: "destroy",
341
+ value: function destroy() {
342
+ Object.values(this.instanceBorders).forEach(function (border) {
343
+ return border.destroy();
344
+ });
345
+ }
346
+ }]);
347
+ return Selection;
348
+ }();
349
+ export default Selection;
@@ -83,15 +83,6 @@ var calculatedColumns = {
83
83
  */
84
84
  getVisibleColumnsCount: function getVisibleColumnsCount() {
85
85
  return this.dataAccessObject.countColumnsVisible;
86
- },
87
- /**
88
- * Get the number of rendered row headers.
89
- *
90
- * @returns {number}
91
- * @this Table
92
- */
93
- getRowHeadersCount: function getRowHeadersCount() {
94
- return this.dataAccessObject.rowHeaders.length;
95
86
  }
96
87
  };
97
88
  (0, _object.defineGetter)(calculatedColumns, 'MIXIN_NAME', MIXIN_NAME, {
@@ -79,15 +79,6 @@ var calculatedColumns = {
79
79
  */
80
80
  getVisibleColumnsCount: function getVisibleColumnsCount() {
81
81
  return this.dataAccessObject.countColumnsVisible;
82
- },
83
- /**
84
- * Get the number of rendered row headers.
85
- *
86
- * @returns {number}
87
- * @this Table
88
- */
89
- getRowHeadersCount: function getRowHeadersCount() {
90
- return this.dataAccessObject.rowHeaders.length;
91
82
  }
92
83
  };
93
84
  defineGetter(calculatedColumns, 'MIXIN_NAME', MIXIN_NAME, {
@@ -83,15 +83,6 @@ var calculatedRows = {
83
83
  */
84
84
  getVisibleRowsCount: function getVisibleRowsCount() {
85
85
  return this.dataAccessObject.countRowsVisible;
86
- },
87
- /**
88
- * Get the number of rendered column headers.
89
- *
90
- * @returns {number}
91
- * @this Table
92
- */
93
- getColumnHeadersCount: function getColumnHeadersCount() {
94
- return this.dataAccessObject.columnHeaders.length;
95
86
  }
96
87
  };
97
88
  (0, _object.defineGetter)(calculatedRows, 'MIXIN_NAME', MIXIN_NAME, {
@@ -79,15 +79,6 @@ var calculatedRows = {
79
79
  */
80
80
  getVisibleRowsCount: function getVisibleRowsCount() {
81
81
  return this.dataAccessObject.countRowsVisible;
82
- },
83
- /**
84
- * Get the number of rendered column headers.
85
- *
86
- * @returns {number}
87
- * @this Table
88
- */
89
- getColumnHeadersCount: function getColumnHeadersCount() {
90
- return this.dataAccessObject.columnHeaders.length;
91
82
  }
92
83
  };
93
84
  defineGetter(calculatedRows, 'MIXIN_NAME', MIXIN_NAME, {
@@ -75,15 +75,6 @@ var stickyColumnsStart = {
75
75
  */
76
76
  getVisibleColumnsCount: function getVisibleColumnsCount() {
77
77
  return this.getRenderedColumnsCount();
78
- },
79
- /**
80
- * Get the number of rendered row headers.
81
- *
82
- * @returns {number}
83
- * @this Table
84
- */
85
- getRowHeadersCount: function getRowHeadersCount() {
86
- return this.dataAccessObject.rowHeaders.length;
87
78
  }
88
79
  };
89
80
  (0, _object.defineGetter)(stickyColumnsStart, 'MIXIN_NAME', MIXIN_NAME, {
@@ -71,15 +71,6 @@ var stickyColumnsStart = {
71
71
  */
72
72
  getVisibleColumnsCount: function getVisibleColumnsCount() {
73
73
  return this.getRenderedColumnsCount();
74
- },
75
- /**
76
- * Get the number of rendered row headers.
77
- *
78
- * @returns {number}
79
- * @this Table
80
- */
81
- getRowHeadersCount: function getRowHeadersCount() {
82
- return this.dataAccessObject.rowHeaders.length;
83
74
  }
84
75
  };
85
76
  defineGetter(stickyColumnsStart, 'MIXIN_NAME', MIXIN_NAME, {
@@ -80,15 +80,6 @@ var stickyRowsBottom = {
80
80
  */
81
81
  getVisibleRowsCount: function getVisibleRowsCount() {
82
82
  return this.getRenderedRowsCount();
83
- },
84
- /**
85
- * Get the number of rendered column headers.
86
- *
87
- * @returns {number}
88
- * @this Table
89
- */
90
- getColumnHeadersCount: function getColumnHeadersCount() {
91
- return 0;
92
83
  }
93
84
  };
94
85
  (0, _object.defineGetter)(stickyRowsBottom, 'MIXIN_NAME', MIXIN_NAME, {
@@ -76,15 +76,6 @@ var stickyRowsBottom = {
76
76
  */
77
77
  getVisibleRowsCount: function getVisibleRowsCount() {
78
78
  return this.getRenderedRowsCount();
79
- },
80
- /**
81
- * Get the number of rendered column headers.
82
- *
83
- * @returns {number}
84
- * @this Table
85
- */
86
- getColumnHeadersCount: function getColumnHeadersCount() {
87
- return 0;
88
79
  }
89
80
  };
90
81
  defineGetter(stickyRowsBottom, 'MIXIN_NAME', MIXIN_NAME, {
@@ -75,15 +75,6 @@ var stickyRowsTop = {
75
75
  */
76
76
  getVisibleRowsCount: function getVisibleRowsCount() {
77
77
  return this.getRenderedRowsCount();
78
- },
79
- /**
80
- * Get the number of rendered column headers.
81
- *
82
- * @returns {number}
83
- * @this Table
84
- */
85
- getColumnHeadersCount: function getColumnHeadersCount() {
86
- return this.dataAccessObject.columnHeaders.length;
87
78
  }
88
79
  };
89
80
  (0, _object.defineGetter)(stickyRowsTop, 'MIXIN_NAME', MIXIN_NAME, {
@@ -71,15 +71,6 @@ var stickyRowsTop = {
71
71
  */
72
72
  getVisibleRowsCount: function getVisibleRowsCount() {
73
73
  return this.getRenderedRowsCount();
74
- },
75
- /**
76
- * Get the number of rendered column headers.
77
- *
78
- * @returns {number}
79
- * @this Table
80
- */
81
- getColumnHeadersCount: function getColumnHeadersCount() {
82
- return this.dataAccessObject.columnHeaders.length;
83
74
  }
84
75
  };
85
76
  defineGetter(stickyRowsTop, 'MIXIN_NAME', MIXIN_NAME, {
@@ -2,15 +2,16 @@
2
2
 
3
3
  require("core-js/modules/es.symbol.iterator.js");
4
4
  require("core-js/modules/es.array.iterator.js");
5
- require("core-js/modules/es.string.iterator.js");
6
5
  require("core-js/modules/web.dom-collections.iterator.js");
7
6
  require("core-js/modules/es.array.slice.js");
8
7
  require("core-js/modules/es.regexp.to-string.js");
9
- require("core-js/modules/es.array.from.js");
10
8
  require("core-js/modules/es.regexp.exec.js");
11
9
  exports.__esModule = true;
12
10
  exports.default = void 0;
13
11
  require("core-js/modules/es.function.name.js");
12
+ require("core-js/modules/es.array.from.js");
13
+ require("core-js/modules/es.string.iterator.js");
14
+ require("core-js/modules/es.array.includes.js");
14
15
  require("core-js/modules/es.object.to-string.js");
15
16
  require("core-js/modules/web.dom-collections.for-each.js");
16
17
  require("core-js/modules/es.symbol.to-primitive.js");
@@ -387,7 +388,7 @@ var Table = /*#__PURE__*/function () {
387
388
  wtOverlays.refreshAll(); // `refreshAll()` internally already calls `refreshSelections()` method
388
389
  wtOverlays.adjustElementsSize();
389
390
  } else {
390
- this.dataAccessObject.selectionManager.setActiveOverlay(this.facadeGetter()).render(runFastDraw);
391
+ this.refreshSelections(runFastDraw);
391
392
  }
392
393
  if (syncScroll) {
393
394
  wtOverlays.syncScrollWithMaster();
@@ -479,6 +480,74 @@ var Table = /*#__PURE__*/function () {
479
480
  }
480
481
  }
481
482
 
483
+ /**
484
+ * @param {string} className The CSS class name to remove from the table cells.
485
+ */
486
+ }, {
487
+ key: "removeClassFromCells",
488
+ value: function removeClassFromCells(className) {
489
+ var nodes = this.TABLE.querySelectorAll(".".concat(className));
490
+ for (var i = 0, len = nodes.length; i < len; i++) {
491
+ (0, _element.removeClass)(nodes[i], className);
492
+ }
493
+ }
494
+
495
+ /**
496
+ * Refresh the table selection by re-rendering Selection instances connected with that instance.
497
+ *
498
+ * @param {boolean} fastDraw If fast drawing is enabled than additionally className clearing is applied.
499
+ */
500
+ }, {
501
+ key: "refreshSelections",
502
+ value: function refreshSelections(fastDraw) {
503
+ var wtSettings = this.wtSettings;
504
+ var selections = this.dataAccessObject.selections;
505
+ if (!selections) {
506
+ return;
507
+ }
508
+ var highlights = Array.from(selections);
509
+ var len = highlights.length;
510
+ if (fastDraw) {
511
+ var classesToRemove = [];
512
+ for (var i = 0; i < len; i++) {
513
+ var _highlights$i$setting = highlights[i].settings,
514
+ highlightHeaderClassName = _highlights$i$setting.highlightHeaderClassName,
515
+ highlightRowClassName = _highlights$i$setting.highlightRowClassName,
516
+ highlightColumnClassName = _highlights$i$setting.highlightColumnClassName;
517
+ var classNames = highlights[i].classNames;
518
+ var classNamesLength = classNames.length;
519
+ for (var j = 0; j < classNamesLength; j++) {
520
+ if (!classesToRemove.includes(classNames[j])) {
521
+ classesToRemove.push(classNames[j]);
522
+ }
523
+ }
524
+ if (highlightHeaderClassName && !classesToRemove.includes(highlightHeaderClassName)) {
525
+ classesToRemove.push(highlightHeaderClassName);
526
+ }
527
+ if (highlightRowClassName && !classesToRemove.includes(highlightRowClassName)) {
528
+ classesToRemove.push(highlightRowClassName);
529
+ }
530
+ if (highlightColumnClassName && !classesToRemove.includes(highlightColumnClassName)) {
531
+ classesToRemove.push(highlightColumnClassName);
532
+ }
533
+ }
534
+ var additionalClassesToRemove = wtSettings.getSetting('onBeforeRemoveCellClassNames');
535
+ if (Array.isArray(additionalClassesToRemove)) {
536
+ for (var _i = 0; _i < additionalClassesToRemove.length; _i++) {
537
+ classesToRemove.push(additionalClassesToRemove[_i]);
538
+ }
539
+ }
540
+ var classesToRemoveLength = classesToRemove.length;
541
+ for (var _i2 = 0; _i2 < classesToRemoveLength; _i2++) {
542
+ // there was no rerender, so we need to remove classNames by ourselves
543
+ this.removeClassFromCells(classesToRemove[_i2]);
544
+ }
545
+ }
546
+ for (var _i3 = 0; _i3 < len; _i3++) {
547
+ highlights[_i3].draw(this.facadeGetter(), fastDraw);
548
+ }
549
+ }
550
+
482
551
  /**
483
552
  * Get cell element at coords.
484
553
  * Negative coords.row or coords.col are used to retrieve header cells. If there are multiple header levels, the
@@ -612,14 +681,14 @@ var Table = /*#__PURE__*/function () {
612
681
  key: "getRowHeader",
613
682
  value: function getRowHeader(row) {
614
683
  var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
684
+ if (this.columnFilter.sourceColumnToVisibleRowHeadedColumn(0) === 0) {
685
+ return;
686
+ }
615
687
  var rowHeadersCount = this.wtSettings.getSetting('rowHeaders').length;
616
688
  if (level >= rowHeadersCount) {
617
689
  return;
618
690
  }
619
- var renderedRow = this.rowFilter.sourceToRendered(row);
620
- var visibleRow = renderedRow < 0 ? this.rowFilter.sourceRowToVisibleColHeadedRow(row) : renderedRow;
621
- var parentElement = renderedRow < 0 ? this.THEAD : this.TBODY;
622
- var TR = parentElement.childNodes[visibleRow];
691
+ var TR = this.TBODY.childNodes[this.rowFilter.sourceToRendered(row)];
623
692
  return TR === null || TR === void 0 ? void 0 : TR.childNodes[level];
624
693
  }
625
694
 
@@ -632,6 +701,9 @@ var Table = /*#__PURE__*/function () {
632
701
  }, {
633
702
  key: "getRowHeaders",
634
703
  value: function getRowHeaders(row) {
704
+ if (this.columnFilter.sourceColumnToVisibleRowHeadedColumn(0) === 0) {
705
+ return [];
706
+ }
635
707
  var THs = [];
636
708
  var rowHeadersCount = this.wtSettings.getSetting('rowHeaders').length;
637
709
  for (var renderedRowIndex = 0; renderedRowIndex < rowHeadersCount; renderedRowIndex++) {