handsontable 0.0.0-next-fd9f817-20241125 → 0.0.0-next-fcb9b77-20241126
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 +2 -1
- 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 +19 -26
- package/3rdparty/walkontable/src/core/_base.mjs +19 -26
- package/3rdparty/walkontable/src/core/clone.js +0 -1
- package/3rdparty/walkontable/src/core/clone.mjs +0 -1
- package/3rdparty/walkontable/src/core/core.js +0 -2
- package/3rdparty/walkontable/src/core/core.mjs +0 -2
- package/3rdparty/walkontable/src/facade/core.js +6 -9
- package/3rdparty/walkontable/src/facade/core.mjs +6 -9
- package/3rdparty/walkontable/src/index.js +1 -0
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/_base.js +1 -3
- package/3rdparty/walkontable/src/overlay/_base.mjs +1 -3
- package/3rdparty/walkontable/src/overlay/bottom.js +2 -2
- package/3rdparty/walkontable/src/overlay/bottom.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/top.js +1 -1
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/index.js +2 -4
- package/3rdparty/walkontable/src/renderer/index.mjs +2 -4
- package/3rdparty/walkontable/src/renderer/table.js +3 -12
- package/3rdparty/walkontable/src/renderer/table.mjs +3 -12
- package/3rdparty/walkontable/src/scroll.js +46 -37
- package/3rdparty/walkontable/src/scroll.mjs +46 -37
- package/3rdparty/walkontable/src/settings.js +2 -0
- package/3rdparty/walkontable/src/settings.mjs +2 -0
- package/3rdparty/walkontable/src/table.js +9 -17
- package/3rdparty/walkontable/src/table.mjs +9 -17
- package/3rdparty/walkontable/src/types.js +0 -1
- package/3rdparty/walkontable/src/types.mjs +0 -1
- package/3rdparty/walkontable/src/utils/column.js +1 -1
- package/3rdparty/walkontable/src/utils/column.mjs +1 -1
- package/3rdparty/walkontable/src/viewport.js +0 -1
- package/3rdparty/walkontable/src/viewport.mjs +0 -1
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/hooks/constants.js +7 -9
- package/core/hooks/constants.mjs +7 -9
- package/core/hooks/index.d.ts +2 -3
- package/core.d.ts +0 -2
- package/core.js +3 -64
- package/core.mjs +3 -64
- package/dataMap/metaManager/metaSchema.js +3 -23
- package/dataMap/metaManager/metaSchema.mjs +3 -23
- package/dist/handsontable.css +9 -17
- package/dist/handsontable.full.css +240 -249
- package/dist/handsontable.full.js +4386 -4760
- package/dist/handsontable.full.min.css +9 -11
- package/dist/handsontable.full.min.js +53 -53
- package/dist/handsontable.js +4087 -4467
- package/dist/handsontable.min.css +4 -5
- package/dist/handsontable.min.js +33 -33
- 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 +0 -9
- package/editors/dateEditor/dateEditor.mjs +1 -10
- package/editors/handsontableEditor/handsontableEditor.js +1 -7
- package/editors/handsontableEditor/handsontableEditor.mjs +1 -7
- package/editors/selectEditor/selectEditor.js +9 -20
- package/editors/selectEditor/selectEditor.mjs +9 -20
- package/editors/textEditor/textEditor.js +11 -4
- package/editors/textEditor/textEditor.mjs +11 -4
- package/helpers/dom/element.js +1 -32
- package/helpers/dom/element.mjs +1 -31
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/package.json +3 -10
- package/plugins/comments/commentEditor.js +0 -9
- package/plugins/comments/commentEditor.mjs +0 -9
- package/plugins/comments/comments.js +0 -14
- package/plugins/comments/comments.mjs +1 -15
- package/plugins/contextMenu/menu/menu.js +4 -9
- package/plugins/contextMenu/menu/menu.mjs +4 -9
- package/plugins/contextMenu/predefinedItems/alignment.js +7 -84
- package/plugins/contextMenu/predefinedItems/alignment.mjs +8 -85
- package/plugins/contextMenu/utils.js +0 -10
- package/plugins/contextMenu/utils.mjs +0 -9
- package/plugins/filters/ui/multipleSelect.js +0 -6
- package/plugins/filters/ui/multipleSelect.mjs +0 -6
- package/plugins/manualRowMove/manualRowMove.js +1 -1
- package/plugins/manualRowMove/manualRowMove.mjs +1 -1
- package/plugins/manualRowResize/manualRowResize.js +2 -1
- package/plugins/manualRowResize/manualRowResize.mjs +3 -2
- package/plugins/mergeCells/mergeCells.js +1 -1
- package/plugins/mergeCells/mergeCells.mjs +1 -1
- package/plugins/nestedHeaders/nestedHeaders.js +60 -15
- package/plugins/nestedHeaders/nestedHeaders.mjs +60 -15
- package/plugins/nestedRows/ui/headers.js +1 -7
- package/plugins/nestedRows/ui/headers.mjs +1 -7
- package/plugins/stretchColumns/calculator.js +1 -2
- package/plugins/stretchColumns/calculator.mjs +2 -3
- package/selection/selection.js +4 -2
- package/selection/selection.mjs +4 -2
- package/settings.d.ts +0 -1
- package/tableView.js +23 -64
- package/tableView.mjs +24 -65
- package/utils/autoResize.js +1 -4
- package/utils/autoResize.mjs +1 -4
- package/utils/ghostTable.js +3 -5
- package/utils/ghostTable.mjs +3 -5
- package/3rdparty/walkontable/src/utils/stylesHandler.js +0 -287
- package/3rdparty/walkontable/src/utils/stylesHandler.mjs +0 -283
- package/helpers/themes.js +0 -17
- package/helpers/themes.mjs +0 -13
- package/styles/handsontable.css +0 -2187
- package/styles/handsontable.min.css +0 -30
- package/styles/ht-theme-horizon.css +0 -607
- package/styles/ht-theme-horizon.min.css +0 -30
- package/styles/ht-theme-main.css +0 -613
- package/styles/ht-theme-main.min.css +0 -30
@@ -73,6 +73,7 @@ var _stateManager = /*#__PURE__*/new WeakMap();
|
|
73
73
|
var _hidingIndexMapObserver = /*#__PURE__*/new WeakMap();
|
74
74
|
var _focusInitialCoords = /*#__PURE__*/new WeakMap();
|
75
75
|
var _isColumnsSelectionInProgress = /*#__PURE__*/new WeakMap();
|
76
|
+
var _recentlyHighlightCoords = /*#__PURE__*/new WeakMap();
|
76
77
|
var _NestedHeaders_brand = /*#__PURE__*/new WeakSet();
|
77
78
|
export class NestedHeaders extends BasePlugin {
|
78
79
|
constructor() {
|
@@ -107,6 +108,14 @@ export class NestedHeaders extends BasePlugin {
|
|
107
108
|
* @type {boolean}
|
108
109
|
*/
|
109
110
|
_classPrivateFieldInitSpec(this, _isColumnsSelectionInProgress, false);
|
111
|
+
/**
|
112
|
+
* Keeps the last highlight position made by column selection. The coords are necessary to scroll
|
113
|
+
* the viewport to the correct position when the nested header is clicked when the `navigableHeaders`
|
114
|
+
* option is disabled.
|
115
|
+
*
|
116
|
+
* @type {CellCoords | null}
|
117
|
+
*/
|
118
|
+
_classPrivateFieldInitSpec(this, _recentlyHighlightCoords, null);
|
110
119
|
/**
|
111
120
|
* Custom helper for getting widths of the nested headers.
|
112
121
|
*
|
@@ -526,9 +535,13 @@ function _updateFocusHighlightPosition() {
|
|
526
535
|
* indexes are used.
|
527
536
|
*
|
528
537
|
* @param {number} visualColumn A visual column index to which the viewport will be scrolled.
|
538
|
+
* @param {{ value: 'auto' | 'start' | 'end' }} snapping If `'start'`, viewport is scrolled to show
|
539
|
+
* the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
|
540
|
+
* the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
|
529
541
|
* @returns {number}
|
530
542
|
*/
|
531
|
-
function _onBeforeViewportScrollHorizontally(visualColumn) {
|
543
|
+
function _onBeforeViewportScrollHorizontally(visualColumn, snapping) {
|
544
|
+
var _classPrivateFieldGet4;
|
532
545
|
const selection = this.hot.getSelectedRangeLast();
|
533
546
|
if (!selection) {
|
534
547
|
return visualColumn;
|
@@ -536,20 +549,50 @@ function _onBeforeViewportScrollHorizontally(visualColumn) {
|
|
536
549
|
const {
|
537
550
|
highlight
|
538
551
|
} = selection;
|
539
|
-
const
|
552
|
+
const {
|
553
|
+
navigableHeaders
|
554
|
+
} = this.hot.getSettings();
|
555
|
+
const isSelectedByColumnHeader = this.hot.selection.isSelectedByColumnHeader();
|
556
|
+
const highlightRow = navigableHeaders ? highlight.row : (_classPrivateFieldGet4 = _classPrivateFieldGet(_recentlyHighlightCoords, this)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.row;
|
557
|
+
const highlightColumn = isSelectedByColumnHeader ? visualColumn : highlight.col;
|
558
|
+
const isNestedHeadersRange = highlightRow < 0 && highlightColumn >= 0;
|
559
|
+
_classPrivateFieldSet(_recentlyHighlightCoords, this, null);
|
540
560
|
if (!isNestedHeadersRange) {
|
541
561
|
return visualColumn;
|
542
562
|
}
|
543
|
-
const
|
544
|
-
const
|
545
|
-
const
|
546
|
-
const
|
563
|
+
const firstVisibleColumn = this.hot.getFirstFullyVisibleColumn();
|
564
|
+
const lastVisibleColumn = this.hot.getLastFullyVisibleColumn();
|
565
|
+
const viewportWidth = lastVisibleColumn - firstVisibleColumn + 1;
|
566
|
+
const mostLeftColumnIndex = _classPrivateFieldGet(_stateManager, this).findLeftMostColumnIndex(highlightRow, highlightColumn);
|
567
|
+
const mostRightColumnIndex = _classPrivateFieldGet(_stateManager, this).findRightMostColumnIndex(highlightRow, highlightColumn);
|
568
|
+
const headerWidth = mostRightColumnIndex - mostLeftColumnIndex + 1;
|
547
569
|
|
548
|
-
//
|
549
|
-
if (mostLeftColumnIndex <
|
550
|
-
return
|
570
|
+
// scroll the viewport always to the left when the header is wider than the viewport
|
571
|
+
if (mostLeftColumnIndex < firstVisibleColumn && mostRightColumnIndex > lastVisibleColumn) {
|
572
|
+
return mostLeftColumnIndex;
|
573
|
+
}
|
574
|
+
if (isSelectedByColumnHeader) {
|
575
|
+
let scrollColumnIndex = null;
|
576
|
+
if (mostLeftColumnIndex >= firstVisibleColumn && mostRightColumnIndex > lastVisibleColumn) {
|
577
|
+
if (headerWidth > viewportWidth) {
|
578
|
+
snapping.value = 'start';
|
579
|
+
scrollColumnIndex = mostLeftColumnIndex;
|
580
|
+
} else {
|
581
|
+
snapping.value = 'end';
|
582
|
+
scrollColumnIndex = mostRightColumnIndex;
|
583
|
+
}
|
584
|
+
} else if (mostLeftColumnIndex < firstVisibleColumn && mostRightColumnIndex <= lastVisibleColumn) {
|
585
|
+
if (headerWidth > viewportWidth) {
|
586
|
+
snapping.value = 'end';
|
587
|
+
scrollColumnIndex = mostRightColumnIndex;
|
588
|
+
} else {
|
589
|
+
snapping.value = 'start';
|
590
|
+
scrollColumnIndex = mostLeftColumnIndex;
|
591
|
+
}
|
592
|
+
}
|
593
|
+
return scrollColumnIndex;
|
551
594
|
}
|
552
|
-
return mostLeftColumnIndex
|
595
|
+
return mostLeftColumnIndex <= firstVisibleColumn ? mostLeftColumnIndex : mostRightColumnIndex;
|
553
596
|
}
|
554
597
|
/**
|
555
598
|
* Allows to control which header DOM element will be used to highlight.
|
@@ -620,13 +663,13 @@ function _onBeforeCopy(data, copyableRanges, _ref2) {
|
|
620
663
|
}
|
621
664
|
for (let column = startCol; column <= endCol; column++) {
|
622
665
|
for (let row = startRow; row <= endRow; row++) {
|
623
|
-
var
|
666
|
+
var _classPrivateFieldGet5;
|
624
667
|
const zeroBasedColumnHeaderLevel = rowsCount + row;
|
625
668
|
const zeroBasedColumnIndex = column - startCol;
|
626
669
|
if (zeroBasedColumnIndex === 0) {
|
627
670
|
continue; // eslint-disable-line no-continue
|
628
671
|
}
|
629
|
-
const isRoot = (
|
672
|
+
const isRoot = (_classPrivateFieldGet5 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet5 === void 0 ? void 0 : _classPrivateFieldGet5.isRoot;
|
630
673
|
if (isRoot === false) {
|
631
674
|
data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';
|
632
675
|
}
|
@@ -812,8 +855,9 @@ function _onModifyTransformStart(delta) {
|
|
812
855
|
*
|
813
856
|
* @param {CellCoords} from The coords object where the selection starts.
|
814
857
|
* @param {CellCoords} to The coords object where the selection ends.
|
858
|
+
* @param {CellCoords} highlight The coords object where the focus is.
|
815
859
|
*/
|
816
|
-
function _onBeforeSelectColumns(from, to) {
|
860
|
+
function _onBeforeSelectColumns(from, to, highlight) {
|
817
861
|
const headerLevel = from.row;
|
818
862
|
const startNodeData = this._getHeaderTreeNodeDataByCoords({
|
819
863
|
row: headerLevel,
|
@@ -823,6 +867,7 @@ function _onBeforeSelectColumns(from, to) {
|
|
823
867
|
row: headerLevel,
|
824
868
|
col: to.col
|
825
869
|
});
|
870
|
+
_classPrivateFieldSet(_recentlyHighlightCoords, this, highlight.clone());
|
826
871
|
if (to.col < from.col) {
|
827
872
|
// Column selection from right to left
|
828
873
|
if (startNodeData) {
|
@@ -907,10 +952,10 @@ function _onModifyColWidth(width, column) {
|
|
907
952
|
* @returns {string} Returns the column header value to update.
|
908
953
|
*/
|
909
954
|
function _onModifyColumnHeaderValue(value, visualColumnIndex, headerLevel) {
|
910
|
-
var
|
955
|
+
var _classPrivateFieldGet6;
|
911
956
|
const {
|
912
957
|
label
|
913
|
-
} = (
|
958
|
+
} = (_classPrivateFieldGet6 = _classPrivateFieldGet(_stateManager, this).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet6 !== void 0 ? _classPrivateFieldGet6 : {
|
914
959
|
label: ''
|
915
960
|
};
|
916
961
|
return label;
|
@@ -125,13 +125,7 @@ class HeadersUI extends _base.default {
|
|
125
125
|
if (!deepestLevelIndex) {
|
126
126
|
deepestLevelIndex = this.dataManager.cache.levelCount;
|
127
127
|
}
|
128
|
-
|
129
|
-
let completeVerticalPadding = 11;
|
130
|
-
if (!stylesHandler.isClassicTheme()) {
|
131
|
-
const verticalPadding = stylesHandler.getCSSVariableValue('cell-horizontal-padding');
|
132
|
-
completeVerticalPadding = verticalPadding * 2;
|
133
|
-
}
|
134
|
-
this.rowHeaderWidthCache = Math.max(50, completeVerticalPadding + 10 * deepestLevelIndex + 25);
|
128
|
+
this.rowHeaderWidthCache = Math.max(50, 11 + 10 * deepestLevelIndex + 25);
|
135
129
|
this.hot.render();
|
136
130
|
}
|
137
131
|
}
|
@@ -121,13 +121,7 @@ class HeadersUI extends BaseUI {
|
|
121
121
|
if (!deepestLevelIndex) {
|
122
122
|
deepestLevelIndex = this.dataManager.cache.levelCount;
|
123
123
|
}
|
124
|
-
|
125
|
-
let completeVerticalPadding = 11;
|
126
|
-
if (!stylesHandler.isClassicTheme()) {
|
127
|
-
const verticalPadding = stylesHandler.getCSSVariableValue('cell-horizontal-padding');
|
128
|
-
completeVerticalPadding = verticalPadding * 2;
|
129
|
-
}
|
130
|
-
this.rowHeaderWidthCache = Math.max(50, completeVerticalPadding + 10 * deepestLevelIndex + 25);
|
124
|
+
this.rowHeaderWidthCache = Math.max(50, 11 + 10 * deepestLevelIndex + 25);
|
131
125
|
this.hot.render();
|
132
126
|
}
|
133
127
|
}
|
@@ -127,12 +127,11 @@ function _willVerticalScrollAppear() {
|
|
127
127
|
}
|
128
128
|
const viewportHeight = view.getViewportHeight();
|
129
129
|
const totalRows = _classPrivateFieldGet(_hot, this).countRows();
|
130
|
-
const defaultRowHeight = view.getStylesHandler().getDefaultRowHeight();
|
131
130
|
let totalHeight = 0;
|
132
131
|
let hasVerticalScroll = false;
|
133
132
|
for (let row = 0; row < totalRows; row++) {
|
134
133
|
var _classPrivateFieldGet2;
|
135
|
-
totalHeight += ((_classPrivateFieldGet2 = _classPrivateFieldGet(_hot, this).getRowHeight(row)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 :
|
134
|
+
totalHeight += ((_classPrivateFieldGet2 = _classPrivateFieldGet(_hot, this).getRowHeight(row)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : _src.DEFAULT_ROW_HEIGHT) + (row === 0 ? 1 : 0);
|
136
135
|
if (totalHeight > viewportHeight) {
|
137
136
|
hasVerticalScroll = true;
|
138
137
|
break;
|
@@ -7,7 +7,7 @@ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("C
|
|
7
7
|
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
8
8
|
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
9
9
|
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"); }
|
10
|
-
import { DEFAULT_COLUMN_WIDTH } from "../../3rdparty/walkontable/src/index.mjs";
|
10
|
+
import { DEFAULT_COLUMN_WIDTH, DEFAULT_ROW_HEIGHT } from "../../3rdparty/walkontable/src/index.mjs";
|
11
11
|
import { getScrollbarWidth } from "../../helpers/dom/element.mjs";
|
12
12
|
import { StretchAllStrategy } from "./strategies/all.mjs";
|
13
13
|
import { StretchLastStrategy } from "./strategies/last.mjs";
|
@@ -123,12 +123,11 @@ function _willVerticalScrollAppear() {
|
|
123
123
|
}
|
124
124
|
const viewportHeight = view.getViewportHeight();
|
125
125
|
const totalRows = _classPrivateFieldGet(_hot, this).countRows();
|
126
|
-
const defaultRowHeight = view.getStylesHandler().getDefaultRowHeight();
|
127
126
|
let totalHeight = 0;
|
128
127
|
let hasVerticalScroll = false;
|
129
128
|
for (let row = 0; row < totalRows; row++) {
|
130
129
|
var _classPrivateFieldGet2;
|
131
|
-
totalHeight += ((_classPrivateFieldGet2 = _classPrivateFieldGet(_hot, this).getRowHeight(row)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 :
|
130
|
+
totalHeight += ((_classPrivateFieldGet2 = _classPrivateFieldGet(_hot, this).getRowHeight(row)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : DEFAULT_ROW_HEIGHT) + (row === 0 ? 1 : 0);
|
132
131
|
if (totalHeight > viewportHeight) {
|
133
132
|
hasVerticalScroll = true;
|
134
133
|
break;
|
package/selection/selection.js
CHANGED
@@ -1208,9 +1208,11 @@ class Selection {
|
|
1208
1208
|
if (!this.isSelected()) {
|
1209
1209
|
return;
|
1210
1210
|
}
|
1211
|
-
const focusHighlight = this.highlight.getFocus();
|
1212
1211
|
const currentLayer = this.getLayerLevel();
|
1213
|
-
|
1212
|
+
const cellRange = this.selectedRange.current();
|
1213
|
+
if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, cellRange.highlight)) {
|
1214
|
+
this.highlight.getFocus().commit().syncWith(cellRange);
|
1215
|
+
}
|
1214
1216
|
|
1215
1217
|
// Rewriting rendered ranges going through all layers.
|
1216
1218
|
for (let layerLevel = 0; layerLevel < this.selectedRange.size(); layerLevel += 1) {
|
package/selection/selection.mjs
CHANGED
@@ -1202,9 +1202,11 @@ class Selection {
|
|
1202
1202
|
if (!this.isSelected()) {
|
1203
1203
|
return;
|
1204
1204
|
}
|
1205
|
-
const focusHighlight = this.highlight.getFocus();
|
1206
1205
|
const currentLayer = this.getLayerLevel();
|
1207
|
-
|
1206
|
+
const cellRange = this.selectedRange.current();
|
1207
|
+
if (this.highlight.isEnabledFor(FOCUS_TYPE, cellRange.highlight)) {
|
1208
|
+
this.highlight.getFocus().commit().syncWith(cellRange);
|
1209
|
+
}
|
1208
1210
|
|
1209
1211
|
// Rewriting rendered ranges going through all layers.
|
1210
1212
|
for (let layerLevel = 0; layerLevel < this.selectedRange.size(); layerLevel += 1) {
|
package/settings.d.ts
CHANGED
@@ -214,7 +214,6 @@ export interface GridSettings extends Events {
|
|
214
214
|
strict?: boolean;
|
215
215
|
tableClassName?: string | string[];
|
216
216
|
tabMoves?: CellCoords | SimpleCellCoords | ((event: KeyboardEvent) => CellCoords | SimpleCellCoords);
|
217
|
-
themeName?: string;
|
218
217
|
title?: string;
|
219
218
|
trimDropdown?: boolean;
|
220
219
|
trimRows?: TrimRowsSettings;
|
package/tableView.js
CHANGED
@@ -198,38 +198,43 @@ class TableView {
|
|
198
198
|
* Scroll viewport to a cell.
|
199
199
|
*
|
200
200
|
* @param {CellCoords} coords Renderable cell coordinates.
|
201
|
-
* @param {
|
202
|
-
*
|
203
|
-
*
|
204
|
-
* @param {
|
201
|
+
* @param {'auto' | 'start' | 'end'} [horizontalSnap] If `'start'`, viewport is scrolled to show
|
202
|
+
* the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
|
203
|
+
* the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
|
204
|
+
* @param {'auto' | 'top' | 'bottom'} [verticalSnap] If `'top'`, viewport is scrolled to show
|
205
|
+
* the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on the bottom of
|
206
|
+
* the table. When `'auto'`, the viewport is scrolled only when the row is outside of the viewport.
|
205
207
|
* @returns {boolean}
|
206
208
|
*/
|
207
|
-
scrollViewport(coords,
|
208
|
-
return this._wt.scrollViewport(coords,
|
209
|
+
scrollViewport(coords, horizontalSnap, verticalSnap) {
|
210
|
+
return this._wt.scrollViewport(coords, horizontalSnap, verticalSnap);
|
209
211
|
}
|
210
212
|
|
211
213
|
/**
|
212
214
|
* Scroll viewport to a column.
|
213
215
|
*
|
214
216
|
* @param {number} column Renderable column index.
|
215
|
-
* @param {
|
216
|
-
*
|
217
|
+
* @param {'auto' | 'start' | 'end'} [snap] If `'start'`, viewport is scrolled to show
|
218
|
+
* the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
|
219
|
+
* the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
|
217
220
|
* @returns {boolean}
|
218
221
|
*/
|
219
|
-
scrollViewportHorizontally(column,
|
220
|
-
return this._wt.scrollViewportHorizontally(column,
|
222
|
+
scrollViewportHorizontally(column, snap) {
|
223
|
+
return this._wt.scrollViewportHorizontally(column, snap);
|
221
224
|
}
|
222
225
|
|
223
226
|
/**
|
224
227
|
* Scroll viewport to a row.
|
225
228
|
*
|
226
229
|
* @param {number} row Renderable row index.
|
227
|
-
* @param {
|
228
|
-
*
|
230
|
+
* @param {'auto' | 'top' | 'bottom'} [snap] If `'top'`, viewport is scrolled to show
|
231
|
+
* the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
|
232
|
+
* the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
|
233
|
+
* the viewport.
|
229
234
|
* @returns {boolean}
|
230
235
|
*/
|
231
|
-
scrollViewportVertically(row,
|
232
|
-
return this._wt.scrollViewportVertically(row,
|
236
|
+
scrollViewportVertically(row, snap) {
|
237
|
+
return this._wt.scrollViewportVertically(row, snap);
|
233
238
|
}
|
234
239
|
|
235
240
|
/**
|
@@ -587,52 +592,6 @@ class TableView {
|
|
587
592
|
return count;
|
588
593
|
}
|
589
594
|
|
590
|
-
/**
|
591
|
-
* Retrieves the styles handler from the Walkontable instance.
|
592
|
-
*
|
593
|
-
* @returns {StylesHandler} The styles handler instance.
|
594
|
-
*/
|
595
|
-
getStylesHandler() {
|
596
|
-
return this._wt.stylesHandler;
|
597
|
-
}
|
598
|
-
|
599
|
-
/**
|
600
|
-
* Returns the default row height.
|
601
|
-
*
|
602
|
-
* This method retrieves the default row height from the Walkontable styles handler.
|
603
|
-
*
|
604
|
-
* @returns {number} The default row height.
|
605
|
-
*/
|
606
|
-
getDefaultRowHeight() {
|
607
|
-
return this._wt.stylesHandler.getDefaultRowHeight();
|
608
|
-
}
|
609
|
-
|
610
|
-
/**
|
611
|
-
* Add a class name to the license information element.
|
612
|
-
*
|
613
|
-
* @param {string} className The class name to add.
|
614
|
-
*/
|
615
|
-
addClassNameToLicenseElement(className) {
|
616
|
-
var _this$hot$rootElement;
|
617
|
-
const licenseInfoElement = (_this$hot$rootElement = this.hot.rootElement.parentNode) === null || _this$hot$rootElement === void 0 ? void 0 : _this$hot$rootElement.querySelector('.hot-display-license-info');
|
618
|
-
if (licenseInfoElement) {
|
619
|
-
(0, _element.addClass)(licenseInfoElement, className);
|
620
|
-
}
|
621
|
-
}
|
622
|
-
|
623
|
-
/**
|
624
|
-
* Remove a class name from the license information element.
|
625
|
-
*
|
626
|
-
* @param {string} className The class name to remove.
|
627
|
-
*/
|
628
|
-
removeClassNameFromLicenseElement(className) {
|
629
|
-
var _this$hot$rootElement2;
|
630
|
-
const licenseInfoElement = (_this$hot$rootElement2 = this.hot.rootElement.parentNode) === null || _this$hot$rootElement2 === void 0 ? void 0 : _this$hot$rootElement2.querySelector('.hot-display-license-info');
|
631
|
-
if (licenseInfoElement) {
|
632
|
-
(0, _element.removeClass)(licenseInfoElement, className);
|
633
|
-
}
|
634
|
-
}
|
635
|
-
|
636
595
|
/**
|
637
596
|
* Checks if at least one cell than belongs to the main table is not covered by the top, left or
|
638
597
|
* bottom overlay.
|
@@ -866,7 +825,7 @@ class TableView {
|
|
866
825
|
},
|
867
826
|
beforeDraw: (force, skipRender) => this.beforeRender(force, skipRender),
|
868
827
|
onDraw: force => this.afterRender(force),
|
869
|
-
onBeforeViewportScrollVertically: renderableRow => {
|
828
|
+
onBeforeViewportScrollVertically: (renderableRow, snapping) => {
|
870
829
|
const rowMapper = this.hot.rowIndexMapper;
|
871
830
|
const areColumnHeadersSelected = renderableRow < 0;
|
872
831
|
let visualRow = renderableRow;
|
@@ -878,14 +837,14 @@ class TableView {
|
|
878
837
|
return renderableRow;
|
879
838
|
}
|
880
839
|
}
|
881
|
-
visualRow = this.hot.runHooks('beforeViewportScrollVertically', visualRow);
|
840
|
+
visualRow = this.hot.runHooks('beforeViewportScrollVertically', visualRow, snapping);
|
882
841
|
this.hot.runHooks('beforeViewportScroll');
|
883
842
|
if (!areColumnHeadersSelected) {
|
884
843
|
return rowMapper.getRenderableFromVisualIndex(visualRow);
|
885
844
|
}
|
886
845
|
return visualRow;
|
887
846
|
},
|
888
|
-
onBeforeViewportScrollHorizontally: renderableColumn => {
|
847
|
+
onBeforeViewportScrollHorizontally: (renderableColumn, snapping) => {
|
889
848
|
const columnMapper = this.hot.columnIndexMapper;
|
890
849
|
const areRowHeadersSelected = renderableColumn < 0;
|
891
850
|
let visualColumn = renderableColumn;
|
@@ -897,7 +856,7 @@ class TableView {
|
|
897
856
|
return renderableColumn;
|
898
857
|
}
|
899
858
|
}
|
900
|
-
visualColumn = this.hot.runHooks('beforeViewportScrollHorizontally', visualColumn);
|
859
|
+
visualColumn = this.hot.runHooks('beforeViewportScrollHorizontally', visualColumn, snapping);
|
901
860
|
this.hot.runHooks('beforeViewportScroll');
|
902
861
|
if (!areRowHeadersSelected) {
|
903
862
|
return columnMapper.getRenderableFromVisualIndex(visualColumn);
|
package/tableView.mjs
CHANGED
@@ -9,7 +9,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
9
9
|
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
10
10
|
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
11
11
|
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
|
-
import { addClass,
|
12
|
+
import { addClass, clearTextSelection, empty, fastInnerHTML, fastInnerText, getScrollbarWidth, hasClass, isChildOf, isInput, isOutsideInput, isVisible, setAttribute, getParentWindow } from "./helpers/dom/element.mjs";
|
13
13
|
import EventManager from "./eventManager.mjs";
|
14
14
|
import { isImmediatePropagationStopped, isRightClick, isLeftClick } from "./helpers/dom/event.mjs";
|
15
15
|
import Walkontable from "./3rdparty/walkontable/src/index.mjs";
|
@@ -194,38 +194,43 @@ class TableView {
|
|
194
194
|
* Scroll viewport to a cell.
|
195
195
|
*
|
196
196
|
* @param {CellCoords} coords Renderable cell coordinates.
|
197
|
-
* @param {
|
198
|
-
*
|
199
|
-
*
|
200
|
-
* @param {
|
197
|
+
* @param {'auto' | 'start' | 'end'} [horizontalSnap] If `'start'`, viewport is scrolled to show
|
198
|
+
* the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
|
199
|
+
* the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
|
200
|
+
* @param {'auto' | 'top' | 'bottom'} [verticalSnap] If `'top'`, viewport is scrolled to show
|
201
|
+
* the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on the bottom of
|
202
|
+
* the table. When `'auto'`, the viewport is scrolled only when the row is outside of the viewport.
|
201
203
|
* @returns {boolean}
|
202
204
|
*/
|
203
|
-
scrollViewport(coords,
|
204
|
-
return this._wt.scrollViewport(coords,
|
205
|
+
scrollViewport(coords, horizontalSnap, verticalSnap) {
|
206
|
+
return this._wt.scrollViewport(coords, horizontalSnap, verticalSnap);
|
205
207
|
}
|
206
208
|
|
207
209
|
/**
|
208
210
|
* Scroll viewport to a column.
|
209
211
|
*
|
210
212
|
* @param {number} column Renderable column index.
|
211
|
-
* @param {
|
212
|
-
*
|
213
|
+
* @param {'auto' | 'start' | 'end'} [snap] If `'start'`, viewport is scrolled to show
|
214
|
+
* the cell on the left of the table. If `'end'`, viewport is scrolled to show the cell on the right of
|
215
|
+
* the table. When `'auto'`, the viewport is scrolled only when the column is outside of the viewport.
|
213
216
|
* @returns {boolean}
|
214
217
|
*/
|
215
|
-
scrollViewportHorizontally(column,
|
216
|
-
return this._wt.scrollViewportHorizontally(column,
|
218
|
+
scrollViewportHorizontally(column, snap) {
|
219
|
+
return this._wt.scrollViewportHorizontally(column, snap);
|
217
220
|
}
|
218
221
|
|
219
222
|
/**
|
220
223
|
* Scroll viewport to a row.
|
221
224
|
*
|
222
225
|
* @param {number} row Renderable row index.
|
223
|
-
* @param {
|
224
|
-
*
|
226
|
+
* @param {'auto' | 'top' | 'bottom'} [snap] If `'top'`, viewport is scrolled to show
|
227
|
+
* the cell on the top of the table. If `'bottom'`, viewport is scrolled to show the cell on
|
228
|
+
* the bottom of the table. When `'auto'`, the viewport is scrolled only when the row is outside of
|
229
|
+
* the viewport.
|
225
230
|
* @returns {boolean}
|
226
231
|
*/
|
227
|
-
scrollViewportVertically(row,
|
228
|
-
return this._wt.scrollViewportVertically(row,
|
232
|
+
scrollViewportVertically(row, snap) {
|
233
|
+
return this._wt.scrollViewportVertically(row, snap);
|
229
234
|
}
|
230
235
|
|
231
236
|
/**
|
@@ -583,52 +588,6 @@ class TableView {
|
|
583
588
|
return count;
|
584
589
|
}
|
585
590
|
|
586
|
-
/**
|
587
|
-
* Retrieves the styles handler from the Walkontable instance.
|
588
|
-
*
|
589
|
-
* @returns {StylesHandler} The styles handler instance.
|
590
|
-
*/
|
591
|
-
getStylesHandler() {
|
592
|
-
return this._wt.stylesHandler;
|
593
|
-
}
|
594
|
-
|
595
|
-
/**
|
596
|
-
* Returns the default row height.
|
597
|
-
*
|
598
|
-
* This method retrieves the default row height from the Walkontable styles handler.
|
599
|
-
*
|
600
|
-
* @returns {number} The default row height.
|
601
|
-
*/
|
602
|
-
getDefaultRowHeight() {
|
603
|
-
return this._wt.stylesHandler.getDefaultRowHeight();
|
604
|
-
}
|
605
|
-
|
606
|
-
/**
|
607
|
-
* Add a class name to the license information element.
|
608
|
-
*
|
609
|
-
* @param {string} className The class name to add.
|
610
|
-
*/
|
611
|
-
addClassNameToLicenseElement(className) {
|
612
|
-
var _this$hot$rootElement;
|
613
|
-
const licenseInfoElement = (_this$hot$rootElement = this.hot.rootElement.parentNode) === null || _this$hot$rootElement === void 0 ? void 0 : _this$hot$rootElement.querySelector('.hot-display-license-info');
|
614
|
-
if (licenseInfoElement) {
|
615
|
-
addClass(licenseInfoElement, className);
|
616
|
-
}
|
617
|
-
}
|
618
|
-
|
619
|
-
/**
|
620
|
-
* Remove a class name from the license information element.
|
621
|
-
*
|
622
|
-
* @param {string} className The class name to remove.
|
623
|
-
*/
|
624
|
-
removeClassNameFromLicenseElement(className) {
|
625
|
-
var _this$hot$rootElement2;
|
626
|
-
const licenseInfoElement = (_this$hot$rootElement2 = this.hot.rootElement.parentNode) === null || _this$hot$rootElement2 === void 0 ? void 0 : _this$hot$rootElement2.querySelector('.hot-display-license-info');
|
627
|
-
if (licenseInfoElement) {
|
628
|
-
removeClass(licenseInfoElement, className);
|
629
|
-
}
|
630
|
-
}
|
631
|
-
|
632
591
|
/**
|
633
592
|
* Checks if at least one cell than belongs to the main table is not covered by the top, left or
|
634
593
|
* bottom overlay.
|
@@ -862,7 +821,7 @@ class TableView {
|
|
862
821
|
},
|
863
822
|
beforeDraw: (force, skipRender) => this.beforeRender(force, skipRender),
|
864
823
|
onDraw: force => this.afterRender(force),
|
865
|
-
onBeforeViewportScrollVertically: renderableRow => {
|
824
|
+
onBeforeViewportScrollVertically: (renderableRow, snapping) => {
|
866
825
|
const rowMapper = this.hot.rowIndexMapper;
|
867
826
|
const areColumnHeadersSelected = renderableRow < 0;
|
868
827
|
let visualRow = renderableRow;
|
@@ -874,14 +833,14 @@ class TableView {
|
|
874
833
|
return renderableRow;
|
875
834
|
}
|
876
835
|
}
|
877
|
-
visualRow = this.hot.runHooks('beforeViewportScrollVertically', visualRow);
|
836
|
+
visualRow = this.hot.runHooks('beforeViewportScrollVertically', visualRow, snapping);
|
878
837
|
this.hot.runHooks('beforeViewportScroll');
|
879
838
|
if (!areColumnHeadersSelected) {
|
880
839
|
return rowMapper.getRenderableFromVisualIndex(visualRow);
|
881
840
|
}
|
882
841
|
return visualRow;
|
883
842
|
},
|
884
|
-
onBeforeViewportScrollHorizontally: renderableColumn => {
|
843
|
+
onBeforeViewportScrollHorizontally: (renderableColumn, snapping) => {
|
885
844
|
const columnMapper = this.hot.columnIndexMapper;
|
886
845
|
const areRowHeadersSelected = renderableColumn < 0;
|
887
846
|
let visualColumn = renderableColumn;
|
@@ -893,7 +852,7 @@ class TableView {
|
|
893
852
|
return renderableColumn;
|
894
853
|
}
|
895
854
|
}
|
896
|
-
visualColumn = this.hot.runHooks('beforeViewportScrollHorizontally', visualColumn);
|
855
|
+
visualColumn = this.hot.runHooks('beforeViewportScrollHorizontally', visualColumn, snapping);
|
897
856
|
this.hot.runHooks('beforeViewportScroll');
|
898
857
|
if (!areRowHeadersSelected) {
|
899
858
|
return columnMapper.getRenderableFromVisualIndex(visualColumn);
|
package/utils/autoResize.js
CHANGED
@@ -77,7 +77,6 @@ function createInputElementResizer(ownerDocument) {
|
|
77
77
|
* Resizes the element.
|
78
78
|
*/
|
79
79
|
function resize() {
|
80
|
-
var _getComputedStyle, _getComputedStyle2;
|
81
80
|
textHolder.textContent = observedElement.value;
|
82
81
|
// Won't expand the element size for displaying body as for example, `grid`, `inline-grid` or `flex` with
|
83
82
|
// `flex-direction` set as `column`.
|
@@ -86,9 +85,7 @@ function createInputElementResizer(ownerDocument) {
|
|
86
85
|
textContainer.style.fontFamily = getComputedStyle(observedElement).fontFamily;
|
87
86
|
textContainer.style.whiteSpace = 'pre';
|
88
87
|
body.appendChild(textContainer);
|
89
|
-
const
|
90
|
-
const paddingEnd = parseInt(((_getComputedStyle2 = getComputedStyle(observedElement)) === null || _getComputedStyle2 === void 0 ? void 0 : _getComputedStyle2.paddingInlineEnd) || 0, 10);
|
91
|
-
const width = textContainer.clientWidth + 2 + paddingStart + paddingEnd;
|
88
|
+
const width = textContainer.clientWidth + 2;
|
92
89
|
body.removeChild(textContainer);
|
93
90
|
const elementStyle = observedElement.style;
|
94
91
|
elementStyle.height = `${defaults.minHeight}px`;
|
package/utils/autoResize.mjs
CHANGED
@@ -73,7 +73,6 @@ export function createInputElementResizer(ownerDocument) {
|
|
73
73
|
* Resizes the element.
|
74
74
|
*/
|
75
75
|
function resize() {
|
76
|
-
var _getComputedStyle, _getComputedStyle2;
|
77
76
|
textHolder.textContent = observedElement.value;
|
78
77
|
// Won't expand the element size for displaying body as for example, `grid`, `inline-grid` or `flex` with
|
79
78
|
// `flex-direction` set as `column`.
|
@@ -82,9 +81,7 @@ export function createInputElementResizer(ownerDocument) {
|
|
82
81
|
textContainer.style.fontFamily = getComputedStyle(observedElement).fontFamily;
|
83
82
|
textContainer.style.whiteSpace = 'pre';
|
84
83
|
body.appendChild(textContainer);
|
85
|
-
const
|
86
|
-
const paddingEnd = parseInt(((_getComputedStyle2 = getComputedStyle(observedElement)) === null || _getComputedStyle2 === void 0 ? void 0 : _getComputedStyle2.paddingInlineEnd) || 0, 10);
|
87
|
-
const width = textContainer.clientWidth + 2 + paddingStart + paddingEnd;
|
84
|
+
const width = textContainer.clientWidth + 2;
|
88
85
|
body.removeChild(textContainer);
|
89
86
|
const elementStyle = observedElement.style;
|
90
87
|
elementStyle.height = `${defaults.minHeight}px`;
|
package/utils/ghostTable.js
CHANGED
@@ -133,7 +133,7 @@ class GhostTable {
|
|
133
133
|
if (this.getSetting('useHeaders') && this.hot.getColHeader(column) !== null) {
|
134
134
|
// Please keep in mind that the renderable column index equal to the visual columns index for the GhostTable.
|
135
135
|
// We render all columns.
|
136
|
-
this.hot.view.appendColHeader(column, this.table.th
|
136
|
+
this.hot.view.appendColHeader(column, this.table.th);
|
137
137
|
}
|
138
138
|
this.table.tBody.appendChild(this.createCol(column));
|
139
139
|
this.container.container.appendChild(this.table.fragment);
|
@@ -149,8 +149,6 @@ class GhostTable {
|
|
149
149
|
if (!this.injected) {
|
150
150
|
this.injectTable();
|
151
151
|
}
|
152
|
-
const isBorderBoxSizing = this.hot.view.getStylesHandler().areCellsBorderBox();
|
153
|
-
const borderCompensation = isBorderBoxSizing ? 0 : 1;
|
154
152
|
(0, _array.arrayEach)(this.rows, row => {
|
155
153
|
// In cases when the cell's content produces the height with a decimal point, the height
|
156
154
|
// needs to be rounded up to make sure that there will be a space for the cell's content.
|
@@ -159,8 +157,8 @@ class GhostTable {
|
|
159
157
|
height
|
160
158
|
} = row.table.getBoundingClientRect();
|
161
159
|
|
162
|
-
// -1 <- reduce border-top from table
|
163
|
-
callback(row.row, Math.ceil(height) -
|
160
|
+
// -1 <- reduce border-top from table
|
161
|
+
callback(row.row, Math.ceil(height) - 1);
|
164
162
|
});
|
165
163
|
}
|
166
164
|
|