handsontable 0.0.0-next-9891faa-20240822 → 0.0.0-next-0306a1a-20240826
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/constants.js +26 -0
- package/3rdparty/walkontable/src/calculator/constants.mjs +23 -0
- package/3rdparty/walkontable/src/calculator/index.js +17 -18
- package/3rdparty/walkontable/src/calculator/index.mjs +6 -11
- package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllColumns.js → renderAllColumns.js} +9 -32
- package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllColumns.mjs → renderAllColumns.mjs} +8 -31
- package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllRows.js → renderAllRows.js} +9 -32
- package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllRows.mjs → renderAllRows.mjs} +8 -31
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +145 -51
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +145 -51
- package/3rdparty/walkontable/src/calculator/viewportRows.js +141 -59
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +141 -59
- package/3rdparty/walkontable/src/index.js +0 -2
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/table.js +11 -5
- package/3rdparty/walkontable/src/table.mjs +11 -5
- package/3rdparty/walkontable/src/utils/column.js +1 -2
- package/3rdparty/walkontable/src/utils/column.mjs +1 -2
- package/3rdparty/walkontable/src/utils/columnStretching.js +19 -10
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +19 -10
- package/3rdparty/walkontable/src/viewport.js +46 -35
- package/3rdparty/walkontable/src/viewport.mjs +47 -36
- package/CHANGELOG.md +0 -27
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +2 -1
- package/core.js +1 -1
- package/core.mjs +2 -2
- package/dataMap/metaManager/metaSchema.js +6 -5
- package/dataMap/metaManager/metaSchema.mjs +6 -5
- package/dist/handsontable.css +20 -32
- package/dist/handsontable.full.css +20 -32
- package/dist/handsontable.full.js +2085 -2703
- package/dist/handsontable.full.min.css +5 -5
- package/dist/handsontable.full.min.js +148 -148
- package/dist/handsontable.js +2086 -2704
- package/dist/handsontable.min.css +4 -4
- package/dist/handsontable.min.js +14 -14
- package/editors/autocompleteEditor/autocompleteEditor.d.ts +1 -1
- package/helpers/a11y.js +0 -2
- package/helpers/a11y.mjs +0 -1
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/package.json +1 -1
- package/pluginHooks.js +1 -0
- package/pluginHooks.mjs +1 -0
- package/plugins/autoColumnSize/autoColumnSize.js +1 -1
- package/plugins/autoColumnSize/autoColumnSize.mjs +2 -2
- package/plugins/autoRowSize/autoRowSize.js +2 -1
- package/plugins/autoRowSize/autoRowSize.mjs +2 -1
- package/plugins/columnSorting/columnSorting.js +1 -10
- package/plugins/columnSorting/columnSorting.mjs +1 -10
- package/plugins/contextMenu/menu/menuItemRenderer.js +4 -3
- package/plugins/contextMenu/menu/menuItemRenderer.mjs +6 -5
- package/plugins/contextMenu/menu/positioner.js +12 -4
- package/plugins/contextMenu/menu/positioner.mjs +12 -4
- package/plugins/contextMenu/menu/utils.js +0 -11
- package/plugins/contextMenu/menu/utils.mjs +0 -10
- package/plugins/contextMenu/predefinedItems/alignment.js +49 -67
- package/plugins/contextMenu/predefinedItems/alignment.mjs +50 -68
- package/plugins/contextMenu/predefinedItems/readOnly.js +0 -11
- package/plugins/contextMenu/predefinedItems/readOnly.mjs +0 -11
- package/plugins/contextMenu/utils.js +0 -26
- package/plugins/contextMenu/utils.mjs +0 -24
- package/plugins/copyPaste/copyPaste.js +14 -14
- package/plugins/copyPaste/copyPaste.mjs +14 -14
- package/plugins/dropdownMenu/dropdownMenu.js +4 -10
- package/plugins/dropdownMenu/dropdownMenu.mjs +4 -10
- package/plugins/filters/component/condition.js +1 -6
- package/plugins/filters/component/condition.mjs +1 -6
- package/plugins/filters/component/value.js +1 -6
- package/plugins/filters/component/value.mjs +1 -6
- package/plugins/filters/conditionCollection.d.ts +3 -4
- package/plugins/filters/ui/multipleSelect.js +9 -7
- package/plugins/filters/ui/multipleSelect.mjs +9 -7
- package/plugins/manualRowResize/manualRowResize.js +1 -1
- package/plugins/manualRowResize/manualRowResize.mjs +2 -2
- package/plugins/mergeCells/cellsCollection.js +9 -11
- package/plugins/mergeCells/cellsCollection.mjs +10 -12
- package/shortcuts/utils.js +1 -3
- package/shortcuts/utils.mjs +1 -3
- package/utils/ghostTable.js +9 -11
- package/utils/ghostTable.mjs +10 -12
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.js +0 -126
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.mjs +0 -122
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.js +0 -119
- package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.mjs +0 -115
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.js +0 -125
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.mjs +0 -121
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.js +0 -118
- package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.mjs +0 -114
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.js +0 -37
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs +0 -33
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.js +0 -37
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs +0 -33
- package/3rdparty/walkontable/src/calculator/viewportBase.js +0 -92
- package/3rdparty/walkontable/src/calculator/viewportBase.mjs +0 -88
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
/**
|
5
|
+
* Render type calculation calculates how many DOM nodes should be created and where placed
|
6
|
+
* based on `startRow` and `endRow` properties.
|
7
|
+
*
|
8
|
+
* @type {number}
|
9
|
+
*/
|
10
|
+
const RENDER_TYPE = exports.RENDER_TYPE = 1;
|
11
|
+
/**
|
12
|
+
* Fully visible type calculation calculates rows that are fully visible in the viewport.
|
13
|
+
* This type of calculation is used in scrolling by arrow keys navigation.
|
14
|
+
*
|
15
|
+
* @type {number}
|
16
|
+
*/
|
17
|
+
const FULLY_VISIBLE_TYPE = exports.FULLY_VISIBLE_TYPE = 2;
|
18
|
+
/**
|
19
|
+
* Partially visible type calculation calculates rows that are fully and partially visible in
|
20
|
+
* the viewport. This type of calculation is used to check `endRow` (or `startRow`) with properties
|
21
|
+
* calculated in render calculator. If checking met the criteria slow render is
|
22
|
+
* performed (which render calculator with new data).
|
23
|
+
*
|
24
|
+
* @type {number}
|
25
|
+
*/
|
26
|
+
const PARTIALLY_VISIBLE_TYPE = exports.PARTIALLY_VISIBLE_TYPE = 3;
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/**
|
2
|
+
* Render type calculation calculates how many DOM nodes should be created and where placed
|
3
|
+
* based on `startRow` and `endRow` properties.
|
4
|
+
*
|
5
|
+
* @type {number}
|
6
|
+
*/
|
7
|
+
export const RENDER_TYPE = 1;
|
8
|
+
/**
|
9
|
+
* Fully visible type calculation calculates rows that are fully visible in the viewport.
|
10
|
+
* This type of calculation is used in scrolling by arrow keys navigation.
|
11
|
+
*
|
12
|
+
* @type {number}
|
13
|
+
*/
|
14
|
+
export const FULLY_VISIBLE_TYPE = 2;
|
15
|
+
/**
|
16
|
+
* Partially visible type calculation calculates rows that are fully and partially visible in
|
17
|
+
* the viewport. This type of calculation is used to check `endRow` (or `startRow`) with properties
|
18
|
+
* calculated in render calculator. If checking met the criteria slow render is
|
19
|
+
* performed (which render calculator with new data).
|
20
|
+
*
|
21
|
+
* @type {number}
|
22
|
+
*/
|
23
|
+
export const PARTIALLY_VISIBLE_TYPE = 3;
|
@@ -1,25 +1,24 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
var
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
var
|
11
|
-
exports.
|
12
|
-
var
|
13
|
-
exports.
|
14
|
-
var _renderedAllRows = require("./calculationType/renderedAllRows");
|
15
|
-
exports.RenderedAllRowsCalculationType = _renderedAllRows.RenderedAllRowsCalculationType;
|
16
|
-
var _renderedColumns = require("./calculationType/renderedColumns");
|
17
|
-
exports.RenderedColumnsCalculationType = _renderedColumns.RenderedColumnsCalculationType;
|
18
|
-
var _renderedRows = require("./calculationType/renderedRows");
|
19
|
-
exports.RenderedRowsCalculationType = _renderedRows.RenderedRowsCalculationType;
|
4
|
+
var _exportNames = {
|
5
|
+
RenderAllColumnsCalculator: true,
|
6
|
+
RenderAllRowsCalculator: true,
|
7
|
+
ViewportColumnsCalculator: true,
|
8
|
+
ViewportRowsCalculator: true
|
9
|
+
};
|
10
|
+
var _renderAllColumns = require("./renderAllColumns");
|
11
|
+
exports.RenderAllColumnsCalculator = _renderAllColumns.RenderAllColumnsCalculator;
|
12
|
+
var _renderAllRows = require("./renderAllRows");
|
13
|
+
exports.RenderAllRowsCalculator = _renderAllRows.RenderAllRowsCalculator;
|
20
14
|
var _viewportColumns = require("./viewportColumns");
|
21
15
|
exports.ViewportColumnsCalculator = _viewportColumns.ViewportColumnsCalculator;
|
22
|
-
exports.DEFAULT_COLUMN_WIDTH = _viewportColumns.DEFAULT_WIDTH;
|
23
16
|
var _viewportRows = require("./viewportRows");
|
24
17
|
exports.ViewportRowsCalculator = _viewportRows.ViewportRowsCalculator;
|
25
|
-
|
18
|
+
var _constants = require("./constants");
|
19
|
+
Object.keys(_constants).forEach(function (key) {
|
20
|
+
if (key === "default" || key === "__esModule") return;
|
21
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
22
|
+
if (key in exports && exports[key] === _constants[key]) return;
|
23
|
+
exports[key] = _constants[key];
|
24
|
+
});
|
@@ -1,11 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import {
|
5
|
-
|
6
|
-
|
7
|
-
import { RenderedColumnsCalculationType } from "./calculationType/renderedColumns.mjs";
|
8
|
-
import { RenderedRowsCalculationType } from "./calculationType/renderedRows.mjs";
|
9
|
-
import { ViewportColumnsCalculator, DEFAULT_WIDTH } from "./viewportColumns.mjs";
|
10
|
-
import { ViewportRowsCalculator, DEFAULT_HEIGHT } from "./viewportRows.mjs";
|
11
|
-
export { DEFAULT_HEIGHT as DEFAULT_ROW_HEIGHT, DEFAULT_WIDTH as DEFAULT_COLUMN_WIDTH, FullyVisibleColumnsCalculationType, FullyVisibleRowsCalculationType, PartiallyVisibleColumnsCalculationType, PartiallyVisibleRowsCalculationType, RenderedAllColumnsCalculationType, RenderedAllRowsCalculationType, RenderedColumnsCalculationType, RenderedRowsCalculationType, ViewportColumnsCalculator, ViewportRowsCalculator };
|
1
|
+
import { RenderAllColumnsCalculator } from "./renderAllColumns.mjs";
|
2
|
+
import { RenderAllRowsCalculator } from "./renderAllRows.mjs";
|
3
|
+
import { ViewportColumnsCalculator } from "./viewportColumns.mjs";
|
4
|
+
import { ViewportRowsCalculator } from "./viewportRows.mjs";
|
5
|
+
export * from "./constants.mjs";
|
6
|
+
export { RenderAllColumnsCalculator, RenderAllRowsCalculator, ViewportColumnsCalculator, ViewportRowsCalculator };
|
@@ -6,16 +6,19 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
6
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
7
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
8
|
/**
|
9
|
-
* @typedef {object}
|
9
|
+
* @typedef {object} RenderAllColumnsCalculatorOptions
|
10
10
|
* @property {number} totalColumns Total number of columns.
|
11
11
|
*/
|
12
12
|
/**
|
13
13
|
* Holds all calculations needed to perform the rendering of all columns.
|
14
14
|
*
|
15
|
-
* @class
|
15
|
+
* @class RenderAllColumnsCalculator
|
16
16
|
*/
|
17
|
-
class
|
18
|
-
|
17
|
+
class RenderAllColumnsCalculator {
|
18
|
+
/**
|
19
|
+
* @param {RenderAllColumnsCalculatorOptions} options Object with all options specified for column viewport calculation.
|
20
|
+
*/
|
21
|
+
constructor(options) {
|
19
22
|
/**
|
20
23
|
* Number of rendered/visible columns.
|
21
24
|
*
|
@@ -40,34 +43,8 @@ class RenderedAllColumnsCalculationType {
|
|
40
43
|
* @type {number}
|
41
44
|
*/
|
42
45
|
_defineProperty(this, "startPosition", 0);
|
43
|
-
|
44
|
-
* Determines if the viewport is visible in the trimming container.
|
45
|
-
*
|
46
|
-
* @type {boolean}
|
47
|
-
*/
|
48
|
-
_defineProperty(this, "isVisibleInTrimmingContainer", true);
|
49
|
-
}
|
50
|
-
/**
|
51
|
-
* Initializes the calculation.
|
52
|
-
*
|
53
|
-
* @param {ViewportColumnsCalculator} viewportCalculator The viewport calculator object.
|
54
|
-
*/
|
55
|
-
initialize(_ref) {
|
56
|
-
let {
|
57
|
-
totalColumns
|
58
|
-
} = _ref;
|
59
|
-
this.count = totalColumns;
|
46
|
+
this.count = options.totalColumns;
|
60
47
|
this.endColumn = this.count - 1;
|
61
48
|
}
|
62
|
-
|
63
|
-
/**
|
64
|
-
* Processes the column.
|
65
|
-
*/
|
66
|
-
process() {}
|
67
|
-
|
68
|
-
/**
|
69
|
-
* Finalizes the calculation.
|
70
|
-
*/
|
71
|
-
finalize() {}
|
72
49
|
}
|
73
|
-
exports.
|
50
|
+
exports.RenderAllColumnsCalculator = RenderAllColumnsCalculator;
|
@@ -3,16 +3,19 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
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
5
|
/**
|
6
|
-
* @typedef {object}
|
6
|
+
* @typedef {object} RenderAllColumnsCalculatorOptions
|
7
7
|
* @property {number} totalColumns Total number of columns.
|
8
8
|
*/
|
9
9
|
/**
|
10
10
|
* Holds all calculations needed to perform the rendering of all columns.
|
11
11
|
*
|
12
|
-
* @class
|
12
|
+
* @class RenderAllColumnsCalculator
|
13
13
|
*/
|
14
|
-
export class
|
15
|
-
|
14
|
+
export class RenderAllColumnsCalculator {
|
15
|
+
/**
|
16
|
+
* @param {RenderAllColumnsCalculatorOptions} options Object with all options specified for column viewport calculation.
|
17
|
+
*/
|
18
|
+
constructor(options) {
|
16
19
|
/**
|
17
20
|
* Number of rendered/visible columns.
|
18
21
|
*
|
@@ -37,33 +40,7 @@ export class RenderedAllColumnsCalculationType {
|
|
37
40
|
* @type {number}
|
38
41
|
*/
|
39
42
|
_defineProperty(this, "startPosition", 0);
|
40
|
-
|
41
|
-
* Determines if the viewport is visible in the trimming container.
|
42
|
-
*
|
43
|
-
* @type {boolean}
|
44
|
-
*/
|
45
|
-
_defineProperty(this, "isVisibleInTrimmingContainer", true);
|
46
|
-
}
|
47
|
-
/**
|
48
|
-
* Initializes the calculation.
|
49
|
-
*
|
50
|
-
* @param {ViewportColumnsCalculator} viewportCalculator The viewport calculator object.
|
51
|
-
*/
|
52
|
-
initialize(_ref) {
|
53
|
-
let {
|
54
|
-
totalColumns
|
55
|
-
} = _ref;
|
56
|
-
this.count = totalColumns;
|
43
|
+
this.count = options.totalColumns;
|
57
44
|
this.endColumn = this.count - 1;
|
58
45
|
}
|
59
|
-
|
60
|
-
/**
|
61
|
-
* Processes the column.
|
62
|
-
*/
|
63
|
-
process() {}
|
64
|
-
|
65
|
-
/**
|
66
|
-
* Finalizes the calculation.
|
67
|
-
*/
|
68
|
-
finalize() {}
|
69
46
|
}
|
package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllRows.js → renderAllRows.js}
RENAMED
@@ -6,16 +6,19 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
6
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
7
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
8
|
/**
|
9
|
-
* @typedef {object}
|
9
|
+
* @typedef {object} RenderAllRowsCalculatorOptions
|
10
10
|
* @property {number} totalRows Total number of rows.
|
11
11
|
*/
|
12
12
|
/**
|
13
13
|
* Holds all calculations needed to perform the rendering of all rows.
|
14
14
|
*
|
15
|
-
* @class
|
15
|
+
* @class RenderAllRowsCalculator
|
16
16
|
*/
|
17
|
-
class
|
18
|
-
|
17
|
+
class RenderAllRowsCalculator {
|
18
|
+
/**
|
19
|
+
* @param {RenderAllRowsCalculatorOptions} options Object with all options specified for row viewport calculation.
|
20
|
+
*/
|
21
|
+
constructor(options) {
|
19
22
|
/**
|
20
23
|
* Number of rendered/visible rows.
|
21
24
|
*
|
@@ -40,34 +43,8 @@ class RenderedAllRowsCalculationType {
|
|
40
43
|
* @type {number}
|
41
44
|
*/
|
42
45
|
_defineProperty(this, "startPosition", 0);
|
43
|
-
|
44
|
-
* Determines if the viewport is visible in the trimming container.
|
45
|
-
*
|
46
|
-
* @type {boolean}
|
47
|
-
*/
|
48
|
-
_defineProperty(this, "isVisibleInTrimmingContainer", true);
|
49
|
-
}
|
50
|
-
/**
|
51
|
-
* Initializes the calculation.
|
52
|
-
*
|
53
|
-
* @param {ViewportRowsCalculator} viewportCalculator The viewport calculator object.
|
54
|
-
*/
|
55
|
-
initialize(_ref) {
|
56
|
-
let {
|
57
|
-
totalRows
|
58
|
-
} = _ref;
|
59
|
-
this.count = totalRows;
|
46
|
+
this.count = options.totalRows;
|
60
47
|
this.endRow = this.count - 1;
|
61
48
|
}
|
62
|
-
|
63
|
-
/**
|
64
|
-
* Processes the row.
|
65
|
-
*/
|
66
|
-
process() {}
|
67
|
-
|
68
|
-
/**
|
69
|
-
* Finalizes the calculation.
|
70
|
-
*/
|
71
|
-
finalize() {}
|
72
49
|
}
|
73
|
-
exports.
|
50
|
+
exports.RenderAllRowsCalculator = RenderAllRowsCalculator;
|
@@ -3,16 +3,19 @@ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object
|
|
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
5
|
/**
|
6
|
-
* @typedef {object}
|
6
|
+
* @typedef {object} RenderAllRowsCalculatorOptions
|
7
7
|
* @property {number} totalRows Total number of rows.
|
8
8
|
*/
|
9
9
|
/**
|
10
10
|
* Holds all calculations needed to perform the rendering of all rows.
|
11
11
|
*
|
12
|
-
* @class
|
12
|
+
* @class RenderAllRowsCalculator
|
13
13
|
*/
|
14
|
-
export class
|
15
|
-
|
14
|
+
export class RenderAllRowsCalculator {
|
15
|
+
/**
|
16
|
+
* @param {RenderAllRowsCalculatorOptions} options Object with all options specified for row viewport calculation.
|
17
|
+
*/
|
18
|
+
constructor(options) {
|
16
19
|
/**
|
17
20
|
* Number of rendered/visible rows.
|
18
21
|
*
|
@@ -37,33 +40,7 @@ export class RenderedAllRowsCalculationType {
|
|
37
40
|
* @type {number}
|
38
41
|
*/
|
39
42
|
_defineProperty(this, "startPosition", 0);
|
40
|
-
|
41
|
-
* Determines if the viewport is visible in the trimming container.
|
42
|
-
*
|
43
|
-
* @type {boolean}
|
44
|
-
*/
|
45
|
-
_defineProperty(this, "isVisibleInTrimmingContainer", true);
|
46
|
-
}
|
47
|
-
/**
|
48
|
-
* Initializes the calculation.
|
49
|
-
*
|
50
|
-
* @param {ViewportRowsCalculator} viewportCalculator The viewport calculator object.
|
51
|
-
*/
|
52
|
-
initialize(_ref) {
|
53
|
-
let {
|
54
|
-
totalRows
|
55
|
-
} = _ref;
|
56
|
-
this.count = totalRows;
|
43
|
+
this.count = options.totalRows;
|
57
44
|
this.endRow = this.count - 1;
|
58
45
|
}
|
59
|
-
|
60
|
-
/**
|
61
|
-
* Processes the row.
|
62
|
-
*/
|
63
|
-
process() {}
|
64
|
-
|
65
|
-
/**
|
66
|
-
* Finalizes the calculation.
|
67
|
-
*/
|
68
|
-
finalize() {}
|
69
46
|
}
|
@@ -2,61 +2,89 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
|
+
require("core-js/modules/es.array.at.js");
|
5
6
|
require("core-js/modules/es.array.push.js");
|
6
|
-
var
|
7
|
+
var _constants = require("./constants");
|
8
|
+
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
9
|
+
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
7
10
|
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
11
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
9
12
|
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
|
-
|
13
|
+
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
14
|
+
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
15
|
+
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"); }
|
12
16
|
/**
|
13
17
|
* @typedef {object} ViewportColumnsCalculatorOptions
|
14
|
-
* @property {Map<string, ViewportBaseCalculator>} calculationTypes The calculation types to be performed.
|
15
18
|
* @property {number} viewportWidth Width of the viewport.
|
16
19
|
* @property {number} scrollOffset Current horizontal scroll position of the viewport.
|
17
20
|
* @property {number} totalColumns Total number of columns.
|
18
21
|
* @property {Function} columnWidthFn Function that returns the width of the column at a given index (in px).
|
19
|
-
* @property {Function} overrideFn Function that
|
22
|
+
* @property {Function} overrideFn Function that changes calculated this.startRow, this.endRow (used by
|
23
|
+
* MergeCells plugin).
|
24
|
+
* @property {string} calculationType String which describes types of calculation which will be performed.
|
20
25
|
* @property {string} inlineStartOffset Inline-start offset of the parent container.
|
26
|
+
* @property {string} stretchMode Stretch mode 'all' or 'last'.
|
27
|
+
* @property {Function} stretchingColumnWidthFn Function that returns the new width of the stretched column.
|
21
28
|
*/
|
22
29
|
/**
|
23
|
-
* Calculates indexes of columns to render OR columns that are visible
|
30
|
+
* Calculates indexes of columns to render OR columns that are visible.
|
31
|
+
* To redo the calculation, you need to create a new calculator.
|
24
32
|
*
|
25
33
|
* @class ViewportColumnsCalculator
|
26
34
|
*/
|
27
|
-
|
35
|
+
var _options = /*#__PURE__*/new WeakMap();
|
36
|
+
class ViewportColumnsCalculator {
|
37
|
+
/**
|
38
|
+
* Default column width.
|
39
|
+
*
|
40
|
+
* @type {number}
|
41
|
+
*/
|
42
|
+
static get DEFAULT_WIDTH() {
|
43
|
+
return 50;
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Number of rendered/visible columns.
|
48
|
+
*
|
49
|
+
* @type {number}
|
50
|
+
*/
|
51
|
+
|
28
52
|
/**
|
29
53
|
* @param {ViewportColumnsCalculatorOptions} options Object with all options specified for column viewport calculation.
|
30
54
|
*/
|
31
|
-
constructor(
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
_defineProperty(this, "
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
_defineProperty(this, "
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
this
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
constructor(options) {
|
56
|
+
_defineProperty(this, "count", 0);
|
57
|
+
/**
|
58
|
+
* Index of the first rendered/visible column (can be overwritten using overrideFn).
|
59
|
+
*
|
60
|
+
* @type {number|null}
|
61
|
+
*/
|
62
|
+
_defineProperty(this, "startColumn", null);
|
63
|
+
/**
|
64
|
+
* Index of the last rendered/visible column (can be overwritten using overrideFn).
|
65
|
+
*
|
66
|
+
* @type {null}
|
67
|
+
*/
|
68
|
+
_defineProperty(this, "endColumn", null);
|
69
|
+
/**
|
70
|
+
* Position of the first rendered/visible column (in px).
|
71
|
+
*
|
72
|
+
* @type {number|null}
|
73
|
+
*/
|
74
|
+
_defineProperty(this, "startPosition", null);
|
75
|
+
/**
|
76
|
+
* Determines if the viewport is visible in the trimming container.
|
77
|
+
*
|
78
|
+
* @type {boolean}
|
79
|
+
*/
|
80
|
+
_defineProperty(this, "isVisibleInTrimmingContainer", false);
|
81
|
+
/**
|
82
|
+
* The calculator options.
|
83
|
+
*
|
84
|
+
* @type {ViewportColumnsCalculatorOptions}
|
85
|
+
*/
|
86
|
+
_classPrivateFieldInitSpec(this, _options, void 0);
|
87
|
+
_classPrivateFieldSet(_options, this, options);
|
60
88
|
this.calculate();
|
61
89
|
}
|
62
90
|
|
@@ -64,30 +92,96 @@ class ViewportColumnsCalculator extends _viewportBase.ViewportBaseCalculator {
|
|
64
92
|
* Calculates viewport.
|
65
93
|
*/
|
66
94
|
calculate() {
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
95
|
+
const {
|
96
|
+
calculationType,
|
97
|
+
overrideFn,
|
98
|
+
scrollOffset,
|
99
|
+
totalColumns,
|
100
|
+
viewportWidth
|
101
|
+
} = _classPrivateFieldGet(_options, this);
|
102
|
+
const zeroBasedScrollOffset = Math.max(_classPrivateFieldGet(_options, this).scrollOffset, 0);
|
103
|
+
// +1 pixel for row header width compensation for horizontal scroll > 0
|
104
|
+
const compensatedViewportWidth = zeroBasedScrollOffset > 0 ? viewportWidth + 1 : viewportWidth;
|
105
|
+
let sum = 0;
|
106
|
+
let needReverse = true;
|
107
|
+
const startPositions = [];
|
108
|
+
let columnWidth;
|
109
|
+
let firstVisibleColumnWidth = 0;
|
110
|
+
let lastVisibleColumnWidth = 0;
|
111
|
+
for (let i = 0; i < totalColumns; i++) {
|
112
|
+
columnWidth = this._getColumnWidth(i);
|
113
|
+
if (sum <= zeroBasedScrollOffset && calculationType !== _constants.FULLY_VISIBLE_TYPE) {
|
114
|
+
this.startColumn = i;
|
115
|
+
firstVisibleColumnWidth = columnWidth;
|
116
|
+
}
|
117
|
+
if (sum >= zeroBasedScrollOffset && sum + (calculationType === _constants.FULLY_VISIBLE_TYPE ? columnWidth : 0) <= zeroBasedScrollOffset + compensatedViewportWidth) {
|
118
|
+
if (this.startColumn === null || this.startColumn === undefined) {
|
119
|
+
this.startColumn = i;
|
120
|
+
firstVisibleColumnWidth = columnWidth;
|
121
|
+
}
|
122
|
+
this.endColumn = i;
|
123
|
+
}
|
124
|
+
startPositions.push(sum);
|
125
|
+
sum += columnWidth;
|
126
|
+
lastVisibleColumnWidth = columnWidth;
|
127
|
+
if (calculationType !== _constants.FULLY_VISIBLE_TYPE) {
|
128
|
+
this.endColumn = i;
|
129
|
+
}
|
130
|
+
if (sum >= zeroBasedScrollOffset + viewportWidth) {
|
131
|
+
needReverse = false;
|
75
132
|
break;
|
76
133
|
}
|
77
134
|
}
|
78
|
-
|
135
|
+
const mostRightScrollOffset = scrollOffset + viewportWidth - compensatedViewportWidth;
|
136
|
+
const inlineEndColumnOffset = calculationType === _constants.FULLY_VISIBLE_TYPE ? 0 : lastVisibleColumnWidth;
|
137
|
+
const inlineStartColumnOffset = calculationType === _constants.FULLY_VISIBLE_TYPE ? firstVisibleColumnWidth : 0;
|
138
|
+
if (
|
139
|
+
// the table is to the left of the viewport
|
140
|
+
mostRightScrollOffset < -1 * _classPrivateFieldGet(_options, this).inlineStartOffset || scrollOffset > startPositions.at(-1) + inlineEndColumnOffset ||
|
141
|
+
// the table is to the right of the viewport
|
142
|
+
-1 * _classPrivateFieldGet(_options, this).scrollOffset - _classPrivateFieldGet(_options, this).viewportWidth > -1 * inlineStartColumnOffset) {
|
143
|
+
this.isVisibleInTrimmingContainer = false;
|
144
|
+
} else {
|
145
|
+
this.isVisibleInTrimmingContainer = true;
|
146
|
+
}
|
147
|
+
if (this.endColumn === totalColumns - 1 && needReverse) {
|
148
|
+
this.startColumn = this.endColumn;
|
149
|
+
while (this.startColumn > 0) {
|
150
|
+
const viewportSum = startPositions[this.endColumn] + columnWidth - startPositions[this.startColumn - 1];
|
151
|
+
if (viewportSum <= viewportWidth || calculationType !== _constants.FULLY_VISIBLE_TYPE) {
|
152
|
+
this.startColumn -= 1;
|
153
|
+
}
|
154
|
+
if (viewportSum > viewportWidth) {
|
155
|
+
break;
|
156
|
+
}
|
157
|
+
}
|
158
|
+
}
|
159
|
+
if (calculationType === _constants.RENDER_TYPE && this.startColumn !== null && overrideFn) {
|
160
|
+
overrideFn(this);
|
161
|
+
}
|
162
|
+
this.startPosition = startPositions[this.startColumn];
|
163
|
+
if (this.startPosition === undefined) {
|
164
|
+
this.startPosition = null;
|
165
|
+
}
|
166
|
+
|
167
|
+
// If totalColumns exceeded its total columns size set endColumn to the latest item
|
168
|
+
if (totalColumns < this.endColumn) {
|
169
|
+
this.endColumn = totalColumns - 1;
|
170
|
+
}
|
171
|
+
if (this.startColumn !== null) {
|
172
|
+
this.count = this.endColumn - this.startColumn + 1;
|
173
|
+
}
|
79
174
|
}
|
80
175
|
|
81
176
|
/**
|
82
|
-
*
|
83
|
-
*
|
84
|
-
* @param {number} column Column index.
|
177
|
+
* @param {number} column The visual column index.
|
85
178
|
* @returns {number}
|
179
|
+
* @private
|
86
180
|
*/
|
87
|
-
|
88
|
-
|
181
|
+
_getColumnWidth(column) {
|
182
|
+
let width = _classPrivateFieldGet(_options, this).columnWidthFn(column);
|
89
183
|
if (isNaN(width)) {
|
90
|
-
|
184
|
+
width = ViewportColumnsCalculator.DEFAULT_WIDTH;
|
91
185
|
}
|
92
186
|
return width;
|
93
187
|
}
|