UNPKG

handsontable

Version:

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

18 lines (17 loc) 743 B
import { FixedPageSizeStrategy } from "./fixedPageSize.mjs"; import { throwWithCause } from "../../../helpers/errors.mjs"; import { AutoPageSizeStrategy } from "./autoPageSize.mjs"; const strategies = new Map([['fixed', FixedPageSizeStrategy], ['auto', AutoPageSizeStrategy]]); /** * Create a pagination calculation strategy based on the provided type. * * @param {string} strategyType The type of pagination strategy to create. * @returns {FixedPageSizeStrategy | AutoPageSizeStrategy} */ export function createPaginatorStrategy(strategyType) { if (!strategies.has(strategyType)) { throwWithCause(`Unknown pagination strategy type: ${strategyType}`); } const Strategy = strategies.get(strategyType); return new Strategy(); }