@dhis2/analytics 26.9.5 → 26.10.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.
Files changed (59) hide show
  1. package/build/cjs/__demo__/DataDimension.stories.js +53 -0
  2. package/build/cjs/api/dimensions.js +1 -1
  3. package/build/cjs/api/expression.js +20 -10
  4. package/build/cjs/components/DataDimension/Calculation/CalculationModal.js +1 -1
  5. package/build/cjs/components/DataDimension/DataDimension.js +4 -1
  6. package/build/cjs/components/DataDimension/Info/CalculationInfo.js +106 -0
  7. package/build/cjs/components/DataDimension/Info/DataElementInfo.js +135 -0
  8. package/build/cjs/components/DataDimension/Info/DataElementOperandInfo.js +188 -0
  9. package/build/cjs/components/DataDimension/Info/DataSetInfo.js +115 -0
  10. package/build/cjs/components/DataDimension/Info/EventDataItemInfo.js +111 -0
  11. package/build/cjs/components/DataDimension/Info/IndicatorInfo.js +179 -0
  12. package/build/cjs/components/DataDimension/Info/InfoPopover.js +58 -0
  13. package/build/cjs/components/DataDimension/Info/InfoTable.js +219 -0
  14. package/build/cjs/components/DataDimension/Info/ProgramIndicatorInfo.js +191 -0
  15. package/build/cjs/components/DataDimension/Info/styles/InfoPopover.style.js +10 -0
  16. package/build/cjs/components/DataDimension/ItemSelector.js +22 -5
  17. package/build/cjs/components/DataDimension/TransferOption.js +117 -0
  18. package/build/cjs/components/DataDimension/styles/TransferOption.style.js +10 -0
  19. package/build/cjs/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +0 -20
  20. package/build/cjs/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +0 -5
  21. package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/FixedPeriodSingleSelect.spec.js.snap +0 -12
  22. package/build/cjs/components/PeriodDimension/__tests__/__snapshots__/PeriodSelector.spec.js.snap +3 -10
  23. package/build/cjs/components/styles/DimensionSelector.style.js +2 -2
  24. package/build/cjs/index.js +66 -10
  25. package/build/cjs/locales/en/translations.json +73 -9
  26. package/build/cjs/locales/vi/translations.json +202 -202
  27. package/build/cjs/modules/dimensionListItem.js +3 -3
  28. package/build/cjs/modules/dimensionSelectorHelper.js +2 -2
  29. package/build/cjs/modules/valueTypes.js +50 -11
  30. package/build/es/__demo__/DataDimension.stories.js +42 -0
  31. package/build/es/api/dimensions.js +1 -1
  32. package/build/es/api/expression.js +19 -9
  33. package/build/es/components/DataDimension/Calculation/CalculationModal.js +2 -2
  34. package/build/es/components/DataDimension/DataDimension.js +4 -1
  35. package/build/es/components/DataDimension/Info/CalculationInfo.js +96 -0
  36. package/build/es/components/DataDimension/Info/DataElementInfo.js +127 -0
  37. package/build/es/components/DataDimension/Info/DataElementOperandInfo.js +178 -0
  38. package/build/es/components/DataDimension/Info/DataSetInfo.js +107 -0
  39. package/build/es/components/DataDimension/Info/EventDataItemInfo.js +103 -0
  40. package/build/es/components/DataDimension/Info/IndicatorInfo.js +169 -0
  41. package/build/es/components/DataDimension/Info/InfoPopover.js +54 -0
  42. package/build/es/components/DataDimension/Info/InfoTable.js +205 -0
  43. package/build/es/components/DataDimension/Info/ProgramIndicatorInfo.js +181 -0
  44. package/build/es/components/DataDimension/Info/styles/InfoPopover.style.js +4 -0
  45. package/build/es/components/DataDimension/ItemSelector.js +24 -7
  46. package/build/es/components/DataDimension/TransferOption.js +109 -0
  47. package/build/es/components/DataDimension/styles/TransferOption.style.js +4 -0
  48. package/build/es/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +0 -20
  49. package/build/es/components/OrgUnitDimension/__tests__/__snapshots__/OrgUnitDimension.spec.js.snap +0 -5
  50. package/build/es/components/PeriodDimension/__tests__/__snapshots__/FixedPeriodSingleSelect.spec.js.snap +0 -12
  51. package/build/es/components/PeriodDimension/__tests__/__snapshots__/PeriodSelector.spec.js.snap +3 -10
  52. package/build/es/components/styles/DimensionSelector.style.js +2 -2
  53. package/build/es/index.js +1 -1
  54. package/build/es/locales/en/translations.json +73 -9
  55. package/build/es/locales/vi/translations.json +202 -202
  56. package/build/es/modules/dimensionListItem.js +1 -1
  57. package/build/es/modules/dimensionSelectorHelper.js +2 -2
  58. package/build/es/modules/valueTypes.js +48 -10
  59. package/package.json +5 -5
@@ -0,0 +1,181 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ import { useDataMutation, useDataEngine } from '@dhis2/app-runtime';
3
+ import PropTypes from 'prop-types';
4
+ import React, { useCallback, useEffect, useState } from 'react';
5
+ import { validateProgramIndicatorExpressionMutation } from '../../../api/expression.js';
6
+ import i18n from '../../../locales/index.js';
7
+ import { getCommonFields, renderHumanReadableExpression, renderLegendSets, sentenceCaseText, InfoTable } from './InfoTable.js';
8
+ import styles from './styles/InfoPopover.style.js';
9
+ const programIndicatorQuery = {
10
+ programIndicator: {
11
+ resource: 'programIndicators',
12
+ id: _ref => {
13
+ let {
14
+ id
15
+ } = _ref;
16
+ return id;
17
+ },
18
+ params: _ref2 => {
19
+ let {
20
+ displayNameProp
21
+ } = _ref2;
22
+ return {
23
+ fields: `${getCommonFields(displayNameProp)},aggregationType,analyticsPeriodBoundaries[analyticsPeriodBoundaryType,boundaryTarget,id,offsetPeriodType,offsetPeriods],analyticsType,decimals,expression,filter,legendSets[id,displayName],program[displayName]`
24
+ };
25
+ }
26
+ }
27
+ };
28
+ export const ProgramIndicatorInfo = _ref3 => {
29
+ let {
30
+ type,
31
+ id,
32
+ displayNameProp
33
+ } = _ref3;
34
+ const [data, setData] = useState();
35
+ const [error, setError] = useState();
36
+ const [loading, setLoading] = useState(true);
37
+ const engine = useDataEngine();
38
+ const [getHumanReadableExpression] = useDataMutation(validateProgramIndicatorExpressionMutation, {
39
+ onError: setError
40
+ });
41
+ const fetchData = useCallback(async () => {
42
+ const {
43
+ programIndicator
44
+ } = await engine.query(programIndicatorQuery, {
45
+ variables: {
46
+ id,
47
+ displayNameProp
48
+ },
49
+ onError: setError
50
+ });
51
+ if (programIndicator.expression) {
52
+ const result = await getHumanReadableExpression({
53
+ expression: programIndicator.expression
54
+ });
55
+ if (result) {
56
+ programIndicator.humanReadableExpression = result;
57
+ }
58
+ }
59
+ if (programIndicator.filter) {
60
+ const result = await getHumanReadableExpression({
61
+ expression: programIndicator.filter
62
+ });
63
+ if (result) {
64
+ programIndicator.humanReadableFilter = result;
65
+ }
66
+ }
67
+ programIndicator.analyticsPeriodBoundaries.forEach((_ref4, index) => {
68
+ let {
69
+ boundaryTarget
70
+ } = _ref4;
71
+ programIndicator.analyticsPeriodBoundaries[index].boundaryTarget = ['ENROLLMENT_DATE', 'EVENT_DATE', 'INCIDENT_DATE'].includes(boundaryTarget) ? sentenceCaseText(boundaryTarget) : i18n.t('Custom');
72
+ });
73
+ setData({
74
+ programIndicator
75
+ });
76
+ setLoading(false);
77
+ }, [displayNameProp, engine, id, getHumanReadableExpression]);
78
+ useEffect(() => {
79
+ fetchData();
80
+ }, [fetchData]);
81
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfoTable, {
82
+ dataType: type,
83
+ data: data === null || data === void 0 ? void 0 : data.programIndicator,
84
+ loading: loading,
85
+ error: error
86
+ }, /*#__PURE__*/React.createElement("tr", {
87
+ className: `jsx-${styles.__hash}`
88
+ }, /*#__PURE__*/React.createElement("th", {
89
+ className: `jsx-${styles.__hash}`
90
+ }, i18n.t('Program')), /*#__PURE__*/React.createElement("td", {
91
+ className: `jsx-${styles.__hash}`
92
+ }, data === null || data === void 0 ? void 0 : data.programIndicator.program.displayName)), /*#__PURE__*/React.createElement("tr", {
93
+ className: `jsx-${styles.__hash}`
94
+ }, /*#__PURE__*/React.createElement("th", {
95
+ className: `jsx-${styles.__hash}`
96
+ }, i18n.t('Analytics type')), /*#__PURE__*/React.createElement("td", {
97
+ className: `jsx-${styles.__hash}`
98
+ }, (data === null || data === void 0 ? void 0 : data.programIndicator.analyticsType) === 'ENROLLMENT' ? i18n.t('Enrollment') : i18n.t('Event'))), /*#__PURE__*/React.createElement("tr", {
99
+ className: `jsx-${styles.__hash}`
100
+ }, /*#__PURE__*/React.createElement("th", {
101
+ className: `jsx-${styles.__hash}`
102
+ }, i18n.t('Analytics period boundaries')), /*#__PURE__*/React.createElement("td", {
103
+ className: `jsx-${styles.__hash}`
104
+ }, /*#__PURE__*/React.createElement("div", {
105
+ className: `jsx-${styles.__hash}` + " " + "content-wrap"
106
+ }, /*#__PURE__*/React.createElement("ul", {
107
+ className: `jsx-${styles.__hash}`
108
+ }, data === null || data === void 0 ? void 0 : data.programIndicator.analyticsPeriodBoundaries.map(_ref5 => {
109
+ let {
110
+ analyticsPeriodBoundaryType,
111
+ boundaryTarget,
112
+ id,
113
+ offsetPeriodType,
114
+ offsetPeriods
115
+ } = _ref5;
116
+ return /*#__PURE__*/React.createElement("li", {
117
+ key: id,
118
+ className: `jsx-${styles.__hash}`
119
+ }, /*#__PURE__*/React.createElement("span", {
120
+ className: `jsx-${styles.__hash}`
121
+ }, /*#__PURE__*/React.createElement("span", {
122
+ className: `jsx-${styles.__hash}` + " " + "label"
123
+ }, i18n.t('Type:'), "\xA0"), sentenceCaseText(analyticsPeriodBoundaryType)), /*#__PURE__*/React.createElement("br", {
124
+ className: `jsx-${styles.__hash}`
125
+ }), /*#__PURE__*/React.createElement("span", {
126
+ className: `jsx-${styles.__hash}`
127
+ }, /*#__PURE__*/React.createElement("span", {
128
+ className: `jsx-${styles.__hash}` + " " + "label"
129
+ }, i18n.t('Target:'), "\xA0"), boundaryTarget), Boolean(offsetPeriods) && Boolean(offsetPeriodType) && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("br", {
130
+ className: `jsx-${styles.__hash}`
131
+ }), /*#__PURE__*/React.createElement("span", {
132
+ className: `jsx-${styles.__hash}`
133
+ }, /*#__PURE__*/React.createElement("span", {
134
+ className: `jsx-${styles.__hash}` + " " + "label"
135
+ }, i18n.t('Offset:'), "\xA0"), i18n.t('{{ offsetPeriodType }} × {{ offsetPeriods }}', {
136
+ offsetPeriodType,
137
+ offsetPeriods
138
+ }))));
139
+ }))))), /*#__PURE__*/React.createElement("tr", {
140
+ className: `jsx-${styles.__hash}`
141
+ }, /*#__PURE__*/React.createElement("th", {
142
+ className: `jsx-${styles.__hash}`
143
+ }, i18n.t('Expression')), /*#__PURE__*/React.createElement("td", {
144
+ className: `jsx-${styles.__hash}`
145
+ }, data !== null && data !== void 0 && data.programIndicator.humanReadableExpression ? renderHumanReadableExpression(data.programIndicator.humanReadableExpression) : /*#__PURE__*/React.createElement("span", {
146
+ className: `jsx-${styles.__hash}` + " " + "none"
147
+ }, i18n.t('None')))), /*#__PURE__*/React.createElement("tr", {
148
+ className: `jsx-${styles.__hash}`
149
+ }, /*#__PURE__*/React.createElement("th", {
150
+ className: `jsx-${styles.__hash}`
151
+ }, i18n.t('Filter')), /*#__PURE__*/React.createElement("td", {
152
+ className: `jsx-${styles.__hash}`
153
+ }, data !== null && data !== void 0 && data.programIndicator.humanReadableFilter ? renderHumanReadableExpression(data.programIndicator.humanReadableFilter) : /*#__PURE__*/React.createElement("span", {
154
+ className: `jsx-${styles.__hash}` + " " + "none"
155
+ }, i18n.t('None')))), /*#__PURE__*/React.createElement("tr", {
156
+ className: `jsx-${styles.__hash}`
157
+ }, /*#__PURE__*/React.createElement("th", {
158
+ className: `jsx-${styles.__hash}`
159
+ }, i18n.t('Aggregation type')), /*#__PURE__*/React.createElement("td", {
160
+ className: `jsx-${styles.__hash}`
161
+ }, 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.createElement("tr", {
162
+ className: `jsx-${styles.__hash}`
163
+ }, /*#__PURE__*/React.createElement("th", {
164
+ className: `jsx-${styles.__hash}`
165
+ }, i18n.t('Decimals in output')), /*#__PURE__*/React.createElement("td", {
166
+ className: `jsx-${styles.__hash}`
167
+ }, data.programIndicator.decimals)), Boolean(data === null || data === void 0 ? void 0 : data.programIndicator.legendSets.length) && /*#__PURE__*/React.createElement("tr", {
168
+ className: `jsx-${styles.__hash}`
169
+ }, /*#__PURE__*/React.createElement("th", {
170
+ className: `jsx-${styles.__hash}`
171
+ }, i18n.t('Legend set(s)')), /*#__PURE__*/React.createElement("td", {
172
+ className: `jsx-${styles.__hash}`
173
+ }, renderLegendSets(data.programIndicator.legendSets)))), /*#__PURE__*/React.createElement(_JSXStyle, {
174
+ id: styles.__hash
175
+ }, styles));
176
+ };
177
+ ProgramIndicatorInfo.propTypes = {
178
+ displayNameProp: PropTypes.string,
179
+ id: PropTypes.string,
180
+ type: PropTypes.string
181
+ };
@@ -0,0 +1,4 @@
1
+ import { colors, spacers } from '@dhis2/ui';
2
+ const _defaultExport = [`.popover.jsx-681815212{width:480px;height:360px;border:1px solid ${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:${colors.grey700};}`, `.data-table.jsx-681815212{display:table;width:100%;border-collapse:collapse;font-size:13px;line-height:17px;margin:${spacers.dp4} 0 0 0;color:${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:${colors.grey100};}`, `ul.jsx-681815212{margin:0;padding:0 0 0 ${spacers.dp16};list-style-position:outside;}`, `li.jsx-681815212+li.jsx-681815212{margin:${spacers.dp4} 0 0 0;}`, `details.jsx-681815212 ul.jsx-681815212{margin:${spacers.dp4} 0 0 ${spacers.dp16};}`, `.data-table.jsx-681815212 .code.jsx-681815212{font-size:11px;line-height:15px;display:inline-block;border-radius:2px;background-color:${colors.grey200};outline:3px solid ${colors.grey200};color:${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:${colors.grey600};}`];
3
+ _defaultExport.__hash = "681815212";
4
+ export default _defaultExport;
@@ -3,19 +3,20 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
3
3
  import { useDataEngine } from '@dhis2/app-runtime';
4
4
  import { Transfer, InputField, IconInfo16, Button, IconAdd24 } from '@dhis2/ui';
5
5
  import PropTypes from 'prop-types';
6
- import React, { useState } from 'react';
6
+ import React, { useRef, useState } from 'react';
7
7
  import { apiFetchOptions } from '../../api/dimensions.js';
8
8
  import i18n from '../../locales/index.js';
9
9
  import { DATA_SETS_CONSTANTS, REPORTING_RATE } from '../../modules/dataSets.js';
10
10
  import { DIMENSION_TYPE_ALL, DIMENSION_TYPE_DATA_ELEMENT, DIMENSION_TYPE_DATA_SET, DIMENSION_TYPE_EVENT_DATA_ITEM, DIMENSION_TYPE_PROGRAM_INDICATOR, DIMENSION_TYPE_INDICATOR, TOTALS, DIMENSION_TYPE_EXPRESSION_DIMENSION_ITEM } from '../../modules/dataTypes.js';
11
- import { getIcon, getTooltipText } from '../../modules/dimensionListItem.js';
11
+ import { getIcon, getDimensionType } from '../../modules/dimensionListItem.js';
12
12
  import { TRANSFER_HEIGHT, TRANSFER_OPTIONS_WIDTH, TRANSFER_SELECTED_WIDTH } from '../../modules/dimensionSelectorHelper.js';
13
13
  import { useDebounce, useDidUpdateEffect } from '../../modules/utils.js';
14
14
  import styles from '../styles/DimensionSelector.style.js';
15
- import { TransferOption } from '../TransferOption.js';
16
15
  import CalculationModal from './Calculation/CalculationModal.js';
17
16
  import DataTypeSelector from './DataTypeSelector.js';
18
17
  import GroupSelector from './GroupSelector.js';
18
+ import { InfoPopover } from './Info/InfoPopover.js';
19
+ import { TransferOption } from './TransferOption.js';
19
20
  const LeftHeader = _ref => {
20
21
  let {
21
22
  searchTerm,
@@ -203,6 +204,7 @@ const ItemSelector = _ref5 => {
203
204
  dataTest,
204
205
  onEDISave
205
206
  } = _ref5;
207
+ const itemsRef = useRef(new Map());
206
208
  const [state, setState] = useState({
207
209
  searchTerm: '',
208
210
  dataTypes,
@@ -222,12 +224,13 @@ const ItemSelector = _ref5 => {
222
224
  }).includes(DIMENSION_TYPE_EXPRESSION_DIMENSION_ITEM)
223
225
  });
224
226
  const [currentCalculation, setCurrentCalculation] = useState();
227
+ const [currentDataItem, setCurrentDataItem] = useState();
228
+ const debouncedSearchTerm = useDebounce(state.searchTerm, 500);
225
229
  const dataEngine = useDataEngine();
226
230
  const setSearchTerm = searchTerm => setState(state => ({
227
231
  ...state,
228
232
  searchTerm
229
233
  }));
230
- const debouncedSearchTerm = useDebounce(state.searchTerm, 500);
231
234
  const fetchItems = async page => {
232
235
  var _result$dimensionItem;
233
236
  setState(state => ({
@@ -391,7 +394,9 @@ const ItemSelector = _ref5 => {
391
394
  subGroup: dataType === DIMENSION_TYPE_DATA_ELEMENT ? TOTALS : null
392
395
  }
393
396
  }));
394
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Transfer, {
397
+ return /*#__PURE__*/React.createElement("div", {
398
+ className: `jsx-${styles.__hash}` + " " + "transfer-container"
399
+ }, /*#__PURE__*/React.createElement(Transfer, {
395
400
  onChange: _ref9 => {
396
401
  let {
397
402
  selected
@@ -445,17 +450,23 @@ const ItemSelector = _ref5 => {
445
450
  return /*#__PURE__*/React.createElement(TransferOption
446
451
  /* eslint-disable react/prop-types */, _extends({}, props, {
447
452
  active: isActive(props.value),
453
+ showingInfo: (currentDataItem === null || currentDataItem === void 0 ? void 0 : currentDataItem.id) === props.value,
448
454
  icon: getIcon(getItemType(props.value)),
449
- tooltipText: getTooltipText({
455
+ dimensionType: getDimensionType({
450
456
  type: getItemType(props.value),
451
457
  expression: props.expression
452
458
  }),
453
459
  dataTest: `${dataTest}-transfer-option`,
460
+ itemsRef: itemsRef,
454
461
  onEditClick: getItemType(props.value) === DIMENSION_TYPE_EXPRESSION_DIMENSION_ITEM && !(((_props$access = props.access) === null || _props$access === void 0 ? void 0 : _props$access.write) === false) && state.supportsEDI ? () => setCurrentCalculation({
455
462
  id: props.value,
456
463
  name: props.label,
457
464
  expression: props.expression
458
- }) : undefined
465
+ }) : undefined,
466
+ onInfoClick: () => setCurrentDataItem({
467
+ id: props.value,
468
+ type: getItemType(props.value)
469
+ })
459
470
  /* eslint-enable react/prop-types */
460
471
  }));
461
472
  },
@@ -466,6 +477,12 @@ const ItemSelector = _ref5 => {
466
477
  onClose: () => setCurrentCalculation(),
467
478
  onDelete: onDeleteCalculation,
468
479
  displayNameProp: displayNameProp
480
+ }), currentDataItem && /*#__PURE__*/React.createElement(InfoPopover, {
481
+ dataTest: `${dataTest}-info`,
482
+ item: currentDataItem,
483
+ reference: itemsRef.current.get(currentDataItem.id),
484
+ onClose: () => setCurrentDataItem(),
485
+ displayNameProp: displayNameProp
469
486
  }), /*#__PURE__*/React.createElement(_JSXStyle, {
470
487
  id: styles.__hash
471
488
  }, styles));
@@ -0,0 +1,109 @@
1
+ import _JSXStyle from "styled-jsx/style";
2
+ import { IconEdit16, IconInfo16 } from '@dhis2/ui';
3
+ import cx from 'classnames';
4
+ import PropTypes from 'prop-types';
5
+ import React from 'react';
6
+ import styles from './styles/TransferOption.style.js';
7
+ export const TransferOption = _ref => {
8
+ let {
9
+ disabled,
10
+ label,
11
+ highlighted,
12
+ selected,
13
+ onClick,
14
+ onDoubleClick,
15
+ value,
16
+ icon,
17
+ active,
18
+ dimensionType,
19
+ dataTest,
20
+ itemsRef,
21
+ showingInfo,
22
+ onEditClick,
23
+ onInfoClick
24
+ } = _ref;
25
+ const renderContent = () => /*#__PURE__*/React.createElement("div", {
26
+ "data-test": `${dataTest}-content`,
27
+ onClick: event => {
28
+ if (disabled) {
29
+ return;
30
+ }
31
+ onClick({
32
+ label,
33
+ value
34
+ }, event);
35
+ },
36
+ onDoubleClick: event => {
37
+ if (disabled) {
38
+ return;
39
+ }
40
+ onDoubleClick({
41
+ label,
42
+ value
43
+ }, event);
44
+ },
45
+ className: `jsx-${styles.__hash}` + " " + (cx('item', {
46
+ highlighted,
47
+ disabled,
48
+ selected,
49
+ inactive: active !== undefined && !active
50
+ }) || "")
51
+ }, /*#__PURE__*/React.createElement("div", {
52
+ className: `jsx-${styles.__hash}` + " " + "labelGroup"
53
+ }, /*#__PURE__*/React.createElement("span", {
54
+ className: `jsx-${styles.__hash}` + " " + "icon"
55
+ }, icon), /*#__PURE__*/React.createElement("span", {
56
+ className: `jsx-${styles.__hash}` + " " + "label"
57
+ }, label), onEditClick && /*#__PURE__*/React.createElement("span", {
58
+ onClick: e => {
59
+ e.stopPropagation();
60
+ onEditClick();
61
+ },
62
+ "data-test": `${dataTest}-edit-button`,
63
+ className: `jsx-${styles.__hash}` + " " + "edit"
64
+ }, /*#__PURE__*/React.createElement(IconEdit16, null))), /*#__PURE__*/React.createElement("div", {
65
+ className: `jsx-${styles.__hash}` + " " + (cx('group', 'nowrap', 'typeGroup') || "")
66
+ }, /*#__PURE__*/React.createElement("span", {
67
+ className: `jsx-${styles.__hash}` + " " + "type"
68
+ }, dimensionType), /*#__PURE__*/React.createElement("span", {
69
+ ref: node => {
70
+ node ? itemsRef.current.set(value, node) : itemsRef.current.delete(value);
71
+ }
72
+ // avoid moving items when toggling the info popover
73
+ // sometimes a double click event is fired
74
+ ,
75
+ onDoubleClick: e => e.stopPropagation(),
76
+ onClick: e => {
77
+ e.stopPropagation();
78
+ onInfoClick();
79
+ },
80
+ "data-test": `${dataTest}-info-button`,
81
+ className: `jsx-${styles.__hash}` + " " + (cx('info', {
82
+ active: showingInfo
83
+ }) || "")
84
+ }, /*#__PURE__*/React.createElement(IconInfo16, null))), /*#__PURE__*/React.createElement(_JSXStyle, {
85
+ id: styles.__hash
86
+ }, styles));
87
+ return /*#__PURE__*/React.createElement("div", {
88
+ "data-value": value,
89
+ "data-test": dataTest,
90
+ className: "wrapper"
91
+ }, renderContent());
92
+ };
93
+ TransferOption.propTypes = {
94
+ label: PropTypes.string.isRequired,
95
+ value: PropTypes.string.isRequired,
96
+ active: PropTypes.bool,
97
+ dataTest: PropTypes.string,
98
+ dimensionType: PropTypes.string,
99
+ disabled: PropTypes.bool,
100
+ highlighted: PropTypes.bool,
101
+ icon: PropTypes.node,
102
+ itemsRef: PropTypes.object,
103
+ selected: PropTypes.bool,
104
+ showingInfo: PropTypes.bool,
105
+ onClick: PropTypes.func,
106
+ onDoubleClick: PropTypes.func,
107
+ onEditClick: PropTypes.func,
108
+ onInfoClick: PropTypes.func
109
+ };
@@ -0,0 +1,4 @@
1
+ import { colors, spacers, theme } from '@dhis2/ui';
2
+ const _defaultExport = [`.wrapper.jsx-2953719875:last-child{margin-bottom:${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:${colors.white};font-size:14px;line-height:16px;border-bottom:1px solid ${colors.grey300};-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}`, `.item.jsx-2953719875:hover{background:${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:${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:${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:${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:${spacers.dp8};cursor:pointer;color:${colors.grey600};}`, `.info.jsx-2953719875{margin:0 0 0 ${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:${colors.grey300};color:${colors.grey900};}`, `.highlighted.jsx-2953719875{background:${theme.secondary700};}`, `.highlighted.jsx-2953719875:hover{background:${theme.secondary800};}`, `.highlighted.jsx-2953719875 .label.jsx-2953719875{color:${colors.white};}`, `.highlighted.jsx-2953719875 .type.jsx-2953719875{color:${theme.secondary050};}`, `.highlighted.jsx-2953719875 .info.jsx-2953719875{color:${theme.secondary050};}`, `.highlighted.jsx-2953719875 .icon path{fill:${colors.teal050};}`, `.highlighted.jsx-2953719875 .type.jsx-2953719875{color:${colors.teal050};}`, `.edit.jsx-2953719875:hover,.info.jsx-2953719875:hover{background-color:${colors.grey200};border-radius:0px;}`, `.highlighted.jsx-2953719875 .info.active.jsx-2953719875{background-color:${theme.secondary900};}`, `.highlighted.jsx-2953719875 .edit.jsx-2953719875:hover,.highlighted.jsx-2953719875 .info.jsx-2953719875:hover{background-color:${theme.secondary900};}`];
3
+ _defaultExport.__hash = "2953719875";
4
+ export default _defaultExport;
@@ -4,10 +4,6 @@ exports[`DimensionItem matches the snapshot 1`] = `
4
4
  <Fragment>
5
5
  <CssVariables
6
6
  colors={true}
7
- elevations={false}
8
- layers={false}
9
- spacers={false}
10
- theme={false}
11
7
  />
12
8
  <li
13
9
  className="item"
@@ -56,10 +52,6 @@ exports[`DimensionItem matches the snapshot with locked 1`] = `
56
52
  <Fragment>
57
53
  <CssVariables
58
54
  colors={true}
59
- elevations={false}
60
- layers={false}
61
- spacers={false}
62
- theme={false}
63
55
  />
64
56
  <li
65
57
  className="item"
@@ -126,10 +118,6 @@ exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
126
118
  <Fragment>
127
119
  <CssVariables
128
120
  colors={true}
129
- elevations={false}
130
- layers={false}
131
- spacers={false}
132
- theme={false}
133
121
  />
134
122
  <li
135
123
  className="item"
@@ -182,10 +170,6 @@ exports[`DimensionItem matches the snapshot with recommended 1`] = `
182
170
  <Fragment>
183
171
  <CssVariables
184
172
  colors={true}
185
- elevations={false}
186
- layers={false}
187
- spacers={false}
188
- theme={false}
189
173
  />
190
174
  <li
191
175
  className="item"
@@ -234,10 +218,6 @@ exports[`DimensionItem matches the snapshot with selected 1`] = `
234
218
  <Fragment>
235
219
  <CssVariables
236
220
  colors={true}
237
- elevations={false}
238
- layers={false}
239
- spacers={false}
240
- theme={false}
241
221
  />
242
222
  <li
243
223
  className="item selected"
@@ -37,11 +37,8 @@ exports[`The OrgUnitDimension component matches the snapshot 1`] = `
37
37
  >
38
38
  <OrganisationUnitTree
39
39
  dataTest="org-unit-tree"
40
- filter={Array []}
41
- highlighted={Array []}
42
40
  initiallyExpanded={Array []}
43
41
  onChange={[Function]}
44
- renderNodeLabel={[Function]}
45
42
  roots={Array []}
46
43
  selected={Array []}
47
44
  />
@@ -78,12 +75,10 @@ exports[`The OrgUnitDimension component matches the snapshot 1`] = `
78
75
  className="deselectButton"
79
76
  >
80
77
  <Button
81
- dataTest="dhis2-uicore-button"
82
78
  disabled={true}
83
79
  onClick={[Function]}
84
80
  secondary={true}
85
81
  small={true}
86
- type="button"
87
82
  >
88
83
  Deselect all
89
84
  </Button>
@@ -28,73 +28,61 @@ exports[`The Fixed Period Single Select component matches the snapshot 1`] = `
28
28
  selected="201405"
29
29
  >
30
30
  <SingleSelectOption
31
- dataTest="dhis2-uicore-singleselectoption"
32
31
  key="201401"
33
32
  label="January 2014"
34
33
  value="201401"
35
34
  />
36
35
  <SingleSelectOption
37
- dataTest="dhis2-uicore-singleselectoption"
38
36
  key="201402"
39
37
  label="February 2014"
40
38
  value="201402"
41
39
  />
42
40
  <SingleSelectOption
43
- dataTest="dhis2-uicore-singleselectoption"
44
41
  key="201403"
45
42
  label="March 2014"
46
43
  value="201403"
47
44
  />
48
45
  <SingleSelectOption
49
- dataTest="dhis2-uicore-singleselectoption"
50
46
  key="201404"
51
47
  label="April 2014"
52
48
  value="201404"
53
49
  />
54
50
  <SingleSelectOption
55
- dataTest="dhis2-uicore-singleselectoption"
56
51
  key="201405"
57
52
  label="May 2014"
58
53
  value="201405"
59
54
  />
60
55
  <SingleSelectOption
61
- dataTest="dhis2-uicore-singleselectoption"
62
56
  key="201406"
63
57
  label="June 2014"
64
58
  value="201406"
65
59
  />
66
60
  <SingleSelectOption
67
- dataTest="dhis2-uicore-singleselectoption"
68
61
  key="201407"
69
62
  label="July 2014"
70
63
  value="201407"
71
64
  />
72
65
  <SingleSelectOption
73
- dataTest="dhis2-uicore-singleselectoption"
74
66
  key="201408"
75
67
  label="August 2014"
76
68
  value="201408"
77
69
  />
78
70
  <SingleSelectOption
79
- dataTest="dhis2-uicore-singleselectoption"
80
71
  key="201409"
81
72
  label="September 2014"
82
73
  value="201409"
83
74
  />
84
75
  <SingleSelectOption
85
- dataTest="dhis2-uicore-singleselectoption"
86
76
  key="201410"
87
77
  label="October 2014"
88
78
  value="201410"
89
79
  />
90
80
  <SingleSelectOption
91
- dataTest="dhis2-uicore-singleselectoption"
92
81
  key="201411"
93
82
  label="November 2014"
94
83
  value="201411"
95
84
  />
96
85
  <SingleSelectOption
97
- dataTest="dhis2-uicore-singleselectoption"
98
86
  key="201412"
99
87
  label="December 2014"
100
88
  value="201412"
@@ -4,16 +4,10 @@ exports[`The Period Selector component matches the snapshot 1`] = `
4
4
  <Transfer
5
5
  dataTest="period-dimension-transfer"
6
6
  enableOrderChange={true}
7
- filterCallback={[Function]}
8
- filterCallbackPicked={[Function]}
9
7
  height="512px"
10
- initialSearchTerm=""
11
- initialSearchTermPicked=""
12
8
  leftHeader={
13
9
  <React.Fragment>
14
- <TabBar
15
- dataTest="dhis2-uicore-tabbar"
16
- >
10
+ <TabBar>
17
11
  <Tab
18
12
  dataTest="period-dimension-relative-periods-button"
19
13
  onClick={[Function]}
@@ -44,7 +38,6 @@ exports[`The Period Selector component matches the snapshot 1`] = `
44
38
  </style>
45
39
  </React.Fragment>
46
40
  }
47
- maxSelections={Infinity}
48
41
  onChange={[Function]}
49
42
  options={
50
43
  Array [
@@ -74,7 +67,7 @@ exports[`The Period Selector component matches the snapshot 1`] = `
74
67
  },
75
68
  ]
76
69
  }
77
- optionsWidth="420px"
70
+ optionsWidth="520px"
78
71
  renderOption={[Function]}
79
72
  rightFooter={<React.Fragment />}
80
73
  rightHeader={<RightHeader />}
@@ -91,6 +84,6 @@ exports[`The Period Selector component matches the snapshot 1`] = `
91
84
  </style>
92
85
  </React.Fragment>
93
86
  }
94
- selectedWidth="298px"
87
+ selectedWidth="520px"
95
88
  />
96
89
  `;
@@ -1,4 +1,4 @@
1
1
  import { spacers, colors } from '@dhis2/ui';
2
- const _defaultExport = [`.filterContainer.jsx-336728173{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin-bottom:${spacers.dp12};margin-top:${spacers.dp8};}`, `.emptyList.jsx-336728173{text-align:center;font-size:14px;line-height:16px;margin:${spacers.dp24} 0 0;color:${colors.grey700};}`, ".rightHeader.jsx-336728173{font-size:14px;font-weight:400;}", `.leftHeader.jsx-336728173{padding:${spacers.dp12} ${spacers.dp4};}`, `.info-container.jsx-336728173{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-336728173{padding-left:${spacers.dp8};color:${colors.grey900};font-size:12px;line-height:16px;}`, `.calculation-button.jsx-336728173{margin:${spacers.dp8} 0;}`];
3
- _defaultExport.__hash = "336728173";
2
+ const _defaultExport = [".transfer-container.jsx-1438110436{min-width:800px;}", `.filterContainer.jsx-1438110436{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;margin-bottom:${spacers.dp12};margin-top:${spacers.dp8};}`, `.emptyList.jsx-1438110436{text-align:center;font-size:14px;line-height:16px;margin:${spacers.dp24} 0 0;color:${colors.grey700};}`, ".rightHeader.jsx-1438110436{font-size:14px;font-weight:400;}", `.leftHeader.jsx-1438110436{padding:${spacers.dp12} ${spacers.dp4};}`, `.info-container.jsx-1438110436{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-1438110436{padding-left:${spacers.dp8};color:${colors.grey900};font-size:12px;line-height:16px;}`, `.calculation-button.jsx-1438110436{margin:${spacers.dp8} 0;}`];
3
+ _defaultExport.__hash = "1438110436";
4
4
  export default _defaultExport;
package/build/es/index.js CHANGED
@@ -70,7 +70,7 @@ export { layoutHasDynamicDimension } from './modules/layout/layoutHasDynamicDime
70
70
  export { layoutHasPeriodDimension } from './modules/layout/layoutHasPeriodDimension.js';
71
71
 
72
72
  // Modules: valueTypes
73
- export { VALUE_TYPE_NUMBER, VALUE_TYPE_UNIT_INTERVAL, VALUE_TYPE_PERCENTAGE, VALUE_TYPE_INTEGER, VALUE_TYPE_INTEGER_POSITIVE, VALUE_TYPE_INTEGER_NEGATIVE, VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE, VALUE_TYPE_TEXT, VALUE_TYPE_LONG_TEXT, VALUE_TYPE_LETTER, VALUE_TYPE_PHONE_NUMBER, VALUE_TYPE_EMAIL, VALUE_TYPE_USERNAME, VALUE_TYPE_URL, VALUE_TYPE_BOOLEAN, VALUE_TYPE_TRUE_ONLY, VALUE_TYPE_DATE, VALUE_TYPE_TIME, VALUE_TYPE_DATETIME, VALUE_TYPE_ORGANISATION_UNIT, VALUE_TYPE_AGE } from './modules/valueTypes.js';
73
+ export { VALUE_TYPE_TEXT, VALUE_TYPE_LONG_TEXT, VALUE_TYPE_MULTI_TEXT, VALUE_TYPE_LETTER, VALUE_TYPE_PHONE_NUMBER, VALUE_TYPE_EMAIL, VALUE_TYPE_BOOLEAN, VALUE_TYPE_TRUE_ONLY, VALUE_TYPE_DATE, VALUE_TYPE_DATETIME, VALUE_TYPE_TIME, VALUE_TYPE_NUMBER, VALUE_TYPE_UNIT_INTERVAL, VALUE_TYPE_PERCENTAGE, VALUE_TYPE_INTEGER, VALUE_TYPE_INTEGER_POSITIVE, VALUE_TYPE_INTEGER_NEGATIVE, VALUE_TYPE_INTEGER_ZERO_OR_POSITIVE, VALUE_TYPE_TRACKER_ASSOCIATE, VALUE_TYPE_USERNAME, VALUE_TYPE_COORDINATE, VALUE_TYPE_ORGANISATION_UNIT, VALUE_TYPE_REFERENCE, VALUE_TYPE_AGE, VALUE_TYPE_URL, VALUE_TYPE_FILE_RESOURCE, VALUE_TYPE_IMAGE, VALUE_TYPE_GEOJSON, valueTypeDisplayNames } from './modules/valueTypes.js';
74
74
  export { AXIS, AXIS_ID_COLUMNS, AXIS_ID_ROWS, AXIS_ID_FILTERS, DEFAULT_AXIS_IDS } from './modules/layout/axis.js';
75
75
  export { axisGetAllItems } from './modules/layout/axisGetAllItems.js';
76
76
  export { axisGetDimension } from './modules/layout/axisGetDimension.js';