handsontable 14.0.0-next-dd92f79-20231124 → 14.0.0-next-88de277-20231127

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. package/3rdparty/walkontable/src/overlay/_base.js +2 -2
  2. package/3rdparty/walkontable/src/overlay/_base.mjs +2 -2
  3. package/3rdparty/walkontable/src/renderer/columnHeaders.js +1 -1
  4. package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +2 -2
  5. package/3rdparty/walkontable/src/renderer/rows.js +1 -1
  6. package/3rdparty/walkontable/src/renderer/rows.mjs +2 -2
  7. package/3rdparty/walkontable/src/selection/manager.js +20 -6
  8. package/3rdparty/walkontable/src/selection/manager.mjs +20 -6
  9. package/base.js +2 -2
  10. package/base.mjs +2 -2
  11. package/core.js +1 -1
  12. package/core.mjs +1 -1
  13. package/dataMap/replaceData.js +3 -1
  14. package/dataMap/replaceData.mjs +3 -1
  15. package/dist/handsontable.css +62 -44
  16. package/dist/handsontable.full.css +62 -44
  17. package/dist/handsontable.full.js +123 -302
  18. package/dist/handsontable.full.min.css +5 -5
  19. package/dist/handsontable.full.min.js +64 -64
  20. package/dist/handsontable.js +123 -302
  21. package/dist/handsontable.min.css +5 -5
  22. package/dist/handsontable.min.js +19 -19
  23. package/dist/languages/all.js +2 -24
  24. package/dist/languages/all.min.js +1 -1
  25. package/dist/languages/en-US.js +1 -12
  26. package/dist/languages/en-US.min.js +1 -1
  27. package/dist/languages/pl-PL.js +1 -12
  28. package/dist/languages/pl-PL.min.js +1 -1
  29. package/editors/dateEditor/dateEditor.js +0 -7
  30. package/editors/dateEditor/dateEditor.mjs +1 -8
  31. package/editors/handsontableEditor/handsontableEditor.js +0 -7
  32. package/editors/handsontableEditor/handsontableEditor.mjs +1 -8
  33. package/editors/passwordEditor/passwordEditor.js +4 -0
  34. package/editors/passwordEditor/passwordEditor.mjs +5 -1
  35. package/helpers/a11y.js +2 -2
  36. package/helpers/a11y.mjs +1 -1
  37. package/helpers/dom/element.js +0 -29
  38. package/helpers/dom/element.mjs +0 -28
  39. package/helpers/mixed.js +2 -2
  40. package/helpers/mixed.mjs +2 -2
  41. package/i18n/constants.js +1 -14
  42. package/i18n/constants.mjs +1 -14
  43. package/i18n/languages/en-US.js +1 -12
  44. package/i18n/languages/en-US.mjs +1 -12
  45. package/i18n/languages/pl-PL.js +1 -12
  46. package/i18n/languages/pl-PL.mjs +1 -12
  47. package/languages/all.js +2 -24
  48. package/languages/en-US.js +1 -12
  49. package/languages/en-US.mjs +1 -12
  50. package/languages/index.js +2 -24
  51. package/languages/pl-PL.js +1 -12
  52. package/languages/pl-PL.mjs +1 -12
  53. package/package.json +1 -1
  54. package/plugins/collapsibleColumns/collapsibleColumns.js +2 -3
  55. package/plugins/collapsibleColumns/collapsibleColumns.mjs +3 -4
  56. package/plugins/columnSorting/columnSorting.js +4 -30
  57. package/plugins/columnSorting/columnSorting.mjs +6 -32
  58. package/plugins/contextMenu/menu/menuItemRenderer.js +0 -12
  59. package/plugins/contextMenu/menu/menuItemRenderer.mjs +2 -14
  60. package/plugins/dropdownMenu/dropdownMenu.js +1 -2
  61. package/plugins/dropdownMenu/dropdownMenu.mjs +2 -3
  62. package/plugins/filters/ui/input.js +3 -0
  63. package/plugins/filters/ui/input.mjs +3 -0
  64. package/plugins/hiddenColumns/hiddenColumns.js +0 -44
  65. package/plugins/hiddenColumns/hiddenColumns.mjs +1 -45
  66. package/plugins/hiddenRows/hiddenRows.js +0 -44
  67. package/plugins/hiddenRows/hiddenRows.mjs +1 -45
  68. package/plugins/multiColumnSorting/multiColumnSorting.js +0 -21
  69. package/plugins/multiColumnSorting/multiColumnSorting.mjs +1 -22
  70. package/plugins/nestedRows/nestedRows.js +1 -2
  71. package/plugins/nestedRows/nestedRows.mjs +1 -2
  72. package/plugins/nestedRows/ui/headers.js +3 -3
  73. package/plugins/nestedRows/ui/headers.mjs +4 -4
  74. package/renderers/autocompleteRenderer/autocompleteRenderer.js +0 -3
  75. package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +1 -4
  76. package/renderers/checkboxRenderer/checkboxRenderer.js +0 -1
  77. package/renderers/checkboxRenderer/checkboxRenderer.mjs +0 -1
  78. package/renderers/dateRenderer/dateRenderer.js +0 -5
  79. package/renderers/dateRenderer/dateRenderer.mjs +0 -5
  80. package/renderers/handsontableRenderer/handsontableRenderer.js +0 -5
  81. package/renderers/handsontableRenderer/handsontableRenderer.mjs +0 -5
  82. package/renderers/selectRenderer/selectRenderer.js +0 -5
  83. package/renderers/selectRenderer/selectRenderer.mjs +0 -5
  84. package/selection/highlight/types/focus.js +2 -0
  85. package/selection/highlight/types/focus.mjs +2 -0
  86. package/selection/selection.js +0 -1
  87. package/selection/selection.mjs +0 -1
  88. package/tableView.js +35 -2
  89. package/tableView.mjs +35 -2
@@ -10,7 +10,7 @@ function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _
10
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); }
11
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; } }
12
12
  import { BasePlugin } from "../base/index.mjs";
13
- import { addClass, appendElement } from "../../helpers/dom/element.mjs";
13
+ import { addClass } from "../../helpers/dom/element.mjs";
14
14
  import { rangeEach } from "../../helpers/number.mjs";
15
15
  import { arrayEach, arrayMap, arrayReduce } from "../../helpers/array.mjs";
16
16
  import { isObject } from "../../helpers/object.mjs";
@@ -20,16 +20,12 @@ import Hooks from "../../pluginHooks.mjs";
20
20
  import hideRowItem from "./contextMenuItem/hideRow.mjs";
21
21
  import showRowItem from "./contextMenuItem/showRow.mjs";
22
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";
25
23
  Hooks.getSingleton().register('beforeHideRows');
26
24
  Hooks.getSingleton().register('afterHideRows');
27
25
  Hooks.getSingleton().register('beforeUnhideRows');
28
26
  Hooks.getSingleton().register('afterUnhideRows');
29
27
  export const PLUGIN_KEY = 'hiddenRows';
30
28
  export const PLUGIN_PRIORITY = 320;
31
- const AFTER_INDICATOR_CLASSNAME = 'afterHiddenRowIndicator';
32
- const BEFORE_INDICATOR_CLASSNAME = 'beforeHiddenRowIndicator';
33
29
 
34
30
  /* eslint-disable jsdoc/require-description-complete-sentence */
35
31
 
@@ -139,7 +135,6 @@ const BEFORE_INDICATOR_CLASSNAME = 'beforeHiddenRowIndicator';
139
135
  */
140
136
  var _settings = /*#__PURE__*/new WeakMap();
141
137
  var _hiddenRowsMap = /*#__PURE__*/new WeakMap();
142
- var _clearIndicatorElements = /*#__PURE__*/new WeakSet();
143
138
  var _onModifyRowHeight = /*#__PURE__*/new WeakSet();
144
139
  var _onAfterGetCellMeta = /*#__PURE__*/new WeakSet();
145
140
  var _onModifyCopyableRange = /*#__PURE__*/new WeakSet();
@@ -189,12 +184,6 @@ export class HiddenRows extends BasePlugin {
189
184
  * @returns {number}
190
185
  */
191
186
  _classPrivateMethodInitSpec(this, _onModifyRowHeight);
192
- /**
193
- * Remove the indicator elements from the provided row header element.
194
- *
195
- * @param {HTMLElement} TH Column header element.
196
- */
197
- _classPrivateMethodInitSpec(this, _clearIndicatorElements);
198
187
  /**
199
188
  * Cached settings from Handsontable settings.
200
189
  *
@@ -284,15 +273,8 @@ export class HiddenRows extends BasePlugin {
284
273
  * Disables the plugin functionality for this Handsontable instance.
285
274
  */
286
275
  disablePlugin() {
287
- const clearRowHeader = (columnIndex, TH) => {
288
- _classPrivateMethodGet(this, _clearIndicatorElements, _clearIndicatorElements2).call(this, TH);
289
- };
290
276
  this.hot.rowIndexMapper.unregisterMap(this.pluginName);
291
277
  _classPrivateFieldSet(this, _settings, {});
292
- this.hot.addHook('afterGetRowHeader', clearRowHeader);
293
- this.hot.addHookOnce('afterViewRender', () => {
294
- this.hot.removeHook('afterGetRowHeader', clearRowHeader);
295
- });
296
278
  super.disablePlugin();
297
279
  this.resetCellsMeta();
298
280
  }
@@ -440,11 +422,6 @@ export class HiddenRows extends BasePlugin {
440
422
  super.destroy();
441
423
  }
442
424
  }
443
- function _clearIndicatorElements2(TH) {
444
- Array.from(TH.querySelectorAll(`.${AFTER_INDICATOR_CLASSNAME}, .${BEFORE_INDICATOR_CLASSNAME}`)).forEach(element => {
445
- element.remove();
446
- });
447
- }
448
425
  function _onModifyRowHeight2(height, row) {
449
426
  // Hook is triggered internally only for the visible rows. Conditional will be handled for the API
450
427
  // calls of the `getRowHeight` function on not visible indexes.
@@ -511,35 +488,14 @@ function _onModifyCopyableRange2(ranges) {
511
488
  return newRanges;
512
489
  }
513
490
  function _onAfterGetRowHeader2(row, TH) {
514
- const areAriaTagsEnabled = this.hot.getSettings().ariaTags;
515
- const beforeHiddenRowIndicatorElement = TH.querySelector('.beforeHiddenRowIndicator');
516
- const afterHiddenRowIndicatorElement = TH.querySelector('.afterHiddenRowIndicator');
517
491
  if (!_classPrivateFieldGet(this, _settings).indicators || row < 0) {
518
- beforeHiddenRowIndicatorElement === null || beforeHiddenRowIndicatorElement === void 0 || beforeHiddenRowIndicatorElement.remove();
519
- afterHiddenRowIndicatorElement === null || afterHiddenRowIndicatorElement === void 0 || afterHiddenRowIndicatorElement.remove();
520
492
  return;
521
493
  }
522
494
  const classList = [];
523
495
  if (row >= 1 && this.isHidden(row - 1)) {
524
- if (!afterHiddenRowIndicatorElement) {
525
- const attributesToAdd = areAriaTagsEnabled ? [A11Y_LABEL(this.hot.getTranslatedPhrase(ROW_HEADER_LABEL_AFTER_HIDDEN_ROW))] : [];
526
- appendElement(TH, {
527
- tagName: 'div',
528
- attributes: attributesToAdd,
529
- className: AFTER_INDICATOR_CLASSNAME
530
- });
531
- }
532
496
  classList.push('afterHiddenRow');
533
497
  }
534
498
  if (row < this.hot.countRows() - 1 && this.isHidden(row + 1)) {
535
- if (!beforeHiddenRowIndicatorElement) {
536
- const attributesToAdd = areAriaTagsEnabled ? [A11Y_LABEL(this.hot.getTranslatedPhrase(ROW_HEADER_LABEL_BEFORE_HIDDEN_ROW))] : [];
537
- appendElement(TH, {
538
- tagName: 'div',
539
- attributes: attributesToAdd,
540
- className: BEFORE_INDICATOR_CLASSNAME
541
- });
542
- }
543
499
  classList.push('beforeHiddenRow');
544
500
  }
545
501
  addClass(TH, classList);
@@ -9,8 +9,6 @@ var _element = require("../../helpers/dom/element");
9
9
  var _rootComparator = require("./rootComparator");
10
10
  var _utils2 = require("./utils");
11
11
  var _domHelpers = require("./domHelpers");
12
- var _a11y = require("../../helpers/a11y");
13
- var _constants = require("../../i18n/constants");
14
12
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
15
13
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
16
14
  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); }
@@ -272,25 +270,6 @@ class MultiColumnSorting extends _columnSorting.ColumnSorting {
272
270
  }
273
271
  }
274
272
 
275
- /**
276
- * Update sorting indicator.
277
- *
278
- * @private
279
- * @param {number} column Visual column index.
280
- * @param {HTMLElement} headerSpanElement Header span element.
281
- */
282
- updateSortingIndicator(column, headerSpanElement) {
283
- super.updateSortingIndicator(column, headerSpanElement);
284
- const indicatorElement = headerSpanElement.querySelector('.columnSortingIndicator');
285
- if (!indicatorElement || !this.hot.getSettings().ariaTags || !this.columnStatesManager.isColumnSorted(column) || this.columnStatesManager.getNumberOfSortedColumns() <= 1) {
286
- return;
287
- }
288
- const multiColumnSortingOrder = this.columnStatesManager.getIndexOfColumnInSortQueue(column) + 1;
289
- const a11yLabelAttribute = (0, _a11y.A11Y_LABEL)(`${this.hot.getTranslatedPhrase(_constants.COLUMN_HEADER_LABEL_MULTI_COLUMN_SORT_ORDER)} ${multiColumnSortingOrder}.`);
290
- (0, _element.removeAttribute)(indicatorElement, (0, _a11y.A11Y_HIDDEN)()[0]);
291
- (0, _element.setAttribute)(indicatorElement, ...a11yLabelAttribute);
292
- }
293
-
294
273
  /**
295
274
  * Overwriting base plugin's `onUpdateSettings` method. Please keep in mind that `onAfterUpdateSettings` isn't called
296
275
  * for `updateSettings` in specific situations.
@@ -5,12 +5,10 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
5
5
  import { APPEND_COLUMN_CONFIG_STRATEGY, ColumnSorting } from "../columnSorting/index.mjs";
6
6
  import { registerRootComparator } from "../columnSorting/sortService/index.mjs";
7
7
  import { wasHeaderClickedProperly } from "../columnSorting/utils.mjs";
8
- import { addClass, removeClass, setAttribute, removeAttribute } from "../../helpers/dom/element.mjs";
8
+ import { addClass, removeClass } from "../../helpers/dom/element.mjs";
9
9
  import { rootComparator } from "./rootComparator.mjs";
10
10
  import { warnAboutPluginsConflict } from "./utils.mjs";
11
11
  import { getClassesToAdd, getClassesToRemove } from "./domHelpers.mjs";
12
- import { A11Y_HIDDEN, A11Y_LABEL } from "../../helpers/a11y.mjs";
13
- import { COLUMN_HEADER_LABEL_MULTI_COLUMN_SORT_ORDER } from "../../i18n/constants.mjs";
14
12
  export const PLUGIN_KEY = 'multiColumnSorting';
15
13
  export const PLUGIN_PRIORITY = 170;
16
14
  const CONFLICTED_PLUGIN_KEY = 'columnSorting';
@@ -269,25 +267,6 @@ export class MultiColumnSorting extends ColumnSorting {
269
267
  }
270
268
  }
271
269
 
272
- /**
273
- * Update sorting indicator.
274
- *
275
- * @private
276
- * @param {number} column Visual column index.
277
- * @param {HTMLElement} headerSpanElement Header span element.
278
- */
279
- updateSortingIndicator(column, headerSpanElement) {
280
- super.updateSortingIndicator(column, headerSpanElement);
281
- const indicatorElement = headerSpanElement.querySelector('.columnSortingIndicator');
282
- if (!indicatorElement || !this.hot.getSettings().ariaTags || !this.columnStatesManager.isColumnSorted(column) || this.columnStatesManager.getNumberOfSortedColumns() <= 1) {
283
- return;
284
- }
285
- const multiColumnSortingOrder = this.columnStatesManager.getIndexOfColumnInSortQueue(column) + 1;
286
- const a11yLabelAttribute = A11Y_LABEL(`${this.hot.getTranslatedPhrase(COLUMN_HEADER_LABEL_MULTI_COLUMN_SORT_ORDER)} ${multiColumnSortingOrder}.`);
287
- removeAttribute(indicatorElement, A11Y_HIDDEN()[0]);
288
- setAttribute(indicatorElement, ...a11yLabelAttribute);
289
- }
290
-
291
270
  /**
292
271
  * Overwriting base plugin's `onUpdateSettings` method. Please keep in mind that `onAfterUpdateSettings` isn't called
293
272
  * for `updateSettings` in specific situations.
@@ -365,8 +365,7 @@ class NestedRows extends _base.BasePlugin {
365
365
  /**
366
366
  * Updates the plugin's state.
367
367
  *
368
- * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the
369
- * following configuration options:
368
+ * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:
370
369
  * - [`nestedRows`](@/api/options.md#nestedrows)
371
370
  */
372
371
  updatePlugin() {
@@ -361,8 +361,7 @@ export class NestedRows extends BasePlugin {
361
361
  /**
362
362
  * Updates the plugin's state.
363
363
  *
364
- * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the
365
- * following configuration options:
364
+ * This method is executed when [`updateSettings()`](@/api/core.md#updatesettings) is invoked with any of the following configuration options:
366
365
  * - [`nestedRows`](@/api/options.md#nestedrows)
367
366
  */
368
367
  updatePlugin() {
@@ -6,7 +6,6 @@ var _number = require("../../../helpers/number");
6
6
  var _element = require("../../../helpers/dom/element");
7
7
  var _base = _interopRequireDefault(require("./_base"));
8
8
  var _a11y = require("../../../helpers/a11y");
9
- var _constants = require("../../../i18n/constants");
10
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
10
  /**
12
11
  * Class responsible for the UI in the Nested Rows' row headers.
@@ -25,6 +24,7 @@ class HeadersUI extends _base.default {
25
24
  return {
26
25
  indicatorContainer: 'ht_nestingLevels',
27
26
  parent: 'ht_nestingParent',
27
+ indicator: 'ht_nestingLevel',
28
28
  emptyIndicator: 'ht_nestingLevel_empty',
29
29
  button: 'ht_nestingButton',
30
30
  expandButton: 'ht_nestingExpand',
@@ -102,12 +102,12 @@ class HeadersUI extends _base.default {
102
102
  if (this.collapsingUI.areChildrenCollapsed(rowIndex)) {
103
103
  (0, _element.addClass)(buttonsContainer, `${HeadersUI.CSS_CLASSES.button} ${HeadersUI.CSS_CLASSES.expandButton}`);
104
104
  if (ariaEnabled) {
105
- (0, _element.setAttribute)(TH, [(0, _a11y.A11Y_EXPANDED)(false), (0, _a11y.A11Y_DESCRIPTION)(this.hot.getTranslatedPhrase(_constants.ROW_HEADER_DESCRIPTION_EXPAND_ROW))]);
105
+ (0, _element.setAttribute)(TH, [(0, _a11y.A11Y_EXPANDED)(false)]);
106
106
  }
107
107
  } else {
108
108
  (0, _element.addClass)(buttonsContainer, `${HeadersUI.CSS_CLASSES.button} ${HeadersUI.CSS_CLASSES.collapseButton}`);
109
109
  if (ariaEnabled) {
110
- (0, _element.setAttribute)(TH, [(0, _a11y.A11Y_EXPANDED)(true), (0, _a11y.A11Y_DESCRIPTION)(this.hot.getTranslatedPhrase(_constants.ROW_HEADER_DESCRIPTION_COLLAPSE_ROW))]);
110
+ (0, _element.setAttribute)(TH, [(0, _a11y.A11Y_EXPANDED)(true)]);
111
111
  }
112
112
  }
113
113
  innerDiv.appendChild(buttonsContainer);
@@ -2,8 +2,7 @@ import { arrayEach } from "../../../helpers/array.mjs";
2
2
  import { rangeEach } from "../../../helpers/number.mjs";
3
3
  import { addClass, setAttribute } from "../../../helpers/dom/element.mjs";
4
4
  import BaseUI from "./_base.mjs";
5
- import { A11Y_DESCRIPTION, A11Y_EXPANDED, A11Y_HIDDEN } from "../../../helpers/a11y.mjs";
6
- import { ROW_HEADER_DESCRIPTION_COLLAPSE_ROW, ROW_HEADER_DESCRIPTION_EXPAND_ROW } from "../../../i18n/constants.mjs";
5
+ import { A11Y_EXPANDED, A11Y_HIDDEN } from "../../../helpers/a11y.mjs";
7
6
  /**
8
7
  * Class responsible for the UI in the Nested Rows' row headers.
9
8
  *
@@ -21,6 +20,7 @@ class HeadersUI extends BaseUI {
21
20
  return {
22
21
  indicatorContainer: 'ht_nestingLevels',
23
22
  parent: 'ht_nestingParent',
23
+ indicator: 'ht_nestingLevel',
24
24
  emptyIndicator: 'ht_nestingLevel_empty',
25
25
  button: 'ht_nestingButton',
26
26
  expandButton: 'ht_nestingExpand',
@@ -98,12 +98,12 @@ class HeadersUI extends BaseUI {
98
98
  if (this.collapsingUI.areChildrenCollapsed(rowIndex)) {
99
99
  addClass(buttonsContainer, `${HeadersUI.CSS_CLASSES.button} ${HeadersUI.CSS_CLASSES.expandButton}`);
100
100
  if (ariaEnabled) {
101
- setAttribute(TH, [A11Y_EXPANDED(false), A11Y_DESCRIPTION(this.hot.getTranslatedPhrase(ROW_HEADER_DESCRIPTION_EXPAND_ROW))]);
101
+ setAttribute(TH, [A11Y_EXPANDED(false)]);
102
102
  }
103
103
  } else {
104
104
  addClass(buttonsContainer, `${HeadersUI.CSS_CLASSES.button} ${HeadersUI.CSS_CLASSES.collapseButton}`);
105
105
  if (ariaEnabled) {
106
- setAttribute(TH, [A11Y_EXPANDED(true), A11Y_DESCRIPTION(this.hot.getTranslatedPhrase(ROW_HEADER_DESCRIPTION_COLLAPSE_ROW))]);
106
+ setAttribute(TH, [A11Y_EXPANDED(true)]);
107
107
  }
108
108
  }
109
109
  innerDiv.appendChild(buttonsContainer);
@@ -44,9 +44,6 @@ function autocompleteRenderer(hotInstance, TD, row, col, prop, value, cellProper
44
44
 
45
45
  TD.insertBefore(ARROW, TD.firstChild);
46
46
  (0, _element.addClass)(TD, 'htAutocomplete');
47
- if (isAriaEnabled) {
48
- TD.setAttribute(...(0, _a11y.A11Y_HASPOPUP)('listbox'));
49
- }
50
47
  if (!hotInstance.acArrowListener) {
51
48
  const eventManager = new _eventManager.default(hotInstance);
52
49
 
@@ -2,7 +2,7 @@ import { htmlRenderer } from "../htmlRenderer/index.mjs";
2
2
  import { textRenderer } from "../textRenderer/index.mjs";
3
3
  import EventManager from "../../eventManager.mjs";
4
4
  import { addClass, hasClass } from "../../helpers/dom/element.mjs";
5
- import { A11Y_HASPOPUP, A11Y_HIDDEN } from "../../helpers/a11y.mjs";
5
+ import { A11Y_HIDDEN } from "../../helpers/a11y.mjs";
6
6
  export const RENDERER_TYPE = 'autocomplete';
7
7
 
8
8
  /**
@@ -39,9 +39,6 @@ export function autocompleteRenderer(hotInstance, TD, row, col, prop, value, cel
39
39
 
40
40
  TD.insertBefore(ARROW, TD.firstChild);
41
41
  addClass(TD, 'htAutocomplete');
42
- if (isAriaEnabled) {
43
- TD.setAttribute(...A11Y_HASPOPUP('listbox'));
44
- }
45
42
  if (!hotInstance.acArrowListener) {
46
43
  const eventManager = new EventManager(hotInstance);
47
44
 
@@ -294,7 +294,6 @@ function createInput(rootDocument) {
294
294
  const input = rootDocument.createElement('input');
295
295
  input.className = 'htCheckboxRendererInput';
296
296
  input.type = 'checkbox';
297
- input.setAttribute('autocomplete', 'off');
298
297
  input.setAttribute('tabindex', '-1');
299
298
  return input.cloneNode(false);
300
299
  }
@@ -289,7 +289,6 @@ function createInput(rootDocument) {
289
289
  const input = rootDocument.createElement('input');
290
290
  input.className = 'htCheckboxRendererInput';
291
291
  input.type = 'checkbox';
292
- input.setAttribute('autocomplete', 'off');
293
292
  input.setAttribute('tabindex', '-1');
294
293
  return input.cloneNode(false);
295
294
  }
@@ -3,8 +3,6 @@
3
3
  exports.__esModule = true;
4
4
  exports.dateRenderer = dateRenderer;
5
5
  var _autocompleteRenderer = require("../autocompleteRenderer");
6
- var _a11y = require("../../helpers/a11y");
7
- var _element = require("../../helpers/dom/element");
8
6
  const RENDERER_TYPE = exports.RENDERER_TYPE = 'date';
9
7
 
10
8
  /**
@@ -21,8 +19,5 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'date';
21
19
  */
22
20
  function dateRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
23
21
  _autocompleteRenderer.autocompleteRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
24
- if (hotInstance.getSettings().ariaTags) {
25
- (0, _element.setAttribute)(TD, [(0, _a11y.A11Y_HASPOPUP)('dialog'), (0, _a11y.A11Y_EXPANDED)('false')]);
26
- }
27
22
  }
28
23
  dateRenderer.RENDERER_TYPE = RENDERER_TYPE;
@@ -1,6 +1,4 @@
1
1
  import { autocompleteRenderer } from "../autocompleteRenderer/index.mjs";
2
- import { A11Y_EXPANDED, A11Y_HASPOPUP } from "../../helpers/a11y.mjs";
3
- import { setAttribute } from "../../helpers/dom/element.mjs";
4
2
  export const RENDERER_TYPE = 'date';
5
3
 
6
4
  /**
@@ -17,8 +15,5 @@ export const RENDERER_TYPE = 'date';
17
15
  */
18
16
  export function dateRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
19
17
  autocompleteRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
20
- if (hotInstance.getSettings().ariaTags) {
21
- setAttribute(TD, [A11Y_HASPOPUP('dialog'), A11Y_EXPANDED('false')]);
22
- }
23
18
  }
24
19
  dateRenderer.RENDERER_TYPE = RENDERER_TYPE;
@@ -3,8 +3,6 @@
3
3
  exports.__esModule = true;
4
4
  exports.handsontableRenderer = handsontableRenderer;
5
5
  var _autocompleteRenderer = require("../autocompleteRenderer");
6
- var _a11y = require("../../helpers/a11y");
7
- var _element = require("../../helpers/dom/element");
8
6
  const RENDERER_TYPE = exports.RENDERER_TYPE = 'handsontable';
9
7
 
10
8
  /**
@@ -21,8 +19,5 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'handsontable';
21
19
  */
22
20
  function handsontableRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
23
21
  _autocompleteRenderer.autocompleteRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
24
- if (hotInstance.getSettings().ariaTags) {
25
- (0, _element.setAttribute)(TD, [(0, _a11y.A11Y_HASPOPUP)('true'), (0, _a11y.A11Y_EXPANDED)('false')]);
26
- }
27
22
  }
28
23
  handsontableRenderer.RENDERER_TYPE = RENDERER_TYPE;
@@ -1,6 +1,4 @@
1
1
  import { autocompleteRenderer } from "../autocompleteRenderer/index.mjs";
2
- import { A11Y_EXPANDED, A11Y_HASPOPUP } from "../../helpers/a11y.mjs";
3
- import { setAttribute } from "../../helpers/dom/element.mjs";
4
2
  export const RENDERER_TYPE = 'handsontable';
5
3
 
6
4
  /**
@@ -17,8 +15,5 @@ export const RENDERER_TYPE = 'handsontable';
17
15
  */
18
16
  export function handsontableRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
19
17
  autocompleteRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
20
- if (hotInstance.getSettings().ariaTags) {
21
- setAttribute(TD, [A11Y_HASPOPUP('true'), A11Y_EXPANDED('false')]);
22
- }
23
18
  }
24
19
  handsontableRenderer.RENDERER_TYPE = RENDERER_TYPE;
@@ -3,8 +3,6 @@
3
3
  exports.__esModule = true;
4
4
  exports.selectRenderer = selectRenderer;
5
5
  var _textRenderer = require("../textRenderer");
6
- var _a11y = require("../../helpers/a11y");
7
- var _element = require("../../helpers/dom/element");
8
6
  const RENDERER_TYPE = exports.RENDERER_TYPE = 'select';
9
7
 
10
8
  /**
@@ -19,8 +17,5 @@ const RENDERER_TYPE = exports.RENDERER_TYPE = 'select';
19
17
  */
20
18
  function selectRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
21
19
  _textRenderer.textRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
22
- if (hotInstance.getSettings().ariaTags) {
23
- (0, _element.setAttribute)(TD, ...(0, _a11y.A11Y_HASPOPUP)('listbox'));
24
- }
25
20
  }
26
21
  selectRenderer.RENDERER_TYPE = RENDERER_TYPE;
@@ -1,6 +1,4 @@
1
1
  import { textRenderer } from "../textRenderer/index.mjs";
2
- import { A11Y_HASPOPUP } from "../../helpers/a11y.mjs";
3
- import { setAttribute } from "../../helpers/dom/element.mjs";
4
2
  export const RENDERER_TYPE = 'select';
5
3
 
6
4
  /**
@@ -15,8 +13,5 @@ export const RENDERER_TYPE = 'select';
15
13
  */
16
14
  export function selectRenderer(hotInstance, TD, row, col, prop, value, cellProperties) {
17
15
  textRenderer.apply(this, [hotInstance, TD, row, col, prop, value, cellProperties]);
18
- if (hotInstance.getSettings().ariaTags) {
19
- setAttribute(TD, ...A11Y_HASPOPUP('listbox'));
20
- }
21
16
  }
22
17
  selectRenderer.RENDERER_TYPE = RENDERER_TYPE;
@@ -4,6 +4,7 @@ exports.__esModule = true;
4
4
  exports.createHighlight = createHighlight;
5
5
  var _src = require("../../../3rdparty/walkontable/src");
6
6
  var _visualSelection = _interopRequireDefault(require("../visualSelection"));
7
+ var _a11y = require("../../../helpers/a11y");
7
8
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
8
9
  /**
9
10
  * Creates the new instance of Selection responsible for highlighting currently selected cell. This type of selection
@@ -20,6 +21,7 @@ function createHighlight(_ref) {
20
21
  } = _ref;
21
22
  return new _visualSelection.default({
22
23
  className: 'current',
24
+ headerAttributes: [(0, _a11y.A11Y_SELECTED)()],
23
25
  border: {
24
26
  width: 2,
25
27
  color: '#4b89ff',
@@ -1,5 +1,6 @@
1
1
  import { HIGHLIGHT_FOCUS_TYPE } from "../../../3rdparty/walkontable/src/index.mjs";
2
2
  import VisualSelection from "../visualSelection.mjs";
3
+ import { A11Y_SELECTED } from "../../../helpers/a11y.mjs";
3
4
  /**
4
5
  * Creates the new instance of Selection responsible for highlighting currently selected cell. This type of selection
5
6
  * can present on the table only one at the time.
@@ -15,6 +16,7 @@ export function createHighlight(_ref) {
15
16
  } = _ref;
16
17
  return new VisualSelection({
17
18
  className: 'current',
19
+ headerAttributes: [A11Y_SELECTED()],
18
20
  border: {
19
21
  width: 2,
20
22
  color: '#4b89ff',
@@ -99,7 +99,6 @@ class Selection {
99
99
  this.tableProps = tableProps;
100
100
  this.highlight = new _highlight.default({
101
101
  headerClassName: settings.currentHeaderClassName,
102
- headerAttributes: [(0, _a11y.A11Y_SELECTED)()],
103
102
  activeHeaderClassName: settings.activeHeaderClassName,
104
103
  rowClassName: settings.currentRowClassName,
105
104
  columnClassName: settings.currentColClassName,
@@ -93,7 +93,6 @@ class Selection {
93
93
  this.tableProps = tableProps;
94
94
  this.highlight = new Highlight({
95
95
  headerClassName: settings.currentHeaderClassName,
96
- headerAttributes: [A11Y_SELECTED()],
97
96
  activeHeaderClassName: settings.activeHeaderClassName,
98
97
  rowClassName: settings.currentRowClassName,
99
98
  columnClassName: settings.currentColClassName,
package/tableView.js CHANGED
@@ -11,11 +11,13 @@ var _mouseEventHandler = require("./selection/mouseEventHandler");
11
11
  var _rootInstance = require("./utils/rootInstance");
12
12
  var _a11y = require("./helpers/a11y");
13
13
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+ function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
14
15
  function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
15
16
  function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
16
17
  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; }
17
18
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
18
19
  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); }
20
+ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
19
21
  function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
20
22
  function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
21
23
  function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
@@ -32,11 +34,25 @@ var _mouseDown = /*#__PURE__*/new WeakMap();
32
34
  var _table = /*#__PURE__*/new WeakMap();
33
35
  var _lastWidth = /*#__PURE__*/new WeakMap();
34
36
  var _lastHeight = /*#__PURE__*/new WeakMap();
37
+ var _getAriaColcount = /*#__PURE__*/new WeakSet();
38
+ var _updateAriaColcount = /*#__PURE__*/new WeakSet();
35
39
  class TableView {
36
40
  /**
37
41
  * @param {Hanstontable} hotInstance Instance of {@link Handsontable}.
38
42
  */
39
43
  constructor(hotInstance) {
44
+ /**
45
+ * Update the `aria-colcount` attribute by the provided value.
46
+ *
47
+ * @param {number} delta The number of columns to add or remove to the aria tag.
48
+ */
49
+ _classPrivateMethodInitSpec(this, _updateAriaColcount);
50
+ /**
51
+ * Return the value of the `aria-colcount` attribute.
52
+ *
53
+ * @returns {number} The value of the `aria-colcount` attribute.
54
+ */
55
+ _classPrivateMethodInitSpec(this, _getAriaColcount);
40
56
  /**
41
57
  * Instance of {@link Handsontable}.
42
58
  *
@@ -273,7 +289,7 @@ class TableView {
273
289
  }
274
290
  if (this.settings.ariaTags) {
275
291
  (0, _element.setAttribute)(_classPrivateFieldGet(this, _table), [(0, _a11y.A11Y_PRESENTATION)()]);
276
- (0, _element.setAttribute)(rootElement, [(0, _a11y.A11Y_TREEGRID)(), (0, _a11y.A11Y_ROWCOUNT)(this.hot.countRows()), (0, _a11y.A11Y_COLCOUNT)(this.hot.countCols()), (0, _a11y.A11Y_MULTISELECTABLE)()]);
292
+ (0, _element.setAttribute)(rootElement, [(0, _a11y.A11Y_TREEGRID)(), (0, _a11y.A11Y_ROWCOUNT)(-1), (0, _a11y.A11Y_COLCOUNT)(this.hot.countCols()), (0, _a11y.A11Y_MULTISELECTABLE)()]);
277
293
  }
278
294
  this.THEAD = rootDocument.createElement('THEAD');
279
295
  _classPrivateFieldGet(this, _table).appendChild(this.THEAD);
@@ -666,6 +682,13 @@ class TableView {
666
682
  }
667
683
  this.hot.runHooks('afterGetRowHeaderRenderers', headerRenderers);
668
684
  _classPrivateFieldSet(this, _rowHeadersCount, headerRenderers.length);
685
+ if (this.hot.getSettings().ariaTags) {
686
+ // Update the aria-colcount attribute.
687
+ // Only needs to be done once after initialization/data update.
688
+ if (_classPrivateMethodGet(this, _getAriaColcount, _getAriaColcount2).call(this) === this.hot.countCols()) {
689
+ _classPrivateMethodGet(this, _updateAriaColcount, _updateAriaColcount2).call(this, _classPrivateFieldGet(this, _rowHeadersCount));
690
+ }
691
+ }
669
692
  return headerRenderers;
670
693
  },
671
694
  columnHeaders: () => {
@@ -1158,6 +1181,10 @@ class TableView {
1158
1181
  const span = rootDocument.createElement('span');
1159
1182
  div.className = 'relative';
1160
1183
  span.className = 'colHeader';
1184
+ if (this.settings.ariaTags) {
1185
+ (0, _element.setAttribute)(div, ...(0, _a11y.A11Y_PRESENTATION)());
1186
+ (0, _element.setAttribute)(span, ...(0, _a11y.A11Y_PRESENTATION)());
1187
+ }
1161
1188
  this.updateCellHeader(span, visualColumnIndex, label, headerLevel);
1162
1189
  div.appendChild(span);
1163
1190
  TH.appendChild(div);
@@ -1301,7 +1328,6 @@ class TableView {
1301
1328
  getRowHeadersCount() {
1302
1329
  return _classPrivateFieldGet(this, _rowHeadersCount);
1303
1330
  }
1304
-
1305
1331
  /**
1306
1332
  * Destroys internal WalkOnTable's instance. Detaches all of the bonded listeners.
1307
1333
  *
@@ -1312,4 +1338,11 @@ class TableView {
1312
1338
  this.eventManager.destroy();
1313
1339
  }
1314
1340
  }
1341
+ function _getAriaColcount2() {
1342
+ return parseInt(this.hot.rootElement.getAttribute((0, _a11y.A11Y_COLCOUNT)()[0]), 10);
1343
+ }
1344
+ function _updateAriaColcount2(delta) {
1345
+ const colCount = _classPrivateMethodGet(this, _getAriaColcount, _getAriaColcount2).call(this) + delta;
1346
+ (0, _element.setAttribute)(this.hot.rootElement, ...(0, _a11y.A11Y_COLCOUNT)(colCount));
1347
+ }
1315
1348
  var _default = exports.default = TableView;