handsontable 0.0.0-next-ff10728-20250410 → 0.0.0-next-d9b3885-20250415
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/cell/range.js +14 -0
- package/3rdparty/walkontable/src/cell/range.mjs +14 -0
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +4 -1
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +4 -1
- package/3rdparty/walkontable/src/selection/border/border.js +5 -0
- package/3rdparty/walkontable/src/selection/border/border.mjs +5 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +3 -4
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +3 -4
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +8 -10
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +8 -10
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +3 -4
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +3 -4
- package/3rdparty/walkontable/src/table.js +5 -2
- package/3rdparty/walkontable/src/table.mjs +5 -2
- package/CHANGELOG.md +39 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/focusCatcher/focusDetector.js +1 -1
- package/core/focusCatcher/focusDetector.mjs +2 -2
- package/core/hooks/constants.js +266 -0
- package/core/hooks/constants.mjs +266 -0
- package/core/hooks/index.d.ts +1 -0
- package/core.d.ts +0 -1
- package/core.js +71 -25
- package/core.mjs +72 -26
- package/dataMap/dataMap.js +0 -7
- package/dataMap/dataMap.mjs +0 -7
- package/dataMap/metaManager/metaSchema.js +28 -0
- package/dataMap/metaManager/metaSchema.mjs +28 -0
- package/dist/handsontable.css +3 -3
- package/dist/handsontable.full.css +3 -3
- package/dist/handsontable.full.js +1375 -350
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +17 -17
- package/dist/handsontable.js +1375 -350
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +18 -18
- package/editorManager.js +1 -7
- package/editorManager.mjs +1 -7
- package/editors/autocompleteEditor/autocompleteEditor.js +14 -4
- package/editors/autocompleteEditor/autocompleteEditor.mjs +14 -4
- package/editors/textEditor/textEditor.js +1 -1
- package/editors/textEditor/textEditor.mjs +2 -2
- package/helpers/browser.js +1 -1
- package/helpers/browser.mjs +1 -1
- package/helpers/dom/element.js +2 -2
- package/helpers/dom/element.mjs +1 -1
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/helpers/object.js +3 -0
- package/helpers/object.mjs +3 -0
- package/package.json +1 -1
- package/plugins/autoColumnSize/autoColumnSize.js +48 -1
- package/plugins/autoColumnSize/autoColumnSize.mjs +48 -1
- package/plugins/autoRowSize/autoRowSize.js +46 -6
- package/plugins/autoRowSize/autoRowSize.mjs +46 -6
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +13 -0
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +13 -0
- package/plugins/collapsibleColumns/collapsibleColumns.js +31 -0
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +31 -0
- package/plugins/columnSorting/columnSorting.js +0 -4
- package/plugins/columnSorting/columnSorting.mjs +0 -4
- package/plugins/columnSummary/columnSummary.js +33 -0
- package/plugins/columnSummary/columnSummary.mjs +33 -0
- package/plugins/comments/comments.js +54 -0
- package/plugins/comments/comments.mjs +54 -0
- package/plugins/contextMenu/menu/defaultShortcutsList.js +2 -2
- package/plugins/contextMenu/menu/defaultShortcutsList.mjs +2 -2
- package/plugins/contextMenu/menu/menu.js +1 -0
- package/plugins/contextMenu/menu/menu.mjs +1 -0
- package/plugins/contextMenu/menu/positioner.js +10 -2
- package/plugins/contextMenu/menu/positioner.mjs +10 -2
- package/plugins/copyPaste/copyPaste.js +12 -15
- package/plugins/copyPaste/copyPaste.mjs +13 -16
- package/plugins/copyPaste/pasteEvent.js +3 -0
- package/plugins/copyPaste/pasteEvent.mjs +3 -0
- package/plugins/dropdownMenu/dropdownMenu.js +15 -0
- package/plugins/dropdownMenu/dropdownMenu.mjs +15 -0
- package/plugins/exportFile/exportFile.js +58 -0
- package/plugins/exportFile/exportFile.mjs +58 -0
- package/plugins/filters/filters.js +99 -24
- package/plugins/filters/filters.mjs +99 -24
- package/plugins/filters/ui/multipleSelect.js +7 -1
- package/plugins/filters/ui/multipleSelect.mjs +7 -1
- package/plugins/hiddenColumns/hiddenColumns.js +65 -1
- package/plugins/hiddenColumns/hiddenColumns.mjs +65 -1
- package/plugins/hiddenRows/hiddenRows.js +65 -1
- package/plugins/hiddenRows/hiddenRows.mjs +65 -1
- package/plugins/manualColumnResize/manualColumnResize.js +4 -6
- package/plugins/manualColumnResize/manualColumnResize.mjs +4 -6
- package/plugins/manualRowResize/manualRowResize.js +4 -6
- package/plugins/manualRowResize/manualRowResize.mjs +4 -6
- package/plugins/mergeCells/mergeCells.js +26 -29
- package/plugins/mergeCells/mergeCells.mjs +26 -29
- package/plugins/mergeCells/renderer.js +15 -0
- package/plugins/mergeCells/renderer.mjs +15 -0
- package/plugins/mergeCells/utils.js +31 -0
- package/plugins/mergeCells/utils.mjs +27 -0
- package/plugins/nestedHeaders/nestedHeaders.js +25 -0
- package/plugins/nestedHeaders/nestedHeaders.mjs +25 -0
- package/plugins/nestedRows/data/dataManager.js +2 -2
- package/plugins/nestedRows/data/dataManager.mjs +2 -2
- package/plugins/stretchColumns/stretchColumns.js +13 -0
- package/plugins/stretchColumns/stretchColumns.mjs +13 -0
- package/plugins/trimRows/trimRows.js +61 -0
- package/plugins/trimRows/trimRows.mjs +61 -0
- package/plugins/undoRedo/actions/removeColumn.js +19 -14
- package/plugins/undoRedo/actions/removeColumn.mjs +19 -14
- package/plugins/undoRedo/actions/removeRow.js +12 -4
- package/plugins/undoRedo/actions/removeRow.mjs +12 -4
- package/selection/selection.js +3 -1
- package/selection/selection.mjs +3 -1
- package/styles/handsontable.css +14 -15
- package/styles/handsontable.min.css +3 -3
- package/styles/ht-theme-horizon.css +2 -2
- package/styles/ht-theme-horizon.min.css +2 -2
- package/styles/ht-theme-main.css +2 -2
- package/styles/ht-theme-main.min.css +2 -2
- package/tableView.js +5 -8
- package/tableView.mjs +5 -8
- package/utils/ghostTable.js +3 -0
- package/utils/ghostTable.mjs +3 -0
|
@@ -137,6 +137,70 @@ export const PLUGIN_PRIORITY = 320;
|
|
|
137
137
|
* hot.render();
|
|
138
138
|
* ```
|
|
139
139
|
* :::
|
|
140
|
+
*
|
|
141
|
+
* ::: only-for angular
|
|
142
|
+
* ```ts
|
|
143
|
+
* import { AfterViewInit, Component, ViewChild } from "@angular/core";
|
|
144
|
+
* import {
|
|
145
|
+
* GridSettings,
|
|
146
|
+
* HotTableModule,
|
|
147
|
+
* HotTableComponent,
|
|
148
|
+
* } from "@handsontable/angular-wrapper";
|
|
149
|
+
*
|
|
150
|
+
* `@Component`({
|
|
151
|
+
* selector: "app-example",
|
|
152
|
+
* standalone: true,
|
|
153
|
+
* imports: [HotTableModule],
|
|
154
|
+
* template: ` <div class="ht-theme-main">
|
|
155
|
+
* <hot-table [settings]="gridSettings" />
|
|
156
|
+
* </div>`,
|
|
157
|
+
* })
|
|
158
|
+
* export class ExampleComponent implements AfterViewInit {
|
|
159
|
+
* `@ViewChild`(HotTableComponent, { static: false })
|
|
160
|
+
* readonly hotTable!: HotTableComponent;
|
|
161
|
+
*
|
|
162
|
+
* readonly gridSettings = <GridSettings>{
|
|
163
|
+
* data: this.getData(),
|
|
164
|
+
* hiddenRows: {
|
|
165
|
+
* copyPasteEnabled: true,
|
|
166
|
+
* indicators: true,
|
|
167
|
+
* rows: [1, 2, 5],
|
|
168
|
+
* },
|
|
169
|
+
* };
|
|
170
|
+
*
|
|
171
|
+
* ngAfterViewInit(): void {
|
|
172
|
+
* // Access the `HiddenRows` plugin's instance
|
|
173
|
+
* const hot = this.hotTable.hotInstance;
|
|
174
|
+
* const hiddenRowsPlugin = hot.getPlugin("hiddenRows");
|
|
175
|
+
*
|
|
176
|
+
* // Hide a single row
|
|
177
|
+
* hiddenRowsPlugin.hideRow(1);
|
|
178
|
+
*
|
|
179
|
+
* // Hide multiple rows
|
|
180
|
+
* hiddenRowsPlugin.hideRow(1, 2, 9);
|
|
181
|
+
*
|
|
182
|
+
* // Hide multiple rows as an array
|
|
183
|
+
* hiddenRowsPlugin.hideRows([1, 2, 9]);
|
|
184
|
+
*
|
|
185
|
+
* // Unhide a single row
|
|
186
|
+
* hiddenRowsPlugin.showRow(1);
|
|
187
|
+
*
|
|
188
|
+
* // Unhide multiple rows
|
|
189
|
+
* hiddenRowsPlugin.showRow(1, 2, 9);
|
|
190
|
+
*
|
|
191
|
+
* // Unhide multiple rows as an array
|
|
192
|
+
* hiddenRowsPlugin.showRows([1, 2, 9]);
|
|
193
|
+
*
|
|
194
|
+
* // To see your changes, re-render your Handsontable instance
|
|
195
|
+
* hot.render();
|
|
196
|
+
* }
|
|
197
|
+
*
|
|
198
|
+
* private getData(): any[] {
|
|
199
|
+
* // Get some data
|
|
200
|
+
* }
|
|
201
|
+
* }
|
|
202
|
+
* ```
|
|
203
|
+
* :::
|
|
140
204
|
*/
|
|
141
205
|
var _hiddenRowsMap = /*#__PURE__*/new WeakMap();
|
|
142
206
|
var _HiddenRows_brand = /*#__PURE__*/new WeakSet();
|
|
@@ -227,8 +291,8 @@ export class HiddenRows extends BasePlugin {
|
|
|
227
291
|
* Disables the plugin functionality for this Handsontable instance.
|
|
228
292
|
*/
|
|
229
293
|
disablePlugin() {
|
|
230
|
-
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
|
231
294
|
super.disablePlugin();
|
|
295
|
+
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
|
232
296
|
this.resetCellsMeta();
|
|
233
297
|
}
|
|
234
298
|
|
|
@@ -341,12 +341,12 @@ class ManualColumnResize extends _base.BasePlugin {
|
|
|
341
341
|
setupGuidePosition() {
|
|
342
342
|
const handleHeight = parseInt((0, _element.outerHeight)(_classPrivateFieldGet(_handle, this)), 10);
|
|
343
343
|
const handleBottomPosition = parseInt(_classPrivateFieldGet(_handle, this).style.top, 10) + handleHeight;
|
|
344
|
-
const
|
|
344
|
+
const tableHeight = this.hot.view.getTableHeight();
|
|
345
345
|
(0, _element.addClass)(_classPrivateFieldGet(_handle, this), 'active');
|
|
346
346
|
(0, _element.addClass)(_classPrivateFieldGet(_guide, this), 'active');
|
|
347
347
|
_classPrivateFieldGet(_guide, this).style.top = `${handleBottomPosition}px`;
|
|
348
348
|
this.refreshGuidePosition();
|
|
349
|
-
_classPrivateFieldGet(_guide, this).style.height = `${
|
|
349
|
+
_classPrivateFieldGet(_guide, this).style.height = `${tableHeight - handleHeight}px`;
|
|
350
350
|
this.hot.rootElement.appendChild(_classPrivateFieldGet(_guide, this));
|
|
351
351
|
}
|
|
352
352
|
|
|
@@ -417,8 +417,7 @@ class ManualColumnResize extends _base.BasePlugin {
|
|
|
417
417
|
*/
|
|
418
418
|
afterMouseDownTimeout() {
|
|
419
419
|
const render = () => {
|
|
420
|
-
this.hot.
|
|
421
|
-
this.hot.view.render(); // updates all
|
|
420
|
+
this.hot.render();
|
|
422
421
|
this.hot.view.adjustElementsSize();
|
|
423
422
|
};
|
|
424
423
|
const resize = (column, forceRender) => {
|
|
@@ -578,8 +577,7 @@ function _onMouseMove(event) {
|
|
|
578
577
|
*/
|
|
579
578
|
function _onMouseUp() {
|
|
580
579
|
const render = () => {
|
|
581
|
-
this.hot.
|
|
582
|
-
this.hot.view.render(); // updates all
|
|
580
|
+
this.hot.render();
|
|
583
581
|
this.hot.view.adjustElementsSize();
|
|
584
582
|
};
|
|
585
583
|
const resize = (column, forceRender) => {
|
|
@@ -336,12 +336,12 @@ export class ManualColumnResize extends BasePlugin {
|
|
|
336
336
|
setupGuidePosition() {
|
|
337
337
|
const handleHeight = parseInt(outerHeight(_classPrivateFieldGet(_handle, this)), 10);
|
|
338
338
|
const handleBottomPosition = parseInt(_classPrivateFieldGet(_handle, this).style.top, 10) + handleHeight;
|
|
339
|
-
const
|
|
339
|
+
const tableHeight = this.hot.view.getTableHeight();
|
|
340
340
|
addClass(_classPrivateFieldGet(_handle, this), 'active');
|
|
341
341
|
addClass(_classPrivateFieldGet(_guide, this), 'active');
|
|
342
342
|
_classPrivateFieldGet(_guide, this).style.top = `${handleBottomPosition}px`;
|
|
343
343
|
this.refreshGuidePosition();
|
|
344
|
-
_classPrivateFieldGet(_guide, this).style.height = `${
|
|
344
|
+
_classPrivateFieldGet(_guide, this).style.height = `${tableHeight - handleHeight}px`;
|
|
345
345
|
this.hot.rootElement.appendChild(_classPrivateFieldGet(_guide, this));
|
|
346
346
|
}
|
|
347
347
|
|
|
@@ -412,8 +412,7 @@ export class ManualColumnResize extends BasePlugin {
|
|
|
412
412
|
*/
|
|
413
413
|
afterMouseDownTimeout() {
|
|
414
414
|
const render = () => {
|
|
415
|
-
this.hot.
|
|
416
|
-
this.hot.view.render(); // updates all
|
|
415
|
+
this.hot.render();
|
|
417
416
|
this.hot.view.adjustElementsSize();
|
|
418
417
|
};
|
|
419
418
|
const resize = (column, forceRender) => {
|
|
@@ -572,8 +571,7 @@ function _onMouseMove(event) {
|
|
|
572
571
|
*/
|
|
573
572
|
function _onMouseUp() {
|
|
574
573
|
const render = () => {
|
|
575
|
-
this.hot.
|
|
576
|
-
this.hot.view.render(); // updates all
|
|
574
|
+
this.hot.render();
|
|
577
575
|
this.hot.view.adjustElementsSize();
|
|
578
576
|
};
|
|
579
577
|
const resize = (column, forceRender) => {
|
|
@@ -328,12 +328,12 @@ class ManualRowResize extends _base.BasePlugin {
|
|
|
328
328
|
setupGuidePosition() {
|
|
329
329
|
const handleWidth = parseInt((0, _element.outerWidth)(_classPrivateFieldGet(_handle, this)), 10);
|
|
330
330
|
const handleEndPosition = parseInt(_classPrivateFieldGet(_handle, this).style[this.inlineDir], 10) + handleWidth;
|
|
331
|
-
const
|
|
331
|
+
const tableWidth = this.hot.view.getTableWidth();
|
|
332
332
|
(0, _element.addClass)(_classPrivateFieldGet(_handle, this), 'active');
|
|
333
333
|
(0, _element.addClass)(_classPrivateFieldGet(_guide, this), 'active');
|
|
334
334
|
_classPrivateFieldGet(_guide, this).style.top = _classPrivateFieldGet(_handle, this).style.top;
|
|
335
335
|
_classPrivateFieldGet(_guide, this).style[this.inlineDir] = `${handleEndPosition}px`;
|
|
336
|
-
_classPrivateFieldGet(_guide, this).style.width = `${
|
|
336
|
+
_classPrivateFieldGet(_guide, this).style.width = `${tableWidth - handleWidth}px`;
|
|
337
337
|
this.hot.rootElement.appendChild(_classPrivateFieldGet(_guide, this));
|
|
338
338
|
}
|
|
339
339
|
|
|
@@ -414,8 +414,7 @@ class ManualRowResize extends _base.BasePlugin {
|
|
|
414
414
|
*/
|
|
415
415
|
afterMouseDownTimeout() {
|
|
416
416
|
const render = () => {
|
|
417
|
-
this.hot.
|
|
418
|
-
this.hot.view.render(); // updates all
|
|
417
|
+
this.hot.render();
|
|
419
418
|
this.hot.view.adjustElementsSize();
|
|
420
419
|
};
|
|
421
420
|
const resize = (row, forceRender) => {
|
|
@@ -543,8 +542,7 @@ function _onMouseMove(event) {
|
|
|
543
542
|
*/
|
|
544
543
|
function _onMouseUp() {
|
|
545
544
|
const render = () => {
|
|
546
|
-
this.hot.
|
|
547
|
-
this.hot.view.render(); // updates all
|
|
545
|
+
this.hot.render();
|
|
548
546
|
this.hot.view.adjustElementsSize();
|
|
549
547
|
};
|
|
550
548
|
const runHooks = (row, forceRender) => {
|
|
@@ -323,12 +323,12 @@ export class ManualRowResize extends BasePlugin {
|
|
|
323
323
|
setupGuidePosition() {
|
|
324
324
|
const handleWidth = parseInt(outerWidth(_classPrivateFieldGet(_handle, this)), 10);
|
|
325
325
|
const handleEndPosition = parseInt(_classPrivateFieldGet(_handle, this).style[this.inlineDir], 10) + handleWidth;
|
|
326
|
-
const
|
|
326
|
+
const tableWidth = this.hot.view.getTableWidth();
|
|
327
327
|
addClass(_classPrivateFieldGet(_handle, this), 'active');
|
|
328
328
|
addClass(_classPrivateFieldGet(_guide, this), 'active');
|
|
329
329
|
_classPrivateFieldGet(_guide, this).style.top = _classPrivateFieldGet(_handle, this).style.top;
|
|
330
330
|
_classPrivateFieldGet(_guide, this).style[this.inlineDir] = `${handleEndPosition}px`;
|
|
331
|
-
_classPrivateFieldGet(_guide, this).style.width = `${
|
|
331
|
+
_classPrivateFieldGet(_guide, this).style.width = `${tableWidth - handleWidth}px`;
|
|
332
332
|
this.hot.rootElement.appendChild(_classPrivateFieldGet(_guide, this));
|
|
333
333
|
}
|
|
334
334
|
|
|
@@ -409,8 +409,7 @@ export class ManualRowResize extends BasePlugin {
|
|
|
409
409
|
*/
|
|
410
410
|
afterMouseDownTimeout() {
|
|
411
411
|
const render = () => {
|
|
412
|
-
this.hot.
|
|
413
|
-
this.hot.view.render(); // updates all
|
|
412
|
+
this.hot.render();
|
|
414
413
|
this.hot.view.adjustElementsSize();
|
|
415
414
|
};
|
|
416
415
|
const resize = (row, forceRender) => {
|
|
@@ -537,8 +536,7 @@ function _onMouseMove(event) {
|
|
|
537
536
|
*/
|
|
538
537
|
function _onMouseUp() {
|
|
539
538
|
const render = () => {
|
|
540
|
-
this.hot.
|
|
541
|
-
this.hot.view.render(); // updates all
|
|
539
|
+
this.hot.render();
|
|
542
540
|
this.hot.view.adjustElementsSize();
|
|
543
541
|
};
|
|
544
542
|
const runHooks = (row, forceRender) => {
|
|
@@ -30,6 +30,7 @@ var _element = require("../../helpers/dom/element");
|
|
|
30
30
|
var _browser = require("../../helpers/browser");
|
|
31
31
|
var _focusOrder2 = require("./focusOrder");
|
|
32
32
|
var _renderer = require("./renderer");
|
|
33
|
+
var _utils = require("./utils");
|
|
33
34
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
34
35
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
|
35
36
|
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
|
@@ -84,6 +85,24 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
|
84
85
|
* />
|
|
85
86
|
* ```
|
|
86
87
|
* :::
|
|
88
|
+
*
|
|
89
|
+
* ::: only-for angular
|
|
90
|
+
* ```ts
|
|
91
|
+
* settings = {
|
|
92
|
+
* data: getData(),
|
|
93
|
+
* // Enable plugin
|
|
94
|
+
* mergeCells: [
|
|
95
|
+
* { row: 0, col: 3, rowspan: 3, colspan: 3 },
|
|
96
|
+
* { row: 2, col: 6, rowspan: 2, colspan: 2 },
|
|
97
|
+
* { row: 4, col: 8, rowspan: 3, colspan: 3 },
|
|
98
|
+
* ],
|
|
99
|
+
* };
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* ```html
|
|
103
|
+
* <hot-table [settings]="settings"></hot-table>
|
|
104
|
+
* ```
|
|
105
|
+
* :::
|
|
87
106
|
*/
|
|
88
107
|
var _lastSelectedFocus = /*#__PURE__*/new WeakMap();
|
|
89
108
|
var _lastFocusDelta = /*#__PURE__*/new WeakMap();
|
|
@@ -666,8 +685,12 @@ class MergeCells extends _base.BasePlugin {
|
|
|
666
685
|
* @param {CellRange} cellRange The cell range to merge or unmerged.
|
|
667
686
|
*/
|
|
668
687
|
toggleMerge(cellRange) {
|
|
669
|
-
const
|
|
670
|
-
|
|
688
|
+
const {
|
|
689
|
+
from,
|
|
690
|
+
to
|
|
691
|
+
} = cellRange.clone().normalize();
|
|
692
|
+
const mergedCell = this.mergedCellsCollection.get(from.row, from.col);
|
|
693
|
+
const mergedCellCoversWholeRange = mergedCell.row === from.row && mergedCell.col === from.col && mergedCell.row + mergedCell.rowspan - 1 === to.row && mergedCell.col + mergedCell.colspan - 1 === to.col;
|
|
671
694
|
if (mergedCellCoversWholeRange) {
|
|
672
695
|
this.unmergeRange(cellRange);
|
|
673
696
|
} else {
|
|
@@ -1479,33 +1502,7 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
|
1479
1502
|
} else {
|
|
1480
1503
|
rowspanAfterCorrection = rowspan - rowspanCorrection;
|
|
1481
1504
|
}
|
|
1482
|
-
height = Math.max(height !== null && height !== void 0 ? height : 0,
|
|
1505
|
+
height = Math.max(height !== null && height !== void 0 ? height : 0, (0, _utils.sumCellsHeights)(this.hot, row, rowspanAfterCorrection));
|
|
1483
1506
|
});
|
|
1484
1507
|
return height;
|
|
1485
|
-
}
|
|
1486
|
-
/**
|
|
1487
|
-
* Sums the heights of the all cells that the merge cell consists of.
|
|
1488
|
-
*
|
|
1489
|
-
* @param {number} row The visual row index of the merged cell.
|
|
1490
|
-
* @param {number} rowspan The rowspan value of the merged cell.
|
|
1491
|
-
* @returns {number}
|
|
1492
|
-
*/
|
|
1493
|
-
function _sumCellsHeights(row, rowspan) {
|
|
1494
|
-
const {
|
|
1495
|
-
view,
|
|
1496
|
-
rowIndexMapper
|
|
1497
|
-
} = this.hot;
|
|
1498
|
-
const stylesHandler = view.getStylesHandler();
|
|
1499
|
-
const defaultHeight = view.getDefaultRowHeight();
|
|
1500
|
-
let height = 0;
|
|
1501
|
-
for (let i = row; i < row + rowspan; i++) {
|
|
1502
|
-
if (!rowIndexMapper.isHidden(i)) {
|
|
1503
|
-
var _this$hot$getRowHeigh;
|
|
1504
|
-
height += (_this$hot$getRowHeigh = this.hot.getRowHeight(i)) !== null && _this$hot$getRowHeigh !== void 0 ? _this$hot$getRowHeigh : defaultHeight;
|
|
1505
|
-
if (i === 0 && !stylesHandler.isClassicTheme()) {
|
|
1506
|
-
height += 1; // border-top-width
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
}
|
|
1510
|
-
return height;
|
|
1511
1508
|
}
|
|
@@ -36,6 +36,7 @@ import { getStyle } from "../../helpers/dom/element.mjs";
|
|
|
36
36
|
import { isChrome } from "../../helpers/browser.mjs";
|
|
37
37
|
import { FocusOrder } from "./focusOrder.mjs";
|
|
38
38
|
import { createMergeCellRenderer } from "./renderer.mjs";
|
|
39
|
+
import { sumCellsHeights } from "./utils.mjs";
|
|
39
40
|
Hooks.getSingleton().register('beforeMergeCells');
|
|
40
41
|
Hooks.getSingleton().register('afterMergeCells');
|
|
41
42
|
Hooks.getSingleton().register('beforeUnmergeCells');
|
|
@@ -80,6 +81,24 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
|
80
81
|
* />
|
|
81
82
|
* ```
|
|
82
83
|
* :::
|
|
84
|
+
*
|
|
85
|
+
* ::: only-for angular
|
|
86
|
+
* ```ts
|
|
87
|
+
* settings = {
|
|
88
|
+
* data: getData(),
|
|
89
|
+
* // Enable plugin
|
|
90
|
+
* mergeCells: [
|
|
91
|
+
* { row: 0, col: 3, rowspan: 3, colspan: 3 },
|
|
92
|
+
* { row: 2, col: 6, rowspan: 2, colspan: 2 },
|
|
93
|
+
* { row: 4, col: 8, rowspan: 3, colspan: 3 },
|
|
94
|
+
* ],
|
|
95
|
+
* };
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* ```html
|
|
99
|
+
* <hot-table [settings]="settings"></hot-table>
|
|
100
|
+
* ```
|
|
101
|
+
* :::
|
|
83
102
|
*/
|
|
84
103
|
var _lastSelectedFocus = /*#__PURE__*/new WeakMap();
|
|
85
104
|
var _lastFocusDelta = /*#__PURE__*/new WeakMap();
|
|
@@ -662,8 +681,12 @@ export class MergeCells extends BasePlugin {
|
|
|
662
681
|
* @param {CellRange} cellRange The cell range to merge or unmerged.
|
|
663
682
|
*/
|
|
664
683
|
toggleMerge(cellRange) {
|
|
665
|
-
const
|
|
666
|
-
|
|
684
|
+
const {
|
|
685
|
+
from,
|
|
686
|
+
to
|
|
687
|
+
} = cellRange.clone().normalize();
|
|
688
|
+
const mergedCell = this.mergedCellsCollection.get(from.row, from.col);
|
|
689
|
+
const mergedCellCoversWholeRange = mergedCell.row === from.row && mergedCell.col === from.col && mergedCell.row + mergedCell.rowspan - 1 === to.row && mergedCell.col + mergedCell.colspan - 1 === to.col;
|
|
667
690
|
if (mergedCellCoversWholeRange) {
|
|
668
691
|
this.unmergeRange(cellRange);
|
|
669
692
|
} else {
|
|
@@ -1474,33 +1497,7 @@ function _onModifyRowHeightByOverlayName(height, row, overlayType) {
|
|
|
1474
1497
|
} else {
|
|
1475
1498
|
rowspanAfterCorrection = rowspan - rowspanCorrection;
|
|
1476
1499
|
}
|
|
1477
|
-
height = Math.max(height !== null && height !== void 0 ? height : 0,
|
|
1500
|
+
height = Math.max(height !== null && height !== void 0 ? height : 0, sumCellsHeights(this.hot, row, rowspanAfterCorrection));
|
|
1478
1501
|
});
|
|
1479
1502
|
return height;
|
|
1480
|
-
}
|
|
1481
|
-
/**
|
|
1482
|
-
* Sums the heights of the all cells that the merge cell consists of.
|
|
1483
|
-
*
|
|
1484
|
-
* @param {number} row The visual row index of the merged cell.
|
|
1485
|
-
* @param {number} rowspan The rowspan value of the merged cell.
|
|
1486
|
-
* @returns {number}
|
|
1487
|
-
*/
|
|
1488
|
-
function _sumCellsHeights(row, rowspan) {
|
|
1489
|
-
const {
|
|
1490
|
-
view,
|
|
1491
|
-
rowIndexMapper
|
|
1492
|
-
} = this.hot;
|
|
1493
|
-
const stylesHandler = view.getStylesHandler();
|
|
1494
|
-
const defaultHeight = view.getDefaultRowHeight();
|
|
1495
|
-
let height = 0;
|
|
1496
|
-
for (let i = row; i < row + rowspan; i++) {
|
|
1497
|
-
if (!rowIndexMapper.isHidden(i)) {
|
|
1498
|
-
var _this$hot$getRowHeigh;
|
|
1499
|
-
height += (_this$hot$getRowHeigh = this.hot.getRowHeight(i)) !== null && _this$hot$getRowHeigh !== void 0 ? _this$hot$getRowHeigh : defaultHeight;
|
|
1500
|
-
if (i === 0 && !stylesHandler.isClassicTheme()) {
|
|
1501
|
-
height += 1; // border-top-width
|
|
1502
|
-
}
|
|
1503
|
-
}
|
|
1504
|
-
}
|
|
1505
|
-
return height;
|
|
1506
1503
|
}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.createMergeCellRenderer = createMergeCellRenderer;
|
|
5
5
|
var _object = require("../../helpers/object");
|
|
6
|
+
var _browser = require("../../helpers/browser");
|
|
7
|
+
var _utils = require("./utils");
|
|
6
8
|
/**
|
|
7
9
|
* Creates a renderer object for the `MergeCells` plugin.
|
|
8
10
|
*
|
|
@@ -18,6 +20,7 @@ function createMergeCellRenderer(plugin) {
|
|
|
18
20
|
rowIndexMapper: rowMapper,
|
|
19
21
|
columnIndexMapper: columnMapper
|
|
20
22
|
} = hot;
|
|
23
|
+
const updateNextCellsHeight = new Map();
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* Runs before the cell is rendered.
|
|
@@ -39,6 +42,10 @@ function createMergeCellRenderer(plugin) {
|
|
|
39
42
|
if (!(0, _object.isObject)(mergedCell)) {
|
|
40
43
|
TD.removeAttribute('rowspan');
|
|
41
44
|
TD.removeAttribute('colspan');
|
|
45
|
+
if ((0, _browser.isSafari)() && updateNextCellsHeight.has(row) && !hot.getSettings().rowHeaders) {
|
|
46
|
+
TD.style.height = `${updateNextCellsHeight.get(row)}px`;
|
|
47
|
+
updateNextCellsHeight.delete(row);
|
|
48
|
+
}
|
|
42
49
|
TD.style.display = '';
|
|
43
50
|
return;
|
|
44
51
|
}
|
|
@@ -50,6 +57,14 @@ function createMergeCellRenderer(plugin) {
|
|
|
50
57
|
} = mergedCell;
|
|
51
58
|
const [lastMergedRowIndex, lastMergedColumnIndex] = plugin.translateMergedCellToRenderable(origRow, origRowspan, origColumn, origColspan);
|
|
52
59
|
const isVirtualRenderingEnabled = plugin.getSetting('virtualized');
|
|
60
|
+
|
|
61
|
+
// Safari bug fix - the height of the cells next to the merged cell must be defined
|
|
62
|
+
// so that their height is proportional to the height of the merged cell
|
|
63
|
+
// (this emulates default behavior in Chrome, FF etc.)
|
|
64
|
+
if ((0, _browser.isSafari)() && origColumn === 0 && !hot.getSettings().rowHeaders) {
|
|
65
|
+
const height = (0, _utils.sumCellsHeights)(hot, origRow, origRowspan);
|
|
66
|
+
updateNextCellsHeight.set(row, height / origRowspan);
|
|
67
|
+
}
|
|
53
68
|
const renderedRowIndex = rowMapper.getRenderableFromVisualIndex(row);
|
|
54
69
|
const renderedColumnIndex = columnMapper.getRenderableFromVisualIndex(col);
|
|
55
70
|
const maxRowSpan = lastMergedRowIndex - renderedRowIndex + 1; // Number of rendered columns.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { isObject } from "../../helpers/object.mjs";
|
|
2
|
+
import { isSafari } from "../../helpers/browser.mjs";
|
|
3
|
+
import { sumCellsHeights } from "./utils.mjs";
|
|
2
4
|
/**
|
|
3
5
|
* Creates a renderer object for the `MergeCells` plugin.
|
|
4
6
|
*
|
|
@@ -14,6 +16,7 @@ export function createMergeCellRenderer(plugin) {
|
|
|
14
16
|
rowIndexMapper: rowMapper,
|
|
15
17
|
columnIndexMapper: columnMapper
|
|
16
18
|
} = hot;
|
|
19
|
+
const updateNextCellsHeight = new Map();
|
|
17
20
|
|
|
18
21
|
/**
|
|
19
22
|
* Runs before the cell is rendered.
|
|
@@ -35,6 +38,10 @@ export function createMergeCellRenderer(plugin) {
|
|
|
35
38
|
if (!isObject(mergedCell)) {
|
|
36
39
|
TD.removeAttribute('rowspan');
|
|
37
40
|
TD.removeAttribute('colspan');
|
|
41
|
+
if (isSafari() && updateNextCellsHeight.has(row) && !hot.getSettings().rowHeaders) {
|
|
42
|
+
TD.style.height = `${updateNextCellsHeight.get(row)}px`;
|
|
43
|
+
updateNextCellsHeight.delete(row);
|
|
44
|
+
}
|
|
38
45
|
TD.style.display = '';
|
|
39
46
|
return;
|
|
40
47
|
}
|
|
@@ -46,6 +53,14 @@ export function createMergeCellRenderer(plugin) {
|
|
|
46
53
|
} = mergedCell;
|
|
47
54
|
const [lastMergedRowIndex, lastMergedColumnIndex] = plugin.translateMergedCellToRenderable(origRow, origRowspan, origColumn, origColspan);
|
|
48
55
|
const isVirtualRenderingEnabled = plugin.getSetting('virtualized');
|
|
56
|
+
|
|
57
|
+
// Safari bug fix - the height of the cells next to the merged cell must be defined
|
|
58
|
+
// so that their height is proportional to the height of the merged cell
|
|
59
|
+
// (this emulates default behavior in Chrome, FF etc.)
|
|
60
|
+
if (isSafari() && origColumn === 0 && !hot.getSettings().rowHeaders) {
|
|
61
|
+
const height = sumCellsHeights(hot, origRow, origRowspan);
|
|
62
|
+
updateNextCellsHeight.set(row, height / origRowspan);
|
|
63
|
+
}
|
|
49
64
|
const renderedRowIndex = rowMapper.getRenderableFromVisualIndex(row);
|
|
50
65
|
const renderedColumnIndex = columnMapper.getRenderableFromVisualIndex(col);
|
|
51
66
|
const maxRowSpan = lastMergedRowIndex - renderedRowIndex + 1; // Number of rendered columns.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.sumCellsHeights = sumCellsHeights;
|
|
5
|
+
/**
|
|
6
|
+
* Calculates the total height of the merged cell.
|
|
7
|
+
*
|
|
8
|
+
* @param {Core} hotInstance The Handsontable instance.
|
|
9
|
+
* @param {*} row The merged cell's row index.
|
|
10
|
+
* @param {*} rowspan The merged cell height.
|
|
11
|
+
* @returns {number}
|
|
12
|
+
*/
|
|
13
|
+
function sumCellsHeights(hotInstance, row, rowspan) {
|
|
14
|
+
const {
|
|
15
|
+
view,
|
|
16
|
+
rowIndexMapper
|
|
17
|
+
} = hotInstance;
|
|
18
|
+
const stylesHandler = view.getStylesHandler();
|
|
19
|
+
const defaultHeight = view.getDefaultRowHeight();
|
|
20
|
+
let height = 0;
|
|
21
|
+
for (let i = row; i < row + rowspan; i++) {
|
|
22
|
+
if (!rowIndexMapper.isHidden(i)) {
|
|
23
|
+
var _hotInstance$getRowHe;
|
|
24
|
+
height += (_hotInstance$getRowHe = hotInstance.getRowHeight(i)) !== null && _hotInstance$getRowHe !== void 0 ? _hotInstance$getRowHe : defaultHeight;
|
|
25
|
+
if (i === 0 && !stylesHandler.isClassicTheme()) {
|
|
26
|
+
height += 1; // border-top-width
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return height;
|
|
31
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calculates the total height of the merged cell.
|
|
3
|
+
*
|
|
4
|
+
* @param {Core} hotInstance The Handsontable instance.
|
|
5
|
+
* @param {*} row The merged cell's row index.
|
|
6
|
+
* @param {*} rowspan The merged cell height.
|
|
7
|
+
* @returns {number}
|
|
8
|
+
*/
|
|
9
|
+
export function sumCellsHeights(hotInstance, row, rowspan) {
|
|
10
|
+
const {
|
|
11
|
+
view,
|
|
12
|
+
rowIndexMapper
|
|
13
|
+
} = hotInstance;
|
|
14
|
+
const stylesHandler = view.getStylesHandler();
|
|
15
|
+
const defaultHeight = view.getDefaultRowHeight();
|
|
16
|
+
let height = 0;
|
|
17
|
+
for (let i = row; i < row + rowspan; i++) {
|
|
18
|
+
if (!rowIndexMapper.isHidden(i)) {
|
|
19
|
+
var _hotInstance$getRowHe;
|
|
20
|
+
height += (_hotInstance$getRowHe = hotInstance.getRowHeight(i)) !== null && _hotInstance$getRowHe !== void 0 ? _hotInstance$getRowHe : defaultHeight;
|
|
21
|
+
if (i === 0 && !stylesHandler.isClassicTheme()) {
|
|
22
|
+
height += 1; // border-top-width
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return height;
|
|
27
|
+
}
|
|
@@ -72,6 +72,31 @@ const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 280;
|
|
|
72
72
|
* />
|
|
73
73
|
* ```
|
|
74
74
|
* :::
|
|
75
|
+
*
|
|
76
|
+
* ::: only-for angular
|
|
77
|
+
* ```ts
|
|
78
|
+
* settings = {
|
|
79
|
+
* data: getData(),
|
|
80
|
+
* nestedHeaders: [
|
|
81
|
+
* ["A", { label: "B", colspan: 8, headerClassName: "htRight" }, "C"],
|
|
82
|
+
* ["D", { label: "E", colspan: 4 }, { label: "F", colspan: 4 }, "G"],
|
|
83
|
+
* [
|
|
84
|
+
* "H",
|
|
85
|
+
* { label: "I", colspan: 2 },
|
|
86
|
+
* { label: "J", colspan: 2 },
|
|
87
|
+
* { label: "K", colspan: 2 },
|
|
88
|
+
* { label: "L", colspan: 2 },
|
|
89
|
+
* "M",
|
|
90
|
+
* ],
|
|
91
|
+
* ["N", "O", "P", "Q", "R", "S", "T", "U", "V", "W"],
|
|
92
|
+
* ],
|
|
93
|
+
* };
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* ```html
|
|
97
|
+
* <hot-table [settings]="settings"></hot-table>
|
|
98
|
+
* ```
|
|
99
|
+
* :::
|
|
75
100
|
*/
|
|
76
101
|
var _stateManager = /*#__PURE__*/new WeakMap();
|
|
77
102
|
var _hidingIndexMapObserver = /*#__PURE__*/new WeakMap();
|
|
@@ -68,6 +68,31 @@ export const PLUGIN_PRIORITY = 280;
|
|
|
68
68
|
* />
|
|
69
69
|
* ```
|
|
70
70
|
* :::
|
|
71
|
+
*
|
|
72
|
+
* ::: only-for angular
|
|
73
|
+
* ```ts
|
|
74
|
+
* settings = {
|
|
75
|
+
* data: getData(),
|
|
76
|
+
* nestedHeaders: [
|
|
77
|
+
* ["A", { label: "B", colspan: 8, headerClassName: "htRight" }, "C"],
|
|
78
|
+
* ["D", { label: "E", colspan: 4 }, { label: "F", colspan: 4 }, "G"],
|
|
79
|
+
* [
|
|
80
|
+
* "H",
|
|
81
|
+
* { label: "I", colspan: 2 },
|
|
82
|
+
* { label: "J", colspan: 2 },
|
|
83
|
+
* { label: "K", colspan: 2 },
|
|
84
|
+
* { label: "L", colspan: 2 },
|
|
85
|
+
* "M",
|
|
86
|
+
* ],
|
|
87
|
+
* ["N", "O", "P", "Q", "R", "S", "T", "U", "V", "W"],
|
|
88
|
+
* ],
|
|
89
|
+
* };
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* ```html
|
|
93
|
+
* <hot-table [settings]="settings"></hot-table>
|
|
94
|
+
* ```
|
|
95
|
+
* :::
|
|
71
96
|
*/
|
|
72
97
|
var _stateManager = /*#__PURE__*/new WeakMap();
|
|
73
98
|
var _hidingIndexMapObserver = /*#__PURE__*/new WeakMap();
|
|
@@ -627,7 +627,7 @@ class DataManager {
|
|
|
627
627
|
*/
|
|
628
628
|
syncRowWithRawSource(rowElement) {
|
|
629
629
|
let upmostParent = rowElement;
|
|
630
|
-
let tempParent =
|
|
630
|
+
let tempParent = upmostParent;
|
|
631
631
|
do {
|
|
632
632
|
tempParent = this.getRowParent(tempParent);
|
|
633
633
|
if (tempParent !== null) {
|
|
@@ -635,7 +635,7 @@ class DataManager {
|
|
|
635
635
|
}
|
|
636
636
|
} while (tempParent !== null);
|
|
637
637
|
this.plugin.disableCoreAPIModifiers();
|
|
638
|
-
this.hot.setSourceDataAtCell(this.
|
|
638
|
+
this.hot.setSourceDataAtCell(this.getRowIndexWithinParent(upmostParent), '__children', upmostParent.__children, 'NestedRows.syncRowWithRawSource');
|
|
639
639
|
this.plugin.enableCoreAPIModifiers();
|
|
640
640
|
}
|
|
641
641
|
|
|
@@ -624,7 +624,7 @@ class DataManager {
|
|
|
624
624
|
*/
|
|
625
625
|
syncRowWithRawSource(rowElement) {
|
|
626
626
|
let upmostParent = rowElement;
|
|
627
|
-
let tempParent =
|
|
627
|
+
let tempParent = upmostParent;
|
|
628
628
|
do {
|
|
629
629
|
tempParent = this.getRowParent(tempParent);
|
|
630
630
|
if (tempParent !== null) {
|
|
@@ -632,7 +632,7 @@ class DataManager {
|
|
|
632
632
|
}
|
|
633
633
|
} while (tempParent !== null);
|
|
634
634
|
this.plugin.disableCoreAPIModifiers();
|
|
635
|
-
this.hot.setSourceDataAtCell(this.
|
|
635
|
+
this.hot.setSourceDataAtCell(this.getRowIndexWithinParent(upmostParent), '__children', upmostParent.__children, 'NestedRows.syncRowWithRawSource');
|
|
636
636
|
this.plugin.enableCoreAPIModifiers();
|
|
637
637
|
}
|
|
638
638
|
|
|
@@ -62,6 +62,19 @@ const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 155;
|
|
|
62
62
|
* />
|
|
63
63
|
* ```
|
|
64
64
|
* :::
|
|
65
|
+
*
|
|
66
|
+
* ::: only-for angular
|
|
67
|
+
* ```ts
|
|
68
|
+
* settings = {
|
|
69
|
+
* data: getData(),
|
|
70
|
+
* stretchH: "all",
|
|
71
|
+
* };
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* ```html
|
|
75
|
+
* <hot-table [settings]="settings"></hot-table>
|
|
76
|
+
* ```
|
|
77
|
+
* :::
|
|
65
78
|
*/
|
|
66
79
|
/* eslint-enable jsdoc/require-description-complete-sentence */
|
|
67
80
|
var _stretchCalculator = /*#__PURE__*/new WeakMap();
|
|
@@ -59,6 +59,19 @@ export const PLUGIN_PRIORITY = 155;
|
|
|
59
59
|
* />
|
|
60
60
|
* ```
|
|
61
61
|
* :::
|
|
62
|
+
*
|
|
63
|
+
* ::: only-for angular
|
|
64
|
+
* ```ts
|
|
65
|
+
* settings = {
|
|
66
|
+
* data: getData(),
|
|
67
|
+
* stretchH: "all",
|
|
68
|
+
* };
|
|
69
|
+
* ```
|
|
70
|
+
*
|
|
71
|
+
* ```html
|
|
72
|
+
* <hot-table [settings]="settings"></hot-table>
|
|
73
|
+
* ```
|
|
74
|
+
* :::
|
|
62
75
|
*/
|
|
63
76
|
/* eslint-enable jsdoc/require-description-complete-sentence */
|
|
64
77
|
var _stretchCalculator = /*#__PURE__*/new WeakMap();
|