handsontable 0.0.0-next-acb8c02-20230620 → 0.0.0-next-6d7bdba-20230620

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.

Files changed (57) hide show
  1. package/base.js +2 -2
  2. package/base.mjs +2 -2
  3. package/dist/handsontable.css +2 -2
  4. package/dist/handsontable.full.css +2 -2
  5. package/dist/handsontable.full.js +2193 -2052
  6. package/dist/handsontable.full.min.css +2 -2
  7. package/dist/handsontable.full.min.js +75 -75
  8. package/dist/handsontable.js +1985 -1844
  9. package/dist/handsontable.min.css +2 -2
  10. package/dist/handsontable.min.js +4 -4
  11. package/helpers/mixed.js +1 -1
  12. package/helpers/mixed.mjs +1 -1
  13. package/package.json +1 -1
  14. package/plugins/comments/comments.js +11 -4
  15. package/plugins/comments/comments.mjs +11 -4
  16. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  17. package/plugins/contextMenu/contextMenu.js +80 -29
  18. package/plugins/contextMenu/contextMenu.mjs +81 -30
  19. package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
  20. package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
  21. package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
  22. package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
  23. package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
  24. package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
  25. package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
  26. package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
  27. package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
  28. package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
  29. package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
  30. package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
  31. package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
  32. package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
  33. package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
  34. package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
  35. package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
  36. package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
  37. package/plugins/contextMenu/utils.js +0 -16
  38. package/plugins/contextMenu/utils.mjs +0 -15
  39. package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
  40. package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
  41. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
  42. package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
  43. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
  44. package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
  45. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
  46. package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
  47. package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
  48. package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
  49. package/plugins/customBorders/customBorders.js +7 -0
  50. package/plugins/customBorders/customBorders.mjs +7 -0
  51. package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
  52. package/plugins/dropdownMenu/dropdownMenu.js +20 -10
  53. package/plugins/dropdownMenu/dropdownMenu.mjs +20 -10
  54. package/shortcuts/recorder.js +2 -2
  55. package/shortcuts/recorder.mjs +2 -2
  56. package/shortcuts/utils.js +21 -5
  57. package/shortcuts/utils.mjs +20 -4
@@ -32,6 +32,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
32
32
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
33
33
  import { BasePlugin } from "../base/index.mjs";
34
34
  import { arrayEach } from "../../helpers/array.mjs";
35
+ import { objectEach } from "../../helpers/object.mjs";
35
36
  import CommandExecutor from "../contextMenu/commandExecutor.mjs";
36
37
  import { getDocumentOffsetByElement } from "../contextMenu/utils.mjs";
37
38
  import EventManager from "../../eventManager.mjs";
@@ -268,9 +269,9 @@ export var DropdownMenu = /*#__PURE__*/function (_BasePlugin) {
268
269
  var rect = target.getBoundingClientRect();
269
270
  _this3.open({
270
271
  left: rect.left + offset.left,
271
- top: rect.top + target.offsetHeight + offset.top,
272
- width: rect.width,
273
- height: rect.height
272
+ top: rect.top + target.offsetHeight + offset.top
273
+ }, {
274
+ left: rect.width
274
275
  });
275
276
  _this3.hot._registerTimeout(function () {
276
277
  _this3.menu.selectFirstCell();
@@ -328,20 +329,29 @@ export var DropdownMenu = /*#__PURE__*/function (_BasePlugin) {
328
329
  * which contains coordinates relative to the browsers viewport (without included scroll offsets).
329
330
  * Or if the native event is passed the menu will be positioned based on the `pageX` and `pageY`
330
331
  * coordinates.
332
+ * @param {{ above?: number, below?: number, left?: number, right?: number }} offset An object allows applying
333
+ * the offset to the menu position.
331
334
  * @fires Hooks#beforeDropdownMenuShow
332
335
  * @fires Hooks#afterDropdownMenuShow
333
336
  */
334
337
  }, {
335
338
  key: "open",
336
339
  value: function open(position) {
337
- var _this$menu;
340
+ var _this$menu,
341
+ _this5 = this;
342
+ var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
343
+ above: 0,
344
+ below: 0,
345
+ left: 0,
346
+ right: 0
347
+ };
338
348
  if ((_this$menu = this.menu) !== null && _this$menu !== void 0 && _this$menu.isOpened()) {
339
349
  return;
340
350
  }
341
351
  this.menu.open();
342
- if (position.width) {
343
- this.menu.setOffset('left', position.width);
344
- }
352
+ objectEach(offset, function (value, key) {
353
+ _this5.menu.setOffset(key, value);
354
+ });
345
355
  this.menu.setPosition(position);
346
356
  }
347
357
 
@@ -429,9 +439,9 @@ export var DropdownMenu = /*#__PURE__*/function (_BasePlugin) {
429
439
  var rect = event.target.getBoundingClientRect();
430
440
  this.open({
431
441
  left: rect.left + offset.left,
432
- top: rect.top + event.target.offsetHeight + 3 + offset.top,
433
- width: rect.width,
434
- height: rect.height
442
+ top: rect.top + event.target.offsetHeight + 3 + offset.top
443
+ }, {
444
+ left: rect.width
435
445
  });
436
446
  }
437
447
  }
@@ -88,7 +88,7 @@ function useRecorder(ownerWindow, handleEvent, beforeKeyDown, afterKeyDown, call
88
88
  if (event.keyCode === 229 || result === false || (0, _event.isImmediatePropagationStopped)(event)) {
89
89
  return;
90
90
  }
91
- var pressedKey = (0, _utils.normalizeEventKey)(event.key);
91
+ var pressedKey = (0, _utils.normalizeEventKey)(event);
92
92
  var extraModifierKeys = [];
93
93
  if (isModifierKey(pressedKey)) {
94
94
  modifierKeysObserver.press(pressedKey);
@@ -114,7 +114,7 @@ function useRecorder(ownerWindow, handleEvent, beforeKeyDown, afterKeyDown, call
114
114
  if (handleEvent(event) === false) {
115
115
  return;
116
116
  }
117
- var pressedKey = (0, _utils.normalizeEventKey)(event.key);
117
+ var pressedKey = (0, _utils.normalizeEventKey)(event);
118
118
  if (isModifierKey(pressedKey) === false) {
119
119
  return;
120
120
  }
@@ -84,7 +84,7 @@ export function useRecorder(ownerWindow, handleEvent, beforeKeyDown, afterKeyDow
84
84
  if (event.keyCode === 229 || result === false || isImmediatePropagationStopped(event)) {
85
85
  return;
86
86
  }
87
- var pressedKey = normalizeEventKey(event.key);
87
+ var pressedKey = normalizeEventKey(event);
88
88
  var extraModifierKeys = [];
89
89
  if (isModifierKey(pressedKey)) {
90
90
  modifierKeysObserver.press(pressedKey);
@@ -110,7 +110,7 @@ export function useRecorder(ownerWindow, handleEvent, beforeKeyDown, afterKeyDow
110
110
  if (handleEvent(event) === false) {
111
111
  return;
112
112
  }
113
- var pressedKey = normalizeEventKey(event.key);
113
+ var pressedKey = normalizeEventKey(event);
114
114
  if (isModifierKey(pressedKey) === false) {
115
115
  return;
116
116
  }
@@ -10,6 +10,10 @@ require("core-js/modules/web.dom-collections.iterator.js");
10
10
  require("core-js/modules/es.array.join.js");
11
11
  require("core-js/modules/es.array.sort.js");
12
12
  require("core-js/modules/es.array.map.js");
13
+ require("core-js/modules/es.regexp.constructor.js");
14
+ require("core-js/modules/es.regexp.exec.js");
15
+ require("core-js/modules/es.regexp.to-string.js");
16
+ require("core-js/modules/es.string.replace.js");
13
17
  // This file handles key-name discrepancies between browsers.
14
18
  // For the list of discrepancies, go to: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values.
15
19
  var mappings = new Map([[' ', 'space'],
@@ -46,13 +50,25 @@ var getKeysList = function getKeysList(normalizedKeys) {
46
50
  };
47
51
 
48
52
  /**
49
- * Normalize a `KeyboardEvent.key` property, to use it for keyboard shortcuts.
53
+ * The regex tests if the event.code matches to the pattern and it's used to extract letters and digits from
54
+ * the string.
55
+ */
56
+ exports.getKeysList = getKeysList;
57
+ var codeToKeyRegExp = new RegExp('^(?:Key|Digit)([A-Z0-9])$');
58
+
59
+ /**
60
+ * Normalizes a keyboard event key value to a key before its modification. When the keyboard event
61
+ * is triggered with Alt, Control or Shift keys the `key` property contains modified key e.g. for Alt+L
62
+ * it will be `ł`. But that value is only valid for polish keyboard layout. To fix that limitations, for
63
+ * letters and digits the value is taken from the `code` property which holds original value before
64
+ * transformation.
50
65
  *
51
- * @param {string} key KeyboardEvent's key property.
66
+ * @param {Event} event The KeyboardEvent object.
52
67
  * @returns {string}
53
68
  */
54
- exports.getKeysList = getKeysList;
55
- var normalizeEventKey = function normalizeEventKey(key) {
56
- return key.toLowerCase();
69
+ var normalizeEventKey = function normalizeEventKey(_ref) {
70
+ var key = _ref.key,
71
+ code = _ref.code;
72
+ return (codeToKeyRegExp.test(code) ? code.replace(codeToKeyRegExp, '$1') : key).toLowerCase();
57
73
  };
58
74
  exports.normalizeEventKey = normalizeEventKey;
@@ -6,6 +6,10 @@ import "core-js/modules/web.dom-collections.iterator.js";
6
6
  import "core-js/modules/es.array.join.js";
7
7
  import "core-js/modules/es.array.sort.js";
8
8
  import "core-js/modules/es.array.map.js";
9
+ import "core-js/modules/es.regexp.constructor.js";
10
+ import "core-js/modules/es.regexp.exec.js";
11
+ import "core-js/modules/es.regexp.to-string.js";
12
+ import "core-js/modules/es.string.replace.js";
9
13
  // This file handles key-name discrepancies between browsers.
10
14
  // For the list of discrepancies, go to: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key/Key_Values.
11
15
  var mappings = new Map([[' ', 'space'],
@@ -41,11 +45,23 @@ export var getKeysList = function getKeysList(normalizedKeys) {
41
45
  };
42
46
 
43
47
  /**
44
- * Normalize a `KeyboardEvent.key` property, to use it for keyboard shortcuts.
48
+ * The regex tests if the event.code matches to the pattern and it's used to extract letters and digits from
49
+ * the string.
50
+ */
51
+ var codeToKeyRegExp = new RegExp('^(?:Key|Digit)([A-Z0-9])$');
52
+
53
+ /**
54
+ * Normalizes a keyboard event key value to a key before its modification. When the keyboard event
55
+ * is triggered with Alt, Control or Shift keys the `key` property contains modified key e.g. for Alt+L
56
+ * it will be `ł`. But that value is only valid for polish keyboard layout. To fix that limitations, for
57
+ * letters and digits the value is taken from the `code` property which holds original value before
58
+ * transformation.
45
59
  *
46
- * @param {string} key KeyboardEvent's key property.
60
+ * @param {Event} event The KeyboardEvent object.
47
61
  * @returns {string}
48
62
  */
49
- export var normalizeEventKey = function normalizeEventKey(key) {
50
- return key.toLowerCase();
63
+ export var normalizeEventKey = function normalizeEventKey(_ref) {
64
+ var key = _ref.key,
65
+ code = _ref.code;
66
+ return (codeToKeyRegExp.test(code) ? code.replace(codeToKeyRegExp, '$1') : key).toLowerCase();
51
67
  };