handsontable 14.3.0 → 14.4.0-next-f62dd73-20240521

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. package/3rdparty/walkontable/src/calculator/viewportRows.js +3 -3
  2. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +3 -3
  3. package/3rdparty/walkontable/src/core/_base.js +1 -1
  4. package/3rdparty/walkontable/src/core/_base.mjs +1 -1
  5. package/3rdparty/walkontable/src/overlay/_base.js +24 -20
  6. package/3rdparty/walkontable/src/overlay/_base.mjs +24 -20
  7. package/3rdparty/walkontable/src/overlay/bottom.js +3 -6
  8. package/3rdparty/walkontable/src/overlay/bottom.mjs +3 -6
  9. package/3rdparty/walkontable/src/overlay/inlineStart.js +22 -19
  10. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +22 -19
  11. package/3rdparty/walkontable/src/overlay/top.js +13 -12
  12. package/3rdparty/walkontable/src/overlay/top.mjs +13 -12
  13. package/3rdparty/walkontable/src/overlays.js +46 -24
  14. package/3rdparty/walkontable/src/overlays.mjs +46 -24
  15. package/3rdparty/walkontable/src/selection/manager.js +7 -0
  16. package/3rdparty/walkontable/src/selection/manager.mjs +7 -0
  17. package/3rdparty/walkontable/src/selection/scanner.js +7 -0
  18. package/3rdparty/walkontable/src/selection/scanner.mjs +7 -0
  19. package/3rdparty/walkontable/src/table.js +10 -11
  20. package/3rdparty/walkontable/src/table.mjs +10 -11
  21. package/3rdparty/walkontable/src/utils/columnStretching.js +4 -0
  22. package/3rdparty/walkontable/src/utils/columnStretching.mjs +4 -0
  23. package/3rdparty/walkontable/src/viewport.js +18 -10
  24. package/3rdparty/walkontable/src/viewport.mjs +18 -10
  25. package/CHANGELOG.md +37 -0
  26. package/base.js +2 -2
  27. package/base.mjs +2 -2
  28. package/core.d.ts +2 -2
  29. package/core.js +93 -162
  30. package/core.mjs +93 -162
  31. package/dataMap/dataMap.js +10 -4
  32. package/dataMap/dataMap.mjs +10 -4
  33. package/dataMap/dataSource.js +16 -3
  34. package/dataMap/dataSource.mjs +16 -3
  35. package/dataMap/metaManager/lazyFactoryMap.js +7 -0
  36. package/dataMap/metaManager/lazyFactoryMap.mjs +7 -0
  37. package/dataMap/metaManager/metaSchema.js +38 -0
  38. package/dataMap/metaManager/metaSchema.mjs +38 -0
  39. package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -0
  40. package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -0
  41. package/dataMap/metaManager/mods/extendMetaProperties.js +44 -31
  42. package/dataMap/metaManager/mods/extendMetaProperties.mjs +44 -31
  43. package/dataMap/metaManager/utils.js +7 -0
  44. package/dataMap/metaManager/utils.mjs +7 -0
  45. package/dist/handsontable.css +4 -5
  46. package/dist/handsontable.full.css +4 -5
  47. package/dist/handsontable.full.js +5878 -4657
  48. package/dist/handsontable.full.min.css +4 -4
  49. package/dist/handsontable.full.min.js +59 -59
  50. package/dist/handsontable.js +5383 -4277
  51. package/dist/handsontable.min.css +4 -4
  52. package/dist/handsontable.min.js +20 -20
  53. package/editorManager.js +0 -67
  54. package/editorManager.mjs +0 -67
  55. package/editors/autocompleteEditor/autocompleteEditor.js +6 -4
  56. package/editors/autocompleteEditor/autocompleteEditor.mjs +6 -4
  57. package/editors/baseEditor/baseEditor.js +1 -36
  58. package/editors/baseEditor/baseEditor.mjs +2 -37
  59. package/editors/dateEditor/dateEditor.js +4 -1
  60. package/editors/dateEditor/dateEditor.mjs +4 -1
  61. package/editors/dropdownEditor/dropdownEditor.js +8 -5
  62. package/editors/dropdownEditor/dropdownEditor.mjs +8 -5
  63. package/editors/handsontableEditor/handsontableEditor.js +2 -2
  64. package/editors/handsontableEditor/handsontableEditor.mjs +2 -2
  65. package/editors/selectEditor/selectEditor.js +1 -9
  66. package/editors/selectEditor/selectEditor.mjs +1 -9
  67. package/editors/textEditor/textEditor.js +2 -11
  68. package/editors/textEditor/textEditor.mjs +2 -11
  69. package/focusManager.js +3 -5
  70. package/focusManager.mjs +3 -5
  71. package/helpers/array.js +7 -0
  72. package/helpers/array.mjs +7 -0
  73. package/helpers/mixed.js +2 -2
  74. package/helpers/mixed.mjs +2 -2
  75. package/helpers/number.js +12 -2
  76. package/helpers/number.mjs +12 -2
  77. package/package.json +3 -3
  78. package/pluginHooks.d.ts +1 -1
  79. package/pluginHooks.js +79 -2
  80. package/pluginHooks.mjs +79 -2
  81. package/plugins/autoColumnSize/autoColumnSize.js +7 -0
  82. package/plugins/autoColumnSize/autoColumnSize.mjs +7 -0
  83. package/plugins/autoRowSize/autoRowSize.js +2 -2
  84. package/plugins/autoRowSize/autoRowSize.mjs +2 -2
  85. package/plugins/autofill/autofill.js +1 -1
  86. package/plugins/autofill/autofill.mjs +1 -1
  87. package/plugins/base/base.d.ts +1 -1
  88. package/plugins/base/base.js +6 -2
  89. package/plugins/base/base.mjs +6 -2
  90. package/plugins/collapsibleColumns/collapsibleColumns.js +1 -1
  91. package/plugins/collapsibleColumns/collapsibleColumns.mjs +1 -1
  92. package/plugins/columnSorting/sortFunction/date.js +2 -46
  93. package/plugins/columnSorting/sortFunction/date.mjs +2 -45
  94. package/plugins/columnSorting/sortFunction/time.js +17 -0
  95. package/plugins/columnSorting/sortFunction/time.mjs +13 -0
  96. package/plugins/columnSorting/sortService/registry.js +4 -2
  97. package/plugins/columnSorting/sortService/registry.mjs +3 -1
  98. package/plugins/columnSorting/utils.js +64 -0
  99. package/plugins/columnSorting/utils.mjs +62 -0
  100. package/plugins/columnSummary/columnSummary.js +27 -10
  101. package/plugins/columnSummary/columnSummary.mjs +27 -10
  102. package/plugins/columnSummary/endpoints.js +15 -0
  103. package/plugins/columnSummary/endpoints.mjs +15 -0
  104. package/plugins/comments/comments.js +2 -8
  105. package/plugins/comments/comments.mjs +2 -8
  106. package/plugins/comments/contextMenuItem/addEditComment.js +0 -1
  107. package/plugins/comments/contextMenuItem/addEditComment.mjs +0 -1
  108. package/plugins/contextMenu/contextMenu.d.ts +1 -1
  109. package/plugins/copyPaste/copyPaste.js +9 -2
  110. package/plugins/copyPaste/copyPaste.mjs +9 -2
  111. package/plugins/copyPaste/pasteEvent.js +1 -0
  112. package/plugins/copyPaste/pasteEvent.mjs +1 -0
  113. package/plugins/filters/filters.js +1 -1
  114. package/plugins/filters/filters.mjs +1 -1
  115. package/plugins/filters/ui/multipleSelect.js +22 -14
  116. package/plugins/filters/ui/multipleSelect.mjs +22 -14
  117. package/plugins/filters/utils.js +7 -0
  118. package/plugins/filters/utils.mjs +7 -0
  119. package/plugins/formulas/formulas.d.ts +10 -0
  120. package/plugins/formulas/formulas.js +11 -2
  121. package/plugins/formulas/formulas.mjs +11 -2
  122. package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +1 -1
  123. package/plugins/hiddenColumns/contextMenuItem/hideColumn.mjs +1 -1
  124. package/plugins/hiddenColumns/contextMenuItem/showColumn.js +1 -1
  125. package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +1 -1
  126. package/plugins/hiddenColumns/hiddenColumns.js +8 -1
  127. package/plugins/hiddenColumns/hiddenColumns.mjs +8 -1
  128. package/plugins/hiddenRows/contextMenuItem/hideRow.js +1 -1
  129. package/plugins/hiddenRows/contextMenuItem/hideRow.mjs +1 -1
  130. package/plugins/hiddenRows/contextMenuItem/showRow.js +1 -1
  131. package/plugins/hiddenRows/contextMenuItem/showRow.mjs +1 -1
  132. package/plugins/hiddenRows/hiddenRows.js +7 -0
  133. package/plugins/hiddenRows/hiddenRows.mjs +7 -0
  134. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
  135. package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
  136. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
  137. package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
  138. package/plugins/manualColumnMove/manualColumnMove.js +1 -1
  139. package/plugins/manualColumnMove/manualColumnMove.mjs +1 -1
  140. package/plugins/manualColumnResize/manualColumnResize.js +3 -3
  141. package/plugins/manualColumnResize/manualColumnResize.mjs +3 -3
  142. package/plugins/manualRowMove/manualRowMove.js +1 -1
  143. package/plugins/manualRowMove/manualRowMove.mjs +1 -1
  144. package/plugins/manualRowResize/manualRowResize.d.ts +1 -0
  145. package/plugins/manualRowResize/manualRowResize.js +11 -2
  146. package/plugins/manualRowResize/manualRowResize.mjs +11 -2
  147. package/plugins/mergeCells/cellsCollection.js +7 -0
  148. package/plugins/mergeCells/cellsCollection.mjs +7 -0
  149. package/plugins/mergeCells/mergeCells.js +7 -0
  150. package/plugins/mergeCells/mergeCells.mjs +7 -0
  151. package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.js +7 -0
  152. package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.mjs +7 -0
  153. package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.js +7 -0
  154. package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.mjs +7 -0
  155. package/plugins/nestedRows/nestedRows.js +7 -0
  156. package/plugins/nestedRows/nestedRows.mjs +7 -0
  157. package/plugins/trimRows/trimRows.js +7 -0
  158. package/plugins/trimRows/trimRows.mjs +7 -0
  159. package/selection/selection.js +163 -4
  160. package/selection/selection.mjs +163 -4
  161. package/selection/utils.js +7 -0
  162. package/selection/utils.mjs +7 -0
  163. package/settings.d.ts +1 -0
  164. package/shortcutContexts/commands/editor/closeAndSave.js +2 -3
  165. package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -3
  166. package/shortcutContexts/commands/editor/closeAndSaveByArrowKeys.js +27 -0
  167. package/shortcutContexts/commands/editor/closeAndSaveByArrowKeys.mjs +24 -0
  168. package/shortcutContexts/commands/editor/closeAndSaveByEnter.js +11 -0
  169. package/shortcutContexts/commands/editor/closeAndSaveByEnter.mjs +8 -0
  170. package/shortcutContexts/commands/editor/index.js +3 -1
  171. package/shortcutContexts/commands/editor/index.mjs +3 -1
  172. package/shortcutContexts/editor.js +9 -1
  173. package/shortcutContexts/editor.mjs +9 -1
  174. package/shortcutContexts/index.js +1 -1
  175. package/shortcutContexts/index.mjs +1 -1
  176. package/shortcuts/keyObserver.js +7 -0
  177. package/shortcuts/keyObserver.mjs +7 -0
  178. package/shortcuts/utils.js +7 -0
  179. package/shortcuts/utils.mjs +7 -0
  180. package/tableView.js +1 -4
  181. package/tableView.mjs +1 -4
  182. package/translations/changesObservable/observable.js +7 -0
  183. package/translations/changesObservable/observable.mjs +7 -0
  184. package/translations/indexMapper.js +7 -0
  185. package/translations/indexMapper.mjs +8 -1
  186. package/utils/dataStructures/uniqueSet.js +7 -0
  187. package/utils/dataStructures/uniqueSet.mjs +7 -0
  188. package/utils/ghostTable.js +0 -4
  189. package/utils/ghostTable.mjs +0 -4
  190. package/utils/paginator.js +7 -0
  191. package/utils/paginator.mjs +7 -0
  192. package/validators/dateValidator/dateValidator.js +1 -3
  193. package/validators/dateValidator/dateValidator.mjs +1 -3
  194. package/validators/timeValidator/timeValidator.js +1 -3
  195. package/validators/timeValidator/timeValidator.mjs +1 -3
@@ -22,7 +22,6 @@ function addEditCommentItem(plugin) {
22
22
  },
23
23
  callback() {
24
24
  const range = this.getSelectedRangeLast();
25
- this.deselectCell();
26
25
  plugin.setRange(range);
27
26
  plugin.show();
28
27
  plugin.focusEditor();
@@ -16,7 +16,6 @@ export default function addEditCommentItem(plugin) {
16
16
  },
17
17
  callback() {
18
18
  const range = this.getSelectedRangeLast();
19
- this.deselectCell();
20
19
  plugin.setRange(range);
21
20
  plugin.show();
22
21
  plugin.focusEditor();
@@ -21,7 +21,7 @@ export interface Selection {
21
21
  }
22
22
 
23
23
  export interface MenuConfig {
24
- [key: string]: MenuItemConfig;
24
+ [key: string]: MenuItemConfig | PredefinedMenuItemKey;
25
25
  }
26
26
 
27
27
  export interface MenuItemConfig {
@@ -556,6 +556,9 @@ class CopyPaste extends _base.BasePlugin {
556
556
  if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened()) {
557
557
  return;
558
558
  }
559
+ if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
560
+ return;
561
+ }
559
562
  this.setCopyableText();
560
563
  _classPrivateFieldSet(_isTriggeredByCopy, this, false);
561
564
  const data = this.getRangedData(this.copyableRanges);
@@ -586,6 +589,9 @@ class CopyPaste extends _base.BasePlugin {
586
589
  if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened()) {
587
590
  return;
588
591
  }
592
+ if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
593
+ return;
594
+ }
589
595
  this.setCopyableText();
590
596
  _classPrivateFieldSet(_isTriggeredByCut, this, false);
591
597
  const rangedData = this.getRangedData(this.copyableRanges);
@@ -615,9 +621,10 @@ class CopyPaste extends _base.BasePlugin {
615
621
  if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected()) {
616
622
  return;
617
623
  }
618
- if (event && event.preventDefault) {
619
- event.preventDefault();
624
+ if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
625
+ return;
620
626
  }
627
+ event.preventDefault();
621
628
  let pastedData;
622
629
  if (event && typeof event.clipboardData !== 'undefined') {
623
630
  const textHTML = (0, _string.sanitize)(event.clipboardData.getData('text/html'), {
@@ -552,6 +552,9 @@ export class CopyPaste extends BasePlugin {
552
552
  if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened()) {
553
553
  return;
554
554
  }
555
+ if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
556
+ return;
557
+ }
555
558
  this.setCopyableText();
556
559
  _classPrivateFieldSet(_isTriggeredByCopy, this, false);
557
560
  const data = this.getRangedData(this.copyableRanges);
@@ -582,6 +585,9 @@ export class CopyPaste extends BasePlugin {
582
585
  if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened()) {
583
586
  return;
584
587
  }
588
+ if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
589
+ return;
590
+ }
585
591
  this.setCopyableText();
586
592
  _classPrivateFieldSet(_isTriggeredByCut, this, false);
587
593
  const rangedData = this.getRangedData(this.copyableRanges);
@@ -611,9 +617,10 @@ export class CopyPaste extends BasePlugin {
611
617
  if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected()) {
612
618
  return;
613
619
  }
614
- if (event && event.preventDefault) {
615
- event.preventDefault();
620
+ if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
621
+ return;
616
622
  }
623
+ event.preventDefault();
617
624
  let pastedData;
618
625
  if (event && typeof event.clipboardData !== 'undefined') {
619
626
  const textHTML = sanitize(event.clipboardData.getData('text/html'), {
@@ -10,5 +10,6 @@ class PasteEvent {
10
10
  constructor() {
11
11
  this.clipboardData = new _clipboardData.default();
12
12
  }
13
+ preventDefault() {}
13
14
  }
14
15
  exports.default = PasteEvent;
@@ -6,4 +6,5 @@ export default class PasteEvent {
6
6
  constructor() {
7
7
  this.clipboardData = new ClipboardData();
8
8
  }
9
+ preventDefault() {}
9
10
  }
@@ -508,7 +508,7 @@ class Filters extends _base.BasePlugin {
508
508
  }
509
509
  }
510
510
  this.hot.runHooks('afterFilter', conditions);
511
- this.hot.view.adjustElementsSize(true);
511
+ this.hot.view.adjustElementsSize();
512
512
  this.hot.render();
513
513
  if (this.hot.selection.isSelected()) {
514
514
  this.hot.selectCell(navigableHeaders ? -1 : 0, this.hot.getSelectedRangeLast().highlight.col);
@@ -502,7 +502,7 @@ export class Filters extends BasePlugin {
502
502
  }
503
503
  }
504
504
  this.hot.runHooks('afterFilter', conditions);
505
- this.hot.view.adjustElementsSize(true);
505
+ this.hot.view.adjustElementsSize();
506
506
  this.hot.render();
507
507
  if (this.hot.selection.isSelected()) {
508
508
  this.hot.selectCell(navigableHeaders ? -1 : 0, this.hot.getSelectedRangeLast().highlight.col);
@@ -5,7 +5,6 @@ require("core-js/modules/es.error.cause.js");
5
5
  require("core-js/modules/es.array.push.js");
6
6
  var _element = require("../../../helpers/dom/element");
7
7
  var _object = require("../../../helpers/object");
8
- var _array = require("../../../helpers/array");
9
8
  var _unicode = require("../../../helpers/unicode");
10
9
  var _function = require("../../../helpers/function");
11
10
  var _data = require("../../../helpers/data");
@@ -251,11 +250,17 @@ class MultipleSelectUI extends _base.BaseUI {
251
250
  beforeOnCellMouseUp: () => {
252
251
  _classPrivateFieldGet(_itemsBox, this).listen();
253
252
  },
253
+ modifyColWidth: width => {
254
+ const minWidth = _classPrivateFieldGet(_itemsBox, this).container.scrollWidth - (0, _element.getScrollbarWidth)(rootDocument);
255
+ if (width !== undefined && width < minWidth) {
256
+ return minWidth;
257
+ }
258
+ return width;
259
+ },
260
+ hiddenRows: true,
254
261
  maxCols: 1,
255
262
  autoWrapCol: true,
256
263
  height: 110,
257
- // Workaround for #151.
258
- colWidths: () => _classPrivateFieldGet(_itemsBox, this).container.scrollWidth - (0, _element.getScrollbarWidth)(rootDocument),
259
264
  copyPaste: false,
260
265
  disableVisualSelection: 'area',
261
266
  fillHandle: false,
@@ -342,13 +347,16 @@ class MultipleSelectUI extends _base.BaseUI {
342
347
  exports.MultipleSelectUI = MultipleSelectUI;
343
348
  function _onInput(event) {
344
349
  const value = event.target.value.toLocaleLowerCase(this.getLocale());
345
- let filteredItems;
346
- if (value === '') {
347
- filteredItems = [..._classPrivateFieldGet(_items, this)];
348
- } else {
349
- filteredItems = (0, _array.arrayFilter)(_classPrivateFieldGet(_items, this), item => `${item.value}`.toLocaleLowerCase(this.getLocale()).indexOf(value) >= 0);
350
- }
351
- _classPrivateFieldGet(_itemsBox, this).loadData(filteredItems);
350
+ const hiddenRows = _classPrivateFieldGet(_itemsBox, this).getPlugin('hiddenRows');
351
+ hiddenRows.showRows(hiddenRows.getHiddenRows());
352
+ _classPrivateFieldGet(_items, this).forEach((item, index) => {
353
+ item.checked = `${item.value}`.toLocaleLowerCase(this.getLocale()).indexOf(value) >= 0;
354
+ if (!item.checked) {
355
+ hiddenRows.hideRow(index);
356
+ }
357
+ });
358
+ _classPrivateFieldGet(_itemsBox, this).view.adjustElementsSize();
359
+ _classPrivateFieldGet(_itemsBox, this).render();
352
360
  }
353
361
  /**
354
362
  * 'keydown' event listener for input element.
@@ -373,7 +381,7 @@ function _onInputKeyDown(event) {
373
381
  function _onSelectAllClick(event) {
374
382
  const changes = [];
375
383
  event.preventDefault();
376
- (0, _array.arrayEach)(_classPrivateFieldGet(_itemsBox, this).getSourceData(), (row, rowIndex) => {
384
+ _classPrivateFieldGet(_itemsBox, this).getSourceData().forEach((row, rowIndex) => {
377
385
  row.checked = true;
378
386
  changes.push((0, _data.dataRowToChangesArray)(row, rowIndex)[0]);
379
387
  });
@@ -387,7 +395,7 @@ function _onSelectAllClick(event) {
387
395
  function _onClearAllClick(event) {
388
396
  const changes = [];
389
397
  event.preventDefault();
390
- (0, _array.arrayEach)(_classPrivateFieldGet(_itemsBox, this).getSourceData(), (row, rowIndex) => {
398
+ _classPrivateFieldGet(_itemsBox, this).getSourceData().forEach((row, rowIndex) => {
391
399
  row.checked = false;
392
400
  changes.push((0, _data.dataRowToChangesArray)(row, rowIndex)[0]);
393
401
  });
@@ -403,7 +411,7 @@ var _default = exports.default = MultipleSelectUI;
403
411
  */
404
412
  function valueToItems(availableItems, selectedValue) {
405
413
  const arrayAssertion = (0, _utils.createArrayAssertion)(selectedValue);
406
- return (0, _array.arrayMap)(availableItems, item => {
414
+ return availableItems.map(item => {
407
415
  item.checked = arrayAssertion(item.value);
408
416
  return item;
409
417
  });
@@ -417,7 +425,7 @@ function valueToItems(availableItems, selectedValue) {
417
425
  */
418
426
  function itemsToValue(availableItems) {
419
427
  const items = [];
420
- (0, _array.arrayEach)(availableItems, item => {
428
+ availableItems.forEach(item => {
421
429
  if (item.checked) {
422
430
  items.push(item.value);
423
431
  }
@@ -8,7 +8,6 @@ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a),
8
8
  function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
9
9
  import { addClass, getScrollbarWidth } from "../../../helpers/dom/element.mjs";
10
10
  import { clone, extend } from "../../../helpers/object.mjs";
11
- import { arrayFilter, arrayMap, arrayEach } from "../../../helpers/array.mjs";
12
11
  import { isKey } from "../../../helpers/unicode.mjs";
13
12
  import { partial } from "../../../helpers/function.mjs";
14
13
  import { dataRowToChangesArray } from "../../../helpers/data.mjs";
@@ -246,11 +245,17 @@ export class MultipleSelectUI extends BaseUI {
246
245
  beforeOnCellMouseUp: () => {
247
246
  _classPrivateFieldGet(_itemsBox, this).listen();
248
247
  },
248
+ modifyColWidth: width => {
249
+ const minWidth = _classPrivateFieldGet(_itemsBox, this).container.scrollWidth - getScrollbarWidth(rootDocument);
250
+ if (width !== undefined && width < minWidth) {
251
+ return minWidth;
252
+ }
253
+ return width;
254
+ },
255
+ hiddenRows: true,
249
256
  maxCols: 1,
250
257
  autoWrapCol: true,
251
258
  height: 110,
252
- // Workaround for #151.
253
- colWidths: () => _classPrivateFieldGet(_itemsBox, this).container.scrollWidth - getScrollbarWidth(rootDocument),
254
259
  copyPaste: false,
255
260
  disableVisualSelection: 'area',
256
261
  fillHandle: false,
@@ -336,13 +341,16 @@ export class MultipleSelectUI extends BaseUI {
336
341
  }
337
342
  function _onInput(event) {
338
343
  const value = event.target.value.toLocaleLowerCase(this.getLocale());
339
- let filteredItems;
340
- if (value === '') {
341
- filteredItems = [..._classPrivateFieldGet(_items, this)];
342
- } else {
343
- filteredItems = arrayFilter(_classPrivateFieldGet(_items, this), item => `${item.value}`.toLocaleLowerCase(this.getLocale()).indexOf(value) >= 0);
344
- }
345
- _classPrivateFieldGet(_itemsBox, this).loadData(filteredItems);
344
+ const hiddenRows = _classPrivateFieldGet(_itemsBox, this).getPlugin('hiddenRows');
345
+ hiddenRows.showRows(hiddenRows.getHiddenRows());
346
+ _classPrivateFieldGet(_items, this).forEach((item, index) => {
347
+ item.checked = `${item.value}`.toLocaleLowerCase(this.getLocale()).indexOf(value) >= 0;
348
+ if (!item.checked) {
349
+ hiddenRows.hideRow(index);
350
+ }
351
+ });
352
+ _classPrivateFieldGet(_itemsBox, this).view.adjustElementsSize();
353
+ _classPrivateFieldGet(_itemsBox, this).render();
346
354
  }
347
355
  /**
348
356
  * 'keydown' event listener for input element.
@@ -367,7 +375,7 @@ function _onInputKeyDown(event) {
367
375
  function _onSelectAllClick(event) {
368
376
  const changes = [];
369
377
  event.preventDefault();
370
- arrayEach(_classPrivateFieldGet(_itemsBox, this).getSourceData(), (row, rowIndex) => {
378
+ _classPrivateFieldGet(_itemsBox, this).getSourceData().forEach((row, rowIndex) => {
371
379
  row.checked = true;
372
380
  changes.push(dataRowToChangesArray(row, rowIndex)[0]);
373
381
  });
@@ -381,7 +389,7 @@ function _onSelectAllClick(event) {
381
389
  function _onClearAllClick(event) {
382
390
  const changes = [];
383
391
  event.preventDefault();
384
- arrayEach(_classPrivateFieldGet(_itemsBox, this).getSourceData(), (row, rowIndex) => {
392
+ _classPrivateFieldGet(_itemsBox, this).getSourceData().forEach((row, rowIndex) => {
385
393
  row.checked = false;
386
394
  changes.push(dataRowToChangesArray(row, rowIndex)[0]);
387
395
  });
@@ -398,7 +406,7 @@ export default MultipleSelectUI;
398
406
  */
399
407
  function valueToItems(availableItems, selectedValue) {
400
408
  const arrayAssertion = createArrayAssertion(selectedValue);
401
- return arrayMap(availableItems, item => {
409
+ return availableItems.map(item => {
402
410
  item.checked = arrayAssertion(item.value);
403
411
  return item;
404
412
  });
@@ -412,7 +420,7 @@ function valueToItems(availableItems, selectedValue) {
412
420
  */
413
421
  function itemsToValue(availableItems) {
414
422
  const items = [];
415
- arrayEach(availableItems, item => {
423
+ availableItems.forEach(item => {
416
424
  if (item.checked) {
417
425
  items.push(item.value);
418
426
  }
@@ -8,6 +8,13 @@ exports.toEmptyString = toEmptyString;
8
8
  exports.toVisualValue = toVisualValue;
9
9
  exports.unifyColumnValues = unifyColumnValues;
10
10
  require("core-js/modules/es.array.push.js");
11
+ require("core-js/modules/esnext.set.difference.v2.js");
12
+ require("core-js/modules/esnext.set.intersection.v2.js");
13
+ require("core-js/modules/esnext.set.is-disjoint-from.v2.js");
14
+ require("core-js/modules/esnext.set.is-subset-of.v2.js");
15
+ require("core-js/modules/esnext.set.is-superset-of.v2.js");
16
+ require("core-js/modules/esnext.set.symmetric-difference.v2.js");
17
+ require("core-js/modules/esnext.set.union.v2.js");
11
18
  var _feature = require("../../helpers/feature");
12
19
  var _array = require("../../helpers/array");
13
20
  const sortCompare = (0, _feature.getComparisonFunction)();
@@ -1,4 +1,11 @@
1
1
  import "core-js/modules/es.array.push.js";
2
+ import "core-js/modules/esnext.set.difference.v2.js";
3
+ import "core-js/modules/esnext.set.intersection.v2.js";
4
+ import "core-js/modules/esnext.set.is-disjoint-from.v2.js";
5
+ import "core-js/modules/esnext.set.is-subset-of.v2.js";
6
+ import "core-js/modules/esnext.set.is-superset-of.v2.js";
7
+ import "core-js/modules/esnext.set.symmetric-difference.v2.js";
8
+ import "core-js/modules/esnext.set.union.v2.js";
2
9
  import { getComparisonFunction } from "../../helpers/feature.mjs";
3
10
  import { arrayUnique, arrayEach } from "../../helpers/array.mjs";
4
11
  const sortCompare = getComparisonFunction();
@@ -2,17 +2,27 @@ import {
2
2
  CellType as HyperFormulaCellType,
3
3
  ConfigParams,
4
4
  HyperFormula,
5
+ RawCellContent,
6
+ NamedExpressionOptions,
5
7
  } from 'hyperformula';
6
8
  import Core from '../../core';
7
9
  import { CellValue } from '../../common';
8
10
  import { BasePlugin } from '../base';
9
11
 
12
+ type NamedExpressions = {
13
+ name: string;
14
+ expression: RawCellContent;
15
+ scope?: number;
16
+ options?: NamedExpressionOptions;
17
+ }
18
+
10
19
  export interface HyperFormulaSettings extends Partial<ConfigParams> {
11
20
  hyperformula: typeof HyperFormula | HyperFormula;
12
21
  }
13
22
  export interface DetailedSettings {
14
23
  engine: typeof HyperFormula | HyperFormula | HyperFormulaSettings;
15
24
  sheetName?: string;
25
+ namedExpressions?: NamedExpressions[],
16
26
  }
17
27
 
18
28
  export type Settings = DetailedSettings;
@@ -4,6 +4,13 @@ exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  require("core-js/modules/es.array.push.js");
6
6
  require("core-js/modules/es.json.stringify.js");
7
+ require("core-js/modules/esnext.set.difference.v2.js");
8
+ require("core-js/modules/esnext.set.intersection.v2.js");
9
+ require("core-js/modules/esnext.set.is-disjoint-from.v2.js");
10
+ require("core-js/modules/esnext.set.is-subset-of.v2.js");
11
+ require("core-js/modules/esnext.set.is-superset-of.v2.js");
12
+ require("core-js/modules/esnext.set.symmetric-difference.v2.js");
13
+ require("core-js/modules/esnext.set.union.v2.js");
7
14
  var _base = require("../base");
8
15
  var _staticRegister = _interopRequireDefault(require("../../utils/staticRegister"));
9
16
  var _console = require("../../helpers/console");
@@ -1127,7 +1134,8 @@ function _onAfterRemoveRow(row, amount, physicalRows, source) {
1127
1134
  if (isBlockedSource(source)) {
1128
1135
  return;
1129
1136
  }
1130
- const descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
1137
+ const descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort((a, b) => b - a); // sort numeric values descending
1138
+
1131
1139
  const changes = this.engine.batch(() => {
1132
1140
  descendingHfRows.forEach(hfRow => {
1133
1141
  this.engine.removeRows(this.sheetId, [hfRow, 1]);
@@ -1148,7 +1156,8 @@ function _onAfterRemoveCol(col, amount, physicalColumns, source) {
1148
1156
  if (isBlockedSource(source)) {
1149
1157
  return;
1150
1158
  }
1151
- const descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
1159
+ const descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort((a, b) => b - a); // sort numeric values descending
1160
+
1152
1161
  const changes = this.engine.batch(() => {
1153
1162
  descendingHfColumns.forEach(hfColumn => {
1154
1163
  this.engine.removeColumns(this.sheetId, [hfColumn, 1]);
@@ -1,6 +1,13 @@
1
1
  import "core-js/modules/es.error.cause.js";
2
2
  import "core-js/modules/es.array.push.js";
3
3
  import "core-js/modules/es.json.stringify.js";
4
+ import "core-js/modules/esnext.set.difference.v2.js";
5
+ import "core-js/modules/esnext.set.intersection.v2.js";
6
+ import "core-js/modules/esnext.set.is-disjoint-from.v2.js";
7
+ import "core-js/modules/esnext.set.is-subset-of.v2.js";
8
+ import "core-js/modules/esnext.set.is-superset-of.v2.js";
9
+ import "core-js/modules/esnext.set.symmetric-difference.v2.js";
10
+ import "core-js/modules/esnext.set.union.v2.js";
4
11
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
5
12
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
13
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
@@ -1122,7 +1129,8 @@ function _onAfterRemoveRow(row, amount, physicalRows, source) {
1122
1129
  if (isBlockedSource(source)) {
1123
1130
  return;
1124
1131
  }
1125
- const descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort().reverse();
1132
+ const descendingHfRows = this.rowAxisSyncer.getRemovedHfIndexes().sort((a, b) => b - a); // sort numeric values descending
1133
+
1126
1134
  const changes = this.engine.batch(() => {
1127
1135
  descendingHfRows.forEach(hfRow => {
1128
1136
  this.engine.removeRows(this.sheetId, [hfRow, 1]);
@@ -1143,7 +1151,8 @@ function _onAfterRemoveCol(col, amount, physicalColumns, source) {
1143
1151
  if (isBlockedSource(source)) {
1144
1152
  return;
1145
1153
  }
1146
- const descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort().reverse();
1154
+ const descendingHfColumns = this.columnAxisSyncer.getRemovedHfIndexes().sort((a, b) => b - a); // sort numeric values descending
1155
+
1147
1156
  const changes = this.engine.batch(() => {
1148
1157
  descendingHfColumns.forEach(hfColumn => {
1149
1158
  this.engine.removeColumns(this.sheetId, [hfColumn, 1]);
@@ -44,7 +44,7 @@ function hideColumnItem(hiddenColumnsPlugin) {
44
44
  this.deselectCell();
45
45
  }
46
46
  this.render();
47
- this.view.adjustElementsSize(true);
47
+ this.view.adjustElementsSize();
48
48
  },
49
49
  disabled: false,
50
50
  hidden() {
@@ -38,7 +38,7 @@ export default function hideColumnItem(hiddenColumnsPlugin) {
38
38
  this.deselectCell();
39
39
  }
40
40
  this.render();
41
- this.view.adjustElementsSize(true);
41
+ this.view.adjustElementsSize();
42
42
  },
43
43
  disabled: false,
44
44
  hidden() {
@@ -36,7 +36,7 @@ function showColumnItem(hiddenColumnsPlugin) {
36
36
  // We render columns at first. It was needed for getting fixed columns.
37
37
  // Please take a look at #6864 for broader description.
38
38
  this.render();
39
- this.view.adjustElementsSize(true);
39
+ this.view.adjustElementsSize();
40
40
  const allColumnsSelected = endVisualColumn - startVisualColumn + 1 === this.countCols();
41
41
 
42
42
  // When all headers needs to be selected then do nothing. The header selection is
@@ -30,7 +30,7 @@ export default function showColumnItem(hiddenColumnsPlugin) {
30
30
  // We render columns at first. It was needed for getting fixed columns.
31
31
  // Please take a look at #6864 for broader description.
32
32
  this.render();
33
- this.view.adjustElementsSize(true);
33
+ this.view.adjustElementsSize();
34
34
  const allColumnsSelected = endVisualColumn - startVisualColumn + 1 === this.countCols();
35
35
 
36
36
  // When all headers needs to be selected then do nothing. The header selection is
@@ -3,6 +3,13 @@
3
3
  exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  require("core-js/modules/es.array.push.js");
6
+ require("core-js/modules/esnext.set.difference.v2.js");
7
+ require("core-js/modules/esnext.set.intersection.v2.js");
8
+ require("core-js/modules/esnext.set.is-disjoint-from.v2.js");
9
+ require("core-js/modules/esnext.set.is-subset-of.v2.js");
10
+ require("core-js/modules/esnext.set.is-superset-of.v2.js");
11
+ require("core-js/modules/esnext.set.symmetric-difference.v2.js");
12
+ require("core-js/modules/esnext.set.union.v2.js");
6
13
  var _base = require("../base");
7
14
  var _element = require("../../helpers/dom/element");
8
15
  var _number = require("../../helpers/number");
@@ -204,7 +211,7 @@ class HiddenColumns extends _base.BasePlugin {
204
211
  return _assertClassBrand(_HiddenColumns_brand, _this, _onAfterContextMenuDefaultOptions).call(_this, ...args);
205
212
  });
206
213
  this.addHook('afterGetCellMeta', (row, col, cellProperties) => _assertClassBrand(_HiddenColumns_brand, this, _onAfterGetCellMeta).call(this, row, col, cellProperties));
207
- this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_HiddenColumns_brand, this, _onModifyColWidth).call(this, width, col));
214
+ this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_HiddenColumns_brand, this, _onModifyColWidth).call(this, width, col), 2);
208
215
  this.addHook('afterGetColHeader', function () {
209
216
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
210
217
  args[_key2] = arguments[_key2];
@@ -1,5 +1,12 @@
1
1
  import "core-js/modules/es.error.cause.js";
2
2
  import "core-js/modules/es.array.push.js";
3
+ import "core-js/modules/esnext.set.difference.v2.js";
4
+ import "core-js/modules/esnext.set.intersection.v2.js";
5
+ import "core-js/modules/esnext.set.is-disjoint-from.v2.js";
6
+ import "core-js/modules/esnext.set.is-subset-of.v2.js";
7
+ import "core-js/modules/esnext.set.is-superset-of.v2.js";
8
+ import "core-js/modules/esnext.set.symmetric-difference.v2.js";
9
+ import "core-js/modules/esnext.set.union.v2.js";
3
10
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
4
11
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
5
12
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
@@ -200,7 +207,7 @@ export class HiddenColumns extends BasePlugin {
200
207
  return _assertClassBrand(_HiddenColumns_brand, _this, _onAfterContextMenuDefaultOptions).call(_this, ...args);
201
208
  });
202
209
  this.addHook('afterGetCellMeta', (row, col, cellProperties) => _assertClassBrand(_HiddenColumns_brand, this, _onAfterGetCellMeta).call(this, row, col, cellProperties));
203
- this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_HiddenColumns_brand, this, _onModifyColWidth).call(this, width, col));
210
+ this.addHook('modifyColWidth', (width, col) => _assertClassBrand(_HiddenColumns_brand, this, _onModifyColWidth).call(this, width, col), 2);
204
211
  this.addHook('afterGetColHeader', function () {
205
212
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
206
213
  args[_key2] = arguments[_key2];
@@ -44,7 +44,7 @@ function hideRowItem(hiddenRowsPlugin) {
44
44
  this.deselectCell();
45
45
  }
46
46
  this.render();
47
- this.view.adjustElementsSize(true);
47
+ this.view.adjustElementsSize();
48
48
  },
49
49
  disabled: false,
50
50
  hidden() {
@@ -38,7 +38,7 @@ export default function hideRowItem(hiddenRowsPlugin) {
38
38
  this.deselectCell();
39
39
  }
40
40
  this.render();
41
- this.view.adjustElementsSize(true);
41
+ this.view.adjustElementsSize();
42
42
  },
43
43
  disabled: false,
44
44
  hidden() {
@@ -36,7 +36,7 @@ function showRowItem(hiddenRowsPlugin) {
36
36
  // We render rows at first. It was needed for getting fixed rows.
37
37
  // Please take a look at #6864 for broader description.
38
38
  this.render();
39
- this.view.adjustElementsSize(true);
39
+ this.view.adjustElementsSize();
40
40
  const allRowsSelected = endVisualRow - startVisualRow + 1 === this.countRows();
41
41
 
42
42
  // When all headers needs to be selected then do nothing. The header selection is
@@ -30,7 +30,7 @@ export default function showRowItem(hiddenRowsPlugin) {
30
30
  // We render rows at first. It was needed for getting fixed rows.
31
31
  // Please take a look at #6864 for broader description.
32
32
  this.render();
33
- this.view.adjustElementsSize(true);
33
+ this.view.adjustElementsSize();
34
34
  const allRowsSelected = endVisualRow - startVisualRow + 1 === this.countRows();
35
35
 
36
36
  // When all headers needs to be selected then do nothing. The header selection is
@@ -3,6 +3,13 @@
3
3
  exports.__esModule = true;
4
4
  require("core-js/modules/es.error.cause.js");
5
5
  require("core-js/modules/es.array.push.js");
6
+ require("core-js/modules/esnext.set.difference.v2.js");
7
+ require("core-js/modules/esnext.set.intersection.v2.js");
8
+ require("core-js/modules/esnext.set.is-disjoint-from.v2.js");
9
+ require("core-js/modules/esnext.set.is-subset-of.v2.js");
10
+ require("core-js/modules/esnext.set.is-superset-of.v2.js");
11
+ require("core-js/modules/esnext.set.symmetric-difference.v2.js");
12
+ require("core-js/modules/esnext.set.union.v2.js");
6
13
  var _base = require("../base");
7
14
  var _element = require("../../helpers/dom/element");
8
15
  var _number = require("../../helpers/number");
@@ -1,5 +1,12 @@
1
1
  import "core-js/modules/es.error.cause.js";
2
2
  import "core-js/modules/es.array.push.js";
3
+ import "core-js/modules/esnext.set.difference.v2.js";
4
+ import "core-js/modules/esnext.set.intersection.v2.js";
5
+ import "core-js/modules/esnext.set.is-disjoint-from.v2.js";
6
+ import "core-js/modules/esnext.set.is-subset-of.v2.js";
7
+ import "core-js/modules/esnext.set.is-superset-of.v2.js";
8
+ import "core-js/modules/esnext.set.symmetric-difference.v2.js";
9
+ import "core-js/modules/esnext.set.union.v2.js";
3
10
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
4
11
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
5
12
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
@@ -23,7 +23,7 @@ function freezeColumnItem(manualColumnFreezePlugin) {
23
23
  }] = selected;
24
24
  manualColumnFreezePlugin.freezeColumn(selectedColumn);
25
25
  this.render();
26
- this.view.adjustElementsSize(true);
26
+ this.view.adjustElementsSize();
27
27
  },
28
28
  hidden() {
29
29
  const selection = this.getSelectedRange();
@@ -17,7 +17,7 @@ export default function freezeColumnItem(manualColumnFreezePlugin) {
17
17
  }] = selected;
18
18
  manualColumnFreezePlugin.freezeColumn(selectedColumn);
19
19
  this.render();
20
- this.view.adjustElementsSize(true);
20
+ this.view.adjustElementsSize();
21
21
  },
22
22
  hidden() {
23
23
  const selection = this.getSelectedRange();
@@ -23,7 +23,7 @@ function unfreezeColumnItem(manualColumnFreezePlugin) {
23
23
  }] = selected;
24
24
  manualColumnFreezePlugin.unfreezeColumn(selectedColumn);
25
25
  this.render();
26
- this.view.adjustElementsSize(true);
26
+ this.view.adjustElementsSize();
27
27
  },
28
28
  hidden() {
29
29
  const selection = this.getSelectedRange();
@@ -17,7 +17,7 @@ export default function unfreezeColumnItem(manualColumnFreezePlugin) {
17
17
  }] = selected;
18
18
  manualColumnFreezePlugin.unfreezeColumn(selectedColumn);
19
19
  this.render();
20
- this.view.adjustElementsSize(true);
20
+ this.view.adjustElementsSize();
21
21
  },
22
22
  hidden() {
23
23
  const selection = this.getSelectedRange();
@@ -655,7 +655,7 @@ function _onMouseUp() {
655
655
  if (movePerformed === true) {
656
656
  this.persistentStateSave();
657
657
  this.hot.render();
658
- this.hot.view.adjustElementsSize(true);
658
+ this.hot.view.adjustElementsSize();
659
659
  const selectionStart = this.hot.toVisualColumn(firstMovedPhysicalColumn);
660
660
  const selectionEnd = selectionStart + columnsLen - 1;
661
661
  this.hot.selectColumns(selectionStart, selectionEnd);