handsontable 0.0.0-next-2c41c5b-20250814 → 0.0.0-next-fce5825-20250822

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 (126) hide show
  1. package/base.js +2 -2
  2. package/base.mjs +2 -2
  3. package/cellTypes/autocompleteType/autocompleteType.js +1 -4
  4. package/cellTypes/autocompleteType/autocompleteType.mjs +1 -4
  5. package/cellTypes/checkboxType/checkboxType.js +1 -3
  6. package/cellTypes/checkboxType/checkboxType.mjs +1 -3
  7. package/cellTypes/dropdownType/dropdownType.js +1 -4
  8. package/cellTypes/dropdownType/dropdownType.mjs +1 -4
  9. package/cellTypes/numericType/numericType.js +1 -3
  10. package/cellTypes/numericType/numericType.mjs +1 -3
  11. package/core/focusCatcher/index.js +37 -20
  12. package/core/focusCatcher/index.mjs +37 -20
  13. package/core/focusCatcher/utils.js +3 -64
  14. package/core/focusCatcher/utils.mjs +1 -60
  15. package/core/hooks/constants.js +58 -0
  16. package/core/hooks/constants.mjs +58 -0
  17. package/core/hooks/index.d.ts +7 -0
  18. package/core.d.ts +0 -1
  19. package/core.js +59 -55
  20. package/core.mjs +61 -57
  21. package/dataMap/dataMap.js +3 -13
  22. package/dataMap/dataMap.mjs +4 -14
  23. package/dataMap/dataSource.js +0 -16
  24. package/dataMap/dataSource.mjs +0 -16
  25. package/dataMap/metaManager/lazyFactoryMap.js +3 -4
  26. package/dataMap/metaManager/lazyFactoryMap.mjs +1 -2
  27. package/dataMap/metaManager/metaLayers/cellMeta.js +2 -3
  28. package/dataMap/metaManager/metaLayers/cellMeta.mjs +2 -3
  29. package/dataMap/metaManager/metaSchema.js +97 -68
  30. package/dataMap/metaManager/metaSchema.mjs +97 -68
  31. package/dataMap/metaManager/utils.js +11 -0
  32. package/dataMap/metaManager/utils.mjs +10 -0
  33. package/dist/handsontable.css +103 -5
  34. package/dist/handsontable.full.css +103 -5
  35. package/dist/handsontable.full.js +2770 -1954
  36. package/dist/handsontable.full.min.css +3 -3
  37. package/dist/handsontable.full.min.js +67 -67
  38. package/dist/handsontable.js +2772 -1956
  39. package/dist/handsontable.min.css +3 -3
  40. package/dist/handsontable.min.js +27 -27
  41. package/editors/autocompleteEditor/autocompleteEditor.js +8 -33
  42. package/editors/autocompleteEditor/autocompleteEditor.mjs +9 -34
  43. package/editors/baseEditor/baseEditor.js +2 -2
  44. package/editors/baseEditor/baseEditor.mjs +2 -2
  45. package/helpers/a11y.js +5 -1
  46. package/helpers/a11y.mjs +3 -1
  47. package/helpers/mixed.js +64 -1
  48. package/helpers/mixed.mjs +62 -1
  49. package/helpers/number.js +0 -28
  50. package/helpers/number.mjs +0 -26
  51. package/helpers/string.js +0 -19
  52. package/helpers/string.mjs +0 -18
  53. package/index.d.ts +9 -0
  54. package/package.json +6 -1
  55. package/plugins/autofill/autofill.js +3 -50
  56. package/plugins/autofill/autofill.mjs +3 -50
  57. package/plugins/base/base.js +75 -14
  58. package/plugins/base/base.mjs +75 -14
  59. package/plugins/contextMenu/contextMenu.js +1 -0
  60. package/plugins/contextMenu/contextMenu.mjs +1 -0
  61. package/plugins/copyPaste/copyPaste.js +28 -61
  62. package/plugins/copyPaste/copyPaste.mjs +29 -62
  63. package/plugins/dialog/dialog.d.ts +23 -0
  64. package/plugins/dialog/dialog.js +469 -0
  65. package/plugins/dialog/dialog.mjs +465 -0
  66. package/plugins/dialog/index.d.ts +1 -0
  67. package/plugins/dialog/index.js +7 -0
  68. package/plugins/dialog/index.mjs +1 -0
  69. package/plugins/dialog/ui.js +240 -0
  70. package/plugins/dialog/ui.mjs +235 -0
  71. package/plugins/dropdownMenu/dropdownMenu.js +1 -0
  72. package/plugins/dropdownMenu/dropdownMenu.mjs +1 -0
  73. package/plugins/index.d.ts +3 -0
  74. package/plugins/index.js +3 -0
  75. package/plugins/index.mjs +3 -1
  76. package/plugins/pagination/focusController.js +27 -0
  77. package/plugins/pagination/focusController.mjs +23 -0
  78. package/plugins/pagination/pagination.js +165 -18
  79. package/plugins/pagination/pagination.mjs +165 -18
  80. package/plugins/pagination/ui.js +101 -62
  81. package/plugins/pagination/ui.mjs +102 -63
  82. package/selection/range.js +11 -0
  83. package/selection/range.mjs +11 -0
  84. package/selection/selection.js +63 -2
  85. package/selection/selection.mjs +63 -2
  86. package/selection/utils.js +2 -1
  87. package/selection/utils.mjs +2 -1
  88. package/settings.d.ts +3 -3
  89. package/shortcuts/context.js +4 -1
  90. package/shortcuts/context.mjs +4 -1
  91. package/shortcuts/manager.js +17 -3
  92. package/shortcuts/manager.mjs +17 -3
  93. package/styles/handsontable.css +106 -22
  94. package/styles/handsontable.min.css +3 -3
  95. package/styles/ht-theme-horizon.css +24 -6
  96. package/styles/ht-theme-horizon.min.css +3 -3
  97. package/styles/ht-theme-main.css +52 -34
  98. package/styles/ht-theme-main.min.css +3 -3
  99. package/tableView.js +7 -2
  100. package/tableView.mjs +7 -2
  101. package/{core/focusCatcher → utils}/focusDetector.js +29 -11
  102. package/{core/focusCatcher → utils}/focusDetector.mjs +29 -11
  103. package/validators/autocompleteValidator/autocompleteValidator.js +1 -2
  104. package/validators/autocompleteValidator/autocompleteValidator.mjs +1 -2
  105. package/cellTypes/autocompleteType/accessors/index.js +0 -7
  106. package/cellTypes/autocompleteType/accessors/index.mjs +0 -2
  107. package/cellTypes/autocompleteType/accessors/valueGetter.js +0 -14
  108. package/cellTypes/autocompleteType/accessors/valueGetter.mjs +0 -10
  109. package/cellTypes/autocompleteType/accessors/valueSetter.js +0 -25
  110. package/cellTypes/autocompleteType/accessors/valueSetter.mjs +0 -21
  111. package/cellTypes/checkboxType/accessors/index.js +0 -5
  112. package/cellTypes/checkboxType/accessors/index.mjs +0 -1
  113. package/cellTypes/checkboxType/accessors/valueSetter.js +0 -26
  114. package/cellTypes/checkboxType/accessors/valueSetter.mjs +0 -22
  115. package/cellTypes/dropdownType/accessors/index.js +0 -7
  116. package/cellTypes/dropdownType/accessors/index.mjs +0 -2
  117. package/cellTypes/dropdownType/accessors/valueGetter.js +0 -14
  118. package/cellTypes/dropdownType/accessors/valueGetter.mjs +0 -10
  119. package/cellTypes/dropdownType/accessors/valueSetter.js +0 -17
  120. package/cellTypes/dropdownType/accessors/valueSetter.mjs +0 -13
  121. package/cellTypes/numericType/accessors/index.js +0 -5
  122. package/cellTypes/numericType/accessors/index.mjs +0 -1
  123. package/cellTypes/numericType/accessors/valueSetter.js +0 -19
  124. package/cellTypes/numericType/accessors/valueSetter.mjs +0 -15
  125. package/utils/valueAccessors.js +0 -45
  126. package/utils/valueAccessors.mjs +0 -40
package/core.js CHANGED
@@ -54,7 +54,6 @@ var _stylesHandler = require("./utils/stylesHandler");
54
54
  var _console = require("./helpers/console");
55
55
  var _rangeToRenderableMapper = require("./core/coordsMapper/rangeToRenderableMapper");
56
56
  var _a11yAnnouncer = require("./utils/a11yAnnouncer");
57
- var _valueAccessors = require("./utils/valueAccessors");
58
57
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
59
58
  let activeGuid = null;
60
59
 
@@ -202,6 +201,14 @@ function Core(rootContainer, userSettings) {
202
201
  */
203
202
  this.rootWrapperElement = undefined;
204
203
 
204
+ /**
205
+ * Reference to the grid element.
206
+ *
207
+ * @private
208
+ * @type {HTMLElement}
209
+ */
210
+ this.rootGridElement = undefined;
211
+
205
212
  /**
206
213
  * Reference to the portal element.
207
214
  *
@@ -236,10 +243,13 @@ function Core(rootContainer, userSettings) {
236
243
  this.rootWindow = this.rootDocument.defaultView;
237
244
  if ((0, _rootInstance.isRootInstance)(this)) {
238
245
  this.rootWrapperElement = this.rootDocument.createElement('div');
246
+ this.rootGridElement = this.rootDocument.createElement('div');
239
247
  this.rootPortalElement = this.rootDocument.createElement('div');
240
248
  (0, _element.addClass)(this.rootElement, ['ht-wrapper', 'handsontable']);
241
249
  (0, _element.addClass)(this.rootWrapperElement, 'ht-root-wrapper');
242
- this.rootWrapperElement.appendChild(this.rootElement);
250
+ (0, _element.addClass)(this.rootGridElement, 'ht-grid');
251
+ this.rootGridElement.appendChild(this.rootElement);
252
+ this.rootWrapperElement.appendChild(this.rootGridElement);
243
253
  this.rootContainer.appendChild(this.rootWrapperElement);
244
254
  (0, _element.addClass)(this.rootPortalElement, 'ht-portal');
245
255
  this.rootDocument.body.appendChild(this.rootPortalElement);
@@ -352,9 +362,6 @@ function Core(rootContainer, userSettings) {
352
362
  const pluginsRegistry = (0, _uniqueMap.createUniqueMap)();
353
363
  this.container = this.rootDocument.createElement('div');
354
364
  this.rootElement.insertBefore(this.container, this.rootElement.firstChild);
355
- if ((0, _rootInstance.isRootInstance)(this)) {
356
- (0, _mixed._injectProductInfo)(mergedUserSettings.licenseKey, this.rootWrapperElement);
357
- }
358
365
  this.guid = `ht_${(0, _string.randomString)()}`; // this is the namespace for global events
359
366
 
360
367
  foreignHotInstances.set(this.guid, this);
@@ -1073,7 +1080,6 @@ function Core(rootContainer, userSettings) {
1073
1080
  }
1074
1081
  skippedColumn = 0;
1075
1082
  for (c = 0; c < clen; c++) {
1076
- var _cellMeta, _instance$getSourceDa;
1077
1083
  if (end && current.col > end.col && colSelectionLength > colInputLength || !tableMeta.allowInsertColumn && current.col > instance.countCols() - 1 || current.col >= tableMeta.maxCols) {
1078
1084
  break;
1079
1085
  }
@@ -1090,9 +1096,8 @@ function Core(rootContainer, userSettings) {
1090
1096
  continue;
1091
1097
  }
1092
1098
  const visualColumn = c - skippedColumn;
1093
- const hasValueSetter = !!((_cellMeta = cellMeta) !== null && _cellMeta !== void 0 && _cellMeta.valueSetter);
1094
1099
  let value = getInputValue(visualRow, visualColumn);
1095
- let orgValue = (_instance$getSourceDa = instance.getSourceDataAtCell(current.row, current.col)) !== null && _instance$getSourceDa !== void 0 ? _instance$getSourceDa : null;
1100
+ let orgValue = instance.getDataAtCell(current.row, current.col);
1096
1101
  if (value !== null && typeof value === 'object') {
1097
1102
  // when 'value' is array and 'orgValue' is null, set 'orgValue' to
1098
1103
  // an empty array so that the null value can be compared to 'value'
@@ -1100,23 +1105,20 @@ function Core(rootContainer, userSettings) {
1100
1105
  if (Array.isArray(value) && orgValue === null) {
1101
1106
  orgValue = [];
1102
1107
  }
1103
- if (!hasValueSetter && (typeof orgValue !== 'object' || orgValue === null)) {
1108
+ if (orgValue === null || typeof orgValue !== 'object') {
1104
1109
  pushData = false;
1105
- } else if (orgValue !== null) {
1110
+ } else {
1106
1111
  const orgValueSchema = (0, _object.duckSchema)(Array.isArray(orgValue) ? orgValue : orgValue[0] || orgValue);
1107
1112
  const valueSchema = (0, _object.duckSchema)(Array.isArray(value) ? value : value[0] || value);
1108
1113
 
1109
1114
  // Allow overwriting values with the same object-based schema or any array-based schema.
1110
- if (hasValueSetter ||
1111
- // If the cell has a value setter, we don't know the value schema (it's dynamic)
1112
-
1113
- (0, _object.isObjectEqual)(orgValueSchema, valueSchema) || Array.isArray(orgValueSchema) && Array.isArray(valueSchema)) {
1115
+ if ((0, _object.isObjectEqual)(orgValueSchema, valueSchema) || Array.isArray(orgValueSchema) && Array.isArray(valueSchema)) {
1114
1116
  value = (0, _object.deepClone)(value);
1115
1117
  } else {
1116
1118
  pushData = false;
1117
1119
  }
1118
1120
  }
1119
- } else if (!hasValueSetter && orgValue !== null && typeof orgValue === 'object') {
1121
+ } else if (orgValue !== null && typeof orgValue === 'object') {
1120
1122
  pushData = false;
1121
1123
  }
1122
1124
  if (pushData) {
@@ -1196,6 +1198,7 @@ function Core(rootContainer, userSettings) {
1196
1198
  if ((0, _rootInstance.isRootInstance)(this)) {
1197
1199
  (0, _index.installFocusCatcher)(instance);
1198
1200
  (0, _a11yAnnouncer.install)(instance.rootPortalElement);
1201
+ (0, _mixed._injectProductInfo)(mergedUserSettings.licenseKey, this.rootWrapperElement);
1199
1202
  }
1200
1203
  instance.runHooks('init');
1201
1204
  this.render();
@@ -1244,6 +1247,23 @@ function Core(rootContainer, userSettings) {
1244
1247
  };
1245
1248
  }
1246
1249
 
1250
+ /**
1251
+ * Get parsed number from numeric string.
1252
+ *
1253
+ * @private
1254
+ * @param {string} numericData Float (separated by a dot or a comma) or integer.
1255
+ * @returns {number} Number if we get data in parsable format, not changed value otherwise.
1256
+ */
1257
+ function getParsedNumber(numericData) {
1258
+ // Unifying "float like" string. Change from value with comma determiner to value with dot determiner,
1259
+ // for example from `450,65` to `450.65`.
1260
+ const unifiedNumericData = numericData.replace(',', '.');
1261
+ if (isNaN(parseFloat(unifiedNumericData)) === false) {
1262
+ return parseFloat(unifiedNumericData);
1263
+ }
1264
+ return numericData;
1265
+ }
1266
+
1247
1267
  /**
1248
1268
  * @ignore
1249
1269
  * @param {Array} changes The 2D array containing information about each of the edited cells.
@@ -1517,7 +1537,22 @@ function Core(rootContainer, userSettings) {
1517
1537
  ...tableMeta
1518
1538
  };
1519
1539
  }
1520
- filteredChanges[i][3] = (0, _valueAccessors.getValueSetterValue)(newValue, cellProperties);
1540
+ const {
1541
+ type,
1542
+ checkedTemplate,
1543
+ uncheckedTemplate
1544
+ } = cellProperties;
1545
+ if (type === 'numeric' && typeof newValue === 'string' && (0, _number.isNumericLike)(newValue)) {
1546
+ filteredChanges[i][3] = getParsedNumber(newValue);
1547
+ }
1548
+ if (type === 'checkbox') {
1549
+ const stringifiedValue = (0, _mixed.stringify)(newValue);
1550
+ const isChecked = stringifiedValue === (0, _mixed.stringify)(checkedTemplate);
1551
+ const isUnchecked = stringifiedValue === (0, _mixed.stringify)(uncheckedTemplate);
1552
+ if (isChecked || isUnchecked) {
1553
+ filteredChanges[i][3] = isChecked ? checkedTemplate : uncheckedTemplate;
1554
+ }
1555
+ }
1521
1556
  }
1522
1557
  return filteredChanges;
1523
1558
  }
@@ -1542,19 +1577,18 @@ function Core(rootContainer, userSettings) {
1542
1577
  let ilen;
1543
1578
  let prop;
1544
1579
  for (i = 0, ilen = input.length; i < ilen; i++) {
1545
- const [visualRow, visualColumn, newValue] = input[i];
1546
1580
  if (typeof input[i] !== 'object') {
1547
1581
  throw new Error('Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter');
1548
1582
  }
1549
- if (typeof visualColumn !== 'number') {
1583
+ if (typeof input[i][1] !== 'number') {
1550
1584
  throw new Error('Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`'); // eslint-disable-line max-len
1551
1585
  }
1552
- if (visualColumn >= this.countCols()) {
1553
- prop = visualColumn;
1586
+ if (input[i][1] >= this.countCols()) {
1587
+ prop = input[i][1];
1554
1588
  } else {
1555
- prop = datamap.colToProp(visualColumn);
1589
+ prop = datamap.colToProp(input[i][1]);
1556
1590
  }
1557
- changes.push([visualRow, prop, dataSource.getAtCell(this.toPhysicalRow(visualRow), visualColumn), newValue]);
1591
+ changes.push([input[i][0], prop, dataSource.getAtCell(this.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]);
1558
1592
  }
1559
1593
  if (!changeSource && typeof row === 'object') {
1560
1594
  changeSource = column;
@@ -1585,8 +1619,7 @@ function Core(rootContainer, userSettings) {
1585
1619
  let i;
1586
1620
  let ilen;
1587
1621
  for (i = 0, ilen = input.length; i < ilen; i++) {
1588
- const [visualRow, inputProp, newValue] = input[i];
1589
- changes.push([visualRow, inputProp, dataSource.getAtCell(this.toPhysicalRow(visualRow), inputProp), newValue]);
1622
+ changes.push([input[i][0], input[i][1], dataSource.getAtCell(this.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]);
1590
1623
  }
1591
1624
 
1592
1625
  // TODO: I don't think `prop` should be used as `changeSource` here, but removing it would be a breaking change.
@@ -2423,20 +2456,6 @@ function Core(rootContainer, userSettings) {
2423
2456
  return datamap.getCopyable(row, datamap.colToProp(column));
2424
2457
  };
2425
2458
 
2426
- /**
2427
- * Returns the source data's copyable value at specified `row` and `column` index.
2428
- *
2429
- * @memberof Core#
2430
- * @function getCopyableSourceData
2431
- * @param {number} row Visual row index.
2432
- * @param {number} column Visual column index.
2433
- * @since 16.1.0
2434
- * @returns {string}
2435
- */
2436
- this.getCopyableSourceData = function (row, column) {
2437
- return dataSource.getCopyable(row, datamap.colToProp(column));
2438
- };
2439
-
2440
2459
  /**
2441
2460
  * Returns schema provided by constructor settings. If it doesn't exist then it returns the schema based on the data
2442
2461
  * structure in the first row.
@@ -3046,32 +3065,17 @@ function Core(rootContainer, userSettings) {
3046
3065
  const input = setDataInputToArray(row, column, value);
3047
3066
  const isThereAnySetSourceListener = this.hasHook('afterSetSourceDataAtCell');
3048
3067
  const changesForHook = [];
3049
- const getCellProperties = (changeRow, changeProp) => {
3050
- const visualRow = this.toVisualRow(changeRow);
3051
- const visualColumn = this.toVisualColumn(changeProp);
3052
- if (Number.isInteger(visualColumn)) {
3053
- return this.getCellMeta(visualRow, visualColumn);
3054
- }
3055
-
3056
- // If there's no requested visual column, we can use the table meta as the cell properties
3057
- return {
3058
- ...Object.getPrototypeOf(tableMeta),
3059
- ...tableMeta
3060
- };
3061
- };
3062
3068
  if (isThereAnySetSourceListener) {
3063
3069
  (0, _array.arrayEach)(input, _ref9 => {
3064
3070
  let [changeRow, changeProp, changeValue] = _ref9;
3065
- const newValue = (0, _valueAccessors.getValueSetterValue)(changeValue, getCellProperties(changeRow, changeProp));
3066
3071
  changesForHook.push([changeRow, changeProp, dataSource.getAtCell(changeRow, changeProp),
3067
3072
  // The previous value.
3068
- newValue]);
3073
+ changeValue]);
3069
3074
  });
3070
3075
  }
3071
3076
  (0, _array.arrayEach)(input, _ref0 => {
3072
3077
  let [changeRow, changeProp, changeValue] = _ref0;
3073
- const newValue = (0, _valueAccessors.getValueSetterValue)(changeValue, getCellProperties(changeRow, changeProp));
3074
- dataSource.setAtCell(changeRow, changeProp, newValue);
3078
+ dataSource.setAtCell(changeRow, changeProp, changeValue);
3075
3079
  });
3076
3080
  if (isThereAnySetSourceListener) {
3077
3081
  this.runHooks('afterSetSourceDataAtCell', changesForHook, source);
package/core.mjs CHANGED
@@ -15,7 +15,7 @@ import "core-js/modules/esnext.iterator.map.js";
15
15
  import "core-js/modules/web.immediate.js";
16
16
  import { addClass, empty, observeVisibilityChangeOnce, removeClass } from "./helpers/dom/element.mjs";
17
17
  import { isFunction } from "./helpers/function.mjs";
18
- import { isDefined, isUndefined, isRegExp, _injectProductInfo, isEmpty } from "./helpers/mixed.mjs";
18
+ import { isDefined, isUndefined, isRegExp, _injectProductInfo, isEmpty, stringify } from "./helpers/mixed.mjs";
19
19
  import { isMobileBrowser, isIpadOS } from "./helpers/browser.mjs";
20
20
  import EditorManager from "./editorManager.mjs";
21
21
  import EventManager from "./eventManager.mjs";
@@ -29,7 +29,7 @@ import { getRenderer } from "./renderers/registry.mjs";
29
29
  import { getEditor } from "./editors/registry.mjs";
30
30
  import { getValidator } from "./validators/registry.mjs";
31
31
  import { randomString, toUpperCaseFirst } from "./helpers/string.mjs";
32
- import { rangeEach, rangeEachReverse } from "./helpers/number.mjs";
32
+ import { rangeEach, rangeEachReverse, isNumericLike } from "./helpers/number.mjs";
33
33
  import TableView from "./tableView.mjs";
34
34
  import DataSource from "./dataMap/dataSource.mjs";
35
35
  import { spreadsheetColumnLabel } from "./helpers/data.mjs";
@@ -50,7 +50,6 @@ import { StylesHandler } from "./utils/stylesHandler.mjs";
50
50
  import { warn } from "./helpers/console.mjs";
51
51
  import { CellRangeToRenderableMapper } from "./core/coordsMapper/rangeToRenderableMapper.mjs";
52
52
  import { install as installAccessibilityAnnouncer, uninstall as uninstallAccessibilityAnnouncer } from "./utils/a11yAnnouncer.mjs";
53
- import { getValueSetterValue } from "./utils/valueAccessors.mjs";
54
53
  let activeGuid = null;
55
54
 
56
55
  /**
@@ -197,6 +196,14 @@ export default function Core(rootContainer, userSettings) {
197
196
  */
198
197
  this.rootWrapperElement = undefined;
199
198
 
199
+ /**
200
+ * Reference to the grid element.
201
+ *
202
+ * @private
203
+ * @type {HTMLElement}
204
+ */
205
+ this.rootGridElement = undefined;
206
+
200
207
  /**
201
208
  * Reference to the portal element.
202
209
  *
@@ -231,10 +238,13 @@ export default function Core(rootContainer, userSettings) {
231
238
  this.rootWindow = this.rootDocument.defaultView;
232
239
  if (isRootInstance(this)) {
233
240
  this.rootWrapperElement = this.rootDocument.createElement('div');
241
+ this.rootGridElement = this.rootDocument.createElement('div');
234
242
  this.rootPortalElement = this.rootDocument.createElement('div');
235
243
  addClass(this.rootElement, ['ht-wrapper', 'handsontable']);
236
244
  addClass(this.rootWrapperElement, 'ht-root-wrapper');
237
- this.rootWrapperElement.appendChild(this.rootElement);
245
+ addClass(this.rootGridElement, 'ht-grid');
246
+ this.rootGridElement.appendChild(this.rootElement);
247
+ this.rootWrapperElement.appendChild(this.rootGridElement);
238
248
  this.rootContainer.appendChild(this.rootWrapperElement);
239
249
  addClass(this.rootPortalElement, 'ht-portal');
240
250
  this.rootDocument.body.appendChild(this.rootPortalElement);
@@ -347,9 +357,6 @@ export default function Core(rootContainer, userSettings) {
347
357
  const pluginsRegistry = createUniqueMap();
348
358
  this.container = this.rootDocument.createElement('div');
349
359
  this.rootElement.insertBefore(this.container, this.rootElement.firstChild);
350
- if (isRootInstance(this)) {
351
- _injectProductInfo(mergedUserSettings.licenseKey, this.rootWrapperElement);
352
- }
353
360
  this.guid = `ht_${randomString()}`; // this is the namespace for global events
354
361
 
355
362
  foreignHotInstances.set(this.guid, this);
@@ -1068,7 +1075,6 @@ export default function Core(rootContainer, userSettings) {
1068
1075
  }
1069
1076
  skippedColumn = 0;
1070
1077
  for (c = 0; c < clen; c++) {
1071
- var _cellMeta, _instance$getSourceDa;
1072
1078
  if (end && current.col > end.col && colSelectionLength > colInputLength || !tableMeta.allowInsertColumn && current.col > instance.countCols() - 1 || current.col >= tableMeta.maxCols) {
1073
1079
  break;
1074
1080
  }
@@ -1085,9 +1091,8 @@ export default function Core(rootContainer, userSettings) {
1085
1091
  continue;
1086
1092
  }
1087
1093
  const visualColumn = c - skippedColumn;
1088
- const hasValueSetter = !!((_cellMeta = cellMeta) !== null && _cellMeta !== void 0 && _cellMeta.valueSetter);
1089
1094
  let value = getInputValue(visualRow, visualColumn);
1090
- let orgValue = (_instance$getSourceDa = instance.getSourceDataAtCell(current.row, current.col)) !== null && _instance$getSourceDa !== void 0 ? _instance$getSourceDa : null;
1095
+ let orgValue = instance.getDataAtCell(current.row, current.col);
1091
1096
  if (value !== null && typeof value === 'object') {
1092
1097
  // when 'value' is array and 'orgValue' is null, set 'orgValue' to
1093
1098
  // an empty array so that the null value can be compared to 'value'
@@ -1095,23 +1100,20 @@ export default function Core(rootContainer, userSettings) {
1095
1100
  if (Array.isArray(value) && orgValue === null) {
1096
1101
  orgValue = [];
1097
1102
  }
1098
- if (!hasValueSetter && (typeof orgValue !== 'object' || orgValue === null)) {
1103
+ if (orgValue === null || typeof orgValue !== 'object') {
1099
1104
  pushData = false;
1100
- } else if (orgValue !== null) {
1105
+ } else {
1101
1106
  const orgValueSchema = duckSchema(Array.isArray(orgValue) ? orgValue : orgValue[0] || orgValue);
1102
1107
  const valueSchema = duckSchema(Array.isArray(value) ? value : value[0] || value);
1103
1108
 
1104
1109
  // Allow overwriting values with the same object-based schema or any array-based schema.
1105
- if (hasValueSetter ||
1106
- // If the cell has a value setter, we don't know the value schema (it's dynamic)
1107
-
1108
- isObjectEqual(orgValueSchema, valueSchema) || Array.isArray(orgValueSchema) && Array.isArray(valueSchema)) {
1110
+ if (isObjectEqual(orgValueSchema, valueSchema) || Array.isArray(orgValueSchema) && Array.isArray(valueSchema)) {
1109
1111
  value = deepClone(value);
1110
1112
  } else {
1111
1113
  pushData = false;
1112
1114
  }
1113
1115
  }
1114
- } else if (!hasValueSetter && orgValue !== null && typeof orgValue === 'object') {
1116
+ } else if (orgValue !== null && typeof orgValue === 'object') {
1115
1117
  pushData = false;
1116
1118
  }
1117
1119
  if (pushData) {
@@ -1191,6 +1193,7 @@ export default function Core(rootContainer, userSettings) {
1191
1193
  if (isRootInstance(this)) {
1192
1194
  installFocusCatcher(instance);
1193
1195
  installAccessibilityAnnouncer(instance.rootPortalElement);
1196
+ _injectProductInfo(mergedUserSettings.licenseKey, this.rootWrapperElement);
1194
1197
  }
1195
1198
  instance.runHooks('init');
1196
1199
  this.render();
@@ -1239,6 +1242,23 @@ export default function Core(rootContainer, userSettings) {
1239
1242
  };
1240
1243
  }
1241
1244
 
1245
+ /**
1246
+ * Get parsed number from numeric string.
1247
+ *
1248
+ * @private
1249
+ * @param {string} numericData Float (separated by a dot or a comma) or integer.
1250
+ * @returns {number} Number if we get data in parsable format, not changed value otherwise.
1251
+ */
1252
+ function getParsedNumber(numericData) {
1253
+ // Unifying "float like" string. Change from value with comma determiner to value with dot determiner,
1254
+ // for example from `450,65` to `450.65`.
1255
+ const unifiedNumericData = numericData.replace(',', '.');
1256
+ if (isNaN(parseFloat(unifiedNumericData)) === false) {
1257
+ return parseFloat(unifiedNumericData);
1258
+ }
1259
+ return numericData;
1260
+ }
1261
+
1242
1262
  /**
1243
1263
  * @ignore
1244
1264
  * @param {Array} changes The 2D array containing information about each of the edited cells.
@@ -1512,7 +1532,22 @@ export default function Core(rootContainer, userSettings) {
1512
1532
  ...tableMeta
1513
1533
  };
1514
1534
  }
1515
- filteredChanges[i][3] = getValueSetterValue(newValue, cellProperties);
1535
+ const {
1536
+ type,
1537
+ checkedTemplate,
1538
+ uncheckedTemplate
1539
+ } = cellProperties;
1540
+ if (type === 'numeric' && typeof newValue === 'string' && isNumericLike(newValue)) {
1541
+ filteredChanges[i][3] = getParsedNumber(newValue);
1542
+ }
1543
+ if (type === 'checkbox') {
1544
+ const stringifiedValue = stringify(newValue);
1545
+ const isChecked = stringifiedValue === stringify(checkedTemplate);
1546
+ const isUnchecked = stringifiedValue === stringify(uncheckedTemplate);
1547
+ if (isChecked || isUnchecked) {
1548
+ filteredChanges[i][3] = isChecked ? checkedTemplate : uncheckedTemplate;
1549
+ }
1550
+ }
1516
1551
  }
1517
1552
  return filteredChanges;
1518
1553
  }
@@ -1537,19 +1572,18 @@ export default function Core(rootContainer, userSettings) {
1537
1572
  let ilen;
1538
1573
  let prop;
1539
1574
  for (i = 0, ilen = input.length; i < ilen; i++) {
1540
- const [visualRow, visualColumn, newValue] = input[i];
1541
1575
  if (typeof input[i] !== 'object') {
1542
1576
  throw new Error('Method `setDataAtCell` accepts row number or changes array of arrays as its first parameter');
1543
1577
  }
1544
- if (typeof visualColumn !== 'number') {
1578
+ if (typeof input[i][1] !== 'number') {
1545
1579
  throw new Error('Method `setDataAtCell` accepts row and column number as its parameters. If you want to use object property name, use method `setDataAtRowProp`'); // eslint-disable-line max-len
1546
1580
  }
1547
- if (visualColumn >= this.countCols()) {
1548
- prop = visualColumn;
1581
+ if (input[i][1] >= this.countCols()) {
1582
+ prop = input[i][1];
1549
1583
  } else {
1550
- prop = datamap.colToProp(visualColumn);
1584
+ prop = datamap.colToProp(input[i][1]);
1551
1585
  }
1552
- changes.push([visualRow, prop, dataSource.getAtCell(this.toPhysicalRow(visualRow), visualColumn), newValue]);
1586
+ changes.push([input[i][0], prop, dataSource.getAtCell(this.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]);
1553
1587
  }
1554
1588
  if (!changeSource && typeof row === 'object') {
1555
1589
  changeSource = column;
@@ -1580,8 +1614,7 @@ export default function Core(rootContainer, userSettings) {
1580
1614
  let i;
1581
1615
  let ilen;
1582
1616
  for (i = 0, ilen = input.length; i < ilen; i++) {
1583
- const [visualRow, inputProp, newValue] = input[i];
1584
- changes.push([visualRow, inputProp, dataSource.getAtCell(this.toPhysicalRow(visualRow), inputProp), newValue]);
1617
+ changes.push([input[i][0], input[i][1], dataSource.getAtCell(this.toPhysicalRow(input[i][0]), input[i][1]), input[i][2]]);
1585
1618
  }
1586
1619
 
1587
1620
  // TODO: I don't think `prop` should be used as `changeSource` here, but removing it would be a breaking change.
@@ -2418,20 +2451,6 @@ export default function Core(rootContainer, userSettings) {
2418
2451
  return datamap.getCopyable(row, datamap.colToProp(column));
2419
2452
  };
2420
2453
 
2421
- /**
2422
- * Returns the source data's copyable value at specified `row` and `column` index.
2423
- *
2424
- * @memberof Core#
2425
- * @function getCopyableSourceData
2426
- * @param {number} row Visual row index.
2427
- * @param {number} column Visual column index.
2428
- * @since 16.1.0
2429
- * @returns {string}
2430
- */
2431
- this.getCopyableSourceData = function (row, column) {
2432
- return dataSource.getCopyable(row, datamap.colToProp(column));
2433
- };
2434
-
2435
2454
  /**
2436
2455
  * Returns schema provided by constructor settings. If it doesn't exist then it returns the schema based on the data
2437
2456
  * structure in the first row.
@@ -3041,32 +3060,17 @@ export default function Core(rootContainer, userSettings) {
3041
3060
  const input = setDataInputToArray(row, column, value);
3042
3061
  const isThereAnySetSourceListener = this.hasHook('afterSetSourceDataAtCell');
3043
3062
  const changesForHook = [];
3044
- const getCellProperties = (changeRow, changeProp) => {
3045
- const visualRow = this.toVisualRow(changeRow);
3046
- const visualColumn = this.toVisualColumn(changeProp);
3047
- if (Number.isInteger(visualColumn)) {
3048
- return this.getCellMeta(visualRow, visualColumn);
3049
- }
3050
-
3051
- // If there's no requested visual column, we can use the table meta as the cell properties
3052
- return {
3053
- ...Object.getPrototypeOf(tableMeta),
3054
- ...tableMeta
3055
- };
3056
- };
3057
3063
  if (isThereAnySetSourceListener) {
3058
3064
  arrayEach(input, _ref9 => {
3059
3065
  let [changeRow, changeProp, changeValue] = _ref9;
3060
- const newValue = getValueSetterValue(changeValue, getCellProperties(changeRow, changeProp));
3061
3066
  changesForHook.push([changeRow, changeProp, dataSource.getAtCell(changeRow, changeProp),
3062
3067
  // The previous value.
3063
- newValue]);
3068
+ changeValue]);
3064
3069
  });
3065
3070
  }
3066
3071
  arrayEach(input, _ref0 => {
3067
3072
  let [changeRow, changeProp, changeValue] = _ref0;
3068
- const newValue = getValueSetterValue(changeValue, getCellProperties(changeRow, changeProp));
3069
- dataSource.setAtCell(changeRow, changeProp, newValue);
3073
+ dataSource.setAtCell(changeRow, changeProp, changeValue);
3070
3074
  });
3071
3075
  if (isThereAnySetSourceListener) {
3072
3076
  this.runHooks('afterSetSourceDataAtCell', changesForHook, source);
@@ -12,7 +12,6 @@ var _object = require("../helpers/object");
12
12
  var _array = require("../helpers/array");
13
13
  var _number = require("../helpers/number");
14
14
  var _mixed = require("../helpers/mixed");
15
- var _valueAccessors = require("../utils/valueAccessors");
16
15
  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; }
17
16
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
18
17
  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); }
@@ -670,18 +669,9 @@ class DataMap {
670
669
  } else if (typeof prop === 'function') {
671
670
  value = prop(this.dataSource.slice(physicalRow, physicalRow + 1)[0]);
672
671
  }
673
- const visualColumnIndex = this.propToCol(prop);
674
- const physicalColumn = this.hot.toPhysicalColumn(visualColumnIndex);
675
- if ((0, _number.isUnsignedNumber)(physicalRow) && (0, _number.isUnsignedNumber)(physicalColumn)) {
676
- value = (0, _valueAccessors.getValueGetterValue)(value, this.metaManager.getCellMeta(physicalRow, physicalColumn, {
677
- visualRow: row,
678
- visualColumn: visualColumnIndex,
679
- skipMetaExtension: true
680
- }));
681
- }
682
672
  if (this.hot.hasHook('modifyData')) {
683
673
  const valueHolder = (0, _object.createObjectPropListener)(value);
684
- this.hot.runHooks('modifyData', row, visualColumnIndex, valueHolder, 'get');
674
+ this.hot.runHooks('modifyData', row, this.propToCol(prop), valueHolder, 'get');
685
675
  if (valueHolder.isTouched()) {
686
676
  value = valueHolder.value;
687
677
  }
@@ -692,7 +682,7 @@ class DataMap {
692
682
  /**
693
683
  * Returns single value from the data array (intended for clipboard copy to an external application).
694
684
  *
695
- * @param {number} row Visual row index.
685
+ * @param {number} row Physical row index.
696
686
  * @param {number} prop The column property.
697
687
  * @returns {string}
698
688
  */
@@ -707,7 +697,7 @@ class DataMap {
707
697
  * Saves single value to the data array.
708
698
  *
709
699
  * @param {number} row Visual row index.
710
- * @param {number|string} prop The column property.
700
+ * @param {number} prop The column property.
711
701
  * @param {string} value The value to set.
712
702
  */
713
703
  set(row, prop, value) {
@@ -10,9 +10,8 @@ import { stringify } from "../3rdparty/SheetClip/index.mjs";
10
10
  import { countFirstRowKeys } from "../helpers/data.mjs";
11
11
  import { createObjectPropListener, deepClone, deepExtend, deepObjectSize, duckSchema, hasOwnProperty, isObject, objectEach } from "../helpers/object.mjs";
12
12
  import { extendArray, to2dArray } from "../helpers/array.mjs";
13
- import { rangeEach, isUnsignedNumber } from "../helpers/number.mjs";
13
+ import { rangeEach } from "../helpers/number.mjs";
14
14
  import { isDefined } from "../helpers/mixed.mjs";
15
- import { getValueGetterValue } from "../utils/valueAccessors.mjs";
16
15
  /*
17
16
  This class contains open-source contributions covered by the MIT license.
18
17
 
@@ -666,18 +665,9 @@ class DataMap {
666
665
  } else if (typeof prop === 'function') {
667
666
  value = prop(this.dataSource.slice(physicalRow, physicalRow + 1)[0]);
668
667
  }
669
- const visualColumnIndex = this.propToCol(prop);
670
- const physicalColumn = this.hot.toPhysicalColumn(visualColumnIndex);
671
- if (isUnsignedNumber(physicalRow) && isUnsignedNumber(physicalColumn)) {
672
- value = getValueGetterValue(value, this.metaManager.getCellMeta(physicalRow, physicalColumn, {
673
- visualRow: row,
674
- visualColumn: visualColumnIndex,
675
- skipMetaExtension: true
676
- }));
677
- }
678
668
  if (this.hot.hasHook('modifyData')) {
679
669
  const valueHolder = createObjectPropListener(value);
680
- this.hot.runHooks('modifyData', row, visualColumnIndex, valueHolder, 'get');
670
+ this.hot.runHooks('modifyData', row, this.propToCol(prop), valueHolder, 'get');
681
671
  if (valueHolder.isTouched()) {
682
672
  value = valueHolder.value;
683
673
  }
@@ -688,7 +678,7 @@ class DataMap {
688
678
  /**
689
679
  * Returns single value from the data array (intended for clipboard copy to an external application).
690
680
  *
691
- * @param {number} row Visual row index.
681
+ * @param {number} row Physical row index.
692
682
  * @param {number} prop The column property.
693
683
  * @returns {string}
694
684
  */
@@ -703,7 +693,7 @@ class DataMap {
703
693
  * Saves single value to the data array.
704
694
  *
705
695
  * @param {number} row Visual row index.
706
- * @param {number|string} prop The column property.
696
+ * @param {number} prop The column property.
707
697
  * @param {string} value The value to set.
708
698
  */
709
699
  set(row, prop, value) {
@@ -277,22 +277,6 @@ class DataSource {
277
277
  return result;
278
278
  }
279
279
 
280
- /**
281
- * Returns single value from the data array (intended for clipboard copy to an external application).
282
- *
283
- * @param {number} row Visual row index.
284
- * @param {number} prop The column property.
285
- * @since 16.1.0
286
- * @returns {string}
287
- */
288
- getCopyable(row, prop) {
289
- const visualColumn = this.propToCol(prop);
290
- if (this.hot.getCellMeta(row, visualColumn).copyable) {
291
- return this.getAtCell(this.hot.toPhysicalRow(row), visualColumn);
292
- }
293
- return '';
294
- }
295
-
296
280
  /**
297
281
  * Count number of rows.
298
282
  *
@@ -274,22 +274,6 @@ class DataSource {
274
274
  return result;
275
275
  }
276
276
 
277
- /**
278
- * Returns single value from the data array (intended for clipboard copy to an external application).
279
- *
280
- * @param {number} row Visual row index.
281
- * @param {number} prop The column property.
282
- * @since 16.1.0
283
- * @returns {string}
284
- */
285
- getCopyable(row, prop) {
286
- const visualColumn = this.propToCol(prop);
287
- if (this.hot.getCellMeta(row, visualColumn).copyable) {
288
- return this.getAtCell(this.hot.toPhysicalRow(row), visualColumn);
289
- }
290
- return '';
291
- }
292
-
293
277
  /**
294
278
  * Count number of rows.
295
279
  *