handsontable 0.0.0-next-9891faa-20240822 → 0.0.0-next-0306a1a-20240826

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 (97) hide show
  1. package/3rdparty/walkontable/src/calculator/constants.js +26 -0
  2. package/3rdparty/walkontable/src/calculator/constants.mjs +23 -0
  3. package/3rdparty/walkontable/src/calculator/index.js +17 -18
  4. package/3rdparty/walkontable/src/calculator/index.mjs +6 -11
  5. package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllColumns.js → renderAllColumns.js} +9 -32
  6. package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllColumns.mjs → renderAllColumns.mjs} +8 -31
  7. package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllRows.js → renderAllRows.js} +9 -32
  8. package/3rdparty/walkontable/src/calculator/{calculationType/renderedAllRows.mjs → renderAllRows.mjs} +8 -31
  9. package/3rdparty/walkontable/src/calculator/viewportColumns.js +145 -51
  10. package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +145 -51
  11. package/3rdparty/walkontable/src/calculator/viewportRows.js +141 -59
  12. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +141 -59
  13. package/3rdparty/walkontable/src/index.js +0 -2
  14. package/3rdparty/walkontable/src/index.mjs +2 -2
  15. package/3rdparty/walkontable/src/table.js +11 -5
  16. package/3rdparty/walkontable/src/table.mjs +11 -5
  17. package/3rdparty/walkontable/src/utils/column.js +1 -2
  18. package/3rdparty/walkontable/src/utils/column.mjs +1 -2
  19. package/3rdparty/walkontable/src/utils/columnStretching.js +19 -10
  20. package/3rdparty/walkontable/src/utils/columnStretching.mjs +19 -10
  21. package/3rdparty/walkontable/src/viewport.js +46 -35
  22. package/3rdparty/walkontable/src/viewport.mjs +47 -36
  23. package/CHANGELOG.md +0 -27
  24. package/base.js +2 -2
  25. package/base.mjs +2 -2
  26. package/core.d.ts +2 -1
  27. package/core.js +1 -1
  28. package/core.mjs +2 -2
  29. package/dataMap/metaManager/metaSchema.js +6 -5
  30. package/dataMap/metaManager/metaSchema.mjs +6 -5
  31. package/dist/handsontable.css +20 -32
  32. package/dist/handsontable.full.css +20 -32
  33. package/dist/handsontable.full.js +2085 -2703
  34. package/dist/handsontable.full.min.css +5 -5
  35. package/dist/handsontable.full.min.js +148 -148
  36. package/dist/handsontable.js +2086 -2704
  37. package/dist/handsontable.min.css +4 -4
  38. package/dist/handsontable.min.js +14 -14
  39. package/editors/autocompleteEditor/autocompleteEditor.d.ts +1 -1
  40. package/helpers/a11y.js +0 -2
  41. package/helpers/a11y.mjs +0 -1
  42. package/helpers/mixed.js +2 -2
  43. package/helpers/mixed.mjs +2 -2
  44. package/package.json +1 -1
  45. package/pluginHooks.js +1 -0
  46. package/pluginHooks.mjs +1 -0
  47. package/plugins/autoColumnSize/autoColumnSize.js +1 -1
  48. package/plugins/autoColumnSize/autoColumnSize.mjs +2 -2
  49. package/plugins/autoRowSize/autoRowSize.js +2 -1
  50. package/plugins/autoRowSize/autoRowSize.mjs +2 -1
  51. package/plugins/columnSorting/columnSorting.js +1 -10
  52. package/plugins/columnSorting/columnSorting.mjs +1 -10
  53. package/plugins/contextMenu/menu/menuItemRenderer.js +4 -3
  54. package/plugins/contextMenu/menu/menuItemRenderer.mjs +6 -5
  55. package/plugins/contextMenu/menu/positioner.js +12 -4
  56. package/plugins/contextMenu/menu/positioner.mjs +12 -4
  57. package/plugins/contextMenu/menu/utils.js +0 -11
  58. package/plugins/contextMenu/menu/utils.mjs +0 -10
  59. package/plugins/contextMenu/predefinedItems/alignment.js +49 -67
  60. package/plugins/contextMenu/predefinedItems/alignment.mjs +50 -68
  61. package/plugins/contextMenu/predefinedItems/readOnly.js +0 -11
  62. package/plugins/contextMenu/predefinedItems/readOnly.mjs +0 -11
  63. package/plugins/contextMenu/utils.js +0 -26
  64. package/plugins/contextMenu/utils.mjs +0 -24
  65. package/plugins/copyPaste/copyPaste.js +14 -14
  66. package/plugins/copyPaste/copyPaste.mjs +14 -14
  67. package/plugins/dropdownMenu/dropdownMenu.js +4 -10
  68. package/plugins/dropdownMenu/dropdownMenu.mjs +4 -10
  69. package/plugins/filters/component/condition.js +1 -6
  70. package/plugins/filters/component/condition.mjs +1 -6
  71. package/plugins/filters/component/value.js +1 -6
  72. package/plugins/filters/component/value.mjs +1 -6
  73. package/plugins/filters/conditionCollection.d.ts +3 -4
  74. package/plugins/filters/ui/multipleSelect.js +9 -7
  75. package/plugins/filters/ui/multipleSelect.mjs +9 -7
  76. package/plugins/manualRowResize/manualRowResize.js +1 -1
  77. package/plugins/manualRowResize/manualRowResize.mjs +2 -2
  78. package/plugins/mergeCells/cellsCollection.js +9 -11
  79. package/plugins/mergeCells/cellsCollection.mjs +10 -12
  80. package/shortcuts/utils.js +1 -3
  81. package/shortcuts/utils.mjs +1 -3
  82. package/utils/ghostTable.js +9 -11
  83. package/utils/ghostTable.mjs +10 -12
  84. package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.js +0 -126
  85. package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleColumns.mjs +0 -122
  86. package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.js +0 -119
  87. package/3rdparty/walkontable/src/calculator/calculationType/fullyVisibleRows.mjs +0 -115
  88. package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.js +0 -125
  89. package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleColumns.mjs +0 -121
  90. package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.js +0 -118
  91. package/3rdparty/walkontable/src/calculator/calculationType/partiallyVisibleRows.mjs +0 -114
  92. package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.js +0 -37
  93. package/3rdparty/walkontable/src/calculator/calculationType/renderedColumns.mjs +0 -33
  94. package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.js +0 -37
  95. package/3rdparty/walkontable/src/calculator/calculationType/renderedRows.mjs +0 -33
  96. package/3rdparty/walkontable/src/calculator/viewportBase.js +0 -92
  97. package/3rdparty/walkontable/src/calculator/viewportBase.mjs +0 -88
@@ -1,19 +1,8 @@
1
- import { align, getAlignmentClasses, markLabelAsSelected, hasSelectionAClass } from "../utils.mjs";
1
+ import { align, getAlignmentClasses, checkSelectionConsistency, markLabelAsSelected } from "../utils.mjs";
2
2
  import { KEY as SEPARATOR } from "./separator.mjs";
3
3
  import * as C from "../../../i18n/constants.mjs";
4
4
  export const KEY = 'alignment';
5
5
 
6
- /**
7
- * @param {object} hot The current Handsontable instance.
8
- * @param {string} rawName The raw name of the menu item.
9
- * @param {string} htClassName The class name to check.
10
- * @returns {string} The value of aria-label parameter.
11
- */
12
- function ariaLabel(hot, rawName, htClassName) {
13
- const checkboxState = hasSelectionAClass(hot, htClassName) ? hot.getTranslatedPhrase(C.CHECKBOX_CHECKED) : hot.getTranslatedPhrase(C.CHECKBOX_UNCHECKED);
14
- return `${rawName} ${checkboxState.toLowerCase()}`;
15
- }
16
-
17
6
  /**
18
7
  * @returns {object}
19
8
  */
@@ -39,16 +28,15 @@ export default function alignmentItem() {
39
28
  submenu: {
40
29
  items: [{
41
30
  key: `${KEY}:left`,
42
- checkable: true,
43
- ariaLabel() {
44
- return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT), 'htLeft');
45
- },
46
- ariaChecked() {
47
- return hasSelectionAClass(this, 'htLeft');
48
- },
49
31
  name() {
50
32
  let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_LEFT);
51
- if (hasSelectionAClass(this, 'htLeft')) {
33
+ const hasClass = checkSelectionConsistency(this.getSelectedRange(), (row, col) => {
34
+ const className = this.getCellMeta(row, col).className;
35
+ if (className && className.indexOf('htLeft') !== -1) {
36
+ return true;
37
+ }
38
+ });
39
+ if (hasClass) {
52
40
  label = markLabelAsSelected(label);
53
41
  }
54
42
  return label;
@@ -65,16 +53,15 @@ export default function alignmentItem() {
65
53
  disabled: false
66
54
  }, {
67
55
  key: `${KEY}:center`,
68
- checkable: true,
69
- ariaLabel() {
70
- return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER), 'htCenter');
71
- },
72
- ariaChecked() {
73
- return hasSelectionAClass(this, 'htCenter');
74
- },
75
56
  name() {
76
57
  let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_CENTER);
77
- if (hasSelectionAClass(this, 'htCenter')) {
58
+ const hasClass = checkSelectionConsistency(this.getSelectedRange(), (row, col) => {
59
+ const className = this.getCellMeta(row, col).className;
60
+ if (className && className.indexOf('htCenter') !== -1) {
61
+ return true;
62
+ }
63
+ });
64
+ if (hasClass) {
78
65
  label = markLabelAsSelected(label);
79
66
  }
80
67
  return label;
@@ -91,16 +78,15 @@ export default function alignmentItem() {
91
78
  disabled: false
92
79
  }, {
93
80
  key: `${KEY}:right`,
94
- checkable: true,
95
- ariaLabel() {
96
- return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT), 'htRight');
97
- },
98
- ariaChecked() {
99
- return hasSelectionAClass(this, 'htRight');
100
- },
101
81
  name() {
102
82
  let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_RIGHT);
103
- if (hasSelectionAClass(this, 'htRight')) {
83
+ const hasClass = checkSelectionConsistency(this.getSelectedRange(), (row, col) => {
84
+ const className = this.getCellMeta(row, col).className;
85
+ if (className && className.indexOf('htRight') !== -1) {
86
+ return true;
87
+ }
88
+ });
89
+ if (hasClass) {
104
90
  label = markLabelAsSelected(label);
105
91
  }
106
92
  return label;
@@ -117,16 +103,15 @@ export default function alignmentItem() {
117
103
  disabled: false
118
104
  }, {
119
105
  key: `${KEY}:justify`,
120
- checkable: true,
121
- ariaLabel() {
122
- return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY), 'htJustify');
123
- },
124
- ariaChecked() {
125
- return hasSelectionAClass(this, 'htJustify');
126
- },
127
106
  name() {
128
107
  let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_JUSTIFY);
129
- if (hasSelectionAClass(this, 'htJustify')) {
108
+ const hasClass = checkSelectionConsistency(this.getSelectedRange(), (row, col) => {
109
+ const className = this.getCellMeta(row, col).className;
110
+ if (className && className.indexOf('htJustify') !== -1) {
111
+ return true;
112
+ }
113
+ });
114
+ if (hasClass) {
130
115
  label = markLabelAsSelected(label);
131
116
  }
132
117
  return label;
@@ -145,16 +130,15 @@ export default function alignmentItem() {
145
130
  name: SEPARATOR
146
131
  }, {
147
132
  key: `${KEY}:top`,
148
- checkable: true,
149
- ariaLabel() {
150
- return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_TOP), 'htTop');
151
- },
152
- ariaChecked() {
153
- return hasSelectionAClass(this, 'htTop');
154
- },
155
133
  name() {
156
134
  let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_TOP);
157
- if (hasSelectionAClass(this, 'htTop')) {
135
+ const hasClass = checkSelectionConsistency(this.getSelectedRange(), (row, col) => {
136
+ const className = this.getCellMeta(row, col).className;
137
+ if (className && className.indexOf('htTop') !== -1) {
138
+ return true;
139
+ }
140
+ });
141
+ if (hasClass) {
158
142
  label = markLabelAsSelected(label);
159
143
  }
160
144
  return label;
@@ -171,16 +155,15 @@ export default function alignmentItem() {
171
155
  disabled: false
172
156
  }, {
173
157
  key: `${KEY}:middle`,
174
- checkable: true,
175
- ariaLabel() {
176
- return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE), 'htMiddle');
177
- },
178
- ariaChecked() {
179
- return hasSelectionAClass(this, 'htMiddle');
180
- },
181
158
  name() {
182
159
  let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_MIDDLE);
183
- if (hasSelectionAClass(this, 'htMiddle')) {
160
+ const hasClass = checkSelectionConsistency(this.getSelectedRange(), (row, col) => {
161
+ const className = this.getCellMeta(row, col).className;
162
+ if (className && className.indexOf('htMiddle') !== -1) {
163
+ return true;
164
+ }
165
+ });
166
+ if (hasClass) {
184
167
  label = markLabelAsSelected(label);
185
168
  }
186
169
  return label;
@@ -197,16 +180,15 @@ export default function alignmentItem() {
197
180
  disabled: false
198
181
  }, {
199
182
  key: `${KEY}:bottom`,
200
- checkable: true,
201
- ariaLabel() {
202
- return ariaLabel(this, this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM), 'htBottom');
203
- },
204
- ariaChecked() {
205
- return hasSelectionAClass(this, 'htBottom');
206
- },
207
183
  name() {
208
184
  let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ALIGNMENT_BOTTOM);
209
- if (hasSelectionAClass(this, 'htBottom')) {
185
+ const hasClass = checkSelectionConsistency(this.getSelectedRange(), (row, col) => {
186
+ const className = this.getCellMeta(row, col).className;
187
+ if (className && className.indexOf('htBottom') !== -1) {
188
+ return true;
189
+ }
190
+ });
191
+ if (hasClass) {
210
192
  label = markLabelAsSelected(label);
211
193
  }
212
194
  return label;
@@ -15,17 +15,6 @@ const KEY = exports.KEY = 'make_read_only';
15
15
  function readOnlyItem() {
16
16
  return {
17
17
  key: KEY,
18
- checkable: true,
19
- ariaChecked() {
20
- const atLeastOneReadOnly = (0, _utils.checkSelectionConsistency)(this.getSelectedRange(), (row, col) => this.getCellMeta(row, col).readOnly);
21
- return atLeastOneReadOnly;
22
- },
23
- ariaLabel() {
24
- const rawName = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_READ_ONLY);
25
- const atLeastOneReadOnly = (0, _utils.checkSelectionConsistency)(this.getSelectedRange(), (row, col) => this.getCellMeta(row, col).readOnly);
26
- const checkboxState = atLeastOneReadOnly ? this.getTranslatedPhrase(C.CHECKBOX_CHECKED) : this.getTranslatedPhrase(C.CHECKBOX_UNCHECKED);
27
- return `${rawName} ${checkboxState.toLowerCase()}`;
28
- },
29
18
  name() {
30
19
  let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_READ_ONLY);
31
20
  const atLeastOneReadOnly = (0, _utils.checkSelectionConsistency)(this.getSelectedRange(), (row, col) => this.getCellMeta(row, col).readOnly);
@@ -9,17 +9,6 @@ export const KEY = 'make_read_only';
9
9
  export default function readOnlyItem() {
10
10
  return {
11
11
  key: KEY,
12
- checkable: true,
13
- ariaChecked() {
14
- const atLeastOneReadOnly = checkSelectionConsistency(this.getSelectedRange(), (row, col) => this.getCellMeta(row, col).readOnly);
15
- return atLeastOneReadOnly;
16
- },
17
- ariaLabel() {
18
- const rawName = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_READ_ONLY);
19
- const atLeastOneReadOnly = checkSelectionConsistency(this.getSelectedRange(), (row, col) => this.getCellMeta(row, col).readOnly);
20
- const checkboxState = atLeastOneReadOnly ? this.getTranslatedPhrase(C.CHECKBOX_CHECKED) : this.getTranslatedPhrase(C.CHECKBOX_UNCHECKED);
21
- return `${rawName} ${checkboxState.toLowerCase()}`;
22
- },
23
12
  name() {
24
13
  let label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_READ_ONLY);
25
14
  const atLeastOneReadOnly = checkSelectionConsistency(this.getSelectedRange(), (row, col) => this.getCellMeta(row, col).readOnly);
@@ -4,9 +4,7 @@ exports.__esModule = true;
4
4
  exports.align = align;
5
5
  exports.checkSelectionConsistency = checkSelectionConsistency;
6
6
  exports.getAlignmentClasses = getAlignmentClasses;
7
- exports.getAlignmentComparatorByClass = getAlignmentComparatorByClass;
8
7
  exports.getDocumentOffsetByElement = getDocumentOffsetByElement;
9
- exports.hasSelectionAClass = hasSelectionAClass;
10
8
  exports.markLabelAsSelected = markLabelAsSelected;
11
9
  exports.prepareHorizontalAlignClass = prepareHorizontalAlignClass;
12
10
  exports.prepareVerticalAlignClass = prepareVerticalAlignClass;
@@ -153,28 +151,4 @@ function getDocumentOffsetByElement(elementToCheck, baseDocument) {
153
151
  offset.left = left;
154
152
  }
155
153
  return offset;
156
- }
157
-
158
- /**
159
- * Prepares comparator function consumable by checkSelectionConsistency
160
- * Comparator function checks if the cell has the provided class name.
161
- *
162
- * @param {string} htClassName The class name to check.
163
- * @returns {Function} Returns the comparator function.
164
- * Use with .bind, .call or .apply to pass the Handsontable instance.
165
- */
166
- function getAlignmentComparatorByClass(htClassName) {
167
- return function (row, col) {
168
- const className = this.getCellMeta(row, col).className;
169
- return className && className.indexOf(htClassName) !== -1;
170
- };
171
- }
172
-
173
- /**
174
- * @param {object} hot Handsontable instance.
175
- * @param {string} htClassName The class name to check.
176
- * @returns {boolean} Returns true if at least one cell has the provided class name.
177
- */
178
- function hasSelectionAClass(hot, htClassName) {
179
- return checkSelectionConsistency(hot.getSelectedRange(), getAlignmentComparatorByClass(htClassName).bind(hot));
180
154
  }
@@ -141,28 +141,4 @@ export function getDocumentOffsetByElement(elementToCheck, baseDocument) {
141
141
  offset.left = left;
142
142
  }
143
143
  return offset;
144
- }
145
-
146
- /**
147
- * Prepares comparator function consumable by checkSelectionConsistency
148
- * Comparator function checks if the cell has the provided class name.
149
- *
150
- * @param {string} htClassName The class name to check.
151
- * @returns {Function} Returns the comparator function.
152
- * Use with .bind, .call or .apply to pass the Handsontable instance.
153
- */
154
- export function getAlignmentComparatorByClass(htClassName) {
155
- return function (row, col) {
156
- const className = this.getCellMeta(row, col).className;
157
- return className && className.indexOf(htClassName) !== -1;
158
- };
159
- }
160
-
161
- /**
162
- * @param {object} hot Handsontable instance.
163
- * @param {string} htClassName The class name to check.
164
- * @returns {boolean} Returns true if at least one cell has the provided class name.
165
- */
166
- export function hasSelectionAClass(hot, htClassName) {
167
- return checkSelectionConsistency(hot.getSelectedRange(), getAlignmentComparatorByClass(htClassName).bind(hot));
168
144
  }
@@ -553,13 +553,12 @@ class CopyPaste extends _base.BasePlugin {
553
553
  * @private
554
554
  */
555
555
  onCopy(event) {
556
- var _event$target;
557
- const focusedElement = this.hot.getFocusManager().getRefocusElement();
558
- const isHotInput = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.hasAttribute('data-hot-input');
559
- if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened() || event.target instanceof HTMLElement && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body)) {
556
+ if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened()) {
557
+ return;
558
+ }
559
+ if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
560
560
  return;
561
561
  }
562
- event.preventDefault();
563
562
  this.setCopyableText();
564
563
  _classPrivateFieldSet(_isTriggeredByCopy, this, false);
565
564
  const data = this.getRangedData(this.copyableRanges);
@@ -577,6 +576,7 @@ class CopyPaste extends _base.BasePlugin {
577
576
  this.hot.runHooks('afterCopy', data, this.copyableRanges, copiedHeadersCount);
578
577
  }
579
578
  _classPrivateFieldSet(_copyMode, this, 'cells-only');
579
+ event.preventDefault();
580
580
  }
581
581
 
582
582
  /**
@@ -586,13 +586,12 @@ class CopyPaste extends _base.BasePlugin {
586
586
  * @private
587
587
  */
588
588
  onCut(event) {
589
- var _event$target2;
590
- const focusedElement = this.hot.getFocusManager().getRefocusElement();
591
- const isHotInput = (_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.hasAttribute('data-hot-input');
592
- if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened() || event.target instanceof HTMLElement && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body)) {
589
+ if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened()) {
590
+ return;
591
+ }
592
+ if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
593
593
  return;
594
594
  }
595
- event.preventDefault();
596
595
  this.setCopyableText();
597
596
  _classPrivateFieldSet(_isTriggeredByCut, this, false);
598
597
  const rangedData = this.getRangedData(this.copyableRanges);
@@ -609,6 +608,7 @@ class CopyPaste extends _base.BasePlugin {
609
608
  this.hot.emptySelectedCells('CopyPaste.cut');
610
609
  this.hot.runHooks('afterCut', rangedData, this.copyableRanges);
611
610
  }
611
+ event.preventDefault();
612
612
  }
613
613
 
614
614
  /**
@@ -618,10 +618,10 @@ class CopyPaste extends _base.BasePlugin {
618
618
  * @private
619
619
  */
620
620
  onPaste(event) {
621
- var _event$target3;
622
- const focusedElement = this.hot.getFocusManager().getRefocusElement();
623
- const isHotInput = (_event$target3 = event.target) === null || _event$target3 === void 0 ? void 0 : _event$target3.hasAttribute('data-hot-input');
624
- if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected() || event.target instanceof HTMLElement && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body)) {
621
+ if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected()) {
622
+ return;
623
+ }
624
+ if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
625
625
  return;
626
626
  }
627
627
  event.preventDefault();
@@ -549,13 +549,12 @@ export class CopyPaste extends BasePlugin {
549
549
  * @private
550
550
  */
551
551
  onCopy(event) {
552
- var _event$target;
553
- const focusedElement = this.hot.getFocusManager().getRefocusElement();
554
- const isHotInput = (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.hasAttribute('data-hot-input');
555
- if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened() || event.target instanceof HTMLElement && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body)) {
552
+ if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCopy, this) || this.isEditorOpened()) {
553
+ return;
554
+ }
555
+ if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
556
556
  return;
557
557
  }
558
- event.preventDefault();
559
558
  this.setCopyableText();
560
559
  _classPrivateFieldSet(_isTriggeredByCopy, this, false);
561
560
  const data = this.getRangedData(this.copyableRanges);
@@ -573,6 +572,7 @@ export class CopyPaste extends BasePlugin {
573
572
  this.hot.runHooks('afterCopy', data, this.copyableRanges, copiedHeadersCount);
574
573
  }
575
574
  _classPrivateFieldSet(_copyMode, this, 'cells-only');
575
+ event.preventDefault();
576
576
  }
577
577
 
578
578
  /**
@@ -582,13 +582,12 @@ export class CopyPaste extends BasePlugin {
582
582
  * @private
583
583
  */
584
584
  onCut(event) {
585
- var _event$target2;
586
- const focusedElement = this.hot.getFocusManager().getRefocusElement();
587
- const isHotInput = (_event$target2 = event.target) === null || _event$target2 === void 0 ? void 0 : _event$target2.hasAttribute('data-hot-input');
588
- if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened() || event.target instanceof HTMLElement && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body)) {
585
+ if (!this.hot.isListening() && !_classPrivateFieldGet(_isTriggeredByCut, this) || this.isEditorOpened()) {
586
+ return;
587
+ }
588
+ if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
589
589
  return;
590
590
  }
591
- event.preventDefault();
592
591
  this.setCopyableText();
593
592
  _classPrivateFieldSet(_isTriggeredByCut, this, false);
594
593
  const rangedData = this.getRangedData(this.copyableRanges);
@@ -605,6 +604,7 @@ export class CopyPaste extends BasePlugin {
605
604
  this.hot.emptySelectedCells('CopyPaste.cut');
606
605
  this.hot.runHooks('afterCut', rangedData, this.copyableRanges);
607
606
  }
607
+ event.preventDefault();
608
608
  }
609
609
 
610
610
  /**
@@ -614,10 +614,10 @@ export class CopyPaste extends BasePlugin {
614
614
  * @private
615
615
  */
616
616
  onPaste(event) {
617
- var _event$target3;
618
- const focusedElement = this.hot.getFocusManager().getRefocusElement();
619
- const isHotInput = (_event$target3 = event.target) === null || _event$target3 === void 0 ? void 0 : _event$target3.hasAttribute('data-hot-input');
620
- if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected() || event.target instanceof HTMLElement && (isHotInput && event.target !== focusedElement || !isHotInput && event.target !== this.hot.rootDocument.body)) {
617
+ if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected()) {
618
+ return;
619
+ }
620
+ if (!this.hot.getSettings().outsideClickDeselects && event.target !== this.hot.rootDocument.body) {
621
621
  return;
622
622
  }
623
623
  event.preventDefault();
@@ -260,16 +260,13 @@ class DropdownMenu extends _base.BasePlugin {
260
260
  from
261
261
  } = this.hot.getSelectedRangeLast();
262
262
  const offset = (0, _utils.getDocumentOffsetByElement)(this.menu.container, this.hot.rootDocument);
263
- const target = this.hot.getCell(-1, from.col, true).querySelector(`.${BUTTON_CLASS_NAME}`);
263
+ const target = this.hot.getCell(-1, from.col, true);
264
264
  const rect = target.getBoundingClientRect();
265
265
  this.open({
266
266
  left: rect.left + offset.left,
267
267
  top: rect.top + target.offsetHeight + offset.top
268
268
  }, {
269
- left: rect.width,
270
- right: 0,
271
- above: 0,
272
- below: 3
269
+ left: rect.width
273
270
  });
274
271
  // Make sure the first item is selected (role=menuitem). Otherwise, screen readers
275
272
  // will block the Esc key for the whole menu.
@@ -436,12 +433,9 @@ function _onTableClick(event) {
436
433
  _classPrivateFieldSet(_isButtonClicked, this, false);
437
434
  this.open({
438
435
  left: rect.left + offset.left,
439
- top: rect.top + event.target.offsetHeight + offset.top
436
+ top: rect.top + event.target.offsetHeight + 3 + offset.top
440
437
  }, {
441
- left: rect.width,
442
- right: 0,
443
- above: 0,
444
- below: 3
438
+ left: rect.width
445
439
  });
446
440
  }
447
441
  }
@@ -256,16 +256,13 @@ export class DropdownMenu extends BasePlugin {
256
256
  from
257
257
  } = this.hot.getSelectedRangeLast();
258
258
  const offset = getDocumentOffsetByElement(this.menu.container, this.hot.rootDocument);
259
- const target = this.hot.getCell(-1, from.col, true).querySelector(`.${BUTTON_CLASS_NAME}`);
259
+ const target = this.hot.getCell(-1, from.col, true);
260
260
  const rect = target.getBoundingClientRect();
261
261
  this.open({
262
262
  left: rect.left + offset.left,
263
263
  top: rect.top + target.offsetHeight + offset.top
264
264
  }, {
265
- left: rect.width,
266
- right: 0,
267
- above: 0,
268
- below: 3
265
+ left: rect.width
269
266
  });
270
267
  // Make sure the first item is selected (role=menuitem). Otherwise, screen readers
271
268
  // will block the Esc key for the whole menu.
@@ -431,12 +428,9 @@ function _onTableClick(event) {
431
428
  _classPrivateFieldSet(_isButtonClicked, this, false);
432
429
  this.open({
433
430
  left: rect.left + offset.left,
434
- top: rect.top + event.target.offsetHeight + offset.top
431
+ top: rect.top + event.target.offsetHeight + 3 + offset.top
435
432
  }, {
436
- left: rect.width,
437
- right: 0,
438
- above: 0,
439
- below: 3
433
+ left: rect.width
440
434
  });
441
435
  }
442
436
  }
@@ -191,12 +191,7 @@ class ConditionComponent extends _base.BaseComponent {
191
191
  (0, _element.addClass)(label, 'htFiltersMenuLabel');
192
192
  label.textContent = value;
193
193
  wrapper.appendChild(label);
194
-
195
- // The SelectUI should not extend the menu width (it should adjust to the menu item width only).
196
- // That's why it's skipped from rendering when the GhostTable tries to render it.
197
- if (!wrapper.parentElement.hasAttribute('ghost-table')) {
198
- (0, _array.arrayEach)(this.elements, ui => wrapper.appendChild(ui.element));
199
- }
194
+ (0, _array.arrayEach)(this.elements, ui => wrapper.appendChild(ui.element));
200
195
  return wrapper;
201
196
  }
202
197
  };
@@ -186,12 +186,7 @@ export class ConditionComponent extends BaseComponent {
186
186
  addClass(label, 'htFiltersMenuLabel');
187
187
  label.textContent = value;
188
188
  wrapper.appendChild(label);
189
-
190
- // The SelectUI should not extend the menu width (it should adjust to the menu item width only).
191
- // That's why it's skipped from rendering when the GhostTable tries to render it.
192
- if (!wrapper.parentElement.hasAttribute('ghost-table')) {
193
- arrayEach(this.elements, ui => wrapper.appendChild(ui.element));
194
- }
189
+ arrayEach(this.elements, ui => wrapper.appendChild(ui.element));
195
190
  return wrapper;
196
191
  }
197
192
  };
@@ -177,12 +177,7 @@ class ValueComponent extends _base.BaseComponent {
177
177
  (0, _element.addClass)(label, 'htFiltersMenuLabel');
178
178
  label.textContent = value;
179
179
  wrapper.appendChild(label);
180
-
181
- // The MultipleSelectUI should not extend the menu width (it should adjust to the menu item width only).
182
- // That's why it's skipped from rendering when the GhostTable tries to render it.
183
- if (!wrapper.parentElement.hasAttribute('ghost-table')) {
184
- (0, _array.arrayEach)(this.elements, ui => wrapper.appendChild(ui.element));
185
- }
180
+ (0, _array.arrayEach)(this.elements, ui => wrapper.appendChild(ui.element));
186
181
  return wrapper;
187
182
  }
188
183
  };
@@ -172,12 +172,7 @@ export class ValueComponent extends BaseComponent {
172
172
  addClass(label, 'htFiltersMenuLabel');
173
173
  label.textContent = value;
174
174
  wrapper.appendChild(label);
175
-
176
- // The MultipleSelectUI should not extend the menu width (it should adjust to the menu item width only).
177
- // That's why it's skipped from rendering when the GhostTable tries to render it.
178
- if (!wrapper.parentElement.hasAttribute('ghost-table')) {
179
- arrayEach(this.elements, ui => wrapper.appendChild(ui.element));
180
- }
175
+ arrayEach(this.elements, ui => wrapper.appendChild(ui.element));
181
176
  return wrapper;
182
177
  }
183
178
  };
@@ -5,10 +5,9 @@ import {
5
5
  ColumnConditions,
6
6
  } from './filters';
7
7
 
8
- export type ConditionName = 'begins_with' | 'between' | 'by_value' | 'contains' |
9
- 'date_after' | 'date_before' | 'date_today' | 'date_tomorrow' | 'date_yesterday' |
10
- 'empty' | 'ends_with' | 'eq' | 'gt' | 'gte' | 'lt' | 'lte' |
11
- 'not_between' | 'not_contains' | 'not_empty' | 'neq' | 'none';
8
+ export type ConditionName = 'begins_with' | 'between' | 'by_value' | 'contains' | 'empty' | 'ends_with' |
9
+ 'eq' | 'gt' | 'gte' | 'lt' | 'lte' | 'not_between' | 'not_contains' |
10
+ 'not_empty' | 'neq';
12
11
 
13
12
  export interface Condition {
14
13
  name: ConditionName;
@@ -128,9 +128,10 @@ class MultipleSelectUI extends _base.BaseUI {
128
128
  * @param {Array} items Array of objects with `checked` and `label` property.
129
129
  */
130
130
  setItems(items) {
131
- var _classPrivateFieldGet2;
132
131
  _classPrivateFieldSet(_items, this, items);
133
- (_classPrivateFieldGet2 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.loadData(_classPrivateFieldGet(_items, this));
132
+ if (_classPrivateFieldGet(_itemsBox, this)) {
133
+ _classPrivateFieldGet(_itemsBox, this).loadData(_classPrivateFieldGet(_items, this));
134
+ }
134
135
  }
135
136
 
136
137
  /**
@@ -222,13 +223,13 @@ class MultipleSelectUI extends _base.BaseUI {
222
223
  this._element.appendChild(selectionControl.element);
223
224
  this._element.appendChild(itemsBoxWrapper);
224
225
  const hotInitializer = wrapper => {
225
- var _classPrivateFieldGet3;
226
226
  if (!this._element) {
227
227
  return;
228
228
  }
229
- (_classPrivateFieldGet3 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.destroy();
229
+ if (_classPrivateFieldGet(_itemsBox, this)) {
230
+ _classPrivateFieldGet(_itemsBox, this).destroy();
231
+ }
230
232
  (0, _element.addClass)(wrapper, 'htUIMultipleSelectHot');
231
-
232
233
  // Constructs and initializes a new Handsontable instance
233
234
  _classPrivateFieldSet(_itemsBox, this, new this.hot.constructor(wrapper, {
234
235
  data: _classPrivateFieldGet(_items, this),
@@ -322,8 +323,9 @@ class MultipleSelectUI extends _base.BaseUI {
322
323
  * Destroy instance.
323
324
  */
324
325
  destroy() {
325
- var _classPrivateFieldGet4;
326
- (_classPrivateFieldGet4 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.destroy();
326
+ if (_classPrivateFieldGet(_itemsBox, this)) {
327
+ _classPrivateFieldGet(_itemsBox, this).destroy();
328
+ }
327
329
  _classPrivateFieldGet(_searchInput, this).destroy();
328
330
  _classPrivateFieldGet(_clearAllUI, this).destroy();
329
331
  _classPrivateFieldGet(_selectAllUI, this).destroy();
@@ -123,9 +123,10 @@ export class MultipleSelectUI extends BaseUI {
123
123
  * @param {Array} items Array of objects with `checked` and `label` property.
124
124
  */
125
125
  setItems(items) {
126
- var _classPrivateFieldGet2;
127
126
  _classPrivateFieldSet(_items, this, items);
128
- (_classPrivateFieldGet2 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.loadData(_classPrivateFieldGet(_items, this));
127
+ if (_classPrivateFieldGet(_itemsBox, this)) {
128
+ _classPrivateFieldGet(_itemsBox, this).loadData(_classPrivateFieldGet(_items, this));
129
+ }
129
130
  }
130
131
 
131
132
  /**
@@ -217,13 +218,13 @@ export class MultipleSelectUI extends BaseUI {
217
218
  this._element.appendChild(selectionControl.element);
218
219
  this._element.appendChild(itemsBoxWrapper);
219
220
  const hotInitializer = wrapper => {
220
- var _classPrivateFieldGet3;
221
221
  if (!this._element) {
222
222
  return;
223
223
  }
224
- (_classPrivateFieldGet3 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.destroy();
224
+ if (_classPrivateFieldGet(_itemsBox, this)) {
225
+ _classPrivateFieldGet(_itemsBox, this).destroy();
226
+ }
225
227
  addClass(wrapper, 'htUIMultipleSelectHot');
226
-
227
228
  // Constructs and initializes a new Handsontable instance
228
229
  _classPrivateFieldSet(_itemsBox, this, new this.hot.constructor(wrapper, {
229
230
  data: _classPrivateFieldGet(_items, this),
@@ -317,8 +318,9 @@ export class MultipleSelectUI extends BaseUI {
317
318
  * Destroy instance.
318
319
  */
319
320
  destroy() {
320
- var _classPrivateFieldGet4;
321
- (_classPrivateFieldGet4 = _classPrivateFieldGet(_itemsBox, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.destroy();
321
+ if (_classPrivateFieldGet(_itemsBox, this)) {
322
+ _classPrivateFieldGet(_itemsBox, this).destroy();
323
+ }
322
324
  _classPrivateFieldGet(_searchInput, this).destroy();
323
325
  _classPrivateFieldGet(_clearAllUI, this).destroy();
324
326
  _classPrivateFieldGet(_selectAllUI, this).destroy();