@dhis2/analytics 24.10.0 → 25.0.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 (86) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/build/cjs/__demo__/CalculationModal.stories.js +448 -0
  3. package/build/cjs/api/analytics/AnalyticsRequest.js +12 -1
  4. package/build/cjs/api/dimensions.js +1 -1
  5. package/build/cjs/api/expression.js +67 -0
  6. package/build/cjs/assets/DimensionItemIcons/CalculationIcon.js +25 -0
  7. package/build/cjs/assets/FormulaIcon.js +40 -0
  8. package/build/cjs/components/DataDimension/Calculation/CalculationModal.js +447 -0
  9. package/build/cjs/components/DataDimension/Calculation/DataElementOption.js +77 -0
  10. package/build/cjs/components/DataDimension/Calculation/DataElementSelector.js +306 -0
  11. package/build/cjs/components/DataDimension/Calculation/DndContext.js +213 -0
  12. package/build/cjs/components/DataDimension/Calculation/DragHandleIcon.js +23 -0
  13. package/build/cjs/components/DataDimension/Calculation/DraggingItem.js +58 -0
  14. package/build/cjs/components/DataDimension/Calculation/DropZone.js +58 -0
  15. package/build/cjs/components/DataDimension/Calculation/FormulaField.js +121 -0
  16. package/build/cjs/components/DataDimension/Calculation/FormulaItem.js +232 -0
  17. package/build/cjs/components/DataDimension/Calculation/MathOperatorSelector.js +57 -0
  18. package/build/cjs/components/DataDimension/Calculation/Operator.js +81 -0
  19. package/build/cjs/components/DataDimension/Calculation/styles/CalculationModal.style.js +13 -0
  20. package/build/cjs/components/DataDimension/Calculation/styles/DataElementOption.style.js +13 -0
  21. package/build/cjs/components/DataDimension/Calculation/styles/DataElementSelector.style.js +13 -0
  22. package/build/cjs/components/DataDimension/Calculation/styles/DraggingItem.style.js +13 -0
  23. package/build/cjs/components/DataDimension/Calculation/styles/DropZone.style.js +13 -0
  24. package/build/cjs/components/DataDimension/Calculation/styles/FormulaField.style.js +13 -0
  25. package/build/cjs/components/DataDimension/Calculation/styles/FormulaItem.style.js +13 -0
  26. package/build/cjs/components/DataDimension/Calculation/styles/MathOperatorSelector.style.js +13 -0
  27. package/build/cjs/components/DataDimension/Calculation/styles/Operator.style.js +13 -0
  28. package/build/cjs/components/DataDimension/DataDimension.js +22 -6
  29. package/build/cjs/components/DataDimension/DataTypeSelector.js +5 -3
  30. package/build/cjs/components/DataDimension/ItemSelector.js +111 -73
  31. package/build/cjs/components/TransferOption.js +13 -4
  32. package/build/cjs/components/styles/DimensionSelector.style.js +2 -2
  33. package/build/cjs/components/styles/TransferOption.style.js +2 -2
  34. package/build/cjs/index.js +6 -0
  35. package/build/cjs/locales/en/translations.json +32 -7
  36. package/build/cjs/modules/__tests__/expressions.spec.js +139 -0
  37. package/build/cjs/modules/__tests__/hash.spec.js +92 -0
  38. package/build/cjs/modules/__tests__/parseExpression.spec.js +46 -0
  39. package/build/cjs/modules/dataTypes.js +8 -1
  40. package/build/cjs/modules/dimensionListItem.js +82 -0
  41. package/build/cjs/modules/expressions.js +164 -0
  42. package/build/cjs/modules/hash.js +28 -0
  43. package/build/cjs/visualizations/config/generators/dhis/singleValue.js +2 -2
  44. package/build/es/__demo__/CalculationModal.stories.js +440 -0
  45. package/build/es/api/analytics/AnalyticsRequest.js +11 -1
  46. package/build/es/api/dimensions.js +1 -1
  47. package/build/es/api/expression.js +57 -0
  48. package/build/es/assets/DimensionItemIcons/CalculationIcon.js +13 -0
  49. package/build/es/assets/FormulaIcon.js +30 -0
  50. package/build/es/components/DataDimension/Calculation/CalculationModal.js +418 -0
  51. package/build/es/components/DataDimension/Calculation/DataElementOption.js +60 -0
  52. package/build/es/components/DataDimension/Calculation/DataElementSelector.js +280 -0
  53. package/build/es/components/DataDimension/Calculation/DndContext.js +194 -0
  54. package/build/es/components/DataDimension/Calculation/DragHandleIcon.js +11 -0
  55. package/build/es/components/DataDimension/Calculation/DraggingItem.js +40 -0
  56. package/build/es/components/DataDimension/Calculation/DropZone.js +43 -0
  57. package/build/es/components/DataDimension/Calculation/FormulaField.js +98 -0
  58. package/build/es/components/DataDimension/Calculation/FormulaItem.js +207 -0
  59. package/build/es/components/DataDimension/Calculation/MathOperatorSelector.js +41 -0
  60. package/build/es/components/DataDimension/Calculation/Operator.js +64 -0
  61. package/build/es/components/DataDimension/Calculation/styles/CalculationModal.style.js +4 -0
  62. package/build/es/components/DataDimension/Calculation/styles/DataElementOption.style.js +4 -0
  63. package/build/es/components/DataDimension/Calculation/styles/DataElementSelector.style.js +4 -0
  64. package/build/es/components/DataDimension/Calculation/styles/DraggingItem.style.js +4 -0
  65. package/build/es/components/DataDimension/Calculation/styles/DropZone.style.js +4 -0
  66. package/build/es/components/DataDimension/Calculation/styles/FormulaField.style.js +4 -0
  67. package/build/es/components/DataDimension/Calculation/styles/FormulaItem.style.js +4 -0
  68. package/build/es/components/DataDimension/Calculation/styles/MathOperatorSelector.style.js +4 -0
  69. package/build/es/components/DataDimension/Calculation/styles/Operator.style.js +4 -0
  70. package/build/es/components/DataDimension/DataDimension.js +21 -6
  71. package/build/es/components/DataDimension/DataTypeSelector.js +6 -4
  72. package/build/es/components/DataDimension/ItemSelector.js +111 -73
  73. package/build/es/components/TransferOption.js +14 -5
  74. package/build/es/components/styles/DimensionSelector.style.js +2 -2
  75. package/build/es/components/styles/TransferOption.style.js +2 -2
  76. package/build/es/index.js +1 -1
  77. package/build/es/locales/en/translations.json +32 -7
  78. package/build/es/modules/__tests__/expressions.spec.js +136 -0
  79. package/build/es/modules/__tests__/hash.spec.js +88 -0
  80. package/build/es/modules/__tests__/parseExpression.spec.js +43 -0
  81. package/build/es/modules/dataTypes.js +6 -0
  82. package/build/es/modules/dimensionListItem.js +61 -0
  83. package/build/es/modules/expressions.js +131 -0
  84. package/build/es/modules/hash.js +12 -0
  85. package/build/es/visualizations/config/generators/dhis/singleValue.js +2 -2
  86. package/package.json +6 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ # [25.0.0](https://github.com/dhis2/analytics/compare/v24.10.1...v25.0.0) (2023-04-24)
2
+
3
+
4
+ ### Features
5
+
6
+ * custom calculations (DHIS2-13871) ([#1370](https://github.com/dhis2/analytics/issues/1370)) ([d174e3e](https://github.com/dhis2/analytics/commit/d174e3e8a1dd1ea756cf42eaf7748b2135151e57))
7
+
8
+
9
+ ### BREAKING CHANGES
10
+
11
+ * requires metadata to be provided for the new EDI dimension type
12
+
13
+ ## [24.10.1](https://github.com/dhis2/analytics/compare/v24.10.0...v24.10.1) (2023-04-24)
14
+
15
+
16
+ ### Bug Fixes
17
+
18
+ * sv size when downloading is a small square (DHIS2-15178) ([245d799](https://github.com/dhis2/analytics/commit/245d799d9513e0407e4a6b6ba24c3da15754618d))
19
+
1
20
  # [24.10.0](https://github.com/dhis2/analytics/compare/v24.9.3...v24.10.0) (2023-04-19)
2
21
 
3
22
 
@@ -0,0 +1,448 @@
1
+ "use strict";
2
+
3
+ var _appRuntime = require("@dhis2/app-runtime");
4
+
5
+ var _react = require("@storybook/react");
6
+
7
+ var _react2 = _interopRequireDefault(require("react"));
8
+
9
+ var _CalculationModal = _interopRequireDefault(require("../components/DataDimension/Calculation/CalculationModal.js"));
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
13
+ const DATA_ELEMENTS = {
14
+ pager: {
15
+ page: 1,
16
+ total: 622,
17
+ pageSize: 50,
18
+ nextPage: 'http://localhost:8080/api/39/dataElements?page=2&filter=domainType%3Aeq%3AAGGREGATE&paging=true&fields=dimensionItem%7Erename%28id%29%2CdisplayName%7Erename%28name%29%2CdimensionItemType&order=displayName%3Aasc',
19
+ pageCount: 13
20
+ },
21
+ dataElements: [{
22
+ dimensionItemType: 'DATA_ELEMENT',
23
+ id: 'fbfJHSPpUQD',
24
+ name: 'ANC 1st visit'
25
+ }, {
26
+ dimensionItemType: 'DATA_ELEMENT',
27
+ id: 'cYeuwXTCPkU',
28
+ name: 'ANC 2nd visit'
29
+ }, {
30
+ dimensionItemType: 'DATA_ELEMENT',
31
+ id: 'Jtf34kNZhzP',
32
+ name: 'ANC 3rd visit'
33
+ }, {
34
+ dimensionItemType: 'DATA_ELEMENT',
35
+ id: 'hfdmMSPBgLG',
36
+ name: 'ANC 4th or more visits'
37
+ }, {
38
+ dimensionItemType: 'DATA_ELEMENT',
39
+ id: 'FHD3wiSM7Sn',
40
+ name: 'ARI treated with antibiotics (pneumonia) follow-up'
41
+ }, {
42
+ dimensionItemType: 'DATA_ELEMENT',
43
+ id: 'oLfWYAJhZb2',
44
+ name: 'ARI treated without antibiotics (cough) referrals'
45
+ }, {
46
+ dimensionItemType: 'DATA_ELEMENT',
47
+ id: 'GMd99K8gVut',
48
+ name: 'ART No clients who stopped TRT due to TRT failure'
49
+ }, {
50
+ dimensionItemType: 'DATA_ELEMENT',
51
+ id: 'wfKKFhBn0Q0',
52
+ name: 'ART No clients who stopped TRT due to adverse clinical status/event'
53
+ }, {
54
+ dimensionItemType: 'DATA_ELEMENT',
55
+ id: 'aIJZ2d2QgVV',
56
+ name: 'ART defaulters'
57
+ }, {
58
+ dimensionItemType: 'DATA_ELEMENT',
59
+ id: 'BOSZApCrBni',
60
+ name: 'ART enrollment stage 1'
61
+ }, {
62
+ dimensionItemType: 'DATA_ELEMENT',
63
+ id: 'dGdeotKpRed',
64
+ name: 'ART enrollment stage 2'
65
+ }, {
66
+ dimensionItemType: 'DATA_ELEMENT',
67
+ id: 'LVaUdM3CERi',
68
+ name: 'ART entry point: No old patients'
69
+ }, {
70
+ dimensionItemType: 'DATA_ELEMENT',
71
+ id: 'M62VHgYT2n0',
72
+ name: 'Acute Flaccid Paralysis (AFP) referrals'
73
+ }, {
74
+ dimensionItemType: 'DATA_ELEMENT',
75
+ id: 'uF1DLnZNlWe',
76
+ name: 'Additional notes related to facility'
77
+ }, {
78
+ dimensionItemType: 'DATA_ELEMENT',
79
+ id: 'jmWyJFtE7Af',
80
+ name: 'Anaemia follow-up'
81
+ }, {
82
+ dimensionItemType: 'DATA_ELEMENT',
83
+ id: 'HLPuaFB7Frw',
84
+ name: 'Anaemia new'
85
+ }]
86
+ };
87
+ const DATA_ELEMENT_OPERANDS = {
88
+ pager: {
89
+ page: 1,
90
+ pageCount: 43,
91
+ total: 2122,
92
+ pageSize: 50,
93
+ nextPage: 'https://debug.dhis2.org/dev/api/dataElementOperands.json?page=2'
94
+ },
95
+ dataElementOperands: [{
96
+ dimensionItemType: 'DATA_ELEMENT_OPERAND',
97
+ id: 'fbfJHSPpUQD.pq2XI5kz2BY',
98
+ name: 'ANC 1st visit Fixed'
99
+ }, {
100
+ dimensionItemType: 'DATA_ELEMENT_OPERAND',
101
+ id: 'fbfJHSPpUQD.PT59n8BQbqM',
102
+ name: 'ANC 1st visit Outreach'
103
+ }]
104
+ };
105
+ const DATA_ELEMENT_GROUPS = {
106
+ dataElementGroups: [{
107
+ id: 'qfxEYY9xAl6',
108
+ name: 'ANC'
109
+ }, {
110
+ id: 'yhg8oYU9ekY',
111
+ name: 'ARI Treated Without Antibiotics (Cough)'
112
+ }, {
113
+ id: 'M2cth8EmrlT',
114
+ name: 'ARI treated with antibiotics (Pneumonia)'
115
+ }, {
116
+ id: 'k1M0nuodfhN',
117
+ name: 'ART'
118
+ }, {
119
+ id: 'bdiyMm9qZl5',
120
+ name: 'ART enrollment'
121
+ }, {
122
+ id: 's8FiXqB2DhB',
123
+ name: 'ART entry points'
124
+ }, {
125
+ id: 'TcxHxMlYzpv',
126
+ name: 'ART pediatric 1st line'
127
+ }, {
128
+ id: 'vxIWSNeEcf7',
129
+ name: 'ART staging'
130
+ }, {
131
+ id: 'zz1lNBgRKWU',
132
+ name: 'ART treatment'
133
+ }, {
134
+ id: 'oDkJh5Ddh7d',
135
+ name: 'Acute Flaccid Paralysis (AFP) '
136
+ }, {
137
+ id: 'GBHN1a1Jddh',
138
+ name: 'All Others'
139
+ }, {
140
+ id: 'KmwPVkjp7yl',
141
+ name: 'Anaemia'
142
+ }, {
143
+ id: 'oGktdmYkRNo',
144
+ name: 'Burns'
145
+ }, {
146
+ id: 'KUSvwZQsMSN',
147
+ name: 'Cholera'
148
+ }, {
149
+ id: 'Euvh58hLl61',
150
+ name: 'Clinical Malnutrition'
151
+ }, {
152
+ id: 'Svac1cNQhRS',
153
+ name: 'Commodities'
154
+ }, {
155
+ id: 'KJKWrWBcJdf',
156
+ name: 'Commodities Child Health'
157
+ }, {
158
+ id: 'idD1wcvBISQ',
159
+ name: 'Commodities Maternal Health'
160
+ }, {
161
+ id: 'rioWDAi1S7z',
162
+ name: 'Commodities Newborn Health'
163
+ }, {
164
+ id: 'IyIa0h8CbCZ',
165
+ name: 'Commodities Reproductive Health'
166
+ }, {
167
+ id: 'PfJGQacYpjn',
168
+ name: 'Deaths'
169
+ }, {
170
+ id: 't5W0AAqvK5b',
171
+ name: 'Delivery'
172
+ }, {
173
+ id: 'mcjC3qZgIkO',
174
+ name: 'Diarrhoea With Blood (Dysentery)'
175
+ }, {
176
+ id: 'RSFc8ADyKTw',
177
+ name: 'Diarrhoea With Severe Dehydration'
178
+ }, {
179
+ id: 'kE8lP5t0b5R',
180
+ name: 'Diarrhoea Without Severe Dehydration'
181
+ }, {
182
+ id: 'qiF051Ue9Ei',
183
+ name: 'Emergency Response'
184
+ }, {
185
+ id: 'GbSz3TobZcc',
186
+ name: 'Expenditures'
187
+ }, {
188
+ id: 'lLKpwhjd1dM',
189
+ name: 'Eye Infection'
190
+ }, {
191
+ id: 'Sp1jJqzsiOi',
192
+ name: 'Facility infrastructure'
193
+ }, {
194
+ id: 'g50BzGAsrvu',
195
+ name: 'Follow-up'
196
+ }, {
197
+ id: 'URmi41e0SFH',
198
+ name: 'HIV Care'
199
+ }, {
200
+ id: 'ID4BbhF7Eli',
201
+ name: 'HIV Peadriatics'
202
+ }, {
203
+ id: 'HKU7L73im5r',
204
+ name: 'HIV/AIDS'
205
+ }, {
206
+ id: 'jWgEsdH87Jk',
207
+ name: 'Hypertension'
208
+ }, {
209
+ id: 'nb3rBNvVHtp',
210
+ name: 'ICS Children'
211
+ }, {
212
+ id: 'dMyLpSQn6hu',
213
+ name: 'ICS mother'
214
+ }, {
215
+ id: 'b3gDdvmrSFc',
216
+ name: 'IDSR'
217
+ }, {
218
+ id: 'h9cuJOkOwY2',
219
+ name: 'Immunization'
220
+ }, {
221
+ id: 'OP4dLqk0JTH',
222
+ name: 'Inpatient morbidity/mortality aggregates'
223
+ }, {
224
+ id: 'SriP0jBXMr6',
225
+ name: 'Lassa Fever'
226
+ }, {
227
+ id: 'U0uJG4kydwE',
228
+ name: 'Leprosy'
229
+ }, {
230
+ id: 'eeQCyjnMyGY',
231
+ name: 'Low birth'
232
+ }, {
233
+ id: 'LEet4tb49IP',
234
+ name: 'MNCH Aggregates'
235
+ }, {
236
+ id: 'TzwKbcw1nUK',
237
+ name: 'Malaria'
238
+ }, {
239
+ id: 'qk2KOBMX4Mf',
240
+ name: 'Measles'
241
+ }, {
242
+ id: 'lnLbEej0gwe',
243
+ name: 'Meningitis / Severe Bacterial Infection'
244
+ }, {
245
+ id: 'SLsJy3zqUbD',
246
+ name: 'Morbidity'
247
+ }, {
248
+ id: 'QAc5FhbeFwl',
249
+ name: 'Mortality'
250
+ }, {
251
+ id: 'rPGfUFYbcfJ',
252
+ name: 'Mortality < 5 years'
253
+ }, {
254
+ id: 'KU0wDurtWDM',
255
+ name: 'Mortality Narrative'
256
+ }, {
257
+ id: 'UAEhIWpoQFN',
258
+ name: 'Neonatal Tetanus'
259
+ }, {
260
+ id: 'weRMUzBs8T7',
261
+ name: 'New cases'
262
+ }, {
263
+ id: 'XGSHYf5uOlJ',
264
+ name: 'New on ART'
265
+ }, {
266
+ id: 'u1ilfnoYafG',
267
+ name: 'Nutrition'
268
+ }, {
269
+ id: 'HDdnX6XqxIn',
270
+ name: 'Onchocerciasis'
271
+ }, {
272
+ id: 'JZ3usxLEcc9',
273
+ name: 'Otitis Media'
274
+ }, {
275
+ id: 'WS3MniopkOQ',
276
+ name: 'PMTCT'
277
+ }, {
278
+ id: 'e5NGCRQR8Yo',
279
+ name: 'PMTCT ANC'
280
+ }, {
281
+ id: 'bXpe2ByvlFR',
282
+ name: 'PMTCT Maternity/Delivery'
283
+ }, {
284
+ id: 'sGLusXgmaOT',
285
+ name: 'PMTCT Postnatal'
286
+ }, {
287
+ id: 'sP7jTt3YGBb',
288
+ name: 'Population Estimates'
289
+ }, {
290
+ id: 'ubJrVb4v5xy',
291
+ name: 'Postnatal'
292
+ }, {
293
+ id: 'qkrZMU4Y2h5',
294
+ name: 'Pregnancy complications and deaths'
295
+ }, {
296
+ id: 'ZPtRFVLY40u',
297
+ name: 'Pregnancy-related (PHUF5)'
298
+ }, {
299
+ id: 'AiytigJkHP6',
300
+ name: 'Prev month on ART'
301
+ }, {
302
+ id: 'UWaMbg9h7vF',
303
+ name: 'Referrals'
304
+ }, {
305
+ id: 'OJxi4vkcTBS',
306
+ name: 'Reproductive health'
307
+ }, {
308
+ id: 'xNrDrDbJgnm',
309
+ name: 'STI - Genital Discharge'
310
+ }, {
311
+ id: 'UmyRWILcoed',
312
+ name: 'STI - Genital Ulcer'
313
+ }, {
314
+ id: 'LqG1FnAUhyb',
315
+ name: 'Schistosomiasis'
316
+ }, {
317
+ id: 'rwG73cCi66Z',
318
+ name: 'Shift from ART reg.'
319
+ }, {
320
+ id: 'rgTZ4mKjZza',
321
+ name: 'Shift to ART reg.'
322
+ }, {
323
+ id: 'VCoSeRRVS1n',
324
+ name: 'Skin Infection'
325
+ }, {
326
+ id: 'rVEe5QNBgDX',
327
+ name: 'Staffing'
328
+ }, {
329
+ id: 'pxWhf42tCIs',
330
+ name: 'Stock PHU'
331
+ }, {
332
+ id: 'OnAQ2lsilN9',
333
+ name: 'TB'
334
+ }, {
335
+ id: 'LgtuBcNaMB3',
336
+ name: 'Tetanus'
337
+ }, {
338
+ id: 'yHtsPZqpAxm',
339
+ name: 'Tuberculosis'
340
+ }, {
341
+ id: 'dUK38PhdUdV',
342
+ name: 'Typhoid Fever'
343
+ }, {
344
+ id: 'U9wcARyKSzx',
345
+ name: 'VCCT'
346
+ }, {
347
+ id: 'LzDaTmQYWcj',
348
+ name: 'Worm Infestation'
349
+ }, {
350
+ id: 'IUZ0GidX0jh',
351
+ name: 'Wounds/Trauma'
352
+ }, {
353
+ id: 'zmWJAEjfv59',
354
+ name: 'Yaws'
355
+ }, {
356
+ id: 'HAraPb0v7ex',
357
+ name: 'Yellow Fever'
358
+ }]
359
+ };
360
+ const calculation = {
361
+ id: 'calculationid',
362
+ name: 'My calculation',
363
+ expression: '#{fbfJHSPpUQD}/10*#{hfdmMSPBgLG}'
364
+ };
365
+ const calculationWithOperand = {
366
+ id: 'calcid2',
367
+ name: 'Calculation with operand',
368
+ expression: '#{cYeuwXTCPkU}*10-#{fbfJHSPpUQD.pq2XI5kz2BY}'
369
+ };
370
+ (0, _react.storiesOf)('CalculationModal', module).add('Default', () => {
371
+ return /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
372
+ data: {
373
+ dataElements: DATA_ELEMENTS,
374
+ dataElementGroups: DATA_ELEMENT_GROUPS,
375
+ dataElementOperands: DATA_ELEMENT_OPERANDS
376
+ }
377
+ }, /*#__PURE__*/_react2.default.createElement(_CalculationModal.default, {
378
+ displayNameProp: "name",
379
+ onClose: Function.prototype,
380
+ onDelete: Function.prototype,
381
+ onSave: Function.prototype
382
+ }));
383
+ }).add('With calculation', () => {
384
+ return /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
385
+ data: {
386
+ dataElements: DATA_ELEMENTS,
387
+ dataElementGroups: DATA_ELEMENT_GROUPS,
388
+ dataElementOperands: DATA_ELEMENT_OPERANDS
389
+ }
390
+ }, /*#__PURE__*/_react2.default.createElement(_CalculationModal.default, {
391
+ calculation: calculation,
392
+ displayNameProp: "name",
393
+ onClose: Function.prototype,
394
+ onDelete: Function.prototype,
395
+ onSave: Function.prototype
396
+ }));
397
+ }).add('With calculation containing operand', () => {
398
+ return /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
399
+ data: {
400
+ dataElements: DATA_ELEMENTS,
401
+ dataElementGroups: DATA_ELEMENT_GROUPS,
402
+ dataElementOperands: DATA_ELEMENT_OPERANDS
403
+ }
404
+ }, /*#__PURE__*/_react2.default.createElement(_CalculationModal.default, {
405
+ calculation: calculationWithOperand,
406
+ displayNameProp: "name",
407
+ onClose: Function.prototype,
408
+ onDelete: Function.prototype,
409
+ onSave: Function.prototype
410
+ }));
411
+ }).add('No available data', () => {
412
+ return /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
413
+ data: {
414
+ dataElements: {
415
+ pager: {
416
+ page: 1,
417
+ total: 0,
418
+ pageSize: 50,
419
+ pageCount: 1
420
+ },
421
+ dataElements: []
422
+ },
423
+ dataElementGroups: {
424
+ pager: {
425
+ page: 1,
426
+ total: 0,
427
+ pageSize: 50,
428
+ pageCount: 1
429
+ },
430
+ dataElementGroups: []
431
+ },
432
+ dataElementOperands: {
433
+ pager: {
434
+ page: 1,
435
+ total: 0,
436
+ pageSize: 50,
437
+ pageCount: 1
438
+ },
439
+ dataElementOperands: []
440
+ }
441
+ }
442
+ }, /*#__PURE__*/_react2.default.createElement(_CalculationModal.default, {
443
+ displayNameProp: "name",
444
+ onClose: Function.prototype,
445
+ onDelete: Function.prototype,
446
+ onSave: Function.prototype
447
+ }));
448
+ });
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
 
8
+ var _hash = require("../../modules/hash.js");
9
+
8
10
  var _predefinedDimensions = require("../../modules/predefinedDimensions.js");
9
11
 
10
12
  var _AnalyticsRequestBase = _interopRequireDefault(require("./AnalyticsRequestBase.js"));
@@ -111,7 +113,16 @@ class AnalyticsRequest extends (0, _AnalyticsRequestDimensionsMixin.default)((0,
111
113
  request = request.addFilter(filterString, (_f$items2 = f.items) === null || _f$items2 === void 0 ? void 0 : _f$items2.map(item => item.id));
112
114
  }
113
115
  }
114
- });
116
+ }); // add cache param for expression dimension items
117
+
118
+ const expressionHash = (0, _hash.getExpressionHashFromVisualization)(visualization);
119
+
120
+ if (expressionHash) {
121
+ request.withParameters({
122
+ edi_cache: expressionHash
123
+ });
124
+ }
125
+
115
126
  return request;
116
127
  }
117
128
 
@@ -77,7 +77,7 @@ const dataItemsQuery = {
77
77
  }
78
78
 
79
79
  return (0, _objectClean.default)({
80
- fields: "id,".concat(nameProp, "~rename(name),dimensionItemType"),
80
+ fields: "id,".concat(nameProp, "~rename(name),dimensionItemType,expression"),
81
81
  order: "".concat(nameProp, ":asc"),
82
82
  filter: filters,
83
83
  paging: true,
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.validateExpressionMutation = exports.updateCalculationMutation = exports.deleteCalculationMutation = exports.createCalculationMutation = void 0;
7
+ const validateExpressionMutation = {
8
+ type: 'create',
9
+ resource: 'indicators/expression/description',
10
+ data: _ref => {
11
+ let {
12
+ expression
13
+ } = _ref;
14
+ return expression;
15
+ }
16
+ };
17
+ exports.validateExpressionMutation = validateExpressionMutation;
18
+ const createCalculationMutation = {
19
+ type: 'create',
20
+ resource: 'expressionDimensionItems',
21
+ data: _ref2 => {
22
+ let {
23
+ name,
24
+ expression
25
+ } = _ref2;
26
+ return {
27
+ name,
28
+ shortName: name,
29
+ expression
30
+ };
31
+ }
32
+ };
33
+ exports.createCalculationMutation = createCalculationMutation;
34
+ const updateCalculationMutation = {
35
+ type: 'update',
36
+ resource: 'expressionDimensionItems',
37
+ partial: true,
38
+ id: _ref3 => {
39
+ let {
40
+ id
41
+ } = _ref3;
42
+ return id;
43
+ },
44
+ data: _ref4 => {
45
+ let {
46
+ name,
47
+ expression
48
+ } = _ref4;
49
+ return {
50
+ name,
51
+ shortName: name,
52
+ expression
53
+ };
54
+ }
55
+ };
56
+ exports.updateCalculationMutation = updateCalculationMutation;
57
+ const deleteCalculationMutation = {
58
+ type: 'delete',
59
+ resource: 'expressionDimensionItems',
60
+ id: _ref5 => {
61
+ let {
62
+ id
63
+ } = _ref5;
64
+ return id;
65
+ }
66
+ };
67
+ exports.deleteCalculationMutation = deleteCalculationMutation;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var _default = /*#__PURE__*/_react.default.createElement("svg", {
13
+ height: "16",
14
+ viewBox: "0 0 16 16",
15
+ width: "16",
16
+ fill: "none",
17
+ xmlns: "http://www.w3.org/2000/svg"
18
+ }, /*#__PURE__*/_react.default.createElement("path", {
19
+ fillRule: "evenodd",
20
+ clipRule: "evenodd",
21
+ d: "M7 4H5V2H4V4H2V5H4V7H5V5H7V4ZM7 9.5H2V10.5H7V9.5ZM2 12H7V13H2V12ZM14 4H9V5H14V4ZM14 9.205L12.205 11L14 12.795L13.295 13.5L11.5 11.705L9.705 13.5L9 12.795L10.795 11L9 9.205L9.705 8.5L11.5 10.295L13.295 8.5L14 9.205Z",
22
+ fill: "#404B5A"
23
+ }));
24
+
25
+ exports.default = _default;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ const FormulaIcon = () => {
13
+ return /*#__PURE__*/_react.default.createElement("svg", {
14
+ width: "32",
15
+ height: "32",
16
+ viewBox: "0 0 32 32",
17
+ fill: "none",
18
+ xmlns: "http://www.w3.org/2000/svg"
19
+ }, /*#__PURE__*/_react.default.createElement("g", {
20
+ clipPath: "url(#clip0_927_2130)"
21
+ }, /*#__PURE__*/_react.default.createElement("rect", {
22
+ width: "32",
23
+ height: "32",
24
+ fill: "white"
25
+ }), /*#__PURE__*/_react.default.createElement("path", {
26
+ fillRule: "evenodd",
27
+ clipRule: "evenodd",
28
+ d: "M14 8H10V4H8V8H4V10H8V14H10V10H14V8ZM14 19H4V21H14V19ZM4 24H14V26H4V24ZM28 8H18V10H28V8ZM28 18.41L24.41 22L28 25.59L26.59 27L23 23.41L19.41 27L18 25.59L21.59 22L18 18.41L19.41 17L23 20.59L26.59 17L28 18.41Z",
29
+ fill: "#A0ADBA"
30
+ })), /*#__PURE__*/_react.default.createElement("defs", null, /*#__PURE__*/_react.default.createElement("clipPath", {
31
+ id: "clip0_927_2130"
32
+ }, /*#__PURE__*/_react.default.createElement("rect", {
33
+ width: "32",
34
+ height: "32",
35
+ fill: "white"
36
+ }))));
37
+ };
38
+
39
+ var _default = FormulaIcon;
40
+ exports.default = _default;