@dhis2/analytics 26.8.5 → 26.8.7
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/PivotTable/PivotTableValueCell.js +6 -2
- package/build/cjs/components/PivotTable/styles/PivotTable.style.js +2 -2
- package/build/cjs/locales/en/translations.json +2 -0
- package/build/cjs/locales/zh/translations.json +32 -30
- package/build/cjs/modules/pivotTable/PivotTableEngine.js +59 -24
- package/build/cjs/modules/pivotTable/pivotTableConstants.js +6 -2
- package/build/cjs/modules/valueTypes.js +4 -1
- package/build/es/components/PivotTable/PivotTableValueCell.js +6 -2
- package/build/es/components/PivotTable/styles/PivotTable.style.js +2 -2
- package/build/es/locales/en/translations.json +2 -0
- package/build/es/locales/zh/translations.json +32 -30
- package/build/es/modules/pivotTable/PivotTableEngine.js +61 -26
- package/build/es/modules/pivotTable/pivotTableConstants.js +4 -1
- package/build/es/modules/valueTypes.js +2 -0
- package/package.json +1 -2
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.PivotTableValueCell = void 0;
|
|
7
|
+
var _d2I18n = _interopRequireDefault(require("@dhis2/d2-i18n"));
|
|
7
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
10
|
var _applyLegendSet = require("../../modules/pivotTable/applyLegendSet.js");
|
|
@@ -16,7 +17,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
16
17
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
17
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
18
19
|
const PivotTableValueCell = _ref => {
|
|
19
|
-
var _cellContent$rendered;
|
|
20
|
+
var _cellContent$titleVal, _cellContent$rendered;
|
|
20
21
|
let {
|
|
21
22
|
row,
|
|
22
23
|
column,
|
|
@@ -54,7 +55,10 @@ const PivotTableValueCell = _ref => {
|
|
|
54
55
|
return /*#__PURE__*/_react.default.createElement(_PivotTableCell.PivotTableCell, {
|
|
55
56
|
key: column,
|
|
56
57
|
classes: classes,
|
|
57
|
-
title: cellContent.
|
|
58
|
+
title: (_cellContent$titleVal = cellContent.titleValue) !== null && _cellContent$titleVal !== void 0 ? _cellContent$titleVal : _d2I18n.default.t('Value: {{value}}', {
|
|
59
|
+
value: cellContent.renderedValue,
|
|
60
|
+
nsSeparator: '^^'
|
|
61
|
+
}),
|
|
58
62
|
style: style,
|
|
59
63
|
onClick: isClickable ? onClick : undefined,
|
|
60
64
|
ref: cellRef,
|
|
@@ -9,9 +9,9 @@ var _pivotTableConstants = require("../../../modules/pivotTable/pivotTableConsta
|
|
|
9
9
|
const table = [`div.pivot-table-container.jsx-3572446209{font-family:'Roboto',Arial,sans-serif;overflow:auto;color:${_ui.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 ${_pivotTableConstants.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 ${_pivotTableConstants.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;}"];
|
|
10
10
|
exports.table = table;
|
|
11
11
|
table.__hash = "3572446209";
|
|
12
|
-
const cell = [`td.jsx-
|
|
12
|
+
const cell = [`td.jsx-2444037071,th.jsx-2444037071{box-sizing:border-box;font-weight:normal;overflow:hidden;text-overflow:ellipsis;border:1px solid ${_pivotTableConstants.BORDER_COLOR};border-width:0 0 1px 1px;cursor:default;}`, "th.fixed-header.jsx-2444037071{position:-webkit-sticky;position:sticky;z-index:1;top:0;left:0;}", `.fontsize-SMALL.jsx-2444037071{font-size:${_pivotTableConstants.FONT_SIZE_SMALL}px;line-height:${_pivotTableConstants.FONT_SIZE_SMALL}px;}`, `.fontsize-NORMAL.jsx-2444037071{font-size:${_pivotTableConstants.FONT_SIZE_NORMAL}px;line-height:${_pivotTableConstants.FONT_SIZE_NORMAL}px;}`, `.fontsize-LARGE.jsx-2444037071{font-size:${_pivotTableConstants.FONT_SIZE_LARGE}px;line-height:${_pivotTableConstants.FONT_SIZE_LARGE}px;}`, `.displaydensity-COMPACT.jsx-2444037071{padding:${_pivotTableConstants.DISPLAY_DENSITY_PADDING_COMPACT}px;}`, `.displaydensity-NORMAL.jsx-2444037071{padding:${_pivotTableConstants.DISPLAY_DENSITY_PADDING_NORMAL}px;}`, `.displaydensity-COMFORTABLE.jsx-2444037071{padding:${_pivotTableConstants.DISPLAY_DENSITY_PADDING_COMFORTABLE}px;}`, ".column-header.jsx-2444037071{background-color:#dae6f8;}", "div.column-header-inner.jsx-2444037071{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-2444037071{font-weight:bold;background-color:#cddaed;padding:0;}", ".title-cell-content.jsx-2444037071{text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}", `.title-cell.displaydensity-COMPACT.jsx-2444037071>.title-cell-content.jsx-2444037071{padding:${_pivotTableConstants.DISPLAY_DENSITY_PADDING_COMPACT}px;}`, `.title-cell.displaydensity-NORMAL.jsx-2444037071>.title-cell-content.jsx-2444037071{padding:${_pivotTableConstants.DISPLAY_DENSITY_PADDING_NORMAL}px;}`, `.title-cell.displaydensity-COMFORTABLE.jsx-2444037071>.title-cell-content.jsx-2444037071{padding:${_pivotTableConstants.DISPLAY_DENSITY_PADDING_COMFORTABLE}px;}`, ".row-header.jsx-2444037071{background-color:#dae6f8;}", ".row-header-hierarchy.jsx-2444037071{text-align:left;}", ".empty-header.jsx-2444037071{background-color:#cddaed;}", ".total-header.jsx-2444037071{background-color:#bac6d8;}", ".value.jsx-2444037071{background-color:#ffffff;text-align:left;}", ".NUMBER.jsx-2444037071,.INTEGER.jsx-2444037071,.INTEGER_POSITIVE.jsx-2444037071,.INTEGER_NEGATIVE.jsx-2444037071,.INTEGER_ZERO_OR_POSITIVE.jsx-2444037071,.UNIT_INTERVAL.jsx-2444037071,.PERCENTAGE.jsx-2444037071,.BOOLEAN.jsx-2444037071,.TRUE_ONLY.jsx-2444037071{text-align:right;}", `.N_A.jsx-2444037071{text-align:center;color:${_ui.colors.grey600};}`, ".clickable.jsx-2444037071{cursor:pointer;}", ".value.jsx-2444037071:hover{background-color:#f3f3f3;}", ".subtotal.jsx-2444037071{background-color:#f4f4f4;}", ".total.jsx-2444037071{background-color:#d8d8d8;}", ".column-header-label.jsx-2444037071{overflow:hidden;text-overflow:ellipsis;}"];
|
|
13
13
|
exports.cell = cell;
|
|
14
|
-
cell.__hash = "
|
|
14
|
+
cell.__hash = "2444037071";
|
|
15
15
|
const sortIcon = [`.fontsize-SMALL.jsx-2877616992{height:${_pivotTableConstants.FONT_SIZE_SMALL}px;margin-bottom:1px;margin-left:5px;}`, `.fontsize-NORMAL.jsx-2877616992{height:${_pivotTableConstants.FONT_SIZE_NORMAL}px;max-height:11px;margin-bottom:2px;margin-left:6px;}`, `.fontsize-LARGE.jsx-2877616992{height:${_pivotTableConstants.FONT_SIZE_LARGE}px;margin-bottom:2px;margin-left:7px;}`];
|
|
16
16
|
exports.sortIcon = sortIcon;
|
|
17
17
|
sortIcon.__hash = "2877616992";
|
|
@@ -267,6 +267,7 @@
|
|
|
267
267
|
"Six-months": "Six-months",
|
|
268
268
|
"Financial Years": "Financial Years",
|
|
269
269
|
"Years": "Years",
|
|
270
|
+
"Value: {{value}}": "Value: {{value}}",
|
|
270
271
|
"Bold text": "Bold text",
|
|
271
272
|
"Italic text": "Italic text",
|
|
272
273
|
"Link to a URL": "Link to a URL",
|
|
@@ -357,6 +358,7 @@
|
|
|
357
358
|
"{{thresholdFactor}} × Modified Z-score high": "{{thresholdFactor}} × Modified Z-score high",
|
|
358
359
|
"{{thresholdFactor}} × Z-score low": "{{thresholdFactor}} × Z-score low",
|
|
359
360
|
"{{thresholdFactor}} × Z-score high": "{{thresholdFactor}} × Z-score high",
|
|
361
|
+
"Not applicable": "Not applicable",
|
|
360
362
|
"Data": "Data",
|
|
361
363
|
"Organisation unit": "Organisation unit",
|
|
362
364
|
"Assigned Categories": "Assigned Categories",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"Last updated {{time}}": "最后更新 {{time}}",
|
|
10
10
|
"Created {{time}} by {{author}}": "由 {{author}} 在 {{time}} 创建",
|
|
11
11
|
"Created {{time}}": "已创建 {{time}}",
|
|
12
|
-
"Viewed {{count}} times": "查看了 {{count}}
|
|
12
|
+
"Viewed {{count}} times": "查看了 {{count}} 条",
|
|
13
13
|
"Notifications": "通知",
|
|
14
14
|
"You're subscribed and getting updates about new interpretations.": "您已订阅并获取有关新解释的更新。",
|
|
15
15
|
"Unsubscribe": "退订",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"About this map": "关于该地图",
|
|
19
19
|
"About this line list": "关于此行列表",
|
|
20
20
|
"About this visualization": "关于此可视化",
|
|
21
|
+
"About this event chart": "关于该事件图表",
|
|
22
|
+
"About this event report": "关于本事件报表",
|
|
21
23
|
"This app could not retrieve required data.": "此应用无法检索所需数据。",
|
|
22
24
|
"Network error": "网络错误",
|
|
23
25
|
"Data / Edit calculation": "数据/编辑计算",
|
|
@@ -33,7 +35,7 @@
|
|
|
33
35
|
"Save calculation": "保存计算",
|
|
34
36
|
"Are you sure you want to delete this calculation? It may be used by other visualizations.": "您确定要删除此计算吗?它可以被其他可视化使用。",
|
|
35
37
|
"Yes, delete": "是的,删除",
|
|
36
|
-
"Totals only": "
|
|
38
|
+
"Totals only": "仅总数",
|
|
37
39
|
"Details only": "仅详细信息",
|
|
38
40
|
"Loading": "载入",
|
|
39
41
|
"Data elements": "数据元",
|
|
@@ -132,17 +134,6 @@
|
|
|
132
134
|
"Manage sharing": "管理共享",
|
|
133
135
|
"Could not update interpretation": "无法更新解释",
|
|
134
136
|
"Enter interpretation text": "输入解释文本",
|
|
135
|
-
"Bold text": "粗体文字",
|
|
136
|
-
"Italic text": "斜体文字",
|
|
137
|
-
"Link to a URL": "链接到 URL",
|
|
138
|
-
"Mention a user": "提及用户",
|
|
139
|
-
"Add emoji": "添加表情符号",
|
|
140
|
-
"Preview": "预览",
|
|
141
|
-
"Back to write mode": "返回写入模式",
|
|
142
|
-
"Too many results. Try refining the search.": "结果太多。尝试优化搜索。",
|
|
143
|
-
"Search for a user": "搜索用户",
|
|
144
|
-
"Searching for \"{{- searchText}}\"": "搜索“{{- searchText}}”",
|
|
145
|
-
"No results found": "没有结果",
|
|
146
137
|
"Not available offline": "离线不可用",
|
|
147
138
|
"Created by": "创建人",
|
|
148
139
|
"Anyone": "任何人",
|
|
@@ -217,9 +208,9 @@
|
|
|
217
208
|
"Six-monthly April": "半年四月",
|
|
218
209
|
"Yearly": "每年",
|
|
219
210
|
"Financial year (Start November)": "财政年(11月始)",
|
|
220
|
-
"Financial year (Start October)": "
|
|
221
|
-
"Financial year (Start July)": "
|
|
222
|
-
"Financial year (Start April)": "
|
|
211
|
+
"Financial year (Start October)": "财政年度(10 月开始)",
|
|
212
|
+
"Financial year (Start July)": "财政年度(7 月开始)",
|
|
213
|
+
"Financial year (Start April)": "财政年度(4 月开始)",
|
|
223
214
|
"Today": "今天",
|
|
224
215
|
"Yesterday": "昨天",
|
|
225
216
|
"Last 3 days": "Last 3 days",
|
|
@@ -231,33 +222,33 @@
|
|
|
231
222
|
"Last 180 days": "最近180天",
|
|
232
223
|
"This week": "本年",
|
|
233
224
|
"Last week": "上周",
|
|
234
|
-
"Last 4 weeks": "
|
|
235
|
-
"Last 12 weeks": "最近12周",
|
|
236
|
-
"Last 52 weeks": "
|
|
237
|
-
"Weeks this year": "
|
|
225
|
+
"Last 4 weeks": "最近 4 周",
|
|
226
|
+
"Last 12 weeks": "最近 12 周",
|
|
227
|
+
"Last 52 weeks": "最近52 周",
|
|
228
|
+
"Weeks this year": "今年的周",
|
|
238
229
|
"This bi-week": "本双周",
|
|
239
230
|
"Last bi-week": "最近两周",
|
|
240
231
|
"Last 4 bi-weeks": "最近4个两周",
|
|
241
232
|
"This month": "本月",
|
|
242
233
|
"Last month": "上月",
|
|
243
234
|
"Last 3 months": "最近3个月",
|
|
244
|
-
"Last 6 months": "
|
|
235
|
+
"Last 6 months": "最近 6 个月",
|
|
245
236
|
"Last 12 months": "最近12月",
|
|
246
237
|
"Months this year": "今年的月份",
|
|
247
238
|
"This bi-month": "本双月",
|
|
248
|
-
"Last bi-month": "
|
|
249
|
-
"Last 6 bi-months": "
|
|
250
|
-
"Bi-months this year": "
|
|
239
|
+
"Last bi-month": "上两个月",
|
|
240
|
+
"Last 6 bi-months": "最近 6 个双月",
|
|
241
|
+
"Bi-months this year": "今年的双月",
|
|
251
242
|
"This quarter": "本季度",
|
|
252
243
|
"Last quarter": "最近一季",
|
|
253
|
-
"Last 4 quarters": "
|
|
244
|
+
"Last 4 quarters": "最近 4 个季度",
|
|
254
245
|
"Quarters this year": "今年的季度",
|
|
255
246
|
"This six-month": "本六个月",
|
|
256
247
|
"Last six-month": "最近六个月",
|
|
257
248
|
"Last 2 six-month": "最近2个六个月",
|
|
258
249
|
"This financial year": "本财年",
|
|
259
250
|
"Last financial year": "上一财政年",
|
|
260
|
-
"Last 5 financial years": "
|
|
251
|
+
"Last 5 financial years": "最近 5 个财政年度",
|
|
261
252
|
"This year": "今年",
|
|
262
253
|
"Last year": "去年",
|
|
263
254
|
"Last 5 years": "最近5年",
|
|
@@ -266,11 +257,18 @@
|
|
|
266
257
|
"Weeks": "星期",
|
|
267
258
|
"Bi-weeks": "双周",
|
|
268
259
|
"Months": "月",
|
|
269
|
-
"Bi-months": "
|
|
260
|
+
"Bi-months": "双月",
|
|
270
261
|
"Quarters": "四分之一",
|
|
271
|
-
"Six-months": "
|
|
272
|
-
"Financial Years": "
|
|
262
|
+
"Six-months": "六个月",
|
|
263
|
+
"Financial Years": "财政年度",
|
|
273
264
|
"Years": "年",
|
|
265
|
+
"Bold text": "粗体文字",
|
|
266
|
+
"Italic text": "斜体文字",
|
|
267
|
+
"Link to a URL": "链接到 URL",
|
|
268
|
+
"Mention a user": "提及用户",
|
|
269
|
+
"Add emoji": "添加表情符号",
|
|
270
|
+
"Preview": "预览",
|
|
271
|
+
"Back to write mode": "返回写入模式",
|
|
274
272
|
"Interpretations and details": "解释和细节",
|
|
275
273
|
"Translating to": "翻译成",
|
|
276
274
|
"Choose a locale": "选择语言环境",
|
|
@@ -281,6 +279,10 @@
|
|
|
281
279
|
"Cannot save while offline": "离线时无法保存",
|
|
282
280
|
"Could not load translations": "无法加载翻译",
|
|
283
281
|
"Retry": "重试",
|
|
282
|
+
"Too many results. Try refining the search.": "结果太多。尝试优化搜索。",
|
|
283
|
+
"Search for a user": "搜索用户",
|
|
284
|
+
"Searching for \"{{- searchText}}\"": "搜索“{{- searchText}}”",
|
|
285
|
+
"No results found": "没有结果",
|
|
284
286
|
"Series": "系列",
|
|
285
287
|
"Category": "分类",
|
|
286
288
|
"Filter": "过滤器",
|
|
@@ -367,7 +369,7 @@
|
|
|
367
369
|
"Year over year (line)": "逐年(折线图)",
|
|
368
370
|
"Pie": "饼图",
|
|
369
371
|
"Radar": "雷达图",
|
|
370
|
-
"Scatter": "
|
|
372
|
+
"Scatter": "散点图",
|
|
371
373
|
"Single value": "单个值",
|
|
372
374
|
"Outlier table": "异常值表",
|
|
373
375
|
"All charts": "所有图表",
|
|
@@ -160,7 +160,7 @@ const applyTotalAggregationType = (_ref2, overrideTotalAggregationType) => {
|
|
|
160
160
|
} = _ref2;
|
|
161
161
|
switch (overrideTotalAggregationType || totalAggregationType) {
|
|
162
162
|
case _pivotTableConstants.AGGREGATE_TYPE_NA:
|
|
163
|
-
return
|
|
163
|
+
return _pivotTableConstants.VALUE_NA;
|
|
164
164
|
case _pivotTableConstants.AGGREGATE_TYPE_AVERAGE:
|
|
165
165
|
return (numerator || value) * multiplier / (denominator * divisor || 1);
|
|
166
166
|
case _pivotTableConstants.AGGREGATE_TYPE_SUM:
|
|
@@ -265,15 +265,29 @@ class PivotTableEngine {
|
|
|
265
265
|
rawCell.rawValue = rawValue;
|
|
266
266
|
rawCell.renderedValue = renderedValue;
|
|
267
267
|
}
|
|
268
|
+
if ([_pivotTableConstants.CELL_TYPE_TOTAL, _pivotTableConstants.CELL_TYPE_SUBTOTAL].includes(rawCell.cellType) && rawCell.rawValue === _pivotTableConstants.AGGREGATE_TYPE_NA) {
|
|
269
|
+
rawCell.titleValue = _d2I18n.default.t('Not applicable');
|
|
270
|
+
}
|
|
268
271
|
if (this.options.cumulativeValues) {
|
|
272
|
+
let titleValue;
|
|
273
|
+
if (this.data[row] && this.data[row][column]) {
|
|
274
|
+
const dataRow = this.data[row][column];
|
|
275
|
+
const rawValue = cellType === _pivotTableConstants.CELL_TYPE_VALUE ? dataRow[this.dimensionLookup.dataHeaders.value] : dataRow.value;
|
|
276
|
+
titleValue = _d2I18n.default.t('Value: {{value}}', {
|
|
277
|
+
value: (0, _renderValue.renderValue)(rawValue, valueType, this.visualization),
|
|
278
|
+
nsSeparator: '^^'
|
|
279
|
+
});
|
|
280
|
+
}
|
|
269
281
|
const cumulativeValue = this.getCumulative({
|
|
270
282
|
row,
|
|
271
283
|
column
|
|
272
284
|
});
|
|
273
285
|
if (cumulativeValue !== undefined && cumulativeValue !== null) {
|
|
274
|
-
// force to
|
|
275
|
-
|
|
286
|
+
// force to TEXT for N/A (accumulated) values
|
|
287
|
+
// force to NUMBER for accumulated values if no valueType present
|
|
288
|
+
rawCell.valueType = cumulativeValue === _pivotTableConstants.VALUE_NA ? _pivotTableConstants.VALUE_TYPE_NA : valueType === undefined || valueType === null ? _valueTypes.VALUE_TYPE_NUMBER : valueType;
|
|
276
289
|
rawCell.empty = false;
|
|
290
|
+
rawCell.titleValue = titleValue;
|
|
277
291
|
rawCell.rawValue = cumulativeValue;
|
|
278
292
|
rawCell.renderedValue = (0, _renderValue.renderValue)(cumulativeValue, valueType, this.visualization);
|
|
279
293
|
}
|
|
@@ -372,15 +386,12 @@ class PivotTableEngine {
|
|
|
372
386
|
return undefined;
|
|
373
387
|
}
|
|
374
388
|
const cellValue = this.data[row][column];
|
|
389
|
+
|
|
390
|
+
// empty cell
|
|
375
391
|
if (!cellValue) {
|
|
376
|
-
|
|
377
|
-
// The cell still needs to get the valueType to render correctly 0 and cumulative values
|
|
378
|
-
return {
|
|
379
|
-
valueType: _valueTypes.VALUE_TYPE_NUMBER,
|
|
380
|
-
totalAggregationType: _pivotTableConstants.AGGREGATE_TYPE_SUM
|
|
381
|
-
};
|
|
392
|
+
return undefined;
|
|
382
393
|
}
|
|
383
|
-
if (!Array.isArray(cellValue)) {
|
|
394
|
+
if (cellValue && !Array.isArray(cellValue)) {
|
|
384
395
|
// This is a total cell
|
|
385
396
|
return {
|
|
386
397
|
valueType: cellValue.valueType,
|
|
@@ -543,19 +554,26 @@ class PivotTableEngine {
|
|
|
543
554
|
} else {
|
|
544
555
|
totalCell.totalAggregationType = currentAggType;
|
|
545
556
|
}
|
|
546
|
-
|
|
557
|
+
|
|
558
|
+
// Force value type of total cells to NUMBER for value cells with numeric or boolean types.
|
|
559
|
+
// This is to simplify the code below where we compare the previous value type.
|
|
560
|
+
// All numeric/boolean value types use the same style for rendering the total cell (right aligned content)
|
|
561
|
+
// and using NUMBER for the total cell is enough for that.
|
|
562
|
+
// (see DHIS2-9155)
|
|
563
|
+
const currentValueType = (0, _valueTypes.isNumericValueType)(dxDimension === null || dxDimension === void 0 ? void 0 : dxDimension.valueType) || (0, _valueTypes.isBooleanValueType)(dxDimension === null || dxDimension === void 0 ? void 0 : dxDimension.valueType) ? _valueTypes.VALUE_TYPE_NUMBER : dxDimension === null || dxDimension === void 0 ? void 0 : dxDimension.valueType;
|
|
547
564
|
const previousValueType = totalCell.valueType;
|
|
548
565
|
if (previousValueType && currentValueType !== previousValueType) {
|
|
549
|
-
totalCell.valueType = _pivotTableConstants.
|
|
566
|
+
totalCell.valueType = _pivotTableConstants.VALUE_TYPE_NA;
|
|
550
567
|
} else {
|
|
551
568
|
totalCell.valueType = currentValueType;
|
|
552
569
|
}
|
|
553
570
|
|
|
554
|
-
//
|
|
555
|
-
//
|
|
571
|
+
// Compute totals for all numeric and boolean value types only.
|
|
572
|
+
// In practice valueType here is NUMBER (see the comment above).
|
|
573
|
+
// When is not, it means there is some value cell with a valueType other than numeric/boolean,
|
|
574
|
+
// the total should not be computed then.
|
|
556
575
|
// (see DHIS2-9155)
|
|
557
|
-
if ((0, _valueTypes.isNumericValueType)(
|
|
558
|
-
totalCell.valueType = _valueTypes.VALUE_TYPE_NUMBER;
|
|
576
|
+
if ((0, _valueTypes.isNumericValueType)(totalCell.valueType)) {
|
|
559
577
|
dataFields.forEach(field => {
|
|
560
578
|
const headerIndex = this.dimensionLookup.dataHeaders[field];
|
|
561
579
|
const value = (0, _parseValue.parseValue)(dataRow[headerIndex]);
|
|
@@ -649,6 +667,17 @@ class PivotTableEngine {
|
|
|
649
667
|
}
|
|
650
668
|
}
|
|
651
669
|
}
|
|
670
|
+
computeOverrideTotalAggregationType(totalCell, visualization) {
|
|
671
|
+
// Avoid undefined on total cells with valueTypes that cannot be totalized.
|
|
672
|
+
// This happens for example when a column/row has all value cells of type TEXT.
|
|
673
|
+
if (!((0, _valueTypes.isNumericValueType)(totalCell.valueType) || (0, _valueTypes.isBooleanValueType)(totalCell.valueType))) {
|
|
674
|
+
return _pivotTableConstants.AGGREGATE_TYPE_NA;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// DHIS2-15698: do not override total aggregation type when numberType option is not present
|
|
678
|
+
// (numberType option default is VALUE)
|
|
679
|
+
return visualization.numberType && visualization.numberType !== _pivotTableConstants.NUMBER_TYPE_VALUE && _pivotTableConstants.AGGREGATE_TYPE_SUM;
|
|
680
|
+
}
|
|
652
681
|
finalizeTotal(_ref11) {
|
|
653
682
|
let {
|
|
654
683
|
row,
|
|
@@ -659,10 +688,12 @@ class PivotTableEngine {
|
|
|
659
688
|
}
|
|
660
689
|
const totalCell = this.data[row][column];
|
|
661
690
|
if (totalCell && totalCell.count) {
|
|
662
|
-
totalCell.value = applyTotalAggregationType(totalCell,
|
|
663
|
-
|
|
664
|
-
//
|
|
665
|
-
|
|
691
|
+
totalCell.value = applyTotalAggregationType(totalCell, this.computeOverrideTotalAggregationType(totalCell, this.visualization));
|
|
692
|
+
|
|
693
|
+
// override valueType for styling cells with N/A value
|
|
694
|
+
if (totalCell.value === _pivotTableConstants.AGGREGATE_TYPE_NA) {
|
|
695
|
+
totalCell.valueType = _pivotTableConstants.VALUE_TYPE_NA;
|
|
696
|
+
}
|
|
666
697
|
this.adaptiveClippingController.add({
|
|
667
698
|
row,
|
|
668
699
|
column
|
|
@@ -763,10 +794,14 @@ class PivotTableEngine {
|
|
|
763
794
|
column
|
|
764
795
|
});
|
|
765
796
|
const valueType = (dxDimension === null || dxDimension === void 0 ? void 0 : dxDimension.valueType) || _valueTypes.VALUE_TYPE_TEXT;
|
|
797
|
+
const totalAggregationType = dxDimension === null || dxDimension === void 0 ? void 0 : dxDimension.totalAggregationType;
|
|
766
798
|
|
|
767
|
-
// only accumulate numeric values
|
|
768
|
-
// accumulating text values does not make sense
|
|
769
|
-
if (valueType ===
|
|
799
|
+
// only accumulate numeric (except for PERCENTAGE and UNIT_INTERVAL) and boolean values
|
|
800
|
+
// accumulating other value types like text values does not make sense
|
|
801
|
+
if ((0, _valueTypes.isCumulativeValueType)(valueType) && totalAggregationType === _pivotTableConstants.AGGREGATE_TYPE_SUM) {
|
|
802
|
+
// initialise to 0 for cumulative types
|
|
803
|
+
// (||= is not transformed correctly in Babel with the current setup)
|
|
804
|
+
acc || (acc = 0);
|
|
770
805
|
if (this.data[row] && this.data[row][column]) {
|
|
771
806
|
const dataRow = this.data[row][column];
|
|
772
807
|
const rawValue = cellType === _pivotTableConstants.CELL_TYPE_VALUE ? dataRow[this.dimensionLookup.dataHeaders.value] : dataRow.value;
|
|
@@ -775,7 +810,7 @@ class PivotTableEngine {
|
|
|
775
810
|
this.accumulators.rows[row][column] = acc;
|
|
776
811
|
}
|
|
777
812
|
return acc;
|
|
778
|
-
},
|
|
813
|
+
}, '');
|
|
779
814
|
});
|
|
780
815
|
} else {
|
|
781
816
|
this.accumulators = {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.WRAPPED_TEXT_LINE_HEIGHT = exports.WRAPPED_TEXT_JUSTIFY_BUFFER = exports.SORT_ORDER_DESCENDING = exports.SORT_ORDER_ASCENDING = exports.NUMBER_TYPE_VALUE = exports.NUMBER_TYPE_ROW_PERCENTAGE = exports.NUMBER_TYPE_COLUMN_PERCENTAGE = exports.FONT_SIZE_SMALL = exports.FONT_SIZE_OPTION_SMALL = exports.FONT_SIZE_OPTION_NORMAL = exports.FONT_SIZE_OPTION_LARGE = exports.FONT_SIZE_NORMAL = exports.FONT_SIZE_LARGE = exports.DISPLAY_DENSITY_PADDING_NORMAL = exports.DISPLAY_DENSITY_PADDING_COMPACT = exports.DISPLAY_DENSITY_PADDING_COMFORTABLE = exports.DISPLAY_DENSITY_OPTION_NORMAL = exports.DISPLAY_DENSITY_OPTION_COMPACT = exports.DISPLAY_DENSITY_OPTION_COMFORTABLE = exports.CLIPPED_CELL_MIN_SIZE = exports.CLIPPED_CELL_MAX_SIZE = exports.CLIPPED_AXIS_PARTITION_SIZE_PX = exports.CELL_TYPE_VALUE = exports.CELL_TYPE_TOTAL = exports.CELL_TYPE_SUBTOTAL = exports.BORDER_COLOR = exports.AGGREGATE_TYPE_SUM = exports.AGGREGATE_TYPE_NA = exports.AGGREGATE_TYPE_AVERAGE = void 0;
|
|
6
|
+
exports.WRAPPED_TEXT_LINE_HEIGHT = exports.WRAPPED_TEXT_JUSTIFY_BUFFER = exports.VALUE_TYPE_NA = exports.VALUE_NA = exports.SORT_ORDER_DESCENDING = exports.SORT_ORDER_ASCENDING = exports.NUMBER_TYPE_VALUE = exports.NUMBER_TYPE_ROW_PERCENTAGE = exports.NUMBER_TYPE_COLUMN_PERCENTAGE = exports.FONT_SIZE_SMALL = exports.FONT_SIZE_OPTION_SMALL = exports.FONT_SIZE_OPTION_NORMAL = exports.FONT_SIZE_OPTION_LARGE = exports.FONT_SIZE_NORMAL = exports.FONT_SIZE_LARGE = exports.DISPLAY_DENSITY_PADDING_NORMAL = exports.DISPLAY_DENSITY_PADDING_COMPACT = exports.DISPLAY_DENSITY_PADDING_COMFORTABLE = exports.DISPLAY_DENSITY_OPTION_NORMAL = exports.DISPLAY_DENSITY_OPTION_COMPACT = exports.DISPLAY_DENSITY_OPTION_COMFORTABLE = exports.CLIPPED_CELL_MIN_SIZE = exports.CLIPPED_CELL_MAX_SIZE = exports.CLIPPED_AXIS_PARTITION_SIZE_PX = exports.CELL_TYPE_VALUE = exports.CELL_TYPE_TOTAL = exports.CELL_TYPE_SUBTOTAL = exports.BORDER_COLOR = exports.AGGREGATE_TYPE_SUM = exports.AGGREGATE_TYPE_NA = exports.AGGREGATE_TYPE_AVERAGE = void 0;
|
|
7
7
|
const SORT_ORDER_ASCENDING = 1;
|
|
8
8
|
exports.SORT_ORDER_ASCENDING = SORT_ORDER_ASCENDING;
|
|
9
9
|
const SORT_ORDER_DESCENDING = -1;
|
|
@@ -20,6 +20,8 @@ const AGGREGATE_TYPE_AVERAGE = 'AVERAGE';
|
|
|
20
20
|
exports.AGGREGATE_TYPE_AVERAGE = AGGREGATE_TYPE_AVERAGE;
|
|
21
21
|
const AGGREGATE_TYPE_NA = 'N/A';
|
|
22
22
|
exports.AGGREGATE_TYPE_NA = AGGREGATE_TYPE_NA;
|
|
23
|
+
const VALUE_TYPE_NA = 'N_A'; // this ends up as CSS class and / is problematic
|
|
24
|
+
exports.VALUE_TYPE_NA = VALUE_TYPE_NA;
|
|
23
25
|
const NUMBER_TYPE_VALUE = 'VALUE';
|
|
24
26
|
exports.NUMBER_TYPE_VALUE = NUMBER_TYPE_VALUE;
|
|
25
27
|
const NUMBER_TYPE_ROW_PERCENTAGE = 'ROW_PERCENTAGE';
|
|
@@ -61,4 +63,6 @@ exports.WRAPPED_TEXT_JUSTIFY_BUFFER = WRAPPED_TEXT_JUSTIFY_BUFFER;
|
|
|
61
63
|
const WRAPPED_TEXT_LINE_HEIGHT = 1.0;
|
|
62
64
|
exports.WRAPPED_TEXT_LINE_HEIGHT = WRAPPED_TEXT_LINE_HEIGHT;
|
|
63
65
|
const CLIPPED_AXIS_PARTITION_SIZE_PX = 1000;
|
|
64
|
-
exports.CLIPPED_AXIS_PARTITION_SIZE_PX = CLIPPED_AXIS_PARTITION_SIZE_PX;
|
|
66
|
+
exports.CLIPPED_AXIS_PARTITION_SIZE_PX = CLIPPED_AXIS_PARTITION_SIZE_PX;
|
|
67
|
+
const VALUE_NA = 'N/A';
|
|
68
|
+
exports.VALUE_NA = VALUE_NA;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isNumericValueType = exports.isBooleanValueType = exports.VALUE_TYPE_USERNAME = exports.VALUE_TYPE_URL = exports.VALUE_TYPE_UNIT_INTERVAL = exports.VALUE_TYPE_TRUE_ONLY = exports.VALUE_TYPE_TIME = exports.VALUE_TYPE_TEXT = exports.VALUE_TYPE_PHONE_NUMBER = exports.VALUE_TYPE_PERCENTAGE = exports.VALUE_TYPE_ORGANISATION_UNIT = exports.VALUE_TYPE_NUMBER = exports.VALUE_TYPE_LONG_TEXT = exports.VALUE_TYPE_LETTER = exports.VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE = exports.VALUE_TYPE_INTEGER_POSITIVE = exports.VALUE_TYPE_INTEGER_NEGATIVE = exports.VALUE_TYPE_INTEGER = exports.VALUE_TYPE_EMAIL = exports.VALUE_TYPE_DATETIME = exports.VALUE_TYPE_DATE = exports.VALUE_TYPE_BOOLEAN = exports.VALUE_TYPE_AGE = void 0;
|
|
6
|
+
exports.isNumericValueType = exports.isCumulativeValueType = exports.isBooleanValueType = exports.VALUE_TYPE_USERNAME = exports.VALUE_TYPE_URL = exports.VALUE_TYPE_UNIT_INTERVAL = exports.VALUE_TYPE_TRUE_ONLY = exports.VALUE_TYPE_TIME = exports.VALUE_TYPE_TEXT = exports.VALUE_TYPE_PHONE_NUMBER = exports.VALUE_TYPE_PERCENTAGE = exports.VALUE_TYPE_ORGANISATION_UNIT = exports.VALUE_TYPE_NUMBER = exports.VALUE_TYPE_LONG_TEXT = exports.VALUE_TYPE_LETTER = exports.VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE = exports.VALUE_TYPE_INTEGER_POSITIVE = exports.VALUE_TYPE_INTEGER_NEGATIVE = exports.VALUE_TYPE_INTEGER = exports.VALUE_TYPE_EMAIL = exports.VALUE_TYPE_DATETIME = exports.VALUE_TYPE_DATE = exports.VALUE_TYPE_BOOLEAN = exports.VALUE_TYPE_AGE = void 0;
|
|
7
7
|
/* These types match the types in the backend
|
|
8
8
|
https://github.com/dhis2/dhis2-core/blob/master/dhis-2/dhis-api/src/main/java/org/hisp/dhis/common/ValueType.java
|
|
9
9
|
*/
|
|
@@ -52,6 +52,9 @@ const VALUE_TYPE_AGE = 'AGE';
|
|
|
52
52
|
exports.VALUE_TYPE_AGE = VALUE_TYPE_AGE;
|
|
53
53
|
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];
|
|
54
54
|
const BOOLEAN_VALUE_TYPES = [VALUE_TYPE_BOOLEAN, VALUE_TYPE_TRUE_ONLY];
|
|
55
|
+
const CUMULATIVE_VALUE_TYPES = [VALUE_TYPE_NUMBER, VALUE_TYPE_INTEGER, VALUE_TYPE_INTEGER_POSITIVE, VALUE_TYPE_INTEGER_NEGATIVE, VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE, ...BOOLEAN_VALUE_TYPES];
|
|
56
|
+
const isCumulativeValueType = type => CUMULATIVE_VALUE_TYPES.includes(type);
|
|
57
|
+
exports.isCumulativeValueType = isCumulativeValueType;
|
|
55
58
|
const isNumericValueType = type => NUMERIC_VALUE_TYPES.includes(type);
|
|
56
59
|
exports.isNumericValueType = isNumericValueType;
|
|
57
60
|
const isBooleanValueType = type => BOOLEAN_VALUE_TYPES.includes(type);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import i18n from '@dhis2/d2-i18n';
|
|
1
2
|
import PropTypes from 'prop-types';
|
|
2
3
|
import React, { useRef } from 'react';
|
|
3
4
|
import { applyLegendSet } from '../../modules/pivotTable/applyLegendSet.js';
|
|
@@ -7,7 +8,7 @@ import { PivotTableCell } from './PivotTableCell.js';
|
|
|
7
8
|
import { PivotTableEmptyCell } from './PivotTableEmptyCell.js';
|
|
8
9
|
import { usePivotTableEngine } from './PivotTableEngineContext.js';
|
|
9
10
|
export const PivotTableValueCell = _ref => {
|
|
10
|
-
var _cellContent$rendered;
|
|
11
|
+
var _cellContent$titleVal, _cellContent$rendered;
|
|
11
12
|
let {
|
|
12
13
|
row,
|
|
13
14
|
column,
|
|
@@ -45,7 +46,10 @@ export const PivotTableValueCell = _ref => {
|
|
|
45
46
|
return /*#__PURE__*/React.createElement(PivotTableCell, {
|
|
46
47
|
key: column,
|
|
47
48
|
classes: classes,
|
|
48
|
-
title: cellContent.
|
|
49
|
+
title: (_cellContent$titleVal = cellContent.titleValue) !== null && _cellContent$titleVal !== void 0 ? _cellContent$titleVal : i18n.t('Value: {{value}}', {
|
|
50
|
+
value: cellContent.renderedValue,
|
|
51
|
+
nsSeparator: '^^'
|
|
52
|
+
}),
|
|
49
53
|
style: style,
|
|
50
54
|
onClick: isClickable ? onClick : undefined,
|
|
51
55
|
ref: cellRef,
|
|
@@ -2,7 +2,7 @@ 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
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
4
|
table.__hash = "3572446209";
|
|
5
|
-
export const cell = [`td.jsx-
|
|
6
|
-
cell.__hash = "
|
|
5
|
+
export const cell = [`td.jsx-2444037071,th.jsx-2444037071{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-2444037071{position:-webkit-sticky;position:sticky;z-index:1;top:0;left:0;}", `.fontsize-SMALL.jsx-2444037071{font-size:${FONT_SIZE_SMALL}px;line-height:${FONT_SIZE_SMALL}px;}`, `.fontsize-NORMAL.jsx-2444037071{font-size:${FONT_SIZE_NORMAL}px;line-height:${FONT_SIZE_NORMAL}px;}`, `.fontsize-LARGE.jsx-2444037071{font-size:${FONT_SIZE_LARGE}px;line-height:${FONT_SIZE_LARGE}px;}`, `.displaydensity-COMPACT.jsx-2444037071{padding:${DISPLAY_DENSITY_PADDING_COMPACT}px;}`, `.displaydensity-NORMAL.jsx-2444037071{padding:${DISPLAY_DENSITY_PADDING_NORMAL}px;}`, `.displaydensity-COMFORTABLE.jsx-2444037071{padding:${DISPLAY_DENSITY_PADDING_COMFORTABLE}px;}`, ".column-header.jsx-2444037071{background-color:#dae6f8;}", "div.column-header-inner.jsx-2444037071{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-2444037071{font-weight:bold;background-color:#cddaed;padding:0;}", ".title-cell-content.jsx-2444037071{text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}", `.title-cell.displaydensity-COMPACT.jsx-2444037071>.title-cell-content.jsx-2444037071{padding:${DISPLAY_DENSITY_PADDING_COMPACT}px;}`, `.title-cell.displaydensity-NORMAL.jsx-2444037071>.title-cell-content.jsx-2444037071{padding:${DISPLAY_DENSITY_PADDING_NORMAL}px;}`, `.title-cell.displaydensity-COMFORTABLE.jsx-2444037071>.title-cell-content.jsx-2444037071{padding:${DISPLAY_DENSITY_PADDING_COMFORTABLE}px;}`, ".row-header.jsx-2444037071{background-color:#dae6f8;}", ".row-header-hierarchy.jsx-2444037071{text-align:left;}", ".empty-header.jsx-2444037071{background-color:#cddaed;}", ".total-header.jsx-2444037071{background-color:#bac6d8;}", ".value.jsx-2444037071{background-color:#ffffff;text-align:left;}", ".NUMBER.jsx-2444037071,.INTEGER.jsx-2444037071,.INTEGER_POSITIVE.jsx-2444037071,.INTEGER_NEGATIVE.jsx-2444037071,.INTEGER_ZERO_OR_POSITIVE.jsx-2444037071,.UNIT_INTERVAL.jsx-2444037071,.PERCENTAGE.jsx-2444037071,.BOOLEAN.jsx-2444037071,.TRUE_ONLY.jsx-2444037071{text-align:right;}", `.N_A.jsx-2444037071{text-align:center;color:${colors.grey600};}`, ".clickable.jsx-2444037071{cursor:pointer;}", ".value.jsx-2444037071:hover{background-color:#f3f3f3;}", ".subtotal.jsx-2444037071{background-color:#f4f4f4;}", ".total.jsx-2444037071{background-color:#d8d8d8;}", ".column-header-label.jsx-2444037071{overflow:hidden;text-overflow:ellipsis;}"];
|
|
6
|
+
cell.__hash = "2444037071";
|
|
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;}`];
|
|
8
8
|
sortIcon.__hash = "2877616992";
|
|
@@ -267,6 +267,7 @@
|
|
|
267
267
|
"Six-months": "Six-months",
|
|
268
268
|
"Financial Years": "Financial Years",
|
|
269
269
|
"Years": "Years",
|
|
270
|
+
"Value: {{value}}": "Value: {{value}}",
|
|
270
271
|
"Bold text": "Bold text",
|
|
271
272
|
"Italic text": "Italic text",
|
|
272
273
|
"Link to a URL": "Link to a URL",
|
|
@@ -357,6 +358,7 @@
|
|
|
357
358
|
"{{thresholdFactor}} × Modified Z-score high": "{{thresholdFactor}} × Modified Z-score high",
|
|
358
359
|
"{{thresholdFactor}} × Z-score low": "{{thresholdFactor}} × Z-score low",
|
|
359
360
|
"{{thresholdFactor}} × Z-score high": "{{thresholdFactor}} × Z-score high",
|
|
361
|
+
"Not applicable": "Not applicable",
|
|
360
362
|
"Data": "Data",
|
|
361
363
|
"Organisation unit": "Organisation unit",
|
|
362
364
|
"Assigned Categories": "Assigned Categories",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"Last updated {{time}}": "最后更新 {{time}}",
|
|
10
10
|
"Created {{time}} by {{author}}": "由 {{author}} 在 {{time}} 创建",
|
|
11
11
|
"Created {{time}}": "已创建 {{time}}",
|
|
12
|
-
"Viewed {{count}} times": "查看了 {{count}}
|
|
12
|
+
"Viewed {{count}} times": "查看了 {{count}} 条",
|
|
13
13
|
"Notifications": "通知",
|
|
14
14
|
"You're subscribed and getting updates about new interpretations.": "您已订阅并获取有关新解释的更新。",
|
|
15
15
|
"Unsubscribe": "退订",
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
"About this map": "关于该地图",
|
|
19
19
|
"About this line list": "关于此行列表",
|
|
20
20
|
"About this visualization": "关于此可视化",
|
|
21
|
+
"About this event chart": "关于该事件图表",
|
|
22
|
+
"About this event report": "关于本事件报表",
|
|
21
23
|
"This app could not retrieve required data.": "此应用无法检索所需数据。",
|
|
22
24
|
"Network error": "网络错误",
|
|
23
25
|
"Data / Edit calculation": "数据/编辑计算",
|
|
@@ -33,7 +35,7 @@
|
|
|
33
35
|
"Save calculation": "保存计算",
|
|
34
36
|
"Are you sure you want to delete this calculation? It may be used by other visualizations.": "您确定要删除此计算吗?它可以被其他可视化使用。",
|
|
35
37
|
"Yes, delete": "是的,删除",
|
|
36
|
-
"Totals only": "
|
|
38
|
+
"Totals only": "仅总数",
|
|
37
39
|
"Details only": "仅详细信息",
|
|
38
40
|
"Loading": "载入",
|
|
39
41
|
"Data elements": "数据元",
|
|
@@ -132,17 +134,6 @@
|
|
|
132
134
|
"Manage sharing": "管理共享",
|
|
133
135
|
"Could not update interpretation": "无法更新解释",
|
|
134
136
|
"Enter interpretation text": "输入解释文本",
|
|
135
|
-
"Bold text": "粗体文字",
|
|
136
|
-
"Italic text": "斜体文字",
|
|
137
|
-
"Link to a URL": "链接到 URL",
|
|
138
|
-
"Mention a user": "提及用户",
|
|
139
|
-
"Add emoji": "添加表情符号",
|
|
140
|
-
"Preview": "预览",
|
|
141
|
-
"Back to write mode": "返回写入模式",
|
|
142
|
-
"Too many results. Try refining the search.": "结果太多。尝试优化搜索。",
|
|
143
|
-
"Search for a user": "搜索用户",
|
|
144
|
-
"Searching for \"{{- searchText}}\"": "搜索“{{- searchText}}”",
|
|
145
|
-
"No results found": "没有结果",
|
|
146
137
|
"Not available offline": "离线不可用",
|
|
147
138
|
"Created by": "创建人",
|
|
148
139
|
"Anyone": "任何人",
|
|
@@ -217,9 +208,9 @@
|
|
|
217
208
|
"Six-monthly April": "半年四月",
|
|
218
209
|
"Yearly": "每年",
|
|
219
210
|
"Financial year (Start November)": "财政年(11月始)",
|
|
220
|
-
"Financial year (Start October)": "
|
|
221
|
-
"Financial year (Start July)": "
|
|
222
|
-
"Financial year (Start April)": "
|
|
211
|
+
"Financial year (Start October)": "财政年度(10 月开始)",
|
|
212
|
+
"Financial year (Start July)": "财政年度(7 月开始)",
|
|
213
|
+
"Financial year (Start April)": "财政年度(4 月开始)",
|
|
223
214
|
"Today": "今天",
|
|
224
215
|
"Yesterday": "昨天",
|
|
225
216
|
"Last 3 days": "Last 3 days",
|
|
@@ -231,33 +222,33 @@
|
|
|
231
222
|
"Last 180 days": "最近180天",
|
|
232
223
|
"This week": "本年",
|
|
233
224
|
"Last week": "上周",
|
|
234
|
-
"Last 4 weeks": "
|
|
235
|
-
"Last 12 weeks": "最近12周",
|
|
236
|
-
"Last 52 weeks": "
|
|
237
|
-
"Weeks this year": "
|
|
225
|
+
"Last 4 weeks": "最近 4 周",
|
|
226
|
+
"Last 12 weeks": "最近 12 周",
|
|
227
|
+
"Last 52 weeks": "最近52 周",
|
|
228
|
+
"Weeks this year": "今年的周",
|
|
238
229
|
"This bi-week": "本双周",
|
|
239
230
|
"Last bi-week": "最近两周",
|
|
240
231
|
"Last 4 bi-weeks": "最近4个两周",
|
|
241
232
|
"This month": "本月",
|
|
242
233
|
"Last month": "上月",
|
|
243
234
|
"Last 3 months": "最近3个月",
|
|
244
|
-
"Last 6 months": "
|
|
235
|
+
"Last 6 months": "最近 6 个月",
|
|
245
236
|
"Last 12 months": "最近12月",
|
|
246
237
|
"Months this year": "今年的月份",
|
|
247
238
|
"This bi-month": "本双月",
|
|
248
|
-
"Last bi-month": "
|
|
249
|
-
"Last 6 bi-months": "
|
|
250
|
-
"Bi-months this year": "
|
|
239
|
+
"Last bi-month": "上两个月",
|
|
240
|
+
"Last 6 bi-months": "最近 6 个双月",
|
|
241
|
+
"Bi-months this year": "今年的双月",
|
|
251
242
|
"This quarter": "本季度",
|
|
252
243
|
"Last quarter": "最近一季",
|
|
253
|
-
"Last 4 quarters": "
|
|
244
|
+
"Last 4 quarters": "最近 4 个季度",
|
|
254
245
|
"Quarters this year": "今年的季度",
|
|
255
246
|
"This six-month": "本六个月",
|
|
256
247
|
"Last six-month": "最近六个月",
|
|
257
248
|
"Last 2 six-month": "最近2个六个月",
|
|
258
249
|
"This financial year": "本财年",
|
|
259
250
|
"Last financial year": "上一财政年",
|
|
260
|
-
"Last 5 financial years": "
|
|
251
|
+
"Last 5 financial years": "最近 5 个财政年度",
|
|
261
252
|
"This year": "今年",
|
|
262
253
|
"Last year": "去年",
|
|
263
254
|
"Last 5 years": "最近5年",
|
|
@@ -266,11 +257,18 @@
|
|
|
266
257
|
"Weeks": "星期",
|
|
267
258
|
"Bi-weeks": "双周",
|
|
268
259
|
"Months": "月",
|
|
269
|
-
"Bi-months": "
|
|
260
|
+
"Bi-months": "双月",
|
|
270
261
|
"Quarters": "四分之一",
|
|
271
|
-
"Six-months": "
|
|
272
|
-
"Financial Years": "
|
|
262
|
+
"Six-months": "六个月",
|
|
263
|
+
"Financial Years": "财政年度",
|
|
273
264
|
"Years": "年",
|
|
265
|
+
"Bold text": "粗体文字",
|
|
266
|
+
"Italic text": "斜体文字",
|
|
267
|
+
"Link to a URL": "链接到 URL",
|
|
268
|
+
"Mention a user": "提及用户",
|
|
269
|
+
"Add emoji": "添加表情符号",
|
|
270
|
+
"Preview": "预览",
|
|
271
|
+
"Back to write mode": "返回写入模式",
|
|
274
272
|
"Interpretations and details": "解释和细节",
|
|
275
273
|
"Translating to": "翻译成",
|
|
276
274
|
"Choose a locale": "选择语言环境",
|
|
@@ -281,6 +279,10 @@
|
|
|
281
279
|
"Cannot save while offline": "离线时无法保存",
|
|
282
280
|
"Could not load translations": "无法加载翻译",
|
|
283
281
|
"Retry": "重试",
|
|
282
|
+
"Too many results. Try refining the search.": "结果太多。尝试优化搜索。",
|
|
283
|
+
"Search for a user": "搜索用户",
|
|
284
|
+
"Searching for \"{{- searchText}}\"": "搜索“{{- searchText}}”",
|
|
285
|
+
"No results found": "没有结果",
|
|
284
286
|
"Series": "系列",
|
|
285
287
|
"Category": "分类",
|
|
286
288
|
"Filter": "过滤器",
|
|
@@ -367,7 +369,7 @@
|
|
|
367
369
|
"Year over year (line)": "逐年(折线图)",
|
|
368
370
|
"Pie": "饼图",
|
|
369
371
|
"Radar": "雷达图",
|
|
370
|
-
"Scatter": "
|
|
372
|
+
"Scatter": "散点图",
|
|
371
373
|
"Single value": "单个值",
|
|
372
374
|
"Outlier table": "异常值表",
|
|
373
375
|
"All charts": "所有图表",
|
|
@@ -6,11 +6,11 @@ import times from 'lodash/times';
|
|
|
6
6
|
import { DIMENSION_TYPE_DATA, DIMENSION_TYPE_DATA_ELEMENT_GROUP_SET, DIMENSION_TYPE_ORGANISATION_UNIT, DIMENSION_TYPE_PERIOD } from '../dataTypes.js';
|
|
7
7
|
import { DIMENSION_ID_ORGUNIT } from '../predefinedDimensions.js';
|
|
8
8
|
import { renderValue } from '../renderValue.js';
|
|
9
|
-
import { VALUE_TYPE_NUMBER, VALUE_TYPE_TEXT, isBooleanValueType, isNumericValueType } from '../valueTypes.js';
|
|
9
|
+
import { VALUE_TYPE_NUMBER, VALUE_TYPE_TEXT, isBooleanValueType, isCumulativeValueType, isNumericValueType } from '../valueTypes.js';
|
|
10
10
|
import { AdaptiveClippingController } from './AdaptiveClippingController.js';
|
|
11
11
|
import { addToTotalIfNumber } from './addToTotalIfNumber.js';
|
|
12
12
|
import { parseValue } from './parseValue.js';
|
|
13
|
-
import { AGGREGATE_TYPE_NA, AGGREGATE_TYPE_AVERAGE, AGGREGATE_TYPE_SUM, CELL_TYPE_VALUE, CELL_TYPE_TOTAL, CELL_TYPE_SUBTOTAL, SORT_ORDER_ASCENDING, SORT_ORDER_DESCENDING, DISPLAY_DENSITY_PADDING_COMPACT, DISPLAY_DENSITY_PADDING_COMFORTABLE, DISPLAY_DENSITY_OPTION_COMFORTABLE, DISPLAY_DENSITY_OPTION_COMPACT, DISPLAY_DENSITY_OPTION_NORMAL, DISPLAY_DENSITY_PADDING_NORMAL, FONT_SIZE_OPTION_SMALL, FONT_SIZE_SMALL, FONT_SIZE_OPTION_LARGE, FONT_SIZE_LARGE, FONT_SIZE_OPTION_NORMAL, FONT_SIZE_NORMAL, NUMBER_TYPE_COLUMN_PERCENTAGE, NUMBER_TYPE_ROW_PERCENTAGE, NUMBER_TYPE_VALUE } from './pivotTableConstants.js';
|
|
13
|
+
import { AGGREGATE_TYPE_NA, AGGREGATE_TYPE_AVERAGE, AGGREGATE_TYPE_SUM, CELL_TYPE_VALUE, CELL_TYPE_TOTAL, CELL_TYPE_SUBTOTAL, SORT_ORDER_ASCENDING, SORT_ORDER_DESCENDING, DISPLAY_DENSITY_PADDING_COMPACT, DISPLAY_DENSITY_PADDING_COMFORTABLE, DISPLAY_DENSITY_OPTION_COMFORTABLE, DISPLAY_DENSITY_OPTION_COMPACT, DISPLAY_DENSITY_OPTION_NORMAL, DISPLAY_DENSITY_PADDING_NORMAL, FONT_SIZE_OPTION_SMALL, FONT_SIZE_SMALL, FONT_SIZE_OPTION_LARGE, FONT_SIZE_LARGE, FONT_SIZE_OPTION_NORMAL, FONT_SIZE_NORMAL, NUMBER_TYPE_COLUMN_PERCENTAGE, NUMBER_TYPE_ROW_PERCENTAGE, NUMBER_TYPE_VALUE, VALUE_TYPE_NA, VALUE_NA } from './pivotTableConstants.js';
|
|
14
14
|
const dataFields = ['value', 'numerator', 'denominator', 'factor', 'multiplier', 'divisor'];
|
|
15
15
|
const defaultOptions = {
|
|
16
16
|
hideEmptyColumns: false,
|
|
@@ -153,7 +153,7 @@ const applyTotalAggregationType = (_ref2, overrideTotalAggregationType) => {
|
|
|
153
153
|
} = _ref2;
|
|
154
154
|
switch (overrideTotalAggregationType || totalAggregationType) {
|
|
155
155
|
case AGGREGATE_TYPE_NA:
|
|
156
|
-
return
|
|
156
|
+
return VALUE_NA;
|
|
157
157
|
case AGGREGATE_TYPE_AVERAGE:
|
|
158
158
|
return (numerator || value) * multiplier / (denominator * divisor || 1);
|
|
159
159
|
case AGGREGATE_TYPE_SUM:
|
|
@@ -258,15 +258,29 @@ export class PivotTableEngine {
|
|
|
258
258
|
rawCell.rawValue = rawValue;
|
|
259
259
|
rawCell.renderedValue = renderedValue;
|
|
260
260
|
}
|
|
261
|
+
if ([CELL_TYPE_TOTAL, CELL_TYPE_SUBTOTAL].includes(rawCell.cellType) && rawCell.rawValue === AGGREGATE_TYPE_NA) {
|
|
262
|
+
rawCell.titleValue = i18n.t('Not applicable');
|
|
263
|
+
}
|
|
261
264
|
if (this.options.cumulativeValues) {
|
|
265
|
+
let titleValue;
|
|
266
|
+
if (this.data[row] && this.data[row][column]) {
|
|
267
|
+
const dataRow = this.data[row][column];
|
|
268
|
+
const rawValue = cellType === CELL_TYPE_VALUE ? dataRow[this.dimensionLookup.dataHeaders.value] : dataRow.value;
|
|
269
|
+
titleValue = i18n.t('Value: {{value}}', {
|
|
270
|
+
value: renderValue(rawValue, valueType, this.visualization),
|
|
271
|
+
nsSeparator: '^^'
|
|
272
|
+
});
|
|
273
|
+
}
|
|
262
274
|
const cumulativeValue = this.getCumulative({
|
|
263
275
|
row,
|
|
264
276
|
column
|
|
265
277
|
});
|
|
266
278
|
if (cumulativeValue !== undefined && cumulativeValue !== null) {
|
|
267
|
-
// force to
|
|
268
|
-
|
|
279
|
+
// force to TEXT for N/A (accumulated) values
|
|
280
|
+
// force to NUMBER for accumulated values if no valueType present
|
|
281
|
+
rawCell.valueType = cumulativeValue === VALUE_NA ? VALUE_TYPE_NA : valueType === undefined || valueType === null ? VALUE_TYPE_NUMBER : valueType;
|
|
269
282
|
rawCell.empty = false;
|
|
283
|
+
rawCell.titleValue = titleValue;
|
|
270
284
|
rawCell.rawValue = cumulativeValue;
|
|
271
285
|
rawCell.renderedValue = renderValue(cumulativeValue, valueType, this.visualization);
|
|
272
286
|
}
|
|
@@ -365,15 +379,12 @@ export class PivotTableEngine {
|
|
|
365
379
|
return undefined;
|
|
366
380
|
}
|
|
367
381
|
const cellValue = this.data[row][column];
|
|
382
|
+
|
|
383
|
+
// empty cell
|
|
368
384
|
if (!cellValue) {
|
|
369
|
-
|
|
370
|
-
// The cell still needs to get the valueType to render correctly 0 and cumulative values
|
|
371
|
-
return {
|
|
372
|
-
valueType: VALUE_TYPE_NUMBER,
|
|
373
|
-
totalAggregationType: AGGREGATE_TYPE_SUM
|
|
374
|
-
};
|
|
385
|
+
return undefined;
|
|
375
386
|
}
|
|
376
|
-
if (!Array.isArray(cellValue)) {
|
|
387
|
+
if (cellValue && !Array.isArray(cellValue)) {
|
|
377
388
|
// This is a total cell
|
|
378
389
|
return {
|
|
379
390
|
valueType: cellValue.valueType,
|
|
@@ -536,19 +547,26 @@ export class PivotTableEngine {
|
|
|
536
547
|
} else {
|
|
537
548
|
totalCell.totalAggregationType = currentAggType;
|
|
538
549
|
}
|
|
539
|
-
|
|
550
|
+
|
|
551
|
+
// Force value type of total cells to NUMBER for value cells with numeric or boolean types.
|
|
552
|
+
// This is to simplify the code below where we compare the previous value type.
|
|
553
|
+
// All numeric/boolean value types use the same style for rendering the total cell (right aligned content)
|
|
554
|
+
// and using NUMBER for the total cell is enough for that.
|
|
555
|
+
// (see DHIS2-9155)
|
|
556
|
+
const currentValueType = isNumericValueType(dxDimension === null || dxDimension === void 0 ? void 0 : dxDimension.valueType) || isBooleanValueType(dxDimension === null || dxDimension === void 0 ? void 0 : dxDimension.valueType) ? VALUE_TYPE_NUMBER : dxDimension === null || dxDimension === void 0 ? void 0 : dxDimension.valueType;
|
|
540
557
|
const previousValueType = totalCell.valueType;
|
|
541
558
|
if (previousValueType && currentValueType !== previousValueType) {
|
|
542
|
-
totalCell.valueType =
|
|
559
|
+
totalCell.valueType = VALUE_TYPE_NA;
|
|
543
560
|
} else {
|
|
544
561
|
totalCell.valueType = currentValueType;
|
|
545
562
|
}
|
|
546
563
|
|
|
547
|
-
//
|
|
548
|
-
//
|
|
564
|
+
// Compute totals for all numeric and boolean value types only.
|
|
565
|
+
// In practice valueType here is NUMBER (see the comment above).
|
|
566
|
+
// When is not, it means there is some value cell with a valueType other than numeric/boolean,
|
|
567
|
+
// the total should not be computed then.
|
|
549
568
|
// (see DHIS2-9155)
|
|
550
|
-
if (isNumericValueType(
|
|
551
|
-
totalCell.valueType = VALUE_TYPE_NUMBER;
|
|
569
|
+
if (isNumericValueType(totalCell.valueType)) {
|
|
552
570
|
dataFields.forEach(field => {
|
|
553
571
|
const headerIndex = this.dimensionLookup.dataHeaders[field];
|
|
554
572
|
const value = parseValue(dataRow[headerIndex]);
|
|
@@ -642,6 +660,17 @@ export class PivotTableEngine {
|
|
|
642
660
|
}
|
|
643
661
|
}
|
|
644
662
|
}
|
|
663
|
+
computeOverrideTotalAggregationType(totalCell, visualization) {
|
|
664
|
+
// Avoid undefined on total cells with valueTypes that cannot be totalized.
|
|
665
|
+
// This happens for example when a column/row has all value cells of type TEXT.
|
|
666
|
+
if (!(isNumericValueType(totalCell.valueType) || isBooleanValueType(totalCell.valueType))) {
|
|
667
|
+
return AGGREGATE_TYPE_NA;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
// DHIS2-15698: do not override total aggregation type when numberType option is not present
|
|
671
|
+
// (numberType option default is VALUE)
|
|
672
|
+
return visualization.numberType && visualization.numberType !== NUMBER_TYPE_VALUE && AGGREGATE_TYPE_SUM;
|
|
673
|
+
}
|
|
645
674
|
finalizeTotal(_ref11) {
|
|
646
675
|
let {
|
|
647
676
|
row,
|
|
@@ -652,10 +681,12 @@ export class PivotTableEngine {
|
|
|
652
681
|
}
|
|
653
682
|
const totalCell = this.data[row][column];
|
|
654
683
|
if (totalCell && totalCell.count) {
|
|
655
|
-
totalCell.value = applyTotalAggregationType(totalCell,
|
|
656
|
-
|
|
657
|
-
//
|
|
658
|
-
|
|
684
|
+
totalCell.value = applyTotalAggregationType(totalCell, this.computeOverrideTotalAggregationType(totalCell, this.visualization));
|
|
685
|
+
|
|
686
|
+
// override valueType for styling cells with N/A value
|
|
687
|
+
if (totalCell.value === AGGREGATE_TYPE_NA) {
|
|
688
|
+
totalCell.valueType = VALUE_TYPE_NA;
|
|
689
|
+
}
|
|
659
690
|
this.adaptiveClippingController.add({
|
|
660
691
|
row,
|
|
661
692
|
column
|
|
@@ -756,10 +787,14 @@ export class PivotTableEngine {
|
|
|
756
787
|
column
|
|
757
788
|
});
|
|
758
789
|
const valueType = (dxDimension === null || dxDimension === void 0 ? void 0 : dxDimension.valueType) || VALUE_TYPE_TEXT;
|
|
790
|
+
const totalAggregationType = dxDimension === null || dxDimension === void 0 ? void 0 : dxDimension.totalAggregationType;
|
|
759
791
|
|
|
760
|
-
// only accumulate numeric values
|
|
761
|
-
// accumulating text values does not make sense
|
|
762
|
-
if (valueType ===
|
|
792
|
+
// only accumulate numeric (except for PERCENTAGE and UNIT_INTERVAL) and boolean values
|
|
793
|
+
// accumulating other value types like text values does not make sense
|
|
794
|
+
if (isCumulativeValueType(valueType) && totalAggregationType === AGGREGATE_TYPE_SUM) {
|
|
795
|
+
// initialise to 0 for cumulative types
|
|
796
|
+
// (||= is not transformed correctly in Babel with the current setup)
|
|
797
|
+
acc || (acc = 0);
|
|
763
798
|
if (this.data[row] && this.data[row][column]) {
|
|
764
799
|
const dataRow = this.data[row][column];
|
|
765
800
|
const rawValue = cellType === CELL_TYPE_VALUE ? dataRow[this.dimensionLookup.dataHeaders.value] : dataRow.value;
|
|
@@ -768,7 +803,7 @@ export class PivotTableEngine {
|
|
|
768
803
|
this.accumulators.rows[row][column] = acc;
|
|
769
804
|
}
|
|
770
805
|
return acc;
|
|
771
|
-
},
|
|
806
|
+
}, '');
|
|
772
807
|
});
|
|
773
808
|
} else {
|
|
774
809
|
this.accumulators = {
|
|
@@ -6,6 +6,8 @@ export const CELL_TYPE_TOTAL = 'total';
|
|
|
6
6
|
export const AGGREGATE_TYPE_SUM = 'SUM';
|
|
7
7
|
export const AGGREGATE_TYPE_AVERAGE = 'AVERAGE';
|
|
8
8
|
export const AGGREGATE_TYPE_NA = 'N/A';
|
|
9
|
+
export const VALUE_TYPE_NA = 'N_A'; // this ends up as CSS class and / is problematic
|
|
10
|
+
|
|
9
11
|
export const NUMBER_TYPE_VALUE = 'VALUE';
|
|
10
12
|
export const NUMBER_TYPE_ROW_PERCENTAGE = 'ROW_PERCENTAGE';
|
|
11
13
|
export const NUMBER_TYPE_COLUMN_PERCENTAGE = 'COLUMN_PERCENTAGE';
|
|
@@ -26,4 +28,5 @@ export const CLIPPED_CELL_MAX_SIZE = 360;
|
|
|
26
28
|
export const CLIPPED_CELL_MIN_SIZE = 36;
|
|
27
29
|
export const WRAPPED_TEXT_JUSTIFY_BUFFER = 25;
|
|
28
30
|
export const WRAPPED_TEXT_LINE_HEIGHT = 1.0;
|
|
29
|
-
export const CLIPPED_AXIS_PARTITION_SIZE_PX = 1000;
|
|
31
|
+
export const CLIPPED_AXIS_PARTITION_SIZE_PX = 1000;
|
|
32
|
+
export const VALUE_NA = 'N/A';
|
|
@@ -25,5 +25,7 @@ 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
|
+
const CUMULATIVE_VALUE_TYPES = [VALUE_TYPE_NUMBER, VALUE_TYPE_INTEGER, VALUE_TYPE_INTEGER_POSITIVE, VALUE_TYPE_INTEGER_NEGATIVE, VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE, ...BOOLEAN_VALUE_TYPES];
|
|
29
|
+
export const isCumulativeValueType = type => CUMULATIVE_VALUE_TYPES.includes(type);
|
|
28
30
|
export const isNumericValueType = type => NUMERIC_VALUE_TYPES.includes(type);
|
|
29
31
|
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.8.
|
|
3
|
+
"version": "26.8.7",
|
|
4
4
|
"main": "./build/cjs/index.js",
|
|
5
5
|
"module": "./build/es/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "d2-app-scripts build",
|
|
23
|
-
"postbuild": "yarn build-storybook",
|
|
24
23
|
"build-storybook": "build-storybook",
|
|
25
24
|
"start-storybook": "start-storybook --port 5000",
|
|
26
25
|
"start": "yarn start-storybook",
|