@dhis2/analytics 24.3.4 → 24.3.6

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.6](https://github.com/dhis2/analytics/compare/v24.3.5...v24.3.6) (2022-11-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **OpenFileDialog:** use case insensitive sorting on displayName (DHIS2-13554) ([#1384](https://github.com/dhis2/analytics/issues/1384)) ([e8348f7](https://github.com/dhis2/analytics/commit/e8348f7fe4b9a9d6349eddf9c86b11b5939564a2))
7
+
8
+ ## [24.3.5](https://github.com/dhis2/analytics/compare/v24.3.4...v24.3.5) (2022-11-17)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * avoid canceled request error ([#1379](https://github.com/dhis2/analytics/issues/1379)) ([6cbe4f4](https://github.com/dhis2/analytics/commit/6cbe4f4a1bae190a18c27a16d00b0a7e84ab95e9))
14
+
1
15
  ## [24.3.4](https://github.com/dhis2/analytics/compare/v24.3.3...v24.3.4) (2022-11-16)
2
16
 
3
17
 
@@ -101,7 +101,10 @@ const FileMenu = _ref => {
101
101
  objectToTranslate: fileObject,
102
102
  fieldsToTranslate: ['name', 'description'],
103
103
  onClose: onDialogClose,
104
- onTranslationSaved: onTranslate
104
+ onTranslationSaved: () => {
105
+ onDialogClose();
106
+ onTranslate();
107
+ }
105
108
  });
106
109
 
107
110
  case 'sharing':
@@ -168,7 +171,7 @@ const FileMenu = _ref => {
168
171
  onNew: onNew,
169
172
  currentUser: currentUser
170
173
  }), menuIsOpen && /*#__PURE__*/_react.default.createElement(_ui.Layer, {
171
- onClick: toggleMenu,
174
+ onBackdropClick: toggleMenu,
172
175
  position: "fixed",
173
176
  level: 2000,
174
177
  dataTest: "file-menu-toggle-layer"
@@ -47,7 +47,7 @@ const getQuery = type => ({
47
47
  params: _ref => {
48
48
  let {
49
49
  sortField = 'displayName',
50
- sortDirection = 'asc',
50
+ sortDirection = 'iasc',
51
51
  page = 1,
52
52
  filters
53
53
  } = _ref;
@@ -138,6 +138,13 @@ const OpenFileDialog = _ref2 => {
138
138
 
139
139
  return queryFilters;
140
140
  }, [currentUser, filters]);
141
+ const formatSortDirection = (0, _react.useCallback)(() => {
142
+ if (sortField === 'displayName' && sortDirection !== 'default') {
143
+ return "i".concat(sortDirection);
144
+ }
145
+
146
+ return sortDirection;
147
+ }, [sortField, sortDirection]);
141
148
  const {
142
149
  loading,
143
150
  error,
@@ -177,11 +184,11 @@ const OpenFileDialog = _ref2 => {
177
184
  refetch({
178
185
  page,
179
186
  sortField,
180
- sortDirection,
187
+ sortDirection: formatSortDirection(),
181
188
  filters: formatFilters()
182
189
  });
183
190
  }
184
- }, [open, page, sortField, sortDirection, filters, refetch, formatFilters]);
191
+ }, [open, page, sortField, filters, refetch, formatFilters, formatSortDirection]);
185
192
  const headers = [{
186
193
  field: 'displayName',
187
194
  label: _d2I18n.default.t('Name'),
@@ -92,7 +92,6 @@ const TranslationForm = _ref => {
92
92
  }] = (0, _appRuntime.useDataMutation)(translationsMutationRef.current, {
93
93
  onComplete: () => {
94
94
  onTranslationSaved();
95
- onClose();
96
95
  },
97
96
  onError: error => showError(error)
98
97
  });
@@ -75,7 +75,10 @@ export const FileMenu = _ref => {
75
75
  objectToTranslate: fileObject,
76
76
  fieldsToTranslate: ['name', 'description'],
77
77
  onClose: onDialogClose,
78
- onTranslationSaved: onTranslate
78
+ onTranslationSaved: () => {
79
+ onDialogClose();
80
+ onTranslate();
81
+ }
79
82
  });
80
83
 
81
84
  case 'sharing':
@@ -142,7 +145,7 @@ export const FileMenu = _ref => {
142
145
  onNew: onNew,
143
146
  currentUser: currentUser
144
147
  }), menuIsOpen && /*#__PURE__*/React.createElement(Layer, {
145
- onClick: toggleMenu,
148
+ onBackdropClick: toggleMenu,
146
149
  position: "fixed",
147
150
  level: 2000,
148
151
  dataTest: "file-menu-toggle-layer"
@@ -20,7 +20,7 @@ const getQuery = type => ({
20
20
  params: _ref => {
21
21
  let {
22
22
  sortField = 'displayName',
23
- sortDirection = 'asc',
23
+ sortDirection = 'iasc',
24
24
  page = 1,
25
25
  filters
26
26
  } = _ref;
@@ -111,6 +111,13 @@ export const OpenFileDialog = _ref2 => {
111
111
 
112
112
  return queryFilters;
113
113
  }, [currentUser, filters]);
114
+ const formatSortDirection = useCallback(() => {
115
+ if (sortField === 'displayName' && sortDirection !== 'default') {
116
+ return "i".concat(sortDirection);
117
+ }
118
+
119
+ return sortDirection;
120
+ }, [sortField, sortDirection]);
114
121
  const {
115
122
  loading,
116
123
  error,
@@ -150,11 +157,11 @@ export const OpenFileDialog = _ref2 => {
150
157
  refetch({
151
158
  page,
152
159
  sortField,
153
- sortDirection,
160
+ sortDirection: formatSortDirection(),
154
161
  filters: formatFilters()
155
162
  });
156
163
  }
157
- }, [open, page, sortField, sortDirection, filters, refetch, formatFilters]);
164
+ }, [open, page, sortField, filters, refetch, formatFilters, formatSortDirection]);
158
165
  const headers = [{
159
166
  field: 'displayName',
160
167
  label: i18n.t('Name'),
@@ -72,7 +72,6 @@ export const TranslationForm = _ref => {
72
72
  }] = useDataMutation(translationsMutationRef.current, {
73
73
  onComplete: () => {
74
74
  onTranslationSaved();
75
- onClose();
76
75
  },
77
76
  onError: error => showError(error)
78
77
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2/analytics",
3
- "version": "24.3.4",
3
+ "version": "24.3.6",
4
4
  "main": "./build/cjs/index.js",
5
5
  "module": "./build/es/index.js",
6
6
  "exports": {