@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.
Files changed (31) hide show
  1. package/build/cjs/components/PeriodDimension/FixedPeriodFilter.js +5 -10
  2. package/build/cjs/components/PeriodDimension/FixedPeriodSelect.js +3 -1
  3. package/build/cjs/components/PeriodDimension/PeriodDimension.js +15 -5
  4. package/build/cjs/components/PeriodDimension/PeriodTransfer.js +110 -14
  5. package/build/cjs/components/PeriodDimension/RelativePeriodFilter.js +4 -6
  6. package/build/cjs/components/PeriodDimension/__tests__/PeriodDimension.spec.js +19 -6
  7. package/build/cjs/components/PeriodDimension/__tests__/fixedPeriods.spec.js +1 -1
  8. package/build/cjs/components/PeriodDimension/__tests__/utils.spec.js +1 -1
  9. package/build/cjs/components/PeriodDimension/useDataOutputPeriodTypes.js +153 -0
  10. package/build/cjs/components/PeriodDimension/utils/enabledPeriodTypes.js +179 -0
  11. package/build/cjs/components/PeriodDimension/utils/fixedPeriods.js +24 -42
  12. package/build/cjs/components/PeriodDimension/utils/index.js +7 -4
  13. package/build/cjs/index.js +8 -0
  14. package/build/cjs/locales/en/translations.json +8 -3
  15. package/build/cjs/visualizations/util/getFilterText.js +1 -1
  16. package/build/es/components/PeriodDimension/FixedPeriodFilter.js +5 -10
  17. package/build/es/components/PeriodDimension/FixedPeriodSelect.js +4 -2
  18. package/build/es/components/PeriodDimension/PeriodDimension.js +15 -5
  19. package/build/es/components/PeriodDimension/PeriodTransfer.js +115 -19
  20. package/build/es/components/PeriodDimension/RelativePeriodFilter.js +4 -6
  21. package/build/es/components/PeriodDimension/__tests__/PeriodDimension.spec.js +19 -6
  22. package/build/es/components/PeriodDimension/__tests__/fixedPeriods.spec.js +1 -1
  23. package/build/es/components/PeriodDimension/__tests__/utils.spec.js +1 -1
  24. package/build/es/components/PeriodDimension/useDataOutputPeriodTypes.js +147 -0
  25. package/build/es/components/PeriodDimension/utils/enabledPeriodTypes.js +168 -0
  26. package/build/es/components/PeriodDimension/utils/fixedPeriods.js +25 -43
  27. package/build/es/components/PeriodDimension/utils/index.js +6 -3
  28. package/build/es/index.js +1 -0
  29. package/build/es/locales/en/translations.json +8 -3
  30. package/build/es/visualizations/util/getFilterText.js +1 -1
  31. 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, FYNOV, FYOCT, FYJUL, FYAPR } from './index.js';
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 getFinancialOctoberPeriodType = (fnFilter, periodSettings) => {
160
+ const getFinancialPeriodType = (periodType, fnFilter, periodSettings) => {
161
161
  return config => {
162
162
  return getPeriods({
163
- periodType: 'FYOCT',
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: FYNOV,
275
- getPeriods: getFinancialNovemberPeriodType(filterFuturePeriods, periodSettings),
276
- name: i18n.t('Financial year (Start November)')
244
+ id: FYFEB,
245
+ getPeriods: getFinancialPeriodType('FYFEB', filterFuturePeriods, periodSettings),
246
+ name: i18n.t('Financial year (Start February)')
277
247
  }, {
278
- id: FYOCT,
279
- getPeriods: getFinancialOctoberPeriodType(filterFuturePeriods, periodSettings),
280
- name: i18n.t('Financial year (Start October)')
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: getFinancialJulyPeriodType(filterFuturePeriods, periodSettings),
253
+ getPeriods: getFinancialPeriodType('FYJUL', filterFuturePeriods, periodSettings),
284
254
  name: i18n.t('Financial year (Start July)')
285
255
  }, {
286
- id: FYAPR,
287
- getPeriods: getFinancialAprilPeriodType(filterFuturePeriods, periodSettings),
288
- name: i18n.t('Financial year (Start April)')
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 FYNOV = 'FYNOV';
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 November)": "Financial year (Start November)",
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 relativePeriodNames[id] || ((_metaData$items$id = metaData.items[id]) === null || _metaData$items$id === void 0 ? void 0 : _metaData$items$id.name) || id;
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];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "29.2.1",
3
+ "version": "29.3.0",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {