handsontable 0.0.0-next-f86a877-20250819 → 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.
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/focusCatcher/index.js +37 -20
- package/core/focusCatcher/index.mjs +37 -20
- package/core/focusCatcher/utils.js +3 -64
- package/core/focusCatcher/utils.mjs +1 -60
- package/core/hooks/constants.js +58 -0
- package/core/hooks/constants.mjs +58 -0
- package/core/hooks/index.d.ts +7 -0
- package/core.js +13 -4
- package/core.mjs +13 -4
- package/dataMap/metaManager/metaSchema.js +95 -0
- package/dataMap/metaManager/metaSchema.mjs +95 -0
- package/dist/handsontable.css +103 -5
- package/dist/handsontable.full.css +103 -5
- package/dist/handsontable.full.js +1600 -282
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +65 -65
- package/dist/handsontable.js +1600 -282
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +27 -27
- package/editors/baseEditor/baseEditor.js +1 -0
- package/editors/baseEditor/baseEditor.mjs +1 -0
- package/helpers/a11y.js +5 -1
- package/helpers/a11y.mjs +3 -1
- package/helpers/mixed.js +64 -1
- package/helpers/mixed.mjs +62 -1
- package/index.d.ts +9 -0
- package/package.json +6 -1
- package/plugins/base/base.js +75 -14
- package/plugins/base/base.mjs +75 -14
- package/plugins/contextMenu/contextMenu.js +1 -0
- package/plugins/contextMenu/contextMenu.mjs +1 -0
- package/plugins/dialog/dialog.d.ts +23 -0
- package/plugins/dialog/dialog.js +469 -0
- package/plugins/dialog/dialog.mjs +465 -0
- package/plugins/dialog/index.d.ts +1 -0
- package/plugins/dialog/index.js +7 -0
- package/plugins/dialog/index.mjs +1 -0
- package/plugins/dialog/ui.js +240 -0
- package/plugins/dialog/ui.mjs +235 -0
- package/plugins/dropdownMenu/dropdownMenu.js +1 -0
- package/plugins/dropdownMenu/dropdownMenu.mjs +1 -0
- package/plugins/index.d.ts +3 -0
- package/plugins/index.js +3 -0
- package/plugins/index.mjs +3 -1
- package/plugins/pagination/focusController.js +27 -0
- package/plugins/pagination/focusController.mjs +23 -0
- package/plugins/pagination/pagination.js +165 -18
- package/plugins/pagination/pagination.mjs +165 -18
- package/plugins/pagination/ui.js +101 -62
- package/plugins/pagination/ui.mjs +102 -63
- package/selection/range.js +11 -0
- package/selection/range.mjs +11 -0
- package/selection/selection.js +63 -2
- package/selection/selection.mjs +63 -2
- package/selection/utils.js +2 -1
- package/selection/utils.mjs +2 -1
- package/settings.d.ts +2 -0
- package/shortcuts/context.js +4 -1
- package/shortcuts/context.mjs +4 -1
- package/shortcuts/manager.js +17 -3
- package/shortcuts/manager.mjs +17 -3
- package/styles/handsontable.css +106 -22
- package/styles/handsontable.min.css +3 -3
- package/styles/ht-theme-horizon.css +24 -6
- package/styles/ht-theme-horizon.min.css +3 -3
- package/styles/ht-theme-main.css +52 -34
- package/styles/ht-theme-main.min.css +3 -3
- package/tableView.js +7 -2
- package/tableView.mjs +7 -2
- package/{core/focusCatcher → utils}/focusDetector.js +29 -11
- package/{core/focusCatcher → utils}/focusDetector.mjs +29 -11
package/plugins/pagination/ui.js
CHANGED
|
@@ -19,12 +19,12 @@ function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
|
19
19
|
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
20
20
|
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"); }
|
|
21
21
|
const TEMPLATE = `
|
|
22
|
-
<div data-ref="container" class="ht-pagination
|
|
23
|
-
<div class="ht-
|
|
22
|
+
<div data-ref="container" class="ht-pagination handsontable">
|
|
23
|
+
<div class="ht-pagination__inner">
|
|
24
24
|
<div data-ref="pageSizeSection" class="ht-page-size-section">
|
|
25
25
|
<span data-ref="pageSizeLabel" class="ht-page-size-section__label"></span>
|
|
26
26
|
<div class="ht-page-size-section__select-wrapper">
|
|
27
|
-
<select data-ref="pageSizeSelect" name="pageSize"></select>
|
|
27
|
+
<select data-ref="pageSizeSelect" name="pageSize" data-hot-input></select>
|
|
28
28
|
</div>
|
|
29
29
|
</div>
|
|
30
30
|
<div data-ref="pageCounterSection" class="ht-page-counter-section"></div>
|
|
@@ -150,26 +150,22 @@ class PaginationUI {
|
|
|
150
150
|
_classPrivateFieldSet(_refs, this, elements.refs);
|
|
151
151
|
container.setAttribute('dir', _classPrivateFieldGet(_isRtl, this) ? 'rtl' : 'ltr');
|
|
152
152
|
const isDisabled = event => event.currentTarget.disabled;
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
if (!isDisabled(event)) {
|
|
170
|
-
this.runLocalHooks('lastPageClick');
|
|
171
|
-
}
|
|
172
|
-
});
|
|
153
|
+
const addClickListener = (eventName, element, callback) => {
|
|
154
|
+
element.addEventListener(eventName, event => {
|
|
155
|
+
if (!isDisabled(event)) {
|
|
156
|
+
callback();
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
};
|
|
160
|
+
addClickListener('click', first, () => this.runLocalHooks('firstPageClick'));
|
|
161
|
+
addClickListener('focus', first, () => this.runLocalHooks('focus', first));
|
|
162
|
+
addClickListener('click', prev, () => this.runLocalHooks('prevPageClick'));
|
|
163
|
+
addClickListener('focus', prev, () => this.runLocalHooks('focus', prev));
|
|
164
|
+
addClickListener('click', next, () => this.runLocalHooks('nextPageClick'));
|
|
165
|
+
addClickListener('focus', next, () => this.runLocalHooks('focus', next));
|
|
166
|
+
addClickListener('click', last, () => this.runLocalHooks('lastPageClick'));
|
|
167
|
+
addClickListener('focus', last, () => this.runLocalHooks('focus', last));
|
|
168
|
+
addClickListener('focus', pageSizeSelect, () => this.runLocalHooks('focus', pageSizeSelect));
|
|
173
169
|
pageSizeSelect.addEventListener('change', () => {
|
|
174
170
|
const value = pageSizeSelect.value === 'auto' ? 'auto' : Number.parseInt(pageSizeSelect.value, 10);
|
|
175
171
|
this.runLocalHooks('pageSizeChange', value);
|
|
@@ -185,6 +181,31 @@ class PaginationUI {
|
|
|
185
181
|
}
|
|
186
182
|
}
|
|
187
183
|
|
|
184
|
+
/**
|
|
185
|
+
* Gets the pagination element.
|
|
186
|
+
*
|
|
187
|
+
* @returns {HTMLElement} The pagination element.
|
|
188
|
+
*/
|
|
189
|
+
getContainer() {
|
|
190
|
+
return _classPrivateFieldGet(_refs, this).container;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Gets the focusable elements.
|
|
195
|
+
*
|
|
196
|
+
* @returns {HTMLElement[]} The focusable elements.
|
|
197
|
+
*/
|
|
198
|
+
getFocusableElements() {
|
|
199
|
+
const {
|
|
200
|
+
first,
|
|
201
|
+
prev,
|
|
202
|
+
next,
|
|
203
|
+
last,
|
|
204
|
+
pageSizeSelect
|
|
205
|
+
} = _classPrivateFieldGet(_refs, this);
|
|
206
|
+
return [pageSizeSelect, first, prev, next, last].filter(element => !element.disabled);
|
|
207
|
+
}
|
|
208
|
+
|
|
188
209
|
/**
|
|
189
210
|
* Updates the width of the pagination container.
|
|
190
211
|
*
|
|
@@ -235,9 +256,9 @@ class PaginationUI {
|
|
|
235
256
|
container
|
|
236
257
|
} = _classPrivateFieldGet(_refs, this);
|
|
237
258
|
if (_classPrivateFieldGet(_uiContainer, this) || _classPrivateFieldGet(_shouldHaveBorder, this).call(this)) {
|
|
238
|
-
(0, _element.addClass)(container, 'ht-pagination
|
|
259
|
+
(0, _element.addClass)(container, 'ht-pagination--bordered');
|
|
239
260
|
} else {
|
|
240
|
-
(0, _element.removeClass)(container, 'ht-pagination
|
|
261
|
+
(0, _element.removeClass)(container, 'ht-pagination--bordered');
|
|
241
262
|
}
|
|
242
263
|
return this;
|
|
243
264
|
}
|
|
@@ -293,7 +314,7 @@ class PaginationUI {
|
|
|
293
314
|
pageSizeSelect.textContent = '';
|
|
294
315
|
pageSizeLabel.textContent = `${pageSizeLabelText}:`;
|
|
295
316
|
(0, _element.setAttribute)(pageNavSection, [...[(0, _a11y.A11Y_LABEL)(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_SECTION))]]);
|
|
296
|
-
(0, _element.setAttribute)(pageSizeSelect, [...[(0, _a11y.A11Y_LABEL)(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_PAGE_SIZE_SECTION))]]);
|
|
317
|
+
(0, _element.setAttribute)(pageSizeSelect, [...[(0, _a11y.A11Y_LABEL)(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_PAGE_SIZE_SECTION))], ...[(0, _a11y.A11Y_TABINDEX)(-1)]]);
|
|
297
318
|
_classPrivateFieldGet(_a11yAnnouncer, this).call(this, navLabelText);
|
|
298
319
|
this.refreshBorderState();
|
|
299
320
|
pageSizeList.forEach(pageSizeItem => {
|
|
@@ -306,40 +327,42 @@ class PaginationUI {
|
|
|
306
327
|
});
|
|
307
328
|
const isFirstPage = currentPage === 1;
|
|
308
329
|
const isLastPage = currentPage === totalPages;
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
(
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
if (prev.
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
330
|
+
if (pageNavSection.style.display !== 'none') {
|
|
331
|
+
const activeElement = _classPrivateFieldGet(_rootElement, this).ownerDocument.activeElement;
|
|
332
|
+
if (isFirstPage) {
|
|
333
|
+
(0, _element.addClass)(first, 'ht-page-navigation-section__button--disabled');
|
|
334
|
+
(0, _element.addClass)(prev, 'ht-page-navigation-section__button--disabled');
|
|
335
|
+
first.disabled = true;
|
|
336
|
+
prev.disabled = true;
|
|
337
|
+
} else {
|
|
338
|
+
(0, _element.removeClass)(first, 'ht-page-navigation-section__button--disabled');
|
|
339
|
+
(0, _element.removeClass)(prev, 'ht-page-navigation-section__button--disabled');
|
|
340
|
+
first.disabled = false;
|
|
341
|
+
prev.disabled = false;
|
|
342
|
+
}
|
|
343
|
+
if (isLastPage) {
|
|
344
|
+
(0, _element.addClass)(next, 'ht-page-navigation-section__button--disabled');
|
|
345
|
+
(0, _element.addClass)(last, 'ht-page-navigation-section__button--disabled');
|
|
346
|
+
next.disabled = true;
|
|
347
|
+
last.disabled = true;
|
|
348
|
+
} else {
|
|
349
|
+
(0, _element.removeClass)(next, 'ht-page-navigation-section__button--disabled');
|
|
350
|
+
(0, _element.removeClass)(last, 'ht-page-navigation-section__button--disabled');
|
|
351
|
+
next.disabled = false;
|
|
352
|
+
last.disabled = false;
|
|
353
|
+
}
|
|
354
|
+
if ([first, prev, next, last].includes(activeElement)) {
|
|
355
|
+
if (prev.disabled) {
|
|
356
|
+
next.focus();
|
|
357
|
+
} else if (next.disabled) {
|
|
358
|
+
prev.focus();
|
|
359
|
+
}
|
|
337
360
|
}
|
|
338
361
|
}
|
|
339
|
-
(0, _element.setAttribute)(first, [...[(0, _a11y.A11Y_LABEL)(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_FIRST_PAGE))], ...[(0, _a11y.A11Y_DISABLED)(isFirstPage)]]);
|
|
340
|
-
(0, _element.setAttribute)(prev, [...[(0, _a11y.A11Y_LABEL)(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_PREV_PAGE))], ...[(0, _a11y.A11Y_DISABLED)(isFirstPage)]]);
|
|
341
|
-
(0, _element.setAttribute)(next, [...[(0, _a11y.A11Y_LABEL)(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_NEXT_PAGE))], ...[(0, _a11y.A11Y_DISABLED)(isLastPage)]]);
|
|
342
|
-
(0, _element.setAttribute)(last, [...[(0, _a11y.A11Y_LABEL)(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_LAST_PAGE))], ...[(0, _a11y.A11Y_DISABLED)(isLastPage)]]);
|
|
362
|
+
(0, _element.setAttribute)(first, [...[(0, _a11y.A11Y_LABEL)(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_FIRST_PAGE))], ...[(0, _a11y.A11Y_DISABLED)(isFirstPage)], ...[(0, _a11y.A11Y_TABINDEX)(-1)]]);
|
|
363
|
+
(0, _element.setAttribute)(prev, [...[(0, _a11y.A11Y_LABEL)(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_PREV_PAGE))], ...[(0, _a11y.A11Y_DISABLED)(isFirstPage)], ...[(0, _a11y.A11Y_TABINDEX)(-1)]]);
|
|
364
|
+
(0, _element.setAttribute)(next, [...[(0, _a11y.A11Y_LABEL)(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_NEXT_PAGE))], ...[(0, _a11y.A11Y_DISABLED)(isLastPage)], ...[(0, _a11y.A11Y_TABINDEX)(-1)]]);
|
|
365
|
+
(0, _element.setAttribute)(last, [...[(0, _a11y.A11Y_LABEL)(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_LAST_PAGE))], ...[(0, _a11y.A11Y_DISABLED)(isLastPage)], ...[(0, _a11y.A11Y_TABINDEX)(-1)]]);
|
|
343
366
|
return this;
|
|
344
367
|
}
|
|
345
368
|
|
|
@@ -350,7 +373,12 @@ class PaginationUI {
|
|
|
350
373
|
* @returns {PaginationUI} The instance of the PaginationUI for method chaining.
|
|
351
374
|
*/
|
|
352
375
|
setPageSizeSectionVisibility(isVisible) {
|
|
353
|
-
|
|
376
|
+
const {
|
|
377
|
+
pageSizeSection,
|
|
378
|
+
pageSizeSelect
|
|
379
|
+
} = _classPrivateFieldGet(_refs, this);
|
|
380
|
+
pageSizeSection.style.display = isVisible ? '' : 'none';
|
|
381
|
+
pageSizeSelect.disabled = !isVisible;
|
|
354
382
|
_assertClassBrand(_PaginationUI_brand, this, _updateContainerVisibility).call(this);
|
|
355
383
|
return this;
|
|
356
384
|
}
|
|
@@ -374,7 +402,18 @@ class PaginationUI {
|
|
|
374
402
|
* @returns {PaginationUI} The instance of the PaginationUI for method chaining.
|
|
375
403
|
*/
|
|
376
404
|
setNavigationSectionVisibility(isVisible) {
|
|
377
|
-
|
|
405
|
+
const {
|
|
406
|
+
pageNavSection,
|
|
407
|
+
first,
|
|
408
|
+
prev,
|
|
409
|
+
next,
|
|
410
|
+
last
|
|
411
|
+
} = _classPrivateFieldGet(_refs, this);
|
|
412
|
+
pageNavSection.style.display = isVisible ? '' : 'none';
|
|
413
|
+
first.disabled = !isVisible;
|
|
414
|
+
prev.disabled = !isVisible;
|
|
415
|
+
next.disabled = !isVisible;
|
|
416
|
+
last.disabled = !isVisible;
|
|
378
417
|
_assertClassBrand(_PaginationUI_brand, this, _updateContainerVisibility).call(this);
|
|
379
418
|
return this;
|
|
380
419
|
}
|
|
@@ -400,9 +439,9 @@ function _updateContainerVisibility() {
|
|
|
400
439
|
// adds or removes the corner around the Handsontable root element
|
|
401
440
|
if (!_classPrivateFieldGet(_uiContainer, this)) {
|
|
402
441
|
if (isSectionVisible) {
|
|
403
|
-
(0, _element.addClass)(_classPrivateFieldGet(_rootElement, this), 'htPagination');
|
|
442
|
+
(0, _element.addClass)(_classPrivateFieldGet(_rootElement, this).querySelector('.ht-wrapper'), 'htPagination');
|
|
404
443
|
} else {
|
|
405
|
-
(0, _element.removeClass)(_classPrivateFieldGet(_rootElement, this), 'htPagination');
|
|
444
|
+
(0, _element.removeClass)(_classPrivateFieldGet(_rootElement, this).querySelector('.ht-wrapper'), 'htPagination');
|
|
406
445
|
}
|
|
407
446
|
}
|
|
408
447
|
container.style.display = isSectionVisible ? '' : 'none';
|
|
@@ -12,14 +12,14 @@ import { mixin } from "../../helpers/object.mjs";
|
|
|
12
12
|
import localHooks from "../../mixins/localHooks.mjs";
|
|
13
13
|
import * as C from "../../i18n/constants.mjs";
|
|
14
14
|
import { addClass, removeClass, setAttribute } from "../../helpers/dom/element.mjs";
|
|
15
|
-
import { A11Y_DISABLED, A11Y_LABEL } from "../../helpers/a11y.mjs";
|
|
15
|
+
import { A11Y_DISABLED, A11Y_LABEL, A11Y_TABINDEX } from "../../helpers/a11y.mjs";
|
|
16
16
|
const TEMPLATE = `
|
|
17
|
-
<div data-ref="container" class="ht-pagination
|
|
18
|
-
<div class="ht-
|
|
17
|
+
<div data-ref="container" class="ht-pagination handsontable">
|
|
18
|
+
<div class="ht-pagination__inner">
|
|
19
19
|
<div data-ref="pageSizeSection" class="ht-page-size-section">
|
|
20
20
|
<span data-ref="pageSizeLabel" class="ht-page-size-section__label"></span>
|
|
21
21
|
<div class="ht-page-size-section__select-wrapper">
|
|
22
|
-
<select data-ref="pageSizeSelect" name="pageSize"></select>
|
|
22
|
+
<select data-ref="pageSizeSelect" name="pageSize" data-hot-input></select>
|
|
23
23
|
</div>
|
|
24
24
|
</div>
|
|
25
25
|
<div data-ref="pageCounterSection" class="ht-page-counter-section"></div>
|
|
@@ -145,26 +145,22 @@ export class PaginationUI {
|
|
|
145
145
|
_classPrivateFieldSet(_refs, this, elements.refs);
|
|
146
146
|
container.setAttribute('dir', _classPrivateFieldGet(_isRtl, this) ? 'rtl' : 'ltr');
|
|
147
147
|
const isDisabled = event => event.currentTarget.disabled;
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (!isDisabled(event)) {
|
|
165
|
-
this.runLocalHooks('lastPageClick');
|
|
166
|
-
}
|
|
167
|
-
});
|
|
148
|
+
const addClickListener = (eventName, element, callback) => {
|
|
149
|
+
element.addEventListener(eventName, event => {
|
|
150
|
+
if (!isDisabled(event)) {
|
|
151
|
+
callback();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
addClickListener('click', first, () => this.runLocalHooks('firstPageClick'));
|
|
156
|
+
addClickListener('focus', first, () => this.runLocalHooks('focus', first));
|
|
157
|
+
addClickListener('click', prev, () => this.runLocalHooks('prevPageClick'));
|
|
158
|
+
addClickListener('focus', prev, () => this.runLocalHooks('focus', prev));
|
|
159
|
+
addClickListener('click', next, () => this.runLocalHooks('nextPageClick'));
|
|
160
|
+
addClickListener('focus', next, () => this.runLocalHooks('focus', next));
|
|
161
|
+
addClickListener('click', last, () => this.runLocalHooks('lastPageClick'));
|
|
162
|
+
addClickListener('focus', last, () => this.runLocalHooks('focus', last));
|
|
163
|
+
addClickListener('focus', pageSizeSelect, () => this.runLocalHooks('focus', pageSizeSelect));
|
|
168
164
|
pageSizeSelect.addEventListener('change', () => {
|
|
169
165
|
const value = pageSizeSelect.value === 'auto' ? 'auto' : Number.parseInt(pageSizeSelect.value, 10);
|
|
170
166
|
this.runLocalHooks('pageSizeChange', value);
|
|
@@ -180,6 +176,31 @@ export class PaginationUI {
|
|
|
180
176
|
}
|
|
181
177
|
}
|
|
182
178
|
|
|
179
|
+
/**
|
|
180
|
+
* Gets the pagination element.
|
|
181
|
+
*
|
|
182
|
+
* @returns {HTMLElement} The pagination element.
|
|
183
|
+
*/
|
|
184
|
+
getContainer() {
|
|
185
|
+
return _classPrivateFieldGet(_refs, this).container;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Gets the focusable elements.
|
|
190
|
+
*
|
|
191
|
+
* @returns {HTMLElement[]} The focusable elements.
|
|
192
|
+
*/
|
|
193
|
+
getFocusableElements() {
|
|
194
|
+
const {
|
|
195
|
+
first,
|
|
196
|
+
prev,
|
|
197
|
+
next,
|
|
198
|
+
last,
|
|
199
|
+
pageSizeSelect
|
|
200
|
+
} = _classPrivateFieldGet(_refs, this);
|
|
201
|
+
return [pageSizeSelect, first, prev, next, last].filter(element => !element.disabled);
|
|
202
|
+
}
|
|
203
|
+
|
|
183
204
|
/**
|
|
184
205
|
* Updates the width of the pagination container.
|
|
185
206
|
*
|
|
@@ -230,9 +251,9 @@ export class PaginationUI {
|
|
|
230
251
|
container
|
|
231
252
|
} = _classPrivateFieldGet(_refs, this);
|
|
232
253
|
if (_classPrivateFieldGet(_uiContainer, this) || _classPrivateFieldGet(_shouldHaveBorder, this).call(this)) {
|
|
233
|
-
addClass(container, 'ht-pagination
|
|
254
|
+
addClass(container, 'ht-pagination--bordered');
|
|
234
255
|
} else {
|
|
235
|
-
removeClass(container, 'ht-pagination
|
|
256
|
+
removeClass(container, 'ht-pagination--bordered');
|
|
236
257
|
}
|
|
237
258
|
return this;
|
|
238
259
|
}
|
|
@@ -288,7 +309,7 @@ export class PaginationUI {
|
|
|
288
309
|
pageSizeSelect.textContent = '';
|
|
289
310
|
pageSizeLabel.textContent = `${pageSizeLabelText}:`;
|
|
290
311
|
setAttribute(pageNavSection, [...[A11Y_LABEL(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_SECTION))]]);
|
|
291
|
-
setAttribute(pageSizeSelect, [...[A11Y_LABEL(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_PAGE_SIZE_SECTION))]]);
|
|
312
|
+
setAttribute(pageSizeSelect, [...[A11Y_LABEL(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_PAGE_SIZE_SECTION))], ...[A11Y_TABINDEX(-1)]]);
|
|
292
313
|
_classPrivateFieldGet(_a11yAnnouncer, this).call(this, navLabelText);
|
|
293
314
|
this.refreshBorderState();
|
|
294
315
|
pageSizeList.forEach(pageSizeItem => {
|
|
@@ -301,40 +322,42 @@ export class PaginationUI {
|
|
|
301
322
|
});
|
|
302
323
|
const isFirstPage = currentPage === 1;
|
|
303
324
|
const isLastPage = currentPage === totalPages;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
if (prev.
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
325
|
+
if (pageNavSection.style.display !== 'none') {
|
|
326
|
+
const activeElement = _classPrivateFieldGet(_rootElement, this).ownerDocument.activeElement;
|
|
327
|
+
if (isFirstPage) {
|
|
328
|
+
addClass(first, 'ht-page-navigation-section__button--disabled');
|
|
329
|
+
addClass(prev, 'ht-page-navigation-section__button--disabled');
|
|
330
|
+
first.disabled = true;
|
|
331
|
+
prev.disabled = true;
|
|
332
|
+
} else {
|
|
333
|
+
removeClass(first, 'ht-page-navigation-section__button--disabled');
|
|
334
|
+
removeClass(prev, 'ht-page-navigation-section__button--disabled');
|
|
335
|
+
first.disabled = false;
|
|
336
|
+
prev.disabled = false;
|
|
337
|
+
}
|
|
338
|
+
if (isLastPage) {
|
|
339
|
+
addClass(next, 'ht-page-navigation-section__button--disabled');
|
|
340
|
+
addClass(last, 'ht-page-navigation-section__button--disabled');
|
|
341
|
+
next.disabled = true;
|
|
342
|
+
last.disabled = true;
|
|
343
|
+
} else {
|
|
344
|
+
removeClass(next, 'ht-page-navigation-section__button--disabled');
|
|
345
|
+
removeClass(last, 'ht-page-navigation-section__button--disabled');
|
|
346
|
+
next.disabled = false;
|
|
347
|
+
last.disabled = false;
|
|
348
|
+
}
|
|
349
|
+
if ([first, prev, next, last].includes(activeElement)) {
|
|
350
|
+
if (prev.disabled) {
|
|
351
|
+
next.focus();
|
|
352
|
+
} else if (next.disabled) {
|
|
353
|
+
prev.focus();
|
|
354
|
+
}
|
|
332
355
|
}
|
|
333
356
|
}
|
|
334
|
-
setAttribute(first, [...[A11Y_LABEL(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_FIRST_PAGE))], ...[A11Y_DISABLED(isFirstPage)]]);
|
|
335
|
-
setAttribute(prev, [...[A11Y_LABEL(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_PREV_PAGE))], ...[A11Y_DISABLED(isFirstPage)]]);
|
|
336
|
-
setAttribute(next, [...[A11Y_LABEL(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_NEXT_PAGE))], ...[A11Y_DISABLED(isLastPage)]]);
|
|
337
|
-
setAttribute(last, [...[A11Y_LABEL(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_LAST_PAGE))], ...[A11Y_DISABLED(isLastPage)]]);
|
|
357
|
+
setAttribute(first, [...[A11Y_LABEL(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_FIRST_PAGE))], ...[A11Y_DISABLED(isFirstPage)], ...[A11Y_TABINDEX(-1)]]);
|
|
358
|
+
setAttribute(prev, [...[A11Y_LABEL(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_PREV_PAGE))], ...[A11Y_DISABLED(isFirstPage)], ...[A11Y_TABINDEX(-1)]]);
|
|
359
|
+
setAttribute(next, [...[A11Y_LABEL(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_NEXT_PAGE))], ...[A11Y_DISABLED(isLastPage)], ...[A11Y_TABINDEX(-1)]]);
|
|
360
|
+
setAttribute(last, [...[A11Y_LABEL(_classPrivateFieldGet(_phraseTranslator, this).call(this, C.PAGINATION_LAST_PAGE))], ...[A11Y_DISABLED(isLastPage)], ...[A11Y_TABINDEX(-1)]]);
|
|
338
361
|
return this;
|
|
339
362
|
}
|
|
340
363
|
|
|
@@ -345,7 +368,12 @@ export class PaginationUI {
|
|
|
345
368
|
* @returns {PaginationUI} The instance of the PaginationUI for method chaining.
|
|
346
369
|
*/
|
|
347
370
|
setPageSizeSectionVisibility(isVisible) {
|
|
348
|
-
|
|
371
|
+
const {
|
|
372
|
+
pageSizeSection,
|
|
373
|
+
pageSizeSelect
|
|
374
|
+
} = _classPrivateFieldGet(_refs, this);
|
|
375
|
+
pageSizeSection.style.display = isVisible ? '' : 'none';
|
|
376
|
+
pageSizeSelect.disabled = !isVisible;
|
|
349
377
|
_assertClassBrand(_PaginationUI_brand, this, _updateContainerVisibility).call(this);
|
|
350
378
|
return this;
|
|
351
379
|
}
|
|
@@ -369,7 +397,18 @@ export class PaginationUI {
|
|
|
369
397
|
* @returns {PaginationUI} The instance of the PaginationUI for method chaining.
|
|
370
398
|
*/
|
|
371
399
|
setNavigationSectionVisibility(isVisible) {
|
|
372
|
-
|
|
400
|
+
const {
|
|
401
|
+
pageNavSection,
|
|
402
|
+
first,
|
|
403
|
+
prev,
|
|
404
|
+
next,
|
|
405
|
+
last
|
|
406
|
+
} = _classPrivateFieldGet(_refs, this);
|
|
407
|
+
pageNavSection.style.display = isVisible ? '' : 'none';
|
|
408
|
+
first.disabled = !isVisible;
|
|
409
|
+
prev.disabled = !isVisible;
|
|
410
|
+
next.disabled = !isVisible;
|
|
411
|
+
last.disabled = !isVisible;
|
|
373
412
|
_assertClassBrand(_PaginationUI_brand, this, _updateContainerVisibility).call(this);
|
|
374
413
|
return this;
|
|
375
414
|
}
|
|
@@ -394,9 +433,9 @@ function _updateContainerVisibility() {
|
|
|
394
433
|
// adds or removes the corner around the Handsontable root element
|
|
395
434
|
if (!_classPrivateFieldGet(_uiContainer, this)) {
|
|
396
435
|
if (isSectionVisible) {
|
|
397
|
-
addClass(_classPrivateFieldGet(_rootElement, this), 'htPagination');
|
|
436
|
+
addClass(_classPrivateFieldGet(_rootElement, this).querySelector('.ht-wrapper'), 'htPagination');
|
|
398
437
|
} else {
|
|
399
|
-
removeClass(_classPrivateFieldGet(_rootElement, this), 'htPagination');
|
|
438
|
+
removeClass(_classPrivateFieldGet(_rootElement, this).querySelector('.ht-wrapper'), 'htPagination');
|
|
400
439
|
}
|
|
401
440
|
}
|
|
402
441
|
container.style.display = isSectionVisible ? '' : 'none';
|
package/selection/range.js
CHANGED
|
@@ -66,6 +66,17 @@ class SelectionRange {
|
|
|
66
66
|
return this;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
/**
|
|
70
|
+
* Pushes a new CellRange instance to the collection.
|
|
71
|
+
*
|
|
72
|
+
* @param {CellRange} cellRange The CellRange instance with defined visual coordinates.
|
|
73
|
+
* @returns {SelectionRange}
|
|
74
|
+
*/
|
|
75
|
+
push(cellRange) {
|
|
76
|
+
this.ranges.push(cellRange);
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
|
|
69
80
|
/**
|
|
70
81
|
* Removes from the stack the last added coordinates.
|
|
71
82
|
*
|
package/selection/range.mjs
CHANGED
|
@@ -63,6 +63,17 @@ class SelectionRange {
|
|
|
63
63
|
return this;
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Pushes a new CellRange instance to the collection.
|
|
68
|
+
*
|
|
69
|
+
* @param {CellRange} cellRange The CellRange instance with defined visual coordinates.
|
|
70
|
+
* @returns {SelectionRange}
|
|
71
|
+
*/
|
|
72
|
+
push(cellRange) {
|
|
73
|
+
this.ranges.push(cellRange);
|
|
74
|
+
return this;
|
|
75
|
+
}
|
|
76
|
+
|
|
66
77
|
/**
|
|
67
78
|
* Removes from the stack the last added coordinates.
|
|
68
79
|
*
|
package/selection/selection.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
|
5
|
+
require("core-js/modules/es.array.push.js");
|
|
5
6
|
require("core-js/modules/es.set.difference.v2.js");
|
|
6
7
|
require("core-js/modules/es.set.intersection.v2.js");
|
|
7
8
|
require("core-js/modules/es.set.is-disjoint-from.v2.js");
|
|
@@ -34,6 +35,15 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
34
35
|
function _classPrivateFieldGet(s, a) { return s.get(_assertClassBrand(s, a)); }
|
|
35
36
|
function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a), r), r; }
|
|
36
37
|
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"); }
|
|
38
|
+
/**
|
|
39
|
+
* @typedef {object} SelectionState
|
|
40
|
+
* @property {CellRange[]} ranges The array of all ranges.
|
|
41
|
+
* @property {CellRange} activeRange The active range.
|
|
42
|
+
* @property {number} activeSelectionLayer The active selection layer.
|
|
43
|
+
* @property {number[]} selectedByRowHeader The state of the selected row headers.
|
|
44
|
+
* @property {number[]} selectedByColumnHeader The state of the selected column headers.
|
|
45
|
+
* @property {boolean} disableHeadersHighlight The state of the disable headers highlight.
|
|
46
|
+
*/
|
|
37
47
|
/**
|
|
38
48
|
* @class Selection
|
|
39
49
|
* @util
|
|
@@ -355,6 +365,7 @@ class Selection {
|
|
|
355
365
|
// We are creating copy. We would like to modify just the start of the selection by below hook. Then original coords
|
|
356
366
|
// should be handled by next methods.
|
|
357
367
|
const coordsClone = coords.clone();
|
|
368
|
+
_classPrivateFieldSet(_disableHeadersHighlight, this, false);
|
|
358
369
|
_classPrivateFieldSet(_isFocusSelectionChanged, this, false);
|
|
359
370
|
this.runLocalHooks(`beforeSetRangeStart${fragment ? 'Only' : ''}`, coordsClone);
|
|
360
371
|
if (!isMultipleMode || isMultipleMode && !isMultipleSelection && (0, _mixed.isUndefined)(multipleSelection)) {
|
|
@@ -952,7 +963,6 @@ class Selection {
|
|
|
952
963
|
focusPosition,
|
|
953
964
|
disableHeadersHighlight
|
|
954
965
|
} = options;
|
|
955
|
-
_classPrivateFieldSet(_disableHeadersHighlight, this, disableHeadersHighlight);
|
|
956
966
|
if (focusPosition && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.row) && Number.isInteger(focusPosition === null || focusPosition === void 0 ? void 0 : focusPosition.col)) {
|
|
957
967
|
highlight = this.tableProps.createCellCoords((0, _number.clamp)(focusPosition.row, rowFrom, nrOfRows - 1), (0, _number.clamp)(focusPosition.col, columnFrom, nrOfColumns - 1));
|
|
958
968
|
}
|
|
@@ -961,6 +971,7 @@ class Selection {
|
|
|
961
971
|
this.clear();
|
|
962
972
|
this.runLocalHooks('beforeSelectAll', startCoords, endCoords, highlight);
|
|
963
973
|
this.setRangeStartOnly(startCoords, undefined, highlight);
|
|
974
|
+
_classPrivateFieldSet(_disableHeadersHighlight, this, disableHeadersHighlight);
|
|
964
975
|
if (columnFrom < 0) {
|
|
965
976
|
this.selectedByRowHeader.add(this.getLayerLevel());
|
|
966
977
|
}
|
|
@@ -970,7 +981,6 @@ class Selection {
|
|
|
970
981
|
this.setRangeEnd(endCoords);
|
|
971
982
|
this.runLocalHooks('afterSelectAll', startCoords, endCoords, highlight);
|
|
972
983
|
this.finish();
|
|
973
|
-
_classPrivateFieldSet(_disableHeadersHighlight, this, false);
|
|
974
984
|
}
|
|
975
985
|
|
|
976
986
|
/**
|
|
@@ -1137,6 +1147,57 @@ class Selection {
|
|
|
1137
1147
|
return isValid;
|
|
1138
1148
|
}
|
|
1139
1149
|
|
|
1150
|
+
/**
|
|
1151
|
+
* Allows importing the selection for all layers from the provided array of CellRange objects.
|
|
1152
|
+
* The method clears the current selection and sets the new one without triggering any
|
|
1153
|
+
* selection related hooks.
|
|
1154
|
+
*
|
|
1155
|
+
* @param {SelectionState} selectionState The selection state to import.
|
|
1156
|
+
*/
|
|
1157
|
+
importSelection(_ref) {
|
|
1158
|
+
let {
|
|
1159
|
+
ranges,
|
|
1160
|
+
activeRange,
|
|
1161
|
+
activeSelectionLayer,
|
|
1162
|
+
selectedByRowHeader,
|
|
1163
|
+
selectedByColumnHeader,
|
|
1164
|
+
disableHeadersHighlight
|
|
1165
|
+
} = _ref;
|
|
1166
|
+
if (ranges.length === 0) {
|
|
1167
|
+
return;
|
|
1168
|
+
}
|
|
1169
|
+
this.selectedRange.clear();
|
|
1170
|
+
this.highlight.clear();
|
|
1171
|
+
this.inProgress = true;
|
|
1172
|
+
_classPrivateFieldSet(_disableHeadersHighlight, this, disableHeadersHighlight);
|
|
1173
|
+
this.selectedByRowHeader = new Set(selectedByRowHeader);
|
|
1174
|
+
this.selectedByColumnHeader = new Set(selectedByColumnHeader);
|
|
1175
|
+
this.setActiveSelectionLayerIndex(0);
|
|
1176
|
+
ranges.forEach((cellRange, selectionLayerIndex) => {
|
|
1177
|
+
this.selectedRange.push(cellRange);
|
|
1178
|
+
this.applyAndCommit(cellRange, selectionLayerIndex);
|
|
1179
|
+
});
|
|
1180
|
+
this.setRangeFocus(activeRange.highlight, activeSelectionLayer);
|
|
1181
|
+
_classPrivateFieldSet(_disableHeadersHighlight, this, false);
|
|
1182
|
+
this.inProgress = false;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
/**
|
|
1186
|
+
* Exports all selection layers with other properties related to the selection state.
|
|
1187
|
+
*
|
|
1188
|
+
* @returns {SelectionState}
|
|
1189
|
+
*/
|
|
1190
|
+
exportSelection() {
|
|
1191
|
+
return {
|
|
1192
|
+
ranges: Array.from(this.selectedRange).map(range => range.clone()),
|
|
1193
|
+
activeRange: this.getActiveSelectedRange(),
|
|
1194
|
+
activeSelectionLayer: this.getActiveSelectionLayerIndex(),
|
|
1195
|
+
selectedByRowHeader: Array.from(this.selectedByRowHeader),
|
|
1196
|
+
selectedByColumnHeader: Array.from(this.selectedByColumnHeader),
|
|
1197
|
+
disableHeadersHighlight: _classPrivateFieldGet(_disableHeadersHighlight, this)
|
|
1198
|
+
};
|
|
1199
|
+
}
|
|
1200
|
+
|
|
1140
1201
|
/**
|
|
1141
1202
|
* Refreshes the whole selection by clearing, reapplying and committing (calculating visual to renderable indexes)
|
|
1142
1203
|
* the selection by using already added visual ranges. The method can be useful when underneath some indexes
|