handsontable 16.1.1 → 16.2.0-next-90d1117-20251117
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.
- package/3rdparty/walkontable/src/overlays.js +1 -1
- package/3rdparty/walkontable/src/overlays.mjs +1 -1
- package/3rdparty/walkontable/src/selection/border/border.js +19 -3
- package/3rdparty/walkontable/src/selection/border/border.mjs +19 -3
- package/CHANGELOG.md +39 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/coordsMapper/index.js +11 -0
- package/core/coordsMapper/index.mjs +1 -0
- package/core/hooks/bucket.js +7 -1
- package/core/hooks/bucket.mjs +7 -1
- package/core/hooks/constants.js +54 -0
- package/core/hooks/constants.mjs +54 -0
- package/core/hooks/index.d.ts +6 -0
- package/core/index.js +10 -4
- package/core/index.mjs +2 -1
- package/core.d.ts +3 -2
- package/core.js +67 -26
- package/core.mjs +56 -15
- package/dataMap/metaManager/metaSchema.js +197 -20
- package/dataMap/metaManager/metaSchema.mjs +197 -20
- package/dist/handsontable.css +175 -3
- package/dist/handsontable.full.css +175 -3
- package/dist/handsontable.full.js +10864 -8426
- package/dist/handsontable.full.min.css +5 -4
- package/dist/handsontable.full.min.js +194 -193
- package/dist/handsontable.js +7126 -4827
- package/dist/handsontable.min.css +4 -4
- package/dist/handsontable.min.js +43 -42
- package/dist/languages/all.js +168 -21
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/ar-AR.js +8 -1
- package/dist/languages/ar-AR.min.js +1 -1
- package/dist/languages/cs-CZ.js +8 -1
- package/dist/languages/cs-CZ.min.js +1 -1
- package/dist/languages/de-CH.js +8 -1
- package/dist/languages/de-CH.min.js +1 -1
- package/dist/languages/de-DE.js +8 -1
- package/dist/languages/de-DE.min.js +1 -1
- package/dist/languages/en-US.js +8 -1
- package/dist/languages/en-US.min.js +1 -1
- package/dist/languages/es-MX.js +8 -1
- package/dist/languages/es-MX.min.js +1 -1
- package/dist/languages/fa-IR.js +8 -1
- package/dist/languages/fa-IR.min.js +1 -1
- package/dist/languages/fr-FR.js +8 -1
- package/dist/languages/fr-FR.min.js +1 -1
- package/dist/languages/hr-HR.js +8 -1
- package/dist/languages/hr-HR.min.js +1 -1
- package/dist/languages/it-IT.js +8 -1
- package/dist/languages/it-IT.min.js +1 -1
- package/dist/languages/ja-JP.js +8 -1
- package/dist/languages/ja-JP.min.js +1 -1
- package/dist/languages/ko-KR.js +8 -1
- package/dist/languages/ko-KR.min.js +1 -1
- package/dist/languages/lv-LV.js +8 -1
- package/dist/languages/lv-LV.min.js +1 -1
- package/dist/languages/nb-NO.js +8 -1
- package/dist/languages/nb-NO.min.js +1 -1
- package/dist/languages/nl-NL.js +8 -1
- package/dist/languages/nl-NL.min.js +1 -1
- package/dist/languages/pl-PL.js +8 -1
- package/dist/languages/pl-PL.min.js +1 -1
- package/dist/languages/pt-BR.js +8 -1
- package/dist/languages/pt-BR.min.js +1 -1
- package/dist/languages/ru-RU.js +8 -1
- package/dist/languages/ru-RU.min.js +1 -1
- package/dist/languages/sr-SP.js +8 -1
- package/dist/languages/sr-SP.min.js +1 -1
- package/dist/languages/zh-CN.js +8 -1
- package/dist/languages/zh-CN.min.js +1 -1
- package/dist/languages/zh-TW.js +8 -1
- package/dist/languages/zh-TW.min.js +1 -1
- package/editors/autocompleteEditor/autocompleteEditor.js +21 -1
- package/editors/autocompleteEditor/autocompleteEditor.mjs +22 -2
- package/focusManager/constants.js +25 -0
- package/focusManager/constants.mjs +22 -0
- package/focusManager/eventListener.js +107 -0
- package/focusManager/eventListener.mjs +103 -0
- package/{focusManager.d.ts → focusManager/grid.d.ts} +1 -1
- package/{focusManager.js → focusManager/grid.js} +48 -17
- package/{focusManager.mjs → focusManager/grid.mjs} +47 -16
- package/focusManager/index.d.ts +2 -0
- package/focusManager/index.js +20 -0
- package/focusManager/index.mjs +20 -0
- package/focusManager/scope.js +133 -0
- package/focusManager/scope.mjs +129 -0
- package/focusManager/scopeManager.d.ts +19 -0
- package/focusManager/scopeManager.js +268 -0
- package/focusManager/scopeManager.mjs +263 -0
- package/focusManager/scopes/grid.js +120 -0
- package/focusManager/scopes/grid.mjs +116 -0
- package/focusManager/scopes/index.js +13 -0
- package/focusManager/scopes/index.mjs +9 -0
- package/{utils → focusManager/utils}/focusDetector.js +21 -31
- package/{utils → focusManager/utils}/focusDetector.mjs +21 -31
- package/focusManager/utils/utils.js +95 -0
- package/focusManager/utils/utils.mjs +89 -0
- package/helpers/dom/element.js +1 -1
- package/helpers/dom/element.mjs +2 -2
- package/helpers/dom/event.js +1 -1
- package/helpers/dom/event.mjs +1 -1
- package/helpers/mixed.js +2 -65
- package/helpers/mixed.mjs +2 -63
- package/i18n/constants.js +10 -1
- package/i18n/constants.mjs +10 -1
- package/i18n/languages/ar-AR.js +8 -1
- package/i18n/languages/ar-AR.mjs +8 -1
- package/i18n/languages/cs-CZ.js +8 -1
- package/i18n/languages/cs-CZ.mjs +8 -1
- package/i18n/languages/de-CH.js +8 -1
- package/i18n/languages/de-CH.mjs +8 -1
- package/i18n/languages/de-DE.js +8 -1
- package/i18n/languages/de-DE.mjs +8 -1
- package/i18n/languages/en-US.js +8 -1
- package/i18n/languages/en-US.mjs +8 -1
- package/i18n/languages/es-MX.js +8 -1
- package/i18n/languages/es-MX.mjs +8 -1
- package/i18n/languages/fa-IR.js +8 -1
- package/i18n/languages/fa-IR.mjs +8 -1
- package/i18n/languages/fr-FR.js +8 -1
- package/i18n/languages/fr-FR.mjs +8 -1
- package/i18n/languages/hr-HR.js +8 -1
- package/i18n/languages/hr-HR.mjs +8 -1
- package/i18n/languages/it-IT.js +8 -1
- package/i18n/languages/it-IT.mjs +8 -1
- package/i18n/languages/ja-JP.js +8 -1
- package/i18n/languages/ja-JP.mjs +8 -1
- package/i18n/languages/ko-KR.js +8 -1
- package/i18n/languages/ko-KR.mjs +8 -1
- package/i18n/languages/lv-LV.js +8 -1
- package/i18n/languages/lv-LV.mjs +8 -1
- package/i18n/languages/nb-NO.js +8 -1
- package/i18n/languages/nb-NO.mjs +8 -1
- package/i18n/languages/nl-NL.js +8 -1
- package/i18n/languages/nl-NL.mjs +8 -1
- package/i18n/languages/pl-PL.js +8 -1
- package/i18n/languages/pl-PL.mjs +8 -1
- package/i18n/languages/pt-BR.js +8 -1
- package/i18n/languages/pt-BR.mjs +8 -1
- package/i18n/languages/ru-RU.js +8 -1
- package/i18n/languages/ru-RU.mjs +8 -1
- package/i18n/languages/sr-SP.js +8 -1
- package/i18n/languages/sr-SP.mjs +8 -1
- package/i18n/languages/zh-CN.js +8 -1
- package/i18n/languages/zh-CN.mjs +8 -1
- package/i18n/languages/zh-TW.js +8 -1
- package/i18n/languages/zh-TW.mjs +8 -1
- package/index.d.ts +9 -0
- package/languages/all.js +168 -21
- package/languages/ar-AR.js +8 -1
- package/languages/ar-AR.mjs +8 -1
- package/languages/cs-CZ.js +8 -1
- package/languages/cs-CZ.mjs +8 -1
- package/languages/de-CH.js +8 -1
- package/languages/de-CH.mjs +8 -1
- package/languages/de-DE.js +8 -1
- package/languages/de-DE.mjs +8 -1
- package/languages/en-US.js +8 -1
- package/languages/en-US.mjs +8 -1
- package/languages/es-MX.js +8 -1
- package/languages/es-MX.mjs +8 -1
- package/languages/fa-IR.js +8 -1
- package/languages/fa-IR.mjs +8 -1
- package/languages/fr-FR.js +8 -1
- package/languages/fr-FR.mjs +8 -1
- package/languages/hr-HR.js +8 -1
- package/languages/hr-HR.mjs +8 -1
- package/languages/index.js +168 -21
- package/languages/it-IT.js +8 -1
- package/languages/it-IT.mjs +8 -1
- package/languages/ja-JP.js +8 -1
- package/languages/ja-JP.mjs +8 -1
- package/languages/ko-KR.js +8 -1
- package/languages/ko-KR.mjs +8 -1
- package/languages/lv-LV.js +8 -1
- package/languages/lv-LV.mjs +8 -1
- package/languages/nb-NO.js +8 -1
- package/languages/nb-NO.mjs +8 -1
- package/languages/nl-NL.js +8 -1
- package/languages/nl-NL.mjs +8 -1
- package/languages/pl-PL.js +8 -1
- package/languages/pl-PL.mjs +8 -1
- package/languages/pt-BR.js +8 -1
- package/languages/pt-BR.mjs +8 -1
- package/languages/ru-RU.js +8 -1
- package/languages/ru-RU.mjs +8 -1
- package/languages/sr-SP.js +8 -1
- package/languages/sr-SP.mjs +8 -1
- package/languages/zh-CN.js +8 -1
- package/languages/zh-CN.mjs +8 -1
- package/languages/zh-TW.js +8 -1
- package/languages/zh-TW.mjs +8 -1
- package/package.json +25 -7
- package/plugins/autoRowSize/autoRowSize.js +8 -1
- package/plugins/autoRowSize/autoRowSize.mjs +8 -1
- package/plugins/base/base.js +36 -10
- package/plugins/base/base.mjs +36 -10
- package/plugins/columnSummary/endpoints.js +13 -3
- package/plugins/columnSummary/endpoints.mjs +13 -3
- package/plugins/customBorders/customBorders.d.ts +1 -0
- package/plugins/customBorders/customBorders.js +32 -2
- package/plugins/customBorders/customBorders.mjs +32 -2
- package/plugins/dialog/constants.js +7 -0
- package/plugins/dialog/constants.mjs +4 -0
- package/plugins/dialog/dialog.d.ts +22 -2
- package/plugins/dialog/dialog.js +197 -81
- package/plugins/dialog/dialog.mjs +196 -81
- package/plugins/dialog/templates/base.js +60 -0
- package/plugins/dialog/templates/base.mjs +56 -0
- package/plugins/dialog/templates/confirm.js +106 -0
- package/plugins/dialog/templates/confirm.mjs +102 -0
- package/plugins/dialog/templates/index.js +6 -0
- package/plugins/dialog/templates/index.mjs +4 -0
- package/plugins/dialog/ui.js +125 -41
- package/plugins/dialog/ui.mjs +119 -35
- package/plugins/emptyDataState/emptyDataState.d.ts +24 -0
- package/plugins/emptyDataState/emptyDataState.js +526 -0
- package/plugins/emptyDataState/emptyDataState.mjs +521 -0
- package/plugins/emptyDataState/index.d.ts +1 -0
- package/plugins/emptyDataState/index.js +7 -0
- package/plugins/emptyDataState/index.mjs +1 -0
- package/plugins/emptyDataState/ui.js +282 -0
- package/plugins/emptyDataState/ui.mjs +278 -0
- package/plugins/filters/component/value.js +16 -1
- package/plugins/filters/component/value.mjs +16 -1
- package/plugins/filters/filters.d.ts +5 -1
- package/plugins/filters/filters.js +22 -1
- package/plugins/filters/filters.mjs +22 -1
- package/plugins/filters/ui/multipleSelect.js +90 -79
- package/plugins/filters/ui/multipleSelect.mjs +90 -79
- package/plugins/index.d.ts +3 -0
- package/plugins/index.js +3 -0
- package/plugins/index.mjs +3 -1
- package/plugins/mergeCells/utils.js +1 -5
- package/plugins/mergeCells/utils.mjs +1 -5
- package/plugins/pagination/pagination.js +37 -175
- package/plugins/pagination/pagination.mjs +37 -175
- package/plugins/pagination/strategies/autoPageSize.js +2 -2
- package/plugins/pagination/strategies/autoPageSize.mjs +2 -2
- package/plugins/pagination/ui.js +6 -10
- package/plugins/pagination/ui.mjs +7 -11
- package/plugins/stretchColumns/calculator.js +3 -1
- package/plugins/stretchColumns/calculator.mjs +3 -1
- package/plugins/undoRedo/undoRedo.js +16 -6
- package/plugins/undoRedo/undoRedo.mjs +16 -5
- package/renderers/checkboxRenderer/checkboxRenderer.js +12 -15
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +12 -15
- package/selection/selection.js +1 -1
- package/selection/selection.mjs +1 -1
- package/settings.d.ts +3 -0
- package/shortcutContexts/commands/index.js +2 -1
- package/shortcutContexts/commands/index.mjs +2 -1
- package/shortcutContexts/commands/tabNavigation.js +51 -0
- package/shortcutContexts/commands/tabNavigation.mjs +48 -0
- package/shortcutContexts/constants.js +16 -1
- package/shortcutContexts/constants.mjs +16 -1
- package/shortcutContexts/editor.js +2 -2
- package/shortcutContexts/editor.mjs +3 -3
- package/shortcutContexts/grid.js +19 -3
- package/shortcutContexts/grid.mjs +20 -4
- package/shortcuts/manager.d.ts +1 -0
- package/shortcuts/manager.js +17 -2
- package/shortcuts/manager.mjs +17 -2
- package/styles/handsontable.css +192 -35
- package/styles/handsontable.min.css +3 -3
- package/styles/ht-icons-horizon.css +233 -0
- package/styles/ht-icons-horizon.min.css +30 -0
- package/styles/ht-icons-main.css +233 -0
- package/styles/ht-icons-main.min.css +30 -0
- package/styles/ht-theme-classic-no-icons.css +399 -0
- package/styles/ht-theme-classic-no-icons.min.css +30 -0
- package/styles/ht-theme-classic.css +308 -556
- package/styles/ht-theme-classic.min.css +3 -3
- package/styles/ht-theme-horizon-no-icons.css +405 -0
- package/styles/ht-theme-horizon-no-icons.min.css +30 -0
- package/styles/ht-theme-horizon.css +312 -556
- package/styles/ht-theme-horizon.min.css +3 -3
- package/styles/ht-theme-main-no-icons.css +396 -0
- package/styles/ht-theme-main-no-icons.min.css +30 -0
- package/styles/ht-theme-main.css +303 -556
- package/styles/ht-theme-main.min.css +3 -3
- package/tableView.js +23 -5
- package/tableView.mjs +23 -5
- package/utils/dataStructures/uniqueMap.js +10 -0
- package/utils/dataStructures/uniqueMap.mjs +10 -0
- package/utils/ghostTable.js +0 -3
- package/utils/ghostTable.mjs +0 -3
- package/utils/stylesHandler.js +19 -4
- package/utils/stylesHandler.mjs +19 -4
- package/core/focusCatcher/index.js +0 -131
- package/core/focusCatcher/index.mjs +0 -127
- package/core/focusCatcher/utils.js +0 -31
- package/core/focusCatcher/utils.mjs +0 -27
- package/plugins/pagination/focusController.js +0 -27
- package/plugins/pagination/focusController.mjs +0 -23
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
|
5
|
+
require("core-js/modules/es.array.at.js");
|
|
6
|
+
require("core-js/modules/es.string.at-alternative.js");
|
|
5
7
|
require("core-js/modules/esnext.iterator.constructor.js");
|
|
6
8
|
require("core-js/modules/esnext.iterator.for-each.js");
|
|
7
9
|
require("core-js/modules/esnext.iterator.map.js");
|
|
@@ -14,8 +16,6 @@ var _a11yAnnouncer = require("../../utils/a11yAnnouncer");
|
|
|
14
16
|
var _strategies = require("./strategies");
|
|
15
17
|
var _templateLiteralTag = require("../../helpers/templateLiteralTag");
|
|
16
18
|
var _console = require("../../helpers/console");
|
|
17
|
-
var _focusController2 = require("./focusController");
|
|
18
|
-
var _focusDetector2 = require("../../utils/focusDetector");
|
|
19
19
|
function _classPrivateMethodInitSpec(e, a) { _checkPrivateRedeclaration(e, a), a.add(e); }
|
|
20
20
|
function _classPrivateFieldInitSpec(e, t, a) { _checkPrivateRedeclaration(e, t), t.set(e, a); }
|
|
21
21
|
function _checkPrivateRedeclaration(e, t) { if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object"); }
|
|
@@ -24,7 +24,6 @@ function _classPrivateFieldSet(s, a, r) { return s.set(_assertClassBrand(s, a),
|
|
|
24
24
|
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"); }
|
|
25
25
|
const PLUGIN_KEY = exports.PLUGIN_KEY = 'pagination';
|
|
26
26
|
const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 900;
|
|
27
|
-
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
28
27
|
const SHORTCUTS_CONTEXT_NAME = `plugin:${PLUGIN_KEY}`;
|
|
29
28
|
const AUTO_PAGE_SIZE_WARNING = (0, _templateLiteralTag.toSingleLine)`The \`auto\` page size setting requires the \`autoRowSize\`\x20
|
|
30
29
|
plugin to be enabled. Set the \`autoRowSize: true\` in the configuration to ensure correct behavior.`;
|
|
@@ -110,15 +109,13 @@ var _ui = /*#__PURE__*/new WeakMap();
|
|
|
110
109
|
var _calcStrategy = /*#__PURE__*/new WeakMap();
|
|
111
110
|
var _internalExecutionCall = /*#__PURE__*/new WeakMap();
|
|
112
111
|
var _internalRenderCall = /*#__PURE__*/new WeakMap();
|
|
113
|
-
var _focusController = /*#__PURE__*/new WeakMap();
|
|
114
|
-
var _focusDetector = /*#__PURE__*/new WeakMap();
|
|
115
112
|
var _Pagination_brand = /*#__PURE__*/new WeakSet();
|
|
116
113
|
var _onIndexCacheUpdate = /*#__PURE__*/new WeakMap();
|
|
117
114
|
class Pagination extends _base.BasePlugin {
|
|
118
115
|
constructor() {
|
|
119
116
|
super(...arguments);
|
|
120
117
|
/**
|
|
121
|
-
*
|
|
118
|
+
* Updates the visibility state of the pagination sections based on the current settings.
|
|
122
119
|
*/
|
|
123
120
|
_classPrivateMethodInitSpec(this, _Pagination_brand);
|
|
124
121
|
/**
|
|
@@ -168,18 +165,6 @@ class Pagination extends _base.BasePlugin {
|
|
|
168
165
|
* @type {boolean}
|
|
169
166
|
*/
|
|
170
167
|
_classPrivateFieldInitSpec(this, _internalRenderCall, false);
|
|
171
|
-
/**
|
|
172
|
-
* Pagination focus controller instance.
|
|
173
|
-
*
|
|
174
|
-
* @type {PaginationController}
|
|
175
|
-
*/
|
|
176
|
-
_classPrivateFieldInitSpec(this, _focusController, null);
|
|
177
|
-
/**
|
|
178
|
-
* Pagination focus detector instance.
|
|
179
|
-
*
|
|
180
|
-
* @type {object}
|
|
181
|
-
*/
|
|
182
|
-
_classPrivateFieldInitSpec(this, _focusDetector, null);
|
|
183
168
|
/**
|
|
184
169
|
* IndexMapper cache update listener. Once the cache is updated, we need to recompute
|
|
185
170
|
* the pagination state.
|
|
@@ -259,35 +244,8 @@ class Pagination extends _base.BasePlugin {
|
|
|
259
244
|
a11yAnnouncer: message => (0, _a11yAnnouncer.announce)(message)
|
|
260
245
|
}));
|
|
261
246
|
_assertClassBrand(_Pagination_brand, this, _updateSectionsVisibilityState).call(this);
|
|
262
|
-
_classPrivateFieldGet(_ui, this).addLocalHook('firstPageClick', () => this.firstPage()).addLocalHook('prevPageClick', () => this.prevPage()).addLocalHook('nextPageClick', () => this.nextPage()).addLocalHook('lastPageClick', () => this.lastPage()).addLocalHook('pageSizeChange', pageSize => this.setPageSize(pageSize))
|
|
263
|
-
_classPrivateFieldGet(_focusController, this).setCurrentPage(_classPrivateFieldGet(_ui, this).getFocusableElements().indexOf(element));
|
|
264
|
-
this.hot.unlisten();
|
|
265
|
-
this.hot.getShortcutManager().setActiveContextName(SHORTCUTS_CONTEXT_NAME);
|
|
266
|
-
this.hot.listen();
|
|
267
|
-
_classPrivateFieldGet(_focusDetector, this).deactivate();
|
|
268
|
-
});
|
|
247
|
+
_classPrivateFieldGet(_ui, this).addLocalHook('firstPageClick', () => this.firstPage()).addLocalHook('prevPageClick', () => this.prevPage()).addLocalHook('nextPageClick', () => this.nextPage()).addLocalHook('lastPageClick', () => this.lastPage()).addLocalHook('pageSizeChange', pageSize => this.setPageSize(pageSize));
|
|
269
248
|
}
|
|
270
|
-
if (!_classPrivateFieldGet(_focusController, this)) {
|
|
271
|
-
_classPrivateFieldSet(_focusController, this, (0, _focusController2.createPaginationFocusController)({
|
|
272
|
-
focusableElements: () => _classPrivateFieldGet(_ui, this).getFocusableElements()
|
|
273
|
-
}));
|
|
274
|
-
}
|
|
275
|
-
if (!_classPrivateFieldGet(_focusDetector, this)) {
|
|
276
|
-
_classPrivateFieldSet(_focusDetector, this, (0, _focusDetector2.installFocusDetector)(this.hot, _classPrivateFieldGet(_ui, this).getContainer(), {
|
|
277
|
-
onFocus: from => {
|
|
278
|
-
this.hot.getShortcutManager().setActiveContextName(SHORTCUTS_CONTEXT_NAME);
|
|
279
|
-
this.hot.listen();
|
|
280
|
-
if (from === 'from_above') {
|
|
281
|
-
_classPrivateFieldGet(_focusController, this).toFirstItem();
|
|
282
|
-
} else {
|
|
283
|
-
_classPrivateFieldGet(_focusController, this).toLastItem();
|
|
284
|
-
}
|
|
285
|
-
_classPrivateFieldGet(_focusDetector, this).deactivate();
|
|
286
|
-
}
|
|
287
|
-
}));
|
|
288
|
-
}
|
|
289
|
-
_assertClassBrand(_Pagination_brand, this, _registerEvents).call(this);
|
|
290
|
-
_assertClassBrand(_Pagination_brand, this, _registerShortcuts).call(this);
|
|
291
249
|
|
|
292
250
|
// Place the onInit hook before others to make sure that the pagination state is computed
|
|
293
251
|
// and applied to the index mapper before AutoColumnSize plugin begins calculate the column sizes.
|
|
@@ -351,37 +309,20 @@ class Pagination extends _base.BasePlugin {
|
|
|
351
309
|
}
|
|
352
310
|
return _assertClassBrand(_Pagination_brand, _this, _onAfterLanguageChange).call(_this, ...args);
|
|
353
311
|
});
|
|
354
|
-
this.addHook('
|
|
312
|
+
this.addHook('beforeHeightChange', function () {
|
|
355
313
|
for (var _len1 = arguments.length, args = new Array(_len1), _key1 = 0; _key1 < _len1; _key1++) {
|
|
356
314
|
args[_key1] = arguments[_key1];
|
|
357
315
|
}
|
|
358
|
-
return _assertClassBrand(_Pagination_brand, _this, _onModifyRowHeight).call(_this, ...args);
|
|
359
|
-
});
|
|
360
|
-
this.addHook('beforeHeightChange', function () {
|
|
361
|
-
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
|
362
|
-
args[_key10] = arguments[_key10];
|
|
363
|
-
}
|
|
364
316
|
return _assertClassBrand(_Pagination_brand, _this, _onBeforeHeightChange).call(_this, ...args);
|
|
365
317
|
});
|
|
366
318
|
this.addHook('afterSetTheme', function () {
|
|
367
|
-
for (var
|
|
368
|
-
args[
|
|
319
|
+
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
|
320
|
+
args[_key10] = arguments[_key10];
|
|
369
321
|
}
|
|
370
322
|
return _assertClassBrand(_Pagination_brand, _this, _onAfterSetTheme).call(_this, ...args);
|
|
371
323
|
});
|
|
372
|
-
this.addHook('afterDialogShow', function () {
|
|
373
|
-
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
|
374
|
-
args[_key12] = arguments[_key12];
|
|
375
|
-
}
|
|
376
|
-
return _assertClassBrand(_Pagination_brand, _this, _onAfterDialogShow).call(_this, ...args);
|
|
377
|
-
});
|
|
378
|
-
this.addHook('beforeDialogHide', function () {
|
|
379
|
-
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
|
380
|
-
args[_key13] = arguments[_key13];
|
|
381
|
-
}
|
|
382
|
-
return _assertClassBrand(_Pagination_brand, _this, _onAfterDialogHide).call(_this, ...args);
|
|
383
|
-
});
|
|
384
324
|
this.hot.rowIndexMapper.addLocalHook('cacheUpdated', _classPrivateFieldGet(_onIndexCacheUpdate, this));
|
|
325
|
+
_assertClassBrand(_Pagination_brand, this, _registerFocusScope).call(this);
|
|
385
326
|
super.enablePlugin();
|
|
386
327
|
}
|
|
387
328
|
|
|
@@ -400,11 +341,12 @@ class Pagination extends _base.BasePlugin {
|
|
|
400
341
|
*/
|
|
401
342
|
disablePlugin() {
|
|
402
343
|
this.hot.rowIndexMapper.removeLocalHook('cacheUpdated', _classPrivateFieldGet(_onIndexCacheUpdate, this)).unregisterMap(this.pluginName);
|
|
344
|
+
_assertClassBrand(_Pagination_brand, this, _unregisterFocusScope).call(this);
|
|
403
345
|
_classPrivateFieldGet(_ui, this).destroy();
|
|
404
346
|
_classPrivateFieldSet(_ui, this, null);
|
|
405
|
-
_assertClassBrand(_Pagination_brand, this, _unregisterShortcuts).call(this);
|
|
406
347
|
super.disablePlugin();
|
|
407
348
|
}
|
|
349
|
+
|
|
408
350
|
/**
|
|
409
351
|
* Gets the pagination current state. Returns an object with the following properties:
|
|
410
352
|
* - `currentPage`: The current page number.
|
|
@@ -660,11 +602,6 @@ class Pagination extends _base.BasePlugin {
|
|
|
660
602
|
_classPrivateFieldGet(_ui, this).setNavigationSectionVisibility(false);
|
|
661
603
|
this.hot.runHooks('afterPageNavigationVisibilityChange', false);
|
|
662
604
|
}
|
|
663
|
-
|
|
664
|
-
/**
|
|
665
|
-
* Updates the visibility state of the pagination sections based on the current settings.
|
|
666
|
-
*/
|
|
667
|
-
|
|
668
605
|
/**
|
|
669
606
|
* Destroys the plugin instance.
|
|
670
607
|
*/
|
|
@@ -678,59 +615,6 @@ class Pagination extends _base.BasePlugin {
|
|
|
678
615
|
}
|
|
679
616
|
}
|
|
680
617
|
exports.Pagination = Pagination;
|
|
681
|
-
function _registerEvents() {
|
|
682
|
-
// TODO: move to general focus manager module
|
|
683
|
-
this.eventManager.addEventListener(this.hot.rootDocument, 'mouseup', event => {
|
|
684
|
-
const container = _classPrivateFieldGet(_ui, this).getContainer();
|
|
685
|
-
if (!container.contains(event.target) && this.hot.getShortcutManager().getActiveContextName() === SHORTCUTS_CONTEXT_NAME) {
|
|
686
|
-
_classPrivateFieldGet(_focusDetector, this).activate();
|
|
687
|
-
_classPrivateFieldGet(_focusController, this).clear();
|
|
688
|
-
this.hot.getShortcutManager().setActiveContextName('grid');
|
|
689
|
-
}
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* Register shortcuts responsible for navigating through the pagination.
|
|
694
|
-
*/
|
|
695
|
-
function _registerShortcuts() {
|
|
696
|
-
var _manager$getContext;
|
|
697
|
-
const manager = this.hot.getShortcutManager();
|
|
698
|
-
const pluginContext = (_manager$getContext = manager.getContext(SHORTCUTS_CONTEXT_NAME)) !== null && _manager$getContext !== void 0 ? _manager$getContext : manager.addContext(SHORTCUTS_CONTEXT_NAME, 'global');
|
|
699
|
-
pluginContext.addShortcut({
|
|
700
|
-
keys: [['Shift', 'Tab'], ['Tab']],
|
|
701
|
-
preventDefault: false,
|
|
702
|
-
callback: event => {
|
|
703
|
-
let previousIndex = _classPrivateFieldGet(_focusController, this).getCurrentPage();
|
|
704
|
-
if (event.shiftKey) {
|
|
705
|
-
_classPrivateFieldGet(_focusController, this).toPreviousItem();
|
|
706
|
-
const currentPage = _classPrivateFieldGet(_focusController, this).getCurrentPage();
|
|
707
|
-
if (currentPage >= previousIndex) {
|
|
708
|
-
_assertClassBrand(_Pagination_brand, this, _unFocusPagination).call(this);
|
|
709
|
-
return;
|
|
710
|
-
}
|
|
711
|
-
previousIndex = currentPage;
|
|
712
|
-
} else {
|
|
713
|
-
_classPrivateFieldGet(_focusController, this).toNextItem();
|
|
714
|
-
const currentPage = _classPrivateFieldGet(_focusController, this).getCurrentPage();
|
|
715
|
-
if (currentPage <= previousIndex) {
|
|
716
|
-
_assertClassBrand(_Pagination_brand, this, _unFocusPagination).call(this);
|
|
717
|
-
return;
|
|
718
|
-
}
|
|
719
|
-
previousIndex = currentPage;
|
|
720
|
-
}
|
|
721
|
-
event.preventDefault();
|
|
722
|
-
},
|
|
723
|
-
group: SHORTCUTS_GROUP
|
|
724
|
-
});
|
|
725
|
-
}
|
|
726
|
-
/**
|
|
727
|
-
* Unregister shortcuts responsible for navigating through the pagination.
|
|
728
|
-
*/
|
|
729
|
-
function _unregisterShortcuts() {
|
|
730
|
-
const shortcutManager = this.hot.getShortcutManager();
|
|
731
|
-
const pluginContext = shortcutManager.getContext(SHORTCUTS_CONTEXT_NAME);
|
|
732
|
-
pluginContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
|
733
|
-
}
|
|
734
618
|
function _updateSectionsVisibilityState() {
|
|
735
619
|
if (this.getSetting('showPageSize')) {
|
|
736
620
|
this.showPageSizeSection();
|
|
@@ -778,10 +662,10 @@ function _computeAndApplyState() {
|
|
|
778
662
|
return view.getViewportHeight() - scrollbarWidth;
|
|
779
663
|
},
|
|
780
664
|
itemsSizeProvider: () => {
|
|
781
|
-
const defaultRowHeight = stylesHandler.getDefaultRowHeight();
|
|
782
665
|
const rowHeights = this.hot.rowIndexMapper.getRenderableIndexes().map(physicalIndex => {
|
|
783
666
|
var _this$hot$getRowHeigh;
|
|
784
|
-
|
|
667
|
+
const visualRowIndex = this.hot.toVisualRow(physicalIndex);
|
|
668
|
+
return (_this$hot$getRowHeigh = this.hot.getRowHeight(visualRowIndex)) !== null && _this$hot$getRowHeigh !== void 0 ? _this$hot$getRowHeigh : stylesHandler.getDefaultRowHeight(visualRowIndex);
|
|
785
669
|
});
|
|
786
670
|
return rowHeights;
|
|
787
671
|
}
|
|
@@ -808,11 +692,6 @@ function _computeAndApplyState() {
|
|
|
808
692
|
...paginationData,
|
|
809
693
|
totalRenderedRows: renderableRowsLength
|
|
810
694
|
});
|
|
811
|
-
if ((this.getSetting('showPageSize') || this.getSetting('showNavigation')) && paginationData.totalPages > 1) {
|
|
812
|
-
_classPrivateFieldGet(_focusDetector, this).activate();
|
|
813
|
-
} else {
|
|
814
|
-
_classPrivateFieldGet(_focusDetector, this).deactivate();
|
|
815
|
-
}
|
|
816
695
|
}
|
|
817
696
|
/**
|
|
818
697
|
* Based on the external factors (like the scroll position of the table, size etc.) it computes
|
|
@@ -838,6 +717,31 @@ function _computeNeedsBorder() {
|
|
|
838
717
|
} = this.getPaginationData();
|
|
839
718
|
return view.getLastFullyVisibleRow() !== lastVisibleRowIndex;
|
|
840
719
|
}
|
|
720
|
+
/**
|
|
721
|
+
* Registers the focus scope for the pagination plugin.
|
|
722
|
+
*/
|
|
723
|
+
function _registerFocusScope() {
|
|
724
|
+
this.hot.getFocusScopeManager().registerScope(PLUGIN_KEY, _classPrivateFieldGet(_ui, this).getContainer(), {
|
|
725
|
+
shortcutsContextName: SHORTCUTS_CONTEXT_NAME,
|
|
726
|
+
runOnlyIf: () => this.getSetting('showPageSize') || this.getSetting('showNavigation'),
|
|
727
|
+
onActivate: focusSource => {
|
|
728
|
+
const focusableElements = _classPrivateFieldGet(_ui, this).getFocusableElements();
|
|
729
|
+
if (focusableElements.length > 0) {
|
|
730
|
+
if (focusSource === 'tab_from_above') {
|
|
731
|
+
focusableElements.at(0).focus();
|
|
732
|
+
} else if (focusSource === 'tab_from_below') {
|
|
733
|
+
focusableElements.at(-1).focus();
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Unregisters the focus scope for the pagination plugin.
|
|
741
|
+
*/
|
|
742
|
+
function _unregisterFocusScope() {
|
|
743
|
+
this.hot.getFocusScopeManager().unregisterScope(PLUGIN_KEY);
|
|
744
|
+
}
|
|
841
745
|
/**
|
|
842
746
|
* Called before the selection of columns or all table is made. It modifies the selection rows range
|
|
843
747
|
* to the range of the current page.
|
|
@@ -912,27 +816,6 @@ function _onBeforePaste(pastedData, ranges) {
|
|
|
912
816
|
pastedData.splice(0, rowsToRemove);
|
|
913
817
|
});
|
|
914
818
|
}
|
|
915
|
-
/**
|
|
916
|
-
* Called when the row height is modified. It adds 1px border top compensation for
|
|
917
|
-
* the first row of the each page to make sure that the table's hider element
|
|
918
|
-
* height is correctly calculated.
|
|
919
|
-
*
|
|
920
|
-
* @param {number | undefined} height Row height.
|
|
921
|
-
* @param {number} row Visual row index.
|
|
922
|
-
* @returns {number}
|
|
923
|
-
*/
|
|
924
|
-
function _onModifyRowHeight(height, row) {
|
|
925
|
-
if (height === undefined || !_classPrivateFieldGet(_calcStrategy, this).getState(_classPrivateFieldGet(_currentPage, this))) {
|
|
926
|
-
return;
|
|
927
|
-
}
|
|
928
|
-
const {
|
|
929
|
-
firstVisibleRowIndex
|
|
930
|
-
} = this.getPaginationData();
|
|
931
|
-
if (row !== 0 && row === firstVisibleRowIndex) {
|
|
932
|
-
height += 1; // 1px border top compensation for the first row of the page.
|
|
933
|
-
}
|
|
934
|
-
return height;
|
|
935
|
-
}
|
|
936
819
|
/**
|
|
937
820
|
* Called after the view is rendered. It recalculates the pagination state only when
|
|
938
821
|
* the `pageSize` is set to `'auto'`. In this case, the plugin will compute the
|
|
@@ -1010,25 +893,4 @@ function _onAfterLanguageChange() {
|
|
|
1010
893
|
*/
|
|
1011
894
|
function _onAfterSetTheme(themeName) {
|
|
1012
895
|
_classPrivateFieldGet(_ui, this).updateTheme(themeName);
|
|
1013
|
-
}
|
|
1014
|
-
/**
|
|
1015
|
-
* Unfocuses the pagination and sets the active context for the shortcuts.
|
|
1016
|
-
*/
|
|
1017
|
-
function _unFocusPagination() {
|
|
1018
|
-
_classPrivateFieldGet(_focusDetector, this).activate();
|
|
1019
|
-
_classPrivateFieldGet(_focusController, this).clear();
|
|
1020
|
-
this.hot.unlisten();
|
|
1021
|
-
this.hot.getShortcutManager().setActiveContextName('grid');
|
|
1022
|
-
}
|
|
1023
|
-
/**
|
|
1024
|
-
* Called after the dialog is shown. It sets the active context for the shortcuts.
|
|
1025
|
-
*/
|
|
1026
|
-
function _onAfterDialogShow() {
|
|
1027
|
-
_classPrivateFieldGet(_focusDetector, this).deactivate();
|
|
1028
|
-
}
|
|
1029
|
-
/**
|
|
1030
|
-
* Called after the dialog is hidden. It sets the active context for the shortcuts.
|
|
1031
|
-
*/
|
|
1032
|
-
function _onAfterDialogHide() {
|
|
1033
|
-
_classPrivateFieldGet(_focusDetector, this).activate();
|
|
1034
896
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
|
2
|
+
import "core-js/modules/es.array.at.js";
|
|
3
|
+
import "core-js/modules/es.string.at-alternative.js";
|
|
2
4
|
import "core-js/modules/esnext.iterator.constructor.js";
|
|
3
5
|
import "core-js/modules/esnext.iterator.for-each.js";
|
|
4
6
|
import "core-js/modules/esnext.iterator.map.js";
|
|
@@ -17,11 +19,8 @@ import { announce } from "../../utils/a11yAnnouncer.mjs";
|
|
|
17
19
|
import { createPaginatorStrategy } from "./strategies/index.mjs";
|
|
18
20
|
import { toSingleLine } from "../../helpers/templateLiteralTag.mjs";
|
|
19
21
|
import { warn } from "../../helpers/console.mjs";
|
|
20
|
-
import { createPaginationFocusController } from "./focusController.mjs";
|
|
21
|
-
import { installFocusDetector } from "../../utils/focusDetector.mjs";
|
|
22
22
|
export const PLUGIN_KEY = 'pagination';
|
|
23
23
|
export const PLUGIN_PRIORITY = 900;
|
|
24
|
-
const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
25
24
|
const SHORTCUTS_CONTEXT_NAME = `plugin:${PLUGIN_KEY}`;
|
|
26
25
|
const AUTO_PAGE_SIZE_WARNING = toSingleLine`The \`auto\` page size setting requires the \`autoRowSize\`\x20
|
|
27
26
|
plugin to be enabled. Set the \`autoRowSize: true\` in the configuration to ensure correct behavior.`;
|
|
@@ -107,15 +106,13 @@ var _ui = /*#__PURE__*/new WeakMap();
|
|
|
107
106
|
var _calcStrategy = /*#__PURE__*/new WeakMap();
|
|
108
107
|
var _internalExecutionCall = /*#__PURE__*/new WeakMap();
|
|
109
108
|
var _internalRenderCall = /*#__PURE__*/new WeakMap();
|
|
110
|
-
var _focusController = /*#__PURE__*/new WeakMap();
|
|
111
|
-
var _focusDetector = /*#__PURE__*/new WeakMap();
|
|
112
109
|
var _Pagination_brand = /*#__PURE__*/new WeakSet();
|
|
113
110
|
var _onIndexCacheUpdate = /*#__PURE__*/new WeakMap();
|
|
114
111
|
export class Pagination extends BasePlugin {
|
|
115
112
|
constructor() {
|
|
116
113
|
super(...arguments);
|
|
117
114
|
/**
|
|
118
|
-
*
|
|
115
|
+
* Updates the visibility state of the pagination sections based on the current settings.
|
|
119
116
|
*/
|
|
120
117
|
_classPrivateMethodInitSpec(this, _Pagination_brand);
|
|
121
118
|
/**
|
|
@@ -165,18 +162,6 @@ export class Pagination extends BasePlugin {
|
|
|
165
162
|
* @type {boolean}
|
|
166
163
|
*/
|
|
167
164
|
_classPrivateFieldInitSpec(this, _internalRenderCall, false);
|
|
168
|
-
/**
|
|
169
|
-
* Pagination focus controller instance.
|
|
170
|
-
*
|
|
171
|
-
* @type {PaginationController}
|
|
172
|
-
*/
|
|
173
|
-
_classPrivateFieldInitSpec(this, _focusController, null);
|
|
174
|
-
/**
|
|
175
|
-
* Pagination focus detector instance.
|
|
176
|
-
*
|
|
177
|
-
* @type {object}
|
|
178
|
-
*/
|
|
179
|
-
_classPrivateFieldInitSpec(this, _focusDetector, null);
|
|
180
165
|
/**
|
|
181
166
|
* IndexMapper cache update listener. Once the cache is updated, we need to recompute
|
|
182
167
|
* the pagination state.
|
|
@@ -256,35 +241,8 @@ export class Pagination extends BasePlugin {
|
|
|
256
241
|
a11yAnnouncer: message => announce(message)
|
|
257
242
|
}));
|
|
258
243
|
_assertClassBrand(_Pagination_brand, this, _updateSectionsVisibilityState).call(this);
|
|
259
|
-
_classPrivateFieldGet(_ui, this).addLocalHook('firstPageClick', () => this.firstPage()).addLocalHook('prevPageClick', () => this.prevPage()).addLocalHook('nextPageClick', () => this.nextPage()).addLocalHook('lastPageClick', () => this.lastPage()).addLocalHook('pageSizeChange', pageSize => this.setPageSize(pageSize))
|
|
260
|
-
_classPrivateFieldGet(_focusController, this).setCurrentPage(_classPrivateFieldGet(_ui, this).getFocusableElements().indexOf(element));
|
|
261
|
-
this.hot.unlisten();
|
|
262
|
-
this.hot.getShortcutManager().setActiveContextName(SHORTCUTS_CONTEXT_NAME);
|
|
263
|
-
this.hot.listen();
|
|
264
|
-
_classPrivateFieldGet(_focusDetector, this).deactivate();
|
|
265
|
-
});
|
|
244
|
+
_classPrivateFieldGet(_ui, this).addLocalHook('firstPageClick', () => this.firstPage()).addLocalHook('prevPageClick', () => this.prevPage()).addLocalHook('nextPageClick', () => this.nextPage()).addLocalHook('lastPageClick', () => this.lastPage()).addLocalHook('pageSizeChange', pageSize => this.setPageSize(pageSize));
|
|
266
245
|
}
|
|
267
|
-
if (!_classPrivateFieldGet(_focusController, this)) {
|
|
268
|
-
_classPrivateFieldSet(_focusController, this, createPaginationFocusController({
|
|
269
|
-
focusableElements: () => _classPrivateFieldGet(_ui, this).getFocusableElements()
|
|
270
|
-
}));
|
|
271
|
-
}
|
|
272
|
-
if (!_classPrivateFieldGet(_focusDetector, this)) {
|
|
273
|
-
_classPrivateFieldSet(_focusDetector, this, installFocusDetector(this.hot, _classPrivateFieldGet(_ui, this).getContainer(), {
|
|
274
|
-
onFocus: from => {
|
|
275
|
-
this.hot.getShortcutManager().setActiveContextName(SHORTCUTS_CONTEXT_NAME);
|
|
276
|
-
this.hot.listen();
|
|
277
|
-
if (from === 'from_above') {
|
|
278
|
-
_classPrivateFieldGet(_focusController, this).toFirstItem();
|
|
279
|
-
} else {
|
|
280
|
-
_classPrivateFieldGet(_focusController, this).toLastItem();
|
|
281
|
-
}
|
|
282
|
-
_classPrivateFieldGet(_focusDetector, this).deactivate();
|
|
283
|
-
}
|
|
284
|
-
}));
|
|
285
|
-
}
|
|
286
|
-
_assertClassBrand(_Pagination_brand, this, _registerEvents).call(this);
|
|
287
|
-
_assertClassBrand(_Pagination_brand, this, _registerShortcuts).call(this);
|
|
288
246
|
|
|
289
247
|
// Place the onInit hook before others to make sure that the pagination state is computed
|
|
290
248
|
// and applied to the index mapper before AutoColumnSize plugin begins calculate the column sizes.
|
|
@@ -348,37 +306,20 @@ export class Pagination extends BasePlugin {
|
|
|
348
306
|
}
|
|
349
307
|
return _assertClassBrand(_Pagination_brand, _this, _onAfterLanguageChange).call(_this, ...args);
|
|
350
308
|
});
|
|
351
|
-
this.addHook('
|
|
309
|
+
this.addHook('beforeHeightChange', function () {
|
|
352
310
|
for (var _len1 = arguments.length, args = new Array(_len1), _key1 = 0; _key1 < _len1; _key1++) {
|
|
353
311
|
args[_key1] = arguments[_key1];
|
|
354
312
|
}
|
|
355
|
-
return _assertClassBrand(_Pagination_brand, _this, _onModifyRowHeight).call(_this, ...args);
|
|
356
|
-
});
|
|
357
|
-
this.addHook('beforeHeightChange', function () {
|
|
358
|
-
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
|
359
|
-
args[_key10] = arguments[_key10];
|
|
360
|
-
}
|
|
361
313
|
return _assertClassBrand(_Pagination_brand, _this, _onBeforeHeightChange).call(_this, ...args);
|
|
362
314
|
});
|
|
363
315
|
this.addHook('afterSetTheme', function () {
|
|
364
|
-
for (var
|
|
365
|
-
args[
|
|
316
|
+
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
|
317
|
+
args[_key10] = arguments[_key10];
|
|
366
318
|
}
|
|
367
319
|
return _assertClassBrand(_Pagination_brand, _this, _onAfterSetTheme).call(_this, ...args);
|
|
368
320
|
});
|
|
369
|
-
this.addHook('afterDialogShow', function () {
|
|
370
|
-
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
|
371
|
-
args[_key12] = arguments[_key12];
|
|
372
|
-
}
|
|
373
|
-
return _assertClassBrand(_Pagination_brand, _this, _onAfterDialogShow).call(_this, ...args);
|
|
374
|
-
});
|
|
375
|
-
this.addHook('beforeDialogHide', function () {
|
|
376
|
-
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
|
377
|
-
args[_key13] = arguments[_key13];
|
|
378
|
-
}
|
|
379
|
-
return _assertClassBrand(_Pagination_brand, _this, _onAfterDialogHide).call(_this, ...args);
|
|
380
|
-
});
|
|
381
321
|
this.hot.rowIndexMapper.addLocalHook('cacheUpdated', _classPrivateFieldGet(_onIndexCacheUpdate, this));
|
|
322
|
+
_assertClassBrand(_Pagination_brand, this, _registerFocusScope).call(this);
|
|
382
323
|
super.enablePlugin();
|
|
383
324
|
}
|
|
384
325
|
|
|
@@ -397,11 +338,12 @@ export class Pagination extends BasePlugin {
|
|
|
397
338
|
*/
|
|
398
339
|
disablePlugin() {
|
|
399
340
|
this.hot.rowIndexMapper.removeLocalHook('cacheUpdated', _classPrivateFieldGet(_onIndexCacheUpdate, this)).unregisterMap(this.pluginName);
|
|
341
|
+
_assertClassBrand(_Pagination_brand, this, _unregisterFocusScope).call(this);
|
|
400
342
|
_classPrivateFieldGet(_ui, this).destroy();
|
|
401
343
|
_classPrivateFieldSet(_ui, this, null);
|
|
402
|
-
_assertClassBrand(_Pagination_brand, this, _unregisterShortcuts).call(this);
|
|
403
344
|
super.disablePlugin();
|
|
404
345
|
}
|
|
346
|
+
|
|
405
347
|
/**
|
|
406
348
|
* Gets the pagination current state. Returns an object with the following properties:
|
|
407
349
|
* - `currentPage`: The current page number.
|
|
@@ -657,11 +599,6 @@ export class Pagination extends BasePlugin {
|
|
|
657
599
|
_classPrivateFieldGet(_ui, this).setNavigationSectionVisibility(false);
|
|
658
600
|
this.hot.runHooks('afterPageNavigationVisibilityChange', false);
|
|
659
601
|
}
|
|
660
|
-
|
|
661
|
-
/**
|
|
662
|
-
* Updates the visibility state of the pagination sections based on the current settings.
|
|
663
|
-
*/
|
|
664
|
-
|
|
665
602
|
/**
|
|
666
603
|
* Destroys the plugin instance.
|
|
667
604
|
*/
|
|
@@ -674,59 +611,6 @@ export class Pagination extends BasePlugin {
|
|
|
674
611
|
super.destroy();
|
|
675
612
|
}
|
|
676
613
|
}
|
|
677
|
-
function _registerEvents() {
|
|
678
|
-
// TODO: move to general focus manager module
|
|
679
|
-
this.eventManager.addEventListener(this.hot.rootDocument, 'mouseup', event => {
|
|
680
|
-
const container = _classPrivateFieldGet(_ui, this).getContainer();
|
|
681
|
-
if (!container.contains(event.target) && this.hot.getShortcutManager().getActiveContextName() === SHORTCUTS_CONTEXT_NAME) {
|
|
682
|
-
_classPrivateFieldGet(_focusDetector, this).activate();
|
|
683
|
-
_classPrivateFieldGet(_focusController, this).clear();
|
|
684
|
-
this.hot.getShortcutManager().setActiveContextName('grid');
|
|
685
|
-
}
|
|
686
|
-
});
|
|
687
|
-
}
|
|
688
|
-
/**
|
|
689
|
-
* Register shortcuts responsible for navigating through the pagination.
|
|
690
|
-
*/
|
|
691
|
-
function _registerShortcuts() {
|
|
692
|
-
var _manager$getContext;
|
|
693
|
-
const manager = this.hot.getShortcutManager();
|
|
694
|
-
const pluginContext = (_manager$getContext = manager.getContext(SHORTCUTS_CONTEXT_NAME)) !== null && _manager$getContext !== void 0 ? _manager$getContext : manager.addContext(SHORTCUTS_CONTEXT_NAME, 'global');
|
|
695
|
-
pluginContext.addShortcut({
|
|
696
|
-
keys: [['Shift', 'Tab'], ['Tab']],
|
|
697
|
-
preventDefault: false,
|
|
698
|
-
callback: event => {
|
|
699
|
-
let previousIndex = _classPrivateFieldGet(_focusController, this).getCurrentPage();
|
|
700
|
-
if (event.shiftKey) {
|
|
701
|
-
_classPrivateFieldGet(_focusController, this).toPreviousItem();
|
|
702
|
-
const currentPage = _classPrivateFieldGet(_focusController, this).getCurrentPage();
|
|
703
|
-
if (currentPage >= previousIndex) {
|
|
704
|
-
_assertClassBrand(_Pagination_brand, this, _unFocusPagination).call(this);
|
|
705
|
-
return;
|
|
706
|
-
}
|
|
707
|
-
previousIndex = currentPage;
|
|
708
|
-
} else {
|
|
709
|
-
_classPrivateFieldGet(_focusController, this).toNextItem();
|
|
710
|
-
const currentPage = _classPrivateFieldGet(_focusController, this).getCurrentPage();
|
|
711
|
-
if (currentPage <= previousIndex) {
|
|
712
|
-
_assertClassBrand(_Pagination_brand, this, _unFocusPagination).call(this);
|
|
713
|
-
return;
|
|
714
|
-
}
|
|
715
|
-
previousIndex = currentPage;
|
|
716
|
-
}
|
|
717
|
-
event.preventDefault();
|
|
718
|
-
},
|
|
719
|
-
group: SHORTCUTS_GROUP
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
|
-
/**
|
|
723
|
-
* Unregister shortcuts responsible for navigating through the pagination.
|
|
724
|
-
*/
|
|
725
|
-
function _unregisterShortcuts() {
|
|
726
|
-
const shortcutManager = this.hot.getShortcutManager();
|
|
727
|
-
const pluginContext = shortcutManager.getContext(SHORTCUTS_CONTEXT_NAME);
|
|
728
|
-
pluginContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
|
729
|
-
}
|
|
730
614
|
function _updateSectionsVisibilityState() {
|
|
731
615
|
if (this.getSetting('showPageSize')) {
|
|
732
616
|
this.showPageSizeSection();
|
|
@@ -774,10 +658,10 @@ function _computeAndApplyState() {
|
|
|
774
658
|
return view.getViewportHeight() - scrollbarWidth;
|
|
775
659
|
},
|
|
776
660
|
itemsSizeProvider: () => {
|
|
777
|
-
const defaultRowHeight = stylesHandler.getDefaultRowHeight();
|
|
778
661
|
const rowHeights = this.hot.rowIndexMapper.getRenderableIndexes().map(physicalIndex => {
|
|
779
662
|
var _this$hot$getRowHeigh;
|
|
780
|
-
|
|
663
|
+
const visualRowIndex = this.hot.toVisualRow(physicalIndex);
|
|
664
|
+
return (_this$hot$getRowHeigh = this.hot.getRowHeight(visualRowIndex)) !== null && _this$hot$getRowHeigh !== void 0 ? _this$hot$getRowHeigh : stylesHandler.getDefaultRowHeight(visualRowIndex);
|
|
781
665
|
});
|
|
782
666
|
return rowHeights;
|
|
783
667
|
}
|
|
@@ -804,11 +688,6 @@ function _computeAndApplyState() {
|
|
|
804
688
|
...paginationData,
|
|
805
689
|
totalRenderedRows: renderableRowsLength
|
|
806
690
|
});
|
|
807
|
-
if ((this.getSetting('showPageSize') || this.getSetting('showNavigation')) && paginationData.totalPages > 1) {
|
|
808
|
-
_classPrivateFieldGet(_focusDetector, this).activate();
|
|
809
|
-
} else {
|
|
810
|
-
_classPrivateFieldGet(_focusDetector, this).deactivate();
|
|
811
|
-
}
|
|
812
691
|
}
|
|
813
692
|
/**
|
|
814
693
|
* Based on the external factors (like the scroll position of the table, size etc.) it computes
|
|
@@ -834,6 +713,31 @@ function _computeNeedsBorder() {
|
|
|
834
713
|
} = this.getPaginationData();
|
|
835
714
|
return view.getLastFullyVisibleRow() !== lastVisibleRowIndex;
|
|
836
715
|
}
|
|
716
|
+
/**
|
|
717
|
+
* Registers the focus scope for the pagination plugin.
|
|
718
|
+
*/
|
|
719
|
+
function _registerFocusScope() {
|
|
720
|
+
this.hot.getFocusScopeManager().registerScope(PLUGIN_KEY, _classPrivateFieldGet(_ui, this).getContainer(), {
|
|
721
|
+
shortcutsContextName: SHORTCUTS_CONTEXT_NAME,
|
|
722
|
+
runOnlyIf: () => this.getSetting('showPageSize') || this.getSetting('showNavigation'),
|
|
723
|
+
onActivate: focusSource => {
|
|
724
|
+
const focusableElements = _classPrivateFieldGet(_ui, this).getFocusableElements();
|
|
725
|
+
if (focusableElements.length > 0) {
|
|
726
|
+
if (focusSource === 'tab_from_above') {
|
|
727
|
+
focusableElements.at(0).focus();
|
|
728
|
+
} else if (focusSource === 'tab_from_below') {
|
|
729
|
+
focusableElements.at(-1).focus();
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
/**
|
|
736
|
+
* Unregisters the focus scope for the pagination plugin.
|
|
737
|
+
*/
|
|
738
|
+
function _unregisterFocusScope() {
|
|
739
|
+
this.hot.getFocusScopeManager().unregisterScope(PLUGIN_KEY);
|
|
740
|
+
}
|
|
837
741
|
/**
|
|
838
742
|
* Called before the selection of columns or all table is made. It modifies the selection rows range
|
|
839
743
|
* to the range of the current page.
|
|
@@ -908,27 +812,6 @@ function _onBeforePaste(pastedData, ranges) {
|
|
|
908
812
|
pastedData.splice(0, rowsToRemove);
|
|
909
813
|
});
|
|
910
814
|
}
|
|
911
|
-
/**
|
|
912
|
-
* Called when the row height is modified. It adds 1px border top compensation for
|
|
913
|
-
* the first row of the each page to make sure that the table's hider element
|
|
914
|
-
* height is correctly calculated.
|
|
915
|
-
*
|
|
916
|
-
* @param {number | undefined} height Row height.
|
|
917
|
-
* @param {number} row Visual row index.
|
|
918
|
-
* @returns {number}
|
|
919
|
-
*/
|
|
920
|
-
function _onModifyRowHeight(height, row) {
|
|
921
|
-
if (height === undefined || !_classPrivateFieldGet(_calcStrategy, this).getState(_classPrivateFieldGet(_currentPage, this))) {
|
|
922
|
-
return;
|
|
923
|
-
}
|
|
924
|
-
const {
|
|
925
|
-
firstVisibleRowIndex
|
|
926
|
-
} = this.getPaginationData();
|
|
927
|
-
if (row !== 0 && row === firstVisibleRowIndex) {
|
|
928
|
-
height += 1; // 1px border top compensation for the first row of the page.
|
|
929
|
-
}
|
|
930
|
-
return height;
|
|
931
|
-
}
|
|
932
815
|
/**
|
|
933
816
|
* Called after the view is rendered. It recalculates the pagination state only when
|
|
934
817
|
* the `pageSize` is set to `'auto'`. In this case, the plugin will compute the
|
|
@@ -1006,25 +889,4 @@ function _onAfterLanguageChange() {
|
|
|
1006
889
|
*/
|
|
1007
890
|
function _onAfterSetTheme(themeName) {
|
|
1008
891
|
_classPrivateFieldGet(_ui, this).updateTheme(themeName);
|
|
1009
|
-
}
|
|
1010
|
-
/**
|
|
1011
|
-
* Unfocuses the pagination and sets the active context for the shortcuts.
|
|
1012
|
-
*/
|
|
1013
|
-
function _unFocusPagination() {
|
|
1014
|
-
_classPrivateFieldGet(_focusDetector, this).activate();
|
|
1015
|
-
_classPrivateFieldGet(_focusController, this).clear();
|
|
1016
|
-
this.hot.unlisten();
|
|
1017
|
-
this.hot.getShortcutManager().setActiveContextName('grid');
|
|
1018
|
-
}
|
|
1019
|
-
/**
|
|
1020
|
-
* Called after the dialog is shown. It sets the active context for the shortcuts.
|
|
1021
|
-
*/
|
|
1022
|
-
function _onAfterDialogShow() {
|
|
1023
|
-
_classPrivateFieldGet(_focusDetector, this).deactivate();
|
|
1024
|
-
}
|
|
1025
|
-
/**
|
|
1026
|
-
* Called after the dialog is hidden. It sets the active context for the shortcuts.
|
|
1027
|
-
*/
|
|
1028
|
-
function _onAfterDialogHide() {
|
|
1029
|
-
_classPrivateFieldGet(_focusDetector, this).activate();
|
|
1030
892
|
}
|
|
@@ -45,7 +45,7 @@ class AutoPageSizeStrategy {
|
|
|
45
45
|
const viewportSize = viewportSizeProvider();
|
|
46
46
|
const pages = [];
|
|
47
47
|
let startIndex = 0;
|
|
48
|
-
let totalSize =
|
|
48
|
+
let totalSize = 0;
|
|
49
49
|
let pageSize = 0;
|
|
50
50
|
for (let index = 0; index < itemSizes.length; index++) {
|
|
51
51
|
const itemSize = itemSizes[index];
|
|
@@ -56,7 +56,7 @@ class AutoPageSizeStrategy {
|
|
|
56
56
|
pageSize
|
|
57
57
|
});
|
|
58
58
|
startIndex = index;
|
|
59
|
-
totalSize =
|
|
59
|
+
totalSize = 0;
|
|
60
60
|
pageSize = 0;
|
|
61
61
|
}
|
|
62
62
|
totalSize += itemSize;
|