@dhis2/analytics 21.0.10 → 21.1.1
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 +28 -0
- package/build/cjs/index.js +8 -0
- package/build/cjs/locales/ar/translations.json +1 -1
- package/build/cjs/modules/layout/dimension.js +9 -2
- package/build/cjs/modules/layout/dimensionCreate.js +3 -0
- package/build/cjs/modules/pivotTable/PivotTableEngine.js +4 -3
- package/build/es/index.js +3 -1
- package/build/es/locales/ar/translations.json +1 -1
- package/build/es/modules/layout/dimension.js +7 -1
- package/build/es/modules/layout/dimensionCreate.js +4 -1
- package/build/es/modules/pivotTable/PivotTableEngine.js +4 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
## [21.1.1](https://github.com/dhis2/analytics/compare/v21.1.0...v21.1.1) (2021-12-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* do not fix headers if no dimension items are selected ([#1057](https://github.com/dhis2/analytics/issues/1057)) ([ae51967](https://github.com/dhis2/analytics/commit/ae51967ff35a17b8589f4959015b06c4913b7dae))
|
|
7
|
+
|
|
8
|
+
# [21.1.0](https://github.com/dhis2/analytics/compare/v21.0.12...v21.1.0) (2021-12-20)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* export formatValue function ([#1080](https://github.com/dhis2/analytics/issues/1080)) ([20d0f5a](https://github.com/dhis2/analytics/commit/20d0f5a1b2eda14879f03a4c6d37337c80bb15ff))
|
|
14
|
+
|
|
15
|
+
## [21.0.12](https://github.com/dhis2/analytics/compare/v21.0.11...v21.0.12) (2021-12-11)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **translations:** sync translations from transifex (master) ([ac9ad8c](https://github.com/dhis2/analytics/commit/ac9ad8ca44fa56d976e11c554a894b6aafebb58c))
|
|
21
|
+
|
|
22
|
+
## [21.0.11](https://github.com/dhis2/analytics/compare/v21.0.10...v21.0.11) (2021-12-10)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Bug Fixes
|
|
26
|
+
|
|
27
|
+
* support legendset in dimension create ([#1107](https://github.com/dhis2/analytics/issues/1107)) ([4b4dbe7](https://github.com/dhis2/analytics/commit/4b4dbe74c0012419f12c6b2f9c297e1a3e256c05))
|
|
28
|
+
|
|
1
29
|
## [21.0.10](https://github.com/dhis2/analytics/compare/v21.0.9...v21.0.10) (2021-12-09)
|
|
2
30
|
|
|
3
31
|
|
package/build/cjs/index.js
CHANGED
|
@@ -969,6 +969,12 @@ Object.defineProperty(exports, "LEGEND_DISPLAY_STYLE_TEXT", {
|
|
|
969
969
|
return _legends.LEGEND_DISPLAY_STYLE_TEXT;
|
|
970
970
|
}
|
|
971
971
|
});
|
|
972
|
+
Object.defineProperty(exports, "formatValue", {
|
|
973
|
+
enumerable: true,
|
|
974
|
+
get: function () {
|
|
975
|
+
return _renderValue.renderValue;
|
|
976
|
+
}
|
|
977
|
+
});
|
|
972
978
|
Object.defineProperty(exports, "COLOR_SET_DEFAULT", {
|
|
973
979
|
enumerable: true,
|
|
974
980
|
get: function () {
|
|
@@ -1270,6 +1276,8 @@ var _fontStyle = require("./modules/fontStyle.js");
|
|
|
1270
1276
|
|
|
1271
1277
|
var _legends = require("./modules/legends.js");
|
|
1272
1278
|
|
|
1279
|
+
var _renderValue = require("./modules/pivotTable/renderValue.js");
|
|
1280
|
+
|
|
1273
1281
|
var _colorSets = require("./visualizations/util/colors/colorSets.js");
|
|
1274
1282
|
|
|
1275
1283
|
var _index7 = require("./components/PeriodDimension/utils/index.js");
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.DIMENSION_PROPS = exports.DIMENSION_PROP_FILTER = exports.DIMENSION_PROP_ITEMS = exports.DIMENSION_PROP_ID = exports.DIMENSION = void 0;
|
|
6
|
+
exports.DIMENSION_PROPS = 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
|
|
|
@@ -38,5 +38,12 @@ const DIMENSION_PROP_FILTER = {
|
|
|
38
38
|
isValid: prop => (0, _isString.default)(prop)
|
|
39
39
|
};
|
|
40
40
|
exports.DIMENSION_PROP_FILTER = DIMENSION_PROP_FILTER;
|
|
41
|
-
const
|
|
41
|
+
const DIMENSION_PROP_LEGEND_SET = {
|
|
42
|
+
name: 'legendSet',
|
|
43
|
+
defaultValue: [],
|
|
44
|
+
required: false,
|
|
45
|
+
isValid: prop => (0, _isString.default)(prop)
|
|
46
|
+
};
|
|
47
|
+
exports.DIMENSION_PROP_LEGEND_SET = DIMENSION_PROP_LEGEND_SET;
|
|
48
|
+
const DIMENSION_PROPS = [DIMENSION_PROP_ID, DIMENSION_PROP_ITEMS, DIMENSION_PROP_FILTER, DIMENSION_PROP_LEGEND_SET];
|
|
42
49
|
exports.DIMENSION_PROPS = DIMENSION_PROPS;
|
|
@@ -17,6 +17,9 @@ const dimensionCreate = (dimensionId, itemIds = [], args = {}) => {
|
|
|
17
17
|
}),
|
|
18
18
|
...(args.filter && {
|
|
19
19
|
[_dimension.DIMENSION_PROP_FILTER.name]: args.filter
|
|
20
|
+
}),
|
|
21
|
+
...(args.legendSet && {
|
|
22
|
+
[_dimension.DIMENSION_PROP_LEGEND_SET.name]: args.legendSet
|
|
20
23
|
})
|
|
21
24
|
};
|
|
22
25
|
return dimension;
|
|
@@ -226,6 +226,7 @@ class PivotTableEngine {
|
|
|
226
226
|
return sets;
|
|
227
227
|
}, {});
|
|
228
228
|
this.rawData = data;
|
|
229
|
+
this.dimensionLookup = buildDimensionLookup(this.visualization, this.rawData.metaData, this.rawData.headers);
|
|
229
230
|
this.options = { ...defaultOptions,
|
|
230
231
|
showColumnTotals: visualization.colTotals,
|
|
231
232
|
showRowTotals: visualization.rowTotals,
|
|
@@ -235,10 +236,10 @@ class PivotTableEngine {
|
|
|
235
236
|
hideEmptyRows: visualization.hideEmptyRows,
|
|
236
237
|
title: visualization.hideTitle ? undefined : visualization.title,
|
|
237
238
|
subtitle: visualization.hideSubtitle ? undefined : visualization.subtitle,
|
|
238
|
-
|
|
239
|
-
|
|
239
|
+
// turn on fixed headers only when there are dimensions
|
|
240
|
+
fixColumnHeaders: this.dimensionLookup.columns.length ? visualization.fixColumnHeaders : false,
|
|
241
|
+
fixRowHeaders: this.dimensionLookup.rows.length ? visualization.fixRowHeaders : false
|
|
240
242
|
};
|
|
241
|
-
this.dimensionLookup = buildDimensionLookup(this.visualization, this.rawData.metaData, this.rawData.headers);
|
|
242
243
|
this.adaptiveClippingController = new _AdaptiveClippingController.AdaptiveClippingController(this);
|
|
243
244
|
const doColumnSubtotals = this.options.showColumnSubtotals && this.dimensionLookup.rows.length > 1;
|
|
244
245
|
const singularRow = this.dimensionLookup.rows.length === 1 && this.dimensionLookup.rows[0].count === 1;
|
package/build/es/index.js
CHANGED
|
@@ -78,7 +78,9 @@ export { createVisualization } from './visualizations/index.js'; // Modules: fon
|
|
|
78
78
|
|
|
79
79
|
export { FONT_STYLE_VISUALIZATION_TITLE, FONT_STYLE_VISUALIZATION_SUBTITLE, FONT_STYLE_HORIZONTAL_AXIS_TITLE, FONT_STYLE_VERTICAL_AXIS_TITLE, FONT_STYLE_LEGEND, FONT_STYLE_AXIS_LABELS, FONT_STYLE_REGRESSION_LINE_LABEL, FONT_STYLE_OPTION_FONT, FONT_STYLE_OPTION_FONT_SIZE, FONT_STYLE_OPTION_BOLD, FONT_STYLE_OPTION_ITALIC, FONT_STYLE_OPTION_UNDERLINE, FONT_STYLE_OPTION_TEXT_COLOR, FONT_STYLE_OPTION_TEXT_ALIGN, TEXT_ALIGN_LEFT, TEXT_ALIGN_CENTER, TEXT_ALIGN_RIGHT, defaultFontStyle, getFontSizeOptions, getTextAlignOptions, deleteFontStyleOption } from './modules/fontStyle.js'; // Modules: legend
|
|
80
80
|
|
|
81
|
-
export { LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM, LEGEND_DISPLAY_STRATEGY_FIXED, LEGEND_DISPLAY_STYLE_FILL, LEGEND_DISPLAY_STYLE_TEXT } from './modules/legends.js'; //
|
|
81
|
+
export { LEGEND_DISPLAY_STRATEGY_BY_DATA_ITEM, LEGEND_DISPLAY_STRATEGY_FIXED, LEGEND_DISPLAY_STYLE_FILL, LEGEND_DISPLAY_STYLE_TEXT } from './modules/legends.js'; // Modules: pivotTable
|
|
82
|
+
|
|
83
|
+
export { renderValue as formatValue } from './modules/pivotTable/renderValue.js'; // Utils: colorSets
|
|
82
84
|
|
|
83
85
|
export { COLOR_SET_DEFAULT, COLOR_SET_BRIGHT, COLOR_SET_DARK, COLOR_SET_GRAY, COLOR_SET_COLOR_BLIND, COLOR_SET_PATTERNS, colorSets } from './visualizations/util/colors/colorSets.js'; // Utils: periods
|
|
84
86
|
|
|
@@ -23,4 +23,10 @@ export const DIMENSION_PROP_FILTER = {
|
|
|
23
23
|
required: false,
|
|
24
24
|
isValid: prop => isString(prop)
|
|
25
25
|
};
|
|
26
|
-
export const
|
|
26
|
+
export const DIMENSION_PROP_LEGEND_SET = {
|
|
27
|
+
name: 'legendSet',
|
|
28
|
+
defaultValue: [],
|
|
29
|
+
required: false,
|
|
30
|
+
isValid: prop => isString(prop)
|
|
31
|
+
};
|
|
32
|
+
export const DIMENSION_PROPS = [DIMENSION_PROP_ID, DIMENSION_PROP_ITEMS, DIMENSION_PROP_FILTER, DIMENSION_PROP_LEGEND_SET];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DIMENSION_PROP_ID, DIMENSION_PROP_ITEMS, DIMENSION_PROP_FILTER } from './dimension.js';
|
|
1
|
+
import { DIMENSION_PROP_ID, DIMENSION_PROP_ITEMS, DIMENSION_PROP_FILTER, DIMENSION_PROP_LEGEND_SET } from './dimension.js';
|
|
2
2
|
export const dimensionCreate = (dimensionId, itemIds = [], args = {}) => {
|
|
3
3
|
const dimension = {
|
|
4
4
|
[DIMENSION_PROP_ID.name]: dimensionId,
|
|
@@ -9,6 +9,9 @@ export const dimensionCreate = (dimensionId, itemIds = [], args = {}) => {
|
|
|
9
9
|
}),
|
|
10
10
|
...(args.filter && {
|
|
11
11
|
[DIMENSION_PROP_FILTER.name]: args.filter
|
|
12
|
+
}),
|
|
13
|
+
...(args.legendSet && {
|
|
14
|
+
[DIMENSION_PROP_LEGEND_SET.name]: args.legendSet
|
|
12
15
|
})
|
|
13
16
|
};
|
|
14
17
|
return dimension;
|
|
@@ -211,6 +211,7 @@ export class PivotTableEngine {
|
|
|
211
211
|
return sets;
|
|
212
212
|
}, {});
|
|
213
213
|
this.rawData = data;
|
|
214
|
+
this.dimensionLookup = buildDimensionLookup(this.visualization, this.rawData.metaData, this.rawData.headers);
|
|
214
215
|
this.options = { ...defaultOptions,
|
|
215
216
|
showColumnTotals: visualization.colTotals,
|
|
216
217
|
showRowTotals: visualization.rowTotals,
|
|
@@ -220,10 +221,10 @@ export class PivotTableEngine {
|
|
|
220
221
|
hideEmptyRows: visualization.hideEmptyRows,
|
|
221
222
|
title: visualization.hideTitle ? undefined : visualization.title,
|
|
222
223
|
subtitle: visualization.hideSubtitle ? undefined : visualization.subtitle,
|
|
223
|
-
|
|
224
|
-
|
|
224
|
+
// turn on fixed headers only when there are dimensions
|
|
225
|
+
fixColumnHeaders: this.dimensionLookup.columns.length ? visualization.fixColumnHeaders : false,
|
|
226
|
+
fixRowHeaders: this.dimensionLookup.rows.length ? visualization.fixRowHeaders : false
|
|
225
227
|
};
|
|
226
|
-
this.dimensionLookup = buildDimensionLookup(this.visualization, this.rawData.metaData, this.rawData.headers);
|
|
227
228
|
this.adaptiveClippingController = new AdaptiveClippingController(this);
|
|
228
229
|
const doColumnSubtotals = this.options.showColumnSubtotals && this.dimensionLookup.rows.length > 1;
|
|
229
230
|
const singularRow = this.dimensionLookup.rows.length === 1 && this.dimensionLookup.rows[0].count === 1;
|