@dhis2/analytics 29.2.1 → 29.3.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/build/cjs/components/PeriodDimension/FixedPeriodFilter.js +5 -10
- package/build/cjs/components/PeriodDimension/FixedPeriodSelect.js +3 -1
- package/build/cjs/components/PeriodDimension/PeriodDimension.js +15 -5
- package/build/cjs/components/PeriodDimension/PeriodTransfer.js +110 -14
- package/build/cjs/components/PeriodDimension/RelativePeriodFilter.js +4 -6
- package/build/cjs/components/PeriodDimension/__tests__/PeriodDimension.spec.js +19 -6
- package/build/cjs/components/PeriodDimension/__tests__/fixedPeriods.spec.js +1 -1
- package/build/cjs/components/PeriodDimension/__tests__/utils.spec.js +1 -1
- package/build/cjs/components/PeriodDimension/useDataOutputPeriodTypes.js +153 -0
- package/build/cjs/components/PeriodDimension/utils/enabledPeriodTypes.js +179 -0
- package/build/cjs/components/PeriodDimension/utils/fixedPeriods.js +24 -42
- package/build/cjs/components/PeriodDimension/utils/index.js +7 -4
- package/build/cjs/index.js +8 -0
- package/build/cjs/locales/en/translations.json +8 -3
- package/build/cjs/visualizations/util/getFilterText.js +1 -1
- package/build/es/components/PeriodDimension/FixedPeriodFilter.js +5 -10
- package/build/es/components/PeriodDimension/FixedPeriodSelect.js +4 -2
- package/build/es/components/PeriodDimension/PeriodDimension.js +15 -5
- package/build/es/components/PeriodDimension/PeriodTransfer.js +115 -19
- package/build/es/components/PeriodDimension/RelativePeriodFilter.js +4 -6
- package/build/es/components/PeriodDimension/__tests__/PeriodDimension.spec.js +19 -6
- package/build/es/components/PeriodDimension/__tests__/fixedPeriods.spec.js +1 -1
- package/build/es/components/PeriodDimension/__tests__/utils.spec.js +1 -1
- package/build/es/components/PeriodDimension/useDataOutputPeriodTypes.js +147 -0
- package/build/es/components/PeriodDimension/utils/enabledPeriodTypes.js +168 -0
- package/build/es/components/PeriodDimension/utils/fixedPeriods.js +25 -43
- package/build/es/components/PeriodDimension/utils/index.js +6 -3
- package/build/es/index.js +1 -0
- package/build/es/locales/en/translations.json +8 -3
- package/build/es/visualizations/util/getFilterText.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { generateFixedPeriods, getNowInCalendar } from '@dhis2/multi-calendar-dates';
|
|
2
2
|
import i18n from '../../../locales/index.js';
|
|
3
|
-
import { DAILY, WEEKLY, WEEKLYWED, WEEKLYTHU, WEEKLYSAT, WEEKLYSUN, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SIXMONTHLY, SIXMONTHLYAPR, YEARLY,
|
|
3
|
+
import { DAILY, WEEKLY, WEEKLYWED, WEEKLYTHU, WEEKLYSAT, WEEKLYSUN, BIWEEKLY, MONTHLY, BIMONTHLY, QUARTERLY, SIXMONTHLY, SIXMONTHLYAPR, YEARLY, FYFEB, FYAPR, FYJUL, FYAUG, FYSEP, FYOCT, FYNOV } from './index.js';
|
|
4
4
|
export const PERIOD_TYPE_REGEX = {
|
|
5
5
|
[DAILY]: /^([0-9]{4})([0-9]{2})([0-9]{2})$/,
|
|
6
6
|
// YYYYMMDD
|
|
@@ -157,40 +157,10 @@ const getYearlyPeriodType = (fnFilter, periodSettings) => {
|
|
|
157
157
|
});
|
|
158
158
|
};
|
|
159
159
|
};
|
|
160
|
-
const
|
|
160
|
+
const getFinancialPeriodType = (periodType, fnFilter, periodSettings) => {
|
|
161
161
|
return config => {
|
|
162
162
|
return getPeriods({
|
|
163
|
-
periodType
|
|
164
|
-
config,
|
|
165
|
-
fnFilter,
|
|
166
|
-
periodSettings
|
|
167
|
-
});
|
|
168
|
-
};
|
|
169
|
-
};
|
|
170
|
-
const getFinancialNovemberPeriodType = (fnFilter, periodSettings) => {
|
|
171
|
-
return config => {
|
|
172
|
-
return getPeriods({
|
|
173
|
-
periodType: 'FYNOV',
|
|
174
|
-
config,
|
|
175
|
-
fnFilter,
|
|
176
|
-
periodSettings
|
|
177
|
-
});
|
|
178
|
-
};
|
|
179
|
-
};
|
|
180
|
-
const getFinancialJulyPeriodType = (fnFilter, periodSettings) => {
|
|
181
|
-
return config => {
|
|
182
|
-
return getPeriods({
|
|
183
|
-
periodType: 'FYJUL',
|
|
184
|
-
config,
|
|
185
|
-
fnFilter,
|
|
186
|
-
periodSettings
|
|
187
|
-
});
|
|
188
|
-
};
|
|
189
|
-
};
|
|
190
|
-
const getFinancialAprilPeriodType = (fnFilter, periodSettings) => {
|
|
191
|
-
return config => {
|
|
192
|
-
return getPeriods({
|
|
193
|
-
periodType: 'FYAPR',
|
|
163
|
+
periodType,
|
|
194
164
|
config,
|
|
195
165
|
fnFilter,
|
|
196
166
|
periodSettings
|
|
@@ -271,21 +241,33 @@ const getOptions = periodSettings => {
|
|
|
271
241
|
getPeriods: getYearlyPeriodType(filterFuturePeriods, periodSettings),
|
|
272
242
|
name: i18n.t('Yearly')
|
|
273
243
|
}, {
|
|
274
|
-
id:
|
|
275
|
-
getPeriods:
|
|
276
|
-
name: i18n.t('Financial year (Start
|
|
244
|
+
id: FYFEB,
|
|
245
|
+
getPeriods: getFinancialPeriodType('FYFEB', filterFuturePeriods, periodSettings),
|
|
246
|
+
name: i18n.t('Financial year (Start February)')
|
|
277
247
|
}, {
|
|
278
|
-
id:
|
|
279
|
-
getPeriods:
|
|
280
|
-
name: i18n.t('Financial year (Start
|
|
248
|
+
id: FYAPR,
|
|
249
|
+
getPeriods: getFinancialPeriodType('FYAPR', filterFuturePeriods, periodSettings),
|
|
250
|
+
name: i18n.t('Financial year (Start April)')
|
|
281
251
|
}, {
|
|
282
252
|
id: FYJUL,
|
|
283
|
-
getPeriods:
|
|
253
|
+
getPeriods: getFinancialPeriodType('FYJUL', filterFuturePeriods, periodSettings),
|
|
284
254
|
name: i18n.t('Financial year (Start July)')
|
|
285
255
|
}, {
|
|
286
|
-
id:
|
|
287
|
-
getPeriods:
|
|
288
|
-
name: i18n.t('Financial year (Start
|
|
256
|
+
id: FYAUG,
|
|
257
|
+
getPeriods: getFinancialPeriodType('FYAUG', filterFuturePeriods, periodSettings),
|
|
258
|
+
name: i18n.t('Financial year (Start August)')
|
|
259
|
+
}, {
|
|
260
|
+
id: FYSEP,
|
|
261
|
+
getPeriods: getFinancialPeriodType('FYSEP', filterFuturePeriods, periodSettings),
|
|
262
|
+
name: i18n.t('Financial year (Start September)')
|
|
263
|
+
}, {
|
|
264
|
+
id: FYOCT,
|
|
265
|
+
getPeriods: getFinancialPeriodType('FYOCT', filterFuturePeriods, periodSettings),
|
|
266
|
+
name: i18n.t('Financial year (Start October)')
|
|
267
|
+
}, {
|
|
268
|
+
id: FYNOV,
|
|
269
|
+
getPeriods: getFinancialPeriodType('FYNOV', filterFuturePeriods, periodSettings),
|
|
270
|
+
name: i18n.t('Financial year (Start November)')
|
|
289
271
|
}];
|
|
290
272
|
};
|
|
291
273
|
export const getFixedPeriodsOptionsById = (id, periodSettings) => {
|
|
@@ -13,8 +13,11 @@ export const SIXMONTHLY = 'SIXMONTHLY';
|
|
|
13
13
|
export const SIXMONTHLYAPR = 'SIXMONTHLYAPR';
|
|
14
14
|
export const YEARLY = 'YEARLY';
|
|
15
15
|
export const FINANCIAL = 'FINANCIAL';
|
|
16
|
-
export const
|
|
17
|
-
export const FYOCT = 'FYOCT';
|
|
18
|
-
export const FYJUL = 'FYJUL';
|
|
16
|
+
export const FYFEB = 'FYFEB';
|
|
19
17
|
export const FYAPR = 'FYAPR';
|
|
18
|
+
export const FYJUL = 'FYJUL';
|
|
19
|
+
export const FYAUG = 'FYAUG';
|
|
20
|
+
export const FYSEP = 'FYSEP';
|
|
21
|
+
export const FYOCT = 'FYOCT';
|
|
22
|
+
export const FYNOV = 'FYNOV';
|
|
20
23
|
export const filterPeriodTypesById = (allPeriodTypes = [], excludedPeriodTypes = []) => allPeriodTypes.filter(period => !excludedPeriodTypes.includes(period.id));
|
package/build/es/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import './locales/index.js';
|
|
|
4
4
|
export { default as DataDimension } from './components/DataDimension/DataDimension.js';
|
|
5
5
|
export { default as PeriodDimension } from './components/PeriodDimension/PeriodDimension.js';
|
|
6
6
|
export { default as FixedPeriodSelect } from './components/PeriodDimension/FixedPeriodSelect.js';
|
|
7
|
+
export { useDataOutputPeriodTypes } from './components/PeriodDimension/useDataOutputPeriodTypes.js';
|
|
7
8
|
export { default as OrgUnitDimension } from './components/OrgUnitDimension/OrgUnitDimension.js';
|
|
8
9
|
export { default as DynamicDimension, ALL_DYNAMIC_DIMENSION_ITEMS } from './components/DynamicDimension/DynamicDimension.js';
|
|
9
10
|
export { default as DimensionsPanel } from './components/DimensionsPanel/DimensionsPanel.js';
|
|
@@ -256,6 +256,8 @@
|
|
|
256
256
|
"Select year": "Select year",
|
|
257
257
|
"Period": "Period",
|
|
258
258
|
"Selected Periods": "Selected Periods",
|
|
259
|
+
"No period types available": "No period types available",
|
|
260
|
+
"No period types are enabled in the system. Please contact your system administrator.": "No period types are enabled in the system. Please contact your system administrator.",
|
|
259
261
|
"Relative periods": "Relative periods",
|
|
260
262
|
"Fixed periods": "Fixed periods",
|
|
261
263
|
"No periods selected": "No periods selected",
|
|
@@ -272,10 +274,13 @@
|
|
|
272
274
|
"Six-monthly": "Six-monthly",
|
|
273
275
|
"Six-monthly April": "Six-monthly April",
|
|
274
276
|
"Yearly": "Yearly",
|
|
275
|
-
"Financial year (Start
|
|
276
|
-
"Financial year (Start October)": "Financial year (Start October)",
|
|
277
|
-
"Financial year (Start July)": "Financial year (Start July)",
|
|
277
|
+
"Financial year (Start February)": "Financial year (Start February)",
|
|
278
278
|
"Financial year (Start April)": "Financial year (Start April)",
|
|
279
|
+
"Financial year (Start July)": "Financial year (Start July)",
|
|
280
|
+
"Financial year (Start August)": "Financial year (Start August)",
|
|
281
|
+
"Financial year (Start September)": "Financial year (Start September)",
|
|
282
|
+
"Financial year (Start October)": "Financial year (Start October)",
|
|
283
|
+
"Financial year (Start November)": "Financial year (Start November)",
|
|
279
284
|
"Today": "Today",
|
|
280
285
|
"Yesterday": "Yesterday",
|
|
281
286
|
"Last 3 days": "Last 3 days",
|
|
@@ -22,7 +22,7 @@ export default function (filters, metaData) {
|
|
|
22
22
|
const relativePeriodNames = getRelativePeriodsName();
|
|
23
23
|
titleFragments.push(dimensionGetItemIds(filter).map(id => {
|
|
24
24
|
var _metaData$items$id;
|
|
25
|
-
return
|
|
25
|
+
return ((_metaData$items$id = metaData.items[id]) === null || _metaData$items$id === void 0 ? void 0 : _metaData$items$id.name) || relativePeriodNames[id] || id;
|
|
26
26
|
}).join(', '));
|
|
27
27
|
} else {
|
|
28
28
|
const filterItems = metaData.dimensions[filter.dimension];
|