@dhis2-ui/organisation-unit-tree 10.16.3 → 10.16.5

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 (114) 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 +41 -35
  50. package/build/cjs/organisation-unit-tree/organisation-unit-tree.test.js +78 -7
  51. package/build/cjs/organisation-unit-tree/use-expanded/create-expand-handlers.js +14 -17
  52. package/build/cjs/organisation-unit-tree/use-expanded/use-expanded.js +8 -9
  53. package/build/cjs/organisation-unit-tree/use-root-org-data/patch-missing-display-name.js +1 -2
  54. package/build/cjs/organisation-unit-tree/use-root-org-data/use-root-org-data.js +10 -14
  55. package/build/cjs/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +32 -46
  56. package/build/es/__e2e__/children_as_child_nodes.js +8 -11
  57. package/build/es/__e2e__/common.js +18 -24
  58. package/build/es/__e2e__/controlled_expanded.js +6 -8
  59. package/build/es/__e2e__/displaying_loading_error.js +1 -4
  60. package/build/es/__e2e__/expanded.js +25 -34
  61. package/build/es/__e2e__/force_reload.js +14 -20
  62. package/build/es/__e2e__/get-organisation-unit-data.js +25 -29
  63. package/build/es/__e2e__/highlight.js +7 -10
  64. package/build/es/__e2e__/loading_state.js +7 -13
  65. package/build/es/__e2e__/multi_selection.js +8 -11
  66. package/build/es/__e2e__/no_selection.js +15 -21
  67. package/build/es/__e2e__/path_based_filtering.js +16 -22
  68. package/build/es/__e2e__/single_selection.js +10 -16
  69. package/build/es/__e2e__/sub_unit_as_root.js +4 -5
  70. package/build/es/__e2e__/tree_api.js +15 -21
  71. package/build/es/__stories__/custom-expanded-imperative-open.js +6 -8
  72. package/build/es/__stories__/custom-node-label.js +4 -5
  73. package/build/es/__stories__/development-stories.js +5 -6
  74. package/build/es/__stories__/loading-error-grandchild.js +1 -4
  75. package/build/es/__stories__/loading.js +1 -4
  76. package/build/es/__stories__/multiple-roots.js +9 -12
  77. package/build/es/__stories__/root-error.js +1 -4
  78. package/build/es/__stories__/root-loading.js +1 -4
  79. package/build/es/__stories__/shared.js +45 -77
  80. package/build/es/features/controlled_expanded/index.js +3 -6
  81. package/build/es/locales/index.js +40 -18
  82. package/build/es/organisation-unit-node/error-message.js +10 -13
  83. package/build/es/organisation-unit-node/label/disabled-selection-label.js +9 -12
  84. package/build/es/organisation-unit-node/label/icon-empty.js +19 -22
  85. package/build/es/organisation-unit-node/label/icon-folder-closed.js +25 -28
  86. package/build/es/organisation-unit-node/label/icon-folder-open.js +34 -37
  87. package/build/es/organisation-unit-node/label/icon-single.js +28 -31
  88. package/build/es/organisation-unit-node/label/icon.js +6 -7
  89. package/build/es/organisation-unit-node/label/iconized-checkbox.js +12 -13
  90. package/build/es/organisation-unit-node/label/label-container.js +13 -16
  91. package/build/es/organisation-unit-node/label/label.js +27 -30
  92. package/build/es/organisation-unit-node/label/single-selection-label.js +18 -21
  93. package/build/es/organisation-unit-node/organisation-unit-node-children.js +27 -29
  94. package/build/es/organisation-unit-node/organisation-unit-node.js +22 -23
  95. package/build/es/organisation-unit-node/use-open-state.js +8 -9
  96. package/build/es/organisation-unit-node/use-org-children.js +14 -21
  97. package/build/es/organisation-unit-node/use-org-children.test.js +40 -59
  98. package/build/es/organisation-unit-node/use-org-data/use-org-data.js +13 -20
  99. package/build/es/organisation-unit-node/use-org-data/use-org-data.test.js +17 -27
  100. package/build/es/organisation-unit-tree/default-render-node-label/default-render-node-label.js +3 -6
  101. package/build/es/organisation-unit-tree/organisation-unit-tree-root-error.js +9 -12
  102. package/build/es/organisation-unit-tree/organisation-unit-tree-root-loading.js +10 -13
  103. package/build/es/organisation-unit-tree/organisation-unit-tree.js +34 -27
  104. package/build/es/organisation-unit-tree/organisation-unit-tree.test.js +71 -0
  105. package/build/es/organisation-unit-tree/use-expanded/create-expand-handlers.js +14 -17
  106. package/build/es/organisation-unit-tree/use-expanded/use-expanded.js +8 -9
  107. package/build/es/organisation-unit-tree/use-root-org-data/patch-missing-display-name.js +1 -2
  108. package/build/es/organisation-unit-tree/use-root-org-data/use-root-org-data.js +10 -14
  109. package/build/es/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +32 -46
  110. package/package.json +6 -6
  111. package/src/locales/index.js +57 -18
  112. package/src/organisation-unit-tree/organisation-unit-tree.js +14 -3
  113. package/src/organisation-unit-tree/organisation-unit-tree.test.js +64 -0
  114. package/src/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +14 -14
@@ -3,10 +3,7 @@ import React from 'react';
3
3
  import { OrganisationUnitTree } from '../index.js';
4
4
  import { StatefulMultiSelectionWrapper, dataProviderData } from './common.js';
5
5
  const data = {
6
- organisationUnits: function () {
7
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8
- args[_key] = arguments[_key];
9
- }
6
+ organisationUnits: (...args) => {
10
7
  const [, {
11
8
  id
12
9
  }] = args;
@@ -28,15 +25,12 @@ const data = {
28
25
  };
29
26
  export const SingleSelection = () => /*#__PURE__*/React.createElement(CustomDataProvider, {
30
27
  data: data
31
- }, /*#__PURE__*/React.createElement(StatefulMultiSelectionWrapper, null, _ref => {
32
- let {
33
- selected,
34
- onChange
35
- } = _ref;
36
- return /*#__PURE__*/React.createElement(OrganisationUnitTree, {
37
- singleSelection: true,
38
- roots: ['A0000000000', 'A0000000001'],
39
- onChange: onChange,
40
- selected: selected
41
- });
42
- }));
28
+ }, /*#__PURE__*/React.createElement(StatefulMultiSelectionWrapper, null, ({
29
+ selected,
30
+ onChange
31
+ }) => /*#__PURE__*/React.createElement(OrganisationUnitTree, {
32
+ singleSelection: true,
33
+ roots: ['A0000000000', 'A0000000001'],
34
+ onChange: onChange,
35
+ selected: selected
36
+ })));
@@ -1,11 +1,10 @@
1
1
  import React, { useState } from 'react';
2
2
  import { OrganisationUnitTree } from '../index.js';
3
3
  import { createDecoratorCustomDataProvider, createDecoratorStatefulMultiSelection } from './common.js';
4
- export const MultipleRootSubAndOneMainOrgUnit = (_, _ref) => {
5
- let {
6
- selected,
7
- onChange
8
- } = _ref;
4
+ export const MultipleRootSubAndOneMainOrgUnit = (_, {
5
+ selected,
6
+ onChange
7
+ }) => {
9
8
  const [filter, setFilter] = useState('');
10
9
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("input", {
11
10
  type: "input",
@@ -3,10 +3,7 @@ import React from 'react';
3
3
  import { OrganisationUnitTree } from '../index.js';
4
4
  import { StatefulMultiSelectionWrapper, dataProviderData } from './common.js';
5
5
  const customizedDataProviderData = {
6
- organisationUnits: function () {
7
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
8
- args[_key] = arguments[_key];
9
- }
6
+ organisationUnits: (...args) => {
10
7
  const [, {
11
8
  id,
12
9
  params
@@ -39,20 +36,17 @@ window.onExpand = window.Cypress && window.Cypress.cy.stub();
39
36
  window.onChildrenLoaded = window.Cypress && window.Cypress.cy.stub();
40
37
  export const Events = () => /*#__PURE__*/React.createElement(CustomDataProvider, {
41
38
  data: customizedDataProviderData
42
- }, /*#__PURE__*/React.createElement(StatefulMultiSelectionWrapper, null, _ref => {
43
- let {
44
- selected,
45
- onChange
46
- } = _ref;
47
- return /*#__PURE__*/React.createElement(OrganisationUnitTree, {
48
- roots: "A0000000000",
49
- selected: selected,
50
- onChange: function () {
51
- onChange(...arguments);
52
- window.onChange(...arguments);
53
- },
54
- onExpand: window.onExpand,
55
- onCollapse: window.onCollapse,
56
- onChildrenLoaded: window.onChildrenLoaded
57
- });
58
- }));
39
+ }, /*#__PURE__*/React.createElement(StatefulMultiSelectionWrapper, null, ({
40
+ selected,
41
+ onChange
42
+ }) => /*#__PURE__*/React.createElement(OrganisationUnitTree, {
43
+ roots: "A0000000000",
44
+ selected: selected,
45
+ onChange: (...args) => {
46
+ onChange(...args);
47
+ window.onChange(...args);
48
+ },
49
+ onExpand: window.onExpand,
50
+ onCollapse: window.onCollapse,
51
+ onChildrenLoaded: window.onChildrenLoaded
52
+ })));
@@ -6,18 +6,16 @@ export const CustomExpandedImperativeOpen = () => {
6
6
  const orgUnit2Path = '/A0000000000/A0000000001';
7
7
  const initiallyExpanded = getAllExpandedOrgUnitPaths([]);
8
8
  const [expanded, setExpanded] = useState(initiallyExpanded);
9
- const handleExpand = _ref => {
10
- let {
11
- path
12
- } = _ref;
9
+ const handleExpand = ({
10
+ path
11
+ }) => {
13
12
  if (!expanded.includes(path)) {
14
13
  setExpanded([...expanded, path]);
15
14
  }
16
15
  };
17
- const handleCollapse = _ref2 => {
18
- let {
19
- path
20
- } = _ref2;
16
+ const handleCollapse = ({
17
+ path
18
+ }) => {
21
19
  const pathIndex = expanded.indexOf(path);
22
20
  if (pathIndex !== -1) {
23
21
  const updatedExpanded = pathIndex === 0 ? expanded.slice(1) : [...expanded.slice(0, pathIndex), ...expanded.slice(pathIndex + 1)];
@@ -5,11 +5,10 @@ export const CustomNodeLabel = () => /*#__PURE__*/React.createElement(Organisati
5
5
  name: "Root org unit",
6
6
  roots: "A0000000000",
7
7
  initiallyExpanded: ['/A0000000000/A0000000001'],
8
- renderNodeLabel: _ref => {
9
- let {
10
- label,
11
- node
12
- } = _ref;
8
+ renderNodeLabel: ({
9
+ label,
10
+ node
11
+ }) => {
13
12
  if (node.path !== '/A0000000000/A0000000001') {
14
13
  return label;
15
14
  }
@@ -2,12 +2,11 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
2
2
  import { DataProvider } from '@dhis2/app-runtime';
3
3
  import React, { useState } from 'react';
4
4
  import { OrganisationUnitTree } from '../index.js';
5
- const DX_onChange = (selected, setSelected, singleSelection) => _ref => {
6
- let {
7
- id,
8
- path,
9
- checked
10
- } = _ref;
5
+ const DX_onChange = (selected, setSelected, singleSelection) => ({
6
+ id,
7
+ path,
8
+ checked
9
+ }) => {
11
10
  console.log('onChange', {
12
11
  path,
13
12
  id,
@@ -5,10 +5,7 @@ import { customData, onChange, onExpand, onCollapse, onChildrenLoaded } from './
5
5
  export const LoadingErrorGrandchild = () => /*#__PURE__*/React.createElement(CustomDataProvider, {
6
6
  data: {
7
7
  ...customData,
8
- organisationUnits: function () {
9
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10
- args[_key] = arguments[_key];
11
- }
8
+ organisationUnits: (...args) => {
12
9
  const [, {
13
10
  id
14
11
  }] = args;
@@ -5,10 +5,7 @@ import { customData, onChange } from './shared.js';
5
5
  export const Loading = () => /*#__PURE__*/React.createElement(CustomDataProvider, {
6
6
  data: {
7
7
  ...customData,
8
- organisationUnits: function () {
9
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10
- args[_key] = arguments[_key];
11
- }
8
+ organisationUnits: (...args) => {
12
9
  const [, {
13
10
  id
14
11
  }] = args;
@@ -1,16 +1,13 @@
1
1
  import React from 'react';
2
2
  import { OrganisationUnitTree } from '../index.js';
3
3
  import { createDecoratorCustomDataProvider, createDecoratorStatefulMultiSelection } from './shared.js';
4
- export const MultipleRoots = (_, _ref) => {
5
- let {
6
- onChange,
7
- selected
8
- } = _ref;
9
- return /*#__PURE__*/React.createElement(OrganisationUnitTree, {
10
- selected: selected,
11
- onChange: onChange,
12
- roots: ['A0000000000', 'A0000000001'],
13
- initiallyExpanded: ['/A0000000000/A0000000001']
14
- });
15
- };
4
+ export const MultipleRoots = (_, {
5
+ onChange,
6
+ selected
7
+ }) => /*#__PURE__*/React.createElement(OrganisationUnitTree, {
8
+ selected: selected,
9
+ onChange: onChange,
10
+ roots: ['A0000000000', 'A0000000001'],
11
+ initiallyExpanded: ['/A0000000000/A0000000001']
12
+ });
16
13
  MultipleRoots.decorators = [createDecoratorStatefulMultiSelection(), createDecoratorCustomDataProvider()];
@@ -5,10 +5,7 @@ import { customData, onChange } from './shared.js';
5
5
  export const RootError = () => /*#__PURE__*/React.createElement(CustomDataProvider, {
6
6
  data: {
7
7
  ...customData,
8
- organisationUnits: function () {
9
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10
- args[_key] = arguments[_key];
11
- }
8
+ organisationUnits: (...args) => {
12
9
  const [, {
13
10
  id
14
11
  }] = args;
@@ -5,10 +5,7 @@ import { customData, onChange } from './shared.js';
5
5
  export const RootLoading = () => /*#__PURE__*/React.createElement(CustomDataProvider, {
6
6
  data: {
7
7
  ...customData,
8
- organisationUnits: function () {
9
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
10
- args[_key] = arguments[_key];
11
- }
8
+ organisationUnits: (...args) => {
12
9
  const [, {
13
10
  id
14
11
  }] = args;
@@ -2,60 +2,36 @@ import { CustomDataProvider } from '@dhis2/app-runtime';
2
2
  import PropTypes from 'prop-types';
3
3
  import React, { useState } from 'react';
4
4
  export const log = true;
5
- export const onChange = function () {
6
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
7
- args[_key] = arguments[_key];
8
- }
9
- return log && console.log('onChange', ...args);
10
- };
11
- export const onExpand = function () {
12
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
13
- args[_key2] = arguments[_key2];
14
- }
15
- return log && console.log('onExpand', ...args);
16
- };
17
- export const onCollapse = function () {
18
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
19
- args[_key3] = arguments[_key3];
20
- }
21
- return log && console.log('onCollapse', ...args);
22
- };
23
- export const onChildrenLoaded = function () {
24
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
25
- args[_key4] = arguments[_key4];
26
- }
27
- return log && console.log('onChildrenLoaded', ...args);
28
- };
29
- const createResponse = _ref => {
30
- let {
31
- fields,
32
- id,
33
- path,
34
- displayName,
5
+ export const onChange = (...args) => log && console.log('onChange', ...args);
6
+ export const onExpand = (...args) => log && console.log('onExpand', ...args);
7
+ export const onCollapse = (...args) => log && console.log('onCollapse', ...args);
8
+ export const onChildrenLoaded = (...args) => log && console.log('onChildrenLoaded', ...args);
9
+ const createResponse = ({
10
+ fields,
11
+ id,
12
+ path,
13
+ displayName,
14
+ children
15
+ }) => ({
16
+ ...(fields.includes('id') ? {
17
+ id
18
+ } : {}),
19
+ ...(fields.includes('path') ? {
20
+ path
21
+ } : {}),
22
+ ...(fields.includes('displayName') ? {
23
+ displayName
24
+ } : {}),
25
+ ...(fields.includes('children::size') ? {
26
+ children: children.length
27
+ } : {}),
28
+ ...(fields.includes('children[id,path,displayName]') ? {
35
29
  children
36
- } = _ref;
37
- return {
38
- ...(fields.includes('id') ? {
39
- id
40
- } : {}),
41
- ...(fields.includes('path') ? {
42
- path
43
- } : {}),
44
- ...(fields.includes('displayName') ? {
45
- displayName
46
- } : {}),
47
- ...(fields.includes('children::size') ? {
48
- children: children.length
49
- } : {}),
50
- ...(fields.includes('children[id,path,displayName]') ? {
51
- children
52
- } : {})
53
- };
54
- };
55
- export const getOrganisationUnitData = (id, _ref2) => {
56
- let {
57
- fields
58
- } = _ref2;
30
+ } : {})
31
+ });
32
+ export const getOrganisationUnitData = (id, {
33
+ fields
34
+ }) => {
59
35
  let data;
60
36
  if (id === 'A0000000000') {
61
37
  data = createResponse({
@@ -157,11 +133,10 @@ export const getOrganisationUnitData = (id, _ref2) => {
157
133
  return data;
158
134
  };
159
135
  export const customData = {
160
- organisationUnits: (_, _ref3) => {
161
- let {
162
- id,
163
- params = {}
164
- } = _ref3;
136
+ organisationUnits: (_, {
137
+ id,
138
+ params = {}
139
+ }) => {
165
140
  const data = getOrganisationUnitData(id, params);
166
141
  if (!data) {
167
142
  return Promise.reject(new Error('404 - Org unit not found'));
@@ -169,18 +144,14 @@ export const customData = {
169
144
  return Promise.resolve(data);
170
145
  }
171
146
  };
172
- export const StatefulMultiSelectionWrapper = _ref4 => {
173
- let {
174
- children,
175
- onSelectionChange = () => null
176
- } = _ref4;
147
+ export const StatefulMultiSelectionWrapper = ({
148
+ children,
149
+ onSelectionChange = () => null
150
+ }) => {
177
151
  const [selected, setSelected] = useState([]);
178
152
  return children({
179
153
  selected,
180
- onChange: function () {
181
- for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
182
- args[_key5] = arguments[_key5];
183
- }
154
+ onChange: (...args) => {
184
155
  onChange(...args);
185
156
  const [{
186
157
  selected: newSelected
@@ -197,16 +168,13 @@ StatefulMultiSelectionWrapper.propTypes = {
197
168
  export const createDecoratorStatefulMultiSelection = args => {
198
169
  return Story => /*#__PURE__*/React.createElement(StatefulMultiSelectionWrapper, {
199
170
  onSelectionChange: args === null || args === void 0 ? void 0 : args.onSelectionChange
200
- }, _ref5 => {
201
- let {
202
- selected,
203
- onChange
204
- } = _ref5;
205
- return /*#__PURE__*/React.createElement(Story, {
206
- selected: selected,
207
- onChange: onChange
208
- });
209
- });
171
+ }, ({
172
+ selected,
173
+ onChange
174
+ }) => /*#__PURE__*/React.createElement(Story, {
175
+ selected: selected,
176
+ onChange: onChange
177
+ }));
210
178
  };
211
179
  export const createDecoratorCustomDataProvider = args => {
212
180
  const data = (args === null || args === void 0 ? void 0 : args.data) || customData;
@@ -56,12 +56,9 @@ Then('the path should close', () => {
56
56
  const curData = getOrganisationUnitData(cur, {
57
57
  fields: ['children[id,path,displayName]']
58
58
  });
59
- const childrenIds = curData.children.map(_ref => {
60
- let {
61
- id
62
- } = _ref;
63
- return id;
64
- });
59
+ const childrenIds = curData.children.map(({
60
+ id
61
+ }) => id);
65
62
  return [...acc, ...childrenIds];
66
63
  }, []);
67
64
  expectOrgUnitsToNotBeDisplayed(hiddenChildrenIds);
@@ -26,22 +26,44 @@ import viTranslations from './vi/translations.json';
26
26
  import zhTranslations from './zh/translations.json';
27
27
  import zh_CNTranslations from './zh_CN/translations.json';
28
28
  const namespace = 'default';
29
- i18n.addResources('ar', namespace, arTranslations);
30
- i18n.addResources('cs', namespace, csTranslations);
31
- i18n.addResources('en', namespace, enTranslations);
32
- i18n.addResources('es', namespace, esTranslations);
33
- i18n.addResources('es_419', namespace, es_419Translations);
34
- i18n.addResources('fr', namespace, frTranslations);
35
- i18n.addResources('lo', namespace, loTranslations);
36
- i18n.addResources('nb', namespace, nbTranslations);
37
- i18n.addResources('nl', namespace, nlTranslations);
38
- i18n.addResources('pt', namespace, ptTranslations);
39
- i18n.addResources('ru', namespace, ruTranslations);
40
- i18n.addResources('uk', namespace, ukTranslations);
41
- i18n.addResources('uz_Latn', namespace, uz_LatnTranslations);
42
- i18n.addResources('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations);
43
- i18n.addResources('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations);
44
- i18n.addResources('vi', namespace, viTranslations);
45
- i18n.addResources('zh', namespace, zhTranslations);
46
- i18n.addResources('zh_CN', namespace, zh_CNTranslations);
29
+
30
+ // Use 'deep' = true and 'overwrite' = false to add to, but not overwrite,
31
+ // custom translations from the datastore (added by the app adapter)
32
+
33
+ i18n.addResourceBundle('ar', namespace, arTranslations, true, false);
34
+ i18n.addResourceBundle('ar', namespace, arTranslations, true, false);
35
+ i18n.addResourceBundle('cs', namespace, csTranslations, true, false);
36
+ i18n.addResourceBundle('cs', namespace, csTranslations, true, false);
37
+ i18n.addResourceBundle('en', namespace, enTranslations, true, false);
38
+ i18n.addResourceBundle('en', namespace, enTranslations, true, false);
39
+ i18n.addResourceBundle('es', namespace, esTranslations, true, false);
40
+ i18n.addResourceBundle('es', namespace, esTranslations, true, false);
41
+ i18n.addResourceBundle('es_419', namespace, es_419Translations, true, false);
42
+ i18n.addResourceBundle('es-419', namespace, es_419Translations, true, false);
43
+ i18n.addResourceBundle('fr', namespace, frTranslations, true, false);
44
+ i18n.addResourceBundle('fr', namespace, frTranslations, true, false);
45
+ i18n.addResourceBundle('lo', namespace, loTranslations, true, false);
46
+ i18n.addResourceBundle('lo', namespace, loTranslations, true, false);
47
+ i18n.addResourceBundle('nb', namespace, nbTranslations, true, false);
48
+ i18n.addResourceBundle('nb', namespace, nbTranslations, true, false);
49
+ i18n.addResourceBundle('nl', namespace, nlTranslations, true, false);
50
+ i18n.addResourceBundle('nl', namespace, nlTranslations, true, false);
51
+ i18n.addResourceBundle('pt', namespace, ptTranslations, true, false);
52
+ i18n.addResourceBundle('pt', namespace, ptTranslations, true, false);
53
+ i18n.addResourceBundle('ru', namespace, ruTranslations, true, false);
54
+ i18n.addResourceBundle('ru', namespace, ruTranslations, true, false);
55
+ i18n.addResourceBundle('uk', namespace, ukTranslations, true, false);
56
+ i18n.addResourceBundle('uk', namespace, ukTranslations, true, false);
57
+ i18n.addResourceBundle('uz_Latn', namespace, uz_LatnTranslations, true, false);
58
+ i18n.addResourceBundle('uz-Latn', namespace, uz_LatnTranslations, true, false);
59
+ i18n.addResourceBundle('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations, true, false);
60
+ i18n.addResourceBundle('uz-Cyrl-UZ', namespace, uz_UZ_CyrlTranslations, true, false);
61
+ i18n.addResourceBundle('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations, true, false);
62
+ i18n.addResourceBundle('uz-Latn-UZ', namespace, uz_UZ_LatnTranslations, true, false);
63
+ i18n.addResourceBundle('vi', namespace, viTranslations, true, false);
64
+ i18n.addResourceBundle('vi', namespace, viTranslations, true, false);
65
+ i18n.addResourceBundle('zh', namespace, zhTranslations, true, false);
66
+ i18n.addResourceBundle('zh', namespace, zhTranslations, true, false);
67
+ i18n.addResourceBundle('zh_CN', namespace, zh_CNTranslations, true, false);
68
+ i18n.addResourceBundle('zh-CN', namespace, zh_CNTranslations, true, false);
47
69
  export default i18n;
@@ -2,19 +2,16 @@ import _JSXStyle from "styled-jsx/style";
2
2
  import { colors, spacers, theme } from '@dhis2/ui-constants';
3
3
  import PropTypes from 'prop-types';
4
4
  import React from 'react';
5
- export const ErrorMessage = _ref => {
6
- let {
7
- children,
8
- dataTest
9
- } = _ref;
10
- return /*#__PURE__*/React.createElement("span", {
11
- "data-test": `${dataTest}-error`,
12
- className: _JSXStyle.dynamic([["3198585030", [colors.grey800, spacers.dp4, theme.error]]])
13
- }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
14
- id: "3198585030",
15
- dynamic: [colors.grey800, spacers.dp4, theme.error]
16
- }, [`span.__jsx-style-dynamic-selector{font-size:14px;color:${colors.grey800};margin:${spacers.dp4};color:${theme.error};}`]));
17
- };
5
+ export const ErrorMessage = ({
6
+ children,
7
+ dataTest
8
+ }) => /*#__PURE__*/React.createElement("span", {
9
+ "data-test": `${dataTest}-error`,
10
+ className: _JSXStyle.dynamic([["3198585030", [colors.grey800, spacers.dp4, theme.error]]])
11
+ }, children, /*#__PURE__*/React.createElement(_JSXStyle, {
12
+ id: "3198585030",
13
+ dynamic: [colors.grey800, spacers.dp4, theme.error]
14
+ }, [`span.__jsx-style-dynamic-selector{font-size:14px;color:${colors.grey800};margin:${spacers.dp4};color:${theme.error};}`]));
18
15
  ErrorMessage.propTypes = {
19
16
  children: PropTypes.any.isRequired,
20
17
  dataTest: PropTypes.string.isRequired
@@ -9,18 +9,15 @@ import { SingleSelectionLabel } from './single-selection-label.js';
9
9
  * @param {bool} [props.loading]
10
10
  * @returns {React.Component}
11
11
  */
12
- export const DisabledSelectionLabel = _ref => {
13
- let {
14
- children,
15
- loading,
16
- onToggleOpen
17
- } = _ref;
18
- return /*#__PURE__*/React.createElement(SingleSelectionLabel, {
19
- checked: false,
20
- loading: loading,
21
- onChange: onToggleOpen
22
- }, children);
23
- };
12
+ export const DisabledSelectionLabel = ({
13
+ children,
14
+ loading,
15
+ onToggleOpen
16
+ }) => /*#__PURE__*/React.createElement(SingleSelectionLabel, {
17
+ checked: false,
18
+ loading: loading,
19
+ onChange: onToggleOpen
20
+ }, children);
24
21
  DisabledSelectionLabel.propTypes = {
25
22
  children: PropTypes.any.isRequired,
26
23
  onToggleOpen: PropTypes.func.isRequired,
@@ -1,28 +1,25 @@
1
1
  import _JSXStyle from "styled-jsx/style";
2
2
  import PropTypes from 'prop-types';
3
3
  import React from 'react';
4
- export const IconEmpty = _ref => {
5
- let {
6
- dataTest
7
- } = _ref;
8
- return /*#__PURE__*/React.createElement("svg", {
9
- height: "18px",
10
- version: "1.1",
11
- viewBox: "0 0 18 18",
12
- width: "18px",
13
- "data-test": `${dataTest}-iconempty`,
14
- className: "jsx-3201893673"
15
- }, /*#__PURE__*/React.createElement("g", {
16
- fill: "none",
17
- fillRule: "evenodd",
18
- id: "icon/empty",
19
- stroke: "none",
20
- strokeWidth: "1",
21
- className: "jsx-3201893673"
22
- }), /*#__PURE__*/React.createElement(_JSXStyle, {
23
- id: "3201893673"
24
- }, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
25
- };
4
+ export const IconEmpty = ({
5
+ dataTest
6
+ }) => /*#__PURE__*/React.createElement("svg", {
7
+ height: "18px",
8
+ version: "1.1",
9
+ viewBox: "0 0 18 18",
10
+ width: "18px",
11
+ "data-test": `${dataTest}-iconempty`,
12
+ className: "jsx-3201893673"
13
+ }, /*#__PURE__*/React.createElement("g", {
14
+ fill: "none",
15
+ fillRule: "evenodd",
16
+ id: "icon/empty",
17
+ stroke: "none",
18
+ strokeWidth: "1",
19
+ className: "jsx-3201893673"
20
+ }), /*#__PURE__*/React.createElement(_JSXStyle, {
21
+ id: "3201893673"
22
+ }, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
26
23
  IconEmpty.propTypes = {
27
24
  dataTest: PropTypes.string.isRequired
28
25
  };