@dhis2/analytics 26.9.6 → 26.10.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.
- package/build/cjs/__demo__/DataDimension.stories.js +53 -0
- package/build/cjs/api/dimensions.js +1 -1
- package/build/cjs/api/expression.js +20 -10
- package/build/cjs/components/DataDimension/Calculation/CalculationModal.js +1 -1
- package/build/cjs/components/DataDimension/DataDimension.js +4 -1
- package/build/cjs/components/DataDimension/Info/CalculationInfo.js +106 -0
- package/build/cjs/components/DataDimension/Info/DataElementInfo.js +135 -0
- package/build/cjs/components/DataDimension/Info/DataElementOperandInfo.js +188 -0
- package/build/cjs/components/DataDimension/Info/DataSetInfo.js +115 -0
- package/build/cjs/components/DataDimension/Info/EventDataItemInfo.js +111 -0
- package/build/cjs/components/DataDimension/Info/IndicatorInfo.js +179 -0
- package/build/cjs/components/DataDimension/Info/InfoPopover.js +58 -0
- package/build/cjs/components/DataDimension/Info/InfoTable.js +219 -0
- package/build/cjs/components/DataDimension/Info/ProgramIndicatorInfo.js +191 -0
- package/build/cjs/components/DataDimension/Info/styles/InfoPopover.style.js +10 -0
- package/build/cjs/components/DataDimension/ItemSelector.js +22 -5
- package/build/cjs/components/DataDimension/TransferOption.js +117 -0
- package/build/cjs/components/DataDimension/styles/TransferOption.style.js +10 -0
- package/build/cjs/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +0 -20
- package/build/cjs/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +0 -5
- package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/FixedPeriodSingleSelect.spec.js.snap +0 -12
- package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/PeriodSelector.spec.js.snap +3 -10
- package/build/cjs/components/styles/DimensionSelector.style.js +2 -2
- package/build/cjs/index.js +66 -10
- package/build/cjs/locales/ar/translations.json +96 -22
- package/build/cjs/locales/ar_IQ/translations.json +141 -44
- package/build/cjs/locales/bn/translations.json +458 -0
- package/build/cjs/locales/ckb/translations.json +137 -44
- package/build/cjs/locales/cs/translations.json +88 -20
- package/build/cjs/locales/da/translations.json +102 -23
- package/build/cjs/locales/en/translations.json +73 -9
- package/build/cjs/locales/es/translations.json +75 -9
- package/build/cjs/locales/es_419/translations.json +77 -9
- package/build/cjs/locales/fr/translations.json +77 -9
- package/build/cjs/locales/hi_IN/translations.json +458 -0
- package/build/cjs/locales/id/translations.json +95 -22
- package/build/cjs/locales/index.js +74 -70
- package/build/cjs/locales/km/translations.json +100 -23
- package/build/cjs/locales/lo/translations.json +73 -9
- package/build/cjs/locales/my/translations.json +101 -23
- package/build/cjs/locales/nb/translations.json +88 -20
- package/build/cjs/locales/ne/translations.json +77 -9
- package/build/cjs/locales/nl/translations.json +95 -22
- package/build/cjs/locales/or/translations.json +137 -44
- package/build/cjs/locales/prs/translations.json +102 -23
- package/build/cjs/locales/ps/translations.json +102 -23
- package/build/cjs/locales/pt/translations.json +73 -9
- package/build/cjs/locales/pt_BR/translations.json +95 -22
- package/build/cjs/locales/ro/translations.json +138 -44
- package/build/cjs/locales/ru/translations.json +77 -9
- package/build/cjs/locales/si/translations.json +102 -23
- package/build/cjs/locales/sv/translations.json +88 -20
- package/build/cjs/locales/tet/translations.json +101 -23
- package/build/cjs/locales/tg/translations.json +102 -23
- package/build/cjs/locales/uk/translations.json +96 -22
- package/build/cjs/locales/ur/translations.json +96 -22
- package/build/cjs/locales/uz_UZ_Cyrl/translations.json +95 -22
- package/build/cjs/locales/uz_UZ_Latn/translations.json +96 -22
- package/build/cjs/locales/vi/translations.json +73 -9
- package/build/cjs/locales/zh/translations.json +73 -9
- package/build/cjs/locales/zh_CN/translations.json +95 -22
- package/build/cjs/modules/dimensionListItem.js +3 -3
- package/build/cjs/modules/dimensionSelectorHelper.js +2 -2
- package/build/cjs/modules/valueTypes.js +50 -11
- package/build/es/__demo__/DataDimension.stories.js +42 -0
- package/build/es/api/dimensions.js +1 -1
- package/build/es/api/expression.js +19 -9
- package/build/es/components/DataDimension/Calculation/CalculationModal.js +2 -2
- package/build/es/components/DataDimension/DataDimension.js +4 -1
- package/build/es/components/DataDimension/Info/CalculationInfo.js +96 -0
- package/build/es/components/DataDimension/Info/DataElementInfo.js +127 -0
- package/build/es/components/DataDimension/Info/DataElementOperandInfo.js +178 -0
- package/build/es/components/DataDimension/Info/DataSetInfo.js +107 -0
- package/build/es/components/DataDimension/Info/EventDataItemInfo.js +103 -0
- package/build/es/components/DataDimension/Info/IndicatorInfo.js +169 -0
- package/build/es/components/DataDimension/Info/InfoPopover.js +54 -0
- package/build/es/components/DataDimension/Info/InfoTable.js +205 -0
- package/build/es/components/DataDimension/Info/ProgramIndicatorInfo.js +181 -0
- package/build/es/components/DataDimension/Info/styles/InfoPopover.style.js +4 -0
- package/build/es/components/DataDimension/ItemSelector.js +24 -7
- package/build/es/components/DataDimension/TransferOption.js +109 -0
- package/build/es/components/DataDimension/styles/TransferOption.style.js +4 -0
- package/build/es/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +0 -20
- package/build/es/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +0 -5
- package/build/es/components/PeriodDimension/__tests__/__snapshots__/FixedPeriodSingleSelect.spec.js.snap +0 -12
- package/build/es/components/PeriodDimension/__tests__/__snapshots__/PeriodSelector.spec.js.snap +3 -10
- package/build/es/components/styles/DimensionSelector.style.js +2 -2
- package/build/es/index.js +1 -1
- package/build/es/locales/ar/translations.json +96 -22
- package/build/es/locales/ar_IQ/translations.json +141 -44
- package/build/es/locales/bn/translations.json +458 -0
- package/build/es/locales/ckb/translations.json +137 -44
- package/build/es/locales/cs/translations.json +88 -20
- package/build/es/locales/da/translations.json +102 -23
- package/build/es/locales/en/translations.json +73 -9
- package/build/es/locales/es/translations.json +75 -9
- package/build/es/locales/es_419/translations.json +77 -9
- package/build/es/locales/fr/translations.json +77 -9
- package/build/es/locales/hi_IN/translations.json +458 -0
- package/build/es/locales/id/translations.json +95 -22
- package/build/es/locales/index.js +4 -0
- package/build/es/locales/km/translations.json +100 -23
- package/build/es/locales/lo/translations.json +73 -9
- package/build/es/locales/my/translations.json +101 -23
- package/build/es/locales/nb/translations.json +88 -20
- package/build/es/locales/ne/translations.json +77 -9
- package/build/es/locales/nl/translations.json +95 -22
- package/build/es/locales/or/translations.json +137 -44
- package/build/es/locales/prs/translations.json +102 -23
- package/build/es/locales/ps/translations.json +102 -23
- package/build/es/locales/pt/translations.json +73 -9
- package/build/es/locales/pt_BR/translations.json +95 -22
- package/build/es/locales/ro/translations.json +138 -44
- package/build/es/locales/ru/translations.json +77 -9
- package/build/es/locales/si/translations.json +102 -23
- package/build/es/locales/sv/translations.json +88 -20
- package/build/es/locales/tet/translations.json +101 -23
- package/build/es/locales/tg/translations.json +102 -23
- package/build/es/locales/uk/translations.json +96 -22
- package/build/es/locales/ur/translations.json +96 -22
- package/build/es/locales/uz_UZ_Cyrl/translations.json +95 -22
- package/build/es/locales/uz_UZ_Latn/translations.json +96 -22
- package/build/es/locales/vi/translations.json +73 -9
- package/build/es/locales/zh/translations.json +73 -9
- package/build/es/locales/zh_CN/translations.json +95 -22
- package/build/es/modules/dimensionListItem.js +1 -1
- package/build/es/modules/dimensionSelectorHelper.js +2 -2
- package/build/es/modules/valueTypes.js +48 -10
- package/package.json +5 -5
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"About this map": "",
|
|
19
19
|
"About this line list": "",
|
|
20
20
|
"About this visualization": "",
|
|
21
|
+
"About this event chart": "",
|
|
22
|
+
"About this event report": "",
|
|
21
23
|
"This app could not retrieve required data.": "",
|
|
22
24
|
"Network error": "网络错误",
|
|
23
25
|
"Data / Edit calculation": "",
|
|
@@ -43,9 +45,58 @@
|
|
|
43
45
|
"Drag items here, or double click in the list, to start building a calculation formula": "",
|
|
44
46
|
"Math operators": "",
|
|
45
47
|
"Data Type": "",
|
|
48
|
+
"Only {{dataType}} can be used in {{visType}}": "",
|
|
46
49
|
"All types": "",
|
|
47
50
|
"Disaggregation": "分解",
|
|
48
51
|
"No data": "无数据",
|
|
52
|
+
"Expression description": "表达式描述",
|
|
53
|
+
"Error loading value": "",
|
|
54
|
+
"None": "无",
|
|
55
|
+
"Data set(s)": "",
|
|
56
|
+
"Zero is significant": "",
|
|
57
|
+
"True": "真",
|
|
58
|
+
"False": "假",
|
|
59
|
+
"Value type": "值类型",
|
|
60
|
+
"Aggregation type": "汇总类型",
|
|
61
|
+
"Category combo": "分类组合",
|
|
62
|
+
"Option set": "值域选项集",
|
|
63
|
+
"Group membership": "",
|
|
64
|
+
"Legend set(s)": "",
|
|
65
|
+
"Category option name": "",
|
|
66
|
+
"Category combo name": "",
|
|
67
|
+
"Categories name": "",
|
|
68
|
+
"Period type": "周期类型",
|
|
69
|
+
"Indicators": "指标",
|
|
70
|
+
"Expiry days": "过期满天数",
|
|
71
|
+
"Type": "类型",
|
|
72
|
+
"Data element": "数据元",
|
|
73
|
+
"Tracked entity attribute": "跟踪实体属性",
|
|
74
|
+
"Numerator description": "描述",
|
|
75
|
+
"Numerator expression": "",
|
|
76
|
+
"Denominator description": "分母描述",
|
|
77
|
+
"Denominator expression": "",
|
|
78
|
+
"Annualized": "年度",
|
|
79
|
+
"Yes": "是",
|
|
80
|
+
"No": "否",
|
|
81
|
+
"Indicator type": "指标类型",
|
|
82
|
+
"Decimals in output": "",
|
|
83
|
+
"There was a problem loading information for this data item.": "",
|
|
84
|
+
"Name": "名称",
|
|
85
|
+
"Description": "描述",
|
|
86
|
+
"Code": "代码",
|
|
87
|
+
"ID": "ID",
|
|
88
|
+
"Last updated date": "",
|
|
89
|
+
"Created date": "",
|
|
90
|
+
"Created by": "创建自",
|
|
91
|
+
"Custom": "定制",
|
|
92
|
+
"Program": "项目",
|
|
93
|
+
"Analytics type": "分析类型",
|
|
94
|
+
"Enrollment": "报名",
|
|
95
|
+
"Event": "事件",
|
|
96
|
+
"Analytics period boundaries": "分析期间边界",
|
|
97
|
+
"{{ offsetPeriodType }} × {{ offsetPeriods }}": "",
|
|
98
|
+
"Expression": "表达式",
|
|
99
|
+
"Filter": "过滤器",
|
|
49
100
|
"Search by data item name": "",
|
|
50
101
|
"No items selected": "",
|
|
51
102
|
"Selected Items": "",
|
|
@@ -53,10 +104,12 @@
|
|
|
53
104
|
"No data sets found": "",
|
|
54
105
|
"No event data items found": "",
|
|
55
106
|
"No program indicators found": "",
|
|
107
|
+
"No calculations found": "",
|
|
56
108
|
"No indicators found for \"{{- searchTerm}}\"": "",
|
|
57
109
|
"No data sets found for \"{{- searchTerm}}\"": "",
|
|
58
110
|
"No event data items found for \"{{- searchTerm}}\"": "",
|
|
59
111
|
"No program indicators found for \"{{- searchTerm}}\"": "",
|
|
112
|
+
"No calculations found for \"{{- searchTerm}}\"": "",
|
|
60
113
|
"Nothing found for \"{{- searchTerm}}\"": "",
|
|
61
114
|
"Calculation": "",
|
|
62
115
|
"Metric type": "",
|
|
@@ -94,8 +147,6 @@
|
|
|
94
147
|
"Open in this app": "",
|
|
95
148
|
"Close": "关闭",
|
|
96
149
|
"Rename {{fileType}}": "",
|
|
97
|
-
"Name": "名称",
|
|
98
|
-
"Description": "描述",
|
|
99
150
|
"Rename": "重命名",
|
|
100
151
|
"{{- objectName}} (copy)": "",
|
|
101
152
|
"Save {{fileType}} as": "",
|
|
@@ -123,24 +174,13 @@
|
|
|
123
174
|
"View replies": "",
|
|
124
175
|
"Unlike": "",
|
|
125
176
|
"Like": "Like",
|
|
126
|
-
"Share": "分享",
|
|
127
177
|
"See interpretation": "",
|
|
178
|
+
"Open in app": "",
|
|
179
|
+
"Share": "分享",
|
|
128
180
|
"Manage sharing": "",
|
|
129
181
|
"Could not update interpretation": "",
|
|
130
182
|
"Enter interpretation text": "",
|
|
131
|
-
"Bold text": "",
|
|
132
|
-
"Italic text": "",
|
|
133
|
-
"Link to a URL": "",
|
|
134
|
-
"Mention a user": "",
|
|
135
|
-
"Add emoji": "",
|
|
136
|
-
"Preview": "预览",
|
|
137
|
-
"Back to write mode": "",
|
|
138
|
-
"Too many results. Try refining the search.": "",
|
|
139
|
-
"Search for a user": "",
|
|
140
|
-
"Searching for \"{{- searchText}}\"": "",
|
|
141
|
-
"No results found": "没有结果",
|
|
142
183
|
"Not available offline": "",
|
|
143
|
-
"Created by": "创建自",
|
|
144
184
|
"Anyone": "任何人",
|
|
145
185
|
"Only you": "",
|
|
146
186
|
"Others": "其它",
|
|
@@ -148,7 +188,6 @@
|
|
|
148
188
|
"Filter by name": "按名称过滤",
|
|
149
189
|
"Created": "已创建",
|
|
150
190
|
"Last updated": "上次更新",
|
|
151
|
-
"Type": "类型",
|
|
152
191
|
"Clear filters": "清除过滤器",
|
|
153
192
|
"{{firstItemIndex}}-{{lastItemIndex}} of {{totalNumberOfItems}}": "",
|
|
154
193
|
"Open": "打开",
|
|
@@ -191,13 +230,12 @@
|
|
|
191
230
|
"Select a level": "选择一个等级",
|
|
192
231
|
"Select a group": "",
|
|
193
232
|
"Deselect all": "去全选",
|
|
194
|
-
"Period type": "周期类型",
|
|
195
233
|
"Year": "年",
|
|
196
234
|
"Select year": "选择年份",
|
|
197
235
|
"Period": "周期",
|
|
236
|
+
"Selected Periods": "",
|
|
198
237
|
"Relative periods": "",
|
|
199
238
|
"Fixed periods": "",
|
|
200
|
-
"Selected Periods": "",
|
|
201
239
|
"No periods selected": "",
|
|
202
240
|
"Daily": "每日",
|
|
203
241
|
"Weekly": "每周",
|
|
@@ -267,6 +305,14 @@
|
|
|
267
305
|
"Six-months": "",
|
|
268
306
|
"Financial Years": "",
|
|
269
307
|
"Years": "年",
|
|
308
|
+
"Value: {{value}}": "",
|
|
309
|
+
"Bold text": "",
|
|
310
|
+
"Italic text": "",
|
|
311
|
+
"Link to a URL": "",
|
|
312
|
+
"Mention a user": "",
|
|
313
|
+
"Add emoji": "",
|
|
314
|
+
"Preview": "预览",
|
|
315
|
+
"Back to write mode": "",
|
|
270
316
|
"Interpretations and details": "",
|
|
271
317
|
"Translating to": "",
|
|
272
318
|
"Choose a locale": "",
|
|
@@ -277,9 +323,12 @@
|
|
|
277
323
|
"Cannot save while offline": "",
|
|
278
324
|
"Could not load translations": "",
|
|
279
325
|
"Retry": "",
|
|
326
|
+
"Too many results. Try refining the search.": "",
|
|
327
|
+
"Search for a user": "",
|
|
328
|
+
"Searching for \"{{- searchText}}\"": "",
|
|
329
|
+
"No results found": "没有结果",
|
|
280
330
|
"Series": "",
|
|
281
331
|
"Category": "分类",
|
|
282
|
-
"Filter": "过滤器",
|
|
283
332
|
"Columns": "",
|
|
284
333
|
"Rows": "",
|
|
285
334
|
"Points": "",
|
|
@@ -288,16 +337,13 @@
|
|
|
288
337
|
"Actual reports": "实际上报",
|
|
289
338
|
"Actual reports on time": "实际准时上报",
|
|
290
339
|
"Expected reports": "预期上报",
|
|
291
|
-
"Program": "项目",
|
|
292
340
|
"Select a program": "",
|
|
293
|
-
"Indicators": "指标",
|
|
294
341
|
"Indicator group": "指标组",
|
|
295
342
|
"All groups": "",
|
|
296
343
|
"Indicator": "指标",
|
|
297
344
|
"No indicator groups found": "",
|
|
298
345
|
"Loading indicator groups": "",
|
|
299
346
|
"Data element group": "数据元组",
|
|
300
|
-
"Data element": "数据元",
|
|
301
347
|
"No data element groups found": "",
|
|
302
348
|
"Loading data element groups": "",
|
|
303
349
|
"Data sets": "数据集",
|
|
@@ -346,9 +392,35 @@
|
|
|
346
392
|
"{{thresholdFactor}} × Modified Z-score high": "",
|
|
347
393
|
"{{thresholdFactor}} × Z-score low": "",
|
|
348
394
|
"{{thresholdFactor}} × Z-score high": "",
|
|
395
|
+
"Not applicable": "",
|
|
349
396
|
"Data": "数据",
|
|
350
397
|
"Organisation unit": "机构",
|
|
351
398
|
"Assigned Categories": "",
|
|
399
|
+
"Text": "文本",
|
|
400
|
+
"Long text": "长文本",
|
|
401
|
+
"Multi text": "",
|
|
402
|
+
"Letter": "字符",
|
|
403
|
+
"Phone number": "电话号码",
|
|
404
|
+
"Email": "邮件",
|
|
405
|
+
"Yes/No": "是/否",
|
|
406
|
+
"Yes Only": "仅是",
|
|
407
|
+
"Date": "日期",
|
|
408
|
+
"Date & Time": "日期 &时间",
|
|
409
|
+
"Time": "时间",
|
|
410
|
+
"Unit interval": "单位间隔",
|
|
411
|
+
"Percentage": "百分比",
|
|
412
|
+
"Integer": "整型",
|
|
413
|
+
"Positive Integer": "正数",
|
|
414
|
+
"Negative Integer": "负整数",
|
|
415
|
+
"Positive or Zero Integer": "正整数或零",
|
|
416
|
+
"Tracker Associate": "随访相关",
|
|
417
|
+
"Username": "用户名",
|
|
418
|
+
"Coordinate": "坐标",
|
|
419
|
+
"Reference": "引用",
|
|
420
|
+
"Age": "年龄",
|
|
421
|
+
"URL": "URL",
|
|
422
|
+
"Image": "图片(PNG)",
|
|
423
|
+
"GeoJSON": "GeoJSON",
|
|
352
424
|
"Pivot table": "",
|
|
353
425
|
"Area": "面积",
|
|
354
426
|
"Stacked area": "",
|
|
@@ -365,6 +437,7 @@
|
|
|
365
437
|
"Radar": "",
|
|
366
438
|
"Scatter": "",
|
|
367
439
|
"Single value": "",
|
|
440
|
+
"Outlier table": "",
|
|
368
441
|
"All charts": "",
|
|
369
442
|
"{{seriesName}} (trend)": "",
|
|
370
443
|
"Trend": "",
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.getIcon = exports.getDimensionType = void 0;
|
|
7
7
|
var _ui = require("@dhis2/ui");
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _DataElementIcon = _interopRequireDefault(require("../assets/DimensionItemIcons/DataElementIcon.js"));
|
|
@@ -12,7 +12,7 @@ var _CalculationIcon = _interopRequireDefault(require("./../assets/DimensionItem
|
|
|
12
12
|
var _dataSets = require("./dataSets.js");
|
|
13
13
|
var _dataTypes = require("./dataTypes.js");
|
|
14
14
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
-
const
|
|
15
|
+
const getDimensionType = _ref => {
|
|
16
16
|
var _dataTypes$type;
|
|
17
17
|
let {
|
|
18
18
|
type,
|
|
@@ -33,7 +33,7 @@ const getTooltipText = _ref => {
|
|
|
33
33
|
return (_dataTypes$type = _dataTypes.dataTypeMap[type]) === null || _dataTypes$type === void 0 ? void 0 : _dataTypes$type.getItemName();
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
exports.
|
|
36
|
+
exports.getDimensionType = getDimensionType;
|
|
37
37
|
const getIcon = type => {
|
|
38
38
|
switch (type) {
|
|
39
39
|
case _dataTypes.DIMENSION_TYPE_INDICATOR:
|
|
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.TRANSFER_SELECTED_WIDTH = exports.TRANSFER_OPTIONS_WIDTH = exports.TRANSFER_HEIGHT = void 0;
|
|
7
|
-
const TRANSFER_OPTIONS_WIDTH = exports.TRANSFER_OPTIONS_WIDTH = '
|
|
8
|
-
const TRANSFER_SELECTED_WIDTH = exports.TRANSFER_SELECTED_WIDTH = '
|
|
7
|
+
const TRANSFER_OPTIONS_WIDTH = exports.TRANSFER_OPTIONS_WIDTH = '520px';
|
|
8
|
+
const TRANSFER_SELECTED_WIDTH = exports.TRANSFER_SELECTED_WIDTH = '520px';
|
|
9
9
|
const TRANSFER_HEIGHT = exports.TRANSFER_HEIGHT = '512px';
|
|
@@ -3,32 +3,71 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isNumericValueType = exports.isCumulativeValueType = exports.isBooleanValueType = exports.VALUE_TYPE_USERNAME = exports.VALUE_TYPE_URL = exports.VALUE_TYPE_UNIT_INTERVAL = exports.VALUE_TYPE_TRUE_ONLY = exports.VALUE_TYPE_TIME = exports.VALUE_TYPE_TEXT = exports.VALUE_TYPE_PHONE_NUMBER = exports.VALUE_TYPE_PERCENTAGE = exports.VALUE_TYPE_ORGANISATION_UNIT = exports.VALUE_TYPE_NUMBER = exports.VALUE_TYPE_LONG_TEXT = exports.VALUE_TYPE_LETTER = exports.VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE = exports.VALUE_TYPE_INTEGER_POSITIVE = exports.VALUE_TYPE_INTEGER_NEGATIVE = exports.VALUE_TYPE_INTEGER = exports.VALUE_TYPE_EMAIL = exports.VALUE_TYPE_DATETIME = exports.VALUE_TYPE_DATE = exports.VALUE_TYPE_BOOLEAN = exports.VALUE_TYPE_AGE = void 0;
|
|
6
|
+
exports.valueTypeDisplayNames = exports.isNumericValueType = exports.isCumulativeValueType = exports.isBooleanValueType = exports.VALUE_TYPE_USERNAME = exports.VALUE_TYPE_URL = exports.VALUE_TYPE_UNIT_INTERVAL = exports.VALUE_TYPE_TRUE_ONLY = exports.VALUE_TYPE_TRACKER_ASSOCIATE = exports.VALUE_TYPE_TIME = exports.VALUE_TYPE_TEXT = exports.VALUE_TYPE_REFERENCE = exports.VALUE_TYPE_PHONE_NUMBER = exports.VALUE_TYPE_PERCENTAGE = exports.VALUE_TYPE_ORGANISATION_UNIT = exports.VALUE_TYPE_NUMBER = exports.VALUE_TYPE_MULTI_TEXT = exports.VALUE_TYPE_LONG_TEXT = exports.VALUE_TYPE_LETTER = exports.VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE = exports.VALUE_TYPE_INTEGER_POSITIVE = exports.VALUE_TYPE_INTEGER_NEGATIVE = exports.VALUE_TYPE_INTEGER = exports.VALUE_TYPE_IMAGE = exports.VALUE_TYPE_GEOJSON = exports.VALUE_TYPE_FILE_RESOURCE = exports.VALUE_TYPE_EMAIL = exports.VALUE_TYPE_DATETIME = exports.VALUE_TYPE_DATE = exports.VALUE_TYPE_COORDINATE = exports.VALUE_TYPE_BOOLEAN = exports.VALUE_TYPE_AGE = void 0;
|
|
7
|
+
var _index = _interopRequireDefault(require("../locales/index.js"));
|
|
8
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
9
|
/* These types match the types in the backend
|
|
8
10
|
https://github.com/dhis2/dhis2-core/blob/master/dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java
|
|
9
11
|
*/
|
|
10
12
|
|
|
11
|
-
const VALUE_TYPE_NUMBER = exports.VALUE_TYPE_NUMBER = 'NUMBER';
|
|
12
|
-
const VALUE_TYPE_UNIT_INTERVAL = exports.VALUE_TYPE_UNIT_INTERVAL = 'UNIT_INTERVAL';
|
|
13
|
-
const VALUE_TYPE_PERCENTAGE = exports.VALUE_TYPE_PERCENTAGE = 'PERCENTAGE';
|
|
14
|
-
const VALUE_TYPE_INTEGER = exports.VALUE_TYPE_INTEGER = 'INTEGER';
|
|
15
|
-
const VALUE_TYPE_INTEGER_POSITIVE = exports.VALUE_TYPE_INTEGER_POSITIVE = 'INTEGER_POSITIVE';
|
|
16
|
-
const VALUE_TYPE_INTEGER_NEGATIVE = exports.VALUE_TYPE_INTEGER_NEGATIVE = 'INTEGER_NEGATIVE';
|
|
17
|
-
const VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE = exports.VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE = 'INTEGER_ZERO_OR_POSITIVE';
|
|
18
13
|
const VALUE_TYPE_TEXT = exports.VALUE_TYPE_TEXT = 'TEXT';
|
|
19
14
|
const VALUE_TYPE_LONG_TEXT = exports.VALUE_TYPE_LONG_TEXT = 'LONG_TEXT';
|
|
15
|
+
const VALUE_TYPE_MULTI_TEXT = exports.VALUE_TYPE_MULTI_TEXT = 'MULTI_TEXT';
|
|
20
16
|
const VALUE_TYPE_LETTER = exports.VALUE_TYPE_LETTER = 'LETTER';
|
|
21
17
|
const VALUE_TYPE_PHONE_NUMBER = exports.VALUE_TYPE_PHONE_NUMBER = 'PHONE_NUMBER';
|
|
22
18
|
const VALUE_TYPE_EMAIL = exports.VALUE_TYPE_EMAIL = 'EMAIL';
|
|
23
|
-
const VALUE_TYPE_USERNAME = exports.VALUE_TYPE_USERNAME = 'USERNAME';
|
|
24
|
-
const VALUE_TYPE_URL = exports.VALUE_TYPE_URL = 'URL';
|
|
25
19
|
const VALUE_TYPE_BOOLEAN = exports.VALUE_TYPE_BOOLEAN = 'BOOLEAN';
|
|
26
20
|
const VALUE_TYPE_TRUE_ONLY = exports.VALUE_TYPE_TRUE_ONLY = 'TRUE_ONLY';
|
|
27
21
|
const VALUE_TYPE_DATE = exports.VALUE_TYPE_DATE = 'DATE';
|
|
28
|
-
const VALUE_TYPE_TIME = exports.VALUE_TYPE_TIME = 'TIME';
|
|
29
22
|
const VALUE_TYPE_DATETIME = exports.VALUE_TYPE_DATETIME = 'DATETIME';
|
|
23
|
+
const VALUE_TYPE_TIME = exports.VALUE_TYPE_TIME = 'TIME';
|
|
24
|
+
const VALUE_TYPE_NUMBER = exports.VALUE_TYPE_NUMBER = 'NUMBER';
|
|
25
|
+
const VALUE_TYPE_UNIT_INTERVAL = exports.VALUE_TYPE_UNIT_INTERVAL = 'UNIT_INTERVAL';
|
|
26
|
+
const VALUE_TYPE_PERCENTAGE = exports.VALUE_TYPE_PERCENTAGE = 'PERCENTAGE';
|
|
27
|
+
const VALUE_TYPE_INTEGER = exports.VALUE_TYPE_INTEGER = 'INTEGER';
|
|
28
|
+
const VALUE_TYPE_INTEGER_POSITIVE = exports.VALUE_TYPE_INTEGER_POSITIVE = 'INTEGER_POSITIVE';
|
|
29
|
+
const VALUE_TYPE_INTEGER_NEGATIVE = exports.VALUE_TYPE_INTEGER_NEGATIVE = 'INTEGER_NEGATIVE';
|
|
30
|
+
const VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE = exports.VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE = 'INTEGER_ZERO_OR_POSITIVE';
|
|
31
|
+
const VALUE_TYPE_TRACKER_ASSOCIATE = exports.VALUE_TYPE_TRACKER_ASSOCIATE = 'TRACKER_ASSOCIATE';
|
|
32
|
+
const VALUE_TYPE_USERNAME = exports.VALUE_TYPE_USERNAME = 'USERNAME';
|
|
33
|
+
const VALUE_TYPE_COORDINATE = exports.VALUE_TYPE_COORDINATE = 'COORDINATE';
|
|
30
34
|
const VALUE_TYPE_ORGANISATION_UNIT = exports.VALUE_TYPE_ORGANISATION_UNIT = 'ORGANISATION_UNIT';
|
|
35
|
+
const VALUE_TYPE_REFERENCE = exports.VALUE_TYPE_REFERENCE = 'REFERENCE';
|
|
31
36
|
const VALUE_TYPE_AGE = exports.VALUE_TYPE_AGE = 'AGE';
|
|
37
|
+
const VALUE_TYPE_URL = exports.VALUE_TYPE_URL = 'URL';
|
|
38
|
+
const VALUE_TYPE_FILE_RESOURCE = exports.VALUE_TYPE_FILE_RESOURCE = 'FILE_RESOURCE';
|
|
39
|
+
const VALUE_TYPE_IMAGE = exports.VALUE_TYPE_IMAGE = 'IMAGE';
|
|
40
|
+
const VALUE_TYPE_GEOJSON = exports.VALUE_TYPE_GEOJSON = 'GEOJSON';
|
|
41
|
+
const valueTypeDisplayNames = exports.valueTypeDisplayNames = {
|
|
42
|
+
[VALUE_TYPE_TEXT]: _index.default.t('Text'),
|
|
43
|
+
[VALUE_TYPE_LONG_TEXT]: _index.default.t('Long text'),
|
|
44
|
+
[VALUE_TYPE_MULTI_TEXT]: _index.default.t('Multi text'),
|
|
45
|
+
[VALUE_TYPE_LETTER]: _index.default.t('Letter'),
|
|
46
|
+
[VALUE_TYPE_PHONE_NUMBER]: _index.default.t('Phone number'),
|
|
47
|
+
[VALUE_TYPE_EMAIL]: _index.default.t('Email'),
|
|
48
|
+
[VALUE_TYPE_BOOLEAN]: _index.default.t('Yes/No'),
|
|
49
|
+
[VALUE_TYPE_TRUE_ONLY]: _index.default.t('Yes Only'),
|
|
50
|
+
[VALUE_TYPE_DATE]: _index.default.t('Date'),
|
|
51
|
+
[VALUE_TYPE_DATETIME]: _index.default.t('Date & Time'),
|
|
52
|
+
[VALUE_TYPE_TIME]: _index.default.t('Time'),
|
|
53
|
+
[VALUE_TYPE_NUMBER]: _index.default.t('Number'),
|
|
54
|
+
[VALUE_TYPE_UNIT_INTERVAL]: _index.default.t('Unit interval'),
|
|
55
|
+
[VALUE_TYPE_PERCENTAGE]: _index.default.t('Percentage'),
|
|
56
|
+
[VALUE_TYPE_INTEGER]: _index.default.t('Integer'),
|
|
57
|
+
[VALUE_TYPE_INTEGER_POSITIVE]: _index.default.t('Positive Integer'),
|
|
58
|
+
[VALUE_TYPE_INTEGER_NEGATIVE]: _index.default.t('Negative Integer'),
|
|
59
|
+
[VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE]: _index.default.t('Positive or Zero Integer'),
|
|
60
|
+
[VALUE_TYPE_TRACKER_ASSOCIATE]: _index.default.t('Tracker Associate'),
|
|
61
|
+
[VALUE_TYPE_USERNAME]: _index.default.t('Username'),
|
|
62
|
+
[VALUE_TYPE_COORDINATE]: _index.default.t('Coordinate'),
|
|
63
|
+
[VALUE_TYPE_ORGANISATION_UNIT]: _index.default.t('Organisation unit'),
|
|
64
|
+
[VALUE_TYPE_REFERENCE]: _index.default.t('Reference'),
|
|
65
|
+
[VALUE_TYPE_AGE]: _index.default.t('Age'),
|
|
66
|
+
[VALUE_TYPE_URL]: _index.default.t('URL'),
|
|
67
|
+
[VALUE_TYPE_FILE_RESOURCE]: _index.default.t('File'),
|
|
68
|
+
[VALUE_TYPE_IMAGE]: _index.default.t('Image'),
|
|
69
|
+
[VALUE_TYPE_GEOJSON]: _index.default.t('GeoJSON')
|
|
70
|
+
};
|
|
32
71
|
const NUMERIC_VALUE_TYPES = [VALUE_TYPE_NUMBER, VALUE_TYPE_UNIT_INTERVAL, VALUE_TYPE_PERCENTAGE, VALUE_TYPE_INTEGER, VALUE_TYPE_INTEGER_POSITIVE, VALUE_TYPE_INTEGER_NEGATIVE, VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE];
|
|
33
72
|
const BOOLEAN_VALUE_TYPES = [VALUE_TYPE_BOOLEAN, VALUE_TYPE_TRUE_ONLY];
|
|
34
73
|
const CUMULATIVE_VALUE_TYPES = [VALUE_TYPE_NUMBER, VALUE_TYPE_INTEGER, VALUE_TYPE_INTEGER_POSITIVE, VALUE_TYPE_INTEGER_NEGATIVE, VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE, ...BOOLEAN_VALUE_TYPES];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { DataProvider } from '@dhis2/app-runtime';
|
|
2
|
+
import { ConfigProvider } from '@dhis2/app-service-config';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import DataDimension from '../components/DataDimension/DataDimension.js';
|
|
5
|
+
const Wrapper = story => /*#__PURE__*/React.createElement(ConfigProvider, {
|
|
6
|
+
config: {
|
|
7
|
+
serverVersion: {
|
|
8
|
+
major: 2,
|
|
9
|
+
minor: 41
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}, /*#__PURE__*/React.createElement(DataProvider, {
|
|
13
|
+
baseUrl: "https://test.e2e.dhis2.org/analytics-41dev",
|
|
14
|
+
apiVersion: "41"
|
|
15
|
+
}, story()));
|
|
16
|
+
export default {
|
|
17
|
+
title: 'DataDimension',
|
|
18
|
+
decorators: [Wrapper]
|
|
19
|
+
};
|
|
20
|
+
export const NoneSelected = () => {
|
|
21
|
+
const [selected, setSelected] = useState([]);
|
|
22
|
+
return /*#__PURE__*/React.createElement(DataDimension, {
|
|
23
|
+
displayNameProp: "displayName",
|
|
24
|
+
selectedDimensions: selected,
|
|
25
|
+
onSelect: response => setSelected(response.items)
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
NoneSelected.story = {
|
|
29
|
+
name: 'None selected'
|
|
30
|
+
};
|
|
31
|
+
export const WithInfoBoxMessage = () => {
|
|
32
|
+
const [selected, setSelected] = useState([]);
|
|
33
|
+
return /*#__PURE__*/React.createElement(DataDimension, {
|
|
34
|
+
displayNameProp: "displayName",
|
|
35
|
+
selectedDimensions: selected,
|
|
36
|
+
onSelect: response => setSelected(response.items),
|
|
37
|
+
infoBoxMessage: 'Test message showing in the info box'
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
WithInfoBoxMessage.story = {
|
|
41
|
+
name: 'With info box message'
|
|
42
|
+
};
|
|
@@ -182,7 +182,7 @@ export const dataElementOperandsQuery = {
|
|
|
182
182
|
page
|
|
183
183
|
} = _ref10;
|
|
184
184
|
const idField = (filter === null || filter === void 0 ? void 0 : filter.group) === DIMENSION_TYPE_ALL ? 'id' : 'dimensionItem~rename(id)';
|
|
185
|
-
const filters = [];
|
|
185
|
+
const filters = ['categoryOptionCombo.name:ne:default'];
|
|
186
186
|
if (filter !== null && filter !== void 0 && filter.group && filter.group !== DIMENSION_TYPE_ALL) {
|
|
187
187
|
filters.push(`dataElement.dataElementGroups.id:eq:${filter.group}`);
|
|
188
188
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const
|
|
1
|
+
export const validateIndicatorExpressionMutation = {
|
|
2
2
|
type: 'create',
|
|
3
3
|
resource: 'indicators/expression/description',
|
|
4
4
|
data: _ref => {
|
|
@@ -8,14 +8,24 @@ export const validateExpressionMutation = {
|
|
|
8
8
|
return expression;
|
|
9
9
|
}
|
|
10
10
|
};
|
|
11
|
+
export const validateProgramIndicatorExpressionMutation = {
|
|
12
|
+
type: 'create',
|
|
13
|
+
resource: 'programIndicators/expression/description',
|
|
14
|
+
data: _ref2 => {
|
|
15
|
+
let {
|
|
16
|
+
expression
|
|
17
|
+
} = _ref2;
|
|
18
|
+
return expression;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
11
21
|
export const createCalculationMutation = {
|
|
12
22
|
type: 'create',
|
|
13
23
|
resource: 'expressionDimensionItems',
|
|
14
|
-
data:
|
|
24
|
+
data: _ref3 => {
|
|
15
25
|
let {
|
|
16
26
|
name,
|
|
17
27
|
expression
|
|
18
|
-
} =
|
|
28
|
+
} = _ref3;
|
|
19
29
|
return {
|
|
20
30
|
name,
|
|
21
31
|
shortName: name,
|
|
@@ -26,17 +36,17 @@ export const createCalculationMutation = {
|
|
|
26
36
|
export const updateCalculationMutation = {
|
|
27
37
|
type: 'json-patch',
|
|
28
38
|
resource: 'expressionDimensionItems',
|
|
29
|
-
id:
|
|
39
|
+
id: _ref4 => {
|
|
30
40
|
let {
|
|
31
41
|
id
|
|
32
|
-
} =
|
|
42
|
+
} = _ref4;
|
|
33
43
|
return id;
|
|
34
44
|
},
|
|
35
|
-
data:
|
|
45
|
+
data: _ref5 => {
|
|
36
46
|
let {
|
|
37
47
|
name,
|
|
38
48
|
expression
|
|
39
|
-
} =
|
|
49
|
+
} = _ref5;
|
|
40
50
|
return [{
|
|
41
51
|
op: 'add',
|
|
42
52
|
path: '/name',
|
|
@@ -55,10 +65,10 @@ export const updateCalculationMutation = {
|
|
|
55
65
|
export const deleteCalculationMutation = {
|
|
56
66
|
type: 'delete',
|
|
57
67
|
resource: 'expressionDimensionItems',
|
|
58
|
-
id:
|
|
68
|
+
id: _ref6 => {
|
|
59
69
|
let {
|
|
60
70
|
id
|
|
61
|
-
} =
|
|
71
|
+
} = _ref6;
|
|
62
72
|
return id;
|
|
63
73
|
}
|
|
64
74
|
};
|
|
@@ -4,7 +4,7 @@ import { Button, Modal, ModalTitle, ModalContent, ModalActions, ButtonStrip, Inp
|
|
|
4
4
|
import cx from 'classnames';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
|
-
import { createCalculationMutation, deleteCalculationMutation, updateCalculationMutation,
|
|
7
|
+
import { createCalculationMutation, deleteCalculationMutation, updateCalculationMutation, validateIndicatorExpressionMutation } from '../../../api/expression.js';
|
|
8
8
|
import i18n from '../../../locales/index.js';
|
|
9
9
|
import { parseExpressionToArray, parseArrayToExpression, validateExpression, EXPRESSION_TYPE_DATA, EXPRESSION_TYPE_NUMBER, INVALID_EXPRESSION, VALID_EXPRESSION, getItemIdsFromExpression } from '../../../modules/expressions.js';
|
|
10
10
|
import { OfflineTooltip as Tooltip } from '../../OfflineTooltip.js';
|
|
@@ -42,7 +42,7 @@ const CalculationModal = _ref => {
|
|
|
42
42
|
}] = useDataMutation(deleteCalculationMutation, mutationParams);
|
|
43
43
|
const [doBackendValidation, {
|
|
44
44
|
loading: isValidating
|
|
45
|
-
}] = useDataMutation(
|
|
45
|
+
}] = useDataMutation(validateIndicatorExpressionMutation, {
|
|
46
46
|
onError: error => showError(error)
|
|
47
47
|
});
|
|
48
48
|
const query = {
|
|
@@ -7,6 +7,7 @@ import ItemSelector from './ItemSelector.js';
|
|
|
7
7
|
const DataDimensionCtx = /*#__PURE__*/createContext({});
|
|
8
8
|
const DataDimension = _ref => {
|
|
9
9
|
let {
|
|
10
|
+
currentUser,
|
|
10
11
|
onSelect,
|
|
11
12
|
selectedDimensions,
|
|
12
13
|
displayNameProp,
|
|
@@ -40,7 +41,8 @@ const DataDimension = _ref => {
|
|
|
40
41
|
useEffect(() => enabledDataTypes && setDataTypes(filterDataTypesByVersion(enabledDataTypes)), [enabledDataTypes, filterDataTypesByVersion]);
|
|
41
42
|
return /*#__PURE__*/React.createElement(DataDimensionCtx.Provider, {
|
|
42
43
|
value: {
|
|
43
|
-
visType
|
|
44
|
+
visType,
|
|
45
|
+
currentUser
|
|
44
46
|
}
|
|
45
47
|
}, /*#__PURE__*/React.createElement(ItemSelector, {
|
|
46
48
|
selectedItems: selectedDimensions.map(item => ({
|
|
@@ -69,6 +71,7 @@ DataDimension.propTypes = {
|
|
|
69
71
|
type: PropTypes.string
|
|
70
72
|
})).isRequired,
|
|
71
73
|
onSelect: PropTypes.func.isRequired,
|
|
74
|
+
currentUser: PropTypes.object,
|
|
72
75
|
enabledDataTypes: PropTypes.array,
|
|
73
76
|
infoBoxMessage: PropTypes.string,
|
|
74
77
|
visType: PropTypes.string,
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
2
|
+
import { useConfig, useDataMutation, useDataEngine } from '@dhis2/app-runtime';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import React, { useCallback, useEffect, useState } from 'react';
|
|
5
|
+
import { validateIndicatorExpressionMutation } from '../../../api/expression.js';
|
|
6
|
+
import i18n from '../../../locales/index.js';
|
|
7
|
+
import { getCommonFields, renderHumanReadableExpression, InfoTable } from './InfoTable.js';
|
|
8
|
+
import styles from './styles/InfoPopover.style.js';
|
|
9
|
+
const calculationQuery = {
|
|
10
|
+
calculation: {
|
|
11
|
+
resource: 'expressionDimensionItems',
|
|
12
|
+
id: _ref => {
|
|
13
|
+
let {
|
|
14
|
+
id
|
|
15
|
+
} = _ref;
|
|
16
|
+
return id;
|
|
17
|
+
},
|
|
18
|
+
params: _ref2 => {
|
|
19
|
+
let {
|
|
20
|
+
displayNameProp
|
|
21
|
+
} = _ref2;
|
|
22
|
+
return {
|
|
23
|
+
fields: `${getCommonFields(displayNameProp)},expression`
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export const CalculationInfo = _ref3 => {
|
|
29
|
+
let {
|
|
30
|
+
type,
|
|
31
|
+
id,
|
|
32
|
+
displayNameProp
|
|
33
|
+
} = _ref3;
|
|
34
|
+
const [data, setData] = useState();
|
|
35
|
+
const [error, setError] = useState();
|
|
36
|
+
const [expressionError, setExpressionError] = useState();
|
|
37
|
+
const [loading, setLoading] = useState(true);
|
|
38
|
+
const {
|
|
39
|
+
baseUrl,
|
|
40
|
+
apiVersion
|
|
41
|
+
} = useConfig();
|
|
42
|
+
const engine = useDataEngine();
|
|
43
|
+
const [getHumanReadableExpression] = useDataMutation(validateIndicatorExpressionMutation, {
|
|
44
|
+
onError: setExpressionError
|
|
45
|
+
});
|
|
46
|
+
const fetchData = useCallback(async () => {
|
|
47
|
+
const {
|
|
48
|
+
calculation
|
|
49
|
+
} = await engine.query(calculationQuery, {
|
|
50
|
+
variables: {
|
|
51
|
+
id,
|
|
52
|
+
displayNameProp
|
|
53
|
+
},
|
|
54
|
+
onError: setError
|
|
55
|
+
});
|
|
56
|
+
if (calculation.expression) {
|
|
57
|
+
const result = await getHumanReadableExpression({
|
|
58
|
+
expression: calculation.expression
|
|
59
|
+
});
|
|
60
|
+
if (result) {
|
|
61
|
+
calculation.humanReadableExpression = result;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// inject href as it is not returned from the API
|
|
66
|
+
calculation.href = new URL(`${calculationQuery.calculation.resource}/${id}`, new URL(`api/${apiVersion}/`, baseUrl === '..' ? window.location.href.split('dhis-web-data-visualizer/')[0] : `${baseUrl}/`)).href;
|
|
67
|
+
setData({
|
|
68
|
+
calculation
|
|
69
|
+
});
|
|
70
|
+
setLoading(false);
|
|
71
|
+
}, [displayNameProp, engine, getHumanReadableExpression, id, apiVersion, baseUrl]);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
fetchData();
|
|
74
|
+
}, [fetchData]);
|
|
75
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfoTable, {
|
|
76
|
+
dataType: type,
|
|
77
|
+
data: data === null || data === void 0 ? void 0 : data.calculation,
|
|
78
|
+
loading: loading,
|
|
79
|
+
error: error
|
|
80
|
+
}, /*#__PURE__*/React.createElement("tr", {
|
|
81
|
+
className: `jsx-${styles.__hash}`
|
|
82
|
+
}, /*#__PURE__*/React.createElement("th", {
|
|
83
|
+
className: `jsx-${styles.__hash}`
|
|
84
|
+
}, i18n.t('Expression description')), /*#__PURE__*/React.createElement("td", {
|
|
85
|
+
className: `jsx-${styles.__hash}`
|
|
86
|
+
}, data !== null && data !== void 0 && data.calculation.humanReadableExpression ? renderHumanReadableExpression(data.calculation.humanReadableExpression) : /*#__PURE__*/React.createElement("span", {
|
|
87
|
+
className: `jsx-${styles.__hash}` + " " + "none"
|
|
88
|
+
}, expressionError ? i18n.t('Error loading value') : i18n.t('None'))))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
89
|
+
id: styles.__hash
|
|
90
|
+
}, styles));
|
|
91
|
+
};
|
|
92
|
+
CalculationInfo.propTypes = {
|
|
93
|
+
displayNameProp: PropTypes.string,
|
|
94
|
+
id: PropTypes.string,
|
|
95
|
+
type: PropTypes.string
|
|
96
|
+
};
|