@dhis2/analytics 26.2.0 → 26.3.0-alpha.2
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 +1 -0
- package/build/cjs/assets/DynamicDimensionIcon.js +12 -38
- package/build/cjs/components/DimensionsPanel/List/DimensionItem.js +37 -29
- package/build/cjs/components/DimensionsPanel/List/OptionsButton.js +7 -6
- package/build/cjs/components/DimensionsPanel/List/RecommendedIcon.js +1 -2
- package/build/cjs/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +190 -366
- package/build/cjs/components/DimensionsPanel/List/styles/DimensionItem.module.css +83 -0
- package/build/cjs/components/DimensionsPanel/List/styles/DimensionList.style.js +2 -2
- package/build/cjs/components/DimensionsPanel/List/styles/RecommendedIcon.style.js +4 -4
- package/build/cjs/components/DimensionsPanel/styles/DimensionsPanel.style.js +1 -1
- package/build/es/__demo__/DimensionsPanel.stories.js +1 -0
- package/build/es/assets/DynamicDimensionIcon.js +12 -38
- package/build/es/components/DimensionsPanel/List/DimensionItem.js +38 -30
- package/build/es/components/DimensionsPanel/List/OptionsButton.js +7 -6
- package/build/es/components/DimensionsPanel/List/RecommendedIcon.js +1 -2
- package/build/es/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +190 -366
- package/build/es/components/DimensionsPanel/List/styles/DimensionItem.module.css +83 -0
- package/build/es/components/DimensionsPanel/List/styles/DimensionList.style.js +2 -2
- package/build/es/components/DimensionsPanel/List/styles/RecommendedIcon.style.js +4 -4
- package/build/es/components/DimensionsPanel/styles/DimensionsPanel.style.js +1 -1
- package/package.json +1 -1
- package/build/cjs/components/DimensionsPanel/List/styles/DimensionItem.style.js +0 -73
- package/build/es/components/DimensionsPanel/List/styles/DimensionItem.style.js +0 -66
|
@@ -7,11 +7,11 @@ exports.styles = void 0;
|
|
|
7
7
|
var _ui = require("@dhis2/ui");
|
|
8
8
|
const styles = {
|
|
9
9
|
recommendedIcon: {
|
|
10
|
-
backgroundColor: _ui.theme.
|
|
11
|
-
height: '
|
|
12
|
-
width: '
|
|
10
|
+
backgroundColor: _ui.theme.secondary400,
|
|
11
|
+
height: '6px',
|
|
12
|
+
width: '6px',
|
|
13
13
|
borderRadius: '4px',
|
|
14
|
-
marginLeft: '
|
|
14
|
+
marginLeft: '6px',
|
|
15
15
|
display: 'inline-block',
|
|
16
16
|
cursor: 'pointer'
|
|
17
17
|
}
|
|
@@ -62,6 +62,7 @@ storiesOf('DimensionsPanel', module).add('locked dimension', () => {
|
|
|
62
62
|
return /*#__PURE__*/React.createElement(DimensionsPanel, {
|
|
63
63
|
dimensions: [...fixedDimensions, ...dynamicDimensions],
|
|
64
64
|
onDimensionClick: onDimensionClick,
|
|
65
|
+
selectedIds: [DIMENSION_ID_DATA],
|
|
65
66
|
lockedDimension: dimension => dimension === DIMENSION_ID_DATA
|
|
66
67
|
});
|
|
67
68
|
});
|
|
@@ -1,47 +1,21 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
const DynamicDimensionIcon = () => {
|
|
3
3
|
return /*#__PURE__*/React.createElement("svg", {
|
|
4
|
-
width: "16px",
|
|
5
|
-
height: "16px",
|
|
6
|
-
viewBox: "0 0 16 16",
|
|
7
|
-
version: "1.1",
|
|
8
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
9
|
-
}, /*#__PURE__*/React.createElement("g", {
|
|
10
|
-
id: "Exp",
|
|
11
|
-
stroke: "none",
|
|
12
|
-
strokeWidth: "1",
|
|
13
|
-
fill: "none",
|
|
14
|
-
fillRule: "evenodd"
|
|
15
|
-
}, /*#__PURE__*/React.createElement("g", {
|
|
16
|
-
id: "Artboard",
|
|
17
|
-
transform: "translate(-80.000000, -9.000000)"
|
|
18
|
-
}, /*#__PURE__*/React.createElement("g", {
|
|
19
|
-
id: "icon_dimension_new",
|
|
20
|
-
transform: "translate(80.000000, 9.000000)"
|
|
21
|
-
}, /*#__PURE__*/React.createElement("rect", {
|
|
22
|
-
id: "frame",
|
|
23
|
-
x: "0",
|
|
24
|
-
y: "0",
|
|
25
4
|
width: "16",
|
|
26
|
-
height: "16"
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
5
|
+
height: "16",
|
|
6
|
+
fill: "none",
|
|
7
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
8
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
9
|
+
clipRule: "evenodd",
|
|
10
|
+
d: "m4.832 5.674 2.831-1.11a.913.913 0 0 1 .673 0l2.83 1.11a.548.548 0 0 1 .334.517V9.81a.548.548 0 0 1-.332.517l-2.831 1.11a.92.92 0 0 1-.673 0l-2.83-1.11a.548.548 0 0 1-.334-.517V6.19a.548.548 0 0 1 .332-.517Z",
|
|
11
|
+
stroke: "#212934",
|
|
31
12
|
strokeLinecap: "round",
|
|
32
13
|
strokeLinejoin: "round"
|
|
33
|
-
}, /*#__PURE__*/React.createElement("path", {
|
|
34
|
-
d: "M0.33209728,1.1742111 L3.16308174,0.0641666694 C3.37911767,-0.0213888898 3.61963794,-0.0213888898 3.83567387,0.0641666694 L6.66665833,1.1742111 C6.87300668,1.26220739 7.00497003,1.467 6.99984343,1.69127776 L6.99984343,5.30887771 C7.00517859,5.53285411 6.87376309,5.73756106 6.66790272,5.82594437 L3.83691826,6.93629991 C3.62076407,7.02123336 3.38048032,7.02123336 3.16432613,6.93629991 L0.333341668,5.82594437 C0.126993317,5.73794808 -0.00497002591,5.53315547 0.000156574133,5.30887771 L0.000156574133,1.69127776 C-0.00517858533,1.46730136 0.126236906,1.26259441 0.33209728,1.1742111 Z",
|
|
35
|
-
id: "Shape"
|
|
36
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
37
|
-
d: "M3.5,2.72795833 L0.322,1.48195833",
|
|
38
|
-
id: "Shape"
|
|
39
|
-
}), /*#__PURE__*/React.createElement("path", {
|
|
40
|
-
d: "M3.5,2.72795833 L6.678,1.48195833",
|
|
41
|
-
id: "Shape"
|
|
42
14
|
}), /*#__PURE__*/React.createElement("path", {
|
|
43
|
-
d: "
|
|
44
|
-
|
|
45
|
-
|
|
15
|
+
d: "M8 7.228 4.822 5.982M8 7.228l3.178-1.246M8 11.281V7.228",
|
|
16
|
+
stroke: "#212934",
|
|
17
|
+
strokeLinecap: "round",
|
|
18
|
+
strokeLinejoin: "round"
|
|
19
|
+
}));
|
|
46
20
|
};
|
|
47
21
|
export default DynamicDimensionIcon;
|
|
@@ -2,14 +2,15 @@ function _extends() { _extends = Object.assign ? Object.assign.bind() : function
|
|
|
2
2
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
3
3
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
4
4
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
|
-
import {
|
|
5
|
+
import { CssVariables } from '@dhis2/ui';
|
|
6
|
+
import cx from 'classnames';
|
|
6
7
|
import PropTypes from 'prop-types';
|
|
7
8
|
import React, { Component, createRef } from 'react';
|
|
8
9
|
import DynamicDimensionIcon from '../../../assets/DynamicDimensionIcon.js';
|
|
9
10
|
import { DIMENSION_PROP_NO_ITEMS, getPredefinedDimensionProp } from '../../../modules/predefinedDimensions.js';
|
|
10
11
|
import OptionsButton from './OptionsButton.js';
|
|
11
12
|
import RecommendedIcon from './RecommendedIcon.js';
|
|
12
|
-
import
|
|
13
|
+
import style from './styles/DimensionItem.module.css';
|
|
13
14
|
class DimensionItem extends Component {
|
|
14
15
|
constructor() {
|
|
15
16
|
super(...arguments);
|
|
@@ -30,23 +31,18 @@ class DimensionItem extends Component {
|
|
|
30
31
|
_defineProperty(this, "getDimensionIcon", () => {
|
|
31
32
|
const Icon = getPredefinedDimensionProp(this.props.id, 'icon');
|
|
32
33
|
return Icon ? /*#__PURE__*/React.createElement(Icon, {
|
|
33
|
-
|
|
34
|
+
className: style.fixedDimensionIcon
|
|
34
35
|
}) : /*#__PURE__*/React.createElement(DynamicDimensionIcon, {
|
|
35
|
-
|
|
36
|
+
className: "dynamic-dimension-icon"
|
|
36
37
|
});
|
|
37
38
|
});
|
|
38
39
|
_defineProperty(this, "getDimensionType", () => {
|
|
39
40
|
const {
|
|
40
41
|
id,
|
|
41
|
-
name
|
|
42
|
-
isDeactivated
|
|
42
|
+
name
|
|
43
43
|
} = this.props;
|
|
44
44
|
return /*#__PURE__*/React.createElement("span", {
|
|
45
|
-
"data-dimensionid": id
|
|
46
|
-
style: {
|
|
47
|
-
...styles.text,
|
|
48
|
-
...(isDeactivated ? styles.textDeactivated : {})
|
|
49
|
-
}
|
|
45
|
+
"data-dimensionid": id
|
|
50
46
|
}, name);
|
|
51
47
|
});
|
|
52
48
|
}
|
|
@@ -60,51 +56,63 @@ class DimensionItem extends Component {
|
|
|
60
56
|
onClick,
|
|
61
57
|
onOptionsClick,
|
|
62
58
|
innerRef,
|
|
63
|
-
style,
|
|
64
59
|
dataTest,
|
|
60
|
+
className,
|
|
65
61
|
...rest
|
|
66
62
|
} = this.props;
|
|
67
63
|
const Icon = this.getDimensionIcon();
|
|
68
64
|
const Label = this.getDimensionType();
|
|
69
|
-
const itemStyle = isSelected && !isDeactivated ? {
|
|
70
|
-
...styles.item,
|
|
71
|
-
...styles.selected
|
|
72
|
-
} : styles.item;
|
|
73
65
|
const optionsRef = /*#__PURE__*/createRef();
|
|
66
|
+
const LockIcon = /*#__PURE__*/React.createElement("svg", {
|
|
67
|
+
width: "7",
|
|
68
|
+
height: "9",
|
|
69
|
+
fill: "none",
|
|
70
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
71
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
72
|
+
fillRule: "evenodd",
|
|
73
|
+
clipRule: "evenodd",
|
|
74
|
+
d: "M3.5 1A1.5 1.5 0 0 0 2 2.5V3h3v-.5A1.5 1.5 0 0 0 3.5 1ZM1 2.5V3H0v6h7V3H6v-.5a2.5 2.5 0 0 0-5 0ZM1 8V4h5v4H1Zm3-1V5H3v2h1Z",
|
|
75
|
+
fill: "none"
|
|
76
|
+
}));
|
|
74
77
|
const onLabelClick = () => {
|
|
75
78
|
if (!isDeactivated && !getPredefinedDimensionProp(id, DIMENSION_PROP_NO_ITEMS)) {
|
|
76
79
|
onClick(id);
|
|
77
80
|
}
|
|
78
81
|
};
|
|
79
|
-
return /*#__PURE__*/React.createElement(
|
|
82
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CssVariables, {
|
|
83
|
+
colors: true
|
|
84
|
+
}), /*#__PURE__*/React.createElement("li", _extends({
|
|
80
85
|
onMouseOver: this.onMouseOver,
|
|
81
86
|
onMouseLeave: this.onMouseExit,
|
|
82
87
|
ref: innerRef,
|
|
83
|
-
|
|
88
|
+
className: cx(style.item, {
|
|
89
|
+
[style.deactivated]: isDeactivated,
|
|
90
|
+
[style.selected]: isSelected && !isDeactivated
|
|
91
|
+
}, className),
|
|
84
92
|
"data-test": dataTest,
|
|
85
93
|
onClick: onLabelClick
|
|
86
94
|
}, rest), /*#__PURE__*/React.createElement("div", {
|
|
87
|
-
className:
|
|
95
|
+
className: style.label,
|
|
88
96
|
tabIndex: 0,
|
|
89
|
-
style: styles.label,
|
|
90
97
|
"data-test": `${dataTest}-button-${id}`
|
|
91
98
|
}, /*#__PURE__*/React.createElement("div", {
|
|
92
|
-
|
|
99
|
+
className: style.iconWrapper
|
|
93
100
|
}, Icon), /*#__PURE__*/React.createElement("div", {
|
|
94
|
-
|
|
95
|
-
},
|
|
101
|
+
className: style.labelWrapper
|
|
102
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
103
|
+
className: style.labelText
|
|
104
|
+
}, Label), /*#__PURE__*/React.createElement(RecommendedIcon, {
|
|
96
105
|
isRecommended: isRecommended,
|
|
97
106
|
dataTest: `${dataTest}-recommended-icon`
|
|
98
|
-
})),
|
|
99
|
-
|
|
100
|
-
}, /*#__PURE__*/React.createElement(IconLock16, null))), onOptionsClick ? /*#__PURE__*/React.createElement("div", {
|
|
101
|
-
style: styles.optionsWrapper,
|
|
107
|
+
}))), onOptionsClick ? /*#__PURE__*/React.createElement("div", {
|
|
108
|
+
className: style.optionsWrapper,
|
|
102
109
|
ref: optionsRef,
|
|
103
110
|
"data-test": `${dataTest}-menu-${id}`
|
|
104
111
|
}, this.state.mouseOver && !isDeactivated && !isLocked ? /*#__PURE__*/React.createElement(OptionsButton, {
|
|
105
|
-
style: styles.optionsButton,
|
|
106
112
|
onClick: this.onOptionsClick(id, optionsRef)
|
|
107
|
-
}) : null) : null
|
|
113
|
+
}) : null) : null, isLocked && /*#__PURE__*/React.createElement("div", {
|
|
114
|
+
className: style.lockWrapper
|
|
115
|
+
}, LockIcon)));
|
|
108
116
|
}
|
|
109
117
|
}
|
|
110
118
|
DimensionItem.propTypes = {
|
|
@@ -112,12 +120,12 @@ DimensionItem.propTypes = {
|
|
|
112
120
|
isSelected: PropTypes.bool.isRequired,
|
|
113
121
|
// XXX
|
|
114
122
|
name: PropTypes.string.isRequired,
|
|
123
|
+
className: PropTypes.string,
|
|
115
124
|
dataTest: PropTypes.string,
|
|
116
125
|
innerRef: PropTypes.func,
|
|
117
126
|
isDeactivated: PropTypes.bool,
|
|
118
127
|
isLocked: PropTypes.bool,
|
|
119
128
|
isRecommended: PropTypes.bool,
|
|
120
|
-
style: PropTypes.object,
|
|
121
129
|
onClick: PropTypes.func,
|
|
122
130
|
onOptionsClick: PropTypes.func
|
|
123
131
|
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
+
import _JSXStyle from "styled-jsx/style";
|
|
1
2
|
import { IconMore16 } from '@dhis2/ui';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
const OptionsButton = _ref => {
|
|
5
6
|
let {
|
|
6
|
-
style,
|
|
7
7
|
onClick
|
|
8
8
|
} = _ref;
|
|
9
|
-
return /*#__PURE__*/React.createElement("button", {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}, /*#__PURE__*/React.createElement(IconMore16, null))
|
|
9
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("button", {
|
|
10
|
+
onClick: onClick,
|
|
11
|
+
className: "jsx-2728765288"
|
|
12
|
+
}, /*#__PURE__*/React.createElement(IconMore16, null)), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
13
|
+
id: "2728765288"
|
|
14
|
+
}, ["button.jsx-2728765288{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;height:20px;width:20px;padding:0;border:none;background:none;outline:none;cursor:pointer;border-top-right-radius:2px;border-bottom-left-radius:2px;}", "button.jsx-2728765288:hover{background-color:rgba(0,0,0,0.09);}"]));
|
|
13
15
|
};
|
|
14
16
|
OptionsButton.propTypes = {
|
|
15
|
-
style: PropTypes.object,
|
|
16
17
|
onClick: PropTypes.func
|
|
17
18
|
};
|
|
18
19
|
export default OptionsButton;
|
|
@@ -10,8 +10,7 @@ const RecommendedIcon = _ref => {
|
|
|
10
10
|
} = _ref;
|
|
11
11
|
return isRecommended ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
12
12
|
content: i18n.t('Dimension recommended with selected data'),
|
|
13
|
-
placement: "bottom"
|
|
14
|
-
maxWidth: 160
|
|
13
|
+
placement: "bottom"
|
|
15
14
|
}, /*#__PURE__*/React.createElement("div", {
|
|
16
15
|
style: styles.recommendedIcon,
|
|
17
16
|
"data-test": dataTest
|