@dhis2/analytics 22.0.1 → 23.0.0-alpha.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.
Files changed (26) hide show
  1. package/build/cjs/__demo__/OpenFileDialog.stories.js +39 -6
  2. package/build/cjs/components/FileMenu/FileMenu.js +6 -0
  3. package/build/cjs/components/OpenFileDialog/CustomSelectOption.js +18 -4
  4. package/build/cjs/components/OpenFileDialog/FileList.js +5 -5
  5. package/build/cjs/components/OpenFileDialog/OpenFileDialog.js +26 -21
  6. package/build/cjs/components/OpenFileDialog/VisTypeFilter.js +17 -16
  7. package/build/cjs/components/OpenFileDialog/styles/FileList.style.js +10 -0
  8. package/build/cjs/components/OpenFileDialog/utils.js +33 -74
  9. package/build/cjs/index.js +16 -4
  10. package/build/cjs/locales/en/translations.json +3 -21
  11. package/build/cjs/modules/visTypes.js +12 -21
  12. package/build/cjs/visualizations/package-lock.json +1788 -0
  13. package/build/es/__demo__/OpenFileDialog.stories.js +38 -6
  14. package/build/es/components/FileMenu/FileMenu.js +6 -0
  15. package/build/es/components/OpenFileDialog/CustomSelectOption.js +17 -4
  16. package/build/es/components/OpenFileDialog/FileList.js +5 -5
  17. package/build/es/components/OpenFileDialog/OpenFileDialog.js +27 -23
  18. package/build/es/components/OpenFileDialog/VisTypeFilter.js +18 -14
  19. package/build/es/components/OpenFileDialog/styles/FileList.style.js +3 -0
  20. package/build/es/components/OpenFileDialog/utils.js +32 -71
  21. package/build/es/index.js +1 -1
  22. package/build/es/locales/en/translations.json +3 -21
  23. package/build/es/modules/visTypes.js +9 -19
  24. package/build/es/visualizations/package-lock.json +1788 -0
  25. package/package.json +1 -1
  26. package/CHANGELOG.md +0 -2997
@@ -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
- storiesOf('OpenFileDialog', module).add('List of visualizations', () => /*#__PURE__*/React.createElement(Provider, {
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
- storiesOf('OpenFileDialog', module).add('List of event reports (Line list only)', () => /*#__PURE__*/React.createElement(Provider, {
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: "eventReport",
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
- storiesOf('OpenFileDialog', module).add('List of a supported type without custom titles/texts', () => /*#__PURE__*/React.createElement(Provider, {
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: "eventChart",
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
- export const CustomSelectOption = ({
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) + " " + "label"
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), type === 'visualization' && /*#__PURE__*/React.createElement(DataTableCell, {
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
- type: PropTypes.string.isRequired,
34
- onSelect: PropTypes.func.isRequired
33
+ onSelect: PropTypes.func.isRequired,
34
+ showVisTypeColumn: PropTypes.bool
35
35
  };
36
36
  export default FileList;
@@ -5,13 +5,14 @@ import { Box, Modal, ModalTitle, ModalContent, DataTable, DataTableHead, DataTab
5
5
  import isEqual from 'lodash/isEqual';
6
6
  import PropTypes from 'prop-types';
7
7
  import React, { useEffect, useMemo, useState } from 'react';
8
+ import { VIS_TYPE_GROUP_ALL, VIS_TYPE_GROUP_CHARTS } from '../../modules/visTypes.js';
8
9
  import { CreatedByFilter, CREATED_BY_ALL, CREATED_BY_ALL_BUT_CURRENT_USER, CREATED_BY_CURRENT_USER } from './CreatedByFilter.js';
9
10
  import { FileList } from './FileList.js';
10
11
  import { NameFilter } from './NameFilter.js';
11
12
  import { styles } from './OpenFileDialog.styles.js';
12
13
  import { PaginationControls } from './PaginationControls.js';
13
- import { getTranslatedString, AO_TYPE_VISUALIZATION, AO_TYPE_EVENT_REPORT, AO_TYPE_EVENT_VISUALIZATION, AOTypeMap } from './utils.js';
14
- import { VisTypeFilter, VIS_TYPE_ALL, VIS_TYPE_CHARTS } from './VisTypeFilter.js';
14
+ import { getTranslatedString, AOTypeMap } from './utils.js';
15
+ import { VisTypeFilter } from './VisTypeFilter.js';
15
16
 
16
17
  const getQuery = type => ({
17
18
  files: {
@@ -42,6 +43,8 @@ const getQuery = type => ({
42
43
  export const OpenFileDialog = ({
43
44
  type,
44
45
  open,
46
+ filterVisTypes,
47
+ defaultFilterVisType,
45
48
  onClose,
46
49
  onFileSelect,
47
50
  onNew,
@@ -51,7 +54,7 @@ export const OpenFileDialog = ({
51
54
  const defaultFilters = {
52
55
  searchTerm: '',
53
56
  createdBy: CREATED_BY_ALL,
54
- visType: VIS_TYPE_ALL
57
+ visType: defaultFilterVisType
55
58
  };
56
59
  const [{
57
60
  sortField,
@@ -82,26 +85,23 @@ export const OpenFileDialog = ({
82
85
  break;
83
86
  }
84
87
 
85
- switch (filters.visType) {
86
- case VIS_TYPE_ALL:
87
- break;
88
+ if (filters.visType) {
89
+ switch (filters.visType) {
90
+ case VIS_TYPE_GROUP_ALL:
91
+ break;
88
92
 
89
- case VIS_TYPE_CHARTS:
90
- queryFilters.push('type:!eq:PIVOT_TABLE');
91
- break;
93
+ case VIS_TYPE_GROUP_CHARTS:
94
+ queryFilters.push('type:!eq:PIVOT_TABLE');
95
+ break;
92
96
 
93
- default:
94
- queryFilters.push("type:eq:".concat(filters.visType));
95
- break;
97
+ default:
98
+ queryFilters.push("type:eq:".concat(filters.visType));
99
+ break;
100
+ }
96
101
  }
97
102
 
98
103
  if (filters.searchTerm) {
99
104
  queryFilters.push("name:ilike:".concat(filters.searchTerm));
100
- } // for ER 2.38 only show line list ER types
101
-
102
-
103
- if (type === AO_TYPE_EVENT_REPORT || type === AO_TYPE_EVENT_VISUALIZATION) {
104
- queryFilters.push('dataType:eq:EVENTS');
105
105
  }
106
106
 
107
107
  return queryFilters;
@@ -127,7 +127,8 @@ export const OpenFileDialog = ({
127
127
  refetch({
128
128
  page,
129
129
  sortField,
130
- sortDirection
130
+ sortDirection,
131
+ filters: formatFilters()
131
132
  });
132
133
  }
133
134
  }, [open, page, sortField, sortDirection]);
@@ -157,7 +158,7 @@ export const OpenFileDialog = ({
157
158
  width: '110px'
158
159
  }];
159
160
 
160
- if (type === AO_TYPE_VISUALIZATION) {
161
+ if (filterVisTypes !== null && filterVisTypes !== void 0 && filterVisTypes.length) {
161
162
  headers.splice(1, 0, {
162
163
  field: 'type',
163
164
  label: i18n.t('Type'),
@@ -190,9 +191,10 @@ export const OpenFileDialog = ({
190
191
  searchTerm: value
191
192
  }), 200));
192
193
  }
193
- })), type === AO_TYPE_VISUALIZATION && /*#__PURE__*/React.createElement("div", {
194
+ })), (filterVisTypes === null || filterVisTypes === void 0 ? void 0 : filterVisTypes.length) && /*#__PURE__*/React.createElement("div", {
194
195
  className: "jsx-".concat(styles.__hash) + " " + "type-field-container"
195
196
  }, /*#__PURE__*/React.createElement(VisTypeFilter, {
197
+ visTypes: filterVisTypes,
196
198
  selected: filters.visType,
197
199
  onChange: value => setFilters({ ...filters,
198
200
  visType: value
@@ -261,9 +263,9 @@ export const OpenFileDialog = ({
261
263
  onClose();
262
264
  }
263
265
  }, getTranslatedString(type, 'newButtonLabel'))))))))), (data === null || data === void 0 ? void 0 : data.files[AOTypeMap[type].apiEndpoint].length) > 0 && /*#__PURE__*/React.createElement(FileList, {
264
- type: type,
265
266
  data: data.files[AOTypeMap[type].apiEndpoint],
266
- onSelect: onFileSelect
267
+ onSelect: onFileSelect,
268
+ showVisTypeColumn: Boolean(filterVisTypes === null || filterVisTypes === void 0 ? void 0 : filterVisTypes.length)
267
269
  }))), (data === null || data === void 0 ? void 0 : data.files[AOTypeMap[type].apiEndpoint].length) > 0 && /*#__PURE__*/React.createElement(DataTableToolbar, {
268
270
  position: "bottom"
269
271
  }, /*#__PURE__*/React.createElement("div", {
@@ -282,6 +284,8 @@ OpenFileDialog.propTypes = {
282
284
  type: PropTypes.oneOf(Object.keys(AOTypeMap)).isRequired,
283
285
  onClose: PropTypes.func.isRequired,
284
286
  onFileSelect: PropTypes.func.isRequired,
285
- onNew: PropTypes.func.isRequired
287
+ onNew: PropTypes.func.isRequired,
288
+ defaultFilterVisType: PropTypes.string,
289
+ filterVisTypes: PropTypes.array
286
290
  };
287
291
  export default OpenFileDialog;
@@ -1,13 +1,12 @@
1
1
  import i18n from '@dhis2/d2-i18n';
2
- import { Divider, SingleSelect, SingleSelectOption, colors } from '@dhis2/ui';
2
+ import { SingleSelect, colors } from '@dhis2/ui';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
- import { visTypeDisplayNames } from '../../modules/visTypes.js';
5
+ import { getDisplayNameByVisType, visTypeIcons } from '../../modules/visTypes.js';
6
6
  import { VisTypeIcon } from '../VisTypeIcon.js';
7
7
  import { CustomSelectOption } from './CustomSelectOption.js';
8
- export const VIS_TYPE_ALL = 'all';
9
- export const VIS_TYPE_CHARTS = 'charts';
10
8
  export const VisTypeFilter = ({
9
+ visTypes,
11
10
  selected,
12
11
  onChange
13
12
  }) => /*#__PURE__*/React.createElement(SingleSelect, {
@@ -18,24 +17,29 @@ export const VisTypeFilter = ({
18
17
  prefix: i18n.t('Type'),
19
18
  dense: true,
20
19
  maxHeight: "400px"
21
- }, /*#__PURE__*/React.createElement(SingleSelectOption, {
22
- label: i18n.t('All types'),
23
- value: VIS_TYPE_ALL
24
- }), /*#__PURE__*/React.createElement(SingleSelectOption, {
25
- label: i18n.t('All charts'),
26
- value: VIS_TYPE_CHARTS
27
- }), /*#__PURE__*/React.createElement(Divider, null), Object.entries(visTypeDisplayNames).map(([type, label]) => /*#__PURE__*/React.createElement(CustomSelectOption, {
20
+ }, visTypes === null || visTypes === void 0 ? void 0 : visTypes.map(({
21
+ type,
22
+ disabled,
23
+ insertDivider
24
+ }) => /*#__PURE__*/React.createElement(CustomSelectOption, {
28
25
  key: type,
29
- label: label,
26
+ disabled: disabled,
27
+ label: getDisplayNameByVisType(type),
28
+ insertDivider: insertDivider,
30
29
  value: type,
31
- icon: /*#__PURE__*/React.createElement(VisTypeIcon, {
30
+ icon: visTypeIcons[type] ? /*#__PURE__*/React.createElement(VisTypeIcon, {
32
31
  type: type,
33
32
  useSmall: true,
34
33
  color: colors.grey600
35
- })
34
+ }) : undefined
36
35
  })));
37
36
  VisTypeFilter.propTypes = {
38
37
  selected: PropTypes.string,
38
+ visTypes: PropTypes.arrayOf(PropTypes.shape({
39
+ disabled: PropTypes.bool,
40
+ insertDivider: PropTypes.bool,
41
+ type: PropTypes.string
42
+ })),
39
43
  onChange: PropTypes.func
40
44
  };
41
45
  export default VisTypeFilter;
@@ -0,0 +1,3 @@
1
+ const _defaultExport = [".datatable-row.jsx-670715550{cursor:pointer;}"];
2
+ _defaultExport.__hash = "670715550";
3
+ export default _defaultExport;
@@ -1,8 +1,6 @@
1
1
  import i18n from '@dhis2/d2-i18n';
2
2
  export const AO_TYPE_VISUALIZATION = 'visualization';
3
3
  export const AO_TYPE_MAP = 'map';
4
- export const AO_TYPE_EVENT_CHART = 'eventChart';
5
- export const AO_TYPE_EVENT_REPORT = 'eventReport';
6
4
  export const AO_TYPE_EVENT_VISUALIZATION = 'eventVisualization';
7
5
  export const AOTypeMap = {
8
6
  [AO_TYPE_VISUALIZATION]: {
@@ -11,18 +9,13 @@ export const AOTypeMap = {
11
9
  [AO_TYPE_MAP]: {
12
10
  apiEndpoint: 'maps'
13
11
  },
14
- [AO_TYPE_EVENT_CHART]: {
15
- apiEndpoint: 'eventCharts'
16
- },
17
- [AO_TYPE_EVENT_REPORT]: {
18
- apiEndpoint: 'eventReports'
19
- },
20
12
  [AO_TYPE_EVENT_VISUALIZATION]: {
21
13
  apiEndpoint: 'eventVisualizations'
22
14
  }
23
15
  };
24
- export const getTranslatedString = (type, key) => {
25
- let texts = {
16
+ const NO_TYPE = 'NO_TYPE';
17
+ const texts = {
18
+ [NO_TYPE]: {
26
19
  modalTitle: i18n.t('Open'),
27
20
  loadingText: i18n.t('Loading'),
28
21
  errorTitle: i18n.t("Couldn't load items"),
@@ -30,65 +23,33 @@ export const getTranslatedString = (type, key) => {
30
23
  noDataText: i18n.t('No items found. Create a new to get started.'),
31
24
  noFilteredDataText: i18n.t("No items found. Try adjusting your search or filter options to find what you're looking for."),
32
25
  newButtonLabel: i18n.t('Create new')
33
- };
34
-
35
- switch (type) {
36
- case 'visualization':
37
- {
38
- texts = {
39
- modalTitle: i18n.t('Open a visualization'),
40
- loadingText: i18n.t('Loading visualizations'),
41
- errorTitle: i18n.t("Couldn't load visualizations"),
42
- errorText: i18n.t('There was a problem loading visualizations. Try again or contact your system administrator.'),
43
- noDataText: i18n.t('No visualizations found. Click New visualization to get started.'),
44
- noFilteredDataText: i18n.t("No visualizations found. Try adjusting your search or filter options to find what you're looking for."),
45
- newButtonLabel: i18n.t('New visualization')
46
- };
47
- break;
48
- }
49
-
50
- case 'map':
51
- {
52
- texts = {
53
- modalTitle: i18n.t('Open a map'),
54
- loadingText: i18n.t('Loading maps'),
55
- errorTitle: i18n.t("Couldn't load maps"),
56
- errorText: i18n.t('There was a problem loading maps. Try again or contact your system administrator.'),
57
- noDataText: i18n.t('No maps found. Click New map to get started.'),
58
- noFilteredDataText: i18n.t("No maps found. Try adjusting your search or filter options to find what you're looking for."),
59
- newButtonLabel: i18n.t('New map')
60
- };
61
- break;
62
- }
63
-
64
- case 'eventReport':
65
- {
66
- texts = {
67
- modalTitle: i18n.t('Open an event report'),
68
- loadingText: i18n.t('Loading event reports'),
69
- errorTitle: i18n.t("Couldn't load event reports"),
70
- errorText: i18n.t('There was a problem loading event reports. Try again or contact your system administrator.'),
71
- noDataText: i18n.t('No event reports found. Click New event report to get started.'),
72
- noFilteredDataText: i18n.t("No event reports found. Try adjusting your search or filter options to find what you're looking for."),
73
- newButtonLabel: i18n.t('New event report')
74
- };
75
- break;
76
- }
77
-
78
- case 'eventVisualization':
79
- {
80
- texts = {
81
- modalTitle: i18n.t('Open an event visualization'),
82
- loadingText: i18n.t('Loading event visualizations'),
83
- errorTitle: i18n.t("Couldn't load event visualizations"),
84
- errorText: i18n.t('There was a problem loading event visualizations. Try again or contact your system administrator.'),
85
- noDataText: i18n.t('No event visualizations found. Click New event visualization to get started.'),
86
- noFilteredDataText: i18n.t("No event visualizations found. Try adjusting your search or filter options to find what you're looking for."),
87
- newButtonLabel: i18n.t('New event visualization')
88
- };
89
- break;
90
- }
26
+ },
27
+ [AO_TYPE_VISUALIZATION]: {
28
+ modalTitle: i18n.t('Open a visualization'),
29
+ loadingText: i18n.t('Loading visualizations'),
30
+ errorTitle: i18n.t("Couldn't load visualizations"),
31
+ errorText: i18n.t('There was a problem loading visualizations. Try again or contact your system administrator.'),
32
+ noDataText: i18n.t('No visualizations found. Click New visualization to get started.'),
33
+ noFilteredDataText: i18n.t("No visualizations found. Try adjusting your search or filter options to find what you're looking for."),
34
+ newButtonLabel: i18n.t('New visualization')
35
+ },
36
+ [AO_TYPE_MAP]: {
37
+ modalTitle: i18n.t('Open a map'),
38
+ loadingText: i18n.t('Loading maps'),
39
+ errorTitle: i18n.t("Couldn't load maps"),
40
+ errorText: i18n.t('There was a problem loading maps. Try again or contact your system administrator.'),
41
+ noDataText: i18n.t('No maps found. Click New map to get started.'),
42
+ noFilteredDataText: i18n.t("No maps found. Try adjusting your search or filter options to find what you're looking for."),
43
+ newButtonLabel: i18n.t('New map')
44
+ },
45
+ [AO_TYPE_EVENT_VISUALIZATION]: {
46
+ modalTitle: i18n.t('Open an event visualization'),
47
+ loadingText: i18n.t('Loading event visualizations'),
48
+ errorTitle: i18n.t("Couldn't load event visualizations"),
49
+ errorText: i18n.t('There was a problem loading event visualizations. Try again or contact your system administrator.'),
50
+ noDataText: i18n.t('No event visualizations found. Click New event visualization to get started.'),
51
+ noFilteredDataText: i18n.t("No event visualizations found. Try adjusting your search or filter options to find what you're looking for."),
52
+ newButtonLabel: i18n.t('New event visualization')
91
53
  }
92
-
93
- return texts[key];
94
- };
54
+ };
55
+ export const getTranslatedString = (type, key) => (texts[type] || texts[NO_TYPE])[key];
package/build/es/index.js CHANGED
@@ -69,7 +69,7 @@ export { itemIsValid } from './modules/layout/itemIsValid.js'; // Modules: visTy
69
69
 
70
70
  export { getLayoutTypeByVisType } from './modules/visTypeToLayoutType.js'; // Modules: visTypes
71
71
 
72
- export { VIS_TYPE_COLUMN, VIS_TYPE_STACKED_COLUMN, VIS_TYPE_BAR, VIS_TYPE_STACKED_BAR, VIS_TYPE_LINE, VIS_TYPE_AREA, VIS_TYPE_STACKED_AREA, VIS_TYPE_PIE, VIS_TYPE_RADAR, VIS_TYPE_GAUGE, VIS_TYPE_BUBBLE, VIS_TYPE_YEAR_OVER_YEAR_LINE, VIS_TYPE_YEAR_OVER_YEAR_COLUMN, VIS_TYPE_SINGLE_VALUE, VIS_TYPE_PIVOT_TABLE, VIS_TYPE_SCATTER, visTypeDisplayNames, visTypeDescriptions, visTypeIcons, getDisplayNameByVisType, defaultVisType, isStacked, isMultiType, isYearOverYear, isDualAxisType, isSingleValue, isTwoCategoryChartType, isLegendSetType, isColumnBasedType, isVerticalType } from './modules/visTypes.js'; // Modules: layoutTypes
72
+ export { VIS_TYPE_GROUP_ALL, VIS_TYPE_GROUP_CHARTS, VIS_TYPE_COLUMN, VIS_TYPE_STACKED_COLUMN, VIS_TYPE_BAR, VIS_TYPE_STACKED_BAR, VIS_TYPE_LINE, VIS_TYPE_AREA, VIS_TYPE_STACKED_AREA, VIS_TYPE_PIE, VIS_TYPE_RADAR, VIS_TYPE_GAUGE, VIS_TYPE_BUBBLE, VIS_TYPE_YEAR_OVER_YEAR_LINE, VIS_TYPE_YEAR_OVER_YEAR_COLUMN, VIS_TYPE_SINGLE_VALUE, VIS_TYPE_PIVOT_TABLE, VIS_TYPE_SCATTER, VIS_TYPE_LINE_LIST, visTypeDisplayNames, visTypeIcons, getDisplayNameByVisType, defaultVisType, isStacked, isMultiType, isYearOverYear, isDualAxisType, isSingleValue, isTwoCategoryChartType, isLegendSetType, isColumnBasedType, isVerticalType } from './modules/visTypes.js'; // Modules: layoutTypes
73
73
 
74
74
  export { LAYOUT_TYPE_DEFAULT, LAYOUT_TYPE_PIE, LAYOUT_TYPE_SINGLE_VALUE, LAYOUT_TYPE_YEAR_OVER_YEAR, LAYOUT_TYPE_PIVOT_TABLE, LAYOUT_TYPE_SCATTER } from './modules/layoutTypes.js'; // Modules: layoutUiRules
75
75
 
@@ -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
- "View data and indicators in a manipulatable table.": "View data and indicators in a manipulatable table.",
322
- "Compare sizes of related elements vertically. Recommend period as filter.": "Compare sizes of related elements vertically. Recommend period as filter.",
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",
@@ -17,6 +17,8 @@ export const VIS_TYPE_SINGLE_VALUE = 'SINGLE_VALUE';
17
17
  export const VIS_TYPE_PIVOT_TABLE = 'PIVOT_TABLE';
18
18
  export const VIS_TYPE_SCATTER = 'SCATTER';
19
19
  export const VIS_TYPE_LINE_LIST = 'LINE_LIST';
20
+ export const VIS_TYPE_GROUP_ALL = 'ALL';
21
+ export const VIS_TYPE_GROUP_CHARTS = 'CHARTS';
20
22
  export const visTypeDisplayNames = {
21
23
  [VIS_TYPE_PIVOT_TABLE]: i18n.t('Pivot table'),
22
24
  [VIS_TYPE_COLUMN]: i18n.t('Column'),
@@ -32,24 +34,10 @@ export const visTypeDisplayNames = {
32
34
  [VIS_TYPE_YEAR_OVER_YEAR_LINE]: i18n.t('Year over year (line)'),
33
35
  [VIS_TYPE_YEAR_OVER_YEAR_COLUMN]: i18n.t('Year over year (column)'),
34
36
  [VIS_TYPE_SINGLE_VALUE]: i18n.t('Single value'),
35
- [VIS_TYPE_SCATTER]: i18n.t('Scatter')
36
- };
37
- export const visTypeDescriptions = {
38
- [VIS_TYPE_PIVOT_TABLE]: i18n.t('View data and indicators in a manipulatable table.'),
39
- [VIS_TYPE_COLUMN]: i18n.t('Compare sizes of related elements vertically. Recommend period as filter.'),
40
- [VIS_TYPE_STACKED_COLUMN]: i18n.t('Compare parts of a whole against related elements vertically. Recommend data or org. unit as series.'),
41
- [VIS_TYPE_BAR]: i18n.t('Compare sizes of related elements horizontally. Recommend period as filter.'),
42
- [VIS_TYPE_STACKED_BAR]: i18n.t('Compare parts of a whole against related elements horizontally. Recommend data or org. unit as series.'),
43
- [VIS_TYPE_LINE]: i18n.t('Track or compare changes over time. Recommend period as category.'),
44
- [VIS_TYPE_AREA]: i18n.t('Track or compare changes over time. Recommend period as category.'),
45
- [VIS_TYPE_STACKED_AREA]: i18n.t('Track or compare parts of a whole over time. Recommend data as series and period as category.'),
46
- [VIS_TYPE_PIE]: i18n.t('Compare parts of a whole at a single point in time. Recommend period as filter.'),
47
- [VIS_TYPE_RADAR]: i18n.t('Compare several items against multiple variables.'),
48
- [VIS_TYPE_GAUGE]: i18n.t('Compare a percentage indicator against a 100% scale. Recommend period as filter.'),
49
- [VIS_TYPE_YEAR_OVER_YEAR_LINE]: i18n.t('Compare changes over time between multiple time periods.'),
50
- [VIS_TYPE_YEAR_OVER_YEAR_COLUMN]: i18n.t('Compare changes over time between multiple time periods.'),
51
- [VIS_TYPE_SINGLE_VALUE]: i18n.t('Display a single value. Recommend relative period to show latest data.'),
52
- [VIS_TYPE_SCATTER]: i18n.t('View the relationship between two data items at a place or time. Recommended for finding outliers.')
37
+ [VIS_TYPE_SCATTER]: i18n.t('Scatter'),
38
+ [VIS_TYPE_LINE_LIST]: i18n.t('Line list'),
39
+ [VIS_TYPE_GROUP_ALL]: i18n.t('All types'),
40
+ [VIS_TYPE_GROUP_CHARTS]: i18n.t('All charts')
53
41
  };
54
42
  export const visTypeIcons = {
55
43
  [VIS_TYPE_PIVOT_TABLE]: IconTable24,
@@ -66,7 +54,9 @@ export const visTypeIcons = {
66
54
  [VIS_TYPE_YEAR_OVER_YEAR_LINE]: IconVisualizationLineMulti24,
67
55
  [VIS_TYPE_YEAR_OVER_YEAR_COLUMN]: IconVisualizationColumnMulti24,
68
56
  [VIS_TYPE_SINGLE_VALUE]: IconVisualizationSingleValue24,
69
- [VIS_TYPE_SCATTER]: IconVisualizationScatter24
57
+ [VIS_TYPE_SCATTER]: IconVisualizationScatter24,
58
+ [VIS_TYPE_LINE_LIST]: IconTable24 // TODO different icon @joe
59
+
70
60
  };
71
61
  export const getDisplayNameByVisType = visType => {
72
62
  const displayName = visTypeDisplayNames[visType];