@dhis2/analytics 26.9.0 → 26.9.3

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 (405) hide show
  1. package/build/cjs/__demo__/CalculationModal.stories.js +38 -16
  2. package/build/cjs/__demo__/DimensionsPanel.stories.js +65 -27
  3. package/build/cjs/__demo__/DynamicDimension.stories.js +30 -12
  4. package/build/cjs/__demo__/FileMenu.stories.js +27 -10
  5. package/build/cjs/__demo__/Filter.stories.js +20 -10
  6. package/build/cjs/__demo__/FixedPeriodSelect.stories.js +35 -17
  7. package/build/cjs/__demo__/InterpretationsUnit.stories.js +22 -11
  8. package/build/cjs/__demo__/OpenFileDialog.stories.js +44 -27
  9. package/build/cjs/__demo__/OrgUnitDimension.stories.js +103 -54
  10. package/build/cjs/__demo__/PeriodDimension.stories.js +64 -23
  11. package/build/cjs/__demo__/PivotTable.stories.js +413 -210
  12. package/build/cjs/__demo__/SingleValue.stories.js +37 -59
  13. package/build/cjs/__demo__/Toolbar.stories.js +44 -34
  14. package/build/cjs/__fixtures__/fixtures.js +2 -3
  15. package/build/cjs/api/analytics/Analytics.js +2 -3
  16. package/build/cjs/api/analytics/AnalyticsAggregate.js +2 -3
  17. package/build/cjs/api/analytics/AnalyticsBase.js +2 -3
  18. package/build/cjs/api/analytics/AnalyticsEnrollments.js +2 -3
  19. package/build/cjs/api/analytics/AnalyticsEvents.js +2 -3
  20. package/build/cjs/api/analytics/AnalyticsRequest.js +2 -3
  21. package/build/cjs/api/analytics/AnalyticsRequestBase.js +2 -3
  22. package/build/cjs/api/analytics/AnalyticsRequestDimensionsMixin.js +2 -3
  23. package/build/cjs/api/analytics/AnalyticsRequestFiltersMixin.js +2 -3
  24. package/build/cjs/api/analytics/AnalyticsRequestPropertiesMixin.js +2 -3
  25. package/build/cjs/api/analytics/AnalyticsResponse.js +2 -4
  26. package/build/cjs/api/analytics/AnalyticsResponseHeader.js +1 -2
  27. package/build/cjs/api/analytics/AnalyticsTrackedEntities.js +2 -3
  28. package/build/cjs/api/analytics/__tests__/Analytics.spec.js +1 -1
  29. package/build/cjs/api/analytics/__tests__/AnalyticsAggregate.spec.js +1 -1
  30. package/build/cjs/api/analytics/__tests__/AnalyticsBase.spec.js +2 -2
  31. package/build/cjs/api/analytics/__tests__/AnalyticsEnrollments.spec.js +1 -1
  32. package/build/cjs/api/analytics/__tests__/AnalyticsEvents.spec.js +1 -1
  33. package/build/cjs/api/analytics/__tests__/AnalyticsRequest.spec.js +1 -1
  34. package/build/cjs/api/analytics/__tests__/AnalyticsRequestBase.spec.js +1 -1
  35. package/build/cjs/api/analytics/__tests__/AnalyticsResponse.spec.js +1 -1
  36. package/build/cjs/api/analytics/__tests__/AnalyticsResponseHeader.spec.js +1 -1
  37. package/build/cjs/api/dimensions.js +11 -21
  38. package/build/cjs/api/expression.js +5 -9
  39. package/build/cjs/assets/AssignedCategoriesIcon.js +2 -3
  40. package/build/cjs/assets/DimensionItemIcons/CalculationIcon.js +3 -4
  41. package/build/cjs/assets/DimensionItemIcons/DataElementIcon.js +3 -4
  42. package/build/cjs/assets/DimensionItemIcons/GenericIcon.js +3 -4
  43. package/build/cjs/assets/DimensionItemIcons/PeriodIcon.js +3 -4
  44. package/build/cjs/assets/DynamicDimensionIcon.js +2 -3
  45. package/build/cjs/assets/FormulaIcon.js +2 -3
  46. package/build/cjs/components/AboutAOUnit/AboutAOUnit.js +4 -5
  47. package/build/cjs/components/AboutAOUnit/styles/AboutAOUnit.style.js +1 -2
  48. package/build/cjs/components/AboutAOUnit/utils.js +7 -13
  49. package/build/cjs/components/CachedDataQueryProvider.js +3 -3
  50. package/build/cjs/components/DataDimension/Calculation/CalculationModal.js +4 -5
  51. package/build/cjs/components/DataDimension/Calculation/DataElementOption.js +3 -4
  52. package/build/cjs/components/DataDimension/Calculation/DataElementSelector.js +4 -5
  53. package/build/cjs/components/DataDimension/Calculation/DndContext.js +8 -10
  54. package/build/cjs/components/DataDimension/Calculation/DragHandleIcon.js +3 -4
  55. package/build/cjs/components/DataDimension/Calculation/DraggingItem.js +2 -3
  56. package/build/cjs/components/DataDimension/Calculation/DropZone.js +2 -3
  57. package/build/cjs/components/DataDimension/Calculation/FormulaField.js +4 -7
  58. package/build/cjs/components/DataDimension/Calculation/FormulaItem.js +5 -6
  59. package/build/cjs/components/DataDimension/Calculation/MathOperatorSelector.js +2 -3
  60. package/build/cjs/components/DataDimension/Calculation/Operator.js +3 -4
  61. package/build/cjs/components/DataDimension/Calculation/styles/CalculationModal.style.js +1 -2
  62. package/build/cjs/components/DataDimension/Calculation/styles/DataElementOption.style.js +1 -2
  63. package/build/cjs/components/DataDimension/Calculation/styles/DataElementSelector.style.js +1 -2
  64. package/build/cjs/components/DataDimension/Calculation/styles/DraggingItem.style.js +1 -2
  65. package/build/cjs/components/DataDimension/Calculation/styles/DropZone.style.js +1 -2
  66. package/build/cjs/components/DataDimension/Calculation/styles/FormulaField.style.js +1 -2
  67. package/build/cjs/components/DataDimension/Calculation/styles/FormulaItem.style.js +1 -2
  68. package/build/cjs/components/DataDimension/Calculation/styles/MathOperatorSelector.style.js +1 -2
  69. package/build/cjs/components/DataDimension/Calculation/styles/Operator.style.js +1 -2
  70. package/build/cjs/components/DataDimension/DataDimension.js +4 -5
  71. package/build/cjs/components/DataDimension/DataTypeSelector.js +2 -3
  72. package/build/cjs/components/DataDimension/DetailSelector.js +2 -3
  73. package/build/cjs/components/DataDimension/GroupSelector.js +4 -5
  74. package/build/cjs/components/DataDimension/ItemSelector.js +5 -7
  75. package/build/cjs/components/DataDimension/MetricSelector.js +2 -3
  76. package/build/cjs/components/DataDimension/styles/DataTypeSelector.style.js +1 -2
  77. package/build/cjs/components/DataDimension/styles/DetailSelector.style.js +1 -2
  78. package/build/cjs/components/DataDimension/styles/GroupSelector.style.js +1 -2
  79. package/build/cjs/components/DataDimension/styles/MetricSelector.style.js +1 -2
  80. package/build/cjs/components/DimensionMenu.js +5 -6
  81. package/build/cjs/components/DimensionsPanel/DimensionsPanel.js +7 -8
  82. package/build/cjs/components/DimensionsPanel/List/DimensionItem.js +8 -9
  83. package/build/cjs/components/DimensionsPanel/List/DimensionList.js +7 -8
  84. package/build/cjs/components/DimensionsPanel/List/OptionsButton.js +2 -3
  85. package/build/cjs/components/DimensionsPanel/List/RecommendedIcon.js +2 -3
  86. package/build/cjs/components/DimensionsPanel/List/__tests__/DimensionItem.spec.js +2 -2
  87. package/build/cjs/components/DimensionsPanel/List/styles/DimensionItem.style.js +1 -2
  88. package/build/cjs/components/DimensionsPanel/List/styles/DimensionList.style.js +1 -2
  89. package/build/cjs/components/DimensionsPanel/List/styles/RecommendedIcon.style.js +2 -3
  90. package/build/cjs/components/DimensionsPanel/__tests__/DimensionsPanel.spec.js +2 -2
  91. package/build/cjs/components/DimensionsPanel/styles/DimensionsPanel.style.js +2 -3
  92. package/build/cjs/components/DynamicDimension/DynamicDimension.js +3 -5
  93. package/build/cjs/components/DynamicDimension/ItemSelector.js +5 -7
  94. package/build/cjs/components/DynamicDimension/styles/DynamicDimension.style.js +1 -2
  95. package/build/cjs/components/FileMenu/DeleteDialog.js +3 -3
  96. package/build/cjs/components/FileMenu/FileMenu.js +4 -5
  97. package/build/cjs/components/FileMenu/FileMenu.styles.js +2 -4
  98. package/build/cjs/components/FileMenu/GetLinkDialog.js +1 -1
  99. package/build/cjs/components/FileMenu/GetLinkDialog.styles.js +1 -2
  100. package/build/cjs/components/FileMenu/RenameDialog.js +3 -3
  101. package/build/cjs/components/FileMenu/SaveAsDialog.js +3 -3
  102. package/build/cjs/components/FileMenu/__tests__/DeleteDialog.spec.js +2 -2
  103. package/build/cjs/components/FileMenu/__tests__/FileMenu.spec.js +2 -2
  104. package/build/cjs/components/FileMenu/__tests__/GetLinkDialog.spec.js +2 -2
  105. package/build/cjs/components/FileMenu/__tests__/RenameDialog.spec.js +2 -2
  106. package/build/cjs/components/FileMenu/__tests__/SaveAsDialog.spec.js +2 -2
  107. package/build/cjs/components/FileMenu/utils.js +6 -11
  108. package/build/cjs/components/Filter/Filter.js +2 -3
  109. package/build/cjs/components/Filter/__tests__/Filter.spec.js +2 -2
  110. package/build/cjs/components/Filter/styles/Filter.style.js +1 -2
  111. package/build/cjs/components/Interpretations/InterpretationModal/Comment.js +3 -3
  112. package/build/cjs/components/Interpretations/InterpretationModal/CommentAddForm.js +3 -3
  113. package/build/cjs/components/Interpretations/InterpretationModal/CommentDeleteButton.js +3 -3
  114. package/build/cjs/components/Interpretations/InterpretationModal/CommentUpdateForm.js +3 -3
  115. package/build/cjs/components/Interpretations/InterpretationModal/InterpretationModal.js +3 -3
  116. package/build/cjs/components/Interpretations/InterpretationModal/InterpretationThread.js +3 -3
  117. package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationForm.js +3 -3
  118. package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationList.js +1 -1
  119. package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js +4 -5
  120. package/build/cjs/components/Interpretations/common/Interpretation/Interpretation.js +3 -3
  121. package/build/cjs/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js +1 -1
  122. package/build/cjs/components/Interpretations/common/Interpretation/InterpretationSharingLink.js +3 -3
  123. package/build/cjs/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js +3 -3
  124. package/build/cjs/components/Interpretations/common/Message/Message.js +1 -1
  125. package/build/cjs/components/Interpretations/common/Message/MessageButtonStrip.js +1 -1
  126. package/build/cjs/components/Interpretations/common/Message/MessageEditorContainer.js +1 -1
  127. package/build/cjs/components/Interpretations/common/Message/MessageIconButton.js +1 -1
  128. package/build/cjs/components/Interpretations/common/Message/MessageInput.js +5 -6
  129. package/build/cjs/components/Interpretations/common/Message/MessageStatsBar.js +1 -1
  130. package/build/cjs/components/LegendKey/LegendKey.js +2 -3
  131. package/build/cjs/components/LegendKey/styles/LegendKey.style.js +1 -2
  132. package/build/cjs/components/OfflineTooltip.js +1 -1
  133. package/build/cjs/components/OpenFileDialog/CreatedByFilter.js +5 -9
  134. package/build/cjs/components/OpenFileDialog/CustomSelectOption.js +2 -3
  135. package/build/cjs/components/OpenFileDialog/DateField.js +2 -3
  136. package/build/cjs/components/OpenFileDialog/FileList.js +2 -3
  137. package/build/cjs/components/OpenFileDialog/NameFilter.js +2 -3
  138. package/build/cjs/components/OpenFileDialog/OpenFileDialog.js +4 -5
  139. package/build/cjs/components/OpenFileDialog/OpenFileDialog.styles.js +1 -2
  140. package/build/cjs/components/OpenFileDialog/PaginationControls.js +2 -3
  141. package/build/cjs/components/OpenFileDialog/VisTypeFilter.js +2 -3
  142. package/build/cjs/components/OpenFileDialog/styles/CustomSelectOption.style.js +1 -2
  143. package/build/cjs/components/OpenFileDialog/utils.js +5 -9
  144. package/build/cjs/components/Options/VisualizationOptions.js +4 -5
  145. package/build/cjs/components/Options/styles/VisualizationOptions.style.js +17 -32
  146. package/build/cjs/components/OrgUnitDimension/OrgUnitDimension.js +6 -10
  147. package/build/cjs/components/OrgUnitDimension/__tests__/OrgUnitDimension.spec.js +60 -0
  148. package/build/cjs/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +94 -0
  149. package/build/cjs/components/OrgUnitDimension/styles/OrgUnitDimension.style.js +1 -2
  150. package/build/cjs/components/PeriodDimension/FixedPeriodFilter.js +2 -3
  151. package/build/cjs/components/PeriodDimension/FixedPeriodSelect.js +7 -8
  152. package/build/cjs/components/PeriodDimension/PeriodDimension.js +2 -3
  153. package/build/cjs/components/PeriodDimension/PeriodTransfer.js +5 -6
  154. package/build/cjs/components/PeriodDimension/RelativePeriodFilter.js +2 -3
  155. package/build/cjs/components/PeriodDimension/__tests__/FixedPeriodSingleSelect.spec.js +2 -2
  156. package/build/cjs/components/PeriodDimension/__tests__/PeriodDimension.spec.js +2 -2
  157. package/build/cjs/components/PeriodDimension/__tests__/PeriodSelector.spec.js +2 -2
  158. package/build/cjs/components/PeriodDimension/styles/FixedPeriodSelect.style.js +1 -2
  159. package/build/cjs/components/PeriodDimension/styles/PeriodFilter.style.js +1 -2
  160. package/build/cjs/components/PeriodDimension/utils/fixedPeriods.js +1 -2
  161. package/build/cjs/components/PeriodDimension/utils/index.js +19 -38
  162. package/build/cjs/components/PeriodDimension/utils/relativePeriods.js +1 -1
  163. package/build/cjs/components/PivotTable/PivotTable.js +4 -5
  164. package/build/cjs/components/PivotTable/PivotTableBody.js +1 -1
  165. package/build/cjs/components/PivotTable/PivotTableCell.js +3 -4
  166. package/build/cjs/components/PivotTable/PivotTableClippedAxis.js +1 -1
  167. package/build/cjs/components/PivotTable/PivotTableColumnHeaderCell.js +1 -1
  168. package/build/cjs/components/PivotTable/PivotTableColumnHeaders.js +1 -1
  169. package/build/cjs/components/PivotTable/PivotTableContainer.js +2 -3
  170. package/build/cjs/components/PivotTable/PivotTableDimensionLabelCell.js +1 -1
  171. package/build/cjs/components/PivotTable/PivotTableEmptyCell.js +3 -4
  172. package/build/cjs/components/PivotTable/PivotTableEmptyRow.js +1 -1
  173. package/build/cjs/components/PivotTable/PivotTableEngineContext.js +4 -5
  174. package/build/cjs/components/PivotTable/PivotTableHead.js +1 -1
  175. package/build/cjs/components/PivotTable/PivotTableHeaderCell.js +1 -1
  176. package/build/cjs/components/PivotTable/PivotTableRow.js +1 -1
  177. package/build/cjs/components/PivotTable/PivotTableRowHeaderCell.js +1 -1
  178. package/build/cjs/components/PivotTable/PivotTableSortIcon.js +1 -1
  179. package/build/cjs/components/PivotTable/PivotTableTitleRow.js +3 -3
  180. package/build/cjs/components/PivotTable/PivotTableTitleRows.js +1 -1
  181. package/build/cjs/components/PivotTable/PivotTableValueCell.js +3 -3
  182. package/build/cjs/components/PivotTable/icons/SortIconAscending.js +1 -1
  183. package/build/cjs/components/PivotTable/icons/SortIconDescending.js +1 -1
  184. package/build/cjs/components/PivotTable/icons/SortIconIdle.js +1 -1
  185. package/build/cjs/components/PivotTable/styles/PivotTable.style.js +3 -6
  186. package/build/cjs/components/RichText/Editor/Editor.js +4 -5
  187. package/build/cjs/components/RichText/Editor/__tests__/Editor.spec.js +2 -2
  188. package/build/cjs/components/RichText/Editor/markdownHandler.js +9 -18
  189. package/build/cjs/components/RichText/Editor/styles/Editor.style.js +4 -8
  190. package/build/cjs/components/RichText/Parser/MdParser.js +1 -1
  191. package/build/cjs/components/RichText/Parser/Parser.js +3 -3
  192. package/build/cjs/components/RichText/Parser/__tests__/Parser.spec.js +2 -2
  193. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuBar.js +3 -3
  194. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +3 -3
  195. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuList.js +3 -3
  196. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +4 -4
  197. package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.styles.js +1 -2
  198. package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +4 -4
  199. package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +3 -3
  200. package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +7 -7
  201. package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +5 -5
  202. package/build/cjs/components/Toolbar/InterpretationsAndDetailsToggler.js +1 -1
  203. package/build/cjs/components/Toolbar/MenuButton.styles.js +1 -2
  204. package/build/cjs/components/Toolbar/Toolbar.js +1 -1
  205. package/build/cjs/components/Toolbar/ToolbarSidebar.js +1 -1
  206. package/build/cjs/components/Toolbar/UpdateButton.js +2 -2
  207. package/build/cjs/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +6 -6
  208. package/build/cjs/components/Toolbar/__tests__/Toolbar.spec.js +3 -3
  209. package/build/cjs/components/Toolbar/__tests__/ToolbarSidebar.spec.js +4 -4
  210. package/build/cjs/components/Toolbar/__tests__/UpdateButton.spec.js +5 -5
  211. package/build/cjs/components/TransferOption.js +1 -1
  212. package/build/cjs/components/TranslationDialog/TranslationModal/LocalesSelect.js +1 -1
  213. package/build/cjs/components/TranslationDialog/TranslationModal/TranslationForm.js +3 -3
  214. package/build/cjs/components/TranslationDialog/TranslationModal/TranslationModal.js +3 -3
  215. package/build/cjs/components/TranslationDialog/TranslationModal/TranslationModalActions.js +1 -1
  216. package/build/cjs/components/TranslationDialog/TranslationModal/useTranslationsResults.js +1 -1
  217. package/build/cjs/components/UserMention/UserList.js +1 -1
  218. package/build/cjs/components/UserMention/UserMentionWrapper.js +3 -4
  219. package/build/cjs/components/UserMention/styles/UserMentionWrapper.style.js +4 -6
  220. package/build/cjs/components/UserMention/useUserSearchResults.js +1 -1
  221. package/build/cjs/components/VisTypeIcon.js +2 -3
  222. package/build/cjs/components/styles/DimensionSelector.style.js +1 -2
  223. package/build/cjs/components/styles/DimensionsPanel.style.js +2 -3
  224. package/build/cjs/components/styles/OfflineTooltip.style.js +1 -2
  225. package/build/cjs/components/styles/TransferOption.style.js +1 -2
  226. package/build/cjs/index.js +3 -3
  227. package/build/cjs/locales/index.js +2 -3
  228. package/build/cjs/locales/pt/translations.json +251 -242
  229. package/build/cjs/locales/vi/translations.json +16 -12
  230. package/build/cjs/locales/zh/translations.json +2 -0
  231. package/build/cjs/modules/__tests__/getOuLevelAndGroupText.spec.js +9 -0
  232. package/build/cjs/modules/axis.js +1 -1
  233. package/build/cjs/modules/dataSets.js +8 -14
  234. package/build/cjs/modules/dataTypes.js +24 -47
  235. package/build/cjs/modules/dimensionListItem.js +1 -1
  236. package/build/cjs/modules/dimensionSelectorHelper.js +3 -6
  237. package/build/cjs/modules/expressions.js +6 -11
  238. package/build/cjs/modules/fontStyle.js +19 -37
  239. package/build/cjs/modules/getAdaptedUiLayoutByType.js +1 -1
  240. package/build/cjs/modules/getOuLevelAndGroupText.js +5 -2
  241. package/build/cjs/modules/hash.js +1 -1
  242. package/build/cjs/modules/layout/axis.js +10 -16
  243. package/build/cjs/modules/layout/dimension.js +11 -19
  244. package/build/cjs/modules/layout/item.js +5 -7
  245. package/build/cjs/modules/layout/layout.js +3 -4
  246. package/build/cjs/modules/layout/testResources.js +39 -71
  247. package/build/cjs/modules/layoutTypes.js +8 -16
  248. package/build/cjs/modules/layoutUiRules/rules.js +4 -7
  249. package/build/cjs/modules/legends.js +4 -8
  250. package/build/cjs/modules/list.js +1 -1
  251. package/build/cjs/modules/ouIdHelper/index.js +5 -9
  252. package/build/cjs/modules/outliers/index.js +13 -25
  253. package/build/cjs/modules/outliers/iqr.js +5 -9
  254. package/build/cjs/modules/outliers/modZScore.js +2 -3
  255. package/build/cjs/modules/outliers/normalization.js +2 -2
  256. package/build/cjs/modules/outliers/zScore.js +2 -3
  257. package/build/cjs/modules/pivotTable/AdaptiveClippingController.js +3 -3
  258. package/build/cjs/modules/pivotTable/PivotTableEngine.js +4 -4
  259. package/build/cjs/modules/pivotTable/clipAxis.js +1 -1
  260. package/build/cjs/modules/pivotTable/pivotTableConstants.js +32 -62
  261. package/build/cjs/modules/pivotTable/useParentSize.js +1 -1
  262. package/build/cjs/modules/pivotTable/useScrollPosition.js +1 -1
  263. package/build/cjs/modules/pivotTable/useSortableColumns.js +0 -1
  264. package/build/cjs/modules/predefinedDimensions.js +6 -11
  265. package/build/cjs/modules/valueTypes.js +21 -42
  266. package/build/cjs/modules/visTypes.js +24 -47
  267. package/build/cjs/visualizations/config/adapters/dhis_highcharts/addTrendLines.js +1 -1
  268. package/build/cjs/visualizations/config/adapters/dhis_highcharts/axis.js +1 -1
  269. package/build/cjs/visualizations/config/adapters/dhis_highcharts/chart/default.js +1 -1
  270. package/build/cjs/visualizations/config/adapters/dhis_highcharts/chart/index.js +1 -1
  271. package/build/cjs/visualizations/config/adapters/dhis_highcharts/chart/singleValue.js +1 -1
  272. package/build/cjs/visualizations/config/adapters/dhis_highcharts/customAxes.js +2 -4
  273. package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/index.js +1 -1
  274. package/build/cjs/visualizations/config/adapters/dhis_highcharts/customSVGOptions/singleValue/getSingleValueFormattedValue.js +1 -2
  275. package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/index.js +1 -1
  276. package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/index.js +1 -1
  277. package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/constants.js +1 -2
  278. package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/index.js +1 -2
  279. package/build/cjs/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/styles.js +3 -5
  280. package/build/cjs/visualizations/config/adapters/dhis_highcharts/exporting.js +1 -1
  281. package/build/cjs/visualizations/config/adapters/dhis_highcharts/getAxisTitle.js +1 -1
  282. package/build/cjs/visualizations/config/adapters/dhis_highcharts/getCategories.js +1 -1
  283. package/build/cjs/visualizations/config/adapters/dhis_highcharts/getCumulativeData.js +1 -1
  284. package/build/cjs/visualizations/config/adapters/dhis_highcharts/getFormatter.js +1 -1
  285. package/build/cjs/visualizations/config/adapters/dhis_highcharts/getSortedConfig.js +1 -1
  286. package/build/cjs/visualizations/config/adapters/dhis_highcharts/getSteps.js +1 -1
  287. package/build/cjs/visualizations/config/adapters/dhis_highcharts/getTrimmedConfig.js +1 -1
  288. package/build/cjs/visualizations/config/adapters/dhis_highcharts/index.js +3 -3
  289. package/build/cjs/visualizations/config/adapters/dhis_highcharts/legendSet.js +1 -1
  290. package/build/cjs/visualizations/config/adapters/dhis_highcharts/pane/index.js +1 -1
  291. package/build/cjs/visualizations/config/adapters/dhis_highcharts/plotOptions.js +1 -1
  292. package/build/cjs/visualizations/config/adapters/dhis_highcharts/series/index.js +1 -1
  293. package/build/cjs/visualizations/config/adapters/dhis_highcharts/series/scatter.js +1 -1
  294. package/build/cjs/visualizations/config/adapters/dhis_highcharts/subtitle/__tests__/singleValue.spec.js +1 -2
  295. package/build/cjs/visualizations/config/adapters/dhis_highcharts/subtitle/gauge.js +1 -1
  296. package/build/cjs/visualizations/config/adapters/dhis_highcharts/subtitle/index.js +5 -5
  297. package/build/cjs/visualizations/config/adapters/dhis_highcharts/subtitle/singleValue.js +1 -1
  298. package/build/cjs/visualizations/config/adapters/dhis_highcharts/title/index.js +1 -1
  299. package/build/cjs/visualizations/config/adapters/dhis_highcharts/title/scatter.js +1 -1
  300. package/build/cjs/visualizations/config/adapters/dhis_highcharts/title/singleValue.js +1 -1
  301. package/build/cjs/visualizations/config/adapters/dhis_highcharts/title/yearOverYear.js +3 -3
  302. package/build/cjs/visualizations/config/adapters/dhis_highcharts/xAxis/index.js +1 -1
  303. package/build/cjs/visualizations/config/adapters/dhis_highcharts/xAxis/radar.js +1 -1
  304. package/build/cjs/visualizations/config/adapters/dhis_highcharts/xAxis/scatter.js +1 -1
  305. package/build/cjs/visualizations/config/adapters/dhis_highcharts/xAxis/twoCategory.js +1 -1
  306. package/build/cjs/visualizations/config/adapters/dhis_highcharts/xAxis/yearOnYear.js +1 -1
  307. package/build/cjs/visualizations/config/adapters/dhis_highcharts/yAxis/gauge.js +1 -1
  308. package/build/cjs/visualizations/config/adapters/dhis_highcharts/yAxis/index.js +3 -3
  309. package/build/cjs/visualizations/config/adapters/index.js +3 -4
  310. package/build/cjs/visualizations/config/generators/highcharts/index.js +1 -5
  311. package/build/cjs/visualizations/config/generators/index.js +3 -4
  312. package/build/cjs/visualizations/config/index.js +1 -1
  313. package/build/cjs/visualizations/config/validators/index.js +3 -4
  314. package/build/cjs/visualizations/index.js +2 -3
  315. package/build/cjs/visualizations/store/adapters/dhis_highcharts/index.js +1 -1
  316. package/build/cjs/visualizations/store/adapters/dhis_highcharts/twoCategory.js +1 -1
  317. package/build/cjs/visualizations/store/adapters/index.js +3 -4
  318. package/build/cjs/visualizations/store/index.js +1 -1
  319. package/build/cjs/visualizations/store/validators/dhis/index.js +1 -1
  320. package/build/cjs/visualizations/store/validators/index.js +3 -4
  321. package/build/cjs/visualizations/util/__tests__/getFilterText.spec.js +1 -1
  322. package/build/cjs/visualizations/util/colors/colorSets.js +11 -20
  323. package/build/cjs/visualizations/util/colors/themes.js +3 -5
  324. package/build/es/__demo__/CalculationModal.stories.js +20 -6
  325. package/build/es/__demo__/DimensionsPanel.stories.js +43 -17
  326. package/build/es/__demo__/DynamicDimension.stories.js +18 -7
  327. package/build/es/__demo__/FileMenu.stories.js +15 -5
  328. package/build/es/__demo__/Filter.stories.js +8 -3
  329. package/build/es/__demo__/FixedPeriodSelect.stories.js +18 -7
  330. package/build/es/__demo__/InterpretationsUnit.stories.js +10 -5
  331. package/build/es/__demo__/OpenFileDialog.stories.js +34 -26
  332. package/build/es/__demo__/OrgUnitDimension.stories.js +61 -26
  333. package/build/es/__demo__/PeriodDimension.stories.js +44 -13
  334. package/build/es/__demo__/PivotTable.stories.js +249 -99
  335. package/build/es/__demo__/SingleValue.stories.js +10 -37
  336. package/build/es/__demo__/Toolbar.stories.js +8 -3
  337. package/build/es/api/analytics/AnalyticsResponse.js +0 -1
  338. package/build/es/components/DataDimension/Calculation/DataElementOption.js +1 -1
  339. package/build/es/components/DataDimension/Calculation/DndContext.js +3 -3
  340. package/build/es/components/DataDimension/Calculation/FormulaItem.js +1 -1
  341. package/build/es/components/DataDimension/Calculation/Operator.js +1 -1
  342. package/build/es/components/DataDimension/ItemSelector.js +1 -2
  343. package/build/es/components/DimensionMenu.js +3 -3
  344. package/build/es/components/DimensionsPanel/DimensionsPanel.js +3 -3
  345. package/build/es/components/DimensionsPanel/List/DimensionItem.js +4 -4
  346. package/build/es/components/DimensionsPanel/List/DimensionList.js +3 -3
  347. package/build/es/components/DimensionsPanel/List/__tests__/DimensionItem.spec.js +1 -1
  348. package/build/es/components/DimensionsPanel/__tests__/DimensionsPanel.spec.js +1 -1
  349. package/build/es/components/DynamicDimension/ItemSelector.js +1 -2
  350. package/build/es/components/FileMenu/__tests__/DeleteDialog.spec.js +1 -1
  351. package/build/es/components/FileMenu/__tests__/FileMenu.spec.js +1 -1
  352. package/build/es/components/FileMenu/__tests__/GetLinkDialog.spec.js +1 -1
  353. package/build/es/components/FileMenu/__tests__/RenameDialog.spec.js +1 -1
  354. package/build/es/components/FileMenu/__tests__/SaveAsDialog.spec.js +1 -1
  355. package/build/es/components/Filter/__tests__/Filter.spec.js +1 -1
  356. package/build/es/components/Interpretations/common/Message/MessageInput.js +1 -1
  357. package/build/es/components/OrgUnitDimension/OrgUnitDimension.js +2 -5
  358. package/build/es/components/OrgUnitDimension/__tests__/OrgUnitDimension.spec.js +57 -0
  359. package/build/es/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +94 -0
  360. package/build/es/components/PeriodDimension/FixedPeriodSelect.js +3 -3
  361. package/build/es/components/PeriodDimension/PeriodTransfer.js +1 -1
  362. package/build/es/components/PeriodDimension/__tests__/FixedPeriodSingleSelect.spec.js +1 -1
  363. package/build/es/components/PeriodDimension/__tests__/PeriodDimension.spec.js +1 -1
  364. package/build/es/components/PeriodDimension/__tests__/PeriodSelector.spec.js +1 -1
  365. package/build/es/components/PeriodDimension/utils/fixedPeriods.js +0 -1
  366. package/build/es/components/PivotTable/PivotTableCell.js +1 -1
  367. package/build/es/components/PivotTable/PivotTableEmptyCell.js +1 -1
  368. package/build/es/components/RichText/Editor/__tests__/Editor.spec.js +1 -1
  369. package/build/es/components/RichText/Parser/__tests__/Parser.spec.js +1 -1
  370. package/build/es/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +1 -1
  371. package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +3 -3
  372. package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +2 -2
  373. package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +6 -6
  374. package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +4 -4
  375. package/build/es/components/Toolbar/UpdateButton.js +1 -1
  376. package/build/es/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +5 -5
  377. package/build/es/components/Toolbar/__tests__/Toolbar.spec.js +2 -2
  378. package/build/es/components/Toolbar/__tests__/ToolbarSidebar.spec.js +3 -3
  379. package/build/es/components/Toolbar/__tests__/UpdateButton.spec.js +4 -4
  380. package/build/es/components/UserMention/UserMentionWrapper.js +0 -1
  381. package/build/es/locales/pt/translations.json +251 -242
  382. package/build/es/locales/vi/translations.json +16 -12
  383. package/build/es/locales/zh/translations.json +2 -0
  384. package/build/es/modules/__tests__/getOuLevelAndGroupText.spec.js +9 -0
  385. package/build/es/modules/getOuLevelAndGroupText.js +4 -1
  386. package/build/es/modules/pivotTable/AdaptiveClippingController.js +3 -3
  387. package/build/es/modules/pivotTable/PivotTableEngine.js +3 -3
  388. package/build/es/modules/pivotTable/useSortableColumns.js +0 -1
  389. package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/index.js +1 -2
  390. package/build/es/visualizations/config/adapters/dhis_highcharts/events/loadCustomSVG/singleValue/styles.js +2 -3
  391. package/build/es/visualizations/config/adapters/dhis_highcharts/plotOptions.js +2 -2
  392. package/build/es/visualizations/config/adapters/dhis_highcharts/series/scatter.js +2 -2
  393. package/build/es/visualizations/config/adapters/dhis_highcharts/subtitle/__tests__/singleValue.spec.js +0 -1
  394. package/build/es/visualizations/config/adapters/dhis_highcharts/subtitle/index.js +1 -1
  395. package/build/es/visualizations/config/adapters/dhis_highcharts/title/yearOverYear.js +1 -1
  396. package/build/es/visualizations/config/adapters/dhis_highcharts/xAxis/radar.js +2 -2
  397. package/build/es/visualizations/config/adapters/dhis_highcharts/yAxis/index.js +1 -1
  398. package/build/es/visualizations/config/generators/highcharts/index.js +0 -4
  399. package/package.json +13 -11
  400. package/build/cjs/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/index.js +0 -13
  401. package/build/cjs/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/nonASCIIFont.js +0 -17
  402. package/build/cjs/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/textShadow.js +0 -289
  403. package/build/es/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/index.js +0 -6
  404. package/build/es/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/nonASCIIFont.js +0 -11
  405. package/build/es/visualizations/config/generators/highcharts/pdfExportBugFixPlugin/textShadow.js +0 -283
@@ -1,289 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = _default;
7
- /* This plugin was provided by HighCharts support and resolves an issue with label
8
- * text that has a white outline, such as the one we use for stacked bar charts.
9
- * For example: "ANC: 1-4 visits by districts this year (stacked)"
10
- * This issue has actually been resolved in HighCharts v11, so once we have upgraded
11
- * to that version, this plugin can be removed. */
12
-
13
- function _default(H) {
14
- const {
15
- AST,
16
- defaultOptions,
17
- downloadURL
18
- } = H,
19
- {
20
- ajax
21
- } = H.HttpUtilities,
22
- doc = document,
23
- win = window,
24
- OfflineExporting = H._modules['Extensions/OfflineExporting/OfflineExporting.js'],
25
- {
26
- getScript,
27
- svgToPdf,
28
- imageToDataUrl,
29
- svgToDataUrl
30
- } = OfflineExporting;
31
- H.wrap(OfflineExporting, 'downloadSVGLocal', function (proceed, svg, options, failCallback, successCallback) {
32
- var dummySVGContainer = doc.createElement('div'),
33
- imageType = options.type || 'image/png',
34
- filename = (options.filename || 'chart') + '.' + (imageType === 'image/svg+xml' ? 'svg' : imageType.split('/')[1]),
35
- scale = options.scale || 1;
36
- var svgurl,
37
- blob,
38
- finallyHandler,
39
- libURL = options.libURL || defaultOptions.exporting.libURL,
40
- objectURLRevoke = true,
41
- pdfFont = options.pdfFont;
42
- // Allow libURL to end with or without fordward slash
43
- libURL = libURL.slice(-1) !== '/' ? libURL + '/' : libURL;
44
- /*
45
- * Detect if we need to load TTF fonts for the PDF, then load them and
46
- * proceed.
47
- *
48
- * @private
49
- */
50
- var loadPdfFonts = function (svgElement, callback) {
51
- var hasNonASCII = function (s) {
52
- return (
53
- // eslint-disable-next-line no-control-regex
54
- /[^\u0000-\u007F\u200B]+/.test(s)
55
- );
56
- };
57
- // Register an event in order to add the font once jsPDF is
58
- // initialized
59
- var addFont = function (variant, base64) {
60
- win.jspdf.jsPDF.API.events.push(['initialized', function () {
61
- this.addFileToVFS(variant, base64);
62
- this.addFont(variant, 'HighchartsFont', variant);
63
- if (!this.getFontList().HighchartsFont) {
64
- this.setFont('HighchartsFont');
65
- }
66
- }]);
67
- };
68
- // If there are no non-ASCII characters in the SVG, do not use
69
- // bother downloading the font files
70
- if (pdfFont && !hasNonASCII(svgElement.textContent || '')) {
71
- pdfFont = void 0;
72
- }
73
- // Add new font if the URL is declared, #6417.
74
- var variants = ['normal', 'italic', 'bold', 'bolditalic'];
75
- // Shift the first element off the variants and add as a font.
76
- // Then asynchronously trigger the next variant until calling the
77
- // callback when the variants are empty.
78
- var normalBase64;
79
- var shiftAndLoadVariant = function () {
80
- var variant = variants.shift();
81
- // All variants shifted and possibly loaded, proceed
82
- if (!variant) {
83
- return callback();
84
- }
85
- var url = pdfFont && pdfFont[variant];
86
- if (url) {
87
- ajax({
88
- url: url,
89
- responseType: 'blob',
90
- success: function (data, xhr) {
91
- var reader = new FileReader();
92
- reader.onloadend = function () {
93
- if (typeof this.result === 'string') {
94
- var base64 = this.result.split(',')[1];
95
- addFont(variant, base64);
96
- if (variant === 'normal') {
97
- normalBase64 = base64;
98
- }
99
- }
100
- shiftAndLoadVariant();
101
- };
102
- reader.readAsDataURL(xhr.response);
103
- },
104
- error: shiftAndLoadVariant
105
- });
106
- } else {
107
- // For other variants, fall back to normal text weight/style
108
- if (normalBase64) {
109
- addFont(variant, normalBase64);
110
- }
111
- shiftAndLoadVariant();
112
- }
113
- };
114
- shiftAndLoadVariant();
115
- };
116
- /*
117
- * @private
118
- */
119
- var downloadPDF = function () {
120
- AST.setElementHTML(dummySVGContainer, svg);
121
- var textElements = dummySVGContainer.getElementsByTagName('text'),
122
- // Copy style property to element from parents if it's not
123
- // there. Searches up hierarchy until it finds prop, or hits the
124
- // chart container.
125
- setStylePropertyFromParents = function (el, propName) {
126
- var curParent = el;
127
- while (curParent && curParent !== dummySVGContainer) {
128
- if (curParent.style[propName]) {
129
- el.style[propName] = curParent.style[propName];
130
- break;
131
- }
132
- curParent = curParent.parentNode;
133
- }
134
- };
135
- var titleElements, outlineElements
136
- // Workaround for the text styling. Making sure it does pick up
137
- // settings for parent elements.
138
- ;
139
- [].forEach.call(textElements, function (el) {
140
- // Workaround for the text styling. making sure it does pick up
141
- // the root element
142
- ;
143
- ['font-family', 'font-size'].forEach(function (property) {
144
- setStylePropertyFromParents(el, property);
145
- });
146
- el.style.fontFamily = pdfFont && pdfFont.normal ?
147
- // Custom PDF font
148
- 'HighchartsFont' :
149
- // Generic font (serif, sans-serif etc)
150
- String(el.style.fontFamily && el.style.fontFamily.split(' ').splice(-1));
151
- // Workaround for plotband with width, removing title from text
152
- // nodes
153
- titleElements = el.getElementsByTagName('title');
154
- [].forEach.call(titleElements, function (titleElement) {
155
- el.removeChild(titleElement);
156
- });
157
-
158
- // Remove all .highcharts-text-outline elements, #17170
159
- outlineElements = el.getElementsByClassName('highcharts-text-outline');
160
- while (outlineElements.length > 0) {
161
- const outline = outlineElements[0];
162
- if (outline.parentNode) {
163
- outline.parentNode.removeChild(outline);
164
- }
165
- }
166
- });
167
- var svgNode = dummySVGContainer.querySelector('svg');
168
- if (svgNode) {
169
- loadPdfFonts(svgNode, function () {
170
- svgToPdf(svgNode, 0, function (pdfData) {
171
- try {
172
- downloadURL(pdfData, filename);
173
- if (successCallback) {
174
- successCallback();
175
- }
176
- } catch (e) {
177
- failCallback(e);
178
- }
179
- });
180
- });
181
- }
182
- };
183
- // Initiate download depending on file type
184
- if (imageType === 'image/svg+xml') {
185
- // SVG download. In this case, we want to use Microsoft specific
186
- // Blob if available
187
- try {
188
- if (typeof win.navigator.msSaveOrOpenBlob !== 'undefined') {
189
- // eslint-disable-next-line no-undef
190
- blob = new MSBlobBuilder();
191
- blob.append(svg);
192
- svgurl = blob.getBlob('image/svg+xml');
193
- } else {
194
- svgurl = svgToDataUrl(svg);
195
- }
196
- downloadURL(svgurl, filename);
197
- if (successCallback) {
198
- successCallback();
199
- }
200
- } catch (e) {
201
- failCallback(e);
202
- }
203
- } else if (imageType === 'application/pdf') {
204
- if (win.jspdf && win.jspdf.jsPDF) {
205
- downloadPDF();
206
- } else {
207
- // Must load pdf libraries first. // Don't destroy the object
208
- // URL yet since we are doing things asynchronously. A cleaner
209
- // solution would be nice, but this will do for now.
210
- objectURLRevoke = true;
211
- getScript(libURL + 'jspdf.js', function () {
212
- getScript(libURL + 'svg2pdf.js', downloadPDF);
213
- });
214
- }
215
- } else {
216
- // PNG/JPEG download - create bitmap from SVG
217
- svgurl = svgToDataUrl(svg);
218
- finallyHandler = function () {
219
- try {
220
- OfflineExporting.domurl.revokeObjectURL(svgurl);
221
- } catch (e) {
222
- // Ignore
223
- }
224
- };
225
- // First, try to get PNG by rendering on canvas
226
- imageToDataUrl(svgurl, imageType, {}, scale, function (imageURL) {
227
- // Success
228
- try {
229
- downloadURL(imageURL, filename);
230
- if (successCallback) {
231
- successCallback();
232
- }
233
- } catch (e) {
234
- failCallback(e);
235
- }
236
- }, function () {
237
- // Failed due to tainted canvas
238
- // Create new and untainted canvas
239
- var canvas = doc.createElement('canvas'),
240
- ctx = canvas.getContext('2d'),
241
- imageWidth = svg.match(
242
- // eslint-disable-next-line no-useless-escape
243
- /^<svg[^>]*width\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale,
244
- imageHeight = svg.match(
245
- // eslint-disable-next-line no-useless-escape
246
- /^<svg[^>]*height\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale,
247
- downloadWithCanVG = function () {
248
- var v = win.canvg.Canvg.fromString(ctx, svg);
249
- v.start();
250
- try {
251
- downloadURL(win.navigator.msSaveOrOpenBlob ? canvas.msToBlob() : canvas.toDataURL(imageType), filename);
252
- if (successCallback) {
253
- successCallback();
254
- }
255
- } catch (e) {
256
- failCallback(e);
257
- } finally {
258
- finallyHandler();
259
- }
260
- };
261
- canvas.width = imageWidth;
262
- canvas.height = imageHeight;
263
- if (win.canvg) {
264
- // Use preloaded canvg
265
- downloadWithCanVG();
266
- } else {
267
- // Must load canVG first. // Don't destroy the object
268
- // URL yet since we are doing things asynchronously. A
269
- // cleaner solution would be nice, but this will do for
270
- // now.
271
- objectURLRevoke = true;
272
- getScript(libURL + 'canvg.js', function () {
273
- downloadWithCanVG();
274
- });
275
- }
276
- },
277
- // No canvas support
278
- failCallback,
279
- // Failed to load image
280
- failCallback,
281
- // Finally
282
- function () {
283
- if (objectURLRevoke) {
284
- finallyHandler();
285
- }
286
- });
287
- }
288
- });
289
- }
@@ -1,6 +0,0 @@
1
- import nonASCIIFontBugfix from './nonASCIIFont.js';
2
- import textShadowBugFix from './textShadow.js';
3
- export default function (H) {
4
- textShadowBugFix(H);
5
- nonASCIIFontBugfix(H);
6
- }
@@ -1,11 +0,0 @@
1
- /* This is a workaround for https://github.com/highcharts/highcharts/issues/22008
2
- * We add some transparent text in a non-ASCII script to the chart to prevent
3
- * the chart from being exported in a serif font */
4
-
5
- export default function (H) {
6
- H.addEvent(H.Chart, 'load', function () {
7
- this.renderer.text('모', 20, 20).attr({
8
- opacity: 0
9
- }).add();
10
- });
11
- }
@@ -1,283 +0,0 @@
1
- /* This plugin was provided by HighCharts support and resolves an issue with label
2
- * text that has a white outline, such as the one we use for stacked bar charts.
3
- * For example: "ANC: 1-4 visits by districts this year (stacked)"
4
- * This issue has actually been resolved in HighCharts v11, so once we have upgraded
5
- * to that version, this plugin can be removed. */
6
-
7
- export default function (H) {
8
- const {
9
- AST,
10
- defaultOptions,
11
- downloadURL
12
- } = H,
13
- {
14
- ajax
15
- } = H.HttpUtilities,
16
- doc = document,
17
- win = window,
18
- OfflineExporting = H._modules['Extensions/OfflineExporting/OfflineExporting.js'],
19
- {
20
- getScript,
21
- svgToPdf,
22
- imageToDataUrl,
23
- svgToDataUrl
24
- } = OfflineExporting;
25
- H.wrap(OfflineExporting, 'downloadSVGLocal', function (proceed, svg, options, failCallback, successCallback) {
26
- var dummySVGContainer = doc.createElement('div'),
27
- imageType = options.type || 'image/png',
28
- filename = (options.filename || 'chart') + '.' + (imageType === 'image/svg+xml' ? 'svg' : imageType.split('/')[1]),
29
- scale = options.scale || 1;
30
- var svgurl,
31
- blob,
32
- finallyHandler,
33
- libURL = options.libURL || defaultOptions.exporting.libURL,
34
- objectURLRevoke = true,
35
- pdfFont = options.pdfFont;
36
- // Allow libURL to end with or without fordward slash
37
- libURL = libURL.slice(-1) !== '/' ? libURL + '/' : libURL;
38
- /*
39
- * Detect if we need to load TTF fonts for the PDF, then load them and
40
- * proceed.
41
- *
42
- * @private
43
- */
44
- var loadPdfFonts = function (svgElement, callback) {
45
- var hasNonASCII = function (s) {
46
- return (
47
- // eslint-disable-next-line no-control-regex
48
- /[^\u0000-\u007F\u200B]+/.test(s)
49
- );
50
- };
51
- // Register an event in order to add the font once jsPDF is
52
- // initialized
53
- var addFont = function (variant, base64) {
54
- win.jspdf.jsPDF.API.events.push(['initialized', function () {
55
- this.addFileToVFS(variant, base64);
56
- this.addFont(variant, 'HighchartsFont', variant);
57
- if (!this.getFontList().HighchartsFont) {
58
- this.setFont('HighchartsFont');
59
- }
60
- }]);
61
- };
62
- // If there are no non-ASCII characters in the SVG, do not use
63
- // bother downloading the font files
64
- if (pdfFont && !hasNonASCII(svgElement.textContent || '')) {
65
- pdfFont = void 0;
66
- }
67
- // Add new font if the URL is declared, #6417.
68
- var variants = ['normal', 'italic', 'bold', 'bolditalic'];
69
- // Shift the first element off the variants and add as a font.
70
- // Then asynchronously trigger the next variant until calling the
71
- // callback when the variants are empty.
72
- var normalBase64;
73
- var shiftAndLoadVariant = function () {
74
- var variant = variants.shift();
75
- // All variants shifted and possibly loaded, proceed
76
- if (!variant) {
77
- return callback();
78
- }
79
- var url = pdfFont && pdfFont[variant];
80
- if (url) {
81
- ajax({
82
- url: url,
83
- responseType: 'blob',
84
- success: function (data, xhr) {
85
- var reader = new FileReader();
86
- reader.onloadend = function () {
87
- if (typeof this.result === 'string') {
88
- var base64 = this.result.split(',')[1];
89
- addFont(variant, base64);
90
- if (variant === 'normal') {
91
- normalBase64 = base64;
92
- }
93
- }
94
- shiftAndLoadVariant();
95
- };
96
- reader.readAsDataURL(xhr.response);
97
- },
98
- error: shiftAndLoadVariant
99
- });
100
- } else {
101
- // For other variants, fall back to normal text weight/style
102
- if (normalBase64) {
103
- addFont(variant, normalBase64);
104
- }
105
- shiftAndLoadVariant();
106
- }
107
- };
108
- shiftAndLoadVariant();
109
- };
110
- /*
111
- * @private
112
- */
113
- var downloadPDF = function () {
114
- AST.setElementHTML(dummySVGContainer, svg);
115
- var textElements = dummySVGContainer.getElementsByTagName('text'),
116
- // Copy style property to element from parents if it's not
117
- // there. Searches up hierarchy until it finds prop, or hits the
118
- // chart container.
119
- setStylePropertyFromParents = function (el, propName) {
120
- var curParent = el;
121
- while (curParent && curParent !== dummySVGContainer) {
122
- if (curParent.style[propName]) {
123
- el.style[propName] = curParent.style[propName];
124
- break;
125
- }
126
- curParent = curParent.parentNode;
127
- }
128
- };
129
- var titleElements, outlineElements
130
- // Workaround for the text styling. Making sure it does pick up
131
- // settings for parent elements.
132
- ;
133
- [].forEach.call(textElements, function (el) {
134
- // Workaround for the text styling. making sure it does pick up
135
- // the root element
136
- ;
137
- ['font-family', 'font-size'].forEach(function (property) {
138
- setStylePropertyFromParents(el, property);
139
- });
140
- el.style.fontFamily = pdfFont && pdfFont.normal ?
141
- // Custom PDF font
142
- 'HighchartsFont' :
143
- // Generic font (serif, sans-serif etc)
144
- String(el.style.fontFamily && el.style.fontFamily.split(' ').splice(-1));
145
- // Workaround for plotband with width, removing title from text
146
- // nodes
147
- titleElements = el.getElementsByTagName('title');
148
- [].forEach.call(titleElements, function (titleElement) {
149
- el.removeChild(titleElement);
150
- });
151
-
152
- // Remove all .highcharts-text-outline elements, #17170
153
- outlineElements = el.getElementsByClassName('highcharts-text-outline');
154
- while (outlineElements.length > 0) {
155
- const outline = outlineElements[0];
156
- if (outline.parentNode) {
157
- outline.parentNode.removeChild(outline);
158
- }
159
- }
160
- });
161
- var svgNode = dummySVGContainer.querySelector('svg');
162
- if (svgNode) {
163
- loadPdfFonts(svgNode, function () {
164
- svgToPdf(svgNode, 0, function (pdfData) {
165
- try {
166
- downloadURL(pdfData, filename);
167
- if (successCallback) {
168
- successCallback();
169
- }
170
- } catch (e) {
171
- failCallback(e);
172
- }
173
- });
174
- });
175
- }
176
- };
177
- // Initiate download depending on file type
178
- if (imageType === 'image/svg+xml') {
179
- // SVG download. In this case, we want to use Microsoft specific
180
- // Blob if available
181
- try {
182
- if (typeof win.navigator.msSaveOrOpenBlob !== 'undefined') {
183
- // eslint-disable-next-line no-undef
184
- blob = new MSBlobBuilder();
185
- blob.append(svg);
186
- svgurl = blob.getBlob('image/svg+xml');
187
- } else {
188
- svgurl = svgToDataUrl(svg);
189
- }
190
- downloadURL(svgurl, filename);
191
- if (successCallback) {
192
- successCallback();
193
- }
194
- } catch (e) {
195
- failCallback(e);
196
- }
197
- } else if (imageType === 'application/pdf') {
198
- if (win.jspdf && win.jspdf.jsPDF) {
199
- downloadPDF();
200
- } else {
201
- // Must load pdf libraries first. // Don't destroy the object
202
- // URL yet since we are doing things asynchronously. A cleaner
203
- // solution would be nice, but this will do for now.
204
- objectURLRevoke = true;
205
- getScript(libURL + 'jspdf.js', function () {
206
- getScript(libURL + 'svg2pdf.js', downloadPDF);
207
- });
208
- }
209
- } else {
210
- // PNG/JPEG download - create bitmap from SVG
211
- svgurl = svgToDataUrl(svg);
212
- finallyHandler = function () {
213
- try {
214
- OfflineExporting.domurl.revokeObjectURL(svgurl);
215
- } catch (e) {
216
- // Ignore
217
- }
218
- };
219
- // First, try to get PNG by rendering on canvas
220
- imageToDataUrl(svgurl, imageType, {}, scale, function (imageURL) {
221
- // Success
222
- try {
223
- downloadURL(imageURL, filename);
224
- if (successCallback) {
225
- successCallback();
226
- }
227
- } catch (e) {
228
- failCallback(e);
229
- }
230
- }, function () {
231
- // Failed due to tainted canvas
232
- // Create new and untainted canvas
233
- var canvas = doc.createElement('canvas'),
234
- ctx = canvas.getContext('2d'),
235
- imageWidth = svg.match(
236
- // eslint-disable-next-line no-useless-escape
237
- /^<svg[^>]*width\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale,
238
- imageHeight = svg.match(
239
- // eslint-disable-next-line no-useless-escape
240
- /^<svg[^>]*height\s*=\s*\"?(\d+)\"?[^>]*>/)[1] * scale,
241
- downloadWithCanVG = function () {
242
- var v = win.canvg.Canvg.fromString(ctx, svg);
243
- v.start();
244
- try {
245
- downloadURL(win.navigator.msSaveOrOpenBlob ? canvas.msToBlob() : canvas.toDataURL(imageType), filename);
246
- if (successCallback) {
247
- successCallback();
248
- }
249
- } catch (e) {
250
- failCallback(e);
251
- } finally {
252
- finallyHandler();
253
- }
254
- };
255
- canvas.width = imageWidth;
256
- canvas.height = imageHeight;
257
- if (win.canvg) {
258
- // Use preloaded canvg
259
- downloadWithCanVG();
260
- } else {
261
- // Must load canVG first. // Don't destroy the object
262
- // URL yet since we are doing things asynchronously. A
263
- // cleaner solution would be nice, but this will do for
264
- // now.
265
- objectURLRevoke = true;
266
- getScript(libURL + 'canvg.js', function () {
267
- downloadWithCanVG();
268
- });
269
- }
270
- },
271
- // No canvas support
272
- failCallback,
273
- // Failed to load image
274
- failCallback,
275
- // Finally
276
- function () {
277
- if (objectURLRevoke) {
278
- finallyHandler();
279
- }
280
- });
281
- }
282
- });
283
- }