@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
@@ -0,0 +1,1368 @@
1
+ /* *
2
+ *
3
+ * (c) 2009-2026 Highsoft AS
4
+ *
5
+ * A commercial license may be required depending on use.
6
+ * See www.highcharts.com/license
7
+ *
8
+ *
9
+ * */
10
+ import H from '../Core/Globals.js';
11
+ const { doc, win } = H;
12
+ /* eslint-disable valid-jsdoc */
13
+ /**
14
+ * Add an event listener.
15
+ *
16
+ * @function Highcharts.addEvent<T>
17
+ *
18
+ * @param {Highcharts.Class<T>|T} el
19
+ * The element or object to add a listener to. It can be a
20
+ * {@link HTMLDOMElement}, an {@link SVGElement} or any other object.
21
+ *
22
+ * @param {string} type
23
+ * The event type.
24
+ *
25
+ * @param {Highcharts.EventCallbackFunction<T>|Function} fn
26
+ * The function callback to execute when the event is fired.
27
+ *
28
+ * @param {Highcharts.EventOptionsObject} [options]
29
+ * Options for adding the event.
30
+ *
31
+ * @sample highcharts/members/addevent
32
+ * Use a general `render` event to draw shapes on a chart
33
+ *
34
+ * @return {Function}
35
+ * A callback function to remove the added event.
36
+ */
37
+ export function addEvent(el, type, fn, options = {}) {
38
+ /* eslint-enable valid-jsdoc */
39
+ // Add hcEvents to either the prototype (in case we're running addEvent on a
40
+ // class) or the instance. If hasOwnProperty('hcEvents') is false, it is
41
+ // inherited down the prototype chain, in which case we need to set the
42
+ // property on this instance (which may itself be a prototype).
43
+ const owner = typeof el === 'function' && el.prototype || el;
44
+ if (!Object.hasOwnProperty.call(owner, 'hcEvents')) {
45
+ owner.hcEvents = {};
46
+ }
47
+ const events = owner.hcEvents;
48
+ // Allow click events added to points, otherwise they will be prevented by
49
+ // the TouchPointer.pinch function after a pinch zoom operation (#7091).
50
+ if (H.Point && // Without H a dependency loop occurs
51
+ el instanceof H.Point &&
52
+ el.series &&
53
+ el.series.chart) {
54
+ el.series.chart.runTrackerClick = true;
55
+ }
56
+ // Handle DOM events
57
+ // If the browser supports passive events, add it to improve performance
58
+ // on touch events (#11353).
59
+ const addEventListener = el.addEventListener;
60
+ if (addEventListener) {
61
+ addEventListener.call(el, type, fn, H.supportsPassiveEvents ? {
62
+ passive: options.passive === void 0 ?
63
+ type.indexOf('touch') !== -1 : options.passive,
64
+ capture: false
65
+ } : false);
66
+ }
67
+ if (!events[type]) {
68
+ events[type] = [];
69
+ }
70
+ const eventObject = {
71
+ fn,
72
+ order: typeof options.order === 'number' ? options.order : Infinity
73
+ };
74
+ events[type].push(eventObject);
75
+ // Order the calls
76
+ events[type].sort((a, b) => a.order - b.order);
77
+ // Return a function that can be called to remove this event.
78
+ return function () {
79
+ removeEvent(el, type, fn);
80
+ };
81
+ }
82
+ /**
83
+ * Non-recursive method to find the lowest member of an array. `Math.min` raises
84
+ * a maximum call stack size exceeded error in Chrome when trying to apply more
85
+ * than 150.000 points. This method is slightly slower, but safe.
86
+ *
87
+ * @function Highcharts.arrayMin
88
+ *
89
+ * @param {Array<*>} data
90
+ * An array of numbers.
91
+ *
92
+ * @return {number}
93
+ * The lowest number.
94
+ */
95
+ export function arrayMin(data) {
96
+ let i = data.length, min = data[0];
97
+ while (i--) {
98
+ if (data[i] < min) {
99
+ min = data[i];
100
+ }
101
+ }
102
+ return min;
103
+ }
104
+ /**
105
+ * Non-recursive method to find the lowest member of an array. `Math.max` raises
106
+ * a maximum call stack size exceeded error in Chrome when trying to apply more
107
+ * than 150.000 points. This method is slightly slower, but safe.
108
+ *
109
+ * @function Highcharts.arrayMax
110
+ *
111
+ * @param {Array<*>} data
112
+ * An array of numbers.
113
+ *
114
+ * @return {number}
115
+ * The highest number.
116
+ */
117
+ export function arrayMax(data) {
118
+ let i = data.length, max = data[0];
119
+ while (i--) {
120
+ if (data[i] > max) {
121
+ max = data[i];
122
+ }
123
+ }
124
+ return max;
125
+ }
126
+ /**
127
+ * Set or get an attribute or an object of attributes.
128
+ *
129
+ * To use as a setter, pass a key and a value, or let the second argument be a
130
+ * collection of keys and values. When using a collection, passing a value of
131
+ * `null` or `undefined` will remove the attribute.
132
+ *
133
+ * To use as a getter, pass only a string as the second argument.
134
+ *
135
+ * @function Highcharts.attr
136
+ *
137
+ * @param {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement} elem
138
+ * The DOM element to receive the attribute(s).
139
+ *
140
+ * @param {string|Highcharts.HTMLAttributes|Highcharts.SVGAttributes} [keyOrAttribs]
141
+ * The property or an object of key-value pairs.
142
+ *
143
+ * @param {number|string} [value]
144
+ * The value if a single property is set.
145
+ *
146
+ * @return {string|null|undefined}
147
+ * When used as a getter, return the value.
148
+ */
149
+ export function attr(elem, keyOrAttribs, value) {
150
+ const isGetter = isString(keyOrAttribs) && !defined(value);
151
+ let ret;
152
+ const attrSingle = (value, key) => {
153
+ // Set the value
154
+ if (defined(value)) {
155
+ elem.setAttribute(key, value);
156
+ // Get the value
157
+ }
158
+ else if (isGetter) {
159
+ ret = elem.getAttribute(key);
160
+ // IE7 and below cannot get class through getAttribute (#7850)
161
+ if (!ret && key === 'class') {
162
+ ret = elem.getAttribute(key + 'Name');
163
+ }
164
+ // Remove the value
165
+ }
166
+ else {
167
+ elem.removeAttribute(key);
168
+ }
169
+ };
170
+ // If keyOrAttribs is a string
171
+ if (isString(keyOrAttribs)) {
172
+ attrSingle(value, keyOrAttribs);
173
+ // Else if keyOrAttribs is defined, it is a hash of key/value pairs
174
+ }
175
+ else {
176
+ objectEach(keyOrAttribs, attrSingle);
177
+ }
178
+ return ret;
179
+ }
180
+ /**
181
+ * Constrain a value to within a lower and upper threshold.
182
+ *
183
+ * @internal
184
+ * @param {number} value The initial value
185
+ * @param {number} min The lower threshold
186
+ * @param {number} max The upper threshold
187
+ * @return {number} Returns a number value within min and max.
188
+ */
189
+ export function clamp(value, min, max) {
190
+ return value > min ? value < max ? value : max : min;
191
+ }
192
+ /**
193
+ * Fix JS round off float errors.
194
+ *
195
+ * @function Highcharts.correctFloat
196
+ *
197
+ * @param {number} num
198
+ * A float number to fix.
199
+ *
200
+ * @param {number} [prec=14]
201
+ * The precision.
202
+ *
203
+ * @return {number}
204
+ * The corrected float number.
205
+ */
206
+ export function correctFloat(num, prec) {
207
+ // When the number is higher than 1e14 use the number (#16275)
208
+ return num > 1e14 ? num : parseFloat(num.toPrecision(prec || 14));
209
+ }
210
+ /**
211
+ * Utility function to create an HTML element with attributes and styles.
212
+ *
213
+ * @function Highcharts.createElement
214
+ *
215
+ * @param {string} tag
216
+ * The HTML tag.
217
+ *
218
+ * @param {Highcharts.HTMLAttributes} [attribs]
219
+ * Attributes as an object of key-value pairs.
220
+ *
221
+ * @param {Highcharts.CSSObject} [styles]
222
+ * Styles as an object of key-value pairs.
223
+ *
224
+ * @param {Highcharts.HTMLDOMElement} [parent]
225
+ * The parent HTML object.
226
+ *
227
+ * @param {boolean} [nopad=false]
228
+ * If true, remove all padding, border and margin.
229
+ *
230
+ * @return {Highcharts.HTMLDOMElement}
231
+ * The created DOM element.
232
+ */
233
+ export function createElement(tag, attribs, styles, parent, nopad) {
234
+ const el = doc.createElement(tag);
235
+ if (attribs) {
236
+ extend(el, attribs);
237
+ }
238
+ if (nopad) {
239
+ css(el, { padding: '0', border: 'none', margin: '0' });
240
+ }
241
+ if (styles) {
242
+ css(el, styles);
243
+ }
244
+ if (parent) {
245
+ parent.appendChild(el);
246
+ }
247
+ return el;
248
+ }
249
+ /**
250
+ * Utility for crisping a line position to the nearest full pixel depening on
251
+ * the line width
252
+ *
253
+ * @internal
254
+ * @param {number} value The raw pixel position
255
+ * @param {number} lineWidth The line width
256
+ * @param {boolean} [inverted] Whether the containing group is inverted.
257
+ * Crisping round numbers on the y-scale need to go
258
+ * to the other side because the coordinate system
259
+ * is flipped (scaleY is -1)
260
+ * @return {number} The pixel position to use for a crisp display
261
+ */
262
+ export function crisp(value, lineWidth = 0, inverted) {
263
+ const mod = lineWidth % 2 / 2, inverter = inverted ? -1 : 1;
264
+ return (Math.round(value * inverter - mod) + mod) * inverter;
265
+ }
266
+ /**
267
+ * Set CSS on a given element.
268
+ *
269
+ * @function Highcharts.css
270
+ *
271
+ * @param {Highcharts.HTMLDOMElement|Highcharts.SVGDOMElement} el
272
+ * An HTML DOM element.
273
+ *
274
+ * @param {Highcharts.CSSObject} styles
275
+ * Style object with camel case property names.
276
+ *
277
+ * @return {void}
278
+ */
279
+ export function css(el, styles) {
280
+ extend(el.style, styles);
281
+ }
282
+ /**
283
+ * Check if an object is null or undefined.
284
+ *
285
+ * @function Highcharts.defined
286
+ *
287
+ * @param {*} obj
288
+ * The object to check.
289
+ *
290
+ * @return {boolean}
291
+ * False if the object is null or undefined, otherwise true.
292
+ */
293
+ export function defined(obj) {
294
+ return typeof obj !== 'undefined' && obj !== null;
295
+ }
296
+ /**
297
+ * Utility method that destroys any SVGElement instances that are properties on
298
+ * the given object. It loops all properties and invokes destroy if there is a
299
+ * destroy method. The property is then delete.
300
+ *
301
+ * @function Highcharts.destroyObjectProperties
302
+ *
303
+ * @param {*} obj
304
+ * The object to destroy properties on.
305
+ *
306
+ * @param {*} [except]
307
+ * Exception, do not destroy this property, only delete it.
308
+ */
309
+ export function destroyObjectProperties(obj, except, destructablesOnly) {
310
+ objectEach(obj, function (val, n) {
311
+ // If the object is non-null and destroy is defined
312
+ if (val !== except && val?.destroy) {
313
+ // Invoke the destroy
314
+ val.destroy();
315
+ }
316
+ // Delete the property from the object
317
+ if (val?.destroy || !destructablesOnly) {
318
+ delete obj[n];
319
+ }
320
+ });
321
+ }
322
+ /**
323
+ * Discard a HTML element
324
+ *
325
+ * @function Highcharts.discardElement
326
+ *
327
+ * @param {Highcharts.HTMLDOMElement} element
328
+ * The HTML node to discard.
329
+ */
330
+ export function discardElement(element) {
331
+ element?.parentElement?.removeChild(element);
332
+ }
333
+ // eslint-disable-next-line valid-jsdoc
334
+ /**
335
+ * Return the deep difference between two objects. It can either return the new
336
+ * properties, or optionally return the old values of new properties.
337
+ * @internal
338
+ */
339
+ export function diffObjects(newer, older, keepOlder, collectionsWithUpdate) {
340
+ const ret = {};
341
+ /**
342
+ * Recurse over a set of options and its current values, and store the
343
+ * current values in the ret object.
344
+ */
345
+ function diff(newer, older, ret, depth) {
346
+ const keeper = keepOlder ? older : newer;
347
+ objectEach(newer, function (newerVal, key) {
348
+ if (!depth &&
349
+ collectionsWithUpdate &&
350
+ collectionsWithUpdate.indexOf(key) > -1 &&
351
+ older[key]) {
352
+ newerVal = splat(newerVal);
353
+ ret[key] = [];
354
+ // Iterate over collections like series, xAxis or yAxis and map
355
+ // the items by index.
356
+ for (let i = 0; i < Math.max(newerVal.length, older[key].length); i++) {
357
+ // Item exists in current data (#6347)
358
+ if (older[key][i]) {
359
+ // If the item is missing from the new data, we need to
360
+ // save the whole config structure. Like when
361
+ // responsively updating from a dual axis layout to a
362
+ // single axis and back (#13544).
363
+ if (newerVal[i] === void 0) {
364
+ ret[key][i] = older[key][i];
365
+ // Otherwise, proceed
366
+ }
367
+ else {
368
+ ret[key][i] = {};
369
+ diff(newerVal[i], older[key][i], ret[key][i], depth + 1);
370
+ }
371
+ }
372
+ }
373
+ }
374
+ else if (isObject(newerVal, true) &&
375
+ !newerVal.nodeType // #10044
376
+ ) {
377
+ ret[key] = isArray(newerVal) ? [] : {};
378
+ diff(newerVal, older[key] || {}, ret[key], depth + 1);
379
+ // Delete empty nested objects
380
+ if (Object.keys(ret[key]).length === 0 &&
381
+ // Except colorAxis which is a special case where the empty
382
+ // object means it is enabled. Which is unfortunate and we
383
+ // should try to find a better way.
384
+ !(key === 'colorAxis' && depth === 0)) {
385
+ delete ret[key];
386
+ }
387
+ }
388
+ else if (newer[key] !== older[key] ||
389
+ // If the newer key is explicitly undefined, keep it (#10525)
390
+ (key in newer && !(key in older))) {
391
+ if (key !== '__proto__' && key !== 'constructor') {
392
+ ret[key] = keeper[key];
393
+ }
394
+ }
395
+ });
396
+ }
397
+ diff(newer, older, ret, 0);
398
+ return ret;
399
+ }
400
+ /**
401
+ * Remove the last occurence of an item from an array.
402
+ *
403
+ * @function Highcharts.erase
404
+ *
405
+ * @param {Array<*>} arr
406
+ * The array.
407
+ *
408
+ * @param {*} item
409
+ * The item to remove.
410
+ *
411
+ * @return {void}
412
+ */
413
+ export function erase(arr, item) {
414
+ let i = arr.length;
415
+ while (i--) {
416
+ if (arr[i] === item) {
417
+ arr.splice(i, 1);
418
+ break;
419
+ }
420
+ }
421
+ }
422
+ /**
423
+ * Utility function to extend an object with the members of another.
424
+ *
425
+ * @function Highcharts.extend<T>
426
+ *
427
+ * @param {T|undefined} a
428
+ * The object to be extended.
429
+ *
430
+ * @param {Partial<T>} b
431
+ * The object to add to the first one.
432
+ *
433
+ * @return {T}
434
+ * Object a, the original object.
435
+ */
436
+ export function extend(a, b) {
437
+ /* eslint-enable valid-jsdoc */
438
+ let n;
439
+ if (!a) {
440
+ a = {};
441
+ }
442
+ for (n in b) { // eslint-disable-line guard-for-in
443
+ a[n] = b[n];
444
+ }
445
+ return a;
446
+ }
447
+ // eslint-disable-next-line valid-jsdoc
448
+ /**
449
+ * Extend a prototyped class by new members.
450
+ *
451
+ * @deprecated
452
+ * @function Highcharts.extendClass<T>
453
+ *
454
+ * @param {Highcharts.Class<T>} parent
455
+ * The parent prototype to inherit.
456
+ *
457
+ * @param {Highcharts.Dictionary<*>} members
458
+ * A collection of prototype members to add or override compared to the
459
+ * parent prototype.
460
+ *
461
+ * @return {Highcharts.Class<T>}
462
+ * A new prototype.
463
+ */
464
+ export function extendClass(parent, members) {
465
+ const obj = (function () { });
466
+ obj.prototype = new parent(); // eslint-disable-line new-cap
467
+ extend(obj.prototype, members);
468
+ return obj;
469
+ }
470
+ /* eslint-disable valid-jsdoc */
471
+ /**
472
+ * Fire an event that was registered with {@link Highcharts#addEvent}.
473
+ *
474
+ * @function Highcharts.fireEvent<T>
475
+ *
476
+ * @param {T} el
477
+ * The object to fire the event on. It can be a {@link HTMLDOMElement},
478
+ * an {@link SVGElement} or any other object.
479
+ *
480
+ * @param {string} type
481
+ * The type of event.
482
+ *
483
+ * @param {Highcharts.Dictionary<*>|Event} [eventArguments]
484
+ * Custom event arguments that are passed on as an argument to the event
485
+ * handler.
486
+ *
487
+ * @param {Highcharts.EventCallbackFunction<T>|Function} [defaultFunction]
488
+ * The default function to execute if the other listeners haven't
489
+ * returned false.
490
+ *
491
+ * @return {void}
492
+ */
493
+ export function fireEvent(el, type, eventArguments, defaultFunction) {
494
+ /* eslint-enable valid-jsdoc */
495
+ eventArguments = eventArguments || {};
496
+ if (doc?.createEvent &&
497
+ (el.dispatchEvent ||
498
+ (el.fireEvent &&
499
+ // Enable firing events on Highcharts instance.
500
+ el !== H))) {
501
+ const e = doc.createEvent('Events');
502
+ e.initEvent(type, true, true);
503
+ eventArguments = extend(e, eventArguments);
504
+ if (el.dispatchEvent) {
505
+ el.dispatchEvent(eventArguments);
506
+ }
507
+ else {
508
+ el.fireEvent(type, eventArguments);
509
+ }
510
+ }
511
+ else if (el.hcEvents) {
512
+ if (!eventArguments.target) {
513
+ // We're running a custom event
514
+ extend(eventArguments, {
515
+ // Attach a simple preventDefault function to skip
516
+ // default handler if called. The built-in
517
+ // defaultPrevented property is not overwritable (#5112)
518
+ preventDefault: function () {
519
+ eventArguments.defaultPrevented = true;
520
+ },
521
+ // Setting target to native events fails with clicking
522
+ // the zoom-out button in Chrome.
523
+ target: el,
524
+ // If the type is not set, we're running a custom event
525
+ // (#2297). If it is set, we're running a browser event.
526
+ type: type
527
+ });
528
+ }
529
+ const events = [];
530
+ let object = el;
531
+ let multilevel = false;
532
+ // Recurse up the inheritance chain and collect hcEvents set as own
533
+ // objects on the prototypes.
534
+ while (object.hcEvents) {
535
+ if (Object.hasOwnProperty.call(object, 'hcEvents') &&
536
+ object.hcEvents[type]) {
537
+ if (events.length) {
538
+ multilevel = true;
539
+ }
540
+ events.unshift.apply(events, object.hcEvents[type]);
541
+ }
542
+ object = Object.getPrototypeOf(object);
543
+ }
544
+ // For performance reasons, only sort the event handlers in case we are
545
+ // dealing with multiple levels in the prototype chain. Otherwise, the
546
+ // events are already sorted in the addEvent function.
547
+ if (multilevel) {
548
+ // Order the calls
549
+ events.sort((a, b) => a.order - b.order);
550
+ }
551
+ // Call the collected event handlers
552
+ events.forEach((obj) => {
553
+ // If the event handler returns false, prevent the default handler
554
+ // from executing
555
+ if (obj.fn.call(el, eventArguments, el) === false) {
556
+ eventArguments.preventDefault();
557
+ }
558
+ });
559
+ }
560
+ // Run the default if not prevented
561
+ if (defaultFunction && !eventArguments.defaultPrevented) {
562
+ defaultFunction.call(el, eventArguments);
563
+ }
564
+ }
565
+ /**
566
+ * Convenience function to get the align factor, used several places for
567
+ * computing positions
568
+ * @internal
569
+ */
570
+ export const getAlignFactor = (align = '') => ({
571
+ center: 0.5,
572
+ right: 1,
573
+ middle: 0.5,
574
+ bottom: 1
575
+ }[align] || 0);
576
+ /**
577
+ * Find the closest distance between two values of a two-dimensional array
578
+ * @internal
579
+ * @function Highcharts.getClosestDistance
580
+ *
581
+ * @param {Array<Array<number>>} arrays
582
+ * An array of arrays of numbers
583
+ *
584
+ * @return {number | undefined}
585
+ * The closest distance between values
586
+ */
587
+ export function getClosestDistance(arrays, onError) {
588
+ const allowNegative = !onError;
589
+ let closest, loopLength, distance, i;
590
+ arrays.forEach((xData) => {
591
+ if (xData.length > 1) {
592
+ loopLength = xData.length - 1;
593
+ for (i = loopLength; i > 0; i--) {
594
+ distance = xData[i] - xData[i - 1];
595
+ if (distance < 0 && !allowNegative) {
596
+ onError?.();
597
+ // Only one call
598
+ onError = void 0;
599
+ }
600
+ else if (distance && (typeof closest === 'undefined' || distance < closest)) {
601
+ closest = distance;
602
+ }
603
+ }
604
+ }
605
+ });
606
+ return closest;
607
+ }
608
+ /**
609
+ * Get the magnitude of a number.
610
+ *
611
+ * @function Highcharts.getMagnitude
612
+ *
613
+ * @param {number} num
614
+ * The number.
615
+ *
616
+ * @return {number}
617
+ * The magnitude, where 1-9 are magnitude 1, 10-99 magnitude 2 etc.
618
+ */
619
+ export function getMagnitude(num) {
620
+ return Math.pow(10, Math.floor(Math.log(num) / Math.LN10));
621
+ }
622
+ /**
623
+ * Returns the value of a property path on a given object.
624
+ *
625
+ * @internal
626
+ * @function getNestedProperty
627
+ *
628
+ * @param {string} path
629
+ * Path to the property, for example `custom.myValue`.
630
+ *
631
+ * @param {unknown} obj
632
+ * Instance containing the property on the specific path.
633
+ *
634
+ * @return {unknown}
635
+ * The unknown property value.
636
+ */
637
+ export function getNestedProperty(path, parent) {
638
+ const pathElements = path.split('.');
639
+ while (pathElements.length && defined(parent)) {
640
+ const pathElement = pathElements.shift();
641
+ // Filter on the key
642
+ if (typeof pathElement === 'undefined' ||
643
+ pathElement === '__proto__') {
644
+ return; // Undefined
645
+ }
646
+ if (pathElement === 'this') {
647
+ let thisProp;
648
+ if (isObject(parent)) {
649
+ thisProp = parent['@this'];
650
+ }
651
+ return thisProp ?? parent;
652
+ }
653
+ const child = parent[pathElement.replace(/[\\'"]/g, '')];
654
+ // Filter on the child
655
+ if (!defined(child) ||
656
+ typeof child === 'function' ||
657
+ typeof child.nodeType === 'number' ||
658
+ child === win) {
659
+ return; // Undefined
660
+ }
661
+ // Else, proceed
662
+ parent = child;
663
+ }
664
+ return parent;
665
+ }
666
+ /**
667
+ * Get the computed CSS value for given element and property, only for numerical
668
+ * properties. For width and height, the dimension of the inner box (excluding
669
+ * padding) is returned. Used for fitting the chart within the container.
670
+ *
671
+ * @function Highcharts.getStyle
672
+ *
673
+ * @param {Highcharts.HTMLDOMElement} el
674
+ * An HTML element.
675
+ *
676
+ * @param {string} prop
677
+ * The property name.
678
+ *
679
+ * @param {boolean} [toInt=true]
680
+ * Parse to integer.
681
+ *
682
+ * @return {number|string|undefined}
683
+ * The style value.
684
+ */
685
+ export function getStyle(el, prop, toInt) {
686
+ let style;
687
+ // For width and height, return the actual inner pixel size (#4913)
688
+ if (prop === 'width') {
689
+ let offsetWidth = Math.min(el.offsetWidth, el.scrollWidth);
690
+ // In flex boxes, we need to use getBoundingClientRect and floor it,
691
+ // because scrollWidth doesn't support subpixel precision (#6427) ...
692
+ const boundingClientRectWidth = el.getBoundingClientRect?.().width;
693
+ // ...unless if the containing div or its parents are transform-scaled
694
+ // down, in which case the boundingClientRect can't be used as it is
695
+ // also scaled down (#9871, #10498).
696
+ if (boundingClientRectWidth < offsetWidth &&
697
+ boundingClientRectWidth >= offsetWidth - 1) {
698
+ offsetWidth = Math.floor(boundingClientRectWidth);
699
+ }
700
+ return Math.max(0, // #8377
701
+ (offsetWidth -
702
+ (getStyle(el, 'padding-left', true) || 0) -
703
+ (getStyle(el, 'padding-right', true) || 0)));
704
+ }
705
+ if (prop === 'height') {
706
+ return Math.max(0, // #8377
707
+ (Math.min(el.offsetHeight, el.scrollHeight) -
708
+ (getStyle(el, 'padding-top', true) || 0) -
709
+ (getStyle(el, 'padding-bottom', true) || 0)));
710
+ }
711
+ // Otherwise, get the computed style
712
+ const css = win.getComputedStyle(el, void 0); // eslint-disable-line no-undefined
713
+ if (css) {
714
+ style = css.getPropertyValue(prop);
715
+ if (pick(toInt, prop !== 'opacity')) {
716
+ style = pInt(style);
717
+ }
718
+ }
719
+ return style;
720
+ }
721
+ /**
722
+ * Return the value of the first element in the array that satisfies the
723
+ * provided testing function.
724
+ *
725
+ * @function Highcharts.find<T>
726
+ *
727
+ * @param {Array<T>} arr
728
+ * The array to test.
729
+ *
730
+ * @param {Function} callback
731
+ * The callback function. The function receives the item as the first
732
+ * argument. Return `true` if this item satisfies the condition.
733
+ *
734
+ * @return {T|undefined}
735
+ * The value of the element.
736
+ */
737
+ export const find = Array.prototype.find ?
738
+ function (arr, callback) {
739
+ return arr.find(callback);
740
+ } :
741
+ // Legacy implementation. PhantomJS, IE <= 11 etc. #7223.
742
+ function (arr, callback) {
743
+ let i;
744
+ const length = arr.length;
745
+ for (i = 0; i < length; i++) {
746
+ if (callback(arr[i], i)) { // eslint-disable-line node/callback-return
747
+ return arr[i];
748
+ }
749
+ }
750
+ };
751
+ /**
752
+ * Internal clear timeout. The function checks that the `id` was not removed
753
+ * (e.g. by `chart.destroy()`). For the details see
754
+ * [issue #7901](https://github.com/highcharts/highcharts/issues/7901).
755
+ *
756
+ * @internal
757
+ *
758
+ * @function Highcharts.clearTimeout
759
+ *
760
+ * @param {number|undefined} id
761
+ * Id of a timeout.
762
+ */
763
+ export function internalClearTimeout(id) {
764
+ if (defined(id)) {
765
+ clearTimeout(id);
766
+ }
767
+ }
768
+ /**
769
+ * Utility function to check if an Object is a HTML Element.
770
+ *
771
+ * @function Highcharts.isDOMElement
772
+ *
773
+ * @param {*} obj
774
+ * The item to check.
775
+ *
776
+ * @return {boolean}
777
+ * True if the argument is a HTML Element.
778
+ */
779
+ export function isDOMElement(obj) {
780
+ return isObject(obj) && typeof obj.nodeType === 'number';
781
+ }
782
+ /**
783
+ * Utility function to check if an Object is a class.
784
+ *
785
+ * @function Highcharts.isClass
786
+ *
787
+ * @param {object|undefined} obj
788
+ * The item to check.
789
+ *
790
+ * @return {boolean}
791
+ * True if the argument is a class.
792
+ */
793
+ export function isClass(obj) {
794
+ const c = obj?.constructor;
795
+ return !!(isObject(obj, true) &&
796
+ !isDOMElement(obj) &&
797
+ (c?.name && c.name !== 'Object'));
798
+ }
799
+ /**
800
+ * Utility function to check if an item is a number and it is finite (not NaN,
801
+ * Infinity or -Infinity).
802
+ *
803
+ * @function Highcharts.isNumber
804
+ *
805
+ * @param {*} n
806
+ * The item to check.
807
+ *
808
+ * @return {boolean}
809
+ * True if the item is a finite number
810
+ */
811
+ export function isNumber(n) {
812
+ return typeof n === 'number' && !isNaN(n) && n < Infinity && n > -Infinity;
813
+ }
814
+ /**
815
+ * Utility function to check for string type.
816
+ *
817
+ * @function Highcharts.isString
818
+ *
819
+ * @param {*} s
820
+ * The item to check.
821
+ *
822
+ * @return {boolean}
823
+ * True if the argument is a string.
824
+ */
825
+ export function isString(s) {
826
+ return typeof s === 'string';
827
+ }
828
+ /**
829
+ * Utility function to check if an item is an array.
830
+ *
831
+ * @function Highcharts.isArray
832
+ *
833
+ * @param {*} obj
834
+ * The item to check.
835
+ *
836
+ * @return {boolean}
837
+ * True if the argument is an array.
838
+ */
839
+ export function isArray(obj) {
840
+ const str = Object.prototype.toString.call(obj);
841
+ return str === '[object Array]' || str === '[object Array Iterator]';
842
+ }
843
+ /**
844
+ * Utility function to check if object is a function.
845
+ *
846
+ * @function Highcharts.isFunction
847
+ *
848
+ * @param {*} obj
849
+ * The item to check.
850
+ *
851
+ * @return {boolean}
852
+ * True if the argument is a function.
853
+ */
854
+ export function isFunction(obj) {
855
+ return typeof obj === 'function';
856
+ }
857
+ /**
858
+ * Utility function to check if an item is of type object.
859
+ *
860
+ * @function Highcharts.isObject
861
+ *
862
+ * @param {*} obj
863
+ * The item to check.
864
+ *
865
+ * @param {boolean} [strict=false]
866
+ * Also checks that the object is not an array.
867
+ *
868
+ * @return {boolean}
869
+ * True if the argument is an object.
870
+ */
871
+ export function isObject(obj, strict) {
872
+ return (!!obj &&
873
+ typeof obj === 'object' &&
874
+ (!strict || !isArray(obj))); // eslint-disable-line @typescript-eslint/no-explicit-any
875
+ }
876
+ /**
877
+ * Utility function to deep merge two or more objects and return a third object.
878
+ * If the first argument is true, the contents of the second object is copied
879
+ * into the first object. The merge function can also be used with a single
880
+ * object argument to create a deep copy of an object.
881
+ *
882
+ * @function Highcharts.merge<T>
883
+ *
884
+ * @param {true | T} extendOrSource
885
+ * Whether to extend the left-side object,
886
+ * or the first object to merge as a deep copy.
887
+ *
888
+ * @param {...Array<object|undefined>} [sources]
889
+ * Object(s) to merge into the previous one.
890
+ *
891
+ * @return {T}
892
+ * The merged object. If the first argument is true, the return is the
893
+ * same as the second argument.
894
+ */
895
+ export function merge(extendOrSource, ...sources) {
896
+ let i, args = [extendOrSource, ...sources], ret = {};
897
+ const doCopy = function (copy, original) {
898
+ // An object is replacing a primitive
899
+ if (typeof copy !== 'object') {
900
+ copy = {};
901
+ }
902
+ objectEach(original, function (value, key) {
903
+ // Prototype pollution (#14883)
904
+ if (key === '__proto__' || key === 'constructor') {
905
+ return;
906
+ }
907
+ // Copy the contents of objects, but not arrays or DOM nodes
908
+ if (isObject(value, true) &&
909
+ !isClass(value) &&
910
+ !isDOMElement(value)) {
911
+ copy[key] = doCopy(copy[key] || {}, value);
912
+ // Primitives and arrays are copied over directly
913
+ }
914
+ else {
915
+ copy[key] = original[key];
916
+ }
917
+ });
918
+ return copy;
919
+ };
920
+ // If first argument is true, copy into the existing object. Used in
921
+ // setOptions.
922
+ if (extendOrSource === true) {
923
+ ret = args[1];
924
+ args = Array.prototype.slice.call(args, 2);
925
+ }
926
+ // For each argument, extend the return
927
+ const len = args.length;
928
+ for (i = 0; i < len; i++) {
929
+ ret = doCopy(ret, args[i]);
930
+ }
931
+ return ret;
932
+ }
933
+ /**
934
+ * Take an interval and normalize it to multiples of round numbers.
935
+ *
936
+ * @deprecated
937
+ * @function Highcharts.normalizeTickInterval
938
+ *
939
+ * @param {number} interval
940
+ * The raw, un-rounded interval.
941
+ *
942
+ * @param {Array<*>} [multiples]
943
+ * Allowed multiples.
944
+ *
945
+ * @param {number} [magnitude]
946
+ * The magnitude of the number.
947
+ *
948
+ * @param {boolean} [allowDecimals]
949
+ * Whether to allow decimals.
950
+ *
951
+ * @param {boolean} [hasTickAmount]
952
+ * If it has tickAmount, avoid landing on tick intervals lower than
953
+ * original.
954
+ *
955
+ * @return {number}
956
+ * The normalized interval.
957
+ *
958
+ * @todo
959
+ * Move this function to the Axis prototype. It is here only for historical
960
+ * reasons.
961
+ */
962
+ export function normalizeTickInterval(interval, multiples, magnitude, allowDecimals, hasTickAmount) {
963
+ let i, retInterval = interval;
964
+ // Round to a tenfold of 1, 2, 2.5 or 5
965
+ magnitude = pick(magnitude, getMagnitude(interval));
966
+ const normalized = interval / magnitude;
967
+ // Multiples for a linear scale
968
+ if (!multiples) {
969
+ multiples = hasTickAmount ?
970
+ // Finer grained ticks when the tick amount is hard set, including
971
+ // when alignTicks is true on multiple axes (#4580).
972
+ [1, 1.2, 1.5, 2, 2.5, 3, 4, 5, 6, 8, 10] :
973
+ // Else, let ticks fall on rounder numbers
974
+ [1, 2, 2.5, 5, 10];
975
+ // The allowDecimals option
976
+ if (allowDecimals === false) {
977
+ if (magnitude === 1) {
978
+ multiples = multiples.filter(function (num) {
979
+ return num % 1 === 0;
980
+ });
981
+ }
982
+ else if (magnitude <= 0.1) {
983
+ multiples = [1 / magnitude];
984
+ }
985
+ }
986
+ }
987
+ // Normalize the interval to the nearest multiple
988
+ for (i = 0; i < multiples.length; i++) {
989
+ retInterval = multiples[i];
990
+ // Only allow tick amounts smaller than natural
991
+ if ((hasTickAmount &&
992
+ retInterval * magnitude >= interval) ||
993
+ (!hasTickAmount &&
994
+ (normalized <=
995
+ (multiples[i] +
996
+ (multiples[i + 1] || multiples[i])) / 2))) {
997
+ break;
998
+ }
999
+ }
1000
+ // Multiply back to the correct magnitude. Correct floats to appropriate
1001
+ // precision (#6085).
1002
+ retInterval = correctFloat(retInterval * magnitude, -Math.round(Math.log(0.001) / Math.LN10));
1003
+ return retInterval;
1004
+ }
1005
+ /* eslint-disable valid-jsdoc */
1006
+ /**
1007
+ * Iterate over object key pairs in an object.
1008
+ *
1009
+ * @function Highcharts.objectEach<T>
1010
+ *
1011
+ * @param {*} obj
1012
+ * The object to iterate over.
1013
+ *
1014
+ * @param {Highcharts.ObjectEachCallbackFunction<T>} fn
1015
+ * The iterator callback. It passes three arguments:
1016
+ * * value - The property value.
1017
+ * * key - The property key.
1018
+ * * obj - The object that objectEach is being applied to.
1019
+ *
1020
+ * @param {T} [ctx]
1021
+ * The context.
1022
+ */
1023
+ export function objectEach(obj, fn, ctx) {
1024
+ /* eslint-enable valid-jsdoc */
1025
+ for (const key in obj) {
1026
+ if (Object.hasOwnProperty.call(obj, key)) {
1027
+ fn.call(ctx || obj[key], obj[key], key, obj);
1028
+ }
1029
+ }
1030
+ }
1031
+ /**
1032
+ * Get the element's offset position, corrected for `overflow: auto`.
1033
+ *
1034
+ * @function Highcharts.offset
1035
+ *
1036
+ * @param {global.Element} el
1037
+ * The DOM element.
1038
+ *
1039
+ * @return {Highcharts.OffsetObject}
1040
+ * An object containing `left` and `top` properties for the position in
1041
+ * the page.
1042
+ */
1043
+ export function offset(el) {
1044
+ const docElem = doc.documentElement, box = (el.parentElement || el.parentNode) ?
1045
+ el.getBoundingClientRect() :
1046
+ { top: 0, left: 0, width: 0, height: 0 };
1047
+ return {
1048
+ top: box.top + (win.pageYOffset || docElem.scrollTop) -
1049
+ (docElem.clientTop || 0),
1050
+ left: box.left + (win.pageXOffset || docElem.scrollLeft) -
1051
+ (docElem.clientLeft || 0),
1052
+ width: box.width,
1053
+ height: box.height
1054
+ };
1055
+ }
1056
+ /**
1057
+ * Left-pad a string to a given length by adding a character repetitively.
1058
+ *
1059
+ * @function Highcharts.pad
1060
+ *
1061
+ * @param {number} number
1062
+ * The input string or number.
1063
+ *
1064
+ * @param {number} [length]
1065
+ * The desired string length.
1066
+ *
1067
+ * @param {string} [padder=0]
1068
+ * The character to pad with.
1069
+ *
1070
+ * @return {string}
1071
+ * The padded string.
1072
+ */
1073
+ export function pad(number, length, padder) {
1074
+ return new Array((length || 2) +
1075
+ 1 -
1076
+ String(number)
1077
+ .replace('-', '')
1078
+ .length).join(padder || '0') + number;
1079
+ }
1080
+ /* eslint-disable valid-jsdoc */
1081
+ /**
1082
+ * Return the first value that is not null or undefined.
1083
+ *
1084
+ * @function Highcharts.pick<T>
1085
+ *
1086
+ * @param {...Array<T|null|undefined>} items
1087
+ * Variable number of arguments to inspect.
1088
+ *
1089
+ * @return {T}
1090
+ * The value of the first argument that is not null or undefined.
1091
+ */
1092
+ export function pick() {
1093
+ const args = arguments;
1094
+ const length = args.length;
1095
+ for (let i = 0; i < length; i++) {
1096
+ const arg = args[i];
1097
+ if (typeof arg !== 'undefined' && arg !== null) {
1098
+ return arg;
1099
+ }
1100
+ }
1101
+ }
1102
+ /**
1103
+ * Shortcut for parseInt
1104
+ *
1105
+ * @internal
1106
+ * @function Highcharts.pInt
1107
+ *
1108
+ * @param {*} s
1109
+ * any
1110
+ *
1111
+ * @param {number} [mag]
1112
+ * Magnitude
1113
+ *
1114
+ * @return {number}
1115
+ * number
1116
+ */
1117
+ export function pInt(s, mag) {
1118
+ return parseInt(s, mag || 10);
1119
+ }
1120
+ /**
1121
+ * Adds an item to an array, if it is not present in the array.
1122
+ *
1123
+ * @internal
1124
+ *
1125
+ * @function Highcharts.pushUnique
1126
+ *
1127
+ * @param {Array<unknown>} array
1128
+ * The array to add the item to.
1129
+ *
1130
+ * @param {unknown} item
1131
+ * The item to add.
1132
+ *
1133
+ * @return {boolean}
1134
+ * Returns true, if the item was not present and has been added.
1135
+ */
1136
+ export function pushUnique(array, item) {
1137
+ return array.indexOf(item) < 0 && !!array.push(item);
1138
+ }
1139
+ /**
1140
+ * Return a length based on either the integer value, or a percentage of a base.
1141
+ *
1142
+ * @function Highcharts.relativeLength
1143
+ *
1144
+ * @param {Highcharts.RelativeSize} value
1145
+ * A percentage string or a number.
1146
+ *
1147
+ * @param {number} base
1148
+ * The full length that represents 100%.
1149
+ *
1150
+ * @param {number} [offset=0]
1151
+ * A pixel offset to apply for percentage values. Used internally in
1152
+ * axis positioning.
1153
+ *
1154
+ * @return {number}
1155
+ * The computed length.
1156
+ */
1157
+ export function relativeLength(value, base, offset) {
1158
+ return (/%$/).test(value) ?
1159
+ (base * parseFloat(value) / 100) + (offset || 0) :
1160
+ parseFloat(value);
1161
+ }
1162
+ /**
1163
+ * Replaces text in a string with a given replacement in a loop to catch nested
1164
+ * matches after previous replacements.
1165
+ *
1166
+ * @internal
1167
+ *
1168
+ * @function Highcharts.replaceNested
1169
+ *
1170
+ * @param {string} text
1171
+ * Text to search and modify.
1172
+ *
1173
+ * @param {...Array<(RegExp|string)>} replacements
1174
+ * One or multiple tuples with search pattern (`[0]: (string|RegExp)`) and
1175
+ * replacement (`[1]: string`) for matching text.
1176
+ *
1177
+ * @return {string}
1178
+ * Text with replacements.
1179
+ */
1180
+ export function replaceNested(text, ...replacements) {
1181
+ let previous, replacement;
1182
+ do {
1183
+ previous = text;
1184
+ for (replacement of replacements) {
1185
+ text = text.replace(replacement[0], replacement[1]);
1186
+ }
1187
+ } while (text !== previous);
1188
+ return text;
1189
+ }
1190
+ /* eslint-disable valid-jsdoc */
1191
+ /**
1192
+ * Remove an event that was added with {@link Highcharts#addEvent}.
1193
+ *
1194
+ * @function Highcharts.removeEvent<T>
1195
+ *
1196
+ * @param {Highcharts.Class<T>|T} el
1197
+ * The element to remove events on.
1198
+ *
1199
+ * @param {string} [type]
1200
+ * The type of events to remove. If undefined, all events are removed
1201
+ * from the element.
1202
+ *
1203
+ * @param {Highcharts.EventCallbackFunction<T>} [fn]
1204
+ * The specific callback to remove. If undefined, all events that match
1205
+ * the element and optionally the type are removed.
1206
+ *
1207
+ * @return {void}
1208
+ */
1209
+ export function removeEvent(el, type, fn) {
1210
+ /* eslint-enable valid-jsdoc */
1211
+ /** @internal */
1212
+ function removeOneEvent(type, fn) {
1213
+ const removeEventListener = el.removeEventListener;
1214
+ if (removeEventListener) {
1215
+ removeEventListener.call(el, type, fn, false);
1216
+ }
1217
+ }
1218
+ /** @internal */
1219
+ function removeAllEvents(eventCollection) {
1220
+ let types, len;
1221
+ if (!el.nodeName) {
1222
+ return; // Break on non-DOM events
1223
+ }
1224
+ if (type) {
1225
+ types = {};
1226
+ types[type] = true;
1227
+ }
1228
+ else {
1229
+ types = eventCollection;
1230
+ }
1231
+ objectEach(types, function (_val, n) {
1232
+ if (eventCollection[n]) {
1233
+ len = eventCollection[n].length;
1234
+ while (len--) {
1235
+ removeOneEvent(n, eventCollection[n][len].fn);
1236
+ }
1237
+ }
1238
+ });
1239
+ }
1240
+ const owner = typeof el === 'function' && el.prototype || el;
1241
+ if (Object.hasOwnProperty.call(owner, 'hcEvents')) {
1242
+ const events = owner.hcEvents;
1243
+ if (type) {
1244
+ const typeEvents = (events[type] || []);
1245
+ if (fn) {
1246
+ events[type] = typeEvents.filter(function (obj) {
1247
+ return fn !== obj.fn;
1248
+ });
1249
+ removeOneEvent(type, fn);
1250
+ }
1251
+ else {
1252
+ removeAllEvents(events);
1253
+ events[type] = [];
1254
+ }
1255
+ }
1256
+ else {
1257
+ removeAllEvents(events);
1258
+ delete owner.hcEvents;
1259
+ }
1260
+ }
1261
+ }
1262
+ /**
1263
+ * Check if an element is an array, and if not, make it into an array.
1264
+ *
1265
+ * @function Highcharts.splat
1266
+ *
1267
+ * @param {*} obj
1268
+ * The object to splat.
1269
+ *
1270
+ * @return {Array}
1271
+ * The produced or original array.
1272
+ */
1273
+ export function splat(obj) {
1274
+ return isArray(obj) ? obj : [obj];
1275
+ }
1276
+ /**
1277
+ * Sort an object array and keep the order of equal items. The ECMAScript
1278
+ * standard does not specify the behaviour when items are equal.
1279
+ *
1280
+ * @function Highcharts.stableSort
1281
+ *
1282
+ * @param {Array<*>} arr
1283
+ * The array to sort.
1284
+ *
1285
+ * @param {Function} sortFunction
1286
+ * The function to sort it with, like with regular Array.prototype.sort.
1287
+ */
1288
+ export function stableSort(arr, sortFunction) {
1289
+ // @todo It seems like Chrome since v70 sorts in a stable way internally,
1290
+ // plus all other browsers do it, so over time we may be able to remove this
1291
+ // function
1292
+ const length = arr.length;
1293
+ let sortValue, i;
1294
+ // Add index to each item
1295
+ for (i = 0; i < length; i++) {
1296
+ arr[i].safeI = i; // Stable sort index
1297
+ }
1298
+ arr.sort(function (a, b) {
1299
+ sortValue = sortFunction(a, b);
1300
+ return sortValue === 0 ? a.safeI - b.safeI : sortValue;
1301
+ });
1302
+ // Remove index from items
1303
+ for (i = 0; i < length; i++) {
1304
+ delete arr[i].safeI; // Stable sort index
1305
+ }
1306
+ }
1307
+ /**
1308
+ * Set a timeout if the delay is given, otherwise perform the function
1309
+ * synchronously.
1310
+ *
1311
+ * @function Highcharts.syncTimeout
1312
+ *
1313
+ * @param {Function} fn
1314
+ * The function callback.
1315
+ *
1316
+ * @param {number} delay
1317
+ * Delay in milliseconds.
1318
+ *
1319
+ * @param {*} [context]
1320
+ * An optional context to send to the function callback.
1321
+ *
1322
+ * @return {number}
1323
+ * An identifier for the timeout that can later be cleared with
1324
+ * Highcharts.clearTimeout. Returns -1 if there is no timeout.
1325
+ */
1326
+ export function syncTimeout(fn, delay, context) {
1327
+ if (delay > 0) {
1328
+ return setTimeout(fn, delay, context);
1329
+ }
1330
+ fn.call(0, context);
1331
+ return -1;
1332
+ }
1333
+ /**
1334
+ * @internal
1335
+ */
1336
+ export function ucfirst(s) {
1337
+ return ((isString(s) ?
1338
+ s.substring(0, 1).toUpperCase() + s.substring(1) :
1339
+ String(s)));
1340
+ }
1341
+ /**
1342
+ * Wrap a method with extended functionality, preserving the original function.
1343
+ *
1344
+ * @function Highcharts.wrap
1345
+ *
1346
+ * @param {*} obj
1347
+ * The context object that the method belongs to. In real cases, this is
1348
+ * often a prototype.
1349
+ *
1350
+ * @param {string} method
1351
+ * The name of the method to extend.
1352
+ *
1353
+ * @param {Highcharts.WrapProceedFunction} func
1354
+ * A wrapper function callback. This function is called with the same
1355
+ * arguments as the original function, except that the original function
1356
+ * is unshifted and passed as the first argument.
1357
+ */
1358
+ export function wrap(obj, method, func) {
1359
+ const proceed = obj[method];
1360
+ obj[method] = function () {
1361
+ const outerArgs = arguments, scope = this;
1362
+ return func.apply(this, [
1363
+ function () {
1364
+ return proceed.apply(scope, arguments.length ? arguments : outerArgs);
1365
+ }
1366
+ ].concat([].slice.call(arguments)));
1367
+ };
1368
+ }