handsontable 0.0.0-next-29d7f5c-20241210 → 0.0.0-next-2580147-20241212

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 (37) hide show
  1. package/base.js +2 -2
  2. package/base.mjs +2 -2
  3. package/core.js +4 -6
  4. package/core.mjs +4 -6
  5. package/dist/handsontable.css +2 -2
  6. package/dist/handsontable.full.css +2 -2
  7. package/dist/handsontable.full.js +123 -112
  8. package/dist/handsontable.full.min.css +2 -2
  9. package/dist/handsontable.full.min.js +61 -61
  10. package/dist/handsontable.js +123 -112
  11. package/dist/handsontable.min.css +2 -2
  12. package/dist/handsontable.min.js +12 -12
  13. package/helpers/mixed.js +1 -1
  14. package/helpers/mixed.mjs +1 -1
  15. package/package.json +1 -1
  16. package/plugins/filters/conditionCollection.js +8 -7
  17. package/plugins/filters/conditionCollection.mjs +8 -7
  18. package/plugins/filters/utils.js +7 -24
  19. package/plugins/filters/utils.mjs +7 -24
  20. package/plugins/mergeCells/calculations/autofill.js +60 -44
  21. package/plugins/mergeCells/calculations/autofill.mjs +60 -44
  22. package/plugins/mergeCells/cellsCollection.js +25 -8
  23. package/plugins/mergeCells/cellsCollection.mjs +25 -8
  24. package/plugins/mergeCells/mergeCells.js +10 -14
  25. package/plugins/mergeCells/mergeCells.mjs +10 -14
  26. package/plugins/undoRedo/actions/filters.js +1 -3
  27. package/plugins/undoRedo/actions/filters.mjs +1 -3
  28. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +1 -0
  29. package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +1 -0
  30. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +2 -1
  31. package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +2 -1
  32. package/styles/handsontable.css +5 -2
  33. package/styles/handsontable.min.css +3 -3
  34. package/styles/ht-theme-horizon.css +2 -2
  35. package/styles/ht-theme-horizon.min.css +2 -2
  36. package/styles/ht-theme-main.css +2 -2
  37. package/styles/ht-theme-main.min.css +2 -2
package/helpers/mixed.js CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
134
134
  function _injectProductInfo(key, element) {
135
135
  const hasValidType = !isEmpty(key);
136
136
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
137
- const hotVersion = "0.0.0-next-29d7f5c-20241210";
137
+ const hotVersion = "0.0.0-next-2580147-20241212";
138
138
  let keyValidityDate;
139
139
  let consoleMessageState = 'invalid';
140
140
  let domMessageState = 'invalid';
package/helpers/mixed.mjs CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
124
124
  export function _injectProductInfo(key, element) {
125
125
  const hasValidType = !isEmpty(key);
126
126
  const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
127
- const hotVersion = "0.0.0-next-29d7f5c-20241210";
127
+ const hotVersion = "0.0.0-next-2580147-20241212";
128
128
  let keyValidityDate;
129
129
  let consoleMessageState = 'invalid';
130
130
  let domMessageState = 'invalid';
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/handsontable/handsontable/issues"
11
11
  },
12
12
  "author": "Handsoncode <hello@handsontable.com>",
13
- "version": "0.0.0-next-29d7f5c-20241210",
13
+ "version": "0.0.0-next-2580147-20241212",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -4,9 +4,10 @@ exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  require("core-js/modules/es.array.push.js");
6
6
  require("core-js/modules/esnext.iterator.constructor.js");
7
+ require("core-js/modules/esnext.iterator.for-each.js");
7
8
  require("core-js/modules/esnext.iterator.map.js");
9
+ require("core-js/modules/esnext.iterator.reduce.js");
8
10
  require("core-js/modules/esnext.iterator.some.js");
9
- var _array = require("../../helpers/array");
10
11
  var _object = require("../../helpers/object");
11
12
  var _templateLiteralTag = require("../../helpers/templateLiteralTag");
12
13
  var _localHooks = _interopRequireDefault(require("../../mixins/localHooks"));
@@ -121,7 +122,7 @@ class ConditionCollection {
121
122
  let operation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _conjunction.OPERATION_ID;
122
123
  let position = arguments.length > 3 ? arguments[3] : undefined;
123
124
  const localeForColumn = this.hot.getCellMeta(0, column).locale;
124
- const args = (0, _array.arrayMap)(conditionDefinition.args, v => typeof v === 'string' ? v.toLocaleLowerCase(localeForColumn) : v);
125
+ const args = conditionDefinition.args.map(v => typeof v === 'string' ? v.toLocaleLowerCase(localeForColumn) : v);
125
126
  const name = conditionDefinition.name || conditionDefinition.command.key;
126
127
 
127
128
  // If there's no previous condition stack defined (which means the condition stack was not cleared after the
@@ -215,7 +216,7 @@ class ConditionCollection {
215
216
  * @returns {Array}
216
217
  */
217
218
  exportAllConditions() {
218
- return (0, _array.arrayReduce)(this.filteringStates.getEntries(), (allConditions, _ref2) => {
219
+ return this.filteringStates.getEntries().reduce((allConditions, _ref2) => {
219
220
  let [column, {
220
221
  operation,
221
222
  conditions
@@ -223,14 +224,14 @@ class ConditionCollection {
223
224
  allConditions.push({
224
225
  column,
225
226
  operation,
226
- conditions: (0, _array.arrayMap)(conditions, _ref3 => {
227
+ conditions: conditions.map(_ref3 => {
227
228
  let {
228
229
  name,
229
230
  args
230
231
  } = _ref3;
231
232
  return {
232
233
  name,
233
- args
234
+ args: [...args]
234
235
  };
235
236
  })
236
237
  });
@@ -245,8 +246,8 @@ class ConditionCollection {
245
246
  */
246
247
  importAllConditions(conditions) {
247
248
  this.clean();
248
- (0, _array.arrayEach)(conditions, stack => {
249
- (0, _array.arrayEach)(stack.conditions, condition => this.addCondition(stack.column, condition));
249
+ conditions.forEach(stack => {
250
+ stack.conditions.forEach(condition => this.addCondition(stack.column, condition));
250
251
  });
251
252
  }
252
253
 
@@ -1,12 +1,13 @@
1
1
  import "core-js/modules/es.error.cause.js";
2
2
  import "core-js/modules/es.array.push.js";
3
3
  import "core-js/modules/esnext.iterator.constructor.js";
4
+ import "core-js/modules/esnext.iterator.for-each.js";
4
5
  import "core-js/modules/esnext.iterator.map.js";
6
+ import "core-js/modules/esnext.iterator.reduce.js";
5
7
  import "core-js/modules/esnext.iterator.some.js";
6
8
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
7
9
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
8
10
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
9
- import { arrayEach, arrayMap, arrayReduce } from "../../helpers/array.mjs";
10
11
  import { mixin } from "../../helpers/object.mjs";
11
12
  import { toSingleLine } from "../../helpers/templateLiteralTag.mjs";
12
13
  import localHooks from "../../mixins/localHooks.mjs";
@@ -117,7 +118,7 @@ class ConditionCollection {
117
118
  let operation = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : OPERATION_AND;
118
119
  let position = arguments.length > 3 ? arguments[3] : undefined;
119
120
  const localeForColumn = this.hot.getCellMeta(0, column).locale;
120
- const args = arrayMap(conditionDefinition.args, v => typeof v === 'string' ? v.toLocaleLowerCase(localeForColumn) : v);
121
+ const args = conditionDefinition.args.map(v => typeof v === 'string' ? v.toLocaleLowerCase(localeForColumn) : v);
121
122
  const name = conditionDefinition.name || conditionDefinition.command.key;
122
123
 
123
124
  // If there's no previous condition stack defined (which means the condition stack was not cleared after the
@@ -211,7 +212,7 @@ class ConditionCollection {
211
212
  * @returns {Array}
212
213
  */
213
214
  exportAllConditions() {
214
- return arrayReduce(this.filteringStates.getEntries(), (allConditions, _ref2) => {
215
+ return this.filteringStates.getEntries().reduce((allConditions, _ref2) => {
215
216
  let [column, {
216
217
  operation,
217
218
  conditions
@@ -219,14 +220,14 @@ class ConditionCollection {
219
220
  allConditions.push({
220
221
  column,
221
222
  operation,
222
- conditions: arrayMap(conditions, _ref3 => {
223
+ conditions: conditions.map(_ref3 => {
223
224
  let {
224
225
  name,
225
226
  args
226
227
  } = _ref3;
227
228
  return {
228
229
  name,
229
- args
230
+ args: [...args]
230
231
  };
231
232
  })
232
233
  });
@@ -241,8 +242,8 @@ class ConditionCollection {
241
242
  */
242
243
  importAllConditions(conditions) {
243
244
  this.clean();
244
- arrayEach(conditions, stack => {
245
- arrayEach(stack.conditions, condition => this.addCondition(stack.column, condition));
245
+ conditions.forEach(stack => {
246
+ stack.conditions.forEach(condition => this.addCondition(stack.column, condition));
246
247
  });
247
248
  }
248
249
 
@@ -15,8 +15,10 @@ require("core-js/modules/es.set.is-subset-of.v2.js");
15
15
  require("core-js/modules/es.set.is-superset-of.v2.js");
16
16
  require("core-js/modules/es.set.symmetric-difference.v2.js");
17
17
  require("core-js/modules/es.set.union.v2.js");
18
+ require("core-js/modules/esnext.iterator.constructor.js");
19
+ require("core-js/modules/esnext.iterator.for-each.js");
20
+ require("core-js/modules/esnext.iterator.map.js");
18
21
  var _feature = require("../../helpers/feature");
19
- var _array = require("../../helpers/array");
20
22
  const sortCompare = (0, _feature.getComparisonFunction)();
21
23
 
22
24
  /**
@@ -47,8 +49,6 @@ function toVisualValue(value, defaultEmptyValue) {
47
49
  }
48
50
  return visualValue;
49
51
  }
50
- const SUPPORT_SET_CONSTRUCTOR = new Set([1]).has(1);
51
- const SUPPORT_FAST_DEDUPE = SUPPORT_SET_CONSTRUCTOR && typeof Array.from === 'function';
52
52
 
53
53
  /**
54
54
  * Create an array assertion to compare if an element exists in that array (in a more efficient way than .indexOf).
@@ -57,19 +57,9 @@ const SUPPORT_FAST_DEDUPE = SUPPORT_SET_CONSTRUCTOR && typeof Array.from === 'fu
57
57
  * @returns {Function}
58
58
  */
59
59
  function createArrayAssertion(initialData) {
60
- let dataset = initialData;
61
- if (SUPPORT_SET_CONSTRUCTOR) {
62
- dataset = new Set(dataset);
63
- }
60
+ const dataset = new Set(initialData);
64
61
  return function (value) {
65
- let result;
66
- if (SUPPORT_SET_CONSTRUCTOR) {
67
- result = dataset.has(value);
68
- } else {
69
- /* eslint-disable no-bitwise */
70
- result = !!~dataset.indexOf(value);
71
- }
72
- return result;
62
+ return dataset.has(value);
73
63
  };
74
64
  }
75
65
 
@@ -90,13 +80,7 @@ function toEmptyString(value) {
90
80
  * @returns {Array}
91
81
  */
92
82
  function unifyColumnValues(values) {
93
- let unifiedValues = values;
94
- if (SUPPORT_FAST_DEDUPE) {
95
- unifiedValues = Array.from(new Set(unifiedValues));
96
- } else {
97
- unifiedValues = (0, _array.arrayUnique)(unifiedValues);
98
- }
99
- unifiedValues = unifiedValues.sort((a, b) => {
83
+ return Array.from(new Set(values)).map(value => toEmptyString(value)).sort((a, b) => {
100
84
  if (typeof a === 'number' && typeof b === 'number') {
101
85
  return a - b;
102
86
  }
@@ -105,7 +89,6 @@ function unifyColumnValues(values) {
105
89
  }
106
90
  return a > b ? 1 : -1;
107
91
  });
108
- return unifiedValues;
109
92
  }
110
93
 
111
94
  /**
@@ -124,7 +107,7 @@ function intersectValues(base, selected, defaultEmptyValue, callback) {
124
107
  if (!same) {
125
108
  selectedItemsAssertion = createArrayAssertion(selected);
126
109
  }
127
- (0, _array.arrayEach)(base, value => {
110
+ base.forEach(value => {
128
111
  let checked = false;
129
112
  if (same || selectedItemsAssertion(value)) {
130
113
  checked = true;
@@ -6,8 +6,10 @@ import "core-js/modules/es.set.is-subset-of.v2.js";
6
6
  import "core-js/modules/es.set.is-superset-of.v2.js";
7
7
  import "core-js/modules/es.set.symmetric-difference.v2.js";
8
8
  import "core-js/modules/es.set.union.v2.js";
9
+ import "core-js/modules/esnext.iterator.constructor.js";
10
+ import "core-js/modules/esnext.iterator.for-each.js";
11
+ import "core-js/modules/esnext.iterator.map.js";
9
12
  import { getComparisonFunction } from "../../helpers/feature.mjs";
10
- import { arrayUnique, arrayEach } from "../../helpers/array.mjs";
11
13
  const sortCompare = getComparisonFunction();
12
14
 
13
15
  /**
@@ -38,8 +40,6 @@ export function toVisualValue(value, defaultEmptyValue) {
38
40
  }
39
41
  return visualValue;
40
42
  }
41
- const SUPPORT_SET_CONSTRUCTOR = new Set([1]).has(1);
42
- const SUPPORT_FAST_DEDUPE = SUPPORT_SET_CONSTRUCTOR && typeof Array.from === 'function';
43
43
 
44
44
  /**
45
45
  * Create an array assertion to compare if an element exists in that array (in a more efficient way than .indexOf).
@@ -48,19 +48,9 @@ const SUPPORT_FAST_DEDUPE = SUPPORT_SET_CONSTRUCTOR && typeof Array.from === 'fu
48
48
  * @returns {Function}
49
49
  */
50
50
  export function createArrayAssertion(initialData) {
51
- let dataset = initialData;
52
- if (SUPPORT_SET_CONSTRUCTOR) {
53
- dataset = new Set(dataset);
54
- }
51
+ const dataset = new Set(initialData);
55
52
  return function (value) {
56
- let result;
57
- if (SUPPORT_SET_CONSTRUCTOR) {
58
- result = dataset.has(value);
59
- } else {
60
- /* eslint-disable no-bitwise */
61
- result = !!~dataset.indexOf(value);
62
- }
63
- return result;
53
+ return dataset.has(value);
64
54
  };
65
55
  }
66
56
 
@@ -81,13 +71,7 @@ export function toEmptyString(value) {
81
71
  * @returns {Array}
82
72
  */
83
73
  export function unifyColumnValues(values) {
84
- let unifiedValues = values;
85
- if (SUPPORT_FAST_DEDUPE) {
86
- unifiedValues = Array.from(new Set(unifiedValues));
87
- } else {
88
- unifiedValues = arrayUnique(unifiedValues);
89
- }
90
- unifiedValues = unifiedValues.sort((a, b) => {
74
+ return Array.from(new Set(values)).map(value => toEmptyString(value)).sort((a, b) => {
91
75
  if (typeof a === 'number' && typeof b === 'number') {
92
76
  return a - b;
93
77
  }
@@ -96,7 +80,6 @@ export function unifyColumnValues(values) {
96
80
  }
97
81
  return a > b ? 1 : -1;
98
82
  });
99
- return unifiedValues;
100
83
  }
101
84
 
102
85
  /**
@@ -115,7 +98,7 @@ export function intersectValues(base, selected, defaultEmptyValue, callback) {
115
98
  if (!same) {
116
99
  selectedItemsAssertion = createArrayAssertion(selected);
117
100
  }
118
- arrayEach(base, value => {
101
+ base.forEach(value => {
119
102
  let checked = false;
120
103
  if (same || selectedItemsAssertion(value)) {
121
104
  checked = true;
@@ -2,6 +2,8 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
+ require("core-js/modules/esnext.iterator.constructor.js");
6
+ require("core-js/modules/esnext.iterator.every.js");
5
7
  var _object = require("../../../helpers/object");
6
8
  var _array = require("../../../helpers/array");
7
9
  function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
@@ -38,35 +40,20 @@ class AutofillCalculations {
38
40
  this.mergedCellsCollection = this.plugin.mergedCellsCollection;
39
41
  }
40
42
 
41
- /**
42
- * Correct the provided selection area, so it's not selecting only a part of a merged cell.
43
- *
44
- * @param {Array} selectionArea The selection to correct.
45
- */
46
- correctSelectionAreaSize(selectionArea) {
47
- if (selectionArea[0] === selectionArea[2] && selectionArea[1] === selectionArea[3]) {
48
- const mergedCell = this.mergedCellsCollection.get(selectionArea[0], selectionArea[1]);
49
- if (mergedCell) {
50
- selectionArea[2] = selectionArea[0] + mergedCell.rowspan - 1;
51
- selectionArea[3] = selectionArea[1] + mergedCell.colspan - 1;
52
- }
53
- }
54
- }
55
-
56
43
  /**
57
44
  * Get the direction of the autofill process.
58
45
  *
59
- * @param {Array} selectionArea The selection area.
60
- * @param {Array} finalArea The final area (base + drag).
46
+ * @param {Array} baseArea The selection area.
47
+ * @param {Array} fullArea The final area (base + drag).
61
48
  * @returns {string} `up`, `down`, `left` or `right`.
62
49
  */
63
- getDirection(selectionArea, finalArea) {
50
+ getDirection(baseArea, fullArea) {
64
51
  let direction = null;
65
- if (finalArea[0] === selectionArea[0] && finalArea[1] === selectionArea[1] && finalArea[3] === selectionArea[3]) {
52
+ if (fullArea[0] === baseArea[0] && fullArea[1] === baseArea[1] && fullArea[3] === baseArea[3]) {
66
53
  direction = 'down';
67
- } else if (finalArea[2] === selectionArea[2] && finalArea[1] === selectionArea[1] && finalArea[3] === selectionArea[3]) {
54
+ } else if (fullArea[2] === baseArea[2] && fullArea[1] === baseArea[1] && fullArea[3] === baseArea[3]) {
68
55
  direction = 'up';
69
- } else if (finalArea[1] === selectionArea[1] && finalArea[2] === selectionArea[2]) {
56
+ } else if (fullArea[1] === baseArea[1] && fullArea[2] === baseArea[2]) {
70
57
  direction = 'right';
71
58
  } else {
72
59
  direction = 'left';
@@ -78,20 +65,20 @@ class AutofillCalculations {
78
65
  * Snap the drag area to the farthest merged cell, so it won't clip any of the merged cells.
79
66
  *
80
67
  * @param {Array} baseArea The base selected area.
81
- * @param {Array} dragArea The drag area.
68
+ * @param {Array} fullArea The drag area.
82
69
  * @param {string} dragDirection The autofill drag direction.
83
70
  * @param {Array} foundMergedCells MergeCellCoords found in the base selection area.
84
71
  * @returns {Array} The new drag area.
85
72
  */
86
- snapDragArea(baseArea, dragArea, dragDirection, foundMergedCells) {
87
- const newDragArea = dragArea.slice(0);
88
- const fillSize = this.getAutofillSize(baseArea, dragArea, dragDirection);
73
+ snapDragArea(baseArea, fullArea, dragDirection, foundMergedCells) {
74
+ const newDragArea = fullArea.slice(0);
75
+ const fillSize = this.getAutofillSize(baseArea, fullArea, dragDirection);
89
76
  const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
90
77
  const verticalDirection = ['up', 'down'].indexOf(dragDirection) > -1;
91
78
  const fullCycle = verticalDirection ? baseAreaEndRow - baseAreaStartRow + 1 : baseAreaEndColumn - baseAreaStartColumn + 1;
92
79
  const fulls = Math.floor(fillSize / fullCycle) * fullCycle;
93
80
  const partials = fillSize - fulls;
94
- const farthestCollection = this.getFarthestCollection(baseArea, dragArea, dragDirection, foundMergedCells);
81
+ const farthestCollection = this.getFarthestCollection(baseArea, fullArea, dragDirection, foundMergedCells);
95
82
  if (farthestCollection) {
96
83
  if (dragDirection === 'down') {
97
84
  const fill = farthestCollection.row + farthestCollection.rowspan - baseAreaStartRow - partials;
@@ -156,13 +143,13 @@ class AutofillCalculations {
156
143
  *
157
144
  * @private
158
145
  * @param {Array} baseArea The base selection area.
159
- * @param {Array} dragArea The drag area (containing the base area).
146
+ * @param {Array} fullArea The drag area (containing the base area).
160
147
  * @param {string} direction The drag direction.
161
148
  * @returns {number|null} The "length" (height or width, depending on the direction) of the drag.
162
149
  */
163
- getAutofillSize(baseArea, dragArea, direction) {
150
+ getAutofillSize(baseArea, fullArea, direction) {
164
151
  const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
165
- const [dragAreaStartRow, dragAreaStartColumn, dragAreaEndRow, dragAreaEndColumn] = dragArea;
152
+ const [dragAreaStartRow, dragAreaStartColumn, dragAreaEndRow, dragAreaEndColumn] = fullArea;
166
153
  switch (direction) {
167
154
  case 'up':
168
155
  return baseAreaStartRow - dragAreaStartRow;
@@ -182,22 +169,30 @@ class AutofillCalculations {
182
169
  *
183
170
  * @private
184
171
  * @param {Array} baseArea The base selection area.
185
- * @param {Array} dragArea The base selection area extended by the drag area.
172
+ * @param {Array} fullArea The base selection area extended by the drag area.
186
173
  * @param {string} direction Drag direction.
187
174
  * @returns {Array|null} Array representing the drag area coordinates.
188
175
  */
189
- getDragArea(baseArea, dragArea, direction) {
176
+ getDragArea(baseArea, fullArea, direction) {
190
177
  const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
191
- const [dragAreaStartRow, dragAreaStartColumn, dragAreaEndRow, dragAreaEndColumn] = dragArea;
178
+ const [fullAreaStartRow, fullAreaStartColumn, fullAreaEndRow, fullAreaEndColumn] = fullArea;
192
179
  switch (direction) {
193
180
  case 'up':
194
- return [dragAreaStartRow, dragAreaStartColumn, baseAreaStartRow - 1, baseAreaEndColumn];
181
+ return [fullAreaStartRow, fullAreaStartColumn, baseAreaStartRow - 1, baseAreaEndColumn];
195
182
  case 'down':
196
- return [baseAreaEndRow + 1, baseAreaStartColumn, dragAreaEndRow, baseAreaEndColumn];
183
+ {
184
+ const mergedCell = this.mergedCellsCollection.get(fullAreaEndRow, baseAreaEndColumn);
185
+ const rowShift = mergedCell ? mergedCell.rowspan - 1 : 0;
186
+ return [baseAreaEndRow + 1, baseAreaStartColumn, fullAreaEndRow + rowShift, baseAreaEndColumn];
187
+ }
197
188
  case 'left':
198
- return [dragAreaStartRow, dragAreaStartColumn, baseAreaEndRow, baseAreaStartColumn - 1];
189
+ return [fullAreaStartRow, fullAreaStartColumn, baseAreaEndRow, baseAreaStartColumn - 1];
199
190
  case 'right':
200
- return [baseAreaStartRow, baseAreaEndColumn + 1, dragAreaEndRow, dragAreaEndColumn];
191
+ {
192
+ const mergedCell = this.mergedCellsCollection.get(fullAreaEndRow, baseAreaEndColumn);
193
+ const columnShift = mergedCell ? mergedCell.colspan - 1 : 0;
194
+ return [baseAreaStartRow, baseAreaEndColumn + columnShift, fullAreaEndRow, fullAreaEndColumn];
195
+ }
201
196
  default:
202
197
  return null;
203
198
  }
@@ -208,17 +203,17 @@ class AutofillCalculations {
208
203
  *
209
204
  * @private
210
205
  * @param {Array} baseArea The base selection area.
211
- * @param {Array} dragArea The drag area (containing the base area).
206
+ * @param {Array} fullArea The drag area (containing the base area).
212
207
  * @param {string} direction The drag direction.
213
208
  * @param {Array} mergedCellArray Array of the merged cells found in the base area.
214
209
  * @returns {MergedCellCoords|null}
215
210
  */
216
- getFarthestCollection(baseArea, dragArea, direction, mergedCellArray) {
211
+ getFarthestCollection(baseArea, fullArea, direction, mergedCellArray) {
217
212
  const [baseAreaStartRow, baseAreaStartColumn, baseAreaEndRow, baseAreaEndColumn] = baseArea;
218
213
  const verticalDirection = ['up', 'down'].indexOf(direction) > -1;
219
214
  const baseEnd = verticalDirection ? baseAreaEndRow : baseAreaEndColumn;
220
215
  const baseStart = verticalDirection ? baseAreaStartRow : baseAreaStartColumn;
221
- const fillSize = this.getAutofillSize(baseArea, dragArea, direction);
216
+ const fillSize = this.getAutofillSize(baseArea, fullArea, direction);
222
217
  const fullCycle = verticalDirection ? baseAreaEndRow - baseAreaStartRow + 1 : baseAreaEndColumn - baseAreaStartColumn + 1;
223
218
  const fulls = Math.floor(fillSize / fullCycle) * fullCycle;
224
219
  const partials = fillSize - fulls;
@@ -293,7 +288,7 @@ class AutofillCalculations {
293
288
  rowspan: current.rowspan,
294
289
  col: current.col,
295
290
  colspan: current.colspan
296
- });
291
+ }, true);
297
292
  break;
298
293
  case 'down':
299
294
  this.plugin.mergedCellsCollection.add({
@@ -301,7 +296,7 @@ class AutofillCalculations {
301
296
  rowspan: current.rowspan,
302
297
  col: current.col,
303
298
  colspan: current.colspan
304
- });
299
+ }, true);
305
300
  break;
306
301
  case 'left':
307
302
  this.plugin.mergedCellsCollection.add({
@@ -309,7 +304,7 @@ class AutofillCalculations {
309
304
  rowspan: current.rowspan,
310
305
  col: current.col - fillOffset,
311
306
  colspan: current.colspan
312
- });
307
+ }, true);
313
308
  break;
314
309
  case 'right':
315
310
  this.plugin.mergedCellsCollection.add({
@@ -317,7 +312,7 @@ class AutofillCalculations {
317
312
  rowspan: current.rowspan,
318
313
  col: current.col + fillOffset,
319
314
  colspan: current.colspan
320
- });
315
+ }, true);
321
316
  break;
322
317
  default:
323
318
  }
@@ -392,7 +387,28 @@ class AutofillCalculations {
392
387
  const topLeft = this.plugin.hot._createCellCoords(dragAreaStartRow, dragAreaStartColumn);
393
388
  const bottomRight = this.plugin.hot._createCellCoords(dragAreaEndRow, dragAreaEndColumn);
394
389
  const dragRange = this.plugin.hot._createCellRange(topLeft, topLeft, bottomRight);
395
- return this.mergedCellsCollection.getWithinRange(dragRange, true).length > 0;
390
+ const mergedCellsWithPartials = this.mergedCellsCollection.getWithinRange(dragRange, true);
391
+ if (mergedCellsWithPartials.length === 0) {
392
+ return false;
393
+ }
394
+ const mergedCellsWithoutPartials = this.mergedCellsCollection.getWithinRange(dragRange, false);
395
+ if (mergedCellsWithoutPartials.length === 0) {
396
+ return true;
397
+ }
398
+ if (direction === 'up' || direction === 'down') {
399
+ return !mergedCellsWithoutPartials.every(_ref => {
400
+ let {
401
+ colspan
402
+ } = _ref;
403
+ return colspan === dragRange.getWidth();
404
+ });
405
+ }
406
+ return !mergedCellsWithoutPartials.every(_ref2 => {
407
+ let {
408
+ rowspan
409
+ } = _ref2;
410
+ return rowspan === dragRange.getHeight();
411
+ });
396
412
  }
397
413
  }
398
414
  var _default = exports.default = AutofillCalculations;