@dhis2/analytics 29.3.2 → 29.4.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.
@@ -29,7 +29,8 @@ const CalculationModal = ({
29
29
  onSave,
30
30
  onClose,
31
31
  onDelete,
32
- displayNameProp
32
+ displayNameProp,
33
+ height
33
34
  }) => {
34
35
  const {
35
36
  show: showError
@@ -277,7 +278,8 @@ const CalculationModal = ({
277
278
  className: `jsx-${_CalculationModalStyle.default.__hash}` + " " + "left-section"
278
279
  }, /*#__PURE__*/_react.default.createElement(_DataElementSelector.default, {
279
280
  displayNameProp: displayNameProp,
280
- onDoubleClick: addItem
281
+ onDoubleClick: addItem,
282
+ height: height
281
283
  }), /*#__PURE__*/_react.default.createElement(_MathOperatorSelector.default, {
282
284
  onDoubleClick: addItem
283
285
  })), /*#__PURE__*/_react.default.createElement("div", {
@@ -378,6 +380,7 @@ CalculationModal.propTypes = {
378
380
  expression: _propTypes.default.string,
379
381
  id: _propTypes.default.string,
380
382
  name: _propTypes.default.string
381
- })
383
+ }),
384
+ height: _propTypes.default.string
382
385
  };
383
386
  var _default = exports.default = CalculationModal;
@@ -19,6 +19,7 @@ var _DataElementOption = _interopRequireDefault(require("./DataElementOption.js"
19
19
  var _DataElementSelectorStyle = _interopRequireDefault(require("./styles/DataElementSelector.style.js"));
20
20
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
21
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
+ const SCROLLBOX_HEIGHT = '337px';
22
23
  const getOptions = () => ({
23
24
  [_dataTypes.TOTALS]: _index.default.t('Totals only'),
24
25
  [_dataTypes.DETAIL]: _index.default.t('Details only')
@@ -97,7 +98,8 @@ DisaggregationSelector.propTypes = {
97
98
  };
98
99
  const DataElementSelector = ({
99
100
  displayNameProp,
100
- onDoubleClick
101
+ onDoubleClick,
102
+ height = SCROLLBOX_HEIGHT
101
103
  }) => {
102
104
  const dataEngine = (0, _appRuntime.useDataEngine)();
103
105
  const [searchTerm, setSearchTerm] = (0, _react.useState)('');
@@ -223,6 +225,9 @@ const DataElementSelector = ({
223
225
  className: `jsx-${_DataElementSelectorStyle.default.__hash}` + " " + "dimension-list-overlay"
224
226
  }, /*#__PURE__*/_react.default.createElement(_ui.CircularLoader, null)), /*#__PURE__*/_react.default.createElement("div", {
225
227
  ref: rootRef,
228
+ style: {
229
+ height
230
+ },
226
231
  onScroll: () => {
227
232
  if (isSorting) {
228
233
  rootRef.current.scrollTo({
@@ -259,6 +264,7 @@ const DataElementSelector = ({
259
264
  };
260
265
  DataElementSelector.propTypes = {
261
266
  displayNameProp: _propTypes.default.string.isRequired,
262
- onDoubleClick: _propTypes.default.func.isRequired
267
+ onDoubleClick: _propTypes.default.func.isRequired,
268
+ height: _propTypes.default.string
263
269
  };
264
270
  var _default = exports.default = DataElementSelector;
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _ui = require("@dhis2/ui");
8
- const _defaultExport = [".dimension-list-container.jsx-4262244129{position:relative;}", `.dimension-list-scrollbox.jsx-4262244129{position:relative;width:100%;height:337px;overflow:hidden;overflow-y:auto;border:1px solid ${_ui.colors.grey400};}`, `.dimension-list-scroller.jsx-4262244129{position:relative;min-height:1px;padding:0 ${_ui.spacers.dp4};}`, ".dimension-list-scroller.loading.jsx-4262244129{-webkit-filter:blur(2px);filter:blur(2px);}", ".scroll-detector.jsx-4262244129{boxsizing:border-box;width:100%;height:100px;position:absolute;bottom:0;left:0;z-index:-1;}", ".dimension-list-overlay.jsx-4262244129{position:absolute;width:100%;height:100%;z-index:2;top:0;left:0;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;}", `.filter-wrapper.jsx-4262244129{padding:${_ui.spacers.dp8};border:1px solid ${_ui.colors.grey400};border-bottom:0;}`, `.selector-wrapper.jsx-4262244129{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:${_ui.spacers.dp4};}`, `.sub-header.jsx-4262244129{font-size:14px;font-weight:normal;margin:0 0 ${_ui.spacers.dp4};}`, `.group-select.jsx-4262244129{width:50%;margin-top:${_ui.spacers.dp4};}`, `.empty-list.jsx-4262244129{text-align:center;font-size:14px;line-height:16px;margin:${_ui.spacers.dp24} 0 0;color:${_ui.colors.grey700};}`];
9
- _defaultExport.__hash = "4262244129";
8
+ const _defaultExport = [".dimension-list-container.jsx-1805862671{position:relative;}", `.dimension-list-scrollbox.jsx-1805862671{position:relative;width:100%;overflow:hidden;overflow-y:auto;border:1px solid ${_ui.colors.grey400};}`, `.dimension-list-scroller.jsx-1805862671{position:relative;min-height:1px;padding:0 ${_ui.spacers.dp4};}`, ".dimension-list-scroller.loading.jsx-1805862671{-webkit-filter:blur(2px);filter:blur(2px);}", ".scroll-detector.jsx-1805862671{boxsizing:border-box;width:100%;height:100px;position:absolute;bottom:0;left:0;z-index:-1;}", ".dimension-list-overlay.jsx-1805862671{position:absolute;width:100%;height:100%;z-index:2;top:0;left:0;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;}", `.filter-wrapper.jsx-1805862671{padding:${_ui.spacers.dp8};border:1px solid ${_ui.colors.grey400};border-bottom:0;}`, `.selector-wrapper.jsx-1805862671{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:${_ui.spacers.dp4};}`, `.sub-header.jsx-1805862671{font-size:14px;font-weight:normal;margin:0 0 ${_ui.spacers.dp4};}`, `.group-select.jsx-1805862671{width:50%;margin-top:${_ui.spacers.dp4};}`, `.empty-list.jsx-1805862671{text-align:center;font-size:14px;line-height:16px;margin:${_ui.spacers.dp24} 0 0;color:${_ui.colors.grey700};}`];
9
+ _defaultExport.__hash = "1805862671";
10
10
  var _default = exports.default = _defaultExport;
@@ -25,7 +25,10 @@ const DataDimension = ({
25
25
  enabledDataTypes,
26
26
  infoBoxMessage,
27
27
  onCalculationSave,
28
- visType
28
+ visType,
29
+ height,
30
+ heightCalculation,
31
+ maxSelections
29
32
  }) => {
30
33
  const {
31
34
  serverVersion
@@ -101,7 +104,10 @@ const DataDimension = ({
101
104
  setCurrentCalculation: setCurrentCalculation,
102
105
  infoDataItem: infoDataItem,
103
106
  setInfoDataItem: setInfoDataItem,
104
- onEditClick: onEditClick
107
+ onEditClick: onEditClick,
108
+ height: height,
109
+ heightCalculation: heightCalculation,
110
+ maxSelections: maxSelections
105
111
  }), currentDataItem && /*#__PURE__*/_react.default.createElement(_ItemOptionsSelector.ItemOptionsSelector, _extends({}, currentDataItem, {
106
112
  selectedItems: selectedItems,
107
113
  onSelect: onSelectItems,
@@ -111,7 +117,9 @@ const DataDimension = ({
111
117
  infoDataItem: infoDataItem,
112
118
  setInfoDataItem: setInfoDataItem,
113
119
  onClose: () => setCurrentDataItem(),
114
- onEditClick: onEditClick
120
+ onEditClick: onEditClick,
121
+ height: height,
122
+ maxSelections: maxSelections
115
123
  })), infoDataItem && /*#__PURE__*/_react.default.createElement(_InfoPopover.InfoPopover, {
116
124
  dataTest: 'data-dimension-info',
117
125
  item: infoDataItem,
@@ -132,7 +140,10 @@ DataDimension.propTypes = {
132
140
  onSelect: _propTypes.default.func.isRequired,
133
141
  currentUser: _propTypes.default.object,
134
142
  enabledDataTypes: _propTypes.default.array,
143
+ height: _propTypes.default.string,
144
+ heightCalculation: _propTypes.default.string,
135
145
  infoBoxMessage: _propTypes.default.string,
146
+ maxSelections: _propTypes.default.number,
136
147
  visType: _propTypes.default.string,
137
148
  onCalculationSave: _propTypes.default.func
138
149
  };
@@ -47,7 +47,9 @@ const ItemOptionsSelector = ({
47
47
  onEditClick,
48
48
  onSelect,
49
49
  onClose,
50
- dataTest
50
+ dataTest,
51
+ height = _dimensionSelectorHelper.TRANSFER_HEIGHT,
52
+ maxSelections
51
53
  }) => {
52
54
  var _state$filter;
53
55
  const [state, setState] = (0, _react.useState)({
@@ -189,8 +191,8 @@ const ItemOptionsSelector = ({
189
191
  rightHeader: /*#__PURE__*/_react.default.createElement("p", {
190
192
  className: `jsx-${_DimensionSelectorStyle.default.__hash} jsx-${_ItemOptionSelectorStyle.default.__hash}` + " " + "rightHeader"
191
193
  }, _index.default.t('Selected items')),
192
- enableOrderChange: true,
193
- height: _dimensionSelectorHelper.TRANSFER_HEIGHT,
194
+ enableOrderChange: !maxSelections || maxSelections > 1,
195
+ height: height,
194
196
  optionsWidth: _dimensionSelectorHelper.TRANSFER_OPTIONS_WIDTH,
195
197
  selectedWidth: _dimensionSelectorHelper.TRANSFER_SELECTED_WIDTH,
196
198
  selectedEmptyComponent: /*#__PURE__*/_react.default.createElement(_SelectedEmptyPlaceholder.SelectedEmptyPlaceholder, null),
@@ -215,6 +217,7 @@ const ItemOptionsSelector = ({
215
217
  /* eslint-enable react/prop-types */
216
218
  }));
217
219
  },
220
+ maxSelections: maxSelections,
218
221
  dataTest: `${dataTest}-option-view-mode-transfer`
219
222
  }), /*#__PURE__*/_react.default.createElement(_style.default, {
220
223
  id: _DimensionSelectorStyle.default.__hash
@@ -231,8 +234,10 @@ ItemOptionsSelector.propTypes = {
231
234
  onClose: _propTypes.default.func.isRequired,
232
235
  onSelect: _propTypes.default.func.isRequired,
233
236
  dataTest: _propTypes.default.string,
237
+ height: _propTypes.default.string,
234
238
  infoDataItem: _propTypes.default.object,
235
239
  itemsRef: _propTypes.default.object,
240
+ maxSelections: _propTypes.default.number,
236
241
  selectedItems: _propTypes.default.arrayOf(_propTypes.default.exact({
237
242
  label: _propTypes.default.string.isRequired,
238
243
  value: _propTypes.default.string.isRequired,
@@ -114,7 +114,10 @@ const ItemSelector = ({
114
114
  onEDISave,
115
115
  onEditClick,
116
116
  isOptionViewMode,
117
- supportsEDI
117
+ supportsEDI,
118
+ height = _dimensionSelectorHelper.TRANSFER_HEIGHT,
119
+ heightCalculation,
120
+ maxSelections
118
121
  }) => {
119
122
  const [state, setState] = (0, _react.useState)({
120
123
  searchTerm: '',
@@ -342,8 +345,8 @@ const ItemSelector = ({
342
345
  onClick: () => setCurrentCalculation({}),
343
346
  small: true
344
347
  }, _index.default.t('Calculation'))) : undefined,
345
- enableOrderChange: true,
346
- height: _dimensionSelectorHelper.TRANSFER_HEIGHT,
348
+ enableOrderChange: !maxSelections || maxSelections > 1,
349
+ height: height,
347
350
  optionsWidth: _dimensionSelectorHelper.TRANSFER_OPTIONS_WIDTH,
348
351
  selectedWidth: _dimensionSelectorHelper.TRANSFER_SELECTED_WIDTH,
349
352
  selectedEmptyComponent: /*#__PURE__*/_react.default.createElement(_SelectedEmptyPlaceholder.SelectedEmptyPlaceholder, null),
@@ -370,13 +373,15 @@ const ItemSelector = ({
370
373
  })
371
374
  /* eslint-enable react/prop-types */
372
375
  })),
376
+ maxSelections: maxSelections,
373
377
  dataTest: `${dataTest}-transfer`
374
378
  }), currentCalculation && supportsEDI && /*#__PURE__*/_react.default.createElement(_CalculationModal.default, {
375
379
  calculation: currentCalculation,
376
380
  onSave: onSaveCalculation,
377
381
  onClose: () => setCurrentCalculation(),
378
382
  onDelete: onDeleteCalculation,
379
- displayNameProp: displayNameProp
383
+ displayNameProp: displayNameProp,
384
+ height: heightCalculation
380
385
  }), /*#__PURE__*/_react.default.createElement(_style.default, {
381
386
  id: _DimensionSelectorStyle.default.__hash
382
387
  }, _DimensionSelectorStyle.default));
@@ -387,10 +392,13 @@ ItemSelector.propTypes = {
387
392
  currentCalculation: _propTypes.default.object,
388
393
  dataTest: _propTypes.default.string,
389
394
  dataTypes: _propTypes.default.array,
395
+ height: _propTypes.default.string,
396
+ heightCalculation: _propTypes.default.string,
390
397
  infoBoxMessage: _propTypes.default.string,
391
398
  infoDataItem: _propTypes.default.object,
392
399
  isOptionViewMode: _propTypes.default.bool,
393
400
  itemsRef: _propTypes.default.object,
401
+ maxSelections: _propTypes.default.number,
394
402
  noItemsMessage: _propTypes.default.string,
395
403
  rightFooter: _propTypes.default.node,
396
404
  selectedItems: _propTypes.default.arrayOf(_propTypes.default.exact({
@@ -151,6 +151,9 @@ const PeriodTransfer = ({
151
151
  const opt = filteredRelativeOptions.find(o => o.id === effectiveRelativeFilterType);
152
152
  return (opt === null || opt === void 0 ? void 0 : opt.getPeriods()) || [];
153
153
  } else {
154
+ if (!/\d{4}/.test(fixedFilter.year)) {
155
+ return [];
156
+ }
154
157
  const opt = filteredFixedOptions.find(o => o.id === effectiveFixedFilterType);
155
158
  return (opt === null || opt === void 0 ? void 0 : opt.getPeriods(fixedPeriodConfig(Number(fixedFilter.year)))) || [];
156
159
  }
@@ -21,7 +21,8 @@ const CalculationModal = ({
21
21
  onSave,
22
22
  onClose,
23
23
  onDelete,
24
- displayNameProp
24
+ displayNameProp,
25
+ height
25
26
  }) => {
26
27
  const {
27
28
  show: showError
@@ -269,7 +270,8 @@ const CalculationModal = ({
269
270
  className: `jsx-${styles.__hash}` + " " + "left-section"
270
271
  }, /*#__PURE__*/React.createElement(DataElementSelector, {
271
272
  displayNameProp: displayNameProp,
272
- onDoubleClick: addItem
273
+ onDoubleClick: addItem,
274
+ height: height
273
275
  }), /*#__PURE__*/React.createElement(MathOperatorSelector, {
274
276
  onDoubleClick: addItem
275
277
  })), /*#__PURE__*/React.createElement("div", {
@@ -370,6 +372,7 @@ CalculationModal.propTypes = {
370
372
  expression: PropTypes.string,
371
373
  id: PropTypes.string,
372
374
  name: PropTypes.string
373
- })
375
+ }),
376
+ height: PropTypes.string
374
377
  };
375
378
  export default CalculationModal;
@@ -11,6 +11,7 @@ import i18n from '../../../locales/index.js';
11
11
  import { TOTALS, DETAIL, DIMENSION_TYPE_ALL, DIMENSION_TYPE_DATA_ELEMENT, dataTypeMap as dataTypes } from '../../../modules/dataTypes.js';
12
12
  import DataElementOption from './DataElementOption.js';
13
13
  import styles from './styles/DataElementSelector.style.js';
14
+ const SCROLLBOX_HEIGHT = '337px';
14
15
  const getOptions = () => ({
15
16
  [TOTALS]: i18n.t('Totals only'),
16
17
  [DETAIL]: i18n.t('Details only')
@@ -89,7 +90,8 @@ DisaggregationSelector.propTypes = {
89
90
  };
90
91
  const DataElementSelector = ({
91
92
  displayNameProp,
92
- onDoubleClick
93
+ onDoubleClick,
94
+ height = SCROLLBOX_HEIGHT
93
95
  }) => {
94
96
  const dataEngine = useDataEngine();
95
97
  const [searchTerm, setSearchTerm] = useState('');
@@ -215,6 +217,9 @@ const DataElementSelector = ({
215
217
  className: `jsx-${styles.__hash}` + " " + "dimension-list-overlay"
216
218
  }, /*#__PURE__*/React.createElement(CircularLoader, null)), /*#__PURE__*/React.createElement("div", {
217
219
  ref: rootRef,
220
+ style: {
221
+ height
222
+ },
218
223
  onScroll: () => {
219
224
  if (isSorting) {
220
225
  rootRef.current.scrollTo({
@@ -251,6 +256,7 @@ const DataElementSelector = ({
251
256
  };
252
257
  DataElementSelector.propTypes = {
253
258
  displayNameProp: PropTypes.string.isRequired,
254
- onDoubleClick: PropTypes.func.isRequired
259
+ onDoubleClick: PropTypes.func.isRequired,
260
+ height: PropTypes.string
255
261
  };
256
262
  export default DataElementSelector;
@@ -1,4 +1,4 @@
1
1
  import { colors, spacers } from '@dhis2/ui';
2
- const _defaultExport = [".dimension-list-container.jsx-4262244129{position:relative;}", `.dimension-list-scrollbox.jsx-4262244129{position:relative;width:100%;height:337px;overflow:hidden;overflow-y:auto;border:1px solid ${colors.grey400};}`, `.dimension-list-scroller.jsx-4262244129{position:relative;min-height:1px;padding:0 ${spacers.dp4};}`, ".dimension-list-scroller.loading.jsx-4262244129{-webkit-filter:blur(2px);filter:blur(2px);}", ".scroll-detector.jsx-4262244129{boxsizing:border-box;width:100%;height:100px;position:absolute;bottom:0;left:0;z-index:-1;}", ".dimension-list-overlay.jsx-4262244129{position:absolute;width:100%;height:100%;z-index:2;top:0;left:0;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;}", `.filter-wrapper.jsx-4262244129{padding:${spacers.dp8};border:1px solid ${colors.grey400};border-bottom:0;}`, `.selector-wrapper.jsx-4262244129{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:${spacers.dp4};}`, `.sub-header.jsx-4262244129{font-size:14px;font-weight:normal;margin:0 0 ${spacers.dp4};}`, `.group-select.jsx-4262244129{width:50%;margin-top:${spacers.dp4};}`, `.empty-list.jsx-4262244129{text-align:center;font-size:14px;line-height:16px;margin:${spacers.dp24} 0 0;color:${colors.grey700};}`];
3
- _defaultExport.__hash = "4262244129";
2
+ const _defaultExport = [".dimension-list-container.jsx-1805862671{position:relative;}", `.dimension-list-scrollbox.jsx-1805862671{position:relative;width:100%;overflow:hidden;overflow-y:auto;border:1px solid ${colors.grey400};}`, `.dimension-list-scroller.jsx-1805862671{position:relative;min-height:1px;padding:0 ${spacers.dp4};}`, ".dimension-list-scroller.loading.jsx-1805862671{-webkit-filter:blur(2px);filter:blur(2px);}", ".scroll-detector.jsx-1805862671{boxsizing:border-box;width:100%;height:100px;position:absolute;bottom:0;left:0;z-index:-1;}", ".dimension-list-overlay.jsx-1805862671{position:absolute;width:100%;height:100%;z-index:2;top:0;left:0;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;}", `.filter-wrapper.jsx-1805862671{padding:${spacers.dp8};border:1px solid ${colors.grey400};border-bottom:0;}`, `.selector-wrapper.jsx-1805862671{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;gap:${spacers.dp4};}`, `.sub-header.jsx-1805862671{font-size:14px;font-weight:normal;margin:0 0 ${spacers.dp4};}`, `.group-select.jsx-1805862671{width:50%;margin-top:${spacers.dp4};}`, `.empty-list.jsx-1805862671{text-align:center;font-size:14px;line-height:16px;margin:${spacers.dp24} 0 0;color:${colors.grey700};}`];
3
+ _defaultExport.__hash = "1805862671";
4
4
  export default _defaultExport;
@@ -17,7 +17,10 @@ const DataDimension = ({
17
17
  enabledDataTypes,
18
18
  infoBoxMessage,
19
19
  onCalculationSave,
20
- visType
20
+ visType,
21
+ height,
22
+ heightCalculation,
23
+ maxSelections
21
24
  }) => {
22
25
  const {
23
26
  serverVersion
@@ -93,7 +96,10 @@ const DataDimension = ({
93
96
  setCurrentCalculation: setCurrentCalculation,
94
97
  infoDataItem: infoDataItem,
95
98
  setInfoDataItem: setInfoDataItem,
96
- onEditClick: onEditClick
99
+ onEditClick: onEditClick,
100
+ height: height,
101
+ heightCalculation: heightCalculation,
102
+ maxSelections: maxSelections
97
103
  }), currentDataItem && /*#__PURE__*/React.createElement(ItemOptionsSelector, _extends({}, currentDataItem, {
98
104
  selectedItems: selectedItems,
99
105
  onSelect: onSelectItems,
@@ -103,7 +109,9 @@ const DataDimension = ({
103
109
  infoDataItem: infoDataItem,
104
110
  setInfoDataItem: setInfoDataItem,
105
111
  onClose: () => setCurrentDataItem(),
106
- onEditClick: onEditClick
112
+ onEditClick: onEditClick,
113
+ height: height,
114
+ maxSelections: maxSelections
107
115
  })), infoDataItem && /*#__PURE__*/React.createElement(InfoPopover, {
108
116
  dataTest: 'data-dimension-info',
109
117
  item: infoDataItem,
@@ -124,7 +132,10 @@ DataDimension.propTypes = {
124
132
  onSelect: PropTypes.func.isRequired,
125
133
  currentUser: PropTypes.object,
126
134
  enabledDataTypes: PropTypes.array,
135
+ height: PropTypes.string,
136
+ heightCalculation: PropTypes.string,
127
137
  infoBoxMessage: PropTypes.string,
138
+ maxSelections: PropTypes.number,
128
139
  visType: PropTypes.string,
129
140
  onCalculationSave: PropTypes.func
130
141
  };
@@ -39,7 +39,9 @@ export const ItemOptionsSelector = ({
39
39
  onEditClick,
40
40
  onSelect,
41
41
  onClose,
42
- dataTest
42
+ dataTest,
43
+ height = TRANSFER_HEIGHT,
44
+ maxSelections
43
45
  }) => {
44
46
  var _state$filter;
45
47
  const [state, setState] = useState({
@@ -181,8 +183,8 @@ export const ItemOptionsSelector = ({
181
183
  rightHeader: /*#__PURE__*/React.createElement("p", {
182
184
  className: `jsx-${styles.__hash} jsx-${itemOptionSelectorStyles.__hash}` + " " + "rightHeader"
183
185
  }, i18n.t('Selected items')),
184
- enableOrderChange: true,
185
- height: TRANSFER_HEIGHT,
186
+ enableOrderChange: !maxSelections || maxSelections > 1,
187
+ height: height,
186
188
  optionsWidth: TRANSFER_OPTIONS_WIDTH,
187
189
  selectedWidth: TRANSFER_SELECTED_WIDTH,
188
190
  selectedEmptyComponent: /*#__PURE__*/React.createElement(SelectedEmptyPlaceholder, null),
@@ -207,6 +209,7 @@ export const ItemOptionsSelector = ({
207
209
  /* eslint-enable react/prop-types */
208
210
  }));
209
211
  },
212
+ maxSelections: maxSelections,
210
213
  dataTest: `${dataTest}-option-view-mode-transfer`
211
214
  }), /*#__PURE__*/React.createElement(_JSXStyle, {
212
215
  id: styles.__hash
@@ -222,8 +225,10 @@ ItemOptionsSelector.propTypes = {
222
225
  onClose: PropTypes.func.isRequired,
223
226
  onSelect: PropTypes.func.isRequired,
224
227
  dataTest: PropTypes.string,
228
+ height: PropTypes.string,
225
229
  infoDataItem: PropTypes.object,
226
230
  itemsRef: PropTypes.object,
231
+ maxSelections: PropTypes.number,
227
232
  selectedItems: PropTypes.arrayOf(PropTypes.exact({
228
233
  label: PropTypes.string.isRequired,
229
234
  value: PropTypes.string.isRequired,
@@ -106,7 +106,10 @@ const ItemSelector = ({
106
106
  onEDISave,
107
107
  onEditClick,
108
108
  isOptionViewMode,
109
- supportsEDI
109
+ supportsEDI,
110
+ height = TRANSFER_HEIGHT,
111
+ heightCalculation,
112
+ maxSelections
110
113
  }) => {
111
114
  const [state, setState] = useState({
112
115
  searchTerm: '',
@@ -334,8 +337,8 @@ const ItemSelector = ({
334
337
  onClick: () => setCurrentCalculation({}),
335
338
  small: true
336
339
  }, i18n.t('Calculation'))) : undefined,
337
- enableOrderChange: true,
338
- height: TRANSFER_HEIGHT,
340
+ enableOrderChange: !maxSelections || maxSelections > 1,
341
+ height: height,
339
342
  optionsWidth: TRANSFER_OPTIONS_WIDTH,
340
343
  selectedWidth: TRANSFER_SELECTED_WIDTH,
341
344
  selectedEmptyComponent: /*#__PURE__*/React.createElement(SelectedEmptyPlaceholder, null),
@@ -362,13 +365,15 @@ const ItemSelector = ({
362
365
  })
363
366
  /* eslint-enable react/prop-types */
364
367
  })),
368
+ maxSelections: maxSelections,
365
369
  dataTest: `${dataTest}-transfer`
366
370
  }), currentCalculation && supportsEDI && /*#__PURE__*/React.createElement(CalculationModal, {
367
371
  calculation: currentCalculation,
368
372
  onSave: onSaveCalculation,
369
373
  onClose: () => setCurrentCalculation(),
370
374
  onDelete: onDeleteCalculation,
371
- displayNameProp: displayNameProp
375
+ displayNameProp: displayNameProp,
376
+ height: heightCalculation
372
377
  }), /*#__PURE__*/React.createElement(_JSXStyle, {
373
378
  id: styles.__hash
374
379
  }, styles));
@@ -379,10 +384,13 @@ ItemSelector.propTypes = {
379
384
  currentCalculation: PropTypes.object,
380
385
  dataTest: PropTypes.string,
381
386
  dataTypes: PropTypes.array,
387
+ height: PropTypes.string,
388
+ heightCalculation: PropTypes.string,
382
389
  infoBoxMessage: PropTypes.string,
383
390
  infoDataItem: PropTypes.object,
384
391
  isOptionViewMode: PropTypes.bool,
385
392
  itemsRef: PropTypes.object,
393
+ maxSelections: PropTypes.number,
386
394
  noItemsMessage: PropTypes.string,
387
395
  rightFooter: PropTypes.node,
388
396
  selectedItems: PropTypes.arrayOf(PropTypes.exact({
@@ -143,6 +143,9 @@ const PeriodTransfer = ({
143
143
  const opt = filteredRelativeOptions.find(o => o.id === effectiveRelativeFilterType);
144
144
  return (opt === null || opt === void 0 ? void 0 : opt.getPeriods()) || [];
145
145
  } else {
146
+ if (!/\d{4}/.test(fixedFilter.year)) {
147
+ return [];
148
+ }
146
149
  const opt = filteredFixedOptions.find(o => o.id === effectiveFixedFilterType);
147
150
  return (opt === null || opt === void 0 ? void 0 : opt.getPeriods(fixedPeriodConfig(Number(fixedFilter.year)))) || [];
148
151
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "29.3.2",
3
+ "version": "29.4.0",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {