handsontable 0.0.0-next-ecc62fd-20230525 → 0.0.0-next-93e34dc-20230601

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

Potentially problematic release.


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

Files changed (216) hide show
  1. package/3rdparty/walkontable/src/cell/coords.d.ts +6 -1
  2. package/3rdparty/walkontable/src/cell/coords.js +61 -12
  3. package/3rdparty/walkontable/src/cell/coords.mjs +61 -12
  4. package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
  5. package/3rdparty/walkontable/src/cell/range.js +44 -7
  6. package/3rdparty/walkontable/src/cell/range.mjs +44 -7
  7. package/3rdparty/walkontable/src/core/_base.js +9 -3
  8. package/3rdparty/walkontable/src/core/_base.mjs +9 -3
  9. package/3rdparty/walkontable/src/core/clone.js +2 -2
  10. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  11. package/3rdparty/walkontable/src/core/core.js +3 -2
  12. package/3rdparty/walkontable/src/core/core.mjs +3 -2
  13. package/3rdparty/walkontable/src/event.js +7 -7
  14. package/3rdparty/walkontable/src/event.mjs +7 -7
  15. package/3rdparty/walkontable/src/facade/core.js +2 -2
  16. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  17. package/3rdparty/walkontable/src/index.js +10 -2
  18. package/3rdparty/walkontable/src/index.mjs +2 -2
  19. package/3rdparty/walkontable/src/overlay/_base.js +1 -1
  20. package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
  21. package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -4
  22. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -4
  23. package/3rdparty/walkontable/src/overlay/top.js +2 -4
  24. package/3rdparty/walkontable/src/overlay/top.mjs +2 -4
  25. package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
  26. package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
  27. package/3rdparty/walkontable/src/selection/border/constants.js +18 -0
  28. package/3rdparty/walkontable/src/selection/border/constants.mjs +13 -0
  29. package/3rdparty/walkontable/src/selection/constants.js +63 -0
  30. package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
  31. package/3rdparty/walkontable/src/selection/index.js +30 -0
  32. package/3rdparty/walkontable/src/selection/index.mjs +5 -0
  33. package/3rdparty/walkontable/src/selection/manager.js +328 -0
  34. package/3rdparty/walkontable/src/selection/manager.mjs +322 -0
  35. package/3rdparty/walkontable/src/selection/scanner.js +363 -0
  36. package/3rdparty/walkontable/src/selection/scanner.mjs +359 -0
  37. package/3rdparty/walkontable/src/selection/selection.js +133 -0
  38. package/3rdparty/walkontable/src/selection/selection.mjs +127 -0
  39. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
  40. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
  41. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
  42. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
  43. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
  44. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
  45. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
  46. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
  47. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
  48. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
  49. package/3rdparty/walkontable/src/table.js +7 -79
  50. package/3rdparty/walkontable/src/table.mjs +8 -80
  51. package/base.js +2 -2
  52. package/base.mjs +2 -2
  53. package/core.d.ts +5 -3
  54. package/core.js +82 -300
  55. package/core.mjs +82 -300
  56. package/dataMap/metaManager/metaSchema.js +15 -0
  57. package/dataMap/metaManager/metaSchema.mjs +15 -0
  58. package/dist/handsontable.css +8 -3
  59. package/dist/handsontable.full.css +8 -3
  60. package/dist/handsontable.full.js +12245 -9953
  61. package/dist/handsontable.full.min.css +3 -3
  62. package/dist/handsontable.full.min.js +120 -120
  63. package/dist/handsontable.js +15898 -13606
  64. package/dist/handsontable.min.css +3 -3
  65. package/dist/handsontable.min.js +4 -4
  66. package/editorManager.js +20 -82
  67. package/editorManager.mjs +25 -86
  68. package/editors/textEditor/textEditor.js +3 -11
  69. package/editors/textEditor/textEditor.mjs +4 -12
  70. package/helpers/mixed.js +1 -1
  71. package/helpers/mixed.mjs +1 -1
  72. package/helpers/number.d.ts +1 -0
  73. package/helpers/number.js +18 -0
  74. package/helpers/number.mjs +17 -0
  75. package/package.json +1 -1
  76. package/pluginHooks.js +1 -1
  77. package/pluginHooks.mjs +1 -1
  78. package/plugins/copyPaste/copyPaste.js +5 -1
  79. package/plugins/copyPaste/copyPaste.mjs +5 -1
  80. package/plugins/customBorders/customBorders.js +18 -52
  81. package/plugins/customBorders/customBorders.mjs +19 -53
  82. package/plugins/mergeCells/mergeCells.js +5 -18
  83. package/plugins/mergeCells/mergeCells.mjs +5 -18
  84. package/plugins/nestedHeaders/nestedHeaders.js +89 -9
  85. package/plugins/nestedHeaders/nestedHeaders.mjs +89 -9
  86. package/plugins/nestedHeaders/stateManager/index.js +37 -0
  87. package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
  88. package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
  89. package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
  90. package/selection/highlight/highlight.js +311 -88
  91. package/selection/highlight/highlight.mjs +301 -84
  92. package/selection/highlight/types/activeHeader.js +10 -9
  93. package/selection/highlight/types/activeHeader.mjs +10 -8
  94. package/selection/highlight/types/area.js +12 -27
  95. package/selection/highlight/types/area.mjs +16 -30
  96. package/selection/highlight/types/areaLayered.js +54 -0
  97. package/selection/highlight/types/areaLayered.mjs +49 -0
  98. package/selection/highlight/types/column.js +50 -0
  99. package/selection/highlight/types/column.mjs +45 -0
  100. package/selection/highlight/types/customSelection.js +7 -10
  101. package/selection/highlight/types/customSelection.mjs +7 -9
  102. package/selection/highlight/types/fill.js +5 -8
  103. package/selection/highlight/types/fill.mjs +5 -7
  104. package/selection/highlight/types/{cell.js → focus.js} +5 -8
  105. package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
  106. package/selection/highlight/types/header.js +10 -20
  107. package/selection/highlight/types/header.mjs +10 -19
  108. package/selection/highlight/types/{index.js → row.js} +27 -31
  109. package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
  110. package/selection/highlight/visualSelection.js +23 -28
  111. package/selection/highlight/visualSelection.mjs +23 -28
  112. package/selection/index.js +4 -7
  113. package/selection/index.mjs +2 -3
  114. package/selection/mouseEventHandler.js +1 -1
  115. package/selection/mouseEventHandler.mjs +1 -1
  116. package/selection/range.js +8 -8
  117. package/selection/range.mjs +8 -8
  118. package/selection/selection.js +296 -180
  119. package/selection/selection.mjs +291 -179
  120. package/selection/transformation.js +233 -96
  121. package/selection/transformation.mjs +230 -93
  122. package/selection/utils.js +12 -35
  123. package/selection/utils.mjs +13 -35
  124. package/settings.d.ts +1 -0
  125. package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
  126. package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
  127. package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
  128. package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
  129. package/shortcutContexts/commands/editor/fastOpen.js +16 -0
  130. package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
  131. package/shortcutContexts/commands/editor/index.js +16 -0
  132. package/shortcutContexts/commands/editor/index.mjs +12 -0
  133. package/shortcutContexts/commands/editor/open.js +29 -0
  134. package/shortcutContexts/commands/editor/open.mjs +24 -0
  135. package/shortcutContexts/commands/emptySelectedCells.js +12 -0
  136. package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
  137. package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
  138. package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
  139. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
  140. package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -0
  141. package/shortcutContexts/commands/extendCellsSelection/index.js +24 -0
  142. package/shortcutContexts/commands/extendCellsSelection/index.mjs +20 -0
  143. package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
  144. package/shortcutContexts/commands/extendCellsSelection/left.mjs +10 -0
  145. package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
  146. package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
  147. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
  148. package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
  149. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
  150. package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
  151. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
  152. package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
  153. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +39 -0
  154. package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +34 -0
  155. package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +39 -0
  156. package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +34 -0
  157. package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
  158. package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
  159. package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
  160. package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
  161. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
  162. package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
  163. package/shortcutContexts/commands/index.js +51 -0
  164. package/shortcutContexts/commands/index.mjs +47 -0
  165. package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
  166. package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
  167. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +11 -0
  168. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +6 -0
  169. package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
  170. package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
  171. package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
  172. package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
  173. package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
  174. package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
  175. package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
  176. package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
  177. package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
  178. package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
  179. package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
  180. package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
  181. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
  182. package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
  183. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
  184. package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
  185. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
  186. package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
  187. package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +35 -0
  188. package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +30 -0
  189. package/shortcutContexts/commands/moveCellSelection/toMostRight.js +35 -0
  190. package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +30 -0
  191. package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
  192. package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
  193. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
  194. package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
  195. package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
  196. package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
  197. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +11 -0
  198. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +6 -0
  199. package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
  200. package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
  201. package/shortcutContexts/commands/selectAll.js +11 -0
  202. package/shortcutContexts/commands/selectAll.mjs +6 -0
  203. package/shortcutContexts/constants.js +19 -0
  204. package/shortcutContexts/constants.mjs +12 -0
  205. package/shortcutContexts/editor.js +29 -0
  206. package/shortcutContexts/editor.mjs +25 -0
  207. package/shortcutContexts/grid.js +232 -0
  208. package/shortcutContexts/grid.mjs +228 -0
  209. package/shortcutContexts/index.js +29 -0
  210. package/shortcutContexts/index.mjs +15 -0
  211. package/tableView.js +58 -9
  212. package/tableView.mjs +58 -9
  213. package/3rdparty/walkontable/src/selection.js +0 -354
  214. package/3rdparty/walkontable/src/selection.mjs +0 -348
  215. package/selection/highlight/constants.js +0 -16
  216. package/selection/highlight/constants.mjs +0 -6
@@ -4,7 +4,12 @@ export default class CellCoords {
4
4
  row: number;
5
5
  col: number;
6
6
 
7
- isValid(wot: any): boolean;
7
+ isValid(tableParams: {
8
+ countRows?: number;
9
+ countCols?: number;
10
+ countRowHeaders?: number;
11
+ countColHeaders?: number;
12
+ }): boolean;
8
13
  isEqual(cellCoords: CellCoords): boolean;
9
14
  isSouthEastOf(testedCoords: any): boolean;
10
15
  isNorthWestOf(testedCoords: any): boolean;
@@ -4,16 +4,24 @@ require("core-js/modules/es.symbol.to-primitive.js");
4
4
  require("core-js/modules/es.date.to-primitive.js");
5
5
  require("core-js/modules/es.symbol.js");
6
6
  require("core-js/modules/es.symbol.description.js");
7
- require("core-js/modules/es.number.constructor.js");
7
+ require("core-js/modules/es.object.keys.js");
8
+ require("core-js/modules/es.array.filter.js");
9
+ require("core-js/modules/es.object.get-own-property-descriptor.js");
10
+ require("core-js/modules/web.dom-collections.for-each.js");
11
+ require("core-js/modules/es.object.get-own-property-descriptors.js");
8
12
  require("core-js/modules/es.symbol.iterator.js");
9
13
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
10
14
  exports.__esModule = true;
11
15
  exports.default = void 0;
16
+ require("core-js/modules/es.number.is-integer.js");
17
+ require("core-js/modules/es.number.constructor.js");
12
18
  require("core-js/modules/es.array.iterator.js");
13
19
  require("core-js/modules/es.object.to-string.js");
14
20
  require("core-js/modules/es.string.iterator.js");
15
21
  require("core-js/modules/es.weak-map.js");
16
22
  require("core-js/modules/web.dom-collections.iterator.js");
23
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
24
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17
25
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
26
  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); } }
19
27
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -78,28 +86,45 @@ var CellCoords = /*#__PURE__*/function () {
78
86
 
79
87
  /**
80
88
  * Checks if the coordinates in your `CellCoords` instance are valid
81
- * in the context of a given Walkontable instance.
89
+ * in the context of a given table parameters.
82
90
  *
83
91
  * The `row` index:
84
- * - Can't be negative.
85
- * - Can't be higher than the total number of rows in the Walkontable instance.
92
+ * - Cannot be a type other than Integer.
93
+ * - Can't be lower than the number of column headers in the table.
94
+ * - Can't be higher than the total number of rows in the table.
86
95
  *
87
96
  * The `col` index:
88
- * - Can't be negative.
89
- * - Can't be higher than the total number of columns in the Walkontable instance.
97
+ * - Cannot be a type other than Integer.
98
+ * - Can't be lower than the number of rows headers in the table.
99
+ * - Can't be higher than the total number of columns in the table.
90
100
  *
91
- * @param {Walkontable} wot A Walkontable instance.
101
+ * @param {object} [tableParams] An object with defined table size.
102
+ * @param {number} [tableParams.countRows=0] Total number of rows.
103
+ * @param {number} [tableParams.countCols=0] Total number of columns.
104
+ * @param {number} [tableParams.countRowHeaders=0] A number of row headers
105
+ * @param {number} [tableParams.countColHeaders=0] A number of column headers
92
106
  * @returns {boolean} `true`: The coordinates are valid.
93
107
  */
94
108
  _createClass(CellCoords, [{
95
109
  key: "isValid",
96
- value: function isValid(wot) {
97
- // check if the row and column indexes are valid (0 or higher)
98
- if (this.row < 0 || this.col < 0) {
110
+ value: function isValid(tableParams) {
111
+ var _countRows$countCols$ = _objectSpread({
112
+ countRows: 0,
113
+ countCols: 0,
114
+ countRowHeaders: 0,
115
+ countColHeaders: 0
116
+ }, tableParams),
117
+ countRows = _countRows$countCols$.countRows,
118
+ countCols = _countRows$countCols$.countCols,
119
+ countRowHeaders = _countRows$countCols$.countRowHeaders,
120
+ countColHeaders = _countRows$countCols$.countColHeaders;
121
+ if (!Number.isInteger(this.row) || !Number.isInteger(this.col)) {
99
122
  return false;
100
123
  }
101
- // check if the selection fits in the total of rows and columns
102
- if (this.row >= wot.getSetting('totalRows') || this.col >= wot.getSetting('totalColumns')) {
124
+ if (this.row < -countColHeaders || this.col < -countRowHeaders) {
125
+ return false;
126
+ }
127
+ if (this.row >= countRows || this.col >= countCols) {
103
128
  return false;
104
129
  }
105
130
  return true;
@@ -121,6 +146,30 @@ var CellCoords = /*#__PURE__*/function () {
121
146
  return this.row === cellCoords.row && this.col === cellCoords.col;
122
147
  }
123
148
 
149
+ /**
150
+ * Checks if the coordinates point to the headers range. If one of the axis (row or col) point to
151
+ * the header (negative value) then method returns `true`.
152
+ *
153
+ * @returns {boolean}
154
+ */
155
+ }, {
156
+ key: "isHeader",
157
+ value: function isHeader() {
158
+ return !this.isCell();
159
+ }
160
+
161
+ /**
162
+ * Checks if the coordinates point to the cells range. If all axis (row and col) point to
163
+ * the cell (positive value) then method returns `true`.
164
+ *
165
+ * @returns {boolean}
166
+ */
167
+ }, {
168
+ key: "isCell",
169
+ value: function isCell() {
170
+ return this.row >= 0 && this.col >= 0;
171
+ }
172
+
124
173
  /**
125
174
  * Checks if another set of coordinates (`testedCoords`)
126
175
  * is south-east of the coordinates in your `CellCoords` instance.
@@ -1,4 +1,6 @@
1
1
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
+ import "core-js/modules/es.number.is-integer.js";
3
+ import "core-js/modules/es.number.constructor.js";
2
4
  import "core-js/modules/es.array.iterator.js";
3
5
  import "core-js/modules/es.object.to-string.js";
4
6
  import "core-js/modules/es.string.iterator.js";
@@ -8,8 +10,14 @@ import "core-js/modules/es.symbol.to-primitive.js";
8
10
  import "core-js/modules/es.date.to-primitive.js";
9
11
  import "core-js/modules/es.symbol.js";
10
12
  import "core-js/modules/es.symbol.description.js";
11
- import "core-js/modules/es.number.constructor.js";
13
+ import "core-js/modules/es.object.keys.js";
14
+ import "core-js/modules/es.array.filter.js";
15
+ import "core-js/modules/es.object.get-own-property-descriptor.js";
16
+ import "core-js/modules/web.dom-collections.for-each.js";
17
+ import "core-js/modules/es.object.get-own-property-descriptors.js";
12
18
  import "core-js/modules/es.symbol.iterator.js";
19
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
21
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
22
  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); } }
15
23
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -74,28 +82,45 @@ var CellCoords = /*#__PURE__*/function () {
74
82
 
75
83
  /**
76
84
  * Checks if the coordinates in your `CellCoords` instance are valid
77
- * in the context of a given Walkontable instance.
85
+ * in the context of a given table parameters.
78
86
  *
79
87
  * The `row` index:
80
- * - Can't be negative.
81
- * - Can't be higher than the total number of rows in the Walkontable instance.
88
+ * - Cannot be a type other than Integer.
89
+ * - Can't be lower than the number of column headers in the table.
90
+ * - Can't be higher than the total number of rows in the table.
82
91
  *
83
92
  * The `col` index:
84
- * - Can't be negative.
85
- * - Can't be higher than the total number of columns in the Walkontable instance.
93
+ * - Cannot be a type other than Integer.
94
+ * - Can't be lower than the number of rows headers in the table.
95
+ * - Can't be higher than the total number of columns in the table.
86
96
  *
87
- * @param {Walkontable} wot A Walkontable instance.
97
+ * @param {object} [tableParams] An object with defined table size.
98
+ * @param {number} [tableParams.countRows=0] Total number of rows.
99
+ * @param {number} [tableParams.countCols=0] Total number of columns.
100
+ * @param {number} [tableParams.countRowHeaders=0] A number of row headers
101
+ * @param {number} [tableParams.countColHeaders=0] A number of column headers
88
102
  * @returns {boolean} `true`: The coordinates are valid.
89
103
  */
90
104
  _createClass(CellCoords, [{
91
105
  key: "isValid",
92
- value: function isValid(wot) {
93
- // check if the row and column indexes are valid (0 or higher)
94
- if (this.row < 0 || this.col < 0) {
106
+ value: function isValid(tableParams) {
107
+ var _countRows$countCols$ = _objectSpread({
108
+ countRows: 0,
109
+ countCols: 0,
110
+ countRowHeaders: 0,
111
+ countColHeaders: 0
112
+ }, tableParams),
113
+ countRows = _countRows$countCols$.countRows,
114
+ countCols = _countRows$countCols$.countCols,
115
+ countRowHeaders = _countRows$countCols$.countRowHeaders,
116
+ countColHeaders = _countRows$countCols$.countColHeaders;
117
+ if (!Number.isInteger(this.row) || !Number.isInteger(this.col)) {
95
118
  return false;
96
119
  }
97
- // check if the selection fits in the total of rows and columns
98
- if (this.row >= wot.getSetting('totalRows') || this.col >= wot.getSetting('totalColumns')) {
120
+ if (this.row < -countColHeaders || this.col < -countRowHeaders) {
121
+ return false;
122
+ }
123
+ if (this.row >= countRows || this.col >= countCols) {
99
124
  return false;
100
125
  }
101
126
  return true;
@@ -117,6 +142,30 @@ var CellCoords = /*#__PURE__*/function () {
117
142
  return this.row === cellCoords.row && this.col === cellCoords.col;
118
143
  }
119
144
 
145
+ /**
146
+ * Checks if the coordinates point to the headers range. If one of the axis (row or col) point to
147
+ * the header (negative value) then method returns `true`.
148
+ *
149
+ * @returns {boolean}
150
+ */
151
+ }, {
152
+ key: "isHeader",
153
+ value: function isHeader() {
154
+ return !this.isCell();
155
+ }
156
+
157
+ /**
158
+ * Checks if the coordinates point to the cells range. If all axis (row and col) point to
159
+ * the cell (positive value) then method returns `true`.
160
+ *
161
+ * @returns {boolean}
162
+ */
163
+ }, {
164
+ key: "isCell",
165
+ value: function isCell() {
166
+ return this.row >= 0 && this.col >= 0;
167
+ }
168
+
120
169
  /**
121
170
  * Checks if another set of coordinates (`testedCoords`)
122
171
  * is south-east of the coordinates in your `CellCoords` instance.
@@ -12,8 +12,15 @@ export default class CellRange {
12
12
  setHighlight(coords: CellCoords): CellRange;
13
13
  setFrom(coords: CellCoords): CellRange;
14
14
  setTo(coords: CellCoords): CellRange;
15
- isValid(wot: any): boolean;
16
- isSingle(): boolean;
15
+ isValid(tableParams: {
16
+ countRows?: number;
17
+ countCols?: number;
18
+ countRowHeaders?: number;
19
+ countColHeaders?: number;
20
+ }): boolean;
21
+ isSingleCell(): boolean;
22
+ isSingleHeader(): boolean;
23
+ containsHeaders(): boolean;
17
24
  getOuterHeight(): number;
18
25
  getOuterWidth(): number;
19
26
  getHeight(): number;
@@ -89,7 +89,7 @@ var CellRange = /*#__PURE__*/function () {
89
89
  writable: true,
90
90
  value: false
91
91
  });
92
- this.highlight = highlight.clone().normalize();
92
+ this.highlight = highlight.clone();
93
93
  this.from = from.clone();
94
94
  this.to = to.clone();
95
95
  _classPrivateFieldSet(this, _isRtl, isRtl);
@@ -104,7 +104,7 @@ var CellRange = /*#__PURE__*/function () {
104
104
  _createClass(CellRange, [{
105
105
  key: "setHighlight",
106
106
  value: function setHighlight(coords) {
107
- this.highlight = coords.clone().normalize();
107
+ this.highlight = coords.clone();
108
108
  return this;
109
109
  }
110
110
 
@@ -136,30 +136,67 @@ var CellRange = /*#__PURE__*/function () {
136
136
 
137
137
  /**
138
138
  * Checks if the coordinates in your `CellRange` instance are valid
139
- * in the context of a given Walkontable instance.
139
+ * in the context of a given table parameters.
140
140
  *
141
141
  * See the [`isValid()`](@/api/cellCoords.md#isvalid) method of the [`CellCoords`](@/api/cellCoords.md) class.
142
142
  *
143
- * @param {Walkontable} wot A Walkontable instance.
143
+ * @param {object} tableParams An object with defined table size.
144
+ * @param {number} tableParams.countRows Total number of rows.
145
+ * @param {number} tableParams.countCols Total number of columns.
146
+ * @param {number} tableParams.countRowHeaders A number of row headers
147
+ * @param {number} tableParams.countColHeaders A number of column headers
144
148
  * @returns {boolean}
145
149
  */
146
150
  }, {
147
151
  key: "isValid",
148
- value: function isValid(wot) {
149
- return this.from.isValid(wot) && this.to.isValid(wot);
152
+ value: function isValid(tableParams) {
153
+ return this.from.isValid(tableParams) && this.to.isValid(tableParams);
150
154
  }
151
155
 
152
156
  /**
153
- * Checks if your range is just a single cell.
157
+ * Checks if your range is just a single cell or header.
154
158
  *
155
159
  * @returns {boolean}
156
160
  */
157
161
  }, {
158
162
  key: "isSingle",
159
163
  value: function isSingle() {
164
+ return this.isSingleCell() || this.isSingleHeader();
165
+ }
166
+
167
+ /**
168
+ * Checks if your range is just a single cell.
169
+ *
170
+ * @returns {boolean}
171
+ */
172
+ }, {
173
+ key: "isSingleCell",
174
+ value: function isSingleCell() {
160
175
  return this.from.row >= 0 && this.from.row === this.to.row && this.from.col >= 0 && this.from.col === this.to.col;
161
176
  }
162
177
 
178
+ /**
179
+ * Checks if your range is just a single header.
180
+ *
181
+ * @returns {boolean}
182
+ */
183
+ }, {
184
+ key: "isSingleHeader",
185
+ value: function isSingleHeader() {
186
+ return (this.from.row < 0 || this.from.col < 0) && this.from.row === this.to.row && this.from.col === this.to.col;
187
+ }
188
+
189
+ /**
190
+ * Checks if your range overlaps headers range (negative coordinates).
191
+ *
192
+ * @returns {boolean}
193
+ */
194
+ }, {
195
+ key: "containsHeaders",
196
+ value: function containsHeaders() {
197
+ return this.from.isHeader() || this.to.isHeader();
198
+ }
199
+
163
200
  /**
164
201
  * Returns the height of your range (as a number of rows, including row headers).
165
202
  *
@@ -84,7 +84,7 @@ var CellRange = /*#__PURE__*/function () {
84
84
  writable: true,
85
85
  value: false
86
86
  });
87
- this.highlight = highlight.clone().normalize();
87
+ this.highlight = highlight.clone();
88
88
  this.from = from.clone();
89
89
  this.to = to.clone();
90
90
  _classPrivateFieldSet(this, _isRtl, isRtl);
@@ -99,7 +99,7 @@ var CellRange = /*#__PURE__*/function () {
99
99
  _createClass(CellRange, [{
100
100
  key: "setHighlight",
101
101
  value: function setHighlight(coords) {
102
- this.highlight = coords.clone().normalize();
102
+ this.highlight = coords.clone();
103
103
  return this;
104
104
  }
105
105
 
@@ -131,30 +131,67 @@ var CellRange = /*#__PURE__*/function () {
131
131
 
132
132
  /**
133
133
  * Checks if the coordinates in your `CellRange` instance are valid
134
- * in the context of a given Walkontable instance.
134
+ * in the context of a given table parameters.
135
135
  *
136
136
  * See the [`isValid()`](@/api/cellCoords.md#isvalid) method of the [`CellCoords`](@/api/cellCoords.md) class.
137
137
  *
138
- * @param {Walkontable} wot A Walkontable instance.
138
+ * @param {object} tableParams An object with defined table size.
139
+ * @param {number} tableParams.countRows Total number of rows.
140
+ * @param {number} tableParams.countCols Total number of columns.
141
+ * @param {number} tableParams.countRowHeaders A number of row headers
142
+ * @param {number} tableParams.countColHeaders A number of column headers
139
143
  * @returns {boolean}
140
144
  */
141
145
  }, {
142
146
  key: "isValid",
143
- value: function isValid(wot) {
144
- return this.from.isValid(wot) && this.to.isValid(wot);
147
+ value: function isValid(tableParams) {
148
+ return this.from.isValid(tableParams) && this.to.isValid(tableParams);
145
149
  }
146
150
 
147
151
  /**
148
- * Checks if your range is just a single cell.
152
+ * Checks if your range is just a single cell or header.
149
153
  *
150
154
  * @returns {boolean}
151
155
  */
152
156
  }, {
153
157
  key: "isSingle",
154
158
  value: function isSingle() {
159
+ return this.isSingleCell() || this.isSingleHeader();
160
+ }
161
+
162
+ /**
163
+ * Checks if your range is just a single cell.
164
+ *
165
+ * @returns {boolean}
166
+ */
167
+ }, {
168
+ key: "isSingleCell",
169
+ value: function isSingleCell() {
155
170
  return this.from.row >= 0 && this.from.row === this.to.row && this.from.col >= 0 && this.from.col === this.to.col;
156
171
  }
157
172
 
173
+ /**
174
+ * Checks if your range is just a single header.
175
+ *
176
+ * @returns {boolean}
177
+ */
178
+ }, {
179
+ key: "isSingleHeader",
180
+ value: function isSingleHeader() {
181
+ return (this.from.row < 0 || this.from.col < 0) && this.from.row === this.to.row && this.from.col === this.to.col;
182
+ }
183
+
184
+ /**
185
+ * Checks if your range overlaps headers range (negative coordinates).
186
+ *
187
+ * @returns {boolean}
188
+ */
189
+ }, {
190
+ key: "containsHeaders",
191
+ value: function containsHeaders() {
192
+ return this.from.isHeader() || this.to.isHeader();
193
+ }
194
+
158
195
  /**
159
196
  * Returns the height of your range (as a number of rows, including row headers).
160
197
  *
@@ -41,7 +41,7 @@ var CoreAbstract = /*#__PURE__*/function () {
41
41
  _defineProperty(this, "wtScroll", void 0);
42
42
  _defineProperty(this, "wtViewport", void 0);
43
43
  _defineProperty(this, "wtOverlays", void 0);
44
- _defineProperty(this, "selections", void 0);
44
+ _defineProperty(this, "selectionManager", void 0);
45
45
  _defineProperty(this, "wtEvent", void 0);
46
46
  /**
47
47
  * The walkontable instance id.
@@ -348,8 +348,8 @@ var CoreAbstract = /*#__PURE__*/function () {
348
348
  return wot.wtOverlays; // TODO refactoring: move outside dao, use IOC
349
349
  },
350
350
 
351
- get selections() {
352
- return wot.selections; // TODO refactoring: move outside dao, use IOC
351
+ get selectionManager() {
352
+ return wot.selectionManager; // TODO refactoring: move outside dao, use IOC
353
353
  },
354
354
 
355
355
  get drawn() {
@@ -398,6 +398,12 @@ var CoreAbstract = /*#__PURE__*/function () {
398
398
  },
399
399
  get countRowsVisible() {
400
400
  return wot.wtViewport.rowsVisibleCalculator.count;
401
+ },
402
+ get columnHeaders() {
403
+ return wot.wtSettings.getSetting('columnHeaders');
404
+ },
405
+ get rowHeaders() {
406
+ return wot.wtSettings.getSetting('rowHeaders');
401
407
  }
402
408
  };
403
409
  }
@@ -36,7 +36,7 @@ var CoreAbstract = /*#__PURE__*/function () {
36
36
  _defineProperty(this, "wtScroll", void 0);
37
37
  _defineProperty(this, "wtViewport", void 0);
38
38
  _defineProperty(this, "wtOverlays", void 0);
39
- _defineProperty(this, "selections", void 0);
39
+ _defineProperty(this, "selectionManager", void 0);
40
40
  _defineProperty(this, "wtEvent", void 0);
41
41
  /**
42
42
  * The walkontable instance id.
@@ -343,8 +343,8 @@ var CoreAbstract = /*#__PURE__*/function () {
343
343
  return wot.wtOverlays; // TODO refactoring: move outside dao, use IOC
344
344
  },
345
345
 
346
- get selections() {
347
- return wot.selections; // TODO refactoring: move outside dao, use IOC
346
+ get selectionManager() {
347
+ return wot.selectionManager; // TODO refactoring: move outside dao, use IOC
348
348
  },
349
349
 
350
350
  get drawn() {
@@ -393,6 +393,12 @@ var CoreAbstract = /*#__PURE__*/function () {
393
393
  },
394
394
  get countRowsVisible() {
395
395
  return wot.wtViewport.rowsVisibleCalculator.count;
396
+ },
397
+ get columnHeaders() {
398
+ return wot.wtSettings.getSetting('columnHeaders');
399
+ },
400
+ get rowHeaders() {
401
+ return wot.wtSettings.getSetting('rowHeaders');
396
402
  }
397
403
  };
398
404
  }
@@ -54,8 +54,8 @@ var Clone = /*#__PURE__*/function (_CoreAbstract) {
54
54
  _this.cloneOverlay = clone.overlay;
55
55
  _this.wtTable = _this.cloneOverlay.createTable(_this.getTableDao(), facadeGetter, _this.domBindings, _this.wtSettings);
56
56
  _this.wtViewport = clone.viewport;
57
- _this.selections = clone.selections;
58
- _this.wtEvent = new _event.default(facadeGetter, _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable, _this.selections, clone.event);
57
+ _this.selectionManager = clone.selectionManager;
58
+ _this.wtEvent = new _event.default(facadeGetter, _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable, _this.selectionManager, clone.event);
59
59
  _this.findOriginalHeaders();
60
60
  return _this;
61
61
  }
@@ -49,8 +49,8 @@ var Clone = /*#__PURE__*/function (_CoreAbstract) {
49
49
  _this.cloneOverlay = clone.overlay;
50
50
  _this.wtTable = _this.cloneOverlay.createTable(_this.getTableDao(), facadeGetter, _this.domBindings, _this.wtSettings);
51
51
  _this.wtViewport = clone.viewport;
52
- _this.selections = clone.selections;
53
- _this.wtEvent = new Event(facadeGetter, _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable, _this.selections, clone.event);
52
+ _this.selectionManager = clone.selectionManager;
53
+ _this.wtEvent = new Event(facadeGetter, _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable, _this.selectionManager, clone.event);
54
54
  _this.findOriginalHeaders();
55
55
  return _this;
56
56
  }
@@ -22,6 +22,7 @@ var _settings = _interopRequireDefault(require("../settings"));
22
22
  var _master = _interopRequireDefault(require("../table/master"));
23
23
  var _viewport = _interopRequireDefault(require("../viewport"));
24
24
  var _base = _interopRequireDefault(require("./_base"));
25
+ var _manager = require("../selection/manager");
25
26
  var _object = require("../../../../helpers/object");
26
27
  var _element = require("../../../../helpers/dom/element");
27
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -55,8 +56,8 @@ var Walkontable = /*#__PURE__*/function (_CoreAbstract) {
55
56
 
56
57
  _this.wtTable = new _master.default(_this.getTableDao(), facadeGetter, _this.domBindings, _this.wtSettings);
57
58
  _this.wtViewport = new _viewport.default(_this.getViewportDao(), _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable);
58
- _this.selections = _this.wtSettings.getSetting('selections');
59
- _this.wtEvent = new _event.default(facadeGetter, _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable, _this.selections);
59
+ _this.selectionManager = new _manager.SelectionManager(_this.wtSettings.getSetting('selections'));
60
+ _this.wtEvent = new _event.default(facadeGetter, _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable, _this.selectionManager);
60
61
  _this.wtOverlays = new _overlays.default( // TODO create DAO and remove reference to the Walkontable instance.
61
62
  _assertThisInitialized(_this), facadeGetter, _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable);
62
63
  _this.exportSettingsAsClassNames();
@@ -30,6 +30,7 @@ import Settings from "../settings.mjs";
30
30
  import MasterTable from "../table/master.mjs";
31
31
  import Viewport from "../viewport.mjs";
32
32
  import CoreAbstract from "./_base.mjs";
33
+ import { SelectionManager } from "../selection/manager.mjs";
33
34
  import { objectEach } from "../../../../helpers/object.mjs";
34
35
  import { addClass, removeClass } from "../../../../helpers/dom/element.mjs";
35
36
  /**
@@ -50,8 +51,8 @@ var Walkontable = /*#__PURE__*/function (_CoreAbstract) {
50
51
 
51
52
  _this.wtTable = new MasterTable(_this.getTableDao(), facadeGetter, _this.domBindings, _this.wtSettings);
52
53
  _this.wtViewport = new Viewport(_this.getViewportDao(), _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable);
53
- _this.selections = _this.wtSettings.getSetting('selections');
54
- _this.wtEvent = new Event(facadeGetter, _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable, _this.selections);
54
+ _this.selectionManager = new SelectionManager(_this.wtSettings.getSetting('selections'));
55
+ _this.wtEvent = new Event(facadeGetter, _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable, _this.selectionManager);
55
56
  _this.wtOverlays = new Overlays( // TODO create DAO and remove reference to the Walkontable instance.
56
57
  _assertThisInitialized(_this), facadeGetter, _this.domBindings, _this.wtSettings, _this.eventManager, _this.wtTable);
57
58
  _this.exportSettingsAsClassNames();
@@ -38,16 +38,16 @@ var Event = /*#__PURE__*/function () {
38
38
  * @param {Settings} wtSettings The walkontable settings.
39
39
  * @param {EventManager} eventManager The walkontable event manager.
40
40
  * @param {Table} wtTable The table.
41
- * @param {Selections} selections Selections.
41
+ * @param {SelectionManager} selectionManager Selections.
42
42
  * @param {Event} [parent=null] The main Event instance.
43
43
  */
44
- function Event(facadeGetter, domBindings, wtSettings, eventManager, wtTable, selections) {
44
+ function Event(facadeGetter, domBindings, wtSettings, eventManager, wtTable, selectionManager) {
45
45
  var parent = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
46
46
  _classCallCheck(this, Event);
47
47
  this.wtSettings = wtSettings;
48
48
  this.domBindings = domBindings;
49
49
  this.wtTable = wtTable;
50
- this.selections = selections;
50
+ this.selectionManager = selectionManager;
51
51
  this.parent = parent;
52
52
 
53
53
  /**
@@ -180,11 +180,11 @@ var Event = /*#__PURE__*/function () {
180
180
  cell.coords = this.wtTable.getCoords(TD);
181
181
  cell.TD = TD;
182
182
  } else if ((0, _element.hasClass)(elem, 'wtBorder') && (0, _element.hasClass)(elem, 'current')) {
183
- cell.coords = this.selections.getCell().cellRange.highlight;
183
+ cell.coords = this.selectionManager.getFocusSelection().cellRange.highlight;
184
184
  cell.TD = this.wtTable.getCell(cell.coords);
185
185
  } else if ((0, _element.hasClass)(elem, 'wtBorder') && (0, _element.hasClass)(elem, 'area')) {
186
- if (this.selections.createOrGetArea().cellRange) {
187
- cell.coords = this.selections.createOrGetArea().cellRange.to;
186
+ if (this.selectionManager.getAreaSelection().cellRange) {
187
+ cell.coords = this.selectionManager.getAreaSelection().cellRange.to;
188
188
  cell.TD = this.wtTable.getCell(cell.coords);
189
189
  }
190
190
  }
@@ -334,7 +334,7 @@ var Event = /*#__PURE__*/function () {
334
334
  key: "onTouchStart",
335
335
  value: function onTouchStart(event) {
336
336
  var priv = privatePool.get(this);
337
- priv.selectedCellBeforeTouchEnd = this.selections.getCell().cellRange;
337
+ priv.selectedCellBeforeTouchEnd = this.selectionManager.getFocusSelection().cellRange;
338
338
  this.touchApplied = true;
339
339
  this.onMouseDown(event);
340
340
  }