handsontable 0.0.0-next-08765b9-20230809 → 0.0.0-next-7e1ba35-20230821

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 (299) 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 +11 -50
  5. package/3rdparty/walkontable/src/cell/coords.mjs +11 -50
  6. package/3rdparty/walkontable/src/cell/range.d.ts +2 -9
  7. package/3rdparty/walkontable/src/cell/range.js +7 -38
  8. package/3rdparty/walkontable/src/cell/range.mjs +7 -38
  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 +6 -2
  24. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +6 -2
  25. package/3rdparty/walkontable/src/overlay/top.js +6 -2
  26. package/3rdparty/walkontable/src/overlay/top.mjs +6 -2
  27. package/3rdparty/walkontable/src/selection.js +295 -0
  28. package/3rdparty/walkontable/src/selection.mjs +290 -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 +78 -6
  40. package/3rdparty/walkontable/src/table.mjs +79 -7
  41. package/base.js +2 -2
  42. package/base.mjs +2 -2
  43. package/common.d.ts +1 -1
  44. package/core.d.ts +3 -6
  45. package/core.js +290 -173
  46. package/core.mjs +290 -173
  47. package/dataMap/metaManager/metaSchema.js +0 -41
  48. package/dataMap/metaManager/metaSchema.mjs +0 -41
  49. package/dist/handsontable.css +4 -24
  50. package/dist/handsontable.full.css +4 -24
  51. package/dist/handsontable.full.js +5384 -8679
  52. package/dist/handsontable.full.min.css +3 -4
  53. package/dist/handsontable.full.min.js +960 -29
  54. package/dist/handsontable.js +8132 -11427
  55. package/dist/handsontable.min.css +3 -4
  56. package/dist/handsontable.min.js +61 -24
  57. package/editorManager.js +75 -11
  58. package/editorManager.mjs +74 -11
  59. package/editors/baseEditor/baseEditor.d.ts +1 -0
  60. package/editors/textEditor/textEditor.js +11 -3
  61. package/editors/textEditor/textEditor.mjs +12 -4
  62. package/helpers/mixed.js +1 -1
  63. package/helpers/mixed.mjs +1 -1
  64. package/helpers/number.d.ts +0 -1
  65. package/helpers/number.js +0 -18
  66. package/helpers/number.mjs +0 -17
  67. package/package.json +1 -1
  68. package/pluginHooks.d.ts +1 -7
  69. package/pluginHooks.js +1 -106
  70. package/pluginHooks.mjs +1 -106
  71. package/plugins/collapsibleColumns/collapsibleColumns.js +4 -58
  72. package/plugins/collapsibleColumns/collapsibleColumns.mjs +4 -58
  73. package/plugins/columnSorting/columnSorting.js +0 -38
  74. package/plugins/columnSorting/columnSorting.mjs +2 -38
  75. package/plugins/columnSorting/index.js +1 -3
  76. package/plugins/columnSorting/index.mjs +1 -1
  77. package/plugins/comments/commentEditor.js +0 -1
  78. package/plugins/comments/commentEditor.mjs +0 -1
  79. package/plugins/comments/comments.js +189 -251
  80. package/plugins/comments/comments.mjs +190 -250
  81. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  82. package/plugins/contextMenu/contextMenu.js +30 -72
  83. package/plugins/contextMenu/contextMenu.mjs +31 -73
  84. package/plugins/contextMenu/predefinedItems/alignment.js +0 -7
  85. package/plugins/contextMenu/predefinedItems/alignment.mjs +0 -7
  86. package/plugins/contextMenu/predefinedItems/clearColumn.js +3 -5
  87. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +3 -5
  88. package/plugins/contextMenu/predefinedItems/columnLeft.js +3 -5
  89. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +3 -5
  90. package/plugins/contextMenu/predefinedItems/columnRight.js +3 -5
  91. package/plugins/contextMenu/predefinedItems/columnRight.mjs +3 -5
  92. package/plugins/contextMenu/predefinedItems/readOnly.js +0 -7
  93. package/plugins/contextMenu/predefinedItems/readOnly.mjs +0 -7
  94. package/plugins/contextMenu/predefinedItems/removeColumn.js +5 -7
  95. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +3 -5
  96. package/plugins/contextMenu/predefinedItems/removeRow.js +5 -7
  97. package/plugins/contextMenu/predefinedItems/removeRow.mjs +3 -5
  98. package/plugins/contextMenu/predefinedItems/rowAbove.js +3 -5
  99. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +3 -5
  100. package/plugins/contextMenu/predefinedItems/rowBelow.js +3 -5
  101. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +3 -5
  102. package/plugins/contextMenu/utils.js +16 -28
  103. package/plugins/contextMenu/utils.mjs +15 -27
  104. package/plugins/copyPaste/contextMenuItem/copy.js +0 -7
  105. package/plugins/copyPaste/contextMenuItem/copy.mjs +0 -7
  106. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +1 -9
  107. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +1 -9
  108. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +1 -9
  109. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +1 -9
  110. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +1 -9
  111. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +1 -9
  112. package/plugins/copyPaste/contextMenuItem/cut.js +0 -7
  113. package/plugins/copyPaste/contextMenuItem/cut.mjs +0 -7
  114. package/plugins/copyPaste/copyPaste.js +10 -14
  115. package/plugins/copyPaste/copyPaste.mjs +10 -14
  116. package/plugins/customBorders/customBorders.js +20 -23
  117. package/plugins/customBorders/customBorders.mjs +21 -24
  118. package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
  119. package/plugins/dropdownMenu/dropdownMenu.js +32 -89
  120. package/plugins/dropdownMenu/dropdownMenu.mjs +32 -89
  121. package/plugins/filters/filters.js +14 -31
  122. package/plugins/filters/filters.mjs +13 -30
  123. package/plugins/manualColumnResize/manualColumnResize.js +6 -0
  124. package/plugins/manualColumnResize/manualColumnResize.mjs +7 -1
  125. package/plugins/mergeCells/mergeCells.js +17 -5
  126. package/plugins/mergeCells/mergeCells.mjs +17 -5
  127. package/plugins/multiColumnSorting/multiColumnSorting.js +2 -37
  128. package/plugins/multiColumnSorting/multiColumnSorting.mjs +2 -37
  129. package/plugins/nestedHeaders/nestedHeaders.js +8 -121
  130. package/plugins/nestedHeaders/nestedHeaders.mjs +8 -121
  131. package/plugins/nestedHeaders/stateManager/index.js +0 -37
  132. package/plugins/nestedHeaders/stateManager/index.mjs +0 -37
  133. package/plugins/nestedRows/nestedRows.js +0 -41
  134. package/plugins/nestedRows/nestedRows.mjs +0 -41
  135. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  136. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  137. package/selection/highlight/constants.js +15 -0
  138. package/selection/highlight/constants.mjs +6 -0
  139. package/selection/highlight/highlight.js +71 -256
  140. package/selection/highlight/highlight.mjs +71 -250
  141. package/selection/highlight/types/activeHeader.js +8 -10
  142. package/selection/highlight/types/activeHeader.mjs +8 -10
  143. package/selection/highlight/types/area.js +18 -6
  144. package/selection/highlight/types/area.mjs +18 -6
  145. package/selection/highlight/types/{focus.js → cell.js} +7 -5
  146. package/selection/highlight/types/{focus.mjs → cell.mjs} +7 -5
  147. package/selection/highlight/types/customSelection.js +9 -7
  148. package/selection/highlight/types/customSelection.mjs +9 -7
  149. package/selection/highlight/types/fill.js +7 -5
  150. package/selection/highlight/types/fill.mjs +7 -5
  151. package/selection/highlight/types/header.js +18 -9
  152. package/selection/highlight/types/header.mjs +18 -9
  153. package/selection/highlight/types/index.js +35 -0
  154. package/selection/highlight/types/index.mjs +31 -0
  155. package/selection/highlight/visualSelection.js +27 -31
  156. package/selection/highlight/visualSelection.mjs +27 -31
  157. package/selection/index.js +7 -4
  158. package/selection/index.mjs +3 -2
  159. package/selection/mouseEventHandler.js +1 -1
  160. package/selection/mouseEventHandler.mjs +1 -1
  161. package/selection/range.js +8 -8
  162. package/selection/range.mjs +8 -8
  163. package/selection/selection.js +154 -290
  164. package/selection/selection.mjs +153 -287
  165. package/selection/transformation.js +90 -232
  166. package/selection/transformation.mjs +90 -232
  167. package/selection/utils.js +21 -15
  168. package/selection/utils.mjs +21 -16
  169. package/settings.d.ts +0 -2
  170. package/shortcuts/manager.js +0 -2
  171. package/shortcuts/manager.mjs +0 -2
  172. package/shortcuts/recorder.js +2 -2
  173. package/shortcuts/recorder.mjs +2 -2
  174. package/shortcuts/utils.js +5 -19
  175. package/shortcuts/utils.mjs +4 -18
  176. package/tableView.js +13 -67
  177. package/tableView.mjs +13 -67
  178. package/3rdparty/walkontable/src/selection/border/constants.js +0 -16
  179. package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -12
  180. package/3rdparty/walkontable/src/selection/constants.js +0 -62
  181. package/3rdparty/walkontable/src/selection/constants.mjs +0 -51
  182. package/3rdparty/walkontable/src/selection/index.js +0 -26
  183. package/3rdparty/walkontable/src/selection/index.mjs +0 -5
  184. package/3rdparty/walkontable/src/selection/manager.js +0 -259
  185. package/3rdparty/walkontable/src/selection/manager.mjs +0 -254
  186. package/3rdparty/walkontable/src/selection/scanner.js +0 -270
  187. package/3rdparty/walkontable/src/selection/scanner.mjs +0 -267
  188. package/3rdparty/walkontable/src/selection/selection.js +0 -101
  189. package/3rdparty/walkontable/src/selection/selection.mjs +0 -96
  190. package/core/focusCatcher/focusDetector.js +0 -58
  191. package/core/focusCatcher/focusDetector.mjs +0 -54
  192. package/core/focusCatcher/index.js +0 -142
  193. package/core/focusCatcher/index.mjs +0 -138
  194. package/core/index.js +0 -9
  195. package/core/index.mjs +0 -1
  196. package/plugins/comments/contextMenuItem/addEditComment.js +0 -41
  197. package/plugins/comments/contextMenuItem/addEditComment.mjs +0 -35
  198. package/plugins/comments/contextMenuItem/readOnlyComment.js +0 -49
  199. package/plugins/comments/contextMenuItem/readOnlyComment.mjs +0 -43
  200. package/plugins/comments/contextMenuItem/removeComment.js +0 -38
  201. package/plugins/comments/contextMenuItem/removeComment.mjs +0 -32
  202. package/selection/highlight/types/areaLayered.js +0 -31
  203. package/selection/highlight/types/areaLayered.mjs +0 -26
  204. package/selection/highlight/types/column.js +0 -27
  205. package/selection/highlight/types/column.mjs +0 -22
  206. package/selection/highlight/types/row.js +0 -27
  207. package/selection/highlight/types/row.mjs +0 -22
  208. package/shortcutContexts/commands/editor/closeAndSave.js +0 -12
  209. package/shortcutContexts/commands/editor/closeAndSave.mjs +0 -8
  210. package/shortcutContexts/commands/editor/closeWithoutSaving.js +0 -12
  211. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +0 -8
  212. package/shortcutContexts/commands/editor/fastOpen.js +0 -16
  213. package/shortcutContexts/commands/editor/fastOpen.mjs +0 -12
  214. package/shortcutContexts/commands/editor/index.js +0 -16
  215. package/shortcutContexts/commands/editor/index.mjs +0 -12
  216. package/shortcutContexts/commands/editor/open.js +0 -27
  217. package/shortcutContexts/commands/editor/open.mjs +0 -23
  218. package/shortcutContexts/commands/emptySelectedCells.js +0 -11
  219. package/shortcutContexts/commands/emptySelectedCells.mjs +0 -7
  220. package/shortcutContexts/commands/extendCellsSelection/down.js +0 -15
  221. package/shortcutContexts/commands/extendCellsSelection/down.mjs +0 -11
  222. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +0 -21
  223. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +0 -17
  224. package/shortcutContexts/commands/extendCellsSelection/index.js +0 -26
  225. package/shortcutContexts/commands/extendCellsSelection/index.mjs +0 -22
  226. package/shortcutContexts/commands/extendCellsSelection/left.js +0 -15
  227. package/shortcutContexts/commands/extendCellsSelection/left.mjs +0 -11
  228. package/shortcutContexts/commands/extendCellsSelection/right.js +0 -15
  229. package/shortcutContexts/commands/extendCellsSelection/right.mjs +0 -11
  230. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +0 -19
  231. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +0 -15
  232. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +0 -29
  233. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +0 -25
  234. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +0 -19
  235. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +0 -15
  236. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +0 -19
  237. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +0 -15
  238. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +0 -29
  239. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +0 -25
  240. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +0 -29
  241. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +0 -25
  242. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +0 -29
  243. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +0 -25
  244. package/shortcutContexts/commands/extendCellsSelection/toRows.js +0 -19
  245. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +0 -15
  246. package/shortcutContexts/commands/extendCellsSelection/up.js +0 -15
  247. package/shortcutContexts/commands/extendCellsSelection/up.mjs +0 -11
  248. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +0 -21
  249. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +0 -17
  250. package/shortcutContexts/commands/index.js +0 -35
  251. package/shortcutContexts/commands/index.mjs +0 -31
  252. package/shortcutContexts/commands/moveCellSelection/down.js +0 -13
  253. package/shortcutContexts/commands/moveCellSelection/down.mjs +0 -9
  254. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +0 -31
  255. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +0 -27
  256. package/shortcutContexts/commands/moveCellSelection/index.js +0 -28
  257. package/shortcutContexts/commands/moveCellSelection/index.mjs +0 -24
  258. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +0 -12
  259. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +0 -8
  260. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +0 -12
  261. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +0 -8
  262. package/shortcutContexts/commands/moveCellSelection/left.js +0 -10
  263. package/shortcutContexts/commands/moveCellSelection/left.mjs +0 -6
  264. package/shortcutContexts/commands/moveCellSelection/right.js +0 -10
  265. package/shortcutContexts/commands/moveCellSelection/right.mjs +0 -6
  266. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +0 -17
  267. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +0 -13
  268. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +0 -18
  269. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +0 -14
  270. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +0 -14
  271. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +0 -10
  272. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +0 -17
  273. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +0 -13
  274. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +0 -19
  275. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +0 -15
  276. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +0 -21
  277. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +0 -17
  278. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +0 -17
  279. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +0 -13
  280. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +0 -19
  281. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +0 -15
  282. package/shortcutContexts/commands/moveCellSelection/up.js +0 -13
  283. package/shortcutContexts/commands/moveCellSelection/up.mjs +0 -9
  284. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +0 -31
  285. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +0 -27
  286. package/shortcutContexts/commands/populateSelectedCellsData.js +0 -29
  287. package/shortcutContexts/commands/populateSelectedCellsData.mjs +0 -25
  288. package/shortcutContexts/commands/scrollToFocusedCell.js +0 -36
  289. package/shortcutContexts/commands/scrollToFocusedCell.mjs +0 -32
  290. package/shortcutContexts/commands/selectAll.js +0 -10
  291. package/shortcutContexts/commands/selectAll.mjs +0 -6
  292. package/shortcutContexts/constants.js +0 -13
  293. package/shortcutContexts/constants.mjs +0 -8
  294. package/shortcutContexts/editor.js +0 -25
  295. package/shortcutContexts/editor.mjs +0 -21
  296. package/shortcutContexts/grid.js +0 -163
  297. package/shortcutContexts/grid.mjs +0 -159
  298. package/shortcutContexts/index.js +0 -24
  299. package/shortcutContexts/index.mjs +0 -11
@@ -50,8 +50,8 @@ class WalkontableFacade {
50
50
  return this._wot.cloneOverlay; // todo create facade
51
51
  }
52
52
 
53
- get selectionManager() {
54
- return this._wot.selectionManager; // todo create facade
53
+ get selections() {
54
+ return this._wot.selections; // todo create facade
55
55
  }
56
56
 
57
57
  get wtViewport() {
@@ -46,8 +46,8 @@ export default class WalkontableFacade {
46
46
  return this._wot.cloneOverlay; // todo create facade
47
47
  }
48
48
 
49
- get selectionManager() {
50
- return this._wot.selectionManager; // todo create facade
49
+ get selections() {
50
+ return this._wot.selections; // todo create facade
51
51
  }
52
52
 
53
53
  get wtViewport() {
@@ -12,16 +12,8 @@ exports.CellRange = _range.default;
12
12
  var _core = _interopRequireDefault(require("./facade/core"));
13
13
  exports.default = _core.default;
14
14
  exports.Core = _core.default;
15
- var _selection = require("./selection");
16
- exports.Selection = _selection.Selection;
17
- exports.HIGHLIGHT_ACTIVE_HEADER_TYPE = _selection.ACTIVE_HEADER_TYPE;
18
- exports.HIGHLIGHT_AREA_TYPE = _selection.AREA_TYPE;
19
- exports.HIGHLIGHT_FOCUS_TYPE = _selection.FOCUS_TYPE;
20
- exports.HIGHLIGHT_FILL_TYPE = _selection.FILL_TYPE;
21
- exports.HIGHLIGHT_HEADER_TYPE = _selection.HEADER_TYPE;
22
- exports.HIGHLIGHT_ROW_TYPE = _selection.ROW_TYPE;
23
- exports.HIGHLIGHT_COLUMN_TYPE = _selection.COLUMN_TYPE;
24
- exports.HIGHLIGHT_CUSTOM_SELECTION_TYPE = _selection.CUSTOM_SELECTION_TYPE;
15
+ var _selection = _interopRequireDefault(require("./selection"));
16
+ exports.Selection = _selection.default;
25
17
  var Renderer = _interopRequireWildcard(require("./renderer"));
26
18
  exports.Renderer = Renderer;
27
19
  var _orderView = require("./utils/orderView");
@@ -3,8 +3,8 @@ import ViewportRowsCalculator from "./calculator/viewportRows.mjs";
3
3
  import CellCoords from "./cell/coords.mjs";
4
4
  import CellRange from "./cell/range.mjs";
5
5
  import Walkontable from "./facade/core.mjs";
6
- import { Selection, ACTIVE_HEADER_TYPE, AREA_TYPE, FOCUS_TYPE, FILL_TYPE, HEADER_TYPE, ROW_TYPE, COLUMN_TYPE, CUSTOM_SELECTION_TYPE } from "./selection/index.mjs";
6
+ import Selection from "./selection.mjs";
7
7
  import * as Renderer from "./renderer/index.mjs";
8
8
  import { OrderView, SharedOrderView } from "./utils/orderView/index.mjs";
9
9
  import { getListenersCounter } from "../../../eventManager.mjs";
10
- export { ViewportColumnsCalculator, ViewportRowsCalculator, CellCoords, CellRange, Walkontable as default, Walkontable as Core, Selection, ACTIVE_HEADER_TYPE as HIGHLIGHT_ACTIVE_HEADER_TYPE, AREA_TYPE as HIGHLIGHT_AREA_TYPE, FOCUS_TYPE as HIGHLIGHT_FOCUS_TYPE, FILL_TYPE as HIGHLIGHT_FILL_TYPE, HEADER_TYPE as HIGHLIGHT_HEADER_TYPE, ROW_TYPE as HIGHLIGHT_ROW_TYPE, COLUMN_TYPE as HIGHLIGHT_COLUMN_TYPE, CUSTOM_SELECTION_TYPE as HIGHLIGHT_CUSTOM_SELECTION_TYPE, Renderer, OrderView, SharedOrderView, getListenersCounter };
10
+ export { ViewportColumnsCalculator, ViewportRowsCalculator, CellCoords, CellRange, Walkontable as default, Walkontable as Core, Selection, Renderer, OrderView, SharedOrderView, getListenersCounter };
@@ -281,7 +281,7 @@ class Overlay {
281
281
  // todo ioc , or factor func if used only here
282
282
  event: this.wot.wtEvent,
283
283
  // todo ioc , or factory func if used only here
284
- selectionManager: this.wot.selectionManager // todo ioc , or factory func if used only here
284
+ selections: this.wot.selections // todo ioc , or factory func if used only here
285
285
  });
286
286
  }
287
287
 
@@ -277,7 +277,7 @@ export class Overlay {
277
277
  // todo ioc , or factor func if used only here
278
278
  event: this.wot.wtEvent,
279
279
  // todo ioc , or factory func if used only here
280
- selectionManager: this.wot.selectionManager // todo ioc , or factory func if used only here
280
+ selections: this.wot.selections // todo ioc , or factory func if used only here
281
281
  });
282
282
  }
283
283
 
@@ -5,7 +5,6 @@ require("core-js/modules/es.error.cause.js");
5
5
  var _element = require("../../../../helpers/dom/element");
6
6
  var _inlineStart = _interopRequireDefault(require("../table/inlineStart"));
7
7
  var _base = require("./_base");
8
- var _selection = require("../selection");
9
8
  var _constants = require("./constants");
10
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
10
  /**
@@ -173,10 +172,15 @@ class InlineStartOverlay extends _base.Overlay {
173
172
  * Adjust overlay root childs size.
174
173
  */
175
174
  adjustRootChildrenSize() {
175
+ var _selections$getCell$g;
176
176
  const {
177
177
  holder
178
178
  } = this.clone.wtTable;
179
- const selectionCornerOffset = this.wot.selectionManager.getFocusSelection() ? parseInt(_selection.CORNER_DEFAULT_STYLE.width, 10) / 2 : 0;
179
+ const {
180
+ selections
181
+ } = this.wot;
182
+ const facade = this.facadeGetter();
183
+ const selectionCornerOffset = Math.abs((_selections$getCell$g = selections === null || selections === void 0 ? void 0 : selections.getCell().getBorder(facade).cornerCenterPointOffset) !== null && _selections$getCell$g !== void 0 ? _selections$getCell$g : 0);
180
184
  this.clone.wtTable.hider.style.height = this.hider.style.height;
181
185
  holder.style.height = holder.parentNode.style.height;
182
186
  // Add selection corner protruding part to the holder total width to make sure that
@@ -2,7 +2,6 @@ import "core-js/modules/es.error.cause.js";
2
2
  import { addClass, getScrollbarWidth, getScrollLeft, getWindowScrollTop, hasClass, outerWidth, removeClass, setOverlayPosition, resetCssTransform } from "../../../../helpers/dom/element.mjs";
3
3
  import InlineStartOverlayTable from "../table/inlineStart.mjs";
4
4
  import { Overlay } from "./_base.mjs";
5
- import { CORNER_DEFAULT_STYLE } from "../selection/index.mjs";
6
5
  import { CLONE_INLINE_START } from "./constants.mjs";
7
6
  /**
8
7
  * @class InlineStartOverlay
@@ -169,10 +168,15 @@ export class InlineStartOverlay extends Overlay {
169
168
  * Adjust overlay root childs size.
170
169
  */
171
170
  adjustRootChildrenSize() {
171
+ var _selections$getCell$g;
172
172
  const {
173
173
  holder
174
174
  } = this.clone.wtTable;
175
- const selectionCornerOffset = this.wot.selectionManager.getFocusSelection() ? parseInt(CORNER_DEFAULT_STYLE.width, 10) / 2 : 0;
175
+ const {
176
+ selections
177
+ } = this.wot;
178
+ const facade = this.facadeGetter();
179
+ const selectionCornerOffset = Math.abs((_selections$getCell$g = selections === null || selections === void 0 ? void 0 : selections.getCell().getBorder(facade).cornerCenterPointOffset) !== null && _selections$getCell$g !== void 0 ? _selections$getCell$g : 0);
176
180
  this.clone.wtTable.hider.style.height = this.hider.style.height;
177
181
  holder.style.height = holder.parentNode.style.height;
178
182
  // Add selection corner protruding part to the holder total width to make sure that
@@ -5,7 +5,6 @@ require("core-js/modules/es.error.cause.js");
5
5
  var _element = require("../../../../helpers/dom/element");
6
6
  var _top = _interopRequireDefault(require("./../table/top"));
7
7
  var _base = require("./_base");
8
- var _selection = require("../selection");
9
8
  var _constants = require("./constants");
10
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
10
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -200,10 +199,15 @@ class TopOverlay extends _base.Overlay {
200
199
  * Adjust overlay root childs size.
201
200
  */
202
201
  adjustRootChildrenSize() {
202
+ var _selections$getCell$g;
203
203
  const {
204
204
  holder
205
205
  } = this.clone.wtTable;
206
- const selectionCornerOffset = this.wot.selectionManager.getFocusSelection() ? parseInt(_selection.CORNER_DEFAULT_STYLE.height, 10) / 2 : 0;
206
+ const {
207
+ selections
208
+ } = this.wot;
209
+ const facade = this.facadeGetter();
210
+ const selectionCornerOffset = Math.abs((_selections$getCell$g = selections === null || selections === void 0 ? void 0 : selections.getCell().getBorder(facade).cornerCenterPointOffset) !== null && _selections$getCell$g !== void 0 ? _selections$getCell$g : 0);
207
211
  this.clone.wtTable.hider.style.width = this.hider.style.width;
208
212
  holder.style.width = holder.parentNode.style.width;
209
213
  // Add selection corner protruding part to the holder total height to make sure that
@@ -5,7 +5,6 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
5
5
  import { addClass, getScrollbarWidth, getScrollTop, getWindowScrollLeft, hasClass, outerHeight, removeClass, setOverlayPosition, resetCssTransform } from "../../../../helpers/dom/element.mjs";
6
6
  import TopOverlayTable from "./../table/top.mjs";
7
7
  import { Overlay } from "./_base.mjs";
8
- import { CORNER_DEFAULT_STYLE } from "../selection/index.mjs";
9
8
  import { CLONE_TOP } from "./constants.mjs";
10
9
  /**
11
10
  * @class TopOverlay
@@ -196,10 +195,15 @@ export class TopOverlay extends Overlay {
196
195
  * Adjust overlay root childs size.
197
196
  */
198
197
  adjustRootChildrenSize() {
198
+ var _selections$getCell$g;
199
199
  const {
200
200
  holder
201
201
  } = this.clone.wtTable;
202
- const selectionCornerOffset = this.wot.selectionManager.getFocusSelection() ? parseInt(CORNER_DEFAULT_STYLE.height, 10) / 2 : 0;
202
+ const {
203
+ selections
204
+ } = this.wot;
205
+ const facade = this.facadeGetter();
206
+ const selectionCornerOffset = Math.abs((_selections$getCell$g = selections === null || selections === void 0 ? void 0 : selections.getCell().getBorder(facade).cornerCenterPointOffset) !== null && _selections$getCell$g !== void 0 ? _selections$getCell$g : 0);
203
207
  this.clone.wtTable.hider.style.width = this.hider.style.width;
204
208
  holder.style.width = holder.parentNode.style.width;
205
209
  // Add selection corner protruding part to the holder total height to make sure that
@@ -0,0 +1,295 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ require("core-js/modules/es.array.push.js");
5
+ var _element = require("./../../../helpers/dom/element");
6
+ var _border = _interopRequireDefault(require("./border"));
7
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
+ /**
9
+ * @class Selection
10
+ */
11
+ class Selection {
12
+ /**
13
+ * @param {object} settings The selection settings object. @todo type.
14
+ * @param {CellRange} cellRange The cell range instance.
15
+ */
16
+ constructor(settings, cellRange) {
17
+ this.settings = settings;
18
+ this.cellRange = cellRange || null;
19
+ this.instanceBorders = {};
20
+ this.classNames = [this.settings.className];
21
+ this.classNameGenerator = this.linearClassNameGenerator(this.settings.className, this.settings.layerLevel);
22
+ }
23
+
24
+ /**
25
+ * Each Walkontable clone requires it's own border for every selection. This method creates and returns selection
26
+ * borders per instance.
27
+ *
28
+ * @param {WalkontableFacade} wotInstance The Walkontable instance.
29
+ * @returns {Border}
30
+ */
31
+ getBorder(wotInstance) {
32
+ if (!this.instanceBorders[wotInstance.guid]) {
33
+ this.instanceBorders[wotInstance.guid] = new _border.default(wotInstance, this.settings);
34
+ }
35
+ return this.instanceBorders[wotInstance.guid];
36
+ }
37
+
38
+ /**
39
+ * Checks if selection is empty.
40
+ *
41
+ * @returns {boolean}
42
+ */
43
+ isEmpty() {
44
+ return this.cellRange === null;
45
+ }
46
+
47
+ /**
48
+ * Adds a cell coords to the selection.
49
+ *
50
+ * @param {CellCoords} coords The cell coordinates to add.
51
+ * @returns {Selection}
52
+ */
53
+ add(coords) {
54
+ if (this.isEmpty()) {
55
+ this.cellRange = this.settings.createCellRange(coords);
56
+ } else {
57
+ this.cellRange.expand(coords);
58
+ }
59
+ return this;
60
+ }
61
+
62
+ /**
63
+ * If selection range from or to property equals oldCoords, replace it with newCoords. Return boolean
64
+ * information about success.
65
+ *
66
+ * @param {CellCoords} oldCoords An old cell coordinates to replace.
67
+ * @param {CellCoords} newCoords The new cell coordinates.
68
+ * @returns {boolean}
69
+ */
70
+ replace(oldCoords, newCoords) {
71
+ if (!this.isEmpty()) {
72
+ if (this.cellRange.from.isEqual(oldCoords)) {
73
+ this.cellRange.from = newCoords;
74
+ return true;
75
+ }
76
+ if (this.cellRange.to.isEqual(oldCoords)) {
77
+ this.cellRange.to = newCoords;
78
+ return true;
79
+ }
80
+ }
81
+ return false;
82
+ }
83
+
84
+ /**
85
+ * Clears selection.
86
+ *
87
+ * @returns {Selection}
88
+ */
89
+ clear() {
90
+ this.cellRange = null;
91
+ return this;
92
+ }
93
+
94
+ /**
95
+ * Returns the top left (or top right in RTL) and bottom right (or bottom left in RTL) selection coordinates.
96
+ *
97
+ * @returns {Array} Returns array of coordinates for example `[1, 1, 5, 5]`.
98
+ */
99
+ getCorners() {
100
+ const topStart = this.cellRange.getOuterTopStartCorner();
101
+ const bottomEnd = this.cellRange.getOuterBottomEndCorner();
102
+ return [topStart.row, topStart.col, bottomEnd.row, bottomEnd.col];
103
+ }
104
+
105
+ /**
106
+ * Adds class name to cell element at given coords.
107
+ *
108
+ * @param {WalkontableFacade} wotInstance Walkontable instance.
109
+ * @param {number} sourceRow Cell row coord.
110
+ * @param {number} sourceColumn Cell column coord.
111
+ * @param {string} className Class name.
112
+ * @param {boolean} [markIntersections=false] If `true`, linear className generator will be used to add CSS classes
113
+ * in a continuous way.
114
+ * @returns {Selection}
115
+ */
116
+ addClassAtCoords(wotInstance, sourceRow, sourceColumn, className) {
117
+ let markIntersections = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
118
+ const TD = wotInstance.wtTable.getCell(this.settings.createCellCoords(sourceRow, sourceColumn));
119
+ if (typeof TD === 'object') {
120
+ let cellClassName = className;
121
+ if (markIntersections) {
122
+ cellClassName = this.classNameGenerator(TD);
123
+ if (!this.classNames.includes(cellClassName)) {
124
+ this.classNames.push(cellClassName);
125
+ }
126
+ }
127
+ (0, _element.addClass)(TD, cellClassName);
128
+ }
129
+ return this;
130
+ }
131
+
132
+ /**
133
+ * Generate helper for calculating classNames based on previously added base className.
134
+ * The generated className is always generated as a continuation of the previous className. For example, when
135
+ * the currently checked element has 'area-2' className the generated new className will be 'area-3'. When
136
+ * the element doesn't have any classNames than the base className will be returned ('area');.
137
+ *
138
+ * @param {string} baseClassName Base className to be used.
139
+ * @param {number} layerLevelOwner Layer level which the instance of the Selection belongs to.
140
+ * @returns {Function}
141
+ */
142
+ linearClassNameGenerator(baseClassName, layerLevelOwner) {
143
+ // TODO: Make this recursive function Proper Tail Calls (TCO/PTC) friendly.
144
+ return function calcClassName(element) {
145
+ let previousIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
146
+ if (layerLevelOwner === 0 || previousIndex === 0) {
147
+ return baseClassName;
148
+ }
149
+ let index = previousIndex >= 0 ? previousIndex : layerLevelOwner;
150
+ let className = baseClassName;
151
+ index -= 1;
152
+ const previousClassName = index === 0 ? baseClassName : `${baseClassName}-${index}`;
153
+ if ((0, _element.hasClass)(element, previousClassName)) {
154
+ const currentLayer = index + 1;
155
+ className = `${baseClassName}-${currentLayer}`;
156
+ } else {
157
+ className = calcClassName(element, index);
158
+ }
159
+ return className;
160
+ };
161
+ }
162
+
163
+ /**
164
+ * @param {WalkontableFacade} wotInstance The Walkontable instance.
165
+ */
166
+ draw(wotInstance) {
167
+ if (this.isEmpty()) {
168
+ if (this.settings.border) {
169
+ this.getBorder(wotInstance).disappear();
170
+ }
171
+ return;
172
+ }
173
+ const renderedRows = wotInstance.wtTable.getRenderedRowsCount();
174
+ const renderedColumns = wotInstance.wtTable.getRenderedColumnsCount();
175
+ const corners = this.getCorners();
176
+ const [topRow, topColumn, bottomRow, bottomColumn] = corners;
177
+ const {
178
+ highlightHeaderClassName,
179
+ highlightColumnClassName,
180
+ highlightRowClassName,
181
+ highlightOnlyClosestHeader,
182
+ selectionType
183
+ } = this.settings;
184
+ const isHeaderSelectionType = selectionType === void 0 || ['active-header', 'header'].includes(selectionType);
185
+ if (isHeaderSelectionType && topColumn !== null && bottomColumn !== null) {
186
+ let selectionColumnCursor = 0;
187
+ for (let column = 0; column < renderedColumns; column += 1) {
188
+ const sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(column);
189
+ if (sourceCol >= topColumn && sourceCol <= bottomColumn) {
190
+ let THs = wotInstance.wtTable.getColumnHeaders(sourceCol);
191
+ const closestHeaderLevel = THs.length - 1;
192
+ if (highlightOnlyClosestHeader && THs.length > 1) {
193
+ THs = [THs[closestHeaderLevel]];
194
+ }
195
+ for (let headerLevel = 0; headerLevel < THs.length; headerLevel += 1) {
196
+ const newClasses = [];
197
+ let TH = THs[headerLevel];
198
+ if (highlightHeaderClassName) {
199
+ newClasses.push(highlightHeaderClassName);
200
+ }
201
+ if (highlightColumnClassName) {
202
+ newClasses.push(highlightColumnClassName);
203
+ }
204
+ headerLevel = highlightOnlyClosestHeader ? closestHeaderLevel : headerLevel;
205
+ const newSourceCol = wotInstance.getSetting('onBeforeHighlightingColumnHeader', sourceCol, headerLevel, {
206
+ selectionType,
207
+ columnCursor: selectionColumnCursor,
208
+ selectionWidth: bottomColumn - topColumn + 1,
209
+ classNames: newClasses
210
+ });
211
+ if (newSourceCol !== sourceCol) {
212
+ TH = wotInstance.wtTable.getColumnHeader(newSourceCol, headerLevel);
213
+ }
214
+ (0, _element.addClass)(TH, newClasses);
215
+ }
216
+ selectionColumnCursor += 1;
217
+ }
218
+ }
219
+ }
220
+ if (topRow !== null && bottomRow !== null) {
221
+ let selectionRowCursor = 0;
222
+ for (let row = 0; row < renderedRows; row += 1) {
223
+ const sourceRow = wotInstance.wtTable.rowFilter.renderedToSource(row);
224
+ if (isHeaderSelectionType && sourceRow >= topRow && sourceRow <= bottomRow) {
225
+ let THs = wotInstance.wtTable.getRowHeaders(sourceRow);
226
+ const closestHeaderLevel = THs.length - 1;
227
+ if (highlightOnlyClosestHeader && THs.length > 1) {
228
+ THs = [THs[closestHeaderLevel]];
229
+ }
230
+ for (let headerLevel = 0; headerLevel < THs.length; headerLevel += 1) {
231
+ const newClasses = [];
232
+ let TH = THs[headerLevel];
233
+ if (highlightHeaderClassName) {
234
+ newClasses.push(highlightHeaderClassName);
235
+ }
236
+ if (highlightRowClassName) {
237
+ newClasses.push(highlightRowClassName);
238
+ }
239
+ headerLevel = highlightOnlyClosestHeader ? closestHeaderLevel : headerLevel;
240
+ const newSourceRow = wotInstance.getSetting('onBeforeHighlightingRowHeader', sourceRow, headerLevel, {
241
+ selectionType,
242
+ rowCursor: selectionRowCursor,
243
+ selectionHeight: bottomRow - topRow + 1,
244
+ classNames: newClasses
245
+ });
246
+ if (newSourceRow !== sourceRow) {
247
+ TH = wotInstance.wtTable.getRowHeader(newSourceRow, headerLevel);
248
+ }
249
+ (0, _element.addClass)(TH, newClasses);
250
+ }
251
+ selectionRowCursor += 1;
252
+ }
253
+ if (topColumn !== null && bottomColumn !== null) {
254
+ for (let column = 0; column < renderedColumns; column += 1) {
255
+ const sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(column);
256
+ if (sourceRow >= topRow && sourceRow <= bottomRow && sourceCol >= topColumn && sourceCol <= bottomColumn) {
257
+ // selected cell
258
+ if (this.settings.className) {
259
+ this.addClassAtCoords(wotInstance, sourceRow, sourceCol, this.settings.className, this.settings.markIntersections);
260
+ }
261
+ } else if (sourceRow >= topRow && sourceRow <= bottomRow) {
262
+ // selection is in this row
263
+ if (highlightRowClassName) {
264
+ this.addClassAtCoords(wotInstance, sourceRow, sourceCol, highlightRowClassName);
265
+ }
266
+ } else if (sourceCol >= topColumn && sourceCol <= bottomColumn) {
267
+ // selection is in this column
268
+ if (highlightColumnClassName) {
269
+ this.addClassAtCoords(wotInstance, sourceRow, sourceCol, highlightColumnClassName);
270
+ }
271
+ }
272
+ const additionalSelectionClass = wotInstance.getSetting('onAfterDrawSelection', sourceRow, sourceCol, this.settings.layerLevel);
273
+ if (typeof additionalSelectionClass === 'string') {
274
+ this.addClassAtCoords(wotInstance, sourceRow, sourceCol, additionalSelectionClass);
275
+ }
276
+ }
277
+ }
278
+ }
279
+ }
280
+ wotInstance.getSetting('onBeforeDrawBorders', corners, this.settings.className);
281
+ if (this.settings.border) {
282
+ // warning! border.appear modifies corners!
283
+ this.getBorder(wotInstance).appear(corners);
284
+ }
285
+ }
286
+
287
+ /**
288
+ * Cleans up all the DOM state related to a Selection instance. Call this prior to deleting a Selection instance.
289
+ */
290
+ destroy() {
291
+ Object.values(this.instanceBorders).forEach(border => border.destroy());
292
+ }
293
+ }
294
+ var _default = Selection;
295
+ exports.default = _default;