@highcharts/grid-pro 2.0.0
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/README.md +35 -0
- package/css/grid-pro.css +1756 -0
- package/es-modules/Accessibility/A11yI18n.d.ts +95 -0
- package/es-modules/Accessibility/A11yI18n.js +290 -0
- package/es-modules/Accessibility/Accessibility.d.ts +116 -0
- package/es-modules/Accessibility/Accessibility.js +402 -0
- package/es-modules/Accessibility/AccessibilityComponent.d.ts +97 -0
- package/es-modules/Accessibility/AccessibilityComponent.js +147 -0
- package/es-modules/Accessibility/Components/AnnotationsA11y.d.ts +43 -0
- package/es-modules/Accessibility/Components/AnnotationsA11y.js +160 -0
- package/es-modules/Accessibility/Components/ContainerComponent.d.ts +48 -0
- package/es-modules/Accessibility/Components/ContainerComponent.js +142 -0
- package/es-modules/Accessibility/Components/InfoRegionsComponent.d.ts +144 -0
- package/es-modules/Accessibility/Components/InfoRegionsComponent.js +555 -0
- package/es-modules/Accessibility/Components/LegendComponent.d.ts +124 -0
- package/es-modules/Accessibility/Components/LegendComponent.js +474 -0
- package/es-modules/Accessibility/Components/MenuComponent.d.ts +93 -0
- package/es-modules/Accessibility/Components/MenuComponent.js +430 -0
- package/es-modules/Accessibility/Components/NavigatorComponent.d.ts +57 -0
- package/es-modules/Accessibility/Components/NavigatorComponent.js +235 -0
- package/es-modules/Accessibility/Components/RangeSelectorComponent.d.ts +126 -0
- package/es-modules/Accessibility/Components/RangeSelectorComponent.js +473 -0
- package/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.d.ts +18 -0
- package/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.js +234 -0
- package/es-modules/Accessibility/Components/SeriesComponent/NewDataAnnouncer.d.ts +87 -0
- package/es-modules/Accessibility/Components/SeriesComponent/NewDataAnnouncer.js +309 -0
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesComponent.d.ts +53 -0
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesComponent.js +130 -0
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesDescriber.d.ts +28 -0
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesDescriber.js +415 -0
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesKeyboardNavigation.d.ts +114 -0
- package/es-modules/Accessibility/Components/SeriesComponent/SeriesKeyboardNavigation.js +721 -0
- package/es-modules/Accessibility/Components/ZoomComponent.d.ts +96 -0
- package/es-modules/Accessibility/Components/ZoomComponent.js +314 -0
- package/es-modules/Accessibility/FocusBorder.d.ts +40 -0
- package/es-modules/Accessibility/FocusBorder.js +301 -0
- package/es-modules/Accessibility/HighContrastMode.d.ts +35 -0
- package/es-modules/Accessibility/HighContrastMode.js +100 -0
- package/es-modules/Accessibility/HighContrastTheme.d.ts +11 -0
- package/es-modules/Accessibility/HighContrastTheme.js +212 -0
- package/es-modules/Accessibility/KeyboardNavigation.d.ts +133 -0
- package/es-modules/Accessibility/KeyboardNavigation.js +450 -0
- package/es-modules/Accessibility/KeyboardNavigationHandler.d.ts +48 -0
- package/es-modules/Accessibility/KeyboardNavigationHandler.js +126 -0
- package/es-modules/Accessibility/Options/A11yDefaults.d.ts +68 -0
- package/es-modules/Accessibility/Options/A11yDefaults.js +971 -0
- package/es-modules/Accessibility/Options/DeprecatedOptions.d.ts +22 -0
- package/es-modules/Accessibility/Options/DeprecatedOptions.js +265 -0
- package/es-modules/Accessibility/Options/LangDefaults.d.ts +4 -0
- package/es-modules/Accessibility/Options/LangDefaults.js +440 -0
- package/es-modules/Accessibility/ProxyElement.d.ts +78 -0
- package/es-modules/Accessibility/ProxyElement.js +223 -0
- package/es-modules/Accessibility/ProxyProvider.d.ts +90 -0
- package/es-modules/Accessibility/ProxyProvider.js +315 -0
- package/es-modules/Accessibility/Utils/Announcer.d.ts +26 -0
- package/es-modules/Accessibility/Utils/Announcer.js +90 -0
- package/es-modules/Accessibility/Utils/ChartUtilities.d.ts +90 -0
- package/es-modules/Accessibility/Utils/ChartUtilities.js +298 -0
- package/es-modules/Accessibility/Utils/DOMElementProvider.d.ts +20 -0
- package/es-modules/Accessibility/Utils/DOMElementProvider.js +69 -0
- package/es-modules/Accessibility/Utils/EventProvider.d.ts +26 -0
- package/es-modules/Accessibility/Utils/EventProvider.js +65 -0
- package/es-modules/Accessibility/Utils/HTMLUtilities.d.ts +108 -0
- package/es-modules/Accessibility/Utils/HTMLUtilities.js +319 -0
- package/es-modules/Core/Animation/AnimationUtilities.d.ts +107 -0
- package/es-modules/Core/Animation/AnimationUtilities.js +200 -0
- package/es-modules/Core/Animation/Fx.d.ts +130 -0
- package/es-modules/Core/Animation/Fx.js +388 -0
- package/es-modules/Core/Chart/Chart.d.ts +1009 -0
- package/es-modules/Core/Chart/Chart.js +3008 -0
- package/es-modules/Core/Chart/Chart3D.d.ts +276 -0
- package/es-modules/Core/Chart/Chart3D.js +1686 -0
- package/es-modules/Core/Chart/ChartDefaults.d.ts +8 -0
- package/es-modules/Core/Chart/ChartDefaults.js +1304 -0
- package/es-modules/Core/Chart/ChartNavigationComposition.d.ts +55 -0
- package/es-modules/Core/Chart/ChartNavigationComposition.js +90 -0
- package/es-modules/Core/Chart/GanttChart.d.ts +74 -0
- package/es-modules/Core/Chart/GanttChart.js +189 -0
- package/es-modules/Core/Chart/MapChart.d.ts +132 -0
- package/es-modules/Core/Chart/MapChart.js +232 -0
- package/es-modules/Core/Chart/StockChart.d.ts +117 -0
- package/es-modules/Core/Chart/StockChart.js +641 -0
- package/es-modules/Core/Color/Color.d.ts +112 -0
- package/es-modules/Core/Color/Color.js +418 -0
- package/es-modules/Core/Color/Palettes.d.ts +84 -0
- package/es-modules/Core/Color/Palettes.js +23 -0
- package/es-modules/Core/Defaults.d.ts +42 -0
- package/es-modules/Core/Defaults.js +2977 -0
- package/es-modules/Core/Foundation.d.ts +19 -0
- package/es-modules/Core/Foundation.js +63 -0
- package/es-modules/Core/Geometry/CircleUtilities.d.ts +189 -0
- package/es-modules/Core/Geometry/CircleUtilities.js +388 -0
- package/es-modules/Core/Geometry/GeometryUtilities.d.ts +48 -0
- package/es-modules/Core/Geometry/GeometryUtilities.js +105 -0
- package/es-modules/Core/Geometry/PolygonClip.d.ts +19 -0
- package/es-modules/Core/Geometry/PolygonClip.js +96 -0
- package/es-modules/Core/Globals.d.ts +110 -0
- package/es-modules/Core/Globals.js +127 -0
- package/es-modules/Core/HttpUtilities.d.ts +61 -0
- package/es-modules/Core/HttpUtilities.js +214 -0
- package/es-modules/Core/MSPointer.d.ts +74 -0
- package/es-modules/Core/MSPointer.js +218 -0
- package/es-modules/Core/Math3D.d.ts +117 -0
- package/es-modules/Core/Math3D.js +250 -0
- package/es-modules/Core/Pointer.d.ts +590 -0
- package/es-modules/Core/Pointer.js +1631 -0
- package/es-modules/Core/Renderer/HTML/AST.d.ts +163 -0
- package/es-modules/Core/Renderer/HTML/AST.js +562 -0
- package/es-modules/Core/Renderer/HTML/HTMLElement.d.ts +76 -0
- package/es-modules/Core/Renderer/HTML/HTMLElement.js +471 -0
- package/es-modules/Core/Renderer/RendererRegistry.d.ts +29 -0
- package/es-modules/Core/Renderer/RendererRegistry.js +76 -0
- package/es-modules/Core/Renderer/RendererUtilities.d.ts +26 -0
- package/es-modules/Core/Renderer/RendererUtilities.js +172 -0
- package/es-modules/Core/Responsive.d.ts +55 -0
- package/es-modules/Core/Responsive.js +260 -0
- package/es-modules/Core/Templating.d.ts +125 -0
- package/es-modules/Core/Templating.js +428 -0
- package/es-modules/Core/Time.d.ts +69 -0
- package/es-modules/Core/Time.js +172 -0
- package/es-modules/Core/Tooltip.d.ts +297 -0
- package/es-modules/Core/Tooltip.js +1377 -0
- package/es-modules/Core/Utilities.d.ts +770 -0
- package/es-modules/Core/Utilities.js +1989 -0
- package/es-modules/Data/ColumnUtils.d.ts +87 -0
- package/es-modules/Data/ColumnUtils.js +140 -0
- package/es-modules/Data/Connectors/CSVConnector.d.ts +63 -0
- package/es-modules/Data/Connectors/CSVConnector.js +149 -0
- package/es-modules/Data/Connectors/CSVConnectorOptions.d.ts +149 -0
- package/es-modules/Data/Connectors/DataConnector.d.ts +204 -0
- package/es-modules/Data/Connectors/DataConnector.js +345 -0
- package/es-modules/Data/Connectors/DataConnectorOptions.d.ts +87 -0
- package/es-modules/Data/Connectors/DataConnectorType.d.ts +45 -0
- package/es-modules/Data/Connectors/GoogleSheetsConnector.d.ts +65 -0
- package/es-modules/Data/Connectors/GoogleSheetsConnector.js +226 -0
- package/es-modules/Data/Connectors/GoogleSheetsConnectorOptions.d.ts +167 -0
- package/es-modules/Data/Connectors/HTMLTableConnector.d.ts +77 -0
- package/es-modules/Data/Connectors/HTMLTableConnector.js +119 -0
- package/es-modules/Data/Connectors/HTMLTableConnectorOptions.d.ts +49 -0
- package/es-modules/Data/Connectors/JSONConnector.d.ts +64 -0
- package/es-modules/Data/Connectors/JSONConnector.js +156 -0
- package/es-modules/Data/Connectors/JSONConnectorOptions.d.ts +185 -0
- package/es-modules/Data/Converters/CSVConverter.d.ts +64 -0
- package/es-modules/Data/Converters/CSVConverter.js +374 -0
- package/es-modules/Data/Converters/CSVConverterOptions.d.ts +53 -0
- package/es-modules/Data/Converters/DataConverter.d.ts +168 -0
- package/es-modules/Data/Converters/DataConverter.js +387 -0
- package/es-modules/Data/Converters/DataConverterType.d.ts +40 -0
- package/es-modules/Data/Converters/DataConverterUtils.d.ts +82 -0
- package/es-modules/Data/Converters/DataConverterUtils.js +216 -0
- package/es-modules/Data/Converters/GoogleSheetsConverter.d.ts +46 -0
- package/es-modules/Data/Converters/GoogleSheetsConverter.js +135 -0
- package/es-modules/Data/Converters/GoogleSheetsConverterOptions.d.ts +52 -0
- package/es-modules/Data/Converters/HTMLTableConverter.d.ts +72 -0
- package/es-modules/Data/Converters/HTMLTableConverter.js +362 -0
- package/es-modules/Data/Converters/HTMLTableConverterOptions.d.ts +51 -0
- package/es-modules/Data/Converters/JSONConverter.d.ts +99 -0
- package/es-modules/Data/Converters/JSONConverter.js +239 -0
- package/es-modules/Data/Converters/JSONConverterOptions.d.ts +52 -0
- package/es-modules/Data/DataCursor.d.ts +176 -0
- package/es-modules/Data/DataCursor.js +379 -0
- package/es-modules/Data/DataEvent.d.ts +81 -0
- package/es-modules/Data/DataEvent.js +14 -0
- package/es-modules/Data/DataPool.d.ts +130 -0
- package/es-modules/Data/DataPool.js +257 -0
- package/es-modules/Data/DataPoolOptions.d.ts +66 -0
- package/es-modules/Data/DataTable.d.ts +563 -0
- package/es-modules/Data/DataTable.js +930 -0
- package/es-modules/Data/DataTableCore.d.ts +165 -0
- package/es-modules/Data/DataTableCore.js +316 -0
- package/es-modules/Data/DataTableOptions.d.ts +25 -0
- package/es-modules/Data/DataTableOptions.js +15 -0
- package/es-modules/Data/Formula/Formula.d.ts +21 -0
- package/es-modules/Data/Formula/Formula.js +54 -0
- package/es-modules/Data/Formula/FormulaParser.d.ts +31 -0
- package/es-modules/Data/Formula/FormulaParser.js +488 -0
- package/es-modules/Data/Formula/FormulaProcessor.d.ts +155 -0
- package/es-modules/Data/Formula/FormulaProcessor.js +529 -0
- package/es-modules/Data/Formula/FormulaTypes.d.ts +138 -0
- package/es-modules/Data/Formula/FormulaTypes.js +135 -0
- package/es-modules/Data/Formula/Functions/ABS.d.ts +19 -0
- package/es-modules/Data/Formula/Functions/ABS.js +67 -0
- package/es-modules/Data/Formula/Functions/AND.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/AND.js +59 -0
- package/es-modules/Data/Formula/Functions/AVERAGE.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/AVERAGE.js +74 -0
- package/es-modules/Data/Formula/Functions/AVERAGEA.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/AVERAGEA.js +90 -0
- package/es-modules/Data/Formula/Functions/COUNT.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/COUNT.js +65 -0
- package/es-modules/Data/Formula/Functions/COUNTA.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/COUNTA.js +71 -0
- package/es-modules/Data/Formula/Functions/IF.d.ts +21 -0
- package/es-modules/Data/Formula/Functions/IF.js +54 -0
- package/es-modules/Data/Formula/Functions/ISNA.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/ISNA.js +52 -0
- package/es-modules/Data/Formula/Functions/MAX.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/MAX.js +69 -0
- package/es-modules/Data/Formula/Functions/MEDIAN.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/MEDIAN.js +78 -0
- package/es-modules/Data/Formula/Functions/MIN.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/MIN.js +69 -0
- package/es-modules/Data/Formula/Functions/MOD.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/MOD.js +63 -0
- package/es-modules/Data/Formula/Functions/MODE.d.ts +41 -0
- package/es-modules/Data/Formula/Functions/MODE.js +149 -0
- package/es-modules/Data/Formula/Functions/NOT.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/NOT.js +60 -0
- package/es-modules/Data/Formula/Functions/OR.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/OR.js +62 -0
- package/es-modules/Data/Formula/Functions/PRODUCT.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/PRODUCT.js +68 -0
- package/es-modules/Data/Formula/Functions/SUM.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/SUM.js +65 -0
- package/es-modules/Data/Formula/Functions/XOR.d.ts +20 -0
- package/es-modules/Data/Formula/Functions/XOR.js +81 -0
- package/es-modules/Data/Modifiers/ChainModifier.d.ts +128 -0
- package/es-modules/Data/Modifiers/ChainModifier.js +231 -0
- package/es-modules/Data/Modifiers/ChainModifierOptions.d.ts +20 -0
- package/es-modules/Data/Modifiers/ChainModifierOptions.js +14 -0
- package/es-modules/Data/Modifiers/DataModifier.d.ts +117 -0
- package/es-modules/Data/Modifiers/DataModifier.js +202 -0
- package/es-modules/Data/Modifiers/DataModifierEvent.d.ts +28 -0
- package/es-modules/Data/Modifiers/DataModifierEvent.js +15 -0
- package/es-modules/Data/Modifiers/DataModifierOptions.d.ts +11 -0
- package/es-modules/Data/Modifiers/DataModifierOptions.js +15 -0
- package/es-modules/Data/Modifiers/DataModifierType.d.ts +44 -0
- package/es-modules/Data/Modifiers/FilterModifier.d.ts +53 -0
- package/es-modules/Data/Modifiers/FilterModifier.js +172 -0
- package/es-modules/Data/Modifiers/FilterModifierOptions.d.ts +110 -0
- package/es-modules/Data/Modifiers/FilterModifierOptions.js +14 -0
- package/es-modules/Data/Modifiers/InvertModifier.d.ts +48 -0
- package/es-modules/Data/Modifiers/InvertModifier.js +116 -0
- package/es-modules/Data/Modifiers/InvertModifierOptions.d.ts +11 -0
- package/es-modules/Data/Modifiers/InvertModifierOptions.js +15 -0
- package/es-modules/Data/Modifiers/MathModifier.d.ts +68 -0
- package/es-modules/Data/Modifiers/MathModifier.js +165 -0
- package/es-modules/Data/Modifiers/MathModifierOptions.d.ts +50 -0
- package/es-modules/Data/Modifiers/MathModifierOptions.js +14 -0
- package/es-modules/Data/Modifiers/RangeModifier.d.ts +46 -0
- package/es-modules/Data/Modifiers/RangeModifier.js +96 -0
- package/es-modules/Data/Modifiers/RangeModifierOptions.d.ts +22 -0
- package/es-modules/Data/Modifiers/RangeModifierOptions.js +15 -0
- package/es-modules/Data/Modifiers/SortModifier.d.ts +54 -0
- package/es-modules/Data/Modifiers/SortModifier.js +144 -0
- package/es-modules/Data/Modifiers/SortModifierOptions.d.ts +44 -0
- package/es-modules/Data/Modifiers/SortModifierOptions.js +14 -0
- package/es-modules/Grid/Core/Accessibility/A11yOptions.d.ts +148 -0
- package/es-modules/Grid/Core/Accessibility/A11yOptions.js +17 -0
- package/es-modules/Grid/Core/Accessibility/Accessibility.d.ts +115 -0
- package/es-modules/Grid/Core/Accessibility/Accessibility.js +231 -0
- package/es-modules/Grid/Core/Credits.d.ts +57 -0
- package/es-modules/Grid/Core/Credits.js +125 -0
- package/es-modules/Grid/Core/Defaults.d.ts +20 -0
- package/es-modules/Grid/Core/Defaults.js +148 -0
- package/es-modules/Grid/Core/Globals.d.ts +103 -0
- package/es-modules/Grid/Core/Globals.js +134 -0
- package/es-modules/Grid/Core/Grid.d.ts +295 -0
- package/es-modules/Grid/Core/Grid.js +730 -0
- package/es-modules/Grid/Core/GridUtils.d.ts +110 -0
- package/es-modules/Grid/Core/GridUtils.js +191 -0
- package/es-modules/Grid/Core/Options.d.ts +599 -0
- package/es-modules/Grid/Core/Options.js +16 -0
- package/es-modules/Grid/Core/Pagination/Icons.d.ts +7 -0
- package/es-modules/Grid/Core/Pagination/Icons.js +7 -0
- package/es-modules/Grid/Core/Pagination/Pagination.d.ts +278 -0
- package/es-modules/Grid/Core/Pagination/Pagination.js +842 -0
- package/es-modules/Grid/Core/Pagination/PaginationOptions.d.ts +228 -0
- package/es-modules/Grid/Core/Querying/FilteringController.d.ts +66 -0
- package/es-modules/Grid/Core/Querying/FilteringController.js +256 -0
- package/es-modules/Grid/Core/Querying/PaginationController.d.ts +50 -0
- package/es-modules/Grid/Core/Querying/PaginationController.js +101 -0
- package/es-modules/Grid/Core/Querying/QueryingController.d.ts +58 -0
- package/es-modules/Grid/Core/Querying/QueryingController.js +127 -0
- package/es-modules/Grid/Core/Querying/SortingController.d.ts +67 -0
- package/es-modules/Grid/Core/Querying/SortingController.js +136 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/ColumnFiltering.d.ts +114 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/ColumnFiltering.js +351 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterCell.d.ts +14 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterCell.js +86 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterRow.d.ts +19 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterRow.js +80 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilteringTypes.d.ts +52 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilteringTypes.js +81 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnSorting.d.ts +56 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnSorting.js +170 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnsResizer.d.ts +55 -0
- package/es-modules/Grid/Core/Table/Actions/ColumnsResizer.js +182 -0
- package/es-modules/Grid/Core/Table/Actions/RowsVirtualizer.d.ts +87 -0
- package/es-modules/Grid/Core/Table/Actions/RowsVirtualizer.js +346 -0
- package/es-modules/Grid/Core/Table/Body/TableCell.d.ts +88 -0
- package/es-modules/Grid/Core/Table/Body/TableCell.js +231 -0
- package/es-modules/Grid/Core/Table/Body/TableRow.d.ts +79 -0
- package/es-modules/Grid/Core/Table/Body/TableRow.js +177 -0
- package/es-modules/Grid/Core/Table/Cell.d.ts +92 -0
- package/es-modules/Grid/Core/Table/Cell.js +223 -0
- package/es-modules/Grid/Core/Table/CellContent/CellContent.d.ts +30 -0
- package/es-modules/Grid/Core/Table/CellContent/CellContent.js +40 -0
- package/es-modules/Grid/Core/Table/CellContent/TextContent.d.ts +19 -0
- package/es-modules/Grid/Core/Table/CellContent/TextContent.js +98 -0
- package/es-modules/Grid/Core/Table/Column.d.ts +136 -0
- package/es-modules/Grid/Core/Table/Column.js +230 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/AdjacentResizingMode.d.ts +7 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/AdjacentResizingMode.js +62 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/ColumnResizing.d.ts +32 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/ColumnResizing.js +68 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/DistributedResizingMode.d.ts +7 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/DistributedResizingMode.js +53 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/IndependentResizingMode.d.ts +7 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/IndependentResizingMode.js +63 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/ResizingMode.d.ts +92 -0
- package/es-modules/Grid/Core/Table/ColumnResizing/ResizingMode.js +194 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ColumnToolbar.d.ts +68 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ColumnToolbar.js +187 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/FilterPopup.d.ts +29 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/FilterPopup.js +77 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/FilterMenuButton.d.ts +13 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/FilterMenuButton.js +79 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/SortMenuButton.d.ts +12 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/SortMenuButton.js +71 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuPopup.d.ts +12 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuPopup.js +66 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/StateHelpers.d.ts +25 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/StateHelpers.js +65 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/FilterToolbarButton.d.ts +12 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/FilterToolbarButton.js +81 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/MenuToolbarButton.d.ts +12 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/MenuToolbarButton.js +80 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/SortToolbarButton.d.ts +11 -0
- package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/SortToolbarButton.js +81 -0
- package/es-modules/Grid/Core/Table/Header/HeaderCell.d.ts +70 -0
- package/es-modules/Grid/Core/Table/Header/HeaderCell.js +225 -0
- package/es-modules/Grid/Core/Table/Header/HeaderRow.d.ts +53 -0
- package/es-modules/Grid/Core/Table/Header/HeaderRow.js +182 -0
- package/es-modules/Grid/Core/Table/Header/TableHeader.d.ts +65 -0
- package/es-modules/Grid/Core/Table/Header/TableHeader.js +159 -0
- package/es-modules/Grid/Core/Table/Row.d.ts +76 -0
- package/es-modules/Grid/Core/Table/Row.js +131 -0
- package/es-modules/Grid/Core/Table/Table.d.ts +181 -0
- package/es-modules/Grid/Core/Table/Table.js +399 -0
- package/es-modules/Grid/Core/UI/Button.d.ts +31 -0
- package/es-modules/Grid/Core/UI/Button.js +16 -0
- package/es-modules/Grid/Core/UI/ContextMenu.d.ts +38 -0
- package/es-modules/Grid/Core/UI/ContextMenu.js +132 -0
- package/es-modules/Grid/Core/UI/ContextMenuButton.d.ts +126 -0
- package/es-modules/Grid/Core/UI/ContextMenuButton.js +183 -0
- package/es-modules/Grid/Core/UI/Popup.d.ts +149 -0
- package/es-modules/Grid/Core/UI/Popup.js +271 -0
- package/es-modules/Grid/Core/UI/SvgIcons.d.ts +53 -0
- package/es-modules/Grid/Core/UI/SvgIcons.js +158 -0
- package/es-modules/Grid/Core/UI/Toolbar.d.ts +16 -0
- package/es-modules/Grid/Core/UI/Toolbar.js +16 -0
- package/es-modules/Grid/Core/UI/ToolbarButton.d.ts +135 -0
- package/es-modules/Grid/Core/UI/ToolbarButton.js +191 -0
- package/es-modules/Grid/Pro/CellEditing/CellEditMode.d.ts +112 -0
- package/es-modules/Grid/Pro/CellEditing/CellEditing.d.ts +80 -0
- package/es-modules/Grid/Pro/CellEditing/CellEditing.js +211 -0
- package/es-modules/Grid/Pro/CellEditing/CellEditingComposition.d.ts +123 -0
- package/es-modules/Grid/Pro/CellEditing/CellEditingComposition.js +198 -0
- package/es-modules/Grid/Pro/CellRendering/CellContentPro.d.ts +23 -0
- package/es-modules/Grid/Pro/CellRendering/CellContentPro.js +45 -0
- package/es-modules/Grid/Pro/CellRendering/CellRenderer.d.ts +50 -0
- package/es-modules/Grid/Pro/CellRendering/CellRenderer.js +41 -0
- package/es-modules/Grid/Pro/CellRendering/CellRendererRegistry.d.ts +18 -0
- package/es-modules/Grid/Pro/CellRendering/CellRendererRegistry.js +58 -0
- package/es-modules/Grid/Pro/CellRendering/CellRendererType.d.ts +48 -0
- package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.d.ts +18 -0
- package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.js +79 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/CheckboxContent.d.ts +30 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/CheckboxContent.js +122 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContent.d.ts +12 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContent.js +39 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContentBase.d.ts +66 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContentBase.js +145 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateTimeInputContent.d.ts +12 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateTimeInputContent.js +38 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/NumberInputContent.d.ts +58 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/NumberInputContent.js +158 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/SelectContent.d.ts +58 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/SelectContent.js +173 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.d.ts +28 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.js +157 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/TextInputContent.d.ts +58 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/TextInputContent.js +168 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/TimeInputContent.d.ts +13 -0
- package/es-modules/Grid/Pro/CellRendering/ContentTypes/TimeInputContent.js +41 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/CheckboxRenderer.d.ts +50 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/CheckboxRenderer.js +65 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRenderer.d.ts +37 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRenderer.js +65 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRendererBase.d.ts +26 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRendererBase.js +16 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateTimeInputRenderer.d.ts +37 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/DateTimeInputRenderer.js +64 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/NumberInputRenderer.d.ts +52 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/NumberInputRenderer.js +64 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/SelectRenderer.d.ts +74 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/SelectRenderer.js +66 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.d.ts +45 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.js +89 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextInputRenderer.d.ts +54 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextInputRenderer.js +65 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextRenderer.d.ts +43 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/TextRenderer.js +74 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/TimeInputRenderer.d.ts +37 -0
- package/es-modules/Grid/Pro/CellRendering/Renderers/TimeInputRenderer.js +64 -0
- package/es-modules/Grid/Pro/ColumnTypes/ColumnDataType.d.ts +29 -0
- package/es-modules/Grid/Pro/ColumnTypes/Validator.d.ts +118 -0
- package/es-modules/Grid/Pro/ColumnTypes/Validator.js +270 -0
- package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.d.ts +32 -0
- package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.js +63 -0
- package/es-modules/Grid/Pro/Credits/CreditsPro.d.ts +35 -0
- package/es-modules/Grid/Pro/Credits/CreditsPro.js +112 -0
- package/es-modules/Grid/Pro/Credits/CreditsProComposition.d.ts +28 -0
- package/es-modules/Grid/Pro/Credits/CreditsProComposition.js +61 -0
- package/es-modules/Grid/Pro/Export/Exporting.d.ts +68 -0
- package/es-modules/Grid/Pro/Export/Exporting.js +202 -0
- package/es-modules/Grid/Pro/Export/ExportingComposition.d.ts +68 -0
- package/es-modules/Grid/Pro/Export/ExportingComposition.js +55 -0
- package/es-modules/Grid/Pro/GridEvents.d.ts +119 -0
- package/es-modules/Grid/Pro/GridEvents.js +107 -0
- package/es-modules/Grid/Pro/Pagination/PaginationComposition.d.ts +75 -0
- package/es-modules/Grid/Pro/Pagination/PaginationComposition.js +76 -0
- package/es-modules/Grid/Pro/highcharts.d.ts +7 -0
- package/es-modules/Grid/index.d.ts +5 -0
- package/es-modules/Grid/index.js +19 -0
- package/es-modules/Shared/BaseForm.d.ts +49 -0
- package/es-modules/Shared/BaseForm.js +126 -0
- package/es-modules/Shared/DownloadURL.d.ts +85 -0
- package/es-modules/Shared/DownloadURL.js +198 -0
- package/es-modules/Shared/LangOptionsCore.d.ts +27 -0
- package/es-modules/Shared/TimeBase.d.ts +353 -0
- package/es-modules/Shared/TimeBase.js +830 -0
- package/es-modules/Shared/Types.d.ts +48 -0
- package/es-modules/masters/grid-pro.src.d.ts +99 -0
- package/es-modules/masters/grid-pro.src.js +129 -0
- package/grid-pro.d.ts +50 -0
- package/grid-pro.js +12 -0
- package/grid-pro.js.map +1 -0
- package/grid-pro.src.d.ts +50 -0
- package/grid-pro.src.js +26623 -0
- package/package.json +21 -0
|
@@ -0,0 +1,842 @@
|
|
|
1
|
+
/* *
|
|
2
|
+
*
|
|
3
|
+
* Grid Pagination class
|
|
4
|
+
*
|
|
5
|
+
* (c) 2020-2025 Highsoft AS
|
|
6
|
+
*
|
|
7
|
+
* License: www.highcharts.com/license
|
|
8
|
+
*
|
|
9
|
+
* !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
|
|
10
|
+
*
|
|
11
|
+
* Authors:
|
|
12
|
+
* - Sebastian Bochan
|
|
13
|
+
*
|
|
14
|
+
* */
|
|
15
|
+
'use strict';
|
|
16
|
+
import Icons from './Icons.js';
|
|
17
|
+
import Defaults from '../Defaults.js';
|
|
18
|
+
import Globals from '../Globals.js';
|
|
19
|
+
import GridUtils from '../GridUtils.js';
|
|
20
|
+
import Utilities from '../../../Core/Utilities.js';
|
|
21
|
+
import AST from '../../../Core/Renderer/HTML/AST.js';
|
|
22
|
+
const { makeHTMLElement, formatText } = GridUtils;
|
|
23
|
+
const { merge, fireEvent, isObject, defined } = Utilities;
|
|
24
|
+
/**
|
|
25
|
+
* Representing the pagination functionalities for the Grid.
|
|
26
|
+
*/
|
|
27
|
+
class Pagination {
|
|
28
|
+
/* *
|
|
29
|
+
*
|
|
30
|
+
* Constructor
|
|
31
|
+
*
|
|
32
|
+
* */
|
|
33
|
+
/**
|
|
34
|
+
* Construct the pagination object.
|
|
35
|
+
*
|
|
36
|
+
* @param grid
|
|
37
|
+
* The Grid Table instance which the pagination controller belongs to.
|
|
38
|
+
*
|
|
39
|
+
* @param options
|
|
40
|
+
* The Pagination user options.
|
|
41
|
+
*
|
|
42
|
+
* @param state
|
|
43
|
+
* The Pagination state. Used to restore the previous state after the Grid
|
|
44
|
+
* is destroyed.
|
|
45
|
+
*/
|
|
46
|
+
constructor(grid, options, state = {}) {
|
|
47
|
+
/**
|
|
48
|
+
* Current page number, starting from 1.
|
|
49
|
+
*/
|
|
50
|
+
this.currentPage = 1;
|
|
51
|
+
this.grid = grid;
|
|
52
|
+
this.options = merge(Pagination.defaultOptions, options);
|
|
53
|
+
const pageSizeSelector = this.options.controls.pageSizeSelector;
|
|
54
|
+
this.pageSizeOptions = isObject(pageSizeSelector) ?
|
|
55
|
+
pageSizeSelector.options :
|
|
56
|
+
Pagination.defaultOptions.controls.pageSizeSelector.options; // eslint-disable-line
|
|
57
|
+
this.currentPageSize =
|
|
58
|
+
state.currentPageSize ||
|
|
59
|
+
this.options.pageSize ||
|
|
60
|
+
this.pageSizeOptions[0];
|
|
61
|
+
// Lang pack
|
|
62
|
+
this.lang = merge(Defaults.defaultOptions.pagination, this.grid.options?.lang?.pagination);
|
|
63
|
+
// Set state
|
|
64
|
+
if (state.currentPage) {
|
|
65
|
+
this.currentPage = state.currentPage;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/* *
|
|
69
|
+
*
|
|
70
|
+
* Methods
|
|
71
|
+
*
|
|
72
|
+
* */
|
|
73
|
+
/**
|
|
74
|
+
* Total number of items (rows)
|
|
75
|
+
*/
|
|
76
|
+
get totalItems() {
|
|
77
|
+
return this.grid.querying.pagination.totalItems || 0;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Total number of pages
|
|
81
|
+
*/
|
|
82
|
+
get totalPages() {
|
|
83
|
+
return Math.ceil(this.totalItems / this.currentPageSize) || 1;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Render the pagination container.
|
|
87
|
+
*
|
|
88
|
+
* The pagination container is positioned based on the `position` option:
|
|
89
|
+
* - `'top'`: Rendered before the table
|
|
90
|
+
* - `'bottom'`: Rendered after the table (default)
|
|
91
|
+
* - `'footer'`: Rendered inside a tfoot element
|
|
92
|
+
* - `'#id'` or any string: Rendered inside a custom container with
|
|
93
|
+
* the specified ID.
|
|
94
|
+
*/
|
|
95
|
+
render() {
|
|
96
|
+
const position = this.options.position;
|
|
97
|
+
const grid = this.grid;
|
|
98
|
+
this.oldTotalItems = this.totalItems;
|
|
99
|
+
// Set row count for a11y
|
|
100
|
+
grid.tableElement?.setAttribute('aria-current', 'page');
|
|
101
|
+
this.updateA11yRowsCount(this.currentPageSize);
|
|
102
|
+
// Render pagination container
|
|
103
|
+
if (typeof position === 'string' && position.startsWith('#')) {
|
|
104
|
+
this.renderCustomContainer(position);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
if (position === 'footer') {
|
|
108
|
+
this.renderFooter();
|
|
109
|
+
}
|
|
110
|
+
this.contentWrapper = makeHTMLElement('nav', {
|
|
111
|
+
className: Globals.getClassName('paginationWrapper')
|
|
112
|
+
}, position === 'footer' ?
|
|
113
|
+
this.paginationContainer : grid.contentWrapper);
|
|
114
|
+
this.contentWrapper.setAttribute('aria-label', 'Results pagination');
|
|
115
|
+
}
|
|
116
|
+
// Clamps the current page to the valid range
|
|
117
|
+
this.clampCurrentPage();
|
|
118
|
+
// Render all components
|
|
119
|
+
this.renderPageInfo();
|
|
120
|
+
this.renderControls();
|
|
121
|
+
this.renderPageSizeSelector();
|
|
122
|
+
// Update button states after rendering
|
|
123
|
+
this.updateButtonStates();
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Render pagination in a tfoot element.
|
|
127
|
+
*/
|
|
128
|
+
renderFooter() {
|
|
129
|
+
const tableElement = this.grid.tableElement;
|
|
130
|
+
if (!tableElement) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
// Create tfoot element
|
|
134
|
+
const tfootElement = makeHTMLElement('tfoot', {}, tableElement);
|
|
135
|
+
// Create tfoot row
|
|
136
|
+
const tfootRow = makeHTMLElement('tr', {}, tfootElement);
|
|
137
|
+
// Create tfoot cell with colspan and store it in paginationContainer
|
|
138
|
+
this.paginationContainer = makeHTMLElement('td', {}, tfootRow);
|
|
139
|
+
this.paginationContainer.setAttribute('colSpan', (this.grid.enabledColumns || []).length.toString());
|
|
140
|
+
this.reflow();
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Render pagination in a custom container by ID.
|
|
144
|
+
*
|
|
145
|
+
* @param id
|
|
146
|
+
* The ID of the custom container.
|
|
147
|
+
*/
|
|
148
|
+
renderCustomContainer(id) {
|
|
149
|
+
const customContainer = document.querySelector(id);
|
|
150
|
+
if (!customContainer) {
|
|
151
|
+
console.warn(`Pagination: Custom container with ID "${id}" not found.`); // eslint-disable-line no-console
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
this.paginationContainer = customContainer;
|
|
155
|
+
// Set content wrapper to the custom container
|
|
156
|
+
this.contentWrapper = makeHTMLElement('div', {
|
|
157
|
+
className: Globals.getClassName('paginationContainer')
|
|
158
|
+
}, customContainer);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Render the page information text.
|
|
162
|
+
*/
|
|
163
|
+
renderPageInfo() {
|
|
164
|
+
const pageInfo = this.options.controls?.pageInfo;
|
|
165
|
+
if (pageInfo === false ||
|
|
166
|
+
(isObject(pageInfo) && pageInfo.enabled === false)) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
this.pageInfoElement = makeHTMLElement('div', {
|
|
170
|
+
className: Globals.getClassName('paginationPageInfo')
|
|
171
|
+
}, this.contentWrapper);
|
|
172
|
+
this.updatePageInfo();
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Update the page information text.
|
|
176
|
+
*/
|
|
177
|
+
updatePageInfo() {
|
|
178
|
+
if (!this.pageInfoElement) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const startItem = (this.currentPage - 1) * this.currentPageSize + 1;
|
|
182
|
+
const endItem = Math.min(this.currentPage * this.currentPageSize, this.totalItems);
|
|
183
|
+
const pageInfoText = formatText(this.lang.pageInfo, {
|
|
184
|
+
start: startItem,
|
|
185
|
+
end: endItem,
|
|
186
|
+
total: this.totalItems,
|
|
187
|
+
currentPage: this.currentPage,
|
|
188
|
+
totalPages: this.totalPages
|
|
189
|
+
});
|
|
190
|
+
this.pageInfoElement.innerHTML = pageInfoText;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Render the controls buttons and page numbers.
|
|
194
|
+
*/
|
|
195
|
+
renderControls() {
|
|
196
|
+
const navContainer = makeHTMLElement('div', {
|
|
197
|
+
className: Globals.getClassName('paginationControls')
|
|
198
|
+
}, this.contentWrapper);
|
|
199
|
+
// Render first/previous buttons
|
|
200
|
+
if (this.options.controls?.firstLastButtons) {
|
|
201
|
+
this.renderFirstButton(navContainer);
|
|
202
|
+
}
|
|
203
|
+
// Render previous button
|
|
204
|
+
if (this.options.controls?.previousNextButtons) {
|
|
205
|
+
this.renderPrevButton(navContainer);
|
|
206
|
+
}
|
|
207
|
+
// Render page numbers
|
|
208
|
+
if (this.options.controls?.pageButtons) {
|
|
209
|
+
this.renderPageNumbers(navContainer);
|
|
210
|
+
}
|
|
211
|
+
// Render mobile page selector
|
|
212
|
+
this.renderMobilePageSelector(navContainer);
|
|
213
|
+
// Render next button
|
|
214
|
+
if (this.options.controls?.previousNextButtons) {
|
|
215
|
+
this.renderNextButton(navContainer);
|
|
216
|
+
}
|
|
217
|
+
// Render last/first buttons
|
|
218
|
+
if (this.options.controls?.firstLastButtons) {
|
|
219
|
+
this.renderLastButton(navContainer);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Update the pagination controls.
|
|
224
|
+
*/
|
|
225
|
+
updateControls() {
|
|
226
|
+
if (this.oldTotalItems === this.totalItems) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
this.updatePageInfo();
|
|
230
|
+
this.updatePageNumbers();
|
|
231
|
+
this.updateButtonStates();
|
|
232
|
+
this.updateA11yRowsCount(this.currentPageSize);
|
|
233
|
+
this.oldTotalItems = this.totalItems;
|
|
234
|
+
}
|
|
235
|
+
/**
|
|
236
|
+
* Render the first page button.
|
|
237
|
+
*
|
|
238
|
+
* @param container
|
|
239
|
+
* The container element for the first page button.
|
|
240
|
+
*
|
|
241
|
+
*/
|
|
242
|
+
renderFirstButton(container) {
|
|
243
|
+
const firstLastButtons = this.options.controls?.firstLastButtons;
|
|
244
|
+
if (firstLastButtons === false ||
|
|
245
|
+
(isObject(firstLastButtons) && firstLastButtons.enabled === false)) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
// Create first button
|
|
249
|
+
this.firstButton = makeHTMLElement('button', {
|
|
250
|
+
innerHTML: Icons.first,
|
|
251
|
+
className: Globals.getClassName('paginationButton') + ' ' +
|
|
252
|
+
Globals.getClassName('paginationFirstButton')
|
|
253
|
+
}, container);
|
|
254
|
+
this.firstButton.title = this.lang.firstPage;
|
|
255
|
+
// Set aria-label for a11y
|
|
256
|
+
this.firstButton.setAttribute('aria-label', this.lang.firstPage);
|
|
257
|
+
// Add click event
|
|
258
|
+
this.firstButton.addEventListener('click', () => {
|
|
259
|
+
void this.goToPage(1);
|
|
260
|
+
});
|
|
261
|
+
this.setButtonState(this.firstButton, this.currentPage === 1);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Render the previous page button.
|
|
265
|
+
*
|
|
266
|
+
* @param container
|
|
267
|
+
* The container element for the previous page button.
|
|
268
|
+
*/
|
|
269
|
+
renderPrevButton(container) {
|
|
270
|
+
const previousNextButtons = this.options.controls?.previousNextButtons;
|
|
271
|
+
if (previousNextButtons === false ||
|
|
272
|
+
(isObject(previousNextButtons) &&
|
|
273
|
+
previousNextButtons.enabled === false)) {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
// Create previous button
|
|
277
|
+
this.prevButton = makeHTMLElement('button', {
|
|
278
|
+
innerHTML: Icons.previous,
|
|
279
|
+
className: Globals.getClassName('paginationButton') + ' ' +
|
|
280
|
+
Globals.getClassName('paginationPrevButton')
|
|
281
|
+
}, container);
|
|
282
|
+
this.prevButton.title = this.lang.previousPage;
|
|
283
|
+
// Set aria-label for a11y
|
|
284
|
+
this.prevButton.setAttribute('aria-label', this.lang.previousPage);
|
|
285
|
+
// Add click event
|
|
286
|
+
this.prevButton.addEventListener('click', () => {
|
|
287
|
+
void this.goToPage(this.currentPage - 1);
|
|
288
|
+
});
|
|
289
|
+
this.setButtonState(this.prevButton, this.currentPage === 1);
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Render the next page button.
|
|
293
|
+
*
|
|
294
|
+
* @param container
|
|
295
|
+
* The container element for the next page button.
|
|
296
|
+
*/
|
|
297
|
+
renderNextButton(container) {
|
|
298
|
+
const previousNextButtons = this.options.controls?.previousNextButtons;
|
|
299
|
+
if (previousNextButtons === false ||
|
|
300
|
+
(isObject(previousNextButtons) &&
|
|
301
|
+
previousNextButtons.enabled === false)) {
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
// Create next button
|
|
305
|
+
this.nextButton = makeHTMLElement('button', {
|
|
306
|
+
innerHTML: Icons.next,
|
|
307
|
+
className: Globals.getClassName('paginationButton') + ' ' +
|
|
308
|
+
Globals.getClassName('paginationNextButton')
|
|
309
|
+
}, container);
|
|
310
|
+
this.nextButton.title = this.lang.nextPage;
|
|
311
|
+
// Set aria-label for a11y
|
|
312
|
+
this.nextButton.setAttribute('aria-label', this.lang.nextPage);
|
|
313
|
+
// Add click event
|
|
314
|
+
this.nextButton.addEventListener('click', () => {
|
|
315
|
+
void this.goToPage(this.currentPage + 1);
|
|
316
|
+
});
|
|
317
|
+
this.setButtonState(this.nextButton, this.currentPage >= this.totalPages);
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Render the last page button.
|
|
321
|
+
*
|
|
322
|
+
* @param container
|
|
323
|
+
* The container element for the last page button.
|
|
324
|
+
*/
|
|
325
|
+
renderLastButton(container) {
|
|
326
|
+
const firstLastButtons = this.options.controls?.firstLastButtons;
|
|
327
|
+
if (firstLastButtons === false ||
|
|
328
|
+
(isObject(firstLastButtons) && firstLastButtons.enabled === false)) {
|
|
329
|
+
return;
|
|
330
|
+
}
|
|
331
|
+
// Create last button
|
|
332
|
+
this.lastButton = makeHTMLElement('button', {
|
|
333
|
+
innerHTML: Icons.last,
|
|
334
|
+
className: Globals.getClassName('paginationButton') + ' ' +
|
|
335
|
+
Globals.getClassName('paginationLastButton')
|
|
336
|
+
}, container);
|
|
337
|
+
this.lastButton.title = this.lang.lastPage;
|
|
338
|
+
// Set aria-label for a11y
|
|
339
|
+
this.lastButton.setAttribute('aria-label', this.lang.lastPage);
|
|
340
|
+
// Add click event
|
|
341
|
+
this.lastButton.addEventListener('click', () => {
|
|
342
|
+
void this.goToPage(this.totalPages);
|
|
343
|
+
});
|
|
344
|
+
this.setButtonState(this.lastButton, this.currentPage >= this.totalPages);
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Render page number buttons with ellipsis.
|
|
348
|
+
*
|
|
349
|
+
* @param container
|
|
350
|
+
* The container element for the page number buttons.
|
|
351
|
+
*/
|
|
352
|
+
renderPageNumbers(container) {
|
|
353
|
+
const pageButtons = this.options.controls?.pageButtons;
|
|
354
|
+
if (pageButtons === false ||
|
|
355
|
+
(isObject(pageButtons) && pageButtons.enabled === false)) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
this.pageNumbersContainer = makeHTMLElement('div', {
|
|
359
|
+
className: Globals.getClassName('paginationPageButton')
|
|
360
|
+
}, container);
|
|
361
|
+
this.updatePageNumbers();
|
|
362
|
+
}
|
|
363
|
+
/**
|
|
364
|
+
* Update page number buttons based on current page and total pages.
|
|
365
|
+
*/
|
|
366
|
+
updatePageNumbers() {
|
|
367
|
+
if (!this.pageNumbersContainer) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
// Clear existing page numbers
|
|
371
|
+
this.pageNumbersContainer.innerHTML = AST.emptyHTML;
|
|
372
|
+
const pageButtons = this.options.controls?.pageButtons;
|
|
373
|
+
const maxPageNumbers = isObject(pageButtons) ?
|
|
374
|
+
pageButtons.count :
|
|
375
|
+
Pagination.defaultOptions.controls.pageButtons.count; // eslint-disable-line
|
|
376
|
+
const totalPages = this.totalPages;
|
|
377
|
+
const currentPage = this.currentPage;
|
|
378
|
+
if (totalPages <= maxPageNumbers) {
|
|
379
|
+
// Show all page numbers if total pages is less than max
|
|
380
|
+
for (let i = 1; i <= totalPages; i++) {
|
|
381
|
+
this.createPageButton(i, i === currentPage);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
const elements = [];
|
|
386
|
+
// Determine layout based on current page position
|
|
387
|
+
const isNearStart = currentPage <= 3;
|
|
388
|
+
const isNearEnd = currentPage >= totalPages - 2;
|
|
389
|
+
if (isNearStart) {
|
|
390
|
+
// -2 for ellipsis and last page
|
|
391
|
+
const pagesToShow = maxPageNumbers - 2;
|
|
392
|
+
const maxPages = Math.min(pagesToShow, totalPages - 1);
|
|
393
|
+
for (let i = 1; i <= maxPages; i++) {
|
|
394
|
+
elements.push({ type: 'button', page: i });
|
|
395
|
+
}
|
|
396
|
+
if (totalPages > pagesToShow + 1) {
|
|
397
|
+
elements.push({ type: 'ellipsis' });
|
|
398
|
+
elements.push({ type: 'button', page: totalPages });
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
else if (isNearEnd) {
|
|
402
|
+
// -2 for first page and ellipsis
|
|
403
|
+
const pagesToShow = maxPageNumbers - 2;
|
|
404
|
+
let i = totalPages - pagesToShow + 1;
|
|
405
|
+
elements.push({ type: 'button', page: 1 });
|
|
406
|
+
elements.push({ type: 'ellipsis' });
|
|
407
|
+
for (i; i <= totalPages; i++) {
|
|
408
|
+
elements.push({ type: 'button', page: i });
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
// Always add first page
|
|
413
|
+
elements.push({ type: 'button', page: 1 });
|
|
414
|
+
// -4 for first, last, and two ellipsis
|
|
415
|
+
const maxMiddlePages = maxPageNumbers - 4;
|
|
416
|
+
const halfMiddle = Math.floor(maxMiddlePages / 2);
|
|
417
|
+
let startPage = Math.max(2, currentPage - halfMiddle);
|
|
418
|
+
let endPage = Math.min(totalPages - 1, currentPage + halfMiddle);
|
|
419
|
+
// Adjust to ensure we have exactly maxMiddlePages
|
|
420
|
+
if (endPage - startPage + 1 > maxMiddlePages) {
|
|
421
|
+
if (startPage === 2) {
|
|
422
|
+
endPage = startPage + maxMiddlePages - 1;
|
|
423
|
+
}
|
|
424
|
+
else {
|
|
425
|
+
startPage = endPage - maxMiddlePages + 1;
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
// Check if we actually need ellipsis
|
|
429
|
+
const needFirstEllipsis = startPage > 2;
|
|
430
|
+
const needLastEllipsis = endPage < totalPages - 1;
|
|
431
|
+
if (!needFirstEllipsis && !needLastEllipsis) {
|
|
432
|
+
// -2 for first and last
|
|
433
|
+
const availableSlots = maxPageNumbers - 2;
|
|
434
|
+
startPage = 2;
|
|
435
|
+
endPage = Math.min(totalPages - 1, startPage + availableSlots - 1);
|
|
436
|
+
}
|
|
437
|
+
else if (!needFirstEllipsis) {
|
|
438
|
+
// -3 for first, last, and one ellipsis
|
|
439
|
+
const availableSlots = maxPageNumbers - 3;
|
|
440
|
+
startPage = 2;
|
|
441
|
+
endPage = Math.min(totalPages - 1, startPage + availableSlots - 1);
|
|
442
|
+
}
|
|
443
|
+
else if (!needLastEllipsis) {
|
|
444
|
+
// -3 for first, last, and one ellipsis
|
|
445
|
+
const availableSlots = maxPageNumbers - 3;
|
|
446
|
+
endPage = totalPages - 1;
|
|
447
|
+
startPage = Math.max(2, endPage - availableSlots + 1);
|
|
448
|
+
}
|
|
449
|
+
// Add first ellipsis
|
|
450
|
+
if (needFirstEllipsis) {
|
|
451
|
+
elements.push({ type: 'ellipsis' });
|
|
452
|
+
}
|
|
453
|
+
// Add middle pages
|
|
454
|
+
for (let i = startPage; i <= endPage; i++) {
|
|
455
|
+
elements.push({ type: 'button', page: i });
|
|
456
|
+
}
|
|
457
|
+
// Add last ellipsis
|
|
458
|
+
if (needLastEllipsis) {
|
|
459
|
+
elements.push({ type: 'ellipsis' });
|
|
460
|
+
}
|
|
461
|
+
// Always add last page
|
|
462
|
+
elements.push({ type: 'button', page: totalPages });
|
|
463
|
+
}
|
|
464
|
+
// Render all elements
|
|
465
|
+
elements.forEach((element) => {
|
|
466
|
+
if (element.type === 'button' && defined(element.page)) {
|
|
467
|
+
this.createPageButton(element.page, element.page === currentPage);
|
|
468
|
+
}
|
|
469
|
+
else if (element.type === 'ellipsis') {
|
|
470
|
+
this.createEllipsis();
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
// Update mobile selector if it exists
|
|
475
|
+
if (this.mobilePageSelector) {
|
|
476
|
+
this.mobilePageSelector.value = this.currentPage.toString();
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* Create a page number button.
|
|
481
|
+
*
|
|
482
|
+
* @param pageNumber
|
|
483
|
+
* The page number to create a button for.
|
|
484
|
+
*
|
|
485
|
+
* @param isActive
|
|
486
|
+
* Whether the page number button is active.
|
|
487
|
+
*/
|
|
488
|
+
createPageButton(pageNumber, isActive) {
|
|
489
|
+
if (!this.pageNumbersContainer) {
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
const button = makeHTMLElement('button', {
|
|
493
|
+
innerHTML: pageNumber.toString(),
|
|
494
|
+
className: Globals.getClassName(isActive ? 'paginationPageButtonActive' : 'paginationPageButton')
|
|
495
|
+
}, this.pageNumbersContainer);
|
|
496
|
+
button.title = formatText(this.lang.pageNumber, { page: pageNumber });
|
|
497
|
+
// Set aria-label for a11y
|
|
498
|
+
button.setAttribute('aria-label', formatText(this.lang.pageNumber, { page: pageNumber }));
|
|
499
|
+
// Add click event
|
|
500
|
+
button.addEventListener('click', () => {
|
|
501
|
+
void this.goToPage(pageNumber);
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Create an ellipsis element.
|
|
506
|
+
*/
|
|
507
|
+
createEllipsis() {
|
|
508
|
+
if (!this.pageNumbersContainer) {
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
const ellipsisElement = makeHTMLElement('span', {
|
|
512
|
+
innerHTML: '...',
|
|
513
|
+
className: Globals.getClassName('paginationEllipsis')
|
|
514
|
+
}, this.pageNumbersContainer);
|
|
515
|
+
ellipsisElement.title = this.lang.ellipsis;
|
|
516
|
+
// Set aria-label for a11y
|
|
517
|
+
ellipsisElement.setAttribute('aria-hidden', true);
|
|
518
|
+
}
|
|
519
|
+
/**
|
|
520
|
+
* Render the page size selector.
|
|
521
|
+
*/
|
|
522
|
+
renderPageSizeSelector() {
|
|
523
|
+
const pageSizeSelector = this.options.controls.pageSizeSelector;
|
|
524
|
+
if (pageSizeSelector === false ||
|
|
525
|
+
(isObject(pageSizeSelector) &&
|
|
526
|
+
pageSizeSelector.enabled === false)) {
|
|
527
|
+
return;
|
|
528
|
+
}
|
|
529
|
+
const container = makeHTMLElement('div', {
|
|
530
|
+
className: Globals.getClassName('paginationPageSizeContainer')
|
|
531
|
+
}, this.contentWrapper);
|
|
532
|
+
makeHTMLElement('span', {
|
|
533
|
+
innerHTML: this.lang.pageSizeLabel
|
|
534
|
+
}, container);
|
|
535
|
+
this.pageSizeSelect = makeHTMLElement('select', {
|
|
536
|
+
className: Globals.getClassName('paginationPageSizeSelect')
|
|
537
|
+
}, container);
|
|
538
|
+
this.pageSizeOptions.forEach((option) => {
|
|
539
|
+
const optionElement = document.createElement('option');
|
|
540
|
+
optionElement.value = option.toString();
|
|
541
|
+
optionElement.innerHTML = option.toString();
|
|
542
|
+
if (option === this.currentPageSize) {
|
|
543
|
+
optionElement.selected = true;
|
|
544
|
+
}
|
|
545
|
+
this.pageSizeSelect?.appendChild(optionElement);
|
|
546
|
+
});
|
|
547
|
+
this.pageSizeSelect.addEventListener('change', () => {
|
|
548
|
+
if (!this.pageSizeSelect) {
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
void this.setPageSize(parseInt(this.pageSizeSelect.value, 10));
|
|
552
|
+
});
|
|
553
|
+
// Render mobile page size selector in the same container
|
|
554
|
+
this.renderMobilePageSizeSelector(container);
|
|
555
|
+
}
|
|
556
|
+
/**
|
|
557
|
+
* Set the page size and recalculate pagination.
|
|
558
|
+
*
|
|
559
|
+
* @param newPageSize
|
|
560
|
+
* The new page size to set.
|
|
561
|
+
*/
|
|
562
|
+
async setPageSize(newPageSize) {
|
|
563
|
+
const pageSize = this.currentPageSize;
|
|
564
|
+
const langAccessibility = this.grid.options?.lang?.accessibility;
|
|
565
|
+
fireEvent(this, 'beforePageSizeChange', {
|
|
566
|
+
pageSize: pageSize,
|
|
567
|
+
newPageSize: newPageSize
|
|
568
|
+
});
|
|
569
|
+
this.currentPageSize = newPageSize;
|
|
570
|
+
// Reset to first page when changing page size
|
|
571
|
+
this.currentPage = 1;
|
|
572
|
+
// Update the grid's pagination range
|
|
573
|
+
await this.updateGridPagination();
|
|
574
|
+
// Update UI
|
|
575
|
+
this.updatePageInfo();
|
|
576
|
+
this.updatePageNumbers();
|
|
577
|
+
this.updateButtonStates();
|
|
578
|
+
// Update row count for a11y
|
|
579
|
+
this.updateA11yRowsCount(this.currentPageSize);
|
|
580
|
+
// Announce the page size change
|
|
581
|
+
this.grid.accessibility?.announce(langAccessibility?.pagination?.announcements?.pageSizeChange +
|
|
582
|
+
' ' + newPageSize);
|
|
583
|
+
// Update mobile page size selector if it exists
|
|
584
|
+
if (this.mobilePageSizeSelector) {
|
|
585
|
+
this.mobilePageSizeSelector.value = this.currentPageSize.toString();
|
|
586
|
+
}
|
|
587
|
+
fireEvent(this, 'afterPageSizeChange', {
|
|
588
|
+
pageSize: newPageSize,
|
|
589
|
+
previousPageSize: pageSize
|
|
590
|
+
});
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Navigate to a specific page.
|
|
594
|
+
*
|
|
595
|
+
* @param pageNumber
|
|
596
|
+
* The page number to navigate to.
|
|
597
|
+
*/
|
|
598
|
+
async goToPage(pageNumber) {
|
|
599
|
+
const langAccessibility = this.grid.options?.lang?.accessibility;
|
|
600
|
+
if (pageNumber < 1 ||
|
|
601
|
+
pageNumber > this.totalPages ||
|
|
602
|
+
pageNumber === this.currentPage) {
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
const previousPage = this.currentPage;
|
|
606
|
+
fireEvent(this, 'beforePageChange', {
|
|
607
|
+
currentPage: this.currentPage,
|
|
608
|
+
nextPage: pageNumber,
|
|
609
|
+
pageSize: this.currentPageSize
|
|
610
|
+
});
|
|
611
|
+
this.currentPage = pageNumber;
|
|
612
|
+
await this.updateGridPagination();
|
|
613
|
+
this.updatePageInfo();
|
|
614
|
+
this.updatePageNumbers();
|
|
615
|
+
this.updateButtonStates();
|
|
616
|
+
// Announce the page change
|
|
617
|
+
this.grid.accessibility?.announce(langAccessibility?.pagination?.announcements?.pageChange +
|
|
618
|
+
' ' + this.currentPage);
|
|
619
|
+
fireEvent(this, 'afterPageChange', {
|
|
620
|
+
currentPage: this.currentPage,
|
|
621
|
+
previousPage: previousPage,
|
|
622
|
+
pageSize: this.currentPageSize
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
/**
|
|
626
|
+
* Update the grid's pagination state.
|
|
627
|
+
*
|
|
628
|
+
* @param ignoreDataRange
|
|
629
|
+
* Whether to ignore the data range update. Used when updating the data
|
|
630
|
+
* range is not needed, for example when updating the data range from
|
|
631
|
+
* the server.
|
|
632
|
+
* @internal
|
|
633
|
+
*/
|
|
634
|
+
async updateGridPagination(ignoreDataRange = false) {
|
|
635
|
+
if (!this.grid.querying?.pagination) {
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
this.grid.querying.pagination.setRange(ignoreDataRange ? 1 : this.currentPage);
|
|
639
|
+
// Trigger the grid to update its data and viewport
|
|
640
|
+
this.grid.querying.shouldBeUpdated = true;
|
|
641
|
+
// Force the querying controller to proceed with updates
|
|
642
|
+
await this.grid.querying.proceed(true);
|
|
643
|
+
// Update the viewport to reflect the new data
|
|
644
|
+
await this.grid.viewport?.updateRows();
|
|
645
|
+
this.grid.viewport?.header?.reflow();
|
|
646
|
+
// Scroll to top after page change
|
|
647
|
+
const tBody = this.grid.viewport?.tbodyElement;
|
|
648
|
+
if (tBody) {
|
|
649
|
+
tBody.scrollTop = 0;
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Ensures the current page is within valid range.
|
|
654
|
+
*/
|
|
655
|
+
clampCurrentPage() {
|
|
656
|
+
if (this.currentPage > this.totalPages) {
|
|
657
|
+
this.currentPage = this.totalPages;
|
|
658
|
+
this.grid.querying.pagination.setRange(this.currentPage);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
/**
|
|
662
|
+
* Update button states based on current page.
|
|
663
|
+
*/
|
|
664
|
+
updateButtonStates() {
|
|
665
|
+
if (this.firstButton) {
|
|
666
|
+
this.setButtonState(this.firstButton, this.currentPage === 1);
|
|
667
|
+
}
|
|
668
|
+
if (this.prevButton) {
|
|
669
|
+
this.setButtonState(this.prevButton, this.currentPage === 1);
|
|
670
|
+
}
|
|
671
|
+
if (this.nextButton) {
|
|
672
|
+
this.setButtonState(this.nextButton, this.currentPage >= this.totalPages);
|
|
673
|
+
}
|
|
674
|
+
if (this.lastButton) {
|
|
675
|
+
this.setButtonState(this.lastButton, this.currentPage >= this.totalPages);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
/**
|
|
679
|
+
* Call modifier to replace items with new ones.
|
|
680
|
+
*
|
|
681
|
+
* @param isNextPage
|
|
682
|
+
* Declare prev or next action triggered by button.
|
|
683
|
+
* @returns
|
|
684
|
+
*/
|
|
685
|
+
async updatePage(isNextPage = true) {
|
|
686
|
+
const newPage = isNextPage ? this.currentPage + 1 : this.currentPage - 1;
|
|
687
|
+
await this.goToPage(newPage);
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Set button state (enabled/disabled).
|
|
691
|
+
*
|
|
692
|
+
* @param button
|
|
693
|
+
* The button to set the state for.
|
|
694
|
+
*
|
|
695
|
+
* @param disabled
|
|
696
|
+
* Whether the button should be disabled.
|
|
697
|
+
*/
|
|
698
|
+
setButtonState(button, disabled) {
|
|
699
|
+
if (disabled) {
|
|
700
|
+
button.classList.add(Globals.getClassName('paginationButtonDisabled'));
|
|
701
|
+
button.setAttribute('disabled', 'disabled');
|
|
702
|
+
}
|
|
703
|
+
else {
|
|
704
|
+
button.classList.remove(Globals.getClassName('paginationButtonDisabled'));
|
|
705
|
+
button.removeAttribute('disabled');
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Reflow the pagination container.
|
|
710
|
+
*/
|
|
711
|
+
reflow() {
|
|
712
|
+
const position = this.options.position;
|
|
713
|
+
if (!this.paginationContainer) {
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
716
|
+
if (position === 'footer') {
|
|
717
|
+
// Set the width to match the table width
|
|
718
|
+
this.paginationContainer.style.width =
|
|
719
|
+
this.grid.tableElement?.offsetWidth + 'px';
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Destroy the pagination instance.
|
|
725
|
+
*/
|
|
726
|
+
destroy() {
|
|
727
|
+
const position = this.options.position;
|
|
728
|
+
if (position === 'footer') {
|
|
729
|
+
// For footer position, remove the entire tfoot element.
|
|
730
|
+
this.paginationContainer?.parentElement?.parentElement?.remove();
|
|
731
|
+
}
|
|
732
|
+
else {
|
|
733
|
+
this.contentWrapper?.remove();
|
|
734
|
+
}
|
|
735
|
+
this.grid.querying.pagination.reset();
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* Render the mobile page selector (select dropdown).
|
|
739
|
+
*
|
|
740
|
+
* @param container
|
|
741
|
+
* The container element for the mobile page selector.
|
|
742
|
+
*/
|
|
743
|
+
renderMobilePageSelector(container) {
|
|
744
|
+
const totalPages = this.totalPages;
|
|
745
|
+
if (totalPages <= 1) {
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
const mobileSelect = makeHTMLElement('select', {
|
|
749
|
+
className: Globals.getClassName('paginationMobileSelector')
|
|
750
|
+
}, container);
|
|
751
|
+
// Add options for each page
|
|
752
|
+
for (let i = 1; i <= totalPages; i++) {
|
|
753
|
+
const option = makeHTMLElement('option', {}, mobileSelect);
|
|
754
|
+
option.value = i.toString();
|
|
755
|
+
option.textContent = `Page ${i} of ${totalPages}`;
|
|
756
|
+
}
|
|
757
|
+
// Set current page as selected
|
|
758
|
+
mobileSelect.value = this.currentPage.toString();
|
|
759
|
+
this.mobilePageSelector = mobileSelect;
|
|
760
|
+
// Add event listener for page change
|
|
761
|
+
mobileSelect.addEventListener('change', () => {
|
|
762
|
+
const newPage = parseInt(mobileSelect.value, 10);
|
|
763
|
+
if (newPage !== this.currentPage) {
|
|
764
|
+
void this.goToPage(newPage);
|
|
765
|
+
}
|
|
766
|
+
});
|
|
767
|
+
}
|
|
768
|
+
/**
|
|
769
|
+
* Render the mobile page size selector (select dropdown).
|
|
770
|
+
*
|
|
771
|
+
* @param container
|
|
772
|
+
* The container element for the mobile page size selector.
|
|
773
|
+
*/
|
|
774
|
+
renderMobilePageSizeSelector(container) {
|
|
775
|
+
const mobilePageSizeSelect = makeHTMLElement('select', {
|
|
776
|
+
className: Globals.getClassName('paginationMobilePageSizeSelector')
|
|
777
|
+
}, container);
|
|
778
|
+
this.pageSizeOptions.forEach((option) => {
|
|
779
|
+
const optionElement = makeHTMLElement('option', {}, mobilePageSizeSelect);
|
|
780
|
+
optionElement.value = option.toString();
|
|
781
|
+
optionElement.textContent = `${option} ${this.lang.pageSizeLabel}`;
|
|
782
|
+
if (option === this.currentPageSize) {
|
|
783
|
+
optionElement.selected = true;
|
|
784
|
+
}
|
|
785
|
+
});
|
|
786
|
+
this.mobilePageSizeSelector = mobilePageSizeSelect;
|
|
787
|
+
mobilePageSizeSelect.addEventListener('change', () => {
|
|
788
|
+
if (!this.mobilePageSizeSelector) {
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
void this.setPageSize(parseInt(this.mobilePageSizeSelector.value, 10));
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Update the row count for a11y.
|
|
796
|
+
*
|
|
797
|
+
* @param currentPageSize
|
|
798
|
+
* The current page size.
|
|
799
|
+
*/
|
|
800
|
+
updateA11yRowsCount(currentPageSize) {
|
|
801
|
+
const grid = this.grid;
|
|
802
|
+
grid.tableElement?.setAttribute('aria-rowcount', currentPageSize || this.totalItems);
|
|
803
|
+
}
|
|
804
|
+
}
|
|
805
|
+
/* *
|
|
806
|
+
*
|
|
807
|
+
* Static Properties
|
|
808
|
+
*
|
|
809
|
+
* */
|
|
810
|
+
/**
|
|
811
|
+
* Default options of the pagination.
|
|
812
|
+
*/
|
|
813
|
+
Pagination.defaultOptions = {
|
|
814
|
+
enabled: false,
|
|
815
|
+
pageSize: 10,
|
|
816
|
+
position: 'bottom',
|
|
817
|
+
controls: {
|
|
818
|
+
pageSizeSelector: {
|
|
819
|
+
enabled: true,
|
|
820
|
+
options: [10, 20, 50, 100]
|
|
821
|
+
},
|
|
822
|
+
pageInfo: {
|
|
823
|
+
enabled: true
|
|
824
|
+
},
|
|
825
|
+
firstLastButtons: {
|
|
826
|
+
enabled: true
|
|
827
|
+
},
|
|
828
|
+
previousNextButtons: {
|
|
829
|
+
enabled: true
|
|
830
|
+
},
|
|
831
|
+
pageButtons: {
|
|
832
|
+
enabled: true,
|
|
833
|
+
count: 7
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
};
|
|
837
|
+
/* *
|
|
838
|
+
*
|
|
839
|
+
* Default Export
|
|
840
|
+
*
|
|
841
|
+
* */
|
|
842
|
+
export default Pagination;
|