handsontable
Version:
Handsontable is a JavaScript Data Grid available for React, Angular and Vue.
22 lines (20 loc) • 827 B
JavaScript
exports.__esModule = true;
exports.createPaginatorStrategy = createPaginatorStrategy;
require("core-js/modules/es.error.cause.js");
var _fixedPageSize = require("./fixedPageSize");
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)) {
throw new Error(`Unknown pagination strategy type: ${strategyType}`);
}
const Strategy = strategies.get(strategyType);
return new Strategy();
}
;