handsontable 0.0.0-next-06a64be-20230621 → 0.0.0-next-d1c8e0e-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 (279) 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 +329 -0
  34. package/3rdparty/walkontable/src/selection/manager.mjs +323 -0
  35. package/3rdparty/walkontable/src/selection/scanner.js +364 -0
  36. package/3rdparty/walkontable/src/selection/scanner.mjs +360 -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 +127 -309
  55. package/core.mjs +127 -309
  56. package/dataMap/metaManager/metaSchema.js +19 -0
  57. package/dataMap/metaManager/metaSchema.mjs +19 -0
  58. package/dist/handsontable.css +8 -3
  59. package/dist/handsontable.full.css +8 -3
  60. package/dist/handsontable.full.js +13658 -10651
  61. package/dist/handsontable.full.min.css +3 -3
  62. package/dist/handsontable.full.min.js +112 -112
  63. package/dist/handsontable.js +16566 -13559
  64. package/dist/handsontable.min.css +3 -3
  65. package/dist/handsontable.min.js +4 -4
  66. package/editorManager.js +21 -94
  67. package/editorManager.mjs +26 -98
  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.d.ts +5 -1
  77. package/pluginHooks.js +89 -1
  78. package/pluginHooks.mjs +89 -1
  79. package/plugins/collapsibleColumns/collapsibleColumns.js +81 -24
  80. package/plugins/collapsibleColumns/collapsibleColumns.mjs +81 -24
  81. package/plugins/columnSorting/columnSorting.js +50 -8
  82. package/plugins/columnSorting/columnSorting.mjs +49 -9
  83. package/plugins/columnSorting/index.js +4 -2
  84. package/plugins/columnSorting/index.mjs +1 -1
  85. package/plugins/comments/comments.js +11 -4
  86. package/plugins/comments/comments.mjs +11 -4
  87. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  88. package/plugins/contextMenu/contextMenu.js +80 -29
  89. package/plugins/contextMenu/contextMenu.mjs +81 -30
  90. package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
  91. package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
  92. package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
  93. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
  94. package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
  95. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
  96. package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
  97. package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
  98. package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
  99. package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
  100. package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
  101. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
  102. package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
  103. package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
  104. package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
  105. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
  106. package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
  107. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
  108. package/plugins/contextMenu/utils.js +25 -16
  109. package/plugins/contextMenu/utils.mjs +24 -15
  110. package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
  111. package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
  112. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
  113. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
  114. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
  115. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
  116. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
  117. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
  118. package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
  119. package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
  120. package/plugins/copyPaste/copyPaste.js +5 -1
  121. package/plugins/copyPaste/copyPaste.mjs +5 -1
  122. package/plugins/customBorders/customBorders.js +25 -53
  123. package/plugins/customBorders/customBorders.mjs +26 -54
  124. package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
  125. package/plugins/dropdownMenu/dropdownMenu.js +94 -30
  126. package/plugins/dropdownMenu/dropdownMenu.mjs +94 -30
  127. package/plugins/filters/filters.js +62 -42
  128. package/plugins/filters/filters.mjs +61 -41
  129. package/plugins/mergeCells/mergeCells.js +5 -18
  130. package/plugins/mergeCells/mergeCells.mjs +5 -18
  131. package/plugins/multiColumnSorting/multiColumnSorting.js +42 -3
  132. package/plugins/multiColumnSorting/multiColumnSorting.mjs +42 -3
  133. package/plugins/nestedHeaders/nestedHeaders.js +132 -10
  134. package/plugins/nestedHeaders/nestedHeaders.mjs +132 -10
  135. package/plugins/nestedHeaders/stateManager/index.js +37 -0
  136. package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
  137. package/plugins/nestedRows/nestedRows.js +52 -7
  138. package/plugins/nestedRows/nestedRows.mjs +52 -7
  139. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  140. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  141. package/selection/highlight/highlight.js +312 -89
  142. package/selection/highlight/highlight.mjs +302 -85
  143. package/selection/highlight/types/activeHeader.js +10 -9
  144. package/selection/highlight/types/activeHeader.mjs +10 -8
  145. package/selection/highlight/types/area.js +12 -27
  146. package/selection/highlight/types/area.mjs +16 -30
  147. package/selection/highlight/types/areaLayered.js +54 -0
  148. package/selection/highlight/types/areaLayered.mjs +49 -0
  149. package/selection/highlight/types/column.js +50 -0
  150. package/selection/highlight/types/column.mjs +45 -0
  151. package/selection/highlight/types/customSelection.js +7 -10
  152. package/selection/highlight/types/customSelection.mjs +7 -9
  153. package/selection/highlight/types/fill.js +5 -8
  154. package/selection/highlight/types/fill.mjs +5 -7
  155. package/selection/highlight/types/{cell.js → focus.js} +5 -8
  156. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  157. package/selection/highlight/types/header.js +10 -20
  158. package/selection/highlight/types/header.mjs +10 -19
  159. package/selection/highlight/types/{index.js → row.js} +27 -31
  160. package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
  161. package/selection/highlight/visualSelection.js +31 -27
  162. package/selection/highlight/visualSelection.mjs +31 -27
  163. package/selection/index.js +4 -7
  164. package/selection/index.mjs +2 -3
  165. package/selection/mouseEventHandler.js +1 -1
  166. package/selection/mouseEventHandler.mjs +1 -1
  167. package/selection/range.js +8 -8
  168. package/selection/range.mjs +8 -8
  169. package/selection/selection.js +315 -181
  170. package/selection/selection.mjs +310 -180
  171. package/selection/transformation.js +233 -96
  172. package/selection/transformation.mjs +230 -93
  173. package/selection/utils.js +12 -36
  174. package/selection/utils.mjs +13 -36
  175. package/settings.d.ts +1 -0
  176. package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
  177. package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
  178. package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
  179. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  180. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  181. package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
  182. package/shortcutContexts/commands/editor/index.js +16 -0
  183. package/shortcutContexts/commands/editor/index.mjs +12 -0
  184. package/shortcutContexts/commands/editor/open.js +29 -0
  185. package/shortcutContexts/commands/editor/open.mjs +24 -0
  186. package/shortcutContexts/commands/emptySelectedCells.js +12 -0
  187. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  188. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  189. package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
  190. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
  191. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
  192. package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
  193. package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
  194. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  195. package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
  196. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  197. package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
  198. package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
  199. package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +14 -0
  200. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
  201. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
  202. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
  203. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
  204. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
  205. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
  206. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +40 -0
  207. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +35 -0
  208. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +40 -0
  209. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +35 -0
  210. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
  211. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
  212. package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
  213. package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +14 -0
  214. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  215. package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
  216. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
  217. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
  218. package/shortcutContexts/commands/index.js +52 -0
  219. package/shortcutContexts/commands/index.mjs +48 -0
  220. package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
  221. package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
  222. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +29 -0
  223. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +24 -0
  224. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  225. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  226. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
  227. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  228. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
  229. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  230. package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
  231. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  232. package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
  233. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  234. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
  235. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
  236. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
  237. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
  238. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
  239. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
  240. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
  241. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
  242. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +36 -0
  243. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +31 -0
  244. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +36 -0
  245. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +31 -0
  246. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
  247. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
  248. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
  249. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
  250. package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
  251. package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
  252. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +29 -0
  253. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +24 -0
  254. package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
  255. package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
  256. package/shortcutContexts/commands/selectAll.js +11 -0
  257. package/shortcutContexts/commands/selectAll.mjs +6 -0
  258. package/shortcutContexts/constants.js +19 -0
  259. package/shortcutContexts/constants.mjs +12 -0
  260. package/shortcutContexts/editor.js +29 -0
  261. package/shortcutContexts/editor.mjs +25 -0
  262. package/shortcutContexts/grid.js +247 -0
  263. package/shortcutContexts/grid.mjs +243 -0
  264. package/shortcutContexts/index.js +29 -0
  265. package/shortcutContexts/index.mjs +15 -0
  266. package/shortcuts/manager.js +2 -0
  267. package/shortcuts/manager.mjs +2 -0
  268. package/shortcuts/recorder.js +2 -2
  269. package/shortcuts/recorder.mjs +2 -2
  270. package/shortcuts/utils.js +21 -5
  271. package/shortcuts/utils.mjs +20 -4
  272. package/tableView.js +58 -9
  273. package/tableView.mjs +58 -9
  274. package/translations/indexMapper.js +8 -9
  275. package/translations/indexMapper.mjs +8 -9
  276. package/3rdparty/walkontable/src/selection.js +0 -355
  277. package/3rdparty/walkontable/src/selection.mjs +0 -349
  278. package/selection/highlight/constants.js +0 -16
  279. package/selection/highlight/constants.mjs +0 -6
@@ -675,25 +675,24 @@ var IndexMapper = /*#__PURE__*/function () {
675
675
  var notTrimmedIndexesLength = this.getNotTrimmedIndexesLength();
676
676
  var movedIndexesLength = movedIndexes.length;
677
677
 
678
- // Removing moved indexes without re-indexing.
679
- var notMovedIndexes = (0, _maps.getListWithRemovedItems)(this.getIndexesSequence(), physicalMovedIndexes);
680
- var notTrimmedNotMovedItems = notMovedIndexes.filter(function (index) {
681
- return _this5.isTrimmed(index) === false;
682
- });
678
+ // Removing indexes without re-indexing.
679
+ var listWithRemovedItems = (0, _maps.getListWithRemovedItems)(this.getIndexesSequence(), physicalMovedIndexes);
683
680
 
684
681
  // When item(s) are moved after the last visible item we assign the last possible index.
685
- var destinationPosition = notMovedIndexes.indexOf(notTrimmedNotMovedItems[notTrimmedNotMovedItems.length - 1]) + 1;
682
+ var destinationPosition = notTrimmedIndexesLength - movedIndexesLength;
686
683
 
687
684
  // Otherwise, we find proper index for inserted item(s).
688
685
  if (finalIndex + movedIndexesLength < notTrimmedIndexesLength) {
689
686
  // Physical index at final index position.
690
- var physicalIndex = notTrimmedNotMovedItems[finalIndex];
691
- destinationPosition = notMovedIndexes.indexOf(physicalIndex);
687
+ var physicalIndex = listWithRemovedItems.filter(function (index) {
688
+ return _this5.isTrimmed(index) === false;
689
+ })[finalIndex];
690
+ destinationPosition = listWithRemovedItems.indexOf(physicalIndex);
692
691
  }
693
692
  this.indexesChangeSource = 'move';
694
693
 
695
694
  // Adding indexes without re-indexing.
696
- this.setIndexesSequence((0, _maps.getListWithInsertedItems)(notMovedIndexes, destinationPosition, physicalMovedIndexes));
695
+ this.setIndexesSequence((0, _maps.getListWithInsertedItems)(listWithRemovedItems, destinationPosition, physicalMovedIndexes));
697
696
  this.indexesChangeSource = void 0;
698
697
  }
699
698
 
@@ -671,25 +671,24 @@ export var IndexMapper = /*#__PURE__*/function () {
671
671
  var notTrimmedIndexesLength = this.getNotTrimmedIndexesLength();
672
672
  var movedIndexesLength = movedIndexes.length;
673
673
 
674
- // Removing moved indexes without re-indexing.
675
- var notMovedIndexes = getListWithRemovedItems(this.getIndexesSequence(), physicalMovedIndexes);
676
- var notTrimmedNotMovedItems = notMovedIndexes.filter(function (index) {
677
- return _this5.isTrimmed(index) === false;
678
- });
674
+ // Removing indexes without re-indexing.
675
+ var listWithRemovedItems = getListWithRemovedItems(this.getIndexesSequence(), physicalMovedIndexes);
679
676
 
680
677
  // When item(s) are moved after the last visible item we assign the last possible index.
681
- var destinationPosition = notMovedIndexes.indexOf(notTrimmedNotMovedItems[notTrimmedNotMovedItems.length - 1]) + 1;
678
+ var destinationPosition = notTrimmedIndexesLength - movedIndexesLength;
682
679
 
683
680
  // Otherwise, we find proper index for inserted item(s).
684
681
  if (finalIndex + movedIndexesLength < notTrimmedIndexesLength) {
685
682
  // Physical index at final index position.
686
- var physicalIndex = notTrimmedNotMovedItems[finalIndex];
687
- destinationPosition = notMovedIndexes.indexOf(physicalIndex);
683
+ var physicalIndex = listWithRemovedItems.filter(function (index) {
684
+ return _this5.isTrimmed(index) === false;
685
+ })[finalIndex];
686
+ destinationPosition = listWithRemovedItems.indexOf(physicalIndex);
688
687
  }
689
688
  this.indexesChangeSource = 'move';
690
689
 
691
690
  // Adding indexes without re-indexing.
692
- this.setIndexesSequence(getListWithInsertedItems(notMovedIndexes, destinationPosition, physicalMovedIndexes));
691
+ this.setIndexesSequence(getListWithInsertedItems(listWithRemovedItems, destinationPosition, physicalMovedIndexes));
693
692
  this.indexesChangeSource = void 0;
694
693
  }
695
694
 
@@ -1,355 +0,0 @@
1
- "use strict";
2
-
3
- require("core-js/modules/es.symbol.iterator.js");
4
- require("core-js/modules/es.array.iterator.js");
5
- require("core-js/modules/es.string.iterator.js");
6
- require("core-js/modules/web.dom-collections.iterator.js");
7
- require("core-js/modules/es.array.slice.js");
8
- require("core-js/modules/es.regexp.to-string.js");
9
- require("core-js/modules/es.function.name.js");
10
- require("core-js/modules/es.array.from.js");
11
- require("core-js/modules/es.regexp.exec.js");
12
- exports.__esModule = true;
13
- exports.default = void 0;
14
- require("core-js/modules/es.array.includes.js");
15
- require("core-js/modules/es.string.includes.js");
16
- require("core-js/modules/es.array.concat.js");
17
- require("core-js/modules/es.object.to-string.js");
18
- require("core-js/modules/web.dom-collections.for-each.js");
19
- require("core-js/modules/es.object.values.js");
20
- require("core-js/modules/es.symbol.to-primitive.js");
21
- require("core-js/modules/es.date.to-primitive.js");
22
- require("core-js/modules/es.symbol.js");
23
- require("core-js/modules/es.symbol.description.js");
24
- require("core-js/modules/es.number.constructor.js");
25
- var _element = require("./../../../helpers/dom/element");
26
- var _border = _interopRequireDefault(require("./border"));
27
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
29
- 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."); }
30
- 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); }
31
- 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; }
32
- 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; } }
33
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
34
- 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); }
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
- /**
41
- * @class Selection
42
- */
43
- var Selection = /*#__PURE__*/function () {
44
- /**
45
- * @param {object} settings The selection settings object. @todo type.
46
- * @param {CellRange} cellRange The cell range instance.
47
- */
48
- function Selection(settings, cellRange) {
49
- _classCallCheck(this, Selection);
50
- this.settings = settings;
51
- this.cellRange = cellRange || null;
52
- this.instanceBorders = {};
53
- this.classNames = [this.settings.className];
54
- this.classNameGenerator = this.linearClassNameGenerator(this.settings.className, this.settings.layerLevel);
55
- }
56
-
57
- /**
58
- * Each Walkontable clone requires it's own border for every selection. This method creates and returns selection
59
- * borders per instance.
60
- *
61
- * @param {WalkontableFacade} wotInstance The Walkontable instance.
62
- * @returns {Border}
63
- */
64
- _createClass(Selection, [{
65
- key: "getBorder",
66
- value: function getBorder(wotInstance) {
67
- if (!this.instanceBorders[wotInstance.guid]) {
68
- this.instanceBorders[wotInstance.guid] = new _border.default(wotInstance, this.settings);
69
- }
70
- return this.instanceBorders[wotInstance.guid];
71
- }
72
-
73
- /**
74
- * Checks if selection is empty.
75
- *
76
- * @returns {boolean}
77
- */
78
- }, {
79
- key: "isEmpty",
80
- value: function isEmpty() {
81
- return this.cellRange === null;
82
- }
83
-
84
- /**
85
- * Adds a cell coords to the selection.
86
- *
87
- * @param {CellCoords} coords The cell coordinates to add.
88
- * @returns {Selection}
89
- */
90
- }, {
91
- key: "add",
92
- value: function add(coords) {
93
- if (this.isEmpty()) {
94
- this.cellRange = this.settings.createCellRange(coords);
95
- } else {
96
- this.cellRange.expand(coords);
97
- }
98
- return this;
99
- }
100
-
101
- /**
102
- * If selection range from or to property equals oldCoords, replace it with newCoords. Return boolean
103
- * information about success.
104
- *
105
- * @param {CellCoords} oldCoords An old cell coordinates to replace.
106
- * @param {CellCoords} newCoords The new cell coordinates.
107
- * @returns {boolean}
108
- */
109
- }, {
110
- key: "replace",
111
- value: function replace(oldCoords, newCoords) {
112
- if (!this.isEmpty()) {
113
- if (this.cellRange.from.isEqual(oldCoords)) {
114
- this.cellRange.from = newCoords;
115
- return true;
116
- }
117
- if (this.cellRange.to.isEqual(oldCoords)) {
118
- this.cellRange.to = newCoords;
119
- return true;
120
- }
121
- }
122
- return false;
123
- }
124
-
125
- /**
126
- * Clears selection.
127
- *
128
- * @returns {Selection}
129
- */
130
- }, {
131
- key: "clear",
132
- value: function clear() {
133
- this.cellRange = null;
134
- return this;
135
- }
136
-
137
- /**
138
- * Returns the top left (or top right in RTL) and bottom right (or bottom left in RTL) selection coordinates.
139
- *
140
- * @returns {Array} Returns array of coordinates for example `[1, 1, 5, 5]`.
141
- */
142
- }, {
143
- key: "getCorners",
144
- value: function getCorners() {
145
- var topStart = this.cellRange.getOuterTopStartCorner();
146
- var bottomEnd = this.cellRange.getOuterBottomEndCorner();
147
- return [topStart.row, topStart.col, bottomEnd.row, bottomEnd.col];
148
- }
149
-
150
- /**
151
- * Adds class name to cell element at given coords.
152
- *
153
- * @param {WalkontableFacade} wotInstance Walkontable instance.
154
- * @param {number} sourceRow Cell row coord.
155
- * @param {number} sourceColumn Cell column coord.
156
- * @param {string} className Class name.
157
- * @param {boolean} [markIntersections=false] If `true`, linear className generator will be used to add CSS classes
158
- * in a continuous way.
159
- * @returns {Selection}
160
- */
161
- }, {
162
- key: "addClassAtCoords",
163
- value: function addClassAtCoords(wotInstance, sourceRow, sourceColumn, className) {
164
- var markIntersections = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
165
- var TD = wotInstance.wtTable.getCell(this.settings.createCellCoords(sourceRow, sourceColumn));
166
- if (_typeof(TD) === 'object') {
167
- var cellClassName = className;
168
- if (markIntersections) {
169
- cellClassName = this.classNameGenerator(TD);
170
- if (!this.classNames.includes(cellClassName)) {
171
- this.classNames.push(cellClassName);
172
- }
173
- }
174
- (0, _element.addClass)(TD, cellClassName);
175
- }
176
- return this;
177
- }
178
-
179
- /**
180
- * Generate helper for calculating classNames based on previously added base className.
181
- * The generated className is always generated as a continuation of the previous className. For example, when
182
- * the currently checked element has 'area-2' className the generated new className will be 'area-3'. When
183
- * the element doesn't have any classNames than the base className will be returned ('area');.
184
- *
185
- * @param {string} baseClassName Base className to be used.
186
- * @param {number} layerLevelOwner Layer level which the instance of the Selection belongs to.
187
- * @returns {Function}
188
- */
189
- }, {
190
- key: "linearClassNameGenerator",
191
- value: function linearClassNameGenerator(baseClassName, layerLevelOwner) {
192
- // TODO: Make this recursive function Proper Tail Calls (TCO/PTC) friendly.
193
- return function calcClassName(element) {
194
- var previousIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
195
- if (layerLevelOwner === 0 || previousIndex === 0) {
196
- return baseClassName;
197
- }
198
- var index = previousIndex >= 0 ? previousIndex : layerLevelOwner;
199
- var className = baseClassName;
200
- index -= 1;
201
- var previousClassName = index === 0 ? baseClassName : "".concat(baseClassName, "-").concat(index);
202
- if ((0, _element.hasClass)(element, previousClassName)) {
203
- var currentLayer = index + 1;
204
- className = "".concat(baseClassName, "-").concat(currentLayer);
205
- } else {
206
- className = calcClassName(element, index);
207
- }
208
- return className;
209
- };
210
- }
211
-
212
- /**
213
- * @param {WalkontableFacade} wotInstance The Walkontable instance.
214
- */
215
- }, {
216
- key: "draw",
217
- value: function draw(wotInstance) {
218
- if (this.isEmpty()) {
219
- if (this.settings.border) {
220
- this.getBorder(wotInstance).disappear();
221
- }
222
- return;
223
- }
224
- var renderedRows = wotInstance.wtTable.getRenderedRowsCount();
225
- var renderedColumns = wotInstance.wtTable.getRenderedColumnsCount();
226
- var corners = this.getCorners();
227
- var _corners = _slicedToArray(corners, 4),
228
- topRow = _corners[0],
229
- topColumn = _corners[1],
230
- bottomRow = _corners[2],
231
- bottomColumn = _corners[3];
232
- var _this$settings = this.settings,
233
- highlightHeaderClassName = _this$settings.highlightHeaderClassName,
234
- highlightColumnClassName = _this$settings.highlightColumnClassName,
235
- highlightRowClassName = _this$settings.highlightRowClassName,
236
- highlightOnlyClosestHeader = _this$settings.highlightOnlyClosestHeader,
237
- selectionType = _this$settings.selectionType;
238
- var isHeaderSelectionType = selectionType === void 0 || ['active-header', 'header'].includes(selectionType);
239
- if (isHeaderSelectionType && topColumn !== null && bottomColumn !== null) {
240
- var selectionColumnCursor = 0;
241
- for (var column = 0; column < renderedColumns; column += 1) {
242
- var sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(column);
243
- if (sourceCol >= topColumn && sourceCol <= bottomColumn) {
244
- var THs = wotInstance.wtTable.getColumnHeaders(sourceCol);
245
- var closestHeaderLevel = THs.length - 1;
246
- if (highlightOnlyClosestHeader && THs.length > 1) {
247
- THs = [THs[closestHeaderLevel]];
248
- }
249
- for (var headerLevel = 0; headerLevel < THs.length; headerLevel += 1) {
250
- var newClasses = [];
251
- var TH = THs[headerLevel];
252
- if (highlightHeaderClassName) {
253
- newClasses.push(highlightHeaderClassName);
254
- }
255
- if (highlightColumnClassName) {
256
- newClasses.push(highlightColumnClassName);
257
- }
258
- headerLevel = highlightOnlyClosestHeader ? closestHeaderLevel : headerLevel;
259
- var newSourceCol = wotInstance.getSetting('onBeforeHighlightingColumnHeader', sourceCol, headerLevel, {
260
- selectionType: selectionType,
261
- columnCursor: selectionColumnCursor,
262
- selectionWidth: bottomColumn - topColumn + 1,
263
- classNames: newClasses
264
- });
265
- if (newSourceCol !== sourceCol) {
266
- TH = wotInstance.wtTable.getColumnHeader(newSourceCol, headerLevel);
267
- }
268
- (0, _element.addClass)(TH, newClasses);
269
- }
270
- selectionColumnCursor += 1;
271
- }
272
- }
273
- }
274
- if (topRow !== null && bottomRow !== null) {
275
- var selectionRowCursor = 0;
276
- for (var row = 0; row < renderedRows; row += 1) {
277
- var sourceRow = wotInstance.wtTable.rowFilter.renderedToSource(row);
278
- if (isHeaderSelectionType && sourceRow >= topRow && sourceRow <= bottomRow) {
279
- var _THs = wotInstance.wtTable.getRowHeaders(sourceRow);
280
- var _closestHeaderLevel = _THs.length - 1;
281
- if (highlightOnlyClosestHeader && _THs.length > 1) {
282
- _THs = [_THs[_closestHeaderLevel]];
283
- }
284
- for (var _headerLevel = 0; _headerLevel < _THs.length; _headerLevel += 1) {
285
- var _newClasses = [];
286
- var _TH = _THs[_headerLevel];
287
- if (highlightHeaderClassName) {
288
- _newClasses.push(highlightHeaderClassName);
289
- }
290
- if (highlightRowClassName) {
291
- _newClasses.push(highlightRowClassName);
292
- }
293
- _headerLevel = highlightOnlyClosestHeader ? _closestHeaderLevel : _headerLevel;
294
- var newSourceRow = wotInstance.getSetting('onBeforeHighlightingRowHeader', sourceRow, _headerLevel, {
295
- selectionType: selectionType,
296
- rowCursor: selectionRowCursor,
297
- selectionHeight: bottomRow - topRow + 1,
298
- classNames: _newClasses
299
- });
300
- if (newSourceRow !== sourceRow) {
301
- _TH = wotInstance.wtTable.getRowHeader(newSourceRow, _headerLevel);
302
- }
303
- (0, _element.addClass)(_TH, _newClasses);
304
- }
305
- selectionRowCursor += 1;
306
- }
307
- if (topColumn !== null && bottomColumn !== null) {
308
- for (var _column = 0; _column < renderedColumns; _column += 1) {
309
- var _sourceCol = wotInstance.wtTable.columnFilter.renderedToSource(_column);
310
- if (sourceRow >= topRow && sourceRow <= bottomRow && _sourceCol >= topColumn && _sourceCol <= bottomColumn) {
311
- // selected cell
312
- if (this.settings.className) {
313
- this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, this.settings.className, this.settings.markIntersections);
314
- }
315
- } else if (sourceRow >= topRow && sourceRow <= bottomRow) {
316
- // selection is in this row
317
- if (highlightRowClassName) {
318
- this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, highlightRowClassName);
319
- }
320
- } else if (_sourceCol >= topColumn && _sourceCol <= bottomColumn) {
321
- // selection is in this column
322
- if (highlightColumnClassName) {
323
- this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, highlightColumnClassName);
324
- }
325
- }
326
- var additionalSelectionClass = wotInstance.getSetting('onAfterDrawSelection', sourceRow, _sourceCol, this.settings.layerLevel);
327
- if (typeof additionalSelectionClass === 'string') {
328
- this.addClassAtCoords(wotInstance, sourceRow, _sourceCol, additionalSelectionClass);
329
- }
330
- }
331
- }
332
- }
333
- }
334
- wotInstance.getSetting('onBeforeDrawBorders', corners, this.settings.className);
335
- if (this.settings.border) {
336
- // warning! border.appear modifies corners!
337
- this.getBorder(wotInstance).appear(corners);
338
- }
339
- }
340
-
341
- /**
342
- * Cleans up all the DOM state related to a Selection instance. Call this prior to deleting a Selection instance.
343
- */
344
- }, {
345
- key: "destroy",
346
- value: function destroy() {
347
- Object.values(this.instanceBorders).forEach(function (border) {
348
- return border.destroy();
349
- });
350
- }
351
- }]);
352
- return Selection;
353
- }();
354
- var _default = Selection;
355
- exports.default = _default;