@highcharts/grid-pro 2.1.1 → 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 (455) hide show
  1. package/LICENSE.txt +6 -0
  2. package/README.md +15 -9
  3. package/css/grid-pro.css +1289 -1153
  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 +4 -5
  17. package/es-modules/Accessibility/Accessibility.js +5 -5
  18. package/es-modules/Accessibility/AccessibilityComponent.d.ts +3 -3
  19. package/es-modules/Accessibility/AccessibilityComponent.js +4 -3
  20. package/es-modules/Accessibility/Components/AnnotationsA11y.js +4 -3
  21. package/es-modules/Accessibility/Components/ContainerComponent.js +4 -3
  22. package/es-modules/Accessibility/Components/InfoRegionsComponent.js +9 -9
  23. package/es-modules/Accessibility/Components/LegendComponent.js +5 -5
  24. package/es-modules/Accessibility/Components/MenuComponent.js +5 -5
  25. package/es-modules/Accessibility/Components/NavigatorComponent.js +6 -7
  26. package/es-modules/Accessibility/Components/RangeSelectorComponent.js +5 -5
  27. package/es-modules/Accessibility/Components/SeriesComponent/ForcedMarkers.js +15 -5
  28. package/es-modules/Accessibility/Components/SeriesComponent/NewDataAnnouncer.js +7 -7
  29. package/es-modules/Accessibility/Components/SeriesComponent/SeriesComponent.js +4 -3
  30. package/es-modules/Accessibility/Components/SeriesComponent/SeriesDescriber.js +7 -7
  31. package/es-modules/Accessibility/Components/SeriesComponent/SeriesKeyboardNavigation.js +5 -5
  32. package/es-modules/Accessibility/Components/ZoomComponent.js +5 -5
  33. package/es-modules/Accessibility/FocusBorder.js +5 -5
  34. package/es-modules/Accessibility/HighContrastMode.js +4 -3
  35. package/es-modules/Accessibility/HighContrastTheme.js +4 -3
  36. package/es-modules/Accessibility/KeyboardNavigation.js +5 -5
  37. package/es-modules/Accessibility/KeyboardNavigationHandler.js +5 -5
  38. package/es-modules/Accessibility/Options/A11yDefaults.d.ts +11 -0
  39. package/es-modules/Accessibility/Options/A11yDefaults.js +15 -3
  40. package/es-modules/Accessibility/Options/DeprecatedOptions.d.ts +58 -0
  41. package/es-modules/Accessibility/Options/DeprecatedOptions.js +11 -5
  42. package/es-modules/Accessibility/Options/LangDefaults.js +13 -3
  43. package/es-modules/Accessibility/ProxyElement.js +6 -8
  44. package/es-modules/Accessibility/ProxyProvider.js +5 -5
  45. package/es-modules/Accessibility/Utils/Announcer.js +6 -6
  46. package/es-modules/Accessibility/Utils/ChartUtilities.js +5 -5
  47. package/es-modules/Accessibility/Utils/DOMElementProvider.js +4 -3
  48. package/es-modules/Accessibility/Utils/EventProvider.d.ts +3 -3
  49. package/es-modules/Accessibility/Utils/EventProvider.js +10 -5
  50. package/es-modules/Accessibility/Utils/HTMLUtilities.js +5 -5
  51. package/es-modules/Core/Animation/AnimationOptions.d.ts +42 -0
  52. package/es-modules/Core/Animation/AnimationOptions.js +10 -0
  53. package/es-modules/Core/Animation/AnimationUtilities.js +40 -5
  54. package/es-modules/Core/Animation/Fx.d.ts +1 -130
  55. package/es-modules/Core/Animation/Fx.js +14 -8
  56. package/es-modules/Core/Animation/FxBase.d.ts +1 -0
  57. package/es-modules/Core/Animation/FxBase.js +11 -0
  58. package/es-modules/Core/Callback.d.ts +56 -0
  59. package/es-modules/Core/Callback.js +10 -0
  60. package/es-modules/Core/Chart/Chart.d.ts +659 -400
  61. package/es-modules/Core/Chart/Chart.js +112 -95
  62. package/es-modules/Core/Chart/Chart3D.d.ts +123 -233
  63. package/es-modules/Core/Chart/Chart3D.js +23 -37
  64. package/es-modules/Core/Chart/ChartBase.d.ts +3 -0
  65. package/es-modules/Core/Chart/ChartBase.js +11 -0
  66. package/es-modules/Core/Chart/ChartDefaults.js +18 -12
  67. package/es-modules/Core/Chart/ChartNavigationComposition.d.ts +1 -55
  68. package/es-modules/Core/Chart/ChartNavigationComposition.js +13 -13
  69. package/es-modules/Core/Chart/ChartOptions.d.ts +1225 -0
  70. package/es-modules/Core/Chart/ChartOptions.js +10 -0
  71. package/es-modules/Core/Chart/GanttChart.d.ts +0 -38
  72. package/es-modules/Core/Chart/GanttChart.js +5 -5
  73. package/es-modules/Core/Chart/MapChart.d.ts +9 -4
  74. package/es-modules/Core/Chart/MapChart.js +14 -5
  75. package/es-modules/Core/Chart/StockChart.d.ts +0 -85
  76. package/es-modules/Core/Chart/StockChart.js +35 -18
  77. package/es-modules/Core/Color/Color.d.ts +16 -24
  78. package/es-modules/Core/Color/Color.js +27 -10
  79. package/es-modules/Core/Color/ColorString.d.ts +0 -23
  80. package/es-modules/Core/Color/ColorString.js +11 -0
  81. package/es-modules/Core/Color/ColorType.d.ts +0 -33
  82. package/es-modules/Core/Color/ColorType.js +11 -0
  83. package/es-modules/Core/Color/GradientColor.d.ts +0 -33
  84. package/es-modules/Core/Color/GradientColor.js +11 -0
  85. package/es-modules/Core/Color/Palettes.d.ts +1 -84
  86. package/es-modules/Core/Color/Palettes.js +2 -1
  87. package/es-modules/Core/Defaults.d.ts +6 -0
  88. package/es-modules/Core/Defaults.js +66 -75
  89. package/es-modules/Core/Delaunay.d.ts +52 -0
  90. package/es-modules/Core/Delaunay.js +310 -0
  91. package/es-modules/Core/Foundation.d.ts +1 -19
  92. package/es-modules/Core/Foundation.js +8 -6
  93. package/es-modules/Core/Geometry/CircleObject.d.ts +5 -0
  94. package/es-modules/Core/Geometry/CircleObject.js +10 -0
  95. package/es-modules/Core/Geometry/CircleUtilities.d.ts +1 -189
  96. package/es-modules/Core/Geometry/CircleUtilities.js +18 -17
  97. package/es-modules/Core/Geometry/GeometryObject.d.ts +7 -0
  98. package/es-modules/Core/Geometry/GeometryObject.js +10 -0
  99. package/es-modules/Core/Geometry/GeometryUtilities.d.ts +1 -48
  100. package/es-modules/Core/Geometry/GeometryUtilities.js +9 -7
  101. package/es-modules/Core/Geometry/IntersectionObject.d.ts +7 -0
  102. package/es-modules/Core/Geometry/IntersectionObject.js +10 -0
  103. package/es-modules/Core/Geometry/PolygonClip.d.ts +1 -19
  104. package/es-modules/Core/Geometry/PolygonClip.js +9 -7
  105. package/es-modules/Core/Globals.d.ts +9 -31
  106. package/es-modules/Core/Globals.js +9 -10
  107. package/es-modules/Core/GlobalsBase.d.ts +35 -0
  108. package/es-modules/Core/GlobalsBase.js +11 -0
  109. package/es-modules/Core/HttpUtilities.d.ts +54 -17
  110. package/es-modules/Core/HttpUtilities.js +16 -16
  111. package/es-modules/Core/JSON.d.ts +29 -0
  112. package/es-modules/Core/JSON.js +13 -0
  113. package/es-modules/Core/KeyboardEvent.d.ts +1 -0
  114. package/es-modules/Core/KeyboardEvent.js +11 -0
  115. package/es-modules/Core/MSPointer.d.ts +1 -74
  116. package/es-modules/Core/MSPointer.js +24 -15
  117. package/es-modules/Core/Math3D.d.ts +1 -117
  118. package/es-modules/Core/Math3D.js +14 -12
  119. package/es-modules/Core/Options.d.ts +338 -0
  120. package/es-modules/Core/Options.js +10 -0
  121. package/es-modules/Core/Pointer.d.ts +71 -445
  122. package/es-modules/Core/Pointer.js +74 -69
  123. package/es-modules/Core/PointerEvent.d.ts +20 -0
  124. package/es-modules/Core/PointerEvent.js +11 -0
  125. package/es-modules/Core/Renderer/AlignObject.d.ts +25 -27
  126. package/es-modules/Core/Renderer/AlignObject.js +11 -0
  127. package/es-modules/Core/Renderer/BBoxObject.d.ts +20 -31
  128. package/es-modules/Core/Renderer/BBoxObject.js +11 -0
  129. package/es-modules/Core/Renderer/CSSObject.d.ts +268 -59
  130. package/es-modules/Core/Renderer/CSSObject.js +10 -0
  131. package/es-modules/Core/Renderer/DOMElementType.d.ts +1 -33
  132. package/es-modules/Core/Renderer/DOMElementType.js +11 -0
  133. package/es-modules/Core/Renderer/DashStyleValue.d.ts +1 -27
  134. package/es-modules/Core/Renderer/DashStyleValue.js +11 -0
  135. package/es-modules/Core/Renderer/FontMetricsObject.d.ts +6 -26
  136. package/es-modules/Core/Renderer/FontMetricsObject.js +11 -0
  137. package/es-modules/Core/Renderer/HTML/AST.d.ts +3 -15
  138. package/es-modules/Core/Renderer/HTML/AST.js +24 -15
  139. package/es-modules/Core/Renderer/HTML/HTMLAttributes.d.ts +1 -25
  140. package/es-modules/Core/Renderer/HTML/HTMLAttributes.js +11 -0
  141. package/es-modules/Core/Renderer/HTML/HTMLElement.d.ts +0 -54
  142. package/es-modules/Core/Renderer/HTML/HTMLElement.js +28 -24
  143. package/es-modules/Core/Renderer/PolygonBoxObject.d.ts +15 -12
  144. package/es-modules/Core/Renderer/PolygonBoxObject.js +11 -0
  145. package/es-modules/Core/Renderer/Position3DObject.d.ts +6 -30
  146. package/es-modules/Core/Renderer/Position3DObject.js +11 -0
  147. package/es-modules/Core/Renderer/PositionObject.d.ts +9 -23
  148. package/es-modules/Core/Renderer/PositionObject.js +11 -0
  149. package/es-modules/Core/Renderer/RectangleObject.d.ts +6 -30
  150. package/es-modules/Core/Renderer/RectangleObject.js +11 -0
  151. package/es-modules/Core/Renderer/RendererRegistry.d.ts +1 -29
  152. package/es-modules/Core/Renderer/RendererRegistry.js +6 -3
  153. package/es-modules/Core/Renderer/RendererType.d.ts +1 -53
  154. package/es-modules/Core/Renderer/RendererType.js +11 -0
  155. package/es-modules/Core/Renderer/RendererUtilities.d.ts +1 -26
  156. package/es-modules/Core/Renderer/RendererUtilities.js +41 -23
  157. package/es-modules/Core/Renderer/SVG/ButtonThemeObject.d.ts +26 -31
  158. package/es-modules/Core/Renderer/SVG/SVGArc3D.d.ts +1 -44
  159. package/es-modules/Core/Renderer/SVG/SVGAttributes.d.ts +15 -51
  160. package/es-modules/Core/Renderer/SVG/SVGAttributes3D.d.ts +1 -42
  161. package/es-modules/Core/Renderer/SVG/SVGCuboid.d.ts +1 -42
  162. package/es-modules/Core/Renderer/SVG/SVGElement.d.ts +459 -0
  163. package/es-modules/Core/Renderer/SVG/SVGElement3D.d.ts +1 -0
  164. package/es-modules/Core/Renderer/SVG/SVGElementBase.d.ts +0 -23
  165. package/es-modules/Core/Renderer/SVG/SVGLabel.d.ts +14 -0
  166. package/es-modules/Core/Renderer/SVG/SVGPath.d.ts +18 -56
  167. package/es-modules/Core/Renderer/SVG/SVGPath3D.d.ts +0 -30
  168. package/es-modules/Core/Renderer/SVG/SVGRenderer.d.ts +652 -0
  169. package/es-modules/Core/Renderer/SVG/SVGRenderer3D.d.ts +1 -0
  170. package/es-modules/Core/Renderer/SVG/SVGRendererBase.d.ts +0 -24
  171. package/es-modules/Core/Renderer/SVG/SymbolOptions.d.ts +3 -26
  172. package/es-modules/Core/Renderer/SVG/SymbolType.d.ts +1 -41
  173. package/es-modules/Core/Renderer/SVG/Symbols.d.ts +146 -0
  174. package/es-modules/Core/Renderer/SVG/TextBuilder.d.ts +1 -0
  175. package/es-modules/Core/Renderer/ShadowOptionsObject.d.ts +21 -30
  176. package/es-modules/Core/Renderer/ShadowOptionsObject.js +11 -0
  177. package/es-modules/Core/Renderer/SizeObject.d.ts +0 -23
  178. package/es-modules/Core/Renderer/SizeObject.js +11 -0
  179. package/es-modules/Core/Responsive.d.ts +94 -29
  180. package/es-modules/Core/Responsive.js +17 -12
  181. package/es-modules/Core/Templating.d.ts +17 -1
  182. package/es-modules/Core/Templating.js +12 -8
  183. package/es-modules/Core/Time.d.ts +18 -1
  184. package/es-modules/Core/Time.js +6 -5
  185. package/es-modules/Core/Tooltip.d.ts +67 -123
  186. package/es-modules/Core/Tooltip.js +161 -108
  187. package/es-modules/Core/TooltipOptions.d.ts +724 -0
  188. package/es-modules/Core/TooltipOptions.js +10 -0
  189. package/es-modules/Core/Utilities.d.ts +32 -703
  190. package/es-modules/Core/Utilities.js +28 -1443
  191. package/es-modules/Data/ColumnUtils.d.ts +83 -80
  192. package/es-modules/Data/ColumnUtils.js +106 -116
  193. package/es-modules/Data/Connectors/CSVConnector.d.ts +9 -14
  194. package/es-modules/Data/Connectors/CSVConnector.js +6 -7
  195. package/es-modules/Data/Connectors/CSVConnectorOptions.d.ts +3 -3
  196. package/es-modules/Data/Connectors/DataConnector.d.ts +63 -54
  197. package/es-modules/Data/Connectors/DataConnector.js +67 -56
  198. package/es-modules/Data/Connectors/DataConnectorOptions.d.ts +3 -3
  199. package/es-modules/Data/Connectors/DataConnectorType.d.ts +3 -3
  200. package/es-modules/Data/Connectors/GoogleSheetsConnector.d.ts +40 -42
  201. package/es-modules/Data/Connectors/GoogleSheetsConnector.js +76 -91
  202. package/es-modules/Data/Connectors/GoogleSheetsConnectorOptions.d.ts +7 -5
  203. package/es-modules/Data/Connectors/HTMLTableConnector.d.ts +23 -28
  204. package/es-modules/Data/Connectors/HTMLTableConnector.js +6 -7
  205. package/es-modules/Data/Connectors/HTMLTableConnectorOptions.d.ts +3 -3
  206. package/es-modules/Data/Connectors/JSONConnector.d.ts +9 -14
  207. package/es-modules/Data/Connectors/JSONConnector.js +6 -7
  208. package/es-modules/Data/Connectors/JSONConnectorOptions.d.ts +3 -3
  209. package/es-modules/Data/Converters/CSVConverter.d.ts +5 -5
  210. package/es-modules/Data/Converters/CSVConverter.js +6 -7
  211. package/es-modules/Data/Converters/CSVConverterOptions.d.ts +5 -5
  212. package/es-modules/Data/Converters/DataConverter.d.ts +76 -78
  213. package/es-modules/Data/Converters/DataConverter.js +29 -56
  214. package/es-modules/Data/Converters/DataConverterType.d.ts +3 -3
  215. package/es-modules/Data/Converters/DataConverterUtils.d.ts +88 -81
  216. package/es-modules/Data/Converters/DataConverterUtils.js +172 -184
  217. package/es-modules/Data/Converters/GoogleSheetsConverter.d.ts +4 -4
  218. package/es-modules/Data/Converters/GoogleSheetsConverter.js +6 -6
  219. package/es-modules/Data/Converters/GoogleSheetsConverterOptions.d.ts +5 -5
  220. package/es-modules/Data/Converters/HTMLTableConverter.d.ts +4 -4
  221. package/es-modules/Data/Converters/HTMLTableConverter.js +5 -6
  222. package/es-modules/Data/Converters/HTMLTableConverterOptions.d.ts +5 -5
  223. package/es-modules/Data/Converters/JSONConverter.d.ts +7 -7
  224. package/es-modules/Data/Converters/JSONConverter.js +9 -9
  225. package/es-modules/Data/Converters/JSONConverterOptions.d.ts +5 -5
  226. package/es-modules/Data/DataCursor.d.ts +65 -70
  227. package/es-modules/Data/DataCursor.js +122 -142
  228. package/es-modules/Data/DataEvent.d.ts +55 -57
  229. package/es-modules/Data/DataEvent.js +3 -3
  230. package/es-modules/Data/DataPool.d.ts +10 -17
  231. package/es-modules/Data/DataPool.js +23 -12
  232. package/es-modules/Data/DataPoolOptions.d.ts +3 -3
  233. package/es-modules/Data/DataTable.d.ts +115 -117
  234. package/es-modules/Data/DataTable.js +67 -33
  235. package/es-modules/Data/DataTableCore.d.ts +11 -11
  236. package/es-modules/Data/DataTableCore.js +7 -7
  237. package/es-modules/Data/DataTableOptions.js +3 -3
  238. package/es-modules/Data/Formula/Formula.js +3 -3
  239. package/es-modules/Data/Formula/FormulaParser.js +4 -5
  240. package/es-modules/Data/Formula/FormulaProcessor.js +4 -5
  241. package/es-modules/Data/Formula/FormulaTypes.js +3 -3
  242. package/es-modules/Data/Formula/Functions/ABS.js +3 -3
  243. package/es-modules/Data/Formula/Functions/AND.js +3 -3
  244. package/es-modules/Data/Formula/Functions/AVERAGE.js +3 -3
  245. package/es-modules/Data/Formula/Functions/AVERAGEA.js +3 -3
  246. package/es-modules/Data/Formula/Functions/COUNT.js +3 -3
  247. package/es-modules/Data/Formula/Functions/COUNTA.js +3 -3
  248. package/es-modules/Data/Formula/Functions/IF.js +3 -3
  249. package/es-modules/Data/Formula/Functions/ISNA.js +3 -3
  250. package/es-modules/Data/Formula/Functions/MAX.js +3 -3
  251. package/es-modules/Data/Formula/Functions/MEDIAN.js +3 -3
  252. package/es-modules/Data/Formula/Functions/MIN.js +3 -3
  253. package/es-modules/Data/Formula/Functions/MOD.js +3 -3
  254. package/es-modules/Data/Formula/Functions/MODE.js +3 -3
  255. package/es-modules/Data/Formula/Functions/NOT.js +3 -3
  256. package/es-modules/Data/Formula/Functions/OR.js +3 -3
  257. package/es-modules/Data/Formula/Functions/PRODUCT.js +3 -3
  258. package/es-modules/Data/Formula/Functions/SUM.js +3 -3
  259. package/es-modules/Data/Formula/Functions/XOR.js +3 -3
  260. package/es-modules/Data/Modifiers/ChainModifier.d.ts +29 -34
  261. package/es-modules/Data/Modifiers/ChainModifier.js +10 -11
  262. package/es-modules/Data/Modifiers/ChainModifierOptions.js +3 -3
  263. package/es-modules/Data/Modifiers/DataModifier.d.ts +36 -41
  264. package/es-modules/Data/Modifiers/DataModifier.js +34 -56
  265. package/es-modules/Data/Modifiers/DataModifierEvent.js +3 -3
  266. package/es-modules/Data/Modifiers/DataModifierOptions.js +3 -3
  267. package/es-modules/Data/Modifiers/DataModifierType.d.ts +3 -3
  268. package/es-modules/Data/Modifiers/FilterModifier.d.ts +4 -4
  269. package/es-modules/Data/Modifiers/FilterModifier.js +6 -7
  270. package/es-modules/Data/Modifiers/FilterModifierOptions.d.ts +3 -2
  271. package/es-modules/Data/Modifiers/FilterModifierOptions.js +3 -3
  272. package/es-modules/Data/Modifiers/InvertModifier.d.ts +4 -4
  273. package/es-modules/Data/Modifiers/InvertModifier.js +6 -7
  274. package/es-modules/Data/Modifiers/InvertModifierOptions.js +3 -3
  275. package/es-modules/Data/Modifiers/MathModifier.d.ts +5 -4
  276. package/es-modules/Data/Modifiers/MathModifier.js +3 -3
  277. package/es-modules/Data/Modifiers/MathModifierOptions.js +3 -3
  278. package/es-modules/Data/Modifiers/RangeModifier.d.ts +4 -4
  279. package/es-modules/Data/Modifiers/RangeModifier.js +6 -7
  280. package/es-modules/Data/Modifiers/RangeModifierOptions.js +3 -3
  281. package/es-modules/Data/Modifiers/SortModifier.d.ts +6 -11
  282. package/es-modules/Data/Modifiers/SortModifier.js +35 -10
  283. package/es-modules/Data/Modifiers/SortModifierOptions.d.ts +43 -6
  284. package/es-modules/Data/Modifiers/SortModifierOptions.js +3 -3
  285. package/es-modules/Grid/Core/Accessibility/A11yOptions.d.ts +77 -0
  286. package/es-modules/Grid/Core/Accessibility/A11yOptions.js +4 -3
  287. package/es-modules/Grid/Core/Accessibility/Accessibility.d.ts +68 -1
  288. package/es-modules/Grid/Core/Accessibility/Accessibility.js +179 -7
  289. package/es-modules/Grid/Core/Credits.js +3 -3
  290. package/es-modules/Grid/Core/Data/DataProvider.d.ts +97 -0
  291. package/es-modules/Grid/Core/Data/DataProvider.js +89 -0
  292. package/es-modules/Grid/Core/Data/DataProviderRegistry.d.ts +20 -0
  293. package/es-modules/Grid/Core/Data/DataProviderRegistry.js +52 -0
  294. package/es-modules/Grid/Core/Data/DataProviderType.d.ts +19 -0
  295. package/es-modules/Grid/Core/Data/DataProviderType.js +15 -0
  296. package/es-modules/Grid/Core/Data/LocalDataProvider.d.ts +165 -0
  297. package/es-modules/Grid/Core/Data/LocalDataProvider.js +341 -0
  298. package/es-modules/Grid/Core/Defaults.js +21 -7
  299. package/es-modules/Grid/Core/Globals.d.ts +20 -16
  300. package/es-modules/Grid/Core/Globals.js +13 -11
  301. package/es-modules/Grid/Core/Grid.d.ts +43 -23
  302. package/es-modules/Grid/Core/Grid.js +316 -136
  303. package/es-modules/Grid/Core/GridUtils.d.ts +33 -0
  304. package/es-modules/Grid/Core/GridUtils.js +53 -6
  305. package/es-modules/Grid/Core/Options.d.ts +162 -5
  306. package/es-modules/Grid/Core/Options.js +3 -3
  307. package/es-modules/Grid/Core/Pagination/Pagination.d.ts +3 -0
  308. package/es-modules/Grid/Core/Pagination/Pagination.js +66 -26
  309. package/es-modules/Grid/Core/Pagination/PaginationOptions.d.ts +4 -40
  310. package/es-modules/Grid/Core/Pagination/PaginationOptions.js +11 -0
  311. package/es-modules/Grid/Core/Querying/FilteringController.js +4 -5
  312. package/es-modules/Grid/Core/Querying/PaginationController.d.ts +2 -2
  313. package/es-modules/Grid/Core/Querying/PaginationController.js +6 -6
  314. package/es-modules/Grid/Core/Querying/QueryingController.d.ts +1 -1
  315. package/es-modules/Grid/Core/Querying/QueryingController.js +5 -29
  316. package/es-modules/Grid/Core/Querying/SortingController.d.ts +15 -0
  317. package/es-modules/Grid/Core/Querying/SortingController.js +89 -51
  318. package/es-modules/Grid/Core/Responsive/ResponsiveComposition.d.ts +53 -0
  319. package/es-modules/Grid/Core/Responsive/ResponsiveComposition.js +229 -0
  320. package/es-modules/Grid/Core/Responsive/ResponsiveOptions.d.ts +58 -0
  321. package/es-modules/Grid/Core/Responsive/ResponsiveOptions.js +15 -0
  322. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/ColumnFiltering.js +5 -6
  323. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterCell.d.ts +3 -3
  324. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterCell.js +6 -7
  325. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterRow.d.ts +1 -1
  326. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilterRow.js +5 -5
  327. package/es-modules/Grid/Core/Table/Actions/ColumnFiltering/FilteringTypes.js +3 -3
  328. package/es-modules/Grid/Core/Table/Actions/ColumnSorting.d.ts +29 -3
  329. package/es-modules/Grid/Core/Table/Actions/ColumnSorting.js +136 -26
  330. package/es-modules/Grid/Core/Table/Actions/ColumnsResizer.js +4 -6
  331. package/es-modules/Grid/Core/Table/Actions/RowsVirtualizer.d.ts +94 -3
  332. package/es-modules/Grid/Core/Table/Actions/RowsVirtualizer.js +481 -91
  333. package/es-modules/Grid/Core/Table/Body/CellContextMenu.d.ts +11 -0
  334. package/es-modules/Grid/Core/Table/Body/CellContextMenu.js +84 -0
  335. package/es-modules/Grid/Core/Table/Body/TableCell.d.ts +36 -15
  336. package/es-modules/Grid/Core/Table/Body/TableCell.js +89 -33
  337. package/es-modules/Grid/Core/Table/Body/TableRow.d.ts +15 -5
  338. package/es-modules/Grid/Core/Table/Body/TableRow.js +70 -19
  339. package/es-modules/Grid/Core/Table/Cell.d.ts +16 -10
  340. package/es-modules/Grid/Core/Table/Cell.js +41 -6
  341. package/es-modules/Grid/Core/Table/CellContent/CellContent.js +3 -3
  342. package/es-modules/Grid/Core/Table/CellContent/TextContent.js +7 -12
  343. package/es-modules/Grid/Core/Table/Column.d.ts +11 -5
  344. package/es-modules/Grid/Core/Table/Column.js +26 -37
  345. package/es-modules/Grid/Core/Table/ColumnResizing/AdjacentResizingMode.js +3 -3
  346. package/es-modules/Grid/Core/Table/ColumnResizing/ColumnResizing.js +3 -3
  347. package/es-modules/Grid/Core/Table/ColumnResizing/DistributedResizingMode.js +3 -3
  348. package/es-modules/Grid/Core/Table/ColumnResizing/IndependentResizingMode.js +12 -11
  349. package/es-modules/Grid/Core/Table/ColumnResizing/ResizingMode.js +7 -6
  350. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ColumnToolbar.d.ts +5 -0
  351. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ColumnToolbar.js +21 -7
  352. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/FilterPopup.js +4 -5
  353. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/FilterMenuButton.js +4 -5
  354. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/SortMenuButton.d.ts +9 -0
  355. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuButtons/SortMenuButton.js +37 -9
  356. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/MenuPopup.js +5 -4
  357. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/StateHelpers.js +11 -7
  358. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/FilterToolbarButton.js +4 -5
  359. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/MenuToolbarButton.js +4 -5
  360. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/SortToolbarButton.d.ts +4 -1
  361. package/es-modules/Grid/Core/Table/Header/ColumnToolbar/ToolbarButtons/SortToolbarButton.js +88 -15
  362. package/es-modules/Grid/Core/Table/Header/HeaderCell.d.ts +8 -3
  363. package/es-modules/Grid/Core/Table/Header/HeaderCell.js +36 -15
  364. package/es-modules/Grid/Core/Table/Header/HeaderRow.js +7 -8
  365. package/es-modules/Grid/Core/Table/Header/TableHeader.d.ts +1 -1
  366. package/es-modules/Grid/Core/Table/Header/TableHeader.js +6 -6
  367. package/es-modules/Grid/Core/Table/Row.d.ts +1 -1
  368. package/es-modules/Grid/Core/Table/Row.js +5 -5
  369. package/es-modules/Grid/Core/Table/Table.d.ts +68 -12
  370. package/es-modules/Grid/Core/Table/Table.js +296 -92
  371. package/es-modules/Grid/Core/UI/Button.js +3 -3
  372. package/es-modules/Grid/Core/UI/ContextMenu.js +3 -3
  373. package/es-modules/Grid/Core/UI/ContextMenuButton.d.ts +6 -7
  374. package/es-modules/Grid/Core/UI/ContextMenuButton.js +8 -6
  375. package/es-modules/Grid/Core/UI/Popup.js +10 -12
  376. package/es-modules/Grid/Core/UI/SvgIcons.d.ts +42 -7
  377. package/es-modules/Grid/Core/UI/SvgIcons.js +209 -36
  378. package/es-modules/Grid/Core/UI/Toolbar.d.ts +5 -0
  379. package/es-modules/Grid/Core/UI/Toolbar.js +3 -3
  380. package/es-modules/Grid/Core/UI/ToolbarButton.d.ts +4 -12
  381. package/es-modules/Grid/Core/UI/ToolbarButton.js +11 -29
  382. package/es-modules/Grid/Pro/CellEditing/CellEditMode.d.ts +4 -45
  383. package/es-modules/Grid/Pro/CellEditing/CellEditMode.js +16 -0
  384. package/es-modules/Grid/Pro/CellEditing/CellEditing.js +13 -13
  385. package/es-modules/Grid/Pro/CellEditing/CellEditingComposition.js +4 -5
  386. package/es-modules/Grid/Pro/CellRendering/CellContentPro.js +3 -3
  387. package/es-modules/Grid/Pro/CellRendering/CellRenderer.js +3 -3
  388. package/es-modules/Grid/Pro/CellRendering/CellRendererRegistry.js +3 -3
  389. package/es-modules/Grid/Pro/CellRendering/CellRendererType.d.ts +1 -34
  390. package/es-modules/Grid/Pro/CellRendering/CellRendererType.js +15 -0
  391. package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.d.ts +1 -1
  392. package/es-modules/Grid/Pro/CellRendering/CellRenderersComposition.js +7 -5
  393. package/es-modules/Grid/Pro/CellRendering/ContentTypes/CheckboxContent.d.ts +2 -2
  394. package/es-modules/Grid/Pro/CellRendering/ContentTypes/CheckboxContent.js +3 -3
  395. package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContent.js +3 -3
  396. package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateInputContentBase.js +3 -3
  397. package/es-modules/Grid/Pro/CellRendering/ContentTypes/DateTimeInputContent.js +3 -3
  398. package/es-modules/Grid/Pro/CellRendering/ContentTypes/NumberInputContent.js +4 -5
  399. package/es-modules/Grid/Pro/CellRendering/ContentTypes/SelectContent.d.ts +2 -2
  400. package/es-modules/Grid/Pro/CellRendering/ContentTypes/SelectContent.js +3 -3
  401. package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.d.ts +7 -5
  402. package/es-modules/Grid/Pro/CellRendering/ContentTypes/SparklineContent.js +4 -5
  403. package/es-modules/Grid/Pro/CellRendering/ContentTypes/TextInputContent.d.ts +2 -2
  404. package/es-modules/Grid/Pro/CellRendering/ContentTypes/TextInputContent.js +4 -5
  405. package/es-modules/Grid/Pro/CellRendering/ContentTypes/TimeInputContent.js +3 -3
  406. package/es-modules/Grid/Pro/CellRendering/Renderers/CheckboxRenderer.js +4 -5
  407. package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRenderer.js +4 -5
  408. package/es-modules/Grid/Pro/CellRendering/Renderers/DateInputRendererBase.js +3 -3
  409. package/es-modules/Grid/Pro/CellRendering/Renderers/DateTimeInputRenderer.js +4 -5
  410. package/es-modules/Grid/Pro/CellRendering/Renderers/NumberInputRenderer.js +4 -5
  411. package/es-modules/Grid/Pro/CellRendering/Renderers/SelectRenderer.js +4 -5
  412. package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.d.ts +4 -4
  413. package/es-modules/Grid/Pro/CellRendering/Renderers/SparklineRenderer.js +4 -5
  414. package/es-modules/Grid/Pro/CellRendering/Renderers/TextInputRenderer.js +4 -5
  415. package/es-modules/Grid/Pro/CellRendering/Renderers/TextRenderer.js +4 -5
  416. package/es-modules/Grid/Pro/CellRendering/Renderers/TimeInputRenderer.js +4 -5
  417. package/es-modules/Grid/Pro/ColumnTypes/Validator.d.ts +10 -1
  418. package/es-modules/Grid/Pro/ColumnTypes/Validator.js +56 -12
  419. package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.d.ts +1 -1
  420. package/es-modules/Grid/Pro/ColumnTypes/ValidatorComposition.js +6 -7
  421. package/es-modules/Grid/Pro/Credits/CreditsPro.js +3 -3
  422. package/es-modules/Grid/Pro/Credits/CreditsProComposition.js +4 -6
  423. package/es-modules/Grid/Pro/Data/DataSourceHelper.d.ts +74 -0
  424. package/es-modules/Grid/Pro/Data/DataSourceHelper.js +246 -0
  425. package/es-modules/Grid/Pro/Data/QuerySerializer.d.ts +46 -0
  426. package/es-modules/Grid/Pro/Data/QuerySerializer.js +169 -0
  427. package/es-modules/Grid/Pro/Data/RemoteDataProvider.d.ts +187 -0
  428. package/es-modules/Grid/Pro/Data/RemoteDataProvider.js +500 -0
  429. package/es-modules/Grid/Pro/Export/Exporting.js +5 -7
  430. package/es-modules/Grid/Pro/Export/ExportingComposition.js +4 -5
  431. package/es-modules/Grid/Pro/GridEvents.d.ts +1 -0
  432. package/es-modules/Grid/Pro/GridEvents.js +4 -5
  433. package/es-modules/Grid/Pro/Pagination/PaginationComposition.d.ts +0 -1
  434. package/es-modules/Grid/Pro/Pagination/PaginationComposition.js +4 -5
  435. package/es-modules/Grid/index.js +3 -3
  436. package/es-modules/Shared/BaseForm.js +4 -5
  437. package/es-modules/Shared/DownloadURL.d.ts +1 -85
  438. package/es-modules/Shared/DownloadURL.js +15 -13
  439. package/es-modules/Shared/LangOptionsCore.d.ts +4 -3
  440. package/es-modules/Shared/TimeBase.d.ts +1 -46
  441. package/es-modules/Shared/TimeBase.js +11 -10
  442. package/es-modules/Shared/Types.d.ts +11 -3
  443. package/es-modules/Shared/Utilities.d.ts +576 -0
  444. package/es-modules/Shared/Utilities.js +1368 -0
  445. package/es-modules/masters/grid-pro.src.d.ts +18 -19
  446. package/es-modules/masters/grid-pro.src.js +24 -9
  447. package/grid-pro.d.ts +18 -19
  448. package/grid-pro.js +6 -5
  449. package/grid-pro.js.map +1 -1
  450. package/grid-pro.src.d.ts +18 -19
  451. package/grid-pro.src.js +8132 -4531
  452. package/package.json +1 -1
  453. package/es-modules/Grid/Core/Pagination/Icons.d.ts +0 -7
  454. package/es-modules/Grid/Core/Pagination/Icons.js +0 -7
  455. package/es-modules/Grid/Pro/highcharts.d.ts +0 -7
@@ -2,11 +2,11 @@
2
2
  *
3
3
  * Highcharts Grid class
4
4
  *
5
- * (c) 2020-2025 Highsoft AS
5
+ * (c) 2020-2026 Highsoft AS
6
6
  *
7
- * License: www.highcharts.com/license
7
+ * A commercial license may be required depending on use.
8
+ * See www.highcharts.com/license
8
9
  *
9
- * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
10
10
  *
11
11
  * Authors:
12
12
  * - Dawid Dragula
@@ -16,17 +16,17 @@
16
16
  'use strict';
17
17
  import Accessibility from './Accessibility/Accessibility.js';
18
18
  import AST from '../../Core/Renderer/HTML/AST.js';
19
- import { defaultOptions } from './Defaults.js';
20
- import GridUtils from './GridUtils.js';
19
+ import DataProviderRegistry from './Data/DataProviderRegistry.js';
21
20
  import DataTable from '../../Data/DataTable.js';
21
+ import { defaultOptions } from './Defaults.js';
22
+ import { makeHTMLElement, setHTMLContent, createOptionsProxy } from './GridUtils.js';
22
23
  import Table from './Table/Table.js';
23
- import U from '../../Core/Utilities.js';
24
24
  import QueryingController from './Querying/QueryingController.js';
25
25
  import Globals from './Globals.js';
26
26
  import TimeBase from '../../Shared/TimeBase.js';
27
27
  import Pagination from './Pagination/Pagination.js';
28
- const { makeHTMLElement, setHTMLContent } = GridUtils;
29
- const { defined, diffObjects, extend, fireEvent, getStyle, merge, pick } = U;
28
+ import { defined, diffObjects, extend, fireEvent, merge, pick } from '../../Shared/Utilities.js';
29
+ import { uniqueKey } from '../../Core/Utilities.js';
30
30
  /* *
31
31
  *
32
32
  * Class
@@ -85,11 +85,6 @@ export class Grid {
85
85
  * The list of currently shown popups.
86
86
  */
87
87
  this.popups = new Set();
88
- /**
89
- * Functions that unregister events attached to the grid's data table,
90
- * that need to be removed when the grid is destroyed.
91
- */
92
- this.dataTableEventDestructors = [];
93
88
  /**
94
89
  * Whether the Grid is rendered.
95
90
  */
@@ -100,9 +95,16 @@ export class Grid {
100
95
  * @internal
101
96
  */
102
97
  this.dirtyFlags = new Set();
98
+ /**
99
+ * Internal redraw queue used to prevent concurrent `redraw()` calls from
100
+ * interleaving async DOM work and corrupting the state (for example
101
+ * rendering duplicate pagination controls when `update()` is called
102
+ * multiple times without awaiting).
103
+ */
104
+ this.redrawQueue = Promise.resolve();
103
105
  this.renderTo = renderTo;
104
106
  this.loadUserOptions(options);
105
- this.id = this.options?.id || U.uniqueKey();
107
+ this.id = this.options?.id || uniqueKey();
106
108
  this.querying = new QueryingController(this);
107
109
  this.locale = this.options?.lang?.locale || (this.container?.closest('[lang]')?.lang);
108
110
  this.time = new TimeBase(extend(this.options?.time, { locale: this.locale }), this.options?.lang);
@@ -118,6 +120,31 @@ export class Grid {
118
120
  * Methods
119
121
  *
120
122
  * */
123
+ /**
124
+ * The data source of the Grid. It contains the original data table
125
+ * that was passed to the Grid.
126
+ *
127
+ * @deprecated Use `dataProvider` instead.
128
+ */
129
+ get dataTable() {
130
+ const dp = this.dataProvider;
131
+ if (dp && 'getDataTable' in dp) {
132
+ return dp.getDataTable();
133
+ }
134
+ }
135
+ /**
136
+ * The presentation table of the Grid. It contains a modified version
137
+ * of the data table that is used for rendering the Grid content. If
138
+ * not modified, just a reference to the original data table.
139
+ *
140
+ * @deprecated Use `dataProvider` instead.
141
+ */
142
+ get presentationTable() {
143
+ const dp = this.dataProvider;
144
+ if (dp && 'getDataTable' in dp) {
145
+ return dp.getDataTable(true);
146
+ }
147
+ }
121
148
  /*
122
149
  * Initializes the accessibility controller.
123
150
  */
@@ -153,8 +180,8 @@ export class Grid {
153
180
  throw new Error('Rendering div not found. It is unable to find the HTML ' +
154
181
  'element to render the Grid in.');
155
182
  }
156
- this.initialContainerHeight = getStyle(container, 'height', true) || 0;
157
183
  this.container = container;
184
+ this.container.style.minHeight = 0 + 'px';
158
185
  this.container.innerHTML = AST.emptyHTML;
159
186
  this.contentWrapper = makeHTMLElement('div', {
160
187
  className: Globals.getClassName('container')
@@ -195,6 +222,9 @@ export class Grid {
195
222
  merge(true, diff, diffObjects(newOptions, this.userOptions));
196
223
  this.userOptions = merge(this.userOptions, newOptions);
197
224
  this.options = merge(this.options ?? defaultOptions, this.userOptions);
225
+ this.viewport?.columns.forEach((column) => {
226
+ column.options = createOptionsProxy(this.columnOptionsMap?.[column.id]?.options ?? {}, this.options?.columnDefaults);
227
+ });
198
228
  return diff;
199
229
  }
200
230
  /**
@@ -330,7 +360,7 @@ export class Grid {
330
360
  * the ones that are currently defined in the user options. When `true`,
331
361
  * the columns not defined in the new options will be removed.
332
362
  */
333
- async update(options = {}, redraw = true, oneToOne = false) {
363
+ update(options = {}, redraw = true, oneToOne = false) {
334
364
  fireEvent(this, 'beforeUpdate', {
335
365
  scope: 'grid',
336
366
  options,
@@ -341,20 +371,28 @@ export class Grid {
341
371
  const diff = this.loadUserOptions(options, oneToOne);
342
372
  const flags = this.dirtyFlags;
343
373
  if (viewport) {
344
- if (!this.dataTable || 'dataTable' in diff) {
345
- this.userOptions.dataTable = options.dataTable;
346
- (this.options ?? {}).dataTable = options.dataTable;
347
- this.loadDataTable();
348
- // TODO: Sometimes it can be too much, so we need to check if
349
- // the columns have changed or just their data. If just their
350
- // data, we can just mark the grid.table as dirty instead of the
351
- // whole grid.
374
+ if (!this.dataProvider ||
375
+ ('data' in diff) ||
376
+ ('dataTable' in diff)) {
377
+ if ( // Handle backward compatibility
378
+ diff.dataTable &&
379
+ this.options?.dataTable &&
380
+ this.options?.data?.providerType === 'local') {
381
+ const userDT = this.options.dataTable;
382
+ this.options.data.dataTable = 'clone' in userDT ?
383
+ userDT : new DataTable(userDT);
384
+ }
385
+ this.loadDataProvider(); // Rebuild the data provider
386
+ // TODO(update): Sometimes it can be too much, so we need to
387
+ // check if the columns have changed or just their data. If
388
+ // just their data, we can just mark the grid.table as dirty
389
+ // instead of the whole grid.
352
390
  flags.add('grid');
353
391
  }
354
392
  if ('columns' in diff) {
355
393
  const ids = Object.keys(diff.columns ?? {});
356
394
  for (const id of ids) {
357
- // TODO: Move this to the column update method.
395
+ // TODO(update): Move this to the column update method.
358
396
  this.loadColumnOptionDiffs(viewport, id, diff.columns?.[id]);
359
397
  delete diff.columns?.[id];
360
398
  }
@@ -371,7 +409,7 @@ export class Grid {
371
409
  this.time.update({ locale: this.locale });
372
410
  }
373
411
  delete langDiff.locale;
374
- // TODO: Add more lang diff checks here.
412
+ // TODO(update): Add more lang diff checks here.
375
413
  if (Object.keys(langDiff).length > 0) {
376
414
  flags.add('grid');
377
415
  }
@@ -391,7 +429,7 @@ export class Grid {
391
429
  this.pagination?.update(paginationDiff);
392
430
  }
393
431
  delete diff.pagination;
394
- // TODO: Add more options that can be optimized here.
432
+ // TODO(update): Add more options that can be optimized here.
395
433
  if (Object.keys(diff).length > 0) {
396
434
  flags.add('grid');
397
435
  }
@@ -399,15 +437,18 @@ export class Grid {
399
437
  else {
400
438
  flags.add('grid');
401
439
  }
440
+ const finish = () => {
441
+ fireEvent(this, 'afterUpdate', {
442
+ scope: 'grid',
443
+ options,
444
+ redraw,
445
+ oneToOne
446
+ });
447
+ };
402
448
  if (redraw) {
403
- await this.redraw();
449
+ return this.redraw().then(finish);
404
450
  }
405
- fireEvent(this, 'afterUpdate', {
406
- scope: 'grid',
407
- options,
408
- redraw,
409
- oneToOne
410
- });
451
+ finish();
411
452
  }
412
453
  /**
413
454
  * Loads the column option diffs by updating the dirty flags.
@@ -439,8 +480,7 @@ export class Grid {
439
480
  const cellsDiff = columnDiff.cells ?? {};
440
481
  if ('format' in cellsDiff ||
441
482
  'formatter' in cellsDiff ||
442
- 'className' in cellsDiff // TODO: check if this too
443
- ) {
483
+ 'className' in cellsDiff) {
444
484
  // Optimization idea: list of columns to update
445
485
  flags.add('rows');
446
486
  }
@@ -464,6 +504,7 @@ export class Grid {
464
504
  }
465
505
  delete sortingDiff.compare;
466
506
  delete sortingDiff.order;
507
+ delete sortingDiff.orderSequence;
467
508
  // Idea: sortable - redraw only header cell
468
509
  if (Object.keys(sortingDiff).length > 0) {
469
510
  flags.add('grid');
@@ -493,50 +534,64 @@ export class Grid {
493
534
  * them minimizing the number of DOM operations.
494
535
  */
495
536
  async redraw() {
496
- fireEvent(this, 'beforeRedraw');
497
- const flags = this.dirtyFlags;
498
- if (flags.has('grid')) {
499
- return await this.render();
500
- }
501
- const { viewport: vp, pagination } = this;
502
- const colResizing = vp?.columnResizing;
503
- if (flags.has('sorting') ||
504
- flags.has('filtering') ||
505
- pagination?.isDirtyQuerying) {
506
- this.querying.loadOptions();
507
- }
508
- if (colResizing?.isDirty) {
509
- colResizing.loadColumns();
510
- }
511
- if (flags.has('rows') ||
512
- flags.has('sorting') ||
513
- flags.has('filtering') ||
514
- pagination?.isDirtyQuerying) {
515
- await vp?.updateRows();
516
- }
517
- else if (flags.has('reflow') ||
518
- colResizing?.isDirty) {
519
- vp?.reflow();
520
- }
521
- const columns = vp?.columns ?? [];
522
- if (flags.has('sorting') ||
523
- flags.has('filtering')) {
524
- for (const column of columns) {
525
- column.header?.toolbar?.refreshState();
537
+ const run = async () => {
538
+ fireEvent(this, 'beforeRedraw');
539
+ const flags = this.dirtyFlags;
540
+ const flagsToProcess = new Set(flags);
541
+ const { viewport: vp, pagination } = this;
542
+ const colResizing = vp?.columnResizing;
543
+ const paginationWasDirty = !!pagination?.isDirtyQuerying;
544
+ const colResizingWasDirty = !!colResizing?.isDirty;
545
+ if (flagsToProcess.has('grid')) {
546
+ await this.render(false);
547
+ for (const flag of flagsToProcess) {
548
+ flags.delete(flag);
549
+ }
550
+ fireEvent(this, 'afterRedraw');
551
+ return;
526
552
  }
527
- }
528
- if (flags.has('filtering')) {
529
- for (const column of columns) {
530
- column.filtering?.refreshState();
553
+ await this.dataProvider?.init();
554
+ if (flagsToProcess.has('sorting') ||
555
+ flagsToProcess.has('filtering') ||
556
+ paginationWasDirty) {
557
+ this.querying.loadOptions();
531
558
  }
532
- }
533
- if (pagination?.isDirtyQuerying) {
534
- pagination.updateControls(true);
535
- }
536
- delete pagination?.isDirtyQuerying;
537
- delete colResizing?.isDirty;
538
- flags.clear();
539
- fireEvent(this, 'afterRedraw');
559
+ if (colResizingWasDirty) {
560
+ colResizing?.loadColumns();
561
+ }
562
+ if (flagsToProcess.has('rows') ||
563
+ flagsToProcess.has('sorting') ||
564
+ flagsToProcess.has('filtering') ||
565
+ paginationWasDirty) {
566
+ await vp?.updateRows();
567
+ }
568
+ else if (flagsToProcess.has('reflow') ||
569
+ colResizingWasDirty) {
570
+ vp?.reflow();
571
+ }
572
+ const columns = vp?.columns ?? [];
573
+ if (flagsToProcess.has('sorting') ||
574
+ flagsToProcess.has('filtering')) {
575
+ for (const column of columns) {
576
+ column.header?.toolbar?.refreshState();
577
+ }
578
+ }
579
+ if (flagsToProcess.has('filtering')) {
580
+ for (const column of columns) {
581
+ column.filtering?.refreshState();
582
+ }
583
+ }
584
+ pagination?.redraw();
585
+ delete colResizing?.isDirty;
586
+ for (const flag of ['sorting', 'filtering']) {
587
+ flags.delete(flag);
588
+ }
589
+ fireEvent(this, 'afterRedraw');
590
+ };
591
+ const queued = this.redrawQueue.then(run, run);
592
+ // Keep the queue progressing even if one redraw fails.
593
+ this.redrawQueue = queued['catch'](() => void 0);
594
+ return queued;
540
595
  }
541
596
  /**
542
597
  * Updates the column of the Grid with new options.
@@ -583,19 +638,105 @@ export class Grid {
583
638
  columnId
584
639
  });
585
640
  }
586
- async render() {
641
+ /**
642
+ * Sets the sorting order for one or more columns. Provide the sortings
643
+ * in priority order. Use `null` to clear sorting.
644
+ *
645
+ * @param sortings
646
+ * The sorting definition in priority order.
647
+ */
648
+ async setSorting(sortings) {
649
+ const viewport = this.viewport;
650
+ if (!viewport) {
651
+ return;
652
+ }
653
+ if (viewport.validator?.errorCell) {
654
+ return;
655
+ }
656
+ const normalized = (sortings || []).filter((sorting) => !!(sorting.columnId && sorting.order));
657
+ const sortingController = this.querying.sorting;
658
+ const previousSortings = sortingController.currentSortings || [];
659
+ const eventColumnIds = new Set();
660
+ for (const sorting of previousSortings) {
661
+ if (sorting.columnId) {
662
+ eventColumnIds.add(sorting.columnId);
663
+ }
664
+ }
665
+ for (const sorting of normalized) {
666
+ eventColumnIds.add(sorting.columnId);
667
+ }
668
+ const eventColumns = Array.from(eventColumnIds)
669
+ .map((columnId) => {
670
+ const column = viewport.getColumn(columnId);
671
+ if (!column) {
672
+ return null;
673
+ }
674
+ const order = normalized.find((sorting) => sorting.columnId === columnId)?.order || null;
675
+ return { column, order };
676
+ })
677
+ .filter((item) => !!item);
678
+ for (const { column, order } of eventColumns) {
679
+ [column, this].forEach((source) => {
680
+ fireEvent(source, 'beforeSort', {
681
+ target: column,
682
+ order
683
+ });
684
+ });
685
+ }
686
+ sortingController.setSorting(normalized);
687
+ await viewport.updateRows();
688
+ const currentSortings = sortingController.currentSortings || [];
689
+ const hasMultiple = currentSortings.length > 1;
690
+ for (const column of viewport.columns) {
691
+ const sortingIndex = currentSortings.findIndex((sorting) => sorting.columnId === column.id);
692
+ if (sortingIndex !== -1 && currentSortings[sortingIndex].order) {
693
+ const sorting = currentSortings[sortingIndex];
694
+ const sortingOptions = {
695
+ order: sorting.order
696
+ };
697
+ if (hasMultiple) {
698
+ sortingOptions.priority = sortingIndex + 1;
699
+ }
700
+ column.setOptions({ sorting: sortingOptions });
701
+ if (!hasMultiple) {
702
+ delete column.options.sorting?.priority;
703
+ }
704
+ }
705
+ else {
706
+ delete column.options.sorting?.order;
707
+ delete column.options.sorting?.priority;
708
+ if (column.options.sorting &&
709
+ Object.keys(column.options.sorting).length < 1) {
710
+ delete column.options.sorting;
711
+ }
712
+ }
713
+ column.sorting?.refreshHeaderAttributes();
714
+ }
715
+ this.accessibility?.userSortedColumn(currentSortings[0]?.order || null);
716
+ for (const { column, order } of eventColumns) {
717
+ [column, this].forEach((source) => {
718
+ fireEvent(source, 'afterSort', {
719
+ target: column,
720
+ order
721
+ });
722
+ });
723
+ }
724
+ }
725
+ async render(clearDirtyFlags = true) {
587
726
  if (this.isRendered) {
588
727
  this.destroy(true);
589
728
  }
590
- this.loadDataTable();
729
+ await this.loadDataProvider().init();
591
730
  this.initContainer(this.renderTo);
592
731
  this.initAccessibility();
593
732
  this.initPagination();
594
733
  this.querying.loadOptions();
595
734
  await this.querying.proceed();
596
- this.renderViewport();
735
+ await this.renderViewport();
597
736
  this.isRendered = true;
598
- this.dirtyFlags.clear();
737
+ if (clearDirtyFlags) {
738
+ this.dirtyFlags.clear();
739
+ }
599
740
  }
600
741
  /**
601
742
  * Hovers the row with the provided index. It removes the hover effect from
@@ -685,20 +826,19 @@ export class Grid {
685
826
  */
686
827
  renderCaption() {
687
828
  const captionOptions = this.options?.caption;
688
- const captionText = captionOptions?.text;
689
- if (!captionText) {
829
+ if (!captionOptions?.text || !this.contentWrapper) {
690
830
  return;
691
831
  }
692
- // Create a caption element.
693
- this.captionElement = makeHTMLElement('div', {
694
- className: Globals.getClassName('captionElement'),
695
- id: this.id + '-caption'
696
- }, this.contentWrapper);
697
- // Render the caption element content.
698
- setHTMLContent(this.captionElement, captionText);
699
- if (captionOptions.className) {
700
- this.captionElement.classList.add(...captionOptions.className.split(/\s+/g));
701
- }
832
+ const tag = captionOptions.htmlTag?.toLowerCase();
833
+ const tagName = tag && AST.allowedTags.includes(tag) ? tag : 'div';
834
+ const defaultClass = Globals.getClassName('captionElement');
835
+ const className = captionOptions.className ?
836
+ `${defaultClass} ${captionOptions.className}` : defaultClass;
837
+ this.captionElement = new AST([{
838
+ tagName,
839
+ attributes: { 'class': className, id: this.id + '-caption' },
840
+ textContent: captionOptions.text
841
+ }]).addToDOM(this.contentWrapper);
702
842
  }
703
843
  /**
704
844
  * Render description under the grid.
@@ -741,11 +881,11 @@ export class Grid {
741
881
  * rendered, it will be destroyed and re-rendered with the new data.
742
882
  * @internal
743
883
  */
744
- renderViewport() {
884
+ async renderViewport() {
745
885
  const viewportMeta = this.viewport?.getStateMeta();
746
886
  const pagination = this.pagination;
747
887
  const paginationPosition = pagination?.options?.position;
748
- this.enabledColumns = this.getEnabledColumnIDs();
888
+ this.enabledColumns = await this.getEnabledColumnIDs();
749
889
  this.credits?.destroy();
750
890
  this.viewport?.destroy();
751
891
  delete this.viewport;
@@ -757,7 +897,8 @@ export class Grid {
757
897
  pagination?.render();
758
898
  }
759
899
  if (this.enabledColumns.length > 0) {
760
- this.viewport = this.renderTable();
900
+ this.viewport = await this.renderTable();
901
+ this.viewport.tableElement.setAttribute('id', this.id);
761
902
  if (viewportMeta && this.viewport) {
762
903
  this.viewport.applyStateMeta(viewportMeta);
763
904
  }
@@ -765,7 +906,7 @@ export class Grid {
765
906
  else {
766
907
  this.renderNoData();
767
908
  }
768
- this.accessibility?.setA11yOptions();
909
+ await this.renderAccessibility();
769
910
  // Render bottom pagination, footer pagination,
770
911
  // or custom container pagination (after table).
771
912
  if (paginationPosition !== 'top') {
@@ -775,18 +916,33 @@ export class Grid {
775
916
  fireEvent(this, 'afterRenderViewport');
776
917
  this.viewport?.reflow();
777
918
  }
919
+ /**
920
+ * Renders the Grid accessibility.
921
+ * @internal
922
+ */
923
+ async renderAccessibility() {
924
+ const accessibility = this.accessibility;
925
+ if (!accessibility) {
926
+ return;
927
+ }
928
+ await accessibility.setA11yOptions();
929
+ accessibility.addScreenReaderSection('before');
930
+ accessibility.addScreenReaderSection('after');
931
+ }
778
932
  /**
779
933
  * Renders the table (viewport) of the Grid.
780
934
  *
781
935
  * @returns
782
936
  * The newly rendered table (viewport) of the Grid.
783
937
  */
784
- renderTable() {
938
+ async renderTable() {
785
939
  this.tableElement = makeHTMLElement('table', {
786
940
  className: Globals.getClassName('tableElement')
787
941
  }, this.contentWrapper);
788
942
  this.tableElement.setAttribute('role', 'grid');
789
- return new Table(this, this.tableElement);
943
+ const table = new Table(this, this.tableElement);
944
+ await table.init();
945
+ return table;
790
946
  }
791
947
  /**
792
948
  * Renders a message that there is no data to display.
@@ -801,12 +957,12 @@ export class Grid {
801
957
  * Returns the array of IDs of columns that should be displayed in the data
802
958
  * grid, in the correct order.
803
959
  */
804
- getEnabledColumnIDs() {
960
+ async getEnabledColumnIDs() {
805
961
  const { columnOptionsMap } = this;
806
962
  const header = this.options?.header;
807
963
  const headerColumns = this.getColumnIds(header || [], false);
808
964
  const columnsIncluded = this.options?.rendering?.columns?.included || (headerColumns && headerColumns.length > 0 ?
809
- headerColumns : this.dataTable?.getColumnIds());
965
+ headerColumns : await this.dataProvider?.getColumnIds());
810
966
  if (!columnsIncluded?.length) {
811
967
  return [];
812
968
  }
@@ -823,37 +979,25 @@ export class Grid {
823
979
  }
824
980
  return result;
825
981
  }
826
- /**
827
- * Loads the data table of the Grid. If the data table is passed as a
828
- * reference, it should be used instead of creating a new one.
829
- */
830
- loadDataTable() {
982
+ loadDataProvider() {
983
+ this.dataProvider?.destroy();
831
984
  this.querying.shouldBeUpdated = true;
832
- // Unregister all events attached to the previous data table.
833
- this.dataTableEventDestructors.forEach((fn) => fn());
834
- const tableOptions = this.options?.dataTable;
835
- // If the table is passed as a reference, it should be used instead of
836
- // creating a new one.
837
- if (tableOptions?.clone) {
838
- this.dataTable = tableOptions;
839
- this.presentationTable = this.dataTable.getModified();
840
- return;
841
- }
842
- const dt = this.dataTable = this.presentationTable =
843
- new DataTable(tableOptions);
844
- // If the data table is modified, mark the querying controller to be
845
- // updated on the next proceed.
846
- [
847
- 'afterDeleteColumns',
848
- 'afterDeleteRows',
849
- 'afterSetCell',
850
- 'afterSetColumns',
851
- 'afterSetRows'
852
- ].forEach((eventName) => {
853
- this.dataTableEventDestructors.push(dt.on(eventName, () => {
854
- this.querying.shouldBeUpdated = true;
855
- }));
856
- });
985
+ const userDT = this.options?.dataTable;
986
+ const dataOptions = this.options?.data ?? {
987
+ providerType: 'local',
988
+ dataTable: userDT ?? {}
989
+ };
990
+ // Just for the backward compatibility, remove in the future
991
+ if (dataOptions.providerType === 'local' &&
992
+ !dataOptions.dataTable && userDT) {
993
+ dataOptions.dataTable = 'clone' in userDT ?
994
+ userDT : new DataTable(userDT);
995
+ }
996
+ // End of backward compatibility snippet
997
+ const DataProviderConstructor = DataProviderRegistry.types[dataOptions.providerType ?? 'local'] ??
998
+ DataProviderRegistry.types.local;
999
+ this.dataProvider = new DataProviderConstructor(this.querying, dataOptions);
1000
+ return this.dataProvider;
857
1001
  }
858
1002
  /**
859
1003
  * Extracts all references to columnIds on all levels below defined level
@@ -890,9 +1034,10 @@ export class Grid {
890
1034
  * after destruction by calling the `render` method.
891
1035
  */
892
1036
  destroy(onlyDOM = false) {
1037
+ fireEvent(this, 'beforeDestroy');
893
1038
  this.isRendered = false;
894
1039
  const dgIndex = Grid.grids.findIndex((dg) => dg === this);
895
- this.dataTableEventDestructors.forEach((fn) => fn());
1040
+ this.dataProvider?.destroy();
896
1041
  this.accessibility?.destroy();
897
1042
  this.pagination?.destroy();
898
1043
  this.viewport?.destroy();
@@ -943,6 +1088,11 @@ export class Grid {
943
1088
  /**
944
1089
  * Returns the grid data as a JSON string.
945
1090
  *
1091
+ * **Note:** This method only works with `LocalDataProvider`.
1092
+ * For other data providers, use your data source directly.
1093
+ *
1094
+ * @deprecated
1095
+ *
946
1096
  * @param modified
947
1097
  * Whether to return the modified data table (after filtering/sorting/etc.)
948
1098
  * or the unmodified, original one. Default value is set to `true`.
@@ -951,7 +1101,14 @@ export class Grid {
951
1101
  * JSON representation of the data
952
1102
  */
953
1103
  getData(modified = true) {
954
- const dataTable = modified ? this.presentationTable : this.dataTable;
1104
+ if (!this.dataProvider || !('getDataTable' in this.dataProvider)) {
1105
+ // eslint-disable-next-line no-console
1106
+ console.warn('getData() works only with LocalDataProvider.');
1107
+ return JSON.stringify({
1108
+ error: 'getData() works only with LocalDataProvider.'
1109
+ }, null, 2);
1110
+ }
1111
+ const dataTable = this.dataProvider.getDataTable(modified);
955
1112
  const tableColumns = dataTable?.columns;
956
1113
  const outputColumns = {};
957
1114
  if (!this.enabledColumns || !tableColumns) {
@@ -993,12 +1150,35 @@ export class Grid {
993
1150
  * Grid options.
994
1151
  */
995
1152
  getOptions(onlyUserOptions = true) {
996
- const options = onlyUserOptions ? merge(this.userOptions) : merge(this.options);
997
- if (options.dataTable?.id) {
1153
+ const options = onlyUserOptions ?
1154
+ merge(this.userOptions) :
1155
+ merge(this.options);
1156
+ // Keep `getOptions()` serializable:
1157
+ if (options.dataTable && 'clone' in options.dataTable) {
998
1158
  options.dataTable = {
999
1159
  columns: options.dataTable.columns
1000
1160
  };
1001
1161
  }
1162
+ if (options.data?.providerType === 'local') {
1163
+ if (options.data?.dataTable && 'clone' in options.data.dataTable) {
1164
+ options.data.columns = options.data.dataTable.columns;
1165
+ }
1166
+ if (options.data?.connector &&
1167
+ 'initConverters' in options.data.connector) {
1168
+ options.data.connector = options.data.connector.options;
1169
+ }
1170
+ }
1171
+ // Clean up the column options by removing the ones that have no other
1172
+ // options than `id`:
1173
+ const oldColumnOptions = options.columns;
1174
+ if (oldColumnOptions) {
1175
+ options.columns = [];
1176
+ for (const columnOption of oldColumnOptions) {
1177
+ if (Object.keys(columnOption).length > 1) {
1178
+ options.columns.push(columnOption);
1179
+ }
1180
+ }
1181
+ }
1002
1182
  return options;
1003
1183
  }
1004
1184
  }