handsontable 0.0.0-next-2c41c5b-20250814 → 0.0.0-next-fce5825-20250822

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of handsontable might be problematic. Click here for more details.

Files changed (126) hide show
  1. package/base.js +2 -2
  2. package/base.mjs +2 -2
  3. package/cellTypes/autocompleteType/autocompleteType.js +1 -4
  4. package/cellTypes/autocompleteType/autocompleteType.mjs +1 -4
  5. package/cellTypes/checkboxType/checkboxType.js +1 -3
  6. package/cellTypes/checkboxType/checkboxType.mjs +1 -3
  7. package/cellTypes/dropdownType/dropdownType.js +1 -4
  8. package/cellTypes/dropdownType/dropdownType.mjs +1 -4
  9. package/cellTypes/numericType/numericType.js +1 -3
  10. package/cellTypes/numericType/numericType.mjs +1 -3
  11. package/core/focusCatcher/index.js +37 -20
  12. package/core/focusCatcher/index.mjs +37 -20
  13. package/core/focusCatcher/utils.js +3 -64
  14. package/core/focusCatcher/utils.mjs +1 -60
  15. package/core/hooks/constants.js +58 -0
  16. package/core/hooks/constants.mjs +58 -0
  17. package/core/hooks/index.d.ts +7 -0
  18. package/core.d.ts +0 -1
  19. package/core.js +59 -55
  20. package/core.mjs +61 -57
  21. package/dataMap/dataMap.js +3 -13
  22. package/dataMap/dataMap.mjs +4 -14
  23. package/dataMap/dataSource.js +0 -16
  24. package/dataMap/dataSource.mjs +0 -16
  25. package/dataMap/metaManager/lazyFactoryMap.js +3 -4
  26. package/dataMap/metaManager/lazyFactoryMap.mjs +1 -2
  27. package/dataMap/metaManager/metaLayers/cellMeta.js +2 -3
  28. package/dataMap/metaManager/metaLayers/cellMeta.mjs +2 -3
  29. package/dataMap/metaManager/metaSchema.js +97 -68
  30. package/dataMap/metaManager/metaSchema.mjs +97 -68
  31. package/dataMap/metaManager/utils.js +11 -0
  32. package/dataMap/metaManager/utils.mjs +10 -0
  33. package/dist/handsontable.css +103 -5
  34. package/dist/handsontable.full.css +103 -5
  35. package/dist/handsontable.full.js +2770 -1954
  36. package/dist/handsontable.full.min.css +3 -3
  37. package/dist/handsontable.full.min.js +67 -67
  38. package/dist/handsontable.js +2772 -1956
  39. package/dist/handsontable.min.css +3 -3
  40. package/dist/handsontable.min.js +27 -27
  41. package/editors/autocompleteEditor/autocompleteEditor.js +8 -33
  42. package/editors/autocompleteEditor/autocompleteEditor.mjs +9 -34
  43. package/editors/baseEditor/baseEditor.js +2 -2
  44. package/editors/baseEditor/baseEditor.mjs +2 -2
  45. package/helpers/a11y.js +5 -1
  46. package/helpers/a11y.mjs +3 -1
  47. package/helpers/mixed.js +64 -1
  48. package/helpers/mixed.mjs +62 -1
  49. package/helpers/number.js +0 -28
  50. package/helpers/number.mjs +0 -26
  51. package/helpers/string.js +0 -19
  52. package/helpers/string.mjs +0 -18
  53. package/index.d.ts +9 -0
  54. package/package.json +6 -1
  55. package/plugins/autofill/autofill.js +3 -50
  56. package/plugins/autofill/autofill.mjs +3 -50
  57. package/plugins/base/base.js +75 -14
  58. package/plugins/base/base.mjs +75 -14
  59. package/plugins/contextMenu/contextMenu.js +1 -0
  60. package/plugins/contextMenu/contextMenu.mjs +1 -0
  61. package/plugins/copyPaste/copyPaste.js +28 -61
  62. package/plugins/copyPaste/copyPaste.mjs +29 -62
  63. package/plugins/dialog/dialog.d.ts +23 -0
  64. package/plugins/dialog/dialog.js +469 -0
  65. package/plugins/dialog/dialog.mjs +465 -0
  66. package/plugins/dialog/index.d.ts +1 -0
  67. package/plugins/dialog/index.js +7 -0
  68. package/plugins/dialog/index.mjs +1 -0
  69. package/plugins/dialog/ui.js +240 -0
  70. package/plugins/dialog/ui.mjs +235 -0
  71. package/plugins/dropdownMenu/dropdownMenu.js +1 -0
  72. package/plugins/dropdownMenu/dropdownMenu.mjs +1 -0
  73. package/plugins/index.d.ts +3 -0
  74. package/plugins/index.js +3 -0
  75. package/plugins/index.mjs +3 -1
  76. package/plugins/pagination/focusController.js +27 -0
  77. package/plugins/pagination/focusController.mjs +23 -0
  78. package/plugins/pagination/pagination.js +165 -18
  79. package/plugins/pagination/pagination.mjs +165 -18
  80. package/plugins/pagination/ui.js +101 -62
  81. package/plugins/pagination/ui.mjs +102 -63
  82. package/selection/range.js +11 -0
  83. package/selection/range.mjs +11 -0
  84. package/selection/selection.js +63 -2
  85. package/selection/selection.mjs +63 -2
  86. package/selection/utils.js +2 -1
  87. package/selection/utils.mjs +2 -1
  88. package/settings.d.ts +3 -3
  89. package/shortcuts/context.js +4 -1
  90. package/shortcuts/context.mjs +4 -1
  91. package/shortcuts/manager.js +17 -3
  92. package/shortcuts/manager.mjs +17 -3
  93. package/styles/handsontable.css +106 -22
  94. package/styles/handsontable.min.css +3 -3
  95. package/styles/ht-theme-horizon.css +24 -6
  96. package/styles/ht-theme-horizon.min.css +3 -3
  97. package/styles/ht-theme-main.css +52 -34
  98. package/styles/ht-theme-main.min.css +3 -3
  99. package/tableView.js +7 -2
  100. package/tableView.mjs +7 -2
  101. package/{core/focusCatcher → utils}/focusDetector.js +29 -11
  102. package/{core/focusCatcher → utils}/focusDetector.mjs +29 -11
  103. package/validators/autocompleteValidator/autocompleteValidator.js +1 -2
  104. package/validators/autocompleteValidator/autocompleteValidator.mjs +1 -2
  105. package/cellTypes/autocompleteType/accessors/index.js +0 -7
  106. package/cellTypes/autocompleteType/accessors/index.mjs +0 -2
  107. package/cellTypes/autocompleteType/accessors/valueGetter.js +0 -14
  108. package/cellTypes/autocompleteType/accessors/valueGetter.mjs +0 -10
  109. package/cellTypes/autocompleteType/accessors/valueSetter.js +0 -25
  110. package/cellTypes/autocompleteType/accessors/valueSetter.mjs +0 -21
  111. package/cellTypes/checkboxType/accessors/index.js +0 -5
  112. package/cellTypes/checkboxType/accessors/index.mjs +0 -1
  113. package/cellTypes/checkboxType/accessors/valueSetter.js +0 -26
  114. package/cellTypes/checkboxType/accessors/valueSetter.mjs +0 -22
  115. package/cellTypes/dropdownType/accessors/index.js +0 -7
  116. package/cellTypes/dropdownType/accessors/index.mjs +0 -2
  117. package/cellTypes/dropdownType/accessors/valueGetter.js +0 -14
  118. package/cellTypes/dropdownType/accessors/valueGetter.mjs +0 -10
  119. package/cellTypes/dropdownType/accessors/valueSetter.js +0 -17
  120. package/cellTypes/dropdownType/accessors/valueSetter.mjs +0 -13
  121. package/cellTypes/numericType/accessors/index.js +0 -5
  122. package/cellTypes/numericType/accessors/index.mjs +0 -1
  123. package/cellTypes/numericType/accessors/valueSetter.js +0 -19
  124. package/cellTypes/numericType/accessors/valueSetter.mjs +0 -15
  125. package/utils/valueAccessors.js +0 -45
  126. package/utils/valueAccessors.mjs +0 -40
@@ -0,0 +1,240 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ require("core-js/modules/es.error.cause.js");
5
+ var _templateLiteralTag = require("../../helpers/templateLiteralTag");
6
+ var _object = require("../../helpers/object");
7
+ var _localHooks = _interopRequireDefault(require("../../mixins/localHooks"));
8
+ var _element = require("../../helpers/dom/element");
9
+ var _a11y = require("../../helpers/a11y");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
12
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
13
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
14
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
15
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
16
+ const DIALOG_CLASS_NAME = 'ht-dialog';
17
+ const TEMPLATE = `
18
+ <div data-ref="dialogElement" class="${DIALOG_CLASS_NAME}">
19
+ <div data-ref="contentWrapperElement" class="${DIALOG_CLASS_NAME}__content-wrapper">
20
+ <div data-ref="contentElement" class="${DIALOG_CLASS_NAME}__content"></div>
21
+ </div>
22
+ </div>
23
+ `;
24
+
25
+ /**
26
+ * DialogUI is a UI component that renders and manages dialog elements.
27
+ * It handles dialog creation, content updates, visibility toggling, and styling.
28
+ *
29
+ * @private
30
+ * @class DialogUI
31
+ */
32
+ var _rootElement = /*#__PURE__*/new WeakMap();
33
+ var _refs = /*#__PURE__*/new WeakMap();
34
+ var _isRtl = /*#__PURE__*/new WeakMap();
35
+ class DialogUI {
36
+ constructor(_ref) {
37
+ let {
38
+ rootElement,
39
+ isRtl
40
+ } = _ref;
41
+ /**
42
+ * The root element where the dialog UI will be installed.
43
+ *
44
+ * @type {HTMLElement}
45
+ */
46
+ _classPrivateFieldInitSpec(this, _rootElement, void 0);
47
+ /**
48
+ * The references to the UI elements.
49
+ *
50
+ * @type {object}
51
+ */
52
+ _classPrivateFieldInitSpec(this, _refs, void 0);
53
+ /**
54
+ * Indicates if the UI is in RTL mode.
55
+ *
56
+ * @type {boolean}
57
+ */
58
+ _classPrivateFieldInitSpec(this, _isRtl, false);
59
+ _classPrivateFieldSet(_rootElement, this, rootElement);
60
+ _classPrivateFieldSet(_isRtl, this, isRtl);
61
+ this.install();
62
+ }
63
+
64
+ /**
65
+ * Creates the dialog UI elements and sets up the structure.
66
+ */
67
+ install() {
68
+ var _classPrivateFieldGet2;
69
+ if ((_classPrivateFieldGet2 = _classPrivateFieldGet(_refs, this)) !== null && _classPrivateFieldGet2 !== void 0 && _classPrivateFieldGet2.dialogElement) {
70
+ return;
71
+ }
72
+ const elements = (0, _templateLiteralTag.html)`${TEMPLATE}`;
73
+ _classPrivateFieldSet(_refs, this, elements.refs);
74
+ const {
75
+ dialogElement
76
+ } = _classPrivateFieldGet(_refs, this);
77
+ dialogElement.addEventListener('click', () => this.runLocalHooks('clickDialogElement'));
78
+
79
+ // Set ARIA attributes
80
+ (0, _element.setAttribute)(dialogElement, [(0, _a11y.A11Y_DIALOG)(), (0, _a11y.A11Y_MODAL)(), (0, _a11y.A11Y_TABINDEX)(-1), ['dir', _classPrivateFieldGet(_isRtl, this) ? 'rtl' : 'ltr']]);
81
+
82
+ // Append to Handsontable after table grid element
83
+ _classPrivateFieldGet(_rootElement, this).after(elements.fragment);
84
+ }
85
+
86
+ /**
87
+ * Returns the dialog element.
88
+ *
89
+ * @returns {HTMLElement} The dialog element.
90
+ */
91
+ getDialogElement() {
92
+ return _classPrivateFieldGet(_refs, this).dialogElement;
93
+ }
94
+
95
+ /**
96
+ * Checks if the given element is inside the dialog.
97
+ *
98
+ * @param {HTMLElement} element - The element to check.
99
+ * @returns {boolean} Returns `true` if the element is inside the dialog, `false` otherwise.
100
+ */
101
+ isInsideDialog(element) {
102
+ return _classPrivateFieldGet(_refs, this).dialogElement.contains(element);
103
+ }
104
+
105
+ /**
106
+ * Updates the dialog content and class name.
107
+ *
108
+ * @param {object} options - Class name update options.
109
+ * @param {boolean} options.isVisible - Whether the dialog is visible.
110
+ * @param {string|HTMLElement} options.content - The content to render in the dialog.
111
+ * @param {string} options.customClassName - The custom class name to add to the dialog.
112
+ * @param {string} options.background - The background to add to the dialog.
113
+ * @param {boolean} options.contentBackground - Whether to show content background.
114
+ * @param {string} options.contentDirections - The flex direction for content layout.
115
+ * @param {boolean} options.animation - Whether to add the animation class to the dialog.
116
+ *
117
+ * @returns {DialogUI} The instance of the DialogUI.
118
+ */
119
+ updateDialog(_ref2) {
120
+ let {
121
+ isVisible,
122
+ content,
123
+ customClassName,
124
+ background,
125
+ contentBackground,
126
+ contentDirections,
127
+ animation
128
+ } = _ref2;
129
+ const {
130
+ dialogElement,
131
+ contentElement
132
+ } = _classPrivateFieldGet(_refs, this);
133
+
134
+ // Dialog class name
135
+ const customClass = customClassName ? ` ${customClassName}` : '';
136
+ const backgroundClass = background ? ` ${DIALOG_CLASS_NAME}--background-${background}` : '';
137
+ const animationClass = animation ? ` ${DIALOG_CLASS_NAME}--animation` : '';
138
+ const showClass = isVisible ? ` ${DIALOG_CLASS_NAME}--show` : '';
139
+
140
+ // Update dialog class name
141
+ dialogElement.className = `${DIALOG_CLASS_NAME}${customClass}${backgroundClass}${animationClass}${showClass}`;
142
+
143
+ // Dialog content class name
144
+ const contentBackgroundClass = contentBackground ? ` ${DIALOG_CLASS_NAME}__content--background` : '';
145
+ const contentDirectionsClass = contentDirections ? ` ${DIALOG_CLASS_NAME}__content--flex-${contentDirections}` : '';
146
+
147
+ // Update content class name
148
+ contentElement.className = `${DIALOG_CLASS_NAME}__content${contentBackgroundClass}${contentDirectionsClass}`;
149
+
150
+ // Clear existing dialog content
151
+ contentElement.innerHTML = '';
152
+
153
+ // Render new dialog content
154
+ if (typeof content === 'string') {
155
+ (0, _element.fastInnerHTML)(contentElement, content);
156
+ } else if (content instanceof HTMLElement || content instanceof DocumentFragment) {
157
+ contentElement.appendChild(content);
158
+ }
159
+ return this;
160
+ }
161
+
162
+ /**
163
+ * Shows the dialog with optional animation.
164
+ *
165
+ * @param {boolean} animation - Whether to add the animation class to the dialog.
166
+ * @returns {DialogUI} The instance of the DialogUI.
167
+ */
168
+ showDialog(animation) {
169
+ const {
170
+ dialogElement
171
+ } = _classPrivateFieldGet(_refs, this);
172
+ dialogElement.style.display = 'block';
173
+ if (animation) {
174
+ // Triggers style and layout recalculation, so the display: block is fully committed before adding
175
+ // the class ht-dialog--show.
176
+ // eslint-disable-next-line no-unused-expressions
177
+ dialogElement.offsetHeight;
178
+ }
179
+ (0, _element.addClass)(dialogElement, `${DIALOG_CLASS_NAME}--show`);
180
+ return this;
181
+ }
182
+
183
+ /**
184
+ * Hides the dialog with optional animation.
185
+ *
186
+ * @param {boolean} animation - Whether to add the animation class to the dialog.
187
+ * @returns {DialogUI} The instance of the DialogUI.
188
+ */
189
+ hideDialog(animation) {
190
+ const {
191
+ dialogElement
192
+ } = _classPrivateFieldGet(_refs, this);
193
+ (0, _element.removeClass)(dialogElement, `${DIALOG_CLASS_NAME}--show`);
194
+ if (animation) {
195
+ dialogElement.addEventListener('transitionend', () => {
196
+ if (!(0, _element.hasClass)(dialogElement, `${DIALOG_CLASS_NAME}--show`)) {
197
+ dialogElement.style.display = 'none';
198
+ }
199
+ }, {
200
+ once: true
201
+ });
202
+ } else {
203
+ dialogElement.style.display = 'none';
204
+ }
205
+ return this;
206
+ }
207
+
208
+ /**
209
+ * Updates the width of the dialog container to the same size as the table.
210
+ *
211
+ * @param {number} width - The width of the table.
212
+ * @returns {DialogUI} The instance of the DialogUI.
213
+ */
214
+ updateWidth(width) {
215
+ _classPrivateFieldGet(_refs, this).dialogElement.style.width = `${width}px`;
216
+ return this;
217
+ }
218
+
219
+ /**
220
+ * Updates the height of the dialog container.
221
+ *
222
+ * @param {number} licenseInfoHeight - The height of the license info.
223
+ * @returns {DialogUI} The instance of the DialogUI.
224
+ */
225
+ updateHeight(licenseInfoHeight) {
226
+ _classPrivateFieldGet(_refs, this).dialogElement.style.height = `calc(100% - ${licenseInfoHeight}px)`;
227
+ return this;
228
+ }
229
+
230
+ /**
231
+ * Removes the dialog UI elements from the DOM and clears the refs.
232
+ */
233
+ destroyDialog() {
234
+ var _classPrivateFieldGet3;
235
+ (_classPrivateFieldGet3 = _classPrivateFieldGet(_refs, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.dialogElement.remove();
236
+ _classPrivateFieldSet(_refs, this, null);
237
+ }
238
+ }
239
+ exports.DialogUI = DialogUI;
240
+ (0, _object.mixin)(DialogUI, _localHooks.default);
@@ -0,0 +1,235 @@
1
+ import "core-js/modules/es.error.cause.js";
2
+ function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
3
+ function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
4
+ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
5
+ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
6
+ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
7
+ import { html } from "../../helpers/templateLiteralTag.mjs";
8
+ import { mixin } from "../../helpers/object.mjs";
9
+ import localHooks from "../../mixins/localHooks.mjs";
10
+ import { addClass, removeClass, hasClass, fastInnerHTML, setAttribute } from "../../helpers/dom/element.mjs";
11
+ import { A11Y_DIALOG, A11Y_MODAL, A11Y_TABINDEX } from "../../helpers/a11y.mjs";
12
+ const DIALOG_CLASS_NAME = 'ht-dialog';
13
+ const TEMPLATE = `
14
+ <div data-ref="dialogElement" class="${DIALOG_CLASS_NAME}">
15
+ <div data-ref="contentWrapperElement" class="${DIALOG_CLASS_NAME}__content-wrapper">
16
+ <div data-ref="contentElement" class="${DIALOG_CLASS_NAME}__content"></div>
17
+ </div>
18
+ </div>
19
+ `;
20
+
21
+ /**
22
+ * DialogUI is a UI component that renders and manages dialog elements.
23
+ * It handles dialog creation, content updates, visibility toggling, and styling.
24
+ *
25
+ * @private
26
+ * @class DialogUI
27
+ */
28
+ var _rootElement = /*#__PURE__*/new WeakMap();
29
+ var _refs = /*#__PURE__*/new WeakMap();
30
+ var _isRtl = /*#__PURE__*/new WeakMap();
31
+ export class DialogUI {
32
+ constructor(_ref) {
33
+ let {
34
+ rootElement,
35
+ isRtl
36
+ } = _ref;
37
+ /**
38
+ * The root element where the dialog UI will be installed.
39
+ *
40
+ * @type {HTMLElement}
41
+ */
42
+ _classPrivateFieldInitSpec(this, _rootElement, void 0);
43
+ /**
44
+ * The references to the UI elements.
45
+ *
46
+ * @type {object}
47
+ */
48
+ _classPrivateFieldInitSpec(this, _refs, void 0);
49
+ /**
50
+ * Indicates if the UI is in RTL mode.
51
+ *
52
+ * @type {boolean}
53
+ */
54
+ _classPrivateFieldInitSpec(this, _isRtl, false);
55
+ _classPrivateFieldSet(_rootElement, this, rootElement);
56
+ _classPrivateFieldSet(_isRtl, this, isRtl);
57
+ this.install();
58
+ }
59
+
60
+ /**
61
+ * Creates the dialog UI elements and sets up the structure.
62
+ */
63
+ install() {
64
+ var _classPrivateFieldGet2;
65
+ if ((_classPrivateFieldGet2 = _classPrivateFieldGet(_refs, this)) !== null && _classPrivateFieldGet2 !== void 0 && _classPrivateFieldGet2.dialogElement) {
66
+ return;
67
+ }
68
+ const elements = html`${TEMPLATE}`;
69
+ _classPrivateFieldSet(_refs, this, elements.refs);
70
+ const {
71
+ dialogElement
72
+ } = _classPrivateFieldGet(_refs, this);
73
+ dialogElement.addEventListener('click', () => this.runLocalHooks('clickDialogElement'));
74
+
75
+ // Set ARIA attributes
76
+ setAttribute(dialogElement, [A11Y_DIALOG(), A11Y_MODAL(), A11Y_TABINDEX(-1), ['dir', _classPrivateFieldGet(_isRtl, this) ? 'rtl' : 'ltr']]);
77
+
78
+ // Append to Handsontable after table grid element
79
+ _classPrivateFieldGet(_rootElement, this).after(elements.fragment);
80
+ }
81
+
82
+ /**
83
+ * Returns the dialog element.
84
+ *
85
+ * @returns {HTMLElement} The dialog element.
86
+ */
87
+ getDialogElement() {
88
+ return _classPrivateFieldGet(_refs, this).dialogElement;
89
+ }
90
+
91
+ /**
92
+ * Checks if the given element is inside the dialog.
93
+ *
94
+ * @param {HTMLElement} element - The element to check.
95
+ * @returns {boolean} Returns `true` if the element is inside the dialog, `false` otherwise.
96
+ */
97
+ isInsideDialog(element) {
98
+ return _classPrivateFieldGet(_refs, this).dialogElement.contains(element);
99
+ }
100
+
101
+ /**
102
+ * Updates the dialog content and class name.
103
+ *
104
+ * @param {object} options - Class name update options.
105
+ * @param {boolean} options.isVisible - Whether the dialog is visible.
106
+ * @param {string|HTMLElement} options.content - The content to render in the dialog.
107
+ * @param {string} options.customClassName - The custom class name to add to the dialog.
108
+ * @param {string} options.background - The background to add to the dialog.
109
+ * @param {boolean} options.contentBackground - Whether to show content background.
110
+ * @param {string} options.contentDirections - The flex direction for content layout.
111
+ * @param {boolean} options.animation - Whether to add the animation class to the dialog.
112
+ *
113
+ * @returns {DialogUI} The instance of the DialogUI.
114
+ */
115
+ updateDialog(_ref2) {
116
+ let {
117
+ isVisible,
118
+ content,
119
+ customClassName,
120
+ background,
121
+ contentBackground,
122
+ contentDirections,
123
+ animation
124
+ } = _ref2;
125
+ const {
126
+ dialogElement,
127
+ contentElement
128
+ } = _classPrivateFieldGet(_refs, this);
129
+
130
+ // Dialog class name
131
+ const customClass = customClassName ? ` ${customClassName}` : '';
132
+ const backgroundClass = background ? ` ${DIALOG_CLASS_NAME}--background-${background}` : '';
133
+ const animationClass = animation ? ` ${DIALOG_CLASS_NAME}--animation` : '';
134
+ const showClass = isVisible ? ` ${DIALOG_CLASS_NAME}--show` : '';
135
+
136
+ // Update dialog class name
137
+ dialogElement.className = `${DIALOG_CLASS_NAME}${customClass}${backgroundClass}${animationClass}${showClass}`;
138
+
139
+ // Dialog content class name
140
+ const contentBackgroundClass = contentBackground ? ` ${DIALOG_CLASS_NAME}__content--background` : '';
141
+ const contentDirectionsClass = contentDirections ? ` ${DIALOG_CLASS_NAME}__content--flex-${contentDirections}` : '';
142
+
143
+ // Update content class name
144
+ contentElement.className = `${DIALOG_CLASS_NAME}__content${contentBackgroundClass}${contentDirectionsClass}`;
145
+
146
+ // Clear existing dialog content
147
+ contentElement.innerHTML = '';
148
+
149
+ // Render new dialog content
150
+ if (typeof content === 'string') {
151
+ fastInnerHTML(contentElement, content);
152
+ } else if (content instanceof HTMLElement || content instanceof DocumentFragment) {
153
+ contentElement.appendChild(content);
154
+ }
155
+ return this;
156
+ }
157
+
158
+ /**
159
+ * Shows the dialog with optional animation.
160
+ *
161
+ * @param {boolean} animation - Whether to add the animation class to the dialog.
162
+ * @returns {DialogUI} The instance of the DialogUI.
163
+ */
164
+ showDialog(animation) {
165
+ const {
166
+ dialogElement
167
+ } = _classPrivateFieldGet(_refs, this);
168
+ dialogElement.style.display = 'block';
169
+ if (animation) {
170
+ // Triggers style and layout recalculation, so the display: block is fully committed before adding
171
+ // the class ht-dialog--show.
172
+ // eslint-disable-next-line no-unused-expressions
173
+ dialogElement.offsetHeight;
174
+ }
175
+ addClass(dialogElement, `${DIALOG_CLASS_NAME}--show`);
176
+ return this;
177
+ }
178
+
179
+ /**
180
+ * Hides the dialog with optional animation.
181
+ *
182
+ * @param {boolean} animation - Whether to add the animation class to the dialog.
183
+ * @returns {DialogUI} The instance of the DialogUI.
184
+ */
185
+ hideDialog(animation) {
186
+ const {
187
+ dialogElement
188
+ } = _classPrivateFieldGet(_refs, this);
189
+ removeClass(dialogElement, `${DIALOG_CLASS_NAME}--show`);
190
+ if (animation) {
191
+ dialogElement.addEventListener('transitionend', () => {
192
+ if (!hasClass(dialogElement, `${DIALOG_CLASS_NAME}--show`)) {
193
+ dialogElement.style.display = 'none';
194
+ }
195
+ }, {
196
+ once: true
197
+ });
198
+ } else {
199
+ dialogElement.style.display = 'none';
200
+ }
201
+ return this;
202
+ }
203
+
204
+ /**
205
+ * Updates the width of the dialog container to the same size as the table.
206
+ *
207
+ * @param {number} width - The width of the table.
208
+ * @returns {DialogUI} The instance of the DialogUI.
209
+ */
210
+ updateWidth(width) {
211
+ _classPrivateFieldGet(_refs, this).dialogElement.style.width = `${width}px`;
212
+ return this;
213
+ }
214
+
215
+ /**
216
+ * Updates the height of the dialog container.
217
+ *
218
+ * @param {number} licenseInfoHeight - The height of the license info.
219
+ * @returns {DialogUI} The instance of the DialogUI.
220
+ */
221
+ updateHeight(licenseInfoHeight) {
222
+ _classPrivateFieldGet(_refs, this).dialogElement.style.height = `calc(100% - ${licenseInfoHeight}px)`;
223
+ return this;
224
+ }
225
+
226
+ /**
227
+ * Removes the dialog UI elements from the DOM and clears the refs.
228
+ */
229
+ destroyDialog() {
230
+ var _classPrivateFieldGet3;
231
+ (_classPrivateFieldGet3 = _classPrivateFieldGet(_refs, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.dialogElement.remove();
232
+ _classPrivateFieldSet(_refs, this, null);
233
+ }
234
+ }
235
+ mixin(DialogUI, localHooks);
@@ -193,6 +193,7 @@ class DropdownMenu extends _base.BasePlugin {
193
193
  }
194
194
  return _assertClassBrand(_DropdownMenu_brand, _this, _onBeforeViewportScrollHorizontally).call(_this, ...args);
195
195
  });
196
+ this.addHook('beforeDialogShow', () => this.close());
196
197
  const settings = this.hot.getSettings()[PLUGIN_KEY];
197
198
  const predefinedItems = {
198
199
  items: this.itemsFactory.getItems(settings)
@@ -190,6 +190,7 @@ export class DropdownMenu extends BasePlugin {
190
190
  }
191
191
  return _assertClassBrand(_DropdownMenu_brand, _this, _onBeforeViewportScrollHorizontally).call(_this, ...args);
192
192
  });
193
+ this.addHook('beforeDialogShow', () => this.close());
193
194
  const settings = this.hot.getSettings()[PLUGIN_KEY];
194
195
  const predefinedItems = {
195
196
  items: this.itemsFactory.getItems(settings)
@@ -33,6 +33,7 @@ import { Search } from './search';
33
33
  import { StretchColumns } from './stretchColumns';
34
34
  import { TouchScroll } from './touchScroll';
35
35
  import { TrimRows } from './trimRows';
36
+ import { Dialog } from './dialog';
36
37
  import { UndoRedo } from './undoRedo';
37
38
 
38
39
  export interface Plugins {
@@ -71,6 +72,7 @@ export interface Plugins {
71
72
  stretchColumns: StretchColumns;
72
73
  touchScroll: TouchScroll;
73
74
  trimRows: TrimRows;
75
+ dialog: Dialog;
74
76
  undoRedo: UndoRedo;
75
77
  }
76
78
 
@@ -113,5 +115,6 @@ export {
113
115
  StretchColumns,
114
116
  TouchScroll,
115
117
  TrimRows,
118
+ Dialog,
116
119
  UndoRedo
117
120
  };
package/plugins/index.js CHANGED
@@ -74,6 +74,8 @@ var _trimRows = require("./trimRows");
74
74
  exports.TrimRows = _trimRows.TrimRows;
75
75
  var _undoRedo = require("./undoRedo");
76
76
  exports.UndoRedo = _undoRedo.UndoRedo;
77
+ var _dialog = require("./dialog");
78
+ exports.Dialog = _dialog.Dialog;
77
79
  var _registry = require("./registry");
78
80
  exports.registerPlugin = _registry.registerPlugin;
79
81
  exports.getPlugin = _registry.getPlugin;
@@ -117,4 +119,5 @@ function registerAllPlugins() {
117
119
  (0, _registry.registerPlugin)(_touchScroll.TouchScroll);
118
120
  (0, _registry.registerPlugin)(_trimRows.TrimRows);
119
121
  (0, _registry.registerPlugin)(_undoRedo.UndoRedo);
122
+ (0, _registry.registerPlugin)(_dialog.Dialog);
120
123
  }
package/plugins/index.mjs CHANGED
@@ -34,6 +34,7 @@ import { StretchColumns } from "./stretchColumns/index.mjs";
34
34
  import { TouchScroll } from "./touchScroll/index.mjs";
35
35
  import { TrimRows } from "./trimRows/index.mjs";
36
36
  import { UndoRedo } from "./undoRedo/index.mjs";
37
+ import { Dialog } from "./dialog/index.mjs";
37
38
  import { registerPlugin } from "./registry.mjs";
38
39
  /**
39
40
  * Registers all available plugins.
@@ -74,6 +75,7 @@ export function registerAllPlugins() {
74
75
  registerPlugin(TouchScroll);
75
76
  registerPlugin(TrimRows);
76
77
  registerPlugin(UndoRedo);
78
+ registerPlugin(Dialog);
77
79
  }
78
- export { AutoColumnSize, Autofill, AutoRowSize, BasePlugin, BindRowsWithHeaders, CollapsibleColumns, ColumnSorting, ColumnSummary, Comments, ContextMenu, CopyPaste, CustomBorders, DragToScroll, DropdownMenu, ExportFile, Filters, Formulas, HiddenColumns, HiddenRows, ManualColumnFreeze, ManualColumnMove, ManualColumnResize, ManualRowMove, ManualRowResize, MergeCells, MultiColumnSorting, MultipleSelectionHandles, NestedHeaders, NestedRows, Pagination, PersistentState, Search, StretchColumns, TouchScroll, TrimRows, UndoRedo };
80
+ export { AutoColumnSize, Autofill, AutoRowSize, BasePlugin, BindRowsWithHeaders, CollapsibleColumns, ColumnSorting, ColumnSummary, Comments, ContextMenu, CopyPaste, CustomBorders, DragToScroll, DropdownMenu, ExportFile, Filters, Formulas, HiddenColumns, HiddenRows, ManualColumnFreeze, ManualColumnMove, ManualColumnResize, ManualRowMove, ManualRowResize, MergeCells, MultiColumnSorting, MultipleSelectionHandles, NestedHeaders, NestedRows, Pagination, PersistentState, Search, StretchColumns, TouchScroll, TrimRows, UndoRedo, Dialog };
79
81
  export { getPlugin, getPluginsNames, registerPlugin } from "./registry.mjs";
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.createPaginationFocusController = createPaginationFocusController;
5
+ var _paginator = require("../../utils/paginator");
6
+ /**
7
+ * Creates a pagination focus controller instance.
8
+ *
9
+ * @private
10
+ * @param {object} options The options for the pagination focus controller.
11
+ * @param {HTMLElement[]} options.focusableElements The focusable elements.
12
+ * @returns {PaginationController} The pagination controller instance.
13
+ */
14
+ function createPaginationFocusController(_ref) {
15
+ let {
16
+ focusableElements
17
+ } = _ref;
18
+ const navigator = (0, _paginator.createPaginator)({
19
+ initialPage: 0,
20
+ size: () => focusableElements().length,
21
+ onItemSelect: currentIndex => {
22
+ const elements = focusableElements();
23
+ elements[currentIndex].focus();
24
+ }
25
+ });
26
+ return navigator;
27
+ }
@@ -0,0 +1,23 @@
1
+ import { createPaginator } from "../../utils/paginator.mjs";
2
+ /**
3
+ * Creates a pagination focus controller instance.
4
+ *
5
+ * @private
6
+ * @param {object} options The options for the pagination focus controller.
7
+ * @param {HTMLElement[]} options.focusableElements The focusable elements.
8
+ * @returns {PaginationController} The pagination controller instance.
9
+ */
10
+ export function createPaginationFocusController(_ref) {
11
+ let {
12
+ focusableElements
13
+ } = _ref;
14
+ const navigator = createPaginator({
15
+ initialPage: 0,
16
+ size: () => focusableElements().length,
17
+ onItemSelect: currentIndex => {
18
+ const elements = focusableElements();
19
+ elements[currentIndex].focus();
20
+ }
21
+ });
22
+ return navigator;
23
+ }