@dhis2/analytics 24.3.10 → 24.3.12

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [24.3.12](https://github.com/dhis2/analytics/compare/v24.3.11...v24.3.12) (2022-12-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * typo in dataTest ([#1404](https://github.com/dhis2/analytics/issues/1404)) ([55a94ca](https://github.com/dhis2/analytics/commit/55a94cabbb11e5ed91f59c55ebee3053f83e7fa7))
7
+
8
+ ## [24.3.11](https://github.com/dhis2/analytics/compare/v24.3.10...v24.3.11) (2022-12-21)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * 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))
14
+
1
15
  ## [24.3.10](https://github.com/dhis2/analytics/compare/v24.3.9...v24.3.10) (2022-12-02)
2
16
 
3
17
 
@@ -115,7 +115,7 @@ class DimensionItem extends _react.Component {
115
115
  className: "label",
116
116
  tabIndex: 0,
117
117
  style: _DimensionItemStyle.styles.label,
118
- dataTest: "".concat(dataTest, "-button-").concat(id)
118
+ "data-test": "".concat(dataTest, "-button-").concat(id)
119
119
  }, /*#__PURE__*/_react.default.createElement("div", {
120
120
  style: _DimensionItemStyle.styles.iconWrapper
121
121
  }, Icon), /*#__PURE__*/_react.default.createElement("div", {
@@ -20,7 +20,7 @@ exports[`DimensionItem matches the snapshot 1`] = `
20
20
  >
21
21
  <div
22
22
  className="label"
23
- dataTest="undefined-button-pe"
23
+ data-test="undefined-button-pe"
24
24
  style={
25
25
  Object {
26
26
  "display": "flex",
@@ -96,7 +96,7 @@ exports[`DimensionItem matches the snapshot with locked 1`] = `
96
96
  >
97
97
  <div
98
98
  className="label"
99
- dataTest="undefined-button-pe"
99
+ data-test="undefined-button-pe"
100
100
  style={
101
101
  Object {
102
102
  "display": "flex",
@@ -183,7 +183,7 @@ exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
183
183
  >
184
184
  <div
185
185
  className="label"
186
- dataTest="undefined-button-pe"
186
+ data-test="undefined-button-pe"
187
187
  style={
188
188
  Object {
189
189
  "display": "flex",
@@ -270,7 +270,7 @@ exports[`DimensionItem matches the snapshot with recommended 1`] = `
270
270
  >
271
271
  <div
272
272
  className="label"
273
- dataTest="undefined-button-pe"
273
+ data-test="undefined-button-pe"
274
274
  style={
275
275
  Object {
276
276
  "display": "flex",
@@ -348,7 +348,7 @@ exports[`DimensionItem matches the snapshot with selected 1`] = `
348
348
  >
349
349
  <div
350
350
  className="label"
351
- dataTest="undefined-button-pe"
351
+ data-test="undefined-button-pe"
352
352
  style={
353
353
  Object {
354
354
  "display": "flex",
@@ -63,7 +63,25 @@ const TranslationForm = _ref => {
63
63
  value: translation
64
64
  };
65
65
  const translationIndex = getTranslationIndexForField(field);
66
- setNewTranslations(translationIndex === -1 ? [...newTranslations, newTranslation] : newTranslations.map((translation, index) => index === translationIndex ? newTranslation : translation));
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)({
@@ -95,7 +95,7 @@ class DimensionItem extends Component {
95
95
  className: "label",
96
96
  tabIndex: 0,
97
97
  style: styles.label,
98
- dataTest: "".concat(dataTest, "-button-").concat(id)
98
+ "data-test": "".concat(dataTest, "-button-").concat(id)
99
99
  }, /*#__PURE__*/React.createElement("div", {
100
100
  style: styles.iconWrapper
101
101
  }, Icon), /*#__PURE__*/React.createElement("div", {
@@ -20,7 +20,7 @@ exports[`DimensionItem matches the snapshot 1`] = `
20
20
  >
21
21
  <div
22
22
  className="label"
23
- dataTest="undefined-button-pe"
23
+ data-test="undefined-button-pe"
24
24
  style={
25
25
  Object {
26
26
  "display": "flex",
@@ -96,7 +96,7 @@ exports[`DimensionItem matches the snapshot with locked 1`] = `
96
96
  >
97
97
  <div
98
98
  className="label"
99
- dataTest="undefined-button-pe"
99
+ data-test="undefined-button-pe"
100
100
  style={
101
101
  Object {
102
102
  "display": "flex",
@@ -183,7 +183,7 @@ exports[`DimensionItem matches the snapshot with onOptionsClick 1`] = `
183
183
  >
184
184
  <div
185
185
  className="label"
186
- dataTest="undefined-button-pe"
186
+ data-test="undefined-button-pe"
187
187
  style={
188
188
  Object {
189
189
  "display": "flex",
@@ -270,7 +270,7 @@ exports[`DimensionItem matches the snapshot with recommended 1`] = `
270
270
  >
271
271
  <div
272
272
  className="label"
273
- dataTest="undefined-button-pe"
273
+ data-test="undefined-button-pe"
274
274
  style={
275
275
  Object {
276
276
  "display": "flex",
@@ -348,7 +348,7 @@ exports[`DimensionItem matches the snapshot with selected 1`] = `
348
348
  >
349
349
  <div
350
350
  className="label"
351
- dataTest="undefined-button-pe"
351
+ data-test="undefined-button-pe"
352
352
  style={
353
353
  Object {
354
354
  "display": "flex",
@@ -43,7 +43,25 @@ export const TranslationForm = _ref => {
43
43
  value: translation
44
44
  };
45
45
  const translationIndex = getTranslationIndexForField(field);
46
- setNewTranslations(translationIndex === -1 ? [...newTranslations, newTranslation] : newTranslations.map((translation, index) => index === translationIndex ? newTranslation : translation));
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "24.3.10",
3
+ "version": "24.3.12",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {