@dhis2/analytics 20.6.4 → 21.0.0-alpha.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.
- package/build/cjs/__demo__/Filter.stories.js +2 -2
- package/build/cjs/__demo__/FixedPeriodSelect.stories.js +2 -2
- package/build/cjs/__demo__/OpenFileDialog.stories.js +1 -1
- package/build/cjs/__demo__/OrgUnitDimension.stories.js +104 -0
- package/build/cjs/__demo__/PivotTable.stories.js +2 -2
- package/build/cjs/api/analytics/AnalyticsBase.js +1 -1
- package/build/cjs/api/analytics/AnalyticsRequest.js +1 -1
- package/build/cjs/api/analytics/AnalyticsRequestBase.js +3 -3
- package/build/cjs/api/analytics/AnalyticsRequestPropertiesMixin.js +7 -7
- package/build/cjs/api/analytics/AnalyticsResponse.js +2 -2
- package/build/cjs/api/analytics/__tests__/AnalyticsAggregate.spec.js +11 -1
- package/build/cjs/api/analytics/__tests__/AnalyticsRequest.spec.js +9 -9
- package/build/cjs/api/analytics/__tests__/AnalyticsRequestBase.spec.js +4 -4
- package/build/cjs/api/analytics/utils.js +1 -1
- package/build/cjs/api/dimensions.js +37 -37
- package/build/cjs/api/organisationUnits.js +100 -46
- package/build/cjs/components/DataDimension/DataTypesSelector.js +3 -3
- package/build/cjs/components/DataDimension/DetailSelector.js +2 -2
- package/build/cjs/components/DataDimension/GroupSelector.js +9 -9
- package/build/cjs/components/DataDimension/ItemSelector.js +19 -19
- package/build/cjs/components/DataDimension/MetricSelector.js +3 -3
- package/build/cjs/components/DataDimension/styles/DataTypesSelector.style.js +1 -1
- package/build/cjs/components/DataDimension/styles/DetailSelector.style.js +1 -1
- package/build/cjs/components/DataDimension/styles/GroupSelector.style.js +1 -1
- package/build/cjs/components/DataDimension/styles/MetricSelector.style.js +1 -1
- package/build/cjs/components/DimensionMenu.js +10 -10
- package/build/cjs/components/DimensionsPanel/DimensionsPanel.js +2 -2
- package/build/cjs/components/DimensionsPanel/List/DimensionItem.js +5 -5
- package/build/cjs/components/DimensionsPanel/List/DimensionLabel.js +2 -2
- package/build/cjs/components/DimensionsPanel/List/DimensionList.js +10 -10
- package/build/cjs/components/DimensionsPanel/List/styles/DimensionList.style.js +1 -1
- package/build/cjs/components/DimensionsPanel/styles/DimensionsPanel.style.js +1 -1
- package/build/cjs/components/DynamicDimension/DynamicDimension.js +4 -4
- package/build/cjs/components/DynamicDimension/ItemSelector.js +8 -8
- package/build/cjs/components/DynamicDimension/styles/DynamicDimension.style.js +1 -1
- package/build/cjs/components/FileMenu/DeleteDialog.js +4 -4
- package/build/cjs/components/FileMenu/FileMenu.js +7 -7
- package/build/cjs/components/FileMenu/FileMenu.styles.js +1 -1
- package/build/cjs/components/FileMenu/GetLinkDialog.js +3 -3
- package/build/cjs/components/FileMenu/RenameDialog.js +4 -4
- package/build/cjs/components/FileMenu/SaveAsDialog.js +4 -4
- package/build/cjs/components/FileMenu/__tests__/DeleteDialog.spec.js +1 -1
- package/build/cjs/components/FileMenu/__tests__/RenameDialog.spec.js +1 -1
- package/build/cjs/components/FileMenu/__tests__/SaveAsDialog.spec.js +1 -1
- package/build/cjs/components/FileMenu/utils.js +3 -3
- package/build/cjs/components/Filter/Filter.js +1 -1
- package/build/cjs/components/Filter/styles/Filter.style.js +1 -1
- package/build/cjs/components/LegendKey/LegendKey.js +9 -9
- package/build/cjs/components/LegendKey/styles/LegendKey.style.js +1 -1
- package/build/cjs/components/OpenFileDialog/CustomSelectOption.js +2 -2
- package/build/cjs/components/OpenFileDialog/OpenFileDialog.js +21 -21
- package/build/cjs/components/OpenFileDialog/OpenFileDialog.styles.js +1 -1
- package/build/cjs/components/OpenFileDialog/styles/CustomSelectOption.style.js +1 -1
- package/build/cjs/components/Options/VisualizationOptions.js +2 -2
- package/build/cjs/components/Options/styles/VisualizationOptions.style.js +10 -10
- package/build/cjs/components/OrgUnitDimension/OrgUnitDimension.js +224 -195
- package/build/cjs/components/OrgUnitDimension/OrgUnitDimensionOld.js +244 -0
- package/build/cjs/components/OrgUnitDimension/styles/OrgUnitDimension.style.js +5 -2
- package/build/cjs/components/PeriodDimension/FixedPeriodFilter.js +5 -5
- package/build/cjs/components/PeriodDimension/FixedPeriodSelect.js +6 -6
- package/build/cjs/components/PeriodDimension/PeriodTransfer.js +11 -11
- package/build/cjs/components/PeriodDimension/RelativePeriodFilter.js +2 -2
- package/build/cjs/components/PeriodDimension/styles/FixedPeriodSelect.style.js +1 -1
- package/build/cjs/components/PeriodDimension/styles/PeriodFilter.style.js +1 -1
- package/build/cjs/components/PeriodDimension/utils/fixedPeriods.js +49 -49
- package/build/cjs/components/PivotTable/PivotTable.js +2 -2
- package/build/cjs/components/PivotTable/PivotTableCell.js +3 -3
- package/build/cjs/components/PivotTable/PivotTableColumnHeaderCell.js +2 -2
- package/build/cjs/components/PivotTable/PivotTableContainer.js +2 -2
- package/build/cjs/components/PivotTable/PivotTableEngineContext.js +2 -2
- package/build/cjs/components/PivotTable/PivotTableSortIcon.js +2 -2
- package/build/cjs/components/PivotTable/PivotTableTitleRow.js +4 -4
- package/build/cjs/components/PivotTable/PivotTableValueCell.js +2 -2
- package/build/cjs/components/PivotTable/styles/PivotTable.style.js +3 -3
- package/build/cjs/components/TransferOption.js +7 -7
- package/build/cjs/components/styles/DimensionSelector.style.js +1 -1
- package/build/cjs/components/styles/TransferOption.style.js +1 -1
- package/build/cjs/index.js +24 -6
- package/build/cjs/locales/en/translations.json +15 -0
- package/build/cjs/locales/ru/translations.json +1 -1
- package/build/cjs/modules/axis.js +1 -1
- package/build/cjs/modules/layoutUiRules/rules.js +1 -1
- package/build/cjs/modules/ouIdHelper/index.js +9 -3
- package/build/cjs/modules/pivotTable/PivotTableEngine.js +3 -3
- package/build/cjs/modules/pivotTable/measureText.js +1 -1
- package/build/cjs/modules/relativeItems/index.js +1 -1
- package/build/cjs/modules/visTypes.js +1 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/addTrendLines.js +1 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/axis.js +2 -2
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/getAxisTitle.js +1 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/index.js +2 -2
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/legend.js +19 -8
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/legendSet.js +1 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/plotOptions.js +1 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/subtitle/index.js +1 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/title/index.js +1 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/title/scatter.js +1 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/xAxis/index.js +1 -1
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/yAxis/gauge.js +3 -3
- package/build/cjs/visualizations/config/adapters/dhis_highcharts/yAxis/index.js +2 -2
- package/build/cjs/visualizations/config/generators/dhis/singleValue.js +5 -5
- package/build/cjs/visualizations/config/index.js +3 -3
- package/build/cjs/visualizations/store/adapters/dhis_dhis/index.js +1 -1
- package/build/cjs/visualizations/store/adapters/dhis_highcharts/index.js +1 -1
- package/build/cjs/visualizations/store/adapters/dhis_highcharts/twoCategory.js +1 -1
- package/build/cjs/visualizations/store/index.js +2 -2
- package/build/cjs/visualizations/util/axisId.js +1 -1
- package/build/cjs/visualizations/util/getFilterText.js +3 -3
- package/build/es/__demo__/OpenFileDialog.stories.js +1 -1
- package/build/es/__demo__/OrgUnitDimension.stories.js +93 -0
- package/build/es/api/analytics/AnalyticsBase.js +1 -1
- package/build/es/api/analytics/AnalyticsRequest.js +1 -1
- package/build/es/api/analytics/AnalyticsRequestBase.js +3 -3
- package/build/es/api/analytics/AnalyticsRequestPropertiesMixin.js +7 -7
- package/build/es/api/analytics/AnalyticsResponse.js +2 -2
- package/build/es/api/analytics/__tests__/AnalyticsAggregate.spec.js +11 -1
- package/build/es/api/analytics/__tests__/AnalyticsRequest.spec.js +9 -9
- package/build/es/api/analytics/__tests__/AnalyticsRequestBase.spec.js +4 -4
- package/build/es/api/analytics/utils.js +1 -1
- package/build/es/api/dimensions.js +39 -39
- package/build/es/api/organisationUnits.js +93 -43
- package/build/es/components/DataDimension/DataTypesSelector.js +3 -3
- package/build/es/components/DataDimension/DetailSelector.js +2 -2
- package/build/es/components/DataDimension/GroupSelector.js +7 -7
- package/build/es/components/DataDimension/ItemSelector.js +17 -17
- package/build/es/components/DataDimension/MetricSelector.js +3 -3
- package/build/es/components/DataDimension/styles/DataTypesSelector.style.js +1 -1
- package/build/es/components/DataDimension/styles/DetailSelector.style.js +1 -1
- package/build/es/components/DataDimension/styles/GroupSelector.style.js +1 -1
- package/build/es/components/DataDimension/styles/MetricSelector.style.js +1 -1
- package/build/es/components/DimensionMenu.js +10 -10
- package/build/es/components/DimensionsPanel/List/DimensionItem.js +3 -3
- package/build/es/components/DimensionsPanel/List/DimensionList.js +8 -8
- package/build/es/components/DimensionsPanel/List/styles/DimensionList.style.js +1 -1
- package/build/es/components/DimensionsPanel/styles/DimensionsPanel.style.js +1 -1
- package/build/es/components/DynamicDimension/DynamicDimension.js +4 -4
- package/build/es/components/DynamicDimension/ItemSelector.js +6 -6
- package/build/es/components/DynamicDimension/styles/DynamicDimension.style.js +1 -1
- package/build/es/components/FileMenu/DeleteDialog.js +1 -1
- package/build/es/components/FileMenu/FileMenu.js +4 -4
- package/build/es/components/FileMenu/FileMenu.styles.js +1 -1
- package/build/es/components/FileMenu/GetLinkDialog.js +2 -2
- package/build/es/components/FileMenu/RenameDialog.js +1 -1
- package/build/es/components/FileMenu/SaveAsDialog.js +1 -1
- package/build/es/components/FileMenu/__tests__/DeleteDialog.spec.js +1 -1
- package/build/es/components/FileMenu/__tests__/RenameDialog.spec.js +1 -1
- package/build/es/components/FileMenu/__tests__/SaveAsDialog.spec.js +1 -1
- package/build/es/components/FileMenu/utils.js +3 -3
- package/build/es/components/Filter/Filter.js +1 -1
- package/build/es/components/Filter/styles/Filter.style.js +1 -1
- package/build/es/components/LegendKey/LegendKey.js +9 -9
- package/build/es/components/LegendKey/styles/LegendKey.style.js +1 -1
- package/build/es/components/OpenFileDialog/CustomSelectOption.js +2 -2
- package/build/es/components/OpenFileDialog/OpenFileDialog.js +19 -19
- package/build/es/components/OpenFileDialog/OpenFileDialog.styles.js +1 -1
- package/build/es/components/OpenFileDialog/styles/CustomSelectOption.style.js +1 -1
- package/build/es/components/Options/styles/VisualizationOptions.style.js +10 -10
- package/build/es/components/OrgUnitDimension/OrgUnitDimension.js +224 -196
- package/build/es/components/OrgUnitDimension/OrgUnitDimensionOld.js +220 -0
- package/build/es/components/OrgUnitDimension/styles/OrgUnitDimension.style.js +3 -2
- package/build/es/components/PeriodDimension/FixedPeriodFilter.js +5 -5
- package/build/es/components/PeriodDimension/FixedPeriodSelect.js +3 -3
- package/build/es/components/PeriodDimension/PeriodTransfer.js +9 -9
- package/build/es/components/PeriodDimension/RelativePeriodFilter.js +2 -2
- package/build/es/components/PeriodDimension/styles/FixedPeriodSelect.style.js +1 -1
- package/build/es/components/PeriodDimension/styles/PeriodFilter.style.js +1 -1
- package/build/es/components/PeriodDimension/utils/fixedPeriods.js +49 -49
- package/build/es/components/PivotTable/PivotTableCell.js +3 -3
- package/build/es/components/PivotTable/PivotTableColumnHeaderCell.js +2 -2
- package/build/es/components/PivotTable/PivotTableContainer.js +2 -2
- package/build/es/components/PivotTable/PivotTableSortIcon.js +2 -2
- package/build/es/components/PivotTable/PivotTableTitleRow.js +2 -2
- package/build/es/components/PivotTable/styles/PivotTable.style.js +3 -3
- package/build/es/components/TransferOption.js +6 -6
- package/build/es/components/styles/DimensionSelector.style.js +1 -1
- package/build/es/components/styles/TransferOption.style.js +1 -1
- package/build/es/index.js +2 -2
- package/build/es/locales/en/translations.json +15 -0
- package/build/es/locales/ru/translations.json +1 -1
- package/build/es/modules/axis.js +1 -1
- package/build/es/modules/layoutUiRules/rules.js +1 -1
- package/build/es/modules/ouIdHelper/index.js +5 -2
- package/build/es/modules/pivotTable/PivotTableEngine.js +3 -3
- package/build/es/modules/pivotTable/measureText.js +1 -1
- package/build/es/modules/relativeItems/index.js +2 -2
- package/build/es/modules/visTypes.js +1 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/addTrendLines.js +1 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/axis.js +2 -2
- package/build/es/visualizations/config/adapters/dhis_highcharts/getAxisTitle.js +1 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/legend.js +19 -8
- package/build/es/visualizations/config/adapters/dhis_highcharts/legendSet.js +1 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/plotOptions.js +1 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/subtitle/index.js +1 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/title/index.js +1 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/title/scatter.js +1 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/xAxis/index.js +1 -1
- package/build/es/visualizations/config/adapters/dhis_highcharts/yAxis/gauge.js +3 -3
- package/build/es/visualizations/config/adapters/dhis_highcharts/yAxis/index.js +2 -2
- package/build/es/visualizations/config/generators/dhis/singleValue.js +5 -5
- package/build/es/visualizations/config/index.js +3 -3
- package/build/es/visualizations/store/adapters/dhis_dhis/index.js +1 -1
- package/build/es/visualizations/store/adapters/dhis_highcharts/index.js +1 -1
- package/build/es/visualizations/store/adapters/dhis_highcharts/twoCategory.js +1 -1
- package/build/es/visualizations/store/index.js +2 -2
- package/build/es/visualizations/util/axisId.js +1 -1
- package/build/es/visualizations/util/getFilterText.js +3 -3
- package/package.json +2 -1
- package/CHANGELOG.md +0 -2749
- package/build/cjs/api/organisationUnits-dataEngine.js +0 -119
- package/build/cjs/components/OrgUnitDimension/__tests__/OrgUnitDimension.spec.js +0 -96
- package/build/es/api/organisationUnits-dataEngine.js +0 -96
- package/build/es/components/OrgUnitDimension/__tests__/OrgUnitDimension.spec.js +0 -86
|
@@ -101,6 +101,21 @@
|
|
|
101
101
|
"Options": "Options",
|
|
102
102
|
"Hide": "Hide",
|
|
103
103
|
"Update": "Update",
|
|
104
|
+
"{{count}} org units": "{{count}} org unit",
|
|
105
|
+
"{{count}} org units_plural": "{{count}} org units",
|
|
106
|
+
"{{count}} levels": "{{count}} level",
|
|
107
|
+
"{{count}} levels_plural": "{{count}} levels",
|
|
108
|
+
"{{count}} groups": "{{count}} group",
|
|
109
|
+
"{{count}} groups_plural": "{{count}} groups",
|
|
110
|
+
"{{count}} user org units": "{{count}} user org unit",
|
|
111
|
+
"{{count}} user org units_plural": "{{count}} user org units",
|
|
112
|
+
"Nothing selected": "Nothing selected",
|
|
113
|
+
"User organisation unit": "User organisation unit",
|
|
114
|
+
"User sub-units": "User sub-units",
|
|
115
|
+
"User sub-x2-units": "User sub-x2-units",
|
|
116
|
+
"Select a level": "Select a level",
|
|
117
|
+
"Select a group": "Select a group",
|
|
118
|
+
"Deselect all": "Deselect all",
|
|
104
119
|
"Period type": "Period type",
|
|
105
120
|
"Year": "Year",
|
|
106
121
|
"Select year": "Select year",
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"There was a problem loading items. Try again or contact your system administrator.": "",
|
|
77
77
|
"No items found. Create a new to get started.": "",
|
|
78
78
|
"No items found. Try adjusting your search or filter options to find what you're looking for.": "",
|
|
79
|
-
"Create new": "",
|
|
79
|
+
"Create new": "Создать новый",
|
|
80
80
|
"Open a visualization": "",
|
|
81
81
|
"Loading visualizations": "",
|
|
82
82
|
"Couldn't load visualizations": "",
|
|
@@ -44,7 +44,7 @@ const getAxisNameByLayoutType = (axisId, layoutType) => {
|
|
|
44
44
|
const name = getAxisNamesByLayoutType(layoutType)[axisId];
|
|
45
45
|
|
|
46
46
|
if (!name) {
|
|
47
|
-
throw new Error(
|
|
47
|
+
throw new Error(`${axisId} is not a valid axis id`);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
return name;
|
|
@@ -111,7 +111,7 @@ const getRulesByVisType = visType => {
|
|
|
111
111
|
const rules = visTypeToRules[visType];
|
|
112
112
|
|
|
113
113
|
if (!rules) {
|
|
114
|
-
throw new Error(
|
|
114
|
+
throw new Error(`${visType} is not a known visualization type`);
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
return rules;
|
|
@@ -3,9 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.ouIdHelper = void 0;
|
|
6
|
+
exports.ouIdHelper = exports.USER_ORG_UNIT_GRANDCHILDREN = exports.USER_ORG_UNIT_CHILDREN = exports.USER_ORG_UNIT = void 0;
|
|
7
7
|
const LEVEL_ID_PREFIX = 'LEVEL';
|
|
8
8
|
const GROUP_ID_PREFIX = 'OU_GROUP';
|
|
9
|
+
const USER_ORG_UNIT = 'USER_ORGUNIT';
|
|
10
|
+
exports.USER_ORG_UNIT = USER_ORG_UNIT;
|
|
11
|
+
const USER_ORG_UNIT_CHILDREN = 'USER_ORGUNIT_CHILDREN';
|
|
12
|
+
exports.USER_ORG_UNIT_CHILDREN = USER_ORG_UNIT_CHILDREN;
|
|
13
|
+
const USER_ORG_UNIT_GRANDCHILDREN = 'USER_ORGUNIT_GRANDCHILDREN';
|
|
14
|
+
exports.USER_ORG_UNIT_GRANDCHILDREN = USER_ORG_UNIT_GRANDCHILDREN;
|
|
9
15
|
|
|
10
16
|
const hasGroupPrefix = id => id.substr(0, GROUP_ID_PREFIX.length) === GROUP_ID_PREFIX;
|
|
11
17
|
|
|
@@ -18,8 +24,8 @@ const stripGroupPrefix = id => hasGroupPrefix(id) ? id.substr(GROUP_ID_PREFIX.le
|
|
|
18
24
|
const removePrefix = id => stripGroupPrefix(stripLevelPrefix(id));
|
|
19
25
|
|
|
20
26
|
const ouIdHelper = Object.freeze({
|
|
21
|
-
addLevelPrefix: id =>
|
|
22
|
-
addGroupPrefix: id =>
|
|
27
|
+
addLevelPrefix: id => `${LEVEL_ID_PREFIX}-${removePrefix(id)}`,
|
|
28
|
+
addGroupPrefix: id => `${GROUP_ID_PREFIX}-${removePrefix(id)}`,
|
|
23
29
|
removePrefix,
|
|
24
30
|
hasGroupPrefix,
|
|
25
31
|
hasLevelPrefix
|
|
@@ -369,7 +369,7 @@ class PivotTableEngine {
|
|
|
369
369
|
}
|
|
370
370
|
|
|
371
371
|
if (rowLevel === lastRowLevel && this.dimensionLookup.rows[lastRowLevel] && columnLevel === lastColumnLevel && this.dimensionLookup.columns[lastColumnLevel]) {
|
|
372
|
-
return
|
|
372
|
+
return `${this.dimensionLookup.rows[lastRowLevel].meta.name} / ${this.dimensionLookup.columns[lastColumnLevel].meta.name}`;
|
|
373
373
|
}
|
|
374
374
|
|
|
375
375
|
if (lastRowLevel === -1) {
|
|
@@ -963,12 +963,12 @@ class PivotTableEngine {
|
|
|
963
963
|
|
|
964
964
|
sort(column, order) {
|
|
965
965
|
if (order !== _pivotTableConstants.SORT_ORDER_ASCENDING && order !== _pivotTableConstants.SORT_ORDER_DESCENDING) {
|
|
966
|
-
console.warn(
|
|
966
|
+
console.warn(`Invalid sort order ${order}`);
|
|
967
967
|
return;
|
|
968
968
|
}
|
|
969
969
|
|
|
970
970
|
if (!this.isSortable(column)) {
|
|
971
|
-
console.warn(
|
|
971
|
+
console.warn(`Invalid sort column ${column}`);
|
|
972
972
|
return;
|
|
973
973
|
}
|
|
974
974
|
|
|
@@ -11,6 +11,6 @@ var _ouIdHelper = require("../ouIdHelper");
|
|
|
11
11
|
|
|
12
12
|
var _predefinedDimensions = require("../predefinedDimensions");
|
|
13
13
|
|
|
14
|
-
const hasRelativeItems = (dimension, itemIds = []) => dimension === _predefinedDimensions.DIMENSION_ID_ASSIGNED_CATEGORIES || dimension === _predefinedDimensions.DIMENSION_ID_ORGUNIT && Array.isArray(itemIds) && itemIds.some(id => _ouIdHelper.ouIdHelper.hasLevelPrefix(id) || _ouIdHelper.ouIdHelper.hasGroupPrefix(id) || [
|
|
14
|
+
const hasRelativeItems = (dimension, itemIds = []) => dimension === _predefinedDimensions.DIMENSION_ID_ASSIGNED_CATEGORIES || dimension === _predefinedDimensions.DIMENSION_ID_ORGUNIT && Array.isArray(itemIds) && itemIds.some(id => _ouIdHelper.ouIdHelper.hasLevelPrefix(id) || _ouIdHelper.ouIdHelper.hasGroupPrefix(id) || [_ouIdHelper.USER_ORG_UNIT, _ouIdHelper.USER_ORG_UNIT_CHILDREN, _ouIdHelper.USER_ORG_UNIT_GRANDCHILDREN].includes(id)) || dimension === _predefinedDimensions.DIMENSION_ID_PERIOD && Array.isArray(itemIds) && itemIds.some(id => (0, _relativePeriods.getRelativePeriodIds)().includes(id));
|
|
15
15
|
|
|
16
16
|
exports.hasRelativeItems = hasRelativeItems;
|
|
@@ -102,7 +102,7 @@ const getDisplayNameByVisType = visType => {
|
|
|
102
102
|
const displayName = visTypeDisplayNames[visType];
|
|
103
103
|
|
|
104
104
|
if (!displayName) {
|
|
105
|
-
throw new Error(
|
|
105
|
+
throw new Error(`${visType} is not a valid visualization type`);
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
return displayName;
|
|
@@ -97,7 +97,7 @@ function getTwoCategoryTrendLines(layout, series, isStacked) {
|
|
|
97
97
|
});
|
|
98
98
|
} else {
|
|
99
99
|
series.forEach(seriesObj => {
|
|
100
|
-
const trendlineSerieId =
|
|
100
|
+
const trendlineSerieId = `trendline-${seriesObj.id}`;
|
|
101
101
|
newSeries.push(seriesObj);
|
|
102
102
|
|
|
103
103
|
if (!seriesObj.custom.isTwoCategoryFakeSerie) {
|
|
@@ -34,7 +34,7 @@ const getPlotLineLabelStyle = fontStyle => ({
|
|
|
34
34
|
y: -7,
|
|
35
35
|
style: {
|
|
36
36
|
color: fontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR],
|
|
37
|
-
fontSize:
|
|
37
|
+
fontSize: `${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px`,
|
|
38
38
|
fontWeight: fontStyle[_fontStyle.FONT_STYLE_OPTION_BOLD] ? _fontStyle.FONT_STYLE_OPTION_BOLD : 'normal',
|
|
39
39
|
fontStyle: fontStyle[_fontStyle.FONT_STYLE_OPTION_ITALIC] ? _fontStyle.FONT_STYLE_OPTION_ITALIC : 'normal'
|
|
40
40
|
}
|
|
@@ -128,7 +128,7 @@ const getLabels = axis => {
|
|
|
128
128
|
return {
|
|
129
129
|
style: {
|
|
130
130
|
color: fontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR],
|
|
131
|
-
fontSize:
|
|
131
|
+
fontSize: `${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px`,
|
|
132
132
|
fontWeight: fontStyle[_fontStyle.FONT_STYLE_OPTION_BOLD] ? _fontStyle.FONT_STYLE_OPTION_BOLD : 'normal',
|
|
133
133
|
fontStyle: fontStyle[_fontStyle.FONT_STYLE_OPTION_ITALIC] ? _fontStyle.FONT_STYLE_OPTION_ITALIC : 'normal'
|
|
134
134
|
},
|
|
@@ -20,7 +20,7 @@ const getTitleStyle = (fontStyle, titleType, visType) => fontStyle ? {
|
|
|
20
20
|
margin: 15,
|
|
21
21
|
style: {
|
|
22
22
|
color: fontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR],
|
|
23
|
-
fontSize:
|
|
23
|
+
fontSize: `${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px`,
|
|
24
24
|
fontWeight: fontStyle[_fontStyle.FONT_STYLE_OPTION_BOLD] ? _fontStyle.FONT_STYLE_OPTION_BOLD : 'normal',
|
|
25
25
|
fontStyle: fontStyle[_fontStyle.FONT_STYLE_OPTION_ITALIC] ? _fontStyle.FONT_STYLE_OPTION_ITALIC : 'normal'
|
|
26
26
|
}
|
|
@@ -47,9 +47,9 @@ var _xAxis = _interopRequireDefault(require("./xAxis"));
|
|
|
47
47
|
|
|
48
48
|
var _yAxis = _interopRequireDefault(require("./yAxis"));
|
|
49
49
|
|
|
50
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
50
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
51
51
|
|
|
52
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
52
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
53
53
|
|
|
54
54
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
55
55
|
|
|
@@ -35,7 +35,7 @@ function getItemStyle(fontStyle, dashboard) {
|
|
|
35
35
|
fontWeight: 'normal'
|
|
36
36
|
}, dashboard ? DASHBOARD_ITEM_STYLE : {
|
|
37
37
|
color: fontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR],
|
|
38
|
-
fontSize:
|
|
38
|
+
fontSize: `${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px`,
|
|
39
39
|
fontWeight: fontStyle[_fontStyle.FONT_STYLE_OPTION_BOLD] ? _fontStyle.FONT_STYLE_OPTION_BOLD : 'normal',
|
|
40
40
|
fontStyle: fontStyle[_fontStyle.FONT_STYLE_OPTION_ITALIC] ? _fontStyle.FONT_STYLE_OPTION_ITALIC : 'normal'
|
|
41
41
|
})
|
|
@@ -86,22 +86,33 @@ const formatLabel = ({
|
|
|
86
86
|
|
|
87
87
|
if ((!seriesId || seriesId.startsWith('trendline')) && seriesType === (0, _type.default)(_visTypes.VIS_TYPE_LINE).type) {
|
|
88
88
|
// trendline
|
|
89
|
-
result.push(
|
|
90
|
-
result.push(
|
|
89
|
+
result.push(`<span style="height: ${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 6.5}px; width: ${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px; background-color: ${seriesColor}; display: inline-block;"></span>`);
|
|
90
|
+
result.push(`<span style="margin-left: 8px" class="data-test-series-key-item-name">${seriesName}</span>`);
|
|
91
91
|
} else if (legendSet !== null && legendSet !== void 0 && (_legendSet$legends = legendSet.legends) !== null && _legendSet$legends !== void 0 && _legendSet$legends.length && (0, _visTypes.isLegendSetType)(visType) && seriesType !== (0, _type.default)(_visTypes.VIS_TYPE_LINE).type) {
|
|
92
92
|
// item with legend set
|
|
93
|
-
legendSet.legends.sort((a, b) => a.startValue - b.startValue).forEach((legend, index) => result.push(
|
|
94
|
-
|
|
93
|
+
legendSet.legends.sort((a, b) => a.startValue - b.startValue).forEach((legend, index) => result.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}" height="${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}" version="1.1" style="margin-right:-5px; z-index: ${legendSet.legends.length - index}" class="data-test-series-key-item-bullet">
|
|
94
|
+
<circle cx="${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2}" cy="${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2}" r="${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2}" fill="${legend.color}"></circle>
|
|
95
|
+
</svg>`));
|
|
96
|
+
result.push(`<span style="margin-left: 8px" class="data-test-series-key-item-name">${seriesName}</span>`);
|
|
95
97
|
} else {
|
|
96
98
|
// regular item (not a trendline, no applied legend set)
|
|
97
99
|
if ((seriesColor === null || seriesColor === void 0 ? void 0 : seriesColor.patternIndex) !== undefined) {
|
|
98
100
|
const pattern = _colorSets.colorSets[_colorSets.COLOR_SET_PATTERNS].patterns[seriesColor.patternIndex];
|
|
99
|
-
result.push(
|
|
101
|
+
result.push(`<svg xmlns="http://www.w3.org/2000/svg" style="height: ${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px; width: ${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px; display: inline-block; margin-right:5px" class="data-test-series-key-item-bullet">
|
|
102
|
+
<defs>
|
|
103
|
+
<pattern id="pattern${seriesColor.patternIndex}" patternUnits="userSpaceOnUse" width="${pattern.width}" height="${pattern.height}">
|
|
104
|
+
<path stroke="${pattern.color}" d="${pattern.path}"/>
|
|
105
|
+
</pattern>
|
|
106
|
+
</defs>
|
|
107
|
+
<circle cx="${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2}" cy="${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2}" r="${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2}" fill="url(#pattern${seriesColor.patternIndex})"/>
|
|
108
|
+
</svg>`);
|
|
100
109
|
} else {
|
|
101
|
-
result.push(
|
|
110
|
+
result.push(`<svg xmlns="http://www.w3.org/2000/svg" width="${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}" height="${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}" version="1.1" style="margin-right:5px" class="data-test-series-key-item-bullet">
|
|
111
|
+
<circle cx="${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2}" cy="${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2}" r="${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE] / 2}" fill="${seriesColor}"></circle>
|
|
112
|
+
</svg>`);
|
|
102
113
|
}
|
|
103
114
|
|
|
104
|
-
result.push(
|
|
115
|
+
result.push(`<span class="data-test-series-key-item-name">${seriesName}</span>`);
|
|
105
116
|
}
|
|
106
117
|
|
|
107
118
|
result.push('</div>');
|
|
@@ -43,7 +43,7 @@ exports.applyLegendSet = applyLegendSet;
|
|
|
43
43
|
|
|
44
44
|
const getLegendSetTooltip = () => ({
|
|
45
45
|
pointFormatter: function () {
|
|
46
|
-
return
|
|
46
|
+
return `<span style="color:${this.color}">●</span> ${this.series.name}: <b>${this.y}</b><br>` + (this.legend ? `${this.legendSet}: <b>${this.legend}</b>` : `${_index.default.t('No legend for this series')}`);
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -41,7 +41,7 @@ var _default = ({
|
|
|
41
41
|
}));
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
return
|
|
44
|
+
return `${labels.map(label => `<b>${label}</b><br>`).join('')}${yAxisName}: ${y}<br>${xAxisName}: ${x}`;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
switch (visType) {
|
|
@@ -73,7 +73,7 @@ function _default(series, layout, metaData, dashboard) {
|
|
|
73
73
|
style: {
|
|
74
74
|
// DHIS2-578: dynamically truncate subtitle when it's taking more than 1 line
|
|
75
75
|
color: fontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR],
|
|
76
|
-
fontSize:
|
|
76
|
+
fontSize: `${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px`,
|
|
77
77
|
fontWeight: fontStyle[_fontStyle.FONT_STYLE_OPTION_BOLD] ? _fontStyle.FONT_STYLE_OPTION_BOLD : 'normal',
|
|
78
78
|
fontStyle: fontStyle[_fontStyle.FONT_STYLE_OPTION_ITALIC] ? _fontStyle.FONT_STYLE_OPTION_ITALIC : 'normal',
|
|
79
79
|
whiteSpace: 'nowrap',
|
|
@@ -77,7 +77,7 @@ function _default(layout, metaData, dashboard) {
|
|
|
77
77
|
align: (0, _getTextAlignOption.getTextAlignOption)(fontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_ALIGN], _fontStyle.FONT_STYLE_VISUALIZATION_TITLE, (0, _visTypes.isVerticalType)(layout.type)),
|
|
78
78
|
style: {
|
|
79
79
|
color: fontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR],
|
|
80
|
-
fontSize:
|
|
80
|
+
fontSize: `${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px`,
|
|
81
81
|
fontWeight: fontStyle[_fontStyle.FONT_STYLE_OPTION_BOLD] ? _fontStyle.FONT_STYLE_OPTION_BOLD : 'normal',
|
|
82
82
|
fontStyle: fontStyle[_fontStyle.FONT_STYLE_OPTION_ITALIC] ? _fontStyle.FONT_STYLE_OPTION_ITALIC : 'normal',
|
|
83
83
|
whiteSpace: 'nowrap',
|
|
@@ -14,6 +14,6 @@ function _default(layout, metaData, dashboard) {
|
|
|
14
14
|
|
|
15
15
|
if ((_layout$rows = layout.rows) !== null && _layout$rows !== void 0 && _layout$rows.length && (_layout$columns = layout.columns) !== null && _layout$columns !== void 0 && _layout$columns.length && !dashboard) {
|
|
16
16
|
const columns = (0, _getFilterText.default)(layout.columns, metaData).split(', ');
|
|
17
|
-
return
|
|
17
|
+
return `${(0, _getFilterText.default)(layout.rows, metaData)}: ${columns[0]} - ${columns[1]}`;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
@@ -44,7 +44,7 @@ const getLabels = axis => {
|
|
|
44
44
|
return {
|
|
45
45
|
style: {
|
|
46
46
|
color: fontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR],
|
|
47
|
-
fontSize:
|
|
47
|
+
fontSize: `${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px`,
|
|
48
48
|
fontWeight: fontStyle[_fontStyle.FONT_STYLE_OPTION_BOLD] ? _fontStyle.FONT_STYLE_OPTION_BOLD : 'normal',
|
|
49
49
|
fontStyle: fontStyle[_fontStyle.FONT_STYLE_OPTION_ITALIC] ? _fontStyle.FONT_STYLE_OPTION_ITALIC : 'normal'
|
|
50
50
|
},
|
|
@@ -68,12 +68,12 @@ function getPlotLine(regressionLine = {}, defaultLabel) {
|
|
|
68
68
|
color: fontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR] || '#000',
|
|
69
69
|
...(label && {
|
|
70
70
|
label: {
|
|
71
|
-
text:
|
|
71
|
+
text: `${label}: ${value}`,
|
|
72
72
|
verticalAlign,
|
|
73
73
|
y,
|
|
74
74
|
style: {
|
|
75
75
|
color: fontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR],
|
|
76
|
-
fontSize:
|
|
76
|
+
fontSize: `${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px`,
|
|
77
77
|
fontWeight: fontStyle[_fontStyle.FONT_STYLE_OPTION_BOLD] ? _fontStyle.FONT_STYLE_OPTION_BOLD : 'normal',
|
|
78
78
|
fontStyle: fontStyle[_fontStyle.FONT_STYLE_OPTION_ITALIC] ? _fontStyle.FONT_STYLE_OPTION_ITALIC : 'normal'
|
|
79
79
|
}
|
|
@@ -90,7 +90,7 @@ const getLabels = axis => {
|
|
|
90
90
|
y: parseInt(fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE], 10) + 7,
|
|
91
91
|
style: {
|
|
92
92
|
color: fontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR],
|
|
93
|
-
fontSize:
|
|
93
|
+
fontSize: `${fontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px`,
|
|
94
94
|
fontWeight: fontStyle[_fontStyle.FONT_STYLE_OPTION_BOLD] ? _fontStyle.FONT_STYLE_OPTION_BOLD : 'normal',
|
|
95
95
|
fontStyle: fontStyle[_fontStyle.FONT_STYLE_OPTION_ITALIC] ? _fontStyle.FONT_STYLE_OPTION_ITALIC : 'normal'
|
|
96
96
|
}
|
|
@@ -73,9 +73,9 @@ function getDefault(layout, series, extraOptions) {
|
|
|
73
73
|
var _axis$title;
|
|
74
74
|
|
|
75
75
|
rl.title = { ...rl.title,
|
|
76
|
-
text:
|
|
76
|
+
text: `${rl.title.text} - ${((_axis$title = axis.title) === null || _axis$title === void 0 ? void 0 : _axis$title.text) || _locales.default.t('Axis {{axisId}}', {
|
|
77
77
|
axisId: axis.index + 1
|
|
78
|
-
})
|
|
78
|
+
})}`
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
});
|
|
@@ -24,7 +24,7 @@ const generateValueSVG = ({
|
|
|
24
24
|
const textSize = 300;
|
|
25
25
|
const svgValue = document.createElementNS(svgNS, 'svg');
|
|
26
26
|
svgValue.setAttribute('xmlns', svgNS);
|
|
27
|
-
svgValue.setAttribute('viewBox',
|
|
27
|
+
svgValue.setAttribute('viewBox', `0 -${textSize + 50} ${textSize * 0.75 * formattedValue.length} ${textSize + 200}`);
|
|
28
28
|
|
|
29
29
|
if (y) {
|
|
30
30
|
svgValue.setAttribute('y', y);
|
|
@@ -52,7 +52,7 @@ const generateValueSVG = ({
|
|
|
52
52
|
if (subText) {
|
|
53
53
|
const svgSubText = document.createElementNS(svgNS, 'svg');
|
|
54
54
|
const subTextSize = 40;
|
|
55
|
-
svgSubText.setAttribute('viewBox',
|
|
55
|
+
svgSubText.setAttribute('viewBox', `0 -50 ${textSize * 0.75 * formattedValue.length} ${textSize + 200}`);
|
|
56
56
|
|
|
57
57
|
if (y) {
|
|
58
58
|
svgSubText.setAttribute('y', y);
|
|
@@ -146,7 +146,7 @@ const generateDVItem = (config, {
|
|
|
146
146
|
const svgNS = 'http://www.w3.org/2000/svg';
|
|
147
147
|
const svg = document.createElementNS(svgNS, 'svg');
|
|
148
148
|
svg.setAttribute('xmlns', svgNS);
|
|
149
|
-
svg.setAttribute('viewBox',
|
|
149
|
+
svg.setAttribute('viewBox', `0 0 ${width} ${height}`);
|
|
150
150
|
svg.setAttribute('width', '100%');
|
|
151
151
|
svg.setAttribute('height', '100%');
|
|
152
152
|
svg.setAttribute('data-test', 'visualization-container');
|
|
@@ -155,7 +155,7 @@ const generateDVItem = (config, {
|
|
|
155
155
|
title.setAttribute('x', getXFromTextAlign(titleFontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_ALIGN]));
|
|
156
156
|
title.setAttribute('y', 28);
|
|
157
157
|
title.setAttribute('text-anchor', getTextAnchorFromTextAlign(titleFontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_ALIGN]));
|
|
158
|
-
title.setAttribute('font-size',
|
|
158
|
+
title.setAttribute('font-size', `${titleFontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px`);
|
|
159
159
|
title.setAttribute('font-weight', titleFontStyle[_fontStyle.FONT_STYLE_OPTION_BOLD] ? _fontStyle.FONT_STYLE_OPTION_BOLD : 'normal');
|
|
160
160
|
title.setAttribute('font-style', titleFontStyle[_fontStyle.FONT_STYLE_OPTION_ITALIC] ? _fontStyle.FONT_STYLE_OPTION_ITALIC : 'normal');
|
|
161
161
|
title.setAttribute('fill', titleFontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR]);
|
|
@@ -172,7 +172,7 @@ const generateDVItem = (config, {
|
|
|
172
172
|
subtitle.setAttribute('y', 28);
|
|
173
173
|
subtitle.setAttribute('dy', 22);
|
|
174
174
|
subtitle.setAttribute('text-anchor', getTextAnchorFromTextAlign(subtitleFontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_ALIGN]));
|
|
175
|
-
subtitle.setAttribute('font-size',
|
|
175
|
+
subtitle.setAttribute('font-size', `${subtitleFontStyle[_fontStyle.FONT_STYLE_OPTION_FONT_SIZE]}px`);
|
|
176
176
|
subtitle.setAttribute('font-weight', subtitleFontStyle[_fontStyle.FONT_STYLE_OPTION_BOLD] ? _fontStyle.FONT_STYLE_OPTION_BOLD : 'normal');
|
|
177
177
|
subtitle.setAttribute('font-style', subtitleFontStyle[_fontStyle.FONT_STYLE_OPTION_ITALIC] ? _fontStyle.FONT_STYLE_OPTION_ITALIC : 'normal');
|
|
178
178
|
subtitle.setAttribute('fill', subtitleFontStyle[_fontStyle.FONT_STYLE_OPTION_TEXT_COLOR]);
|
|
@@ -34,15 +34,15 @@ function _default({
|
|
|
34
34
|
const _generator = _generators.default[outputFormat];
|
|
35
35
|
|
|
36
36
|
if (_validator === _validators.default.noValidation) {
|
|
37
|
-
onWarning(
|
|
37
|
+
onWarning(`No validation implementation for config input format "${inputFormat}"`);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
if (!_adapter) {
|
|
41
|
-
onError(
|
|
41
|
+
onError(`No config tranformation implementation for format "${inputFormat}" to format "${outputFormat}"`);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
if (!_generator) {
|
|
45
|
-
onError(
|
|
45
|
+
onError(`No visualization implementation for format ${outputFormat}`);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
const DEFAULT_EXTRA_OPTIONS = {
|
|
@@ -41,7 +41,7 @@ function getDefault(acc, seriesIds, categoryIds, idValueMap, metaData) {
|
|
|
41
41
|
seriesIds.forEach(seriesId => {
|
|
42
42
|
const serieData = [];
|
|
43
43
|
categoryIds.forEach(categoryId => {
|
|
44
|
-
const value = idValueMap.get(
|
|
44
|
+
const value = idValueMap.get(`${seriesId}-${categoryId}`); // DHIS2-1261: 0 is a valid value
|
|
45
45
|
// undefined value means the key was not found within the rows
|
|
46
46
|
// in that case null is returned as value in the serie
|
|
47
47
|
|
|
@@ -56,7 +56,7 @@ function getDefault(acc, series, categories, idValueMap, metaData) {
|
|
|
56
56
|
series[0].forEach(serieItemId => {
|
|
57
57
|
const serieData = [];
|
|
58
58
|
categories[0].forEach(categoryItemId => {
|
|
59
|
-
const value = idValueMap.get(
|
|
59
|
+
const value = idValueMap.get(`${serieItemId}-${categoryItemId}`); // DHIS2-1261: 0 is a valid value
|
|
60
60
|
// undefined value means the key was not found within the rows
|
|
61
61
|
// in that case null is returned as value in the serie
|
|
62
62
|
// this is to keep the correct indexes for the values within the serie array
|
|
@@ -16,7 +16,7 @@ function _default(acc, series, categories, idValueMap, metaData) {
|
|
|
16
16
|
categories[0].forEach(category1ItemId => {
|
|
17
17
|
const groupData = [];
|
|
18
18
|
categories[1].forEach(category2ItemId => {
|
|
19
|
-
const value = idValueMap.get(
|
|
19
|
+
const value = idValueMap.get(`${seriesItemId}-${category1ItemId}-${category2ItemId}`);
|
|
20
20
|
groupData.push(value === undefined ? null : parseFloat(value));
|
|
21
21
|
});
|
|
22
22
|
groupedData.push(groupData);
|
|
@@ -25,11 +25,11 @@ function _default({
|
|
|
25
25
|
const _adapter = _adapters.default[inputFormat + '_' + outputFormat];
|
|
26
26
|
|
|
27
27
|
if (_validator === _validators.default.noValidation) {
|
|
28
|
-
warning(
|
|
28
|
+
warning(`Validation not supported for data input format "${inputFormat}"`);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
if (!_adapter) {
|
|
32
|
-
error(
|
|
32
|
+
error(`Data tranformation from "${inputFormat}" to "${outputFormat}" is not supported`);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
this.data = data;
|
|
@@ -6,6 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getAxisStringFromId = void 0;
|
|
7
7
|
const AXIS_ID_PREFIX = 'AXIS_';
|
|
8
8
|
|
|
9
|
-
const getAxisStringFromId = id =>
|
|
9
|
+
const getAxisStringFromId = id => `${AXIS_ID_PREFIX}${id}`;
|
|
10
10
|
|
|
11
11
|
exports.getAxisStringFromId = getAxisStringFromId;
|
|
@@ -54,9 +54,9 @@ function _default(filters, metaData) {
|
|
|
54
54
|
} // otherwise use the values directly
|
|
55
55
|
// this is a temporary fix to avoid app crashing when using filters with data items in EV
|
|
56
56
|
else {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
sectionParts.push(metaData.items[filter.dimension].name + ': ' + filterItems.join(', '));
|
|
58
|
+
break;
|
|
59
|
+
}
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
titleFragments.push(sectionParts.join(', '));
|
|
@@ -12,7 +12,7 @@ const user = {
|
|
|
12
12
|
username: 'admin'
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
const onFileSelect = id => alert(
|
|
15
|
+
const onFileSelect = id => alert(`Opening ${id}`);
|
|
16
16
|
|
|
17
17
|
storiesOf('OpenFileDialog', module).add('List of visualizations', () => /*#__PURE__*/React.createElement(Provider, {
|
|
18
18
|
config: configMock
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { DataProvider } from '@dhis2/app-runtime';
|
|
2
|
+
import { storiesOf } from '@storybook/react';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import OrgUnitDimension from '../components/OrgUnitDimension/OrgUnitDimension';
|
|
5
|
+
|
|
6
|
+
const Wrapper = story => /*#__PURE__*/React.createElement(DataProvider, {
|
|
7
|
+
baseUrl: "http://localhost:8080/",
|
|
8
|
+
apiVersion: ""
|
|
9
|
+
}, story());
|
|
10
|
+
|
|
11
|
+
const defaultRootOrgUnits = ['ImspTQPwCqd']; // Sierra Leone
|
|
12
|
+
|
|
13
|
+
storiesOf('OrgUnitDimension', module).addDecorator(Wrapper).add('None selected', () => {
|
|
14
|
+
const [selected, setSelected] = useState([]);
|
|
15
|
+
return /*#__PURE__*/React.createElement(OrgUnitDimension, {
|
|
16
|
+
selected: selected,
|
|
17
|
+
onSelect: response => setSelected(response.items),
|
|
18
|
+
roots: defaultRootOrgUnits
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
storiesOf('OrgUnitDimension', module).addDecorator(Wrapper).add('Root selected', () => {
|
|
22
|
+
const [selected, setSelected] = useState([{
|
|
23
|
+
id: 'ImspTQPwCqd',
|
|
24
|
+
path: '/ImspTQPwCqd',
|
|
25
|
+
name: 'Sierra Leone'
|
|
26
|
+
}]);
|
|
27
|
+
return /*#__PURE__*/React.createElement(OrgUnitDimension, {
|
|
28
|
+
selected: selected,
|
|
29
|
+
onSelect: response => setSelected(response.items),
|
|
30
|
+
roots: defaultRootOrgUnits
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
storiesOf('OrgUnitDimension', module).addDecorator(Wrapper).add('Single level 2 child selected', () => {
|
|
34
|
+
const [selected, setSelected] = useState([{
|
|
35
|
+
id: 'fdc6uOvgoji',
|
|
36
|
+
path: '/ImspTQPwCqd/fdc6uOvgoji',
|
|
37
|
+
name: 'Bombali'
|
|
38
|
+
}]);
|
|
39
|
+
return /*#__PURE__*/React.createElement(OrgUnitDimension, {
|
|
40
|
+
selected: selected,
|
|
41
|
+
onSelect: response => setSelected(response.items),
|
|
42
|
+
roots: defaultRootOrgUnits
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
storiesOf('OrgUnitDimension', module).addDecorator(Wrapper).add('Multiple level 2 children selected', () => {
|
|
46
|
+
const [selected, setSelected] = useState([{
|
|
47
|
+
id: 'O6uvpzGd5pu',
|
|
48
|
+
path: '/ImspTQPwCqd/O6uvpzGd5pu',
|
|
49
|
+
name: 'Bo'
|
|
50
|
+
}, {
|
|
51
|
+
id: 'fdc6uOvgoji',
|
|
52
|
+
path: '/ImspTQPwCqd/fdc6uOvgoji',
|
|
53
|
+
name: 'Bombali'
|
|
54
|
+
}, {
|
|
55
|
+
id: 'lc3eMKXaEfw',
|
|
56
|
+
path: '/ImspTQPwCqd/lc3eMKXaEfw',
|
|
57
|
+
name: 'Bonthe'
|
|
58
|
+
}]);
|
|
59
|
+
return /*#__PURE__*/React.createElement(OrgUnitDimension, {
|
|
60
|
+
selected: selected,
|
|
61
|
+
onSelect: response => setSelected(response.items),
|
|
62
|
+
roots: defaultRootOrgUnits
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
storiesOf('OrgUnitDimension', module).addDecorator(Wrapper).add('Multiple selected across different levels', () => {
|
|
66
|
+
const [selected, setSelected] = useState([{
|
|
67
|
+
id: 'fdc6uOvgoji',
|
|
68
|
+
path: '/ImspTQPwCqd/fdc6uOvgoji',
|
|
69
|
+
name: 'Bombali'
|
|
70
|
+
}, {
|
|
71
|
+
id: 'KKkLOTpMXGV',
|
|
72
|
+
path: '/ImspTQPwCqd/fdc6uOvgoji/KKkLOTpMXGV',
|
|
73
|
+
name: 'Bombali Sebora'
|
|
74
|
+
}, {
|
|
75
|
+
id: 'GQcsUZf81vP',
|
|
76
|
+
path: '/ImspTQPwCqd/fdc6uOvgoji/KKkLOTpMXGV/GQcsUZf81vP',
|
|
77
|
+
name: 'Govt. Hosp. Makeni'
|
|
78
|
+
}]);
|
|
79
|
+
return /*#__PURE__*/React.createElement(OrgUnitDimension, {
|
|
80
|
+
selected: selected,
|
|
81
|
+
onSelect: response => setSelected(response.items),
|
|
82
|
+
roots: defaultRootOrgUnits
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
storiesOf('OrgUnitDimension', module).addDecorator(Wrapper).add('Multiple roots', () => {
|
|
86
|
+
const [selected, setSelected] = useState([]);
|
|
87
|
+
return /*#__PURE__*/React.createElement(OrgUnitDimension, {
|
|
88
|
+
selected: selected,
|
|
89
|
+
onSelect: response => setSelected(response.items),
|
|
90
|
+
roots: ['O6uvpzGd5pu', 'fdc6uOvgoji'] // Bo + Bombali
|
|
91
|
+
|
|
92
|
+
});
|
|
93
|
+
});
|
|
@@ -46,7 +46,7 @@ class AnalyticsRequest extends AnalyticsRequestDimensionsMixin(AnalyticsRequestF
|
|
|
46
46
|
let dimension = d.dimension;
|
|
47
47
|
|
|
48
48
|
if (d.filter) {
|
|
49
|
-
dimension +=
|
|
49
|
+
dimension += `:${d.filter}`;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
request = request.addDimension(dimension, d.items.map(item => item.id));
|