handsontable 0.0.0-next-a148bc1-20241121 → 0.0.0-next-4ad1863-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/index.js +0 -2
- package/3rdparty/walkontable/src/index.mjs +1 -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 +19 -18
- package/3rdparty/walkontable/src/renderer/index.mjs +6 -6
- 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 +1 -1
- package/3rdparty/walkontable/src/renderer/table.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/base.js +2 -2
- package/base.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +1712 -1963
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +7 -7
- package/dist/handsontable.js +1714 -1965
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +7 -7
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/filters/filters.js +2 -0
- package/plugins/filters/filters.mjs +2 -0
- 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
package/helpers/mixed.js
CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
|
|
134
134
|
function _injectProductInfo(key, element) {
|
135
135
|
const hasValidType = !isEmpty(key);
|
136
136
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
137
|
-
const hotVersion = "0.0.0-next-
|
137
|
+
const hotVersion = "0.0.0-next-4ad1863-20241122";
|
138
138
|
let keyValidityDate;
|
139
139
|
let consoleMessageState = 'invalid';
|
140
140
|
let domMessageState = 'invalid';
|
package/helpers/mixed.mjs
CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
|
|
124
124
|
export function _injectProductInfo(key, element) {
|
125
125
|
const hasValidType = !isEmpty(key);
|
126
126
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
127
|
-
const hotVersion = "0.0.0-next-
|
127
|
+
const hotVersion = "0.0.0-next-4ad1863-20241122";
|
128
128
|
let keyValidityDate;
|
129
129
|
let consoleMessageState = 'invalid';
|
130
130
|
let domMessageState = 'invalid';
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"url": "https://github.com/handsontable/handsontable/issues"
|
11
11
|
},
|
12
12
|
"author": "Handsoncode <hello@handsontable.com>",
|
13
|
-
"version": "0.0.0-next-
|
13
|
+
"version": "0.0.0-next-4ad1863-20241122",
|
14
14
|
"main": "index",
|
15
15
|
"module": "index.mjs",
|
16
16
|
"jsnext:main": "index.mjs",
|
@@ -900,10 +900,12 @@ function _onActionBarSubmit(submitType) {
|
|
900
900
|
* @param {object} command Menu item object (command).
|
901
901
|
*/
|
902
902
|
function _onComponentChange(component, command) {
|
903
|
+
const menu = this.dropdownMenuPlugin.menu;
|
903
904
|
this.updateDependentComponentsVisibility();
|
904
905
|
if (component.constructor === _condition.ConditionComponent && !command.inputsCount) {
|
905
906
|
this.setListeningDropdownMenu();
|
906
907
|
}
|
908
|
+
menu.updateMenuDimensions();
|
907
909
|
}
|
908
910
|
/**
|
909
911
|
* On component SelectUI closed listener.
|
@@ -893,10 +893,12 @@ function _onActionBarSubmit(submitType) {
|
|
893
893
|
* @param {object} command Menu item object (command).
|
894
894
|
*/
|
895
895
|
function _onComponentChange(component, command) {
|
896
|
+
const menu = this.dropdownMenuPlugin.menu;
|
896
897
|
this.updateDependentComponentsVisibility();
|
897
898
|
if (component.constructor === ConditionComponent && !command.inputsCount) {
|
898
899
|
this.setListeningDropdownMenu();
|
899
900
|
}
|
901
|
+
menu.updateMenuDimensions();
|
900
902
|
}
|
901
903
|
/**
|
902
904
|
* On component SelectUI closed listener.
|
@@ -1,138 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
exports.__esModule = true;
|
4
|
-
require("core-js/modules/es.error.cause.js");
|
5
|
-
require("core-js/modules/es.array.push.js");
|
6
|
-
var _constants = require("../constants");
|
7
|
-
var _viewOrder = require("./viewOrder");
|
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; }
|
9
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
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); } /* eslint-disable jsdoc/require-description-complete-sentence */
|
11
|
-
/**
|
12
|
-
* A class which is responsible for generating commands/leads which has to be executed
|
13
|
-
* to achieve new DOM nodes order.
|
14
|
-
*
|
15
|
-
* @class {ViewDiffer}
|
16
|
-
*/
|
17
|
-
class ViewDiffer {
|
18
|
-
constructor(sizeSet) {
|
19
|
-
_defineProperty(this, "sizeSet", void 0);
|
20
|
-
this.sizeSet = sizeSet;
|
21
|
-
}
|
22
|
-
|
23
|
-
/**
|
24
|
-
* A method which generates commands/leads which has to be executed to achieve new DOM
|
25
|
-
* nodes order based on new offset and view size.
|
26
|
-
*
|
27
|
-
* For example, if current order looks like this (offset = 0, viewSize = 1):
|
28
|
-
* <body> (root node)
|
29
|
-
* └ <tr> (row 0)
|
30
|
-
* and next order should look like this (offset: 0, viewSize = 5):
|
31
|
-
* <body> (root node)
|
32
|
-
* ├ <tr> (row 0)
|
33
|
-
* ├ <tr> (row 1)
|
34
|
-
* ├ <tr> (row 2)
|
35
|
-
* ├ <tr> (row 3)
|
36
|
-
* └ <tr> (row 4)
|
37
|
-
* the generated commands/leads will look like this:
|
38
|
-
* <body> (root node)
|
39
|
-
* ├ <tr> (none, do nothing, leave as it is)
|
40
|
-
* ├ <tr> (append this element at index 1)
|
41
|
-
* ├ <tr> (append this element at index 2)
|
42
|
-
* ├ <tr> (append this element at index 3)
|
43
|
-
* └ <tr> (append this element at index 4)
|
44
|
-
*
|
45
|
-
* @returns {Array[]} Returns an array with generated commands/leads.
|
46
|
-
*/
|
47
|
-
diff() {
|
48
|
-
const {
|
49
|
-
sizeSet
|
50
|
-
} = this;
|
51
|
-
const {
|
52
|
-
currentSize: currentViewSize,
|
53
|
-
nextSize: nextViewSize
|
54
|
-
} = sizeSet.getViewSize();
|
55
|
-
let maxSize = Math.max(nextViewSize, currentViewSize);
|
56
|
-
if (maxSize === 0) {
|
57
|
-
return [];
|
58
|
-
}
|
59
|
-
const {
|
60
|
-
currentOffset,
|
61
|
-
nextOffset
|
62
|
-
} = sizeSet.getViewSize();
|
63
|
-
|
64
|
-
// @TODO(perf-tip): Creating an array (createRange) is not necessary it would be enough to generate
|
65
|
-
// commands based on numeric values.
|
66
|
-
const currentViewOrder = new _viewOrder.ViewOrder(currentOffset, currentViewSize);
|
67
|
-
const nextViewOrder = new _viewOrder.ViewOrder(nextOffset, nextViewSize);
|
68
|
-
const leads = [];
|
69
|
-
for (let i = 0; i < maxSize; i++) {
|
70
|
-
const currentIndex = currentViewOrder.get(i);
|
71
|
-
const nextIndex = nextViewOrder.get(i);
|
72
|
-
|
73
|
-
// Current index exceeds the next DOM index so it is necessary to generate a "remove" command
|
74
|
-
// to achieve new order.
|
75
|
-
if (nextIndex === -1) {
|
76
|
-
leads.push(['remove', currentIndex]);
|
77
|
-
|
78
|
-
// Next index exceeds the current DOM index so it is necessary to generate a "append" command
|
79
|
-
// to achieve new order.
|
80
|
-
} else if (currentIndex === -1) {
|
81
|
-
// Check what command should be generated (depends on if this work as a shared root node
|
82
|
-
// and in what position or not)
|
83
|
-
if (!sizeSet.isShared() || sizeSet.isShared() && sizeSet.isPlaceOn(_constants.WORKING_SPACE_BOTTOM)) {
|
84
|
-
/**
|
85
|
-
* If the differ has only one root node to manage with, the "append" command is generated.
|
86
|
-
*
|
87
|
-
* For example:
|
88
|
-
* ┌─────────── <body> (root node)
|
89
|
-
* │ <tr>
|
90
|
-
* │ <tr>
|
91
|
-
* (managed by one <tr>
|
92
|
-
* differ - TRs) <tr>
|
93
|
-
* │ <tr>
|
94
|
-
* └─────────── <tr> <--- Generates "append" command (which later executes `rootNode.appendChild(node)`)
|
95
|
-
*/
|
96
|
-
leads.push(['append', nextIndex]);
|
97
|
-
} else {
|
98
|
-
/**
|
99
|
-
* If the differ is sharing root node, the "prepend" command is generated.
|
100
|
-
*
|
101
|
-
* For example:
|
102
|
-
* ┌─────────── <tr> (root node, shared between two differs)
|
103
|
-
* (first differ) <th> <--- Generates "prepend" command (which later executes `rootNode.insertBefore(...)`)
|
104
|
-
* ├─────────── <td>
|
105
|
-
* │ <td>
|
106
|
-
* (second differ <td>
|
107
|
-
* - TDs) <td>
|
108
|
-
* │ <td>
|
109
|
-
* └─────────── <td>
|
110
|
-
*/
|
111
|
-
leads.push(['prepend', nextIndex]);
|
112
|
-
}
|
113
|
-
} else if (nextIndex > currentIndex) {
|
114
|
-
// This emulates DOM behavior when we try to append (or replace) an element which is already
|
115
|
-
// mounted. The old index in the array has to be popped out indicating that an element was
|
116
|
-
// moved to a different position.
|
117
|
-
if (currentViewOrder.has(nextIndex)) {
|
118
|
-
currentViewOrder.remove(nextIndex);
|
119
|
-
|
120
|
-
// Decrease loop size to prevent generating "remove" leads. "remove" leads are necessary only for nodes
|
121
|
-
// which are not mounted in current DOM order.
|
122
|
-
if (nextViewSize <= currentViewOrder.length) {
|
123
|
-
maxSize -= 1;
|
124
|
-
}
|
125
|
-
}
|
126
|
-
leads.push(['replace', nextIndex, currentIndex]);
|
127
|
-
} else if (nextIndex < currentIndex) {
|
128
|
-
const indexToRemove = currentViewOrder.prepend(nextIndex);
|
129
|
-
leads.push(['insert_before', nextIndex, currentIndex, indexToRemove]);
|
130
|
-
} else {
|
131
|
-
// for the same current and next indexes do nothing.
|
132
|
-
leads.push(['none', nextIndex]);
|
133
|
-
}
|
134
|
-
}
|
135
|
-
return leads;
|
136
|
-
}
|
137
|
-
}
|
138
|
-
exports.ViewDiffer = ViewDiffer;
|
@@ -1,135 +0,0 @@
|
|
1
|
-
import "core-js/modules/es.error.cause.js";
|
2
|
-
import "core-js/modules/es.array.push.js";
|
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
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
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
|
-
/* eslint-disable jsdoc/require-description-complete-sentence */
|
7
|
-
import { WORKING_SPACE_BOTTOM } from "../constants.mjs";
|
8
|
-
import { ViewOrder } from "./viewOrder.mjs";
|
9
|
-
/**
|
10
|
-
* A class which is responsible for generating commands/leads which has to be executed
|
11
|
-
* to achieve new DOM nodes order.
|
12
|
-
*
|
13
|
-
* @class {ViewDiffer}
|
14
|
-
*/
|
15
|
-
export class ViewDiffer {
|
16
|
-
constructor(sizeSet) {
|
17
|
-
_defineProperty(this, "sizeSet", void 0);
|
18
|
-
this.sizeSet = sizeSet;
|
19
|
-
}
|
20
|
-
|
21
|
-
/**
|
22
|
-
* A method which generates commands/leads which has to be executed to achieve new DOM
|
23
|
-
* nodes order based on new offset and view size.
|
24
|
-
*
|
25
|
-
* For example, if current order looks like this (offset = 0, viewSize = 1):
|
26
|
-
* <body> (root node)
|
27
|
-
* └ <tr> (row 0)
|
28
|
-
* and next order should look like this (offset: 0, viewSize = 5):
|
29
|
-
* <body> (root node)
|
30
|
-
* ├ <tr> (row 0)
|
31
|
-
* ├ <tr> (row 1)
|
32
|
-
* ├ <tr> (row 2)
|
33
|
-
* ├ <tr> (row 3)
|
34
|
-
* └ <tr> (row 4)
|
35
|
-
* the generated commands/leads will look like this:
|
36
|
-
* <body> (root node)
|
37
|
-
* ├ <tr> (none, do nothing, leave as it is)
|
38
|
-
* ├ <tr> (append this element at index 1)
|
39
|
-
* ├ <tr> (append this element at index 2)
|
40
|
-
* ├ <tr> (append this element at index 3)
|
41
|
-
* └ <tr> (append this element at index 4)
|
42
|
-
*
|
43
|
-
* @returns {Array[]} Returns an array with generated commands/leads.
|
44
|
-
*/
|
45
|
-
diff() {
|
46
|
-
const {
|
47
|
-
sizeSet
|
48
|
-
} = this;
|
49
|
-
const {
|
50
|
-
currentSize: currentViewSize,
|
51
|
-
nextSize: nextViewSize
|
52
|
-
} = sizeSet.getViewSize();
|
53
|
-
let maxSize = Math.max(nextViewSize, currentViewSize);
|
54
|
-
if (maxSize === 0) {
|
55
|
-
return [];
|
56
|
-
}
|
57
|
-
const {
|
58
|
-
currentOffset,
|
59
|
-
nextOffset
|
60
|
-
} = sizeSet.getViewSize();
|
61
|
-
|
62
|
-
// @TODO(perf-tip): Creating an array (createRange) is not necessary it would be enough to generate
|
63
|
-
// commands based on numeric values.
|
64
|
-
const currentViewOrder = new ViewOrder(currentOffset, currentViewSize);
|
65
|
-
const nextViewOrder = new ViewOrder(nextOffset, nextViewSize);
|
66
|
-
const leads = [];
|
67
|
-
for (let i = 0; i < maxSize; i++) {
|
68
|
-
const currentIndex = currentViewOrder.get(i);
|
69
|
-
const nextIndex = nextViewOrder.get(i);
|
70
|
-
|
71
|
-
// Current index exceeds the next DOM index so it is necessary to generate a "remove" command
|
72
|
-
// to achieve new order.
|
73
|
-
if (nextIndex === -1) {
|
74
|
-
leads.push(['remove', currentIndex]);
|
75
|
-
|
76
|
-
// Next index exceeds the current DOM index so it is necessary to generate a "append" command
|
77
|
-
// to achieve new order.
|
78
|
-
} else if (currentIndex === -1) {
|
79
|
-
// Check what command should be generated (depends on if this work as a shared root node
|
80
|
-
// and in what position or not)
|
81
|
-
if (!sizeSet.isShared() || sizeSet.isShared() && sizeSet.isPlaceOn(WORKING_SPACE_BOTTOM)) {
|
82
|
-
/**
|
83
|
-
* If the differ has only one root node to manage with, the "append" command is generated.
|
84
|
-
*
|
85
|
-
* For example:
|
86
|
-
* ┌─────────── <body> (root node)
|
87
|
-
* │ <tr>
|
88
|
-
* │ <tr>
|
89
|
-
* (managed by one <tr>
|
90
|
-
* differ - TRs) <tr>
|
91
|
-
* │ <tr>
|
92
|
-
* └─────────── <tr> <--- Generates "append" command (which later executes `rootNode.appendChild(node)`)
|
93
|
-
*/
|
94
|
-
leads.push(['append', nextIndex]);
|
95
|
-
} else {
|
96
|
-
/**
|
97
|
-
* If the differ is sharing root node, the "prepend" command is generated.
|
98
|
-
*
|
99
|
-
* For example:
|
100
|
-
* ┌─────────── <tr> (root node, shared between two differs)
|
101
|
-
* (first differ) <th> <--- Generates "prepend" command (which later executes `rootNode.insertBefore(...)`)
|
102
|
-
* ├─────────── <td>
|
103
|
-
* │ <td>
|
104
|
-
* (second differ <td>
|
105
|
-
* - TDs) <td>
|
106
|
-
* │ <td>
|
107
|
-
* └─────────── <td>
|
108
|
-
*/
|
109
|
-
leads.push(['prepend', nextIndex]);
|
110
|
-
}
|
111
|
-
} else if (nextIndex > currentIndex) {
|
112
|
-
// This emulates DOM behavior when we try to append (or replace) an element which is already
|
113
|
-
// mounted. The old index in the array has to be popped out indicating that an element was
|
114
|
-
// moved to a different position.
|
115
|
-
if (currentViewOrder.has(nextIndex)) {
|
116
|
-
currentViewOrder.remove(nextIndex);
|
117
|
-
|
118
|
-
// Decrease loop size to prevent generating "remove" leads. "remove" leads are necessary only for nodes
|
119
|
-
// which are not mounted in current DOM order.
|
120
|
-
if (nextViewSize <= currentViewOrder.length) {
|
121
|
-
maxSize -= 1;
|
122
|
-
}
|
123
|
-
}
|
124
|
-
leads.push(['replace', nextIndex, currentIndex]);
|
125
|
-
} else if (nextIndex < currentIndex) {
|
126
|
-
const indexToRemove = currentViewOrder.prepend(nextIndex);
|
127
|
-
leads.push(['insert_before', nextIndex, currentIndex, indexToRemove]);
|
128
|
-
} else {
|
129
|
-
// for the same current and next indexes do nothing.
|
130
|
-
leads.push(['none', nextIndex]);
|
131
|
-
}
|
132
|
-
}
|
133
|
-
return leads;
|
134
|
-
}
|
135
|
-
}
|
@@ -1,72 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
exports.__esModule = true;
|
4
|
-
require("core-js/modules/es.error.cause.js");
|
5
|
-
require("core-js/modules/es.array.unshift.js");
|
6
|
-
require("core-js/modules/esnext.iterator.map.js");
|
7
|
-
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
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
9
|
-
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); }
|
10
|
-
/**
|
11
|
-
* The view order is a list of indexes that represent the order of the rendered elements.
|
12
|
-
*
|
13
|
-
* @class {ViewOrder}
|
14
|
-
*/
|
15
|
-
class ViewOrder {
|
16
|
-
constructor(viewOffset, viewSize) {
|
17
|
-
_defineProperty(this, "order", []);
|
18
|
-
this.order = [...Array(viewSize).keys()].map(i => viewOffset + i);
|
19
|
-
}
|
20
|
-
|
21
|
-
/**
|
22
|
-
* The length of the view order.
|
23
|
-
*
|
24
|
-
* @returns {number}
|
25
|
-
*/
|
26
|
-
get length() {
|
27
|
-
return this.order.length;
|
28
|
-
}
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Checks if the view order contains the offset index.
|
32
|
-
*
|
33
|
-
* @param {number} offsetIndex The offset index.
|
34
|
-
* @returns {boolean}
|
35
|
-
*/
|
36
|
-
has(offsetIndex) {
|
37
|
-
return this.order.indexOf(offsetIndex) > -1;
|
38
|
-
}
|
39
|
-
|
40
|
-
/**
|
41
|
-
* Gets the offset index at the given zero-based index. If the index
|
42
|
-
* is out of bounds, -1 is returned.
|
43
|
-
*
|
44
|
-
* @param {number} zeroBasedIndex The zero-based index.
|
45
|
-
* @returns {number}
|
46
|
-
*/
|
47
|
-
get(zeroBasedIndex) {
|
48
|
-
return zeroBasedIndex < this.order.length ? this.order[zeroBasedIndex] : -1;
|
49
|
-
}
|
50
|
-
|
51
|
-
/**
|
52
|
-
* Removes the offset index from the view order.
|
53
|
-
*
|
54
|
-
* @param {number} offsetIndex The offset index.
|
55
|
-
*/
|
56
|
-
remove(offsetIndex) {
|
57
|
-
this.order.splice(this.order.indexOf(offsetIndex), 1);
|
58
|
-
}
|
59
|
-
|
60
|
-
/**
|
61
|
-
* Prepends the offset index to the view order. To keep the order length constant,
|
62
|
-
* the last offset index is removed.
|
63
|
-
*
|
64
|
-
* @param {number} offsetIndex The offset index.
|
65
|
-
* @returns {number}
|
66
|
-
*/
|
67
|
-
prepend(offsetIndex) {
|
68
|
-
this.order.unshift(offsetIndex);
|
69
|
-
return this.order.pop();
|
70
|
-
}
|
71
|
-
}
|
72
|
-
exports.ViewOrder = ViewOrder;
|
@@ -1,68 +0,0 @@
|
|
1
|
-
import "core-js/modules/es.error.cause.js";
|
2
|
-
import "core-js/modules/es.array.unshift.js";
|
3
|
-
import "core-js/modules/esnext.iterator.map.js";
|
4
|
-
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; }
|
5
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
6
|
-
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); }
|
7
|
-
/**
|
8
|
-
* The view order is a list of indexes that represent the order of the rendered elements.
|
9
|
-
*
|
10
|
-
* @class {ViewOrder}
|
11
|
-
*/
|
12
|
-
export class ViewOrder {
|
13
|
-
constructor(viewOffset, viewSize) {
|
14
|
-
_defineProperty(this, "order", []);
|
15
|
-
this.order = [...Array(viewSize).keys()].map(i => viewOffset + i);
|
16
|
-
}
|
17
|
-
|
18
|
-
/**
|
19
|
-
* The length of the view order.
|
20
|
-
*
|
21
|
-
* @returns {number}
|
22
|
-
*/
|
23
|
-
get length() {
|
24
|
-
return this.order.length;
|
25
|
-
}
|
26
|
-
|
27
|
-
/**
|
28
|
-
* Checks if the view order contains the offset index.
|
29
|
-
*
|
30
|
-
* @param {number} offsetIndex The offset index.
|
31
|
-
* @returns {boolean}
|
32
|
-
*/
|
33
|
-
has(offsetIndex) {
|
34
|
-
return this.order.indexOf(offsetIndex) > -1;
|
35
|
-
}
|
36
|
-
|
37
|
-
/**
|
38
|
-
* Gets the offset index at the given zero-based index. If the index
|
39
|
-
* is out of bounds, -1 is returned.
|
40
|
-
*
|
41
|
-
* @param {number} zeroBasedIndex The zero-based index.
|
42
|
-
* @returns {number}
|
43
|
-
*/
|
44
|
-
get(zeroBasedIndex) {
|
45
|
-
return zeroBasedIndex < this.order.length ? this.order[zeroBasedIndex] : -1;
|
46
|
-
}
|
47
|
-
|
48
|
-
/**
|
49
|
-
* Removes the offset index from the view order.
|
50
|
-
*
|
51
|
-
* @param {number} offsetIndex The offset index.
|
52
|
-
*/
|
53
|
-
remove(offsetIndex) {
|
54
|
-
this.order.splice(this.order.indexOf(offsetIndex), 1);
|
55
|
-
}
|
56
|
-
|
57
|
-
/**
|
58
|
-
* Prepends the offset index to the view order. To keep the order length constant,
|
59
|
-
* the last offset index is removed.
|
60
|
-
*
|
61
|
-
* @param {number} offsetIndex The offset index.
|
62
|
-
* @returns {number}
|
63
|
-
*/
|
64
|
-
prepend(offsetIndex) {
|
65
|
-
this.order.unshift(offsetIndex);
|
66
|
-
return this.order.pop();
|
67
|
-
}
|
68
|
-
}
|