@dhis2/analytics 24.3.9 → 24.3.11
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/CHANGELOG.md +14 -0
- package/build/cjs/components/DimensionsPanel/List/DimensionItem.js +14 -8
- package/build/cjs/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +60 -30
- package/build/cjs/components/DimensionsPanel/List/styles/DimensionItem.style.js +7 -1
- package/build/cjs/components/TranslationDialog/TranslationModal/TranslationForm.js +19 -1
- package/build/es/components/DimensionsPanel/List/DimensionItem.js +15 -8
- package/build/es/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap +60 -30
- package/build/es/components/DimensionsPanel/List/styles/DimensionItem.style.js +7 -1
- package/build/es/components/TranslationDialog/TranslationModal/TranslationForm.js +19 -1
- package/package.json +1 -1
- package/build/cjs/components/DimensionsPanel/List/DimensionLabel.js +0 -63
- package/build/cjs/components/DimensionsPanel/List/styles/DimensionLabel.style.js +0 -13
- package/build/es/components/DimensionsPanel/List/DimensionLabel.js +0 -46
- package/build/es/components/DimensionsPanel/List/styles/DimensionLabel.style.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [24.3.11](https://github.com/dhis2/analytics/compare/v24.3.10...v24.3.11) (2022-12-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* do not pass translation object when value is empty ([#1401](https://github.com/dhis2/analytics/issues/1401)) ([03c6a2e](https://github.com/dhis2/analytics/commit/03c6a2ee98b437fed2a44233e4a750d17bd3c5af))
|
|
7
|
+
|
|
8
|
+
## [24.3.10](https://github.com/dhis2/analytics/compare/v24.3.9...v24.3.10) (2022-12-02)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* items in sidebar not clickable full width (DHIS2-6626) ([#1390](https://github.com/dhis2/analytics/issues/1390)) ([4b7cff4](https://github.com/dhis2/analytics/commit/4b7cff4a182ae3f44fada600337ba477a2656ed5))
|
|
14
|
+
|
|
1
15
|
## [24.3.9](https://github.com/dhis2/analytics/compare/v24.3.8...v24.3.9) (2022-12-01)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -15,8 +15,6 @@ var _DynamicDimensionIcon = _interopRequireDefault(require("../../../assets/Dyna
|
|
|
15
15
|
|
|
16
16
|
var _predefinedDimensions = require("../../../modules/predefinedDimensions.js");
|
|
17
17
|
|
|
18
|
-
var _DimensionLabel = _interopRequireDefault(require("./DimensionLabel.js"));
|
|
19
|
-
|
|
20
18
|
var _OptionsButton = _interopRequireDefault(require("./OptionsButton.js"));
|
|
21
19
|
|
|
22
20
|
var _RecommendedIcon = _interopRequireDefault(require("./RecommendedIcon.js"));
|
|
@@ -99,16 +97,24 @@ class DimensionItem extends _react.Component {
|
|
|
99
97
|
..._DimensionItemStyle.styles.selected
|
|
100
98
|
} : _DimensionItemStyle.styles.item;
|
|
101
99
|
const optionsRef = /*#__PURE__*/(0, _react.createRef)();
|
|
100
|
+
|
|
101
|
+
const onLabelClick = () => {
|
|
102
|
+
if (!isDeactivated && !(0, _predefinedDimensions.getPredefinedDimensionProp)(id, _predefinedDimensions.DIMENSION_PROP_NO_ITEMS)) {
|
|
103
|
+
onClick(id);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
|
|
102
107
|
return /*#__PURE__*/_react.default.createElement("li", _extends({
|
|
103
108
|
onMouseOver: this.onMouseOver,
|
|
104
109
|
onMouseLeave: this.onMouseExit,
|
|
105
110
|
ref: innerRef,
|
|
106
|
-
style: Object.assign({}, itemStyle, style),
|
|
107
|
-
"data-test": dataTest
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
111
|
+
style: Object.assign({}, itemStyle, style, !isDeactivated && _DimensionItemStyle.styles.clickable),
|
|
112
|
+
"data-test": dataTest,
|
|
113
|
+
onClick: onLabelClick
|
|
114
|
+
}, rest), /*#__PURE__*/_react.default.createElement("div", {
|
|
115
|
+
className: "label",
|
|
116
|
+
tabIndex: 0,
|
|
117
|
+
style: _DimensionItemStyle.styles.label,
|
|
112
118
|
dataTest: "".concat(dataTest, "-button-").concat(id)
|
|
113
119
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
114
120
|
style: _DimensionItemStyle.styles.iconWrapper
|
package/build/cjs/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
exports[`DimensionItem matches the snapshot 1`] = `
|
|
4
4
|
<li
|
|
5
5
|
name="Period"
|
|
6
|
+
onClick={[Function]}
|
|
6
7
|
onMouseLeave={[Function]}
|
|
7
8
|
onMouseOver={[Function]}
|
|
8
9
|
style={
|
|
9
10
|
Object {
|
|
10
11
|
"alignItems": "center",
|
|
11
12
|
"borderRadius": "2px",
|
|
13
|
+
"cursor": "pointer",
|
|
12
14
|
"display": "flex",
|
|
13
15
|
"marginBottom": 3,
|
|
14
16
|
"marginTop": 3,
|
|
@@ -16,11 +18,16 @@ exports[`DimensionItem matches the snapshot 1`] = `
|
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
>
|
|
19
|
-
<
|
|
21
|
+
<div
|
|
22
|
+
className="label"
|
|
20
23
|
dataTest="undefined-button-pe"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
style={
|
|
25
|
+
Object {
|
|
26
|
+
"display": "flex",
|
|
27
|
+
"outline": "none",
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
tabIndex={0}
|
|
24
31
|
>
|
|
25
32
|
<div
|
|
26
33
|
style={
|
|
@@ -52,7 +59,6 @@ exports[`DimensionItem matches the snapshot 1`] = `
|
|
|
52
59
|
style={
|
|
53
60
|
Object {
|
|
54
61
|
"color": "#212934",
|
|
55
|
-
"cursor": "pointer",
|
|
56
62
|
"fontSize": "14px",
|
|
57
63
|
"userSelect": "none",
|
|
58
64
|
"wordBreak": "break-word",
|
|
@@ -66,19 +72,21 @@ exports[`DimensionItem matches the snapshot 1`] = `
|
|
|
66
72
|
isRecommended={false}
|
|
67
73
|
/>
|
|
68
74
|
</div>
|
|
69
|
-
</
|
|
75
|
+
</div>
|
|
70
76
|
</li>
|
|
71
77
|
`;
|
|
72
78
|
|
|
73
79
|
exports[`DimensionItem matches the snapshot with locked 1`] = `
|
|
74
80
|
<li
|
|
75
81
|
name="Period"
|
|
82
|
+
onClick={[Function]}
|
|
76
83
|
onMouseLeave={[Function]}
|
|
77
84
|
onMouseOver={[Function]}
|
|
78
85
|
style={
|
|
79
86
|
Object {
|
|
80
87
|
"alignItems": "center",
|
|
81
88
|
"borderRadius": "2px",
|
|
89
|
+
"cursor": "pointer",
|
|
82
90
|
"display": "flex",
|
|
83
91
|
"marginBottom": 3,
|
|
84
92
|
"marginTop": 3,
|
|
@@ -86,11 +94,16 @@ exports[`DimensionItem matches the snapshot with locked 1`] = `
|
|
|
86
94
|
}
|
|
87
95
|
}
|
|
88
96
|
>
|
|
89
|
-
<
|
|
97
|
+
<div
|
|
98
|
+
className="label"
|
|
90
99
|
dataTest="undefined-button-pe"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
100
|
+
style={
|
|
101
|
+
Object {
|
|
102
|
+
"display": "flex",
|
|
103
|
+
"outline": "none",
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
tabIndex={0}
|
|
94
107
|
>
|
|
95
108
|
<div
|
|
96
109
|
style={
|
|
@@ -122,7 +135,6 @@ exports[`DimensionItem matches the snapshot with locked 1`] = `
|
|
|
122
135
|
style={
|
|
123
136
|
Object {
|
|
124
137
|
"color": "#212934",
|
|
125
|
-
"cursor": "pointer",
|
|
126
138
|
"fontSize": "14px",
|
|
127
139
|
"userSelect": "none",
|
|
128
140
|
"wordBreak": "break-word",
|
|
@@ -147,19 +159,21 @@ exports[`DimensionItem matches the snapshot with locked 1`] = `
|
|
|
147
159
|
>
|
|
148
160
|
<SvgLock16 />
|
|
149
161
|
</div>
|
|
150
|
-
</
|
|
162
|
+
</div>
|
|
151
163
|
</li>
|
|
152
164
|
`;
|
|
153
165
|
|
|
154
166
|
exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
|
|
155
167
|
<li
|
|
156
168
|
name="Period"
|
|
169
|
+
onClick={[Function]}
|
|
157
170
|
onMouseLeave={[Function]}
|
|
158
171
|
onMouseOver={[Function]}
|
|
159
172
|
style={
|
|
160
173
|
Object {
|
|
161
174
|
"alignItems": "center",
|
|
162
175
|
"borderRadius": "2px",
|
|
176
|
+
"cursor": "pointer",
|
|
163
177
|
"display": "flex",
|
|
164
178
|
"marginBottom": 3,
|
|
165
179
|
"marginTop": 3,
|
|
@@ -167,11 +181,16 @@ exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
|
|
|
167
181
|
}
|
|
168
182
|
}
|
|
169
183
|
>
|
|
170
|
-
<
|
|
184
|
+
<div
|
|
185
|
+
className="label"
|
|
171
186
|
dataTest="undefined-button-pe"
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
187
|
+
style={
|
|
188
|
+
Object {
|
|
189
|
+
"display": "flex",
|
|
190
|
+
"outline": "none",
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
tabIndex={0}
|
|
175
194
|
>
|
|
176
195
|
<div
|
|
177
196
|
style={
|
|
@@ -203,7 +222,6 @@ exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
|
|
|
203
222
|
style={
|
|
204
223
|
Object {
|
|
205
224
|
"color": "#212934",
|
|
206
|
-
"cursor": "pointer",
|
|
207
225
|
"fontSize": "14px",
|
|
208
226
|
"userSelect": "none",
|
|
209
227
|
"wordBreak": "break-word",
|
|
@@ -217,7 +235,7 @@ exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
|
|
|
217
235
|
isRecommended={false}
|
|
218
236
|
/>
|
|
219
237
|
</div>
|
|
220
|
-
</
|
|
238
|
+
</div>
|
|
221
239
|
<div
|
|
222
240
|
data-test="undefined-menu-pe"
|
|
223
241
|
style={
|
|
@@ -235,12 +253,14 @@ exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
|
|
|
235
253
|
exports[`DimensionItem matches the snapshot with recommended 1`] = `
|
|
236
254
|
<li
|
|
237
255
|
name="Period"
|
|
256
|
+
onClick={[Function]}
|
|
238
257
|
onMouseLeave={[Function]}
|
|
239
258
|
onMouseOver={[Function]}
|
|
240
259
|
style={
|
|
241
260
|
Object {
|
|
242
261
|
"alignItems": "center",
|
|
243
262
|
"borderRadius": "2px",
|
|
263
|
+
"cursor": "pointer",
|
|
244
264
|
"display": "flex",
|
|
245
265
|
"marginBottom": 3,
|
|
246
266
|
"marginTop": 3,
|
|
@@ -248,11 +268,16 @@ exports[`DimensionItem matches the snapshot with recommended 1`] = `
|
|
|
248
268
|
}
|
|
249
269
|
}
|
|
250
270
|
>
|
|
251
|
-
<
|
|
271
|
+
<div
|
|
272
|
+
className="label"
|
|
252
273
|
dataTest="undefined-button-pe"
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
274
|
+
style={
|
|
275
|
+
Object {
|
|
276
|
+
"display": "flex",
|
|
277
|
+
"outline": "none",
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
tabIndex={0}
|
|
256
281
|
>
|
|
257
282
|
<div
|
|
258
283
|
style={
|
|
@@ -284,7 +309,6 @@ exports[`DimensionItem matches the snapshot with recommended 1`] = `
|
|
|
284
309
|
style={
|
|
285
310
|
Object {
|
|
286
311
|
"color": "#212934",
|
|
287
|
-
"cursor": "pointer",
|
|
288
312
|
"fontSize": "14px",
|
|
289
313
|
"userSelect": "none",
|
|
290
314
|
"wordBreak": "break-word",
|
|
@@ -298,13 +322,14 @@ exports[`DimensionItem matches the snapshot with recommended 1`] = `
|
|
|
298
322
|
isRecommended={true}
|
|
299
323
|
/>
|
|
300
324
|
</div>
|
|
301
|
-
</
|
|
325
|
+
</div>
|
|
302
326
|
</li>
|
|
303
327
|
`;
|
|
304
328
|
|
|
305
329
|
exports[`DimensionItem matches the snapshot with selected 1`] = `
|
|
306
330
|
<li
|
|
307
331
|
name="Period"
|
|
332
|
+
onClick={[Function]}
|
|
308
333
|
onMouseLeave={[Function]}
|
|
309
334
|
onMouseOver={[Function]}
|
|
310
335
|
style={
|
|
@@ -312,6 +337,7 @@ exports[`DimensionItem matches the snapshot with selected 1`] = `
|
|
|
312
337
|
"alignItems": "center",
|
|
313
338
|
"backgroundColor": "#e0f2f1",
|
|
314
339
|
"borderRadius": "2px",
|
|
340
|
+
"cursor": "pointer",
|
|
315
341
|
"display": "flex",
|
|
316
342
|
"fontWeight": 500,
|
|
317
343
|
"marginBottom": 3,
|
|
@@ -320,11 +346,16 @@ exports[`DimensionItem matches the snapshot with selected 1`] = `
|
|
|
320
346
|
}
|
|
321
347
|
}
|
|
322
348
|
>
|
|
323
|
-
<
|
|
349
|
+
<div
|
|
350
|
+
className="label"
|
|
324
351
|
dataTest="undefined-button-pe"
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
352
|
+
style={
|
|
353
|
+
Object {
|
|
354
|
+
"display": "flex",
|
|
355
|
+
"outline": "none",
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
tabIndex={0}
|
|
328
359
|
>
|
|
329
360
|
<div
|
|
330
361
|
style={
|
|
@@ -356,7 +387,6 @@ exports[`DimensionItem matches the snapshot with selected 1`] = `
|
|
|
356
387
|
style={
|
|
357
388
|
Object {
|
|
358
389
|
"color": "#212934",
|
|
359
|
-
"cursor": "pointer",
|
|
360
390
|
"fontSize": "14px",
|
|
361
391
|
"userSelect": "none",
|
|
362
392
|
"wordBreak": "break-word",
|
|
@@ -370,6 +400,6 @@ exports[`DimensionItem matches the snapshot with selected 1`] = `
|
|
|
370
400
|
isRecommended={false}
|
|
371
401
|
/>
|
|
372
402
|
</div>
|
|
373
|
-
</
|
|
403
|
+
</div>
|
|
374
404
|
</li>
|
|
375
405
|
`;
|
|
@@ -14,7 +14,6 @@ const styles = {
|
|
|
14
14
|
text: {
|
|
15
15
|
color: _ui.colors.grey900,
|
|
16
16
|
userSelect: 'none',
|
|
17
|
-
cursor: 'pointer',
|
|
18
17
|
wordBreak: 'break-word',
|
|
19
18
|
fontSize: '14px'
|
|
20
19
|
},
|
|
@@ -30,6 +29,9 @@ const styles = {
|
|
|
30
29
|
alignItems: 'center',
|
|
31
30
|
borderRadius: '2px'
|
|
32
31
|
},
|
|
32
|
+
clickable: {
|
|
33
|
+
cursor: 'pointer'
|
|
34
|
+
},
|
|
33
35
|
selected: {
|
|
34
36
|
backgroundColor: _ui.theme.secondary100,
|
|
35
37
|
fontWeight: 500
|
|
@@ -64,6 +66,10 @@ const styles = {
|
|
|
64
66
|
background: 'none',
|
|
65
67
|
outline: 'none',
|
|
66
68
|
cursor: 'pointer'
|
|
69
|
+
},
|
|
70
|
+
label: {
|
|
71
|
+
display: 'flex',
|
|
72
|
+
outline: 'none'
|
|
67
73
|
}
|
|
68
74
|
};
|
|
69
75
|
exports.styles = styles;
|
|
@@ -63,7 +63,25 @@ const TranslationForm = _ref => {
|
|
|
63
63
|
value: translation
|
|
64
64
|
};
|
|
65
65
|
const translationIndex = getTranslationIndexForField(field);
|
|
66
|
-
|
|
66
|
+
|
|
67
|
+
if (translationIndex === -1) {
|
|
68
|
+
// non existing translation, adding new
|
|
69
|
+
setNewTranslations([...newTranslations, newTranslation]);
|
|
70
|
+
} else {
|
|
71
|
+
// cleared existing translation, remove it from the list
|
|
72
|
+
if (!translation) {
|
|
73
|
+
setNewTranslations(newTranslations.reduce((tmp, translation, index) => {
|
|
74
|
+
if (index !== translationIndex) {
|
|
75
|
+
tmp.push(translation);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return tmp;
|
|
79
|
+
}, []));
|
|
80
|
+
} // replace existing translation with new one
|
|
81
|
+
else {
|
|
82
|
+
setNewTranslations(newTranslations.map((translation, index) => index === translationIndex ? newTranslation : translation));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
67
85
|
};
|
|
68
86
|
|
|
69
87
|
const i18nMutationRef = (0, _react.useRef)({
|
|
@@ -6,8 +6,7 @@ import { IconLock16 } from '@dhis2/ui';
|
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import React, { Component, createRef } from 'react';
|
|
8
8
|
import DynamicDimensionIcon from '../../../assets/DynamicDimensionIcon.js';
|
|
9
|
-
import { getPredefinedDimensionProp } from '../../../modules/predefinedDimensions.js';
|
|
10
|
-
import DimensionLabel from './DimensionLabel.js';
|
|
9
|
+
import { DIMENSION_PROP_NO_ITEMS, getPredefinedDimensionProp } from '../../../modules/predefinedDimensions.js';
|
|
11
10
|
import OptionsButton from './OptionsButton.js';
|
|
12
11
|
import RecommendedIcon from './RecommendedIcon.js';
|
|
13
12
|
import { styles } from './styles/DimensionItem.style.js';
|
|
@@ -78,16 +77,24 @@ class DimensionItem extends Component {
|
|
|
78
77
|
...styles.selected
|
|
79
78
|
} : styles.item;
|
|
80
79
|
const optionsRef = /*#__PURE__*/createRef();
|
|
80
|
+
|
|
81
|
+
const onLabelClick = () => {
|
|
82
|
+
if (!isDeactivated && !getPredefinedDimensionProp(id, DIMENSION_PROP_NO_ITEMS)) {
|
|
83
|
+
onClick(id);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
|
|
81
87
|
return /*#__PURE__*/React.createElement("li", _extends({
|
|
82
88
|
onMouseOver: this.onMouseOver,
|
|
83
89
|
onMouseLeave: this.onMouseExit,
|
|
84
90
|
ref: innerRef,
|
|
85
|
-
style: Object.assign({}, itemStyle, style),
|
|
86
|
-
"data-test": dataTest
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
style: Object.assign({}, itemStyle, style, !isDeactivated && styles.clickable),
|
|
92
|
+
"data-test": dataTest,
|
|
93
|
+
onClick: onLabelClick
|
|
94
|
+
}, rest), /*#__PURE__*/React.createElement("div", {
|
|
95
|
+
className: "label",
|
|
96
|
+
tabIndex: 0,
|
|
97
|
+
style: styles.label,
|
|
91
98
|
dataTest: "".concat(dataTest, "-button-").concat(id)
|
|
92
99
|
}, /*#__PURE__*/React.createElement("div", {
|
|
93
100
|
style: styles.iconWrapper
|
package/build/es/components/DimensionsPanel/List/__tests__/__snapshots__/DimensionItem.spec.js.snap
CHANGED
|
@@ -3,12 +3,14 @@
|
|
|
3
3
|
exports[`DimensionItem matches the snapshot 1`] = `
|
|
4
4
|
<li
|
|
5
5
|
name="Period"
|
|
6
|
+
onClick={[Function]}
|
|
6
7
|
onMouseLeave={[Function]}
|
|
7
8
|
onMouseOver={[Function]}
|
|
8
9
|
style={
|
|
9
10
|
Object {
|
|
10
11
|
"alignItems": "center",
|
|
11
12
|
"borderRadius": "2px",
|
|
13
|
+
"cursor": "pointer",
|
|
12
14
|
"display": "flex",
|
|
13
15
|
"marginBottom": 3,
|
|
14
16
|
"marginTop": 3,
|
|
@@ -16,11 +18,16 @@ exports[`DimensionItem matches the snapshot 1`] = `
|
|
|
16
18
|
}
|
|
17
19
|
}
|
|
18
20
|
>
|
|
19
|
-
<
|
|
21
|
+
<div
|
|
22
|
+
className="label"
|
|
20
23
|
dataTest="undefined-button-pe"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
+
style={
|
|
25
|
+
Object {
|
|
26
|
+
"display": "flex",
|
|
27
|
+
"outline": "none",
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
tabIndex={0}
|
|
24
31
|
>
|
|
25
32
|
<div
|
|
26
33
|
style={
|
|
@@ -52,7 +59,6 @@ exports[`DimensionItem matches the snapshot 1`] = `
|
|
|
52
59
|
style={
|
|
53
60
|
Object {
|
|
54
61
|
"color": "#212934",
|
|
55
|
-
"cursor": "pointer",
|
|
56
62
|
"fontSize": "14px",
|
|
57
63
|
"userSelect": "none",
|
|
58
64
|
"wordBreak": "break-word",
|
|
@@ -66,19 +72,21 @@ exports[`DimensionItem matches the snapshot 1`] = `
|
|
|
66
72
|
isRecommended={false}
|
|
67
73
|
/>
|
|
68
74
|
</div>
|
|
69
|
-
</
|
|
75
|
+
</div>
|
|
70
76
|
</li>
|
|
71
77
|
`;
|
|
72
78
|
|
|
73
79
|
exports[`DimensionItem matches the snapshot with locked 1`] = `
|
|
74
80
|
<li
|
|
75
81
|
name="Period"
|
|
82
|
+
onClick={[Function]}
|
|
76
83
|
onMouseLeave={[Function]}
|
|
77
84
|
onMouseOver={[Function]}
|
|
78
85
|
style={
|
|
79
86
|
Object {
|
|
80
87
|
"alignItems": "center",
|
|
81
88
|
"borderRadius": "2px",
|
|
89
|
+
"cursor": "pointer",
|
|
82
90
|
"display": "flex",
|
|
83
91
|
"marginBottom": 3,
|
|
84
92
|
"marginTop": 3,
|
|
@@ -86,11 +94,16 @@ exports[`DimensionItem matches the snapshot with locked 1`] = `
|
|
|
86
94
|
}
|
|
87
95
|
}
|
|
88
96
|
>
|
|
89
|
-
<
|
|
97
|
+
<div
|
|
98
|
+
className="label"
|
|
90
99
|
dataTest="undefined-button-pe"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
100
|
+
style={
|
|
101
|
+
Object {
|
|
102
|
+
"display": "flex",
|
|
103
|
+
"outline": "none",
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
tabIndex={0}
|
|
94
107
|
>
|
|
95
108
|
<div
|
|
96
109
|
style={
|
|
@@ -122,7 +135,6 @@ exports[`DimensionItem matches the snapshot with locked 1`] = `
|
|
|
122
135
|
style={
|
|
123
136
|
Object {
|
|
124
137
|
"color": "#212934",
|
|
125
|
-
"cursor": "pointer",
|
|
126
138
|
"fontSize": "14px",
|
|
127
139
|
"userSelect": "none",
|
|
128
140
|
"wordBreak": "break-word",
|
|
@@ -147,19 +159,21 @@ exports[`DimensionItem matches the snapshot with locked 1`] = `
|
|
|
147
159
|
>
|
|
148
160
|
<SvgLock16 />
|
|
149
161
|
</div>
|
|
150
|
-
</
|
|
162
|
+
</div>
|
|
151
163
|
</li>
|
|
152
164
|
`;
|
|
153
165
|
|
|
154
166
|
exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
|
|
155
167
|
<li
|
|
156
168
|
name="Period"
|
|
169
|
+
onClick={[Function]}
|
|
157
170
|
onMouseLeave={[Function]}
|
|
158
171
|
onMouseOver={[Function]}
|
|
159
172
|
style={
|
|
160
173
|
Object {
|
|
161
174
|
"alignItems": "center",
|
|
162
175
|
"borderRadius": "2px",
|
|
176
|
+
"cursor": "pointer",
|
|
163
177
|
"display": "flex",
|
|
164
178
|
"marginBottom": 3,
|
|
165
179
|
"marginTop": 3,
|
|
@@ -167,11 +181,16 @@ exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
|
|
|
167
181
|
}
|
|
168
182
|
}
|
|
169
183
|
>
|
|
170
|
-
<
|
|
184
|
+
<div
|
|
185
|
+
className="label"
|
|
171
186
|
dataTest="undefined-button-pe"
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
187
|
+
style={
|
|
188
|
+
Object {
|
|
189
|
+
"display": "flex",
|
|
190
|
+
"outline": "none",
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
tabIndex={0}
|
|
175
194
|
>
|
|
176
195
|
<div
|
|
177
196
|
style={
|
|
@@ -203,7 +222,6 @@ exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
|
|
|
203
222
|
style={
|
|
204
223
|
Object {
|
|
205
224
|
"color": "#212934",
|
|
206
|
-
"cursor": "pointer",
|
|
207
225
|
"fontSize": "14px",
|
|
208
226
|
"userSelect": "none",
|
|
209
227
|
"wordBreak": "break-word",
|
|
@@ -217,7 +235,7 @@ exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
|
|
|
217
235
|
isRecommended={false}
|
|
218
236
|
/>
|
|
219
237
|
</div>
|
|
220
|
-
</
|
|
238
|
+
</div>
|
|
221
239
|
<div
|
|
222
240
|
data-test="undefined-menu-pe"
|
|
223
241
|
style={
|
|
@@ -235,12 +253,14 @@ exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
|
|
|
235
253
|
exports[`DimensionItem matches the snapshot with recommended 1`] = `
|
|
236
254
|
<li
|
|
237
255
|
name="Period"
|
|
256
|
+
onClick={[Function]}
|
|
238
257
|
onMouseLeave={[Function]}
|
|
239
258
|
onMouseOver={[Function]}
|
|
240
259
|
style={
|
|
241
260
|
Object {
|
|
242
261
|
"alignItems": "center",
|
|
243
262
|
"borderRadius": "2px",
|
|
263
|
+
"cursor": "pointer",
|
|
244
264
|
"display": "flex",
|
|
245
265
|
"marginBottom": 3,
|
|
246
266
|
"marginTop": 3,
|
|
@@ -248,11 +268,16 @@ exports[`DimensionItem matches the snapshot with recommended 1`] = `
|
|
|
248
268
|
}
|
|
249
269
|
}
|
|
250
270
|
>
|
|
251
|
-
<
|
|
271
|
+
<div
|
|
272
|
+
className="label"
|
|
252
273
|
dataTest="undefined-button-pe"
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
274
|
+
style={
|
|
275
|
+
Object {
|
|
276
|
+
"display": "flex",
|
|
277
|
+
"outline": "none",
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
tabIndex={0}
|
|
256
281
|
>
|
|
257
282
|
<div
|
|
258
283
|
style={
|
|
@@ -284,7 +309,6 @@ exports[`DimensionItem matches the snapshot with recommended 1`] = `
|
|
|
284
309
|
style={
|
|
285
310
|
Object {
|
|
286
311
|
"color": "#212934",
|
|
287
|
-
"cursor": "pointer",
|
|
288
312
|
"fontSize": "14px",
|
|
289
313
|
"userSelect": "none",
|
|
290
314
|
"wordBreak": "break-word",
|
|
@@ -298,13 +322,14 @@ exports[`DimensionItem matches the snapshot with recommended 1`] = `
|
|
|
298
322
|
isRecommended={true}
|
|
299
323
|
/>
|
|
300
324
|
</div>
|
|
301
|
-
</
|
|
325
|
+
</div>
|
|
302
326
|
</li>
|
|
303
327
|
`;
|
|
304
328
|
|
|
305
329
|
exports[`DimensionItem matches the snapshot with selected 1`] = `
|
|
306
330
|
<li
|
|
307
331
|
name="Period"
|
|
332
|
+
onClick={[Function]}
|
|
308
333
|
onMouseLeave={[Function]}
|
|
309
334
|
onMouseOver={[Function]}
|
|
310
335
|
style={
|
|
@@ -312,6 +337,7 @@ exports[`DimensionItem matches the snapshot with selected 1`] = `
|
|
|
312
337
|
"alignItems": "center",
|
|
313
338
|
"backgroundColor": "#e0f2f1",
|
|
314
339
|
"borderRadius": "2px",
|
|
340
|
+
"cursor": "pointer",
|
|
315
341
|
"display": "flex",
|
|
316
342
|
"fontWeight": 500,
|
|
317
343
|
"marginBottom": 3,
|
|
@@ -320,11 +346,16 @@ exports[`DimensionItem matches the snapshot with selected 1`] = `
|
|
|
320
346
|
}
|
|
321
347
|
}
|
|
322
348
|
>
|
|
323
|
-
<
|
|
349
|
+
<div
|
|
350
|
+
className="label"
|
|
324
351
|
dataTest="undefined-button-pe"
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
352
|
+
style={
|
|
353
|
+
Object {
|
|
354
|
+
"display": "flex",
|
|
355
|
+
"outline": "none",
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
tabIndex={0}
|
|
328
359
|
>
|
|
329
360
|
<div
|
|
330
361
|
style={
|
|
@@ -356,7 +387,6 @@ exports[`DimensionItem matches the snapshot with selected 1`] = `
|
|
|
356
387
|
style={
|
|
357
388
|
Object {
|
|
358
389
|
"color": "#212934",
|
|
359
|
-
"cursor": "pointer",
|
|
360
390
|
"fontSize": "14px",
|
|
361
391
|
"userSelect": "none",
|
|
362
392
|
"wordBreak": "break-word",
|
|
@@ -370,6 +400,6 @@ exports[`DimensionItem matches the snapshot with selected 1`] = `
|
|
|
370
400
|
isRecommended={false}
|
|
371
401
|
/>
|
|
372
402
|
</div>
|
|
373
|
-
</
|
|
403
|
+
</div>
|
|
374
404
|
</li>
|
|
375
405
|
`;
|
|
@@ -6,7 +6,6 @@ export const styles = {
|
|
|
6
6
|
text: {
|
|
7
7
|
color: colors.grey900,
|
|
8
8
|
userSelect: 'none',
|
|
9
|
-
cursor: 'pointer',
|
|
10
9
|
wordBreak: 'break-word',
|
|
11
10
|
fontSize: '14px'
|
|
12
11
|
},
|
|
@@ -22,6 +21,9 @@ export const styles = {
|
|
|
22
21
|
alignItems: 'center',
|
|
23
22
|
borderRadius: '2px'
|
|
24
23
|
},
|
|
24
|
+
clickable: {
|
|
25
|
+
cursor: 'pointer'
|
|
26
|
+
},
|
|
25
27
|
selected: {
|
|
26
28
|
backgroundColor: theme.secondary100,
|
|
27
29
|
fontWeight: 500
|
|
@@ -56,5 +58,9 @@ export const styles = {
|
|
|
56
58
|
background: 'none',
|
|
57
59
|
outline: 'none',
|
|
58
60
|
cursor: 'pointer'
|
|
61
|
+
},
|
|
62
|
+
label: {
|
|
63
|
+
display: 'flex',
|
|
64
|
+
outline: 'none'
|
|
59
65
|
}
|
|
60
66
|
};
|
|
@@ -43,7 +43,25 @@ export const TranslationForm = _ref => {
|
|
|
43
43
|
value: translation
|
|
44
44
|
};
|
|
45
45
|
const translationIndex = getTranslationIndexForField(field);
|
|
46
|
-
|
|
46
|
+
|
|
47
|
+
if (translationIndex === -1) {
|
|
48
|
+
// non existing translation, adding new
|
|
49
|
+
setNewTranslations([...newTranslations, newTranslation]);
|
|
50
|
+
} else {
|
|
51
|
+
// cleared existing translation, remove it from the list
|
|
52
|
+
if (!translation) {
|
|
53
|
+
setNewTranslations(newTranslations.reduce((tmp, translation, index) => {
|
|
54
|
+
if (index !== translationIndex) {
|
|
55
|
+
tmp.push(translation);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return tmp;
|
|
59
|
+
}, []));
|
|
60
|
+
} // replace existing translation with new one
|
|
61
|
+
else {
|
|
62
|
+
setNewTranslations(newTranslations.map((translation, index) => index === translationIndex ? newTranslation : translation));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
47
65
|
};
|
|
48
66
|
|
|
49
67
|
const i18nMutationRef = useRef({
|
package/package.json
CHANGED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
|
-
var _predefinedDimensions = require("../../../modules/predefinedDimensions.js");
|
|
13
|
-
|
|
14
|
-
var _DimensionLabelStyle = require("./styles/DimensionLabel.style.js");
|
|
15
|
-
|
|
16
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
20
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
21
|
-
|
|
22
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
-
|
|
24
|
-
class DimensionLabel extends _react.Component {
|
|
25
|
-
constructor() {
|
|
26
|
-
super(...arguments);
|
|
27
|
-
|
|
28
|
-
_defineProperty(this, "onLabelClick", () => {
|
|
29
|
-
if (!this.props.isDeactivated && !(0, _predefinedDimensions.getPredefinedDimensionProp)(this.props.id, _predefinedDimensions.DIMENSION_PROP_NO_ITEMS)) {
|
|
30
|
-
this.props.onClick(this.props.id);
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
_defineProperty(this, "onKeyPress", event => {
|
|
35
|
-
if (event.key === 'Enter' && event.ctrlKey === false) {
|
|
36
|
-
this.onLabelClick();
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
render() {
|
|
42
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
43
|
-
"data-test": this.props.dataTest,
|
|
44
|
-
className: "label",
|
|
45
|
-
onClick: this.onLabelClick,
|
|
46
|
-
onKeyPress: this.onKeyPress,
|
|
47
|
-
tabIndex: 0,
|
|
48
|
-
style: _DimensionLabelStyle.styles.label
|
|
49
|
-
}, this.props.children);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
_defineProperty(DimensionLabel, "propTypes", {
|
|
55
|
-
id: _propTypes.default.string.isRequired,
|
|
56
|
-
isDeactivated: _propTypes.default.bool.isRequired,
|
|
57
|
-
onClick: _propTypes.default.func.isRequired,
|
|
58
|
-
children: _propTypes.default.array,
|
|
59
|
-
dataTest: _propTypes.default.string
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
var _default = DimensionLabel;
|
|
63
|
-
exports.default = _default;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
-
|
|
3
|
-
import PropTypes from 'prop-types';
|
|
4
|
-
import React, { Component } from 'react';
|
|
5
|
-
import { getPredefinedDimensionProp, DIMENSION_PROP_NO_ITEMS } from '../../../modules/predefinedDimensions.js';
|
|
6
|
-
import { styles } from './styles/DimensionLabel.style.js';
|
|
7
|
-
|
|
8
|
-
class DimensionLabel extends Component {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
|
|
12
|
-
_defineProperty(this, "onLabelClick", () => {
|
|
13
|
-
if (!this.props.isDeactivated && !getPredefinedDimensionProp(this.props.id, DIMENSION_PROP_NO_ITEMS)) {
|
|
14
|
-
this.props.onClick(this.props.id);
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
_defineProperty(this, "onKeyPress", event => {
|
|
19
|
-
if (event.key === 'Enter' && event.ctrlKey === false) {
|
|
20
|
-
this.onLabelClick();
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
render() {
|
|
26
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
27
|
-
"data-test": this.props.dataTest,
|
|
28
|
-
className: "label",
|
|
29
|
-
onClick: this.onLabelClick,
|
|
30
|
-
onKeyPress: this.onKeyPress,
|
|
31
|
-
tabIndex: 0,
|
|
32
|
-
style: styles.label
|
|
33
|
-
}, this.props.children);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
_defineProperty(DimensionLabel, "propTypes", {
|
|
39
|
-
id: PropTypes.string.isRequired,
|
|
40
|
-
isDeactivated: PropTypes.bool.isRequired,
|
|
41
|
-
onClick: PropTypes.func.isRequired,
|
|
42
|
-
children: PropTypes.array,
|
|
43
|
-
dataTest: PropTypes.string
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
export default DimensionLabel;
|