handsontable 0.0.0-next-1c936db-20240912 → 0.0.0-next-1f21f59-20240912
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/base.js +2 -2
- package/base.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +61 -19
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +5 -5
- package/dist/handsontable.js +61 -19
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +5 -5
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +1 -1
- package/plugins/contextMenu/contextMenu.js +7 -0
- package/plugins/contextMenu/contextMenu.mjs +7 -0
- package/plugins/contextMenu/menu/menu.js +47 -14
- package/plugins/contextMenu/menu/menu.mjs +48 -15
- package/plugins/filters/filters.js +2 -0
- package/plugins/filters/filters.mjs +2 -0
package/helpers/mixed.js
CHANGED
@@ -134,7 +134,7 @@ const domMessages = {
|
|
134
134
|
function _injectProductInfo(key, element) {
|
135
135
|
const hasValidType = !isEmpty(key);
|
136
136
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
137
|
-
const hotVersion = "0.0.0-next-
|
137
|
+
const hotVersion = "0.0.0-next-1f21f59-20240912";
|
138
138
|
let keyValidityDate;
|
139
139
|
let consoleMessageState = 'invalid';
|
140
140
|
let domMessageState = 'invalid';
|
package/helpers/mixed.mjs
CHANGED
@@ -124,7 +124,7 @@ const domMessages = {
|
|
124
124
|
export function _injectProductInfo(key, element) {
|
125
125
|
const hasValidType = !isEmpty(key);
|
126
126
|
const isNonCommercial = typeof key === 'string' && key.toLowerCase() === 'non-commercial-and-evaluation';
|
127
|
-
const hotVersion = "0.0.0-next-
|
127
|
+
const hotVersion = "0.0.0-next-1f21f59-20240912";
|
128
128
|
let keyValidityDate;
|
129
129
|
let consoleMessageState = 'invalid';
|
130
130
|
let domMessageState = 'invalid';
|
package/package.json
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
"url": "https://github.com/handsontable/handsontable/issues"
|
11
11
|
},
|
12
12
|
"author": "Handsoncode <hello@handsontable.com>",
|
13
|
-
"version": "0.0.0-next-
|
13
|
+
"version": "0.0.0-next-1f21f59-20240912",
|
14
14
|
"main": "index",
|
15
15
|
"module": "index.mjs",
|
16
16
|
"jsnext:main": "index.mjs",
|
@@ -237,6 +237,13 @@ class ContextMenu extends _base.BasePlugin {
|
|
237
237
|
}
|
238
238
|
this.prepareMenuItems();
|
239
239
|
this.menu.open();
|
240
|
+
const themeHasTableBorder = this.menu.tableBorderWidth > 0;
|
241
|
+
if (!themeHasTableBorder) {
|
242
|
+
offset.below += 1;
|
243
|
+
offset.right += 1;
|
244
|
+
offset.above -= 1;
|
245
|
+
offset.left -= 1;
|
246
|
+
}
|
240
247
|
(0, _object.objectEach)(offset, (value, key) => {
|
241
248
|
this.menu.setOffset(key, value);
|
242
249
|
});
|
@@ -233,6 +233,13 @@ export class ContextMenu extends BasePlugin {
|
|
233
233
|
}
|
234
234
|
this.prepareMenuItems();
|
235
235
|
this.menu.open();
|
236
|
+
const themeHasTableBorder = this.menu.tableBorderWidth > 0;
|
237
|
+
if (!themeHasTableBorder) {
|
238
|
+
offset.below += 1;
|
239
|
+
offset.right += 1;
|
240
|
+
offset.above -= 1;
|
241
|
+
offset.left -= 1;
|
242
|
+
}
|
236
243
|
objectEach(offset, (value, key) => {
|
237
244
|
this.menu.setOffset(key, value);
|
238
245
|
});
|
@@ -47,7 +47,21 @@ const MIN_WIDTH = 215;
|
|
47
47
|
*/
|
48
48
|
var _navigator = /*#__PURE__*/new WeakMap();
|
49
49
|
var _shortcutsCtrl = /*#__PURE__*/new WeakMap();
|
50
|
+
var _tableBorderWidth = /*#__PURE__*/new WeakMap();
|
50
51
|
class Menu {
|
52
|
+
/**
|
53
|
+
* Getter for the table border width.
|
54
|
+
* This getter retrieves the border width of the table used in the menu.
|
55
|
+
*
|
56
|
+
* @returns {number} The border width of the table in pixels.
|
57
|
+
*/
|
58
|
+
get tableBorderWidth() {
|
59
|
+
if (_classPrivateFieldGet(_tableBorderWidth, this) === undefined && this.hotMenu) {
|
60
|
+
_classPrivateFieldSet(_tableBorderWidth, this, parseInt((0, _element.getComputedStyle)(this.hotMenu.view._wt.wtTable.TABLE).borderWidth, 10));
|
61
|
+
}
|
62
|
+
return _classPrivateFieldGet(_tableBorderWidth, this);
|
63
|
+
}
|
64
|
+
|
51
65
|
/**
|
52
66
|
* @param {Core} hotInstance Handsontable instance.
|
53
67
|
* @param {MenuOptions} [options] Menu options.
|
@@ -120,6 +134,12 @@ class Menu {
|
|
120
134
|
* @type {KeyboardShortcutsMenuController}
|
121
135
|
*/
|
122
136
|
_classPrivateFieldInitSpec(this, _shortcutsCtrl, void 0);
|
137
|
+
/**
|
138
|
+
* The border width of the table used in the menu.
|
139
|
+
*
|
140
|
+
* @type {number}
|
141
|
+
*/
|
142
|
+
_classPrivateFieldInitSpec(this, _tableBorderWidth, void 0);
|
123
143
|
this.hot = hotInstance;
|
124
144
|
this.options = options || {
|
125
145
|
parent: null,
|
@@ -276,7 +296,7 @@ class Menu {
|
|
276
296
|
this.openSubMenu(coords.row);
|
277
297
|
}
|
278
298
|
},
|
279
|
-
rowHeights: row => filteredItems[row].name === _predefinedItems.SEPARATOR ? 1 :
|
299
|
+
rowHeights: row => filteredItems[row].name === _predefinedItems.SEPARATOR ? 1 : undefined,
|
280
300
|
afterOnCellContextMenu: event => {
|
281
301
|
event.preventDefault();
|
282
302
|
|
@@ -541,6 +561,31 @@ class Menu {
|
|
541
561
|
this.positioner.setElement(this.container).updatePosition(coords);
|
542
562
|
}
|
543
563
|
|
564
|
+
/**
|
565
|
+
* Updates the dimensions of the menu based on its content.
|
566
|
+
* This method calculates the real height of the menu by summing up the heights of its items,
|
567
|
+
* and adjusts the width and height of the menu's holder and hider elements accordingly.
|
568
|
+
*/
|
569
|
+
updateMenuDimensions() {
|
570
|
+
const {
|
571
|
+
wtTable
|
572
|
+
} = this.hotMenu.view._wt;
|
573
|
+
const data = this.hotMenu.getSettings().data;
|
574
|
+
const hiderStyle = wtTable.hider.style;
|
575
|
+
const holderStyle = wtTable.holder.style;
|
576
|
+
const currentHiderWidth = parseInt(hiderStyle.width, 10);
|
577
|
+
const realHeight = (0, _array.arrayReduce)(data, (accumulator, value, index) => {
|
578
|
+
const itemCell = this.hotMenu.getCell(index, 0);
|
579
|
+
const currentRowHeight = itemCell ? (0, _element.outerHeight)(this.hotMenu.getCell(index, 0)) : 0;
|
580
|
+
return accumulator + (value.name === _predefinedItems.SEPARATOR ? 1 : currentRowHeight);
|
581
|
+
}, 0);
|
582
|
+
|
583
|
+
// Additional 3px to menu's size because of additional border around its `table.htCore`.
|
584
|
+
holderStyle.width = `${currentHiderWidth + 3}px`;
|
585
|
+
holderStyle.height = `${realHeight + 3}px`;
|
586
|
+
hiderStyle.height = holderStyle.height;
|
587
|
+
}
|
588
|
+
|
544
589
|
/**
|
545
590
|
* Create container/wrapper for handsontable.
|
546
591
|
*
|
@@ -583,19 +628,7 @@ class Menu {
|
|
583
628
|
* @private
|
584
629
|
*/
|
585
630
|
onAfterInit() {
|
586
|
-
|
587
|
-
wtTable
|
588
|
-
} = this.hotMenu.view._wt;
|
589
|
-
const data = this.hotMenu.getSettings().data;
|
590
|
-
const hiderStyle = wtTable.hider.style;
|
591
|
-
const holderStyle = wtTable.holder.style;
|
592
|
-
const currentHiderWidth = parseInt(hiderStyle.width, 10);
|
593
|
-
const realHeight = (0, _array.arrayReduce)(data, (accumulator, value) => accumulator + (value.name === _predefinedItems.SEPARATOR ? 1 : 26), 0);
|
594
|
-
|
595
|
-
// Additional 3px to menu's size because of additional border around its `table.htCore`.
|
596
|
-
holderStyle.width = `${currentHiderWidth + 3}px`;
|
597
|
-
holderStyle.height = `${realHeight + 3}px`;
|
598
|
-
hiderStyle.height = holderStyle.height;
|
631
|
+
this.updateMenuDimensions();
|
599
632
|
|
600
633
|
// Replace the default accessibility tags with the context menu's
|
601
634
|
if (this.hot.getSettings().ariaTags) {
|
@@ -16,7 +16,7 @@ import { filterSeparators, hasSubMenu, isItemHidden, normalizeSelection, isItemS
|
|
16
16
|
import EventManager from "../../../eventManager.mjs";
|
17
17
|
import { arrayEach, arrayFilter, arrayReduce } from "../../../helpers/array.mjs";
|
18
18
|
import { isWindowsOS, isMobileBrowser, isIpadOS } from "../../../helpers/browser.mjs";
|
19
|
-
import { addClass, isChildOf, getParentWindow, hasClass, setAttribute } from "../../../helpers/dom/element.mjs";
|
19
|
+
import { addClass, isChildOf, getComputedStyle, getParentWindow, hasClass, setAttribute, outerHeight } from "../../../helpers/dom/element.mjs";
|
20
20
|
import { isRightClick } from "../../../helpers/dom/event.mjs";
|
21
21
|
import { debounce, isFunction } from "../../../helpers/function.mjs";
|
22
22
|
import { isUndefined, isDefined } from "../../../helpers/mixed.mjs";
|
@@ -43,7 +43,21 @@ const MIN_WIDTH = 215;
|
|
43
43
|
*/
|
44
44
|
var _navigator = /*#__PURE__*/new WeakMap();
|
45
45
|
var _shortcutsCtrl = /*#__PURE__*/new WeakMap();
|
46
|
+
var _tableBorderWidth = /*#__PURE__*/new WeakMap();
|
46
47
|
export class Menu {
|
48
|
+
/**
|
49
|
+
* Getter for the table border width.
|
50
|
+
* This getter retrieves the border width of the table used in the menu.
|
51
|
+
*
|
52
|
+
* @returns {number} The border width of the table in pixels.
|
53
|
+
*/
|
54
|
+
get tableBorderWidth() {
|
55
|
+
if (_classPrivateFieldGet(_tableBorderWidth, this) === undefined && this.hotMenu) {
|
56
|
+
_classPrivateFieldSet(_tableBorderWidth, this, parseInt(getComputedStyle(this.hotMenu.view._wt.wtTable.TABLE).borderWidth, 10));
|
57
|
+
}
|
58
|
+
return _classPrivateFieldGet(_tableBorderWidth, this);
|
59
|
+
}
|
60
|
+
|
47
61
|
/**
|
48
62
|
* @param {Core} hotInstance Handsontable instance.
|
49
63
|
* @param {MenuOptions} [options] Menu options.
|
@@ -116,6 +130,12 @@ export class Menu {
|
|
116
130
|
* @type {KeyboardShortcutsMenuController}
|
117
131
|
*/
|
118
132
|
_classPrivateFieldInitSpec(this, _shortcutsCtrl, void 0);
|
133
|
+
/**
|
134
|
+
* The border width of the table used in the menu.
|
135
|
+
*
|
136
|
+
* @type {number}
|
137
|
+
*/
|
138
|
+
_classPrivateFieldInitSpec(this, _tableBorderWidth, void 0);
|
119
139
|
this.hot = hotInstance;
|
120
140
|
this.options = options || {
|
121
141
|
parent: null,
|
@@ -272,7 +292,7 @@ export class Menu {
|
|
272
292
|
this.openSubMenu(coords.row);
|
273
293
|
}
|
274
294
|
},
|
275
|
-
rowHeights: row => filteredItems[row].name === SEPARATOR ? 1 :
|
295
|
+
rowHeights: row => filteredItems[row].name === SEPARATOR ? 1 : undefined,
|
276
296
|
afterOnCellContextMenu: event => {
|
277
297
|
event.preventDefault();
|
278
298
|
|
@@ -537,6 +557,31 @@ export class Menu {
|
|
537
557
|
this.positioner.setElement(this.container).updatePosition(coords);
|
538
558
|
}
|
539
559
|
|
560
|
+
/**
|
561
|
+
* Updates the dimensions of the menu based on its content.
|
562
|
+
* This method calculates the real height of the menu by summing up the heights of its items,
|
563
|
+
* and adjusts the width and height of the menu's holder and hider elements accordingly.
|
564
|
+
*/
|
565
|
+
updateMenuDimensions() {
|
566
|
+
const {
|
567
|
+
wtTable
|
568
|
+
} = this.hotMenu.view._wt;
|
569
|
+
const data = this.hotMenu.getSettings().data;
|
570
|
+
const hiderStyle = wtTable.hider.style;
|
571
|
+
const holderStyle = wtTable.holder.style;
|
572
|
+
const currentHiderWidth = parseInt(hiderStyle.width, 10);
|
573
|
+
const realHeight = arrayReduce(data, (accumulator, value, index) => {
|
574
|
+
const itemCell = this.hotMenu.getCell(index, 0);
|
575
|
+
const currentRowHeight = itemCell ? outerHeight(this.hotMenu.getCell(index, 0)) : 0;
|
576
|
+
return accumulator + (value.name === SEPARATOR ? 1 : currentRowHeight);
|
577
|
+
}, 0);
|
578
|
+
|
579
|
+
// Additional 3px to menu's size because of additional border around its `table.htCore`.
|
580
|
+
holderStyle.width = `${currentHiderWidth + 3}px`;
|
581
|
+
holderStyle.height = `${realHeight + 3}px`;
|
582
|
+
hiderStyle.height = holderStyle.height;
|
583
|
+
}
|
584
|
+
|
540
585
|
/**
|
541
586
|
* Create container/wrapper for handsontable.
|
542
587
|
*
|
@@ -579,19 +624,7 @@ export class Menu {
|
|
579
624
|
* @private
|
580
625
|
*/
|
581
626
|
onAfterInit() {
|
582
|
-
|
583
|
-
wtTable
|
584
|
-
} = this.hotMenu.view._wt;
|
585
|
-
const data = this.hotMenu.getSettings().data;
|
586
|
-
const hiderStyle = wtTable.hider.style;
|
587
|
-
const holderStyle = wtTable.holder.style;
|
588
|
-
const currentHiderWidth = parseInt(hiderStyle.width, 10);
|
589
|
-
const realHeight = arrayReduce(data, (accumulator, value) => accumulator + (value.name === SEPARATOR ? 1 : 26), 0);
|
590
|
-
|
591
|
-
// Additional 3px to menu's size because of additional border around its `table.htCore`.
|
592
|
-
holderStyle.width = `${currentHiderWidth + 3}px`;
|
593
|
-
holderStyle.height = `${realHeight + 3}px`;
|
594
|
-
hiderStyle.height = holderStyle.height;
|
627
|
+
this.updateMenuDimensions();
|
595
628
|
|
596
629
|
// Replace the default accessibility tags with the context menu's
|
597
630
|
if (this.hot.getSettings().ariaTags) {
|
@@ -803,7 +803,9 @@ function _onAfterChange(changes) {
|
|
803
803
|
}
|
804
804
|
}
|
805
805
|
function _onAfterDropdownMenuShow() {
|
806
|
+
const menu = this.dropdownMenuPlugin.menu;
|
806
807
|
this.restoreComponents(Array.from(this.components.values()));
|
808
|
+
menu.updateMenuDimensions();
|
807
809
|
}
|
808
810
|
/**
|
809
811
|
* After dropdown menu hide listener.
|
@@ -796,7 +796,9 @@ function _onAfterChange(changes) {
|
|
796
796
|
}
|
797
797
|
}
|
798
798
|
function _onAfterDropdownMenuShow() {
|
799
|
+
const menu = this.dropdownMenuPlugin.menu;
|
799
800
|
this.restoreComponents(Array.from(this.components.values()));
|
801
|
+
menu.updateMenuDimensions();
|
800
802
|
}
|
801
803
|
/**
|
802
804
|
* After dropdown menu hide listener.
|