@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.
- package/CHANGELOG.md +21 -0
- package/build/cjs/components/Interpretations/InterpretationModal/Comment.js +64 -0
- package/build/cjs/components/Interpretations/InterpretationModal/CommentAddForm.js +93 -0
- package/build/cjs/components/Interpretations/InterpretationModal/CommentDeleteButton.js +62 -0
- package/build/cjs/components/Interpretations/InterpretationModal/CommentUpdateForm.js +95 -0
- package/build/cjs/components/Interpretations/InterpretationModal/InterpretationModal.js +187 -0
- package/build/cjs/components/Interpretations/InterpretationModal/InterpretationThread.js +100 -0
- package/build/cjs/components/Interpretations/InterpretationModal/index.js +13 -0
- package/build/cjs/components/Interpretations/InterpretationModal/useModalContentWidth.js +39 -0
- package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationForm.js +94 -0
- package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationList.js +94 -0
- package/build/cjs/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js +135 -0
- package/build/cjs/components/Interpretations/InterpretationsUnit/index.js +13 -0
- package/build/cjs/components/Interpretations/common/Interpretation/Interpretation.js +110 -0
- package/build/cjs/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js +58 -0
- package/build/cjs/components/Interpretations/common/Interpretation/InterpretationSharingLink.js +50 -0
- package/build/cjs/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js +108 -0
- package/build/cjs/components/Interpretations/common/Interpretation/index.js +21 -0
- package/build/cjs/components/Interpretations/common/Interpretation/useLike.js +53 -0
- package/build/cjs/components/Interpretations/common/Message/Message.js +55 -0
- package/build/cjs/components/Interpretations/common/Message/MessageButtonStrip.js +33 -0
- package/build/cjs/components/Interpretations/common/Message/MessageEditorContainer.js +42 -0
- package/build/cjs/components/Interpretations/common/Message/MessageIconButton.js +67 -0
- package/build/cjs/components/Interpretations/common/Message/MessageInput.js +31 -0
- package/build/cjs/components/Interpretations/common/Message/MessageStatsBar.js +33 -0
- package/build/cjs/components/Interpretations/common/Message/index.js +53 -0
- package/build/cjs/components/Interpretations/common/RichTextEditor/RichTextEditor.js +262 -0
- package/build/cjs/components/Interpretations/common/RichTextEditor/index.js +13 -0
- package/build/cjs/components/Interpretations/common/RichTextEditor/markdownHandler.js +148 -0
- package/build/cjs/components/Interpretations/common/RichTextEditor/styles/RichTextEditor.style.js +21 -0
- package/build/cjs/components/Interpretations/common/UserMention/UserList.js +48 -0
- package/build/cjs/components/Interpretations/common/UserMention/UserMentionWrapper.js +226 -0
- package/build/cjs/components/Interpretations/common/UserMention/styles/UserMentionWrapper.style.js +30 -0
- package/build/cjs/components/Interpretations/common/UserMention/useUserSearchResults.js +78 -0
- package/build/cjs/components/Interpretations/common/index.js +44 -0
- package/build/cjs/components/LegendKey/styles/LegendKey.style.js +2 -2
- package/build/cjs/index.js +22 -0
- package/build/cjs/locales/en/translations.json +32 -1
- package/build/cjs/locales/ro/translations.json +6 -6
- package/build/cjs/modules/legends.js +6 -2
- package/build/es/components/Interpretations/InterpretationModal/Comment.js +45 -0
- package/build/es/components/Interpretations/InterpretationModal/CommentAddForm.js +70 -0
- package/build/es/components/Interpretations/InterpretationModal/CommentDeleteButton.js +47 -0
- package/build/es/components/Interpretations/InterpretationModal/CommentUpdateForm.js +73 -0
- package/build/es/components/Interpretations/InterpretationModal/InterpretationModal.js +165 -0
- package/build/es/components/Interpretations/InterpretationModal/InterpretationThread.js +79 -0
- package/build/es/components/Interpretations/InterpretationModal/index.js +1 -0
- package/build/es/components/Interpretations/InterpretationModal/useModalContentWidth.js +28 -0
- package/build/es/components/Interpretations/InterpretationsUnit/InterpretationForm.js +71 -0
- package/build/es/components/Interpretations/InterpretationsUnit/InterpretationList.js +78 -0
- package/build/es/components/Interpretations/InterpretationsUnit/InterpretationsUnit.js +112 -0
- package/build/es/components/Interpretations/InterpretationsUnit/index.js +1 -0
- package/build/es/components/Interpretations/common/Interpretation/Interpretation.js +87 -0
- package/build/es/components/Interpretations/common/Interpretation/InterpretationDeleteButton.js +43 -0
- package/build/es/components/Interpretations/common/Interpretation/InterpretationSharingLink.js +33 -0
- package/build/es/components/Interpretations/common/Interpretation/InterpretationUpdateForm.js +85 -0
- package/build/es/components/Interpretations/common/Interpretation/index.js +2 -0
- package/build/es/components/Interpretations/common/Interpretation/useLike.js +45 -0
- package/build/es/components/Interpretations/common/Message/Message.js +41 -0
- package/build/es/components/Interpretations/common/Message/MessageButtonStrip.js +21 -0
- package/build/es/components/Interpretations/common/Message/MessageEditorContainer.js +30 -0
- package/build/es/components/Interpretations/common/Message/MessageIconButton.js +54 -0
- package/build/es/components/Interpretations/common/Message/MessageInput.js +16 -0
- package/build/es/components/Interpretations/common/Message/MessageStatsBar.js +21 -0
- package/build/es/components/Interpretations/common/Message/index.js +6 -0
- package/build/es/components/Interpretations/common/RichTextEditor/RichTextEditor.js +240 -0
- package/build/es/components/Interpretations/common/RichTextEditor/index.js +1 -0
- package/build/es/components/Interpretations/common/RichTextEditor/markdownHandler.js +128 -0
- package/build/es/components/Interpretations/common/RichTextEditor/styles/RichTextEditor.style.js +9 -0
- package/build/es/components/Interpretations/common/UserMention/UserList.js +33 -0
- package/build/es/components/Interpretations/common/UserMention/UserMentionWrapper.js +202 -0
- package/build/es/components/Interpretations/common/UserMention/styles/UserMentionWrapper.style.js +17 -0
- package/build/es/components/Interpretations/common/UserMention/useUserSearchResults.js +63 -0
- package/build/es/components/Interpretations/common/index.js +3 -0
- package/build/es/components/LegendKey/styles/LegendKey.style.js +2 -2
- package/build/es/index.js +3 -1
- package/build/es/locales/en/translations.json +32 -1
- package/build/es/locales/ro/translations.json +6 -6
- package/build/es/modules/legends.js +6 -2
- package/package.json +3 -2
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.UserMentionWrapper = void 0;
|
|
7
|
+
|
|
8
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
+
|
|
10
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
11
|
+
|
|
12
|
+
var _ui = require("@dhis2/ui");
|
|
13
|
+
|
|
14
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _UserMentionWrapperStyle = require("./styles/UserMentionWrapper.style.js");
|
|
19
|
+
|
|
20
|
+
var _UserList = require("./UserList.js");
|
|
21
|
+
|
|
22
|
+
var _useUserSearchResults = require("./useUserSearchResults.js");
|
|
23
|
+
|
|
24
|
+
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); }
|
|
25
|
+
|
|
26
|
+
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; }
|
|
27
|
+
|
|
28
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
+
|
|
30
|
+
const AT_SYMBOL_WIDTH = 14;
|
|
31
|
+
|
|
32
|
+
const getVirtualPopperReference = ref => {
|
|
33
|
+
const rects = ref.current.getClientRects();
|
|
34
|
+
const lastRect = rects[rects.length - 1];
|
|
35
|
+
const left = lastRect.left + lastRect.width - AT_SYMBOL_WIDTH;
|
|
36
|
+
return {
|
|
37
|
+
getBoundingClientRect: () => ({
|
|
38
|
+
top: lastRect.top,
|
|
39
|
+
right: lastRect.right,
|
|
40
|
+
bottom: lastRect.bottom,
|
|
41
|
+
left,
|
|
42
|
+
width: AT_SYMBOL_WIDTH,
|
|
43
|
+
height: lastRect.height,
|
|
44
|
+
x: left
|
|
45
|
+
})
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const UserMentionWrapper = _ref => {
|
|
50
|
+
let {
|
|
51
|
+
children,
|
|
52
|
+
inputReference,
|
|
53
|
+
onUserSelect
|
|
54
|
+
} = _ref;
|
|
55
|
+
const [captureText, setCaptureText] = (0, _react.useState)(false);
|
|
56
|
+
const [capturedText, setCapturedText] = (0, _react.useState)('');
|
|
57
|
+
const [cloneText, setCloneText] = (0, _react.useState)('');
|
|
58
|
+
const cloneRef = (0, _react.useRef)(null);
|
|
59
|
+
const [captureStartPosition, setCaptureStartPosition] = (0, _react.useState)(null);
|
|
60
|
+
const [selectedUserIndex, setSelectedUserIndex] = (0, _react.useState)(0);
|
|
61
|
+
const {
|
|
62
|
+
users,
|
|
63
|
+
pager,
|
|
64
|
+
fetching,
|
|
65
|
+
clear
|
|
66
|
+
} = (0, _useUserSearchResults.useUserSearchResults)({
|
|
67
|
+
searchText: capturedText
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
const reset = () => {
|
|
71
|
+
setCaptureText(false);
|
|
72
|
+
setCapturedText('');
|
|
73
|
+
setCloneText('');
|
|
74
|
+
setCaptureStartPosition(null);
|
|
75
|
+
setSelectedUserIndex(0);
|
|
76
|
+
clear();
|
|
77
|
+
}; // event bubbles up from the input/textarea
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
const onInput = _ref2 => {
|
|
81
|
+
let {
|
|
82
|
+
target
|
|
83
|
+
} = _ref2;
|
|
84
|
+
const {
|
|
85
|
+
selectionEnd,
|
|
86
|
+
value
|
|
87
|
+
} = target;
|
|
88
|
+
|
|
89
|
+
if (captureText) {
|
|
90
|
+
clear();
|
|
91
|
+
const spacePosition = value.indexOf(' ', captureStartPosition - 1);
|
|
92
|
+
const filterValue = value.substring(captureStartPosition, spacePosition > 0 ? spacePosition : selectionEnd + 1);
|
|
93
|
+
|
|
94
|
+
if (filterValue !== capturedText) {
|
|
95
|
+
setCapturedText(filterValue);
|
|
96
|
+
} else if (filterValue.length === 0) {
|
|
97
|
+
setCapturedText('');
|
|
98
|
+
clear();
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}; // event bubbles up from the wrapped input/textarea
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
const onKeyDown = _ref3 => {
|
|
105
|
+
let {
|
|
106
|
+
key,
|
|
107
|
+
target
|
|
108
|
+
} = _ref3;
|
|
109
|
+
const {
|
|
110
|
+
selectionStart
|
|
111
|
+
} = target;
|
|
112
|
+
|
|
113
|
+
if (!captureText && key === '@') {
|
|
114
|
+
setCaptureText(true);
|
|
115
|
+
setCaptureStartPosition(selectionStart + 1);
|
|
116
|
+
setCloneText(target.value.substring(0, selectionStart) + '@');
|
|
117
|
+
} else if (captureText) {
|
|
118
|
+
if (key === ' ' || key === 'Backspace' && selectionStart <= captureStartPosition) {
|
|
119
|
+
reset();
|
|
120
|
+
} else if (users.length) {
|
|
121
|
+
switch (key) {
|
|
122
|
+
case 'Enter':
|
|
123
|
+
event.preventDefault();
|
|
124
|
+
|
|
125
|
+
if (selectedUserIndex >= 0) {
|
|
126
|
+
onSelect(users[selectedUserIndex]);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
break;
|
|
130
|
+
|
|
131
|
+
case 'ArrowDown':
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
|
|
134
|
+
if (selectedUserIndex < users.length - 1) {
|
|
135
|
+
setSelectedUserIndex(selectedUserIndex + 1);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
break;
|
|
139
|
+
|
|
140
|
+
case 'ArrowUp':
|
|
141
|
+
event.preventDefault();
|
|
142
|
+
|
|
143
|
+
if (selectedUserIndex > 0) {
|
|
144
|
+
setSelectedUserIndex(selectedUserIndex - 1);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
break;
|
|
148
|
+
|
|
149
|
+
default: // other key strokes, typically the text typed
|
|
150
|
+
// the onInput event handler set on the input element is triggering the user lookup
|
|
151
|
+
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
const onSelect = user => {
|
|
158
|
+
const originalValue = inputReference.current.value;
|
|
159
|
+
const newValue = "".concat(originalValue.slice(0, captureStartPosition - 1)).concat(originalValue.slice(captureStartPosition - 1).replace(/^@\w*/, "@".concat(user.username, " ")));
|
|
160
|
+
reset(); // typically for connected components we want the state to be updated too
|
|
161
|
+
// but the logic belongs to the wrapped component, so we just invoke the supplied callback
|
|
162
|
+
|
|
163
|
+
if (onUserSelect) {
|
|
164
|
+
onUserSelect(newValue);
|
|
165
|
+
} // need to refocus on the input/textarea
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
inputReference.current.focus(); // position the cursor at the end
|
|
169
|
+
|
|
170
|
+
requestAnimationFrame(() => inputReference.current.setSelectionRange(-1, -1), 0);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const onClick = user => () => onSelect(user);
|
|
174
|
+
|
|
175
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
176
|
+
onKeyDown: onKeyDown,
|
|
177
|
+
onInput: onInput,
|
|
178
|
+
className: "jsx-".concat(_UserMentionWrapperStyle.userMentionWrapperClasses.__hash) + " " + "wrapper"
|
|
179
|
+
}, children, /*#__PURE__*/_react.default.createElement("div", {
|
|
180
|
+
className: "jsx-".concat(_UserMentionWrapperStyle.userMentionWrapperClasses.__hash) + " " + "clone"
|
|
181
|
+
}, /*#__PURE__*/_react.default.createElement("pre", {
|
|
182
|
+
ref: cloneRef,
|
|
183
|
+
className: "jsx-".concat(_UserMentionWrapperStyle.userMentionWrapperClasses.__hash)
|
|
184
|
+
}, cloneText)), captureText && /*#__PURE__*/_react.default.createElement(_ui.Portal, null, /*#__PURE__*/_react.default.createElement(_ui.Popper, {
|
|
185
|
+
reference: getVirtualPopperReference(cloneRef),
|
|
186
|
+
placement: "top-start"
|
|
187
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.Card, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
188
|
+
className: "jsx-".concat(_UserMentionWrapperStyle.userMentionWrapperClasses.__hash) + " " + "container"
|
|
189
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.Menu, {
|
|
190
|
+
dense: true
|
|
191
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.MenuSectionHeader, {
|
|
192
|
+
className: _UserMentionWrapperStyle.resolvedHeaderStyle.className,
|
|
193
|
+
dense: true,
|
|
194
|
+
hideDivider: true,
|
|
195
|
+
label: capturedText === '' ? _d2I18n.default.t('Search for a user') : _d2I18n.default.t('Searching for "{{searchText}}"', {
|
|
196
|
+
searchText: capturedText
|
|
197
|
+
})
|
|
198
|
+
}), fetching && /*#__PURE__*/_react.default.createElement(_ui.MenuItem, {
|
|
199
|
+
label: /*#__PURE__*/_react.default.createElement(_ui.CenteredContent, null, /*#__PURE__*/_react.default.createElement(_ui.CircularLoader, {
|
|
200
|
+
small: true
|
|
201
|
+
}))
|
|
202
|
+
}), !fetching && users.length > 0 && /*#__PURE__*/_react.default.createElement(_UserList.UserList, {
|
|
203
|
+
users: users,
|
|
204
|
+
selectedUserIndex: selectedUserIndex,
|
|
205
|
+
onUserClick: onClick,
|
|
206
|
+
pager: pager
|
|
207
|
+
}), capturedText && !fetching && users.length === 0 && /*#__PURE__*/_react.default.createElement(_ui.MenuItem, {
|
|
208
|
+
dense: true,
|
|
209
|
+
disabled: true,
|
|
210
|
+
label: _d2I18n.default.t('No results found')
|
|
211
|
+
})))))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
212
|
+
id: _UserMentionWrapperStyle.userMentionWrapperClasses.__hash
|
|
213
|
+
}, _UserMentionWrapperStyle.userMentionWrapperClasses), _UserMentionWrapperStyle.resolvedHeaderStyle.styles);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
exports.UserMentionWrapper = UserMentionWrapper;
|
|
217
|
+
UserMentionWrapper.defaultProps = {
|
|
218
|
+
onUserSelect: Function.prototype
|
|
219
|
+
};
|
|
220
|
+
UserMentionWrapper.propTypes = {
|
|
221
|
+
inputReference: _propTypes.default.object.isRequired,
|
|
222
|
+
onUserSelect: _propTypes.default.func.isRequired,
|
|
223
|
+
children: _propTypes.default.node
|
|
224
|
+
};
|
|
225
|
+
var _default = UserMentionWrapper;
|
|
226
|
+
exports.default = _default;
|
package/build/cjs/components/Interpretations/common/UserMention/styles/UserMentionWrapper.style.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.userMentionWrapperClasses = exports.resolvedHeaderStyle = void 0;
|
|
7
|
+
|
|
8
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
|
|
12
|
+
var _ui = require("@dhis2/ui");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* Note that the clone and clone > pre styles have been chosen
|
|
18
|
+
* to emulate the styles of the textarea. If we decide to make
|
|
19
|
+
* changes there, they should be refelcted here too.
|
|
20
|
+
*/
|
|
21
|
+
const userMentionWrapperClasses = [".wrapper.jsx-1289989717{position:relative;}", ".clone.jsx-1289989717{position:absolute;visibility:hidden;inset:0;box-sizing:border-box;padding:".concat(_ui.spacers.dp8, " ").concat(_ui.spacers.dp12, ";border:1px solid ").concat(_ui.colors.grey500, ";font-size:14px;line-height:").concat(_ui.spacers.dp16, ";z-index:1;pointer-events:none;}"), ".clone.jsx-1289989717>pre.jsx-1289989717{display:inline;word-wrap:break-word;overflow-wrap:break-word;font:inherit;margin:0;}", ".container.jsx-1289989717{background-color:".concat(_ui.colors.white, ";max-height:180px;overflow:auto;}")];
|
|
22
|
+
exports.userMentionWrapperClasses = userMentionWrapperClasses;
|
|
23
|
+
userMentionWrapperClasses.__hash = "1289989717";
|
|
24
|
+
const resolvedHeaderStyle = {
|
|
25
|
+
styles: /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
26
|
+
id: "4275958396"
|
|
27
|
+
}, [".jsx-4275958396{position:-webkit-sticky;position:sticky;top:0;}"]),
|
|
28
|
+
className: "jsx-4275958396"
|
|
29
|
+
};
|
|
30
|
+
exports.resolvedHeaderStyle = resolvedHeaderStyle;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useUserSearchResults = void 0;
|
|
7
|
+
|
|
8
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
9
|
+
|
|
10
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
11
|
+
|
|
12
|
+
var _react = require("react");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
const usersQuery = {
|
|
17
|
+
users: {
|
|
18
|
+
resource: 'users/gist',
|
|
19
|
+
params: _ref => {
|
|
20
|
+
let {
|
|
21
|
+
searchText
|
|
22
|
+
} = _ref;
|
|
23
|
+
return {
|
|
24
|
+
fields: 'id,displayName,username',
|
|
25
|
+
order: 'firstName,surname',
|
|
26
|
+
total: true,
|
|
27
|
+
filter: "username:ilike:".concat(searchText, ",firstName:ilike:").concat(searchText, ",surname:ilike:").concat(searchText, ",email:ilike:").concat(searchText),
|
|
28
|
+
rootJunction: 'OR'
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const useUserSearchResults = _ref2 => {
|
|
35
|
+
let {
|
|
36
|
+
searchText
|
|
37
|
+
} = _ref2;
|
|
38
|
+
const [{
|
|
39
|
+
users,
|
|
40
|
+
pager
|
|
41
|
+
}, setData] = (0, _react.useState)({
|
|
42
|
+
users: [],
|
|
43
|
+
pager: {}
|
|
44
|
+
});
|
|
45
|
+
const {
|
|
46
|
+
data,
|
|
47
|
+
fetching,
|
|
48
|
+
refetch
|
|
49
|
+
} = (0, _appRuntime.useDataQuery)(usersQuery, {
|
|
50
|
+
lazy: true
|
|
51
|
+
});
|
|
52
|
+
const debouncedRefetch = (0, _react.useCallback)((0, _debounce.default)(refetch, 250), [refetch]);
|
|
53
|
+
(0, _react.useEffect)(() => {
|
|
54
|
+
if (searchText.length) {
|
|
55
|
+
debouncedRefetch({
|
|
56
|
+
searchText
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return () => debouncedRefetch.cancel();
|
|
61
|
+
}, [searchText]);
|
|
62
|
+
(0, _react.useEffect)(() => {
|
|
63
|
+
if (data) {
|
|
64
|
+
setData(data.users);
|
|
65
|
+
}
|
|
66
|
+
}, [data]);
|
|
67
|
+
return {
|
|
68
|
+
users,
|
|
69
|
+
pager,
|
|
70
|
+
fetching,
|
|
71
|
+
clear: () => setData({
|
|
72
|
+
users: [],
|
|
73
|
+
pager: {}
|
|
74
|
+
})
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
exports.useUserSearchResults = useUserSearchResults;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var _index = require("./Interpretation/index.js");
|
|
8
|
+
|
|
9
|
+
Object.keys(_index).forEach(function (key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
if (key in exports && exports[key] === _index[key]) return;
|
|
12
|
+
Object.defineProperty(exports, key, {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _index[key];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
var _index2 = require("./Message/index.js");
|
|
21
|
+
|
|
22
|
+
Object.keys(_index2).forEach(function (key) {
|
|
23
|
+
if (key === "default" || key === "__esModule") return;
|
|
24
|
+
if (key in exports && exports[key] === _index2[key]) return;
|
|
25
|
+
Object.defineProperty(exports, key, {
|
|
26
|
+
enumerable: true,
|
|
27
|
+
get: function () {
|
|
28
|
+
return _index2[key];
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
var _index3 = require("./RichTextEditor/index.js");
|
|
34
|
+
|
|
35
|
+
Object.keys(_index3).forEach(function (key) {
|
|
36
|
+
if (key === "default" || key === "__esModule") return;
|
|
37
|
+
if (key in exports && exports[key] === _index3[key]) return;
|
|
38
|
+
Object.defineProperty(exports, key, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _index3[key];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
|
|
8
8
|
var _ui = require("@dhis2/ui");
|
|
9
9
|
|
|
10
|
-
const _defaultExport = [".container.jsx-
|
|
11
|
-
_defaultExport.__hash = "
|
|
10
|
+
const _defaultExport = [".container.jsx-2467849725{width:180px;background:".concat(_ui.colors.white, ";padding:").concat(_ui.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(_ui.spacers.dp4, ";}"), ".legendSetName.jsx-2467849725{display:inline-block;font-size:13px;color:".concat(_ui.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(_ui.spacers.dp4, " 0 ").concat(_ui.spacers.dp4, " 6px;white-space:break-spaces;text-align:left;font-size:13px;}"), ".values.jsx-2467849725{color:".concat(_ui.colors.grey600, ";font-size:12px;padding-top:2px;}"), ".divider.jsx-2467849725{border-top:1px solid ".concat(_ui.colors.grey400, ";padding-top:").concat(_ui.spacers.dp8, ";margin-top:").concat(_ui.spacers.dp8, ";}")];
|
|
11
|
+
_defaultExport.__hash = "2467849725";
|
|
12
12
|
var _default = _defaultExport;
|
|
13
13
|
exports.default = _default;
|
package/build/cjs/index.js
CHANGED
|
@@ -453,6 +453,18 @@ Object.defineProperty(exports, "ITEM_PROP_ID", {
|
|
|
453
453
|
return _item.ITEM_PROP_ID;
|
|
454
454
|
}
|
|
455
455
|
});
|
|
456
|
+
Object.defineProperty(exports, "InterpretationModal", {
|
|
457
|
+
enumerable: true,
|
|
458
|
+
get: function () {
|
|
459
|
+
return _InterpretationModal.InterpretationModal;
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
Object.defineProperty(exports, "InterpretationsUnit", {
|
|
463
|
+
enumerable: true,
|
|
464
|
+
get: function () {
|
|
465
|
+
return _InterpretationsUnit.InterpretationsUnit;
|
|
466
|
+
}
|
|
467
|
+
});
|
|
456
468
|
Object.defineProperty(exports, "LAYOUT", {
|
|
457
469
|
enumerable: true,
|
|
458
470
|
get: function () {
|
|
@@ -1131,6 +1143,12 @@ Object.defineProperty(exports, "getAxisPerLockedDimension", {
|
|
|
1131
1143
|
return _index5.getAxisPerLockedDimension;
|
|
1132
1144
|
}
|
|
1133
1145
|
});
|
|
1146
|
+
Object.defineProperty(exports, "getColorByValueFromLegendSet", {
|
|
1147
|
+
enumerable: true,
|
|
1148
|
+
get: function () {
|
|
1149
|
+
return _legends.getColorByValueFromLegendSet;
|
|
1150
|
+
}
|
|
1151
|
+
});
|
|
1134
1152
|
Object.defineProperty(exports, "getDimensionById", {
|
|
1135
1153
|
enumerable: true,
|
|
1136
1154
|
get: function () {
|
|
@@ -1444,6 +1462,10 @@ var _LegendKey = _interopRequireDefault(require("./components/LegendKey/LegendKe
|
|
|
1444
1462
|
|
|
1445
1463
|
var _AboutAOUnit = _interopRequireDefault(require("./components/AboutAOUnit/AboutAOUnit.js"));
|
|
1446
1464
|
|
|
1465
|
+
var _InterpretationsUnit = require("./components/Interpretations/InterpretationsUnit/InterpretationsUnit.js");
|
|
1466
|
+
|
|
1467
|
+
var _InterpretationModal = require("./components/Interpretations/InterpretationModal/InterpretationModal.js");
|
|
1468
|
+
|
|
1447
1469
|
var _CachedDataQueryProvider = require("./components/CachedDataQueryProvider.js");
|
|
1448
1470
|
|
|
1449
1471
|
var _Analytics = _interopRequireDefault(require("./api/analytics/Analytics.js"));
|
|
@@ -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": "",
|
|
@@ -13,8 +13,12 @@ exports.LEGEND_DISPLAY_STYLE_FILL = LEGEND_DISPLAY_STYLE_FILL;
|
|
|
13
13
|
const LEGEND_DISPLAY_STYLE_TEXT = 'TEXT';
|
|
14
14
|
exports.LEGEND_DISPLAY_STYLE_TEXT = LEGEND_DISPLAY_STYLE_TEXT;
|
|
15
15
|
|
|
16
|
-
const getLegendByValueFromLegendSet = (legendSet, value) =>
|
|
17
|
-
|
|
16
|
+
const getLegendByValueFromLegendSet = (legendSet, value) => {
|
|
17
|
+
var _legendSet$legends;
|
|
18
|
+
|
|
19
|
+
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
|
|
20
|
+
);
|
|
21
|
+
};
|
|
18
22
|
|
|
19
23
|
exports.getLegendByValueFromLegendSet = getLegendByValueFromLegendSet;
|
|
20
24
|
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import i18n from '@dhis2/d2-i18n';
|
|
2
|
+
import { IconEdit16 } from '@dhis2/ui';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import React, { useState } from 'react';
|
|
5
|
+
import { Message, MessageIconButton, MessageStatsBar } from '../common/index.js';
|
|
6
|
+
import { CommentDeleteButton } from './CommentDeleteButton.js';
|
|
7
|
+
import { CommentUpdateForm } from './CommentUpdateForm.js';
|
|
8
|
+
|
|
9
|
+
const Comment = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
comment,
|
|
12
|
+
currentUser,
|
|
13
|
+
interpretationId,
|
|
14
|
+
onThreadUpdated
|
|
15
|
+
} = _ref;
|
|
16
|
+
const [isUpdateMode, setIsUpdateMode] = useState(false);
|
|
17
|
+
return isUpdateMode ? /*#__PURE__*/React.createElement(CommentUpdateForm, {
|
|
18
|
+
close: () => setIsUpdateMode(false),
|
|
19
|
+
commentId: comment.id,
|
|
20
|
+
interpretationId: interpretationId,
|
|
21
|
+
onComplete: () => onThreadUpdated(false),
|
|
22
|
+
text: comment.text,
|
|
23
|
+
currentUser: currentUser
|
|
24
|
+
}) : /*#__PURE__*/React.createElement(Message, {
|
|
25
|
+
text: comment.text,
|
|
26
|
+
created: comment.created,
|
|
27
|
+
username: comment.createdBy.displayName
|
|
28
|
+
}, /*#__PURE__*/React.createElement(MessageStatsBar, null, comment.access.update && /*#__PURE__*/React.createElement(MessageIconButton, {
|
|
29
|
+
iconComponent: IconEdit16,
|
|
30
|
+
tooltipContent: i18n.t('Edit'),
|
|
31
|
+
onClick: () => setIsUpdateMode(true)
|
|
32
|
+
}), comment.access.delete && /*#__PURE__*/React.createElement(CommentDeleteButton, {
|
|
33
|
+
commentId: comment.id,
|
|
34
|
+
interpretationId: interpretationId,
|
|
35
|
+
onComplete: () => onThreadUpdated(true)
|
|
36
|
+
})));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
Comment.propTypes = {
|
|
40
|
+
comment: PropTypes.object.isRequired,
|
|
41
|
+
currentUser: PropTypes.object.isRequired,
|
|
42
|
+
interpretationId: PropTypes.string.isRequired,
|
|
43
|
+
onThreadUpdated: PropTypes.func.isRequired
|
|
44
|
+
};
|
|
45
|
+
export { Comment };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useDataMutation } from '@dhis2/app-runtime';
|
|
2
|
+
import i18n from '@dhis2/d2-i18n';
|
|
3
|
+
import { Button } from '@dhis2/ui';
|
|
4
|
+
import PropTypes from 'prop-types';
|
|
5
|
+
import React, { useRef, useState } from 'react';
|
|
6
|
+
import { RichTextEditor, MessageEditorContainer, MessageButtonStrip, MessageInput } from '../common/index.js';
|
|
7
|
+
export const CommentAddForm = _ref => {
|
|
8
|
+
let {
|
|
9
|
+
interpretationId,
|
|
10
|
+
currentUser,
|
|
11
|
+
onSave,
|
|
12
|
+
focusRef
|
|
13
|
+
} = _ref;
|
|
14
|
+
const [showRichTextEditor, setShowRichTextEditor] = useState(false);
|
|
15
|
+
const [commentText, setCommentText] = useState('');
|
|
16
|
+
const saveMutationRef = useRef({
|
|
17
|
+
resource: "interpretations/".concat(interpretationId, "/comments"),
|
|
18
|
+
type: 'create',
|
|
19
|
+
data: _ref2 => {
|
|
20
|
+
let {
|
|
21
|
+
commentText
|
|
22
|
+
} = _ref2;
|
|
23
|
+
return commentText;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const [save, {
|
|
27
|
+
loading
|
|
28
|
+
}] = useDataMutation(saveMutationRef.current, {
|
|
29
|
+
onComplete: () => {
|
|
30
|
+
setShowRichTextEditor(false);
|
|
31
|
+
setCommentText('');
|
|
32
|
+
onSave();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const inputPlaceholder = i18n.t('Write a reply');
|
|
36
|
+
return /*#__PURE__*/React.createElement(MessageEditorContainer, {
|
|
37
|
+
currentUser: currentUser
|
|
38
|
+
}, showRichTextEditor ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(RichTextEditor, {
|
|
39
|
+
inputPlaceholder: inputPlaceholder,
|
|
40
|
+
onChange: setCommentText,
|
|
41
|
+
value: commentText,
|
|
42
|
+
ref: focusRef,
|
|
43
|
+
disabled: loading
|
|
44
|
+
}), /*#__PURE__*/React.createElement(MessageButtonStrip, null, /*#__PURE__*/React.createElement(Button, {
|
|
45
|
+
primary: true,
|
|
46
|
+
small: true,
|
|
47
|
+
onClick: () => save({
|
|
48
|
+
commentText
|
|
49
|
+
}),
|
|
50
|
+
loading: loading
|
|
51
|
+
}, i18n.t('Post reply')), /*#__PURE__*/React.createElement(Button, {
|
|
52
|
+
secondary: true,
|
|
53
|
+
small: true,
|
|
54
|
+
disabled: loading,
|
|
55
|
+
onClick: () => {
|
|
56
|
+
setCommentText('');
|
|
57
|
+
setShowRichTextEditor(false);
|
|
58
|
+
}
|
|
59
|
+
}, i18n.t('Cancel')))) : /*#__PURE__*/React.createElement(MessageInput, {
|
|
60
|
+
onFocus: () => setShowRichTextEditor(true),
|
|
61
|
+
placeholder: inputPlaceholder,
|
|
62
|
+
ref: focusRef
|
|
63
|
+
}));
|
|
64
|
+
};
|
|
65
|
+
CommentAddForm.propTypes = {
|
|
66
|
+
currentUser: PropTypes.object.isRequired,
|
|
67
|
+
focusRef: PropTypes.object.isRequired,
|
|
68
|
+
interpretationId: PropTypes.string.isRequired,
|
|
69
|
+
onSave: PropTypes.func
|
|
70
|
+
};
|