@dhis2/analytics 26.13.4 → 27.0.1

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.
@@ -20,6 +20,7 @@ export const VIS_TYPE_BUBBLE = 'BUBBLE';
20
20
  export const VIS_TYPE_GROUP_ALL = 'ALL';
21
21
  export const VIS_TYPE_GROUP_CHARTS = 'CHARTS';
22
22
  export const VIS_TYPE_OUTLIER_TABLE = 'OUTLIER_TABLE';
23
+ export const VIS_TYPE_MAP = 'MAP';
23
24
  export const visTypeDisplayNames = {
24
25
  [VIS_TYPE_PIVOT_TABLE]: i18n.t('Pivot table'),
25
26
  [VIS_TYPE_AREA]: i18n.t('Area'),
@@ -39,7 +40,8 @@ export const visTypeDisplayNames = {
39
40
  [VIS_TYPE_SINGLE_VALUE]: i18n.t('Single value'),
40
41
  [VIS_TYPE_OUTLIER_TABLE]: i18n.t('Outlier table'),
41
42
  [VIS_TYPE_GROUP_ALL]: i18n.t('All types'),
42
- [VIS_TYPE_GROUP_CHARTS]: i18n.t('All charts')
43
+ [VIS_TYPE_GROUP_CHARTS]: i18n.t('All charts'),
44
+ [VIS_TYPE_MAP]: i18n.t('Map')
43
45
  };
44
46
  export const visTypeIcons = {
45
47
  [VIS_TYPE_PIVOT_TABLE]: IconVisualizationPivotTable24,
@@ -60,6 +62,26 @@ export const visTypeIcons = {
60
62
  [VIS_TYPE_SINGLE_VALUE]: IconVisualizationSingleValue24,
61
63
  [VIS_TYPE_OUTLIER_TABLE]: IconVisualizationOutlierTable24
62
64
  };
65
+ const visTypeApiEndpoints = {
66
+ [VIS_TYPE_PIVOT_TABLE]: 'visualizations',
67
+ [VIS_TYPE_AREA]: 'visualizations',
68
+ [VIS_TYPE_STACKED_AREA]: 'visualizations',
69
+ [VIS_TYPE_BAR]: 'visualizations',
70
+ [VIS_TYPE_STACKED_BAR]: 'visualizations',
71
+ [VIS_TYPE_COLUMN]: 'visualizations',
72
+ [VIS_TYPE_YEAR_OVER_YEAR_COLUMN]: 'visualizations',
73
+ [VIS_TYPE_STACKED_COLUMN]: 'visualizations',
74
+ [VIS_TYPE_GAUGE]: 'visualizations',
75
+ [VIS_TYPE_LINE]: 'visualizations',
76
+ [VIS_TYPE_YEAR_OVER_YEAR_LINE]: 'visualizations',
77
+ [VIS_TYPE_PIE]: 'visualizations',
78
+ [VIS_TYPE_RADAR]: 'visualizations',
79
+ [VIS_TYPE_SCATTER]: 'visualizations',
80
+ [VIS_TYPE_SINGLE_VALUE]: 'visualizations',
81
+ [VIS_TYPE_OUTLIER_TABLE]: 'visualizations',
82
+ [VIS_TYPE_LINE_LIST]: 'eventVisualizations',
83
+ [VIS_TYPE_MAP]: 'maps'
84
+ };
63
85
  export const getDisplayNameByVisType = visType => {
64
86
  const displayName = visTypeDisplayNames[visType];
65
87
  if (!displayName) {
@@ -67,6 +89,13 @@ export const getDisplayNameByVisType = visType => {
67
89
  }
68
90
  return displayName;
69
91
  };
92
+ export const getApiEndpointByVisType = visType => {
93
+ const apiEndpoint = visTypeApiEndpoints[visType];
94
+ if (!apiEndpoint) {
95
+ throw new Error(`${visType} is not a valid visualization type`);
96
+ }
97
+ return apiEndpoint;
98
+ };
70
99
  const stackedTypes = [VIS_TYPE_STACKED_COLUMN, VIS_TYPE_STACKED_BAR, VIS_TYPE_STACKED_AREA];
71
100
  const yearOverYearTypes = [VIS_TYPE_YEAR_OVER_YEAR_LINE, VIS_TYPE_YEAR_OVER_YEAR_COLUMN];
72
101
  const dualAxisTypes = [VIS_TYPE_COLUMN, VIS_TYPE_BAR, VIS_TYPE_LINE, VIS_TYPE_AREA];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "26.13.4",
3
+ "version": "27.0.1",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {
@@ -39,8 +39,8 @@
39
39
  "@storybook/preset-create-react-app": "^8.3.6",
40
40
  "@storybook/react": "^8.3.6",
41
41
  "@storybook/react-webpack5": "^8.3.6",
42
- "@testing-library/jest-dom": "^5.16.5",
43
- "@testing-library/react": "^12.1.5",
42
+ "@testing-library/jest-dom": "6.6.3",
43
+ "@testing-library/react": "^12",
44
44
  "enzyme": "^3.9.0",
45
45
  "enzyme-adapter-react-16": "^1.15.6",
46
46
  "fs-extra": "^10.1.0",