UNPKG

handsontable

Version:

Handsontable is a JavaScript Data Grid available for React, Angular and Vue.

22 lines (20 loc) 843 B
"use strict"; exports.__esModule = true; exports.createPaginatorStrategy = createPaginatorStrategy; var _fixedPageSize = require("./fixedPageSize"); var _errors = require("../../../helpers/errors"); var _autoPageSize = require("./autoPageSize"); const strategies = new Map([['fixed', _fixedPageSize.FixedPageSizeStrategy], ['auto', _autoPageSize.AutoPageSizeStrategy]]); /** * Create a pagination calculation strategy based on the provided type. * * @param {string} strategyType The type of pagination strategy to create. * @returns {FixedPageSizeStrategy | AutoPageSizeStrategy} */ function createPaginatorStrategy(strategyType) { if (!strategies.has(strategyType)) { (0, _errors.throwWithCause)(`Unknown pagination strategy type: ${strategyType}`); } const Strategy = strategies.get(strategyType); return new Strategy(); }