@highcharts/grid-pro 2.2.0 → 2.3.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.
Files changed (266) hide show
  1. package/LICENSE.txt +6 -0
  2. package/README.md +15 -9
  3. package/css/grid-pro.css +1262 -1122
  4. package/css/modules/grid-base-variables.css +131 -0
  5. package/css/modules/grid-button-variables.css +140 -0
  6. package/css/modules/grid-caption-variables.css +11 -0
  7. package/css/modules/grid-description-variables.css +11 -0
  8. package/css/modules/grid-input-variables.css +114 -0
  9. package/css/modules/grid-link-variables.css +18 -0
  10. package/css/modules/grid-menu-variables.css +50 -0
  11. package/css/modules/grid-pagination-variables.css +12 -0
  12. package/css/modules/grid-popup-variables.css +24 -0
  13. package/css/modules/grid-pro.css +234 -0
  14. package/css/modules/grid-table-variables.css +385 -0
  15. package/css/modules/grid-theme-default.css +55 -0
  16. package/es-modules/Accessibility/A11yI18n.js +1 -2
  17. package/es-modules/Accessibility/Accessibility.js +1 -2
  18. package/es-modules/Accessibility/AccessibilityComponent.d.ts +2 -2
  19. package/es-modules/Accessibility/Components/InfoRegionsComponent.js +5 -6
  20. package/es-modules/Accessibility/Components/LegendComponent.js +1 -2
  21. package/es-modules/Accessibility/Components/MenuComponent.js +1 -2
  22. package/es-modules/Accessibility/Components/NavigatorComponent.js +3 -4
  23. package/es-modules/Accessibility/Components/RangeSelectorComponent.js +1 -2
  24. package/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.js +1 -2
  25. package/es-modules/Accessibility/Components/SeriesComponent/NewDataAnnouncer.js +3 -4
  26. package/es-modules/Accessibility/Components/SeriesComponent/SeriesDescriber.js +3 -4
  27. package/es-modules/Accessibility/Components/SeriesComponent/SeriesKeyboardNavigation.js +1 -2
  28. package/es-modules/Accessibility/Components/ZoomComponent.js +1 -2
  29. package/es-modules/Accessibility/FocusBorder.js +1 -2
  30. package/es-modules/Accessibility/KeyboardNavigation.js +1 -2
  31. package/es-modules/Accessibility/KeyboardNavigationHandler.js +1 -2
  32. package/es-modules/Accessibility/Options/A11yDefaults.d.ts +11 -0
  33. package/es-modules/Accessibility/Options/A11yDefaults.js +11 -0
  34. package/es-modules/Accessibility/Options/DeprecatedOptions.d.ts +58 -0
  35. package/es-modules/Accessibility/Options/DeprecatedOptions.js +7 -2
  36. package/es-modules/Accessibility/Options/LangDefaults.js +9 -0
  37. package/es-modules/Accessibility/ProxyElement.js +2 -5
  38. package/es-modules/Accessibility/ProxyProvider.js +1 -2
  39. package/es-modules/Accessibility/Utils/Announcer.js +2 -3
  40. package/es-modules/Accessibility/Utils/ChartUtilities.js +1 -2
  41. package/es-modules/Accessibility/Utils/EventProvider.d.ts +2 -2
  42. package/es-modules/Accessibility/Utils/EventProvider.js +6 -2
  43. package/es-modules/Accessibility/Utils/HTMLUtilities.js +1 -2
  44. package/es-modules/Core/Animation/AnimationUtilities.js +1 -2
  45. package/es-modules/Core/Animation/Fx.js +1 -2
  46. package/es-modules/Core/Callback.d.ts +9 -2
  47. package/es-modules/Core/Chart/Chart.js +48 -41
  48. package/es-modules/Core/Chart/Chart3D.js +1 -2
  49. package/es-modules/Core/Chart/ChartDefaults.js +11 -0
  50. package/es-modules/Core/Chart/ChartOptions.d.ts +8 -0
  51. package/es-modules/Core/Chart/GanttChart.js +1 -2
  52. package/es-modules/Core/Chart/MapChart.js +1 -2
  53. package/es-modules/Core/Chart/StockChart.js +2 -3
  54. package/es-modules/Core/Color/Color.js +1 -2
  55. package/es-modules/Core/Defaults.js +36 -9
  56. package/es-modules/Core/Delaunay.d.ts +52 -0
  57. package/es-modules/Core/Delaunay.js +310 -0
  58. package/es-modules/Core/Foundation.js +1 -2
  59. package/es-modules/Core/Geometry/CircleUtilities.js +1 -2
  60. package/es-modules/Core/Globals.js +1 -1
  61. package/es-modules/Core/HttpUtilities.js +1 -2
  62. package/es-modules/Core/MSPointer.js +1 -2
  63. package/es-modules/Core/Math3D.js +1 -2
  64. package/es-modules/Core/Options.d.ts +6 -2
  65. package/es-modules/Core/Pointer.js +23 -4
  66. package/es-modules/Core/PointerEvent.d.ts +2 -0
  67. package/es-modules/Core/Renderer/HTML/AST.js +2 -2
  68. package/es-modules/Core/Renderer/HTML/HTMLElement.js +1 -2
  69. package/es-modules/Core/Renderer/RendererUtilities.js +34 -19
  70. package/es-modules/Core/Responsive.d.ts +4 -2
  71. package/es-modules/Core/Responsive.js +10 -4
  72. package/es-modules/Core/Templating.d.ts +1 -1
  73. package/es-modules/Core/Templating.js +3 -4
  74. package/es-modules/Core/Time.d.ts +8 -0
  75. package/es-modules/Core/Time.js +2 -2
  76. package/es-modules/Core/Tooltip.d.ts +4 -8
  77. package/es-modules/Core/Tooltip.js +100 -81
  78. package/es-modules/Core/TooltipOptions.d.ts +44 -1
  79. package/es-modules/Core/Utilities.d.ts +25 -665
  80. package/es-modules/Core/Utilities.js +17 -1398
  81. package/es-modules/Data/ColumnUtils.d.ts +83 -80
  82. package/es-modules/Data/ColumnUtils.js +103 -113
  83. package/es-modules/Data/Connectors/CSVConnector.d.ts +9 -14
  84. package/es-modules/Data/Connectors/CSVConnector.js +3 -4
  85. package/es-modules/Data/Connectors/DataConnector.d.ts +52 -54
  86. package/es-modules/Data/Connectors/DataConnector.js +33 -52
  87. package/es-modules/Data/Connectors/GoogleSheetsConnector.d.ts +40 -42
  88. package/es-modules/Data/Connectors/GoogleSheetsConnector.js +73 -88
  89. package/es-modules/Data/Connectors/GoogleSheetsConnectorOptions.d.ts +4 -2
  90. package/es-modules/Data/Connectors/HTMLTableConnector.d.ts +23 -28
  91. package/es-modules/Data/Connectors/HTMLTableConnector.js +3 -4
  92. package/es-modules/Data/Connectors/JSONConnector.d.ts +9 -14
  93. package/es-modules/Data/Connectors/JSONConnector.js +3 -4
  94. package/es-modules/Data/Converters/CSVConverter.d.ts +5 -5
  95. package/es-modules/Data/Converters/CSVConverter.js +3 -4
  96. package/es-modules/Data/Converters/CSVConverterOptions.d.ts +2 -2
  97. package/es-modules/Data/Converters/DataConverter.d.ts +76 -78
  98. package/es-modules/Data/Converters/DataConverter.js +26 -53
  99. package/es-modules/Data/Converters/DataConverterUtils.d.ts +88 -81
  100. package/es-modules/Data/Converters/DataConverterUtils.js +169 -181
  101. package/es-modules/Data/Converters/GoogleSheetsConverter.d.ts +4 -4
  102. package/es-modules/Data/Converters/GoogleSheetsConverter.js +3 -3
  103. package/es-modules/Data/Converters/GoogleSheetsConverterOptions.d.ts +2 -2
  104. package/es-modules/Data/Converters/HTMLTableConverter.d.ts +4 -4
  105. package/es-modules/Data/Converters/HTMLTableConverter.js +2 -3
  106. package/es-modules/Data/Converters/HTMLTableConverterOptions.d.ts +2 -2
  107. package/es-modules/Data/Converters/JSONConverter.d.ts +7 -7
  108. package/es-modules/Data/Converters/JSONConverter.js +6 -6
  109. package/es-modules/Data/Converters/JSONConverterOptions.d.ts +2 -2
  110. package/es-modules/Data/DataCursor.d.ts +65 -70
  111. package/es-modules/Data/DataCursor.js +119 -139
  112. package/es-modules/Data/DataEvent.d.ts +55 -57
  113. package/es-modules/Data/DataPool.d.ts +10 -17
  114. package/es-modules/Data/DataPool.js +20 -9
  115. package/es-modules/Data/DataTable.d.ts +111 -113
  116. package/es-modules/Data/DataTable.js +3 -3
  117. package/es-modules/Data/DataTableCore.d.ts +9 -9
  118. package/es-modules/Data/DataTableCore.js +2 -2
  119. package/es-modules/Data/Formula/FormulaParser.js +1 -2
  120. package/es-modules/Data/Formula/FormulaProcessor.js +1 -2
  121. package/es-modules/Data/Modifiers/ChainModifier.d.ts +29 -34
  122. package/es-modules/Data/Modifiers/ChainModifier.js +7 -8
  123. package/es-modules/Data/Modifiers/DataModifier.d.ts +36 -41
  124. package/es-modules/Data/Modifiers/DataModifier.js +31 -53
  125. package/es-modules/Data/Modifiers/FilterModifier.d.ts +4 -4
  126. package/es-modules/Data/Modifiers/FilterModifier.js +3 -4
  127. package/es-modules/Data/Modifiers/FilterModifierOptions.d.ts +3 -2
  128. package/es-modules/Data/Modifiers/InvertModifier.d.ts +4 -4
  129. package/es-modules/Data/Modifiers/InvertModifier.js +3 -4
  130. package/es-modules/Data/Modifiers/MathModifier.d.ts +5 -4
  131. package/es-modules/Data/Modifiers/RangeModifier.d.ts +4 -4
  132. package/es-modules/Data/Modifiers/RangeModifier.js +3 -4
  133. package/es-modules/Data/Modifiers/SortModifier.d.ts +6 -11
  134. package/es-modules/Data/Modifiers/SortModifier.js +3 -4
  135. package/es-modules/Data/Modifiers/SortModifierOptions.d.ts +3 -3
  136. package/es-modules/Grid/Core/Accessibility/Accessibility.d.ts +1 -1
  137. package/es-modules/Grid/Core/Accessibility/Accessibility.js +5 -6
  138. package/es-modules/Grid/Core/Data/DataProvider.d.ts +97 -0
  139. package/es-modules/Grid/Core/Data/DataProvider.js +89 -0
  140. package/es-modules/Grid/Core/Data/DataProviderRegistry.d.ts +20 -0
  141. package/es-modules/Grid/Core/Data/DataProviderRegistry.js +52 -0
  142. package/es-modules/Grid/Core/Data/DataProviderType.d.ts +19 -0
  143. package/es-modules/Grid/Core/Data/DataProviderType.js +15 -0
  144. package/es-modules/Grid/Core/Data/LocalDataProvider.d.ts +165 -0
  145. package/es-modules/Grid/Core/Data/LocalDataProvider.js +341 -0
  146. package/es-modules/Grid/Core/Defaults.js +4 -2
  147. package/es-modules/Grid/Core/Globals.d.ts +20 -16
  148. package/es-modules/Grid/Core/Globals.js +10 -8
  149. package/es-modules/Grid/Core/Grid.d.ts +31 -22
  150. package/es-modules/Grid/Core/Grid.js +214 -136
  151. package/es-modules/Grid/Core/GridUtils.d.ts +33 -0
  152. package/es-modules/Grid/Core/GridUtils.js +50 -3
  153. package/es-modules/Grid/Core/Options.d.ts +145 -4
  154. package/es-modules/Grid/Core/Pagination/Pagination.d.ts +3 -0
  155. package/es-modules/Grid/Core/Pagination/Pagination.js +63 -23
  156. package/es-modules/Grid/Core/Pagination/PaginationOptions.d.ts +4 -0
  157. package/es-modules/Grid/Core/Querying/FilteringController.js +1 -2
  158. package/es-modules/Grid/Core/Querying/PaginationController.d.ts +2 -2
  159. package/es-modules/Grid/Core/Querying/PaginationController.js +3 -3
  160. package/es-modules/Grid/Core/Querying/QueryingController.d.ts +1 -1
  161. package/es-modules/Grid/Core/Querying/QueryingController.js +2 -26
  162. package/es-modules/Grid/Core/Responsive/ResponsiveComposition.d.ts +53 -0
  163. package/es-modules/Grid/Core/Responsive/ResponsiveComposition.js +229 -0
  164. package/es-modules/Grid/Core/Responsive/ResponsiveOptions.d.ts +58 -0
  165. package/es-modules/Grid/Core/Responsive/ResponsiveOptions.js +15 -0
  166. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/ColumnFiltering.js +2 -3
  167. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterCell.d.ts +1 -1
  168. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterCell.js +3 -4
  169. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterRow.d.ts +1 -1
  170. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterRow.js +2 -2
  171. package/es-modules/Grid/Core/Table/Actions/ColumnSorting.d.ts +17 -1
  172. package/es-modules/Grid/Core/Table/Actions/ColumnSorting.js +58 -15
  173. package/es-modules/Grid/Core/Table/Actions/ColumnsResizer.js +1 -3
  174. package/es-modules/Grid/Core/Table/Actions/RowsVirtualizer.d.ts +57 -3
  175. package/es-modules/Grid/Core/Table/Actions/RowsVirtualizer.js +397 -118
  176. package/es-modules/Grid/Core/Table/Body/CellContextMenu.d.ts +11 -0
  177. package/es-modules/Grid/Core/Table/Body/CellContextMenu.js +84 -0
  178. package/es-modules/Grid/Core/Table/Body/TableCell.d.ts +27 -13
  179. package/es-modules/Grid/Core/Table/Body/TableCell.js +74 -25
  180. package/es-modules/Grid/Core/Table/Body/TableRow.d.ts +7 -15
  181. package/es-modules/Grid/Core/Table/Body/TableRow.js +24 -19
  182. package/es-modules/Grid/Core/Table/Cell.d.ts +16 -3
  183. package/es-modules/Grid/Core/Table/Cell.js +36 -3
  184. package/es-modules/Grid/Core/Table/CellContent/TextContent.js +3 -8
  185. package/es-modules/Grid/Core/Table/Column.d.ts +10 -4
  186. package/es-modules/Grid/Core/Table/Column.js +23 -34
  187. package/es-modules/Grid/Core/Table/ColumnResizing/IndependentResizingMode.js +9 -8
  188. package/es-modules/Grid/Core/Table/ColumnResizing/ResizingMode.js +4 -3
  189. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ColumnToolbar.d.ts +5 -0
  190. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ColumnToolbar.js +7 -2
  191. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/FilterPopup.js +1 -2
  192. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/FilterMenuButton.js +1 -2
  193. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/SortMenuButton.js +2 -3
  194. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/FilterToolbarButton.js +1 -2
  195. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/MenuToolbarButton.js +1 -2
  196. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/SortToolbarButton.d.ts +0 -1
  197. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/SortToolbarButton.js +4 -14
  198. package/es-modules/Grid/Core/Table/Header/HeaderCell.d.ts +6 -1
  199. package/es-modules/Grid/Core/Table/Header/HeaderCell.js +33 -13
  200. package/es-modules/Grid/Core/Table/Header/HeaderRow.js +4 -5
  201. package/es-modules/Grid/Core/Table/Header/TableHeader.d.ts +1 -1
  202. package/es-modules/Grid/Core/Table/Header/TableHeader.js +3 -3
  203. package/es-modules/Grid/Core/Table/Row.d.ts +1 -1
  204. package/es-modules/Grid/Core/Table/Row.js +2 -2
  205. package/es-modules/Grid/Core/Table/Table.d.ts +38 -12
  206. package/es-modules/Grid/Core/Table/Table.js +184 -91
  207. package/es-modules/Grid/Core/UI/ContextMenuButton.d.ts +6 -7
  208. package/es-modules/Grid/Core/UI/ContextMenuButton.js +5 -3
  209. package/es-modules/Grid/Core/UI/Popup.js +7 -9
  210. package/es-modules/Grid/Core/UI/SvgIcons.d.ts +42 -7
  211. package/es-modules/Grid/Core/UI/SvgIcons.js +206 -33
  212. package/es-modules/Grid/Core/UI/Toolbar.d.ts +5 -0
  213. package/es-modules/Grid/Core/UI/ToolbarButton.d.ts +4 -12
  214. package/es-modules/Grid/Core/UI/ToolbarButton.js +8 -26
  215. package/es-modules/Grid/Pro/CellEditing/CellEditMode.d.ts +2 -2
  216. package/es-modules/Grid/Pro/CellEditing/CellEditing.js +10 -10
  217. package/es-modules/Grid/Pro/CellEditing/CellEditingComposition.js +1 -2
  218. package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.d.ts +1 -1
  219. package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.js +4 -2
  220. package/es-modules/Grid/Pro/CellRendering/ContentTypes/CheckboxContent.d.ts +2 -2
  221. package/es-modules/Grid/Pro/CellRendering/ContentTypes/NumberInputContent.js +1 -2
  222. package/es-modules/Grid/Pro/CellRendering/ContentTypes/SelectContent.d.ts +2 -2
  223. package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.js +1 -2
  224. package/es-modules/Grid/Pro/CellRendering/ContentTypes/TextInputContent.d.ts +2 -2
  225. package/es-modules/Grid/Pro/CellRendering/ContentTypes/TextInputContent.js +1 -2
  226. package/es-modules/Grid/Pro/CellRendering/Renderers/CheckboxRenderer.js +1 -2
  227. package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRenderer.js +1 -2
  228. package/es-modules/Grid/Pro/CellRendering/Renderers/DateTimeInputRenderer.js +1 -2
  229. package/es-modules/Grid/Pro/CellRendering/Renderers/NumberInputRenderer.js +1 -2
  230. package/es-modules/Grid/Pro/CellRendering/Renderers/SelectRenderer.js +1 -2
  231. package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.d.ts +2 -2
  232. package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.js +1 -2
  233. package/es-modules/Grid/Pro/CellRendering/Renderers/TextInputRenderer.js +1 -2
  234. package/es-modules/Grid/Pro/CellRendering/Renderers/TextRenderer.js +1 -2
  235. package/es-modules/Grid/Pro/CellRendering/Renderers/TimeInputRenderer.js +1 -2
  236. package/es-modules/Grid/Pro/ColumnTypes/Validator.js +34 -32
  237. package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.d.ts +1 -1
  238. package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.js +3 -4
  239. package/es-modules/Grid/Pro/Credits/CreditsProComposition.js +1 -3
  240. package/es-modules/Grid/Pro/Data/DataSourceHelper.d.ts +74 -0
  241. package/es-modules/Grid/Pro/Data/DataSourceHelper.js +246 -0
  242. package/es-modules/Grid/Pro/Data/QuerySerializer.d.ts +46 -0
  243. package/es-modules/Grid/Pro/Data/QuerySerializer.js +169 -0
  244. package/es-modules/Grid/Pro/Data/RemoteDataProvider.d.ts +187 -0
  245. package/es-modules/Grid/Pro/Data/RemoteDataProvider.js +500 -0
  246. package/es-modules/Grid/Pro/Export/Exporting.js +1 -2
  247. package/es-modules/Grid/Pro/Export/ExportingComposition.js +1 -2
  248. package/es-modules/Grid/Pro/GridEvents.js +1 -2
  249. package/es-modules/Grid/Pro/Pagination/PaginationComposition.d.ts +0 -1
  250. package/es-modules/Grid/Pro/Pagination/PaginationComposition.js +1 -2
  251. package/es-modules/Shared/BaseForm.js +1 -2
  252. package/es-modules/Shared/DownloadURL.js +1 -2
  253. package/es-modules/Shared/TimeBase.js +3 -3
  254. package/es-modules/Shared/Types.d.ts +7 -0
  255. package/es-modules/Shared/Utilities.d.ts +576 -0
  256. package/es-modules/Shared/Utilities.js +1368 -0
  257. package/es-modules/masters/grid-pro.src.d.ts +15 -11
  258. package/es-modules/masters/grid-pro.src.js +12 -5
  259. package/grid-pro.d.ts +15 -11
  260. package/grid-pro.js +3 -3
  261. package/grid-pro.js.map +1 -1
  262. package/grid-pro.src.d.ts +15 -11
  263. package/grid-pro.src.js +10408 -8009
  264. package/package.json +1 -1
  265. package/es-modules/Grid/Core/Pagination/Icons.d.ts +0 -7
  266. package/es-modules/Grid/Core/Pagination/Icons.js +0 -7
@@ -0,0 +1,341 @@
1
+ /* *
2
+ *
3
+ * Local Data Provider 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
+ * - Dawid Dragula
13
+ *
14
+ * */
15
+ 'use strict';
16
+ import { DataProvider } from './DataProvider.js';
17
+ import DataTable from '../../../Data/DataTable.js';
18
+ import ChainModifier from '../../../Data/Modifiers/ChainModifier.js';
19
+ import DataConnector from '../../../Data/Connectors/DataConnector.js';
20
+ import DataProviderRegistry from './DataProviderRegistry.js';
21
+ import { uniqueKey } from '../../../Core/Utilities.js';
22
+ import { defined, isNumber, isString } from '../../../Shared/Utilities.js';
23
+ /* *
24
+ *
25
+ * Class
26
+ *
27
+ * */
28
+ /**
29
+ * Local data provider for the Grid.
30
+ *
31
+ * Uses a DataTable instances to serve data to the grid, applying query
32
+ * modifiers and persisting edits locally.
33
+ */
34
+ export class LocalDataProvider extends DataProvider {
35
+ constructor() {
36
+ super(...arguments);
37
+ /**
38
+ * Unbind callbacks for DataTable events.
39
+ */
40
+ this.dataTableEventDestructors = [];
41
+ /**
42
+ * Unbind callbacks for connector events.
43
+ */
44
+ this.connectorEventDestructors = [];
45
+ }
46
+ /* *
47
+ *
48
+ * Methods
49
+ *
50
+ * */
51
+ async init() {
52
+ if (this.dataTable) {
53
+ return;
54
+ }
55
+ await this.initDataTable();
56
+ }
57
+ async initDataTable() {
58
+ this.querying.shouldBeUpdated = true;
59
+ this.clearDataTableEvents();
60
+ this.clearConnector();
61
+ if (this.options.connector) {
62
+ await this.initConnector(this.options.connector);
63
+ return;
64
+ }
65
+ let dataTable = this.options.dataTable;
66
+ if (!dataTable) {
67
+ dataTable = new DataTable({
68
+ columns: this.options.columns ?? {}
69
+ });
70
+ }
71
+ this.setDataTable(dataTable);
72
+ }
73
+ setDataTable(table) {
74
+ this.dataTable = table;
75
+ this.presentationTable = table.getModified();
76
+ this.prePaginationRowCount = this.presentationTable?.rowCount ?? 0;
77
+ for (const eventName of LocalDataProvider.tableChangeEventNames) {
78
+ const fn = table.on(eventName, (e) => {
79
+ void this.handleTableChange(e);
80
+ });
81
+ this.dataTableEventDestructors.push(fn);
82
+ }
83
+ const idColId = this.options.idColumn;
84
+ if (idColId) {
85
+ const idColumn = table.getColumn(idColId, true);
86
+ if (!idColumn) {
87
+ throw new Error(`Column "${idColId}" not found in table.`);
88
+ }
89
+ const map = new Map();
90
+ for (let i = 0, len = idColumn.length; i < len; ++i) {
91
+ const value = idColumn[i];
92
+ if (!isString(value) && !isNumber(value)) {
93
+ throw new Error('idColumn must contain only string or number values.');
94
+ }
95
+ map.set(value, i);
96
+ }
97
+ if (map.size !== idColumn.length) {
98
+ throw new Error('idColumn must contain unique values.');
99
+ }
100
+ this.originalRowIndexesMap = map;
101
+ }
102
+ }
103
+ async handleTableChange(e) {
104
+ this.querying.shouldBeUpdated = true;
105
+ const grid = this.querying.grid;
106
+ if (!grid?.viewport) {
107
+ return;
108
+ }
109
+ if (e.type === 'afterSetCell' && e.detail?.fromGrid) {
110
+ return;
111
+ }
112
+ if (this.options.updateOnChange) {
113
+ await grid.viewport.updateRows();
114
+ }
115
+ // TODO: Handle this when Polling emits proper events.
116
+ // grid.dirtyFlags.add((
117
+ // eventName === 'afterDeleteColumns' ||
118
+ // eventName === 'afterSetColumns'
119
+ // ) ? 'grid' : 'rows');
120
+ // await grid.redraw();
121
+ }
122
+ clearDataTableEvents() {
123
+ this.dataTableEventDestructors.forEach((fn) => fn());
124
+ this.dataTableEventDestructors.length = 0;
125
+ }
126
+ clearConnector() {
127
+ this.connectorEventDestructors.forEach((fn) => fn());
128
+ this.connectorEventDestructors.length = 0;
129
+ this.connector?.stopPolling();
130
+ this.connector = void 0;
131
+ }
132
+ async initConnector(connectorInput) {
133
+ let connector;
134
+ if (LocalDataProvider.isConnectorInstance(connectorInput)) {
135
+ connector = connectorInput;
136
+ }
137
+ else {
138
+ const ConnectorClass = DataConnector.types[connectorInput.type];
139
+ if (!ConnectorClass) {
140
+ throw new Error(`Connector type not found. (${connectorInput.type})`);
141
+ }
142
+ if (!connectorInput.id) {
143
+ connectorInput.id = 'connector-' + uniqueKey();
144
+ }
145
+ connector = new ConnectorClass(connectorInput);
146
+ }
147
+ this.connector = connector;
148
+ this.connectorEventDestructors.push(connector.on('afterLoad', () => {
149
+ this.querying.shouldBeUpdated = true;
150
+ }));
151
+ this.setDataTable(connector.getTable());
152
+ if ('enablePolling' in connector.options &&
153
+ connector.options.enablePolling &&
154
+ !connector.polling &&
155
+ 'dataRefreshRate' in connector.options) {
156
+ connector.startPolling(Math.max(connector.options.dataRefreshRate || 0, 1) * 1000);
157
+ }
158
+ if (!connector.loaded) {
159
+ try {
160
+ await connector.load();
161
+ }
162
+ catch {
163
+ return;
164
+ }
165
+ }
166
+ }
167
+ getColumnIds() {
168
+ return Promise.resolve(this.presentationTable?.getColumnIds() ?? []);
169
+ }
170
+ /**
171
+ * Returns the row ID for a given local row index. If not found, returns
172
+ * `undefined`.
173
+ *
174
+ * If the `data.idColumn` option is set, the row ID is the value of the
175
+ * row in the column with the given ID. Otherwise, the row ID is the
176
+ * original row index.
177
+ *
178
+ * @param rowIndex
179
+ * The local (presentation table) row index to get the row ID for.
180
+ */
181
+ async getRowId(rowIndex) {
182
+ const originalRowIndex = await this.getOriginalRowIndexFromLocal(rowIndex);
183
+ if (!defined(originalRowIndex) || !this.dataTable) {
184
+ return Promise.resolve(void 0);
185
+ }
186
+ const idColId = this.options.idColumn;
187
+ if (!idColId) {
188
+ return Promise.resolve(originalRowIndex);
189
+ }
190
+ const rawId = this.dataTable.getCell(idColId, originalRowIndex);
191
+ if (isString(rawId) || isNumber(rawId)) {
192
+ return Promise.resolve(rawId);
193
+ }
194
+ }
195
+ /**
196
+ * Returns the local (presentation table) row index for a given row ID. If
197
+ * not found, returns `undefined`.
198
+ *
199
+ * @param rowId
200
+ * The row ID to get the row index for. If the `data.idColumn` option is
201
+ * set, the row ID is the value of the row in the column with the given ID.
202
+ * Otherwise, the row ID is the original row index.
203
+ */
204
+ getRowIndex(rowId) {
205
+ if (!this.originalRowIndexesMap && isNumber(rowId)) {
206
+ return this.getLocalRowIndexFromOriginal(rowId);
207
+ }
208
+ const originalRowIndex = this.originalRowIndexesMap?.get(rowId);
209
+ if (!defined(originalRowIndex)) {
210
+ return Promise.resolve(void 0);
211
+ }
212
+ return this.getLocalRowIndexFromOriginal(originalRowIndex);
213
+ }
214
+ /**
215
+ * Returns the original row index for a given local row index.
216
+ *
217
+ * @param localRowIndex
218
+ * The local row index to get the original row index for.
219
+ */
220
+ getOriginalRowIndexFromLocal(localRowIndex) {
221
+ return Promise.resolve(this.presentationTable?.getOriginalRowIndex(localRowIndex));
222
+ }
223
+ /**
224
+ * Returns the local (presentation table) row index for a given original
225
+ * data table row index.
226
+ *
227
+ * @param originalRowIndex
228
+ * The original data table row index to get the presentation table row index
229
+ * for.
230
+ */
231
+ getLocalRowIndexFromOriginal(originalRowIndex) {
232
+ return Promise.resolve(this.presentationTable?.getLocalRowIndex(originalRowIndex));
233
+ }
234
+ getRowObject(rowIndex) {
235
+ return Promise.resolve(this.presentationTable?.getRowObject(rowIndex));
236
+ }
237
+ getPrePaginationRowCount() {
238
+ return Promise.resolve(this.prePaginationRowCount ?? 0);
239
+ }
240
+ getRowCount() {
241
+ return Promise.resolve(this.presentationTable?.getRowCount() ?? 0);
242
+ }
243
+ getValue(columnId, rowIndex) {
244
+ return Promise.resolve(this.presentationTable?.getCell(columnId, rowIndex));
245
+ }
246
+ async setValue(value, columnId, rowId) {
247
+ const localRowIndex = await this.getRowIndex(rowId);
248
+ if (!defined(localRowIndex)) {
249
+ // eslint-disable-next-line no-console
250
+ console.error('[setValue] Wrong row ID:', rowId);
251
+ return;
252
+ }
253
+ const rowIndex = await this.getOriginalRowIndexFromLocal(localRowIndex);
254
+ if (!defined(rowIndex)) {
255
+ // eslint-disable-next-line no-console
256
+ console.error('[setValue] Wrong local row index:', localRowIndex);
257
+ return;
258
+ }
259
+ this.dataTable?.setCell(columnId, rowIndex, value, { fromGrid: true });
260
+ return;
261
+ }
262
+ /**
263
+ * Applies querying modifiers and updates the presentation table.
264
+ */
265
+ async applyQuery() {
266
+ const controller = this.querying;
267
+ const originalDataTable = this.dataTable;
268
+ if (!originalDataTable) {
269
+ return;
270
+ }
271
+ const groupedModifiers = controller.getGroupedModifiers();
272
+ let interTable;
273
+ // Grouped modifiers
274
+ if (groupedModifiers.length > 0) {
275
+ const chainModifier = new ChainModifier({}, ...groupedModifiers);
276
+ const dataTableCopy = originalDataTable.clone();
277
+ await chainModifier.modify(dataTableCopy.getModified());
278
+ interTable = dataTableCopy.getModified();
279
+ }
280
+ else {
281
+ interTable = originalDataTable.getModified();
282
+ }
283
+ this.prePaginationRowCount = interTable.rowCount;
284
+ // Pagination modifier
285
+ const paginationModifier = controller.pagination.createModifier(interTable.rowCount);
286
+ if (paginationModifier) {
287
+ interTable = interTable.clone();
288
+ await paginationModifier.modify(interTable);
289
+ interTable = interTable.getModified();
290
+ }
291
+ this.presentationTable = interTable;
292
+ }
293
+ destroy() {
294
+ this.clearDataTableEvents();
295
+ this.clearConnector();
296
+ }
297
+ getColumnDataType(columnId) {
298
+ const column = this.dataTable?.getColumn(columnId);
299
+ if (!column) {
300
+ return Promise.resolve('string');
301
+ }
302
+ if (!Array.isArray(column)) {
303
+ // Typed array
304
+ return Promise.resolve('number');
305
+ }
306
+ return Promise.resolve(DataProvider.assumeColumnDataType(column.slice(0, 30), columnId));
307
+ }
308
+ /**
309
+ * Returns the current data table. When `presentation` is `true`, returns
310
+ * the presentation table (after modifiers).
311
+ *
312
+ * @param presentation
313
+ * Whether to return the presentation table (after modifiers).
314
+ *
315
+ * @return
316
+ * The data table.
317
+ */
318
+ getDataTable(presentation = false) {
319
+ return presentation ? this.presentationTable : this.dataTable;
320
+ }
321
+ /**
322
+ * Checks if the object is an instance of DataConnector.
323
+ *
324
+ * @param connector
325
+ * The object to check.
326
+ *
327
+ * @returns `true` if the object is an instance of DataConnector, `false`
328
+ * otherwise.
329
+ */
330
+ static isConnectorInstance(connector) {
331
+ return 'getTable' in connector;
332
+ }
333
+ }
334
+ LocalDataProvider.tableChangeEventNames = [
335
+ 'afterDeleteColumns',
336
+ 'afterDeleteRows',
337
+ 'afterSetCell',
338
+ 'afterSetColumns',
339
+ 'afterSetRows'
340
+ ];
341
+ DataProviderRegistry.registerDataProvider('local', LocalDataProvider);
@@ -15,8 +15,7 @@
15
15
  * */
16
16
  'use strict';
17
17
  import Pagination from './Pagination/Pagination.js';
18
- import Utils from '../../Core/Utilities.js';
19
- const { merge } = Utils;
18
+ import { merge } from '../../Shared/Utilities.js';
20
19
  /**
21
20
  * Default language options for the Grid.
22
21
  */
@@ -109,6 +108,9 @@ export const defaultOptions = {
109
108
  afterGridFormat: 'End of Grid.'
110
109
  }
111
110
  },
111
+ data: {
112
+ providerType: 'local'
113
+ },
112
114
  time: {
113
115
  timezone: 'UTC'
114
116
  },
@@ -3,7 +3,7 @@ export type DeepRequired<T> = {
3
3
  };
4
4
  export type ClassNameKey = keyof typeof rawClassNames;
5
5
  export declare const classNamePrefix: string;
6
- export declare const version = "2.2.0";
6
+ export declare const version = "2.3.0";
7
7
  export declare const rawClassNames: {
8
8
  readonly container: "container";
9
9
  readonly tableElement: "table";
@@ -40,7 +40,6 @@ export declare const rawClassNames: {
40
40
  readonly columnSortableIcon: "column-sortable-icon";
41
41
  readonly columnSortedAsc: "column-sorted-asc";
42
42
  readonly columnSortedDesc: "column-sorted-desc";
43
- readonly sortPriorityIndicator: "sort-priority-indicator";
44
43
  readonly resizableContent: "resizable-content";
45
44
  readonly resizerHandles: "column-resizer";
46
45
  readonly resizedColumn: "column-resized";
@@ -55,12 +54,12 @@ export declare const rawClassNames: {
55
54
  readonly popup: "popup";
56
55
  readonly button: "button";
57
56
  readonly buttonSelected: "button-selected";
57
+ readonly buttonHighlighted: "button-highlighted";
58
58
  readonly input: "input";
59
59
  readonly icon: "icon";
60
60
  readonly iconSearch: "icon-search";
61
61
  readonly popupContent: "popup-content";
62
62
  readonly columnFilterWrapper: "column-filter-wrapper";
63
- readonly toolbarButtonActiveIndicator: "active-indicator";
64
63
  readonly menuContainer: "menu-container";
65
64
  readonly menuItem: "menu-item";
66
65
  readonly menuHeader: "menu-header";
@@ -70,13 +69,16 @@ export declare const rawClassNames: {
70
69
  readonly menuItemLabel: "menu-item-label";
71
70
  readonly menuDivider: "menu-divider";
72
71
  readonly clearFilterButton: "clear-filter-button";
73
- readonly paginationWrapper: "pagination-wrapper";
74
- readonly paginationContainer: "pagination-container";
72
+ readonly pagination: "pagination";
75
73
  readonly paginationPageInfo: "pagination-info";
76
- readonly paginationControlsContainer: "pagination-controls-container";
77
- readonly paginationNavButtonsContainer: "pagination-nav-buttons-container";
78
- readonly paginationNavDropdown: "pagination-nav-dropdown";
74
+ readonly paginationControls: "pagination-controls";
79
75
  readonly paginationPageSize: "pagination-page-size";
76
+ readonly paginationPages: "pagination-pages";
77
+ readonly paginationNavDropdown: "pagination-nav-dropdown";
78
+ readonly paginationLeft: "pagination-left";
79
+ readonly paginationCenter: "pagination-center";
80
+ readonly paginationRight: "pagination-right";
81
+ readonly paginationDistributed: "pagination-distributed";
80
82
  readonly noWidth: "no-width";
81
83
  readonly rightAlign: "right";
82
84
  readonly centerAlign: "center";
@@ -90,7 +92,7 @@ export declare const isSafari: boolean;
90
92
  export declare const getClassName: (classNameKey: ClassNameKey) => string;
91
93
  declare const _default: {
92
94
  readonly classNamePrefix: string;
93
- readonly version: "2.2.0";
95
+ readonly version: "2.3.0";
94
96
  readonly rawClassNames: {
95
97
  readonly container: "container";
96
98
  readonly tableElement: "table";
@@ -127,7 +129,6 @@ declare const _default: {
127
129
  readonly columnSortableIcon: "column-sortable-icon";
128
130
  readonly columnSortedAsc: "column-sorted-asc";
129
131
  readonly columnSortedDesc: "column-sorted-desc";
130
- readonly sortPriorityIndicator: "sort-priority-indicator";
131
132
  readonly resizableContent: "resizable-content";
132
133
  readonly resizerHandles: "column-resizer";
133
134
  readonly resizedColumn: "column-resized";
@@ -142,12 +143,12 @@ declare const _default: {
142
143
  readonly popup: "popup";
143
144
  readonly button: "button";
144
145
  readonly buttonSelected: "button-selected";
146
+ readonly buttonHighlighted: "button-highlighted";
145
147
  readonly input: "input";
146
148
  readonly icon: "icon";
147
149
  readonly iconSearch: "icon-search";
148
150
  readonly popupContent: "popup-content";
149
151
  readonly columnFilterWrapper: "column-filter-wrapper";
150
- readonly toolbarButtonActiveIndicator: "active-indicator";
151
152
  readonly menuContainer: "menu-container";
152
153
  readonly menuItem: "menu-item";
153
154
  readonly menuHeader: "menu-header";
@@ -157,13 +158,16 @@ declare const _default: {
157
158
  readonly menuItemLabel: "menu-item-label";
158
159
  readonly menuDivider: "menu-divider";
159
160
  readonly clearFilterButton: "clear-filter-button";
160
- readonly paginationWrapper: "pagination-wrapper";
161
- readonly paginationContainer: "pagination-container";
161
+ readonly pagination: "pagination";
162
162
  readonly paginationPageInfo: "pagination-info";
163
- readonly paginationControlsContainer: "pagination-controls-container";
164
- readonly paginationNavButtonsContainer: "pagination-nav-buttons-container";
165
- readonly paginationNavDropdown: "pagination-nav-dropdown";
163
+ readonly paginationControls: "pagination-controls";
166
164
  readonly paginationPageSize: "pagination-page-size";
165
+ readonly paginationPages: "pagination-pages";
166
+ readonly paginationNavDropdown: "pagination-nav-dropdown";
167
+ readonly paginationLeft: "pagination-left";
168
+ readonly paginationCenter: "pagination-center";
169
+ readonly paginationRight: "pagination-right";
170
+ readonly paginationDistributed: "pagination-distributed";
167
171
  readonly noWidth: "no-width";
168
172
  readonly rightAlign: "right";
169
173
  readonly centerAlign: "center";
@@ -18,7 +18,7 @@
18
18
  *
19
19
  * */
20
20
  export const classNamePrefix = 'hcg-';
21
- export const version = '2.2.0';
21
+ export const version = '2.3.0';
22
22
  export const rawClassNames = {
23
23
  container: 'container',
24
24
  tableElement: 'table',
@@ -55,7 +55,6 @@ export const rawClassNames = {
55
55
  columnSortableIcon: 'column-sortable-icon',
56
56
  columnSortedAsc: 'column-sorted-asc',
57
57
  columnSortedDesc: 'column-sorted-desc',
58
- sortPriorityIndicator: 'sort-priority-indicator',
59
58
  resizableContent: 'resizable-content',
60
59
  resizerHandles: 'column-resizer',
61
60
  resizedColumn: 'column-resized',
@@ -70,12 +69,12 @@ export const rawClassNames = {
70
69
  popup: 'popup',
71
70
  button: 'button',
72
71
  buttonSelected: 'button-selected',
72
+ buttonHighlighted: 'button-highlighted',
73
73
  input: 'input',
74
74
  icon: 'icon',
75
75
  iconSearch: 'icon-search',
76
76
  popupContent: 'popup-content',
77
77
  columnFilterWrapper: 'column-filter-wrapper',
78
- toolbarButtonActiveIndicator: 'active-indicator',
79
78
  menuContainer: 'menu-container',
80
79
  menuItem: 'menu-item',
81
80
  menuHeader: 'menu-header',
@@ -85,13 +84,16 @@ export const rawClassNames = {
85
84
  menuItemLabel: 'menu-item-label',
86
85
  menuDivider: 'menu-divider',
87
86
  clearFilterButton: 'clear-filter-button',
88
- paginationWrapper: 'pagination-wrapper',
89
- paginationContainer: 'pagination-container',
87
+ pagination: 'pagination',
90
88
  paginationPageInfo: 'pagination-info',
91
- paginationControlsContainer: 'pagination-controls-container',
92
- paginationNavButtonsContainer: 'pagination-nav-buttons-container',
93
- paginationNavDropdown: 'pagination-nav-dropdown',
89
+ paginationControls: 'pagination-controls',
94
90
  paginationPageSize: 'pagination-page-size',
91
+ paginationPages: 'pagination-pages',
92
+ paginationNavDropdown: 'pagination-nav-dropdown',
93
+ paginationLeft: 'pagination-left',
94
+ paginationCenter: 'pagination-center',
95
+ paginationRight: 'pagination-right',
96
+ paginationDistributed: 'pagination-distributed',
95
97
  noWidth: 'no-width',
96
98
  rightAlign: 'right',
97
99
  centerAlign: 'center',
@@ -1,4 +1,5 @@
1
1
  import type { ColumnSortingOrder, Options, GroupedHeaderOptions } from './Options';
2
+ import type { DataProviderType } from './Data/DataProviderType';
2
3
  import type { NoIdColumnOptions } from './Table/Column';
3
4
  import type Popup from './UI/Popup.js';
4
5
  import Accessibility from './Accessibility/Accessibility.js';
@@ -69,11 +70,6 @@ export declare class Grid {
69
70
  * The content container of the Grid.
70
71
  */
71
72
  contentWrapper?: HTMLElement;
72
- /**
73
- * The data source of the Grid. It contains the original data table
74
- * that was passed to the Grid.
75
- */
76
- dataTable?: DataTable;
77
73
  /**
78
74
  * The description element of the Grid.
79
75
  */
@@ -82,12 +78,6 @@ export declare class Grid {
82
78
  * The container element of the loading indicator overlaying the Grid.
83
79
  */
84
80
  loadingWrapper?: HTMLElement;
85
- /**
86
- * The presentation table of the Grid. It contains a modified version
87
- * of the data table that is used for rendering the Grid content. If
88
- * not modified, just a reference to the original data table.
89
- */
90
- presentationTable?: DataTable;
91
81
  /**
92
82
  * The HTML element of the table.
93
83
  */
@@ -117,16 +107,11 @@ export declare class Grid {
117
107
  /**
118
108
  * The unique ID of the Grid.
119
109
  */
120
- id: string;
110
+ readonly id: string;
121
111
  /**
122
112
  * The list of currently shown popups.
123
113
  */
124
114
  popups: Set<Popup>;
125
- /**
126
- * Functions that unregister events attached to the grid's data table,
127
- * that need to be removed when the grid is destroyed.
128
- */
129
- private dataTableEventDestructors;
130
115
  /**
131
116
  * The render target (container) of the Grid.
132
117
  */
@@ -135,6 +120,14 @@ export declare class Grid {
135
120
  * Whether the Grid is rendered.
136
121
  */
137
122
  private isRendered;
123
+ /**
124
+ * Internal redraw queue used to prevent concurrent `redraw()` calls from
125
+ * interleaving async DOM work and corrupting the state (for example
126
+ * rendering duplicate pagination controls when `update()` is called
127
+ * multiple times without awaiting).
128
+ */
129
+ private redrawQueue;
130
+ dataProvider?: DataProviderType;
138
131
  /**
139
132
  * Constructs a new Grid.
140
133
  *
@@ -148,6 +141,21 @@ export declare class Grid {
148
141
  * The callback that is called after the Grid is loaded.
149
142
  */
150
143
  constructor(renderTo: string | HTMLElement, options: Options, afterLoadCallback?: (grid: Grid) => void);
144
+ /**
145
+ * The data source of the Grid. It contains the original data table
146
+ * that was passed to the Grid.
147
+ *
148
+ * @deprecated Use `dataProvider` instead.
149
+ */
150
+ get dataTable(): DataTable | undefined;
151
+ /**
152
+ * The presentation table of the Grid. It contains a modified version
153
+ * of the data table that is used for rendering the Grid content. If
154
+ * not modified, just a reference to the original data table.
155
+ *
156
+ * @deprecated Use `dataProvider` instead.
157
+ */
158
+ get presentationTable(): DataTable | undefined;
151
159
  private initAccessibility;
152
160
  private initPagination;
153
161
  /**
@@ -277,11 +285,7 @@ export declare class Grid {
277
285
  * grid, in the correct order.
278
286
  */
279
287
  private getEnabledColumnIDs;
280
- /**
281
- * Loads the data table of the Grid. If the data table is passed as a
282
- * reference, it should be used instead of creating a new one.
283
- */
284
- private loadDataTable;
288
+ private loadDataProvider;
285
289
  /**
286
290
  * Extracts all references to columnIds on all levels below defined level
287
291
  * in the settings.header structure.
@@ -317,6 +321,11 @@ export declare class Grid {
317
321
  /**
318
322
  * Returns the grid data as a JSON string.
319
323
  *
324
+ * **Note:** This method only works with `LocalDataProvider`.
325
+ * For other data providers, use your data source directly.
326
+ *
327
+ * @deprecated
328
+ *
320
329
  * @param modified
321
330
  * Whether to return the modified data table (after filtering/sorting/etc.)
322
331
  * or the unmodified, original one. Default value is set to `true`.