handsontable 0.0.0-next-50e428d-20231026 → 0.0.0-next-42d5bd7-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 (84) hide show
  1. package/3rdparty/walkontable/src/renderer/columnHeaders.js +3 -0
  2. package/3rdparty/walkontable/src/renderer/columnHeaders.mjs +4 -1
  3. package/3rdparty/walkontable/src/renderer/rowHeaders.js +3 -0
  4. package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +4 -1
  5. package/base.js +2 -2
  6. package/base.mjs +2 -2
  7. package/core.js +1 -1
  8. package/core.mjs +1 -1
  9. package/dist/handsontable.css +45 -63
  10. package/dist/handsontable.full.css +45 -63
  11. package/dist/handsontable.full.js +3599 -2080
  12. package/dist/handsontable.full.min.css +5 -5
  13. package/dist/handsontable.full.min.js +70 -63
  14. package/dist/handsontable.js +3601 -2082
  15. package/dist/handsontable.min.css +5 -5
  16. package/dist/handsontable.min.js +25 -18
  17. package/dist/languages/all.js +24 -2
  18. package/dist/languages/all.min.js +1 -1
  19. package/dist/languages/en-US.js +12 -1
  20. package/dist/languages/en-US.min.js +1 -1
  21. package/dist/languages/pl-PL.js +12 -1
  22. package/dist/languages/pl-PL.min.js +1 -1
  23. package/helpers/a11y.js +2 -0
  24. package/helpers/a11y.mjs +1 -0
  25. package/helpers/dom/element.js +29 -0
  26. package/helpers/dom/element.mjs +28 -0
  27. package/helpers/mixed.js +1 -1
  28. package/helpers/mixed.mjs +1 -1
  29. package/i18n/constants.js +27 -1
  30. package/i18n/constants.mjs +14 -1
  31. package/i18n/languages/en-US.js +12 -1
  32. package/i18n/languages/en-US.mjs +12 -1
  33. package/i18n/languages/pl-PL.js +12 -1
  34. package/i18n/languages/pl-PL.mjs +12 -1
  35. package/languages/all.js +24 -2
  36. package/languages/en-US.js +12 -1
  37. package/languages/en-US.mjs +12 -1
  38. package/languages/index.js +24 -2
  39. package/languages/pl-PL.js +12 -1
  40. package/languages/pl-PL.mjs +12 -1
  41. package/package.json +1 -1
  42. package/pluginHooks.d.ts +28 -6
  43. package/pluginHooks.js +116 -62
  44. package/pluginHooks.mjs +116 -62
  45. package/plugins/collapsibleColumns/collapsibleColumns.js +3 -2
  46. package/plugins/collapsibleColumns/collapsibleColumns.mjs +4 -3
  47. package/plugins/columnSorting/columnSorting.js +29 -3
  48. package/plugins/columnSorting/columnSorting.mjs +31 -5
  49. package/plugins/contextMenu/menu/menuItemRenderer.js +12 -0
  50. package/plugins/contextMenu/menu/menuItemRenderer.mjs +14 -2
  51. package/plugins/copyPaste/clipboardData/clipboardData.js +517 -0
  52. package/plugins/copyPaste/clipboardData/clipboardData.mjs +512 -0
  53. package/plugins/copyPaste/clipboardData/copyClipboardData.js +69 -0
  54. package/plugins/copyPaste/clipboardData/copyClipboardData.mjs +65 -0
  55. package/plugins/copyPaste/clipboardData/index.js +9 -0
  56. package/plugins/copyPaste/clipboardData/index.mjs +4 -0
  57. package/plugins/copyPaste/clipboardData/pasteClipboardData.js +81 -0
  58. package/plugins/copyPaste/clipboardData/pasteClipboardData.mjs +77 -0
  59. package/plugins/copyPaste/copyPaste.js +38 -92
  60. package/plugins/copyPaste/copyPaste.mjs +40 -94
  61. package/plugins/dropdownMenu/dropdownMenu.js +2 -1
  62. package/plugins/dropdownMenu/dropdownMenu.mjs +3 -2
  63. package/plugins/filters/ui/input.js +0 -3
  64. package/plugins/filters/ui/input.mjs +0 -3
  65. package/plugins/filters/ui/select.js +6 -0
  66. package/plugins/filters/ui/select.mjs +6 -0
  67. package/plugins/hiddenColumns/hiddenColumns.js +48 -3
  68. package/plugins/hiddenColumns/hiddenColumns.mjs +47 -2
  69. package/plugins/hiddenRows/hiddenRows.js +48 -3
  70. package/plugins/hiddenRows/hiddenRows.mjs +47 -2
  71. package/plugins/multiColumnSorting/multiColumnSorting.js +21 -0
  72. package/plugins/multiColumnSorting/multiColumnSorting.mjs +22 -1
  73. package/plugins/nestedHeaders/nestedHeaders.js +21 -22
  74. package/plugins/nestedHeaders/nestedHeaders.mjs +21 -22
  75. package/plugins/nestedRows/nestedRows.js +2 -1
  76. package/plugins/nestedRows/nestedRows.mjs +2 -1
  77. package/plugins/nestedRows/ui/headers.js +3 -3
  78. package/plugins/nestedRows/ui/headers.mjs +4 -4
  79. package/utils/parseTable.js +527 -83
  80. package/utils/parseTable.mjs +523 -82
  81. package/plugins/copyPaste/clipboardData.js +0 -18
  82. package/plugins/copyPaste/clipboardData.mjs +0 -14
  83. package/plugins/copyPaste/pasteEvent.js +0 -14
  84. package/plugins/copyPaste/pasteEvent.mjs +0 -9
@@ -17,7 +17,8 @@ import { warn } from "../../helpers/console.mjs";
17
17
  import { addClass, hasClass, removeClass, fastInnerText, removeAttribute, setAttribute } from "../../helpers/dom/element.mjs";
18
18
  import EventManager from "../../eventManager.mjs";
19
19
  import { stopImmediatePropagation } from "../../helpers/dom/event.mjs";
20
- import { A11Y_EXPANDED, A11Y_HIDDEN } from "../../helpers/a11y.mjs";
20
+ import { A11Y_DESCRIPTION, A11Y_EXPANDED, A11Y_HIDDEN } from "../../helpers/a11y.mjs";
21
+ import { COLUMN_HEADER_DESCRIPTION_COLLAPSE_COLUMN, COLUMN_HEADER_DESCRIPTION_EXPAND_COLUMN } from "../../i18n/constants.mjs";
21
22
  export const PLUGIN_KEY = 'collapsibleColumns';
22
23
  export const PLUGIN_PRIORITY = 290;
23
24
  const SETTING_KEYS = ['nestedHeaders'];
@@ -514,7 +515,7 @@ export class CollapsibleColumns extends BasePlugin {
514
515
 
515
516
  // Add ARIA tags
516
517
  if (isAriaTagsEnabled) {
517
- setAttribute(TH, ...A11Y_EXPANDED(false));
518
+ setAttribute(TH, [A11Y_EXPANDED(false), A11Y_DESCRIPTION(this.hot.getTranslatedPhrase(COLUMN_HEADER_DESCRIPTION_EXPAND_COLUMN))]);
518
519
  }
519
520
  } else {
520
521
  addClass(collapsibleElement, 'expanded');
@@ -522,7 +523,7 @@ export class CollapsibleColumns extends BasePlugin {
522
523
 
523
524
  // Add ARIA tags
524
525
  if (isAriaTagsEnabled) {
525
- setAttribute(TH, ...A11Y_EXPANDED(true));
526
+ setAttribute(TH, [A11Y_EXPANDED(true), A11Y_DESCRIPTION(this.hot.getTranslatedPhrase(COLUMN_HEADER_DESCRIPTION_COLLAPSE_COLUMN))]);
526
527
  }
527
528
  }
528
529
  if (isAriaTagsEnabled) {
@@ -16,6 +16,7 @@ var _domHelpers = require("./domHelpers");
16
16
  var _rootComparator = require("./rootComparator");
17
17
  var _sortService = require("./sortService");
18
18
  var _a11y = require("../../helpers/a11y");
19
+ var _constants = require("../../i18n/constants");
19
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
21
  const PLUGIN_KEY = 'columnSorting';
21
22
  exports.PLUGIN_KEY = PLUGIN_KEY;
@@ -26,6 +27,7 @@ exports.APPEND_COLUMN_CONFIG_STRATEGY = APPEND_COLUMN_CONFIG_STRATEGY;
26
27
  const REPLACE_COLUMN_CONFIG_STRATEGY = 'replace';
27
28
  exports.REPLACE_COLUMN_CONFIG_STRATEGY = REPLACE_COLUMN_CONFIG_STRATEGY;
28
29
  const SHORTCUTS_GROUP = PLUGIN_KEY;
30
+ const SORTING_INDICATOR_CLASS = 'columnSortingIndicator';
29
31
  (0, _sortService.registerRootComparator)(PLUGIN_KEY, _rootComparator.rootComparator);
30
32
  _pluginHooks.default.getSingleton().register('beforeColumnSort');
31
33
  _pluginHooks.default.getSingleton().register('afterColumnSort');
@@ -644,12 +646,14 @@ class ColumnSorting extends _base.BasePlugin {
644
646
  return;
645
647
  }
646
648
  const pluginSettingsForColumn = this.getFirstCellSettings(column)[this.pluginKey];
649
+ const ariaTags = this.hot.getSettings().ariaTags;
647
650
  const showSortIndicator = pluginSettingsForColumn.indicator;
648
651
  const headerActionEnabled = pluginSettingsForColumn.headerAction;
652
+ const currentSortState = this.columnStatesManager.getSortOrderOfColumn(column);
649
653
  this.updateHeaderClasses(headerSpanElement, this.columnStatesManager, column, showSortIndicator, headerActionEnabled);
650
- if (this.hot.getSettings().ariaTags) {
651
- const currentSortState = this.columnStatesManager.getSortOrderOfColumn(column);
652
- (0, _element.setAttribute)(TH, ...(0, _a11y.A11Y_SORT)(currentSortState ? `${currentSortState}ending` : 'none'));
654
+ this.updateSortingIndicator(column, headerSpanElement);
655
+ if (ariaTags) {
656
+ (0, _element.setAttribute)(TH, [(0, _a11y.A11Y_SORT)(currentSortState ? `${currentSortState}ending` : 'none'), (0, _a11y.A11Y_DESCRIPTION)(this.hot.getTranslatedPhrase(_constants.COLUMN_HEADER_DESCRIPTION_SORT_ROWS))]);
653
657
  }
654
658
  }
655
659
 
@@ -670,6 +674,28 @@ class ColumnSorting extends _base.BasePlugin {
670
674
  }
671
675
  }
672
676
 
677
+ /**
678
+ * Update sorting indicator.
679
+ *
680
+ * @private
681
+ * @param {number} column Visual column index.
682
+ * @param {HTMLElement} headerSpanElement Header span element.
683
+ */
684
+ updateSortingIndicator(column, headerSpanElement) {
685
+ const pluginSettingsForColumn = this.getFirstCellSettings(column)[this.pluginKey];
686
+ const ariaTags = this.hot.getSettings().ariaTags;
687
+ const showSortIndicator = pluginSettingsForColumn.indicator;
688
+ const isColumnSorted = this.columnStatesManager.isColumnSorted(column);
689
+ const indicatorElement = headerSpanElement.querySelector(`.${SORTING_INDICATOR_CLASS}`);
690
+ if (showSortIndicator && isColumnSorted && !indicatorElement) {
691
+ (0, _element.appendElement)(headerSpanElement, {
692
+ tagName: 'div',
693
+ className: SORTING_INDICATOR_CLASS,
694
+ attributes: ariaTags ? [(0, _a11y.A11Y_HIDDEN)()] : []
695
+ });
696
+ }
697
+ }
698
+
673
699
  /**
674
700
  * Overwriting base plugin's `onUpdateSettings` method. Please keep in mind that `onAfterUpdateSettings` isn't called
675
701
  * for `updateSettings` in specific situations.
@@ -1,5 +1,5 @@
1
1
  import "core-js/modules/es.array.push.js";
2
- import { addClass, removeClass, setAttribute } from "../../helpers/dom/element.mjs";
2
+ import { addClass, appendElement, removeClass, setAttribute } from "../../helpers/dom/element.mjs";
3
3
  import { isUndefined, isDefined } from "../../helpers/mixed.mjs";
4
4
  import { isObject } from "../../helpers/object.mjs";
5
5
  import { isFunction } from "../../helpers/function.mjs";
@@ -12,12 +12,14 @@ import { getNextSortOrder, areValidSortStates, getHeaderSpanElement, isFirstLeve
12
12
  import { getClassesToRemove, getClassesToAdd } from "./domHelpers.mjs";
13
13
  import { rootComparator } from "./rootComparator.mjs";
14
14
  import { registerRootComparator, sort } from "./sortService/index.mjs";
15
- import { A11Y_SORT } from "../../helpers/a11y.mjs";
15
+ import { A11Y_DESCRIPTION, A11Y_HIDDEN, A11Y_SORT } from "../../helpers/a11y.mjs";
16
+ import { COLUMN_HEADER_DESCRIPTION_SORT_ROWS } from "../../i18n/constants.mjs";
16
17
  export const PLUGIN_KEY = 'columnSorting';
17
18
  export const PLUGIN_PRIORITY = 50;
18
19
  export const APPEND_COLUMN_CONFIG_STRATEGY = 'append';
19
20
  export const REPLACE_COLUMN_CONFIG_STRATEGY = 'replace';
20
21
  const SHORTCUTS_GROUP = PLUGIN_KEY;
22
+ const SORTING_INDICATOR_CLASS = 'columnSortingIndicator';
21
23
  registerRootComparator(PLUGIN_KEY, rootComparator);
22
24
  Hooks.getSingleton().register('beforeColumnSort');
23
25
  Hooks.getSingleton().register('afterColumnSort');
@@ -636,12 +638,14 @@ export class ColumnSorting extends BasePlugin {
636
638
  return;
637
639
  }
638
640
  const pluginSettingsForColumn = this.getFirstCellSettings(column)[this.pluginKey];
641
+ const ariaTags = this.hot.getSettings().ariaTags;
639
642
  const showSortIndicator = pluginSettingsForColumn.indicator;
640
643
  const headerActionEnabled = pluginSettingsForColumn.headerAction;
644
+ const currentSortState = this.columnStatesManager.getSortOrderOfColumn(column);
641
645
  this.updateHeaderClasses(headerSpanElement, this.columnStatesManager, column, showSortIndicator, headerActionEnabled);
642
- if (this.hot.getSettings().ariaTags) {
643
- const currentSortState = this.columnStatesManager.getSortOrderOfColumn(column);
644
- setAttribute(TH, ...A11Y_SORT(currentSortState ? `${currentSortState}ending` : 'none'));
646
+ this.updateSortingIndicator(column, headerSpanElement);
647
+ if (ariaTags) {
648
+ setAttribute(TH, [A11Y_SORT(currentSortState ? `${currentSortState}ending` : 'none'), A11Y_DESCRIPTION(this.hot.getTranslatedPhrase(COLUMN_HEADER_DESCRIPTION_SORT_ROWS))]);
645
649
  }
646
650
  }
647
651
 
@@ -662,6 +666,28 @@ export class ColumnSorting extends BasePlugin {
662
666
  }
663
667
  }
664
668
 
669
+ /**
670
+ * Update sorting indicator.
671
+ *
672
+ * @private
673
+ * @param {number} column Visual column index.
674
+ * @param {HTMLElement} headerSpanElement Header span element.
675
+ */
676
+ updateSortingIndicator(column, headerSpanElement) {
677
+ const pluginSettingsForColumn = this.getFirstCellSettings(column)[this.pluginKey];
678
+ const ariaTags = this.hot.getSettings().ariaTags;
679
+ const showSortIndicator = pluginSettingsForColumn.indicator;
680
+ const isColumnSorted = this.columnStatesManager.isColumnSorted(column);
681
+ const indicatorElement = headerSpanElement.querySelector(`.${SORTING_INDICATOR_CLASS}`);
682
+ if (showSortIndicator && isColumnSorted && !indicatorElement) {
683
+ appendElement(headerSpanElement, {
684
+ tagName: 'div',
685
+ className: SORTING_INDICATOR_CLASS,
686
+ attributes: ariaTags ? [A11Y_HIDDEN()] : []
687
+ });
688
+ }
689
+ }
690
+
665
691
  /**
666
692
  * Overwriting base plugin's `onUpdateSettings` method. Please keep in mind that `onAfterUpdateSettings` isn't called
667
693
  * for `updateSettings` in specific situations.
@@ -5,6 +5,8 @@ exports.createMenuItemRenderer = createMenuItemRenderer;
5
5
  var _utils = require("./utils");
6
6
  var _element = require("../../../helpers/dom/element");
7
7
  var _a11y = require("../../../helpers/a11y");
8
+ const SUBMENU_INDICATOR_CLASSNAME = 'submenuIndicator';
9
+
8
10
  /**
9
11
  * Creates the menu renderer function.
10
12
  *
@@ -37,6 +39,16 @@ function createMenuItemRenderer(mainTableHot) {
37
39
  const isFocusable = !(0, _utils.isItemDisabled)(item, mainTableHot) && !(0, _utils.isItemSelectionDisabled)(item) && !(0, _utils.isItemSeparator)(item);
38
40
  (0, _element.setAttribute)(TD, [(0, _a11y.A11Y_MENU_ITEM)(), (0, _a11y.A11Y_LABEL)(itemValue), ...(isFocusable ? [(0, _a11y.A11Y_TABINDEX)(-1)] : []), ...((0, _utils.isItemDisabled)(item, mainTableHot) ? [(0, _a11y.A11Y_DISABLED)()] : []), ...((0, _utils.isItemSubMenu)(item) ? [(0, _a11y.A11Y_EXPANDED)(false)] : [])]);
39
41
  }
42
+ if ((0, _utils.isItemSubMenu)(item)) {
43
+ const submenuIndicatorElement = TD.querySelector('.submenuIndicator');
44
+ if (!submenuIndicatorElement) {
45
+ (0, _element.appendElement)(TD, {
46
+ tagName: 'div',
47
+ attributes: mainTableHot.getSettings().ariaTags ? [(0, _a11y.A11Y_HIDDEN)()] : [],
48
+ className: SUBMENU_INDICATOR_CLASSNAME
49
+ });
50
+ }
51
+ }
40
52
  TD.className = '';
41
53
  TD.appendChild(wrapper);
42
54
  if ((0, _utils.isItemSeparator)(item)) {
@@ -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)) {