handsontable 0.0.0-next-3c2766c-20240422 → 0.0.0-next-442dd51-20240422
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +2 -2
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +2 -2
- package/3rdparty/walkontable/src/calculator/viewportRows.js +1 -1
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/_base.js +20 -24
- package/3rdparty/walkontable/src/overlay/_base.mjs +20 -24
- package/3rdparty/walkontable/src/overlay/bottom.js +6 -3
- package/3rdparty/walkontable/src/overlay/bottom.mjs +6 -3
- package/3rdparty/walkontable/src/overlay/inlineStart.js +6 -3
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +6 -3
- package/3rdparty/walkontable/src/overlay/top.js +6 -3
- package/3rdparty/walkontable/src/overlay/top.mjs +6 -3
- package/3rdparty/walkontable/src/overlays.js +24 -46
- package/3rdparty/walkontable/src/overlays.mjs +24 -46
- package/3rdparty/walkontable/src/selection/manager.js +0 -7
- package/3rdparty/walkontable/src/selection/manager.mjs +0 -7
- package/3rdparty/walkontable/src/selection/scanner.js +0 -7
- package/3rdparty/walkontable/src/selection/scanner.mjs +0 -7
- package/3rdparty/walkontable/src/table.js +11 -10
- package/3rdparty/walkontable/src/table.mjs +11 -10
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +0 -7
- package/core.mjs +0 -7
- package/dataMap/metaManager/lazyFactoryMap.js +0 -7
- package/dataMap/metaManager/lazyFactoryMap.mjs +0 -7
- package/dataMap/metaManager/mods/dynamicCellMeta.js +0 -7
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +0 -7
- package/dataMap/metaManager/mods/extendMetaProperties.js +31 -44
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +31 -44
- package/dataMap/metaManager/utils.js +0 -7
- package/dataMap/metaManager/utils.mjs +0 -7
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +3780 -10138
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +84 -276
- package/dist/handsontable.js +2522 -3361
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +18 -18
- package/helpers/array.js +0 -7
- package/helpers/array.mjs +0 -7
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/number.js +2 -12
- package/helpers/number.mjs +2 -12
- package/package.json +7 -5
- package/plugins/autoColumnSize/autoColumnSize.js +0 -7
- package/plugins/autoColumnSize/autoColumnSize.mjs +0 -7
- package/plugins/autoRowSize/autoRowSize.js +2 -2
- package/plugins/autoRowSize/autoRowSize.mjs +2 -2
- package/plugins/collapsibleColumns/collapsibleColumns.js +1 -1
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +1 -1
- package/plugins/columnSorting/utils.js +0 -7
- package/plugins/columnSorting/utils.mjs +0 -7
- package/plugins/comments/comments.js +8 -2
- package/plugins/comments/comments.mjs +8 -2
- package/plugins/filters/filters.js +1 -1
- package/plugins/filters/filters.mjs +1 -1
- package/plugins/filters/ui/multipleSelect.js +12 -15
- package/plugins/filters/ui/multipleSelect.mjs +12 -15
- package/plugins/filters/utils.js +0 -7
- package/plugins/filters/utils.mjs +0 -7
- package/plugins/formulas/formulas.js +0 -7
- package/plugins/formulas/formulas.mjs +0 -7
- package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +1 -1
- package/plugins/hiddenColumns/contextMenuItem/hideColumn.mjs +1 -1
- package/plugins/hiddenColumns/contextMenuItem/showColumn.js +1 -1
- package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +1 -1
- package/plugins/hiddenColumns/hiddenColumns.js +0 -7
- package/plugins/hiddenColumns/hiddenColumns.mjs +0 -7
- package/plugins/hiddenRows/contextMenuItem/hideRow.js +1 -1
- package/plugins/hiddenRows/contextMenuItem/hideRow.mjs +1 -1
- package/plugins/hiddenRows/contextMenuItem/showRow.js +1 -1
- package/plugins/hiddenRows/contextMenuItem/showRow.mjs +1 -1
- package/plugins/hiddenRows/hiddenRows.js +0 -7
- package/plugins/hiddenRows/hiddenRows.mjs +0 -7
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
- package/plugins/manualColumnMove/manualColumnMove.js +1 -1
- package/plugins/manualColumnMove/manualColumnMove.mjs +1 -1
- package/plugins/manualColumnResize/manualColumnResize.js +2 -2
- package/plugins/manualColumnResize/manualColumnResize.mjs +2 -2
- package/plugins/manualRowMove/manualRowMove.js +1 -1
- package/plugins/manualRowMove/manualRowMove.mjs +1 -1
- package/plugins/manualRowResize/manualRowResize.js +2 -2
- package/plugins/manualRowResize/manualRowResize.mjs +2 -2
- package/plugins/mergeCells/cellsCollection.js +0 -7
- package/plugins/mergeCells/cellsCollection.mjs +0 -7
- package/plugins/mergeCells/mergeCells.js +0 -7
- package/plugins/mergeCells/mergeCells.mjs +0 -7
- package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.js +0 -7
- package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.mjs +0 -7
- package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.js +0 -7
- package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.mjs +0 -7
- package/plugins/nestedRows/nestedRows.js +0 -7
- package/plugins/nestedRows/nestedRows.mjs +0 -7
- package/plugins/trimRows/trimRows.js +0 -7
- package/plugins/trimRows/trimRows.mjs +0 -7
- package/selection/selection.js +0 -7
- package/selection/selection.mjs +0 -7
- package/selection/utils.js +0 -7
- package/selection/utils.mjs +0 -7
- package/shortcuts/keyObserver.js +0 -7
- package/shortcuts/keyObserver.mjs +0 -7
- package/shortcuts/utils.js +0 -7
- package/shortcuts/utils.mjs +0 -7
- package/tableView.js +4 -1
- package/tableView.mjs +4 -1
- package/translations/changesObservable/observable.js +0 -7
- package/translations/changesObservable/observable.mjs +0 -7
- package/translations/indexMapper.js +0 -7
- package/translations/indexMapper.mjs +1 -8
- package/utils/dataStructures/uniqueSet.js +0 -7
- package/utils/dataStructures/uniqueSet.mjs +0 -7
- package/utils/paginator.js +0 -7
- package/utils/paginator.mjs +0 -7
@@ -137,9 +137,9 @@ class ViewportColumnsCalculator {
|
|
137
137
|
const inlineStartColumnOffset = calculationType === _constants.FULLY_VISIBLE_TYPE ? firstVisibleColumnWidth : 0;
|
138
138
|
if (
|
139
139
|
// the table is to the left of the viewport
|
140
|
-
mostRightScrollOffset < -1 * _classPrivateFieldGet(_options, this).inlineStartOffset || scrollOffset
|
140
|
+
mostRightScrollOffset < -1 * _classPrivateFieldGet(_options, this).inlineStartOffset || scrollOffset > startPositions.at(-1) + inlineEndColumnOffset ||
|
141
141
|
// the table is to the right of the viewport
|
142
|
-
-1 * _classPrivateFieldGet(_options, this).scrollOffset - _classPrivateFieldGet(_options, this).viewportWidth
|
142
|
+
-1 * _classPrivateFieldGet(_options, this).scrollOffset - _classPrivateFieldGet(_options, this).viewportWidth > -1 * inlineStartColumnOffset) {
|
143
143
|
this.isVisibleInTrimmingContainer = false;
|
144
144
|
} else {
|
145
145
|
this.isVisibleInTrimmingContainer = true;
|
@@ -134,9 +134,9 @@ export class ViewportColumnsCalculator {
|
|
134
134
|
const inlineStartColumnOffset = calculationType === FULLY_VISIBLE_TYPE ? firstVisibleColumnWidth : 0;
|
135
135
|
if (
|
136
136
|
// the table is to the left of the viewport
|
137
|
-
mostRightScrollOffset < -1 * _classPrivateFieldGet(_options, this).inlineStartOffset || scrollOffset
|
137
|
+
mostRightScrollOffset < -1 * _classPrivateFieldGet(_options, this).inlineStartOffset || scrollOffset > startPositions.at(-1) + inlineEndColumnOffset ||
|
138
138
|
// the table is to the right of the viewport
|
139
|
-
-1 * _classPrivateFieldGet(_options, this).scrollOffset - _classPrivateFieldGet(_options, this).viewportWidth
|
139
|
+
-1 * _classPrivateFieldGet(_options, this).scrollOffset - _classPrivateFieldGet(_options, this).viewportWidth > -1 * inlineStartColumnOffset) {
|
140
140
|
this.isVisibleInTrimmingContainer = false;
|
141
141
|
} else {
|
142
142
|
this.isVisibleInTrimmingContainer = true;
|
@@ -138,7 +138,7 @@ class ViewportRowsCalculator {
|
|
138
138
|
const mostBottomScrollOffset = scrollOffset + viewportHeight - horizontalScrollbarHeight;
|
139
139
|
const topRowOffset = calculationType === _constants.FULLY_VISIBLE_TYPE ? firstVisibleRowHeight : 0;
|
140
140
|
const bottomRowOffset = calculationType === _constants.FULLY_VISIBLE_TYPE ? 0 : lastVisibleRowHeight;
|
141
|
-
if (mostBottomScrollOffset
|
141
|
+
if (mostBottomScrollOffset < topRowOffset || scrollOffset > startPositions.at(-1) + bottomRowOffset) {
|
142
142
|
this.isVisibleInTrimmingContainer = false;
|
143
143
|
} else {
|
144
144
|
this.isVisibleInTrimmingContainer = true;
|
@@ -135,7 +135,7 @@ export class ViewportRowsCalculator {
|
|
135
135
|
const mostBottomScrollOffset = scrollOffset + viewportHeight - horizontalScrollbarHeight;
|
136
136
|
const topRowOffset = calculationType === FULLY_VISIBLE_TYPE ? firstVisibleRowHeight : 0;
|
137
137
|
const bottomRowOffset = calculationType === FULLY_VISIBLE_TYPE ? 0 : lastVisibleRowHeight;
|
138
|
-
if (mostBottomScrollOffset
|
138
|
+
if (mostBottomScrollOffset < topRowOffset || scrollOffset > startPositions.at(-1) + bottomRowOffset) {
|
139
139
|
this.isVisibleInTrimmingContainer = false;
|
140
140
|
} else {
|
141
141
|
this.isVisibleInTrimmingContainer = true;
|
@@ -4,6 +4,7 @@ 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");
|
7
8
|
var _console = require("../../../../helpers/console");
|
8
9
|
var _constants = require("./constants");
|
9
10
|
var _clone = _interopRequireDefault(require("../core/clone"));
|
@@ -60,35 +61,24 @@ class Overlay {
|
|
60
61
|
this.holder = holder;
|
61
62
|
this.wtRootElement = wtRootElement;
|
62
63
|
this.trimmingContainer = (0, _element.getTrimmingContainer)(this.hider.parentNode.parentNode);
|
63
|
-
this.
|
64
|
+
this.updateStateOfRendering();
|
64
65
|
this.clone = this.makeClone();
|
65
66
|
}
|
66
67
|
|
67
68
|
/**
|
68
|
-
*
|
69
|
+
* Update internal state of object with an information about the need of full rendering of the overlay.
|
69
70
|
*
|
70
|
-
* @returns {boolean}
|
71
|
+
* @returns {boolean} Returns `true` if the state has changed since the last check.
|
71
72
|
*/
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
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;
|
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();
|
91
80
|
}
|
81
|
+
return changed;
|
92
82
|
}
|
93
83
|
|
94
84
|
/**
|
@@ -315,21 +305,27 @@ class Overlay {
|
|
315
305
|
*/
|
316
306
|
refresh() {
|
317
307
|
let fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
318
|
-
|
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)) {
|
319
311
|
this.clone.draw(fastDraw);
|
320
312
|
}
|
313
|
+
this.needFullRender = nextCycleRenderFlag;
|
321
314
|
}
|
322
315
|
|
323
316
|
/**
|
324
317
|
* Reset overlay styles to initial values.
|
325
318
|
*/
|
326
319
|
reset() {
|
320
|
+
if (!this.clone) {
|
321
|
+
return;
|
322
|
+
}
|
327
323
|
const holder = this.clone.wtTable.holder; // todo refactoring: DEMETER
|
328
324
|
const hider = this.clone.wtTable.hider; // todo refactoring: DEMETER
|
329
325
|
const holderStyle = holder.style;
|
330
326
|
const hiderStyle = hider.style;
|
331
327
|
const rootStyle = holder.parentNode.style;
|
332
|
-
[holderStyle, hiderStyle, rootStyle]
|
328
|
+
(0, _array.arrayEach)([holderStyle, hiderStyle, rootStyle], style => {
|
333
329
|
style.width = '';
|
334
330
|
style.height = '';
|
335
331
|
});
|
@@ -4,6 +4,7 @@ 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";
|
7
8
|
import { warn } from "../../../../helpers/console.mjs";
|
8
9
|
import { CLONE_TYPES, CLONE_CLASS_NAMES, CLONE_TOP, CLONE_INLINE_START } from "./constants.mjs";
|
9
10
|
import Clone from "../core/clone.mjs";
|
@@ -56,35 +57,24 @@ export class Overlay {
|
|
56
57
|
this.holder = holder;
|
57
58
|
this.wtRootElement = wtRootElement;
|
58
59
|
this.trimmingContainer = getTrimmingContainer(this.hider.parentNode.parentNode);
|
59
|
-
this.
|
60
|
+
this.updateStateOfRendering();
|
60
61
|
this.clone = this.makeClone();
|
61
62
|
}
|
62
63
|
|
63
64
|
/**
|
64
|
-
*
|
65
|
+
* Update internal state of object with an information about the need of full rendering of the overlay.
|
65
66
|
*
|
66
|
-
* @returns {boolean}
|
67
|
+
* @returns {boolean} Returns `true` if the state has changed since the last check.
|
67
68
|
*/
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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;
|
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();
|
87
76
|
}
|
77
|
+
return changed;
|
88
78
|
}
|
89
79
|
|
90
80
|
/**
|
@@ -311,21 +301,27 @@ export class Overlay {
|
|
311
301
|
*/
|
312
302
|
refresh() {
|
313
303
|
let fastDraw = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
314
|
-
|
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)) {
|
315
307
|
this.clone.draw(fastDraw);
|
316
308
|
}
|
309
|
+
this.needFullRender = nextCycleRenderFlag;
|
317
310
|
}
|
318
311
|
|
319
312
|
/**
|
320
313
|
* Reset overlay styles to initial values.
|
321
314
|
*/
|
322
315
|
reset() {
|
316
|
+
if (!this.clone) {
|
317
|
+
return;
|
318
|
+
}
|
323
319
|
const holder = this.clone.wtTable.holder; // todo refactoring: DEMETER
|
324
320
|
const hider = this.clone.wtTable.hider; // todo refactoring: DEMETER
|
325
321
|
const holderStyle = holder.style;
|
326
322
|
const hiderStyle = hider.style;
|
327
323
|
const rootStyle = holder.parentNode.style;
|
328
|
-
[holderStyle, hiderStyle, rootStyle]
|
324
|
+
arrayEach([holderStyle, hiderStyle, rootStyle], style => {
|
329
325
|
style.width = '';
|
330
326
|
style.height = '';
|
331
327
|
});
|
@@ -61,7 +61,7 @@ class BottomOverlay extends _base.Overlay {
|
|
61
61
|
* @returns {boolean}
|
62
62
|
*/
|
63
63
|
resetFixedPosition() {
|
64
|
-
if (!this.needFullRender || !this.
|
64
|
+
if (!this.needFullRender || !this.wot.wtTable.holder.parentNode) {
|
65
65
|
// removed from DOM
|
66
66
|
return false;
|
67
67
|
}
|
@@ -158,11 +158,14 @@ class BottomOverlay extends _base.Overlay {
|
|
158
158
|
}
|
159
159
|
|
160
160
|
/**
|
161
|
-
* Adjust overlay root element,
|
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.
|
162
164
|
*/
|
163
165
|
adjustElementsSize() {
|
166
|
+
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
164
167
|
this.updateTrimmingContainer();
|
165
|
-
if (this.needFullRender) {
|
168
|
+
if (this.needFullRender || force) {
|
166
169
|
this.adjustRootElementSize();
|
167
170
|
this.adjustRootChildrenSize();
|
168
171
|
}
|
@@ -57,7 +57,7 @@ export class BottomOverlay extends Overlay {
|
|
57
57
|
* @returns {boolean}
|
58
58
|
*/
|
59
59
|
resetFixedPosition() {
|
60
|
-
if (!this.needFullRender || !this.
|
60
|
+
if (!this.needFullRender || !this.wot.wtTable.holder.parentNode) {
|
61
61
|
// removed from DOM
|
62
62
|
return false;
|
63
63
|
}
|
@@ -154,11 +154,14 @@ export class BottomOverlay extends Overlay {
|
|
154
154
|
}
|
155
155
|
|
156
156
|
/**
|
157
|
-
* Adjust overlay root element,
|
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.
|
158
160
|
*/
|
159
161
|
adjustElementsSize() {
|
162
|
+
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
160
163
|
this.updateTrimmingContainer();
|
161
|
-
if (this.needFullRender) {
|
164
|
+
if (this.needFullRender || force) {
|
162
165
|
this.adjustRootElementSize();
|
163
166
|
this.adjustRootChildrenSize();
|
164
167
|
}
|
@@ -54,7 +54,7 @@ class InlineStartOverlay extends _base.Overlay {
|
|
54
54
|
const {
|
55
55
|
wtTable
|
56
56
|
} = this.wot;
|
57
|
-
if (!this.needFullRender || !
|
57
|
+
if (!this.needFullRender || !wtTable.holder.parentNode) {
|
58
58
|
// removed from DOM
|
59
59
|
return false;
|
60
60
|
}
|
@@ -126,11 +126,14 @@ class InlineStartOverlay extends _base.Overlay {
|
|
126
126
|
}
|
127
127
|
|
128
128
|
/**
|
129
|
-
* Adjust overlay root element,
|
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.
|
130
132
|
*/
|
131
133
|
adjustElementsSize() {
|
134
|
+
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
132
135
|
this.updateTrimmingContainer();
|
133
|
-
if (this.needFullRender) {
|
136
|
+
if (this.needFullRender || force) {
|
134
137
|
this.adjustRootElementSize();
|
135
138
|
this.adjustRootChildrenSize();
|
136
139
|
}
|
@@ -50,7 +50,7 @@ export class InlineStartOverlay extends Overlay {
|
|
50
50
|
const {
|
51
51
|
wtTable
|
52
52
|
} = this.wot;
|
53
|
-
if (!this.needFullRender || !
|
53
|
+
if (!this.needFullRender || !wtTable.holder.parentNode) {
|
54
54
|
// removed from DOM
|
55
55
|
return false;
|
56
56
|
}
|
@@ -122,11 +122,14 @@ export class InlineStartOverlay extends Overlay {
|
|
122
122
|
}
|
123
123
|
|
124
124
|
/**
|
125
|
-
* Adjust overlay root element,
|
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.
|
126
128
|
*/
|
127
129
|
adjustElementsSize() {
|
130
|
+
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
128
131
|
this.updateTrimmingContainer();
|
129
|
-
if (this.needFullRender) {
|
132
|
+
if (this.needFullRender || force) {
|
130
133
|
this.adjustRootElementSize();
|
131
134
|
this.adjustRootChildrenSize();
|
132
135
|
}
|
@@ -62,7 +62,7 @@ class TopOverlay extends _base.Overlay {
|
|
62
62
|
* @returns {boolean}
|
63
63
|
*/
|
64
64
|
resetFixedPosition() {
|
65
|
-
if (!this.needFullRender || !this.
|
65
|
+
if (!this.needFullRender || !this.wot.wtTable.holder.parentNode) {
|
66
66
|
// removed from DOM
|
67
67
|
return false;
|
68
68
|
}
|
@@ -150,11 +150,14 @@ class TopOverlay extends _base.Overlay {
|
|
150
150
|
}
|
151
151
|
|
152
152
|
/**
|
153
|
-
* Adjust overlay root element,
|
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.
|
154
156
|
*/
|
155
157
|
adjustElementsSize() {
|
158
|
+
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
156
159
|
this.updateTrimmingContainer();
|
157
|
-
if (this.needFullRender) {
|
160
|
+
if (this.needFullRender || force) {
|
158
161
|
this.adjustRootElementSize();
|
159
162
|
this.adjustRootChildrenSize();
|
160
163
|
}
|
@@ -58,7 +58,7 @@ export class TopOverlay extends Overlay {
|
|
58
58
|
* @returns {boolean}
|
59
59
|
*/
|
60
60
|
resetFixedPosition() {
|
61
|
-
if (!this.needFullRender || !this.
|
61
|
+
if (!this.needFullRender || !this.wot.wtTable.holder.parentNode) {
|
62
62
|
// removed from DOM
|
63
63
|
return false;
|
64
64
|
}
|
@@ -146,11 +146,14 @@ export class TopOverlay extends Overlay {
|
|
146
146
|
}
|
147
147
|
|
148
148
|
/**
|
149
|
-
* Adjust overlay root element,
|
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.
|
150
152
|
*/
|
151
153
|
adjustElementsSize() {
|
154
|
+
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
152
155
|
this.updateTrimmingContainer();
|
153
|
-
if (this.needFullRender) {
|
156
|
+
if (this.needFullRender || force) {
|
154
157
|
this.adjustRootElementSize();
|
155
158
|
this.adjustRootChildrenSize();
|
156
159
|
}
|
@@ -9,19 +9,12 @@ 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"); } }
|
14
12
|
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; }
|
15
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
16
14
|
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"); }
|
20
15
|
/**
|
21
16
|
* @class Overlays
|
22
17
|
*/
|
23
|
-
var _overlays = /*#__PURE__*/new WeakMap();
|
24
|
-
var _hasRenderingStateChanged = /*#__PURE__*/new WeakMap();
|
25
18
|
class Overlays {
|
26
19
|
/**
|
27
20
|
* @param {Walkontable} wotInstance The Walkontable instance. @todo refactoring remove.
|
@@ -39,12 +32,6 @@ class Overlays {
|
|
39
32
|
* @type {Walkontable}
|
40
33
|
*/
|
41
34
|
_defineProperty(this, "wot", null);
|
42
|
-
/**
|
43
|
-
* An array of the all overlays.
|
44
|
-
*
|
45
|
-
* @type {Overlay[]}
|
46
|
-
*/
|
47
|
-
_classPrivateFieldInitSpec(this, _overlays, []);
|
48
35
|
/**
|
49
36
|
* Refer to the TopOverlay instance.
|
50
37
|
*
|
@@ -94,12 +81,6 @@ class Overlays {
|
|
94
81
|
* @type {Settings}
|
95
82
|
*/
|
96
83
|
_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);
|
103
84
|
/**
|
104
85
|
* The instance of the ResizeObserver that observes the size of the Walkontable wrapper element.
|
105
86
|
* In case of the size change detection the `onContainerElementResize` is fired.
|
@@ -159,7 +140,7 @@ class Overlays {
|
|
159
140
|
*/
|
160
141
|
getOverlays() {
|
161
142
|
let includeMaster = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
162
|
-
const overlays = [
|
143
|
+
const overlays = [this.topOverlay, this.topInlineStartCornerOverlay, this.inlineStartOverlay, this.bottomOverlay, this.bottomInlineStartCornerOverlay];
|
163
144
|
if (includeMaster) {
|
164
145
|
overlays.push(this.wtTable);
|
165
146
|
}
|
@@ -204,31 +185,29 @@ class Overlays {
|
|
204
185
|
// TODO cond. Has no any visual impact. They're initially hidden in same way like left, top, and bottom overlays.
|
205
186
|
this.topInlineStartCornerOverlay = new _overlay.TopInlineStartCornerOverlay(...args, this.topOverlay, this.inlineStartOverlay);
|
206
187
|
this.bottomInlineStartCornerOverlay = new _overlay.BottomInlineStartCornerOverlay(...args, this.bottomOverlay, this.inlineStartOverlay);
|
207
|
-
_classPrivateFieldSet(_overlays, this, [this.topOverlay, this.bottomOverlay, this.inlineStartOverlay, this.topInlineStartCornerOverlay, this.bottomInlineStartCornerOverlay]);
|
208
188
|
}
|
209
189
|
|
210
190
|
/**
|
211
|
-
*
|
191
|
+
* Update state of rendering, check if changed.
|
192
|
+
*
|
193
|
+
* @package
|
194
|
+
* @returns {boolean} Returns `true` if changes applied to overlay needs scroll synchronization.
|
212
195
|
*/
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
_classPrivateFieldGet(_overlays, this).forEach(overlay => overlay.updateStateOfRendering('before'));
|
218
|
-
}
|
196
|
+
updateStateOfRendering() {
|
197
|
+
let syncScroll = this.topOverlay.updateStateOfRendering();
|
198
|
+
syncScroll = this.bottomOverlay.updateStateOfRendering() || syncScroll;
|
199
|
+
syncScroll = this.inlineStartOverlay.updateStateOfRendering() || syncScroll;
|
219
200
|
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
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();
|
201
|
+
// todo refactoring: move conditions into updateStateOfRendering(),
|
202
|
+
if (this.inlineStartOverlay.needFullRender) {
|
203
|
+
if (this.topOverlay.needFullRender) {
|
204
|
+
syncScroll = this.topInlineStartCornerOverlay.updateStateOfRendering() || syncScroll;
|
230
205
|
}
|
231
|
-
|
206
|
+
if (this.bottomOverlay.needFullRender) {
|
207
|
+
syncScroll = this.bottomInlineStartCornerOverlay.updateStateOfRendering() || syncScroll;
|
208
|
+
}
|
209
|
+
}
|
210
|
+
return syncScroll;
|
232
211
|
}
|
233
212
|
|
234
213
|
/**
|
@@ -468,9 +447,6 @@ class Overlays {
|
|
468
447
|
* Synchronize overlay scrollbars with the master scrollbar.
|
469
448
|
*/
|
470
449
|
syncScrollWithMaster() {
|
471
|
-
if (!_classPrivateFieldGet(_hasRenderingStateChanged, this)) {
|
472
|
-
return;
|
473
|
-
}
|
474
450
|
const master = this.topOverlay.mainTableScrollableElement;
|
475
451
|
const {
|
476
452
|
scrollLeft,
|
@@ -485,7 +461,6 @@ class Overlays {
|
|
485
461
|
if (this.inlineStartOverlay.needFullRender) {
|
486
462
|
this.inlineStartOverlay.clone.wtTable.holder.scrollTop = scrollTop; // todo rethink, *overlay.setScroll*()
|
487
463
|
}
|
488
|
-
_classPrivateFieldSet(_hasRenderingStateChanged, this, false);
|
489
464
|
}
|
490
465
|
|
491
466
|
/**
|
@@ -576,8 +551,11 @@ class Overlays {
|
|
576
551
|
|
577
552
|
/**
|
578
553
|
* 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.
|
579
556
|
*/
|
580
557
|
adjustElementsSize() {
|
558
|
+
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
581
559
|
const {
|
582
560
|
wtViewport
|
583
561
|
} = this.wot;
|
@@ -627,9 +605,9 @@ class Overlays {
|
|
627
605
|
this.hasScrollbarRight = true;
|
628
606
|
}
|
629
607
|
}
|
630
|
-
this.topOverlay.adjustElementsSize();
|
631
|
-
this.inlineStartOverlay.adjustElementsSize();
|
632
|
-
this.bottomOverlay.adjustElementsSize();
|
608
|
+
this.topOverlay.adjustElementsSize(force);
|
609
|
+
this.inlineStartOverlay.adjustElementsSize(force);
|
610
|
+
this.bottomOverlay.adjustElementsSize(force);
|
633
611
|
}
|
634
612
|
|
635
613
|
/**
|