handsontable 0.0.0-next-9b2cada-20230905 → 0.0.0-next-5c1663f-20230911

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.

@@ -148,7 +148,6 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
148
148
  open() {
149
149
  const priv = privatePool.get(this);
150
150
  super.open();
151
- const choicesListHot = this.htEditor.getInstance();
152
151
  const trimDropdown = this.cellProperties.trimDropdown === void 0 ? true : this.cellProperties.trimDropdown;
153
152
  this.showEditableElement();
154
153
  this.focus();
@@ -158,7 +157,7 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
158
157
  }
159
158
 
160
159
  this.addHook('beforeKeyDown', event => this.onBeforeKeyDown(event));
161
- choicesListHot.updateSettings({
160
+ this.htEditor.updateSettings({
162
161
  colWidths: trimDropdown ? [(0, _element.outerWidth)(this.TEXTAREA) - 2] : void 0,
163
162
  width: trimDropdown ? (0, _element.outerWidth)(this.TEXTAREA) + scrollbarWidth : void 0,
164
163
  renderer: (instance, TD, row, col, prop, value, cellProperties) => {
@@ -271,10 +270,15 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
271
270
  }
272
271
  this.strippedChoices = choices;
273
272
  this.htEditor.loadData((0, _array.pivot)([choices]));
274
- this.updateDropdownHeight();
275
- this.flipDropdownIfNeeded();
276
- if (this.cellProperties.strict === true) {
277
- this.highlightBestMatchingChoice(highlightIndex);
273
+ if (choices.length === 0) {
274
+ this.htEditor.rootElement.style.display = 'none';
275
+ } else {
276
+ this.htEditor.rootElement.style.display = '';
277
+ this.updateDropdownHeight();
278
+ this.flipDropdownIfNeeded();
279
+ if (this.cellProperties.strict === true) {
280
+ this.highlightBestMatchingChoice(highlightIndex);
281
+ }
278
282
  }
279
283
  this.hot.listen();
280
284
  (0, _element.setCaretPosition)(this.TEXTAREA, pos, pos === endPos ? void 0 : endPos);
@@ -411,7 +415,7 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
411
415
  * @returns {number}
412
416
  */
413
417
  getDropdownHeight() {
414
- const firstRowHeight = this.htEditor.getInstance().getRowHeight(0) || 23;
418
+ const firstRowHeight = this.htEditor.getRowHeight(0) || 23;
415
419
  const visibleRows = this.cellProperties.visibleRows;
416
420
  return this.strippedChoices.length >= visibleRows ? visibleRows * firstRowHeight : this.strippedChoices.length * firstRowHeight + 8; // eslint-disable-line max-len
417
421
  }
@@ -144,7 +144,6 @@ export class AutocompleteEditor extends HandsontableEditor {
144
144
  open() {
145
145
  const priv = privatePool.get(this);
146
146
  super.open();
147
- const choicesListHot = this.htEditor.getInstance();
148
147
  const trimDropdown = this.cellProperties.trimDropdown === void 0 ? true : this.cellProperties.trimDropdown;
149
148
  this.showEditableElement();
150
149
  this.focus();
@@ -154,7 +153,7 @@ export class AutocompleteEditor extends HandsontableEditor {
154
153
  }
155
154
 
156
155
  this.addHook('beforeKeyDown', event => this.onBeforeKeyDown(event));
157
- choicesListHot.updateSettings({
156
+ this.htEditor.updateSettings({
158
157
  colWidths: trimDropdown ? [outerWidth(this.TEXTAREA) - 2] : void 0,
159
158
  width: trimDropdown ? outerWidth(this.TEXTAREA) + scrollbarWidth : void 0,
160
159
  renderer: (instance, TD, row, col, prop, value, cellProperties) => {
@@ -267,10 +266,15 @@ export class AutocompleteEditor extends HandsontableEditor {
267
266
  }
268
267
  this.strippedChoices = choices;
269
268
  this.htEditor.loadData(pivot([choices]));
270
- this.updateDropdownHeight();
271
- this.flipDropdownIfNeeded();
272
- if (this.cellProperties.strict === true) {
273
- this.highlightBestMatchingChoice(highlightIndex);
269
+ if (choices.length === 0) {
270
+ this.htEditor.rootElement.style.display = 'none';
271
+ } else {
272
+ this.htEditor.rootElement.style.display = '';
273
+ this.updateDropdownHeight();
274
+ this.flipDropdownIfNeeded();
275
+ if (this.cellProperties.strict === true) {
276
+ this.highlightBestMatchingChoice(highlightIndex);
277
+ }
274
278
  }
275
279
  this.hot.listen();
276
280
  setCaretPosition(this.TEXTAREA, pos, pos === endPos ? void 0 : endPos);
@@ -407,7 +411,7 @@ export class AutocompleteEditor extends HandsontableEditor {
407
411
  * @returns {number}
408
412
  */
409
413
  getDropdownHeight() {
410
- const firstRowHeight = this.htEditor.getInstance().getRowHeight(0) || 23;
414
+ const firstRowHeight = this.htEditor.getRowHeight(0) || 23;
411
415
  const visibleRows = this.cellProperties.visibleRows;
412
416
  return this.strippedChoices.length >= visibleRows ? visibleRows * firstRowHeight : this.strippedChoices.length * firstRowHeight + 8; // eslint-disable-line max-len
413
417
  }
@@ -492,21 +492,30 @@ class BaseEditor {
492
492
  const horizontalScrollPosition = Math.abs(wtOverlays.inlineStartOverlay.getScrollPosition());
493
493
  const verticalScrollPosition = wtOverlays.topOverlay.getScrollPosition();
494
494
  const scrollbarWidth = (0, _element.getScrollbarWidth)(this.hot.rootDocument);
495
- const cellTopOffset = TD.offsetTop + firstRowOffset - verticalScrollPosition;
496
- let cellStartOffset = 0;
495
+ let cellTopOffset = TD.offsetTop;
496
+ if (['inline_start', 'master'].includes(overlayName)) {
497
+ cellTopOffset += firstRowOffset - verticalScrollPosition;
498
+ }
499
+ if (['bottom', 'bottom_inline_start_corner'].includes(overlayName)) {
500
+ const {
501
+ wtViewport: bottomWtViewport,
502
+ wtTable: bottomWtTable
503
+ } = wtOverlays.bottomOverlay.clone;
504
+ cellTopOffset += bottomWtViewport.getWorkspaceHeight() - bottomWtTable.getHeight() - scrollbarWidth;
505
+ }
506
+ let cellStartOffset = TD.offsetLeft;
497
507
  if (this.hot.isRtl()) {
498
- const cellOffset = TD.offsetLeft;
499
- if (cellOffset >= 0) {
508
+ if (cellStartOffset >= 0) {
500
509
  cellStartOffset = overlayTable.getWidth() - TD.offsetLeft;
501
510
  } else {
502
511
  // The `offsetLeft` returns negative values when the parent offset element has position relative
503
512
  // (it happens when on the cell the selection is applied - the `area` CSS class).
504
513
  // When it happens the `offsetLeft` value is calculated from the right edge of the parent element.
505
- cellStartOffset = Math.abs(cellOffset);
514
+ cellStartOffset = Math.abs(cellStartOffset);
506
515
  }
507
516
  cellStartOffset += firstColumnOffset - horizontalScrollPosition - cellWidth;
508
- } else {
509
- cellStartOffset = TD.offsetLeft + firstColumnOffset - horizontalScrollPosition;
517
+ } else if (['top', 'master', 'bottom'].includes(overlayName)) {
518
+ cellStartOffset += firstColumnOffset - horizontalScrollPosition;
510
519
  }
511
520
  const cellComputedStyle = (0, _element.getComputedStyle)(this.TD, this.hot.rootWindow);
512
521
  const borderPhysicalWidthProp = this.hot.isRtl() ? 'borderRightWidth' : 'borderLeftWidth';
@@ -485,21 +485,30 @@ export class BaseEditor {
485
485
  const horizontalScrollPosition = Math.abs(wtOverlays.inlineStartOverlay.getScrollPosition());
486
486
  const verticalScrollPosition = wtOverlays.topOverlay.getScrollPosition();
487
487
  const scrollbarWidth = getScrollbarWidth(this.hot.rootDocument);
488
- const cellTopOffset = TD.offsetTop + firstRowOffset - verticalScrollPosition;
489
- let cellStartOffset = 0;
488
+ let cellTopOffset = TD.offsetTop;
489
+ if (['inline_start', 'master'].includes(overlayName)) {
490
+ cellTopOffset += firstRowOffset - verticalScrollPosition;
491
+ }
492
+ if (['bottom', 'bottom_inline_start_corner'].includes(overlayName)) {
493
+ const {
494
+ wtViewport: bottomWtViewport,
495
+ wtTable: bottomWtTable
496
+ } = wtOverlays.bottomOverlay.clone;
497
+ cellTopOffset += bottomWtViewport.getWorkspaceHeight() - bottomWtTable.getHeight() - scrollbarWidth;
498
+ }
499
+ let cellStartOffset = TD.offsetLeft;
490
500
  if (this.hot.isRtl()) {
491
- const cellOffset = TD.offsetLeft;
492
- if (cellOffset >= 0) {
501
+ if (cellStartOffset >= 0) {
493
502
  cellStartOffset = overlayTable.getWidth() - TD.offsetLeft;
494
503
  } else {
495
504
  // The `offsetLeft` returns negative values when the parent offset element has position relative
496
505
  // (it happens when on the cell the selection is applied - the `area` CSS class).
497
506
  // When it happens the `offsetLeft` value is calculated from the right edge of the parent element.
498
- cellStartOffset = Math.abs(cellOffset);
507
+ cellStartOffset = Math.abs(cellStartOffset);
499
508
  }
500
509
  cellStartOffset += firstColumnOffset - horizontalScrollPosition - cellWidth;
501
- } else {
502
- cellStartOffset = TD.offsetLeft + firstColumnOffset - horizontalScrollPosition;
510
+ } else if (['top', 'master', 'bottom'].includes(overlayName)) {
511
+ cellStartOffset += firstColumnOffset - horizontalScrollPosition;
503
512
  }
504
513
  const cellComputedStyle = getComputedStyle(this.TD, this.hot.rootWindow);
505
514
  const borderPhysicalWidthProp = this.hot.isRtl() ? 'borderRightWidth' : 'borderLeftWidth';
@@ -139,7 +139,7 @@ class HandsontableEditor extends _textEditor.TextEditor {
139
139
  }
140
140
 
141
141
  if (this.htEditor && this.htEditor.getSelectedLast()) {
142
- const value = this.htEditor.getInstance().getValue();
142
+ const value = this.htEditor.getValue();
143
143
  if (value !== void 0) {
144
144
  // if the value is undefined then it means we don't want to set the value
145
145
  this.setValue(value);
@@ -176,7 +176,7 @@ class HandsontableEditor extends _textEditor.TextEditor {
176
176
  position: 'before'
177
177
  };
178
178
  const action = (rowToSelect, event) => {
179
- const innerHOT = this.htEditor.getInstance();
179
+ const innerHOT = this.htEditor;
180
180
  if (rowToSelect !== void 0) {
181
181
  if (rowToSelect < 0 || innerHOT.flipped && rowToSelect > innerHOT.countRows() - 1) {
182
182
  innerHOT.deselectCell();
@@ -195,7 +195,7 @@ class HandsontableEditor extends _textEditor.TextEditor {
195
195
  editorContext.addShortcuts([{
196
196
  keys: [['ArrowUp']],
197
197
  callback: event => {
198
- const innerHOT = this.htEditor.getInstance();
198
+ const innerHOT = this.htEditor;
199
199
  let rowToSelect;
200
200
  let selectedRow;
201
201
  if (!innerHOT.getSelectedLast() && innerHOT.flipped) {
@@ -215,7 +215,7 @@ class HandsontableEditor extends _textEditor.TextEditor {
215
215
  }, {
216
216
  keys: [['ArrowDown']],
217
217
  callback: event => {
218
- const innerHOT = this.htEditor.getInstance();
218
+ const innerHOT = this.htEditor;
219
219
  let rowToSelect;
220
220
  let selectedRow;
221
221
  if (!innerHOT.getSelectedLast() && !innerHOT.flipped) {
@@ -135,7 +135,7 @@ export class HandsontableEditor extends TextEditor {
135
135
  }
136
136
 
137
137
  if (this.htEditor && this.htEditor.getSelectedLast()) {
138
- const value = this.htEditor.getInstance().getValue();
138
+ const value = this.htEditor.getValue();
139
139
  if (value !== void 0) {
140
140
  // if the value is undefined then it means we don't want to set the value
141
141
  this.setValue(value);
@@ -172,7 +172,7 @@ export class HandsontableEditor extends TextEditor {
172
172
  position: 'before'
173
173
  };
174
174
  const action = (rowToSelect, event) => {
175
- const innerHOT = this.htEditor.getInstance();
175
+ const innerHOT = this.htEditor;
176
176
  if (rowToSelect !== void 0) {
177
177
  if (rowToSelect < 0 || innerHOT.flipped && rowToSelect > innerHOT.countRows() - 1) {
178
178
  innerHOT.deselectCell();
@@ -191,7 +191,7 @@ export class HandsontableEditor extends TextEditor {
191
191
  editorContext.addShortcuts([{
192
192
  keys: [['ArrowUp']],
193
193
  callback: event => {
194
- const innerHOT = this.htEditor.getInstance();
194
+ const innerHOT = this.htEditor;
195
195
  let rowToSelect;
196
196
  let selectedRow;
197
197
  if (!innerHOT.getSelectedLast() && innerHOT.flipped) {
@@ -211,7 +211,7 @@ export class HandsontableEditor extends TextEditor {
211
211
  }, {
212
212
  keys: [['ArrowDown']],
213
213
  callback: event => {
214
- const innerHOT = this.htEditor.getInstance();
214
+ const innerHOT = this.htEditor;
215
215
  let rowToSelect;
216
216
  let selectedRow;
217
217
  if (!innerHOT.getSelectedLast() && !innerHOT.flipped) {
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-9b2cada-20230905";
137
+ const hotVersion = "0.0.0-next-5c1663f-20230911";
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-9b2cada-20230905";
127
+ const hotVersion = "0.0.0-next-5c1663f-20230911";
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-9b2cada-20230905",
13
+ "version": "0.0.0-next-5c1663f-20230911",
14
14
  "main": "index",
15
15
  "module": "index.mjs",
16
16
  "jsnext:main": "index.mjs",