handsontable 14.3.0 → 14.4.0-next-0a79a1f-20240521

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. package/3rdparty/walkontable/src/calculator/viewportRows.js +3 -3
  2. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +3 -3
  3. package/3rdparty/walkontable/src/core/_base.js +1 -1
  4. package/3rdparty/walkontable/src/core/_base.mjs +1 -1
  5. package/3rdparty/walkontable/src/overlay/_base.js +24 -20
  6. package/3rdparty/walkontable/src/overlay/_base.mjs +24 -20
  7. package/3rdparty/walkontable/src/overlay/bottom.js +3 -6
  8. package/3rdparty/walkontable/src/overlay/bottom.mjs +3 -6
  9. package/3rdparty/walkontable/src/overlay/inlineStart.js +22 -19
  10. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +22 -19
  11. package/3rdparty/walkontable/src/overlay/top.js +13 -12
  12. package/3rdparty/walkontable/src/overlay/top.mjs +13 -12
  13. package/3rdparty/walkontable/src/overlays.js +46 -24
  14. package/3rdparty/walkontable/src/overlays.mjs +46 -24
  15. package/3rdparty/walkontable/src/selection/manager.js +7 -0
  16. package/3rdparty/walkontable/src/selection/manager.mjs +7 -0
  17. package/3rdparty/walkontable/src/selection/scanner.js +7 -0
  18. package/3rdparty/walkontable/src/selection/scanner.mjs +7 -0
  19. package/3rdparty/walkontable/src/table.js +10 -11
  20. package/3rdparty/walkontable/src/table.mjs +10 -11
  21. package/3rdparty/walkontable/src/utils/columnStretching.js +4 -0
  22. package/3rdparty/walkontable/src/utils/columnStretching.mjs +4 -0
  23. package/3rdparty/walkontable/src/viewport.js +18 -10
  24. package/3rdparty/walkontable/src/viewport.mjs +18 -10
  25. package/CHANGELOG.md +37 -0
  26. package/base.js +2 -2
  27. package/base.mjs +2 -2
  28. package/core.d.ts +2 -2
  29. package/core.js +93 -162
  30. package/core.mjs +93 -162
  31. package/dataMap/dataMap.js +10 -4
  32. package/dataMap/dataMap.mjs +10 -4
  33. package/dataMap/dataSource.js +16 -3
  34. package/dataMap/dataSource.mjs +16 -3
  35. package/dataMap/metaManager/lazyFactoryMap.js +7 -0
  36. package/dataMap/metaManager/lazyFactoryMap.mjs +7 -0
  37. package/dataMap/metaManager/metaSchema.js +38 -0
  38. package/dataMap/metaManager/metaSchema.mjs +38 -0
  39. package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -0
  40. package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -0
  41. package/dataMap/metaManager/mods/extendMetaProperties.js +44 -31
  42. package/dataMap/metaManager/mods/extendMetaProperties.mjs +44 -31
  43. package/dataMap/metaManager/utils.js +7 -0
  44. package/dataMap/metaManager/utils.mjs +7 -0
  45. package/dist/handsontable.css +4 -5
  46. package/dist/handsontable.full.css +4 -5
  47. package/dist/handsontable.full.js +5878 -4657
  48. package/dist/handsontable.full.min.css +4 -4
  49. package/dist/handsontable.full.min.js +59 -59
  50. package/dist/handsontable.js +5383 -4277
  51. package/dist/handsontable.min.css +4 -4
  52. package/dist/handsontable.min.js +20 -20
  53. package/editorManager.js +0 -67
  54. package/editorManager.mjs +0 -67
  55. package/editors/autocompleteEditor/autocompleteEditor.js +6 -4
  56. package/editors/autocompleteEditor/autocompleteEditor.mjs +6 -4
  57. package/editors/baseEditor/baseEditor.js +1 -36
  58. package/editors/baseEditor/baseEditor.mjs +2 -37
  59. package/editors/dateEditor/dateEditor.js +4 -1
  60. package/editors/dateEditor/dateEditor.mjs +4 -1
  61. package/editors/dropdownEditor/dropdownEditor.js +8 -5
  62. package/editors/dropdownEditor/dropdownEditor.mjs +8 -5
  63. package/editors/handsontableEditor/handsontableEditor.js +2 -2
  64. package/editors/handsontableEditor/handsontableEditor.mjs +2 -2
  65. package/editors/selectEditor/selectEditor.js +1 -9
  66. package/editors/selectEditor/selectEditor.mjs +1 -9
  67. package/editors/textEditor/textEditor.js +2 -11
  68. package/editors/textEditor/textEditor.mjs +2 -11
  69. package/focusManager.js +3 -5
  70. package/focusManager.mjs +3 -5
  71. package/helpers/array.js +7 -0
  72. package/helpers/array.mjs +7 -0
  73. package/helpers/mixed.js +2 -2
  74. package/helpers/mixed.mjs +2 -2
  75. package/helpers/number.js +12 -2
  76. package/helpers/number.mjs +12 -2
  77. package/package.json +3 -3
  78. package/pluginHooks.d.ts +1 -1
  79. package/pluginHooks.js +79 -2
  80. package/pluginHooks.mjs +79 -2
  81. package/plugins/autoColumnSize/autoColumnSize.js +7 -0
  82. package/plugins/autoColumnSize/autoColumnSize.mjs +7 -0
  83. package/plugins/autoRowSize/autoRowSize.js +2 -2
  84. package/plugins/autoRowSize/autoRowSize.mjs +2 -2
  85. package/plugins/autofill/autofill.js +1 -1
  86. package/plugins/autofill/autofill.mjs +1 -1
  87. package/plugins/base/base.d.ts +1 -1
  88. package/plugins/base/base.js +6 -2
  89. package/plugins/base/base.mjs +6 -2
  90. package/plugins/collapsibleColumns/collapsibleColumns.js +1 -1
  91. package/plugins/collapsibleColumns/collapsibleColumns.mjs +1 -1
  92. package/plugins/columnSorting/sortFunction/date.js +2 -46
  93. package/plugins/columnSorting/sortFunction/date.mjs +2 -45
  94. package/plugins/columnSorting/sortFunction/time.js +17 -0
  95. package/plugins/columnSorting/sortFunction/time.mjs +13 -0
  96. package/plugins/columnSorting/sortService/registry.js +4 -2
  97. package/plugins/columnSorting/sortService/registry.mjs +3 -1
  98. package/plugins/columnSorting/utils.js +64 -0
  99. package/plugins/columnSorting/utils.mjs +62 -0
  100. package/plugins/columnSummary/columnSummary.js +27 -10
  101. package/plugins/columnSummary/columnSummary.mjs +27 -10
  102. package/plugins/columnSummary/endpoints.js +15 -0
  103. package/plugins/columnSummary/endpoints.mjs +15 -0
  104. package/plugins/comments/comments.js +2 -8
  105. package/plugins/comments/comments.mjs +2 -8
  106. package/plugins/comments/contextMenuItem/addEditComment.js +0 -1
  107. package/plugins/comments/contextMenuItem/addEditComment.mjs +0 -1
  108. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  109. package/plugins/copyPaste/copyPaste.js +9 -2
  110. package/plugins/copyPaste/copyPaste.mjs +9 -2
  111. package/plugins/copyPaste/pasteEvent.js +1 -0
  112. package/plugins/copyPaste/pasteEvent.mjs +1 -0
  113. package/plugins/filters/filters.js +1 -1
  114. package/plugins/filters/filters.mjs +1 -1
  115. package/plugins/filters/ui/multipleSelect.js +22 -14
  116. package/plugins/filters/ui/multipleSelect.mjs +22 -14
  117. package/plugins/filters/utils.js +7 -0
  118. package/plugins/filters/utils.mjs +7 -0
  119. package/plugins/formulas/formulas.d.ts +10 -0
  120. package/plugins/formulas/formulas.js +11 -2
  121. package/plugins/formulas/formulas.mjs +11 -2
  122. package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +1 -1
  123. package/plugins/hiddenColumns/contextMenuItem/hideColumn.mjs +1 -1
  124. package/plugins/hiddenColumns/contextMenuItem/showColumn.js +1 -1
  125. package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +1 -1
  126. package/plugins/hiddenColumns/hiddenColumns.js +8 -1
  127. package/plugins/hiddenColumns/hiddenColumns.mjs +8 -1
  128. package/plugins/hiddenRows/contextMenuItem/hideRow.js +1 -1
  129. package/plugins/hiddenRows/contextMenuItem/hideRow.mjs +1 -1
  130. package/plugins/hiddenRows/contextMenuItem/showRow.js +1 -1
  131. package/plugins/hiddenRows/contextMenuItem/showRow.mjs +1 -1
  132. package/plugins/hiddenRows/hiddenRows.js +7 -0
  133. package/plugins/hiddenRows/hiddenRows.mjs +7 -0
  134. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
  135. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
  136. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
  137. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
  138. package/plugins/manualColumnMove/manualColumnMove.js +1 -1
  139. package/plugins/manualColumnMove/manualColumnMove.mjs +1 -1
  140. package/plugins/manualColumnResize/manualColumnResize.js +3 -3
  141. package/plugins/manualColumnResize/manualColumnResize.mjs +3 -3
  142. package/plugins/manualRowMove/manualRowMove.js +1 -1
  143. package/plugins/manualRowMove/manualRowMove.mjs +1 -1
  144. package/plugins/manualRowResize/manualRowResize.d.ts +1 -0
  145. package/plugins/manualRowResize/manualRowResize.js +11 -2
  146. package/plugins/manualRowResize/manualRowResize.mjs +11 -2
  147. package/plugins/mergeCells/cellsCollection.js +7 -0
  148. package/plugins/mergeCells/cellsCollection.mjs +7 -0
  149. package/plugins/mergeCells/mergeCells.js +7 -0
  150. package/plugins/mergeCells/mergeCells.mjs +7 -0
  151. package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.js +7 -0
  152. package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.mjs +7 -0
  153. package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.js +7 -0
  154. package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.mjs +7 -0
  155. package/plugins/nestedRows/nestedRows.js +7 -0
  156. package/plugins/nestedRows/nestedRows.mjs +7 -0
  157. package/plugins/trimRows/trimRows.js +7 -0
  158. package/plugins/trimRows/trimRows.mjs +7 -0
  159. package/selection/selection.js +163 -4
  160. package/selection/selection.mjs +163 -4
  161. package/selection/utils.js +7 -0
  162. package/selection/utils.mjs +7 -0
  163. package/settings.d.ts +1 -0
  164. package/shortcutContexts/commands/editor/closeAndSave.js +2 -3
  165. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -3
  166. package/shortcutContexts/commands/editor/closeAndSaveByArrowKeys.js +27 -0
  167. package/shortcutContexts/commands/editor/closeAndSaveByArrowKeys.mjs +24 -0
  168. package/shortcutContexts/commands/editor/closeAndSaveByEnter.js +11 -0
  169. package/shortcutContexts/commands/editor/closeAndSaveByEnter.mjs +8 -0
  170. package/shortcutContexts/commands/editor/index.js +3 -1
  171. package/shortcutContexts/commands/editor/index.mjs +3 -1
  172. package/shortcutContexts/editor.js +9 -1
  173. package/shortcutContexts/editor.mjs +9 -1
  174. package/shortcutContexts/index.js +1 -1
  175. package/shortcutContexts/index.mjs +1 -1
  176. package/shortcuts/keyObserver.js +7 -0
  177. package/shortcuts/keyObserver.mjs +7 -0
  178. package/shortcuts/utils.js +7 -0
  179. package/shortcuts/utils.mjs +7 -0
  180. package/tableView.js +1 -4
  181. package/tableView.mjs +1 -4
  182. package/translations/changesObservable/observable.js +7 -0
  183. package/translations/changesObservable/observable.mjs +7 -0
  184. package/translations/indexMapper.js +7 -0
  185. package/translations/indexMapper.mjs +8 -1
  186. package/utils/dataStructures/uniqueSet.js +7 -0
  187. package/utils/dataStructures/uniqueSet.mjs +7 -0
  188. package/utils/ghostTable.js +0 -4
  189. package/utils/ghostTable.mjs +0 -4
  190. package/utils/paginator.js +7 -0
  191. package/utils/paginator.mjs +7 -0
  192. package/validators/dateValidator/dateValidator.js +1 -3
  193. package/validators/dateValidator/dateValidator.mjs +1 -3
  194. package/validators/timeValidator/timeValidator.js +1 -3
  195. package/validators/timeValidator/timeValidator.mjs +1 -3
@@ -99,6 +99,7 @@ class ViewportRowsCalculator {
99
99
  } = _classPrivateFieldGet(_options, this);
100
100
  const zeroBasedScrollOffset = Math.max(_classPrivateFieldGet(_options, this).scrollOffset, 0);
101
101
  const horizontalScrollbarHeight = _classPrivateFieldGet(_options, this).horizontalScrollbarHeight || 0;
102
+ const innerViewportHeight = zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight;
102
103
  let sum = 0;
103
104
  let needReverse = true;
104
105
  const startPositions = [];
@@ -116,8 +117,7 @@ class ViewportRowsCalculator {
116
117
  this.startRow = i;
117
118
  firstVisibleRowHeight = rowHeight;
118
119
  }
119
- if (sum >= zeroBasedScrollOffset && sum + (calculationType === _constants.FULLY_VISIBLE_TYPE ? rowHeight : 0) <= zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight) {
120
- // eslint-disable-line max-len
120
+ if (sum >= zeroBasedScrollOffset && sum + (calculationType === _constants.FULLY_VISIBLE_TYPE ? rowHeight : 0) <= innerViewportHeight) {
121
121
  if (this.startRow === null) {
122
122
  this.startRow = i;
123
123
  firstVisibleRowHeight = rowHeight;
@@ -130,7 +130,7 @@ class ViewportRowsCalculator {
130
130
  if (calculationType !== _constants.FULLY_VISIBLE_TYPE) {
131
131
  this.endRow = i;
132
132
  }
133
- if (sum >= zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight) {
133
+ if (sum >= innerViewportHeight) {
134
134
  needReverse = false;
135
135
  break;
136
136
  }
@@ -96,6 +96,7 @@ export class ViewportRowsCalculator {
96
96
  } = _classPrivateFieldGet(_options, this);
97
97
  const zeroBasedScrollOffset = Math.max(_classPrivateFieldGet(_options, this).scrollOffset, 0);
98
98
  const horizontalScrollbarHeight = _classPrivateFieldGet(_options, this).horizontalScrollbarHeight || 0;
99
+ const innerViewportHeight = zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight;
99
100
  let sum = 0;
100
101
  let needReverse = true;
101
102
  const startPositions = [];
@@ -113,8 +114,7 @@ export class ViewportRowsCalculator {
113
114
  this.startRow = i;
114
115
  firstVisibleRowHeight = rowHeight;
115
116
  }
116
- if (sum >= zeroBasedScrollOffset && sum + (calculationType === FULLY_VISIBLE_TYPE ? rowHeight : 0) <= zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight) {
117
- // eslint-disable-line max-len
117
+ if (sum >= zeroBasedScrollOffset && sum + (calculationType === FULLY_VISIBLE_TYPE ? rowHeight : 0) <= innerViewportHeight) {
118
118
  if (this.startRow === null) {
119
119
  this.startRow = i;
120
120
  firstVisibleRowHeight = rowHeight;
@@ -127,7 +127,7 @@ export class ViewportRowsCalculator {
127
127
  if (calculationType !== FULLY_VISIBLE_TYPE) {
128
128
  this.endRow = i;
129
129
  }
130
- if (sum >= zeroBasedScrollOffset + viewportHeight - horizontalScrollbarHeight) {
130
+ if (sum >= innerViewportHeight) {
131
131
  needReverse = false;
132
132
  break;
133
133
  }
@@ -114,7 +114,7 @@ class CoreAbstract {
114
114
  draw() {
115
115
  let fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
116
116
  this.drawInterrupted = false;
117
- if (!fastDraw && !this.wtTable.isVisible()) {
117
+ if (!this.wtTable.isVisible()) {
118
118
  // draw interrupted because TABLE is not visible
119
119
  this.drawInterrupted = true;
120
120
  } else {
@@ -110,7 +110,7 @@ export default class CoreAbstract {
110
110
  draw() {
111
111
  let fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
112
112
  this.drawInterrupted = false;
113
- if (!fastDraw && !this.wtTable.isVisible()) {
113
+ if (!this.wtTable.isVisible()) {
114
114
  // draw interrupted because TABLE is not visible
115
115
  this.drawInterrupted = true;
116
116
  } else {
@@ -4,7 +4,6 @@ exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  var _element = require("../../../../helpers/dom/element");
6
6
  var _object = require("../../../../helpers/object");
7
- var _array = require("../../../../helpers/array");
8
7
  var _console = require("../../../../helpers/console");
9
8
  var _constants = require("./constants");
10
9
  var _clone = _interopRequireDefault(require("../core/clone"));
@@ -61,24 +60,35 @@ class Overlay {
61
60
  this.holder = holder;
62
61
  this.wtRootElement = wtRootElement;
63
62
  this.trimmingContainer = (0, _element.getTrimmingContainer)(this.hider.parentNode.parentNode);
64
- this.updateStateOfRendering();
63
+ this.needFullRender = this.shouldBeRendered();
65
64
  this.clone = this.makeClone();
66
65
  }
67
66
 
68
67
  /**
69
- * Update internal state of object with an information about the need of full rendering of the overlay.
68
+ * Checks if the overlay rendering state has changed.
70
69
  *
71
- * @returns {boolean} Returns `true` if the state has changed since the last check.
70
+ * @returns {boolean}
72
71
  */
73
- updateStateOfRendering() {
74
- // todo refactoring: conceive introducing final state machine, normal -> changed (once) -> needs-full-render -> ...? -> normal
75
- const previousState = this.needFullRender;
76
- this.needFullRender = this.shouldBeRendered();
77
- const changed = previousState !== this.needFullRender;
78
- if (changed && !this.needFullRender) {
79
- this.reset();
72
+ hasRenderingStateChanged() {
73
+ return this.needFullRender !== this.shouldBeRendered();
74
+ }
75
+
76
+ /**
77
+ * Updates internal state with an information about the need of full rendering of the overlay in the next draw cycles.
78
+ *
79
+ * If the state is changed to render the overlay, the `needFullRender` property is set to `true` which means that
80
+ * the overlay will be fully rendered in the current draw cycle. If the state is changed to not render the overlay,
81
+ * the `needFullRender` property is set to `false` which means that the overlay will be fully rendered in the
82
+ * current draw cycle but it will not be rendered in the next draw cycles.
83
+ *
84
+ * @param {'before' | 'after'} drawPhase The phase of the rendering process.
85
+ */
86
+ updateStateOfRendering(drawPhase) {
87
+ if (drawPhase === 'before' && this.shouldBeRendered()) {
88
+ this.needFullRender = true;
89
+ } else if (drawPhase === 'after' && !this.shouldBeRendered()) {
90
+ this.needFullRender = false;
80
91
  }
81
- return changed;
82
92
  }
83
93
 
84
94
  /**
@@ -305,27 +315,21 @@ class Overlay {
305
315
  */
306
316
  refresh() {
307
317
  let fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
308
- // When hot settings are changed we allow to refresh overlay once before blocking
309
- const nextCycleRenderFlag = this.shouldBeRendered();
310
- if (this.clone && (this.needFullRender || nextCycleRenderFlag)) {
318
+ if (this.needFullRender) {
311
319
  this.clone.draw(fastDraw);
312
320
  }
313
- this.needFullRender = nextCycleRenderFlag;
314
321
  }
315
322
 
316
323
  /**
317
324
  * Reset overlay styles to initial values.
318
325
  */
319
326
  reset() {
320
- if (!this.clone) {
321
- return;
322
- }
323
327
  const holder = this.clone.wtTable.holder; // todo refactoring: DEMETER
324
328
  const hider = this.clone.wtTable.hider; // todo refactoring: DEMETER
325
329
  const holderStyle = holder.style;
326
330
  const hiderStyle = hider.style;
327
331
  const rootStyle = holder.parentNode.style;
328
- (0, _array.arrayEach)([holderStyle, hiderStyle, rootStyle], style => {
332
+ [holderStyle, hiderStyle, rootStyle].forEach(style => {
329
333
  style.width = '';
330
334
  style.height = '';
331
335
  });
@@ -4,7 +4,6 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
4
4
  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); }
5
5
  import { getScrollableElement, getTrimmingContainer, getScrollbarWidth, setAttribute } from "../../../../helpers/dom/element.mjs";
6
6
  import { defineGetter } from "../../../../helpers/object.mjs";
7
- import { arrayEach } from "../../../../helpers/array.mjs";
8
7
  import { warn } from "../../../../helpers/console.mjs";
9
8
  import { CLONE_TYPES, CLONE_CLASS_NAMES, CLONE_TOP, CLONE_INLINE_START } from "./constants.mjs";
10
9
  import Clone from "../core/clone.mjs";
@@ -57,24 +56,35 @@ export class Overlay {
57
56
  this.holder = holder;
58
57
  this.wtRootElement = wtRootElement;
59
58
  this.trimmingContainer = getTrimmingContainer(this.hider.parentNode.parentNode);
60
- this.updateStateOfRendering();
59
+ this.needFullRender = this.shouldBeRendered();
61
60
  this.clone = this.makeClone();
62
61
  }
63
62
 
64
63
  /**
65
- * Update internal state of object with an information about the need of full rendering of the overlay.
64
+ * Checks if the overlay rendering state has changed.
66
65
  *
67
- * @returns {boolean} Returns `true` if the state has changed since the last check.
66
+ * @returns {boolean}
68
67
  */
69
- updateStateOfRendering() {
70
- // todo refactoring: conceive introducing final state machine, normal -> changed (once) -> needs-full-render -> ...? -> normal
71
- const previousState = this.needFullRender;
72
- this.needFullRender = this.shouldBeRendered();
73
- const changed = previousState !== this.needFullRender;
74
- if (changed && !this.needFullRender) {
75
- this.reset();
68
+ hasRenderingStateChanged() {
69
+ return this.needFullRender !== this.shouldBeRendered();
70
+ }
71
+
72
+ /**
73
+ * Updates internal state with an information about the need of full rendering of the overlay in the next draw cycles.
74
+ *
75
+ * If the state is changed to render the overlay, the `needFullRender` property is set to `true` which means that
76
+ * the overlay will be fully rendered in the current draw cycle. If the state is changed to not render the overlay,
77
+ * the `needFullRender` property is set to `false` which means that the overlay will be fully rendered in the
78
+ * current draw cycle but it will not be rendered in the next draw cycles.
79
+ *
80
+ * @param {'before' | 'after'} drawPhase The phase of the rendering process.
81
+ */
82
+ updateStateOfRendering(drawPhase) {
83
+ if (drawPhase === 'before' && this.shouldBeRendered()) {
84
+ this.needFullRender = true;
85
+ } else if (drawPhase === 'after' && !this.shouldBeRendered()) {
86
+ this.needFullRender = false;
76
87
  }
77
- return changed;
78
88
  }
79
89
 
80
90
  /**
@@ -301,27 +311,21 @@ export class Overlay {
301
311
  */
302
312
  refresh() {
303
313
  let fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
304
- // When hot settings are changed we allow to refresh overlay once before blocking
305
- const nextCycleRenderFlag = this.shouldBeRendered();
306
- if (this.clone && (this.needFullRender || nextCycleRenderFlag)) {
314
+ if (this.needFullRender) {
307
315
  this.clone.draw(fastDraw);
308
316
  }
309
- this.needFullRender = nextCycleRenderFlag;
310
317
  }
311
318
 
312
319
  /**
313
320
  * Reset overlay styles to initial values.
314
321
  */
315
322
  reset() {
316
- if (!this.clone) {
317
- return;
318
- }
319
323
  const holder = this.clone.wtTable.holder; // todo refactoring: DEMETER
320
324
  const hider = this.clone.wtTable.hider; // todo refactoring: DEMETER
321
325
  const holderStyle = holder.style;
322
326
  const hiderStyle = hider.style;
323
327
  const rootStyle = holder.parentNode.style;
324
- arrayEach([holderStyle, hiderStyle, rootStyle], style => {
328
+ [holderStyle, hiderStyle, rootStyle].forEach(style => {
325
329
  style.width = '';
326
330
  style.height = '';
327
331
  });
@@ -61,7 +61,7 @@ class BottomOverlay extends _base.Overlay {
61
61
  * @returns {boolean}
62
62
  */
63
63
  resetFixedPosition() {
64
- if (!this.needFullRender || !this.wot.wtTable.holder.parentNode) {
64
+ if (!this.needFullRender || !this.shouldBeRendered() || !this.wot.wtTable.holder.parentNode) {
65
65
  // removed from DOM
66
66
  return false;
67
67
  }
@@ -158,14 +158,11 @@ class BottomOverlay extends _base.Overlay {
158
158
  }
159
159
 
160
160
  /**
161
- * Adjust overlay root element, childs and master table element sizes (width, height).
162
- *
163
- * @param {boolean} [force=false] When `true`, it adjusts the DOM nodes sizes for that overlay.
161
+ * Adjust overlay root element, children and master table element sizes (width, height).
164
162
  */
165
163
  adjustElementsSize() {
166
- let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
167
164
  this.updateTrimmingContainer();
168
- if (this.needFullRender || force) {
165
+ if (this.needFullRender) {
169
166
  this.adjustRootElementSize();
170
167
  this.adjustRootChildrenSize();
171
168
  }
@@ -57,7 +57,7 @@ export class BottomOverlay extends Overlay {
57
57
  * @returns {boolean}
58
58
  */
59
59
  resetFixedPosition() {
60
- if (!this.needFullRender || !this.wot.wtTable.holder.parentNode) {
60
+ if (!this.needFullRender || !this.shouldBeRendered() || !this.wot.wtTable.holder.parentNode) {
61
61
  // removed from DOM
62
62
  return false;
63
63
  }
@@ -154,14 +154,11 @@ export class BottomOverlay extends Overlay {
154
154
  }
155
155
 
156
156
  /**
157
- * Adjust overlay root element, childs and master table element sizes (width, height).
158
- *
159
- * @param {boolean} [force=false] When `true`, it adjusts the DOM nodes sizes for that overlay.
157
+ * Adjust overlay root element, children and master table element sizes (width, height).
160
158
  */
161
159
  adjustElementsSize() {
162
- let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
163
160
  this.updateTrimmingContainer();
164
- if (this.needFullRender || force) {
161
+ if (this.needFullRender) {
165
162
  this.adjustRootElementSize();
166
163
  this.adjustRootChildrenSize();
167
164
  }
@@ -54,7 +54,7 @@ class InlineStartOverlay extends _base.Overlay {
54
54
  const {
55
55
  wtTable
56
56
  } = this.wot;
57
- if (!this.needFullRender || !wtTable.holder.parentNode) {
57
+ if (!this.needFullRender || !this.shouldBeRendered() || !wtTable.holder.parentNode) {
58
58
  // removed from DOM
59
59
  return false;
60
60
  }
@@ -126,14 +126,11 @@ class InlineStartOverlay extends _base.Overlay {
126
126
  }
127
127
 
128
128
  /**
129
- * Adjust overlay root element, childs and master table element sizes (width, height).
130
- *
131
- * @param {boolean} [force=false] When `true`, it adjusts the DOM nodes sizes for that overlay.
129
+ * Adjust overlay root element, children and master table element sizes (width, height).
132
130
  */
133
131
  adjustElementsSize() {
134
- let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
135
132
  this.updateTrimmingContainer();
136
- if (this.needFullRender || force) {
133
+ if (this.needFullRender) {
137
134
  this.adjustRootElementSize();
138
135
  this.adjustRootChildrenSize();
139
136
  }
@@ -322,27 +319,33 @@ class InlineStartOverlay extends _base.Overlay {
322
319
  * @returns {boolean}
323
320
  */
324
321
  adjustHeaderBordersPosition(position) {
322
+ const {
323
+ wtSettings
324
+ } = this;
325
325
  const masterParent = this.wot.wtTable.holder.parentNode;
326
- const rowHeaders = this.wtSettings.getSetting('rowHeaders');
327
- const fixedColumnsStart = this.wtSettings.getSetting('fixedColumnsStart');
328
- const totalRows = this.wtSettings.getSetting('totalRows');
326
+ const rowHeaders = wtSettings.getSetting('rowHeaders');
327
+ const fixedColumnsStart = wtSettings.getSetting('fixedColumnsStart');
328
+ const totalRows = wtSettings.getSetting('totalRows');
329
+ const preventVerticalOverflow = wtSettings.getSetting('preventOverflow') === 'vertical';
329
330
  if (totalRows) {
330
331
  (0, _element.removeClass)(masterParent, 'emptyRows');
331
332
  } else {
332
333
  (0, _element.addClass)(masterParent, 'emptyRows');
333
334
  }
334
335
  let positionChanged = false;
335
- if (fixedColumnsStart && !rowHeaders.length) {
336
- // "innerBorderLeft" is for backward compatibility
337
- (0, _element.addClass)(masterParent, 'innerBorderLeft innerBorderInlineStart');
338
- } else if (!fixedColumnsStart && rowHeaders.length) {
339
- const previousState = (0, _element.hasClass)(masterParent, 'innerBorderInlineStart');
340
- if (position) {
336
+ if (!preventVerticalOverflow) {
337
+ if (fixedColumnsStart && !rowHeaders.length) {
338
+ // "innerBorderLeft" is for backward compatibility
341
339
  (0, _element.addClass)(masterParent, 'innerBorderLeft innerBorderInlineStart');
342
- positionChanged = !previousState;
343
- } else {
344
- (0, _element.removeClass)(masterParent, 'innerBorderLeft innerBorderInlineStart');
345
- positionChanged = previousState;
340
+ } else if (!fixedColumnsStart && rowHeaders.length) {
341
+ const previousState = (0, _element.hasClass)(masterParent, 'innerBorderInlineStart');
342
+ if (position) {
343
+ (0, _element.addClass)(masterParent, 'innerBorderLeft innerBorderInlineStart');
344
+ positionChanged = !previousState;
345
+ } else {
346
+ (0, _element.removeClass)(masterParent, 'innerBorderLeft innerBorderInlineStart');
347
+ positionChanged = previousState;
348
+ }
346
349
  }
347
350
  }
348
351
  return positionChanged;
@@ -50,7 +50,7 @@ export class InlineStartOverlay extends Overlay {
50
50
  const {
51
51
  wtTable
52
52
  } = this.wot;
53
- if (!this.needFullRender || !wtTable.holder.parentNode) {
53
+ if (!this.needFullRender || !this.shouldBeRendered() || !wtTable.holder.parentNode) {
54
54
  // removed from DOM
55
55
  return false;
56
56
  }
@@ -122,14 +122,11 @@ export class InlineStartOverlay extends Overlay {
122
122
  }
123
123
 
124
124
  /**
125
- * Adjust overlay root element, childs and master table element sizes (width, height).
126
- *
127
- * @param {boolean} [force=false] When `true`, it adjusts the DOM nodes sizes for that overlay.
125
+ * Adjust overlay root element, children and master table element sizes (width, height).
128
126
  */
129
127
  adjustElementsSize() {
130
- let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
131
128
  this.updateTrimmingContainer();
132
- if (this.needFullRender || force) {
129
+ if (this.needFullRender) {
133
130
  this.adjustRootElementSize();
134
131
  this.adjustRootChildrenSize();
135
132
  }
@@ -318,27 +315,33 @@ export class InlineStartOverlay extends Overlay {
318
315
  * @returns {boolean}
319
316
  */
320
317
  adjustHeaderBordersPosition(position) {
318
+ const {
319
+ wtSettings
320
+ } = this;
321
321
  const masterParent = this.wot.wtTable.holder.parentNode;
322
- const rowHeaders = this.wtSettings.getSetting('rowHeaders');
323
- const fixedColumnsStart = this.wtSettings.getSetting('fixedColumnsStart');
324
- const totalRows = this.wtSettings.getSetting('totalRows');
322
+ const rowHeaders = wtSettings.getSetting('rowHeaders');
323
+ const fixedColumnsStart = wtSettings.getSetting('fixedColumnsStart');
324
+ const totalRows = wtSettings.getSetting('totalRows');
325
+ const preventVerticalOverflow = wtSettings.getSetting('preventOverflow') === 'vertical';
325
326
  if (totalRows) {
326
327
  removeClass(masterParent, 'emptyRows');
327
328
  } else {
328
329
  addClass(masterParent, 'emptyRows');
329
330
  }
330
331
  let positionChanged = false;
331
- if (fixedColumnsStart && !rowHeaders.length) {
332
- // "innerBorderLeft" is for backward compatibility
333
- addClass(masterParent, 'innerBorderLeft innerBorderInlineStart');
334
- } else if (!fixedColumnsStart && rowHeaders.length) {
335
- const previousState = hasClass(masterParent, 'innerBorderInlineStart');
336
- if (position) {
332
+ if (!preventVerticalOverflow) {
333
+ if (fixedColumnsStart && !rowHeaders.length) {
334
+ // "innerBorderLeft" is for backward compatibility
337
335
  addClass(masterParent, 'innerBorderLeft innerBorderInlineStart');
338
- positionChanged = !previousState;
339
- } else {
340
- removeClass(masterParent, 'innerBorderLeft innerBorderInlineStart');
341
- positionChanged = previousState;
336
+ } else if (!fixedColumnsStart && rowHeaders.length) {
337
+ const previousState = hasClass(masterParent, 'innerBorderInlineStart');
338
+ if (position) {
339
+ addClass(masterParent, 'innerBorderLeft innerBorderInlineStart');
340
+ positionChanged = !previousState;
341
+ } else {
342
+ removeClass(masterParent, 'innerBorderLeft innerBorderInlineStart');
343
+ positionChanged = previousState;
344
+ }
342
345
  }
343
346
  }
344
347
  return positionChanged;
@@ -62,7 +62,7 @@ class TopOverlay extends _base.Overlay {
62
62
  * @returns {boolean}
63
63
  */
64
64
  resetFixedPosition() {
65
- if (!this.needFullRender || !this.wot.wtTable.holder.parentNode) {
65
+ if (!this.needFullRender || !this.shouldBeRendered() || !this.wot.wtTable.holder.parentNode) {
66
66
  // removed from DOM
67
67
  return false;
68
68
  }
@@ -150,14 +150,11 @@ class TopOverlay extends _base.Overlay {
150
150
  }
151
151
 
152
152
  /**
153
- * Adjust overlay root element, childs and master table element sizes (width, height).
154
- *
155
- * @param {boolean} [force=false] When `true`, it adjusts the DOM nodes sizes for that overlay.
153
+ * Adjust overlay root element, children and master table element sizes (width, height).
156
154
  */
157
155
  adjustElementsSize() {
158
- let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
159
156
  this.updateTrimmingContainer();
160
- if (this.needFullRender || force) {
157
+ if (this.needFullRender) {
161
158
  this.adjustRootElementSize();
162
159
  this.adjustRootChildrenSize();
163
160
  }
@@ -349,22 +346,26 @@ class TopOverlay extends _base.Overlay {
349
346
  */
350
347
  adjustHeaderBordersPosition(position) {
351
348
  let skipInnerBorderAdjusting = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
349
+ const {
350
+ wtSettings
351
+ } = this;
352
352
  const masterParent = this.wot.wtTable.holder.parentNode;
353
- const totalColumns = this.wtSettings.getSetting('totalColumns');
353
+ const totalColumns = wtSettings.getSetting('totalColumns');
354
+ const preventHorizontalOverflow = wtSettings.getSetting('preventOverflow') === 'horizontal';
354
355
  if (totalColumns) {
355
356
  (0, _element.removeClass)(masterParent, 'emptyColumns');
356
357
  } else {
357
358
  (0, _element.addClass)(masterParent, 'emptyColumns');
358
359
  }
359
360
  let positionChanged = false;
360
- if (!skipInnerBorderAdjusting) {
361
- const fixedRowsTop = this.wtSettings.getSetting('fixedRowsTop');
361
+ if (!skipInnerBorderAdjusting && !preventHorizontalOverflow) {
362
+ const fixedRowsTop = wtSettings.getSetting('fixedRowsTop');
362
363
  const areFixedRowsTopChanged = this.cachedFixedRowsTop !== fixedRowsTop;
363
- const columnHeaders = this.wtSettings.getSetting('columnHeaders');
364
+ const columnHeaders = wtSettings.getSetting('columnHeaders');
364
365
  if ((areFixedRowsTopChanged || fixedRowsTop === 0) && columnHeaders.length > 0) {
365
366
  const previousState = (0, _element.hasClass)(masterParent, 'innerBorderTop');
366
- this.cachedFixedRowsTop = this.wtSettings.getSetting('fixedRowsTop');
367
- if (position || this.wtSettings.getSetting('totalRows') === 0) {
367
+ this.cachedFixedRowsTop = wtSettings.getSetting('fixedRowsTop');
368
+ if (position || wtSettings.getSetting('totalRows') === 0) {
368
369
  (0, _element.addClass)(masterParent, 'innerBorderTop');
369
370
  positionChanged = !previousState;
370
371
  } else {
@@ -58,7 +58,7 @@ export class TopOverlay extends Overlay {
58
58
  * @returns {boolean}
59
59
  */
60
60
  resetFixedPosition() {
61
- if (!this.needFullRender || !this.wot.wtTable.holder.parentNode) {
61
+ if (!this.needFullRender || !this.shouldBeRendered() || !this.wot.wtTable.holder.parentNode) {
62
62
  // removed from DOM
63
63
  return false;
64
64
  }
@@ -146,14 +146,11 @@ export class TopOverlay extends Overlay {
146
146
  }
147
147
 
148
148
  /**
149
- * Adjust overlay root element, childs and master table element sizes (width, height).
150
- *
151
- * @param {boolean} [force=false] When `true`, it adjusts the DOM nodes sizes for that overlay.
149
+ * Adjust overlay root element, children and master table element sizes (width, height).
152
150
  */
153
151
  adjustElementsSize() {
154
- let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
155
152
  this.updateTrimmingContainer();
156
- if (this.needFullRender || force) {
153
+ if (this.needFullRender) {
157
154
  this.adjustRootElementSize();
158
155
  this.adjustRootChildrenSize();
159
156
  }
@@ -345,22 +342,26 @@ export class TopOverlay extends Overlay {
345
342
  */
346
343
  adjustHeaderBordersPosition(position) {
347
344
  let skipInnerBorderAdjusting = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
345
+ const {
346
+ wtSettings
347
+ } = this;
348
348
  const masterParent = this.wot.wtTable.holder.parentNode;
349
- const totalColumns = this.wtSettings.getSetting('totalColumns');
349
+ const totalColumns = wtSettings.getSetting('totalColumns');
350
+ const preventHorizontalOverflow = wtSettings.getSetting('preventOverflow') === 'horizontal';
350
351
  if (totalColumns) {
351
352
  removeClass(masterParent, 'emptyColumns');
352
353
  } else {
353
354
  addClass(masterParent, 'emptyColumns');
354
355
  }
355
356
  let positionChanged = false;
356
- if (!skipInnerBorderAdjusting) {
357
- const fixedRowsTop = this.wtSettings.getSetting('fixedRowsTop');
357
+ if (!skipInnerBorderAdjusting && !preventHorizontalOverflow) {
358
+ const fixedRowsTop = wtSettings.getSetting('fixedRowsTop');
358
359
  const areFixedRowsTopChanged = this.cachedFixedRowsTop !== fixedRowsTop;
359
- const columnHeaders = this.wtSettings.getSetting('columnHeaders');
360
+ const columnHeaders = wtSettings.getSetting('columnHeaders');
360
361
  if ((areFixedRowsTopChanged || fixedRowsTop === 0) && columnHeaders.length > 0) {
361
362
  const previousState = hasClass(masterParent, 'innerBorderTop');
362
- this.cachedFixedRowsTop = this.wtSettings.getSetting('fixedRowsTop');
363
- if (position || this.wtSettings.getSetting('totalRows') === 0) {
363
+ this.cachedFixedRowsTop = wtSettings.getSetting('fixedRowsTop');
364
+ if (position || wtSettings.getSetting('totalRows') === 0) {
364
365
  addClass(masterParent, 'innerBorderTop');
365
366
  positionChanged = !previousState;
366
367
  } else {