handsontable 0.0.0-next-d7edb4b-20240927 → 0.0.0-next-f512acf-20240930

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 (47) hide show
  1. package/base.js +2 -2
  2. package/base.mjs +2 -2
  3. package/core.js +11 -0
  4. package/core.mjs +11 -0
  5. package/dataMap/metaManager/metaSchema.js +17 -0
  6. package/dataMap/metaManager/metaSchema.mjs +17 -0
  7. package/dist/handsontable.css +296 -145
  8. package/dist/handsontable.full.css +305 -152
  9. package/dist/handsontable.full.js +3610 -3723
  10. package/dist/handsontable.full.min.css +85 -14
  11. package/dist/handsontable.full.min.js +48 -48
  12. package/dist/handsontable.js +3317 -3424
  13. package/dist/handsontable.min.css +82 -11
  14. package/dist/handsontable.min.js +24 -24
  15. package/editors/dateEditor/dateEditor.js +2 -0
  16. package/editors/dateEditor/dateEditor.mjs +2 -0
  17. package/editors/handsontableEditor/handsontableEditor.js +1 -1
  18. package/editors/handsontableEditor/handsontableEditor.mjs +1 -1
  19. package/editors/selectEditor/selectEditor.js +20 -9
  20. package/editors/selectEditor/selectEditor.mjs +20 -9
  21. package/editors/textEditor/textEditor.js +4 -11
  22. package/editors/textEditor/textEditor.mjs +4 -11
  23. package/helpers/mixed.js +2 -2
  24. package/helpers/mixed.mjs +2 -2
  25. package/helpers/themes.js +17 -0
  26. package/helpers/themes.mjs +13 -0
  27. package/package.json +10 -3
  28. package/plugins/comments/commentEditor.js +8 -1
  29. package/plugins/comments/commentEditor.mjs +8 -1
  30. package/plugins/comments/comments.js +1 -1
  31. package/plugins/comments/comments.mjs +1 -1
  32. package/plugins/contextMenu/menu/menu.js +4 -4
  33. package/plugins/contextMenu/menu/menu.mjs +4 -4
  34. package/plugins/contextMenu/menu/shortcuts.js +1 -1
  35. package/plugins/contextMenu/menu/shortcuts.mjs +1 -1
  36. package/plugins/filters/filters.js +37 -13
  37. package/plugins/filters/filters.mjs +37 -13
  38. package/plugins/filters/menu/focusController.js +36 -14
  39. package/plugins/filters/menu/focusController.mjs +36 -14
  40. package/styles/handsontable.css +1921 -0
  41. package/styles/handsontable.min.css +30 -0
  42. package/styles/ht-theme-gemini.css +689 -0
  43. package/styles/ht-theme-gemini.min.css +30 -0
  44. package/styles/ht-theme-main.css +697 -0
  45. package/styles/ht-theme-main.min.css +30 -0
  46. package/utils/ghostTable.js +1 -1
  47. package/utils/ghostTable.mjs +1 -1
@@ -70,6 +70,7 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
70
70
  * :::
71
71
  */
72
72
  var _menuFocusNavigator = /*#__PURE__*/new WeakMap();
73
+ var _dropdownMenuTraces = /*#__PURE__*/new WeakMap();
73
74
  var _Filters_brand = /*#__PURE__*/new WeakSet();
74
75
  export class Filters extends BasePlugin {
75
76
  static get PLUGIN_KEY() {
@@ -133,6 +134,12 @@ export class Filters extends BasePlugin {
133
134
  * @type {MenuFocusNavigator|undefined}
134
135
  */
135
136
  _classPrivateFieldInitSpec(this, _menuFocusNavigator, void 0);
137
+ /**
138
+ * Traces the new menu instances to apply the focus navigation to the latest one.
139
+ *
140
+ * @type {WeakSet<Menu>}
141
+ */
142
+ _classPrivateFieldInitSpec(this, _dropdownMenuTraces, new WeakSet());
136
143
  this.hot.addHook('afterGetColHeader', (col, TH) => _assertClassBrand(_Filters_brand, this, _onAfterGetColHeader).call(this, col, TH));
137
144
  }
138
145
 
@@ -151,6 +158,7 @@ export class Filters extends BasePlugin {
151
158
  * Enables the plugin functionality for this Handsontable instance.
152
159
  */
153
160
  enablePlugin() {
161
+ var _this = this;
154
162
  if (this.enabled) {
155
163
  return;
156
164
  }
@@ -212,7 +220,13 @@ export class Filters extends BasePlugin {
212
220
  this.conditionUpdateObserver.addLocalHook('update', conditionState => _assertClassBrand(_Filters_brand, this, _updateComponents).call(this, conditionState));
213
221
  }
214
222
  this.components.forEach(component => component.show());
215
- this.addHook('afterDropdownMenuDefaultOptions', defaultOptions => _assertClassBrand(_Filters_brand, this, _onAfterDropdownMenuDefaultOptions).call(this, defaultOptions));
223
+ this.addHook('afterDropdownMenuDefaultOptions', function () {
224
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
225
+ args[_key] = arguments[_key];
226
+ }
227
+ return _assertClassBrand(_Filters_brand, _this, _onAfterDropdownMenuDefaultOptions).call(_this, ...args);
228
+ });
229
+ this.addHook('beforeDropdownMenuShow', () => _assertClassBrand(_Filters_brand, this, _onBeforeDropdownMenuShow).call(this));
216
230
  this.addHook('afterDropdownMenuShow', () => _assertClassBrand(_Filters_brand, this, _onAfterDropdownMenuShow).call(this));
217
231
  this.addHook('afterDropdownMenuHide', () => _assertClassBrand(_Filters_brand, this, _onAfterDropdownMenuHide).call(this));
218
232
  this.addHook('afterChange', changes => _assertClassBrand(_Filters_brand, this, _onAfterChange).call(this, changes));
@@ -223,15 +237,15 @@ export class Filters extends BasePlugin {
223
237
  this.dropdownMenuPlugin.enablePlugin();
224
238
  }
225
239
  if (!_classPrivateFieldGet(_menuFocusNavigator, this) && this.dropdownMenuPlugin.enabled) {
226
- const mainMenu = this.dropdownMenuPlugin.menu;
227
240
  const focusableItems = [
228
241
  // A fake menu item that once focused allows escaping from the focus navigation (using Tab keys)
229
242
  // to the menu navigation using arrow keys.
230
243
  {
231
244
  focus: () => {
232
- const menuNavigator = mainMenu.getNavigator();
245
+ const menu = _classPrivateFieldGet(_menuFocusNavigator, this).getMenu();
246
+ const menuNavigator = menu.getNavigator();
233
247
  const lastSelectedMenuItem = _classPrivateFieldGet(_menuFocusNavigator, this).getLastMenuPage();
234
- mainMenu.focus();
248
+ menu.focus();
235
249
  if (lastSelectedMenuItem > 0) {
236
250
  menuNavigator.setCurrentPage(lastSelectedMenuItem);
237
251
  } else {
@@ -242,7 +256,7 @@ export class Filters extends BasePlugin {
242
256
  let [, component] = _ref;
243
257
  return component.getElements();
244
258
  }).flat()];
245
- _classPrivateFieldSet(_menuFocusNavigator, this, createMenuFocusController(mainMenu, focusableItems));
259
+ _classPrivateFieldSet(_menuFocusNavigator, this, createMenuFocusController(this.dropdownMenuPlugin.menu, focusableItems));
246
260
  const forwardToFocusNavigation = event => {
247
261
  _classPrivateFieldGet(_menuFocusNavigator, this).listen();
248
262
  event.preventDefault();
@@ -700,8 +714,8 @@ export class Filters extends BasePlugin {
700
714
  return indexes;
701
715
  }
702
716
  const menu = this.dropdownMenuPlugin.menu;
703
- for (var _len = arguments.length, components = new Array(_len), _key = 0; _key < _len; _key++) {
704
- components[_key] = arguments[_key];
717
+ for (var _len2 = arguments.length, components = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
718
+ components[_key2] = arguments[_key2];
705
719
  }
706
720
  arrayEach(components, component => {
707
721
  arrayEach(menu.menuItems, (item, index) => {
@@ -728,8 +742,8 @@ export class Filters extends BasePlugin {
728
742
  const menu = this.dropdownMenuPlugin.menu;
729
743
  const hotMenu = menu.hotMenu;
730
744
  const hiddenRows = hotMenu.getPlugin('hiddenRows');
731
- for (var _len2 = arguments.length, components = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
732
- components[_key2 - 1] = arguments[_key2];
745
+ for (var _len3 = arguments.length, components = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
746
+ components[_key3 - 1] = arguments[_key3];
733
747
  }
734
748
  const indexes = this.getIndexesOfComponents(...components);
735
749
  if (visible) {
@@ -747,8 +761,8 @@ export class Filters extends BasePlugin {
747
761
  * @param {...BaseComponent} components List of components.
748
762
  */
749
763
  hideComponents() {
750
- for (var _len3 = arguments.length, components = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
751
- components[_key3] = arguments[_key3];
764
+ for (var _len4 = arguments.length, components = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
765
+ components[_key4] = arguments[_key4];
752
766
  }
753
767
  this.changeComponentsVisibility(false, ...components);
754
768
  }
@@ -760,8 +774,8 @@ export class Filters extends BasePlugin {
760
774
  * @param {...BaseComponent} components List of components.
761
775
  */
762
776
  showComponents() {
763
- for (var _len4 = arguments.length, components = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
764
- components[_key4] = arguments[_key4];
777
+ for (var _len5 = arguments.length, components = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
778
+ components[_key5] = arguments[_key5];
765
779
  }
766
780
  this.changeComponentsVisibility(true, ...components);
767
781
  }
@@ -807,6 +821,16 @@ function _onAfterDropdownMenuHide() {
807
821
  this.components.get('filter_by_condition').getSelectElement().closeOptions();
808
822
  this.components.get('filter_by_condition2').getSelectElement().closeOptions();
809
823
  }
824
+ /**
825
+ * Hooks applies the new dropdown menu instance to the focus navigator.
826
+ */
827
+ function _onBeforeDropdownMenuShow() {
828
+ const mainMenu = this.dropdownMenuPlugin.menu;
829
+ if (!_classPrivateFieldGet(_dropdownMenuTraces, this).has(mainMenu)) {
830
+ _classPrivateFieldGet(_menuFocusNavigator, this).setMenu(mainMenu);
831
+ }
832
+ _classPrivateFieldGet(_dropdownMenuTraces, this).add(mainMenu);
833
+ }
810
834
  /**
811
835
  * After dropdown menu default options listener.
812
836
  *
@@ -32,10 +32,11 @@ function createMenuFocusController(mainMenu, menuItems) {
32
32
  * into the focus mode triggered by the TAB or SHIFT+TAB keys).
33
33
  */
34
34
  let lastSelectedMenuItem = -1;
35
+ let menuInstance;
35
36
  const focusNavigator = (0, _focusNavigator.createFocusNavigator)(menuItems);
36
37
  const updateNavigatorPosition = element => () => {
37
- if (mainMenu.isOpened()) {
38
- mainMenu.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);
38
+ if (menuInstance.isOpened()) {
39
+ menuInstance.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);
39
40
  }
40
41
  focusNavigator.setCurrentPage(menuItems.indexOf(element));
41
42
  };
@@ -48,11 +49,7 @@ function createMenuFocusController(mainMenu, menuItems) {
48
49
  element.addLocalHook('afterClose', updateNavigatorPosition(element));
49
50
  }
50
51
  });
51
- mainMenu.addLocalHook('afterSelectionChange', selectedItem => {
52
- if (!selectedItem.key.startsWith('filter_')) {
53
- focusNavigator.clear();
54
- }
55
- });
52
+ setMenu(mainMenu);
56
53
 
57
54
  /**
58
55
  * Extends the menu and submenus with new keyboard shortcuts.
@@ -60,7 +57,7 @@ function createMenuFocusController(mainMenu, menuItems) {
60
57
  * @param {*} menu The menu (as main menu or submenu) instance.
61
58
  */
62
59
  function addKeyboardShortcuts(menu) {
63
- const mainMenuShortcutsCtrl = mainMenu.getKeyboardShortcutsCtrl();
60
+ const mainMenuShortcutsCtrl = menuInstance.getKeyboardShortcutsCtrl();
64
61
  const currentMenuShortcutsCtrl = menu.getKeyboardShortcutsCtrl();
65
62
  focusNavigator.clear();
66
63
  currentMenuShortcutsCtrl.addCustomShortcuts([{
@@ -79,7 +76,7 @@ function createMenuFocusController(mainMenu, menuItems) {
79
76
  mainMenuShortcutsCtrl.addCustomShortcuts([{
80
77
  keys: [['Tab'], ['Shift', 'Tab']],
81
78
  callback: event => {
82
- const menuNavigator = mainMenu.getNavigator();
79
+ const menuNavigator = menuInstance.getNavigator();
83
80
  if (menuNavigator.getCurrentPage() > -1) {
84
81
  lastSelectedMenuItem = menuNavigator.getCurrentPage();
85
82
  }
@@ -93,7 +90,7 @@ function createMenuFocusController(mainMenu, menuItems) {
93
90
  }, {
94
91
  keys: [['Escape']],
95
92
  callback: () => {
96
- mainMenu.close();
93
+ menuInstance.close();
97
94
  }
98
95
  }, {
99
96
  keys: [['Enter'], ['Space']],
@@ -114,16 +111,39 @@ function createMenuFocusController(mainMenu, menuItems) {
114
111
  }
115
112
  }], SHORTCUTS_MENU_CONTEXT);
116
113
  }
117
- mainMenu.addLocalHook('afterSubmenuOpen', addKeyboardShortcuts);
118
- mainMenu.addLocalHook('afterOpen', addKeyboardShortcuts);
119
114
 
120
115
  /**
121
116
  * Focuses the menu and switches its shortcut context to that one which controls
122
117
  * the focus navigation.
123
118
  */
124
119
  function listen() {
125
- mainMenu.focus();
126
- mainMenu.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);
120
+ menuInstance.focus();
121
+ menuInstance.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);
122
+ }
123
+
124
+ /**
125
+ * Applies the focus controller to the new menu instance.
126
+ *
127
+ * @param {Menu} menu The new menu instance.
128
+ */
129
+ function setMenu(menu) {
130
+ menu.addLocalHook('afterSelectionChange', selectedItem => {
131
+ if (!selectedItem.key.startsWith('filter_')) {
132
+ focusNavigator.clear();
133
+ }
134
+ });
135
+ menu.addLocalHook('afterSubmenuOpen', addKeyboardShortcuts);
136
+ menu.addLocalHook('afterOpen', addKeyboardShortcuts);
137
+ menuInstance = menu;
138
+ }
139
+
140
+ /**
141
+ * Retrieves the current menu instance.
142
+ *
143
+ * @returns {Menu} The current menu instance.
144
+ */
145
+ function getMenu() {
146
+ return menuInstance;
127
147
  }
128
148
 
129
149
  /**
@@ -137,6 +157,8 @@ function createMenuFocusController(mainMenu, menuItems) {
137
157
  return {
138
158
  ...focusNavigator,
139
159
  listen,
160
+ setMenu,
161
+ getMenu,
140
162
  getLastMenuPage
141
163
  };
142
164
  }
@@ -28,10 +28,11 @@ export function createMenuFocusController(mainMenu, menuItems) {
28
28
  * into the focus mode triggered by the TAB or SHIFT+TAB keys).
29
29
  */
30
30
  let lastSelectedMenuItem = -1;
31
+ let menuInstance;
31
32
  const focusNavigator = createFocusNavigator(menuItems);
32
33
  const updateNavigatorPosition = element => () => {
33
- if (mainMenu.isOpened()) {
34
- mainMenu.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);
34
+ if (menuInstance.isOpened()) {
35
+ menuInstance.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);
35
36
  }
36
37
  focusNavigator.setCurrentPage(menuItems.indexOf(element));
37
38
  };
@@ -44,11 +45,7 @@ export function createMenuFocusController(mainMenu, menuItems) {
44
45
  element.addLocalHook('afterClose', updateNavigatorPosition(element));
45
46
  }
46
47
  });
47
- mainMenu.addLocalHook('afterSelectionChange', selectedItem => {
48
- if (!selectedItem.key.startsWith('filter_')) {
49
- focusNavigator.clear();
50
- }
51
- });
48
+ setMenu(mainMenu);
52
49
 
53
50
  /**
54
51
  * Extends the menu and submenus with new keyboard shortcuts.
@@ -56,7 +53,7 @@ export function createMenuFocusController(mainMenu, menuItems) {
56
53
  * @param {*} menu The menu (as main menu or submenu) instance.
57
54
  */
58
55
  function addKeyboardShortcuts(menu) {
59
- const mainMenuShortcutsCtrl = mainMenu.getKeyboardShortcutsCtrl();
56
+ const mainMenuShortcutsCtrl = menuInstance.getKeyboardShortcutsCtrl();
60
57
  const currentMenuShortcutsCtrl = menu.getKeyboardShortcutsCtrl();
61
58
  focusNavigator.clear();
62
59
  currentMenuShortcutsCtrl.addCustomShortcuts([{
@@ -75,7 +72,7 @@ export function createMenuFocusController(mainMenu, menuItems) {
75
72
  mainMenuShortcutsCtrl.addCustomShortcuts([{
76
73
  keys: [['Tab'], ['Shift', 'Tab']],
77
74
  callback: event => {
78
- const menuNavigator = mainMenu.getNavigator();
75
+ const menuNavigator = menuInstance.getNavigator();
79
76
  if (menuNavigator.getCurrentPage() > -1) {
80
77
  lastSelectedMenuItem = menuNavigator.getCurrentPage();
81
78
  }
@@ -89,7 +86,7 @@ export function createMenuFocusController(mainMenu, menuItems) {
89
86
  }, {
90
87
  keys: [['Escape']],
91
88
  callback: () => {
92
- mainMenu.close();
89
+ menuInstance.close();
93
90
  }
94
91
  }, {
95
92
  keys: [['Enter'], ['Space']],
@@ -110,16 +107,39 @@ export function createMenuFocusController(mainMenu, menuItems) {
110
107
  }
111
108
  }], SHORTCUTS_MENU_CONTEXT);
112
109
  }
113
- mainMenu.addLocalHook('afterSubmenuOpen', addKeyboardShortcuts);
114
- mainMenu.addLocalHook('afterOpen', addKeyboardShortcuts);
115
110
 
116
111
  /**
117
112
  * Focuses the menu and switches its shortcut context to that one which controls
118
113
  * the focus navigation.
119
114
  */
120
115
  function listen() {
121
- mainMenu.focus();
122
- mainMenu.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);
116
+ menuInstance.focus();
117
+ menuInstance.getKeyboardShortcutsCtrl().listen(SHORTCUTS_MENU_CONTEXT);
118
+ }
119
+
120
+ /**
121
+ * Applies the focus controller to the new menu instance.
122
+ *
123
+ * @param {Menu} menu The new menu instance.
124
+ */
125
+ function setMenu(menu) {
126
+ menu.addLocalHook('afterSelectionChange', selectedItem => {
127
+ if (!selectedItem.key.startsWith('filter_')) {
128
+ focusNavigator.clear();
129
+ }
130
+ });
131
+ menu.addLocalHook('afterSubmenuOpen', addKeyboardShortcuts);
132
+ menu.addLocalHook('afterOpen', addKeyboardShortcuts);
133
+ menuInstance = menu;
134
+ }
135
+
136
+ /**
137
+ * Retrieves the current menu instance.
138
+ *
139
+ * @returns {Menu} The current menu instance.
140
+ */
141
+ function getMenu() {
142
+ return menuInstance;
123
143
  }
124
144
 
125
145
  /**
@@ -133,6 +153,8 @@ export function createMenuFocusController(mainMenu, menuItems) {
133
153
  return {
134
154
  ...focusNavigator,
135
155
  listen,
156
+ setMenu,
157
+ getMenu,
136
158
  getLastMenuPage
137
159
  };
138
160
  }