handsontable 0.0.0-next-1dfe61f-20240910 → 0.0.0-next-1c936db-20240912

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.

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-1dfe61f-20240910";
137
+ const hotVersion = "0.0.0-next-1c936db-20240912";
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-1dfe61f-20240910";
127
+ const hotVersion = "0.0.0-next-1c936db-20240912";
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-1dfe61f-20240910",
13
+ "version": "0.0.0-next-1c936db-20240912",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -186,6 +186,7 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
186
186
  let uncheckCheckbox = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
187
187
  const selRange = hotInstance.getSelectedRange();
188
188
  const changesPerSubSelection = [];
189
+ const nonCheckboxChanges = new Map();
189
190
  let changes = [];
190
191
  let changeCounter = 0;
191
192
  if (!selRange) {
@@ -207,8 +208,19 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
207
208
  checkedTemplate: cachedCellProperties.checkedTemplate,
208
209
  uncheckedTemplate: cachedCellProperties.uncheckedTemplate
209
210
  };
211
+
212
+ // TODO: In the future it'd be better if non-checkbox changes were handled by the non-checkbox
213
+ // `delete` keypress logic.
214
+ /* eslint-disable no-continue */
210
215
  if (cachedCellProperties.type !== 'checkbox') {
211
- return;
216
+ if (uncheckCheckbox === true && !cachedCellProperties.readOnly) {
217
+ if (nonCheckboxChanges.has(changesPerSubSelection.length)) {
218
+ nonCheckboxChanges.set(changesPerSubSelection.length, [...nonCheckboxChanges.get(changesPerSubSelection.length), [visualRow, visualColumn, null]]);
219
+ } else {
220
+ nonCheckboxChanges.set(changesPerSubSelection.length, [[visualRow, visualColumn, null]]);
221
+ }
222
+ }
223
+ continue;
212
224
  }
213
225
 
214
226
  /* eslint-disable no-continue */
@@ -256,8 +268,11 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
256
268
  if (changes.length > 0) {
257
269
  // TODO: This is workaround for handsontable/dev-handsontable#1747 not being a breaking change.
258
270
  // Technically, the changes don't need to be split into chunks when sent to `setDataAtCell`.
259
- changesPerSubSelection.forEach(changesCount => {
260
- const changesChunk = changes.splice(0, changesCount);
271
+ changesPerSubSelection.forEach((changesCount, sectionCount) => {
272
+ let changesChunk = changes.splice(0, changesCount);
273
+ if (nonCheckboxChanges.size && nonCheckboxChanges.has(sectionCount)) {
274
+ changesChunk = [...changesChunk, ...nonCheckboxChanges.get(sectionCount)];
275
+ }
261
276
  hotInstance.setDataAtCell(changesChunk);
262
277
  });
263
278
  }
@@ -280,9 +295,6 @@ function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellProperties
280
295
  for (let visualRow = topLeft.row; visualRow <= bottomRight.row; visualRow++) {
281
296
  for (let visualColumn = topLeft.col; visualColumn <= bottomRight.col; visualColumn++) {
282
297
  const cachedCellProperties = hotInstance.getCellMeta(visualRow, visualColumn);
283
- if (cachedCellProperties.type !== 'checkbox') {
284
- return false;
285
- }
286
298
  const cell = hotInstance.getCell(visualRow, visualColumn);
287
299
  if (cell === null || cell === undefined) {
288
300
  return true;
@@ -181,6 +181,7 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
181
181
  let uncheckCheckbox = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
182
182
  const selRange = hotInstance.getSelectedRange();
183
183
  const changesPerSubSelection = [];
184
+ const nonCheckboxChanges = new Map();
184
185
  let changes = [];
185
186
  let changeCounter = 0;
186
187
  if (!selRange) {
@@ -202,8 +203,19 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
202
203
  checkedTemplate: cachedCellProperties.checkedTemplate,
203
204
  uncheckedTemplate: cachedCellProperties.uncheckedTemplate
204
205
  };
206
+
207
+ // TODO: In the future it'd be better if non-checkbox changes were handled by the non-checkbox
208
+ // `delete` keypress logic.
209
+ /* eslint-disable no-continue */
205
210
  if (cachedCellProperties.type !== 'checkbox') {
206
- return;
211
+ if (uncheckCheckbox === true && !cachedCellProperties.readOnly) {
212
+ if (nonCheckboxChanges.has(changesPerSubSelection.length)) {
213
+ nonCheckboxChanges.set(changesPerSubSelection.length, [...nonCheckboxChanges.get(changesPerSubSelection.length), [visualRow, visualColumn, null]]);
214
+ } else {
215
+ nonCheckboxChanges.set(changesPerSubSelection.length, [[visualRow, visualColumn, null]]);
216
+ }
217
+ }
218
+ continue;
207
219
  }
208
220
 
209
221
  /* eslint-disable no-continue */
@@ -251,8 +263,11 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
251
263
  if (changes.length > 0) {
252
264
  // TODO: This is workaround for handsontable/dev-handsontable#1747 not being a breaking change.
253
265
  // Technically, the changes don't need to be split into chunks when sent to `setDataAtCell`.
254
- changesPerSubSelection.forEach(changesCount => {
255
- const changesChunk = changes.splice(0, changesCount);
266
+ changesPerSubSelection.forEach((changesCount, sectionCount) => {
267
+ let changesChunk = changes.splice(0, changesCount);
268
+ if (nonCheckboxChanges.size && nonCheckboxChanges.has(sectionCount)) {
269
+ changesChunk = [...changesChunk, ...nonCheckboxChanges.get(sectionCount)];
270
+ }
256
271
  hotInstance.setDataAtCell(changesChunk);
257
272
  });
258
273
  }
@@ -275,9 +290,6 @@ export function checkboxRenderer(hotInstance, TD, row, col, prop, value, cellPro
275
290
  for (let visualRow = topLeft.row; visualRow <= bottomRight.row; visualRow++) {
276
291
  for (let visualColumn = topLeft.col; visualColumn <= bottomRight.col; visualColumn++) {
277
292
  const cachedCellProperties = hotInstance.getCellMeta(visualRow, visualColumn);
278
- if (cachedCellProperties.type !== 'checkbox') {
279
- return false;
280
- }
281
293
  const cell = hotInstance.getCell(visualRow, visualColumn);
282
294
  if (cell === null || cell === undefined) {
283
295
  return true;