@dhis2/analytics 24.10.11 → 24.10.13
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 +14 -0
- package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/fixedPeriods.spec.js.snap +1602 -0
- package/build/cjs/components/PivotTable/PivotTableValueCell.js +2 -3
- package/build/cjs/modules/renderValue.js +1 -1
- package/build/cjs/modules/valueTypes.js +7 -2
- package/build/es/components/PeriodDimension/__tests__/__snapshots__/fixedPeriods.spec.js.snap +1602 -0
- package/build/es/components/PivotTable/PivotTableValueCell.js +3 -4
- package/build/es/modules/renderValue.js +2 -2
- package/build/es/modules/valueTypes.js +3 -1
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import PropTypes from 'prop-types';
|
|
|
2
2
|
import React, { useRef } from 'react';
|
|
3
3
|
import { applyLegendSet } from '../../modules/pivotTable/applyLegendSet.js';
|
|
4
4
|
import { CELL_TYPE_VALUE } from '../../modules/pivotTable/pivotTableConstants.js';
|
|
5
|
-
import {
|
|
5
|
+
import { isNumericValueType, isBooleanValueType } from '../../modules/valueTypes.js';
|
|
6
6
|
import { PivotTableCell } from './PivotTableCell.js';
|
|
7
7
|
import { PivotTableEmptyCell } from './PivotTableEmptyCell.js';
|
|
8
8
|
import { usePivotTableEngine } from './PivotTableEngineContext.js';
|
|
@@ -35,10 +35,9 @@ export const PivotTableValueCell = _ref => {
|
|
|
35
35
|
ref: cellRef,
|
|
36
36
|
classes: [cellContent.cellType, isClickable && 'clickable']
|
|
37
37
|
});
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
const legendStyle = cellContent.cellType === CELL_TYPE_VALUE && cellContent.valueType === VALUE_TYPE_NUMBER ? applyLegendSet(cellContent.rawValue, cellContent.dxDimension, engine) : undefined;
|
|
40
|
+
const legendStyle = cellContent.cellType === CELL_TYPE_VALUE && (isNumericValueType(cellContent.valueType) || isBooleanValueType(cellContent.valueType)) ? applyLegendSet(cellContent.rawValue, cellContent.dxDimension, engine) : undefined;
|
|
42
41
|
const width = engine.adaptiveClippingController.columns.sizes[engine.columnMap[column]].size;
|
|
43
42
|
const height = engine.adaptiveClippingController.rows.sizes[engine.rowMap[row]].size;
|
|
44
43
|
const style = { ...legendStyle,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NUMBER_TYPE_ROW_PERCENTAGE, NUMBER_TYPE_COLUMN_PERCENTAGE } from './pivotTable/pivotTableConstants.js';
|
|
2
|
-
import { isNumericValueType } from './valueTypes.js';
|
|
2
|
+
import { isNumericValueType, isBooleanValueType } from './valueTypes.js';
|
|
3
3
|
|
|
4
4
|
const trimTrailingZeros = stringValue => stringValue.replace(/\.?0+$/, '');
|
|
5
5
|
|
|
@@ -53,7 +53,7 @@ const toFixedPrecisionString = (value, skipRounding) => {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
export const renderValue = (value, valueType, visualization) => {
|
|
56
|
-
if (!isNumericValueType(valueType) || value === undefined) {
|
|
56
|
+
if (!(isNumericValueType(valueType) || isBooleanValueType(valueType)) || value === undefined) {
|
|
57
57
|
return String(value).replace(/[^\S\n]+/, ' ');
|
|
58
58
|
}
|
|
59
59
|
|
|
@@ -23,4 +23,6 @@ export const VALUE_TYPE_DATETIME = 'DATETIME';
|
|
|
23
23
|
export const VALUE_TYPE_ORGANISATION_UNIT = 'ORGANISATION_UNIT';
|
|
24
24
|
export const VALUE_TYPE_AGE = 'AGE';
|
|
25
25
|
const NUMERIC_VALUE_TYPES = [VALUE_TYPE_NUMBER, VALUE_TYPE_UNIT_INTERVAL, VALUE_TYPE_PERCENTAGE, VALUE_TYPE_INTEGER, VALUE_TYPE_INTEGER_POSITIVE, VALUE_TYPE_INTEGER_NEGATIVE, VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE];
|
|
26
|
-
|
|
26
|
+
const BOOLEAN_VALUE_TYPES = [VALUE_TYPE_BOOLEAN, VALUE_TYPE_TRUE_ONLY];
|
|
27
|
+
export const isNumericValueType = type => NUMERIC_VALUE_TYPES.includes(type);
|
|
28
|
+
export const isBooleanValueType = type => BOOLEAN_VALUE_TYPES.includes(type);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2/analytics",
|
|
3
|
-
"version": "24.10.
|
|
3
|
+
"version": "24.10.13",
|
|
4
4
|
"main": "./build/cjs/index.js",
|
|
5
5
|
"module": "./build/es/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@dhis2/d2-ui-rich-text": "^7.4.0",
|
|
62
|
-
"@dhis2/multi-calendar-dates": "1.
|
|
62
|
+
"@dhis2/multi-calendar-dates": "^1.2.2",
|
|
63
63
|
"classnames": "^2.3.1",
|
|
64
64
|
"d2-utilizr": "^0.2.16",
|
|
65
65
|
"d3-color": "^1.2.3",
|