handsontable 14.3.0-next-dda3c4b-20240415 → 14.4.0-next-f62dd73-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 +56 -12
  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
@@ -9,12 +9,19 @@ var _array = require("../../../helpers/array");
9
9
  var _unicode = require("../../../helpers/unicode");
10
10
  var _browser = require("../../../helpers/browser");
11
11
  var _overlay = require("./overlay");
12
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
13
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
12
14
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
13
15
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
14
16
  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); }
17
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
18
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
19
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
15
20
  /**
16
21
  * @class Overlays
17
22
  */
23
+ var _overlays = /*#__PURE__*/new WeakMap();
24
+ var _hasRenderingStateChanged = /*#__PURE__*/new WeakMap();
18
25
  class Overlays {
19
26
  /**
20
27
  * @param {Walkontable} wotInstance The Walkontable instance. @todo refactoring remove.
@@ -32,6 +39,12 @@ class Overlays {
32
39
  * @type {Walkontable}
33
40
  */
34
41
  _defineProperty(this, "wot", null);
42
+ /**
43
+ * An array of the all overlays.
44
+ *
45
+ * @type {Overlay[]}
46
+ */
47
+ _classPrivateFieldInitSpec(this, _overlays, []);
35
48
  /**
36
49
  * Refer to the TopOverlay instance.
37
50
  *
@@ -81,6 +94,12 @@ class Overlays {
81
94
  * @type {Settings}
82
95
  */
83
96
  _defineProperty(this, "wtSettings", null);
97
+ /**
98
+ * Indicates whether the rendering state has changed for one of the overlays.
99
+ *
100
+ * @type {boolean}
101
+ */
102
+ _classPrivateFieldInitSpec(this, _hasRenderingStateChanged, false);
84
103
  /**
85
104
  * The instance of the ResizeObserver that observes the size of the Walkontable wrapper element.
86
105
  * In case of the size change detection the `onContainerElementResize` is fired.
@@ -140,7 +159,7 @@ class Overlays {
140
159
  */
141
160
  getOverlays() {
142
161
  let includeMaster = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
143
- const overlays = [this.topOverlay, this.topInlineStartCornerOverlay, this.inlineStartOverlay, this.bottomOverlay, this.bottomInlineStartCornerOverlay];
162
+ const overlays = [..._classPrivateFieldGet(_overlays, this)];
144
163
  if (includeMaster) {
145
164
  overlays.push(this.wtTable);
146
165
  }
@@ -185,29 +204,31 @@ class Overlays {
185
204
  // TODO cond. Has no any visual impact. They're initially hidden in same way like left, top, and bottom overlays.
186
205
  this.topInlineStartCornerOverlay = new _overlay.TopInlineStartCornerOverlay(...args, this.topOverlay, this.inlineStartOverlay);
187
206
  this.bottomInlineStartCornerOverlay = new _overlay.BottomInlineStartCornerOverlay(...args, this.bottomOverlay, this.inlineStartOverlay);
207
+ _classPrivateFieldSet(_overlays, this, [this.topOverlay, this.bottomOverlay, this.inlineStartOverlay, this.topInlineStartCornerOverlay, this.bottomInlineStartCornerOverlay]);
188
208
  }
189
209
 
190
210
  /**
191
- * Update state of rendering, check if changed.
192
- *
193
- * @package
194
- * @returns {boolean} Returns `true` if changes applied to overlay needs scroll synchronization.
211
+ * Runs logic for the overlays before the table is drawn.
195
212
  */
196
- updateStateOfRendering() {
197
- let syncScroll = this.topOverlay.updateStateOfRendering();
198
- syncScroll = this.bottomOverlay.updateStateOfRendering() || syncScroll;
199
- syncScroll = this.inlineStartOverlay.updateStateOfRendering() || syncScroll;
213
+ beforeDraw() {
214
+ _classPrivateFieldSet(_hasRenderingStateChanged, this, _classPrivateFieldGet(_overlays, this).reduce((acc, overlay) => {
215
+ return overlay.hasRenderingStateChanged() || acc;
216
+ }, false));
217
+ _classPrivateFieldGet(_overlays, this).forEach(overlay => overlay.updateStateOfRendering('before'));
218
+ }
200
219
 
201
- // todo refactoring: move conditions into updateStateOfRendering(),
202
- if (this.inlineStartOverlay.needFullRender) {
203
- if (this.topOverlay.needFullRender) {
204
- syncScroll = this.topInlineStartCornerOverlay.updateStateOfRendering() || syncScroll;
205
- }
206
- if (this.bottomOverlay.needFullRender) {
207
- syncScroll = this.bottomInlineStartCornerOverlay.updateStateOfRendering() || syncScroll;
220
+ /**
221
+ * Runs logic for the overlays after the table is drawn.
222
+ */
223
+ afterDraw() {
224
+ this.syncScrollWithMaster();
225
+ _classPrivateFieldGet(_overlays, this).forEach(overlay => {
226
+ const hasRenderingStateChanged = overlay.hasRenderingStateChanged();
227
+ overlay.updateStateOfRendering('after');
228
+ if (hasRenderingStateChanged && !overlay.needFullRender) {
229
+ overlay.reset();
208
230
  }
209
- }
210
- return syncScroll;
231
+ });
211
232
  }
212
233
 
213
234
  /**
@@ -447,6 +468,9 @@ class Overlays {
447
468
  * Synchronize overlay scrollbars with the master scrollbar.
448
469
  */
449
470
  syncScrollWithMaster() {
471
+ if (!_classPrivateFieldGet(_hasRenderingStateChanged, this)) {
472
+ return;
473
+ }
450
474
  const master = this.topOverlay.mainTableScrollableElement;
451
475
  const {
452
476
  scrollLeft,
@@ -461,6 +485,7 @@ class Overlays {
461
485
  if (this.inlineStartOverlay.needFullRender) {
462
486
  this.inlineStartOverlay.clone.wtTable.holder.scrollTop = scrollTop; // todo rethink, *overlay.setScroll*()
463
487
  }
488
+ _classPrivateFieldSet(_hasRenderingStateChanged, this, false);
464
489
  }
465
490
 
466
491
  /**
@@ -551,11 +576,8 @@ class Overlays {
551
576
 
552
577
  /**
553
578
  * Adjust overlays elements size and master table size.
554
- *
555
- * @param {boolean} [force=false] When `true`, it adjust the DOM nodes sizes for all overlays.
556
579
  */
557
580
  adjustElementsSize() {
558
- let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
559
581
  const {
560
582
  wtViewport
561
583
  } = this.wot;
@@ -605,9 +627,9 @@ class Overlays {
605
627
  this.hasScrollbarRight = true;
606
628
  }
607
629
  }
608
- this.topOverlay.adjustElementsSize(force);
609
- this.inlineStartOverlay.adjustElementsSize(force);
610
- this.bottomOverlay.adjustElementsSize(force);
630
+ this.topOverlay.adjustElementsSize();
631
+ this.inlineStartOverlay.adjustElementsSize();
632
+ this.bottomOverlay.adjustElementsSize();
611
633
  }
612
634
 
613
635
  /**
@@ -1,8 +1,13 @@
1
1
  import "core-js/modules/es.error.cause.js";
2
2
  import "core-js/modules/es.array.push.js";
3
+ function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
4
+ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
3
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
4
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
5
7
  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); }
8
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
9
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
10
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
6
11
  import { getScrollableElement, getScrollbarWidth } from "../../../helpers/dom/element.mjs";
7
12
  import { requestAnimationFrame } from "../../../helpers/feature.mjs";
8
13
  import { arrayEach } from "../../../helpers/array.mjs";
@@ -12,6 +17,8 @@ import { InlineStartOverlay, TopOverlay, TopInlineStartCornerOverlay, BottomOver
12
17
  /**
13
18
  * @class Overlays
14
19
  */
20
+ var _overlays = /*#__PURE__*/new WeakMap();
21
+ var _hasRenderingStateChanged = /*#__PURE__*/new WeakMap();
15
22
  class Overlays {
16
23
  /**
17
24
  * @param {Walkontable} wotInstance The Walkontable instance. @todo refactoring remove.
@@ -29,6 +36,12 @@ class Overlays {
29
36
  * @type {Walkontable}
30
37
  */
31
38
  _defineProperty(this, "wot", null);
39
+ /**
40
+ * An array of the all overlays.
41
+ *
42
+ * @type {Overlay[]}
43
+ */
44
+ _classPrivateFieldInitSpec(this, _overlays, []);
32
45
  /**
33
46
  * Refer to the TopOverlay instance.
34
47
  *
@@ -78,6 +91,12 @@ class Overlays {
78
91
  * @type {Settings}
79
92
  */
80
93
  _defineProperty(this, "wtSettings", null);
94
+ /**
95
+ * Indicates whether the rendering state has changed for one of the overlays.
96
+ *
97
+ * @type {boolean}
98
+ */
99
+ _classPrivateFieldInitSpec(this, _hasRenderingStateChanged, false);
81
100
  /**
82
101
  * The instance of the ResizeObserver that observes the size of the Walkontable wrapper element.
83
102
  * In case of the size change detection the `onContainerElementResize` is fired.
@@ -137,7 +156,7 @@ class Overlays {
137
156
  */
138
157
  getOverlays() {
139
158
  let includeMaster = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
140
- const overlays = [this.topOverlay, this.topInlineStartCornerOverlay, this.inlineStartOverlay, this.bottomOverlay, this.bottomInlineStartCornerOverlay];
159
+ const overlays = [..._classPrivateFieldGet(_overlays, this)];
141
160
  if (includeMaster) {
142
161
  overlays.push(this.wtTable);
143
162
  }
@@ -182,29 +201,31 @@ class Overlays {
182
201
  // TODO cond. Has no any visual impact. They're initially hidden in same way like left, top, and bottom overlays.
183
202
  this.topInlineStartCornerOverlay = new TopInlineStartCornerOverlay(...args, this.topOverlay, this.inlineStartOverlay);
184
203
  this.bottomInlineStartCornerOverlay = new BottomInlineStartCornerOverlay(...args, this.bottomOverlay, this.inlineStartOverlay);
204
+ _classPrivateFieldSet(_overlays, this, [this.topOverlay, this.bottomOverlay, this.inlineStartOverlay, this.topInlineStartCornerOverlay, this.bottomInlineStartCornerOverlay]);
185
205
  }
186
206
 
187
207
  /**
188
- * Update state of rendering, check if changed.
189
- *
190
- * @package
191
- * @returns {boolean} Returns `true` if changes applied to overlay needs scroll synchronization.
208
+ * Runs logic for the overlays before the table is drawn.
192
209
  */
193
- updateStateOfRendering() {
194
- let syncScroll = this.topOverlay.updateStateOfRendering();
195
- syncScroll = this.bottomOverlay.updateStateOfRendering() || syncScroll;
196
- syncScroll = this.inlineStartOverlay.updateStateOfRendering() || syncScroll;
210
+ beforeDraw() {
211
+ _classPrivateFieldSet(_hasRenderingStateChanged, this, _classPrivateFieldGet(_overlays, this).reduce((acc, overlay) => {
212
+ return overlay.hasRenderingStateChanged() || acc;
213
+ }, false));
214
+ _classPrivateFieldGet(_overlays, this).forEach(overlay => overlay.updateStateOfRendering('before'));
215
+ }
197
216
 
198
- // todo refactoring: move conditions into updateStateOfRendering(),
199
- if (this.inlineStartOverlay.needFullRender) {
200
- if (this.topOverlay.needFullRender) {
201
- syncScroll = this.topInlineStartCornerOverlay.updateStateOfRendering() || syncScroll;
202
- }
203
- if (this.bottomOverlay.needFullRender) {
204
- syncScroll = this.bottomInlineStartCornerOverlay.updateStateOfRendering() || syncScroll;
217
+ /**
218
+ * Runs logic for the overlays after the table is drawn.
219
+ */
220
+ afterDraw() {
221
+ this.syncScrollWithMaster();
222
+ _classPrivateFieldGet(_overlays, this).forEach(overlay => {
223
+ const hasRenderingStateChanged = overlay.hasRenderingStateChanged();
224
+ overlay.updateStateOfRendering('after');
225
+ if (hasRenderingStateChanged && !overlay.needFullRender) {
226
+ overlay.reset();
205
227
  }
206
- }
207
- return syncScroll;
228
+ });
208
229
  }
209
230
 
210
231
  /**
@@ -444,6 +465,9 @@ class Overlays {
444
465
  * Synchronize overlay scrollbars with the master scrollbar.
445
466
  */
446
467
  syncScrollWithMaster() {
468
+ if (!_classPrivateFieldGet(_hasRenderingStateChanged, this)) {
469
+ return;
470
+ }
447
471
  const master = this.topOverlay.mainTableScrollableElement;
448
472
  const {
449
473
  scrollLeft,
@@ -458,6 +482,7 @@ class Overlays {
458
482
  if (this.inlineStartOverlay.needFullRender) {
459
483
  this.inlineStartOverlay.clone.wtTable.holder.scrollTop = scrollTop; // todo rethink, *overlay.setScroll*()
460
484
  }
485
+ _classPrivateFieldSet(_hasRenderingStateChanged, this, false);
461
486
  }
462
487
 
463
488
  /**
@@ -548,11 +573,8 @@ class Overlays {
548
573
 
549
574
  /**
550
575
  * Adjust overlays elements size and master table size.
551
- *
552
- * @param {boolean} [force=false] When `true`, it adjust the DOM nodes sizes for all overlays.
553
576
  */
554
577
  adjustElementsSize() {
555
- let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
556
578
  const {
557
579
  wtViewport
558
580
  } = this.wot;
@@ -602,9 +624,9 @@ class Overlays {
602
624
  this.hasScrollbarRight = true;
603
625
  }
604
626
  }
605
- this.topOverlay.adjustElementsSize(force);
606
- this.inlineStartOverlay.adjustElementsSize(force);
607
- this.bottomOverlay.adjustElementsSize(force);
627
+ this.topOverlay.adjustElementsSize();
628
+ this.inlineStartOverlay.adjustElementsSize();
629
+ this.bottomOverlay.adjustElementsSize();
608
630
  }
609
631
 
610
632
  /**
@@ -4,6 +4,13 @@ exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  require("core-js/modules/es.array.push.js");
6
6
  require("core-js/modules/es.array.unscopables.flat.js");
7
+ require("core-js/modules/esnext.set.difference.v2.js");
8
+ require("core-js/modules/esnext.set.intersection.v2.js");
9
+ require("core-js/modules/esnext.set.is-disjoint-from.v2.js");
10
+ require("core-js/modules/esnext.set.is-subset-of.v2.js");
11
+ require("core-js/modules/esnext.set.is-superset-of.v2.js");
12
+ require("core-js/modules/esnext.set.symmetric-difference.v2.js");
13
+ require("core-js/modules/esnext.set.union.v2.js");
7
14
  var _element = require("../../../../helpers/dom/element");
8
15
  var _scanner2 = require("./scanner");
9
16
  var _border = _interopRequireDefault(require("./border/border"));
@@ -1,6 +1,13 @@
1
1
  import "core-js/modules/es.error.cause.js";
2
2
  import "core-js/modules/es.array.push.js";
3
3
  import "core-js/modules/es.array.unscopables.flat.js";
4
+ import "core-js/modules/esnext.set.difference.v2.js";
5
+ import "core-js/modules/esnext.set.intersection.v2.js";
6
+ import "core-js/modules/esnext.set.is-disjoint-from.v2.js";
7
+ import "core-js/modules/esnext.set.is-subset-of.v2.js";
8
+ import "core-js/modules/esnext.set.is-superset-of.v2.js";
9
+ import "core-js/modules/esnext.set.symmetric-difference.v2.js";
10
+ import "core-js/modules/esnext.set.union.v2.js";
4
11
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
5
12
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
6
13
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
@@ -2,6 +2,13 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
+ require("core-js/modules/esnext.set.difference.v2.js");
6
+ require("core-js/modules/esnext.set.intersection.v2.js");
7
+ require("core-js/modules/esnext.set.is-disjoint-from.v2.js");
8
+ require("core-js/modules/esnext.set.is-subset-of.v2.js");
9
+ require("core-js/modules/esnext.set.is-superset-of.v2.js");
10
+ require("core-js/modules/esnext.set.symmetric-difference.v2.js");
11
+ require("core-js/modules/esnext.set.union.v2.js");
5
12
  var _element = require("../../../../helpers/dom/element");
6
13
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
7
14
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
@@ -1,4 +1,11 @@
1
1
  import "core-js/modules/es.error.cause.js";
2
+ import "core-js/modules/esnext.set.difference.v2.js";
3
+ import "core-js/modules/esnext.set.intersection.v2.js";
4
+ import "core-js/modules/esnext.set.is-disjoint-from.v2.js";
5
+ import "core-js/modules/esnext.set.is-subset-of.v2.js";
6
+ import "core-js/modules/esnext.set.is-superset-of.v2.js";
7
+ import "core-js/modules/esnext.set.symmetric-difference.v2.js";
8
+ import "core-js/modules/esnext.set.union.v2.js";
2
9
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
3
10
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
4
11
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
@@ -251,7 +251,6 @@ class Table {
251
251
  const rowHeadersCount = rowHeaders.length;
252
252
  const columnHeaders = wtSettings.getSetting('columnHeaders');
253
253
  const columnHeadersCount = columnHeaders.length;
254
- let syncScroll = false;
255
254
  let runFastDraw = fastDraw;
256
255
  if (this.isMaster) {
257
256
  this.holderOffset = (0, _element.offset)(this.holder);
@@ -266,7 +265,7 @@ class Table {
266
265
  }
267
266
  }
268
267
  if (this.isMaster) {
269
- syncScroll = wtOverlays.updateStateOfRendering();
268
+ wtOverlays.beforeDraw();
270
269
  }
271
270
  if (runFastDraw) {
272
271
  if (this.isMaster) {
@@ -307,7 +306,7 @@ class Table {
307
306
  let workspaceWidth;
308
307
  if (this.isMaster) {
309
308
  workspaceWidth = this.dataAccessObject.workspaceWidth;
310
- this.dataAccessObject.wtViewport.containerWidth = null;
309
+ wtViewport.containerWidth = null;
311
310
  this.markOversizedColumnHeaders();
312
311
  }
313
312
  this.adjustColumnHeaderHeights();
@@ -315,10 +314,10 @@ class Table {
315
314
  this.markOversizedRows();
316
315
  }
317
316
  if (this.isMaster) {
318
- this.dataAccessObject.wtViewport.createVisibleCalculators();
319
- this.dataAccessObject.wtViewport.createPartiallyVisibleCalculators();
320
- this.dataAccessObject.wtOverlays.refresh(false);
321
- this.dataAccessObject.wtOverlays.applyToDOM();
317
+ wtViewport.createVisibleCalculators();
318
+ wtViewport.createPartiallyVisibleCalculators();
319
+ wtOverlays.refresh(false);
320
+ wtOverlays.applyToDOM();
322
321
  const hiderWidth = (0, _element.outerWidth)(this.hider);
323
322
  const tableWidth = (0, _element.outerWidth)(this.TABLE);
324
323
  if (hiderWidth !== 0 && tableWidth !== hiderWidth) {
@@ -326,9 +325,9 @@ class Table {
326
325
  this.columnUtils.calculateWidths();
327
326
  this.tableRenderer.renderer.colGroup.render();
328
327
  }
329
- if (workspaceWidth !== this.dataAccessObject.wtViewport.getWorkspaceWidth()) {
328
+ if (workspaceWidth !== wtViewport.getWorkspaceWidth()) {
330
329
  // workspace width changed though to shown/hidden vertical scrollbar. Let's reapply stretching
331
- this.dataAccessObject.wtViewport.containerWidth = null;
330
+ wtViewport.containerWidth = null;
332
331
  this.columnUtils.calculateWidths();
333
332
  this.tableRenderer.renderer.colGroup.render();
334
333
  }
@@ -361,8 +360,8 @@ class Table {
361
360
  } else {
362
361
  this.dataAccessObject.selectionManager.setActiveOverlay(this.facadeGetter()).render(runFastDraw);
363
362
  }
364
- if (syncScroll) {
365
- wtOverlays.syncScrollWithMaster();
363
+ if (this.isMaster) {
364
+ wtOverlays.afterDraw();
366
365
  }
367
366
  this.dataAccessObject.drawn = true;
368
367
  return this;
@@ -247,7 +247,6 @@ class Table {
247
247
  const rowHeadersCount = rowHeaders.length;
248
248
  const columnHeaders = wtSettings.getSetting('columnHeaders');
249
249
  const columnHeadersCount = columnHeaders.length;
250
- let syncScroll = false;
251
250
  let runFastDraw = fastDraw;
252
251
  if (this.isMaster) {
253
252
  this.holderOffset = offset(this.holder);
@@ -262,7 +261,7 @@ class Table {
262
261
  }
263
262
  }
264
263
  if (this.isMaster) {
265
- syncScroll = wtOverlays.updateStateOfRendering();
264
+ wtOverlays.beforeDraw();
266
265
  }
267
266
  if (runFastDraw) {
268
267
  if (this.isMaster) {
@@ -303,7 +302,7 @@ class Table {
303
302
  let workspaceWidth;
304
303
  if (this.isMaster) {
305
304
  workspaceWidth = this.dataAccessObject.workspaceWidth;
306
- this.dataAccessObject.wtViewport.containerWidth = null;
305
+ wtViewport.containerWidth = null;
307
306
  this.markOversizedColumnHeaders();
308
307
  }
309
308
  this.adjustColumnHeaderHeights();
@@ -311,10 +310,10 @@ class Table {
311
310
  this.markOversizedRows();
312
311
  }
313
312
  if (this.isMaster) {
314
- this.dataAccessObject.wtViewport.createVisibleCalculators();
315
- this.dataAccessObject.wtViewport.createPartiallyVisibleCalculators();
316
- this.dataAccessObject.wtOverlays.refresh(false);
317
- this.dataAccessObject.wtOverlays.applyToDOM();
313
+ wtViewport.createVisibleCalculators();
314
+ wtViewport.createPartiallyVisibleCalculators();
315
+ wtOverlays.refresh(false);
316
+ wtOverlays.applyToDOM();
318
317
  const hiderWidth = outerWidth(this.hider);
319
318
  const tableWidth = outerWidth(this.TABLE);
320
319
  if (hiderWidth !== 0 && tableWidth !== hiderWidth) {
@@ -322,9 +321,9 @@ class Table {
322
321
  this.columnUtils.calculateWidths();
323
322
  this.tableRenderer.renderer.colGroup.render();
324
323
  }
325
- if (workspaceWidth !== this.dataAccessObject.wtViewport.getWorkspaceWidth()) {
324
+ if (workspaceWidth !== wtViewport.getWorkspaceWidth()) {
326
325
  // workspace width changed though to shown/hidden vertical scrollbar. Let's reapply stretching
327
- this.dataAccessObject.wtViewport.containerWidth = null;
326
+ wtViewport.containerWidth = null;
328
327
  this.columnUtils.calculateWidths();
329
328
  this.tableRenderer.renderer.colGroup.render();
330
329
  }
@@ -357,8 +356,8 @@ class Table {
357
356
  } else {
358
357
  this.dataAccessObject.selectionManager.setActiveOverlay(this.facadeGetter()).render(runFastDraw);
359
358
  }
360
- if (syncScroll) {
361
- wtOverlays.syncScrollWithMaster();
359
+ if (this.isMaster) {
360
+ wtOverlays.afterDraw();
362
361
  }
363
362
  this.dataAccessObject.drawn = true;
364
363
  return this;
@@ -105,6 +105,10 @@ class ColumnStretching {
105
105
  if (_classPrivateFieldGet(_stretchMode, this).call(this) === 'none') {
106
106
  return;
107
107
  }
108
+ this.stretchAllRatio = 0;
109
+ this.stretchAllColumnsWidth = [];
110
+ this.needVerifyLastColumnWidth = true;
111
+ this.stretchLastWidth = 0;
108
112
  _classPrivateFieldSet(_totalTargetWidth, this, totalWidth);
109
113
  let sumAll = 0;
110
114
  for (let i = 0; i < _classPrivateFieldGet(_totalColumns, this).call(this); i++) {
@@ -102,6 +102,10 @@ export class ColumnStretching {
102
102
  if (_classPrivateFieldGet(_stretchMode, this).call(this) === 'none') {
103
103
  return;
104
104
  }
105
+ this.stretchAllRatio = 0;
106
+ this.stretchAllColumnsWidth = [];
107
+ this.needVerifyLastColumnWidth = true;
108
+ this.stretchLastWidth = 0;
105
109
  _classPrivateFieldSet(_totalTargetWidth, this, totalWidth);
106
110
  let sumAll = 0;
107
111
  for (let i = 0; i < _classPrivateFieldGet(_totalColumns, this).call(this); i++) {
@@ -398,15 +398,19 @@ class Viewport {
398
398
  if (!this.rowsVisibleCalculator) {
399
399
  return false;
400
400
  }
401
- const {
401
+ let {
402
402
  startRow,
403
- endRow,
404
- isVisibleInTrimmingContainer
403
+ endRow
405
404
  } = proposedRowsVisibleCalculator;
406
405
 
407
- // if there are no fully visible rows at all, return false
406
+ // if there are no fully visible rows at all...
408
407
  if (startRow === null && endRow === null) {
409
- return !isVisibleInTrimmingContainer;
408
+ if (!proposedRowsVisibleCalculator.isVisibleInTrimmingContainer) {
409
+ return true;
410
+ }
411
+ // ...use partially visible rows calculator to determine what render type is needed
412
+ startRow = this.rowsPartiallyVisibleCalculator.startRow;
413
+ endRow = this.rowsPartiallyVisibleCalculator.endRow;
410
414
  }
411
415
  const {
412
416
  startRow: renderedStartRow,
@@ -432,15 +436,19 @@ class Viewport {
432
436
  if (!this.columnsVisibleCalculator) {
433
437
  return false;
434
438
  }
435
- const {
439
+ let {
436
440
  startColumn,
437
- endColumn,
438
- isVisibleInTrimmingContainer
441
+ endColumn
439
442
  } = proposedColumnsVisibleCalculator;
440
443
 
441
- // if there are no fully visible columns at all, return false
444
+ // if there are no fully visible columns at all...
442
445
  if (startColumn === null && endColumn === null) {
443
- return !isVisibleInTrimmingContainer;
446
+ if (!proposedColumnsVisibleCalculator.isVisibleInTrimmingContainer) {
447
+ return true;
448
+ }
449
+ // ...use partially visible columns calculator to determine what render type is needed
450
+ startColumn = this.columnsPartiallyVisibleCalculator.startColumn;
451
+ endColumn = this.columnsPartiallyVisibleCalculator.endColumn;
444
452
  }
445
453
  const {
446
454
  startColumn: renderedStartColumn,
@@ -395,15 +395,19 @@ class Viewport {
395
395
  if (!this.rowsVisibleCalculator) {
396
396
  return false;
397
397
  }
398
- const {
398
+ let {
399
399
  startRow,
400
- endRow,
401
- isVisibleInTrimmingContainer
400
+ endRow
402
401
  } = proposedRowsVisibleCalculator;
403
402
 
404
- // if there are no fully visible rows at all, return false
403
+ // if there are no fully visible rows at all...
405
404
  if (startRow === null && endRow === null) {
406
- return !isVisibleInTrimmingContainer;
405
+ if (!proposedRowsVisibleCalculator.isVisibleInTrimmingContainer) {
406
+ return true;
407
+ }
408
+ // ...use partially visible rows calculator to determine what render type is needed
409
+ startRow = this.rowsPartiallyVisibleCalculator.startRow;
410
+ endRow = this.rowsPartiallyVisibleCalculator.endRow;
407
411
  }
408
412
  const {
409
413
  startRow: renderedStartRow,
@@ -429,15 +433,19 @@ class Viewport {
429
433
  if (!this.columnsVisibleCalculator) {
430
434
  return false;
431
435
  }
432
- const {
436
+ let {
433
437
  startColumn,
434
- endColumn,
435
- isVisibleInTrimmingContainer
438
+ endColumn
436
439
  } = proposedColumnsVisibleCalculator;
437
440
 
438
- // if there are no fully visible columns at all, return false
441
+ // if there are no fully visible columns at all...
439
442
  if (startColumn === null && endColumn === null) {
440
- return !isVisibleInTrimmingContainer;
443
+ if (!proposedColumnsVisibleCalculator.isVisibleInTrimmingContainer) {
444
+ return true;
445
+ }
446
+ // ...use partially visible columns calculator to determine what render type is needed
447
+ startColumn = this.columnsPartiallyVisibleCalculator.startColumn;
448
+ endColumn = this.columnsPartiallyVisibleCalculator.endColumn;
441
449
  }
442
450
  const {
443
451
  startColumn: renderedStartColumn,