handsontable 0.0.0-next-8f89e29-20241003 → 0.0.0-next-fbc95c1-20241003
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/calculationType/renderedColumns.js +23 -0
- package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs +23 -0
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.js +23 -0
- package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs +23 -0
- package/3rdparty/walkontable/src/core/_base.js +7 -0
- package/3rdparty/walkontable/src/core/_base.mjs +7 -0
- package/3rdparty/walkontable/src/facade/core.js +3 -0
- package/3rdparty/walkontable/src/facade/core.mjs +3 -0
- package/3rdparty/walkontable/src/overlay/_base.js +3 -0
- package/3rdparty/walkontable/src/overlay/_base.mjs +3 -0
- package/3rdparty/walkontable/src/selection/border/border.js +32 -44
- package/3rdparty/walkontable/src/selection/border/border.mjs +32 -44
- package/3rdparty/walkontable/src/selection/scanner.js +46 -11
- package/3rdparty/walkontable/src/selection/scanner.mjs +46 -11
- package/3rdparty/walkontable/src/settings.js +8 -0
- package/3rdparty/walkontable/src/settings.mjs +8 -0
- package/3rdparty/walkontable/src/table.js +6 -3
- package/3rdparty/walkontable/src/table.mjs +6 -3
- package/3rdparty/walkontable/src/viewport.js +26 -4
- package/3rdparty/walkontable/src/viewport.mjs +26 -4
- package/base.js +4 -4
- package/base.mjs +3 -3
- package/core/hooks/bucket.js +180 -0
- package/core/hooks/bucket.mjs +176 -0
- package/{pluginHooks.mjs → core/hooks/constants.js} +20 -486
- package/{pluginHooks.js → core/hooks/constants.mjs} +16 -489
- package/{pluginHooks.d.ts → core/hooks/index.d.ts} +17 -21
- package/core/hooks/index.js +385 -0
- package/core/hooks/index.mjs +381 -0
- package/core.d.ts +1 -1
- package/core.js +13 -12
- package/core.mjs +5 -4
- package/dataMap/metaManager/metaSchema.js +68 -2
- package/dataMap/metaManager/metaSchema.mjs +68 -2
- package/dataMap/metaManager/mods/dynamicCellMeta.js +2 -3
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +1 -1
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +3009 -2582
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +79 -79
- package/dist/handsontable.js +3011 -2584
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +18 -18
- package/editorManager.js +2 -2
- package/editorManager.mjs +2 -2
- package/editors/baseEditor/baseEditor.js +23 -16
- package/editors/baseEditor/baseEditor.mjs +23 -16
- package/editors/dropdownEditor/dropdownEditor.js +2 -3
- package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
- package/editors/registry.js +2 -2
- package/editors/registry.mjs +1 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/index.d.ts +2 -1
- package/package.json +1 -1
- package/plugins/autoColumnSize/autoColumnSize.js +18 -27
- package/plugins/autoColumnSize/autoColumnSize.mjs +18 -27
- package/plugins/autoRowSize/autoRowSize.js +16 -22
- package/plugins/autoRowSize/autoRowSize.mjs +17 -23
- package/plugins/autofill/autofill.js +4 -5
- package/plugins/autofill/autofill.mjs +1 -1
- package/plugins/base/base.d.ts +1 -1
- package/plugins/base/base.js +39 -0
- package/plugins/base/base.mjs +40 -1
- package/plugins/base/index.js +2 -1
- package/plugins/base/index.mjs +1 -1
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +2 -5
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +2 -5
- package/plugins/columnSorting/columnSorting.js +3 -4
- package/plugins/columnSorting/columnSorting.mjs +1 -1
- package/plugins/comments/comments.js +7 -15
- package/plugins/comments/comments.mjs +8 -16
- package/plugins/contextMenu/contextMenu.js +6 -7
- package/plugins/contextMenu/contextMenu.mjs +1 -1
- package/plugins/copyPaste/copyPaste.js +29 -23
- package/plugins/copyPaste/copyPaste.mjs +21 -15
- package/plugins/dropdownMenu/dropdownMenu.js +6 -7
- package/plugins/dropdownMenu/dropdownMenu.mjs +1 -1
- package/plugins/formulas/formulas.js +7 -7
- package/plugins/formulas/formulas.mjs +1 -1
- package/plugins/hiddenColumns/hiddenColumns.js +19 -30
- package/plugins/hiddenColumns/hiddenColumns.mjs +15 -26
- package/plugins/hiddenRows/hiddenRows.js +18 -29
- package/plugins/hiddenRows/hiddenRows.mjs +14 -25
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +5 -5
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +1 -1
- package/plugins/manualColumnMove/manualColumnMove.js +3 -3
- package/plugins/manualColumnMove/manualColumnMove.mjs +1 -1
- package/plugins/manualRowMove/manualRowMove.js +5 -5
- package/plugins/manualRowMove/manualRowMove.mjs +3 -3
- package/plugins/mergeCells/cellsCollection.js +15 -3
- package/plugins/mergeCells/cellsCollection.mjs +16 -4
- package/plugins/mergeCells/mergeCells.d.ts +6 -2
- package/plugins/mergeCells/mergeCells.js +78 -55
- package/plugins/mergeCells/mergeCells.mjs +76 -53
- package/plugins/mergeCells/renderer.js +13 -3
- package/plugins/mergeCells/renderer.mjs +13 -3
- package/plugins/persistentState/persistentState.js +4 -4
- package/plugins/persistentState/persistentState.mjs +1 -1
- package/plugins/undoRedo/undoRedo.js +4 -5
- package/plugins/undoRedo/undoRedo.mjs +3 -3
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
- package/settings.d.ts +3 -1
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +1 -1
- package/shortcutContexts/commands/scrollToFocusedCell.js +4 -4
- package/shortcutContexts/commands/scrollToFocusedCell.mjs +4 -4
- package/tableView.js +40 -9
- package/tableView.mjs +40 -9
@@ -31,7 +31,7 @@ function createMergeCellRenderer(plugin) {
|
|
31
31
|
*
|
32
32
|
* @private
|
33
33
|
* @param {HTMLElement} TD The cell to be modified.
|
34
|
-
* @param {number} row
|
34
|
+
* @param {number} row Visual row index.
|
35
35
|
* @param {number} col Visual column index.
|
36
36
|
*/
|
37
37
|
function after(TD, row, col) {
|
@@ -49,13 +49,23 @@ function createMergeCellRenderer(plugin) {
|
|
49
49
|
rowspan: origRowspan
|
50
50
|
} = mergedCell;
|
51
51
|
const [lastMergedRowIndex, lastMergedColumnIndex] = plugin.translateMergedCellToRenderable(origRow, origRowspan, origColumn, origColspan);
|
52
|
+
const isVirtualRenderingEnabled = plugin.getSetting('virtualized');
|
52
53
|
const renderedRowIndex = rowMapper.getRenderableFromVisualIndex(row);
|
53
54
|
const renderedColumnIndex = columnMapper.getRenderableFromVisualIndex(col);
|
54
55
|
const maxRowSpan = lastMergedRowIndex - renderedRowIndex + 1; // Number of rendered columns.
|
55
56
|
const maxColSpan = lastMergedColumnIndex - renderedColumnIndex + 1; // Number of rendered columns.
|
56
57
|
|
57
|
-
|
58
|
-
|
58
|
+
let notHiddenRow = rowMapper.getNearestNotHiddenIndex(origRow, 1);
|
59
|
+
let notHiddenColumn = columnMapper.getNearestNotHiddenIndex(origColumn, 1);
|
60
|
+
if (isVirtualRenderingEnabled) {
|
61
|
+
const overlayName = hot.view.getActiveOverlayName();
|
62
|
+
if (!['top', 'top_inline_start_corner'].includes(overlayName)) {
|
63
|
+
notHiddenRow = Math.max(notHiddenRow, hot.getFirstRenderedVisibleRow());
|
64
|
+
}
|
65
|
+
if (!['inline_start', 'top_inline_start_corner', 'bottom_inline_start_corner'].includes(overlayName)) {
|
66
|
+
notHiddenColumn = Math.max(notHiddenColumn, hot.getFirstRenderedVisibleColumn());
|
67
|
+
}
|
68
|
+
}
|
59
69
|
const notHiddenRowspan = Math.min(origRowspan, maxRowSpan);
|
60
70
|
const notHiddenColspan = Math.min(origColspan, maxColSpan);
|
61
71
|
if (notHiddenRow === row && notHiddenColumn === col) {
|
@@ -27,7 +27,7 @@ export function createMergeCellRenderer(plugin) {
|
|
27
27
|
*
|
28
28
|
* @private
|
29
29
|
* @param {HTMLElement} TD The cell to be modified.
|
30
|
-
* @param {number} row
|
30
|
+
* @param {number} row Visual row index.
|
31
31
|
* @param {number} col Visual column index.
|
32
32
|
*/
|
33
33
|
function after(TD, row, col) {
|
@@ -45,13 +45,23 @@ export function createMergeCellRenderer(plugin) {
|
|
45
45
|
rowspan: origRowspan
|
46
46
|
} = mergedCell;
|
47
47
|
const [lastMergedRowIndex, lastMergedColumnIndex] = plugin.translateMergedCellToRenderable(origRow, origRowspan, origColumn, origColspan);
|
48
|
+
const isVirtualRenderingEnabled = plugin.getSetting('virtualized');
|
48
49
|
const renderedRowIndex = rowMapper.getRenderableFromVisualIndex(row);
|
49
50
|
const renderedColumnIndex = columnMapper.getRenderableFromVisualIndex(col);
|
50
51
|
const maxRowSpan = lastMergedRowIndex - renderedRowIndex + 1; // Number of rendered columns.
|
51
52
|
const maxColSpan = lastMergedColumnIndex - renderedColumnIndex + 1; // Number of rendered columns.
|
52
53
|
|
53
|
-
|
54
|
-
|
54
|
+
let notHiddenRow = rowMapper.getNearestNotHiddenIndex(origRow, 1);
|
55
|
+
let notHiddenColumn = columnMapper.getNearestNotHiddenIndex(origColumn, 1);
|
56
|
+
if (isVirtualRenderingEnabled) {
|
57
|
+
const overlayName = hot.view.getActiveOverlayName();
|
58
|
+
if (!['top', 'top_inline_start_corner'].includes(overlayName)) {
|
59
|
+
notHiddenRow = Math.max(notHiddenRow, hot.getFirstRenderedVisibleRow());
|
60
|
+
}
|
61
|
+
if (!['inline_start', 'top_inline_start_corner', 'bottom_inline_start_corner'].includes(overlayName)) {
|
62
|
+
notHiddenColumn = Math.max(notHiddenColumn, hot.getFirstRenderedVisibleColumn());
|
63
|
+
}
|
64
|
+
}
|
55
65
|
const notHiddenRowspan = Math.min(origRowspan, maxRowSpan);
|
56
66
|
const notHiddenColspan = Math.min(origColspan, maxColSpan);
|
57
67
|
if (notHiddenRow === row && notHiddenColumn === col) {
|
@@ -4,14 +4,14 @@ exports.__esModule = true;
|
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
5
|
var _base = require("../base");
|
6
6
|
var _storage = _interopRequireDefault(require("./storage"));
|
7
|
-
var
|
7
|
+
var _hooks = require("../../core/hooks");
|
8
8
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
9
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; }
|
10
10
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
11
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); }
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
_hooks.Hooks.getSingleton().register('persistentStateSave');
|
13
|
+
_hooks.Hooks.getSingleton().register('persistentStateLoad');
|
14
|
+
_hooks.Hooks.getSingleton().register('persistentStateReset');
|
15
15
|
const PLUGIN_KEY = exports.PLUGIN_KEY = 'persistentState';
|
16
16
|
const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 0;
|
17
17
|
|
@@ -4,7 +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 { BasePlugin } from "../base/index.mjs";
|
6
6
|
import Storage from "./storage.mjs";
|
7
|
-
import Hooks from "../../
|
7
|
+
import { Hooks } from "../../core/hooks/index.mjs";
|
8
8
|
Hooks.getSingleton().register('persistentStateSave');
|
9
9
|
Hooks.getSingleton().register('persistentStateLoad');
|
10
10
|
Hooks.getSingleton().register('persistentStateReset');
|
@@ -3,13 +3,12 @@
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.array.push.js");
|
5
5
|
require("core-js/modules/es.object.from-entries.js");
|
6
|
-
var
|
6
|
+
var _hooks = require("../../core/hooks");
|
7
7
|
var _array = require("../../helpers/array");
|
8
8
|
var _number = require("../../helpers/number");
|
9
9
|
var _object = require("../../helpers/object");
|
10
10
|
var _utils = require("../contextMenu/utils");
|
11
11
|
var _moves = require("../../helpers/moves");
|
12
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
13
12
|
const SHORTCUTS_GROUP = 'undoRedo';
|
14
13
|
const PLUGIN_KEY = exports.PLUGIN_KEY = 'undoRedo';
|
15
14
|
|
@@ -401,8 +400,8 @@ UndoRedo.ChangeAction.prototype.undo = function (instance, undoneCallback) {
|
|
401
400
|
if (selectedLast !== undefined) {
|
402
401
|
const [changedRow, changedColumn] = data[0];
|
403
402
|
const [selectedRow, selectedColumn] = selectedLast;
|
404
|
-
const firstFullyVisibleRow = instance.
|
405
|
-
const firstFullyVisibleColumn = instance.
|
403
|
+
const firstFullyVisibleRow = instance.getFirstFullyVisibleRow();
|
404
|
+
const firstFullyVisibleColumn = instance.getFirstFullyVisibleColumn();
|
406
405
|
const isInVerticalViewPort = changedRow >= firstFullyVisibleRow;
|
407
406
|
const isInHorizontalViewPort = changedColumn >= firstFullyVisibleColumn;
|
408
407
|
const isInViewport = isInVerticalViewPort && isInHorizontalViewPort;
|
@@ -972,7 +971,7 @@ function removeExposedUndoRedoMethods(instance) {
|
|
972
971
|
delete instance.isRedoAvailable;
|
973
972
|
delete instance.clearUndo;
|
974
973
|
}
|
975
|
-
const hook =
|
974
|
+
const hook = _hooks.Hooks.getSingleton();
|
976
975
|
hook.add('afterUpdateSettings', function () {
|
977
976
|
var _this$getPlugin;
|
978
977
|
(_this$getPlugin = this.getPlugin('undoRedo')) === null || _this$getPlugin === void 0 || _this$getPlugin.init();
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import "core-js/modules/es.array.push.js";
|
2
2
|
import "core-js/modules/es.object.from-entries.js";
|
3
|
-
import Hooks from "../../
|
3
|
+
import { Hooks } from "../../core/hooks/index.mjs";
|
4
4
|
import { arrayMap, arrayEach } from "../../helpers/array.mjs";
|
5
5
|
import { rangeEach } from "../../helpers/number.mjs";
|
6
6
|
import { inherit, deepClone } from "../../helpers/object.mjs";
|
@@ -397,8 +397,8 @@ UndoRedo.ChangeAction.prototype.undo = function (instance, undoneCallback) {
|
|
397
397
|
if (selectedLast !== undefined) {
|
398
398
|
const [changedRow, changedColumn] = data[0];
|
399
399
|
const [selectedRow, selectedColumn] = selectedLast;
|
400
|
-
const firstFullyVisibleRow = instance.
|
401
|
-
const firstFullyVisibleColumn = instance.
|
400
|
+
const firstFullyVisibleRow = instance.getFirstFullyVisibleRow();
|
401
|
+
const firstFullyVisibleColumn = instance.getFirstFullyVisibleColumn();
|
402
402
|
const isInVerticalViewPort = changedRow >= firstFullyVisibleRow;
|
403
403
|
const isInHorizontalViewPort = changedColumn >= firstFullyVisibleColumn;
|
404
404
|
const isInViewport = isInVerticalViewPort && isInHorizontalViewPort;
|
@@ -8,7 +8,7 @@ var _eventManager = _interopRequireDefault(require("../../eventManager"));
|
|
8
8
|
var _element = require("../../helpers/dom/element");
|
9
9
|
var _mixed = require("../../helpers/mixed");
|
10
10
|
var _shortcutContexts = require("../../shortcutContexts");
|
11
|
-
var
|
11
|
+
var _hooks = require("../../core/hooks");
|
12
12
|
var _a11y = require("../../helpers/a11y");
|
13
13
|
var _constants = require("../../i18n/constants");
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
@@ -19,7 +19,7 @@ const ATTR_ROW = 'data-row';
|
|
19
19
|
const ATTR_COLUMN = 'data-col';
|
20
20
|
const SHORTCUTS_GROUP = 'checkboxRenderer';
|
21
21
|
const RENDERER_TYPE = exports.RENDERER_TYPE = 'checkbox';
|
22
|
-
|
22
|
+
_hooks.Hooks.getSingleton().add('modifyAutoColumnSizeSeed', function (bundleSeed, cellMeta, cellValue) {
|
23
23
|
const {
|
24
24
|
label,
|
25
25
|
type,
|
@@ -4,7 +4,7 @@ import EventManager from "../../eventManager.mjs";
|
|
4
4
|
import { empty, addClass, setAttribute } from "../../helpers/dom/element.mjs";
|
5
5
|
import { isEmpty, stringify } from "../../helpers/mixed.mjs";
|
6
6
|
import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
|
7
|
-
import Hooks from "../../
|
7
|
+
import { Hooks } from "../../core/hooks/index.mjs";
|
8
8
|
import { A11Y_CHECKBOX, A11Y_CHECKED, A11Y_LABEL } from "../../helpers/a11y.mjs";
|
9
9
|
import { CHECKBOX_CHECKED, CHECKBOX_UNCHECKED } from "../../i18n/constants.mjs";
|
10
10
|
const isListeningKeyDownEvent = new WeakMap();
|
package/settings.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { PikadayOptions } from '@handsontable/pikaday';
|
2
2
|
import Core from './core';
|
3
|
-
import { Events } from './
|
3
|
+
import { Events } from './core/hooks';
|
4
4
|
import {
|
5
5
|
CellValue,
|
6
6
|
ColumnDataGetterSetterFunction,
|
@@ -224,6 +224,8 @@ export interface GridSettings extends Events {
|
|
224
224
|
validator?: BaseValidator | RegExp | ValidatorType | string;
|
225
225
|
viewportColumnRenderingOffset?: number | 'auto';
|
226
226
|
viewportRowRenderingOffset?: number | 'auto';
|
227
|
+
viewportColumnRenderingThreshold?: number | 'auto';
|
228
|
+
viewportRowRenderingThreshold?: number | 'auto';
|
227
229
|
visibleRows?: number;
|
228
230
|
width?: number | string | (() => number | string);
|
229
231
|
wordWrap?: boolean;
|
@@ -11,7 +11,7 @@ const command = exports.command = {
|
|
11
11
|
const row = hot.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
|
12
12
|
if (row !== null) {
|
13
13
|
const coords = hot._createCellCoords(row, to.col);
|
14
|
-
const scrollPadding = to.row - hot.
|
14
|
+
const scrollPadding = to.row - hot.getFirstFullyVisibleRow();
|
15
15
|
const nextVerticalScroll = Math.min(coords.row - scrollPadding, hot.countRows() - 1);
|
16
16
|
hot.selection.setRangeEnd(coords);
|
17
17
|
hot.scrollViewportTo({
|
@@ -8,7 +8,7 @@ export const command = {
|
|
8
8
|
const row = hot.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, -1);
|
9
9
|
if (row !== null) {
|
10
10
|
const coords = hot._createCellCoords(row, to.col);
|
11
|
-
const scrollPadding = to.row - hot.
|
11
|
+
const scrollPadding = to.row - hot.getFirstFullyVisibleRow();
|
12
12
|
const nextVerticalScroll = Math.min(coords.row - scrollPadding, hot.countRows() - 1);
|
13
13
|
hot.selection.setRangeEnd(coords);
|
14
14
|
hot.scrollViewportTo({
|
@@ -11,7 +11,7 @@ const command = exports.command = {
|
|
11
11
|
const row = hot.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
|
12
12
|
if (row !== null) {
|
13
13
|
const coords = hot._createCellCoords(row, to.col);
|
14
|
-
const scrollPadding = to.row - hot.
|
14
|
+
const scrollPadding = to.row - hot.getFirstFullyVisibleRow();
|
15
15
|
const nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
|
16
16
|
hot.selection.setRangeEnd(coords);
|
17
17
|
hot.scrollViewportTo({
|
@@ -8,7 +8,7 @@ export const command = {
|
|
8
8
|
const row = hot.rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1);
|
9
9
|
if (row !== null) {
|
10
10
|
const coords = hot._createCellCoords(row, to.col);
|
11
|
-
const scrollPadding = to.row - hot.
|
11
|
+
const scrollPadding = to.row - hot.getFirstFullyVisibleRow();
|
12
12
|
const nextVerticalScroll = Math.max(coords.row - scrollPadding, 0);
|
13
13
|
hot.selection.setRangeEnd(coords);
|
14
14
|
hot.scrollViewportTo({
|
@@ -7,10 +7,10 @@ const command = exports.command = {
|
|
7
7
|
const {
|
8
8
|
highlight
|
9
9
|
} = hot.getSelectedRangeLast();
|
10
|
-
const firstVisibleRow = hot.
|
11
|
-
const firstVisibleColumn = hot.
|
12
|
-
const lastVisibleRow = hot.
|
13
|
-
const lastVisibleColumn = hot.
|
10
|
+
const firstVisibleRow = hot.getFirstFullyVisibleRow() - 1;
|
11
|
+
const firstVisibleColumn = hot.getFirstFullyVisibleColumn() - 1;
|
12
|
+
const lastVisibleRow = hot.getLastFullyVisibleRow() + 1;
|
13
|
+
const lastVisibleColumn = hot.getLastFullyVisibleColumn() + 1;
|
14
14
|
const visibleCoordsFrom = hot._createCellCoords(firstVisibleRow, firstVisibleColumn);
|
15
15
|
const visibleCoordsTo = hot._createCellCoords(lastVisibleRow, lastVisibleColumn);
|
16
16
|
const visibleRange = hot._createCellRange(visibleCoordsFrom, visibleCoordsFrom, visibleCoordsTo);
|
@@ -4,10 +4,10 @@ export const command = {
|
|
4
4
|
const {
|
5
5
|
highlight
|
6
6
|
} = hot.getSelectedRangeLast();
|
7
|
-
const firstVisibleRow = hot.
|
8
|
-
const firstVisibleColumn = hot.
|
9
|
-
const lastVisibleRow = hot.
|
10
|
-
const lastVisibleColumn = hot.
|
7
|
+
const firstVisibleRow = hot.getFirstFullyVisibleRow() - 1;
|
8
|
+
const firstVisibleColumn = hot.getFirstFullyVisibleColumn() - 1;
|
9
|
+
const lastVisibleRow = hot.getLastFullyVisibleRow() + 1;
|
10
|
+
const lastVisibleColumn = hot.getLastFullyVisibleColumn() + 1;
|
11
11
|
const visibleCoordsFrom = hot._createCellCoords(firstVisibleRow, firstVisibleColumn);
|
12
12
|
const visibleCoordsTo = hot._createCellCoords(lastVisibleRow, lastVisibleColumn);
|
13
13
|
const visibleRange = hot._createCellRange(visibleCoordsFrom, visibleCoordsFrom, visibleCoordsTo);
|
package/tableView.js
CHANGED
@@ -614,6 +614,8 @@ class TableView {
|
|
614
614
|
preventOverflow: () => this.settings.preventOverflow,
|
615
615
|
preventWheel: () => this.settings.preventWheel,
|
616
616
|
stretchH: () => this.settings.stretchH,
|
617
|
+
viewportColumnRenderingThreshold: () => this.settings.viewportColumnRenderingThreshold,
|
618
|
+
viewportRowRenderingThreshold: () => this.settings.viewportRowRenderingThreshold,
|
617
619
|
data: (renderableRow, renderableColumn) => {
|
618
620
|
return this.hot.getDataAtCell(...this.translateFromRenderableToVisualIndex(renderableRow, renderableColumn));
|
619
621
|
},
|
@@ -696,7 +698,7 @@ class TableView {
|
|
696
698
|
const [visualRowIndex, visualColumnIndex] = this.translateFromRenderableToVisualIndex(renderedRowIndex, renderedColumnIndex);
|
697
699
|
|
698
700
|
// Coords may be modified. For example, by the `MergeCells` plugin. It should affect cell value and cell meta.
|
699
|
-
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', visualRowIndex, visualColumnIndex);
|
701
|
+
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', visualRowIndex, visualColumnIndex, false, 'meta');
|
700
702
|
let visualRowToCheck = visualRowIndex;
|
701
703
|
let visualColumnToCheck = visualColumnIndex;
|
702
704
|
if (Array.isArray(modifiedCellCoords)) {
|
@@ -915,14 +917,14 @@ class TableView {
|
|
915
917
|
return this.hot.runHooks('beforeStretchingColumnWidth', stretchedWidth, visualColumnIndex);
|
916
918
|
},
|
917
919
|
onModifyRowHeaderWidth: rowHeaderWidth => this.hot.runHooks('modifyRowHeaderWidth', rowHeaderWidth),
|
918
|
-
onModifyGetCellCoords: (renderableRowIndex, renderableColumnIndex, topmost) => {
|
920
|
+
onModifyGetCellCoords: (renderableRowIndex, renderableColumnIndex, topmost, source) => {
|
919
921
|
const rowMapper = this.hot.rowIndexMapper;
|
920
922
|
const columnMapper = this.hot.columnIndexMapper;
|
921
923
|
|
922
924
|
// Callback handle also headers. We shouldn't translate them.
|
923
925
|
const visualColumnIndex = renderableColumnIndex >= 0 ? columnMapper.getVisualFromRenderableIndex(renderableColumnIndex) : renderableColumnIndex;
|
924
926
|
const visualRowIndex = renderableRowIndex >= 0 ? rowMapper.getVisualFromRenderableIndex(renderableRowIndex) : renderableRowIndex;
|
925
|
-
const visualIndexes = this.hot.runHooks('modifyGetCellCoords', visualRowIndex, visualColumnIndex, topmost);
|
927
|
+
const visualIndexes = this.hot.runHooks('modifyGetCellCoords', visualRowIndex, visualColumnIndex, topmost, source);
|
926
928
|
if (Array.isArray(visualIndexes)) {
|
927
929
|
const [visualRowFrom, visualColumnFrom, visualRowTo, visualColumnTo] = visualIndexes;
|
928
930
|
|
@@ -930,6 +932,17 @@ class TableView {
|
|
930
932
|
return [visualRowFrom >= 0 ? rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(visualRowFrom, 1)) : visualRowFrom, visualColumnFrom >= 0 ? columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(visualColumnFrom, 1)) : visualColumnFrom, visualRowTo >= 0 ? rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(visualRowTo, -1)) : visualRowTo, visualColumnTo >= 0 ? columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(visualColumnTo, -1)) : visualColumnTo];
|
931
933
|
}
|
932
934
|
},
|
935
|
+
onModifyGetCoordsElement: (renderableRowIndex, renderableColumnIndex) => {
|
936
|
+
const rowMapper = this.hot.rowIndexMapper;
|
937
|
+
const columnMapper = this.hot.columnIndexMapper;
|
938
|
+
const visualColumnIndex = renderableColumnIndex >= 0 ? columnMapper.getVisualFromRenderableIndex(renderableColumnIndex) : renderableColumnIndex;
|
939
|
+
const visualRowIndex = renderableRowIndex >= 0 ? rowMapper.getVisualFromRenderableIndex(renderableRowIndex) : renderableRowIndex;
|
940
|
+
const visualIndexes = this.hot.runHooks('modifyGetCoordsElement', visualRowIndex, visualColumnIndex);
|
941
|
+
if (Array.isArray(visualIndexes)) {
|
942
|
+
const [visualRow, visualColumn] = visualIndexes;
|
943
|
+
return [visualRow >= 0 ? rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(visualRow, 1)) : visualRow, visualColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(visualColumn, 1)) : visualColumn];
|
944
|
+
}
|
945
|
+
},
|
933
946
|
viewportRowCalculatorOverride: calc => {
|
934
947
|
let viewportOffset = this.settings.viewportRowRenderingOffset;
|
935
948
|
if (viewportOffset === 'auto' && this.settings.fixedRowsTop) {
|
@@ -943,7 +956,7 @@ class TableView {
|
|
943
956
|
calc.startRow = Math.max(firstRenderedRow - viewportOffset, 0);
|
944
957
|
calc.endRow = Math.min(lastRenderedRow + viewportOffset, renderableRows - 1);
|
945
958
|
} else if (viewportOffset === 'auto') {
|
946
|
-
const offset = Math.ceil(lastRenderedRow / renderableRows * 12);
|
959
|
+
const offset = Math.max(1, Math.ceil(lastRenderedRow / renderableRows * 12));
|
947
960
|
calc.startRow = Math.max(firstRenderedRow - offset, 0);
|
948
961
|
calc.endRow = Math.min(lastRenderedRow + offset, renderableRows - 1);
|
949
962
|
}
|
@@ -964,7 +977,7 @@ class TableView {
|
|
964
977
|
calc.endColumn = Math.min(lastRenderedColumn + viewportOffset, renderableColumns - 1);
|
965
978
|
}
|
966
979
|
if (viewportOffset === 'auto') {
|
967
|
-
const offset = Math.ceil(lastRenderedColumn / renderableColumns * 6);
|
980
|
+
const offset = Math.max(1, Math.ceil(lastRenderedColumn / renderableColumns * 6));
|
968
981
|
calc.startColumn = Math.max(firstRenderedColumn - offset, 0);
|
969
982
|
calc.endColumn = Math.min(lastRenderedColumn + offset, renderableColumns - 1);
|
970
983
|
}
|
@@ -1266,7 +1279,9 @@ class TableView {
|
|
1266
1279
|
if (!this._wt.wtViewport.rowsRenderCalculator) {
|
1267
1280
|
return null;
|
1268
1281
|
}
|
1269
|
-
|
1282
|
+
const indexMapper = this.hot.rowIndexMapper;
|
1283
|
+
const visualRowIndex = indexMapper.getVisualFromRenderableIndex(this._wt.wtTable.getFirstRenderedRow());
|
1284
|
+
return indexMapper.getNearestNotHiddenIndex(visualRowIndex !== null && visualRowIndex !== void 0 ? visualRowIndex : 0, 1);
|
1270
1285
|
}
|
1271
1286
|
|
1272
1287
|
/**
|
@@ -1278,7 +1293,9 @@ class TableView {
|
|
1278
1293
|
if (!this._wt.wtViewport.rowsRenderCalculator) {
|
1279
1294
|
return null;
|
1280
1295
|
}
|
1281
|
-
|
1296
|
+
const indexMapper = this.hot.rowIndexMapper;
|
1297
|
+
const visualRowIndex = indexMapper.getVisualFromRenderableIndex(this._wt.wtTable.getLastRenderedRow());
|
1298
|
+
return indexMapper.getNearestNotHiddenIndex(visualRowIndex !== null && visualRowIndex !== void 0 ? visualRowIndex : this.hot.countRows() - 1, -1);
|
1282
1299
|
}
|
1283
1300
|
|
1284
1301
|
/**
|
@@ -1290,7 +1307,9 @@ class TableView {
|
|
1290
1307
|
if (!this._wt.wtViewport.columnsRenderCalculator) {
|
1291
1308
|
return null;
|
1292
1309
|
}
|
1293
|
-
|
1310
|
+
const indexMapper = this.hot.columnIndexMapper;
|
1311
|
+
const visualColumnIndex = indexMapper.getVisualFromRenderableIndex(this._wt.wtTable.getFirstRenderedColumn());
|
1312
|
+
return indexMapper.getNearestNotHiddenIndex(visualColumnIndex !== null && visualColumnIndex !== void 0 ? visualColumnIndex : 0, 1);
|
1294
1313
|
}
|
1295
1314
|
|
1296
1315
|
/**
|
@@ -1302,7 +1321,9 @@ class TableView {
|
|
1302
1321
|
if (!this._wt.wtViewport.columnsRenderCalculator) {
|
1303
1322
|
return null;
|
1304
1323
|
}
|
1305
|
-
|
1324
|
+
const indexMapper = this.hot.columnIndexMapper;
|
1325
|
+
const visualColumnIndex = indexMapper.getVisualFromRenderableIndex(this._wt.wtTable.getLastRenderedColumn());
|
1326
|
+
return indexMapper.getNearestNotHiddenIndex(visualColumnIndex !== null && visualColumnIndex !== void 0 ? visualColumnIndex : this.hot.countCols() - 1, -1);
|
1306
1327
|
}
|
1307
1328
|
|
1308
1329
|
/**
|
@@ -1464,6 +1485,16 @@ class TableView {
|
|
1464
1485
|
return this._wt.getOverlayByName(overlayName);
|
1465
1486
|
}
|
1466
1487
|
|
1488
|
+
/**
|
1489
|
+
* Gets the name of the overlay that currently renders the table. If the method is called out of the render cycle
|
1490
|
+
* the 'master' name is returned.
|
1491
|
+
*
|
1492
|
+
* @returns {string}
|
1493
|
+
*/
|
1494
|
+
getActiveOverlayName() {
|
1495
|
+
return this._wt.activeOverlayName;
|
1496
|
+
}
|
1497
|
+
|
1467
1498
|
/**
|
1468
1499
|
* Checks if the table is visible or not.
|
1469
1500
|
*
|
package/tableView.mjs
CHANGED
@@ -610,6 +610,8 @@ class TableView {
|
|
610
610
|
preventOverflow: () => this.settings.preventOverflow,
|
611
611
|
preventWheel: () => this.settings.preventWheel,
|
612
612
|
stretchH: () => this.settings.stretchH,
|
613
|
+
viewportColumnRenderingThreshold: () => this.settings.viewportColumnRenderingThreshold,
|
614
|
+
viewportRowRenderingThreshold: () => this.settings.viewportRowRenderingThreshold,
|
613
615
|
data: (renderableRow, renderableColumn) => {
|
614
616
|
return this.hot.getDataAtCell(...this.translateFromRenderableToVisualIndex(renderableRow, renderableColumn));
|
615
617
|
},
|
@@ -692,7 +694,7 @@ class TableView {
|
|
692
694
|
const [visualRowIndex, visualColumnIndex] = this.translateFromRenderableToVisualIndex(renderedRowIndex, renderedColumnIndex);
|
693
695
|
|
694
696
|
// Coords may be modified. For example, by the `MergeCells` plugin. It should affect cell value and cell meta.
|
695
|
-
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', visualRowIndex, visualColumnIndex);
|
697
|
+
const modifiedCellCoords = this.hot.runHooks('modifyGetCellCoords', visualRowIndex, visualColumnIndex, false, 'meta');
|
696
698
|
let visualRowToCheck = visualRowIndex;
|
697
699
|
let visualColumnToCheck = visualColumnIndex;
|
698
700
|
if (Array.isArray(modifiedCellCoords)) {
|
@@ -911,14 +913,14 @@ class TableView {
|
|
911
913
|
return this.hot.runHooks('beforeStretchingColumnWidth', stretchedWidth, visualColumnIndex);
|
912
914
|
},
|
913
915
|
onModifyRowHeaderWidth: rowHeaderWidth => this.hot.runHooks('modifyRowHeaderWidth', rowHeaderWidth),
|
914
|
-
onModifyGetCellCoords: (renderableRowIndex, renderableColumnIndex, topmost) => {
|
916
|
+
onModifyGetCellCoords: (renderableRowIndex, renderableColumnIndex, topmost, source) => {
|
915
917
|
const rowMapper = this.hot.rowIndexMapper;
|
916
918
|
const columnMapper = this.hot.columnIndexMapper;
|
917
919
|
|
918
920
|
// Callback handle also headers. We shouldn't translate them.
|
919
921
|
const visualColumnIndex = renderableColumnIndex >= 0 ? columnMapper.getVisualFromRenderableIndex(renderableColumnIndex) : renderableColumnIndex;
|
920
922
|
const visualRowIndex = renderableRowIndex >= 0 ? rowMapper.getVisualFromRenderableIndex(renderableRowIndex) : renderableRowIndex;
|
921
|
-
const visualIndexes = this.hot.runHooks('modifyGetCellCoords', visualRowIndex, visualColumnIndex, topmost);
|
923
|
+
const visualIndexes = this.hot.runHooks('modifyGetCellCoords', visualRowIndex, visualColumnIndex, topmost, source);
|
922
924
|
if (Array.isArray(visualIndexes)) {
|
923
925
|
const [visualRowFrom, visualColumnFrom, visualRowTo, visualColumnTo] = visualIndexes;
|
924
926
|
|
@@ -926,6 +928,17 @@ class TableView {
|
|
926
928
|
return [visualRowFrom >= 0 ? rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(visualRowFrom, 1)) : visualRowFrom, visualColumnFrom >= 0 ? columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(visualColumnFrom, 1)) : visualColumnFrom, visualRowTo >= 0 ? rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(visualRowTo, -1)) : visualRowTo, visualColumnTo >= 0 ? columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(visualColumnTo, -1)) : visualColumnTo];
|
927
929
|
}
|
928
930
|
},
|
931
|
+
onModifyGetCoordsElement: (renderableRowIndex, renderableColumnIndex) => {
|
932
|
+
const rowMapper = this.hot.rowIndexMapper;
|
933
|
+
const columnMapper = this.hot.columnIndexMapper;
|
934
|
+
const visualColumnIndex = renderableColumnIndex >= 0 ? columnMapper.getVisualFromRenderableIndex(renderableColumnIndex) : renderableColumnIndex;
|
935
|
+
const visualRowIndex = renderableRowIndex >= 0 ? rowMapper.getVisualFromRenderableIndex(renderableRowIndex) : renderableRowIndex;
|
936
|
+
const visualIndexes = this.hot.runHooks('modifyGetCoordsElement', visualRowIndex, visualColumnIndex);
|
937
|
+
if (Array.isArray(visualIndexes)) {
|
938
|
+
const [visualRow, visualColumn] = visualIndexes;
|
939
|
+
return [visualRow >= 0 ? rowMapper.getRenderableFromVisualIndex(rowMapper.getNearestNotHiddenIndex(visualRow, 1)) : visualRow, visualColumn >= 0 ? columnMapper.getRenderableFromVisualIndex(columnMapper.getNearestNotHiddenIndex(visualColumn, 1)) : visualColumn];
|
940
|
+
}
|
941
|
+
},
|
929
942
|
viewportRowCalculatorOverride: calc => {
|
930
943
|
let viewportOffset = this.settings.viewportRowRenderingOffset;
|
931
944
|
if (viewportOffset === 'auto' && this.settings.fixedRowsTop) {
|
@@ -939,7 +952,7 @@ class TableView {
|
|
939
952
|
calc.startRow = Math.max(firstRenderedRow - viewportOffset, 0);
|
940
953
|
calc.endRow = Math.min(lastRenderedRow + viewportOffset, renderableRows - 1);
|
941
954
|
} else if (viewportOffset === 'auto') {
|
942
|
-
const offset = Math.ceil(lastRenderedRow / renderableRows * 12);
|
955
|
+
const offset = Math.max(1, Math.ceil(lastRenderedRow / renderableRows * 12));
|
943
956
|
calc.startRow = Math.max(firstRenderedRow - offset, 0);
|
944
957
|
calc.endRow = Math.min(lastRenderedRow + offset, renderableRows - 1);
|
945
958
|
}
|
@@ -960,7 +973,7 @@ class TableView {
|
|
960
973
|
calc.endColumn = Math.min(lastRenderedColumn + viewportOffset, renderableColumns - 1);
|
961
974
|
}
|
962
975
|
if (viewportOffset === 'auto') {
|
963
|
-
const offset = Math.ceil(lastRenderedColumn / renderableColumns * 6);
|
976
|
+
const offset = Math.max(1, Math.ceil(lastRenderedColumn / renderableColumns * 6));
|
964
977
|
calc.startColumn = Math.max(firstRenderedColumn - offset, 0);
|
965
978
|
calc.endColumn = Math.min(lastRenderedColumn + offset, renderableColumns - 1);
|
966
979
|
}
|
@@ -1262,7 +1275,9 @@ class TableView {
|
|
1262
1275
|
if (!this._wt.wtViewport.rowsRenderCalculator) {
|
1263
1276
|
return null;
|
1264
1277
|
}
|
1265
|
-
|
1278
|
+
const indexMapper = this.hot.rowIndexMapper;
|
1279
|
+
const visualRowIndex = indexMapper.getVisualFromRenderableIndex(this._wt.wtTable.getFirstRenderedRow());
|
1280
|
+
return indexMapper.getNearestNotHiddenIndex(visualRowIndex !== null && visualRowIndex !== void 0 ? visualRowIndex : 0, 1);
|
1266
1281
|
}
|
1267
1282
|
|
1268
1283
|
/**
|
@@ -1274,7 +1289,9 @@ class TableView {
|
|
1274
1289
|
if (!this._wt.wtViewport.rowsRenderCalculator) {
|
1275
1290
|
return null;
|
1276
1291
|
}
|
1277
|
-
|
1292
|
+
const indexMapper = this.hot.rowIndexMapper;
|
1293
|
+
const visualRowIndex = indexMapper.getVisualFromRenderableIndex(this._wt.wtTable.getLastRenderedRow());
|
1294
|
+
return indexMapper.getNearestNotHiddenIndex(visualRowIndex !== null && visualRowIndex !== void 0 ? visualRowIndex : this.hot.countRows() - 1, -1);
|
1278
1295
|
}
|
1279
1296
|
|
1280
1297
|
/**
|
@@ -1286,7 +1303,9 @@ class TableView {
|
|
1286
1303
|
if (!this._wt.wtViewport.columnsRenderCalculator) {
|
1287
1304
|
return null;
|
1288
1305
|
}
|
1289
|
-
|
1306
|
+
const indexMapper = this.hot.columnIndexMapper;
|
1307
|
+
const visualColumnIndex = indexMapper.getVisualFromRenderableIndex(this._wt.wtTable.getFirstRenderedColumn());
|
1308
|
+
return indexMapper.getNearestNotHiddenIndex(visualColumnIndex !== null && visualColumnIndex !== void 0 ? visualColumnIndex : 0, 1);
|
1290
1309
|
}
|
1291
1310
|
|
1292
1311
|
/**
|
@@ -1298,7 +1317,9 @@ class TableView {
|
|
1298
1317
|
if (!this._wt.wtViewport.columnsRenderCalculator) {
|
1299
1318
|
return null;
|
1300
1319
|
}
|
1301
|
-
|
1320
|
+
const indexMapper = this.hot.columnIndexMapper;
|
1321
|
+
const visualColumnIndex = indexMapper.getVisualFromRenderableIndex(this._wt.wtTable.getLastRenderedColumn());
|
1322
|
+
return indexMapper.getNearestNotHiddenIndex(visualColumnIndex !== null && visualColumnIndex !== void 0 ? visualColumnIndex : this.hot.countCols() - 1, -1);
|
1302
1323
|
}
|
1303
1324
|
|
1304
1325
|
/**
|
@@ -1460,6 +1481,16 @@ class TableView {
|
|
1460
1481
|
return this._wt.getOverlayByName(overlayName);
|
1461
1482
|
}
|
1462
1483
|
|
1484
|
+
/**
|
1485
|
+
* Gets the name of the overlay that currently renders the table. If the method is called out of the render cycle
|
1486
|
+
* the 'master' name is returned.
|
1487
|
+
*
|
1488
|
+
* @returns {string}
|
1489
|
+
*/
|
1490
|
+
getActiveOverlayName() {
|
1491
|
+
return this._wt.activeOverlayName;
|
1492
|
+
}
|
1493
|
+
|
1463
1494
|
/**
|
1464
1495
|
* Checks if the table is visible or not.
|
1465
1496
|
*
|