handsontable 0.0.0-next-35d334b-20240408 → 0.0.0-next-0ff5394-20240409

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.

@@ -4,6 +4,7 @@ exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  var _moment = _interopRequireDefault(require("moment"));
6
6
  var _pikaday = _interopRequireDefault(require("@handsontable/pikaday"));
7
+ var _baseEditor = require("../baseEditor");
7
8
  var _textEditor = require("../textEditor");
8
9
  var _element = require("../../helpers/dom/element");
9
10
  var _object = require("../../helpers/object");
@@ -115,8 +116,8 @@ class DateEditor extends _textEditor.TextEditor {
115
116
  let event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
116
117
  const shortcutManager = this.hot.getShortcutManager();
117
118
  const editorContext = shortcutManager.getContext('editor');
118
- super.open();
119
119
  this.showDatepicker(event);
120
+ super.open();
120
121
  editorContext.addShortcuts([{
121
122
  keys: [['ArrowLeft']],
122
123
  callback: () => {
@@ -180,7 +181,6 @@ class DateEditor extends _textEditor.TextEditor {
180
181
  * @param {Event} event The event object.
181
182
  */
182
183
  showDatepicker(event) {
183
- const offset = this.TD.getBoundingClientRect();
184
184
  const dateFormat = this.cellProperties.dateFormat || this.defaultDateFormat;
185
185
  const isMouseDown = this.hot.view.isMouseDown();
186
186
  const isMeta = event ? (0, _unicode.isFunctionKey)(event.keyCode) : false;
@@ -191,14 +191,6 @@ class DateEditor extends _textEditor.TextEditor {
191
191
  this.$datePicker.useMoment(_moment.default);
192
192
  }
193
193
  this.$datePicker._onInputFocus = function () {};
194
- this.datePickerStyle.top = `${this.hot.rootWindow.pageYOffset + offset.top + (0, _element.outerHeight)(this.TD)}px`;
195
- let pickerLeftPosition = this.hot.rootWindow.pageXOffset;
196
- if (this.hot.isRtl()) {
197
- pickerLeftPosition = offset.right - (0, _element.outerWidth)(this.datePicker);
198
- } else {
199
- pickerLeftPosition = offset.left;
200
- }
201
- this.datePickerStyle.left = `${pickerLeftPosition}px`;
202
194
  if (this.originalValue) {
203
195
  dateStr = this.originalValue;
204
196
  if ((0, _moment.default)(dateStr, dateFormat, true).isValid()) {
@@ -279,5 +271,37 @@ class DateEditor extends _textEditor.TextEditor {
279
271
  };
280
272
  return options;
281
273
  }
274
+
275
+ /**
276
+ * Refreshes datepicker's size and position. The method is called internally by Handsontable.
277
+ *
278
+ * @private
279
+ * @param {boolean} force Indicates if the refreshing editor dimensions should be triggered.
280
+ */
281
+ refreshDimensions(force) {
282
+ super.refreshDimensions(force);
283
+ if (this.state !== _baseEditor.EDITOR_STATE.EDITING) {
284
+ return;
285
+ }
286
+ this.TD = this.getEditedCell();
287
+ if (!this.TD) {
288
+ this.hideDatepicker();
289
+ return;
290
+ }
291
+ const view = this.hot.view;
292
+ if (this.col >= view.getFirstPartiallyVisibleColumn() && this.col <= view.getLastPartiallyVisibleColumn() && this.row >= view.getFirstPartiallyVisibleRow() && this.row <= view.getLastPartiallyVisibleRow()) {
293
+ const offset = this.TD.getBoundingClientRect();
294
+ this.datePickerStyle.top = `${this.hot.rootWindow.pageYOffset + offset.top + (0, _element.outerHeight)(this.TD)}px`;
295
+ let pickerLeftPosition = this.hot.rootWindow.pageXOffset;
296
+ if (this.hot.isRtl()) {
297
+ pickerLeftPosition += offset.right - (0, _element.outerWidth)(this.datePicker);
298
+ } else {
299
+ pickerLeftPosition += offset.left;
300
+ }
301
+ this.datePickerStyle.left = `${pickerLeftPosition}px`;
302
+ } else {
303
+ this.hideDatepicker();
304
+ }
305
+ }
282
306
  }
283
307
  exports.DateEditor = DateEditor;
@@ -4,6 +4,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
4
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); }
5
5
  import moment from 'moment';
6
6
  import Pikaday from '@handsontable/pikaday';
7
+ import { EDITOR_STATE } from "../baseEditor/index.mjs";
7
8
  import { TextEditor } from "../textEditor/index.mjs";
8
9
  import { addClass, hasClass, outerHeight, outerWidth } from "../../helpers/dom/element.mjs";
9
10
  import { deepExtend } from "../../helpers/object.mjs";
@@ -111,8 +112,8 @@ export class DateEditor extends TextEditor {
111
112
  let event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
112
113
  const shortcutManager = this.hot.getShortcutManager();
113
114
  const editorContext = shortcutManager.getContext('editor');
114
- super.open();
115
115
  this.showDatepicker(event);
116
+ super.open();
116
117
  editorContext.addShortcuts([{
117
118
  keys: [['ArrowLeft']],
118
119
  callback: () => {
@@ -176,7 +177,6 @@ export class DateEditor extends TextEditor {
176
177
  * @param {Event} event The event object.
177
178
  */
178
179
  showDatepicker(event) {
179
- const offset = this.TD.getBoundingClientRect();
180
180
  const dateFormat = this.cellProperties.dateFormat || this.defaultDateFormat;
181
181
  const isMouseDown = this.hot.view.isMouseDown();
182
182
  const isMeta = event ? isFunctionKey(event.keyCode) : false;
@@ -187,14 +187,6 @@ export class DateEditor extends TextEditor {
187
187
  this.$datePicker.useMoment(moment);
188
188
  }
189
189
  this.$datePicker._onInputFocus = function () {};
190
- this.datePickerStyle.top = `${this.hot.rootWindow.pageYOffset + offset.top + outerHeight(this.TD)}px`;
191
- let pickerLeftPosition = this.hot.rootWindow.pageXOffset;
192
- if (this.hot.isRtl()) {
193
- pickerLeftPosition = offset.right - outerWidth(this.datePicker);
194
- } else {
195
- pickerLeftPosition = offset.left;
196
- }
197
- this.datePickerStyle.left = `${pickerLeftPosition}px`;
198
190
  if (this.originalValue) {
199
191
  dateStr = this.originalValue;
200
192
  if (moment(dateStr, dateFormat, true).isValid()) {
@@ -275,4 +267,36 @@ export class DateEditor extends TextEditor {
275
267
  };
276
268
  return options;
277
269
  }
270
+
271
+ /**
272
+ * Refreshes datepicker's size and position. The method is called internally by Handsontable.
273
+ *
274
+ * @private
275
+ * @param {boolean} force Indicates if the refreshing editor dimensions should be triggered.
276
+ */
277
+ refreshDimensions(force) {
278
+ super.refreshDimensions(force);
279
+ if (this.state !== EDITOR_STATE.EDITING) {
280
+ return;
281
+ }
282
+ this.TD = this.getEditedCell();
283
+ if (!this.TD) {
284
+ this.hideDatepicker();
285
+ return;
286
+ }
287
+ const view = this.hot.view;
288
+ if (this.col >= view.getFirstPartiallyVisibleColumn() && this.col <= view.getLastPartiallyVisibleColumn() && this.row >= view.getFirstPartiallyVisibleRow() && this.row <= view.getLastPartiallyVisibleRow()) {
289
+ const offset = this.TD.getBoundingClientRect();
290
+ this.datePickerStyle.top = `${this.hot.rootWindow.pageYOffset + offset.top + outerHeight(this.TD)}px`;
291
+ let pickerLeftPosition = this.hot.rootWindow.pageXOffset;
292
+ if (this.hot.isRtl()) {
293
+ pickerLeftPosition += offset.right - outerWidth(this.datePicker);
294
+ } else {
295
+ pickerLeftPosition += offset.left;
296
+ }
297
+ this.datePickerStyle.left = `${pickerLeftPosition}px`;
298
+ } else {
299
+ this.hideDatepicker();
300
+ }
301
+ }
278
302
  }
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-35d334b-20240408";
137
+ const hotVersion = "0.0.0-next-0ff5394-20240409";
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-35d334b-20240408";
127
+ const hotVersion = "0.0.0-next-0ff5394-20240409";
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-35d334b-20240408",
13
+ "version": "0.0.0-next-0ff5394-20240409",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",