@dhis2/analytics 26.7.3 → 26.7.6
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/__tests__/__snapshots__/fixedPeriods.spec.js.snap +1602 -0
- package/build/cjs/components/PivotTable/PivotTableValueCell.js +1 -3
- package/build/cjs/components/PivotTable/styles/PivotTable.style.js +2 -2
- package/build/cjs/modules/renderValue.js +1 -1
- package/build/cjs/modules/valueTypes.js +5 -2
- package/build/es/components/PeriodDimension/__tests__/__snapshots__/fixedPeriods.spec.js.snap +1602 -0
- package/build/es/components/PivotTable/PivotTableValueCell.js +2 -4
- package/build/es/components/PivotTable/styles/PivotTable.style.js +2 -2
- 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';
|
|
@@ -33,9 +33,7 @@ export const PivotTableValueCell = _ref => {
|
|
|
33
33
|
classes: [cellContent.cellType, isClickable && 'clickable']
|
|
34
34
|
});
|
|
35
35
|
}
|
|
36
|
-
|
|
37
|
-
// TODO: Add support for 'INTEGER' type (requires server changes)
|
|
38
|
-
const legendStyle = cellContent.cellType === CELL_TYPE_VALUE && cellContent.valueType === VALUE_TYPE_NUMBER ? applyLegendSet(cellContent.rawValue, cellContent.dxDimension, engine) : undefined;
|
|
36
|
+
const legendStyle = cellContent.cellType === CELL_TYPE_VALUE && (isNumericValueType(cellContent.valueType) || isBooleanValueType(cellContent.valueType)) ? applyLegendSet(cellContent.rawValue, cellContent.dxDimension, engine) : undefined;
|
|
39
37
|
const width = engine.adaptiveClippingController.columns.sizes[engine.columnMap[column]].size;
|
|
40
38
|
const height = engine.adaptiveClippingController.rows.sizes[engine.rowMap[row]].size;
|
|
41
39
|
const style = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { colors } from '@dhis2/ui';
|
|
2
2
|
import { BORDER_COLOR, DISPLAY_DENSITY_PADDING_COMPACT, DISPLAY_DENSITY_PADDING_NORMAL, DISPLAY_DENSITY_PADDING_COMFORTABLE, FONT_SIZE_SMALL, FONT_SIZE_NORMAL, FONT_SIZE_LARGE } from '../../../modules/pivotTable/pivotTableConstants.js';
|
|
3
|
-
export const table = [`div.pivot-table-container{font-family:'Roboto',Arial,sans-serif;overflow:auto;color:${colors.grey900};}`, `table{border-spacing:0;white-space:nowrap;box-sizing:border-box;text-align:center;border:1px solid ${BORDER_COLOR};border-width:1px 1px 0 0;}`, "table.fixed-headers{border-width:0 0 0 1px;}", "table.fixed-headers tr th,table.fixed-headers tr td{border-width:0 1px 1px 0;}", "table.fixed-column-headers{border-width:0 1px 0 0;}", "table.fixed-column-headers tr th,table.fixed-column-headers tr td{border-width:0 0 1px 1px;}", `table.fixed-headers thead tr:first-of-type th,table.fixed-column-headers thead tr:first-of-type th{border-top:1px solid ${BORDER_COLOR};}`, "table.fixed-row-headers{border-width:0 0 1px 1px;}", "table.fixed-row-headers tr th,table.fixed-row-headers tr td{border-width:1px 1px 0 0;}"];
|
|
4
|
-
table.__hash = "
|
|
3
|
+
export const table = [`div.pivot-table-container.jsx-3572446209{font-family:'Roboto',Arial,sans-serif;overflow:auto;color:${colors.grey900};}`, `div.pivot-table-container.jsx-3572446209 table{border-spacing:0;white-space:nowrap;box-sizing:border-box;text-align:center;border:1px solid ${BORDER_COLOR};border-width:1px 1px 0 0;}`, "div.pivot-table-container.jsx-3572446209 table.fixed-headers{border-width:0 0 0 1px;}", "div.pivot-table-container.jsx-3572446209 table.fixed-headers tr th,div.pivot-table-container.jsx-3572446209 table.fixed-headers tr td{border-width:0 1px 1px 0;}", "div.pivot-table-container.jsx-3572446209 table.fixed-column-headers{border-width:0 1px 0 0;}", "div.pivot-table-container.jsx-3572446209 table.fixed-column-headers tr th,div.pivot-table-container.jsx-3572446209 table.fixed-column-headers tr td{border-width:0 0 1px 1px;}", `div.pivot-table-container.jsx-3572446209 table.fixed-headers thead tr:first-of-type th,div.pivot-table-container.jsx-3572446209 table.fixed-column-headers thead tr:first-of-type th{border-top:1px solid ${BORDER_COLOR};}`, "div.pivot-table-container.jsx-3572446209 table.fixed-row-headers{border-width:0 0 1px 1px;}", "div.pivot-table-container.jsx-3572446209 table.fixed-row-headers tr th,div.pivot-table-container.jsx-3572446209 table.fixed-row-headers tr td{border-width:1px 1px 0 0;}"];
|
|
4
|
+
table.__hash = "3572446209";
|
|
5
5
|
export const cell = [`td.jsx-3234356038,th.jsx-3234356038{box-sizing:border-box;font-weight:normal;overflow:hidden;text-overflow:ellipsis;border:1px solid ${BORDER_COLOR};border-width:0 0 1px 1px;cursor:default;}`, "th.fixed-header.jsx-3234356038{position:-webkit-sticky;position:sticky;z-index:1;top:0;left:0;}", `.fontsize-SMALL.jsx-3234356038{font-size:${FONT_SIZE_SMALL}px;line-height:${FONT_SIZE_SMALL}px;}`, `.fontsize-NORMAL.jsx-3234356038{font-size:${FONT_SIZE_NORMAL}px;line-height:${FONT_SIZE_NORMAL}px;}`, `.fontsize-LARGE.jsx-3234356038{font-size:${FONT_SIZE_LARGE}px;line-height:${FONT_SIZE_LARGE}px;}`, `.displaydensity-COMPACT.jsx-3234356038{padding:${DISPLAY_DENSITY_PADDING_COMPACT}px;}`, `.displaydensity-NORMAL.jsx-3234356038{padding:${DISPLAY_DENSITY_PADDING_NORMAL}px;}`, `.displaydensity-COMFORTABLE.jsx-3234356038{padding:${DISPLAY_DENSITY_PADDING_COMFORTABLE}px;}`, ".column-header.jsx-3234356038{background-color:#dae6f8;}", "div.column-header-inner.jsx-3234356038{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}", ".title-cell.jsx-3234356038{font-weight:bold;background-color:#cddaed;padding:0;}", ".title-cell-content.jsx-3234356038{text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}", `.title-cell.displaydensity-COMPACT.jsx-3234356038>.title-cell-content.jsx-3234356038{padding:${DISPLAY_DENSITY_PADDING_COMPACT}px;}`, `.title-cell.displaydensity-NORMAL.jsx-3234356038>.title-cell-content.jsx-3234356038{padding:${DISPLAY_DENSITY_PADDING_NORMAL}px;}`, `.title-cell.displaydensity-COMFORTABLE.jsx-3234356038>.title-cell-content.jsx-3234356038{padding:${DISPLAY_DENSITY_PADDING_COMFORTABLE}px;}`, ".row-header.jsx-3234356038{background-color:#dae6f8;}", ".row-header-hierarchy.jsx-3234356038{text-align:left;}", ".empty-header.jsx-3234356038{background-color:#cddaed;}", ".total-header.jsx-3234356038{background-color:#bac6d8;}", ".value.jsx-3234356038{background-color:#ffffff;text-align:left;}", ".NUMBER.jsx-3234356038,.INTEGER.jsx-3234356038,.INTEGER_POSITIVE.jsx-3234356038,.INTEGER_NEGATIVE.jsx-3234356038,.INTEGER_ZERO_OR_POSITIVE.jsx-3234356038,.UNIT_INTERVAL.jsx-3234356038,.PERCENTAGE.jsx-3234356038,.BOOLEAN.jsx-3234356038,.TRUE_ONLY.jsx-3234356038{text-align:right;}", ".clickable.jsx-3234356038{cursor:pointer;}", ".value.jsx-3234356038:hover{background-color:#f3f3f3;}", ".subtotal.jsx-3234356038{background-color:#f4f4f4;}", ".total.jsx-3234356038{background-color:#d8d8d8;}", ".column-header-label.jsx-3234356038{overflow:hidden;text-overflow:ellipsis;}"];
|
|
6
6
|
cell.__hash = "3234356038";
|
|
7
7
|
export const sortIcon = [`.fontsize-SMALL.jsx-2877616992{height:${FONT_SIZE_SMALL}px;margin-bottom:1px;margin-left:5px;}`, `.fontsize-NORMAL.jsx-2877616992{height:${FONT_SIZE_NORMAL}px;max-height:11px;margin-bottom:2px;margin-left:6px;}`, `.fontsize-LARGE.jsx-2877616992{height:${FONT_SIZE_LARGE}px;margin-bottom:2px;margin-left:7px;}`];
|
|
@@ -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
|
const trimTrailingZeros = stringValue => stringValue.replace(/\.?0+$/, '');
|
|
4
4
|
export const separateDigitGroups = function (stringValue) {
|
|
5
5
|
let decimalSeparator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '.';
|
|
@@ -40,7 +40,7 @@ const toFixedPrecisionString = (value, skipRounding) => {
|
|
|
40
40
|
return value.toFixed(precision);
|
|
41
41
|
};
|
|
42
42
|
export const renderValue = (value, valueType, visualization) => {
|
|
43
|
-
if (!isNumericValueType(valueType) || value === undefined) {
|
|
43
|
+
if (!(isNumericValueType(valueType) || isBooleanValueType(valueType)) || value === undefined) {
|
|
44
44
|
return String(value).replace(/[^\S\n]+/, ' ');
|
|
45
45
|
}
|
|
46
46
|
if (visualization.numberType === NUMBER_TYPE_ROW_PERCENTAGE || visualization.numberType === NUMBER_TYPE_COLUMN_PERCENTAGE) {
|
|
@@ -24,4 +24,6 @@ export const VALUE_TYPE_DATETIME = 'DATETIME';
|
|
|
24
24
|
export const VALUE_TYPE_ORGANISATION_UNIT = 'ORGANISATION_UNIT';
|
|
25
25
|
export const VALUE_TYPE_AGE = 'AGE';
|
|
26
26
|
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];
|
|
27
|
-
|
|
27
|
+
const BOOLEAN_VALUE_TYPES = [VALUE_TYPE_BOOLEAN, VALUE_TYPE_TRUE_ONLY];
|
|
28
|
+
export const isNumericValueType = type => NUMERIC_VALUE_TYPES.includes(type);
|
|
29
|
+
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": "26.7.
|
|
3
|
+
"version": "26.7.6",
|
|
4
4
|
"main": "./build/cjs/index.js",
|
|
5
5
|
"module": "./build/es/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"styled-jsx": "^4.0.1"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@dhis2/multi-calendar-dates": "1.
|
|
62
|
+
"@dhis2/multi-calendar-dates": "^1.2.2",
|
|
63
63
|
"@dnd-kit/core": "^6.0.7",
|
|
64
64
|
"@dnd-kit/sortable": "^7.0.2",
|
|
65
65
|
"@dnd-kit/utilities": "^3.2.1",
|