@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,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.sentenceCaseText = exports.renderLegendSets = exports.renderHumanReadableExpression = exports.renderGroupMemberships = exports.renderDataSets = exports.getCommonFields = exports.capitalizeText = exports.InfoTable = void 0;
|
|
7
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
8
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
9
|
+
var _ui = require("@dhis2/ui");
|
|
10
|
+
var _moment = _interopRequireDefault(require("moment"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _react = _interopRequireDefault(require("react"));
|
|
13
|
+
var _index = _interopRequireDefault(require("../../../locales/index.js"));
|
|
14
|
+
var _dataTypes = require("../../../modules/dataTypes.js");
|
|
15
|
+
var _InfoPopoverStyle = _interopRequireDefault(require("./styles/InfoPopover.style.js"));
|
|
16
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
17
|
+
const getCommonFields = displayNameProp => `attributeValues[attribute[id,displayName],value],code,created,createdBy,${displayNameProp}~rename(displayName),displayDescription,href,id,lastUpdated`;
|
|
18
|
+
exports.getCommonFields = getCommonFields;
|
|
19
|
+
const capitalizeText = text => text && text.charAt(0).toUpperCase() + text.slice(1).toLowerCase();
|
|
20
|
+
exports.capitalizeText = capitalizeText;
|
|
21
|
+
const sentenceCaseText = text => text && capitalizeText(text.replaceAll('_', ' ').toLowerCase());
|
|
22
|
+
exports.sentenceCaseText = sentenceCaseText;
|
|
23
|
+
const renderDataSets = dataSets => {
|
|
24
|
+
if (dataSets.length === 0) {
|
|
25
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
26
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "none"
|
|
27
|
+
}, _index.default.t('None')), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
28
|
+
id: _InfoPopoverStyle.default.__hash
|
|
29
|
+
}, _InfoPopoverStyle.default));
|
|
30
|
+
} else if (dataSets.length === 1) {
|
|
31
|
+
return dataSets[0].displayName;
|
|
32
|
+
} else {
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
34
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "content-wrap"
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
36
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
37
|
+
}, dataSets.map(_ref => {
|
|
38
|
+
let {
|
|
39
|
+
id,
|
|
40
|
+
displayName
|
|
41
|
+
} = _ref;
|
|
42
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
43
|
+
key: id,
|
|
44
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
45
|
+
}, displayName);
|
|
46
|
+
}))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
47
|
+
id: _InfoPopoverStyle.default.__hash
|
|
48
|
+
}, _InfoPopoverStyle.default));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
exports.renderDataSets = renderDataSets;
|
|
52
|
+
const renderGroupMemberships = groups => {
|
|
53
|
+
if (groups.length === 0) {
|
|
54
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
55
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "none"
|
|
56
|
+
}, _index.default.t('None')), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
57
|
+
id: _InfoPopoverStyle.default.__hash
|
|
58
|
+
}, _InfoPopoverStyle.default));
|
|
59
|
+
} else if (groups.length === 1) {
|
|
60
|
+
return groups[0].displayName;
|
|
61
|
+
} else {
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
63
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "content-wrap"
|
|
64
|
+
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
65
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
66
|
+
}, groups.map(_ref2 => {
|
|
67
|
+
let {
|
|
68
|
+
id,
|
|
69
|
+
displayName
|
|
70
|
+
} = _ref2;
|
|
71
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
72
|
+
key: id,
|
|
73
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
74
|
+
}, displayName);
|
|
75
|
+
}))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
76
|
+
id: _InfoPopoverStyle.default.__hash
|
|
77
|
+
}, _InfoPopoverStyle.default));
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
exports.renderGroupMemberships = renderGroupMemberships;
|
|
81
|
+
const renderHumanReadableExpression = expressionData => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, expressionData.status === 'ERROR' ? /*#__PURE__*/_react.default.createElement("span", {
|
|
82
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "none"
|
|
83
|
+
}, expressionData.message) : /*#__PURE__*/_react.default.createElement("span", {
|
|
84
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "code"
|
|
85
|
+
}, expressionData.description), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
86
|
+
id: _InfoPopoverStyle.default.__hash
|
|
87
|
+
}, _InfoPopoverStyle.default));
|
|
88
|
+
exports.renderHumanReadableExpression = renderHumanReadableExpression;
|
|
89
|
+
const renderLegendSets = legendSets => {
|
|
90
|
+
return legendSets.length === 1 ? legendSets[0].displayName : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
91
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "content-wrap"
|
|
92
|
+
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
93
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
94
|
+
}, legendSets.map(_ref3 => {
|
|
95
|
+
let {
|
|
96
|
+
id,
|
|
97
|
+
displayName
|
|
98
|
+
} = _ref3;
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
100
|
+
key: id,
|
|
101
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
102
|
+
}, displayName);
|
|
103
|
+
}))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
104
|
+
id: _InfoPopoverStyle.default.__hash
|
|
105
|
+
}, _InfoPopoverStyle.default));
|
|
106
|
+
};
|
|
107
|
+
exports.renderLegendSets = renderLegendSets;
|
|
108
|
+
const InfoTable = _ref4 => {
|
|
109
|
+
let {
|
|
110
|
+
dataType,
|
|
111
|
+
data,
|
|
112
|
+
error,
|
|
113
|
+
loading,
|
|
114
|
+
children
|
|
115
|
+
} = _ref4;
|
|
116
|
+
const {
|
|
117
|
+
fromServerDate
|
|
118
|
+
} = (0, _appRuntime.useTimeZoneConversion)();
|
|
119
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, loading && /*#__PURE__*/_react.default.createElement("div", {
|
|
120
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "loader"
|
|
121
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.Center, null, /*#__PURE__*/_react.default.createElement(_ui.CircularLoader, {
|
|
122
|
+
small: true
|
|
123
|
+
}))), error && /*#__PURE__*/_react.default.createElement("div", {
|
|
124
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "error"
|
|
125
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
126
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
127
|
+
}, _index.default.t('There was a problem loading information for this data item.'))), data && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("table", {
|
|
128
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "data-table"
|
|
129
|
+
}, /*#__PURE__*/_react.default.createElement("tbody", {
|
|
130
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
131
|
+
}, /*#__PURE__*/_react.default.createElement("tr", {
|
|
132
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
133
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
134
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
135
|
+
}, _index.default.t('Name')), /*#__PURE__*/_react.default.createElement("td", {
|
|
136
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
137
|
+
}, data.displayName)), children, dataType !== _dataTypes.DIMENSION_TYPE_EXPRESSION_DIMENSION_ITEM ? /*#__PURE__*/_react.default.createElement("tr", {
|
|
138
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
139
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
140
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
141
|
+
}, _index.default.t('Description')), /*#__PURE__*/_react.default.createElement("td", {
|
|
142
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
143
|
+
}, data.displayDescription ? /*#__PURE__*/_react.default.createElement("div", {
|
|
144
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "content-wrap"
|
|
145
|
+
}, data.displayDescription) : /*#__PURE__*/_react.default.createElement("span", {
|
|
146
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "none"
|
|
147
|
+
}, _index.default.t('None')))) : data.displayDescription && /*#__PURE__*/_react.default.createElement("tr", {
|
|
148
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
149
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
150
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
151
|
+
}, _index.default.t('Description')), /*#__PURE__*/_react.default.createElement("td", {
|
|
152
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
153
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
154
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "content-wrap"
|
|
155
|
+
}, data.displayDescription))), dataType !== _dataTypes.DIMENSION_TYPE_EXPRESSION_DIMENSION_ITEM ? /*#__PURE__*/_react.default.createElement("tr", {
|
|
156
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
157
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
158
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
159
|
+
}, _index.default.t('Code')), /*#__PURE__*/_react.default.createElement("td", {
|
|
160
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
161
|
+
}, data.code ? data.code : /*#__PURE__*/_react.default.createElement("span", {
|
|
162
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "none"
|
|
163
|
+
}, _index.default.t('None')))) : data.code && /*#__PURE__*/_react.default.createElement("tr", {
|
|
164
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
165
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
166
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
167
|
+
}, _index.default.t('Code')), /*#__PURE__*/_react.default.createElement("td", {
|
|
168
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
169
|
+
}, data.code)), /*#__PURE__*/_react.default.createElement("tr", {
|
|
170
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
171
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
172
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
173
|
+
}, _index.default.t('ID')), /*#__PURE__*/_react.default.createElement("td", {
|
|
174
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
175
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
176
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "code"
|
|
177
|
+
}, data.id))), /*#__PURE__*/_react.default.createElement("tr", {
|
|
178
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
179
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
180
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
181
|
+
}, _index.default.t('Last updated date')), /*#__PURE__*/_react.default.createElement("td", {
|
|
182
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
183
|
+
}, `${(0, _moment.default)(fromServerDate(data.lastUpdated)).fromNow()} (${(0, _moment.default)(fromServerDate(data.lastUpdated)).format('YYYY-MM-DD')})`)), /*#__PURE__*/_react.default.createElement("tr", {
|
|
184
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
185
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
186
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
187
|
+
}, _index.default.t('Created date')), /*#__PURE__*/_react.default.createElement("td", {
|
|
188
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
189
|
+
}, `${(0, _moment.default)(fromServerDate(data.created)).fromNow()} (${(0, _moment.default)(fromServerDate(data.created)).format('YYYY-MM-DD')})`)), /*#__PURE__*/_react.default.createElement("tr", {
|
|
190
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
191
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
192
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
193
|
+
}, _index.default.t('Created by')), /*#__PURE__*/_react.default.createElement("td", {
|
|
194
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
195
|
+
}, `${data.createdBy.displayName}, ${data.createdBy.username}`)), data.attributeValues.map(_ref5 => {
|
|
196
|
+
let {
|
|
197
|
+
attribute,
|
|
198
|
+
value
|
|
199
|
+
} = _ref5;
|
|
200
|
+
return /*#__PURE__*/_react.default.createElement("tr", {
|
|
201
|
+
key: attribute.id,
|
|
202
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
203
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
204
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
205
|
+
}, attribute.displayName), /*#__PURE__*/_react.default.createElement("td", {
|
|
206
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
207
|
+
}, value));
|
|
208
|
+
})))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
209
|
+
id: _InfoPopoverStyle.default.__hash
|
|
210
|
+
}, _InfoPopoverStyle.default));
|
|
211
|
+
};
|
|
212
|
+
exports.InfoTable = InfoTable;
|
|
213
|
+
InfoTable.propTypes = {
|
|
214
|
+
children: _propTypes.default.node,
|
|
215
|
+
data: _propTypes.default.object,
|
|
216
|
+
dataType: _propTypes.default.string,
|
|
217
|
+
error: _propTypes.default.string,
|
|
218
|
+
loading: _propTypes.default.bool
|
|
219
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ProgramIndicatorInfo = 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 programIndicatorQuery = {
|
|
19
|
+
programIndicator: {
|
|
20
|
+
resource: 'programIndicators',
|
|
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)},aggregationType,analyticsPeriodBoundaries[analyticsPeriodBoundaryType,boundaryTarget,id,offsetPeriodType,offsetPeriods],analyticsType,decimals,expression,filter,legendSets[id,displayName],program[displayName]`
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const ProgramIndicatorInfo = _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.validateProgramIndicatorExpressionMutation, {
|
|
48
|
+
onError: setError
|
|
49
|
+
});
|
|
50
|
+
const fetchData = (0, _react.useCallback)(async () => {
|
|
51
|
+
const {
|
|
52
|
+
programIndicator
|
|
53
|
+
} = await engine.query(programIndicatorQuery, {
|
|
54
|
+
variables: {
|
|
55
|
+
id,
|
|
56
|
+
displayNameProp
|
|
57
|
+
},
|
|
58
|
+
onError: setError
|
|
59
|
+
});
|
|
60
|
+
if (programIndicator.expression) {
|
|
61
|
+
const result = await getHumanReadableExpression({
|
|
62
|
+
expression: programIndicator.expression
|
|
63
|
+
});
|
|
64
|
+
if (result) {
|
|
65
|
+
programIndicator.humanReadableExpression = result;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (programIndicator.filter) {
|
|
69
|
+
const result = await getHumanReadableExpression({
|
|
70
|
+
expression: programIndicator.filter
|
|
71
|
+
});
|
|
72
|
+
if (result) {
|
|
73
|
+
programIndicator.humanReadableFilter = result;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
programIndicator.analyticsPeriodBoundaries.forEach((_ref4, index) => {
|
|
77
|
+
let {
|
|
78
|
+
boundaryTarget
|
|
79
|
+
} = _ref4;
|
|
80
|
+
programIndicator.analyticsPeriodBoundaries[index].boundaryTarget = ['ENROLLMENT_DATE', 'EVENT_DATE', 'INCIDENT_DATE'].includes(boundaryTarget) ? (0, _InfoTable.sentenceCaseText)(boundaryTarget) : _index.default.t('Custom');
|
|
81
|
+
});
|
|
82
|
+
setData({
|
|
83
|
+
programIndicator
|
|
84
|
+
});
|
|
85
|
+
setLoading(false);
|
|
86
|
+
}, [displayNameProp, engine, id, getHumanReadableExpression]);
|
|
87
|
+
(0, _react.useEffect)(() => {
|
|
88
|
+
fetchData();
|
|
89
|
+
}, [fetchData]);
|
|
90
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_InfoTable.InfoTable, {
|
|
91
|
+
dataType: type,
|
|
92
|
+
data: data === null || data === void 0 ? void 0 : data.programIndicator,
|
|
93
|
+
loading: loading,
|
|
94
|
+
error: error
|
|
95
|
+
}, /*#__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('Program')), /*#__PURE__*/_react.default.createElement("td", {
|
|
100
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
101
|
+
}, data === null || data === void 0 ? void 0 : data.programIndicator.program.displayName)), /*#__PURE__*/_react.default.createElement("tr", {
|
|
102
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
103
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
104
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
105
|
+
}, _index.default.t('Analytics type')), /*#__PURE__*/_react.default.createElement("td", {
|
|
106
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
107
|
+
}, (data === null || data === void 0 ? void 0 : data.programIndicator.analyticsType) === 'ENROLLMENT' ? _index.default.t('Enrollment') : _index.default.t('Event'))), /*#__PURE__*/_react.default.createElement("tr", {
|
|
108
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
109
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
110
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
111
|
+
}, _index.default.t('Analytics period boundaries')), /*#__PURE__*/_react.default.createElement("td", {
|
|
112
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
113
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
114
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "content-wrap"
|
|
115
|
+
}, /*#__PURE__*/_react.default.createElement("ul", {
|
|
116
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
117
|
+
}, data === null || data === void 0 ? void 0 : data.programIndicator.analyticsPeriodBoundaries.map(_ref5 => {
|
|
118
|
+
let {
|
|
119
|
+
analyticsPeriodBoundaryType,
|
|
120
|
+
boundaryTarget,
|
|
121
|
+
id,
|
|
122
|
+
offsetPeriodType,
|
|
123
|
+
offsetPeriods
|
|
124
|
+
} = _ref5;
|
|
125
|
+
return /*#__PURE__*/_react.default.createElement("li", {
|
|
126
|
+
key: id,
|
|
127
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
128
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
129
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
130
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
131
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "label"
|
|
132
|
+
}, _index.default.t('Type:'), "\xA0"), (0, _InfoTable.sentenceCaseText)(analyticsPeriodBoundaryType)), /*#__PURE__*/_react.default.createElement("br", {
|
|
133
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
134
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
135
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
136
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
137
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "label"
|
|
138
|
+
}, _index.default.t('Target:'), "\xA0"), boundaryTarget), Boolean(offsetPeriods) && Boolean(offsetPeriodType) && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("br", {
|
|
139
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
140
|
+
}), /*#__PURE__*/_react.default.createElement("span", {
|
|
141
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
142
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
143
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "label"
|
|
144
|
+
}, _index.default.t('Offset:'), "\xA0"), _index.default.t('{{ offsetPeriodType }} × {{ offsetPeriods }}', {
|
|
145
|
+
offsetPeriodType,
|
|
146
|
+
offsetPeriods
|
|
147
|
+
}))));
|
|
148
|
+
}))))), /*#__PURE__*/_react.default.createElement("tr", {
|
|
149
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
150
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
151
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
152
|
+
}, _index.default.t('Expression')), /*#__PURE__*/_react.default.createElement("td", {
|
|
153
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
154
|
+
}, data !== null && data !== void 0 && data.programIndicator.humanReadableExpression ? (0, _InfoTable.renderHumanReadableExpression)(data.programIndicator.humanReadableExpression) : /*#__PURE__*/_react.default.createElement("span", {
|
|
155
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "none"
|
|
156
|
+
}, _index.default.t('None')))), /*#__PURE__*/_react.default.createElement("tr", {
|
|
157
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
158
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
159
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
160
|
+
}, _index.default.t('Filter')), /*#__PURE__*/_react.default.createElement("td", {
|
|
161
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
162
|
+
}, data !== null && data !== void 0 && data.programIndicator.humanReadableFilter ? (0, _InfoTable.renderHumanReadableExpression)(data.programIndicator.humanReadableFilter) : /*#__PURE__*/_react.default.createElement("span", {
|
|
163
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}` + " " + "none"
|
|
164
|
+
}, _index.default.t('None')))), /*#__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('Aggregation type')), /*#__PURE__*/_react.default.createElement("td", {
|
|
169
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
170
|
+
}, data === null || data === void 0 ? void 0 : data.programIndicator.aggregationType)), (data === null || data === void 0 ? void 0 : data.programIndicator) && 'decimals' in data.programIndicator && /*#__PURE__*/_react.default.createElement("tr", {
|
|
171
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
172
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
173
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
174
|
+
}, _index.default.t('Decimals in output')), /*#__PURE__*/_react.default.createElement("td", {
|
|
175
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
176
|
+
}, data.programIndicator.decimals)), Boolean(data === null || data === void 0 ? void 0 : data.programIndicator.legendSets.length) && /*#__PURE__*/_react.default.createElement("tr", {
|
|
177
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
178
|
+
}, /*#__PURE__*/_react.default.createElement("th", {
|
|
179
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
180
|
+
}, _index.default.t('Legend set(s)')), /*#__PURE__*/_react.default.createElement("td", {
|
|
181
|
+
className: `jsx-${_InfoPopoverStyle.default.__hash}`
|
|
182
|
+
}, (0, _InfoTable.renderLegendSets)(data.programIndicator.legendSets)))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
183
|
+
id: _InfoPopoverStyle.default.__hash
|
|
184
|
+
}, _InfoPopoverStyle.default));
|
|
185
|
+
};
|
|
186
|
+
exports.ProgramIndicatorInfo = ProgramIndicatorInfo;
|
|
187
|
+
ProgramIndicatorInfo.propTypes = {
|
|
188
|
+
displayNameProp: _propTypes.default.string,
|
|
189
|
+
id: _propTypes.default.string,
|
|
190
|
+
type: _propTypes.default.string
|
|
191
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _ui = require("@dhis2/ui");
|
|
8
|
+
const _defaultExport = [`.popover.jsx-681815212{width:480px;height:360px;border:1px solid ${_ui.colors.grey400};overflow-x:hidden;overflow-y:auto;}`, ".loader.jsx-681815212{height:100%;width:100%;}", `.error.jsx-681815212{height:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-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;font-size:14px;color:${_ui.colors.grey700};}`, `.data-table.jsx-681815212{display:table;width:100%;border-collapse:collapse;font-size:13px;line-height:17px;margin:${_ui.spacers.dp4} 0 0 0;color:${_ui.colors.grey900};}`, ".data-table.jsx-681815212 th.jsx-681815212{text-align:left;font-weight:500;padding:8px 0 8px 12px;width:128px;vertical-align:top;}", ".data-table.jsx-681815212 td.jsx-681815212{padding:8px 4px 8px 16px;vertical-align:top;}", ".data-table.jsx-681815212 .content-wrap.jsx-681815212{max-height:240px;overflow-y:auto;}", `.data-table.jsx-681815212 tr.jsx-681815212:hover{background:${_ui.colors.grey100};}`, `ul.jsx-681815212{margin:0;padding:0 0 0 ${_ui.spacers.dp16};list-style-position:outside;}`, `li.jsx-681815212+li.jsx-681815212{margin:${_ui.spacers.dp4} 0 0 0;}`, `details.jsx-681815212 ul.jsx-681815212{margin:${_ui.spacers.dp4} 0 0 ${_ui.spacers.dp16};}`, `.data-table.jsx-681815212 .code.jsx-681815212{font-size:11px;line-height:15px;display:inline-block;border-radius:2px;background-color:${_ui.colors.grey200};outline:3px solid ${_ui.colors.grey200};color:${_ui.colors.grey900};font-family:ui-monospace,'Cascadia Code','Source Code Pro',Menlo, Consolas,'DejaVu Sans Mono',monospace;font-weight:normal;}`, `.data-table.jsx-681815212 .none.jsx-681815212,.data-table.jsx-681815212 .label.jsx-681815212{color:${_ui.colors.grey600};}`];
|
|
9
|
+
_defaultExport.__hash = "681815212";
|
|
10
|
+
var _default = exports.default = _defaultExport;
|
|
@@ -17,10 +17,11 @@ var _dimensionListItem = require("../../modules/dimensionListItem.js");
|
|
|
17
17
|
var _dimensionSelectorHelper = require("../../modules/dimensionSelectorHelper.js");
|
|
18
18
|
var _utils = require("../../modules/utils.js");
|
|
19
19
|
var _DimensionSelectorStyle = _interopRequireDefault(require("../styles/DimensionSelector.style.js"));
|
|
20
|
-
var _TransferOption = require("../TransferOption.js");
|
|
21
20
|
var _CalculationModal = _interopRequireDefault(require("./Calculation/CalculationModal.js"));
|
|
22
21
|
var _DataTypeSelector = _interopRequireDefault(require("./DataTypeSelector.js"));
|
|
23
22
|
var _GroupSelector = _interopRequireDefault(require("./GroupSelector.js"));
|
|
23
|
+
var _InfoPopover = require("./Info/InfoPopover.js");
|
|
24
|
+
var _TransferOption = require("./TransferOption.js");
|
|
24
25
|
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); }
|
|
25
26
|
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; }
|
|
26
27
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -212,6 +213,7 @@ const ItemSelector = _ref5 => {
|
|
|
212
213
|
dataTest,
|
|
213
214
|
onEDISave
|
|
214
215
|
} = _ref5;
|
|
216
|
+
const itemsRef = (0, _react.useRef)(new Map());
|
|
215
217
|
const [state, setState] = (0, _react.useState)({
|
|
216
218
|
searchTerm: '',
|
|
217
219
|
dataTypes,
|
|
@@ -231,12 +233,13 @@ const ItemSelector = _ref5 => {
|
|
|
231
233
|
}).includes(_dataTypes.DIMENSION_TYPE_EXPRESSION_DIMENSION_ITEM)
|
|
232
234
|
});
|
|
233
235
|
const [currentCalculation, setCurrentCalculation] = (0, _react.useState)();
|
|
236
|
+
const [currentDataItem, setCurrentDataItem] = (0, _react.useState)();
|
|
237
|
+
const debouncedSearchTerm = (0, _utils.useDebounce)(state.searchTerm, 500);
|
|
234
238
|
const dataEngine = (0, _appRuntime.useDataEngine)();
|
|
235
239
|
const setSearchTerm = searchTerm => setState(state => ({
|
|
236
240
|
...state,
|
|
237
241
|
searchTerm
|
|
238
242
|
}));
|
|
239
|
-
const debouncedSearchTerm = (0, _utils.useDebounce)(state.searchTerm, 500);
|
|
240
243
|
const fetchItems = async page => {
|
|
241
244
|
var _result$dimensionItem;
|
|
242
245
|
setState(state => ({
|
|
@@ -400,7 +403,9 @@ const ItemSelector = _ref5 => {
|
|
|
400
403
|
subGroup: dataType === _dataTypes.DIMENSION_TYPE_DATA_ELEMENT ? _dataTypes.TOTALS : null
|
|
401
404
|
}
|
|
402
405
|
}));
|
|
403
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
406
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
407
|
+
className: `jsx-${_DimensionSelectorStyle.default.__hash}` + " " + "transfer-container"
|
|
408
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.Transfer, {
|
|
404
409
|
onChange: _ref9 => {
|
|
405
410
|
let {
|
|
406
411
|
selected
|
|
@@ -454,17 +459,23 @@ const ItemSelector = _ref5 => {
|
|
|
454
459
|
return /*#__PURE__*/_react.default.createElement(_TransferOption.TransferOption
|
|
455
460
|
/* eslint-disable react/prop-types */, _extends({}, props, {
|
|
456
461
|
active: isActive(props.value),
|
|
462
|
+
showingInfo: (currentDataItem === null || currentDataItem === void 0 ? void 0 : currentDataItem.id) === props.value,
|
|
457
463
|
icon: (0, _dimensionListItem.getIcon)(getItemType(props.value)),
|
|
458
|
-
|
|
464
|
+
dimensionType: (0, _dimensionListItem.getDimensionType)({
|
|
459
465
|
type: getItemType(props.value),
|
|
460
466
|
expression: props.expression
|
|
461
467
|
}),
|
|
462
468
|
dataTest: `${dataTest}-transfer-option`,
|
|
469
|
+
itemsRef: itemsRef,
|
|
463
470
|
onEditClick: getItemType(props.value) === _dataTypes.DIMENSION_TYPE_EXPRESSION_DIMENSION_ITEM && !(((_props$access = props.access) === null || _props$access === void 0 ? void 0 : _props$access.write) === false) && state.supportsEDI ? () => setCurrentCalculation({
|
|
464
471
|
id: props.value,
|
|
465
472
|
name: props.label,
|
|
466
473
|
expression: props.expression
|
|
467
|
-
}) : undefined
|
|
474
|
+
}) : undefined,
|
|
475
|
+
onInfoClick: () => setCurrentDataItem({
|
|
476
|
+
id: props.value,
|
|
477
|
+
type: getItemType(props.value)
|
|
478
|
+
})
|
|
468
479
|
/* eslint-enable react/prop-types */
|
|
469
480
|
}));
|
|
470
481
|
},
|
|
@@ -475,6 +486,12 @@ const ItemSelector = _ref5 => {
|
|
|
475
486
|
onClose: () => setCurrentCalculation(),
|
|
476
487
|
onDelete: onDeleteCalculation,
|
|
477
488
|
displayNameProp: displayNameProp
|
|
489
|
+
}), currentDataItem && /*#__PURE__*/_react.default.createElement(_InfoPopover.InfoPopover, {
|
|
490
|
+
dataTest: `${dataTest}-info`,
|
|
491
|
+
item: currentDataItem,
|
|
492
|
+
reference: itemsRef.current.get(currentDataItem.id),
|
|
493
|
+
onClose: () => setCurrentDataItem(),
|
|
494
|
+
displayNameProp: displayNameProp
|
|
478
495
|
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
479
496
|
id: _DimensionSelectorStyle.default.__hash
|
|
480
497
|
}, _DimensionSelectorStyle.default));
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TransferOption = void 0;
|
|
7
|
+
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
8
|
+
var _ui = require("@dhis2/ui");
|
|
9
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _TransferOptionStyle = _interopRequireDefault(require("./styles/TransferOption.style.js"));
|
|
13
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
|
+
const TransferOption = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
disabled,
|
|
17
|
+
label,
|
|
18
|
+
highlighted,
|
|
19
|
+
selected,
|
|
20
|
+
onClick,
|
|
21
|
+
onDoubleClick,
|
|
22
|
+
value,
|
|
23
|
+
icon,
|
|
24
|
+
active,
|
|
25
|
+
dimensionType,
|
|
26
|
+
dataTest,
|
|
27
|
+
itemsRef,
|
|
28
|
+
showingInfo,
|
|
29
|
+
onEditClick,
|
|
30
|
+
onInfoClick
|
|
31
|
+
} = _ref;
|
|
32
|
+
const renderContent = () => /*#__PURE__*/_react.default.createElement("div", {
|
|
33
|
+
"data-test": `${dataTest}-content`,
|
|
34
|
+
onClick: event => {
|
|
35
|
+
if (disabled) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
onClick({
|
|
39
|
+
label,
|
|
40
|
+
value
|
|
41
|
+
}, event);
|
|
42
|
+
},
|
|
43
|
+
onDoubleClick: event => {
|
|
44
|
+
if (disabled) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
onDoubleClick({
|
|
48
|
+
label,
|
|
49
|
+
value
|
|
50
|
+
}, event);
|
|
51
|
+
},
|
|
52
|
+
className: `jsx-${_TransferOptionStyle.default.__hash}` + " " + ((0, _classnames.default)('item', {
|
|
53
|
+
highlighted,
|
|
54
|
+
disabled,
|
|
55
|
+
selected,
|
|
56
|
+
inactive: active !== undefined && !active
|
|
57
|
+
}) || "")
|
|
58
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
59
|
+
className: `jsx-${_TransferOptionStyle.default.__hash}` + " " + "labelGroup"
|
|
60
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
61
|
+
className: `jsx-${_TransferOptionStyle.default.__hash}` + " " + "icon"
|
|
62
|
+
}, icon), /*#__PURE__*/_react.default.createElement("span", {
|
|
63
|
+
className: `jsx-${_TransferOptionStyle.default.__hash}` + " " + "label"
|
|
64
|
+
}, label), onEditClick && /*#__PURE__*/_react.default.createElement("span", {
|
|
65
|
+
onClick: e => {
|
|
66
|
+
e.stopPropagation();
|
|
67
|
+
onEditClick();
|
|
68
|
+
},
|
|
69
|
+
"data-test": `${dataTest}-edit-button`,
|
|
70
|
+
className: `jsx-${_TransferOptionStyle.default.__hash}` + " " + "edit"
|
|
71
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.IconEdit16, null))), /*#__PURE__*/_react.default.createElement("div", {
|
|
72
|
+
className: `jsx-${_TransferOptionStyle.default.__hash}` + " " + ((0, _classnames.default)('group', 'nowrap', 'typeGroup') || "")
|
|
73
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
74
|
+
className: `jsx-${_TransferOptionStyle.default.__hash}` + " " + "type"
|
|
75
|
+
}, dimensionType), /*#__PURE__*/_react.default.createElement("span", {
|
|
76
|
+
ref: node => {
|
|
77
|
+
node ? itemsRef.current.set(value, node) : itemsRef.current.delete(value);
|
|
78
|
+
}
|
|
79
|
+
// avoid moving items when toggling the info popover
|
|
80
|
+
// sometimes a double click event is fired
|
|
81
|
+
,
|
|
82
|
+
onDoubleClick: e => e.stopPropagation(),
|
|
83
|
+
onClick: e => {
|
|
84
|
+
e.stopPropagation();
|
|
85
|
+
onInfoClick();
|
|
86
|
+
},
|
|
87
|
+
"data-test": `${dataTest}-info-button`,
|
|
88
|
+
className: `jsx-${_TransferOptionStyle.default.__hash}` + " " + ((0, _classnames.default)('info', {
|
|
89
|
+
active: showingInfo
|
|
90
|
+
}) || "")
|
|
91
|
+
}, /*#__PURE__*/_react.default.createElement(_ui.IconInfo16, null))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
92
|
+
id: _TransferOptionStyle.default.__hash
|
|
93
|
+
}, _TransferOptionStyle.default));
|
|
94
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
95
|
+
"data-value": value,
|
|
96
|
+
"data-test": dataTest,
|
|
97
|
+
className: "wrapper"
|
|
98
|
+
}, renderContent());
|
|
99
|
+
};
|
|
100
|
+
exports.TransferOption = TransferOption;
|
|
101
|
+
TransferOption.propTypes = {
|
|
102
|
+
label: _propTypes.default.string.isRequired,
|
|
103
|
+
value: _propTypes.default.string.isRequired,
|
|
104
|
+
active: _propTypes.default.bool,
|
|
105
|
+
dataTest: _propTypes.default.string,
|
|
106
|
+
dimensionType: _propTypes.default.string,
|
|
107
|
+
disabled: _propTypes.default.bool,
|
|
108
|
+
highlighted: _propTypes.default.bool,
|
|
109
|
+
icon: _propTypes.default.node,
|
|
110
|
+
itemsRef: _propTypes.default.object,
|
|
111
|
+
selected: _propTypes.default.bool,
|
|
112
|
+
showingInfo: _propTypes.default.bool,
|
|
113
|
+
onClick: _propTypes.default.func,
|
|
114
|
+
onDoubleClick: _propTypes.default.func,
|
|
115
|
+
onEditClick: _propTypes.default.func,
|
|
116
|
+
onInfoClick: _propTypes.default.func
|
|
117
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _ui = require("@dhis2/ui");
|
|
8
|
+
const _defaultExport = [`.wrapper.jsx-2953719875:last-child{margin-bottom:${_ui.spacers.dp4};}`, `.item.jsx-2953719875{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;background:${_ui.colors.white};font-size:14px;line-height:16px;border-bottom:1px solid ${_ui.colors.grey300};-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}`, `.item.jsx-2953719875:hover{background:${_ui.colors.grey100};}`, ".disabled.jsx-2953719875{opacity:0.3;cursor:not-allowed;}", ".inactive.jsx-2953719875{opacity:0.3;}", ".labelGroup.jsx-2953719875{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;margin:6px 4px;}", ".typeGroup.jsx-2953719875{display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;margin:0;-webkit-align-self:stretch;-ms-flex-item-align:stretch;align-self:stretch;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}", ".nowrap.jsx-2953719875{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;}", ".icon.jsx-2953719875,.label.jsx-2953719875{line-height:18px;}", `.icon.jsx-2953719875{margin-right:${_ui.spacers.dp4};display:-webkit-inline-box;display:-webkit-inline-flex;display:-ms-inline-flexbox;display:inline-flex;vertical-align:text-bottom;}`, `.label.jsx-2953719875{font-size:14px;color:${_ui.colors.grey900};}`, `.type.jsx-2953719875{font-size:10px;-webkit-letter-spacing:-0.2px;-moz-letter-spacing:-0.2px;-ms-letter-spacing:-0.2px;letter-spacing:-0.2px;color:${_ui.colors.grey600};font-family:ui-monospace,'Cascadia Code','Source Code Pro',Menlo, Consolas,'DejaVu Sans Mono',monospace;font-weight:normal;}`, `.edit.jsx-2953719875,.info.jsx-2953719875{height:16px;margin-top:1px;margin-left:${_ui.spacers.dp8};cursor:pointer;color:${_ui.colors.grey600};}`, `.info.jsx-2953719875{margin:0 0 0 ${_ui.spacers.dp4};height:100%;padding:0 6px;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;}`, `.info.active.jsx-2953719875{background-color:${_ui.colors.grey300};color:${_ui.colors.grey900};}`, `.highlighted.jsx-2953719875{background:${_ui.theme.secondary700};}`, `.highlighted.jsx-2953719875:hover{background:${_ui.theme.secondary800};}`, `.highlighted.jsx-2953719875 .label.jsx-2953719875{color:${_ui.colors.white};}`, `.highlighted.jsx-2953719875 .type.jsx-2953719875{color:${_ui.theme.secondary050};}`, `.highlighted.jsx-2953719875 .info.jsx-2953719875{color:${_ui.theme.secondary050};}`, `.highlighted.jsx-2953719875 .icon path{fill:${_ui.colors.teal050};}`, `.highlighted.jsx-2953719875 .type.jsx-2953719875{color:${_ui.colors.teal050};}`, `.edit.jsx-2953719875:hover,.info.jsx-2953719875:hover{background-color:${_ui.colors.grey200};border-radius:0px;}`, `.highlighted.jsx-2953719875 .info.active.jsx-2953719875{background-color:${_ui.theme.secondary900};}`, `.highlighted.jsx-2953719875 .edit.jsx-2953719875:hover,.highlighted.jsx-2953719875 .info.jsx-2953719875:hover{background-color:${_ui.theme.secondary900};}`];
|
|
9
|
+
_defaultExport.__hash = "2953719875";
|
|
10
|
+
var _default = exports.default = _defaultExport;
|