@dhis2/analytics 26.12.2 → 26.13.0
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__/DimensionsPanel.stories.js +29 -4
- package/build/cjs/__demo__/FileMenu.stories.js +1 -9
- package/build/cjs/__demo__/data/avgTotalAggregationType.visualization.json +256 -1
- package/build/cjs/__demo__/data/deep.visualization.json +613 -310
- package/build/cjs/__demo__/data/deepWithFilters.visualization.json +0 -3
- package/build/cjs/__demo__/data/degs.visualization.json +2 -7
- package/build/cjs/__demo__/data/diseaseWeeks.visualization.json +317 -153
- package/build/cjs/__demo__/data/emptyColumns.visualization.json +2 -7
- package/build/cjs/__demo__/data/emptyRows.visualization.json +292 -297
- package/build/cjs/__demo__/data/hierarchy.visualization.json +197 -1
- package/build/cjs/__demo__/data/lastFiveYears.visualization.json +2 -7
- package/build/cjs/__demo__/data/narrative.visualization.json +2 -7
- package/build/cjs/__demo__/data/simple.visualization.json +115 -105
- package/build/cjs/__demo__/data/target-with-legend.visualization.json +370 -115
- package/build/cjs/__demo__/data/under-above-100.legendSet.json +87 -103
- package/build/cjs/__demo__/data/weeklyColumns.visualization.json +2 -7
- package/build/cjs/__fixtures__/json/chartAllFields.json +8 -33
- package/build/cjs/api/dimensions.js +11 -1
- package/build/cjs/api/expression.js +19 -9
- package/build/cjs/assets/DimensionItemIcons/CalculationIcon.js +1 -1
- package/build/cjs/assets/DimensionItemIcons/DataElementIcon.js +1 -1
- package/build/cjs/assets/DimensionItemIcons/GenericIcon.js +1 -1
- package/build/cjs/assets/DimensionItemIcons/PeriodIcon.js +1 -1
- package/build/cjs/components/DataDimension/DataDimension.js +68 -10
- package/build/cjs/components/DataDimension/Info/CalculationInfo.js +3 -3
- package/build/cjs/components/DataDimension/Info/DataElementInfo.js +4 -4
- package/build/cjs/components/DataDimension/Info/DataElementOperandInfo.js +5 -5
- package/build/cjs/components/DataDimension/Info/DataSetInfo.js +3 -3
- package/build/cjs/components/DataDimension/Info/EventDataItemInfo.js +6 -6
- package/build/cjs/components/DataDimension/Info/IndicatorInfo.js +3 -3
- package/build/cjs/components/DataDimension/Info/InfoPopover.js +7 -3
- package/build/cjs/components/DataDimension/Info/InfoTable.js +1 -1
- package/build/cjs/components/DataDimension/Info/OptionInfo.js +70 -0
- package/build/cjs/components/DataDimension/Info/ProgramIndicatorInfo.js +9 -6
- package/build/cjs/components/DataDimension/ItemOptionsSelector/ItemOptionsSelector.js +257 -0
- package/build/cjs/components/DataDimension/ItemOptionsSelector/styles/ItemOptionSelector.style.js +10 -0
- package/build/cjs/components/DataDimension/{DataTypeSelector.js → ItemSelector/DataTypeSelector.js} +4 -4
- package/build/cjs/components/DataDimension/{DetailSelector.js → ItemSelector/DetailSelector.js} +2 -2
- package/build/cjs/components/DataDimension/{GroupSelector.js → ItemSelector/GroupSelector.js} +3 -3
- package/build/cjs/components/DataDimension/{ItemSelector.js → ItemSelector/ItemSelector.js} +76 -163
- package/build/cjs/components/DataDimension/{MetricSelector.js → ItemSelector/MetricSelector.js} +3 -3
- package/build/cjs/components/DataDimension/SelectedEmptyPlaceholder.js +17 -0
- package/build/cjs/components/DataDimension/SourceEmptyPlaceholder.js +113 -0
- package/build/cjs/components/DataDimension/TransferOption.js +34 -3
- package/build/cjs/components/DataDimension/styles/EmptyPlaceholder.style.js +10 -0
- package/build/cjs/components/DataDimension/styles/TransferOption.style.js +2 -2
- package/build/cjs/components/DimensionsPanel/List/OptionsButton.js +3 -3
- package/build/cjs/components/DimensionsPanel/List/styles/DimensionItem.style.js +2 -2
- package/build/cjs/components/DynamicDimension/DynamicDimension.js +1 -1
- package/build/cjs/components/DynamicDimension/ItemSelector.js +64 -111
- package/build/cjs/components/styles/DimensionSelector.style.js +2 -2
- package/build/cjs/locales/en/translations.json +18 -11
- package/build/cjs/modules/dataTypes.js +3 -1
- package/build/cjs/modules/dimensionListItem.js +4 -0
- package/build/es/__demo__/DimensionsPanel.stories.js +27 -3
- package/build/es/__demo__/FileMenu.stories.js +1 -9
- package/build/es/__demo__/data/avgTotalAggregationType.visualization.json +256 -1
- package/build/es/__demo__/data/deep.visualization.json +613 -310
- package/build/es/__demo__/data/deepWithFilters.visualization.json +0 -3
- package/build/es/__demo__/data/degs.visualization.json +2 -7
- package/build/es/__demo__/data/diseaseWeeks.visualization.json +317 -153
- package/build/es/__demo__/data/emptyColumns.visualization.json +2 -7
- package/build/es/__demo__/data/emptyRows.visualization.json +292 -297
- package/build/es/__demo__/data/hierarchy.visualization.json +197 -1
- package/build/es/__demo__/data/lastFiveYears.visualization.json +2 -7
- package/build/es/__demo__/data/narrative.visualization.json +2 -7
- package/build/es/__demo__/data/simple.visualization.json +115 -105
- package/build/es/__demo__/data/target-with-legend.visualization.json +370 -115
- package/build/es/__demo__/data/under-above-100.legendSet.json +87 -103
- package/build/es/__demo__/data/weeklyColumns.visualization.json +2 -7
- package/build/es/__fixtures__/json/chartAllFields.json +8 -33
- package/build/es/api/dimensions.js +12 -2
- package/build/es/api/expression.js +18 -8
- package/build/es/assets/DimensionItemIcons/CalculationIcon.js +1 -1
- package/build/es/assets/DimensionItemIcons/DataElementIcon.js +1 -1
- package/build/es/assets/DimensionItemIcons/GenericIcon.js +1 -1
- package/build/es/assets/DimensionItemIcons/PeriodIcon.js +1 -1
- package/build/es/components/DataDimension/DataDimension.js +69 -11
- package/build/es/components/DataDimension/Info/CalculationInfo.js +3 -3
- package/build/es/components/DataDimension/Info/DataElementInfo.js +4 -4
- package/build/es/components/DataDimension/Info/DataElementOperandInfo.js +5 -5
- package/build/es/components/DataDimension/Info/DataSetInfo.js +3 -3
- package/build/es/components/DataDimension/Info/EventDataItemInfo.js +6 -6
- package/build/es/components/DataDimension/Info/IndicatorInfo.js +3 -3
- package/build/es/components/DataDimension/Info/InfoPopover.js +9 -5
- package/build/es/components/DataDimension/Info/InfoTable.js +1 -1
- package/build/es/components/DataDimension/Info/OptionInfo.js +62 -0
- package/build/es/components/DataDimension/Info/ProgramIndicatorInfo.js +10 -7
- package/build/es/components/DataDimension/ItemOptionsSelector/ItemOptionsSelector.js +247 -0
- package/build/es/components/DataDimension/ItemOptionsSelector/styles/ItemOptionSelector.style.js +4 -0
- package/build/es/components/DataDimension/{DataTypeSelector.js → ItemSelector/DataTypeSelector.js} +4 -4
- package/build/es/components/DataDimension/{DetailSelector.js → ItemSelector/DetailSelector.js} +2 -2
- package/build/es/components/DataDimension/{GroupSelector.js → ItemSelector/GroupSelector.js} +3 -3
- package/build/es/components/DataDimension/{ItemSelector.js → ItemSelector/ItemSelector.js} +76 -163
- package/build/es/components/DataDimension/{MetricSelector.js → ItemSelector/MetricSelector.js} +3 -3
- package/build/es/components/DataDimension/SelectedEmptyPlaceholder.js +9 -0
- package/build/es/components/DataDimension/SourceEmptyPlaceholder.js +105 -0
- package/build/es/components/DataDimension/TransferOption.js +35 -4
- package/build/es/components/DataDimension/styles/EmptyPlaceholder.style.js +4 -0
- package/build/es/components/DataDimension/styles/TransferOption.style.js +2 -2
- package/build/es/components/DimensionsPanel/List/OptionsButton.js +3 -3
- package/build/es/components/DimensionsPanel/List/styles/DimensionItem.style.js +2 -2
- package/build/es/components/DynamicDimension/DynamicDimension.js +1 -1
- package/build/es/components/DynamicDimension/ItemSelector.js +66 -113
- package/build/es/components/styles/DimensionSelector.style.js +2 -2
- package/build/es/locales/en/translations.json +18 -11
- package/build/es/modules/dataTypes.js +2 -0
- package/build/es/modules/dimensionListItem.js +5 -1
- package/package.json +2 -2
- /package/build/cjs/components/DataDimension/{styles → ItemSelector/styles}/DataTypeSelector.style.js +0 -0
- /package/build/cjs/components/DataDimension/{styles → ItemSelector/styles}/DetailSelector.style.js +0 -0
- /package/build/cjs/components/DataDimension/{styles → ItemSelector/styles}/GroupSelector.style.js +0 -0
- /package/build/cjs/components/DataDimension/{styles → ItemSelector/styles}/MetricSelector.style.js +0 -0
- /package/build/es/components/DataDimension/{styles → ItemSelector/styles}/DataTypeSelector.style.js +0 -0
- /package/build/es/components/DataDimension/{styles → ItemSelector/styles}/DetailSelector.style.js +0 -0
- /package/build/es/components/DataDimension/{styles → ItemSelector/styles}/GroupSelector.style.js +0 -0
- /package/build/es/components/DataDimension/{styles → ItemSelector/styles}/MetricSelector.style.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { colors } from '@dhis2/ui';
|
|
2
|
-
const _defaultExport = [`.item.jsx-
|
|
3
|
-
_defaultExport.__hash = "
|
|
2
|
+
const _defaultExport = [`.item.jsx-3350116288{color:${colors.grey900};background-color:transparent;fill:${colors.grey800};display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:4px;outline:none;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;padding:0 0 0 4px;margin:0;border-radius:2px;cursor:pointer;min-height:22px;border:1px solid transparent;}`, `.item.jsx-3350116288:not(.deactivated):not(.dragging):hover{background-color:${colors.grey100};border-color:${colors.grey400};}`, ".label.jsx-3350116288{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;}", ".labelWrapper.jsx-3350116288{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:2px 0;}", ".labelText.jsx-3350116288{font-size:13px;line-height:15px;margin-top:1px;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center;}", ".iconWrapper.jsx-3350116288{width:16px;height:16px;margin:2px 4px 0 0;-webkit-flex:0 0 auto;-ms-flex:0 0 auto;flex:0 0 auto;-webkit-align-self:flex-start;-ms-flex-item-align:start;align-self:flex-start;}", ".item.deactivated.jsx-3350116288{opacity:0.5;cursor:not-allowed;}", `.item.selected.jsx-3350116288{background-color:${colors.teal100};border:1px solid ${colors.teal200};color:${colors.teal900};fill:${colors.teal800};font-weight:400;}`, ".item.selected.jsx-3350116288:not(.deactivated):hover{background:#cdeae8;border-color:#93c4bf;box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);}", ".optionsWrapper.jsx-3350116288{width:20px;-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;-webkit-align-self:stretch;-ms-flex-item-align:stretch;align-self:stretch;}", `.lockWrapper.jsx-3350116288 svg.jsx-3350116288 path.jsx-3350116288{fill:${colors.grey800};}`, `.lockWrapper.jsx-3350116288{background:${colors.grey300};-webkit-align-self:stretch;-ms-flex-item-align:stretch;align-self:stretch;padding:0 2px 0 3px;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;}`, ".item.selected.jsx-3350116288 .lockWrapper.jsx-3350116288{background:#cbe7e5;}", `.item.selected.jsx-3350116288 .lockWrapper.jsx-3350116288 svg.jsx-3350116288 path.jsx-3350116288{fill:${colors.teal900};}`];
|
|
3
|
+
_defaultExport.__hash = "3350116288";
|
|
4
4
|
export default _defaultExport;
|
|
@@ -70,7 +70,7 @@ export const DynamicDimension = _ref => {
|
|
|
70
70
|
checked: !allIsSelected,
|
|
71
71
|
dataTest: 'dynamic-dimension-selection-type-manual'
|
|
72
72
|
}))), !allIsSelected && /*#__PURE__*/React.createElement(ItemSelector, {
|
|
73
|
-
|
|
73
|
+
selectedItems: selectedItems.map(item => ({
|
|
74
74
|
value: item.id,
|
|
75
75
|
label: item.name
|
|
76
76
|
})),
|
|
@@ -1,118 +1,50 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
2
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
3
|
-
import { Transfer
|
|
3
|
+
import { Transfer } from '@dhis2/ui';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import React, { useState
|
|
5
|
+
import React, { useState } from 'react';
|
|
6
6
|
import GenericIcon from '../../assets/DimensionItemIcons/GenericIcon.js';
|
|
7
7
|
import i18n from '../../locales/index.js';
|
|
8
8
|
import { TRANSFER_HEIGHT, TRANSFER_OPTIONS_WIDTH, TRANSFER_SELECTED_WIDTH } from '../../modules/dimensionSelectorHelper.js';
|
|
9
|
-
import { useDebounce } from '../../modules/utils.js';
|
|
9
|
+
import { useDebounce, useDidUpdateEffect } from '../../modules/utils.js';
|
|
10
|
+
import { SelectedEmptyPlaceholder } from '../DataDimension/SelectedEmptyPlaceholder.js';
|
|
11
|
+
import { SourceEmptyPlaceholder } from '../DataDimension/SourceEmptyPlaceholder.js';
|
|
10
12
|
import styles from '../styles/DimensionSelector.style.js';
|
|
11
13
|
import { TransferOption } from '../TransferOption.js';
|
|
12
|
-
const
|
|
14
|
+
const ItemSelector = _ref => {
|
|
13
15
|
let {
|
|
14
|
-
|
|
15
|
-
setFilter
|
|
16
|
-
} = _ref;
|
|
17
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
18
|
-
className: `jsx-${styles.__hash}` + " " + "leftHeader"
|
|
19
|
-
}, /*#__PURE__*/React.createElement(InputField, {
|
|
20
|
-
value: filter,
|
|
21
|
-
onChange: _ref2 => {
|
|
22
|
-
let {
|
|
23
|
-
value
|
|
24
|
-
} = _ref2;
|
|
25
|
-
return setFilter(value);
|
|
26
|
-
},
|
|
27
|
-
placeholder: i18n.t('Search'),
|
|
28
|
-
initialFocus: true,
|
|
29
|
-
type: 'search'
|
|
30
|
-
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
31
|
-
id: styles.__hash
|
|
32
|
-
}, styles));
|
|
33
|
-
};
|
|
34
|
-
LeftHeader.propTypes = {
|
|
35
|
-
filter: PropTypes.string,
|
|
36
|
-
setFilter: PropTypes.func
|
|
37
|
-
};
|
|
38
|
-
const EmptySelection = () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", {
|
|
39
|
-
className: `jsx-${styles.__hash}` + " " + "emptyList"
|
|
40
|
-
}, i18n.t('No items selected')), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
41
|
-
id: styles.__hash
|
|
42
|
-
}, styles));
|
|
43
|
-
const RightHeader = () => /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", {
|
|
44
|
-
className: `jsx-${styles.__hash}` + " " + "rightHeader"
|
|
45
|
-
}, i18n.t('Selected Items')), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
46
|
-
id: styles.__hash
|
|
47
|
-
}, styles));
|
|
48
|
-
const SourceEmptyPlaceholder = _ref3 => {
|
|
49
|
-
let {
|
|
50
|
-
loading,
|
|
51
|
-
filter,
|
|
52
|
-
options,
|
|
53
|
-
noItemsMessage
|
|
54
|
-
} = _ref3;
|
|
55
|
-
let message = '';
|
|
56
|
-
if (!loading && !options.length && !filter) {
|
|
57
|
-
message = noItemsMessage || i18n.t('No data');
|
|
58
|
-
} else if (!loading && !options.length && filter) {
|
|
59
|
-
message = i18n.t('Nothing found for {{- searchTerm}}', {
|
|
60
|
-
searchTerm: filter
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
return message && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("p", {
|
|
64
|
-
className: `jsx-${styles.__hash}` + " " + "emptyList"
|
|
65
|
-
}, message), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
66
|
-
id: styles.__hash
|
|
67
|
-
}, styles));
|
|
68
|
-
};
|
|
69
|
-
SourceEmptyPlaceholder.propTypes = {
|
|
70
|
-
filter: PropTypes.string,
|
|
71
|
-
loading: PropTypes.bool,
|
|
72
|
-
noItemsMessage: PropTypes.string,
|
|
73
|
-
options: PropTypes.array
|
|
74
|
-
};
|
|
75
|
-
const ItemSelector = _ref4 => {
|
|
76
|
-
let {
|
|
77
|
-
initialSelected,
|
|
16
|
+
selectedItems,
|
|
78
17
|
noItemsMessage,
|
|
79
18
|
onFetch,
|
|
80
19
|
onSelect,
|
|
81
20
|
rightFooter,
|
|
82
21
|
dataTest
|
|
83
|
-
} =
|
|
22
|
+
} = _ref;
|
|
84
23
|
const [state, setState] = useState({
|
|
85
|
-
|
|
86
|
-
selected: initialSelected,
|
|
87
|
-
// FIXME: keeping selected in state is redundant, use the initialSelected prop directly instead
|
|
88
|
-
// The useCallback from onChange should be removed in favor of a regular fn as well
|
|
24
|
+
searchTerm: '',
|
|
89
25
|
options: [],
|
|
90
26
|
loading: true,
|
|
91
|
-
nextPage:
|
|
92
|
-
// Implement the solution found in the DataDimension/ItemSelector.js
|
|
27
|
+
nextPage: 1
|
|
93
28
|
});
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
filter
|
|
97
|
-
}));
|
|
98
|
-
const setSelected = selected => setState(state => ({
|
|
29
|
+
const debouncedSearchTerm = useDebounce(state.searchTerm, 500);
|
|
30
|
+
const setSearchTerm = searchTerm => setState(state => ({
|
|
99
31
|
...state,
|
|
100
|
-
|
|
32
|
+
searchTerm
|
|
101
33
|
}));
|
|
102
|
-
const debouncedFilter = useDebounce(state.filter, 200);
|
|
103
34
|
const fetchItems = async page => {
|
|
104
35
|
var _result$dimensionItem;
|
|
105
36
|
setState(state => ({
|
|
106
37
|
...state,
|
|
38
|
+
nextPage: page === 1 ? 1 : state.nextPage,
|
|
107
39
|
loading: true
|
|
108
40
|
}));
|
|
109
|
-
const result = await onFetch(page, state.
|
|
110
|
-
const newOptions = (_result$dimensionItem = result.dimensionItems) === null || _result$dimensionItem === void 0 ? void 0 : _result$dimensionItem.map(
|
|
41
|
+
const result = await onFetch(page, state.searchTerm);
|
|
42
|
+
const newOptions = (_result$dimensionItem = result.dimensionItems) === null || _result$dimensionItem === void 0 ? void 0 : _result$dimensionItem.map(_ref2 => {
|
|
111
43
|
let {
|
|
112
44
|
id,
|
|
113
45
|
name,
|
|
114
46
|
disabled
|
|
115
|
-
} =
|
|
47
|
+
} = _ref2;
|
|
116
48
|
return {
|
|
117
49
|
label: name,
|
|
118
50
|
value: id,
|
|
@@ -125,71 +57,92 @@ const ItemSelector = _ref4 => {
|
|
|
125
57
|
options: page > 1 ? [...state.options, ...newOptions] : newOptions,
|
|
126
58
|
nextPage: result.nextPage
|
|
127
59
|
}));
|
|
60
|
+
/* The following handles a very specific edge-case where the user can select all items from a
|
|
61
|
+
page and then reopen the modal. Usually Transfer triggers the onEndReached when the end of
|
|
62
|
+
the page is reached (scrolling down) or if too few items are on the left side (e.g. selecting
|
|
63
|
+
49 items from page 1, leaving only 1 item on the left side). However, due to the way Transfer
|
|
64
|
+
works, if 0 items are available, more items are fetched, but all items are already selected
|
|
65
|
+
(leaving 0 items on the left side still), the onReachedEnd won't trigger. Hence the code below:
|
|
66
|
+
IF there is a next page AND some options were just fetched AND you have the same or more
|
|
67
|
+
selected items than fetched items AND all fetched items are already selected -> fetch more!
|
|
68
|
+
*/
|
|
69
|
+
if (result.nextPage && newOptions.length && selectedItems.length >= newOptions.length && newOptions.every(newOption => selectedItems.find(selectedItem => selectedItem.value === newOption.value))) {
|
|
70
|
+
fetchItems(result.nextPage);
|
|
71
|
+
}
|
|
128
72
|
};
|
|
129
|
-
|
|
73
|
+
useDidUpdateEffect(() => {
|
|
130
74
|
fetchItems(1);
|
|
131
|
-
}, [
|
|
132
|
-
const onChange =
|
|
133
|
-
const newSelectedWithLabel =
|
|
134
|
-
value,
|
|
135
|
-
label: [...state.options, ...
|
|
75
|
+
}, [debouncedSearchTerm]);
|
|
76
|
+
const onChange = selectedIds => {
|
|
77
|
+
const newSelectedWithLabel = selectedIds.map(id => ({
|
|
78
|
+
value: id,
|
|
79
|
+
label: [...state.options, ...selectedItems].find(item => item.value === id).label
|
|
136
80
|
}));
|
|
137
|
-
setSelected(newSelectedWithLabel);
|
|
138
81
|
onSelect(newSelectedWithLabel);
|
|
139
|
-
}
|
|
140
|
-
const onEndReached =
|
|
82
|
+
};
|
|
83
|
+
const onEndReached = () => {
|
|
141
84
|
if (state.nextPage) {
|
|
142
85
|
fetchItems(state.nextPage);
|
|
143
86
|
}
|
|
144
|
-
}
|
|
145
|
-
return /*#__PURE__*/React.createElement(Transfer, {
|
|
146
|
-
onChange:
|
|
87
|
+
};
|
|
88
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Transfer, {
|
|
89
|
+
onChange: _ref3 => {
|
|
147
90
|
let {
|
|
148
91
|
selected
|
|
149
|
-
} =
|
|
92
|
+
} = _ref3;
|
|
150
93
|
return onChange(selected);
|
|
151
94
|
},
|
|
152
|
-
selected:
|
|
153
|
-
options: [...state.options, ...
|
|
95
|
+
selected: selectedItems.map(item => item.value),
|
|
96
|
+
options: [...state.options, ...selectedItems],
|
|
154
97
|
loading: state.loading,
|
|
155
98
|
loadingPicked: state.loading,
|
|
156
99
|
sourceEmptyPlaceholder: /*#__PURE__*/React.createElement(SourceEmptyPlaceholder, {
|
|
157
100
|
loading: state.loading,
|
|
158
|
-
|
|
101
|
+
searchTerm: debouncedSearchTerm,
|
|
159
102
|
options: state.options,
|
|
160
103
|
noItemsMessage: noItemsMessage
|
|
161
104
|
}),
|
|
162
105
|
onEndReached: onEndReached,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
106
|
+
filterable: true,
|
|
107
|
+
filterPlaceholder: i18n.t('Search'),
|
|
108
|
+
filterablePicked: false,
|
|
109
|
+
searchTerm: state.searchTerm,
|
|
110
|
+
onFilterChange: _ref4 => {
|
|
111
|
+
let {
|
|
112
|
+
value
|
|
113
|
+
} = _ref4;
|
|
114
|
+
return setSearchTerm(value);
|
|
115
|
+
},
|
|
167
116
|
enableOrderChange: true,
|
|
168
117
|
height: TRANSFER_HEIGHT,
|
|
169
118
|
optionsWidth: TRANSFER_OPTIONS_WIDTH,
|
|
170
119
|
selectedWidth: TRANSFER_SELECTED_WIDTH,
|
|
171
|
-
selectedEmptyComponent: /*#__PURE__*/React.createElement(
|
|
172
|
-
rightHeader: /*#__PURE__*/React.createElement(
|
|
120
|
+
selectedEmptyComponent: /*#__PURE__*/React.createElement(SelectedEmptyPlaceholder, null),
|
|
121
|
+
rightHeader: /*#__PURE__*/React.createElement("p", {
|
|
122
|
+
className: `jsx-${styles.__hash}` + " " + "rightHeader"
|
|
123
|
+
}, i18n.t('Selected Items')),
|
|
173
124
|
rightFooter: rightFooter,
|
|
174
125
|
renderOption: props => /*#__PURE__*/React.createElement(TransferOption, _extends({}, props, {
|
|
175
126
|
icon: GenericIcon,
|
|
176
127
|
dataTest: `${dataTest}-transfer-option`
|
|
177
128
|
})),
|
|
178
129
|
dataTest: `${dataTest}-transfer`
|
|
179
|
-
})
|
|
130
|
+
}), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
131
|
+
id: styles.__hash
|
|
132
|
+
}, styles));
|
|
180
133
|
};
|
|
181
134
|
ItemSelector.propTypes = {
|
|
182
135
|
onFetch: PropTypes.func.isRequired,
|
|
183
136
|
onSelect: PropTypes.func.isRequired,
|
|
184
137
|
dataTest: PropTypes.string,
|
|
185
|
-
|
|
138
|
+
noItemsMessage: PropTypes.string,
|
|
139
|
+
rightFooter: PropTypes.node,
|
|
140
|
+
selectedItems: PropTypes.arrayOf(PropTypes.exact({
|
|
186
141
|
label: PropTypes.string.isRequired,
|
|
187
142
|
value: PropTypes.string.isRequired
|
|
188
|
-
}))
|
|
189
|
-
noItemsMessage: PropTypes.string,
|
|
190
|
-
rightFooter: PropTypes.node
|
|
143
|
+
}))
|
|
191
144
|
};
|
|
192
145
|
ItemSelector.defaultProps = {
|
|
193
|
-
|
|
146
|
+
selectedItems: []
|
|
194
147
|
};
|
|
195
148
|
export default ItemSelector;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { spacers, colors } from '@dhis2/ui';
|
|
2
|
-
const _defaultExport = [".transfer-container.jsx-
|
|
3
|
-
_defaultExport.__hash = "
|
|
2
|
+
const _defaultExport = [".transfer-container.jsx-1883578365{min-width:800px;}", ".transfer-container.hidden.jsx-1883578365{position:absolute;visibility:hidden;pointer-events:none;}", `.filterContainer.jsx-1883578365{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin-bottom:${spacers.dp12};margin-top:${spacers.dp8};}`, `.emptyList.jsx-1883578365{text-align:center;font-size:14px;line-height:16px;margin:${spacers.dp24} 0 0;color:${colors.grey700};}`, ".rightHeader.jsx-1883578365{font-size:14px;font-weight:500;}", `.leftHeader.jsx-1883578365{padding:${spacers.dp8} 0;}`, `.info-container.jsx-1883578365{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin-bottom:${spacers.dp8};padding:${spacers.dp8};background-color:${colors.grey200};border-radius:3px;}`, `.info-text.jsx-1883578365{padding-left:${spacers.dp8};color:${colors.grey900};font-size:12px;line-height:16px;}`, `.calculation-button.jsx-1883578365{margin:${spacers.dp8} 0;}`];
|
|
3
|
+
_defaultExport.__hash = "1883578365";
|
|
4
4
|
export default _defaultExport;
|
|
@@ -45,11 +45,6 @@
|
|
|
45
45
|
"No data elements found": "No data elements found",
|
|
46
46
|
"Drag items here, or double click in the list, to start building a calculation formula": "Drag items here, or double click in the list, to start building a calculation formula",
|
|
47
47
|
"Math operators": "Math operators",
|
|
48
|
-
"Data Type": "Data Type",
|
|
49
|
-
"Only {{dataType}} can be used in {{visType}}": "Only {{dataType}} can be used in {{visType}}",
|
|
50
|
-
"All types": "All types",
|
|
51
|
-
"Disaggregation": "Disaggregation",
|
|
52
|
-
"No data": "No data",
|
|
53
48
|
"Expression description": "Expression description",
|
|
54
49
|
"Error loading value": "Error loading value",
|
|
55
50
|
"None": "None",
|
|
@@ -98,9 +93,24 @@
|
|
|
98
93
|
"{{ offsetPeriodType }} × {{ offsetPeriods }}": "{{ offsetPeriodType }} × {{ offsetPeriods }}",
|
|
99
94
|
"Expression": "Expression",
|
|
100
95
|
"Filter": "Filter",
|
|
96
|
+
"All available options are already selected": "All available options are already selected",
|
|
97
|
+
"No available options for this item": "No available options for this item",
|
|
98
|
+
"Search by option name": "Search by option name",
|
|
99
|
+
"Back to all items": "Back to all items",
|
|
100
|
+
"Options": "Options",
|
|
101
|
+
"Selected items": "Selected items",
|
|
102
|
+
"Data Type": "Data Type",
|
|
103
|
+
"Only {{dataType}} can be used in {{visType}}": "Only {{dataType}} can be used in {{visType}}",
|
|
104
|
+
"All types": "All types",
|
|
105
|
+
"Disaggregation": "Disaggregation",
|
|
106
|
+
"No data": "No data",
|
|
101
107
|
"Search by data item name": "Search by data item name",
|
|
102
|
-
"No items selected": "No items selected",
|
|
103
108
|
"Selected Items": "Selected Items",
|
|
109
|
+
"All available items are already selected": "All available items are already selected",
|
|
110
|
+
"Calculation": "Calculation",
|
|
111
|
+
"Metric type": "Metric type",
|
|
112
|
+
"All metrics": "All metrics",
|
|
113
|
+
"No items selected": "No items selected",
|
|
104
114
|
"No indicators found": "No indicators found",
|
|
105
115
|
"No data sets found": "No data sets found",
|
|
106
116
|
"No event data items found": "No event data items found",
|
|
@@ -112,9 +122,7 @@
|
|
|
112
122
|
"No program indicators found for \"{{- searchTerm}}\"": "No program indicators found for \"{{- searchTerm}}\"",
|
|
113
123
|
"No calculations found for \"{{- searchTerm}}\"": "No calculations found for \"{{- searchTerm}}\"",
|
|
114
124
|
"Nothing found for \"{{- searchTerm}}\"": "Nothing found for \"{{- searchTerm}}\"",
|
|
115
|
-
"
|
|
116
|
-
"Metric type": "Metric type",
|
|
117
|
-
"All metrics": "All metrics",
|
|
125
|
+
"Click to choose from available options": "Click to choose from available options",
|
|
118
126
|
"Move to {{axisName}}": "Move to {{axisName}}",
|
|
119
127
|
"Add to {{axisName}}": "Add to {{axisName}}",
|
|
120
128
|
"Not available for {{visualizationType}}": "Not available for {{visualizationType}}",
|
|
@@ -131,7 +139,6 @@
|
|
|
131
139
|
"Manually select items...": "Manually select items...",
|
|
132
140
|
"Nothing found in {{- dimensionTitle}}": "Nothing found in {{- dimensionTitle}}",
|
|
133
141
|
"Search": "Search",
|
|
134
|
-
"Nothing found for {{- searchTerm}}": "Nothing found for {{- searchTerm}}",
|
|
135
142
|
"Delete {{fileType}}": "Delete {{fileType}}",
|
|
136
143
|
"This {{fileType}} and related interpretations will be deleted. Continue?": "This {{fileType}} and related interpretations will be deleted. Continue?",
|
|
137
144
|
"Delete": "Delete",
|
|
@@ -219,7 +226,6 @@
|
|
|
219
226
|
"No line lists found. Click New line list to get started.": "No line lists found. Click New line list to get started.",
|
|
220
227
|
"No line lists found. Try adjusting your search or filter options to find what you're looking for.": "No line lists found. Try adjusting your search or filter options to find what you're looking for.",
|
|
221
228
|
"New line list": "New line list",
|
|
222
|
-
"Options": "Options",
|
|
223
229
|
"Hide": "Hide",
|
|
224
230
|
"{{count}} org units": "{{count}} org unit",
|
|
225
231
|
"{{count}} org units_plural": "{{count}} org units",
|
|
@@ -363,6 +369,7 @@
|
|
|
363
369
|
"Program indicators": "Program indicators",
|
|
364
370
|
"Program indicator": "Program indicator",
|
|
365
371
|
"Calculations": "Calculations",
|
|
372
|
+
"Option": "Option",
|
|
366
373
|
"Number": "Number",
|
|
367
374
|
"Formula is empty. Add items to the formula from the lists on the left.": "Formula is empty. Add items to the formula from the lists on the left.",
|
|
368
375
|
"Consecutive math operators": "Consecutive math operators",
|
|
@@ -6,7 +6,9 @@ export const DIMENSION_TYPE_DATA_SET = 'DATA_SET';
|
|
|
6
6
|
export const DIMENSION_TYPE_EVENT_DATA_ITEM = 'EVENT_DATA_ITEM';
|
|
7
7
|
export const DIMENSION_TYPE_PROGRAM_INDICATOR = 'PROGRAM_INDICATOR';
|
|
8
8
|
export const DIMENSION_TYPE_PROGRAM_DATA_ELEMENT = 'PROGRAM_DATA_ELEMENT';
|
|
9
|
+
export const DIMENSION_TYPE_PROGRAM_DATA_ELEMENT_OPTION = 'PROGRAM_DATA_ELEMENT_OPTION';
|
|
9
10
|
export const DIMENSION_TYPE_PROGRAM_ATTRIBUTE = 'PROGRAM_ATTRIBUTE';
|
|
11
|
+
export const DIMENSION_TYPE_PROGRAM_ATTRIBUTE_OPTION = 'PROGRAM_ATTRIBUTE_OPTION';
|
|
10
12
|
export const DIMENSION_TYPE_DATA_ELEMENT_OPERAND = 'DATA_ELEMENT_OPERAND';
|
|
11
13
|
export const DIMENSION_TYPE_CATEGORY = 'CATEGORY';
|
|
12
14
|
export const DIMENSION_TYPE_CATEGORY_OPTION_GROUP_SET = 'CATEGORY_OPTION_GROUP_SET';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import i18n from '@dhis2/d2-i18n';
|
|
1
2
|
import { IconDimensionDataSet16, IconDimensionIndicator16, IconDimensionEventDataItem16, IconDimensionProgramIndicator16 } from '@dhis2/ui';
|
|
2
3
|
import React from 'react';
|
|
3
4
|
import DataElementIcon from '../assets/DimensionItemIcons/DataElementIcon.js';
|
|
4
5
|
import GenericIcon from '../assets/DimensionItemIcons/GenericIcon.js';
|
|
5
6
|
import CalculationIcon from './../assets/DimensionItemIcons/CalculationIcon.js';
|
|
6
7
|
import { REPORTING_RATE } from './dataSets.js';
|
|
7
|
-
import { DIMENSION_TYPE_DATA_ELEMENT, DIMENSION_TYPE_DATA_ELEMENT_OPERAND, DIMENSION_TYPE_DATA_SET, DIMENSION_TYPE_EVENT_DATA_ITEM, DIMENSION_TYPE_EXPRESSION_DIMENSION_ITEM, DIMENSION_TYPE_PROGRAM_ATTRIBUTE, DIMENSION_TYPE_PROGRAM_DATA_ELEMENT, dataTypeMap as dataTypes, DIMENSION_TYPE_INDICATOR, DIMENSION_TYPE_PROGRAM_INDICATOR } from './dataTypes.js';
|
|
8
|
+
import { DIMENSION_TYPE_DATA_ELEMENT, DIMENSION_TYPE_DATA_ELEMENT_OPERAND, DIMENSION_TYPE_DATA_SET, DIMENSION_TYPE_EVENT_DATA_ITEM, DIMENSION_TYPE_EXPRESSION_DIMENSION_ITEM, DIMENSION_TYPE_PROGRAM_ATTRIBUTE, DIMENSION_TYPE_PROGRAM_DATA_ELEMENT, dataTypeMap as dataTypes, DIMENSION_TYPE_INDICATOR, DIMENSION_TYPE_PROGRAM_INDICATOR, DIMENSION_TYPE_PROGRAM_ATTRIBUTE_OPTION, DIMENSION_TYPE_PROGRAM_DATA_ELEMENT_OPTION } from './dataTypes.js';
|
|
8
9
|
export const getDimensionType = _ref => {
|
|
9
10
|
var _dataTypes$type;
|
|
10
11
|
let {
|
|
@@ -22,6 +23,9 @@ export const getDimensionType = _ref => {
|
|
|
22
23
|
case DIMENSION_TYPE_PROGRAM_DATA_ELEMENT:
|
|
23
24
|
case DIMENSION_TYPE_PROGRAM_ATTRIBUTE:
|
|
24
25
|
return dataTypes[DIMENSION_TYPE_EVENT_DATA_ITEM].getItemName();
|
|
26
|
+
case DIMENSION_TYPE_PROGRAM_ATTRIBUTE_OPTION:
|
|
27
|
+
case DIMENSION_TYPE_PROGRAM_DATA_ELEMENT_OPTION:
|
|
28
|
+
return i18n.t('Option');
|
|
25
29
|
default:
|
|
26
30
|
return (_dataTypes$type = dataTypes[type]) === null || _dataTypes$type === void 0 ? void 0 : _dataTypes$type.getItemName();
|
|
27
31
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2/analytics",
|
|
3
|
-
"version": "26.
|
|
3
|
+
"version": "26.13.0",
|
|
4
4
|
"main": "./build/cjs/index.js",
|
|
5
5
|
"module": "./build/es/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"validate-push": "yarn test"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@dhis2/app-runtime": "^3.
|
|
33
|
+
"@dhis2/app-runtime": "^3.14.1",
|
|
34
34
|
"@dhis2/cli-app-scripts": "^11.8.0",
|
|
35
35
|
"@dhis2/cli-style": "^10.7.4",
|
|
36
36
|
"@dhis2/d2-i18n": "^1.1.0",
|
/package/build/cjs/components/DataDimension/{styles → ItemSelector/styles}/DataTypeSelector.style.js
RENAMED
|
File without changes
|
/package/build/cjs/components/DataDimension/{styles → ItemSelector/styles}/DetailSelector.style.js
RENAMED
|
File without changes
|
/package/build/cjs/components/DataDimension/{styles → ItemSelector/styles}/GroupSelector.style.js
RENAMED
|
File without changes
|
/package/build/cjs/components/DataDimension/{styles → ItemSelector/styles}/MetricSelector.style.js
RENAMED
|
File without changes
|
/package/build/es/components/DataDimension/{styles → ItemSelector/styles}/DataTypeSelector.style.js
RENAMED
|
File without changes
|
/package/build/es/components/DataDimension/{styles → ItemSelector/styles}/DetailSelector.style.js
RENAMED
|
File without changes
|
/package/build/es/components/DataDimension/{styles → ItemSelector/styles}/GroupSelector.style.js
RENAMED
|
File without changes
|
/package/build/es/components/DataDimension/{styles → ItemSelector/styles}/MetricSelector.style.js
RENAMED
|
File without changes
|