@dhis2/analytics 23.4.1 → 23.5.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/CHANGELOG.md +7 -0
- package/build/cjs/api/analytics/AnalyticsRequest.js +10 -2
- package/build/cjs/modules/layout/dimension.js +9 -2
- package/build/cjs/modules/layout/dimensionCreate.js +3 -0
- package/build/es/api/analytics/AnalyticsRequest.js +10 -2
- package/build/es/modules/layout/dimension.js +7 -1
- package/build/es/modules/layout/dimensionCreate.js +4 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [23.5.0](https://github.com/dhis2/analytics/compare/v23.4.1...v23.5.0) (2022-02-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* repeatable events (TECH-894) ([#1152](https://github.com/dhis2/analytics/issues/1152)) ([4c35dbb](https://github.com/dhis2/analytics/commit/4c35dbb16d426afaf70913d41f7640376a4ecbc9))
|
|
7
|
+
|
|
1
8
|
## [23.4.1](https://github.com/dhis2/analytics/compare/v23.4.0...v23.4.1) (2022-02-18)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -56,7 +56,7 @@ class AnalyticsRequest extends (0, _AnalyticsRequestDimensionsMixin.default)((0,
|
|
|
56
56
|
const columns = visualization.columns || [];
|
|
57
57
|
const rows = visualization.rows || [];
|
|
58
58
|
columns.concat(rows).forEach(d => {
|
|
59
|
-
var _d$legendSet, _d$programStage, _d$
|
|
59
|
+
var _d$legendSet, _d$programStage, _d$repetition, _d$repetition$indexes;
|
|
60
60
|
|
|
61
61
|
let dimension = d.dimension;
|
|
62
62
|
|
|
@@ -72,7 +72,15 @@ class AnalyticsRequest extends (0, _AnalyticsRequestDimensionsMixin.default)((0,
|
|
|
72
72
|
dimension += ":".concat(d.filter);
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
if ((_d$repetition = d.repetition) !== null && _d$repetition !== void 0 && (_d$repetition$indexes = _d$repetition.indexes) !== null && _d$repetition$indexes !== void 0 && _d$repetition$indexes.length) {
|
|
76
|
+
d.repetition.indexes.forEach(index => {
|
|
77
|
+
request = request.addDimension(dimension.replace(/\./, "[".concat(index, "].")));
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
var _d$items;
|
|
81
|
+
|
|
82
|
+
request = request.addDimension(dimension, (_d$items = d.items) === null || _d$items === void 0 ? void 0 : _d$items.map(item => item.id));
|
|
83
|
+
}
|
|
76
84
|
}); // extract filters from visualization
|
|
77
85
|
|
|
78
86
|
const filters = visualization.filters || []; // only pass dx/pe/ou as dimension
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.DIMENSION_PROPS = exports.DIMENSION_PROP_PROGRAM_STAGE = exports.DIMENSION_PROP_LEGEND_SET = exports.DIMENSION_PROP_FILTER = exports.DIMENSION_PROP_ITEMS = exports.DIMENSION_PROP_ID = exports.DIMENSION = void 0;
|
|
6
|
+
exports.DIMENSION_PROPS = exports.DIMENSION_PROP_REPETITION = exports.DIMENSION_PROP_PROGRAM_STAGE = exports.DIMENSION_PROP_LEGEND_SET = exports.DIMENSION_PROP_FILTER = exports.DIMENSION_PROP_ITEMS = exports.DIMENSION_PROP_ID = exports.DIMENSION = void 0;
|
|
7
7
|
|
|
8
8
|
var _isObject = _interopRequireDefault(require("lodash/isObject"));
|
|
9
9
|
|
|
@@ -52,5 +52,12 @@ const DIMENSION_PROP_PROGRAM_STAGE = {
|
|
|
52
52
|
isValid: prop => (0, _isObject.default)(prop)
|
|
53
53
|
};
|
|
54
54
|
exports.DIMENSION_PROP_PROGRAM_STAGE = DIMENSION_PROP_PROGRAM_STAGE;
|
|
55
|
-
const
|
|
55
|
+
const DIMENSION_PROP_REPETITION = {
|
|
56
|
+
name: 'repetition',
|
|
57
|
+
defaultValue: [],
|
|
58
|
+
required: false,
|
|
59
|
+
isValid: prop => Array.isArray(prop)
|
|
60
|
+
};
|
|
61
|
+
exports.DIMENSION_PROP_REPETITION = DIMENSION_PROP_REPETITION;
|
|
62
|
+
const DIMENSION_PROPS = [DIMENSION_PROP_ID, DIMENSION_PROP_ITEMS, DIMENSION_PROP_FILTER, DIMENSION_PROP_LEGEND_SET, DIMENSION_PROP_PROGRAM_STAGE, DIMENSION_PROP_REPETITION];
|
|
56
63
|
exports.DIMENSION_PROPS = DIMENSION_PROPS;
|
|
@@ -23,6 +23,9 @@ const dimensionCreate = (dimensionId, itemIds = [], args = {}) => {
|
|
|
23
23
|
}),
|
|
24
24
|
...(args.programStage && {
|
|
25
25
|
[_dimension.DIMENSION_PROP_PROGRAM_STAGE.name]: args.programStage
|
|
26
|
+
}),
|
|
27
|
+
...(args.repetition && {
|
|
28
|
+
[_dimension.DIMENSION_PROP_REPETITION.name]: args.repetition
|
|
26
29
|
})
|
|
27
30
|
};
|
|
28
31
|
return dimension;
|
|
@@ -43,7 +43,7 @@ class AnalyticsRequest extends AnalyticsRequestDimensionsMixin(AnalyticsRequestF
|
|
|
43
43
|
const columns = visualization.columns || [];
|
|
44
44
|
const rows = visualization.rows || [];
|
|
45
45
|
columns.concat(rows).forEach(d => {
|
|
46
|
-
var _d$legendSet, _d$programStage, _d$
|
|
46
|
+
var _d$legendSet, _d$programStage, _d$repetition, _d$repetition$indexes;
|
|
47
47
|
|
|
48
48
|
let dimension = d.dimension;
|
|
49
49
|
|
|
@@ -59,7 +59,15 @@ class AnalyticsRequest extends AnalyticsRequestDimensionsMixin(AnalyticsRequestF
|
|
|
59
59
|
dimension += ":".concat(d.filter);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
if ((_d$repetition = d.repetition) !== null && _d$repetition !== void 0 && (_d$repetition$indexes = _d$repetition.indexes) !== null && _d$repetition$indexes !== void 0 && _d$repetition$indexes.length) {
|
|
63
|
+
d.repetition.indexes.forEach(index => {
|
|
64
|
+
request = request.addDimension(dimension.replace(/\./, "[".concat(index, "].")));
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
var _d$items;
|
|
68
|
+
|
|
69
|
+
request = request.addDimension(dimension, (_d$items = d.items) === null || _d$items === void 0 ? void 0 : _d$items.map(item => item.id));
|
|
70
|
+
}
|
|
63
71
|
}); // extract filters from visualization
|
|
64
72
|
|
|
65
73
|
const filters = visualization.filters || []; // only pass dx/pe/ou as dimension
|
|
@@ -35,4 +35,10 @@ export const DIMENSION_PROP_PROGRAM_STAGE = {
|
|
|
35
35
|
required: false,
|
|
36
36
|
isValid: prop => isObject(prop)
|
|
37
37
|
};
|
|
38
|
-
export const
|
|
38
|
+
export const DIMENSION_PROP_REPETITION = {
|
|
39
|
+
name: 'repetition',
|
|
40
|
+
defaultValue: [],
|
|
41
|
+
required: false,
|
|
42
|
+
isValid: prop => Array.isArray(prop)
|
|
43
|
+
};
|
|
44
|
+
export const DIMENSION_PROPS = [DIMENSION_PROP_ID, DIMENSION_PROP_ITEMS, DIMENSION_PROP_FILTER, DIMENSION_PROP_LEGEND_SET, DIMENSION_PROP_PROGRAM_STAGE, DIMENSION_PROP_REPETITION];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DIMENSION_PROP_ID, DIMENSION_PROP_ITEMS, DIMENSION_PROP_FILTER, DIMENSION_PROP_LEGEND_SET, DIMENSION_PROP_PROGRAM_STAGE } from './dimension.js';
|
|
1
|
+
import { DIMENSION_PROP_ID, DIMENSION_PROP_ITEMS, DIMENSION_PROP_FILTER, DIMENSION_PROP_LEGEND_SET, DIMENSION_PROP_PROGRAM_STAGE, DIMENSION_PROP_REPETITION } from './dimension.js';
|
|
2
2
|
export const dimensionCreate = (dimensionId, itemIds = [], args = {}) => {
|
|
3
3
|
const dimension = {
|
|
4
4
|
[DIMENSION_PROP_ID.name]: dimensionId,
|
|
@@ -15,6 +15,9 @@ export const dimensionCreate = (dimensionId, itemIds = [], args = {}) => {
|
|
|
15
15
|
}),
|
|
16
16
|
...(args.programStage && {
|
|
17
17
|
[DIMENSION_PROP_PROGRAM_STAGE.name]: args.programStage
|
|
18
|
+
}),
|
|
19
|
+
...(args.repetition && {
|
|
20
|
+
[DIMENSION_PROP_REPETITION.name]: args.repetition
|
|
18
21
|
})
|
|
19
22
|
};
|
|
20
23
|
return dimension;
|