handsontable 0.0.0-next-c3d40ad-20241127 → 0.0.0-next-9a52a6a-20241128

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.

@@ -1,8 +1,13 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
+ require("core-js/modules/es.error.cause.js");
4
5
  var _textEditor = require("../textEditor");
6
+ var _autoResize = require("../../utils/autoResize");
5
7
  var _element = require("../../helpers/dom/element");
8
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
9
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
10
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
6
11
  const EDITOR_TYPE = exports.EDITOR_TYPE = 'password';
7
12
 
8
13
  /**
@@ -10,6 +15,19 @@ const EDITOR_TYPE = exports.EDITOR_TYPE = 'password';
10
15
  * @class PasswordEditor
11
16
  */
12
17
  class PasswordEditor extends _textEditor.TextEditor {
18
+ constructor() {
19
+ super(...arguments);
20
+ /**
21
+ * Autoresize instance for resizing the editor to the size of the entered text. Its overwrites the default
22
+ * resizer of the TextEditor.
23
+ *
24
+ * @private
25
+ * @type {Function}
26
+ */
27
+ _defineProperty(this, "autoResize", (0, _autoResize.createInputElementResizer)(this.hot.rootDocument, {
28
+ textContent: element => '•'.repeat(element.value.length)
29
+ }));
30
+ }
13
31
  static get EDITOR_TYPE() {
14
32
  return EDITOR_TYPE;
15
33
  }
@@ -1,4 +1,9 @@
1
+ import "core-js/modules/es.error.cause.js";
2
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
3
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
4
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
5
  import { TextEditor } from "../textEditor/index.mjs";
6
+ import { createInputElementResizer } from "../../utils/autoResize.mjs";
2
7
  import { empty } from "../../helpers/dom/element.mjs";
3
8
  export const EDITOR_TYPE = 'password';
4
9
 
@@ -7,6 +12,19 @@ export const EDITOR_TYPE = 'password';
7
12
  * @class PasswordEditor
8
13
  */
9
14
  export class PasswordEditor extends TextEditor {
15
+ constructor() {
16
+ super(...arguments);
17
+ /**
18
+ * Autoresize instance for resizing the editor to the size of the entered text. Its overwrites the default
19
+ * resizer of the TextEditor.
20
+ *
21
+ * @private
22
+ * @type {Function}
23
+ */
24
+ _defineProperty(this, "autoResize", createInputElementResizer(this.hot.rootDocument, {
25
+ textContent: element => '•'.repeat(element.value.length)
26
+ }));
27
+ }
10
28
  static get EDITOR_TYPE() {
11
29
  return EDITOR_TYPE;
12
30
  }
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-c3d40ad-20241127";
137
+ const hotVersion = "0.0.0-next-9a52a6a-20241128";
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-c3d40ad-20241127";
127
+ const hotVersion = "0.0.0-next-9a52a6a-20241128";
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-c3d40ad-20241127",
13
+ "version": "0.0.0-next-9a52a6a-20241128",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",
@@ -287,7 +287,7 @@ class Comments extends _base.BasePlugin {
287
287
  stopPropagation: true,
288
288
  runOnlyIf: () => {
289
289
  var _this$hot$getSelected;
290
- return ((_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isCell()) && !_classPrivateFieldGet(_editor, this).isVisible();
290
+ return (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isCell();
291
291
  },
292
292
  group: SHORTCUTS_GROUP
293
293
  });
@@ -777,7 +777,7 @@ function _onEditorResize(width, height) {
777
777
  * @param {Event} event The keydown event.
778
778
  */
779
779
  function _onAfterDocumentKeyDown(event) {
780
- if (_classPrivateFieldGet(_editor, this).isVisible()) {
780
+ if (_classPrivateFieldGet(_editor, this).isFocused()) {
781
781
  (0, _event.stopImmediatePropagation)(event);
782
782
  }
783
783
  }
@@ -283,7 +283,7 @@ export class Comments extends BasePlugin {
283
283
  stopPropagation: true,
284
284
  runOnlyIf: () => {
285
285
  var _this$hot$getSelected;
286
- return ((_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isCell()) && !_classPrivateFieldGet(_editor, this).isVisible();
286
+ return (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isCell();
287
287
  },
288
288
  group: SHORTCUTS_GROUP
289
289
  });
@@ -772,7 +772,7 @@ function _onEditorResize(width, height) {
772
772
  * @param {Event} event The keydown event.
773
773
  */
774
774
  function _onAfterDocumentKeyDown(event) {
775
- if (_classPrivateFieldGet(_editor, this).isVisible()) {
775
+ if (_classPrivateFieldGet(_editor, this).isFocused()) {
776
776
  stopImmediatePropagation(event);
777
777
  }
778
778
  }
@@ -85,7 +85,7 @@ function useRecorder(ownerWindow, handleEvent, beforeKeyDown, afterKeyDown, call
85
85
  // keyCode 229 aka 'uninitialized' doesn't take into account with editors. This key code is
86
86
  // produced when unfinished character is entering using the IME editor. It is fired on macOS,
87
87
  // Windows and linux (ubuntu) with installed ibus-pinyin package.
88
- if (event.keyCode === 229 || result === false || (0, _event.isImmediatePropagationStopped)(event)) {
88
+ if (result === false || event.keyCode === 229 || typeof event.key !== 'string' || (0, _event.isImmediatePropagationStopped)(event)) {
89
89
  return;
90
90
  }
91
91
  const pressedKey = (0, _utils.normalizeEventKey)(event);
@@ -109,7 +109,7 @@ function useRecorder(ownerWindow, handleEvent, beforeKeyDown, afterKeyDown, call
109
109
  * @param {KeyboardEvent} event The event object
110
110
  */
111
111
  const onkeydownForModKeys = event => {
112
- if (event.key) {
112
+ if (typeof event.key === 'string') {
113
113
  const pressedKey = (0, _utils.normalizeEventKey)(event);
114
114
  if (isModifierKey(pressedKey)) {
115
115
  modifierKeysObserver.press(pressedKey);
@@ -124,7 +124,7 @@ function useRecorder(ownerWindow, handleEvent, beforeKeyDown, afterKeyDown, call
124
124
  * @param {KeyboardEvent} event The event object
125
125
  */
126
126
  const onkeyupForModKeys = event => {
127
- if (event.key) {
127
+ if (typeof event.key === 'string') {
128
128
  const pressedKey = (0, _utils.normalizeEventKey)(event);
129
129
  if (isModifierKey(pressedKey)) {
130
130
  modifierKeysObserver.release(pressedKey);
@@ -81,7 +81,7 @@ export function useRecorder(ownerWindow, handleEvent, beforeKeyDown, afterKeyDow
81
81
  // keyCode 229 aka 'uninitialized' doesn't take into account with editors. This key code is
82
82
  // produced when unfinished character is entering using the IME editor. It is fired on macOS,
83
83
  // Windows and linux (ubuntu) with installed ibus-pinyin package.
84
- if (event.keyCode === 229 || result === false || isImmediatePropagationStopped(event)) {
84
+ if (result === false || event.keyCode === 229 || typeof event.key !== 'string' || isImmediatePropagationStopped(event)) {
85
85
  return;
86
86
  }
87
87
  const pressedKey = normalizeEventKey(event);
@@ -105,7 +105,7 @@ export function useRecorder(ownerWindow, handleEvent, beforeKeyDown, afterKeyDow
105
105
  * @param {KeyboardEvent} event The event object
106
106
  */
107
107
  const onkeydownForModKeys = event => {
108
- if (event.key) {
108
+ if (typeof event.key === 'string') {
109
109
  const pressedKey = normalizeEventKey(event);
110
110
  if (isModifierKey(pressedKey)) {
111
111
  modifierKeysObserver.press(pressedKey);
@@ -120,7 +120,7 @@ export function useRecorder(ownerWindow, handleEvent, beforeKeyDown, afterKeyDow
120
120
  * @param {KeyboardEvent} event The event object
121
121
  */
122
122
  const onkeyupForModKeys = event => {
123
- if (event.key) {
123
+ if (typeof event.key === 'string') {
124
124
  const pressedKey = normalizeEventKey(event);
125
125
  if (isModifierKey(pressedKey)) {
126
126
  modifierKeysObserver.release(pressedKey);
@@ -48,6 +48,7 @@ function getComputedStyle(element) {
48
48
  * @property {number} maxWidth The maximum width of the element.
49
49
  * @property {number} minHeight The minimum height of the element.
50
50
  * @property {number} maxHeight The maximum height of the element.
51
+ * @property {function(HTMLElement): string} textContent The function that returns the text content to measure.
51
52
  */
52
53
  /**
53
54
  * @typedef InputElementResizer
@@ -59,14 +60,18 @@ function getComputedStyle(element) {
59
60
  * Creates an input element resizer.
60
61
  *
61
62
  * @param {Document} ownerDocument The document to create the resizer for.
63
+ * @param {InputElementResizerConfig} initialOptions The configuration to extend the defaults with.
62
64
  * @returns {InputElementResizer}
63
65
  */
64
66
  function createInputElementResizer(ownerDocument) {
67
+ let initialOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
65
68
  const defaults = {
66
69
  minHeight: 200,
67
70
  maxHeight: 300,
68
71
  minWidth: 100,
69
- maxWidth: 300
72
+ maxWidth: 300,
73
+ textContent: element => element.value,
74
+ ...initialOptions
70
75
  };
71
76
  const body = ownerDocument.body;
72
77
  const textHolder = ownerDocument.createTextNode('');
@@ -77,7 +82,7 @@ function createInputElementResizer(ownerDocument) {
77
82
  * Resizes the element.
78
83
  */
79
84
  function resize() {
80
- textHolder.textContent = observedElement.value;
85
+ textHolder.textContent = defaults.textContent(observedElement);
81
86
  // Won't expand the element size for displaying body as for example, `grid`, `inline-grid` or `flex` with
82
87
  // `flex-direction` set as `column`.
83
88
  textContainer.style.position = 'absolute';
@@ -44,6 +44,7 @@ function getComputedStyle(element) {
44
44
  * @property {number} maxWidth The maximum width of the element.
45
45
  * @property {number} minHeight The minimum height of the element.
46
46
  * @property {number} maxHeight The maximum height of the element.
47
+ * @property {function(HTMLElement): string} textContent The function that returns the text content to measure.
47
48
  */
48
49
  /**
49
50
  * @typedef InputElementResizer
@@ -55,14 +56,18 @@ function getComputedStyle(element) {
55
56
  * Creates an input element resizer.
56
57
  *
57
58
  * @param {Document} ownerDocument The document to create the resizer for.
59
+ * @param {InputElementResizerConfig} initialOptions The configuration to extend the defaults with.
58
60
  * @returns {InputElementResizer}
59
61
  */
60
62
  export function createInputElementResizer(ownerDocument) {
63
+ let initialOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
61
64
  const defaults = {
62
65
  minHeight: 200,
63
66
  maxHeight: 300,
64
67
  minWidth: 100,
65
- maxWidth: 300
68
+ maxWidth: 300,
69
+ textContent: element => element.value,
70
+ ...initialOptions
66
71
  };
67
72
  const body = ownerDocument.body;
68
73
  const textHolder = ownerDocument.createTextNode('');
@@ -73,7 +78,7 @@ export function createInputElementResizer(ownerDocument) {
73
78
  * Resizes the element.
74
79
  */
75
80
  function resize() {
76
- textHolder.textContent = observedElement.value;
81
+ textHolder.textContent = defaults.textContent(observedElement);
77
82
  // Won't expand the element size for displaying body as for example, `grid`, `inline-grid` or `flex` with
78
83
  // `flex-direction` set as `column`.
79
84
  textContainer.style.position = 'absolute';