handsontable 14.1.0 → 14.2.0-next-4873a35-20240228

Sign up to get free protection for your applications and to get access to all the features.
Files changed (161) hide show
  1. package/3rdparty/walkontable/src/core/_base.js +12 -0
  2. package/3rdparty/walkontable/src/core/_base.mjs +12 -0
  3. package/3rdparty/walkontable/src/scroll.js +131 -98
  4. package/3rdparty/walkontable/src/scroll.mjs +133 -100
  5. package/3rdparty/walkontable/src/selection/border/border.js +3 -3
  6. package/3rdparty/walkontable/src/selection/border/border.mjs +3 -3
  7. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +26 -0
  8. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +26 -0
  9. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +26 -0
  10. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +26 -0
  11. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +20 -0
  12. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +20 -0
  13. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +20 -0
  14. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +20 -0
  15. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +20 -0
  16. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +20 -0
  17. package/3rdparty/walkontable/src/table.js +2 -0
  18. package/3rdparty/walkontable/src/table.mjs +2 -0
  19. package/3rdparty/walkontable/src/viewport.js +9 -0
  20. package/3rdparty/walkontable/src/viewport.mjs +10 -1
  21. package/CHANGELOG.md +38 -0
  22. package/base.js +2 -2
  23. package/base.mjs +2 -2
  24. package/core/index.js +6 -0
  25. package/core/index.mjs +2 -1
  26. package/core/viewportScroll/index.js +65 -0
  27. package/core/viewportScroll/index.mjs +61 -0
  28. package/core/viewportScroll/scrollStrategies/columnHeaderScroll.js +20 -0
  29. package/core/viewportScroll/scrollStrategies/columnHeaderScroll.mjs +16 -0
  30. package/core/viewportScroll/scrollStrategies/cornerHeaderScroll.js +14 -0
  31. package/core/viewportScroll/scrollStrategies/cornerHeaderScroll.mjs +10 -0
  32. package/core/viewportScroll/scrollStrategies/multipleScroll.js +15 -0
  33. package/core/viewportScroll/scrollStrategies/multipleScroll.mjs +11 -0
  34. package/core/viewportScroll/scrollStrategies/noncontiguousScroll.js +15 -0
  35. package/core/viewportScroll/scrollStrategies/noncontiguousScroll.mjs +11 -0
  36. package/core/viewportScroll/scrollStrategies/rowHeaderScroll.js +20 -0
  37. package/core/viewportScroll/scrollStrategies/rowHeaderScroll.mjs +16 -0
  38. package/core/viewportScroll/scrollStrategies/singleScroll.js +46 -0
  39. package/core/viewportScroll/scrollStrategies/singleScroll.mjs +42 -0
  40. package/core.d.ts +1 -1
  41. package/core.js +11 -52
  42. package/core.mjs +12 -53
  43. package/dataMap/metaManager/index.js +1 -1
  44. package/dataMap/metaManager/index.mjs +1 -1
  45. package/dataMap/metaManager/metaLayers/cellMeta.js +6 -1
  46. package/dataMap/metaManager/metaLayers/cellMeta.mjs +6 -1
  47. package/dataMap/metaManager/metaSchema.js +36 -12
  48. package/dataMap/metaManager/metaSchema.mjs +36 -12
  49. package/dist/handsontable.css +2 -2
  50. package/dist/handsontable.full.css +2 -2
  51. package/dist/handsontable.full.js +2996 -1928
  52. package/dist/handsontable.full.min.css +2 -2
  53. package/dist/handsontable.full.min.js +42 -42
  54. package/dist/handsontable.js +2998 -1930
  55. package/dist/handsontable.min.css +2 -2
  56. package/dist/handsontable.min.js +25 -25
  57. package/dist/languages/all.js +130 -25
  58. package/dist/languages/all.min.js +1 -1
  59. package/dist/languages/hr-HR.js +167 -0
  60. package/dist/languages/hr-HR.min.js +1 -0
  61. package/editorManager.js +15 -4
  62. package/editorManager.mjs +15 -4
  63. package/editors/autocompleteEditor/autocompleteEditor.js +2 -2
  64. package/editors/autocompleteEditor/autocompleteEditor.mjs +2 -2
  65. package/editors/baseEditor/baseEditor.js +1 -1
  66. package/editors/baseEditor/baseEditor.mjs +1 -1
  67. package/editors/checkboxEditor/checkboxEditor.js +5 -4
  68. package/editors/checkboxEditor/checkboxEditor.mjs +5 -4
  69. package/editors/dateEditor/dateEditor.js +1 -1
  70. package/editors/dateEditor/dateEditor.mjs +1 -1
  71. package/editors/dropdownEditor/dropdownEditor.js +1 -1
  72. package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
  73. package/editors/handsontableEditor/handsontableEditor.js +1 -1
  74. package/editors/handsontableEditor/handsontableEditor.mjs +1 -1
  75. package/editors/selectEditor/selectEditor.js +1 -1
  76. package/editors/selectEditor/selectEditor.mjs +1 -1
  77. package/editors/textEditor/textEditor.js +1 -2
  78. package/editors/textEditor/textEditor.mjs +1 -2
  79. package/editors/timeEditor/timeEditor.js +1 -1
  80. package/editors/timeEditor/timeEditor.mjs +1 -1
  81. package/helpers/mixed.js +2 -2
  82. package/helpers/mixed.mjs +2 -2
  83. package/helpers/moves.js +86 -0
  84. package/helpers/moves.mjs +82 -0
  85. package/i18n/languages/hr-HR.js +96 -0
  86. package/i18n/languages/hr-HR.mjs +90 -0
  87. package/i18n/languages/index.js +2 -0
  88. package/i18n/languages/index.mjs +2 -1
  89. package/languages/all.js +130 -25
  90. package/languages/hr-HR.js +167 -0
  91. package/languages/hr-HR.mjs +92 -0
  92. package/languages/index.js +130 -25
  93. package/languages/index.mjs +2 -1
  94. package/package.json +11 -1
  95. package/pluginHooks.d.ts +4 -2
  96. package/pluginHooks.js +33 -3
  97. package/pluginHooks.mjs +33 -3
  98. package/plugins/autoColumnSize/autoColumnSize.js +6 -1
  99. package/plugins/autoColumnSize/autoColumnSize.mjs +6 -1
  100. package/plugins/autoRowSize/autoRowSize.js +5 -0
  101. package/plugins/autoRowSize/autoRowSize.mjs +5 -0
  102. package/plugins/autofill/autofill.js +3 -2
  103. package/plugins/autofill/autofill.mjs +3 -2
  104. package/plugins/dropdownMenu/dropdownMenu.js +58 -4
  105. package/plugins/dropdownMenu/dropdownMenu.mjs +58 -4
  106. package/plugins/filters/component/value.js +51 -5
  107. package/plugins/filters/component/value.mjs +51 -5
  108. package/plugins/filters/utils.js +1 -1
  109. package/plugins/filters/utils.mjs +1 -1
  110. package/plugins/formulas/formulas.js +10 -1
  111. package/plugins/formulas/formulas.mjs +10 -1
  112. package/plugins/formulas/indexSyncer/axisSyncer.js +3 -75
  113. package/plugins/formulas/indexSyncer/axisSyncer.mjs +3 -75
  114. package/plugins/manualColumnResize/manualColumnResize.js +3 -0
  115. package/plugins/manualColumnResize/manualColumnResize.mjs +3 -0
  116. package/plugins/mergeCells/cellsCollection.js +1 -1
  117. package/plugins/mergeCells/cellsCollection.mjs +1 -1
  118. package/plugins/mergeCells/mergeCells.js +30 -0
  119. package/plugins/mergeCells/mergeCells.mjs +30 -0
  120. package/plugins/undoRedo/undoRedo.js +61 -14
  121. package/plugins/undoRedo/undoRedo.mjs +61 -14
  122. package/renderers/autocompleteRenderer/autocompleteRenderer.js +1 -1
  123. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +1 -1
  124. package/renderers/baseRenderer/baseRenderer.js +1 -1
  125. package/renderers/baseRenderer/baseRenderer.mjs +1 -1
  126. package/renderers/checkboxRenderer/checkboxRenderer.js +36 -8
  127. package/renderers/checkboxRenderer/checkboxRenderer.mjs +36 -8
  128. package/renderers/dateRenderer/dateRenderer.js +1 -1
  129. package/renderers/dateRenderer/dateRenderer.mjs +1 -1
  130. package/renderers/dropdownRenderer/dropdownRenderer.js +1 -1
  131. package/renderers/dropdownRenderer/dropdownRenderer.mjs +1 -1
  132. package/renderers/handsontableRenderer/handsontableRenderer.js +1 -1
  133. package/renderers/handsontableRenderer/handsontableRenderer.mjs +1 -1
  134. package/renderers/htmlRenderer/htmlRenderer.js +1 -1
  135. package/renderers/htmlRenderer/htmlRenderer.mjs +1 -1
  136. package/renderers/numericRenderer/index.js +2 -1
  137. package/renderers/numericRenderer/index.mjs +1 -1
  138. package/renderers/numericRenderer/numericRenderer.js +28 -13
  139. package/renderers/numericRenderer/numericRenderer.mjs +27 -13
  140. package/renderers/passwordRenderer/passwordRenderer.js +1 -1
  141. package/renderers/passwordRenderer/passwordRenderer.mjs +1 -1
  142. package/renderers/selectRenderer/selectRenderer.js +1 -1
  143. package/renderers/selectRenderer/selectRenderer.mjs +1 -1
  144. package/renderers/textRenderer/textRenderer.js +1 -1
  145. package/renderers/textRenderer/textRenderer.mjs +1 -1
  146. package/renderers/timeRenderer/timeRenderer.js +1 -1
  147. package/renderers/timeRenderer/timeRenderer.mjs +1 -1
  148. package/selection/mouseEventHandler.js +4 -0
  149. package/selection/mouseEventHandler.mjs +4 -0
  150. package/selection/selection.js +64 -5
  151. package/selection/selection.mjs +64 -5
  152. package/shortcuts/recorder.js +27 -8
  153. package/shortcuts/recorder.mjs +27 -8
  154. package/tableView.js +86 -5
  155. package/tableView.mjs +87 -6
  156. package/utils/autoResize.js +0 -1
  157. package/utils/autoResize.mjs +0 -1
  158. package/utils/ghostTable.js +6 -6
  159. package/utils/ghostTable.mjs +6 -6
  160. package/utils/parseTable.js +9 -1
  161. package/utils/parseTable.mjs +9 -1
@@ -65,7 +65,7 @@ class GhostTable {
65
65
  /**
66
66
  * Add row.
67
67
  *
68
- * @param {number} row Row index.
68
+ * @param {number} row Visual row index.
69
69
  * @param {Map} samples Samples Map object.
70
70
  */
71
71
  addRow(row, samples) {
@@ -112,7 +112,7 @@ class GhostTable {
112
112
  /**
113
113
  * Add column.
114
114
  *
115
- * @param {number} column Column index.
115
+ * @param {number} column Visual column index.
116
116
  * @param {Map} samples A map with sampled table values.
117
117
  */
118
118
  addColumn(column, samples) {
@@ -244,7 +244,7 @@ class GhostTable {
244
244
  /**
245
245
  * Create table row element.
246
246
  *
247
- * @param {number} row Row index.
247
+ * @param {number} row Visual row index.
248
248
  * @returns {DocumentFragment} Returns created table row elements.
249
249
  */
250
250
  createRow(row) {
@@ -312,7 +312,7 @@ class GhostTable {
312
312
  /**
313
313
  * Create table column elements.
314
314
  *
315
- * @param {number} column Column index.
315
+ * @param {number} column Visual column index.
316
316
  * @returns {DocumentFragment} Returns created column table column elements.
317
317
  */
318
318
  createCol(column) {
@@ -392,10 +392,10 @@ class GhostTable {
392
392
  if (row >= 0 && column >= 0) {
393
393
  colspan = this.hot.getCellMeta(row, column).colspan;
394
394
  }
395
- let width = this.hot.view._wt.wtTable.getStretchedColumnWidth(column);
395
+ let width = this.hot.getColWidth(column);
396
396
  if (colspan > 1) {
397
397
  for (let nextColumn = column + 1; nextColumn < column + colspan; nextColumn++) {
398
- width += this.hot.view._wt.wtTable.getStretchedColumnWidth(nextColumn);
398
+ width += this.hot.getColWidth(nextColumn);
399
399
  }
400
400
  }
401
401
  col.style.width = `${width}px`;
@@ -62,7 +62,7 @@ class GhostTable {
62
62
  /**
63
63
  * Add row.
64
64
  *
65
- * @param {number} row Row index.
65
+ * @param {number} row Visual row index.
66
66
  * @param {Map} samples Samples Map object.
67
67
  */
68
68
  addRow(row, samples) {
@@ -109,7 +109,7 @@ class GhostTable {
109
109
  /**
110
110
  * Add column.
111
111
  *
112
- * @param {number} column Column index.
112
+ * @param {number} column Visual column index.
113
113
  * @param {Map} samples A map with sampled table values.
114
114
  */
115
115
  addColumn(column, samples) {
@@ -241,7 +241,7 @@ class GhostTable {
241
241
  /**
242
242
  * Create table row element.
243
243
  *
244
- * @param {number} row Row index.
244
+ * @param {number} row Visual row index.
245
245
  * @returns {DocumentFragment} Returns created table row elements.
246
246
  */
247
247
  createRow(row) {
@@ -309,7 +309,7 @@ class GhostTable {
309
309
  /**
310
310
  * Create table column elements.
311
311
  *
312
- * @param {number} column Column index.
312
+ * @param {number} column Visual column index.
313
313
  * @returns {DocumentFragment} Returns created column table column elements.
314
314
  */
315
315
  createCol(column) {
@@ -389,10 +389,10 @@ class GhostTable {
389
389
  if (row >= 0 && column >= 0) {
390
390
  colspan = this.hot.getCellMeta(row, column).colspan;
391
391
  }
392
- let width = this.hot.view._wt.wtTable.getStretchedColumnWidth(column);
392
+ let width = this.hot.getColWidth(column);
393
393
  if (colspan > 1) {
394
394
  for (let nextColumn = column + 1; nextColumn < column + colspan; nextColumn++) {
395
- width += this.hot.view._wt.wtTable.getStretchedColumnWidth(nextColumn);
395
+ width += this.hot.getColWidth(nextColumn);
396
396
  }
397
397
  }
398
398
  col.style.width = `${width}px`;
@@ -5,6 +5,7 @@ exports._dataToHTML = _dataToHTML;
5
5
  exports.htmlToGridSettings = htmlToGridSettings;
6
6
  exports.instanceToHTML = instanceToHTML;
7
7
  require("core-js/modules/es.array.push.js");
8
+ require("core-js/modules/es.string.replace-all.js");
8
9
  var _mixed = require("./../helpers/mixed");
9
10
  const ESCAPED_HTML_CHARS = {
10
11
  '&nbsp;': '\x20',
@@ -140,7 +141,14 @@ function htmlToGridSettings(element) {
140
141
  if (typeof checkElement === 'string') {
141
142
  const escapedAdjacentHTML = checkElement.replace(/<td\b[^>]*?>([\s\S]*?)<\/\s*td>/g, cellFragment => {
142
143
  const openingTag = cellFragment.match(/<td\b[^>]*?>/g)[0];
143
- const cellValue = cellFragment.substring(openingTag.length, cellFragment.lastIndexOf('<')).replace(/(<(?!br)([^>]+)>)/gi, '');
144
+ const paragraphRegexp = /<p.*?>/g;
145
+ const cellValue = cellFragment.substring(openingTag.length, cellFragment.lastIndexOf('<')).trim() // Removing whitespaces from the start and the end of HTML fragment
146
+ .replaceAll(/\n\s+/g, ' ') // HTML tags may be split using multiple new lines and whitespaces
147
+ .replaceAll(paragraphRegexp, '\n') // Only paragraphs should split text using new line characters
148
+ .replace('\n', '') // First paragraph shouldn't start with new line characters
149
+ .replaceAll(/<\/(.*)>\s+$/mg, '</$1>') // HTML tags may end with whitespace.
150
+ .replace(/(<(?!br)([^>]+)>)/gi, '') // Removing HTML tags
151
+ .replaceAll(/^&nbsp;$/mg, ''); // Removing single &nbsp; characters separating new lines
144
152
  const closingTag = '</td>';
145
153
  return `${openingTag}${cellValue}${closingTag}`;
146
154
  });
@@ -1,4 +1,5 @@
1
1
  import "core-js/modules/es.array.push.js";
2
+ import "core-js/modules/es.string.replace-all.js";
2
3
  import { isEmpty } from "./../helpers/mixed.mjs";
3
4
  const ESCAPED_HTML_CHARS = {
4
5
  '&nbsp;': '\x20',
@@ -134,7 +135,14 @@ export function htmlToGridSettings(element) {
134
135
  if (typeof checkElement === 'string') {
135
136
  const escapedAdjacentHTML = checkElement.replace(/<td\b[^>]*?>([\s\S]*?)<\/\s*td>/g, cellFragment => {
136
137
  const openingTag = cellFragment.match(/<td\b[^>]*?>/g)[0];
137
- const cellValue = cellFragment.substring(openingTag.length, cellFragment.lastIndexOf('<')).replace(/(<(?!br)([^>]+)>)/gi, '');
138
+ const paragraphRegexp = /<p.*?>/g;
139
+ const cellValue = cellFragment.substring(openingTag.length, cellFragment.lastIndexOf('<')).trim() // Removing whitespaces from the start and the end of HTML fragment
140
+ .replaceAll(/\n\s+/g, ' ') // HTML tags may be split using multiple new lines and whitespaces
141
+ .replaceAll(paragraphRegexp, '\n') // Only paragraphs should split text using new line characters
142
+ .replace('\n', '') // First paragraph shouldn't start with new line characters
143
+ .replaceAll(/<\/(.*)>\s+$/mg, '</$1>') // HTML tags may end with whitespace.
144
+ .replace(/(<(?!br)([^>]+)>)/gi, '') // Removing HTML tags
145
+ .replaceAll(/^&nbsp;$/mg, ''); // Removing single &nbsp; characters separating new lines
138
146
  const closingTag = '</td>';
139
147
  return `${openingTag}${cellValue}${closingTag}`;
140
148
  });