handsontable 0.34.1 → 0.34.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (95) hide show
  1. package/.travis.yml +2 -0
  2. package/README.md +127 -96
  3. package/commonjs/core.js +11 -6
  4. package/commonjs/helpers/dom/element.js +4 -3
  5. package/commonjs/helpers/mixed.js +8 -4
  6. package/commonjs/index.js +5 -4
  7. package/commonjs/pluginHooks.js +18 -2
  8. package/commonjs/plugins/copyPaste/clipboardData.js +31 -0
  9. package/commonjs/plugins/copyPaste/contextMenuItem/copy.js +1 -2
  10. package/commonjs/plugins/copyPaste/contextMenuItem/cut.js +1 -2
  11. package/commonjs/plugins/copyPaste/copyPaste.js +127 -134
  12. package/commonjs/plugins/copyPaste/pasteEvent.js +19 -0
  13. package/commonjs/plugins/copyPaste/test/copyPaste.e2e.js +90 -189
  14. package/commonjs/plugins/copyPaste/test/textarea.unit.js +2 -2
  15. package/commonjs/plugins/copyPaste/textarea.js +2 -1
  16. package/commonjs/plugins/manualColumnMove/manualColumnMove.js +8 -11
  17. package/commonjs/plugins/manualColumnMove/test/manualColumnMoveUI.e2e.js +35 -0
  18. package/commonjs/plugins/manualRowMove/manualRowMove.js +9 -12
  19. package/commonjs/plugins/manualRowMove/test/manualRowMove.e2e.js +256 -60
  20. package/commonjs/plugins/manualRowMove/test/manualRowMoveUI.e2e.js +40 -182
  21. package/commonjs/plugins/manualRowMove/ui/_base.js +2 -2
  22. package/commonjs/tableView.js +1 -0
  23. package/dist/handsontable.css +6 -5
  24. package/dist/handsontable.css.map +1 -1
  25. package/dist/handsontable.full.css +6 -5
  26. package/dist/handsontable.full.js +37721 -42290
  27. package/dist/handsontable.full.min.css +4 -4
  28. package/dist/handsontable.full.min.js +5 -5
  29. package/dist/handsontable.js +28732 -28433
  30. package/dist/handsontable.js.map +1 -1
  31. package/dist/handsontable.min.css +4 -4
  32. package/dist/handsontable.min.js +3 -3
  33. package/es/core.js +11 -6
  34. package/es/helpers/dom/element.js +4 -3
  35. package/es/helpers/mixed.js +4 -4
  36. package/es/index.js +3 -4
  37. package/es/pluginHooks.js +18 -2
  38. package/es/plugins/copyPaste/clipboardData.js +27 -0
  39. package/es/plugins/copyPaste/contextMenuItem/copy.js +1 -2
  40. package/es/plugins/copyPaste/contextMenuItem/cut.js +1 -2
  41. package/es/plugins/copyPaste/copyPaste.js +124 -132
  42. package/es/plugins/copyPaste/pasteEvent.js +11 -0
  43. package/es/plugins/copyPaste/test/copyPaste.e2e.js +90 -189
  44. package/es/plugins/copyPaste/test/textarea.unit.js +2 -2
  45. package/es/plugins/copyPaste/textarea.js +2 -1
  46. package/es/plugins/manualColumnMove/manualColumnMove.js +8 -11
  47. package/es/plugins/manualColumnMove/test/manualColumnMoveUI.e2e.js +35 -0
  48. package/es/plugins/manualRowMove/manualRowMove.js +9 -12
  49. package/es/plugins/manualRowMove/test/manualRowMove.e2e.js +256 -60
  50. package/es/plugins/manualRowMove/test/manualRowMoveUI.e2e.js +40 -182
  51. package/es/plugins/manualRowMove/ui/_base.js +2 -2
  52. package/es/tableView.js +1 -0
  53. package/handsontable.jquery.json +1 -1
  54. package/hot.config.js +1 -1
  55. package/package.json +5 -5
  56. package/src/3rdparty/walkontable/dist/walkontable.js +27234 -11175
  57. package/src/3rdparty/walkontable/dist/walkontable.js.map +1 -1
  58. package/src/3rdparty/walkontable/test/dist/helpers.entry.js +32 -36
  59. package/src/3rdparty/walkontable/test/dist/helpers.entry.js.map +1 -1
  60. package/src/3rdparty/walkontable/test/dist/specs.entry.js +36 -39
  61. package/src/3rdparty/walkontable/test/dist/specs.entry.js.map +1 -1
  62. package/src/core.js +11 -6
  63. package/src/css/handsontable.css +1 -2
  64. package/src/helpers/dom/element.js +4 -3
  65. package/src/helpers/mixed.js +3 -3
  66. package/src/index.js +1 -2
  67. package/src/pluginHooks.js +18 -2
  68. package/src/plugins/copyPaste/clipboardData.js +11 -0
  69. package/src/plugins/copyPaste/contextMenuItem/copy.js +1 -2
  70. package/src/plugins/copyPaste/contextMenuItem/cut.js +1 -2
  71. package/src/plugins/copyPaste/copyPaste.css +3 -1
  72. package/src/plugins/copyPaste/copyPaste.js +120 -127
  73. package/src/plugins/copyPaste/pasteEvent.js +7 -0
  74. package/src/plugins/copyPaste/test/copyPaste.e2e.js +75 -193
  75. package/src/plugins/copyPaste/test/textarea.unit.js +2 -2
  76. package/src/plugins/copyPaste/textarea.js +2 -1
  77. package/src/plugins/manualColumnMove/manualColumnMove.js +6 -9
  78. package/src/plugins/manualColumnMove/test/manualColumnMoveUI.e2e.js +35 -0
  79. package/src/plugins/manualRowMove/manualRowMove.js +7 -10
  80. package/src/plugins/manualRowMove/test/manualRowMove.e2e.js +282 -86
  81. package/src/plugins/manualRowMove/test/manualRowMoveUI.e2e.js +51 -190
  82. package/src/plugins/manualRowMove/ui/_base.js +2 -2
  83. package/test/dist/e2e.entry.js +31381 -31131
  84. package/test/dist/e2e.entry.js.map +1 -1
  85. package/test/dist/helpers.entry.js +16 -19
  86. package/test/dist/helpers.entry.js.map +1 -1
  87. package/test/e2e/Core_listen.spec.js +32 -0
  88. package/test/e2e/Core_selection.spec.js +1 -1
  89. package/test/e2e/Core_validate.spec.js +29 -0
  90. package/test/e2e/renderers/checkboxRenderer.spec.js +20 -7
  91. package/test/e2e/settings/fragmentSelection.spec.js +12 -9
  92. package/test/scripts/trigger-pro-tests.sh +41 -0
  93. package/yarn.lock +260 -208
  94. package/.npmignore +0 -19
  95. package/demo/bower_components/numbro/package.json +0 -63
@@ -1,5 +1,9 @@
1
+ var _createClass = function () { 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, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
2
+
1
3
  function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; }
2
4
 
5
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
6
+
3
7
  describe('CopyPaste', function () {
4
8
  var id = 'testContainer';
5
9
 
@@ -14,6 +18,37 @@ describe('CopyPaste', function () {
14
18
  }
15
19
  });
16
20
 
21
+ var DataTransferObject = function () {
22
+ function DataTransferObject() {
23
+ _classCallCheck(this, DataTransferObject);
24
+
25
+ this.data = '';
26
+ }
27
+
28
+ _createClass(DataTransferObject, [{
29
+ key: 'getData',
30
+ value: function getData() {
31
+ return this.data;
32
+ }
33
+ }, {
34
+ key: 'setData',
35
+ value: function setData(type, value) {
36
+ this.data = value;
37
+ }
38
+ }]);
39
+
40
+ return DataTransferObject;
41
+ }();
42
+
43
+ ;
44
+
45
+ function getClipboardEvent() {
46
+ var event = {};
47
+ event.clipboardData = new DataTransferObject();
48
+ event.preventDefault = function () {};
49
+ return event;
50
+ }
51
+
17
52
  var arrayOfArrays = function arrayOfArrays() {
18
53
  return [['', 'Kia', 'Nissan', 'Toyota', 'Honda'], ['2008', 10, 11, 12, 13], ['2009', 20, 11, 14, 13], ['2010', 30, 15, 12, 13]];
19
54
  };
@@ -78,67 +113,7 @@ describe('CopyPaste', function () {
78
113
  });
79
114
  });
80
115
 
81
- describe('setting values copyable', function () {
82
- it('should set copyable text when selecting a single cell and hitting ctrl', function () {
83
- handsontable({
84
- data: Handsontable.helper.createSpreadsheetData(2, 2)
85
- });
86
-
87
- var copyPasteTextarea = $('#HandsontableCopyPaste')[0];
88
-
89
- expect(copyPasteTextarea.value.length).toEqual(0);
90
-
91
- selectCell(0, 0);
92
- keyDownUp(Handsontable.helper.KEY_CODES.CONTROL_LEFT);
93
-
94
- expect(copyPasteTextarea.value).toEqual('A1');
95
- });
96
-
97
- it('should set copyable text when selecting a single cell and hitting left command', function () {
98
- handsontable({
99
- data: Handsontable.helper.createSpreadsheetData(2, 2)
100
- });
101
-
102
- var copyPasteTextarea = $('#HandsontableCopyPaste')[0];
103
-
104
- expect(copyPasteTextarea.value.length).toEqual(0);
105
-
106
- selectCell(0, 0);
107
- keyDownUp(Handsontable.helper.KEY_CODES.COMMAND_LEFT);
108
-
109
- expect(copyPasteTextarea.value).toEqual('A1');
110
- });
111
-
112
- it('should set copyable text when selecting a single cell and hitting right command', function () {
113
- handsontable({
114
- data: Handsontable.helper.createSpreadsheetData(2, 2)
115
- });
116
-
117
- var copyPasteTextarea = $('#HandsontableCopyPaste')[0];
118
-
119
- expect(copyPasteTextarea.value.length).toEqual(0);
120
-
121
- selectCell(0, 0);
122
- keyDownUp(Handsontable.helper.KEY_CODES.COMMAND_RIGHT);
123
-
124
- expect(copyPasteTextarea.value).toEqual('A1');
125
- });
126
-
127
- it('should set copyable text when selecting multiple cells and hitting ctrl', function () {
128
- handsontable({
129
- data: Handsontable.helper.createSpreadsheetData(2, 2)
130
- });
131
-
132
- var copyPasteTextarea = $('#HandsontableCopyPaste')[0];
133
-
134
- expect(copyPasteTextarea.value.length).toEqual(0);
135
-
136
- selectCell(0, 0, 1, 0);
137
- keyDownUp(Handsontable.helper.KEY_CODES.CONTROL_LEFT);
138
-
139
- expect(copyPasteTextarea.value).toEqual('A1\nA2');
140
- });
141
-
116
+ xdescribe('setting values copyable', function () {
142
117
  it('should set copyable text when selecting all cells with CTRL+A', function (done) {
143
118
  handsontable({
144
119
  data: Handsontable.helper.createSpreadsheetData(2, 2)
@@ -159,24 +134,6 @@ describe('CopyPaste', function () {
159
134
  }, 10);
160
135
  });
161
136
 
162
- it('should not throw error when no cell is selected (#1221)', function () {
163
- handsontable({
164
- data: Handsontable.helper.createSpreadsheetData(2, 2)
165
- });
166
-
167
- selectCell(0, 0);
168
- deselectCell();
169
-
170
- function keydownCtrl() {
171
- $(document).simulate('keydown', {
172
- keyCode: Handsontable.helper.KEY_CODES.COMMAND_LEFT
173
- });
174
- }
175
-
176
- // expect no to throw any exception
177
- expect(keydownCtrl).not.toThrow();
178
- });
179
-
180
137
  it('should not throw error when no cell is selected and contextmenu options was clicked', function () {
181
138
  // This is ugly trick to check problematic thing (#4390).
182
139
  // Unfortunately we cannot open the context menu, when event.target is not an TD element.
@@ -207,22 +164,6 @@ describe('CopyPaste', function () {
207
164
  expect(copyPasteTextarea.value).toEqual('A\t1\nB\t2');
208
165
  });
209
166
 
210
- it('should set copyable text when selecting a single cell with editor type as false (#2574)', function () {
211
- handsontable({
212
- data: [['A', 1], ['B', 2]],
213
- columns: [{ type: 'text' }, { editor: false }]
214
- });
215
-
216
- var copyPasteTextarea = $('#HandsontableCopyPaste')[0];
217
-
218
- expect(copyPasteTextarea.value.length).toEqual(0);
219
-
220
- selectCell(1, 1, 1, 1);
221
- keyDownUp(Handsontable.helper.KEY_CODES.CONTROL_LEFT);
222
-
223
- expect(copyPasteTextarea.value).toEqual('2');
224
- });
225
-
226
167
  it('should set copyable text until copyRowsLimit is reached', function () {
227
168
  handsontable({
228
169
  data: arrayOfArrays(),
@@ -274,67 +215,46 @@ describe('CopyPaste', function () {
274
215
  });
275
216
 
276
217
  describe('copy', function () {
277
- it('should be possible to copy data by keyboard shortcut', function () {
278
- handsontable({
279
- data: Handsontable.helper.createSpreadsheetData(2, 2)
280
- });
281
-
282
- selectCell(1, 1);
283
- keyDown('ctrl');
284
- keyDown('ctrl+c');
218
+ xit('should be possible to copy data by keyboard shortcut', function () {
219
+ // simulated keyboard shortcuts doesn't run the true events
220
+ });
285
221
 
286
- expect($('#HandsontableCopyPaste')[0]).toBe(document.activeElement);
287
- // unfortunately we have not access to read data from the system clipboard
222
+ xit('should be possible to copy data by contextMenu option', function () {
223
+ // simulated mouse events doesn't run the true browser event
288
224
  });
289
225
 
290
226
  it('should be possible to copy data by API', function () {
291
227
  var hot = handsontable({
292
228
  data: Handsontable.helper.createSpreadsheetData(2, 2)
293
229
  });
230
+ var copyEvent = getClipboardEvent('copy');
231
+ var plugin = hot.getPlugin('CopyPaste');
294
232
 
295
233
  selectCell(1, 0);
296
234
 
297
- hot.getPlugin('CopyPaste').setCopyableText();
298
- // below line is cause of console warning in FF about execCommand
299
- hot.getPlugin('CopyPaste').copy(true);
300
-
301
- expect($('#HandsontableCopyPaste')[0]).toBe(document.activeElement);
302
- // unfortunately we have not access to read data from the system clipboard
303
- });
304
-
305
- it('should be possible to copy data by contextMenu option', function () {
306
- var beforeCopySpy = jasmine.createSpy('beforeCopy');
307
-
308
- handsontable({
309
- data: Handsontable.helper.createSpreadsheetData(2, 2),
310
- beforeCopy: beforeCopySpy,
311
- contextMenu: ['copy']
312
- });
313
-
314
- selectCell(0, 1);
315
- contextMenu();
316
-
317
- var items = $('.htContextMenu tbody td');
318
- var actions = items.not('.htSeparator');
319
-
320
- actions.simulate('mousedown');
235
+ plugin.setCopyableText();
236
+ plugin.onCopy(copyEvent);
321
237
 
322
- expect(beforeCopySpy).toHaveBeenCalledTimes(1);
238
+ expect(copyEvent.clipboardData.getData()).toBe('A2');
323
239
  });
324
240
 
325
241
  it('should call beforeCopy and afterCopy during copying operation', function () {
326
242
  var beforeCopySpy = jasmine.createSpy('beforeCopy');
327
243
  var afterCopySpy = jasmine.createSpy('afterCopy');
328
244
 
329
- handsontable({
245
+ var hot = handsontable({
330
246
  data: Handsontable.helper.createSpreadsheetData(2, 2),
331
247
  beforeCopy: beforeCopySpy,
332
248
  afterCopy: afterCopySpy
333
249
  });
334
250
 
251
+ var copyEvent = getClipboardEvent('copy');
252
+ var plugin = hot.getPlugin('CopyPaste');
253
+
335
254
  selectCell(0, 0);
336
- keyDown('ctrl');
337
- keyDown('ctrl+c');
255
+
256
+ plugin.setCopyableText();
257
+ plugin.onCopy(copyEvent);
338
258
 
339
259
  expect(beforeCopySpy.calls.count()).toEqual(1);
340
260
  expect(beforeCopySpy).toHaveBeenCalledWith([['A1']], [{ startRow: 0, startCol: 0, endRow: 0, endCol: 0 }], void 0, void 0, void 0, void 0);
@@ -343,112 +263,93 @@ describe('CopyPaste', function () {
343
263
  });
344
264
 
345
265
  it('should be possible to block copying', function () {
266
+ var beforeCopySpy = jasmine.createSpy('beforeCopy');
346
267
  var afterCopySpy = jasmine.createSpy('afterCopy');
347
268
 
348
- handsontable({
269
+ var hot = handsontable({
349
270
  data: Handsontable.helper.createSpreadsheetData(2, 2),
350
271
  beforeCopy: function beforeCopy() {
272
+ beforeCopySpy();
351
273
  return false;
352
274
  },
353
275
 
354
276
  afterCopy: afterCopySpy
355
277
  });
356
278
 
279
+ var copyEvent = getClipboardEvent('copy');
280
+ var plugin = hot.getPlugin('CopyPaste');
281
+
357
282
  selectCell(0, 0);
358
- keyDown('ctrl');
359
- keyDown('ctrl+c');
360
283
 
284
+ plugin.setCopyableText();
285
+ plugin.onCopy(copyEvent);
286
+
287
+ expect(beforeCopySpy.calls.count()).toEqual(1);
361
288
  expect(afterCopySpy.calls.count()).toEqual(0);
362
289
  });
363
290
 
364
- it('should be possible modification of changes during copying', _asyncToGenerator(function* () {
365
- handsontable({
291
+ it('should be possible modification of changes during copying', function () {
292
+ var hot = handsontable({
366
293
  data: Handsontable.helper.createSpreadsheetData(2, 2),
367
294
  beforeCopy: function beforeCopy(changes) {
368
295
  changes.splice(0, 1);
369
296
  }
370
297
  });
371
298
 
299
+ var copyEvent = getClipboardEvent('copy');
300
+ var plugin = hot.getPlugin('CopyPaste');
372
301
  selectCell(0, 0, 1, 0);
373
- keyDown('ctrl');
374
- keyDown('ctrl+c');
375
302
 
376
- yield sleep(60);
303
+ plugin.setCopyableText();
304
+ plugin.onCopy(copyEvent);
377
305
 
378
- expect($('#HandsontableCopyPaste')[0].value).toEqual('A2');
379
- }));
306
+ expect(copyEvent.clipboardData.getData()).toEqual('A2');
307
+ });
380
308
  });
381
309
 
382
310
  describe('cut', function () {
383
- it('should be possible to cut data by keyboard shortcut', _asyncToGenerator(function* () {
384
- var hot = handsontable({
385
- data: Handsontable.helper.createSpreadsheetData(2, 2)
386
- });
387
-
388
- selectCell(1, 1);
389
- keyDown('ctrl');
390
- keyDown('ctrl+x');
391
-
392
- expect($('#HandsontableCopyPaste')[0]).toBe(document.activeElement);
393
-
394
- yield sleep(100);
311
+ xit('should be possible to cut data by keyboard shortcut', function () {
312
+ // simulated keyboard shortcuts doesn't run the true events
313
+ });
395
314
 
396
- expect(hot.getDataAtCell(1, 1)).toBe('');
397
- // unfortunately we have not access to read data from the system clipboard
398
- }));
315
+ xit('should be possible to cut data by contextMenu option', function () {
316
+ // simulated mouse events doesn't run the true browser event
317
+ });
399
318
 
400
- it('should be possible to cut data by API', _asyncToGenerator(function* () {
319
+ it('should be possible to cut data by API', function () {
401
320
  var hot = handsontable({
402
321
  data: Handsontable.helper.createSpreadsheetData(2, 2)
403
322
  });
323
+ var cutEvent = getClipboardEvent('cut');
324
+ var plugin = hot.getPlugin('CopyPaste');
404
325
 
405
326
  selectCell(1, 0);
406
327
 
407
- hot.getPlugin('CopyPaste').setCopyableText();
408
- // below line is cause of console warning in FF about execCommand
409
- hot.getPlugin('CopyPaste').cut(true);
328
+ plugin.setCopyableText();
329
+ plugin.onCut(cutEvent);
410
330
 
411
- expect($('#HandsontableCopyPaste')[0]).toBe(document.activeElement);
412
-
413
- yield sleep(100);
331
+ expect(cutEvent.clipboardData.getData()).toBe('A2');
414
332
 
333
+ // await sleep(100);
415
334
  expect(hot.getDataAtCell(1, 0)).toBe('');
416
- // unfortunately we have not access to read data from the system clipboard
417
- }));
418
-
419
- it('should be possible to cut data by contextMenu option', function () {
420
- var beforeCutSpy = jasmine.createSpy('beforeCopy');
421
-
422
- handsontable({
423
- data: Handsontable.helper.createSpreadsheetData(2, 2),
424
- beforeCut: beforeCutSpy,
425
- contextMenu: ['cut']
426
- });
427
-
428
- selectCell(0, 1);
429
- contextMenu();
430
-
431
- var items = $('.htContextMenu tbody td');
432
- var actions = items.not('.htSeparator');
433
-
434
- actions.simulate('mousedown');
435
-
436
- expect(beforeCutSpy).toHaveBeenCalledTimes(1);
437
335
  });
438
336
 
439
337
  it('should call beforeCut and afterCut during cutting out operation', function () {
440
338
  var beforeCutSpy = jasmine.createSpy('beforeCut');
441
339
  var afterCutSpy = jasmine.createSpy('afterCut');
442
340
 
443
- handsontable({
341
+ var hot = handsontable({
444
342
  data: Handsontable.helper.createSpreadsheetData(2, 2),
445
343
  beforeCut: beforeCutSpy,
446
344
  afterCut: afterCutSpy
447
345
  });
346
+ var cutEvent = getClipboardEvent('cut');
347
+ var plugin = hot.getPlugin('CopyPaste');
448
348
 
449
349
  selectCell(0, 0);
450
- keyDown('ctrl');
451
- keyDown('ctrl+x');
350
+
351
+ plugin.setCopyableText();
352
+ plugin.onCut(cutEvent);
452
353
 
453
354
  expect(beforeCutSpy.calls.count()).toEqual(1);
454
355
  expect(beforeCutSpy).toHaveBeenCalledWith([['A1']], [{ startRow: 0, startCol: 0, endRow: 0, endCol: 0 }], void 0, void 0, void 0, void 0);
@@ -56,7 +56,7 @@ describe('CopyPaste', function () {
56
56
  var textarea = Textarea.getSingleton();
57
57
  var newValue = 'zxcvb';
58
58
 
59
- expect(textarea.element.value.length).toBe(0);
59
+ expect(textarea.element.value.length).toBe(1);
60
60
 
61
61
  textarea.setValue(newValue);
62
62
 
@@ -69,7 +69,7 @@ describe('CopyPaste', function () {
69
69
  var textarea = Textarea.getSingleton();
70
70
  var newValue = 'zxcvb';
71
71
 
72
- expect(textarea.getValue().length).toBe(0);
72
+ expect(textarea.getValue().length).toBe(1);
73
73
 
74
74
  textarea.setValue(newValue);
75
75
 
@@ -74,7 +74,8 @@ var Textarea = function () {
74
74
  this.element.className = 'copyPaste';
75
75
  this.element.tabIndex = -1;
76
76
  this.element.autocomplete = 'off';
77
- this.element.wrap = 'off';
77
+ this.element.wrap = 'hard';
78
+ this.element.value = ' ';
78
79
  }
79
80
 
80
81
  /**
@@ -149,14 +149,14 @@ var ManualColumnMove = function (_BasePlugin) {
149
149
  this.addHook('beforeRemoveCol', function (index, amount) {
150
150
  return _this2.onBeforeRemoveCol(index, amount);
151
151
  });
152
- this.addHook('afterRemoveCol', function (index, amount) {
153
- return _this2.onAfterRemoveCol(index, amount);
152
+ this.addHook('afterRemoveCol', function () {
153
+ return _this2.onAfterRemoveCol();
154
154
  });
155
155
  this.addHook('afterCreateCol', function (index, amount) {
156
156
  return _this2.onAfterCreateCol(index, amount);
157
157
  });
158
- this.addHook('afterLoadData', function (firstTime) {
159
- return _this2.onAfterLoadData(firstTime);
158
+ this.addHook('afterLoadData', function () {
159
+ return _this2.onAfterLoadData();
160
160
  });
161
161
  this.addHook('unmodifyCol', function (column) {
162
162
  return _this2.onUnmodifyCol(column);
@@ -296,7 +296,7 @@ var ManualColumnMove = function (_BasePlugin) {
296
296
  var columnWidth = 0;
297
297
 
298
298
  if (i < 0) {
299
- columnWidth = this.hot.view.wt.wtTable.getColumnWidth(i) || 0;
299
+ columnWidth = this.hot.view.wt.wtViewport.getRowHeaderWidth() || 0;
300
300
  } else {
301
301
  columnWidth = this.hot.view.wt.wtTable.getStretchedColumnWidth(i) || 0;
302
302
  }
@@ -502,7 +502,7 @@ var ManualColumnMove = function (_BasePlugin) {
502
502
  var maxIndex = countCols - 1;
503
503
  var columnsToRemove = [];
504
504
 
505
- arrayEach(this.columnsMapper._arrayMap, function (value, index, array) {
505
+ arrayEach(this.columnsMapper._arrayMap, function (value, index) {
506
506
  if (value > maxIndex) {
507
507
  columnsToRemove.push(index);
508
508
  }
@@ -777,13 +777,11 @@ var ManualColumnMove = function (_BasePlugin) {
777
777
  * `afterRemoveCol` hook callback.
778
778
  *
779
779
  * @private
780
- * @param {Number} index Visual column index of the removed column.
781
- * @param {Number} amount Amount of removed columns.
782
780
  */
783
781
 
784
782
  }, {
785
783
  key: 'onAfterRemoveCol',
786
- value: function onAfterRemoveCol(index, amount) {
784
+ value: function onAfterRemoveCol() {
787
785
  this.columnsMapper.unshiftItems(this.removedColumns);
788
786
  }
789
787
 
@@ -791,12 +789,11 @@ var ManualColumnMove = function (_BasePlugin) {
791
789
  * `afterLoadData` hook callback.
792
790
  *
793
791
  * @private
794
- * @param {Boolean} firstTime True if that was loading data during the initialization.
795
792
  */
796
793
 
797
794
  }, {
798
795
  key: 'onAfterLoadData',
799
- value: function onAfterLoadData(firstTime) {
796
+ value: function onAfterLoadData() {
800
797
  this.updateColumnsMapper();
801
798
  }
802
799
 
@@ -102,6 +102,41 @@ describe('manualColumnMove', function () {
102
102
  expect(this.$container.find('.ht__manualColumnMove--backlight')[0].offsetWidth).toBe($headerTH[0].offsetWidth);
103
103
  });
104
104
 
105
+ it('should set proper left position of the backlight element when colWidths is undefined', function () {
106
+ handsontable({
107
+ data: Handsontable.helper.createSpreadsheetData(10, 10),
108
+ manualColumnMove: true,
109
+ rowHeaders: true,
110
+ colHeaders: true
111
+ });
112
+
113
+ var header = spec().$container.find('thead tr:eq(0) th:eq(2)');
114
+
115
+ header.simulate('mousedown');
116
+ header.simulate('mouseup');
117
+ header.simulate('mousedown');
118
+
119
+ expect(spec().$container.find('.ht__manualColumnMove--backlight')[0].offsetLeft).toBe(100);
120
+ });
121
+
122
+ it('should set proper left position of the backlight element when colWidths is defined', function () {
123
+ handsontable({
124
+ data: Handsontable.helper.createSpreadsheetData(10, 10),
125
+ manualColumnMove: true,
126
+ rowHeaders: true,
127
+ colWidths: 100,
128
+ colHeaders: true
129
+ });
130
+
131
+ var header = spec().$container.find('thead tr:eq(0) th:eq(2)');
132
+
133
+ header.simulate('mousedown');
134
+ header.simulate('mouseup');
135
+ header.simulate('mousedown');
136
+
137
+ expect(spec().$container.find('.ht__manualColumnMove--backlight')[0].offsetLeft).toBe(150);
138
+ });
139
+
105
140
  it('should not run moving ui if mousedown was fired on sorting element', function () {
106
141
  var hot = handsontable({
107
142
  data: arrayOfArrays.slice(),
@@ -147,14 +147,14 @@ var ManualRowMove = function (_BasePlugin) {
147
147
  this.addHook('beforeRemoveRow', function (index, amount) {
148
148
  return _this2.onBeforeRemoveRow(index, amount);
149
149
  });
150
- this.addHook('afterRemoveRow', function (index, amount) {
151
- return _this2.onAfterRemoveRow(index, amount);
150
+ this.addHook('afterRemoveRow', function () {
151
+ return _this2.onAfterRemoveRow();
152
152
  });
153
153
  this.addHook('afterCreateRow', function (index, amount) {
154
154
  return _this2.onAfterCreateRow(index, amount);
155
155
  });
156
- this.addHook('afterLoadData', function (firstTime) {
157
- return _this2.onAfterLoadData(firstTime);
156
+ this.addHook('afterLoadData', function () {
157
+ return _this2.onAfterLoadData();
158
158
  });
159
159
  this.addHook('beforeColumnSort', function (column, order) {
160
160
  return _this2.onBeforeColumnSort(column, order);
@@ -517,7 +517,7 @@ var ManualRowMove = function (_BasePlugin) {
517
517
  var maxIndex = countRows - 1;
518
518
  var rowsToRemove = [];
519
519
 
520
- arrayEach(this.rowsMapper._arrayMap, function (value, index, array) {
520
+ arrayEach(this.rowsMapper._arrayMap, function (value, index) {
521
521
  if (value > maxIndex) {
522
522
  rowsToRemove.push(index);
523
523
  }
@@ -621,7 +621,7 @@ var ManualRowMove = function (_BasePlugin) {
621
621
  priv.target.TD = TD;
622
622
  priv.rowsToMove = this.prepareRowsToMoving();
623
623
 
624
- var leftPos = wtTable.holder.scrollLeft + wtTable.getColumnWidth(-1);
624
+ var leftPos = wtTable.holder.scrollLeft + this.hot.view.wt.wtViewport.getRowHeaderWidth();
625
625
 
626
626
  this.backlight.setPosition(null, leftPos);
627
627
  this.backlight.setSize(wtTable.hider.offsetWidth - leftPos, this.getRowsHeight(start, end + 1));
@@ -750,7 +750,7 @@ var ManualRowMove = function (_BasePlugin) {
750
750
  key: 'onAfterScrollHorizontally',
751
751
  value: function onAfterScrollHorizontally() {
752
752
  var wtTable = this.hot.view.wt.wtTable;
753
- var headerWidth = wtTable.getColumnWidth(-1);
753
+ var headerWidth = this.hot.view.wt.wtViewport.getRowHeaderWidth();
754
754
  var scrollLeft = wtTable.holder.scrollLeft;
755
755
  var posLeft = headerWidth + scrollLeft;
756
756
 
@@ -799,13 +799,11 @@ var ManualRowMove = function (_BasePlugin) {
799
799
  * `afterRemoveRow` hook callback.
800
800
  *
801
801
  * @private
802
- * @param {Number} index Visual index of the removed row.
803
- * @param {Number} amount Amount of removed rows.
804
802
  */
805
803
 
806
804
  }, {
807
805
  key: 'onAfterRemoveRow',
808
- value: function onAfterRemoveRow(index, amount) {
806
+ value: function onAfterRemoveRow() {
809
807
  this.rowsMapper.unshiftItems(this.removedRows);
810
808
  }
811
809
 
@@ -813,12 +811,11 @@ var ManualRowMove = function (_BasePlugin) {
813
811
  * `afterLoadData` hook callback.
814
812
  *
815
813
  * @private
816
- * @param {Boolean} firstTime True if that was loading data during the initialization.
817
814
  */
818
815
 
819
816
  }, {
820
817
  key: 'onAfterLoadData',
821
- value: function onAfterLoadData(firstTime) {
818
+ value: function onAfterLoadData() {
822
819
  this.updateRowsMapper();
823
820
  }
824
821