@dhis2/analytics 26.10.2 → 26.11.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.
@@ -24,7 +24,8 @@ const PeriodDimension = _ref => {
24
24
  selectedPeriods,
25
25
  rightFooter,
26
26
  excludedPeriodTypes,
27
- infoBoxMessage
27
+ infoBoxMessage,
28
+ height
28
29
  } = _ref;
29
30
  const {
30
31
  systemInfo
@@ -57,12 +58,14 @@ const PeriodDimension = _ref => {
57
58
  rightFooter: rightFooter,
58
59
  dataTest: 'period-dimension',
59
60
  excludedPeriodTypes: excludedPeriodTypes,
60
- periodsSettings: periodsSettings
61
+ periodsSettings: periodsSettings,
62
+ height: height
61
63
  });
62
64
  };
63
65
  PeriodDimension.propTypes = {
64
66
  onSelect: _propTypes.default.func.isRequired,
65
67
  excludedPeriodTypes: _propTypes.default.arrayOf(_propTypes.default.string),
68
+ height: _propTypes.default.string,
66
69
  infoBoxMessage: _propTypes.default.string,
67
70
  rightFooter: _propTypes.default.node,
68
71
  selectedPeriods: _propTypes.default.array
@@ -50,7 +50,8 @@ const PeriodTransfer = _ref2 => {
50
50
  rightFooter,
51
51
  excludedPeriodTypes,
52
52
  periodsSettings,
53
- infoBoxMessage
53
+ infoBoxMessage,
54
+ height = _dimensionSelectorHelper.TRANSFER_HEIGHT
54
55
  } = _ref2;
55
56
  const defaultRelativePeriodType = excludedPeriodTypes.includes(_index2.MONTHLY) ? (0, _relativePeriods.getRelativePeriodsOptionsById)(_index2.QUARTERLY) : (0, _relativePeriods.getRelativePeriodsOptionsById)(_index2.MONTHLY);
56
57
  const defaultFixedPeriodType = excludedPeriodTypes.includes(_index2.MONTHLY) ? (0, _fixedPeriods.getFixedPeriodsOptionsById)(_index2.QUARTERLY, periodsSettings) : (0, _fixedPeriods.getFixedPeriodsOptionsById)(_index2.MONTHLY, periodsSettings);
@@ -151,7 +152,7 @@ const PeriodTransfer = _ref2 => {
151
152
  selected: selectedItems.map(period => period.id),
152
153
  leftHeader: renderLeftHeader(),
153
154
  enableOrderChange: true,
154
- height: _dimensionSelectorHelper.TRANSFER_HEIGHT,
155
+ height: height,
155
156
  optionsWidth: _dimensionSelectorHelper.TRANSFER_OPTIONS_WIDTH,
156
157
  selectedWidth: _dimensionSelectorHelper.TRANSFER_SELECTED_WIDTH,
157
158
  selectedEmptyComponent: renderEmptySelection(),
@@ -196,6 +197,7 @@ PeriodTransfer.propTypes = {
196
197
  onSelect: _propTypes.default.func.isRequired,
197
198
  dataTest: _propTypes.default.string,
198
199
  excludedPeriodTypes: _propTypes.default.arrayOf(_propTypes.default.string),
200
+ height: _propTypes.default.string,
199
201
  infoBoxMessage: _propTypes.default.string,
200
202
  periodsSettings: _propTypes.default.shape({
201
203
  calendar: _propTypes.default.string,
@@ -0,0 +1,347 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`relativePeriods utils should correctly return relative periods details 1`] = `
4
+ Object {
5
+ "BIMONTHS_THIS_YEAR": Object {
6
+ "duration": 6,
7
+ "id": "BIMONTHS_THIS_YEAR",
8
+ "name": "Bi-months this year",
9
+ "offset": 5,
10
+ "type": "BIMONTHLY",
11
+ },
12
+ "LAST_10_YEARS": Object {
13
+ "duration": 10,
14
+ "id": "LAST_10_YEARS",
15
+ "name": "Last 10 years",
16
+ "offset": -1,
17
+ "type": "YEARLY",
18
+ },
19
+ "LAST_12_MONTHS": Object {
20
+ "duration": 12,
21
+ "id": "LAST_12_MONTHS",
22
+ "name": "Last 12 months",
23
+ "offset": -1,
24
+ "type": "MONTHLY",
25
+ },
26
+ "LAST_12_WEEKS": Object {
27
+ "duration": 12,
28
+ "id": "LAST_12_WEEKS",
29
+ "name": "Last 12 weeks",
30
+ "offset": -1,
31
+ "type": "WEEKLY",
32
+ },
33
+ "LAST_14_DAYS": Object {
34
+ "duration": 14,
35
+ "id": "LAST_14_DAYS",
36
+ "name": "Last 14 days",
37
+ "offset": -1,
38
+ "type": "DAILY",
39
+ },
40
+ "LAST_180_DAYS": Object {
41
+ "duration": 180,
42
+ "id": "LAST_180_DAYS",
43
+ "name": "Last 180 days",
44
+ "offset": -1,
45
+ "type": "DAILY",
46
+ },
47
+ "LAST_2_SIXMONTHS": Object {
48
+ "duration": 2,
49
+ "id": "LAST_2_SIXMONTHS",
50
+ "name": "Last 2 six-month",
51
+ "offset": -1,
52
+ "type": "SIXMONTHLY",
53
+ },
54
+ "LAST_30_DAYS": Object {
55
+ "duration": 30,
56
+ "id": "LAST_30_DAYS",
57
+ "name": "Last 30 days",
58
+ "offset": -1,
59
+ "type": "DAILY",
60
+ },
61
+ "LAST_3_DAYS": Object {
62
+ "duration": 3,
63
+ "id": "LAST_3_DAYS",
64
+ "name": "Last 3 days",
65
+ "offset": -1,
66
+ "type": "DAILY",
67
+ },
68
+ "LAST_3_MONTHS": Object {
69
+ "duration": 3,
70
+ "id": "LAST_3_MONTHS",
71
+ "name": "Last 3 months",
72
+ "offset": -1,
73
+ "type": "MONTHLY",
74
+ },
75
+ "LAST_4_BIWEEKS": Object {
76
+ "duration": 4,
77
+ "id": "LAST_4_BIWEEKS",
78
+ "name": "Last 4 bi-weeks",
79
+ "offset": -1,
80
+ "type": "BIWEEKLY",
81
+ },
82
+ "LAST_4_QUARTERS": Object {
83
+ "duration": 4,
84
+ "id": "LAST_4_QUARTERS",
85
+ "name": "Last 4 quarters",
86
+ "offset": -1,
87
+ "type": "QUARTERLY",
88
+ },
89
+ "LAST_4_WEEKS": Object {
90
+ "duration": 4,
91
+ "id": "LAST_4_WEEKS",
92
+ "name": "Last 4 weeks",
93
+ "offset": -1,
94
+ "type": "WEEKLY",
95
+ },
96
+ "LAST_52_WEEKS": Object {
97
+ "duration": 52,
98
+ "id": "LAST_52_WEEKS",
99
+ "name": "Last 52 weeks",
100
+ "offset": -1,
101
+ "type": "WEEKLY",
102
+ },
103
+ "LAST_5_FINANCIAL_YEARS": Object {
104
+ "duration": 5,
105
+ "id": "LAST_5_FINANCIAL_YEARS",
106
+ "name": "Last 5 financial years",
107
+ "offset": -1,
108
+ "type": "FINANCIAL",
109
+ },
110
+ "LAST_5_YEARS": Object {
111
+ "duration": 5,
112
+ "id": "LAST_5_YEARS",
113
+ "name": "Last 5 years",
114
+ "offset": -1,
115
+ "type": "YEARLY",
116
+ },
117
+ "LAST_60_DAYS": Object {
118
+ "duration": 60,
119
+ "id": "LAST_60_DAYS",
120
+ "name": "Last 60 days",
121
+ "offset": -1,
122
+ "type": "DAILY",
123
+ },
124
+ "LAST_6_BIMONTHS": Object {
125
+ "duration": 6,
126
+ "id": "LAST_6_BIMONTHS",
127
+ "name": "Last 6 bi-months",
128
+ "offset": -1,
129
+ "type": "BIMONTHLY",
130
+ },
131
+ "LAST_6_MONTHS": Object {
132
+ "duration": 6,
133
+ "id": "LAST_6_MONTHS",
134
+ "name": "Last 6 months",
135
+ "offset": -1,
136
+ "type": "MONTHLY",
137
+ },
138
+ "LAST_7_DAYS": Object {
139
+ "duration": 7,
140
+ "id": "LAST_7_DAYS",
141
+ "name": "Last 7 days",
142
+ "offset": -1,
143
+ "type": "DAILY",
144
+ },
145
+ "LAST_90_DAYS": Object {
146
+ "duration": 90,
147
+ "id": "LAST_90_DAYS",
148
+ "name": "Last 90 days",
149
+ "offset": -1,
150
+ "type": "DAILY",
151
+ },
152
+ "LAST_BIMONTH": Object {
153
+ "duration": 1,
154
+ "id": "LAST_BIMONTH",
155
+ "name": "Last bi-month",
156
+ "offset": -1,
157
+ "type": "BIMONTHLY",
158
+ },
159
+ "LAST_BIWEEK": Object {
160
+ "duration": 1,
161
+ "id": "LAST_BIWEEK",
162
+ "name": "Last bi-week",
163
+ "offset": -1,
164
+ "type": "BIWEEKLY",
165
+ },
166
+ "LAST_FINANCIAL_YEAR": Object {
167
+ "duration": 1,
168
+ "id": "LAST_FINANCIAL_YEAR",
169
+ "name": "Last financial year",
170
+ "offset": -1,
171
+ "type": "FINANCIAL",
172
+ },
173
+ "LAST_MONTH": Object {
174
+ "duration": 1,
175
+ "id": "LAST_MONTH",
176
+ "name": "Last month",
177
+ "offset": -1,
178
+ "type": "MONTHLY",
179
+ },
180
+ "LAST_QUARTER": Object {
181
+ "duration": 1,
182
+ "id": "LAST_QUARTER",
183
+ "name": "Last quarter",
184
+ "offset": -1,
185
+ "type": "QUARTERLY",
186
+ },
187
+ "LAST_SIX_MONTH": Object {
188
+ "duration": 1,
189
+ "id": "LAST_SIX_MONTH",
190
+ "name": "Last six-month",
191
+ "offset": -1,
192
+ "type": "SIXMONTHLY",
193
+ },
194
+ "LAST_WEEK": Object {
195
+ "duration": 1,
196
+ "id": "LAST_WEEK",
197
+ "name": "Last week",
198
+ "offset": -1,
199
+ "type": "WEEKLY",
200
+ },
201
+ "LAST_YEAR": Object {
202
+ "duration": 1,
203
+ "id": "LAST_YEAR",
204
+ "name": "Last year",
205
+ "offset": -1,
206
+ "type": "YEARLY",
207
+ },
208
+ "MONTHS_THIS_YEAR": Object {
209
+ "duration": 12,
210
+ "id": "MONTHS_THIS_YEAR",
211
+ "name": "Months this year",
212
+ "offset": 11,
213
+ "type": "MONTHLY",
214
+ },
215
+ "QUARTERS_THIS_YEAR": Object {
216
+ "duration": 4,
217
+ "id": "QUARTERS_THIS_YEAR",
218
+ "name": "Quarters this year",
219
+ "offset": 3,
220
+ "type": "QUARTERLY",
221
+ },
222
+ "THIS_BIMONTH": Object {
223
+ "duration": 1,
224
+ "id": "THIS_BIMONTH",
225
+ "name": "This bi-month",
226
+ "offset": 0,
227
+ "type": "BIMONTHLY",
228
+ },
229
+ "THIS_BIWEEK": Object {
230
+ "duration": 1,
231
+ "id": "THIS_BIWEEK",
232
+ "name": "This bi-week",
233
+ "offset": 0,
234
+ "type": "BIWEEKLY",
235
+ },
236
+ "THIS_FINANCIAL_YEAR": Object {
237
+ "duration": 1,
238
+ "id": "THIS_FINANCIAL_YEAR",
239
+ "name": "This financial year",
240
+ "offset": 0,
241
+ "type": "FINANCIAL",
242
+ },
243
+ "THIS_MONTH": Object {
244
+ "duration": 1,
245
+ "id": "THIS_MONTH",
246
+ "name": "This month",
247
+ "offset": 0,
248
+ "type": "MONTHLY",
249
+ },
250
+ "THIS_QUARTER": Object {
251
+ "duration": 1,
252
+ "id": "THIS_QUARTER",
253
+ "name": "This quarter",
254
+ "offset": 0,
255
+ "type": "QUARTERLY",
256
+ },
257
+ "THIS_SIX_MONTH": Object {
258
+ "duration": 1,
259
+ "id": "THIS_SIX_MONTH",
260
+ "name": "This six-month",
261
+ "offset": 0,
262
+ "type": "SIXMONTHLY",
263
+ },
264
+ "THIS_WEEK": Object {
265
+ "duration": 1,
266
+ "id": "THIS_WEEK",
267
+ "name": "This week",
268
+ "offset": 0,
269
+ "type": "WEEKLY",
270
+ },
271
+ "THIS_YEAR": Object {
272
+ "duration": 1,
273
+ "id": "THIS_YEAR",
274
+ "name": "This year",
275
+ "offset": 0,
276
+ "type": "YEARLY",
277
+ },
278
+ "TODAY": Object {
279
+ "duration": 1,
280
+ "id": "TODAY",
281
+ "name": "Today",
282
+ "offset": 0,
283
+ "type": "DAILY",
284
+ },
285
+ "WEEKS_THIS_YEAR": Object {
286
+ "duration": 52,
287
+ "id": "WEEKS_THIS_YEAR",
288
+ "name": "Weeks this year",
289
+ "offset": 51,
290
+ "type": "WEEKLY",
291
+ },
292
+ "YESTERDAY": Object {
293
+ "duration": 1,
294
+ "id": "YESTERDAY",
295
+ "name": "Yesterday",
296
+ "offset": -1,
297
+ "type": "DAILY",
298
+ },
299
+ }
300
+ `;
301
+
302
+ exports[`relativePeriods utils should correctly return relative periods names 1`] = `
303
+ Object {
304
+ "BIMONTHS_THIS_YEAR": "Bi-months this year",
305
+ "LAST_10_YEARS": "Last 10 years",
306
+ "LAST_12_MONTHS": "Last 12 months",
307
+ "LAST_12_WEEKS": "Last 12 weeks",
308
+ "LAST_14_DAYS": "Last 14 days",
309
+ "LAST_180_DAYS": "Last 180 days",
310
+ "LAST_2_SIXMONTHS": "Last 2 six-month",
311
+ "LAST_30_DAYS": "Last 30 days",
312
+ "LAST_3_DAYS": "Last 3 days",
313
+ "LAST_3_MONTHS": "Last 3 months",
314
+ "LAST_4_BIWEEKS": "Last 4 bi-weeks",
315
+ "LAST_4_QUARTERS": "Last 4 quarters",
316
+ "LAST_4_WEEKS": "Last 4 weeks",
317
+ "LAST_52_WEEKS": "Last 52 weeks",
318
+ "LAST_5_FINANCIAL_YEARS": "Last 5 financial years",
319
+ "LAST_5_YEARS": "Last 5 years",
320
+ "LAST_60_DAYS": "Last 60 days",
321
+ "LAST_6_BIMONTHS": "Last 6 bi-months",
322
+ "LAST_6_MONTHS": "Last 6 months",
323
+ "LAST_7_DAYS": "Last 7 days",
324
+ "LAST_90_DAYS": "Last 90 days",
325
+ "LAST_BIMONTH": "Last bi-month",
326
+ "LAST_BIWEEK": "Last bi-week",
327
+ "LAST_FINANCIAL_YEAR": "Last financial year",
328
+ "LAST_MONTH": "Last month",
329
+ "LAST_QUARTER": "Last quarter",
330
+ "LAST_SIX_MONTH": "Last six-month",
331
+ "LAST_WEEK": "Last week",
332
+ "LAST_YEAR": "Last year",
333
+ "MONTHS_THIS_YEAR": "Months this year",
334
+ "QUARTERS_THIS_YEAR": "Quarters this year",
335
+ "THIS_BIMONTH": "This bi-month",
336
+ "THIS_BIWEEK": "This bi-week",
337
+ "THIS_FINANCIAL_YEAR": "This financial year",
338
+ "THIS_MONTH": "This month",
339
+ "THIS_QUARTER": "This quarter",
340
+ "THIS_SIX_MONTH": "This six-month",
341
+ "THIS_WEEK": "This week",
342
+ "THIS_YEAR": "This year",
343
+ "TODAY": "Today",
344
+ "WEEKS_THIS_YEAR": "Weeks this year",
345
+ "YESTERDAY": "Yesterday",
346
+ }
347
+ `;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ var _relativePeriods = require("../utils/relativePeriods.js");
4
+ describe('relativePeriods utils', () => {
5
+ it('should correctly return relative periods details', () => {
6
+ const details = (0, _relativePeriods.getRelativePeriodsDetails)();
7
+ expect(details).toMatchSnapshot();
8
+ });
9
+ it('should correctly return relative periods names', () => {
10
+ const names = (0, _relativePeriods.getRelativePeriodsName)();
11
+ expect(names).toMatchSnapshot();
12
+ });
13
+ });
@@ -3,12 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.parsePeriodCode = exports.getYearOffsetFromNow = exports.getFixedPeriodsOptionsById = exports.getFixedPeriodsOptions = void 0;
6
+ exports.parsePeriodCode = exports.getYearOffsetFromNow = exports.getFixedPeriodsOptionsById = exports.getFixedPeriodsOptions = exports.PERIOD_TYPE_REGEX = void 0;
7
7
  var _multiCalendarDates = require("@dhis2/multi-calendar-dates");
8
8
  var _index = _interopRequireDefault(require("../../../locales/index.js"));
9
9
  var _index2 = require("./index.js");
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- const PERIOD_TYPE_REGEX = {
11
+ const PERIOD_TYPE_REGEX = exports.PERIOD_TYPE_REGEX = {
12
12
  [_index2.DAILY]: /^([0-9]{4})([0-9]{2})([0-9]{2})$/,
13
13
  // YYYYMMDD
14
14
  [_index2.WEEKLY]: /^([0-9]{4})()W([0-9]{1,2})$/,