handsontable 0.0.0-next-a148bc1-20241121 → 0.0.0-next-3058de1-20241122
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/index.js +1 -2
- package/3rdparty/walkontable/src/calculator/index.mjs +2 -2
- package/3rdparty/walkontable/src/calculator/viewportRows.js +3 -3
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +3 -3
- package/3rdparty/walkontable/src/core/_base.js +3 -0
- package/3rdparty/walkontable/src/core/_base.mjs +3 -0
- package/3rdparty/walkontable/src/core/clone.js +1 -0
- package/3rdparty/walkontable/src/core/clone.mjs +1 -0
- package/3rdparty/walkontable/src/core/core.js +2 -0
- package/3rdparty/walkontable/src/core/core.mjs +2 -0
- package/3rdparty/walkontable/src/facade/core.js +3 -0
- package/3rdparty/walkontable/src/facade/core.mjs +3 -0
- package/3rdparty/walkontable/src/index.js +0 -3
- package/3rdparty/walkontable/src/index.mjs +2 -3
- package/3rdparty/walkontable/src/overlay/_base.js +3 -1
- package/3rdparty/walkontable/src/overlay/_base.mjs +3 -1
- package/3rdparty/walkontable/src/overlay/bottom.js +2 -2
- package/3rdparty/walkontable/src/overlay/bottom.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/inlineStart.js +1 -1
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/top.js +2 -2
- package/3rdparty/walkontable/src/overlay/top.mjs +2 -2
- package/3rdparty/walkontable/src/renderer/_base.js +4 -3
- package/3rdparty/walkontable/src/renderer/_base.mjs +2 -2
- package/3rdparty/walkontable/src/renderer/cells.js +10 -11
- package/3rdparty/walkontable/src/renderer/cells.mjs +8 -10
- package/3rdparty/walkontable/src/renderer/colGroup.js +7 -6
- package/3rdparty/walkontable/src/renderer/colGroup.mjs +5 -5
- package/3rdparty/walkontable/src/renderer/columnHeaders.js +5 -4
- package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +3 -3
- package/3rdparty/walkontable/src/renderer/index.js +23 -20
- package/3rdparty/walkontable/src/renderer/index.mjs +10 -8
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +6 -5
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +4 -4
- package/3rdparty/walkontable/src/renderer/rows.js +11 -23
- package/3rdparty/walkontable/src/renderer/rows.mjs +10 -23
- package/3rdparty/walkontable/src/renderer/table.js +13 -4
- package/3rdparty/walkontable/src/renderer/table.mjs +13 -4
- package/3rdparty/walkontable/src/settings.js +0 -2
- package/3rdparty/walkontable/src/settings.mjs +0 -2
- package/3rdparty/walkontable/src/table.js +17 -9
- package/3rdparty/walkontable/src/table.mjs +17 -9
- package/3rdparty/walkontable/src/types.js +1 -0
- package/3rdparty/walkontable/src/types.mjs +1 -0
- package/3rdparty/walkontable/src/utils/column.js +1 -1
- package/3rdparty/walkontable/src/utils/column.mjs +1 -1
- package/3rdparty/walkontable/src/utils/nodesPool.js +5 -22
- package/3rdparty/walkontable/src/utils/nodesPool.mjs +5 -22
- package/3rdparty/walkontable/src/utils/orderView/index.js +5 -4
- package/3rdparty/walkontable/src/utils/orderView/index.mjs +2 -2
- package/3rdparty/walkontable/src/utils/orderView/sharedView.js +4 -3
- package/3rdparty/walkontable/src/utils/orderView/sharedView.mjs +2 -2
- package/3rdparty/walkontable/src/utils/orderView/view.js +76 -79
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +74 -78
- package/3rdparty/walkontable/src/utils/orderView/viewSize.js +1 -1
- package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +1 -1
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +5 -4
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +3 -3
- package/3rdparty/walkontable/src/utils/stylesHandler.js +287 -0
- package/3rdparty/walkontable/src/utils/stylesHandler.mjs +283 -0
- package/3rdparty/walkontable/src/viewport.js +1 -0
- package/3rdparty/walkontable/src/viewport.mjs +1 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/hooks/constants.js +9 -0
- package/core/hooks/constants.mjs +9 -0
- package/core/hooks/index.d.ts +1 -0
- package/core.d.ts +2 -0
- package/core.js +47 -0
- package/core.mjs +47 -0
- package/dataMap/metaManager/metaSchema.js +23 -3
- package/dataMap/metaManager/metaSchema.mjs +23 -3
- package/dist/handsontable.css +17 -9
- package/dist/handsontable.full.css +249 -240
- package/dist/handsontable.full.js +4767 -4686
- package/dist/handsontable.full.min.css +11 -9
- package/dist/handsontable.full.min.js +53 -53
- package/dist/handsontable.js +4474 -4387
- package/dist/handsontable.min.css +5 -4
- package/dist/handsontable.min.js +24 -24
- package/editors/autocompleteEditor/autocompleteEditor.js +1 -1
- package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -1
- package/editors/baseEditor/baseEditor.js +1 -1
- package/editors/baseEditor/baseEditor.mjs +1 -1
- package/editors/dateEditor/dateEditor.js +9 -0
- package/editors/dateEditor/dateEditor.mjs +10 -1
- package/editors/handsontableEditor/handsontableEditor.js +7 -1
- package/editors/handsontableEditor/handsontableEditor.mjs +7 -1
- package/editors/selectEditor/selectEditor.js +20 -9
- package/editors/selectEditor/selectEditor.mjs +20 -9
- package/editors/textEditor/textEditor.js +4 -11
- package/editors/textEditor/textEditor.mjs +4 -11
- package/helpers/dom/element.js +32 -1
- package/helpers/dom/element.mjs +31 -1
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/helpers/themes.js +17 -0
- package/helpers/themes.mjs +13 -0
- package/package.json +10 -3
- package/plugins/comments/commentEditor.js +9 -0
- package/plugins/comments/commentEditor.mjs +9 -0
- package/plugins/comments/comments.js +14 -0
- package/plugins/comments/comments.mjs +15 -1
- package/plugins/contextMenu/menu/menu.js +9 -4
- package/plugins/contextMenu/menu/menu.mjs +9 -4
- package/plugins/filters/ui/multipleSelect.js +6 -0
- package/plugins/filters/ui/multipleSelect.mjs +6 -0
- package/plugins/manualRowMove/manualRowMove.js +1 -1
- package/plugins/manualRowMove/manualRowMove.mjs +1 -1
- package/plugins/manualRowResize/manualRowResize.js +1 -2
- package/plugins/manualRowResize/manualRowResize.mjs +2 -3
- package/plugins/mergeCells/mergeCells.js +1 -1
- package/plugins/mergeCells/mergeCells.mjs +1 -1
- package/plugins/nestedRows/ui/headers.js +7 -1
- package/plugins/nestedRows/ui/headers.mjs +7 -1
- package/plugins/stretchColumns/calculator.js +2 -1
- package/plugins/stretchColumns/calculator.mjs +3 -2
- package/renderers/checkboxRenderer/checkboxRenderer.js +5 -8
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +5 -8
- package/settings.d.ts +1 -0
- package/styles/handsontable.css +2178 -0
- package/styles/handsontable.min.css +30 -0
- package/styles/ht-theme-horizon.css +607 -0
- package/styles/ht-theme-horizon.min.css +30 -0
- package/styles/ht-theme-main.css +613 -0
- package/styles/ht-theme-main.min.css +30 -0
- package/tableView.js +46 -0
- package/tableView.mjs +47 -1
- package/utils/autoResize.js +4 -1
- package/utils/autoResize.mjs +4 -1
- package/utils/ghostTable.js +5 -3
- package/utils/ghostTable.mjs +5 -3
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/index.js +0 -138
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/index.mjs +0 -135
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.js +0 -72
- package/3rdparty/walkontable/src/utils/orderView/viewDiffer/viewOrder.mjs +0 -68
@@ -1,3 +1,3 @@
|
|
1
|
-
import
|
2
|
-
import
|
1
|
+
import OrderView from "./view.mjs";
|
2
|
+
import SharedOrderView from "./sharedView.mjs";
|
3
3
|
export { OrderView, SharedOrderView };
|
@@ -1,13 +1,14 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
var _view = require("./view");
|
4
|
+
var _view = _interopRequireDefault(require("./view"));
|
5
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
5
6
|
/**
|
6
7
|
* Executive model for TR root nodes.
|
7
8
|
*
|
8
9
|
* @class {SharedOrderView}
|
9
10
|
*/
|
10
|
-
class SharedOrderView extends _view.
|
11
|
+
class SharedOrderView extends _view.default {
|
11
12
|
/**
|
12
13
|
* The method results in merging external order view into the current order. This happens only for order views which
|
13
14
|
* operate on the same root node.
|
@@ -42,4 +43,4 @@ class SharedOrderView extends _view.OrderView {
|
|
42
43
|
return this;
|
43
44
|
}
|
44
45
|
}
|
45
|
-
exports.
|
46
|
+
exports.default = SharedOrderView;
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import
|
1
|
+
import OrderView from "./view.mjs";
|
2
2
|
/**
|
3
3
|
* Executive model for TR root nodes.
|
4
4
|
*
|
5
5
|
* @class {SharedOrderView}
|
6
6
|
*/
|
7
|
-
export class SharedOrderView extends OrderView {
|
7
|
+
export default class SharedOrderView extends OrderView {
|
8
8
|
/**
|
9
9
|
* The method results in merging external order view into the current order. This happens only for order views which
|
10
10
|
* operate on the same root node.
|
@@ -3,8 +3,9 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
5
|
require("core-js/modules/es.array.push.js");
|
6
|
-
var
|
7
|
-
var
|
6
|
+
var _constants = require("./constants");
|
7
|
+
var _viewSizeSet = _interopRequireDefault(require("./viewSizeSet"));
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
8
9
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
9
10
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
10
11
|
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,7 +18,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
17
18
|
* @class {OrderView}
|
18
19
|
*/
|
19
20
|
class OrderView {
|
20
|
-
constructor(rootNode, nodesPool) {
|
21
|
+
constructor(rootNode, nodesPool, childNodeType) {
|
21
22
|
/**
|
22
23
|
* The root node to manage with.
|
23
24
|
*
|
@@ -27,7 +28,7 @@ class OrderView {
|
|
27
28
|
/**
|
28
29
|
* Factory for newly created DOM elements.
|
29
30
|
*
|
30
|
-
* @type {
|
31
|
+
* @type {Function}
|
31
32
|
*/
|
32
33
|
_defineProperty(this, "nodesPool", void 0);
|
33
34
|
/**
|
@@ -35,41 +36,28 @@ class OrderView {
|
|
35
36
|
*
|
36
37
|
* @type {ViewSizeSet}
|
37
38
|
*/
|
38
|
-
_defineProperty(this, "sizeSet", new _viewSizeSet.
|
39
|
+
_defineProperty(this, "sizeSet", new _viewSizeSet.default());
|
39
40
|
/**
|
40
|
-
*
|
41
|
+
* Node type which the order view will manage while rendering the DOM elements.
|
41
42
|
*
|
42
|
-
* @type {
|
43
|
+
* @type {string}
|
43
44
|
*/
|
44
|
-
_defineProperty(this, "
|
45
|
+
_defineProperty(this, "childNodeType", void 0);
|
45
46
|
/**
|
46
|
-
* The
|
47
|
-
* commands that are processed by the OrderView (see `applyCommand` method).
|
47
|
+
* The visual index of currently processed row.
|
48
48
|
*
|
49
|
-
* @type {
|
49
|
+
* @type {number}
|
50
50
|
*/
|
51
|
-
_defineProperty(this, "
|
51
|
+
_defineProperty(this, "visualIndex", 0);
|
52
52
|
/**
|
53
|
-
*
|
54
|
-
*/
|
55
|
-
_defineProperty(this, "staleNodeIndexes", []);
|
56
|
-
/**
|
57
|
-
* The list of render commands to execute. The command is an array with the following
|
58
|
-
* structure: [
|
59
|
-
* [
|
60
|
-
* 'prepend' | 'append' | 'insert_before' | 'replace' | 'remove', // command name
|
61
|
-
* 10, // processed node index
|
62
|
-
* 9, // previous node index (only for 'insert_before' and 'replace' commands)
|
63
|
-
* 8 // node index to remove (only for 'insert_before' command)
|
64
|
-
* ],
|
65
|
-
* ...
|
66
|
-
* ].
|
53
|
+
* The list of DOM elements which are rendered for this render cycle.
|
67
54
|
*
|
68
|
-
* @type {
|
55
|
+
* @type {HTMLElement[]}
|
69
56
|
*/
|
70
|
-
_defineProperty(this, "
|
57
|
+
_defineProperty(this, "collectedNodes", []);
|
71
58
|
this.rootNode = rootNode;
|
72
59
|
this.nodesPool = nodesPool;
|
60
|
+
this.childNodeType = childNodeType.toUpperCase();
|
73
61
|
}
|
74
62
|
|
75
63
|
/**
|
@@ -96,14 +84,6 @@ class OrderView {
|
|
96
84
|
return this;
|
97
85
|
}
|
98
86
|
|
99
|
-
/**
|
100
|
-
* @param {number} sourceIndex The source index.
|
101
|
-
* @returns {boolean}
|
102
|
-
*/
|
103
|
-
hasStaleContent(sourceIndex) {
|
104
|
-
return this.staleNodeIndexes.includes(sourceIndex);
|
105
|
-
}
|
106
|
-
|
107
87
|
/**
|
108
88
|
* Checks if this instance of the view shares the root node with another instance. This happens only once when
|
109
89
|
* a row (TR) as a root node is managed by two OrderView instances. If this happens another DOM injection
|
@@ -136,44 +116,30 @@ class OrderView {
|
|
136
116
|
}
|
137
117
|
|
138
118
|
/**
|
139
|
-
*
|
119
|
+
* Returns rendered child count for this instance.
|
140
120
|
*
|
141
|
-
* @
|
121
|
+
* @returns {number}
|
142
122
|
*/
|
143
|
-
|
123
|
+
getRenderedChildCount() {
|
144
124
|
const {
|
145
|
-
rootNode
|
125
|
+
rootNode,
|
126
|
+
sizeSet
|
146
127
|
} = this;
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
case 'append':
|
161
|
-
rootNode.appendChild(node);
|
162
|
-
break;
|
163
|
-
case 'insert_before':
|
164
|
-
rootNode.insertBefore(node, this.nodesPool(nodePrevIndex));
|
165
|
-
// To keep the constant length of child nodes (after inserting a node) remove the last child.
|
166
|
-
rootNode.removeChild(this.nodesPool(nodeIndexToRemove));
|
167
|
-
break;
|
168
|
-
case 'replace':
|
169
|
-
rootNode.replaceChild(node, this.nodesPool(nodePrevIndex));
|
170
|
-
break;
|
171
|
-
case 'remove':
|
172
|
-
rootNode.removeChild(node);
|
173
|
-
break;
|
174
|
-
default:
|
175
|
-
break;
|
128
|
+
let childElementCount = 0;
|
129
|
+
if (this.isSharedViewSet()) {
|
130
|
+
let element = rootNode.firstElementChild;
|
131
|
+
while (element) {
|
132
|
+
if (element.tagName === this.childNodeType) {
|
133
|
+
childElementCount += 1;
|
134
|
+
} else if (sizeSet.isPlaceOn(_constants.WORKING_SPACE_TOP)) {
|
135
|
+
break;
|
136
|
+
}
|
137
|
+
element = element.nextElementSibling;
|
138
|
+
}
|
139
|
+
} else {
|
140
|
+
childElementCount = rootNode.childElementCount;
|
176
141
|
}
|
142
|
+
return childElementCount;
|
177
143
|
}
|
178
144
|
|
179
145
|
/**
|
@@ -182,8 +148,30 @@ class OrderView {
|
|
182
148
|
*/
|
183
149
|
start() {
|
184
150
|
this.collectedNodes.length = 0;
|
185
|
-
this.
|
186
|
-
|
151
|
+
this.visualIndex = 0;
|
152
|
+
const {
|
153
|
+
rootNode,
|
154
|
+
sizeSet
|
155
|
+
} = this;
|
156
|
+
const isShared = this.isSharedViewSet();
|
157
|
+
const {
|
158
|
+
nextSize
|
159
|
+
} = sizeSet.getViewSize();
|
160
|
+
let childElementCount = this.getRenderedChildCount();
|
161
|
+
while (childElementCount < nextSize) {
|
162
|
+
const newNode = this.nodesPool();
|
163
|
+
if (!isShared || isShared && sizeSet.isPlaceOn(_constants.WORKING_SPACE_BOTTOM)) {
|
164
|
+
rootNode.appendChild(newNode);
|
165
|
+
} else {
|
166
|
+
rootNode.insertBefore(newNode, rootNode.firstChild);
|
167
|
+
}
|
168
|
+
childElementCount += 1;
|
169
|
+
}
|
170
|
+
const isSharedPlacedOnTop = isShared && sizeSet.isPlaceOn(_constants.WORKING_SPACE_TOP);
|
171
|
+
while (childElementCount > nextSize) {
|
172
|
+
rootNode.removeChild(isSharedPlacedOnTop ? rootNode.firstChild : rootNode.lastChild);
|
173
|
+
childElementCount -= 1;
|
174
|
+
}
|
187
175
|
}
|
188
176
|
|
189
177
|
/**
|
@@ -191,19 +179,28 @@ class OrderView {
|
|
191
179
|
* This method has to be called as many times as the size count is met (to cover all previously rendered DOM elements).
|
192
180
|
*/
|
193
181
|
render() {
|
194
|
-
|
195
|
-
|
182
|
+
const {
|
183
|
+
rootNode,
|
184
|
+
sizeSet
|
185
|
+
} = this;
|
186
|
+
let visualIndex = this.visualIndex;
|
187
|
+
if (this.isSharedViewSet() && sizeSet.isPlaceOn(_constants.WORKING_SPACE_BOTTOM)) {
|
188
|
+
visualIndex += sizeSet.sharedSize.nextSize;
|
189
|
+
}
|
190
|
+
let node = rootNode.childNodes[visualIndex];
|
191
|
+
if (node.tagName !== this.childNodeType) {
|
192
|
+
const newNode = this.nodesPool();
|
193
|
+
rootNode.replaceChild(newNode, node);
|
194
|
+
node = newNode;
|
196
195
|
}
|
196
|
+
this.collectedNodes.push(node);
|
197
|
+
this.visualIndex += 1;
|
197
198
|
}
|
198
199
|
|
199
200
|
/**
|
200
201
|
* Ends the render process.
|
201
202
|
* This method has to be called only once (at the end) for the render cycle.
|
202
203
|
*/
|
203
|
-
end() {
|
204
|
-
while (this.leads.length > 0) {
|
205
|
-
this.applyCommand(this.leads.shift());
|
206
|
-
}
|
207
|
-
}
|
204
|
+
end() {}
|
208
205
|
}
|
209
|
-
exports.
|
206
|
+
exports.default = OrderView;
|
@@ -3,8 +3,8 @@ import "core-js/modules/es.array.push.js";
|
|
3
3
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
4
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
5
5
|
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); }
|
6
|
-
import {
|
7
|
-
import
|
6
|
+
import { WORKING_SPACE_TOP, WORKING_SPACE_BOTTOM } from "./constants.mjs";
|
7
|
+
import ViewSizeSet from "./viewSizeSet.mjs";
|
8
8
|
/**
|
9
9
|
* Executive model for each table renderer. It's responsible for injecting DOM nodes in a
|
10
10
|
* specified order and adjusting the number of elements in the root node.
|
@@ -13,8 +13,8 @@ import { ViewDiffer } from "./viewDiffer/index.mjs";
|
|
13
13
|
*
|
14
14
|
* @class {OrderView}
|
15
15
|
*/
|
16
|
-
export class OrderView {
|
17
|
-
constructor(rootNode, nodesPool) {
|
16
|
+
export default class OrderView {
|
17
|
+
constructor(rootNode, nodesPool, childNodeType) {
|
18
18
|
/**
|
19
19
|
* The root node to manage with.
|
20
20
|
*
|
@@ -24,7 +24,7 @@ export class OrderView {
|
|
24
24
|
/**
|
25
25
|
* Factory for newly created DOM elements.
|
26
26
|
*
|
27
|
-
* @type {
|
27
|
+
* @type {Function}
|
28
28
|
*/
|
29
29
|
_defineProperty(this, "nodesPool", void 0);
|
30
30
|
/**
|
@@ -34,39 +34,26 @@ export class OrderView {
|
|
34
34
|
*/
|
35
35
|
_defineProperty(this, "sizeSet", new ViewSizeSet());
|
36
36
|
/**
|
37
|
-
*
|
37
|
+
* Node type which the order view will manage while rendering the DOM elements.
|
38
38
|
*
|
39
|
-
* @type {
|
39
|
+
* @type {string}
|
40
40
|
*/
|
41
|
-
_defineProperty(this, "
|
41
|
+
_defineProperty(this, "childNodeType", void 0);
|
42
42
|
/**
|
43
|
-
* The
|
44
|
-
* commands that are processed by the OrderView (see `applyCommand` method).
|
43
|
+
* The visual index of currently processed row.
|
45
44
|
*
|
46
|
-
* @type {
|
45
|
+
* @type {number}
|
47
46
|
*/
|
48
|
-
_defineProperty(this, "
|
47
|
+
_defineProperty(this, "visualIndex", 0);
|
49
48
|
/**
|
50
|
-
*
|
51
|
-
*/
|
52
|
-
_defineProperty(this, "staleNodeIndexes", []);
|
53
|
-
/**
|
54
|
-
* The list of render commands to execute. The command is an array with the following
|
55
|
-
* structure: [
|
56
|
-
* [
|
57
|
-
* 'prepend' | 'append' | 'insert_before' | 'replace' | 'remove', // command name
|
58
|
-
* 10, // processed node index
|
59
|
-
* 9, // previous node index (only for 'insert_before' and 'replace' commands)
|
60
|
-
* 8 // node index to remove (only for 'insert_before' command)
|
61
|
-
* ],
|
62
|
-
* ...
|
63
|
-
* ].
|
49
|
+
* The list of DOM elements which are rendered for this render cycle.
|
64
50
|
*
|
65
|
-
* @type {
|
51
|
+
* @type {HTMLElement[]}
|
66
52
|
*/
|
67
|
-
_defineProperty(this, "
|
53
|
+
_defineProperty(this, "collectedNodes", []);
|
68
54
|
this.rootNode = rootNode;
|
69
55
|
this.nodesPool = nodesPool;
|
56
|
+
this.childNodeType = childNodeType.toUpperCase();
|
70
57
|
}
|
71
58
|
|
72
59
|
/**
|
@@ -93,14 +80,6 @@ export class OrderView {
|
|
93
80
|
return this;
|
94
81
|
}
|
95
82
|
|
96
|
-
/**
|
97
|
-
* @param {number} sourceIndex The source index.
|
98
|
-
* @returns {boolean}
|
99
|
-
*/
|
100
|
-
hasStaleContent(sourceIndex) {
|
101
|
-
return this.staleNodeIndexes.includes(sourceIndex);
|
102
|
-
}
|
103
|
-
|
104
83
|
/**
|
105
84
|
* Checks if this instance of the view shares the root node with another instance. This happens only once when
|
106
85
|
* a row (TR) as a root node is managed by two OrderView instances. If this happens another DOM injection
|
@@ -133,44 +112,30 @@ export class OrderView {
|
|
133
112
|
}
|
134
113
|
|
135
114
|
/**
|
136
|
-
*
|
115
|
+
* Returns rendered child count for this instance.
|
137
116
|
*
|
138
|
-
* @
|
117
|
+
* @returns {number}
|
139
118
|
*/
|
140
|
-
|
119
|
+
getRenderedChildCount() {
|
141
120
|
const {
|
142
|
-
rootNode
|
121
|
+
rootNode,
|
122
|
+
sizeSet
|
143
123
|
} = this;
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
case 'append':
|
158
|
-
rootNode.appendChild(node);
|
159
|
-
break;
|
160
|
-
case 'insert_before':
|
161
|
-
rootNode.insertBefore(node, this.nodesPool(nodePrevIndex));
|
162
|
-
// To keep the constant length of child nodes (after inserting a node) remove the last child.
|
163
|
-
rootNode.removeChild(this.nodesPool(nodeIndexToRemove));
|
164
|
-
break;
|
165
|
-
case 'replace':
|
166
|
-
rootNode.replaceChild(node, this.nodesPool(nodePrevIndex));
|
167
|
-
break;
|
168
|
-
case 'remove':
|
169
|
-
rootNode.removeChild(node);
|
170
|
-
break;
|
171
|
-
default:
|
172
|
-
break;
|
124
|
+
let childElementCount = 0;
|
125
|
+
if (this.isSharedViewSet()) {
|
126
|
+
let element = rootNode.firstElementChild;
|
127
|
+
while (element) {
|
128
|
+
if (element.tagName === this.childNodeType) {
|
129
|
+
childElementCount += 1;
|
130
|
+
} else if (sizeSet.isPlaceOn(WORKING_SPACE_TOP)) {
|
131
|
+
break;
|
132
|
+
}
|
133
|
+
element = element.nextElementSibling;
|
134
|
+
}
|
135
|
+
} else {
|
136
|
+
childElementCount = rootNode.childElementCount;
|
173
137
|
}
|
138
|
+
return childElementCount;
|
174
139
|
}
|
175
140
|
|
176
141
|
/**
|
@@ -179,8 +144,30 @@ export class OrderView {
|
|
179
144
|
*/
|
180
145
|
start() {
|
181
146
|
this.collectedNodes.length = 0;
|
182
|
-
this.
|
183
|
-
|
147
|
+
this.visualIndex = 0;
|
148
|
+
const {
|
149
|
+
rootNode,
|
150
|
+
sizeSet
|
151
|
+
} = this;
|
152
|
+
const isShared = this.isSharedViewSet();
|
153
|
+
const {
|
154
|
+
nextSize
|
155
|
+
} = sizeSet.getViewSize();
|
156
|
+
let childElementCount = this.getRenderedChildCount();
|
157
|
+
while (childElementCount < nextSize) {
|
158
|
+
const newNode = this.nodesPool();
|
159
|
+
if (!isShared || isShared && sizeSet.isPlaceOn(WORKING_SPACE_BOTTOM)) {
|
160
|
+
rootNode.appendChild(newNode);
|
161
|
+
} else {
|
162
|
+
rootNode.insertBefore(newNode, rootNode.firstChild);
|
163
|
+
}
|
164
|
+
childElementCount += 1;
|
165
|
+
}
|
166
|
+
const isSharedPlacedOnTop = isShared && sizeSet.isPlaceOn(WORKING_SPACE_TOP);
|
167
|
+
while (childElementCount > nextSize) {
|
168
|
+
rootNode.removeChild(isSharedPlacedOnTop ? rootNode.firstChild : rootNode.lastChild);
|
169
|
+
childElementCount -= 1;
|
170
|
+
}
|
184
171
|
}
|
185
172
|
|
186
173
|
/**
|
@@ -188,18 +175,27 @@ export class OrderView {
|
|
188
175
|
* This method has to be called as many times as the size count is met (to cover all previously rendered DOM elements).
|
189
176
|
*/
|
190
177
|
render() {
|
191
|
-
|
192
|
-
|
178
|
+
const {
|
179
|
+
rootNode,
|
180
|
+
sizeSet
|
181
|
+
} = this;
|
182
|
+
let visualIndex = this.visualIndex;
|
183
|
+
if (this.isSharedViewSet() && sizeSet.isPlaceOn(WORKING_SPACE_BOTTOM)) {
|
184
|
+
visualIndex += sizeSet.sharedSize.nextSize;
|
185
|
+
}
|
186
|
+
let node = rootNode.childNodes[visualIndex];
|
187
|
+
if (node.tagName !== this.childNodeType) {
|
188
|
+
const newNode = this.nodesPool();
|
189
|
+
rootNode.replaceChild(newNode, node);
|
190
|
+
node = newNode;
|
193
191
|
}
|
192
|
+
this.collectedNodes.push(node);
|
193
|
+
this.visualIndex += 1;
|
194
194
|
}
|
195
195
|
|
196
196
|
/**
|
197
197
|
* Ends the render process.
|
198
198
|
* This method has to be called only once (at the end) for the render cycle.
|
199
199
|
*/
|
200
|
-
end() {
|
201
|
-
while (this.leads.length > 0) {
|
202
|
-
this.applyCommand(this.leads.shift());
|
203
|
-
}
|
204
|
-
}
|
200
|
+
end() {}
|
205
201
|
}
|
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
|
-
var _viewSize = require("./viewSize");
|
5
|
+
var _viewSize = _interopRequireDefault(require("./viewSize"));
|
6
6
|
var _constants = require("./constants");
|
7
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
7
8
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
8
9
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
9
10
|
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); }
|
@@ -30,7 +31,7 @@ class ViewSizeSet {
|
|
30
31
|
*
|
31
32
|
* @type {ViewSize}
|
32
33
|
*/
|
33
|
-
_defineProperty(this, "size", new _viewSize.
|
34
|
+
_defineProperty(this, "size", new _viewSize.default());
|
34
35
|
/**
|
35
36
|
* Defines if this instance shares its size with another instance. If it's in the shared
|
36
37
|
* mode it defines what space it occupies ('top' or 'bottom').
|
@@ -80,7 +81,7 @@ class ViewSizeSet {
|
|
80
81
|
* @returns {boolean}
|
81
82
|
*/
|
82
83
|
isShared() {
|
83
|
-
return this.sharedSize
|
84
|
+
return this.sharedSize instanceof _viewSize.default;
|
84
85
|
}
|
85
86
|
|
86
87
|
/**
|
@@ -115,4 +116,4 @@ class ViewSizeSet {
|
|
115
116
|
this.sharedSize = viewSize.getViewSize();
|
116
117
|
}
|
117
118
|
}
|
118
|
-
exports.
|
119
|
+
exports.default = ViewSizeSet;
|
@@ -2,7 +2,7 @@ import "core-js/modules/es.error.cause.js";
|
|
2
2
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
3
3
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
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
|
-
import
|
5
|
+
import ViewSize from "./viewSize.mjs";
|
6
6
|
import { WORKING_SPACE_ALL, WORKING_SPACE_TOP, WORKING_SPACE_BOTTOM } from "./constants.mjs";
|
7
7
|
/**
|
8
8
|
* The class is a source of the truth of information about the current and
|
@@ -20,7 +20,7 @@ import { WORKING_SPACE_ALL, WORKING_SPACE_TOP, WORKING_SPACE_BOTTOM } from "./co
|
|
20
20
|
*
|
21
21
|
* @class {ViewSizeSet}
|
22
22
|
*/
|
23
|
-
export class ViewSizeSet {
|
23
|
+
export default class ViewSizeSet {
|
24
24
|
constructor() {
|
25
25
|
/**
|
26
26
|
* Holder for current and next view size and offset.
|
@@ -77,7 +77,7 @@ export class ViewSizeSet {
|
|
77
77
|
* @returns {boolean}
|
78
78
|
*/
|
79
79
|
isShared() {
|
80
|
-
return this.sharedSize
|
80
|
+
return this.sharedSize instanceof ViewSize;
|
81
81
|
}
|
82
82
|
|
83
83
|
/**
|