@dhis2-ui/organisation-unit-tree 10.16.3-alpha.1 → 10.16.4

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.
Files changed (110) hide show
  1. package/build/cjs/__e2e__/children_as_child_nodes.js +8 -11
  2. package/build/cjs/__e2e__/common.js +19 -26
  3. package/build/cjs/__e2e__/controlled_expanded.js +7 -10
  4. package/build/cjs/__e2e__/displaying_loading_error.js +1 -4
  5. package/build/cjs/__e2e__/expanded.js +25 -34
  6. package/build/cjs/__e2e__/force_reload.js +15 -22
  7. package/build/cjs/__e2e__/get-organisation-unit-data.js +25 -29
  8. package/build/cjs/__e2e__/highlight.js +7 -10
  9. package/build/cjs/__e2e__/loading_state.js +7 -13
  10. package/build/cjs/__e2e__/multi_selection.js +8 -11
  11. package/build/cjs/__e2e__/no_selection.js +15 -21
  12. package/build/cjs/__e2e__/path_based_filtering.js +16 -22
  13. package/build/cjs/__e2e__/single_selection.js +10 -16
  14. package/build/cjs/__e2e__/sub_unit_as_root.js +5 -7
  15. package/build/cjs/__e2e__/tree_api.js +15 -21
  16. package/build/cjs/__stories__/custom-expanded-imperative-open.js +7 -10
  17. package/build/cjs/__stories__/custom-node-label.js +4 -5
  18. package/build/cjs/__stories__/development-stories.js +6 -8
  19. package/build/cjs/__stories__/force-reload-all.js +1 -2
  20. package/build/cjs/__stories__/loading-error-grandchild.js +1 -4
  21. package/build/cjs/__stories__/loading.js +1 -4
  22. package/build/cjs/__stories__/multiple-roots.js +9 -12
  23. package/build/cjs/__stories__/root-error.js +1 -4
  24. package/build/cjs/__stories__/root-loading.js +1 -4
  25. package/build/cjs/__stories__/shared.js +46 -79
  26. package/build/cjs/features/controlled_expanded/index.js +3 -6
  27. package/build/cjs/locales/index.js +49 -27
  28. package/build/cjs/organisation-unit-node/error-message.js +10 -13
  29. package/build/cjs/organisation-unit-node/label/disabled-selection-label.js +9 -12
  30. package/build/cjs/organisation-unit-node/label/icon-empty.js +19 -22
  31. package/build/cjs/organisation-unit-node/label/icon-folder-closed.js +25 -28
  32. package/build/cjs/organisation-unit-node/label/icon-folder-open.js +34 -37
  33. package/build/cjs/organisation-unit-node/label/icon-single.js +28 -31
  34. package/build/cjs/organisation-unit-node/label/icon.js +6 -7
  35. package/build/cjs/organisation-unit-node/label/iconized-checkbox.js +12 -13
  36. package/build/cjs/organisation-unit-node/label/label-container.js +13 -16
  37. package/build/cjs/organisation-unit-node/label/label.js +27 -30
  38. package/build/cjs/organisation-unit-node/label/single-selection-label.js +18 -21
  39. package/build/cjs/organisation-unit-node/organisation-unit-node-children.js +27 -29
  40. package/build/cjs/organisation-unit-node/organisation-unit-node.js +22 -23
  41. package/build/cjs/organisation-unit-node/use-open-state.js +8 -9
  42. package/build/cjs/organisation-unit-node/use-org-children.js +14 -21
  43. package/build/cjs/organisation-unit-node/use-org-children.test.js +40 -59
  44. package/build/cjs/organisation-unit-node/use-org-data/use-org-data.js +13 -20
  45. package/build/cjs/organisation-unit-node/use-org-data/use-org-data.test.js +17 -27
  46. package/build/cjs/organisation-unit-tree/default-render-node-label/default-render-node-label.js +3 -6
  47. package/build/cjs/organisation-unit-tree/organisation-unit-tree-root-error.js +9 -12
  48. package/build/cjs/organisation-unit-tree/organisation-unit-tree-root-loading.js +10 -13
  49. package/build/cjs/organisation-unit-tree/organisation-unit-tree.js +24 -26
  50. package/build/cjs/organisation-unit-tree/use-expanded/create-expand-handlers.js +14 -17
  51. package/build/cjs/organisation-unit-tree/use-expanded/use-expanded.js +8 -9
  52. package/build/cjs/organisation-unit-tree/use-root-org-data/patch-missing-display-name.js +1 -2
  53. package/build/cjs/organisation-unit-tree/use-root-org-data/use-root-org-data.js +10 -14
  54. package/build/cjs/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +32 -46
  55. package/build/es/__e2e__/children_as_child_nodes.js +8 -11
  56. package/build/es/__e2e__/common.js +18 -24
  57. package/build/es/__e2e__/controlled_expanded.js +6 -8
  58. package/build/es/__e2e__/displaying_loading_error.js +1 -4
  59. package/build/es/__e2e__/expanded.js +25 -34
  60. package/build/es/__e2e__/force_reload.js +14 -20
  61. package/build/es/__e2e__/get-organisation-unit-data.js +25 -29
  62. package/build/es/__e2e__/highlight.js +7 -10
  63. package/build/es/__e2e__/loading_state.js +7 -13
  64. package/build/es/__e2e__/multi_selection.js +8 -11
  65. package/build/es/__e2e__/no_selection.js +15 -21
  66. package/build/es/__e2e__/path_based_filtering.js +16 -22
  67. package/build/es/__e2e__/single_selection.js +10 -16
  68. package/build/es/__e2e__/sub_unit_as_root.js +4 -5
  69. package/build/es/__e2e__/tree_api.js +15 -21
  70. package/build/es/__stories__/custom-expanded-imperative-open.js +6 -8
  71. package/build/es/__stories__/custom-node-label.js +4 -5
  72. package/build/es/__stories__/development-stories.js +5 -6
  73. package/build/es/__stories__/loading-error-grandchild.js +1 -4
  74. package/build/es/__stories__/loading.js +1 -4
  75. package/build/es/__stories__/multiple-roots.js +9 -12
  76. package/build/es/__stories__/root-error.js +1 -4
  77. package/build/es/__stories__/root-loading.js +1 -4
  78. package/build/es/__stories__/shared.js +45 -77
  79. package/build/es/features/controlled_expanded/index.js +3 -6
  80. package/build/es/locales/index.js +40 -18
  81. package/build/es/organisation-unit-node/error-message.js +10 -13
  82. package/build/es/organisation-unit-node/label/disabled-selection-label.js +9 -12
  83. package/build/es/organisation-unit-node/label/icon-empty.js +19 -22
  84. package/build/es/organisation-unit-node/label/icon-folder-closed.js +25 -28
  85. package/build/es/organisation-unit-node/label/icon-folder-open.js +34 -37
  86. package/build/es/organisation-unit-node/label/icon-single.js +28 -31
  87. package/build/es/organisation-unit-node/label/icon.js +6 -7
  88. package/build/es/organisation-unit-node/label/iconized-checkbox.js +12 -13
  89. package/build/es/organisation-unit-node/label/label-container.js +13 -16
  90. package/build/es/organisation-unit-node/label/label.js +27 -30
  91. package/build/es/organisation-unit-node/label/single-selection-label.js +18 -21
  92. package/build/es/organisation-unit-node/organisation-unit-node-children.js +27 -29
  93. package/build/es/organisation-unit-node/organisation-unit-node.js +22 -23
  94. package/build/es/organisation-unit-node/use-open-state.js +8 -9
  95. package/build/es/organisation-unit-node/use-org-children.js +14 -21
  96. package/build/es/organisation-unit-node/use-org-children.test.js +40 -59
  97. package/build/es/organisation-unit-node/use-org-data/use-org-data.js +13 -20
  98. package/build/es/organisation-unit-node/use-org-data/use-org-data.test.js +17 -27
  99. package/build/es/organisation-unit-tree/default-render-node-label/default-render-node-label.js +3 -6
  100. package/build/es/organisation-unit-tree/organisation-unit-tree-root-error.js +9 -12
  101. package/build/es/organisation-unit-tree/organisation-unit-tree-root-loading.js +10 -13
  102. package/build/es/organisation-unit-tree/organisation-unit-tree.js +23 -24
  103. package/build/es/organisation-unit-tree/use-expanded/create-expand-handlers.js +14 -17
  104. package/build/es/organisation-unit-tree/use-expanded/use-expanded.js +8 -9
  105. package/build/es/organisation-unit-tree/use-root-org-data/patch-missing-display-name.js +1 -2
  106. package/build/es/organisation-unit-tree/use-root-org-data/use-root-org-data.js +10 -14
  107. package/build/es/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +32 -46
  108. package/package.json +6 -6
  109. package/src/locales/index.js +57 -18
  110. package/src/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +14 -14
@@ -1,6 +1,3 @@
1
- export const defaultRenderNodeLabel = _ref => {
2
- let {
3
- label
4
- } = _ref;
5
- return label;
6
- };
1
+ export const defaultRenderNodeLabel = ({
2
+ label
3
+ }) => label;
@@ -1,18 +1,15 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import i18n from '../locales/index.js';
4
- export const OrganisationUnitTreeRootError = _ref => {
5
- let {
6
- dataTest = 'dhis2-uiwidgets-orgunittree-error',
7
- error
8
- } = _ref;
9
- return /*#__PURE__*/React.createElement("div", {
10
- "data-test": dataTest
11
- }, i18n.t('Error: {{ ERRORMESSAGE }}', {
12
- ERRORMESSAGE: error,
13
- nsSeparator: '>'
14
- }));
15
- };
4
+ export const OrganisationUnitTreeRootError = ({
5
+ dataTest = 'dhis2-uiwidgets-orgunittree-error',
6
+ error
7
+ }) => /*#__PURE__*/React.createElement("div", {
8
+ "data-test": dataTest
9
+ }, i18n.t('Error: {{ ERRORMESSAGE }}', {
10
+ ERRORMESSAGE: error,
11
+ nsSeparator: '>'
12
+ }));
16
13
  OrganisationUnitTreeRootError.propTypes = {
17
14
  error: PropTypes.string.isRequired,
18
15
  dataTest: PropTypes.string
@@ -2,19 +2,16 @@ import _JSXStyle from "styled-jsx/style";
2
2
  import { CircularLoader } from '@dhis2-ui/loader';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
- export const OrganisationUnitTreeRootLoading = _ref => {
6
- let {
7
- dataTest = 'dhis2-uiwidgets-orgunittree-loading'
8
- } = _ref;
9
- return /*#__PURE__*/React.createElement("div", {
10
- "data-test": dataTest,
11
- className: "jsx-814846266"
12
- }, /*#__PURE__*/React.createElement(CircularLoader, {
13
- small: true
14
- }), /*#__PURE__*/React.createElement(_JSXStyle, {
15
- id: "814846266"
16
- }, ["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;}"]));
17
- };
5
+ export const OrganisationUnitTreeRootLoading = ({
6
+ dataTest = 'dhis2-uiwidgets-orgunittree-loading'
7
+ }) => /*#__PURE__*/React.createElement("div", {
8
+ "data-test": dataTest,
9
+ className: "jsx-814846266"
10
+ }, /*#__PURE__*/React.createElement(CircularLoader, {
11
+ small: true
12
+ }), /*#__PURE__*/React.createElement(_JSXStyle, {
13
+ id: "814846266"
14
+ }, ["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;}"]));
18
15
  OrganisationUnitTreeRootLoading.propTypes = {
19
16
  dataTest: PropTypes.string
20
17
  };
@@ -13,30 +13,29 @@ import { useRootOrgData } from './use-root-org-data/index.js';
13
13
 
14
14
  // A stable object to reference
15
15
  const staticArray = [];
16
- const OrganisationUnitTree = _ref => {
17
- let {
18
- onChange,
19
- roots,
20
- autoExpandLoadingError,
21
- dataTest = 'dhis2-uiwidgets-orgunittree',
22
- disableSelection,
23
- displayProperty = 'displayName',
24
- forceReload,
25
- highlighted = staticArray,
26
- isUserDataViewFallback,
27
- initiallyExpanded = staticArray,
28
- filter = staticArray,
29
- renderNodeLabel = defaultRenderNodeLabel,
30
- selected = staticArray,
31
- singleSelection,
32
- suppressAlphabeticalSorting,
33
- expanded: expandedControlled,
34
- handleExpand: handleExpandControlled,
35
- handleCollapse: handleCollapseControlled,
36
- onExpand,
37
- onCollapse,
38
- onChildrenLoaded
39
- } = _ref;
16
+ const OrganisationUnitTree = ({
17
+ onChange,
18
+ roots,
19
+ autoExpandLoadingError,
20
+ dataTest = 'dhis2-uiwidgets-orgunittree',
21
+ disableSelection,
22
+ displayProperty = 'displayName',
23
+ forceReload,
24
+ highlighted = staticArray,
25
+ isUserDataViewFallback,
26
+ initiallyExpanded = staticArray,
27
+ filter = staticArray,
28
+ renderNodeLabel = defaultRenderNodeLabel,
29
+ selected = staticArray,
30
+ singleSelection,
31
+ suppressAlphabeticalSorting,
32
+ expanded: expandedControlled,
33
+ handleExpand: handleExpandControlled,
34
+ handleCollapse: handleCollapseControlled,
35
+ onExpand,
36
+ onCollapse,
37
+ onChildrenLoaded
38
+ }) => {
40
39
  const rootIds = filterRootIds(filter, Array.isArray(roots) ? roots : [roots]);
41
40
  const reloadId = useForceReload(forceReload);
42
41
  const [prevReloadId, setPrevReloadId] = useState(reloadId);
@@ -6,18 +6,16 @@
6
6
  * @param {Function} [args.onCollapse]
7
7
  * @returns {{ handleExpand: Function, handleCollapse: Function }}
8
8
  */
9
- export const createExpandHandlers = _ref => {
10
- let {
11
- expanded,
12
- setExpanded,
13
- onExpand,
14
- onCollapse
15
- } = _ref;
16
- const handleExpand = _ref2 => {
17
- let {
18
- path,
19
- ...rest
20
- } = _ref2;
9
+ export const createExpandHandlers = ({
10
+ expanded,
11
+ setExpanded,
12
+ onExpand,
13
+ onCollapse
14
+ }) => {
15
+ const handleExpand = ({
16
+ path,
17
+ ...rest
18
+ }) => {
21
19
  if (!expanded.includes(path)) {
22
20
  setExpanded([...expanded, path]);
23
21
  if (onExpand) {
@@ -28,11 +26,10 @@ export const createExpandHandlers = _ref => {
28
26
  }
29
27
  }
30
28
  };
31
- const handleCollapse = _ref3 => {
32
- let {
33
- path,
34
- ...rest
35
- } = _ref3;
29
+ const handleCollapse = ({
30
+ path,
31
+ ...rest
32
+ }) => {
36
33
  const pathIndex = expanded.indexOf(path);
37
34
  if (pathIndex !== -1) {
38
35
  const updatedExpanded = pathIndex === 0 ? expanded.slice(1) : [...expanded.slice(0, pathIndex), ...expanded.slice(pathIndex + 1)];
@@ -8,15 +8,14 @@ import { createExpandHandlers } from './create-expand-handlers.js';
8
8
  * @param {Function} [onCollapse]
9
9
  * @returns {{ expanded: string[], handleExpand: Function, handleCollapse: Function }}
10
10
  */
11
- export const useExpanded = _ref => {
12
- let {
13
- initiallyExpanded,
14
- onExpand,
15
- onCollapse,
16
- expandedControlled,
17
- handleExpandControlled,
18
- handleCollapseControlled
19
- } = _ref;
11
+ export const useExpanded = ({
12
+ initiallyExpanded,
13
+ onExpand,
14
+ onCollapse,
15
+ expandedControlled,
16
+ handleExpandControlled,
17
+ handleCollapseControlled
18
+ }) => {
20
19
  const isControlled = !!expandedControlled;
21
20
  const allInitiallyExpandedPaths = isControlled ? [] : getAllExpandedPaths(initiallyExpanded);
22
21
  const [expanded, setExpanded] = useState(allInitiallyExpandedPaths);
@@ -11,8 +11,7 @@
11
11
  */
12
12
  export const patchMissingDisplayName = nodes => {
13
13
  const nodeEntries = Object.entries(nodes);
14
- const nodesWithDisplayName = nodeEntries.map(_ref => {
15
- let [id, node] = _ref;
14
+ const nodesWithDisplayName = nodeEntries.map(([id, node]) => {
16
15
  const displayName = node.displayName || '';
17
16
  return [id, {
18
17
  ...node,
@@ -6,15 +6,12 @@ export const createRootQuery = (ids, displayProperty) => ids.reduce((query, id)
6
6
  [id]: {
7
7
  id,
8
8
  resource: `organisationUnits`,
9
- params: _ref => {
10
- let {
11
- isUserDataViewFallback
12
- } = _ref;
13
- return {
14
- isUserDataViewFallback,
15
- fields: [displayProperty === 'displayName' ? 'displayName' : `${displayProperty}~rename(displayName)`, 'path', 'id']
16
- };
17
- }
9
+ params: ({
10
+ isUserDataViewFallback
11
+ }) => ({
12
+ isUserDataViewFallback,
13
+ fields: [displayProperty === 'displayName' ? 'displayName' : `${displayProperty}~rename(displayName)`, 'path', 'id']
14
+ })
18
15
  }
19
16
  }), {});
20
17
 
@@ -26,11 +23,10 @@ export const createRootQuery = (ids, displayProperty) => ids.reduce((query, id)
26
23
  * @param {'displayName'|'displayShortName'} [options.displayProperty]
27
24
  * @returns {Object}
28
25
  */
29
- export const useRootOrgData = function (ids) {
30
- let {
31
- isUserDataViewFallback,
32
- displayProperty = 'displayName'
33
- } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
26
+ export const useRootOrgData = (ids, {
27
+ isUserDataViewFallback,
28
+ displayProperty = 'displayName'
29
+ } = {}) => {
34
30
  const query = useMemo(() => createRootQuery(ids, displayProperty), [ids, displayProperty]);
35
31
  const variables = {
36
32
  isUserDataViewFallback
@@ -5,10 +5,7 @@ import { useRootOrgData } from './use-root-org-data.js';
5
5
  describe('OrganisationUnitTree - useRootOrgData', () => {
6
6
  // @TODO: Figure out why this is necessary at all...
7
7
  const origError = console.error;
8
- jest.spyOn(console, 'error').mockImplementation(function () {
9
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10
- args[_key] = arguments[_key];
11
- }
8
+ jest.spyOn(console, 'error').mockImplementation((...args) => {
12
9
  const [err] = args;
13
10
  if (!err.toString().match(/^Warning: An update to/)) {
14
11
  origError(...args);
@@ -18,10 +15,7 @@ describe('OrganisationUnitTree - useRootOrgData', () => {
18
15
  // @TODO: This is kind of necessary; no idea if we can get rid of this
19
16
  const origWarn = console.warn;
20
17
  const dynamicQueryWarningMsg = "The query should be static, don't create it within the render loop!";
21
- jest.spyOn(console, 'warn').mockImplementation(function () {
22
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
23
- args[_key2] = arguments[_key2];
24
- }
18
+ jest.spyOn(console, 'warn').mockImplementation((...args) => {
25
19
  const [err] = args;
26
20
  if (!err.toString().match(dynamicQueryWarningMsg)) {
27
21
  origWarn(...args);
@@ -40,14 +34,11 @@ describe('OrganisationUnitTree - useRootOrgData', () => {
40
34
  };
41
35
  })
42
36
  };
43
- const wrapper = _ref => {
44
- let {
45
- children
46
- } = _ref;
47
- return /*#__PURE__*/React.createElement(CustomDataProvider, {
48
- data: dataProviderData
49
- }, children);
50
- };
37
+ const wrapper = ({
38
+ children
39
+ }) => /*#__PURE__*/React.createElement(CustomDataProvider, {
40
+ data: dataProviderData
41
+ }, children);
51
42
  it('should respond with `loading: false`, `error: null` and `data: null` initially', () => {
52
43
  const {
53
44
  result
@@ -67,32 +58,30 @@ describe('OrganisationUnitTree - useRootOrgData', () => {
67
58
  } = renderHook(() => useRootOrgData(['A0000000000']), {
68
59
  wrapper
69
60
  });
70
- await waitFor(() => {});
71
- expect(result.current).toEqual(expect.objectContaining({
72
- loading: false,
73
- error: null,
74
- data: {
75
- A0000000000: {
76
- id: 'A0000000000',
77
- path: '/A0000000000',
78
- displayName: 'Org Unit 1'
61
+ await waitFor(() => {
62
+ expect(result.current).toEqual(expect.objectContaining({
63
+ loading: false,
64
+ error: null,
65
+ data: {
66
+ A0000000000: {
67
+ id: 'A0000000000',
68
+ path: '/A0000000000',
69
+ displayName: 'Org Unit 1'
70
+ }
79
71
  }
80
- }
81
- }));
72
+ }));
73
+ });
82
74
  });
83
75
  it('should provide the error', async () => {
84
- const errorWrapper = _ref2 => {
85
- let {
86
- children
87
- } = _ref2;
88
- return /*#__PURE__*/React.createElement(CustomDataProvider, {
89
- data: {
90
- organisationUnits: async () => {
91
- throw new Error('Error message');
92
- }
76
+ const errorWrapper = ({
77
+ children
78
+ }) => /*#__PURE__*/React.createElement(CustomDataProvider, {
79
+ data: {
80
+ organisationUnits: async () => {
81
+ throw new Error('Error message');
93
82
  }
94
- }, children);
95
- };
83
+ }
84
+ }, children);
96
85
  const {
97
86
  result
98
87
  } = renderHook(() => useRootOrgData(['A0000000000']), {
@@ -142,14 +131,11 @@ describe('OrganisationUnitTree - useRootOrgData', () => {
142
131
  };
143
132
  })
144
133
  };
145
- const wrapperWithoutDisplayName = _ref3 => {
146
- let {
147
- children
148
- } = _ref3;
149
- return /*#__PURE__*/React.createElement(CustomDataProvider, {
150
- data: dataProviderDataWithoutDisplayName
151
- }, children);
152
- };
134
+ const wrapperWithoutDisplayName = ({
135
+ children
136
+ }) => /*#__PURE__*/React.createElement(CustomDataProvider, {
137
+ data: dataProviderDataWithoutDisplayName
138
+ }, children);
153
139
  const {
154
140
  result
155
141
  } = renderHook(() => useRootOrgData(['A0000000000']), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/organisation-unit-tree",
3
- "version": "10.16.3-alpha.1",
3
+ "version": "10.16.4",
4
4
  "description": "UI OrganisationUnitTree",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,11 +35,11 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@dhis2/prop-types": "^3.1.2",
38
- "@dhis2-ui/button": "10.16.3-alpha.1",
39
- "@dhis2-ui/checkbox": "10.16.3-alpha.1",
40
- "@dhis2-ui/loader": "10.16.3-alpha.1",
41
- "@dhis2-ui/node": "10.16.3-alpha.1",
42
- "@dhis2/ui-constants": "10.16.3-alpha.1",
38
+ "@dhis2-ui/button": "10.16.4",
39
+ "@dhis2-ui/checkbox": "10.16.4",
40
+ "@dhis2-ui/loader": "10.16.4",
41
+ "@dhis2-ui/node": "10.16.4",
42
+ "@dhis2/ui-constants": "10.16.4",
43
43
  "classnames": "^2.3.1",
44
44
  "prop-types": "^15.7.2"
45
45
  },
@@ -28,23 +28,62 @@ import zhTranslations from './zh/translations.json'
28
28
  import zh_CNTranslations from './zh_CN/translations.json'
29
29
 
30
30
  const namespace = 'default'
31
- i18n.addResources('ar', namespace, arTranslations)
32
- i18n.addResources('cs', namespace, csTranslations)
33
- i18n.addResources('en', namespace, enTranslations)
34
- i18n.addResources('es', namespace, esTranslations)
35
- i18n.addResources('es_419', namespace, es_419Translations)
36
- i18n.addResources('fr', namespace, frTranslations)
37
- i18n.addResources('lo', namespace, loTranslations)
38
- i18n.addResources('nb', namespace, nbTranslations)
39
- i18n.addResources('nl', namespace, nlTranslations)
40
- i18n.addResources('pt', namespace, ptTranslations)
41
- i18n.addResources('ru', namespace, ruTranslations)
42
- i18n.addResources('uk', namespace, ukTranslations)
43
- i18n.addResources('uz_Latn', namespace, uz_LatnTranslations)
44
- i18n.addResources('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations)
45
- i18n.addResources('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations)
46
- i18n.addResources('vi', namespace, viTranslations)
47
- i18n.addResources('zh', namespace, zhTranslations)
48
- i18n.addResources('zh_CN', namespace, zh_CNTranslations)
31
+
32
+ // Use 'deep' = true and 'overwrite' = false to add to, but not overwrite,
33
+ // custom translations from the datastore (added by the app adapter)
34
+
35
+ i18n.addResourceBundle('ar', namespace, arTranslations, true, false)
36
+ i18n.addResourceBundle('ar', namespace, arTranslations, true, false)
37
+
38
+ i18n.addResourceBundle('cs', namespace, csTranslations, true, false)
39
+ i18n.addResourceBundle('cs', namespace, csTranslations, true, false)
40
+
41
+ i18n.addResourceBundle('en', namespace, enTranslations, true, false)
42
+ i18n.addResourceBundle('en', namespace, enTranslations, true, false)
43
+
44
+ i18n.addResourceBundle('es', namespace, esTranslations, true, false)
45
+ i18n.addResourceBundle('es', namespace, esTranslations, true, false)
46
+
47
+ i18n.addResourceBundle('es_419', namespace, es_419Translations, true, false)
48
+ i18n.addResourceBundle('es-419', namespace, es_419Translations, true, false)
49
+
50
+ i18n.addResourceBundle('fr', namespace, frTranslations, true, false)
51
+ i18n.addResourceBundle('fr', namespace, frTranslations, true, false)
52
+
53
+ i18n.addResourceBundle('lo', namespace, loTranslations, true, false)
54
+ i18n.addResourceBundle('lo', namespace, loTranslations, true, false)
55
+
56
+ i18n.addResourceBundle('nb', namespace, nbTranslations, true, false)
57
+ i18n.addResourceBundle('nb', namespace, nbTranslations, true, false)
58
+
59
+ i18n.addResourceBundle('nl', namespace, nlTranslations, true, false)
60
+ i18n.addResourceBundle('nl', namespace, nlTranslations, true, false)
61
+
62
+ i18n.addResourceBundle('pt', namespace, ptTranslations, true, false)
63
+ i18n.addResourceBundle('pt', namespace, ptTranslations, true, false)
64
+
65
+ i18n.addResourceBundle('ru', namespace, ruTranslations, true, false)
66
+ i18n.addResourceBundle('ru', namespace, ruTranslations, true, false)
67
+
68
+ i18n.addResourceBundle('uk', namespace, ukTranslations, true, false)
69
+ i18n.addResourceBundle('uk', namespace, ukTranslations, true, false)
70
+
71
+ i18n.addResourceBundle('uz_Latn', namespace, uz_LatnTranslations, true, false)
72
+ i18n.addResourceBundle('uz-Latn', namespace, uz_LatnTranslations, true, false)
73
+
74
+ i18n.addResourceBundle('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations, true, false)
75
+ i18n.addResourceBundle('uz-Cyrl-UZ', namespace, uz_UZ_CyrlTranslations, true, false)
76
+
77
+ i18n.addResourceBundle('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations, true, false)
78
+ i18n.addResourceBundle('uz-Latn-UZ', namespace, uz_UZ_LatnTranslations, true, false)
79
+
80
+ i18n.addResourceBundle('vi', namespace, viTranslations, true, false)
81
+ i18n.addResourceBundle('vi', namespace, viTranslations, true, false)
82
+
83
+ i18n.addResourceBundle('zh', namespace, zhTranslations, true, false)
84
+ i18n.addResourceBundle('zh', namespace, zhTranslations, true, false)
85
+
86
+ i18n.addResourceBundle('zh_CN', namespace, zh_CNTranslations, true, false)
87
+ i18n.addResourceBundle('zh-CN', namespace, zh_CNTranslations, true, false)
49
88
 
50
89
  export default i18n
@@ -67,21 +67,21 @@ describe('OrganisationUnitTree - useRootOrgData', () => {
67
67
  wrapper,
68
68
  })
69
69
 
70
- await waitFor(() => {})
71
-
72
- expect(result.current).toEqual(
73
- expect.objectContaining({
74
- loading: false,
75
- error: null,
76
- data: {
77
- A0000000000: {
78
- id: 'A0000000000',
79
- path: '/A0000000000',
80
- displayName: 'Org Unit 1',
70
+ await waitFor(() => {
71
+ expect(result.current).toEqual(
72
+ expect.objectContaining({
73
+ loading: false,
74
+ error: null,
75
+ data: {
76
+ A0000000000: {
77
+ id: 'A0000000000',
78
+ path: '/A0000000000',
79
+ displayName: 'Org Unit 1',
80
+ },
81
81
  },
82
- },
83
- })
84
- )
82
+ })
83
+ )
84
+ })
85
85
  })
86
86
 
87
87
  it('should provide the error', async () => {