handsontable 0.0.0-next-e54c3d6-20231026 → 0.0.0-next-0c0e2e5-20231027

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 (65) hide show
  1. package/3rdparty/walkontable/src/cell/coords.js +2 -1
  2. package/3rdparty/walkontable/src/cell/coords.mjs +2 -1
  3. package/3rdparty/walkontable/src/renderer/columnHeaders.js +3 -0
  4. package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +4 -1
  5. package/3rdparty/walkontable/src/renderer/rowHeaders.js +3 -0
  6. package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +4 -1
  7. package/base.js +2 -2
  8. package/base.mjs +2 -2
  9. package/core.js +1 -1
  10. package/core.mjs +1 -1
  11. package/dist/handsontable.css +45 -63
  12. package/dist/handsontable.full.css +45 -63
  13. package/dist/handsontable.full.js +255 -25
  14. package/dist/handsontable.full.min.css +5 -5
  15. package/dist/handsontable.full.min.js +105 -105
  16. package/dist/handsontable.js +255 -25
  17. package/dist/handsontable.min.css +5 -5
  18. package/dist/handsontable.min.js +19 -19
  19. package/dist/languages/all.js +24 -2
  20. package/dist/languages/all.min.js +1 -1
  21. package/dist/languages/en-US.js +12 -1
  22. package/dist/languages/en-US.min.js +1 -1
  23. package/dist/languages/pl-PL.js +12 -1
  24. package/dist/languages/pl-PL.min.js +1 -1
  25. package/helpers/a11y.js +2 -0
  26. package/helpers/a11y.mjs +1 -0
  27. package/helpers/dom/element.js +29 -0
  28. package/helpers/dom/element.mjs +28 -0
  29. package/helpers/mixed.js +1 -1
  30. package/helpers/mixed.mjs +1 -1
  31. package/i18n/constants.js +27 -1
  32. package/i18n/constants.mjs +14 -1
  33. package/i18n/languages/en-US.js +12 -1
  34. package/i18n/languages/en-US.mjs +12 -1
  35. package/i18n/languages/pl-PL.js +12 -1
  36. package/i18n/languages/pl-PL.mjs +12 -1
  37. package/languages/all.js +24 -2
  38. package/languages/en-US.js +12 -1
  39. package/languages/en-US.mjs +12 -1
  40. package/languages/index.js +24 -2
  41. package/languages/pl-PL.js +12 -1
  42. package/languages/pl-PL.mjs +12 -1
  43. package/package.json +1 -1
  44. package/plugins/collapsibleColumns/collapsibleColumns.js +3 -2
  45. package/plugins/collapsibleColumns/collapsibleColumns.mjs +4 -3
  46. package/plugins/columnSorting/columnSorting.js +29 -3
  47. package/plugins/columnSorting/columnSorting.mjs +31 -5
  48. package/plugins/contextMenu/menu/menuItemRenderer.js +12 -0
  49. package/plugins/contextMenu/menu/menuItemRenderer.mjs +14 -2
  50. package/plugins/dropdownMenu/dropdownMenu.js +2 -1
  51. package/plugins/dropdownMenu/dropdownMenu.mjs +3 -2
  52. package/plugins/filters/ui/input.js +0 -3
  53. package/plugins/filters/ui/input.mjs +0 -3
  54. package/plugins/filters/ui/select.js +6 -0
  55. package/plugins/filters/ui/select.mjs +6 -0
  56. package/plugins/hiddenColumns/hiddenColumns.js +48 -3
  57. package/plugins/hiddenColumns/hiddenColumns.mjs +47 -2
  58. package/plugins/hiddenRows/hiddenRows.js +48 -3
  59. package/plugins/hiddenRows/hiddenRows.mjs +47 -2
  60. package/plugins/multiColumnSorting/multiColumnSorting.js +21 -0
  61. package/plugins/multiColumnSorting/multiColumnSorting.mjs +22 -1
  62. package/plugins/nestedRows/nestedRows.js +2 -1
  63. package/plugins/nestedRows/nestedRows.mjs +2 -1
  64. package/plugins/nestedRows/ui/headers.js +3 -3
  65. package/plugins/nestedRows/ui/headers.mjs +4 -4
@@ -1,6 +1,8 @@
1
1
  import { isItemSubMenu, isItemDisabled, isItemSelectionDisabled, isItemSeparator } from "./utils.mjs";
2
- import { addClass, empty, fastInnerHTML, setAttribute } from "../../../helpers/dom/element.mjs";
3
- import { A11Y_DISABLED, A11Y_EXPANDED, A11Y_LABEL, A11Y_MENU_ITEM, A11Y_TABINDEX } from "../../../helpers/a11y.mjs";
2
+ import { addClass, appendElement, empty, fastInnerHTML, setAttribute } from "../../../helpers/dom/element.mjs";
3
+ import { A11Y_DISABLED, A11Y_EXPANDED, A11Y_HIDDEN, A11Y_LABEL, A11Y_MENU_ITEM, A11Y_TABINDEX } from "../../../helpers/a11y.mjs";
4
+ const SUBMENU_INDICATOR_CLASSNAME = 'submenuIndicator';
5
+
4
6
  /**
5
7
  * Creates the menu renderer function.
6
8
  *
@@ -33,6 +35,16 @@ export function createMenuItemRenderer(mainTableHot) {
33
35
  const isFocusable = !isItemDisabled(item, mainTableHot) && !isItemSelectionDisabled(item) && !isItemSeparator(item);
34
36
  setAttribute(TD, [A11Y_MENU_ITEM(), A11Y_LABEL(itemValue), ...(isFocusable ? [A11Y_TABINDEX(-1)] : []), ...(isItemDisabled(item, mainTableHot) ? [A11Y_DISABLED()] : []), ...(isItemSubMenu(item) ? [A11Y_EXPANDED(false)] : [])]);
35
37
  }
38
+ if (isItemSubMenu(item)) {
39
+ const submenuIndicatorElement = TD.querySelector('.submenuIndicator');
40
+ if (!submenuIndicatorElement) {
41
+ appendElement(TD, {
42
+ tagName: 'div',
43
+ attributes: mainTableHot.getSettings().ariaTags ? [A11Y_HIDDEN()] : [],
44
+ className: SUBMENU_INDICATOR_CLASSNAME
45
+ });
46
+ }
47
+ }
36
48
  TD.className = '';
37
49
  TD.appendChild(wrapper);
38
50
  if (isItemSeparator(item)) {
@@ -13,6 +13,7 @@ var _itemsFactory = require("../contextMenu/itemsFactory");
13
13
  var _menu = require("../contextMenu/menu");
14
14
  var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
15
15
  var _predefinedItems = require("../contextMenu/predefinedItems");
16
+ var _constants = require("../../i18n/constants");
16
17
  var _a11y = require("../../helpers/a11y");
17
18
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
19
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
@@ -439,7 +440,7 @@ class DropdownMenu extends _base.BasePlugin {
439
440
  button.type = 'button';
440
441
  button.tabIndex = -1;
441
442
  if (this.hot.getSettings().ariaTags) {
442
- (0, _element.setAttribute)(button, [(0, _a11y.A11Y_HIDDEN)()]);
443
+ (0, _element.setAttribute)(button, [(0, _a11y.A11Y_LABEL)(this.hot.getTranslatedPhrase(_constants.COLUMN_HEADER_LABEL_OPEN_MENU))]);
443
444
  (0, _element.setAttribute)(TH, [(0, _a11y.A11Y_HASPOPUP)('menu')]);
444
445
  }
445
446
 
@@ -13,7 +13,8 @@ import { ItemsFactory } from "../contextMenu/itemsFactory.mjs";
13
13
  import { Menu } from "../contextMenu/menu/index.mjs";
14
14
  import Hooks from "../../pluginHooks.mjs";
15
15
  import { COLUMN_LEFT, COLUMN_RIGHT, REMOVE_COLUMN, CLEAR_COLUMN, READ_ONLY, ALIGNMENT, SEPARATOR } from "../contextMenu/predefinedItems/index.mjs";
16
- import { A11Y_HASPOPUP, A11Y_HIDDEN } from "../../helpers/a11y.mjs";
16
+ import { COLUMN_HEADER_LABEL_OPEN_MENU } from "../../i18n/constants.mjs";
17
+ import { A11Y_LABEL, A11Y_HASPOPUP } from "../../helpers/a11y.mjs";
17
18
  Hooks.getSingleton().register('afterDropdownMenuDefaultOptions');
18
19
  Hooks.getSingleton().register('beforeDropdownMenuShow');
19
20
  Hooks.getSingleton().register('afterDropdownMenuShow');
@@ -433,7 +434,7 @@ export class DropdownMenu extends BasePlugin {
433
434
  button.type = 'button';
434
435
  button.tabIndex = -1;
435
436
  if (this.hot.getSettings().ariaTags) {
436
- setAttribute(button, [A11Y_HIDDEN()]);
437
+ setAttribute(button, [A11Y_LABEL(this.hot.getTranslatedPhrase(COLUMN_HEADER_LABEL_OPEN_MENU))]);
437
438
  setAttribute(TH, [A11Y_HASPOPUP('menu')]);
438
439
  }
439
440
 
@@ -63,11 +63,8 @@ class InputUI extends _base.BaseUI {
63
63
  */
64
64
  build() {
65
65
  super.build();
66
- const icon = this.hot.rootDocument.createElement('div');
67
66
  _classPrivateFieldSet(this, _input, this._element.firstChild);
68
67
  (0, _element.addClass)(this._element, 'htUIInput');
69
- (0, _element.addClass)(icon, 'htUIInputIcon');
70
- this._element.appendChild(icon);
71
68
  this.update();
72
69
  }
73
70
 
@@ -60,11 +60,8 @@ export class InputUI extends BaseUI {
60
60
  */
61
61
  build() {
62
62
  super.build();
63
- const icon = this.hot.rootDocument.createElement('div');
64
63
  _classPrivateFieldSet(this, _input, this._element.firstChild);
65
64
  addClass(this._element, 'htUIInput');
66
- addClass(icon, 'htUIInputIcon');
67
- this._element.appendChild(icon);
68
65
  this.update();
69
66
  }
70
67
 
@@ -5,9 +5,11 @@ exports.__esModule = true;
5
5
  var _menu2 = require("../../../plugins/contextMenu/menu");
6
6
  var _object = require("../../../helpers/object");
7
7
  var _array = require("../../../helpers/array");
8
+ var _element = require("../../../helpers/dom/element");
8
9
  var C = _interopRequireWildcard(require("../../../i18n/constants"));
9
10
  var _predefinedItems = require("../../../plugins/contextMenu/predefinedItems");
10
11
  var _base = require("./_base");
12
+ var _a11y = require("../../../helpers/a11y");
11
13
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
14
  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; }
13
15
  function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
@@ -169,6 +171,10 @@ class SelectUI extends _base.BaseUI {
169
171
  _classPrivateFieldSet(this, _caption, caption);
170
172
  _classPrivateFieldSet(this, _captionElement, caption.element);
171
173
  _classPrivateFieldSet(this, _dropdown, dropdown);
174
+ if (this.hot.getSettings().ariaTags) {
175
+ (0, _element.setAttribute)(dropdown.element, [(0, _a11y.A11Y_HIDDEN)()]);
176
+ (0, _element.setAttribute)(this._element, [(0, _a11y.A11Y_LISTBOX)()]);
177
+ }
172
178
  (0, _array.arrayEach)([caption, dropdown], element => this._element.appendChild(element.element));
173
179
  _classPrivateFieldGet(this, _menu).addLocalHook('select', command => _classPrivateMethodGet(this, _onMenuSelect, _onMenuSelect2).call(this, command));
174
180
  _classPrivateFieldGet(this, _menu).addLocalHook('afterClose', () => _classPrivateMethodGet(this, _onMenuClosed, _onMenuClosed2).call(this));
@@ -11,9 +11,11 @@ function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) {
11
11
  import { Menu } from "../../../plugins/contextMenu/menu/index.mjs";
12
12
  import { clone, extend } from "../../../helpers/object.mjs";
13
13
  import { arrayEach } from "../../../helpers/array.mjs";
14
+ import { setAttribute } from "../../../helpers/dom/element.mjs";
14
15
  import * as C from "../../../i18n/constants.mjs";
15
16
  import { SEPARATOR } from "../../../plugins/contextMenu/predefinedItems/index.mjs";
16
17
  import { BaseUI } from "./_base.mjs";
18
+ import { A11Y_HIDDEN, A11Y_LISTBOX } from "../../../helpers/a11y.mjs";
17
19
  /**
18
20
  * @private
19
21
  * @class SelectUI
@@ -164,6 +166,10 @@ export class SelectUI extends BaseUI {
164
166
  _classPrivateFieldSet(this, _caption, caption);
165
167
  _classPrivateFieldSet(this, _captionElement, caption.element);
166
168
  _classPrivateFieldSet(this, _dropdown, dropdown);
169
+ if (this.hot.getSettings().ariaTags) {
170
+ setAttribute(dropdown.element, [A11Y_HIDDEN()]);
171
+ setAttribute(this._element, [A11Y_LISTBOX()]);
172
+ }
167
173
  arrayEach([caption, dropdown], element => this._element.appendChild(element.element));
168
174
  _classPrivateFieldGet(this, _menu).addLocalHook('select', command => _classPrivateMethodGet(this, _onMenuSelect, _onMenuSelect2).call(this, command));
169
175
  _classPrivateFieldGet(this, _menu).addLocalHook('afterClose', () => _classPrivateMethodGet(this, _onMenuClosed, _onMenuClosed2).call(this));
@@ -14,9 +14,13 @@ var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
14
14
  var _hideColumn = _interopRequireDefault(require("./contextMenuItem/hideColumn"));
15
15
  var _showColumn = _interopRequireDefault(require("./contextMenuItem/showColumn"));
16
16
  var _translations = require("../../translations");
17
+ var _a11y = require("../../helpers/a11y");
18
+ var _constants = require("../../i18n/constants");
17
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
18
21
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
19
22
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
23
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
20
24
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
21
25
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
22
26
  function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
@@ -29,6 +33,9 @@ _pluginHooks.default.getSingleton().register('afterUnhideColumns');
29
33
  const PLUGIN_KEY = 'hiddenColumns';
30
34
  exports.PLUGIN_KEY = PLUGIN_KEY;
31
35
  const PLUGIN_PRIORITY = 310;
36
+ exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
37
+ const BEFORE_INDICATOR_CLASSNAME = 'beforeHiddenColumnIndicator';
38
+ const AFTER_INDICATOR_CLASSNAME = 'afterHiddenColumnIndicator';
32
39
 
33
40
  /* eslint-disable jsdoc/require-description-complete-sentence */
34
41
 
@@ -136,12 +143,18 @@ const PLUGIN_PRIORITY = 310;
136
143
  * ```
137
144
  * :::
138
145
  */
139
- exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
140
146
  var _settings = /*#__PURE__*/new WeakMap();
141
147
  var _hiddenColumnsMap = /*#__PURE__*/new WeakMap();
148
+ var _clearIndicatorElements = /*#__PURE__*/new WeakSet();
142
149
  class HiddenColumns extends _base.BasePlugin {
143
150
  constructor() {
144
151
  super(...arguments);
152
+ /**
153
+ * Remove the indicator elements from the provided column header element.
154
+ *
155
+ * @param {HTMLElement} TH Column header element.
156
+ */
157
+ _classPrivateMethodInitSpec(this, _clearIndicatorElements);
145
158
  /**
146
159
  * Cached plugin settings.
147
160
  *
@@ -225,8 +238,15 @@ class HiddenColumns extends _base.BasePlugin {
225
238
  * Disables the plugin functionality for this Handsontable instance.
226
239
  */
227
240
  disablePlugin() {
241
+ const clearColHeader = (columnIndex, TH) => {
242
+ _classPrivateMethodGet(this, _clearIndicatorElements, _clearIndicatorElements2).call(this, TH);
243
+ };
228
244
  this.hot.columnIndexMapper.unregisterMap(this.pluginName);
229
245
  _classPrivateFieldSet(this, _settings, {});
246
+ this.hot.addHook('afterGetColHeader', clearColHeader);
247
+ this.hot.addHookOnce('afterViewRender', () => {
248
+ this.hot.removeHook('afterGetColHeader', clearColHeader);
249
+ });
230
250
  super.disablePlugin();
231
251
  this.resetCellsMeta();
232
252
  }
@@ -368,7 +388,6 @@ class HiddenColumns extends _base.BasePlugin {
368
388
  }
369
389
  });
370
390
  }
371
-
372
391
  /**
373
392
  * Adds the additional column width for the hidden column indicators.
374
393
  *
@@ -473,14 +492,35 @@ class HiddenColumns extends _base.BasePlugin {
473
492
  * @param {HTMLElement} TH Header's TH element.
474
493
  */
475
494
  onAfterGetColHeader(column, TH) {
495
+ const areAriaTagsEnabled = this.hot.getSettings().ariaTags;
496
+ const beforeHiddenColumnIndicatorElement = TH.querySelector('.beforeHiddenColumnIndicator');
497
+ const afterHiddenColumnIndicatorElement = TH.querySelector('.afterHiddenColumnIndicator');
476
498
  if (!_classPrivateFieldGet(this, _settings).indicators || column < 0) {
499
+ beforeHiddenColumnIndicatorElement === null || beforeHiddenColumnIndicatorElement === void 0 || beforeHiddenColumnIndicatorElement.remove();
500
+ afterHiddenColumnIndicatorElement === null || afterHiddenColumnIndicatorElement === void 0 || afterHiddenColumnIndicatorElement.remove();
477
501
  return;
478
502
  }
479
503
  const classList = [];
480
504
  if (column >= 1 && this.isHidden(column - 1)) {
505
+ if (!afterHiddenColumnIndicatorElement) {
506
+ const attributesToAdd = areAriaTagsEnabled ? [(0, _a11y.A11Y_LABEL)(this.hot.getTranslatedPhrase(_constants.COLUMN_HEADER_LABEL_AFTER_HIDDEN_COLUMN))] : [];
507
+ (0, _element.appendElement)(TH, {
508
+ tagName: 'div',
509
+ attributes: attributesToAdd,
510
+ className: AFTER_INDICATOR_CLASSNAME
511
+ });
512
+ }
481
513
  classList.push('afterHiddenColumn');
482
514
  }
483
515
  if (column < this.hot.countCols() - 1 && this.isHidden(column + 1)) {
516
+ if (!beforeHiddenColumnIndicatorElement) {
517
+ const attributesToAdd = areAriaTagsEnabled ? [(0, _a11y.A11Y_LABEL)(this.hot.getTranslatedPhrase(_constants.COLUMN_HEADER_LABEL_BEFORE_HIDDEN_COLUMN))] : [];
518
+ (0, _element.appendElement)(TH, {
519
+ tagName: 'div',
520
+ attributes: attributesToAdd,
521
+ className: BEFORE_INDICATOR_CLASSNAME
522
+ });
523
+ }
484
524
  classList.push('beforeHiddenColumn');
485
525
  }
486
526
  (0, _element.addClass)(TH, classList);
@@ -518,4 +558,9 @@ class HiddenColumns extends _base.BasePlugin {
518
558
  super.destroy();
519
559
  }
520
560
  }
521
- exports.HiddenColumns = HiddenColumns;
561
+ exports.HiddenColumns = HiddenColumns;
562
+ function _clearIndicatorElements2(TH) {
563
+ Array.from(TH.querySelectorAll(`.${AFTER_INDICATOR_CLASSNAME}, .${BEFORE_INDICATOR_CLASSNAME}`)).forEach(element => {
564
+ element.remove();
565
+ });
566
+ }
@@ -1,14 +1,16 @@
1
1
  import "core-js/modules/es.array.push.js";
2
2
  import "core-js/modules/es.error.cause.js";
3
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
3
4
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
4
5
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
6
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
5
7
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
6
8
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
7
9
  function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
8
10
  function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
9
11
  function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
10
12
  import { BasePlugin } from "../base/index.mjs";
11
- import { addClass } from "../../helpers/dom/element.mjs";
13
+ import { addClass, appendElement } from "../../helpers/dom/element.mjs";
12
14
  import { rangeEach } from "../../helpers/number.mjs";
13
15
  import { arrayEach, arrayMap, arrayReduce } from "../../helpers/array.mjs";
14
16
  import { isObject } from "../../helpers/object.mjs";
@@ -18,12 +20,16 @@ import Hooks from "../../pluginHooks.mjs";
18
20
  import hideColumnItem from "./contextMenuItem/hideColumn.mjs";
19
21
  import showColumnItem from "./contextMenuItem/showColumn.mjs";
20
22
  import { HidingMap } from "../../translations/index.mjs";
23
+ import { A11Y_LABEL } from "../../helpers/a11y.mjs";
24
+ import { COLUMN_HEADER_LABEL_AFTER_HIDDEN_COLUMN, COLUMN_HEADER_LABEL_BEFORE_HIDDEN_COLUMN } from "../../i18n/constants.mjs";
21
25
  Hooks.getSingleton().register('beforeHideColumns');
22
26
  Hooks.getSingleton().register('afterHideColumns');
23
27
  Hooks.getSingleton().register('beforeUnhideColumns');
24
28
  Hooks.getSingleton().register('afterUnhideColumns');
25
29
  export const PLUGIN_KEY = 'hiddenColumns';
26
30
  export const PLUGIN_PRIORITY = 310;
31
+ const BEFORE_INDICATOR_CLASSNAME = 'beforeHiddenColumnIndicator';
32
+ const AFTER_INDICATOR_CLASSNAME = 'afterHiddenColumnIndicator';
27
33
 
28
34
  /* eslint-disable jsdoc/require-description-complete-sentence */
29
35
 
@@ -133,9 +139,16 @@ export const PLUGIN_PRIORITY = 310;
133
139
  */
134
140
  var _settings = /*#__PURE__*/new WeakMap();
135
141
  var _hiddenColumnsMap = /*#__PURE__*/new WeakMap();
142
+ var _clearIndicatorElements = /*#__PURE__*/new WeakSet();
136
143
  export class HiddenColumns extends BasePlugin {
137
144
  constructor() {
138
145
  super(...arguments);
146
+ /**
147
+ * Remove the indicator elements from the provided column header element.
148
+ *
149
+ * @param {HTMLElement} TH Column header element.
150
+ */
151
+ _classPrivateMethodInitSpec(this, _clearIndicatorElements);
139
152
  /**
140
153
  * Cached plugin settings.
141
154
  *
@@ -219,8 +232,15 @@ export class HiddenColumns extends BasePlugin {
219
232
  * Disables the plugin functionality for this Handsontable instance.
220
233
  */
221
234
  disablePlugin() {
235
+ const clearColHeader = (columnIndex, TH) => {
236
+ _classPrivateMethodGet(this, _clearIndicatorElements, _clearIndicatorElements2).call(this, TH);
237
+ };
222
238
  this.hot.columnIndexMapper.unregisterMap(this.pluginName);
223
239
  _classPrivateFieldSet(this, _settings, {});
240
+ this.hot.addHook('afterGetColHeader', clearColHeader);
241
+ this.hot.addHookOnce('afterViewRender', () => {
242
+ this.hot.removeHook('afterGetColHeader', clearColHeader);
243
+ });
224
244
  super.disablePlugin();
225
245
  this.resetCellsMeta();
226
246
  }
@@ -362,7 +382,6 @@ export class HiddenColumns extends BasePlugin {
362
382
  }
363
383
  });
364
384
  }
365
-
366
385
  /**
367
386
  * Adds the additional column width for the hidden column indicators.
368
387
  *
@@ -467,14 +486,35 @@ export class HiddenColumns extends BasePlugin {
467
486
  * @param {HTMLElement} TH Header's TH element.
468
487
  */
469
488
  onAfterGetColHeader(column, TH) {
489
+ const areAriaTagsEnabled = this.hot.getSettings().ariaTags;
490
+ const beforeHiddenColumnIndicatorElement = TH.querySelector('.beforeHiddenColumnIndicator');
491
+ const afterHiddenColumnIndicatorElement = TH.querySelector('.afterHiddenColumnIndicator');
470
492
  if (!_classPrivateFieldGet(this, _settings).indicators || column < 0) {
493
+ beforeHiddenColumnIndicatorElement === null || beforeHiddenColumnIndicatorElement === void 0 || beforeHiddenColumnIndicatorElement.remove();
494
+ afterHiddenColumnIndicatorElement === null || afterHiddenColumnIndicatorElement === void 0 || afterHiddenColumnIndicatorElement.remove();
471
495
  return;
472
496
  }
473
497
  const classList = [];
474
498
  if (column >= 1 && this.isHidden(column - 1)) {
499
+ if (!afterHiddenColumnIndicatorElement) {
500
+ const attributesToAdd = areAriaTagsEnabled ? [A11Y_LABEL(this.hot.getTranslatedPhrase(COLUMN_HEADER_LABEL_AFTER_HIDDEN_COLUMN))] : [];
501
+ appendElement(TH, {
502
+ tagName: 'div',
503
+ attributes: attributesToAdd,
504
+ className: AFTER_INDICATOR_CLASSNAME
505
+ });
506
+ }
475
507
  classList.push('afterHiddenColumn');
476
508
  }
477
509
  if (column < this.hot.countCols() - 1 && this.isHidden(column + 1)) {
510
+ if (!beforeHiddenColumnIndicatorElement) {
511
+ const attributesToAdd = areAriaTagsEnabled ? [A11Y_LABEL(this.hot.getTranslatedPhrase(COLUMN_HEADER_LABEL_BEFORE_HIDDEN_COLUMN))] : [];
512
+ appendElement(TH, {
513
+ tagName: 'div',
514
+ attributes: attributesToAdd,
515
+ className: BEFORE_INDICATOR_CLASSNAME
516
+ });
517
+ }
478
518
  classList.push('beforeHiddenColumn');
479
519
  }
480
520
  addClass(TH, classList);
@@ -511,4 +551,9 @@ export class HiddenColumns extends BasePlugin {
511
551
  _classPrivateFieldSet(this, _hiddenColumnsMap, null);
512
552
  super.destroy();
513
553
  }
554
+ }
555
+ function _clearIndicatorElements2(TH) {
556
+ Array.from(TH.querySelectorAll(`.${AFTER_INDICATOR_CLASSNAME}, .${BEFORE_INDICATOR_CLASSNAME}`)).forEach(element => {
557
+ element.remove();
558
+ });
514
559
  }
@@ -14,9 +14,13 @@ var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
14
14
  var _hideRow = _interopRequireDefault(require("./contextMenuItem/hideRow"));
15
15
  var _showRow = _interopRequireDefault(require("./contextMenuItem/showRow"));
16
16
  var _translations = require("../../translations");
17
+ var _a11y = require("../../helpers/a11y");
18
+ var _constants = require("../../i18n/constants");
17
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
18
21
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
19
22
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
23
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
20
24
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
21
25
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
22
26
  function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
@@ -29,6 +33,9 @@ _pluginHooks.default.getSingleton().register('afterUnhideRows');
29
33
  const PLUGIN_KEY = 'hiddenRows';
30
34
  exports.PLUGIN_KEY = PLUGIN_KEY;
31
35
  const PLUGIN_PRIORITY = 320;
36
+ exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
37
+ const AFTER_INDICATOR_CLASSNAME = 'afterHiddenRowIndicator';
38
+ const BEFORE_INDICATOR_CLASSNAME = 'beforeHiddenRowIndicator';
32
39
 
33
40
  /* eslint-disable jsdoc/require-description-complete-sentence */
34
41
 
@@ -136,12 +143,18 @@ const PLUGIN_PRIORITY = 320;
136
143
  * ```
137
144
  * :::
138
145
  */
139
- exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
140
146
  var _settings = /*#__PURE__*/new WeakMap();
141
147
  var _hiddenRowsMap = /*#__PURE__*/new WeakMap();
148
+ var _clearIndicatorElements = /*#__PURE__*/new WeakSet();
142
149
  class HiddenRows extends _base.BasePlugin {
143
150
  constructor() {
144
151
  super(...arguments);
152
+ /**
153
+ * Remove the indicator elements from the provided row header element.
154
+ *
155
+ * @param {HTMLElement} TH Column header element.
156
+ */
157
+ _classPrivateMethodInitSpec(this, _clearIndicatorElements);
145
158
  /**
146
159
  * Cached settings from Handsontable settings.
147
160
  *
@@ -225,8 +238,15 @@ class HiddenRows extends _base.BasePlugin {
225
238
  * Disables the plugin functionality for this Handsontable instance.
226
239
  */
227
240
  disablePlugin() {
241
+ const clearRowHeader = (columnIndex, TH) => {
242
+ _classPrivateMethodGet(this, _clearIndicatorElements, _clearIndicatorElements2).call(this, TH);
243
+ };
228
244
  this.hot.rowIndexMapper.unregisterMap(this.pluginName);
229
245
  _classPrivateFieldSet(this, _settings, {});
246
+ this.hot.addHook('afterGetRowHeader', clearRowHeader);
247
+ this.hot.addHookOnce('afterViewRender', () => {
248
+ this.hot.removeHook('afterGetRowHeader', clearRowHeader);
249
+ });
230
250
  super.disablePlugin();
231
251
  this.resetCellsMeta();
232
252
  }
@@ -365,7 +385,6 @@ class HiddenRows extends _base.BasePlugin {
365
385
  }
366
386
  });
367
387
  }
368
-
369
388
  /**
370
389
  * Adds the additional row height for the hidden row indicators.
371
390
  *
@@ -465,14 +484,35 @@ class HiddenRows extends _base.BasePlugin {
465
484
  * @param {HTMLElement} TH Header's TH element.
466
485
  */
467
486
  onAfterGetRowHeader(row, TH) {
487
+ const areAriaTagsEnabled = this.hot.getSettings().ariaTags;
488
+ const beforeHiddenRowIndicatorElement = TH.querySelector('.beforeHiddenRowIndicator');
489
+ const afterHiddenRowIndicatorElement = TH.querySelector('.afterHiddenRowIndicator');
468
490
  if (!_classPrivateFieldGet(this, _settings).indicators || row < 0) {
491
+ beforeHiddenRowIndicatorElement === null || beforeHiddenRowIndicatorElement === void 0 || beforeHiddenRowIndicatorElement.remove();
492
+ afterHiddenRowIndicatorElement === null || afterHiddenRowIndicatorElement === void 0 || afterHiddenRowIndicatorElement.remove();
469
493
  return;
470
494
  }
471
495
  const classList = [];
472
496
  if (row >= 1 && this.isHidden(row - 1)) {
497
+ if (!afterHiddenRowIndicatorElement) {
498
+ const attributesToAdd = areAriaTagsEnabled ? [(0, _a11y.A11Y_LABEL)(this.hot.getTranslatedPhrase(_constants.ROW_HEADER_LABEL_AFTER_HIDDEN_ROW))] : [];
499
+ (0, _element.appendElement)(TH, {
500
+ tagName: 'div',
501
+ attributes: attributesToAdd,
502
+ className: AFTER_INDICATOR_CLASSNAME
503
+ });
504
+ }
473
505
  classList.push('afterHiddenRow');
474
506
  }
475
507
  if (row < this.hot.countRows() - 1 && this.isHidden(row + 1)) {
508
+ if (!beforeHiddenRowIndicatorElement) {
509
+ const attributesToAdd = areAriaTagsEnabled ? [(0, _a11y.A11Y_LABEL)(this.hot.getTranslatedPhrase(_constants.ROW_HEADER_LABEL_BEFORE_HIDDEN_ROW))] : [];
510
+ (0, _element.appendElement)(TH, {
511
+ tagName: 'div',
512
+ attributes: attributesToAdd,
513
+ className: BEFORE_INDICATOR_CLASSNAME
514
+ });
515
+ }
476
516
  classList.push('beforeHiddenRow');
477
517
  }
478
518
  (0, _element.addClass)(TH, classList);
@@ -510,4 +550,9 @@ class HiddenRows extends _base.BasePlugin {
510
550
  super.destroy();
511
551
  }
512
552
  }
513
- exports.HiddenRows = HiddenRows;
553
+ exports.HiddenRows = HiddenRows;
554
+ function _clearIndicatorElements2(TH) {
555
+ Array.from(TH.querySelectorAll(`.${AFTER_INDICATOR_CLASSNAME}, .${BEFORE_INDICATOR_CLASSNAME}`)).forEach(element => {
556
+ element.remove();
557
+ });
558
+ }
@@ -1,14 +1,16 @@
1
1
  import "core-js/modules/es.array.push.js";
2
2
  import "core-js/modules/es.error.cause.js";
3
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
3
4
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
4
5
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
6
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
5
7
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
6
8
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
7
9
  function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
8
10
  function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
9
11
  function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
10
12
  import { BasePlugin } from "../base/index.mjs";
11
- import { addClass } from "../../helpers/dom/element.mjs";
13
+ import { addClass, appendElement } from "../../helpers/dom/element.mjs";
12
14
  import { rangeEach } from "../../helpers/number.mjs";
13
15
  import { arrayEach, arrayMap, arrayReduce } from "../../helpers/array.mjs";
14
16
  import { isObject } from "../../helpers/object.mjs";
@@ -18,12 +20,16 @@ import Hooks from "../../pluginHooks.mjs";
18
20
  import hideRowItem from "./contextMenuItem/hideRow.mjs";
19
21
  import showRowItem from "./contextMenuItem/showRow.mjs";
20
22
  import { HidingMap } from "../../translations/index.mjs";
23
+ import { A11Y_LABEL } from "../../helpers/a11y.mjs";
24
+ import { ROW_HEADER_LABEL_AFTER_HIDDEN_ROW, ROW_HEADER_LABEL_BEFORE_HIDDEN_ROW } from "../../i18n/constants.mjs";
21
25
  Hooks.getSingleton().register('beforeHideRows');
22
26
  Hooks.getSingleton().register('afterHideRows');
23
27
  Hooks.getSingleton().register('beforeUnhideRows');
24
28
  Hooks.getSingleton().register('afterUnhideRows');
25
29
  export const PLUGIN_KEY = 'hiddenRows';
26
30
  export const PLUGIN_PRIORITY = 320;
31
+ const AFTER_INDICATOR_CLASSNAME = 'afterHiddenRowIndicator';
32
+ const BEFORE_INDICATOR_CLASSNAME = 'beforeHiddenRowIndicator';
27
33
 
28
34
  /* eslint-disable jsdoc/require-description-complete-sentence */
29
35
 
@@ -133,9 +139,16 @@ export const PLUGIN_PRIORITY = 320;
133
139
  */
134
140
  var _settings = /*#__PURE__*/new WeakMap();
135
141
  var _hiddenRowsMap = /*#__PURE__*/new WeakMap();
142
+ var _clearIndicatorElements = /*#__PURE__*/new WeakSet();
136
143
  export class HiddenRows extends BasePlugin {
137
144
  constructor() {
138
145
  super(...arguments);
146
+ /**
147
+ * Remove the indicator elements from the provided row header element.
148
+ *
149
+ * @param {HTMLElement} TH Column header element.
150
+ */
151
+ _classPrivateMethodInitSpec(this, _clearIndicatorElements);
139
152
  /**
140
153
  * Cached settings from Handsontable settings.
141
154
  *
@@ -219,8 +232,15 @@ export class HiddenRows extends BasePlugin {
219
232
  * Disables the plugin functionality for this Handsontable instance.
220
233
  */
221
234
  disablePlugin() {
235
+ const clearRowHeader = (columnIndex, TH) => {
236
+ _classPrivateMethodGet(this, _clearIndicatorElements, _clearIndicatorElements2).call(this, TH);
237
+ };
222
238
  this.hot.rowIndexMapper.unregisterMap(this.pluginName);
223
239
  _classPrivateFieldSet(this, _settings, {});
240
+ this.hot.addHook('afterGetRowHeader', clearRowHeader);
241
+ this.hot.addHookOnce('afterViewRender', () => {
242
+ this.hot.removeHook('afterGetRowHeader', clearRowHeader);
243
+ });
224
244
  super.disablePlugin();
225
245
  this.resetCellsMeta();
226
246
  }
@@ -359,7 +379,6 @@ export class HiddenRows extends BasePlugin {
359
379
  }
360
380
  });
361
381
  }
362
-
363
382
  /**
364
383
  * Adds the additional row height for the hidden row indicators.
365
384
  *
@@ -459,14 +478,35 @@ export class HiddenRows extends BasePlugin {
459
478
  * @param {HTMLElement} TH Header's TH element.
460
479
  */
461
480
  onAfterGetRowHeader(row, TH) {
481
+ const areAriaTagsEnabled = this.hot.getSettings().ariaTags;
482
+ const beforeHiddenRowIndicatorElement = TH.querySelector('.beforeHiddenRowIndicator');
483
+ const afterHiddenRowIndicatorElement = TH.querySelector('.afterHiddenRowIndicator');
462
484
  if (!_classPrivateFieldGet(this, _settings).indicators || row < 0) {
485
+ beforeHiddenRowIndicatorElement === null || beforeHiddenRowIndicatorElement === void 0 || beforeHiddenRowIndicatorElement.remove();
486
+ afterHiddenRowIndicatorElement === null || afterHiddenRowIndicatorElement === void 0 || afterHiddenRowIndicatorElement.remove();
463
487
  return;
464
488
  }
465
489
  const classList = [];
466
490
  if (row >= 1 && this.isHidden(row - 1)) {
491
+ if (!afterHiddenRowIndicatorElement) {
492
+ const attributesToAdd = areAriaTagsEnabled ? [A11Y_LABEL(this.hot.getTranslatedPhrase(ROW_HEADER_LABEL_AFTER_HIDDEN_ROW))] : [];
493
+ appendElement(TH, {
494
+ tagName: 'div',
495
+ attributes: attributesToAdd,
496
+ className: AFTER_INDICATOR_CLASSNAME
497
+ });
498
+ }
467
499
  classList.push('afterHiddenRow');
468
500
  }
469
501
  if (row < this.hot.countRows() - 1 && this.isHidden(row + 1)) {
502
+ if (!beforeHiddenRowIndicatorElement) {
503
+ const attributesToAdd = areAriaTagsEnabled ? [A11Y_LABEL(this.hot.getTranslatedPhrase(ROW_HEADER_LABEL_BEFORE_HIDDEN_ROW))] : [];
504
+ appendElement(TH, {
505
+ tagName: 'div',
506
+ attributes: attributesToAdd,
507
+ className: BEFORE_INDICATOR_CLASSNAME
508
+ });
509
+ }
470
510
  classList.push('beforeHiddenRow');
471
511
  }
472
512
  addClass(TH, classList);
@@ -503,4 +543,9 @@ export class HiddenRows extends BasePlugin {
503
543
  _classPrivateFieldSet(this, _hiddenRowsMap, null);
504
544
  super.destroy();
505
545
  }
546
+ }
547
+ function _clearIndicatorElements2(TH) {
548
+ Array.from(TH.querySelectorAll(`.${AFTER_INDICATOR_CLASSNAME}, .${BEFORE_INDICATOR_CLASSNAME}`)).forEach(element => {
549
+ element.remove();
550
+ });
506
551
  }
@@ -8,6 +8,8 @@ var _element = require("../../helpers/dom/element");
8
8
  var _rootComparator = require("./rootComparator");
9
9
  var _utils2 = require("./utils");
10
10
  var _domHelpers = require("./domHelpers");
11
+ var _a11y = require("../../helpers/a11y");
12
+ var _constants = require("../../i18n/constants");
11
13
  const PLUGIN_KEY = 'multiColumnSorting';
12
14
  exports.PLUGIN_KEY = PLUGIN_KEY;
13
15
  const PLUGIN_PRIORITY = 170;
@@ -268,6 +270,25 @@ class MultiColumnSorting extends _columnSorting.ColumnSorting {
268
270
  }
269
271
  }
270
272
 
273
+ /**
274
+ * Update sorting indicator.
275
+ *
276
+ * @private
277
+ * @param {number} column Visual column index.
278
+ * @param {HTMLElement} headerSpanElement Header span element.
279
+ */
280
+ updateSortingIndicator(column, headerSpanElement) {
281
+ super.updateSortingIndicator(column, headerSpanElement);
282
+ const indicatorElement = headerSpanElement.querySelector('.columnSortingIndicator');
283
+ if (!indicatorElement || !this.hot.getSettings().ariaTags || !this.columnStatesManager.isColumnSorted(column) || this.columnStatesManager.getNumberOfSortedColumns() <= 1) {
284
+ return;
285
+ }
286
+ const multiColumnSortingOrder = this.columnStatesManager.getIndexOfColumnInSortQueue(column) + 1;
287
+ const a11yLabelAttribute = (0, _a11y.A11Y_LABEL)(`${this.hot.getTranslatedPhrase(_constants.COLUMN_HEADER_LABEL_MULTI_COLUMN_SORT_ORDER)} ${multiColumnSortingOrder}.`);
288
+ (0, _element.removeAttribute)(indicatorElement, (0, _a11y.A11Y_HIDDEN)()[0]);
289
+ (0, _element.setAttribute)(indicatorElement, ...a11yLabelAttribute);
290
+ }
291
+
271
292
  /**
272
293
  * Overwriting base plugin's `onUpdateSettings` method. Please keep in mind that `onAfterUpdateSettings` isn't called
273
294
  * for `updateSettings` in specific situations.