@dhis2/analytics 22.0.0 → 23.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/build/cjs/__demo__/OpenFileDialog.stories.js +39 -6
- package/build/cjs/components/FileMenu/FileMenu.js +6 -0
- package/build/cjs/components/OpenFileDialog/CustomSelectOption.js +18 -4
- package/build/cjs/components/OpenFileDialog/FileList.js +5 -5
- package/build/cjs/components/OpenFileDialog/OpenFileDialog.js +26 -21
- package/build/cjs/components/OpenFileDialog/VisTypeFilter.js +17 -16
- package/build/cjs/components/OpenFileDialog/utils.js +33 -74
- package/build/cjs/index.js +22 -4
- package/build/cjs/locales/ar/translations.json +2 -0
- package/build/cjs/locales/ar_EG/translations.json +2 -0
- package/build/cjs/locales/ar_IQ/translations.json +2 -0
- package/build/cjs/locales/ckb/translations.json +2 -0
- package/build/cjs/locales/cs/translations.json +2 -0
- package/build/cjs/locales/da/translations.json +2 -0
- package/build/cjs/locales/en/translations.json +3 -21
- package/build/cjs/locales/es/translations.json +2 -0
- package/build/cjs/locales/fr/translations.json +2 -0
- package/build/cjs/locales/id/translations.json +2 -0
- package/build/cjs/locales/km/translations.json +2 -0
- package/build/cjs/locales/lo/translations.json +2 -0
- package/build/cjs/locales/my/translations.json +2 -0
- package/build/cjs/locales/nb/translations.json +2 -0
- package/build/cjs/locales/nl/translations.json +2 -0
- package/build/cjs/locales/prs/translations.json +2 -0
- package/build/cjs/locales/ps/translations.json +2 -0
- package/build/cjs/locales/pt/translations.json +2 -0
- package/build/cjs/locales/pt_BR/translations.json +2 -0
- package/build/cjs/locales/ru/translations.json +2 -0
- package/build/cjs/locales/sv/translations.json +2 -0
- package/build/cjs/locales/tet/translations.json +2 -0
- package/build/cjs/locales/tg/translations.json +2 -0
- package/build/cjs/locales/uk/translations.json +2 -0
- package/build/cjs/locales/ur/translations.json +2 -0
- package/build/cjs/locales/uz/translations.json +2 -0
- package/build/cjs/locales/uz_Latn/translations.json +2 -0
- package/build/cjs/locales/vi/translations.json +2 -0
- package/build/cjs/locales/zh/translations.json +2 -0
- package/build/cjs/locales/zh_CN/translations.json +2 -0
- package/build/cjs/modules/visTypes.js +12 -21
- package/build/es/__demo__/OpenFileDialog.stories.js +38 -6
- package/build/es/components/FileMenu/FileMenu.js +6 -0
- package/build/es/components/OpenFileDialog/CustomSelectOption.js +17 -4
- package/build/es/components/OpenFileDialog/FileList.js +5 -5
- package/build/es/components/OpenFileDialog/OpenFileDialog.js +27 -23
- package/build/es/components/OpenFileDialog/VisTypeFilter.js +18 -14
- package/build/es/components/OpenFileDialog/utils.js +32 -71
- package/build/es/index.js +2 -2
- package/build/es/locales/ar/translations.json +2 -0
- package/build/es/locales/ar_EG/translations.json +2 -0
- package/build/es/locales/ar_IQ/translations.json +2 -0
- package/build/es/locales/ckb/translations.json +2 -0
- package/build/es/locales/cs/translations.json +2 -0
- package/build/es/locales/da/translations.json +2 -0
- package/build/es/locales/en/translations.json +3 -21
- package/build/es/locales/es/translations.json +2 -0
- package/build/es/locales/fr/translations.json +2 -0
- package/build/es/locales/id/translations.json +2 -0
- package/build/es/locales/km/translations.json +2 -0
- package/build/es/locales/lo/translations.json +2 -0
- package/build/es/locales/my/translations.json +2 -0
- package/build/es/locales/nb/translations.json +2 -0
- package/build/es/locales/nl/translations.json +2 -0
- package/build/es/locales/prs/translations.json +2 -0
- package/build/es/locales/ps/translations.json +2 -0
- package/build/es/locales/pt/translations.json +2 -0
- package/build/es/locales/pt_BR/translations.json +2 -0
- package/build/es/locales/ru/translations.json +2 -0
- package/build/es/locales/sv/translations.json +2 -0
- package/build/es/locales/tet/translations.json +2 -0
- package/build/es/locales/tg/translations.json +2 -0
- package/build/es/locales/uk/translations.json +2 -0
- package/build/es/locales/ur/translations.json +2 -0
- package/build/es/locales/uz/translations.json +2 -0
- package/build/es/locales/uz_Latn/translations.json +2 -0
- package/build/es/locales/vi/translations.json +2 -0
- package/build/es/locales/zh/translations.json +2 -0
- package/build/es/locales/zh_CN/translations.json +2 -0
- package/build/es/modules/visTypes.js +9 -19
- package/package.json +1 -1
|
@@ -83,13 +83,13 @@
|
|
|
83
83
|
"Anyone": "Anyone",
|
|
84
84
|
"Only you": "Only you",
|
|
85
85
|
"Others": "Others",
|
|
86
|
+
"Not supported by this app yet": "Not supported by this app yet",
|
|
86
87
|
"Filter by name": "Filter by name",
|
|
87
88
|
"Created": "Created",
|
|
88
89
|
"Last updated": "Last updated",
|
|
89
90
|
"Type": "Type",
|
|
90
91
|
"Clear filters": "Clear filters",
|
|
91
92
|
"{{firstItemIndex}}-{{lastItemIndex}} of {{totalNumberOfItems}}": "{{firstItemIndex}}-{{lastItemIndex}} of {{totalNumberOfItems}}",
|
|
92
|
-
"All charts": "All charts",
|
|
93
93
|
"Open": "Open",
|
|
94
94
|
"Couldn't load items": "Couldn't load items",
|
|
95
95
|
"There was a problem loading items. Try again or contact your system administrator.": "There was a problem loading items. Try again or contact your system administrator.",
|
|
@@ -110,13 +110,6 @@
|
|
|
110
110
|
"No maps found. Click New map to get started.": "No maps found. Click New map to get started.",
|
|
111
111
|
"No maps found. Try adjusting your search or filter options to find what you're looking for.": "No maps found. Try adjusting your search or filter options to find what you're looking for.",
|
|
112
112
|
"New map": "New map",
|
|
113
|
-
"Open an event report": "Open an event report",
|
|
114
|
-
"Loading event reports": "Loading event reports",
|
|
115
|
-
"Couldn't load event reports": "Couldn't load event reports",
|
|
116
|
-
"There was a problem loading event reports. Try again or contact your system administrator.": "There was a problem loading event reports. Try again or contact your system administrator.",
|
|
117
|
-
"No event reports found. Click New event report to get started.": "No event reports found. Click New event report to get started.",
|
|
118
|
-
"No event reports found. Try adjusting your search or filter options to find what you're looking for.": "No event reports found. Try adjusting your search or filter options to find what you're looking for.",
|
|
119
|
-
"New event report": "New event report",
|
|
120
113
|
"Open an event visualization": "Open an event visualization",
|
|
121
114
|
"Loading event visualizations": "Loading event visualizations",
|
|
122
115
|
"Couldn't load event visualizations": "Couldn't load event visualizations",
|
|
@@ -318,19 +311,8 @@
|
|
|
318
311
|
"Year over year (column)": "Year over year (column)",
|
|
319
312
|
"Single value": "Single value",
|
|
320
313
|
"Scatter": "Scatter",
|
|
321
|
-
"
|
|
322
|
-
"
|
|
323
|
-
"Compare parts of a whole against related elements vertically. Recommend data or org. unit as series.": "Compare parts of a whole against related elements vertically. Recommend data or org. unit as series.",
|
|
324
|
-
"Compare sizes of related elements horizontally. Recommend period as filter.": "Compare sizes of related elements horizontally. Recommend period as filter.",
|
|
325
|
-
"Compare parts of a whole against related elements horizontally. Recommend data or org. unit as series.": "Compare parts of a whole against related elements horizontally. Recommend data or org. unit as series.",
|
|
326
|
-
"Track or compare changes over time. Recommend period as category.": "Track or compare changes over time. Recommend period as category.",
|
|
327
|
-
"Track or compare parts of a whole over time. Recommend data as series and period as category.": "Track or compare parts of a whole over time. Recommend data as series and period as category.",
|
|
328
|
-
"Compare parts of a whole at a single point in time. Recommend period as filter.": "Compare parts of a whole at a single point in time. Recommend period as filter.",
|
|
329
|
-
"Compare several items against multiple variables.": "Compare several items against multiple variables.",
|
|
330
|
-
"Compare a percentage indicator against a 100% scale. Recommend period as filter.": "Compare a percentage indicator against a 100% scale. Recommend period as filter.",
|
|
331
|
-
"Compare changes over time between multiple time periods.": "Compare changes over time between multiple time periods.",
|
|
332
|
-
"Display a single value. Recommend relative period to show latest data.": "Display a single value. Recommend relative period to show latest data.",
|
|
333
|
-
"View the relationship between two data items at a place or time. Recommended for finding outliers.": "View the relationship between two data items at a place or time. Recommended for finding outliers.",
|
|
314
|
+
"Line list": "Line list",
|
|
315
|
+
"All charts": "All charts",
|
|
334
316
|
"{{seriesName}} (trend)": "{{seriesName}} (trend)",
|
|
335
317
|
"Trend": "Trend",
|
|
336
318
|
"No legend for this series": "No legend for this series",
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"Unsubscribe": "",
|
|
17
17
|
"Subscribe to get updates about new interpretations.": "",
|
|
18
18
|
"Subscribe": "",
|
|
19
|
+
"This app could not retrieve required data.": "",
|
|
20
|
+
"Network error": "",
|
|
19
21
|
"Data Type": "Tipo de datos",
|
|
20
22
|
"All types": "Todos los tipos",
|
|
21
23
|
"Totals only": "",
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"Unsubscribe": "",
|
|
17
17
|
"Subscribe to get updates about new interpretations.": "",
|
|
18
18
|
"Subscribe": "",
|
|
19
|
+
"This app could not retrieve required data.": "",
|
|
20
|
+
"Network error": "",
|
|
19
21
|
"Data Type": "Type de données",
|
|
20
22
|
"All types": "Tous les types",
|
|
21
23
|
"Totals only": "Totaux uniquement",
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
"Unsubscribe": "",
|
|
16
16
|
"Subscribe to get updates about new interpretations.": "",
|
|
17
17
|
"Subscribe": "",
|
|
18
|
+
"This app could not retrieve required data.": "",
|
|
19
|
+
"Network error": "",
|
|
18
20
|
"Data Type": "Tipe Data",
|
|
19
21
|
"All types": "Semua jenis",
|
|
20
22
|
"Totals only": "Total saja",
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"Unsubscribe": "Avslutt abonnementet",
|
|
17
17
|
"Subscribe to get updates about new interpretations.": "Abonner for å få oppdateringer om nye tolkninger.",
|
|
18
18
|
"Subscribe": "Abonner",
|
|
19
|
+
"This app could not retrieve required data.": "",
|
|
20
|
+
"Network error": "",
|
|
19
21
|
"Data Type": "Datatype",
|
|
20
22
|
"All types": "Alle typer",
|
|
21
23
|
"Totals only": "Kun totaler",
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
"Unsubscribe": "",
|
|
17
17
|
"Subscribe to get updates about new interpretations.": "",
|
|
18
18
|
"Subscribe": "",
|
|
19
|
+
"This app could not retrieve required data.": "",
|
|
20
|
+
"Network error": "",
|
|
19
21
|
"Data Type": "Tipo de dados",
|
|
20
22
|
"All types": "Todos os tipos",
|
|
21
23
|
"Totals only": "",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"Unsubscribe": "",
|
|
19
19
|
"Subscribe to get updates about new interpretations.": "",
|
|
20
20
|
"Subscribe": "",
|
|
21
|
+
"This app could not retrieve required data.": "",
|
|
22
|
+
"Network error": "",
|
|
21
23
|
"Data Type": "Тип данных",
|
|
22
24
|
"All types": "Все типы",
|
|
23
25
|
"Totals only": "",
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
"Unsubscribe": "",
|
|
16
16
|
"Subscribe to get updates about new interpretations.": "",
|
|
17
17
|
"Subscribe": "",
|
|
18
|
+
"This app could not retrieve required data.": "",
|
|
19
|
+
"Network error": "",
|
|
18
20
|
"Data Type": "Маълумот тури",
|
|
19
21
|
"All types": "Барча турлари",
|
|
20
22
|
"Totals only": "",
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
"Unsubscribe": "",
|
|
16
16
|
"Subscribe to get updates about new interpretations.": "",
|
|
17
17
|
"Subscribe": "",
|
|
18
|
+
"This app could not retrieve required data.": "",
|
|
19
|
+
"Network error": "",
|
|
18
20
|
"Data Type": "Maʼlumot turi",
|
|
19
21
|
"All types": "Barcha turlari",
|
|
20
22
|
"Totals only": "",
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
"Unsubscribe": "",
|
|
16
16
|
"Subscribe to get updates about new interpretations.": "",
|
|
17
17
|
"Subscribe": "",
|
|
18
|
+
"This app could not retrieve required data.": "",
|
|
19
|
+
"Network error": "",
|
|
18
20
|
"Data Type": "Loại dữ liệu",
|
|
19
21
|
"All types": "Các loại",
|
|
20
22
|
"Totals only": "",
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
"Unsubscribe": "退订",
|
|
16
16
|
"Subscribe to get updates about new interpretations.": "订阅以获取有关新解释的更新。",
|
|
17
17
|
"Subscribe": "订阅",
|
|
18
|
+
"This app could not retrieve required data.": "",
|
|
19
|
+
"Network error": "",
|
|
18
20
|
"Data Type": "数据类型",
|
|
19
21
|
"All types": "所有类型",
|
|
20
22
|
"Totals only": "总计",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isColumnBasedType = exports.isLegendSetType = exports.isVerticalType = exports.isTwoCategoryChartType = exports.isSingleValue = exports.isMultiType = exports.isDualAxisType = exports.isYearOverYear = exports.isStacked = exports.defaultVisType = exports.getDisplayNameByVisType = exports.visTypeIcons = exports.
|
|
6
|
+
exports.isColumnBasedType = exports.isLegendSetType = exports.isVerticalType = exports.isTwoCategoryChartType = exports.isSingleValue = exports.isMultiType = exports.isDualAxisType = exports.isYearOverYear = exports.isStacked = exports.defaultVisType = exports.getDisplayNameByVisType = exports.visTypeIcons = exports.visTypeDisplayNames = exports.VIS_TYPE_GROUP_CHARTS = exports.VIS_TYPE_GROUP_ALL = exports.VIS_TYPE_LINE_LIST = exports.VIS_TYPE_SCATTER = exports.VIS_TYPE_PIVOT_TABLE = exports.VIS_TYPE_SINGLE_VALUE = exports.VIS_TYPE_YEAR_OVER_YEAR_COLUMN = exports.VIS_TYPE_YEAR_OVER_YEAR_LINE = exports.VIS_TYPE_BUBBLE = exports.VIS_TYPE_GAUGE = exports.VIS_TYPE_RADAR = exports.VIS_TYPE_PIE = exports.VIS_TYPE_STACKED_AREA = exports.VIS_TYPE_AREA = exports.VIS_TYPE_LINE = exports.VIS_TYPE_STACKED_BAR = exports.VIS_TYPE_BAR = exports.VIS_TYPE_STACKED_COLUMN = exports.VIS_TYPE_COLUMN = void 0;
|
|
7
7
|
|
|
8
8
|
var _ui = require("@dhis2/ui");
|
|
9
9
|
|
|
@@ -45,6 +45,10 @@ const VIS_TYPE_SCATTER = 'SCATTER';
|
|
|
45
45
|
exports.VIS_TYPE_SCATTER = VIS_TYPE_SCATTER;
|
|
46
46
|
const VIS_TYPE_LINE_LIST = 'LINE_LIST';
|
|
47
47
|
exports.VIS_TYPE_LINE_LIST = VIS_TYPE_LINE_LIST;
|
|
48
|
+
const VIS_TYPE_GROUP_ALL = 'ALL';
|
|
49
|
+
exports.VIS_TYPE_GROUP_ALL = VIS_TYPE_GROUP_ALL;
|
|
50
|
+
const VIS_TYPE_GROUP_CHARTS = 'CHARTS';
|
|
51
|
+
exports.VIS_TYPE_GROUP_CHARTS = VIS_TYPE_GROUP_CHARTS;
|
|
48
52
|
const visTypeDisplayNames = {
|
|
49
53
|
[VIS_TYPE_PIVOT_TABLE]: _index.default.t('Pivot table'),
|
|
50
54
|
[VIS_TYPE_COLUMN]: _index.default.t('Column'),
|
|
@@ -60,27 +64,12 @@ const visTypeDisplayNames = {
|
|
|
60
64
|
[VIS_TYPE_YEAR_OVER_YEAR_LINE]: _index.default.t('Year over year (line)'),
|
|
61
65
|
[VIS_TYPE_YEAR_OVER_YEAR_COLUMN]: _index.default.t('Year over year (column)'),
|
|
62
66
|
[VIS_TYPE_SINGLE_VALUE]: _index.default.t('Single value'),
|
|
63
|
-
[VIS_TYPE_SCATTER]: _index.default.t('Scatter')
|
|
67
|
+
[VIS_TYPE_SCATTER]: _index.default.t('Scatter'),
|
|
68
|
+
[VIS_TYPE_LINE_LIST]: _index.default.t('Line list'),
|
|
69
|
+
[VIS_TYPE_GROUP_ALL]: _index.default.t('All types'),
|
|
70
|
+
[VIS_TYPE_GROUP_CHARTS]: _index.default.t('All charts')
|
|
64
71
|
};
|
|
65
72
|
exports.visTypeDisplayNames = visTypeDisplayNames;
|
|
66
|
-
const visTypeDescriptions = {
|
|
67
|
-
[VIS_TYPE_PIVOT_TABLE]: _index.default.t('View data and indicators in a manipulatable table.'),
|
|
68
|
-
[VIS_TYPE_COLUMN]: _index.default.t('Compare sizes of related elements vertically. Recommend period as filter.'),
|
|
69
|
-
[VIS_TYPE_STACKED_COLUMN]: _index.default.t('Compare parts of a whole against related elements vertically. Recommend data or org. unit as series.'),
|
|
70
|
-
[VIS_TYPE_BAR]: _index.default.t('Compare sizes of related elements horizontally. Recommend period as filter.'),
|
|
71
|
-
[VIS_TYPE_STACKED_BAR]: _index.default.t('Compare parts of a whole against related elements horizontally. Recommend data or org. unit as series.'),
|
|
72
|
-
[VIS_TYPE_LINE]: _index.default.t('Track or compare changes over time. Recommend period as category.'),
|
|
73
|
-
[VIS_TYPE_AREA]: _index.default.t('Track or compare changes over time. Recommend period as category.'),
|
|
74
|
-
[VIS_TYPE_STACKED_AREA]: _index.default.t('Track or compare parts of a whole over time. Recommend data as series and period as category.'),
|
|
75
|
-
[VIS_TYPE_PIE]: _index.default.t('Compare parts of a whole at a single point in time. Recommend period as filter.'),
|
|
76
|
-
[VIS_TYPE_RADAR]: _index.default.t('Compare several items against multiple variables.'),
|
|
77
|
-
[VIS_TYPE_GAUGE]: _index.default.t('Compare a percentage indicator against a 100% scale. Recommend period as filter.'),
|
|
78
|
-
[VIS_TYPE_YEAR_OVER_YEAR_LINE]: _index.default.t('Compare changes over time between multiple time periods.'),
|
|
79
|
-
[VIS_TYPE_YEAR_OVER_YEAR_COLUMN]: _index.default.t('Compare changes over time between multiple time periods.'),
|
|
80
|
-
[VIS_TYPE_SINGLE_VALUE]: _index.default.t('Display a single value. Recommend relative period to show latest data.'),
|
|
81
|
-
[VIS_TYPE_SCATTER]: _index.default.t('View the relationship between two data items at a place or time. Recommended for finding outliers.')
|
|
82
|
-
};
|
|
83
|
-
exports.visTypeDescriptions = visTypeDescriptions;
|
|
84
73
|
const visTypeIcons = {
|
|
85
74
|
[VIS_TYPE_PIVOT_TABLE]: _ui.IconTable24,
|
|
86
75
|
[VIS_TYPE_BAR]: _ui.IconVisualizationBar24,
|
|
@@ -96,7 +85,9 @@ const visTypeIcons = {
|
|
|
96
85
|
[VIS_TYPE_YEAR_OVER_YEAR_LINE]: _ui.IconVisualizationLineMulti24,
|
|
97
86
|
[VIS_TYPE_YEAR_OVER_YEAR_COLUMN]: _ui.IconVisualizationColumnMulti24,
|
|
98
87
|
[VIS_TYPE_SINGLE_VALUE]: _ui.IconVisualizationSingleValue24,
|
|
99
|
-
[VIS_TYPE_SCATTER]: _ui.IconVisualizationScatter24
|
|
88
|
+
[VIS_TYPE_SCATTER]: _ui.IconVisualizationScatter24,
|
|
89
|
+
[VIS_TYPE_LINE_LIST]: _ui.IconTable24 // TODO different icon @joe
|
|
90
|
+
|
|
100
91
|
};
|
|
101
92
|
exports.visTypeIcons = visTypeIcons;
|
|
102
93
|
|
|
@@ -2,6 +2,7 @@ import { Provider } from '@dhis2/app-runtime';
|
|
|
2
2
|
import { storiesOf } from '@storybook/react';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { OpenFileDialog } from '../components/OpenFileDialog/OpenFileDialog.js';
|
|
5
|
+
import { VIS_TYPE_GROUP_ALL, VIS_TYPE_GROUP_CHARTS, VIS_TYPE_PIVOT_TABLE, VIS_TYPE_COLUMN, VIS_TYPE_BAR, VIS_TYPE_LINE_LIST } from '../modules/visTypes.js';
|
|
5
6
|
const configMock = {
|
|
6
7
|
baseUrl: 'https://debug.dhis2.org/dev',
|
|
7
8
|
apiVersion: 37
|
|
@@ -14,17 +15,30 @@ const user = {
|
|
|
14
15
|
|
|
15
16
|
const onFileSelect = id => alert("Opening ".concat(id));
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
const filterVisTypesWithGroupsAndDivider = [{
|
|
19
|
+
type: VIS_TYPE_GROUP_ALL
|
|
20
|
+
}, {
|
|
21
|
+
type: VIS_TYPE_GROUP_CHARTS,
|
|
22
|
+
insertDivider: true
|
|
23
|
+
}, {
|
|
24
|
+
type: VIS_TYPE_PIVOT_TABLE
|
|
25
|
+
}, {
|
|
26
|
+
type: VIS_TYPE_COLUMN
|
|
27
|
+
}, {
|
|
28
|
+
type: VIS_TYPE_BAR
|
|
29
|
+
}];
|
|
30
|
+
storiesOf('OpenFileDialog', module).add('List of visualizations with vis type filter and divider (no default vis type)', () => /*#__PURE__*/React.createElement(Provider, {
|
|
18
31
|
config: configMock
|
|
19
32
|
}, /*#__PURE__*/React.createElement(OpenFileDialog, {
|
|
20
33
|
type: "visualization",
|
|
34
|
+
filterVisTypes: filterVisTypesWithGroupsAndDivider,
|
|
21
35
|
onClose: Function.prototype,
|
|
22
36
|
onFileSelect: onFileSelect,
|
|
23
37
|
onNew: Function.prototype,
|
|
24
38
|
open: true,
|
|
25
39
|
currentUser: user
|
|
26
40
|
})));
|
|
27
|
-
storiesOf('OpenFileDialog', module).add('List of maps', () => /*#__PURE__*/React.createElement(Provider, {
|
|
41
|
+
storiesOf('OpenFileDialog', module).add('List of maps (no vis type filter)', () => /*#__PURE__*/React.createElement(Provider, {
|
|
28
42
|
config: configMock
|
|
29
43
|
}, /*#__PURE__*/React.createElement(OpenFileDialog, {
|
|
30
44
|
type: "map",
|
|
@@ -34,20 +48,38 @@ storiesOf('OpenFileDialog', module).add('List of maps', () => /*#__PURE__*/React
|
|
|
34
48
|
open: true,
|
|
35
49
|
currentUser: user
|
|
36
50
|
})));
|
|
37
|
-
|
|
51
|
+
const filterVisTypesWithDisabled = [{
|
|
52
|
+
type: VIS_TYPE_PIVOT_TABLE,
|
|
53
|
+
disabled: true
|
|
54
|
+
}, {
|
|
55
|
+
type: VIS_TYPE_LINE_LIST
|
|
56
|
+
}];
|
|
57
|
+
storiesOf('OpenFileDialog', module).add('List of event visualizations with vis type filter, disabled type and default vis type', () => /*#__PURE__*/React.createElement(Provider, {
|
|
38
58
|
config: configMock
|
|
39
59
|
}, /*#__PURE__*/React.createElement(OpenFileDialog, {
|
|
40
|
-
type: "
|
|
60
|
+
type: "eventVisualization",
|
|
61
|
+
filterVisTypes: filterVisTypesWithDisabled,
|
|
62
|
+
defaultFilterVisType: VIS_TYPE_LINE_LIST,
|
|
41
63
|
onClose: Function.prototype,
|
|
42
64
|
onFileSelect: onFileSelect,
|
|
43
65
|
onNew: Function.prototype,
|
|
44
66
|
open: true,
|
|
45
67
|
currentUser: user
|
|
46
68
|
})));
|
|
47
|
-
|
|
69
|
+
const filterVisTypesWithGroupDividerAndDisabled = [{
|
|
70
|
+
type: VIS_TYPE_GROUP_ALL
|
|
71
|
+
}, {
|
|
72
|
+
type: VIS_TYPE_BAR,
|
|
73
|
+
insertDivider: true
|
|
74
|
+
}, {
|
|
75
|
+
type: VIS_TYPE_COLUMN,
|
|
76
|
+
disabled: true
|
|
77
|
+
}];
|
|
78
|
+
storiesOf('OpenFileDialog', module).add('List of visualizations with vis type filter with group type, divider and disabled option (no default vis type)', () => /*#__PURE__*/React.createElement(Provider, {
|
|
48
79
|
config: configMock
|
|
49
80
|
}, /*#__PURE__*/React.createElement(OpenFileDialog, {
|
|
50
|
-
type: "
|
|
81
|
+
type: "visualization",
|
|
82
|
+
filterVisTypes: filterVisTypesWithGroupDividerAndDisabled,
|
|
51
83
|
onClose: Function.prototype,
|
|
52
84
|
onFileSelect: onFileSelect,
|
|
53
85
|
onNew: Function.prototype,
|
|
@@ -13,8 +13,10 @@ import { SaveAsDialog } from './SaveAsDialog.js';
|
|
|
13
13
|
import { supportedFileTypes } from './utils.js';
|
|
14
14
|
export const FileMenu = ({
|
|
15
15
|
currentUser,
|
|
16
|
+
defaultFilterVisType,
|
|
16
17
|
fileType,
|
|
17
18
|
fileObject,
|
|
19
|
+
filterVisTypes,
|
|
18
20
|
onNew,
|
|
19
21
|
onOpen,
|
|
20
22
|
onSave,
|
|
@@ -129,6 +131,8 @@ export const FileMenu = ({
|
|
|
129
131
|
}, i18n.t('File'))), /*#__PURE__*/React.createElement(OpenFileDialog, {
|
|
130
132
|
open: currentDialog === 'open',
|
|
131
133
|
type: fileType,
|
|
134
|
+
filterVisTypes: filterVisTypes,
|
|
135
|
+
defaultFilterVisType: defaultFilterVisType,
|
|
132
136
|
onClose: onDialogClose,
|
|
133
137
|
onFileSelect: id => {
|
|
134
138
|
onOpen(id);
|
|
@@ -237,8 +241,10 @@ FileMenu.defaultProps = {
|
|
|
237
241
|
};
|
|
238
242
|
FileMenu.propTypes = {
|
|
239
243
|
currentUser: PropTypes.object,
|
|
244
|
+
defaultFilterVisType: PropTypes.string,
|
|
240
245
|
fileObject: PropTypes.object,
|
|
241
246
|
fileType: PropTypes.oneOf(supportedFileTypes),
|
|
247
|
+
filterVisTypes: PropTypes.array,
|
|
242
248
|
onDelete: PropTypes.func,
|
|
243
249
|
onError: PropTypes.func,
|
|
244
250
|
onNew: PropTypes.func,
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import i18n from '@dhis2/d2-i18n';
|
|
3
|
+
import { MenuDivider, Tooltip } from '@dhis2/ui';
|
|
2
4
|
import cx from 'classnames';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import React from 'react';
|
|
5
7
|
import styles from './styles/CustomSelectOption.style.js';
|
|
6
|
-
|
|
8
|
+
|
|
9
|
+
const CustomSelectOptionItem = ({
|
|
7
10
|
value,
|
|
8
11
|
label,
|
|
9
12
|
icon,
|
|
13
|
+
insertDivider,
|
|
10
14
|
onClick,
|
|
11
15
|
active,
|
|
12
16
|
disabled
|
|
13
|
-
}) => /*#__PURE__*/React.createElement("div", {
|
|
17
|
+
}) => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
14
18
|
onClick: e => onClick({}, e),
|
|
15
19
|
"data-value": value,
|
|
16
20
|
"data-label": label,
|
|
@@ -19,10 +23,18 @@ export const CustomSelectOption = ({
|
|
|
19
23
|
disabled
|
|
20
24
|
}) || "")
|
|
21
25
|
}, icon, /*#__PURE__*/React.createElement("span", {
|
|
22
|
-
className: "jsx-".concat(styles.__hash) + " " +
|
|
26
|
+
className: "jsx-".concat(styles.__hash) + " " + (cx({
|
|
27
|
+
label: icon
|
|
28
|
+
}) || "")
|
|
23
29
|
}, label), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
24
30
|
id: styles.__hash
|
|
25
|
-
}, styles))
|
|
31
|
+
}, styles)), insertDivider && /*#__PURE__*/React.createElement(MenuDivider, {
|
|
32
|
+
dense: true
|
|
33
|
+
}));
|
|
34
|
+
|
|
35
|
+
export const CustomSelectOption = props => props.disabled ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
36
|
+
content: i18n.t('Not supported by this app yet')
|
|
37
|
+
}, /*#__PURE__*/React.createElement(CustomSelectOptionItem, props)) : /*#__PURE__*/React.createElement(CustomSelectOptionItem, props);
|
|
26
38
|
CustomSelectOption.propTypes = {
|
|
27
39
|
icon: PropTypes.element.isRequired,
|
|
28
40
|
label: PropTypes.string.isRequired,
|
|
@@ -31,4 +43,5 @@ CustomSelectOption.propTypes = {
|
|
|
31
43
|
disabled: PropTypes.bool,
|
|
32
44
|
onClick: PropTypes.func
|
|
33
45
|
};
|
|
46
|
+
CustomSelectOptionItem.propTypes = CustomSelectOption.propTypes;
|
|
34
47
|
export default CustomSelectOption;
|
|
@@ -4,14 +4,14 @@ import React from 'react';
|
|
|
4
4
|
import { VisTypeIcon } from '../VisTypeIcon.js';
|
|
5
5
|
import { DateField } from './DateField.js';
|
|
6
6
|
export const FileList = ({
|
|
7
|
-
type,
|
|
8
7
|
data,
|
|
9
|
-
onSelect
|
|
8
|
+
onSelect,
|
|
9
|
+
showVisTypeColumn
|
|
10
10
|
}) => /*#__PURE__*/React.createElement(React.Fragment, null, data.map(visualization => /*#__PURE__*/React.createElement(DataTableRow, {
|
|
11
11
|
key: visualization.id
|
|
12
12
|
}, /*#__PURE__*/React.createElement(DataTableCell, {
|
|
13
13
|
onClick: () => onSelect(visualization.id)
|
|
14
|
-
}, visualization.displayName),
|
|
14
|
+
}, visualization.displayName), showVisTypeColumn && /*#__PURE__*/React.createElement(DataTableCell, {
|
|
15
15
|
align: "center"
|
|
16
16
|
}, /*#__PURE__*/React.createElement(VisTypeIcon, {
|
|
17
17
|
type: visualization.type,
|
|
@@ -30,7 +30,7 @@ FileList.propTypes = {
|
|
|
30
30
|
lastUpdated: PropTypes.string.isRequired,
|
|
31
31
|
type: PropTypes.string
|
|
32
32
|
})).isRequired,
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
onSelect: PropTypes.func.isRequired,
|
|
34
|
+
showVisTypeColumn: PropTypes.bool
|
|
35
35
|
};
|
|
36
36
|
export default FileList;
|