@dhis2/analytics 26.9.6 → 26.10.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/build/cjs/__demo__/DataDimension.stories.js +53 -0
- package/build/cjs/api/dimensions.js +1 -1
- package/build/cjs/api/expression.js +20 -10
- package/build/cjs/components/DataDimension/Calculation/CalculationModal.js +1 -1
- package/build/cjs/components/DataDimension/DataDimension.js +4 -1
- package/build/cjs/components/DataDimension/Info/CalculationInfo.js +106 -0
- package/build/cjs/components/DataDimension/Info/DataElementInfo.js +135 -0
- package/build/cjs/components/DataDimension/Info/DataElementOperandInfo.js +188 -0
- package/build/cjs/components/DataDimension/Info/DataSetInfo.js +115 -0
- package/build/cjs/components/DataDimension/Info/EventDataItemInfo.js +111 -0
- package/build/cjs/components/DataDimension/Info/IndicatorInfo.js +179 -0
- package/build/cjs/components/DataDimension/Info/InfoPopover.js +58 -0
- package/build/cjs/components/DataDimension/Info/InfoTable.js +219 -0
- package/build/cjs/components/DataDimension/Info/ProgramIndicatorInfo.js +191 -0
- package/build/cjs/components/DataDimension/Info/styles/InfoPopover.style.js +10 -0
- package/build/cjs/components/DataDimension/ItemSelector.js +22 -5
- package/build/cjs/components/DataDimension/TransferOption.js +117 -0
- package/build/cjs/components/DataDimension/styles/TransferOption.style.js +10 -0
- package/build/cjs/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +0 -20
- package/build/cjs/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +0 -5
- package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/FixedPeriodSingleSelect.spec.js.snap +0 -12
- package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/PeriodSelector.spec.js.snap +3 -10
- package/build/cjs/components/styles/DimensionSelector.style.js +2 -2
- package/build/cjs/index.js +66 -10
- package/build/cjs/locales/ar/translations.json +96 -22
- package/build/cjs/locales/ar_IQ/translations.json +141 -44
- package/build/cjs/locales/bn/translations.json +458 -0
- package/build/cjs/locales/ckb/translations.json +137 -44
- package/build/cjs/locales/cs/translations.json +88 -20
- package/build/cjs/locales/da/translations.json +102 -23
- package/build/cjs/locales/en/translations.json +73 -9
- package/build/cjs/locales/es/translations.json +75 -9
- package/build/cjs/locales/es_419/translations.json +77 -9
- package/build/cjs/locales/fr/translations.json +77 -9
- package/build/cjs/locales/hi_IN/translations.json +458 -0
- package/build/cjs/locales/id/translations.json +95 -22
- package/build/cjs/locales/index.js +74 -70
- package/build/cjs/locales/km/translations.json +100 -23
- package/build/cjs/locales/lo/translations.json +73 -9
- package/build/cjs/locales/my/translations.json +101 -23
- package/build/cjs/locales/nb/translations.json +88 -20
- package/build/cjs/locales/ne/translations.json +77 -9
- package/build/cjs/locales/nl/translations.json +95 -22
- package/build/cjs/locales/or/translations.json +137 -44
- package/build/cjs/locales/prs/translations.json +102 -23
- package/build/cjs/locales/ps/translations.json +102 -23
- package/build/cjs/locales/pt/translations.json +73 -9
- package/build/cjs/locales/pt_BR/translations.json +95 -22
- package/build/cjs/locales/ro/translations.json +138 -44
- package/build/cjs/locales/ru/translations.json +77 -9
- package/build/cjs/locales/si/translations.json +102 -23
- package/build/cjs/locales/sv/translations.json +88 -20
- package/build/cjs/locales/tet/translations.json +101 -23
- package/build/cjs/locales/tg/translations.json +102 -23
- package/build/cjs/locales/uk/translations.json +96 -22
- package/build/cjs/locales/ur/translations.json +96 -22
- package/build/cjs/locales/uz_UZ_Cyrl/translations.json +95 -22
- package/build/cjs/locales/uz_UZ_Latn/translations.json +96 -22
- package/build/cjs/locales/vi/translations.json +73 -9
- package/build/cjs/locales/zh/translations.json +73 -9
- package/build/cjs/locales/zh_CN/translations.json +95 -22
- package/build/cjs/modules/dimensionListItem.js +3 -3
- package/build/cjs/modules/dimensionSelectorHelper.js +2 -2
- package/build/cjs/modules/valueTypes.js +50 -11
- package/build/es/__demo__/DataDimension.stories.js +42 -0
- package/build/es/api/dimensions.js +1 -1
- package/build/es/api/expression.js +19 -9
- package/build/es/components/DataDimension/Calculation/CalculationModal.js +2 -2
- package/build/es/components/DataDimension/DataDimension.js +4 -1
- package/build/es/components/DataDimension/Info/CalculationInfo.js +96 -0
- package/build/es/components/DataDimension/Info/DataElementInfo.js +127 -0
- package/build/es/components/DataDimension/Info/DataElementOperandInfo.js +178 -0
- package/build/es/components/DataDimension/Info/DataSetInfo.js +107 -0
- package/build/es/components/DataDimension/Info/EventDataItemInfo.js +103 -0
- package/build/es/components/DataDimension/Info/IndicatorInfo.js +169 -0
- package/build/es/components/DataDimension/Info/InfoPopover.js +54 -0
- package/build/es/components/DataDimension/Info/InfoTable.js +205 -0
- package/build/es/components/DataDimension/Info/ProgramIndicatorInfo.js +181 -0
- package/build/es/components/DataDimension/Info/styles/InfoPopover.style.js +4 -0
- package/build/es/components/DataDimension/ItemSelector.js +24 -7
- package/build/es/components/DataDimension/TransferOption.js +109 -0
- package/build/es/components/DataDimension/styles/TransferOption.style.js +4 -0
- package/build/es/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +0 -20
- package/build/es/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +0 -5
- package/build/es/components/PeriodDimension/__tests__/__snapshots__/FixedPeriodSingleSelect.spec.js.snap +0 -12
- package/build/es/components/PeriodDimension/__tests__/__snapshots__/PeriodSelector.spec.js.snap +3 -10
- package/build/es/components/styles/DimensionSelector.style.js +2 -2
- package/build/es/index.js +1 -1
- package/build/es/locales/ar/translations.json +96 -22
- package/build/es/locales/ar_IQ/translations.json +141 -44
- package/build/es/locales/bn/translations.json +458 -0
- package/build/es/locales/ckb/translations.json +137 -44
- package/build/es/locales/cs/translations.json +88 -20
- package/build/es/locales/da/translations.json +102 -23
- package/build/es/locales/en/translations.json +73 -9
- package/build/es/locales/es/translations.json +75 -9
- package/build/es/locales/es_419/translations.json +77 -9
- package/build/es/locales/fr/translations.json +77 -9
- package/build/es/locales/hi_IN/translations.json +458 -0
- package/build/es/locales/id/translations.json +95 -22
- package/build/es/locales/index.js +4 -0
- package/build/es/locales/km/translations.json +100 -23
- package/build/es/locales/lo/translations.json +73 -9
- package/build/es/locales/my/translations.json +101 -23
- package/build/es/locales/nb/translations.json +88 -20
- package/build/es/locales/ne/translations.json +77 -9
- package/build/es/locales/nl/translations.json +95 -22
- package/build/es/locales/or/translations.json +137 -44
- package/build/es/locales/prs/translations.json +102 -23
- package/build/es/locales/ps/translations.json +102 -23
- package/build/es/locales/pt/translations.json +73 -9
- package/build/es/locales/pt_BR/translations.json +95 -22
- package/build/es/locales/ro/translations.json +138 -44
- package/build/es/locales/ru/translations.json +77 -9
- package/build/es/locales/si/translations.json +102 -23
- package/build/es/locales/sv/translations.json +88 -20
- package/build/es/locales/tet/translations.json +101 -23
- package/build/es/locales/tg/translations.json +102 -23
- package/build/es/locales/uk/translations.json +96 -22
- package/build/es/locales/ur/translations.json +96 -22
- package/build/es/locales/uz_UZ_Cyrl/translations.json +95 -22
- package/build/es/locales/uz_UZ_Latn/translations.json +96 -22
- package/build/es/locales/vi/translations.json +73 -9
- package/build/es/locales/zh/translations.json +73 -9
- package/build/es/locales/zh_CN/translations.json +95 -22
- package/build/es/modules/dimensionListItem.js +1 -1
- package/build/es/modules/dimensionSelectorHelper.js +2 -2
- package/build/es/modules/valueTypes.js +48 -10
- package/package.json +5 -5
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DataSetInfo = void 0;
|
|
7
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
8
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _index = _interopRequireDefault(require("../../../locales/index.js"));
|
|
12
|
+
var _InfoTable = require("./InfoTable.js");
|
|
13
|
+
var _InfoPopoverStyle = _interopRequireDefault(require("./styles/InfoPopover.style.js"));
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
const dataSetQuery = {
|
|
16
|
+
dataSet: {
|
|
17
|
+
resource: 'dataSets',
|
|
18
|
+
id: _ref => {
|
|
19
|
+
let {
|
|
20
|
+
id
|
|
21
|
+
} = _ref;
|
|
22
|
+
return id;
|
|
23
|
+
},
|
|
24
|
+
params: _ref2 => {
|
|
25
|
+
let {
|
|
26
|
+
displayNameProp
|
|
27
|
+
} = _ref2;
|
|
28
|
+
return {
|
|
29
|
+
fields: `${(0, _InfoTable.getCommonFields)(displayNameProp)},dataSetElements[dataElement[id,displayName]],expiryDays,indicators[id,displayName],periodType,`
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
const DataSetInfo = _ref3 => {
|
|
35
|
+
let {
|
|
36
|
+
type,
|
|
37
|
+
id,
|
|
38
|
+
displayNameProp
|
|
39
|
+
} = _ref3;
|
|
40
|
+
const {
|
|
41
|
+
loading,
|
|
42
|
+
error,
|
|
43
|
+
data
|
|
44
|
+
} = (0, _appRuntime.useDataQuery)(dataSetQuery, {
|
|
45
|
+
variables: {
|
|
46
|
+
id,
|
|
47
|
+
displayNameProp
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_InfoTable.InfoTable, {
|
|
51
|
+
dataType: type,
|
|
52
|
+
data: data === null || data === void 0 ? void 0 : data.dataSet,
|
|
53
|
+
loading: loading,
|
|
54
|
+
error: error
|
|
55
|
+
}, /*#__PURE__*/_react.default.createElement("tr", {
|
|
56
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
57
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
58
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
59
|
+
}, _index.default.t('Period type')), /*#__PURE__*/_react.default.createElement("td", {
|
|
60
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
61
|
+
}, data === null || data === void 0 ? void 0 : data.dataSet.periodType)), /*#__PURE__*/_react.default.createElement("tr", {
|
|
62
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
63
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
64
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
65
|
+
}, _index.default.t('Data elements')), /*#__PURE__*/_react.default.createElement("td", {
|
|
66
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
67
|
+
}, (data === null || data === void 0 ? void 0 : data.dataSet.dataSetElements.length) === 1 ? data.dataSet.dataSetElements[0].dataElement.displayName : /*#__PURE__*/_react.default.createElement("div", {
|
|
68
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "content-wrap"
|
|
69
|
+
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
70
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
71
|
+
}, data === null || data === void 0 ? void 0 : data.dataSet.dataSetElements.map(_ref4 => {
|
|
72
|
+
let {
|
|
73
|
+
dataElement
|
|
74
|
+
} = _ref4;
|
|
75
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
76
|
+
key: dataElement.id,
|
|
77
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
78
|
+
}, dataElement.displayName);
|
|
79
|
+
}))))), /*#__PURE__*/_react.default.createElement("tr", {
|
|
80
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
81
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
82
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
83
|
+
}, _index.default.t('Indicators')), /*#__PURE__*/_react.default.createElement("td", {
|
|
84
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
85
|
+
}, (data === null || data === void 0 ? void 0 : data.dataSet.indicators.length) === 1 ? data.dataSet.indicators[0].displayName : (data === null || data === void 0 ? void 0 : data.dataSet.indicators.length) > 1 ? /*#__PURE__*/_react.default.createElement("div", {
|
|
86
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "content-wrap"
|
|
87
|
+
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
88
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
89
|
+
}, data.dataSet.indicators.map(_ref5 => {
|
|
90
|
+
let {
|
|
91
|
+
id,
|
|
92
|
+
displayName
|
|
93
|
+
} = _ref5;
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
95
|
+
key: id,
|
|
96
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
97
|
+
}, displayName);
|
|
98
|
+
}))) : /*#__PURE__*/_react.default.createElement("span", {
|
|
99
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "none"
|
|
100
|
+
}, _index.default.t('None')))), /*#__PURE__*/_react.default.createElement("tr", {
|
|
101
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
102
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
103
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
104
|
+
}, _index.default.t('Expiry days')), /*#__PURE__*/_react.default.createElement("td", {
|
|
105
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
106
|
+
}, data === null || data === void 0 ? void 0 : data.dataSet.expiryDays))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
107
|
+
id: _InfoPopoverStyle.default.__hash
|
|
108
|
+
}, _InfoPopoverStyle.default));
|
|
109
|
+
};
|
|
110
|
+
exports.DataSetInfo = DataSetInfo;
|
|
111
|
+
DataSetInfo.propTypes = {
|
|
112
|
+
displayNameProp: _propTypes.default.string,
|
|
113
|
+
id: _propTypes.default.string,
|
|
114
|
+
type: _propTypes.default.string
|
|
115
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EventDataItemInfo = void 0;
|
|
7
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
8
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _index = _interopRequireDefault(require("../../../locales/index.js"));
|
|
12
|
+
var _dataTypes = require("../../../modules/dataTypes.js");
|
|
13
|
+
var _valueTypes = require("../../../modules/valueTypes.js");
|
|
14
|
+
var _InfoTable = require("./InfoTable.js");
|
|
15
|
+
var _InfoPopoverStyle = _interopRequireDefault(require("./styles/InfoPopover.style.js"));
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
const programDataElementQuery = {
|
|
18
|
+
programDataElement: {
|
|
19
|
+
resource: 'dataElements',
|
|
20
|
+
id: _ref => {
|
|
21
|
+
let {
|
|
22
|
+
id
|
|
23
|
+
} = _ref;
|
|
24
|
+
return id;
|
|
25
|
+
},
|
|
26
|
+
params: _ref2 => {
|
|
27
|
+
let {
|
|
28
|
+
displayNameProp
|
|
29
|
+
} = _ref2;
|
|
30
|
+
return {
|
|
31
|
+
fields: `${(0, _InfoTable.getCommonFields)(displayNameProp)},aggregationType,dimensionItemType,legendSets[id,displayName],optionsSet[displayName],valueType,zeroIsSignificant`
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const programAttributeQuery = {
|
|
37
|
+
programAttribute: {
|
|
38
|
+
resource: 'trackedEntityAttributes',
|
|
39
|
+
id: _ref3 => {
|
|
40
|
+
let {
|
|
41
|
+
id
|
|
42
|
+
} = _ref3;
|
|
43
|
+
return id;
|
|
44
|
+
},
|
|
45
|
+
params: _ref4 => {
|
|
46
|
+
let {
|
|
47
|
+
displayNameProp
|
|
48
|
+
} = _ref4;
|
|
49
|
+
return {
|
|
50
|
+
fields: `${(0, _InfoTable.getCommonFields)(displayNameProp)},aggregationType,dimensionItemType,legendSets[id,displayName],optionsSet[displayName],valueType,zeroIsSignificant`
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const EventDataItemInfo = _ref5 => {
|
|
56
|
+
let {
|
|
57
|
+
type,
|
|
58
|
+
id,
|
|
59
|
+
displayNameProp
|
|
60
|
+
} = _ref5;
|
|
61
|
+
const {
|
|
62
|
+
loading,
|
|
63
|
+
error,
|
|
64
|
+
data
|
|
65
|
+
} = (0, _appRuntime.useDataQuery)(type === _dataTypes.DIMENSION_TYPE_PROGRAM_DATA_ELEMENT ? programDataElementQuery : programAttributeQuery, {
|
|
66
|
+
// strip program id (if present)
|
|
67
|
+
variables: {
|
|
68
|
+
id: id.split('.').reverse()[0],
|
|
69
|
+
displayNameProp
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
const renderInfoTable = data => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_InfoTable.InfoTable, {
|
|
73
|
+
dataType: type,
|
|
74
|
+
data: data,
|
|
75
|
+
loading: loading,
|
|
76
|
+
error: error
|
|
77
|
+
}, /*#__PURE__*/_react.default.createElement("tr", {
|
|
78
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
79
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
80
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
81
|
+
}, _index.default.t('Type')), /*#__PURE__*/_react.default.createElement("td", {
|
|
82
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
83
|
+
}, type === _dataTypes.DIMENSION_TYPE_PROGRAM_DATA_ELEMENT ? _index.default.t('Data element') : _index.default.t('Tracked entity attribute'))), /*#__PURE__*/_react.default.createElement("tr", {
|
|
84
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
85
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
86
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
87
|
+
}, _index.default.t('Value type')), /*#__PURE__*/_react.default.createElement("td", {
|
|
88
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
89
|
+
}, _valueTypes.valueTypeDisplayNames[data === null || data === void 0 ? void 0 : data.valueType])), (data === null || data === void 0 ? void 0 : data.optionSet) && /*#__PURE__*/_react.default.createElement("tr", {
|
|
90
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement("td", {
|
|
92
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
93
|
+
}, _index.default.t('Option set')), /*#__PURE__*/_react.default.createElement("td", {
|
|
94
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
95
|
+
}, data.optionSet.displayName)), Boolean(data === null || data === void 0 ? void 0 : data.legendSets.length) && /*#__PURE__*/_react.default.createElement("tr", {
|
|
96
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
97
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
98
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
99
|
+
}, _index.default.t('Legend set(s)')), /*#__PURE__*/_react.default.createElement("td", {
|
|
100
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
101
|
+
}, (0, _InfoTable.renderLegendSets)(data.legendSets)))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
102
|
+
id: _InfoPopoverStyle.default.__hash
|
|
103
|
+
}, _InfoPopoverStyle.default));
|
|
104
|
+
return type === _dataTypes.DIMENSION_TYPE_PROGRAM_DATA_ELEMENT ? renderInfoTable(data === null || data === void 0 ? void 0 : data.programDataElement) : renderInfoTable(data === null || data === void 0 ? void 0 : data.programAttribute);
|
|
105
|
+
};
|
|
106
|
+
exports.EventDataItemInfo = EventDataItemInfo;
|
|
107
|
+
EventDataItemInfo.propTypes = {
|
|
108
|
+
displayNameProp: _propTypes.default.string,
|
|
109
|
+
id: _propTypes.default.string,
|
|
110
|
+
type: _propTypes.default.string
|
|
111
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.IndicatorInfo = void 0;
|
|
7
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
8
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _expression = require("../../../api/expression.js");
|
|
12
|
+
var _index = _interopRequireDefault(require("../../../locales/index.js"));
|
|
13
|
+
var _InfoTable = require("./InfoTable.js");
|
|
14
|
+
var _InfoPopoverStyle = _interopRequireDefault(require("./styles/InfoPopover.style.js"));
|
|
15
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
const indicatorQuery = {
|
|
19
|
+
indicator: {
|
|
20
|
+
resource: 'indicators',
|
|
21
|
+
id: _ref => {
|
|
22
|
+
let {
|
|
23
|
+
id
|
|
24
|
+
} = _ref;
|
|
25
|
+
return id;
|
|
26
|
+
},
|
|
27
|
+
params: _ref2 => {
|
|
28
|
+
let {
|
|
29
|
+
displayNameProp
|
|
30
|
+
} = _ref2;
|
|
31
|
+
return {
|
|
32
|
+
fields: `${(0, _InfoTable.getCommonFields)(displayNameProp)},annualized,dataSets[id,displayName],decimals,denominator,displayDenominatorDescription,displayNumeratorDescription,indicatorGroups[id,displayName],indicatorType[displayName,factor],legendSets[id,displayName],numerator`
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const IndicatorInfo = _ref3 => {
|
|
38
|
+
let {
|
|
39
|
+
type,
|
|
40
|
+
id,
|
|
41
|
+
displayNameProp
|
|
42
|
+
} = _ref3;
|
|
43
|
+
const [data, setData] = (0, _react.useState)();
|
|
44
|
+
const [error, setError] = (0, _react.useState)();
|
|
45
|
+
const [loading, setLoading] = (0, _react.useState)(true);
|
|
46
|
+
const engine = (0, _appRuntime.useDataEngine)();
|
|
47
|
+
const [getHumanReadableExpression] = (0, _appRuntime.useDataMutation)(_expression.validateIndicatorExpressionMutation, {
|
|
48
|
+
onError: setError
|
|
49
|
+
});
|
|
50
|
+
const fetchData = (0, _react.useCallback)(async () => {
|
|
51
|
+
const {
|
|
52
|
+
indicator
|
|
53
|
+
} = await engine.query(indicatorQuery, {
|
|
54
|
+
variables: {
|
|
55
|
+
id,
|
|
56
|
+
displayNameProp
|
|
57
|
+
},
|
|
58
|
+
onError: setError
|
|
59
|
+
});
|
|
60
|
+
if (indicator.denominator) {
|
|
61
|
+
const result = await getHumanReadableExpression({
|
|
62
|
+
expression: indicator.denominator
|
|
63
|
+
});
|
|
64
|
+
if (result) {
|
|
65
|
+
indicator.humanReadableDenominatorExpression = result;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (indicator.numerator) {
|
|
69
|
+
const result = await getHumanReadableExpression({
|
|
70
|
+
expression: indicator.numerator
|
|
71
|
+
});
|
|
72
|
+
if (result) {
|
|
73
|
+
indicator.humanReadableNumeratorExpression = result;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
setData({
|
|
77
|
+
indicator
|
|
78
|
+
});
|
|
79
|
+
setLoading(false);
|
|
80
|
+
}, [displayNameProp, engine, getHumanReadableExpression, id]);
|
|
81
|
+
(0, _react.useEffect)(() => {
|
|
82
|
+
fetchData();
|
|
83
|
+
}, [fetchData]);
|
|
84
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_InfoTable.InfoTable, {
|
|
85
|
+
dataType: type,
|
|
86
|
+
data: data === null || data === void 0 ? void 0 : data.indicator,
|
|
87
|
+
loading: loading,
|
|
88
|
+
error: error
|
|
89
|
+
}, /*#__PURE__*/_react.default.createElement("tr", {
|
|
90
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
92
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
93
|
+
}, _index.default.t('Numerator description')), /*#__PURE__*/_react.default.createElement("td", {
|
|
94
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
95
|
+
}, data !== null && data !== void 0 && data.indicator.displayNumeratorDescription ? data.indicator.displayNumeratorDescription : /*#__PURE__*/_react.default.createElement("span", {
|
|
96
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "none"
|
|
97
|
+
}, _index.default.t('None')))), /*#__PURE__*/_react.default.createElement("tr", {
|
|
98
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
99
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
100
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
101
|
+
}, _index.default.t('Numerator expression')), /*#__PURE__*/_react.default.createElement("td", {
|
|
102
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
103
|
+
}, data !== null && data !== void 0 && data.indicator.humanReadableNumeratorExpression ? (0, _InfoTable.renderHumanReadableExpression)(data.indicator.humanReadableNumeratorExpression) : /*#__PURE__*/_react.default.createElement("span", {
|
|
104
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "none"
|
|
105
|
+
}, _index.default.t('None')))), /*#__PURE__*/_react.default.createElement("tr", {
|
|
106
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
107
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
108
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
109
|
+
}, _index.default.t('Denominator description')), /*#__PURE__*/_react.default.createElement("td", {
|
|
110
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
111
|
+
}, data !== null && data !== void 0 && data.indicator.displayDenominatorDescription ? data.indicator.displayDenominatorDescription : /*#__PURE__*/_react.default.createElement("span", {
|
|
112
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "none"
|
|
113
|
+
}, _index.default.t('None')))), /*#__PURE__*/_react.default.createElement("tr", {
|
|
114
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
115
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
116
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
117
|
+
}, _index.default.t('Denominator expression')), /*#__PURE__*/_react.default.createElement("td", {
|
|
118
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
119
|
+
}, data !== null && data !== void 0 && data.indicator.humanReadableDenominatorExpression ? (0, _InfoTable.renderHumanReadableExpression)(data.indicator.humanReadableDenominatorExpression) : /*#__PURE__*/_react.default.createElement("span", {
|
|
120
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "none"
|
|
121
|
+
}, _index.default.t('None')))), /*#__PURE__*/_react.default.createElement("tr", {
|
|
122
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
123
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
124
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
125
|
+
}, _index.default.t('Annualized')), /*#__PURE__*/_react.default.createElement("td", {
|
|
126
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
127
|
+
}, data !== null && data !== void 0 && data.indicator.annualized ? _index.default.t('Yes') : _index.default.t('No'))), /*#__PURE__*/_react.default.createElement("tr", {
|
|
128
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
129
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
130
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
131
|
+
}, _index.default.t('Indicator type')), /*#__PURE__*/_react.default.createElement("td", {
|
|
132
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
133
|
+
}, `${data === null || data === void 0 ? void 0 : data.indicator.indicatorType.displayName}, ${data === null || data === void 0 ? void 0 : data.indicator.indicatorType.factor}`)), (data === null || data === void 0 ? void 0 : data.indicator.decimals) && /*#__PURE__*/_react.default.createElement("tr", {
|
|
134
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
135
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
136
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
137
|
+
}, _index.default.t('Decimals in output')), /*#__PURE__*/_react.default.createElement("td", {
|
|
138
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
139
|
+
}, data.indicator.decimals)), Boolean(data === null || data === void 0 ? void 0 : data.indicator.dataSets.length) && /*#__PURE__*/_react.default.createElement("tr", {
|
|
140
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
141
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
142
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
143
|
+
}, _index.default.t('Data set(s)')), /*#__PURE__*/_react.default.createElement("td", {
|
|
144
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
145
|
+
}, data.indicator.dataSets.length === 1 ? data.indicator.dataSets[0].displayName : /*#__PURE__*/_react.default.createElement("div", {
|
|
146
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "content-wrap"
|
|
147
|
+
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
148
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
149
|
+
}, data.indicator.dataSets.map(_ref4 => {
|
|
150
|
+
let {
|
|
151
|
+
id,
|
|
152
|
+
displayName
|
|
153
|
+
} = _ref4;
|
|
154
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
155
|
+
key: id,
|
|
156
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
157
|
+
}, displayName);
|
|
158
|
+
}))))), /*#__PURE__*/_react.default.createElement("tr", {
|
|
159
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
160
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
161
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
162
|
+
}, _index.default.t('Group membership')), /*#__PURE__*/_react.default.createElement("td", {
|
|
163
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
164
|
+
}, (data === null || data === void 0 ? void 0 : data.indicator.indicatorGroups) && (0, _InfoTable.renderGroupMemberships)(data.indicator.indicatorGroups))), Boolean(data === null || data === void 0 ? void 0 : data.indicator.legendSets.length) && /*#__PURE__*/_react.default.createElement("tr", {
|
|
165
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
166
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
167
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
168
|
+
}, _index.default.t('Legend set(s)')), /*#__PURE__*/_react.default.createElement("td", {
|
|
169
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
170
|
+
}, (0, _InfoTable.renderLegendSets)(data.indicator.legendSets)))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
171
|
+
id: _InfoPopoverStyle.default.__hash
|
|
172
|
+
}, _InfoPopoverStyle.default));
|
|
173
|
+
};
|
|
174
|
+
exports.IndicatorInfo = IndicatorInfo;
|
|
175
|
+
IndicatorInfo.propTypes = {
|
|
176
|
+
displayNameProp: _propTypes.default.string,
|
|
177
|
+
id: _propTypes.default.string,
|
|
178
|
+
type: _propTypes.default.string
|
|
179
|
+
};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.InfoPopover = void 0;
|
|
7
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
8
|
+
var _ui = require("@dhis2/ui");
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _react = _interopRequireDefault(require("react"));
|
|
11
|
+
var _dataSets = require("../../../modules/dataSets.js");
|
|
12
|
+
var _dataTypes = require("../../../modules/dataTypes.js");
|
|
13
|
+
var _CalculationInfo = require("./CalculationInfo.js");
|
|
14
|
+
var _DataElementInfo = require("./DataElementInfo.js");
|
|
15
|
+
var _DataElementOperandInfo = require("./DataElementOperandInfo.js");
|
|
16
|
+
var _DataSetInfo = require("./DataSetInfo.js");
|
|
17
|
+
var _EventDataItemInfo = require("./EventDataItemInfo.js");
|
|
18
|
+
var _IndicatorInfo = require("./IndicatorInfo.js");
|
|
19
|
+
var _ProgramIndicatorInfo = require("./ProgramIndicatorInfo.js");
|
|
20
|
+
var _InfoPopoverStyle = _interopRequireDefault(require("./styles/InfoPopover.style.js"));
|
|
21
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
22
|
+
// data sets
|
|
23
|
+
|
|
24
|
+
const InfoPopover = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
reference,
|
|
27
|
+
onClose,
|
|
28
|
+
dataTest,
|
|
29
|
+
...props
|
|
30
|
+
} = _ref;
|
|
31
|
+
const type = props.item.type;
|
|
32
|
+
const infoProps = {
|
|
33
|
+
type,
|
|
34
|
+
id: props.item.id,
|
|
35
|
+
displayNameProp: props.displayNameProp
|
|
36
|
+
};
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_ui.Popover, {
|
|
38
|
+
placement: "bottom-end",
|
|
39
|
+
reference: reference,
|
|
40
|
+
onClickOutside: onClose,
|
|
41
|
+
maxWidth: 480,
|
|
42
|
+
arrow: false,
|
|
43
|
+
elevation: "rgba(0, 0, 0, 0.1) 0px 1px 5px, rgba(0, 0, 0, 0.07) 0px 3.6px 13px, rgba(0, 0, 0, 0.06) 0px 8.4px 23px, rgba(0, 0, 0, 0.05) 0px 23px 35px"
|
|
44
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
45
|
+
"data-test": `${dataTest}-table`,
|
|
46
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "popover"
|
|
47
|
+
}, type === _dataTypes.DIMENSION_TYPE_DATA_ELEMENT && /*#__PURE__*/_react.default.createElement(_DataElementInfo.DataElementInfo, infoProps), type === _dataTypes.DIMENSION_TYPE_DATA_ELEMENT_OPERAND && /*#__PURE__*/_react.default.createElement(_DataElementOperandInfo.DataElementOperandInfo, infoProps), type === _dataTypes.DIMENSION_TYPE_EXPRESSION_DIMENSION_ITEM && /*#__PURE__*/_react.default.createElement(_CalculationInfo.CalculationInfo, infoProps), type === _dataSets.REPORTING_RATE /* TODO: verify this! */ && /*#__PURE__*/_react.default.createElement(_DataSetInfo.DataSetInfo, infoProps), type === _dataTypes.DIMENSION_TYPE_INDICATOR && /*#__PURE__*/_react.default.createElement(_IndicatorInfo.IndicatorInfo, infoProps), [_dataTypes.DIMENSION_TYPE_PROGRAM_ATTRIBUTE, _dataTypes.DIMENSION_TYPE_PROGRAM_DATA_ELEMENT].includes(type) && /*#__PURE__*/_react.default.createElement(_EventDataItemInfo.EventDataItemInfo, infoProps), type === _dataTypes.DIMENSION_TYPE_PROGRAM_INDICATOR && /*#__PURE__*/_react.default.createElement(_ProgramIndicatorInfo.ProgramIndicatorInfo, infoProps))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
48
|
+
id: _InfoPopoverStyle.default.__hash
|
|
49
|
+
}, _InfoPopoverStyle.default));
|
|
50
|
+
};
|
|
51
|
+
exports.InfoPopover = InfoPopover;
|
|
52
|
+
InfoPopover.propTypes = {
|
|
53
|
+
dataTest: _propTypes.default.string,
|
|
54
|
+
displayNameProp: _propTypes.default.string,
|
|
55
|
+
item: _propTypes.default.object,
|
|
56
|
+
reference: _propTypes.default.object,
|
|
57
|
+
onClose: _propTypes.default.func
|
|
58
|
+
};
|