handsontable 0.0.0-next-ee5ee21-20241202 → 0.0.0-next-b3759c7-20241203

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 (116) hide show
  1. package/3rdparty/walkontable/src/calculator/index.js +1 -2
  2. package/3rdparty/walkontable/src/calculator/index.mjs +2 -2
  3. package/3rdparty/walkontable/src/calculator/viewportRows.js +3 -3
  4. package/3rdparty/walkontable/src/calculator/viewportRows.mjs +3 -3
  5. package/3rdparty/walkontable/src/core/_base.js +3 -0
  6. package/3rdparty/walkontable/src/core/_base.mjs +3 -0
  7. package/3rdparty/walkontable/src/core/clone.js +1 -0
  8. package/3rdparty/walkontable/src/core/clone.mjs +1 -0
  9. package/3rdparty/walkontable/src/core/core.js +2 -0
  10. package/3rdparty/walkontable/src/core/core.mjs +2 -0
  11. package/3rdparty/walkontable/src/facade/core.js +3 -0
  12. package/3rdparty/walkontable/src/facade/core.mjs +3 -0
  13. package/3rdparty/walkontable/src/index.js +0 -1
  14. package/3rdparty/walkontable/src/index.mjs +2 -2
  15. package/3rdparty/walkontable/src/overlay/_base.js +3 -1
  16. package/3rdparty/walkontable/src/overlay/_base.mjs +3 -1
  17. package/3rdparty/walkontable/src/overlay/bottom.js +6 -5
  18. package/3rdparty/walkontable/src/overlay/bottom.mjs +6 -5
  19. package/3rdparty/walkontable/src/overlay/inlineStart.js +7 -6
  20. package/3rdparty/walkontable/src/overlay/inlineStart.mjs +8 -7
  21. package/3rdparty/walkontable/src/overlay/top.js +9 -8
  22. package/3rdparty/walkontable/src/overlay/top.mjs +10 -9
  23. package/3rdparty/walkontable/src/overlays.js +20 -0
  24. package/3rdparty/walkontable/src/overlays.mjs +20 -0
  25. package/3rdparty/walkontable/src/renderer/index.js +4 -2
  26. package/3rdparty/walkontable/src/renderer/index.mjs +4 -2
  27. package/3rdparty/walkontable/src/renderer/table.js +12 -3
  28. package/3rdparty/walkontable/src/renderer/table.mjs +12 -3
  29. package/3rdparty/walkontable/src/selection/border/border.js +19 -13
  30. package/3rdparty/walkontable/src/selection/border/border.mjs +19 -13
  31. package/3rdparty/walkontable/src/selection/border/utils.js +26 -0
  32. package/3rdparty/walkontable/src/selection/border/utils.mjs +22 -0
  33. package/3rdparty/walkontable/src/selection/index.js +4 -4
  34. package/3rdparty/walkontable/src/selection/index.mjs +1 -1
  35. package/3rdparty/walkontable/src/settings.js +0 -2
  36. package/3rdparty/walkontable/src/settings.mjs +0 -2
  37. package/3rdparty/walkontable/src/table.js +17 -9
  38. package/3rdparty/walkontable/src/table.mjs +17 -9
  39. package/3rdparty/walkontable/src/types.js +1 -0
  40. package/3rdparty/walkontable/src/types.mjs +1 -0
  41. package/3rdparty/walkontable/src/utils/column.js +1 -1
  42. package/3rdparty/walkontable/src/utils/column.mjs +1 -1
  43. package/3rdparty/walkontable/src/utils/stylesHandler.js +295 -0
  44. package/3rdparty/walkontable/src/utils/stylesHandler.mjs +291 -0
  45. package/3rdparty/walkontable/src/viewport.js +1 -0
  46. package/3rdparty/walkontable/src/viewport.mjs +1 -0
  47. package/base.js +2 -2
  48. package/base.mjs +2 -2
  49. package/core/hooks/constants.js +9 -0
  50. package/core/hooks/constants.mjs +9 -0
  51. package/core/hooks/index.d.ts +1 -0
  52. package/core.d.ts +2 -0
  53. package/core.js +50 -1
  54. package/core.mjs +50 -1
  55. package/dataMap/metaManager/metaSchema.js +23 -3
  56. package/dataMap/metaManager/metaSchema.mjs +23 -3
  57. package/dist/handsontable.css +84 -72
  58. package/dist/handsontable.full.css +317 -304
  59. package/dist/handsontable.full.js +5923 -5741
  60. package/dist/handsontable.full.min.css +15 -10
  61. package/dist/handsontable.full.min.js +54 -53
  62. package/dist/handsontable.js +4372 -3958
  63. package/dist/handsontable.min.css +10 -6
  64. package/dist/handsontable.min.js +32 -32
  65. package/editors/autocompleteEditor/autocompleteEditor.js +1 -1
  66. package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -1
  67. package/editors/baseEditor/baseEditor.js +1 -1
  68. package/editors/baseEditor/baseEditor.mjs +1 -1
  69. package/editors/dateEditor/dateEditor.js +9 -0
  70. package/editors/dateEditor/dateEditor.mjs +10 -1
  71. package/editors/handsontableEditor/handsontableEditor.js +7 -1
  72. package/editors/handsontableEditor/handsontableEditor.mjs +7 -1
  73. package/editors/selectEditor/selectEditor.js +20 -9
  74. package/editors/selectEditor/selectEditor.mjs +20 -9
  75. package/editors/textEditor/textEditor.js +4 -11
  76. package/editors/textEditor/textEditor.mjs +4 -11
  77. package/helpers/dom/element.js +32 -1
  78. package/helpers/dom/element.mjs +31 -1
  79. package/helpers/mixed.js +2 -2
  80. package/helpers/mixed.mjs +2 -2
  81. package/helpers/themes.js +17 -0
  82. package/helpers/themes.mjs +13 -0
  83. package/package.json +12 -3
  84. package/plugins/comments/commentEditor.js +9 -0
  85. package/plugins/comments/commentEditor.mjs +9 -0
  86. package/plugins/comments/comments.js +14 -0
  87. package/plugins/comments/comments.mjs +15 -1
  88. package/plugins/contextMenu/menu/menu.js +9 -4
  89. package/plugins/contextMenu/menu/menu.mjs +9 -4
  90. package/plugins/filters/ui/multipleSelect.js +6 -0
  91. package/plugins/filters/ui/multipleSelect.mjs +6 -0
  92. package/plugins/manualRowMove/manualRowMove.js +1 -1
  93. package/plugins/manualRowMove/manualRowMove.mjs +1 -1
  94. package/plugins/manualRowResize/manualRowResize.js +1 -2
  95. package/plugins/manualRowResize/manualRowResize.mjs +2 -3
  96. package/plugins/mergeCells/mergeCells.js +1 -1
  97. package/plugins/mergeCells/mergeCells.mjs +1 -1
  98. package/plugins/nestedRows/ui/headers.js +7 -1
  99. package/plugins/nestedRows/ui/headers.mjs +7 -1
  100. package/plugins/stretchColumns/calculator.js +2 -1
  101. package/plugins/stretchColumns/calculator.mjs +3 -2
  102. package/settings.d.ts +1 -0
  103. package/styles/handsontable.css +2307 -0
  104. package/styles/handsontable.min.css +30 -0
  105. package/styles/ht-theme-horizon.css +607 -0
  106. package/styles/ht-theme-horizon.min.css +30 -0
  107. package/styles/ht-theme-main.css +613 -0
  108. package/styles/ht-theme-main.min.css +30 -0
  109. package/tableView.js +67 -0
  110. package/tableView.mjs +68 -1
  111. package/utils/autoResize.js +4 -1
  112. package/utils/autoResize.mjs +4 -1
  113. package/utils/ghostTable.js +5 -3
  114. package/utils/ghostTable.mjs +5 -3
  115. package/3rdparty/walkontable/src/selection/border/constants.js +0 -15
  116. package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -12
package/core.js CHANGED
@@ -47,6 +47,7 @@ var _index3 = require("./core/index");
47
47
  var _uniqueMap = require("./utils/dataStructures/uniqueMap");
48
48
  var _shortcuts = require("./shortcuts");
49
49
  var _shortcutContexts = require("./shortcutContexts");
50
+ var _themes = require("./helpers/themes");
50
51
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
51
52
  let activeGuid = null;
52
53
 
@@ -234,6 +235,7 @@ function Core(rootElement, userSettings) {
234
235
  rootElement.insertBefore(this.container, rootElement.firstChild);
235
236
  if ((0, _rootInstance.isRootInstance)(this)) {
236
237
  (0, _mixed._injectProductInfo)(userSettings.licenseKey, rootElement);
238
+ (0, _element.addClass)(rootElement, 'ht-wrapper');
237
239
  }
238
240
  this.guid = `ht_${(0, _string.randomString)()}`; // this is the namespace for global events
239
241
 
@@ -946,7 +948,9 @@ function Core(rootElement, userSettings) {
946
948
  // when 'value' is array and 'orgValue' is null, set 'orgValue' to
947
949
  // an empty array so that the null value can be compared to 'value'
948
950
  // as an empty value for the array context
949
- if (Array.isArray(value) && orgValue === null) orgValue = [];
951
+ if (Array.isArray(value) && orgValue === null) {
952
+ orgValue = [];
953
+ }
950
954
  if (orgValue === null || typeof orgValue !== 'object') {
951
955
  pushData = false;
952
956
  } else {
@@ -1034,6 +1038,13 @@ function Core(rootElement, userSettings) {
1034
1038
  }
1035
1039
  this.updateSettings(tableMeta, true);
1036
1040
  this.view = new _tableView.default(this);
1041
+ const themeName = tableMeta.themeName || (0, _themes.getThemeClassName)(instance.rootElement);
1042
+
1043
+ // Use the theme defined as a root element class or in the settings (in that order).
1044
+ instance.useTheme(themeName);
1045
+
1046
+ // Add the theme class name to the license info element.
1047
+ instance.view.addClassNameToLicenseElement(instance.getCurrentThemeName());
1037
1048
  editorManager = _editorManager.default.getInstance(instance, tableMeta, selection);
1038
1049
  viewportScroller = (0, _index3.createViewportScroller)(instance);
1039
1050
  focusManager = new _focusManager.FocusManager(instance);
@@ -2387,6 +2398,19 @@ function Core(rootElement, userSettings) {
2387
2398
  if (instance.view) {
2388
2399
  instance.view._wt.wtViewport.resetHasOversizedColumnHeadersMarked();
2389
2400
  instance.view._wt.exportSettingsAsClassNames();
2401
+ const currentThemeName = instance.getCurrentThemeName();
2402
+ const themeNameOptionExists = (0, _object.hasOwnProperty)(settings, 'themeName');
2403
+ if (currentThemeName && themeNameOptionExists) {
2404
+ instance.view.getStylesHandler().removeClassNames();
2405
+ instance.view.removeClassNameFromLicenseElement(currentThemeName);
2406
+ }
2407
+ const themeName = themeNameOptionExists && settings.themeName || (0, _themes.getThemeClassName)(instance.rootElement);
2408
+
2409
+ // Use the theme defined as a root element class or in the settings (in that order).
2410
+ instance.useTheme(themeName);
2411
+
2412
+ // Add the theme class name to the license info element.
2413
+ instance.view.addClassNameToLicenseElement(instance.getCurrentThemeName());
2390
2414
  }
2391
2415
  instance.runHooks('afterUpdateSettings', settings);
2392
2416
  }
@@ -4576,6 +4600,31 @@ function Core(rootElement, userSettings) {
4576
4600
  };
4577
4601
  this.timeouts = [];
4578
4602
 
4603
+ /**
4604
+ * Use the theme specified by the provided name.
4605
+ *
4606
+ * @memberof Core#
4607
+ * @function useTheme
4608
+ * @since 15.0.0
4609
+ * @param {string|boolean|undefined} themeName The name of the theme to use.
4610
+ */
4611
+ this.useTheme = themeName => {
4612
+ this.view.getStylesHandler().useTheme(themeName);
4613
+ this.runHooks('afterSetTheme', themeName, !!firstRun);
4614
+ };
4615
+
4616
+ /**
4617
+ * Gets the name of the currently used theme.
4618
+ *
4619
+ * @memberof Core#
4620
+ * @function getCurrentThemeName
4621
+ * @since 15.0.0
4622
+ * @returns {string|undefined} The name of the currently used theme.
4623
+ */
4624
+ this.getCurrentThemeName = () => {
4625
+ return this.view.getStylesHandler().getThemeName();
4626
+ };
4627
+
4579
4628
  /**
4580
4629
  * Sets timeout. Purpose of this method is to clear all known timeouts when `destroy` method is called.
4581
4630
  *
package/core.mjs CHANGED
@@ -43,6 +43,7 @@ import { installFocusCatcher, createViewportScroller } from "./core/index.mjs";
43
43
  import { createUniqueMap } from "./utils/dataStructures/uniqueMap.mjs";
44
44
  import { createShortcutManager } from "./shortcuts/index.mjs";
45
45
  import { registerAllShortcutContexts } from "./shortcutContexts/index.mjs";
46
+ import { getThemeClassName } from "./helpers/themes.mjs";
46
47
  let activeGuid = null;
47
48
 
48
49
  /**
@@ -229,6 +230,7 @@ export default function Core(rootElement, userSettings) {
229
230
  rootElement.insertBefore(this.container, rootElement.firstChild);
230
231
  if (isRootInstance(this)) {
231
232
  _injectProductInfo(userSettings.licenseKey, rootElement);
233
+ addClass(rootElement, 'ht-wrapper');
232
234
  }
233
235
  this.guid = `ht_${randomString()}`; // this is the namespace for global events
234
236
 
@@ -941,7 +943,9 @@ export default function Core(rootElement, userSettings) {
941
943
  // when 'value' is array and 'orgValue' is null, set 'orgValue' to
942
944
  // an empty array so that the null value can be compared to 'value'
943
945
  // as an empty value for the array context
944
- if (Array.isArray(value) && orgValue === null) orgValue = [];
946
+ if (Array.isArray(value) && orgValue === null) {
947
+ orgValue = [];
948
+ }
945
949
  if (orgValue === null || typeof orgValue !== 'object') {
946
950
  pushData = false;
947
951
  } else {
@@ -1029,6 +1033,13 @@ export default function Core(rootElement, userSettings) {
1029
1033
  }
1030
1034
  this.updateSettings(tableMeta, true);
1031
1035
  this.view = new TableView(this);
1036
+ const themeName = tableMeta.themeName || getThemeClassName(instance.rootElement);
1037
+
1038
+ // Use the theme defined as a root element class or in the settings (in that order).
1039
+ instance.useTheme(themeName);
1040
+
1041
+ // Add the theme class name to the license info element.
1042
+ instance.view.addClassNameToLicenseElement(instance.getCurrentThemeName());
1032
1043
  editorManager = EditorManager.getInstance(instance, tableMeta, selection);
1033
1044
  viewportScroller = createViewportScroller(instance);
1034
1045
  focusManager = new FocusManager(instance);
@@ -2382,6 +2393,19 @@ export default function Core(rootElement, userSettings) {
2382
2393
  if (instance.view) {
2383
2394
  instance.view._wt.wtViewport.resetHasOversizedColumnHeadersMarked();
2384
2395
  instance.view._wt.exportSettingsAsClassNames();
2396
+ const currentThemeName = instance.getCurrentThemeName();
2397
+ const themeNameOptionExists = hasOwnProperty(settings, 'themeName');
2398
+ if (currentThemeName && themeNameOptionExists) {
2399
+ instance.view.getStylesHandler().removeClassNames();
2400
+ instance.view.removeClassNameFromLicenseElement(currentThemeName);
2401
+ }
2402
+ const themeName = themeNameOptionExists && settings.themeName || getThemeClassName(instance.rootElement);
2403
+
2404
+ // Use the theme defined as a root element class or in the settings (in that order).
2405
+ instance.useTheme(themeName);
2406
+
2407
+ // Add the theme class name to the license info element.
2408
+ instance.view.addClassNameToLicenseElement(instance.getCurrentThemeName());
2385
2409
  }
2386
2410
  instance.runHooks('afterUpdateSettings', settings);
2387
2411
  }
@@ -4571,6 +4595,31 @@ export default function Core(rootElement, userSettings) {
4571
4595
  };
4572
4596
  this.timeouts = [];
4573
4597
 
4598
+ /**
4599
+ * Use the theme specified by the provided name.
4600
+ *
4601
+ * @memberof Core#
4602
+ * @function useTheme
4603
+ * @since 15.0.0
4604
+ * @param {string|boolean|undefined} themeName The name of the theme to use.
4605
+ */
4606
+ this.useTheme = themeName => {
4607
+ this.view.getStylesHandler().useTheme(themeName);
4608
+ this.runHooks('afterSetTheme', themeName, !!firstRun);
4609
+ };
4610
+
4611
+ /**
4612
+ * Gets the name of the currently used theme.
4613
+ *
4614
+ * @memberof Core#
4615
+ * @function getCurrentThemeName
4616
+ * @since 15.0.0
4617
+ * @returns {string|undefined} The name of the currently used theme.
4618
+ */
4619
+ this.getCurrentThemeName = () => {
4620
+ return this.view.getStylesHandler().getThemeName();
4621
+ };
4622
+
4574
4623
  /**
4575
4624
  * Sets timeout. Purpose of this method is to clear all known timeouts when `destroy` method is called.
4576
4625
  *
@@ -3842,8 +3842,8 @@ var _default = () => {
3842
3842
  /**
3843
3843
  * The `rowHeights` option sets rows' heights, in pixels.
3844
3844
  *
3845
- * In the rendering process, the default row height is 23 px (22 px + 1 px of the row's bottom border).
3846
- * You can change it to equal or greater than 23px, by setting the `rowHeights` option to one of the following:
3845
+ * In the rendering process, the default row height is 23 px (in the classic theme: 22 px + 1 px of the row's bottom border) or whatever is defined in the used theme (based on the line height, vertical padding and cell borders).
3846
+ * You can change it to equal or greater than the defautl value, by setting the `rowHeights` option to one of the following:
3847
3847
  *
3848
3848
  * | Setting | Description | Example |
3849
3849
  * | ----------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
@@ -3875,7 +3875,7 @@ var _default = () => {
3875
3875
  * // set the first (by visual index) row's height to 100
3876
3876
  * // set the second (by visual index) row's height to 120
3877
3877
  * // set the third (by visual index) row's height to `undefined`
3878
- * // set any other row's height to the default 23px
3878
+ * // set any other row's height to the default height value
3879
3879
  * rowHeights: [100, 120, undefined],
3880
3880
  *
3881
3881
  * // set each row's height individually, using a function
@@ -4313,6 +4313,26 @@ var _default = () => {
4313
4313
  * ```
4314
4314
  */
4315
4315
  tableClassName: undefined,
4316
+ /**
4317
+ * The `themeName` option allows enabling a theme by that name.
4318
+ *
4319
+ * If no `themeName` is provided, the table will use the classic theme (if the correct CSS files are imported).
4320
+ *
4321
+ * Read more:
4322
+ * - [Themes](@/guides/styling/themes/themes.md)
4323
+ *
4324
+ * @memberof Options#
4325
+ * @type {string|boolean|undefined}
4326
+ * @default undefined
4327
+ * @category Core
4328
+ * @since 15.0.0
4329
+ *
4330
+ * @example
4331
+ * ```js
4332
+ * themeName: 'ht-theme-name',
4333
+ * ```
4334
+ */
4335
+ themeName: undefined,
4316
4336
  /**
4317
4337
  * The `tabMoves` option configures the action of the <kbd>**Tab**</kbd> key.
4318
4338
  *
@@ -3839,8 +3839,8 @@ export default () => {
3839
3839
  /**
3840
3840
  * The `rowHeights` option sets rows' heights, in pixels.
3841
3841
  *
3842
- * In the rendering process, the default row height is 23 px (22 px + 1 px of the row's bottom border).
3843
- * You can change it to equal or greater than 23px, by setting the `rowHeights` option to one of the following:
3842
+ * In the rendering process, the default row height is 23 px (in the classic theme: 22 px + 1 px of the row's bottom border) or whatever is defined in the used theme (based on the line height, vertical padding and cell borders).
3843
+ * You can change it to equal or greater than the defautl value, by setting the `rowHeights` option to one of the following:
3844
3844
  *
3845
3845
  * | Setting | Description | Example |
3846
3846
  * | ----------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
@@ -3872,7 +3872,7 @@ export default () => {
3872
3872
  * // set the first (by visual index) row's height to 100
3873
3873
  * // set the second (by visual index) row's height to 120
3874
3874
  * // set the third (by visual index) row's height to `undefined`
3875
- * // set any other row's height to the default 23px
3875
+ * // set any other row's height to the default height value
3876
3876
  * rowHeights: [100, 120, undefined],
3877
3877
  *
3878
3878
  * // set each row's height individually, using a function
@@ -4310,6 +4310,26 @@ export default () => {
4310
4310
  * ```
4311
4311
  */
4312
4312
  tableClassName: undefined,
4313
+ /**
4314
+ * The `themeName` option allows enabling a theme by that name.
4315
+ *
4316
+ * If no `themeName` is provided, the table will use the classic theme (if the correct CSS files are imported).
4317
+ *
4318
+ * Read more:
4319
+ * - [Themes](@/guides/styling/themes/themes.md)
4320
+ *
4321
+ * @memberof Options#
4322
+ * @type {string|boolean|undefined}
4323
+ * @default undefined
4324
+ * @category Core
4325
+ * @since 15.0.0
4326
+ *
4327
+ * @example
4328
+ * ```js
4329
+ * themeName: 'ht-theme-name',
4330
+ * ```
4331
+ */
4332
+ themeName: undefined,
4313
4333
  /**
4314
4334
  * The `tabMoves` option configures the action of the <kbd>**Tab**</kbd> key.
4315
4335
  *