@dhis2-ui/organisation-unit-tree 8.1.10 → 8.2.1
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/__e2e__/children_as_child_nodes.stories.e2e.js +11 -8
- package/build/cjs/__e2e__/common.js +53 -43
- package/build/cjs/__e2e__/controlled_expanded.stories.e2e.js +10 -7
- package/build/cjs/__e2e__/displaying_loading_error.stories.e2e.js +5 -1
- package/build/cjs/__e2e__/expanded.stories.e2e.js +35 -26
- package/build/cjs/__e2e__/force_reload.stories.e2e.js +21 -14
- package/build/cjs/__e2e__/highlight.stories.e2e.js +10 -7
- package/build/cjs/__e2e__/loading_state.stories.e2e.js +14 -7
- package/build/cjs/__e2e__/multi_selection.stories.e2e.js +11 -8
- package/build/cjs/__e2e__/no_selection.stories.e2e.js +21 -15
- package/build/cjs/__e2e__/path_based_filtering.stories.e2e.js +23 -17
- package/build/cjs/__e2e__/single_selection.stories.e2e.js +17 -10
- package/build/cjs/__e2e__/sub_unit_as_root.stories.e2e.js +6 -5
- package/build/cjs/__e2e__/tree_api.stories.e2e.js +22 -15
- package/build/cjs/__stories__/custom-expanded-imperative-open.js +9 -6
- package/build/cjs/__stories__/custom-node-label.js +6 -4
- package/build/cjs/__stories__/development-stories.js +7 -6
- package/build/cjs/__stories__/loading-error-grandchild.js +5 -1
- package/build/cjs/__stories__/loading.js +5 -1
- package/build/cjs/__stories__/multiple-roots.js +12 -9
- package/build/cjs/__stories__/root-error.js +5 -1
- package/build/cjs/__stories__/root-loading.js +5 -1
- package/build/cjs/__stories__/shared.js +82 -45
- package/build/cjs/features/controlled_expanded/index.js +8 -5
- package/build/cjs/features/expanded/index.js +1 -7
- package/build/cjs/features/path_based_filtering/index.js +2 -2
- package/build/cjs/features/sub_unit_as_root/index.js +1 -7
- package/build/cjs/get-all-expanded-paths/get-all-expanded-paths.js +1 -1
- package/build/cjs/helpers/is-path-included.js +1 -1
- package/build/cjs/helpers/left-trim-to-root-id.js +1 -1
- package/build/cjs/organisation-unit-node/compute-child-nodes.js +1 -1
- package/build/cjs/organisation-unit-node/error-message.js +13 -10
- package/build/cjs/organisation-unit-node/has-descendant-selected-paths.js +1 -1
- package/build/cjs/organisation-unit-node/label/disabled-selection-label.js +12 -9
- package/build/cjs/organisation-unit-node/label/icon-empty.js +22 -19
- package/build/cjs/organisation-unit-node/label/icon-folder-closed.js +28 -25
- package/build/cjs/organisation-unit-node/label/icon-folder-open.js +37 -34
- package/build/cjs/organisation-unit-node/label/icon-single.js +31 -28
- package/build/cjs/organisation-unit-node/label/icon.js +8 -6
- package/build/cjs/organisation-unit-node/label/iconized-checkbox.js +14 -12
- package/build/cjs/organisation-unit-node/label/label-container.js +16 -13
- package/build/cjs/organisation-unit-node/label/label.js +31 -27
- package/build/cjs/organisation-unit-node/label/single-selection-label.js +21 -18
- package/build/cjs/organisation-unit-node/organisation-unit-node-children.js +32 -29
- package/build/cjs/organisation-unit-node/organisation-unit-node.js +26 -25
- package/build/cjs/organisation-unit-node/use-open-state.js +9 -8
- package/build/cjs/organisation-unit-node/use-org-children.js +13 -9
- package/build/cjs/organisation-unit-node/use-org-children.test.js +69 -46
- package/build/cjs/organisation-unit-node/use-org-data/use-org-data.js +22 -14
- package/build/cjs/organisation-unit-node/use-org-data/use-org-data.test.js +30 -18
- package/build/cjs/organisation-unit-tree/default-render-node-label/default-render-node-label.js +6 -3
- package/build/cjs/organisation-unit-tree/filter-root-ids.js +1 -1
- package/build/cjs/organisation-unit-tree/organisation-unit-tree.js +23 -22
- package/build/cjs/organisation-unit-tree/root-error.js +12 -9
- package/build/cjs/organisation-unit-tree/root-loading.js +13 -10
- package/build/cjs/organisation-unit-tree/use-expanded/create-expand-handlers.js +19 -14
- package/build/cjs/organisation-unit-tree/use-expanded/use-expanded.js +9 -8
- package/build/cjs/organisation-unit-tree/use-root-org-data/patch-missing-display-name.js +2 -1
- package/build/cjs/organisation-unit-tree/use-root-org-data/use-root-org-data.js +14 -10
- package/build/cjs/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +37 -20
- package/build/cjs/organisation-unit-tree.stories.js +32 -57
- package/build/cjs/prop-types.js +5 -5
- package/build/es/__e2e__/children_as_child_nodes.stories.e2e.js +11 -8
- package/build/es/__e2e__/common.js +52 -42
- package/build/es/__e2e__/controlled_expanded.stories.e2e.js +9 -6
- package/build/es/__e2e__/displaying_loading_error.stories.e2e.js +5 -1
- package/build/es/__e2e__/expanded.stories.e2e.js +34 -25
- package/build/es/__e2e__/force_reload.stories.e2e.js +21 -14
- package/build/es/__e2e__/highlight.stories.e2e.js +10 -7
- package/build/es/__e2e__/loading_state.stories.e2e.js +14 -7
- package/build/es/__e2e__/multi_selection.stories.e2e.js +11 -8
- package/build/es/__e2e__/no_selection.stories.e2e.js +21 -15
- package/build/es/__e2e__/path_based_filtering.stories.e2e.js +23 -17
- package/build/es/__e2e__/single_selection.stories.e2e.js +17 -10
- package/build/es/__e2e__/sub_unit_as_root.stories.e2e.js +5 -4
- package/build/es/__e2e__/tree_api.stories.e2e.js +22 -15
- package/build/es/__stories__/custom-expanded-imperative-open.js +9 -6
- package/build/es/__stories__/custom-node-label.js +6 -4
- package/build/es/__stories__/development-stories.js +6 -5
- package/build/es/__stories__/loading-error-grandchild.js +5 -1
- package/build/es/__stories__/loading.js +5 -1
- package/build/es/__stories__/multiple-roots.js +12 -9
- package/build/es/__stories__/root-error.js +5 -1
- package/build/es/__stories__/root-loading.js +5 -1
- package/build/es/__stories__/shared.js +82 -45
- package/build/es/features/controlled_expanded/index.js +8 -5
- package/build/es/features/expanded/index.js +1 -7
- package/build/es/features/path_based_filtering/index.js +2 -2
- package/build/es/features/sub_unit_as_root/index.js +1 -7
- package/build/es/get-all-expanded-paths/get-all-expanded-paths.js +1 -1
- package/build/es/helpers/is-path-included.js +1 -1
- package/build/es/helpers/left-trim-to-root-id.js +1 -1
- package/build/es/organisation-unit-node/compute-child-nodes.js +1 -1
- package/build/es/organisation-unit-node/error-message.js +13 -10
- package/build/es/organisation-unit-node/has-descendant-selected-paths.js +1 -1
- package/build/es/organisation-unit-node/label/disabled-selection-label.js +12 -9
- package/build/es/organisation-unit-node/label/icon-empty.js +22 -19
- package/build/es/organisation-unit-node/label/icon-folder-closed.js +28 -25
- package/build/es/organisation-unit-node/label/icon-folder-open.js +37 -34
- package/build/es/organisation-unit-node/label/icon-single.js +31 -28
- package/build/es/organisation-unit-node/label/icon.js +8 -6
- package/build/es/organisation-unit-node/label/iconized-checkbox.js +13 -12
- package/build/es/organisation-unit-node/label/label-container.js +16 -13
- package/build/es/organisation-unit-node/label/label.js +31 -27
- package/build/es/organisation-unit-node/label/single-selection-label.js +21 -18
- package/build/es/organisation-unit-node/organisation-unit-node-children.js +32 -29
- package/build/es/organisation-unit-node/organisation-unit-node.js +26 -25
- package/build/es/organisation-unit-node/use-open-state.js +9 -8
- package/build/es/organisation-unit-node/use-org-children.js +13 -9
- package/build/es/organisation-unit-node/use-org-children.test.js +69 -46
- package/build/es/organisation-unit-node/use-org-data/use-org-data.js +22 -14
- package/build/es/organisation-unit-node/use-org-data/use-org-data.test.js +30 -18
- package/build/es/organisation-unit-tree/default-render-node-label/default-render-node-label.js +6 -3
- package/build/es/organisation-unit-tree/filter-root-ids.js +1 -1
- package/build/es/organisation-unit-tree/organisation-unit-tree.js +23 -22
- package/build/es/organisation-unit-tree/root-error.js +12 -9
- package/build/es/organisation-unit-tree/root-loading.js +13 -10
- package/build/es/organisation-unit-tree/use-expanded/create-expand-handlers.js +19 -14
- package/build/es/organisation-unit-tree/use-expanded/use-expanded.js +9 -8
- package/build/es/organisation-unit-tree/use-root-org-data/patch-missing-display-name.js +2 -1
- package/build/es/organisation-unit-tree/use-root-org-data/use-root-org-data.js +14 -10
- package/build/es/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +37 -20
- package/build/es/organisation-unit-tree.stories.js +2 -27
- package/build/es/prop-types.js +4 -4
- package/package.json +5 -5
|
@@ -12,9 +12,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
12
12
|
|
|
13
13
|
describe('OrganisationUnitTree - useOrgChildren', () => {
|
|
14
14
|
const dataProviderData = {
|
|
15
|
-
organisationUnits: jest.fn((type, {
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
organisationUnits: jest.fn((type, _ref) => {
|
|
16
|
+
let {
|
|
17
|
+
id
|
|
18
|
+
} = _ref;
|
|
19
|
+
|
|
18
20
|
if (id === 'A0000000000') {
|
|
19
21
|
return {
|
|
20
22
|
children: [{
|
|
@@ -26,15 +28,18 @@ describe('OrganisationUnitTree - useOrgChildren', () => {
|
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
30
|
|
|
29
|
-
return Promise.reject(
|
|
31
|
+
return Promise.reject("No org unit with id \"".concat(id, "\""));
|
|
30
32
|
})
|
|
31
33
|
};
|
|
32
34
|
|
|
33
|
-
const wrapper =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
const wrapper = _ref2 => {
|
|
36
|
+
let {
|
|
37
|
+
children
|
|
38
|
+
} = _ref2;
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
40
|
+
data: dataProviderData
|
|
41
|
+
}, children);
|
|
42
|
+
};
|
|
38
43
|
|
|
39
44
|
const node = {
|
|
40
45
|
id: 'A0000000000',
|
|
@@ -85,15 +90,18 @@ describe('OrganisationUnitTree - useOrgChildren', () => {
|
|
|
85
90
|
});
|
|
86
91
|
});
|
|
87
92
|
it('should provide the error', async () => {
|
|
88
|
-
const errorWrapper =
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
const errorWrapper = _ref3 => {
|
|
94
|
+
let {
|
|
95
|
+
children
|
|
96
|
+
} = _ref3;
|
|
97
|
+
return /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
98
|
+
data: {
|
|
99
|
+
organisationUnits: async () => {
|
|
100
|
+
throw new Error('Error message');
|
|
101
|
+
}
|
|
94
102
|
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
103
|
+
}, children);
|
|
104
|
+
};
|
|
97
105
|
|
|
98
106
|
const {
|
|
99
107
|
result,
|
|
@@ -137,9 +145,11 @@ describe('OrganisationUnitTree - useOrgChildren', () => {
|
|
|
137
145
|
});
|
|
138
146
|
it("should sort the node's children alphabetically by default", async () => {
|
|
139
147
|
const dataProviderDataWithUnsortedChildren = {
|
|
140
|
-
organisationUnits: jest.fn((type, {
|
|
141
|
-
|
|
142
|
-
|
|
148
|
+
organisationUnits: jest.fn((type, _ref4) => {
|
|
149
|
+
let {
|
|
150
|
+
id
|
|
151
|
+
} = _ref4;
|
|
152
|
+
|
|
143
153
|
if (id === 'A0000000000') {
|
|
144
154
|
return {
|
|
145
155
|
children: [{
|
|
@@ -156,15 +166,18 @@ describe('OrganisationUnitTree - useOrgChildren', () => {
|
|
|
156
166
|
};
|
|
157
167
|
}
|
|
158
168
|
|
|
159
|
-
return Promise.reject(
|
|
169
|
+
return Promise.reject("No org unit with id \"".concat(id, "\""));
|
|
160
170
|
})
|
|
161
171
|
};
|
|
162
172
|
|
|
163
|
-
const wrapperWithUnsortedChildren =
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
173
|
+
const wrapperWithUnsortedChildren = _ref5 => {
|
|
174
|
+
let {
|
|
175
|
+
children
|
|
176
|
+
} = _ref5;
|
|
177
|
+
return /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
178
|
+
data: dataProviderDataWithUnsortedChildren
|
|
179
|
+
}, children);
|
|
180
|
+
};
|
|
168
181
|
|
|
169
182
|
const {
|
|
170
183
|
result,
|
|
@@ -194,11 +207,13 @@ describe('OrganisationUnitTree - useOrgChildren', () => {
|
|
|
194
207
|
}]
|
|
195
208
|
});
|
|
196
209
|
});
|
|
197
|
-
it(
|
|
210
|
+
it("should not sort the node's children alphabetically when \"suppressAlphabeticalSorting\" is true", async () => {
|
|
198
211
|
const dataProviderDataWithUnsortedChildren = {
|
|
199
|
-
organisationUnits: jest.fn((type, {
|
|
200
|
-
|
|
201
|
-
|
|
212
|
+
organisationUnits: jest.fn((type, _ref6) => {
|
|
213
|
+
let {
|
|
214
|
+
id
|
|
215
|
+
} = _ref6;
|
|
216
|
+
|
|
202
217
|
if (id === 'A0000000000') {
|
|
203
218
|
return {
|
|
204
219
|
children: [{
|
|
@@ -215,15 +230,18 @@ describe('OrganisationUnitTree - useOrgChildren', () => {
|
|
|
215
230
|
};
|
|
216
231
|
}
|
|
217
232
|
|
|
218
|
-
return Promise.reject(
|
|
233
|
+
return Promise.reject("No org unit with id \"".concat(id, "\""));
|
|
219
234
|
})
|
|
220
235
|
};
|
|
221
236
|
|
|
222
|
-
const wrapperWithUnsortedChildren =
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
237
|
+
const wrapperWithUnsortedChildren = _ref7 => {
|
|
238
|
+
let {
|
|
239
|
+
children
|
|
240
|
+
} = _ref7;
|
|
241
|
+
return /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
242
|
+
data: dataProviderDataWithUnsortedChildren
|
|
243
|
+
}, children);
|
|
244
|
+
};
|
|
227
245
|
|
|
228
246
|
const options = {
|
|
229
247
|
node: { ...node,
|
|
@@ -255,11 +273,13 @@ describe('OrganisationUnitTree - useOrgChildren', () => {
|
|
|
255
273
|
}]
|
|
256
274
|
});
|
|
257
275
|
});
|
|
258
|
-
it(
|
|
276
|
+
it("should not sort the node's children alphabetically when \"suppressAlphabeticalSorting\" is true", async () => {
|
|
259
277
|
const dataProviderDataWithUnsortedChildren = {
|
|
260
|
-
organisationUnits: jest.fn((type, {
|
|
261
|
-
|
|
262
|
-
|
|
278
|
+
organisationUnits: jest.fn((type, _ref8) => {
|
|
279
|
+
let {
|
|
280
|
+
id
|
|
281
|
+
} = _ref8;
|
|
282
|
+
|
|
263
283
|
if (id === 'A0000000000') {
|
|
264
284
|
return {
|
|
265
285
|
children: [{
|
|
@@ -276,15 +296,18 @@ describe('OrganisationUnitTree - useOrgChildren', () => {
|
|
|
276
296
|
};
|
|
277
297
|
}
|
|
278
298
|
|
|
279
|
-
return Promise.reject(
|
|
299
|
+
return Promise.reject("No org unit with id \"".concat(id, "\""));
|
|
280
300
|
})
|
|
281
301
|
};
|
|
282
302
|
|
|
283
|
-
const wrapperWithUnsortedChildren =
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
303
|
+
const wrapperWithUnsortedChildren = _ref9 => {
|
|
304
|
+
let {
|
|
305
|
+
children
|
|
306
|
+
} = _ref9;
|
|
307
|
+
return /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
308
|
+
data: dataProviderDataWithUnsortedChildren
|
|
309
|
+
}, children);
|
|
310
|
+
};
|
|
288
311
|
|
|
289
312
|
const options = {
|
|
290
313
|
node: { ...node,
|
|
@@ -9,16 +9,22 @@ var _appRuntime = require("@dhis2/app-runtime");
|
|
|
9
9
|
|
|
10
10
|
const ORG_DATA_QUERY = {
|
|
11
11
|
orgUnit: {
|
|
12
|
-
resource:
|
|
13
|
-
id:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
resource: "organisationUnits",
|
|
13
|
+
id: _ref => {
|
|
14
|
+
let {
|
|
15
|
+
id
|
|
16
|
+
} = _ref;
|
|
17
|
+
return id;
|
|
18
|
+
},
|
|
19
|
+
params: _ref2 => {
|
|
20
|
+
let {
|
|
21
|
+
isUserDataViewFallback
|
|
22
|
+
} = _ref2;
|
|
23
|
+
return {
|
|
24
|
+
isUserDataViewFallback,
|
|
25
|
+
fields: ['path', 'children::size']
|
|
26
|
+
};
|
|
27
|
+
}
|
|
22
28
|
}
|
|
23
29
|
};
|
|
24
30
|
/**
|
|
@@ -29,10 +35,12 @@ const ORG_DATA_QUERY = {
|
|
|
29
35
|
* @returns {Object}
|
|
30
36
|
*/
|
|
31
37
|
|
|
32
|
-
const useOrgData = (id, {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
38
|
+
const useOrgData = (id, _ref3) => {
|
|
39
|
+
let {
|
|
40
|
+
displayName,
|
|
41
|
+
isUserDataViewFallback
|
|
42
|
+
} = _ref3;
|
|
43
|
+
|
|
36
44
|
if (!displayName) {
|
|
37
45
|
throw new Error('"displayName" is required');
|
|
38
46
|
}
|
|
@@ -13,7 +13,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
13
13
|
describe('OrganisationUnitTree - useOrgData', () => {
|
|
14
14
|
// @TODO: Figure out why this is necessary at all...
|
|
15
15
|
const origError = console.error;
|
|
16
|
-
jest.spyOn(console, 'error').mockImplementation((
|
|
16
|
+
jest.spyOn(console, 'error').mockImplementation(function () {
|
|
17
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
|
+
args[_key] = arguments[_key];
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
const [err] = args;
|
|
18
22
|
|
|
19
23
|
if (!err.toString().match(/^Warning: An update to/)) {
|
|
@@ -24,9 +28,11 @@ describe('OrganisationUnitTree - useOrgData', () => {
|
|
|
24
28
|
console.error.mockRestore();
|
|
25
29
|
});
|
|
26
30
|
const dataProviderData = {
|
|
27
|
-
organisationUnits: jest.fn((type, {
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
organisationUnits: jest.fn((type, _ref) => {
|
|
32
|
+
let {
|
|
33
|
+
id
|
|
34
|
+
} = _ref;
|
|
35
|
+
|
|
30
36
|
if (id === 'A0000000000') {
|
|
31
37
|
return {
|
|
32
38
|
id: 'A0000000000',
|
|
@@ -35,15 +41,18 @@ describe('OrganisationUnitTree - useOrgData', () => {
|
|
|
35
41
|
};
|
|
36
42
|
}
|
|
37
43
|
|
|
38
|
-
return Promise.reject(
|
|
44
|
+
return Promise.reject("No org unit with id \"".concat(id, "\""));
|
|
39
45
|
})
|
|
40
46
|
};
|
|
41
47
|
|
|
42
|
-
const wrapper =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
const wrapper = _ref2 => {
|
|
49
|
+
let {
|
|
50
|
+
children
|
|
51
|
+
} = _ref2;
|
|
52
|
+
return /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
53
|
+
data: dataProviderData
|
|
54
|
+
}, children);
|
|
55
|
+
};
|
|
47
56
|
|
|
48
57
|
it('should respond with `loading: true`, `error: null` and `data: { displayName, id }` initially', () => {
|
|
49
58
|
const {
|
|
@@ -83,15 +92,18 @@ describe('OrganisationUnitTree - useOrgData', () => {
|
|
|
83
92
|
});
|
|
84
93
|
});
|
|
85
94
|
it('should provide the error', async () => {
|
|
86
|
-
const errorWrapper =
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
95
|
+
const errorWrapper = _ref3 => {
|
|
96
|
+
let {
|
|
97
|
+
children
|
|
98
|
+
} = _ref3;
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
100
|
+
data: {
|
|
101
|
+
organisationUnits: async () => {
|
|
102
|
+
throw new Error('Error message');
|
|
103
|
+
}
|
|
92
104
|
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
105
|
+
}, children);
|
|
106
|
+
};
|
|
95
107
|
|
|
96
108
|
const {
|
|
97
109
|
result,
|
package/build/cjs/organisation-unit-tree/default-render-node-label/default-render-node-label.js
CHANGED
|
@@ -5,8 +5,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.defaultRenderNodeLabel = void 0;
|
|
7
7
|
|
|
8
|
-
const defaultRenderNodeLabel =
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const defaultRenderNodeLabel = _ref => {
|
|
9
|
+
let {
|
|
10
|
+
label
|
|
11
|
+
} = _ref;
|
|
12
|
+
return label;
|
|
13
|
+
};
|
|
11
14
|
|
|
12
15
|
exports.defaultRenderNodeLabel = defaultRenderNodeLabel;
|
|
@@ -12,7 +12,7 @@ const filterRootIds = (filter, rootIds) => {
|
|
|
12
12
|
return rootIds;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
return rootIds.filter(rootId => (0, _index.isPathIncluded)(filter,
|
|
15
|
+
return rootIds.filter(rootId => (0, _index.isPathIncluded)(filter, "/".concat(rootId)));
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
exports.filterRootIds = filterRootIds;
|
|
@@ -35,28 +35,29 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
35
35
|
|
|
36
36
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
37
|
|
|
38
|
-
const OrganisationUnitTree =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
38
|
+
const OrganisationUnitTree = _ref => {
|
|
39
|
+
let {
|
|
40
|
+
onChange,
|
|
41
|
+
roots,
|
|
42
|
+
autoExpandLoadingError,
|
|
43
|
+
dataTest,
|
|
44
|
+
disableSelection,
|
|
45
|
+
forceReload,
|
|
46
|
+
highlighted,
|
|
47
|
+
isUserDataViewFallback,
|
|
48
|
+
initiallyExpanded,
|
|
49
|
+
filter,
|
|
50
|
+
renderNodeLabel,
|
|
51
|
+
selected,
|
|
52
|
+
singleSelection,
|
|
53
|
+
suppressAlphabeticalSorting,
|
|
54
|
+
expanded: expandedControlled,
|
|
55
|
+
handleExpand: handleExpandControlled,
|
|
56
|
+
handleCollapse: handleCollapseControlled,
|
|
57
|
+
onExpand,
|
|
58
|
+
onCollapse,
|
|
59
|
+
onChildrenLoaded
|
|
60
|
+
} = _ref;
|
|
60
61
|
const rootIds = (0, _filterRootIds.filterRootIds)(filter, Array.isArray(roots) ? roots : [roots]);
|
|
61
62
|
const reloadId = (0, _useForceReload.useForceReload)(forceReload);
|
|
62
63
|
const [prevReloadId, setPrevReloadId] = (0, _react.useState)(reloadId);
|
|
@@ -13,15 +13,18 @@ var _index = _interopRequireDefault(require("../locales/index.js"));
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
const RootError =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
const RootError = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
dataTest,
|
|
19
|
+
error
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
22
|
+
"data-test": dataTest
|
|
23
|
+
}, _index.default.t('Error: {{ ERRORMESSAGE }}', {
|
|
24
|
+
ERRORMESSAGE: error,
|
|
25
|
+
nsSeparator: '>'
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
25
28
|
|
|
26
29
|
exports.RootError = RootError;
|
|
27
30
|
RootError.defaultProps = {
|
|
@@ -15,16 +15,19 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
const RootLoading =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
},
|
|
18
|
+
const RootLoading = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
dataTest
|
|
21
|
+
} = _ref;
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
23
|
+
"data-test": dataTest,
|
|
24
|
+
className: "jsx-814846266"
|
|
25
|
+
}, /*#__PURE__*/_react.default.createElement(_loader.CircularLoader, {
|
|
26
|
+
small: true
|
|
27
|
+
}), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
28
|
+
id: "814846266"
|
|
29
|
+
}, ["div.jsx-814846266{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}"]));
|
|
30
|
+
};
|
|
28
31
|
|
|
29
32
|
exports.RootLoading = RootLoading;
|
|
30
33
|
RootLoading.defaultProps = {
|
|
@@ -13,16 +13,20 @@ exports.createExpandHandlers = void 0;
|
|
|
13
13
|
* @param {Function} [args.onCollapse]
|
|
14
14
|
* @returns {{ handleExpand: Function, handleCollapse: Function }}
|
|
15
15
|
*/
|
|
16
|
-
const createExpandHandlers =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
const createExpandHandlers = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
expanded,
|
|
19
|
+
setExpanded,
|
|
20
|
+
onExpand,
|
|
21
|
+
onCollapse
|
|
22
|
+
} = _ref;
|
|
23
|
+
|
|
24
|
+
const handleExpand = _ref2 => {
|
|
25
|
+
let {
|
|
26
|
+
path,
|
|
27
|
+
...rest
|
|
28
|
+
} = _ref2;
|
|
29
|
+
|
|
26
30
|
if (!expanded.includes(path)) {
|
|
27
31
|
setExpanded([...expanded, path]);
|
|
28
32
|
|
|
@@ -35,10 +39,11 @@ const createExpandHandlers = ({
|
|
|
35
39
|
}
|
|
36
40
|
};
|
|
37
41
|
|
|
38
|
-
const handleCollapse =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
const handleCollapse = _ref3 => {
|
|
43
|
+
let {
|
|
44
|
+
path,
|
|
45
|
+
...rest
|
|
46
|
+
} = _ref3;
|
|
42
47
|
const pathIndex = expanded.indexOf(path);
|
|
43
48
|
|
|
44
49
|
if (pathIndex !== -1) {
|
|
@@ -17,14 +17,15 @@ var _createExpandHandlers = require("./create-expand-handlers.js");
|
|
|
17
17
|
* @param {Function} [onCollapse]
|
|
18
18
|
* @returns {{ expanded: string[], handleExpand: Function, handleCollapse: Function }}
|
|
19
19
|
*/
|
|
20
|
-
const useExpanded =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
const useExpanded = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
initiallyExpanded,
|
|
23
|
+
onExpand,
|
|
24
|
+
onCollapse,
|
|
25
|
+
expandedControlled,
|
|
26
|
+
handleExpandControlled,
|
|
27
|
+
handleCollapseControlled
|
|
28
|
+
} = _ref;
|
|
28
29
|
const isControlled = !!expandedControlled;
|
|
29
30
|
const allInitiallyExpandedPaths = isControlled ? [] : (0, _index.getAllExpandedPaths)(initiallyExpanded);
|
|
30
31
|
const [expanded, setExpanded] = (0, _react.useState)(allInitiallyExpandedPaths);
|
|
@@ -18,7 +18,8 @@ exports.patchMissingDisplayName = void 0;
|
|
|
18
18
|
*/
|
|
19
19
|
const patchMissingDisplayName = nodes => {
|
|
20
20
|
const nodeEntries = Object.entries(nodes);
|
|
21
|
-
const nodesWithDisplayName = nodeEntries.map(
|
|
21
|
+
const nodesWithDisplayName = nodeEntries.map(_ref => {
|
|
22
|
+
let [id, node] = _ref;
|
|
22
23
|
const displayName = node.displayName || '';
|
|
23
24
|
return [id, { ...node,
|
|
24
25
|
displayName
|
|
@@ -14,13 +14,16 @@ var _patchMissingDisplayName = require("./patch-missing-display-name.js");
|
|
|
14
14
|
const createRootQuery = ids => ids.reduce((query, id) => ({ ...query,
|
|
15
15
|
[id]: {
|
|
16
16
|
id,
|
|
17
|
-
resource:
|
|
18
|
-
params:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
resource: "organisationUnits",
|
|
18
|
+
params: _ref => {
|
|
19
|
+
let {
|
|
20
|
+
isUserDataViewFallback
|
|
21
|
+
} = _ref;
|
|
22
|
+
return {
|
|
23
|
+
isUserDataViewFallback,
|
|
24
|
+
fields: ['displayName', 'path', 'id']
|
|
25
|
+
};
|
|
26
|
+
}
|
|
24
27
|
}
|
|
25
28
|
}), {});
|
|
26
29
|
/**
|
|
@@ -34,9 +37,10 @@ const createRootQuery = ids => ids.reduce((query, id) => ({ ...query,
|
|
|
34
37
|
|
|
35
38
|
exports.createRootQuery = createRootQuery;
|
|
36
39
|
|
|
37
|
-
const useRootOrgData = (ids
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
const useRootOrgData = function (ids) {
|
|
41
|
+
let {
|
|
42
|
+
isUserDataViewFallback
|
|
43
|
+
} = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
40
44
|
const query = createRootQuery(ids);
|
|
41
45
|
const variables = {
|
|
42
46
|
isUserDataViewFallback
|