@dhis2/analytics 23.10.4 → 23.12.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/build/cjs/components/Interpretations/InterpretationModal/Comment.js +64 -0
  3. package/build/cjs/components/Interpretations/InterpretationModal/CommentAddForm.js +93 -0
  4. package/build/cjs/components/Interpretations/InterpretationModal/CommentDeleteButton.js +62 -0
  5. package/build/cjs/components/Interpretations/InterpretationModal/CommentUpdateForm.js +95 -0
  6. package/build/cjs/components/Interpretations/InterpretationModal/InterpretationModal.js +187 -0
  7. package/build/cjs/components/Interpretations/InterpretationModal/InterpretationThread.js +100 -0
  8. package/build/cjs/components/Interpretations/InterpretationModal/index.js +13 -0
  9. package/build/cjs/components/Interpretations/InterpretationModal/useModalContentWidth.js +39 -0
  10. package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationForm.js +94 -0
  11. package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationList.js +94 -0
  12. package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js +135 -0
  13. package/build/cjs/components/Interpretations/InterpretationsUnit/index.js +13 -0
  14. package/build/cjs/components/Interpretations/common/Interpretation/Interpretation.js +110 -0
  15. package/build/cjs/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js +58 -0
  16. package/build/cjs/components/Interpretations/common/Interpretation/InterpretationSharingLink.js +50 -0
  17. package/build/cjs/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js +108 -0
  18. package/build/cjs/components/Interpretations/common/Interpretation/index.js +21 -0
  19. package/build/cjs/components/Interpretations/common/Interpretation/useLike.js +53 -0
  20. package/build/cjs/components/Interpretations/common/Message/Message.js +55 -0
  21. package/build/cjs/components/Interpretations/common/Message/MessageButtonStrip.js +33 -0
  22. package/build/cjs/components/Interpretations/common/Message/MessageEditorContainer.js +42 -0
  23. package/build/cjs/components/Interpretations/common/Message/MessageIconButton.js +67 -0
  24. package/build/cjs/components/Interpretations/common/Message/MessageInput.js +31 -0
  25. package/build/cjs/components/Interpretations/common/Message/MessageStatsBar.js +33 -0
  26. package/build/cjs/components/Interpretations/common/Message/index.js +53 -0
  27. package/build/cjs/components/Interpretations/common/RichTextEditor/RichTextEditor.js +262 -0
  28. package/build/cjs/components/Interpretations/common/RichTextEditor/index.js +13 -0
  29. package/build/cjs/components/Interpretations/common/RichTextEditor/markdownHandler.js +148 -0
  30. package/build/cjs/components/Interpretations/common/RichTextEditor/styles/RichTextEditor.style.js +21 -0
  31. package/build/cjs/components/Interpretations/common/UserMention/UserList.js +48 -0
  32. package/build/cjs/components/Interpretations/common/UserMention/UserMentionWrapper.js +226 -0
  33. package/build/cjs/components/Interpretations/common/UserMention/styles/UserMentionWrapper.style.js +30 -0
  34. package/build/cjs/components/Interpretations/common/UserMention/useUserSearchResults.js +78 -0
  35. package/build/cjs/components/Interpretations/common/index.js +44 -0
  36. package/build/cjs/components/LegendKey/styles/LegendKey.style.js +2 -2
  37. package/build/cjs/index.js +22 -0
  38. package/build/cjs/locales/en/translations.json +32 -1
  39. package/build/cjs/locales/ro/translations.json +6 -6
  40. package/build/cjs/modules/legends.js +6 -2
  41. package/build/es/components/Interpretations/InterpretationModal/Comment.js +45 -0
  42. package/build/es/components/Interpretations/InterpretationModal/CommentAddForm.js +70 -0
  43. package/build/es/components/Interpretations/InterpretationModal/CommentDeleteButton.js +47 -0
  44. package/build/es/components/Interpretations/InterpretationModal/CommentUpdateForm.js +73 -0
  45. package/build/es/components/Interpretations/InterpretationModal/InterpretationModal.js +165 -0
  46. package/build/es/components/Interpretations/InterpretationModal/InterpretationThread.js +79 -0
  47. package/build/es/components/Interpretations/InterpretationModal/index.js +1 -0
  48. package/build/es/components/Interpretations/InterpretationModal/useModalContentWidth.js +28 -0
  49. package/build/es/components/Interpretations/InterpretationsUnit/InterpretationForm.js +71 -0
  50. package/build/es/components/Interpretations/InterpretationsUnit/InterpretationList.js +78 -0
  51. package/build/es/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js +112 -0
  52. package/build/es/components/Interpretations/InterpretationsUnit/index.js +1 -0
  53. package/build/es/components/Interpretations/common/Interpretation/Interpretation.js +87 -0
  54. package/build/es/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js +43 -0
  55. package/build/es/components/Interpretations/common/Interpretation/InterpretationSharingLink.js +33 -0
  56. package/build/es/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js +85 -0
  57. package/build/es/components/Interpretations/common/Interpretation/index.js +2 -0
  58. package/build/es/components/Interpretations/common/Interpretation/useLike.js +45 -0
  59. package/build/es/components/Interpretations/common/Message/Message.js +41 -0
  60. package/build/es/components/Interpretations/common/Message/MessageButtonStrip.js +21 -0
  61. package/build/es/components/Interpretations/common/Message/MessageEditorContainer.js +30 -0
  62. package/build/es/components/Interpretations/common/Message/MessageIconButton.js +54 -0
  63. package/build/es/components/Interpretations/common/Message/MessageInput.js +16 -0
  64. package/build/es/components/Interpretations/common/Message/MessageStatsBar.js +21 -0
  65. package/build/es/components/Interpretations/common/Message/index.js +6 -0
  66. package/build/es/components/Interpretations/common/RichTextEditor/RichTextEditor.js +240 -0
  67. package/build/es/components/Interpretations/common/RichTextEditor/index.js +1 -0
  68. package/build/es/components/Interpretations/common/RichTextEditor/markdownHandler.js +128 -0
  69. package/build/es/components/Interpretations/common/RichTextEditor/styles/RichTextEditor.style.js +9 -0
  70. package/build/es/components/Interpretations/common/UserMention/UserList.js +33 -0
  71. package/build/es/components/Interpretations/common/UserMention/UserMentionWrapper.js +202 -0
  72. package/build/es/components/Interpretations/common/UserMention/styles/UserMentionWrapper.style.js +17 -0
  73. package/build/es/components/Interpretations/common/UserMention/useUserSearchResults.js +63 -0
  74. package/build/es/components/Interpretations/common/index.js +3 -0
  75. package/build/es/components/LegendKey/styles/LegendKey.style.js +2 -2
  76. package/build/es/index.js +3 -1
  77. package/build/es/locales/en/translations.json +32 -1
  78. package/build/es/locales/ro/translations.json +6 -6
  79. package/build/es/modules/legends.js +6 -2
  80. package/package.json +3 -2
@@ -0,0 +1,63 @@
1
+ import { useDataQuery } from '@dhis2/app-runtime';
2
+ import debounce from 'lodash/debounce';
3
+ import { useCallback, useEffect, useState } from 'react';
4
+ const usersQuery = {
5
+ users: {
6
+ resource: 'users/gist',
7
+ params: _ref => {
8
+ let {
9
+ searchText
10
+ } = _ref;
11
+ return {
12
+ fields: 'id,displayName,username',
13
+ order: 'firstName,surname',
14
+ total: true,
15
+ filter: "username:ilike:".concat(searchText, ",firstName:ilike:").concat(searchText, ",surname:ilike:").concat(searchText, ",email:ilike:").concat(searchText),
16
+ rootJunction: 'OR'
17
+ };
18
+ }
19
+ }
20
+ };
21
+ export const useUserSearchResults = _ref2 => {
22
+ let {
23
+ searchText
24
+ } = _ref2;
25
+ const [{
26
+ users,
27
+ pager
28
+ }, setData] = useState({
29
+ users: [],
30
+ pager: {}
31
+ });
32
+ const {
33
+ data,
34
+ fetching,
35
+ refetch
36
+ } = useDataQuery(usersQuery, {
37
+ lazy: true
38
+ });
39
+ const debouncedRefetch = useCallback(debounce(refetch, 250), [refetch]);
40
+ useEffect(() => {
41
+ if (searchText.length) {
42
+ debouncedRefetch({
43
+ searchText
44
+ });
45
+ }
46
+
47
+ return () => debouncedRefetch.cancel();
48
+ }, [searchText]);
49
+ useEffect(() => {
50
+ if (data) {
51
+ setData(data.users);
52
+ }
53
+ }, [data]);
54
+ return {
55
+ users,
56
+ pager,
57
+ fetching,
58
+ clear: () => setData({
59
+ users: [],
60
+ pager: {}
61
+ })
62
+ };
63
+ };
@@ -0,0 +1,3 @@
1
+ export * from './Interpretation/index.js';
2
+ export * from './Message/index.js';
3
+ export * from './RichTextEditor/index.js';
@@ -1,4 +1,4 @@
1
1
  import { spacers, colors } from '@dhis2/ui';
2
- const _defaultExport = [".container.jsx-3203773516{width:180px;background:".concat(colors.white, ";padding:").concat(spacers.dp8, ";border:1px solid ").concat(colors.grey400, ";}"), ".legendSet.jsx-3203773516{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;margin-left:".concat(spacers.dp4, ";}"), ".legendSetName.jsx-3203773516{display:inline-block;font-size:13px;color:".concat(colors.grey700, ";margin-bottom:2px;}"), ".legend.jsx-3203773516{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:".concat(spacers.dp4, " 0 ").concat(spacers.dp4, " 6px;white-space:break-spaces;text-align:left;font-size:13px;}"), ".values.jsx-3203773516{color:".concat(colors.grey600, ";font-size:12px;padding-top:2px;}"), ".divider.jsx-3203773516{border-top:1px solid ".concat(colors.grey400, ";padding-top:").concat(spacers.dp8, ";margin-top:").concat(spacers.dp8, ";}")];
3
- _defaultExport.__hash = "3203773516";
2
+ const _defaultExport = [".container.jsx-2467849725{width:180px;background:".concat(colors.white, ";padding:").concat(spacers.dp8, ";}"), ".legendSet.jsx-2467849725{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;margin-left:".concat(spacers.dp4, ";}"), ".legendSetName.jsx-2467849725{display:inline-block;font-size:13px;color:".concat(colors.grey700, ";margin-bottom:2px;}"), ".legend.jsx-2467849725{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:".concat(spacers.dp4, " 0 ").concat(spacers.dp4, " 6px;white-space:break-spaces;text-align:left;font-size:13px;}"), ".values.jsx-2467849725{color:".concat(colors.grey600, ";font-size:12px;padding-top:2px;}"), ".divider.jsx-2467849725{border-top:1px solid ".concat(colors.grey400, ";padding-top:").concat(spacers.dp8, ";margin-top:").concat(spacers.dp8, ";}")];
3
+ _defaultExport.__hash = "2467849725";
4
4
  export default _defaultExport;
package/build/es/index.js CHANGED
@@ -14,6 +14,8 @@ export { default as FileMenu } from './components/FileMenu/FileMenu.js';
14
14
  export { default as VisTypeIcon } from './components/VisTypeIcon.js';
15
15
  export { default as LegendKey } from './components/LegendKey/LegendKey.js';
16
16
  export { default as AboutAOUnit } from './components/AboutAOUnit/AboutAOUnit.js';
17
+ export { InterpretationsUnit } from './components/Interpretations/InterpretationsUnit/InterpretationsUnit.js';
18
+ export { InterpretationModal } from './components/Interpretations/InterpretationModal/InterpretationModal.js';
17
19
  export { CachedDataQueryProvider, useCachedDataQuery } from './components/CachedDataQueryProvider.js'; // Api
18
20
 
19
21
  export { default as Analytics } from './api/analytics/Analytics.js';
@@ -81,7 +83,7 @@ export { createVisualization } from './visualizations/index.js'; // Modules: fon
81
83
 
82
84
  export { FONT_STYLE_VISUALIZATION_TITLE, FONT_STYLE_VISUALIZATION_SUBTITLE, FONT_STYLE_HORIZONTAL_AXIS_TITLE, FONT_STYLE_VERTICAL_AXIS_TITLE, FONT_STYLE_LEGEND, FONT_STYLE_AXIS_LABELS, FONT_STYLE_REGRESSION_LINE_LABEL, FONT_STYLE_OPTION_FONT, FONT_STYLE_OPTION_FONT_SIZE, FONT_STYLE_OPTION_BOLD, FONT_STYLE_OPTION_ITALIC, FONT_STYLE_OPTION_UNDERLINE, FONT_STYLE_OPTION_TEXT_COLOR, FONT_STYLE_OPTION_TEXT_ALIGN, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT, defaultFontStyle, getFontSizeOptions, getTextAlignOptions, deleteFontStyleOption } from './modules/fontStyle.js'; // Modules: legend
83
85
 
84
- export { LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM, LEGEND_DISPLAY_STRATEGY_FIXED, LEGEND_DISPLAY_STYLE_FILL, LEGEND_DISPLAY_STYLE_TEXT } from './modules/legends.js'; // Modules: general
86
+ export { LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM, LEGEND_DISPLAY_STRATEGY_FIXED, LEGEND_DISPLAY_STYLE_FILL, LEGEND_DISPLAY_STYLE_TEXT, getColorByValueFromLegendSet } from './modules/legends.js'; // Modules: general
85
87
 
86
88
  export { renderValue as formatValue } from './modules/renderValue.js'; // Utils: colorSets
87
89
 
@@ -83,6 +83,38 @@
83
83
  "line list": "line list",
84
84
  "map": "map",
85
85
  "visualization": "visualization",
86
+ "Edit": "Edit",
87
+ "Write a reply": "Write a reply",
88
+ "Post reply": "Post reply",
89
+ "Could not update comment": "Could not update comment",
90
+ "Enter comment text": "Enter comment text",
91
+ "Update": "Update",
92
+ "Viewing interpretation: {{visualisationName}}": "Viewing interpretation: {{visualisationName}}",
93
+ "Could not load interpretation": "Could not load interpretation",
94
+ "The interpretation couldn’t be displayed. Try again or contact your system administrator.": "The interpretation couldn’t be displayed. Try again or contact your system administrator.",
95
+ "Hide interpretation": "Hide interpretation",
96
+ "Write an interpretation": "Write an interpretation",
97
+ "Post interpretation": "Post interpretation",
98
+ "Interpretations": "Interpretations",
99
+ "Unlike": "Unlike",
100
+ "Like": "Like",
101
+ "Reply": "Reply",
102
+ "Share": "Share",
103
+ "See interpretation": "See interpretation",
104
+ "Manage sharing": "Manage sharing",
105
+ "Could not update interpretation": "Could not update interpretation",
106
+ "Enter interpretation text": "Enter interpretation text",
107
+ "Bold text": "Bold text",
108
+ "Italic text": "Italic text",
109
+ "Link to a URL": "Link to a URL",
110
+ "Mention a user": "Mention a user",
111
+ "Add emoji": "Add emoji",
112
+ "Preview": "Preview",
113
+ "Back to write mode": "Back to write mode",
114
+ "Too many results. Try refining the search.": "Too many results. Try refining the search.",
115
+ "Search for a user": "Search for a user",
116
+ "Searching for \"{{searchText}}\"": "Searching for \"{{searchText}}\"",
117
+ "No results found": "No results found",
86
118
  "Created by": "Created by",
87
119
  "Anyone": "Anyone",
88
120
  "Only you": "Only you",
@@ -123,7 +155,6 @@
123
155
  "New line list": "New line list",
124
156
  "Options": "Options",
125
157
  "Hide": "Hide",
126
- "Update": "Update",
127
158
  "{{count}} org units": "{{count}} org unit",
128
159
  "{{count}} org units_plural": "{{count}} org units",
129
160
  "{{count}} levels": "{{count}} level",
@@ -61,7 +61,7 @@
61
61
  "Nothing found for {{searchTerm}}": "",
62
62
  "Delete {{fileType}}": "",
63
63
  "This {{fileType}} and related interpretations will be deleted. Continue?": "",
64
- "Cancel": "",
64
+ "Cancel": "Anulare",
65
65
  "Delete": "Lichidare",
66
66
  "File": "Fişier",
67
67
  "New": "Nou",
@@ -193,7 +193,7 @@
193
193
  "This week": "Săptămâna aceasta",
194
194
  "Last week": "Săptămâna trecută",
195
195
  "Last 4 weeks": "Ultimele 4 săptămâni",
196
- "Last 12 weeks": "",
196
+ "Last 12 weeks": "Ultimele 12 săptămâni",
197
197
  "Last 52 weeks": "Ultimele 52 de săptămâni",
198
198
  "Weeks this year": "Săptămâni în anul curent",
199
199
  "This bi-week": "",
@@ -251,21 +251,21 @@
251
251
  "Actual reports": "",
252
252
  "Actual reports on time": "",
253
253
  "Expected reports": "",
254
- "Program": "",
254
+ "Program": "Program",
255
255
  "Select a program": "",
256
256
  "Indicators": "Indicatori",
257
- "Indicator group": "",
257
+ "Indicator group": "Grup de indicatori",
258
258
  "All groups": "",
259
259
  "Indicator": "Indicator",
260
260
  "No indicator groups found": "",
261
261
  "Loading indicator groups": "",
262
- "Data elements": "",
262
+ "Data elements": "Elemente de date",
263
263
  "Data element group": "",
264
264
  "Data element": "",
265
265
  "No data element groups found": "",
266
266
  "Loading data element groups": "",
267
267
  "Data sets": "",
268
- "Data set": "",
268
+ "Data set": "Set de date",
269
269
  "All data sets": "",
270
270
  "Loading data sets": "",
271
271
  "Event data items": "",
@@ -2,8 +2,12 @@ export const LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM = 'BY_DATA_ITEM';
2
2
  export const LEGEND_DISPLAY_STRATEGY_FIXED = 'FIXED';
3
3
  export const LEGEND_DISPLAY_STYLE_FILL = 'FILL';
4
4
  export const LEGEND_DISPLAY_STYLE_TEXT = 'TEXT';
5
- export const getLegendByValueFromLegendSet = (legendSet, value) => legendSet.legends.find(legend => value >= legend.startValue && value < legend.endValue // TODO: Confirm inclusive/exclusive bounds
6
- );
5
+ export const getLegendByValueFromLegendSet = (legendSet, value) => {
6
+ var _legendSet$legends;
7
+
8
+ return legendSet === null || legendSet === void 0 ? void 0 : (_legendSet$legends = legendSet.legends) === null || _legendSet$legends === void 0 ? void 0 : _legendSet$legends.find(legend => value >= legend.startValue && value < legend.endValue // TODO: Confirm inclusive/exclusive bounds
9
+ );
10
+ };
7
11
  export const getColorByValueFromLegendSet = (legendSet, value) => {
8
12
  const legend = getLegendByValueFromLegendSet(legendSet, value);
9
13
  return legend && legend.color;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "23.10.4",
3
+ "version": "23.12.0",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {
@@ -35,7 +35,7 @@
35
35
  "@dhis2/cli-app-scripts": "^9.0.0",
36
36
  "@dhis2/cli-style": "^10.4.1",
37
37
  "@dhis2/d2-i18n": "^1.1.0",
38
- "@dhis2/ui": "^8.2.5",
38
+ "@dhis2/ui": "^8.3.1",
39
39
  "@sambego/storybook-state": "^2.0.1",
40
40
  "@storybook/addons": "^6.1.14",
41
41
  "@storybook/preset-create-react-app": "^3.1.7",
@@ -58,6 +58,7 @@
58
58
  "styled-jsx": "^4.0.1"
59
59
  },
60
60
  "dependencies": {
61
+ "@dhis2/d2-ui-rich-text": "^7.4.0",
61
62
  "classnames": "^2.3.1",
62
63
  "d2-utilizr": "^0.2.16",
63
64
  "d3-color": "^1.2.3",