handsontable 0.34.1 → 0.34.5

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 (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
@@ -13,7 +13,7 @@ describe('manualRowMove', () => {
13
13
  });
14
14
 
15
15
  describe('UI', () => {
16
- it('should append UI elements to wtHider after click on row header', function () {
16
+ it('should append UI elements to wtHider after click on row header', () => {
17
17
  handsontable({
18
18
  data: Handsontable.helper.createSpreadsheetData(30, 30),
19
19
  rowHeaders: true,
@@ -30,7 +30,7 @@ describe('manualRowMove', () => {
30
30
  expect(spec().$container.find('.ht__manualRowMove--backlight').length).toBe(1);
31
31
  });
32
32
 
33
- it('should part of UI elements be visible on dragging action', function () {
33
+ it('should part of UI elements be visible on dragging action', () => {
34
34
  handsontable({
35
35
  data: Handsontable.helper.createSpreadsheetData(30, 30),
36
36
  rowHeaders: true,
@@ -47,7 +47,7 @@ describe('manualRowMove', () => {
47
47
  expect(spec().$container.find('.ht__manualRowMove--backlight:visible').length).toBe(1);
48
48
  });
49
49
 
50
- it('should all of UI elements be visible on dragging action', function () {
50
+ it('should all of UI elements be visible on dragging action', () => {
51
51
  handsontable({
52
52
  data: Handsontable.helper.createSpreadsheetData(30, 30),
53
53
  rowHeaders: true,
@@ -55,9 +55,9 @@ describe('manualRowMove', () => {
55
55
  });
56
56
 
57
57
  const $headers = [
58
- this.$container.find('tbody tr:eq(0) th:eq(0)'),
59
- this.$container.find('tbody tr:eq(1) th:eq(0)'),
60
- this.$container.find('tbody tr:eq(2) th:eq(0)'),
58
+ spec().$container.find('tbody tr:eq(0) th:eq(0)'),
59
+ spec().$container.find('tbody tr:eq(1) th:eq(0)'),
60
+ spec().$container.find('tbody tr:eq(2) th:eq(0)'),
61
61
  ];
62
62
 
63
63
  $headers[0].simulate('mousedown');
@@ -70,202 +70,63 @@ describe('manualRowMove', () => {
70
70
  expect(spec().$container.find('.ht__manualRowMove--backlight:visible').length).toBe(1);
71
71
  });
72
72
 
73
- it('should run `beforeRowMove` with proper `target` parameter (moving row above first header)', function () {
74
- let targetParameterInsideCallback;
73
+ describe('backlight', () => {
74
+ it('should set proper left position of element when colWidths is undefined', () => {
75
+ handsontable({
76
+ data: Handsontable.helper.createSpreadsheetData(10, 10),
77
+ rowHeaders: true,
78
+ manualRowMove: true
79
+ });
75
80
 
76
- handsontable({
77
- data: Handsontable.helper.createSpreadsheetData(30, 30),
78
- rowHeaders: true,
79
- colHeaders: true,
80
- manualRowMove: true,
81
- beforeRowMove: (rows, target) => {
82
- targetParameterInsideCallback = target;
83
- }
84
- });
85
- const $fistHeader = this.$container.find('tbody tr:eq(0) th:eq(0)');
86
-
87
- this.$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
88
- this.$container.find('tbody tr:eq(1) th:eq(0)').simulate('mouseup');
89
- this.$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
90
-
91
- $fistHeader.simulate('mouseover');
92
- $fistHeader.simulate('mousemove', {
93
- clientY: $fistHeader.offset().bottom - $fistHeader.height() - 50
94
- });
95
- $fistHeader.simulate('mouseup');
96
-
97
- expect(targetParameterInsideCallback).toEqual(0);
98
- });
99
-
100
- it('should run `beforeRowMove` with proper `target` parameter (moving row to the top of first header)', function () {
101
- let targetParameterInsideCallback;
102
-
103
- handsontable({
104
- data: Handsontable.helper.createSpreadsheetData(30, 30),
105
- rowHeaders: true,
106
- manualRowMove: true,
107
- colHeaders: true,
108
- beforeRowMove: (rows, target) => {
109
- targetParameterInsideCallback = target;
110
- }
111
- });
112
- const $fistHeader = this.$container.find('tbody tr:eq(0) th:eq(0)');
113
-
114
- this.$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
115
- this.$container.find('tbody tr:eq(1) th:eq(0)').simulate('mouseup');
116
- this.$container.find('tbody tr:eq(1) th:eq(0)').simulate('mousedown');
117
-
118
- $fistHeader.simulate('mouseover');
119
- $fistHeader.simulate('mousemove', {
120
- clientY: $fistHeader.offset().bottom - $fistHeader.height()
121
- });
122
- $fistHeader.simulate('mouseup');
123
-
124
- expect(targetParameterInsideCallback).toEqual(0);
125
- });
126
-
127
- it('should run `beforeRowMove` with proper `target` parameter (moving row to the middle of the table)', function () {
128
- let targetParameterInsideCallback;
129
-
130
- handsontable({
131
- data: Handsontable.helper.createSpreadsheetData(30, 30),
132
- rowHeaders: true,
133
- manualRowMove: true,
134
- beforeRowMove: (rows, target) => {
135
- targetParameterInsideCallback = target;
136
- }
137
- });
138
-
139
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
140
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
141
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
142
-
143
- this.$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseover');
144
- this.$container.find('tbody tr:eq(2) th:eq(0)').simulate('mousemove');
145
- this.$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseup');
146
-
147
- expect(targetParameterInsideCallback).toEqual(2);
148
- });
149
-
150
- it('should run `beforeRowMove` with proper `target` parameter (moving row to the top of last header)', function () {
151
- let targetParameterInsideCallback;
152
-
153
- handsontable({
154
- data: Handsontable.helper.createSpreadsheetData(30, 30),
155
- rowHeaders: true,
156
- manualRowMove: true,
157
- beforeRowMove: (rows, target) => {
158
- targetParameterInsideCallback = target;
159
- }
160
- });
161
-
162
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
163
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
164
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
165
-
166
- this.$container.find('tbody tr:eq(29) th:eq(0)').simulate('mouseover');
167
- this.$container.find('tbody tr:eq(29) th:eq(0)').simulate('mousemove');
168
- this.$container.find('tbody tr:eq(29) th:eq(0)').simulate('mouseup');
169
-
170
- expect(targetParameterInsideCallback).toEqual(29);
171
- });
172
-
173
- it('should run `beforeRowMove` with proper `target` parameter (moving row to the bottom of last header)', function () {
174
- let targetParameterInsideCallback;
175
-
176
- handsontable({
177
- data: Handsontable.helper.createSpreadsheetData(30, 30),
178
- rowHeaders: true,
179
- manualRowMove: true,
180
- beforeRowMove: (rows, target) => {
181
- targetParameterInsideCallback = target;
182
- }
183
- });
184
- const $lastHeader = this.$container.find('tbody tr:eq(29) th:eq(0)');
81
+ const $headerTH = spec().$container.find('tbody tr:eq(0) th:eq(0)');
185
82
 
186
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
187
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
188
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
83
+ $headerTH.simulate('mousedown');
84
+ $headerTH.simulate('mouseup');
85
+ $headerTH.simulate('mousedown');
189
86
 
190
- $lastHeader.simulate('mouseover');
191
- $lastHeader.simulate('mousemove', {
192
- clientY: $lastHeader.offset().top + $lastHeader.height()
87
+ expect(spec().$container.find('.ht__manualRowMove--backlight')[0].offsetLeft).toBe(50);
193
88
  });
194
- $lastHeader.simulate('mouseup');
195
89
 
196
- expect(targetParameterInsideCallback).toEqual(30);
197
- });
90
+ it('should set proper left position of element when colWidths is defined', () => {
91
+ handsontable({
92
+ data: Handsontable.helper.createSpreadsheetData(10, 10),
93
+ rowHeaders: true,
94
+ manualRowMove: true,
95
+ colWidths: 100,
96
+ });
198
97
 
199
- it('should run `beforeRowMove` with proper `target` parameter (moving row below last header)', function () {
200
- let targetParameterInsideCallback;
98
+ const $headerTH = spec().$container.find('tbody tr:eq(0) th:eq(0)');
201
99
 
202
- handsontable({
203
- data: Handsontable.helper.createSpreadsheetData(30, 30),
204
- rowHeaders: true,
205
- manualRowMove: true,
206
- beforeRowMove: (rows, target) => {
207
- targetParameterInsideCallback = target;
208
- }
209
- });
210
- const $lastHeader = this.$container.find('tbody tr:eq(29) th:eq(0)');
100
+ $headerTH.simulate('mousedown');
101
+ $headerTH.simulate('mouseup');
102
+ $headerTH.simulate('mousedown');
211
103
 
212
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
213
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
214
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
215
-
216
- $lastHeader.simulate('mouseover');
217
- $lastHeader.simulate('mousemove', {
218
- clientY: $lastHeader.offset().top + $lastHeader.height() + 200
104
+ expect(spec().$container.find('.ht__manualRowMove--backlight')[0].offsetLeft).toBe(50);
219
105
  });
220
- $lastHeader.simulate('mouseup');
221
-
222
- expect(targetParameterInsideCallback).toEqual(30);
223
106
  });
224
107
 
225
- it('should run `beforeRowMove` with proper visual `target` parameter', function () {
226
- let targetParameterInsideCallback;
227
-
228
- handsontable({
229
- data: Handsontable.helper.createSpreadsheetData(30, 30),
230
- rowHeaders: true,
231
- manualRowMove: [1, 2, 0],
232
- beforeRowMove: (rows, target) => {
233
- targetParameterInsideCallback = target;
234
- }
108
+ describe('guideline', () => {
109
+ it('should set proper top position of element when target is first row and column headers are disabled', () => {
110
+ handsontable({
111
+ data: Handsontable.helper.createSpreadsheetData(10, 10),
112
+ rowHeaders: true,
113
+ colHeaders: false,
114
+ manualRowMove: true,
115
+ });
116
+
117
+ const $headers = [
118
+ spec().$container.find('tbody tr:eq(0) th:eq(0)'),
119
+ spec().$container.find('tbody tr:eq(1) th:eq(0)'),
120
+ ];
121
+
122
+ $headers[1].simulate('mousedown');
123
+ $headers[1].simulate('mouseup');
124
+ $headers[1].simulate('mousedown');
125
+ $headers[0].simulate('mouseover');
126
+ $headers[0].simulate('mousemove');
127
+
128
+ expect(spec().$container.find('.ht__manualRowMove--guideline')[0].offsetTop).toBe(-1);
235
129
  });
236
-
237
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
238
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
239
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
240
-
241
- this.$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseover');
242
- this.$container.find('tbody tr:eq(2) th:eq(0)').simulate('mousemove');
243
- this.$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseup');
244
-
245
- expect(targetParameterInsideCallback).toEqual(2);
246
- });
247
-
248
- it('should run `afterRowMove` with proper visual `target` parameter', function () {
249
- let targetParameterInsideCallback;
250
-
251
- handsontable({
252
- data: Handsontable.helper.createSpreadsheetData(30, 30),
253
- rowHeaders: true,
254
- manualRowMove: [1, 2, 0],
255
- afterRowMove: (rows, target) => {
256
- targetParameterInsideCallback = target;
257
- }
258
- });
259
-
260
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
261
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mouseup');
262
- this.$container.find('tbody tr:eq(0) th:eq(0)').simulate('mousedown');
263
-
264
- this.$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseover');
265
- this.$container.find('tbody tr:eq(2) th:eq(0)').simulate('mousemove');
266
- this.$container.find('tbody tr:eq(2) th:eq(0)').simulate('mouseup');
267
-
268
- expect(targetParameterInsideCallback).toEqual(2);
269
130
  });
270
131
  });
271
132
  });
@@ -86,10 +86,10 @@ class BaseUI {
86
86
  * @param {Number} left New left position of the element.
87
87
  */
88
88
  setPosition(top, left) {
89
- if (top) {
89
+ if (top !== void 0) {
90
90
  this._element.style.top = top + UNIT;
91
91
  }
92
- if (left) {
92
+ if (left !== void 0) {
93
93
  this._element.style.left = left + UNIT;
94
94
  }
95
95
  }