handsontable 0.0.0-next-48677e7-20230509 → 0.0.0-next-834f47e-20230509

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 (227) hide show
  1. package/3rdparty/walkontable/src/{selection/border/border.js → border.js} +12 -7
  2. package/3rdparty/walkontable/src/{selection/border/border.mjs → border.mjs} +12 -7
  3. package/3rdparty/walkontable/src/cell/coords.js +13 -40
  4. package/3rdparty/walkontable/src/cell/coords.mjs +13 -40
  5. package/3rdparty/walkontable/src/cell/range.js +25 -29
  6. package/3rdparty/walkontable/src/cell/range.mjs +24 -28
  7. package/3rdparty/walkontable/src/core/_base.js +3 -9
  8. package/3rdparty/walkontable/src/core/_base.mjs +3 -9
  9. package/3rdparty/walkontable/src/core/clone.js +2 -2
  10. package/3rdparty/walkontable/src/core/clone.mjs +2 -2
  11. package/3rdparty/walkontable/src/core/core.js +2 -3
  12. package/3rdparty/walkontable/src/core/core.mjs +2 -3
  13. package/3rdparty/walkontable/src/event.js +10 -12
  14. package/3rdparty/walkontable/src/event.mjs +10 -12
  15. package/3rdparty/walkontable/src/facade/core.js +2 -2
  16. package/3rdparty/walkontable/src/facade/core.mjs +2 -2
  17. package/3rdparty/walkontable/src/index.js +2 -10
  18. package/3rdparty/walkontable/src/index.mjs +2 -2
  19. package/3rdparty/walkontable/src/overlay/_base.js +7 -8
  20. package/3rdparty/walkontable/src/overlay/_base.mjs +7 -8
  21. package/3rdparty/walkontable/src/overlay/bottom.js +6 -7
  22. package/3rdparty/walkontable/src/overlay/bottom.mjs +6 -7
  23. package/3rdparty/walkontable/src/overlay/inlineStart.js +4 -2
  24. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +4 -2
  25. package/3rdparty/walkontable/src/overlay/top.js +10 -9
  26. package/3rdparty/walkontable/src/overlay/top.mjs +10 -9
  27. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +10 -12
  28. package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +10 -12
  29. package/3rdparty/walkontable/src/overlays.js +55 -64
  30. package/3rdparty/walkontable/src/overlays.mjs +55 -64
  31. package/3rdparty/walkontable/src/renderer/table.js +0 -2
  32. package/3rdparty/walkontable/src/renderer/table.mjs +0 -2
  33. package/3rdparty/walkontable/src/scroll.js +20 -23
  34. package/3rdparty/walkontable/src/scroll.mjs +20 -23
  35. package/3rdparty/walkontable/src/selection.js +354 -0
  36. package/3rdparty/walkontable/src/selection.mjs +348 -0
  37. package/3rdparty/walkontable/src/settings.js +13 -15
  38. package/3rdparty/walkontable/src/settings.mjs +13 -15
  39. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +0 -9
  40. package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +0 -9
  41. package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +0 -9
  42. package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +0 -9
  43. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +0 -9
  44. package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +0 -9
  45. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +0 -9
  46. package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +0 -9
  47. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +0 -9
  48. package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +0 -9
  49. package/3rdparty/walkontable/src/table.js +101 -33
  50. package/3rdparty/walkontable/src/table.mjs +102 -34
  51. package/base.js +2 -4
  52. package/base.mjs +2 -2
  53. package/core.d.ts +0 -4
  54. package/core.js +19 -52
  55. package/core.mjs +19 -52
  56. package/dataMap/dataSource.js +5 -5
  57. package/dataMap/dataSource.mjs +5 -5
  58. package/dataMap/metaManager/metaSchema.js +1 -8
  59. package/dataMap/metaManager/metaSchema.mjs +1 -8
  60. package/dist/handsontable.css +2 -7
  61. package/dist/handsontable.full.css +2 -7
  62. package/dist/handsontable.full.js +9162 -9474
  63. package/dist/handsontable.full.min.css +3 -3
  64. package/dist/handsontable.full.min.js +123 -115
  65. package/dist/handsontable.js +8763 -9076
  66. package/dist/handsontable.min.css +3 -3
  67. package/dist/handsontable.min.js +11 -3
  68. package/dist/languages/all.js +133 -0
  69. package/dist/languages/ar-AR.js +7 -0
  70. package/dist/languages/cs-CZ.js +7 -0
  71. package/dist/languages/de-CH.js +7 -0
  72. package/dist/languages/de-DE.js +7 -0
  73. package/dist/languages/en-US.js +7 -0
  74. package/dist/languages/es-MX.js +7 -0
  75. package/dist/languages/fr-FR.js +7 -0
  76. package/dist/languages/it-IT.js +7 -0
  77. package/dist/languages/ja-JP.js +7 -0
  78. package/dist/languages/ko-KR.js +7 -0
  79. package/dist/languages/lv-LV.js +7 -0
  80. package/dist/languages/nb-NO.js +7 -0
  81. package/dist/languages/nl-NL.js +7 -0
  82. package/dist/languages/pl-PL.js +7 -0
  83. package/dist/languages/pt-BR.js +7 -0
  84. package/dist/languages/ru-RU.js +7 -0
  85. package/dist/languages/sr-SP.js +7 -0
  86. package/dist/languages/zh-CN.js +7 -0
  87. package/dist/languages/zh-TW.js +7 -0
  88. package/editorManager.js +3 -7
  89. package/editorManager.mjs +3 -7
  90. package/editors/textEditor/textEditor.js +16 -3
  91. package/editors/textEditor/textEditor.mjs +17 -4
  92. package/helpers/dom/element.js +0 -11
  93. package/helpers/dom/element.mjs +0 -10
  94. package/helpers/mixed.js +1 -1
  95. package/helpers/mixed.mjs +1 -1
  96. package/i18n/languages/ar-AR.js +7 -1
  97. package/i18n/languages/cs-CZ.js +7 -1
  98. package/i18n/languages/de-CH.js +7 -1
  99. package/i18n/languages/de-DE.js +7 -1
  100. package/i18n/languages/en-US.js +7 -1
  101. package/i18n/languages/es-MX.js +7 -1
  102. package/i18n/languages/fr-FR.js +7 -1
  103. package/i18n/languages/it-IT.js +7 -1
  104. package/i18n/languages/ja-JP.js +7 -1
  105. package/i18n/languages/ko-KR.js +7 -1
  106. package/i18n/languages/lv-LV.js +7 -1
  107. package/i18n/languages/nb-NO.js +7 -1
  108. package/i18n/languages/nl-NL.js +7 -1
  109. package/i18n/languages/pl-PL.js +7 -1
  110. package/i18n/languages/pt-BR.js +7 -1
  111. package/i18n/languages/ru-RU.js +7 -1
  112. package/i18n/languages/sr-SP.js +7 -1
  113. package/i18n/languages/zh-CN.js +7 -1
  114. package/i18n/languages/zh-TW.js +7 -1
  115. package/languages/all.js +133 -0
  116. package/languages/ar-AR.js +7 -0
  117. package/languages/cs-CZ.js +7 -0
  118. package/languages/de-CH.js +7 -0
  119. package/languages/de-DE.js +7 -0
  120. package/languages/en-US.js +7 -0
  121. package/languages/es-MX.js +7 -0
  122. package/languages/fr-FR.js +7 -0
  123. package/languages/index.js +133 -0
  124. package/languages/it-IT.js +7 -0
  125. package/languages/ja-JP.js +7 -0
  126. package/languages/ko-KR.js +7 -0
  127. package/languages/lv-LV.js +7 -0
  128. package/languages/nb-NO.js +7 -0
  129. package/languages/nl-NL.js +7 -0
  130. package/languages/pl-PL.js +7 -0
  131. package/languages/pt-BR.js +7 -0
  132. package/languages/ru-RU.js +7 -0
  133. package/languages/sr-SP.js +7 -0
  134. package/languages/zh-CN.js +7 -0
  135. package/languages/zh-TW.js +7 -0
  136. package/package.json +3 -2
  137. package/pluginHooks.js +17 -7
  138. package/pluginHooks.mjs +16 -4
  139. package/plugins/autoRowSize/autoRowSize.js +2 -2
  140. package/plugins/autoRowSize/autoRowSize.mjs +2 -2
  141. package/plugins/copyPaste/copyPaste.js +93 -12
  142. package/plugins/copyPaste/copyPaste.mjs +93 -12
  143. package/plugins/copyPaste/copyableRanges.js +25 -31
  144. package/plugins/copyPaste/copyableRanges.mjs +18 -24
  145. package/plugins/copyPaste/focusableElement.js +219 -0
  146. package/plugins/copyPaste/focusableElement.mjs +213 -0
  147. package/plugins/customBorders/customBorders.js +2 -6
  148. package/plugins/customBorders/customBorders.mjs +3 -7
  149. package/plugins/filters/filters.js +5 -0
  150. package/plugins/filters/filters.mjs +5 -0
  151. package/plugins/formulas/formulas.js +190 -168
  152. package/plugins/formulas/formulas.mjs +190 -168
  153. package/plugins/formulas/indexSyncer/axisSyncer.js +379 -0
  154. package/plugins/formulas/indexSyncer/axisSyncer.mjs +374 -0
  155. package/plugins/formulas/indexSyncer/index.js +225 -0
  156. package/plugins/formulas/indexSyncer/index.mjs +219 -0
  157. package/plugins/mergeCells/mergeCells.js +16 -0
  158. package/plugins/mergeCells/mergeCells.mjs +16 -0
  159. package/plugins/nestedHeaders/nestedHeaders.js +4 -3
  160. package/plugins/nestedHeaders/nestedHeaders.mjs +4 -3
  161. package/plugins/nestedHeaders/stateManager/headersTree.js +23 -26
  162. package/plugins/nestedHeaders/stateManager/headersTree.mjs +20 -23
  163. package/plugins/nestedHeaders/stateManager/index.js +3 -3
  164. package/plugins/nestedHeaders/stateManager/matrixGenerator.js +1 -0
  165. package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +1 -1
  166. package/plugins/nestedHeaders/utils/ghostTable.js +30 -35
  167. package/plugins/nestedHeaders/utils/ghostTable.mjs +30 -35
  168. package/plugins/registry.js +3 -1
  169. package/plugins/undoRedo/undoRedo.js +0 -1
  170. package/plugins/undoRedo/undoRedo.mjs +0 -1
  171. package/renderers/baseRenderer/baseRenderer.js +0 -3
  172. package/renderers/baseRenderer/baseRenderer.mjs +0 -3
  173. package/selection/highlight/constants.js +16 -0
  174. package/selection/highlight/constants.mjs +6 -0
  175. package/selection/highlight/highlight.js +133 -335
  176. package/selection/highlight/highlight.mjs +129 -325
  177. package/selection/highlight/types/activeHeader.js +9 -10
  178. package/selection/highlight/types/activeHeader.mjs +8 -10
  179. package/selection/highlight/types/area.js +27 -12
  180. package/selection/highlight/types/area.mjs +30 -16
  181. package/selection/highlight/types/{focus.js → cell.js} +8 -5
  182. package/selection/highlight/types/{focus.mjs → cell.mjs} +7 -5
  183. package/selection/highlight/types/customSelection.js +10 -7
  184. package/selection/highlight/types/customSelection.mjs +9 -7
  185. package/selection/highlight/types/fill.js +8 -5
  186. package/selection/highlight/types/fill.mjs +7 -5
  187. package/selection/highlight/types/header.js +20 -10
  188. package/selection/highlight/types/header.mjs +19 -10
  189. package/selection/highlight/types/{row.js → index.js} +31 -27
  190. package/selection/highlight/types/{row.mjs → index.mjs} +29 -24
  191. package/selection/highlight/visualSelection.js +21 -12
  192. package/selection/highlight/visualSelection.mjs +21 -12
  193. package/selection/index.js +7 -4
  194. package/selection/index.mjs +3 -2
  195. package/selection/selection.js +46 -88
  196. package/selection/selection.mjs +44 -82
  197. package/settings.d.ts +0 -1
  198. package/tableView.js +66 -94
  199. package/tableView.mjs +66 -94
  200. package/translations/changesObservable/observable.js +41 -46
  201. package/translations/changesObservable/observable.mjs +36 -41
  202. package/translations/changesObservable/observer.js +1 -1
  203. package/translations/indexMapper.js +21 -0
  204. package/translations/indexMapper.mjs +21 -0
  205. package/utils/dataStructures/tree.js +15 -18
  206. package/utils/dataStructures/tree.mjs +15 -18
  207. package/utils/parseTable.js +5 -1
  208. package/utils/parseTable.mjs +5 -1
  209. package/3rdparty/walkontable/src/selection/border/constants.js +0 -18
  210. package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -13
  211. package/3rdparty/walkontable/src/selection/constants.js +0 -63
  212. package/3rdparty/walkontable/src/selection/constants.mjs +0 -51
  213. package/3rdparty/walkontable/src/selection/index.js +0 -30
  214. package/3rdparty/walkontable/src/selection/index.mjs +0 -5
  215. package/3rdparty/walkontable/src/selection/manager.js +0 -334
  216. package/3rdparty/walkontable/src/selection/manager.mjs +0 -328
  217. package/3rdparty/walkontable/src/selection/scanner.js +0 -363
  218. package/3rdparty/walkontable/src/selection/scanner.mjs +0 -359
  219. package/3rdparty/walkontable/src/selection/selection.js +0 -133
  220. package/3rdparty/walkontable/src/selection/selection.mjs +0 -127
  221. package/focusManager.d.ts +0 -12
  222. package/focusManager.js +0 -249
  223. package/focusManager.mjs +0 -245
  224. package/selection/highlight/types/areaLayered.js +0 -54
  225. package/selection/highlight/types/areaLayered.mjs +0 -49
  226. package/selection/highlight/types/column.js +0 -50
  227. package/selection/highlight/types/column.mjs +0 -45
@@ -1,12 +1,10 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
- import "core-js/modules/es.object.keys.js";
3
- import "core-js/modules/es.array.index-of.js";
4
- import "core-js/modules/es.symbol.js";
5
1
  import "core-js/modules/es.symbol.to-primitive.js";
6
2
  import "core-js/modules/es.date.to-primitive.js";
3
+ import "core-js/modules/es.symbol.js";
7
4
  import "core-js/modules/es.symbol.description.js";
8
5
  import "core-js/modules/es.object.to-string.js";
9
6
  import "core-js/modules/es.number.constructor.js";
7
+ import "core-js/modules/es.object.keys.js";
10
8
  import "core-js/modules/es.array.filter.js";
11
9
  import "core-js/modules/es.object.get-own-property-descriptor.js";
12
10
  import "core-js/modules/web.dom-collections.for-each.js";
@@ -15,31 +13,38 @@ import "core-js/modules/es.symbol.iterator.js";
15
13
  import "core-js/modules/es.array.iterator.js";
16
14
  import "core-js/modules/es.string.iterator.js";
17
15
  import "core-js/modules/web.dom-collections.iterator.js";
18
- var _excluded = ["rowClassName"];
16
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
19
17
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
20
18
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21
19
  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; }
22
20
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
23
21
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
24
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
25
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
26
- import { HIGHLIGHT_ROW_TYPE } from "../../../3rdparty/walkontable/src/index.mjs";
27
- import VisualSelection from "../visualSelection.mjs";
22
+ import staticRegister from "./../../../utils/staticRegister.mjs";
23
+ import { ACTIVE_HEADER_TYPE, AREA_TYPE, CELL_TYPE, CUSTOM_SELECTION_TYPE, FILL_TYPE, HEADER_TYPE } from "../constants.mjs";
24
+ import activeHeaderHighlight from "./activeHeader.mjs";
25
+ import areaHighlight from "./area.mjs";
26
+ import cellHighlight from "./cell.mjs";
27
+ import customSelection from "./customSelection.mjs";
28
+ import fillHighlight from "./fill.mjs";
29
+ import headerHighlight from "./header.mjs";
30
+ var _staticRegister = staticRegister('highlight/types'),
31
+ register = _staticRegister.register,
32
+ getItem = _staticRegister.getItem;
33
+ register(ACTIVE_HEADER_TYPE, activeHeaderHighlight);
34
+ register(AREA_TYPE, areaHighlight);
35
+ register(CELL_TYPE, cellHighlight);
36
+ register(CUSTOM_SELECTION_TYPE, customSelection);
37
+ register(FILL_TYPE, fillHighlight);
38
+ register(HEADER_TYPE, headerHighlight);
39
+
28
40
  /**
29
- * Creates the new instance of Selection, responsible for highlighting cells in a rows and
30
- * row headers.
31
- * This type of selection can occur multiple times.
32
- *
33
- * @param {object} highlightParams A configuration object to create a highlight.
34
- * @param {string} highlightParams.rowClassName Highlighted row' class name.
41
+ * @param {string} highlightType The selection type.
42
+ * @param {object} options The selection options.
35
43
  * @returns {Selection}
36
44
  */
37
- export function createHighlight(_ref) {
38
- var rowClassName = _ref.rowClassName,
39
- restOptions = _objectWithoutProperties(_ref, _excluded);
40
- return new VisualSelection(_objectSpread(_objectSpread({
41
- className: rowClassName
42
- }, restOptions), {}, {
43
- selectionType: HIGHLIGHT_ROW_TYPE
44
- }));
45
- }
45
+ function createHighlight(highlightType, options) {
46
+ return getItem(highlightType)(_objectSpread({
47
+ type: highlightType
48
+ }, options));
49
+ }
50
+ export { createHighlight };
@@ -37,16 +37,15 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
37
37
  var VisualSelection = /*#__PURE__*/function (_Selection) {
38
38
  _inherits(VisualSelection, _Selection);
39
39
  var _super = _createSuper(VisualSelection);
40
- /**
41
- * Range of selection visually. Visual representation may have representation in a rendered selection.
42
- *
43
- * @type {null|CellRange}
44
- */
45
-
46
40
  function VisualSelection(settings, visualCellRange) {
47
41
  var _this;
48
42
  _classCallCheck(this, VisualSelection);
49
43
  _this = _super.call(this, settings, null);
44
+ /**
45
+ * Range of selection visually. Visual representation may have representation in a rendered selection.
46
+ *
47
+ * @type {null|CellRange}
48
+ */
50
49
  _defineProperty(_assertThisInitialized(_this), "visualCellRange", null);
51
50
  _this.visualCellRange = visualCellRange || null;
52
51
  _this.commit();
@@ -100,6 +99,10 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
100
99
  return null;
101
100
  }
102
101
  if (visibleFromCoords.row > visibleToCoords.row || visibleFromCoords.col > visibleToCoords.col) {
102
+ var isHeaderTypeSelection = this.settings.type === 'header' || this.settings.type === 'active-header';
103
+ if (!isHeaderTypeSelection) {
104
+ return null;
105
+ }
103
106
  visibleFromCoords = from;
104
107
  visibleToCoords = to;
105
108
  }
@@ -152,7 +155,12 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
152
155
  if (visualIndex < 0) {
153
156
  return visualIndex;
154
157
  }
155
- return indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
158
+ var nearestVisualIndex = indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
159
+ var isHeaderSelectionType = this.settings.type === 'header' || this.settings.type === 'active-header';
160
+ if (isHeaderSelectionType && nearestVisualIndex === null) {
161
+ return -1;
162
+ }
163
+ return nearestVisualIndex;
156
164
  }
157
165
 
158
166
  /**
@@ -228,7 +236,11 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
228
236
  var _this$cellRange = this.cellRange,
229
237
  from = _this$cellRange.from,
230
238
  to = _this$cellRange.to;
231
- return [Math.min(from.row, to.row), Math.min(from.col, to.col), Math.max(from.row, to.row), Math.max(from.col, to.col)];
239
+ var isRowUndefined = from.row === null || to.row === null;
240
+ var isColumnUndefined = from.col === null || to.col === null;
241
+ var topLeftCorner = this.settings.createCellCoords(isRowUndefined ? null : Math.min(from.row, to.row), isColumnUndefined ? null : Math.min(from.col, to.col));
242
+ var bottomRightCorner = this.settings.createCellCoords(isRowUndefined ? null : Math.max(from.row, to.row), isColumnUndefined ? null : Math.max(from.col, to.col));
243
+ return [topLeftCorner.row, topLeftCorner.col, bottomRightCorner.row, bottomRightCorner.col];
232
244
  }
233
245
 
234
246
  /**
@@ -253,16 +265,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
253
265
  * points to the beginning of the selection.
254
266
  * @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
255
267
  * points to the end of the selection.
256
- * @returns {CellRange|null}
268
+ * @returns {CellRange}
257
269
  */
258
270
  }, {
259
271
  key: "createRenderableCellRange",
260
272
  value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
261
273
  var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
262
274
  var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords);
263
- if (renderableFromCoords.row === null || renderableFromCoords.col === null || renderableToCoords.row === null || renderableToCoords.col === null) {
264
- return null;
265
- }
266
275
  return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
267
276
  }
268
277
  }]);
@@ -33,16 +33,15 @@ import { Selection } from "./../../3rdparty/walkontable/src/index.mjs";
33
33
  var VisualSelection = /*#__PURE__*/function (_Selection) {
34
34
  _inherits(VisualSelection, _Selection);
35
35
  var _super = _createSuper(VisualSelection);
36
- /**
37
- * Range of selection visually. Visual representation may have representation in a rendered selection.
38
- *
39
- * @type {null|CellRange}
40
- */
41
-
42
36
  function VisualSelection(settings, visualCellRange) {
43
37
  var _this;
44
38
  _classCallCheck(this, VisualSelection);
45
39
  _this = _super.call(this, settings, null);
40
+ /**
41
+ * Range of selection visually. Visual representation may have representation in a rendered selection.
42
+ *
43
+ * @type {null|CellRange}
44
+ */
46
45
  _defineProperty(_assertThisInitialized(_this), "visualCellRange", null);
47
46
  _this.visualCellRange = visualCellRange || null;
48
47
  _this.commit();
@@ -96,6 +95,10 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
96
95
  return null;
97
96
  }
98
97
  if (visibleFromCoords.row > visibleToCoords.row || visibleFromCoords.col > visibleToCoords.col) {
98
+ var isHeaderTypeSelection = this.settings.type === 'header' || this.settings.type === 'active-header';
99
+ if (!isHeaderTypeSelection) {
100
+ return null;
101
+ }
99
102
  visibleFromCoords = from;
100
103
  visibleToCoords = to;
101
104
  }
@@ -148,7 +151,12 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
148
151
  if (visualIndex < 0) {
149
152
  return visualIndex;
150
153
  }
151
- return indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
154
+ var nearestVisualIndex = indexMapper.getNearestNotHiddenIndex(visualIndex, searchDirection);
155
+ var isHeaderSelectionType = this.settings.type === 'header' || this.settings.type === 'active-header';
156
+ if (isHeaderSelectionType && nearestVisualIndex === null) {
157
+ return -1;
158
+ }
159
+ return nearestVisualIndex;
152
160
  }
153
161
 
154
162
  /**
@@ -224,7 +232,11 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
224
232
  var _this$cellRange = this.cellRange,
225
233
  from = _this$cellRange.from,
226
234
  to = _this$cellRange.to;
227
- return [Math.min(from.row, to.row), Math.min(from.col, to.col), Math.max(from.row, to.row), Math.max(from.col, to.col)];
235
+ var isRowUndefined = from.row === null || to.row === null;
236
+ var isColumnUndefined = from.col === null || to.col === null;
237
+ var topLeftCorner = this.settings.createCellCoords(isRowUndefined ? null : Math.min(from.row, to.row), isColumnUndefined ? null : Math.min(from.col, to.col));
238
+ var bottomRightCorner = this.settings.createCellCoords(isRowUndefined ? null : Math.max(from.row, to.row), isColumnUndefined ? null : Math.max(from.col, to.col));
239
+ return [topLeftCorner.row, topLeftCorner.col, bottomRightCorner.row, bottomRightCorner.col];
228
240
  }
229
241
 
230
242
  /**
@@ -249,16 +261,13 @@ var VisualSelection = /*#__PURE__*/function (_Selection) {
249
261
  * points to the beginning of the selection.
250
262
  * @param {CellCoords} visualToCoords The CellCoords object which contains coordinates that
251
263
  * points to the end of the selection.
252
- * @returns {CellRange|null}
264
+ * @returns {CellRange}
253
265
  */
254
266
  }, {
255
267
  key: "createRenderableCellRange",
256
268
  value: function createRenderableCellRange(visualFromCoords, visualToCoords) {
257
269
  var renderableFromCoords = this.settings.visualToRenderableCoords(visualFromCoords);
258
270
  var renderableToCoords = this.settings.visualToRenderableCoords(visualToCoords);
259
- if (renderableFromCoords.row === null || renderableFromCoords.col === null || renderableToCoords.row === null || renderableToCoords.col === null) {
260
- return null;
261
- }
262
271
  return this.settings.createCellRange(renderableFromCoords, renderableFromCoords, renderableToCoords);
263
272
  }
264
273
  }]);
@@ -5,11 +5,14 @@ require("core-js/modules/web.dom-collections.for-each.js");
5
5
  require("core-js/modules/es.object.keys.js");
6
6
  exports.__esModule = true;
7
7
  var _exportNames = {
8
+ Highlight: true,
8
9
  Selection: true,
9
10
  handleMouseEvent: true,
10
11
  detectSelectionType: true,
11
12
  normalizeSelectionFactory: true
12
13
  };
14
+ var _highlight = _interopRequireDefault(require("./highlight/highlight"));
15
+ exports.Highlight = _highlight.default;
13
16
  var _selection = _interopRequireDefault(require("./selection"));
14
17
  exports.Selection = _selection.default;
15
18
  var _mouseEventHandler = require("./mouseEventHandler");
@@ -17,11 +20,11 @@ exports.handleMouseEvent = _mouseEventHandler.handleMouseEvent;
17
20
  var _utils = require("./utils");
18
21
  exports.detectSelectionType = _utils.detectSelectionType;
19
22
  exports.normalizeSelectionFactory = _utils.normalizeSelectionFactory;
20
- var _highlight = require("./highlight/highlight");
21
- Object.keys(_highlight).forEach(function (key) {
23
+ var _constants = require("./highlight/constants");
24
+ Object.keys(_constants).forEach(function (key) {
22
25
  if (key === "default" || key === "__esModule") return;
23
26
  if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
24
- if (key in exports && exports[key] === _highlight[key]) return;
25
- exports[key] = _highlight[key];
27
+ if (key in exports && exports[key] === _constants[key]) return;
28
+ exports[key] = _constants[key];
26
29
  });
27
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -1,5 +1,6 @@
1
+ import Highlight from "./highlight/highlight.mjs";
1
2
  import Selection from "./selection.mjs";
2
3
  import { handleMouseEvent } from "./mouseEventHandler.mjs";
3
4
  import { detectSelectionType, normalizeSelectionFactory } from "./utils.mjs";
4
- export * from "./highlight/highlight.mjs";
5
- export { handleMouseEvent, Selection, detectSelectionType, normalizeSelectionFactory };
5
+ export * from "./highlight/constants.mjs";
6
+ export { handleMouseEvent, Highlight, Selection, detectSelectionType, normalizeSelectionFactory };
@@ -5,8 +5,6 @@ require("core-js/modules/es.object.freeze.js");
5
5
  require("core-js/modules/es.symbol.iterator.js");
6
6
  require("core-js/modules/es.function.name.js");
7
7
  require("core-js/modules/es.regexp.exec.js");
8
- require("core-js/modules/es.weak-map.js");
9
- require("core-js/modules/es.object.get-own-property-descriptor.js");
10
8
  exports.__esModule = true;
11
9
  exports.default = void 0;
12
10
  require("core-js/modules/es.array.iterator.js");
@@ -25,7 +23,8 @@ require("core-js/modules/es.symbol.to-primitive.js");
25
23
  require("core-js/modules/es.date.to-primitive.js");
26
24
  require("core-js/modules/es.symbol.js");
27
25
  require("core-js/modules/es.symbol.description.js");
28
- var _highlight = _interopRequireWildcard(require("./highlight/highlight"));
26
+ var _highlight = _interopRequireDefault(require("./highlight/highlight"));
27
+ var _constants = require("./highlight/constants");
29
28
  var _range = _interopRequireDefault(require("./range"));
30
29
  var _object = require("./../helpers/object");
31
30
  var _mixed = require("./../helpers/mixed");
@@ -36,8 +35,6 @@ var _utils = require("./utils");
36
35
  var _templateLiteralTag = require("./../helpers/templateLiteralTag");
37
36
  var _templateObject;
38
37
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
40
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
41
38
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
42
39
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
43
40
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -155,12 +152,6 @@ var Selection = /*#__PURE__*/function () {
155
152
  countCols: function countCols() {
156
153
  return _this.tableProps.countColsTranslated();
157
154
  },
158
- countRowHeaders: function countRowHeaders() {
159
- return _this.tableProps.countRowHeaders();
160
- },
161
- countColHeaders: function countColHeaders() {
162
- return _this.tableProps.countColHeaders();
163
- },
164
155
  visualToRenderableCoords: function visualToRenderableCoords(coords) {
165
156
  return _this.tableProps.visualToRenderableCoords(coords);
166
157
  },
@@ -345,9 +336,9 @@ var Selection = /*#__PURE__*/function () {
345
336
  }
346
337
 
347
338
  // Set up current selection.
348
- this.highlight.getFocus().clear();
349
- if (this.highlight.isEnabledFor(_highlight.FOCUS_TYPE, cellRange.highlight)) {
350
- this.highlight.getFocus().add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
339
+ this.highlight.getCell().clear();
340
+ if (this.highlight.isEnabledFor(_constants.CELL_TYPE, cellRange.highlight)) {
341
+ this.highlight.getCell().add(this.selectedRange.current().highlight).commit().syncWith(cellRange);
351
342
  }
352
343
  var layerLevel = this.getLayerLevel();
353
344
 
@@ -357,85 +348,64 @@ var Selection = /*#__PURE__*/function () {
357
348
  (0, _array.arrayEach)(this.highlight.getAreas(), function (highlight) {
358
349
  return void highlight.clear();
359
350
  });
360
- (0, _array.arrayEach)(this.highlight.getLayeredAreas(), function (highlight) {
361
- return void highlight.clear();
362
- });
363
- (0, _array.arrayEach)(this.highlight.getRowHeaders(), function (highlight) {
364
- return void highlight.clear();
365
- });
366
- (0, _array.arrayEach)(this.highlight.getColumnHeaders(), function (highlight) {
367
- return void highlight.clear();
368
- });
369
- (0, _array.arrayEach)(this.highlight.getActiveRowHeaders(), function (highlight) {
370
- return void highlight.clear();
371
- });
372
- (0, _array.arrayEach)(this.highlight.getActiveColumnHeaders(), function (highlight) {
373
- return void highlight.clear();
374
- });
375
- (0, _array.arrayEach)(this.highlight.getRowHighlights(), function (highlight) {
351
+ (0, _array.arrayEach)(this.highlight.getHeaders(), function (highlight) {
376
352
  return void highlight.clear();
377
353
  });
378
- (0, _array.arrayEach)(this.highlight.getColumnHighlights(), function (highlight) {
354
+ (0, _array.arrayEach)(this.highlight.getActiveHeaders(), function (highlight) {
379
355
  return void highlight.clear();
380
356
  });
381
357
  }
382
358
  this.highlight.useLayerLevel(layerLevel);
383
- var areaHighlight = this.highlight.createArea();
384
- var layeredAreaHighlight = this.highlight.createLayeredArea();
385
- var rowHeaderHighlight = this.highlight.createRowHeader();
386
- var columnHeaderHighlight = this.highlight.createColumnHeader();
387
- var activeRowHeaderHighlight = this.highlight.createActiveRowHeader();
388
- var activeColumnHeaderHighlight = this.highlight.createActiveColumnHeader();
389
- var rowHighlight = this.highlight.createRowHighlight();
390
- var columnHighlight = this.highlight.createColumnHighlight();
359
+ var areaHighlight = this.highlight.createOrGetArea();
360
+ var headerHighlight = this.highlight.createOrGetHeader();
361
+ var activeHeaderHighlight = this.highlight.createOrGetActiveHeader();
391
362
  areaHighlight.clear();
392
- layeredAreaHighlight.clear();
393
- rowHeaderHighlight.clear();
394
- columnHeaderHighlight.clear();
395
- activeRowHeaderHighlight.clear();
396
- activeColumnHeaderHighlight.clear();
397
- rowHighlight.clear();
398
- columnHighlight.clear();
399
- if (this.highlight.isEnabledFor(_highlight.AREA_TYPE, cellRange.highlight) && (this.isMultiple() || layerLevel >= 1)) {
363
+ headerHighlight.clear();
364
+ activeHeaderHighlight.clear();
365
+ if (this.highlight.isEnabledFor(_constants.AREA_TYPE, cellRange.highlight) && (this.isMultiple() || layerLevel >= 1)) {
400
366
  areaHighlight.add(cellRange.from).add(cellRange.to).commit();
401
- layeredAreaHighlight.add(cellRange.from).add(cellRange.to).commit();
402
367
  if (layerLevel === 1) {
403
368
  // For single cell selection in the same layer, we do not create area selection to prevent blue background.
404
369
  // When non-consecutive selection is performed we have to add that missing area selection to the previous layer
405
370
  // based on previous coordinates. It only occurs when the previous selection wasn't select multiple cells.
406
371
  var previousRange = this.selectedRange.previous();
407
- this.highlight.useLayerLevel(layerLevel - 1);
408
- this.highlight.createArea().add(previousRange.from).commit()
409
- // Range may start with hidden indexes. Commit would not found start point (as we add just the `from` coords).
410
- .syncWith(previousRange);
411
- this.highlight.createLayeredArea().add(previousRange.from).commit()
372
+ this.highlight.useLayerLevel(layerLevel - 1).createOrGetArea().add(previousRange.from).commit()
412
373
  // Range may start with hidden indexes. Commit would not found start point (as we add just the `from` coords).
413
374
  .syncWith(previousRange);
414
375
  this.highlight.useLayerLevel(layerLevel);
415
376
  }
416
377
  }
417
- if (this.highlight.isEnabledFor(_highlight.HEADER_TYPE, cellRange.highlight)) {
418
- var rowCoordsFrom = this.tableProps.createCellCoords(Math.max(cellRange.from.row, 0), -1);
419
- var rowCoordsTo = this.tableProps.createCellCoords(cellRange.to.row, -1);
420
- var columnCoordsFrom = this.tableProps.createCellCoords(-1, Math.max(cellRange.from.col, 0));
421
- var columnCoordsTo = this.tableProps.createCellCoords(-1, cellRange.to.col);
378
+ if (this.highlight.isEnabledFor(_constants.HEADER_TYPE, cellRange.highlight)) {
379
+ // The header selection generally contains cell selection. In a case when all rows (or columns)
380
+ // are hidden that visual coordinates are translated to renderable coordinates that do not exist.
381
+ // Hence no header highlight is generated. In that case, to make a column (or a row) header
382
+ // highlight, the row and column index has to point to the header (the negative value). See #7052.
383
+ var areAnyRowsRendered = this.tableProps.countRowsTranslated() === 0;
384
+ var areAnyColumnsRendered = this.tableProps.countColsTranslated() === 0;
385
+ var headerCellRange = cellRange;
386
+ if (areAnyRowsRendered || areAnyColumnsRendered) {
387
+ headerCellRange = cellRange.clone();
388
+ }
389
+ if (areAnyRowsRendered) {
390
+ headerCellRange.from.row = -1;
391
+ }
392
+ if (areAnyColumnsRendered) {
393
+ headerCellRange.from.col = -1;
394
+ }
422
395
  if (this.settings.selectionMode === 'single') {
423
- rowHeaderHighlight.add(rowCoordsFrom).commit();
424
- columnHeaderHighlight.add(columnCoordsFrom).commit();
425
- rowHighlight.add(rowCoordsFrom).commit();
426
- columnHighlight.add(columnCoordsFrom).commit();
396
+ if (this.isSelectedByAnyHeader()) {
397
+ headerCellRange.from.normalize();
398
+ }
399
+ headerHighlight.add(headerCellRange.from).commit();
427
400
  } else {
428
- rowHeaderHighlight.add(rowCoordsFrom).add(rowCoordsTo).commit();
429
- columnHeaderHighlight.add(columnCoordsFrom).add(columnCoordsTo).commit();
430
- rowHighlight.add(rowCoordsFrom).add(rowCoordsTo).commit();
431
- columnHighlight.add(columnCoordsFrom).add(columnCoordsTo).commit();
401
+ headerHighlight.add(headerCellRange.from).add(headerCellRange.to).commit();
432
402
  }
433
403
  if (this.isEntireRowSelected()) {
434
404
  var isRowSelected = this.tableProps.countCols() === cellRange.getWidth();
435
405
 
436
406
  // Make sure that the whole row is selected (in case where selectionMode is set to 'single')
437
407
  if (isRowSelected) {
438
- activeRowHeaderHighlight.add(this.tableProps.createCellCoords(cellRange.from.row, Math.min(-this.tableProps.countRowHeaders(), -1))).add(this.tableProps.createCellCoords(cellRange.to.row, -1)).commit();
408
+ activeHeaderHighlight.add(this.tableProps.createCellCoords(cellRange.from.row, -1)).add(this.tableProps.createCellCoords(cellRange.to.row, -1)).commit();
439
409
  }
440
410
  }
441
411
  if (this.isEntireColumnSelected()) {
@@ -443,7 +413,7 @@ var Selection = /*#__PURE__*/function () {
443
413
 
444
414
  // Make sure that the whole column is selected (in case where selectionMode is set to 'single')
445
415
  if (isColumnSelected) {
446
- activeColumnHeaderHighlight.add(this.tableProps.createCellCoords(Math.min(-this.tableProps.countColHeaders(), -1), cellRange.from.col)).add(this.tableProps.createCellCoords(-1, cellRange.to.col)).commit();
416
+ activeHeaderHighlight.add(this.tableProps.createCellCoords(-1, cellRange.from.col)).add(this.tableProps.createCellCoords(-1, cellRange.to.col)).commit();
447
417
  }
448
418
  }
449
419
  }
@@ -678,9 +648,7 @@ var Selection = /*#__PURE__*/function () {
678
648
  if (!includeRowHeaders && !includeColumnHeaders && (nrOfRows === 0 || nrOfColumns === 0)) {
679
649
  return;
680
650
  }
681
- var rowFrom = includeColumnHeaders ? -this.tableProps.countColHeaders() : 0;
682
- var columnFrom = includeRowHeaders ? -this.tableProps.countRowHeaders() : 0;
683
- var startCoords = this.tableProps.createCellCoords(rowFrom, columnFrom);
651
+ var startCoords = this.tableProps.createCellCoords(includeColumnHeaders ? -1 : 0, includeRowHeaders ? -1 : 0);
684
652
  var endCoords = this.tableProps.createCellCoords(nrOfRows - 1, nrOfColumns - 1);
685
653
  this.clear();
686
654
  this.setRangeStartOnly(startCoords);
@@ -814,29 +782,19 @@ var Selection = /*#__PURE__*/function () {
814
782
  if (!this.isSelected()) {
815
783
  return;
816
784
  }
817
- var focusHighlight = this.highlight.getFocus();
785
+ var cellHighlight = this.highlight.getCell();
818
786
  var currentLayer = this.getLayerLevel();
819
- focusHighlight.commit().syncWith(this.selectedRange.current());
787
+ cellHighlight.commit().syncWith(this.selectedRange.current());
820
788
 
821
789
  // Rewriting rendered ranges going through all layers.
822
790
  for (var layerLevel = 0; layerLevel < this.selectedRange.size(); layerLevel += 1) {
823
791
  this.highlight.useLayerLevel(layerLevel);
824
- var areaHighlight = this.highlight.createArea();
825
- var areaLayeredHighlight = this.highlight.createLayeredArea();
826
- var rowHeaderHighlight = this.highlight.createRowHeader();
827
- var columnHeaderHighlight = this.highlight.createColumnHeader();
828
- var activeRowHeaderHighlight = this.highlight.createActiveRowHeader();
829
- var activeColumnHeaderHighlight = this.highlight.createActiveColumnHeader();
830
- var rowHighlight = this.highlight.createRowHighlight();
831
- var columnHighlight = this.highlight.createColumnHighlight();
792
+ var areaHighlight = this.highlight.createOrGetArea();
793
+ var headerHighlight = this.highlight.createOrGetHeader();
794
+ var activeHeaderHighlight = this.highlight.createOrGetActiveHeader();
832
795
  areaHighlight.commit();
833
- areaLayeredHighlight.commit();
834
- rowHeaderHighlight.commit();
835
- columnHeaderHighlight.commit();
836
- activeRowHeaderHighlight.commit();
837
- activeColumnHeaderHighlight.commit();
838
- rowHighlight.commit();
839
- columnHighlight.commit();
796
+ headerHighlight.commit();
797
+ activeHeaderHighlight.commit();
840
798
  }
841
799
 
842
800
  // Reverting starting layer for the Highlight.