@dhis2-ui/organisation-unit-tree 8.2.0 → 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.
Files changed (125) hide show
  1. package/build/cjs/__e2e__/children_as_child_nodes.stories.e2e.js +11 -8
  2. package/build/cjs/__e2e__/common.js +53 -43
  3. package/build/cjs/__e2e__/controlled_expanded.stories.e2e.js +10 -7
  4. package/build/cjs/__e2e__/displaying_loading_error.stories.e2e.js +5 -1
  5. package/build/cjs/__e2e__/expanded.stories.e2e.js +35 -26
  6. package/build/cjs/__e2e__/force_reload.stories.e2e.js +21 -14
  7. package/build/cjs/__e2e__/highlight.stories.e2e.js +10 -7
  8. package/build/cjs/__e2e__/loading_state.stories.e2e.js +14 -7
  9. package/build/cjs/__e2e__/multi_selection.stories.e2e.js +11 -8
  10. package/build/cjs/__e2e__/no_selection.stories.e2e.js +21 -15
  11. package/build/cjs/__e2e__/path_based_filtering.stories.e2e.js +23 -17
  12. package/build/cjs/__e2e__/single_selection.stories.e2e.js +17 -10
  13. package/build/cjs/__e2e__/sub_unit_as_root.stories.e2e.js +6 -5
  14. package/build/cjs/__e2e__/tree_api.stories.e2e.js +22 -15
  15. package/build/cjs/__stories__/custom-expanded-imperative-open.js +9 -6
  16. package/build/cjs/__stories__/custom-node-label.js +6 -4
  17. package/build/cjs/__stories__/development-stories.js +7 -6
  18. package/build/cjs/__stories__/loading-error-grandchild.js +5 -1
  19. package/build/cjs/__stories__/loading.js +5 -1
  20. package/build/cjs/__stories__/multiple-roots.js +12 -9
  21. package/build/cjs/__stories__/root-error.js +5 -1
  22. package/build/cjs/__stories__/root-loading.js +5 -1
  23. package/build/cjs/__stories__/shared.js +82 -45
  24. package/build/cjs/features/controlled_expanded/index.js +8 -5
  25. package/build/cjs/features/expanded/index.js +1 -7
  26. package/build/cjs/features/path_based_filtering/index.js +2 -2
  27. package/build/cjs/features/sub_unit_as_root/index.js +1 -7
  28. package/build/cjs/get-all-expanded-paths/get-all-expanded-paths.js +1 -1
  29. package/build/cjs/helpers/is-path-included.js +1 -1
  30. package/build/cjs/helpers/left-trim-to-root-id.js +1 -1
  31. package/build/cjs/organisation-unit-node/compute-child-nodes.js +1 -1
  32. package/build/cjs/organisation-unit-node/error-message.js +13 -10
  33. package/build/cjs/organisation-unit-node/has-descendant-selected-paths.js +1 -1
  34. package/build/cjs/organisation-unit-node/label/disabled-selection-label.js +12 -9
  35. package/build/cjs/organisation-unit-node/label/icon-empty.js +22 -19
  36. package/build/cjs/organisation-unit-node/label/icon-folder-closed.js +28 -25
  37. package/build/cjs/organisation-unit-node/label/icon-folder-open.js +37 -34
  38. package/build/cjs/organisation-unit-node/label/icon-single.js +31 -28
  39. package/build/cjs/organisation-unit-node/label/icon.js +8 -6
  40. package/build/cjs/organisation-unit-node/label/iconized-checkbox.js +14 -12
  41. package/build/cjs/organisation-unit-node/label/label-container.js +16 -13
  42. package/build/cjs/organisation-unit-node/label/label.js +31 -27
  43. package/build/cjs/organisation-unit-node/label/single-selection-label.js +21 -18
  44. package/build/cjs/organisation-unit-node/organisation-unit-node-children.js +32 -29
  45. package/build/cjs/organisation-unit-node/organisation-unit-node.js +26 -25
  46. package/build/cjs/organisation-unit-node/use-open-state.js +9 -8
  47. package/build/cjs/organisation-unit-node/use-org-children.js +13 -9
  48. package/build/cjs/organisation-unit-node/use-org-children.test.js +69 -46
  49. package/build/cjs/organisation-unit-node/use-org-data/use-org-data.js +22 -14
  50. package/build/cjs/organisation-unit-node/use-org-data/use-org-data.test.js +30 -18
  51. package/build/cjs/organisation-unit-tree/default-render-node-label/default-render-node-label.js +6 -3
  52. package/build/cjs/organisation-unit-tree/filter-root-ids.js +1 -1
  53. package/build/cjs/organisation-unit-tree/organisation-unit-tree.js +23 -22
  54. package/build/cjs/organisation-unit-tree/root-error.js +12 -9
  55. package/build/cjs/organisation-unit-tree/root-loading.js +13 -10
  56. package/build/cjs/organisation-unit-tree/use-expanded/create-expand-handlers.js +19 -14
  57. package/build/cjs/organisation-unit-tree/use-expanded/use-expanded.js +9 -8
  58. package/build/cjs/organisation-unit-tree/use-root-org-data/patch-missing-display-name.js +2 -1
  59. package/build/cjs/organisation-unit-tree/use-root-org-data/use-root-org-data.js +14 -10
  60. package/build/cjs/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +37 -20
  61. package/build/cjs/organisation-unit-tree.stories.js +32 -57
  62. package/build/cjs/prop-types.js +5 -5
  63. package/build/es/__e2e__/children_as_child_nodes.stories.e2e.js +11 -8
  64. package/build/es/__e2e__/common.js +52 -42
  65. package/build/es/__e2e__/controlled_expanded.stories.e2e.js +9 -6
  66. package/build/es/__e2e__/displaying_loading_error.stories.e2e.js +5 -1
  67. package/build/es/__e2e__/expanded.stories.e2e.js +34 -25
  68. package/build/es/__e2e__/force_reload.stories.e2e.js +21 -14
  69. package/build/es/__e2e__/highlight.stories.e2e.js +10 -7
  70. package/build/es/__e2e__/loading_state.stories.e2e.js +14 -7
  71. package/build/es/__e2e__/multi_selection.stories.e2e.js +11 -8
  72. package/build/es/__e2e__/no_selection.stories.e2e.js +21 -15
  73. package/build/es/__e2e__/path_based_filtering.stories.e2e.js +23 -17
  74. package/build/es/__e2e__/single_selection.stories.e2e.js +17 -10
  75. package/build/es/__e2e__/sub_unit_as_root.stories.e2e.js +5 -4
  76. package/build/es/__e2e__/tree_api.stories.e2e.js +22 -15
  77. package/build/es/__stories__/custom-expanded-imperative-open.js +9 -6
  78. package/build/es/__stories__/custom-node-label.js +6 -4
  79. package/build/es/__stories__/development-stories.js +6 -5
  80. package/build/es/__stories__/loading-error-grandchild.js +5 -1
  81. package/build/es/__stories__/loading.js +5 -1
  82. package/build/es/__stories__/multiple-roots.js +12 -9
  83. package/build/es/__stories__/root-error.js +5 -1
  84. package/build/es/__stories__/root-loading.js +5 -1
  85. package/build/es/__stories__/shared.js +82 -45
  86. package/build/es/features/controlled_expanded/index.js +8 -5
  87. package/build/es/features/expanded/index.js +1 -7
  88. package/build/es/features/path_based_filtering/index.js +2 -2
  89. package/build/es/features/sub_unit_as_root/index.js +1 -7
  90. package/build/es/get-all-expanded-paths/get-all-expanded-paths.js +1 -1
  91. package/build/es/helpers/is-path-included.js +1 -1
  92. package/build/es/helpers/left-trim-to-root-id.js +1 -1
  93. package/build/es/organisation-unit-node/compute-child-nodes.js +1 -1
  94. package/build/es/organisation-unit-node/error-message.js +13 -10
  95. package/build/es/organisation-unit-node/has-descendant-selected-paths.js +1 -1
  96. package/build/es/organisation-unit-node/label/disabled-selection-label.js +12 -9
  97. package/build/es/organisation-unit-node/label/icon-empty.js +22 -19
  98. package/build/es/organisation-unit-node/label/icon-folder-closed.js +28 -25
  99. package/build/es/organisation-unit-node/label/icon-folder-open.js +37 -34
  100. package/build/es/organisation-unit-node/label/icon-single.js +31 -28
  101. package/build/es/organisation-unit-node/label/icon.js +8 -6
  102. package/build/es/organisation-unit-node/label/iconized-checkbox.js +13 -12
  103. package/build/es/organisation-unit-node/label/label-container.js +16 -13
  104. package/build/es/organisation-unit-node/label/label.js +31 -27
  105. package/build/es/organisation-unit-node/label/single-selection-label.js +21 -18
  106. package/build/es/organisation-unit-node/organisation-unit-node-children.js +32 -29
  107. package/build/es/organisation-unit-node/organisation-unit-node.js +26 -25
  108. package/build/es/organisation-unit-node/use-open-state.js +9 -8
  109. package/build/es/organisation-unit-node/use-org-children.js +13 -9
  110. package/build/es/organisation-unit-node/use-org-children.test.js +69 -46
  111. package/build/es/organisation-unit-node/use-org-data/use-org-data.js +22 -14
  112. package/build/es/organisation-unit-node/use-org-data/use-org-data.test.js +30 -18
  113. package/build/es/organisation-unit-tree/default-render-node-label/default-render-node-label.js +6 -3
  114. package/build/es/organisation-unit-tree/filter-root-ids.js +1 -1
  115. package/build/es/organisation-unit-tree/organisation-unit-tree.js +23 -22
  116. package/build/es/organisation-unit-tree/root-error.js +12 -9
  117. package/build/es/organisation-unit-tree/root-loading.js +13 -10
  118. package/build/es/organisation-unit-tree/use-expanded/create-expand-handlers.js +19 -14
  119. package/build/es/organisation-unit-tree/use-expanded/use-expanded.js +9 -8
  120. package/build/es/organisation-unit-tree/use-root-org-data/patch-missing-display-name.js +2 -1
  121. package/build/es/organisation-unit-tree/use-root-org-data/use-root-org-data.js +14 -10
  122. package/build/es/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +37 -20
  123. package/build/es/organisation-unit-tree.stories.js +2 -27
  124. package/build/es/prop-types.js +4 -4
  125. package/package.json +5 -5
@@ -17,10 +17,12 @@ const CustomNodeLabel = () => /*#__PURE__*/_react.default.createElement(_index.O
17
17
  name: "Root org unit",
18
18
  roots: "A0000000000",
19
19
  initiallyExpanded: ['/A0000000000/A0000000001'],
20
- renderNodeLabel: ({
21
- label,
22
- node
23
- }) => {
20
+ renderNodeLabel: _ref => {
21
+ let {
22
+ label,
23
+ node
24
+ } = _ref;
25
+
24
26
  if (node.path !== '/A0000000000/A0000000001') {
25
27
  return label;
26
28
  }
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.DxWithRealBackend = exports.DxNoSelection = exports.DxSingleSelection = exports.DxMultiSelection = void 0;
6
+ exports.DxWithRealBackend = exports.DxSingleSelection = exports.DxNoSelection = exports.DxMultiSelection = void 0;
7
7
 
8
8
  var _appRuntime = require("@dhis2/app-runtime");
9
9
 
@@ -17,11 +17,12 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
17
17
 
18
18
  function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
19
19
 
20
- const DX_onChange = (selected, setSelected, singleSelection) => ({
21
- id,
22
- path,
23
- checked
24
- }) => {
20
+ const DX_onChange = (selected, setSelected, singleSelection) => _ref => {
21
+ let {
22
+ id,
23
+ path,
24
+ checked
25
+ } = _ref;
25
26
  console.log('onChange', {
26
27
  path,
27
28
  id,
@@ -17,7 +17,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
17
 
18
18
  const LoadingErrorGrandchild = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
19
19
  data: { ..._shared.customData,
20
- organisationUnits: (...args) => {
20
+ organisationUnits: function () {
21
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
+ args[_key] = arguments[_key];
23
+ }
24
+
21
25
  const [, {
22
26
  id
23
27
  }] = args;
@@ -17,7 +17,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
17
 
18
18
  const Loading = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
19
19
  data: { ..._shared.customData,
20
- organisationUnits: (...args) => {
20
+ organisationUnits: function () {
21
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
+ args[_key] = arguments[_key];
23
+ }
24
+
21
25
  const [, {
22
26
  id
23
27
  }] = args;
@@ -13,15 +13,18 @@ var _shared = require("./shared.js");
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
- const MultipleRoots = (_, {
17
- onChange,
18
- selected
19
- }) => /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
20
- selected: selected,
21
- onChange: onChange,
22
- roots: ['A0000000000', 'A0000000001'],
23
- initiallyExpanded: ['/A0000000000/A0000000001']
24
- });
16
+ const MultipleRoots = (_, _ref) => {
17
+ let {
18
+ onChange,
19
+ selected
20
+ } = _ref;
21
+ return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
22
+ selected: selected,
23
+ onChange: onChange,
24
+ roots: ['A0000000000', 'A0000000001'],
25
+ initiallyExpanded: ['/A0000000000/A0000000001']
26
+ });
27
+ };
25
28
 
26
29
  exports.MultipleRoots = MultipleRoots;
27
30
  MultipleRoots.decorators = [(0, _shared.createDecoratorStatefulMultiSelection)(), (0, _shared.createDecoratorCustomDataProvider)()];
@@ -17,7 +17,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
17
 
18
18
  const RootError = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
19
19
  data: { ..._shared.customData,
20
- organisationUnits: (...args) => {
20
+ organisationUnits: function () {
21
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
+ args[_key] = arguments[_key];
23
+ }
24
+
21
25
  const [, {
22
26
  id
23
27
  }] = args;
@@ -17,7 +17,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
17
17
 
18
18
  const RootLoading = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
19
19
  data: { ..._shared.customData,
20
- organisationUnits: (...args) => {
20
+ organisationUnits: function () {
21
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
22
+ args[_key] = arguments[_key];
23
+ }
24
+
21
25
  const [, {
22
26
  id
23
27
  }] = args;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.createDecoratorCustomDataProvider = exports.createDecoratorStatefulMultiSelection = exports.StatefulMultiSelectionWrapper = exports.customData = exports.getOrganisationUnitData = exports.onChildrenLoaded = exports.onCollapse = exports.onExpand = exports.onChange = exports.log = void 0;
6
+ exports.onExpand = exports.onCollapse = exports.onChildrenLoaded = exports.onChange = exports.log = exports.getOrganisationUnitData = exports.customData = exports.createDecoratorStatefulMultiSelection = exports.createDecoratorCustomDataProvider = exports.StatefulMultiSelectionWrapper = void 0;
7
7
 
8
8
  var _appRuntime = require("@dhis2/app-runtime");
9
9
 
@@ -20,48 +20,76 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
20
  const log = true;
21
21
  exports.log = log;
22
22
 
23
- const onChange = (...args) => log && console.log('onChange', ...args);
23
+ const onChange = function () {
24
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
25
+ args[_key] = arguments[_key];
26
+ }
27
+
28
+ return log && console.log('onChange', ...args);
29
+ };
24
30
 
25
31
  exports.onChange = onChange;
26
32
 
27
- const onExpand = (...args) => log && console.log('onExpand', ...args);
33
+ const onExpand = function () {
34
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
35
+ args[_key2] = arguments[_key2];
36
+ }
37
+
38
+ return log && console.log('onExpand', ...args);
39
+ };
28
40
 
29
41
  exports.onExpand = onExpand;
30
42
 
31
- const onCollapse = (...args) => log && console.log('onCollapse', ...args);
43
+ const onCollapse = function () {
44
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
45
+ args[_key3] = arguments[_key3];
46
+ }
47
+
48
+ return log && console.log('onCollapse', ...args);
49
+ };
32
50
 
33
51
  exports.onCollapse = onCollapse;
34
52
 
35
- const onChildrenLoaded = (...args) => log && console.log('onChildrenLoaded', ...args);
53
+ const onChildrenLoaded = function () {
54
+ for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
55
+ args[_key4] = arguments[_key4];
56
+ }
57
+
58
+ return log && console.log('onChildrenLoaded', ...args);
59
+ };
36
60
 
37
61
  exports.onChildrenLoaded = onChildrenLoaded;
38
62
 
39
- const createResponse = ({
40
- fields,
41
- id,
42
- path,
43
- displayName,
44
- children
45
- }) => ({ ...(fields.includes('id') ? {
46
- id
47
- } : {}),
48
- ...(fields.includes('path') ? {
49
- path
50
- } : {}),
51
- ...(fields.includes('displayName') ? {
52
- displayName
53
- } : {}),
54
- ...(fields.includes('children::size') ? {
55
- children: children.length
56
- } : {}),
57
- ...(fields.includes('children[id,path,displayName]') ? {
63
+ const createResponse = _ref => {
64
+ let {
65
+ fields,
66
+ id,
67
+ path,
68
+ displayName,
58
69
  children
59
- } : {})
60
- });
70
+ } = _ref;
71
+ return { ...(fields.includes('id') ? {
72
+ id
73
+ } : {}),
74
+ ...(fields.includes('path') ? {
75
+ path
76
+ } : {}),
77
+ ...(fields.includes('displayName') ? {
78
+ displayName
79
+ } : {}),
80
+ ...(fields.includes('children::size') ? {
81
+ children: children.length
82
+ } : {}),
83
+ ...(fields.includes('children[id,path,displayName]') ? {
84
+ children
85
+ } : {})
86
+ };
87
+ };
61
88
 
62
- const getOrganisationUnitData = (id, {
63
- fields
64
- }) => {
89
+ const getOrganisationUnitData = (id, _ref2) => {
90
+ let {
91
+ fields
92
+ } = _ref2;
65
93
  let data;
66
94
 
67
95
  if (id === 'A0000000000') {
@@ -173,10 +201,11 @@ const getOrganisationUnitData = (id, {
173
201
 
174
202
  exports.getOrganisationUnitData = getOrganisationUnitData;
175
203
  const customData = {
176
- organisationUnits: (_, {
177
- id,
178
- params = {}
179
- }) => {
204
+ organisationUnits: (_, _ref3) => {
205
+ let {
206
+ id,
207
+ params = {}
208
+ } = _ref3;
180
209
  const data = getOrganisationUnitData(id, params);
181
210
 
182
211
  if (!data) {
@@ -188,14 +217,19 @@ const customData = {
188
217
  };
189
218
  exports.customData = customData;
190
219
 
191
- const StatefulMultiSelectionWrapper = ({
192
- children,
193
- onSelectionChange = () => null
194
- }) => {
220
+ const StatefulMultiSelectionWrapper = _ref4 => {
221
+ let {
222
+ children,
223
+ onSelectionChange = () => null
224
+ } = _ref4;
195
225
  const [selected, setSelected] = (0, _react.useState)([]);
196
226
  return children({
197
227
  selected,
198
- onChange: (...args) => {
228
+ onChange: function () {
229
+ for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
230
+ args[_key5] = arguments[_key5];
231
+ }
232
+
199
233
  onChange(...args);
200
234
  const [{
201
235
  selected: newSelected
@@ -215,13 +249,16 @@ StatefulMultiSelectionWrapper.propTypes = {
215
249
  const createDecoratorStatefulMultiSelection = args => {
216
250
  return Story => /*#__PURE__*/_react.default.createElement(StatefulMultiSelectionWrapper, {
217
251
  onSelectionChange: args === null || args === void 0 ? void 0 : args.onSelectionChange
218
- }, ({
219
- selected,
220
- onChange
221
- }) => /*#__PURE__*/_react.default.createElement(Story, {
222
- selected: selected,
223
- onChange: onChange
224
- }));
252
+ }, _ref5 => {
253
+ let {
254
+ selected,
255
+ onChange
256
+ } = _ref5;
257
+ return /*#__PURE__*/_react.default.createElement(Story, {
258
+ selected: selected,
259
+ onChange: onChange
260
+ });
261
+ });
225
262
  };
226
263
 
227
264
  exports.createDecoratorStatefulMultiSelection = createDecoratorStatefulMultiSelection;
@@ -9,7 +9,7 @@ const expectOrgUnitsToBeDisplayed = ids => {
9
9
  fields: ['displayName']
10
10
  }).displayName);
11
11
  expandedLabels.forEach(label => {
12
- cy.get(`:contains("${label}")`).should('exist');
12
+ cy.get(":contains(\"".concat(label, "\")")).should('exist');
13
13
  });
14
14
  };
15
15
 
@@ -21,7 +21,7 @@ const expectOrgUnitsToNotBeDisplayed = ids => {
21
21
  return data.displayName;
22
22
  });
23
23
  expandedLabels.forEach(label => {
24
- cy.get(`:contains("${label}")`).should('not.exist');
24
+ cy.get(":contains(\"".concat(label, "\")")).should('not.exist');
25
25
  });
26
26
  };
27
27
 
@@ -56,9 +56,12 @@ const expectOrgUnitsToNotBeDisplayed = ids => {
56
56
  const curData = (0, _common.getOrganisationUnitData)(cur, {
57
57
  fields: ['children[id,path,displayName]']
58
58
  });
59
- const childrenIds = curData.children.map(({
60
- id
61
- }) => id);
59
+ const childrenIds = curData.children.map(_ref => {
60
+ let {
61
+ id
62
+ } = _ref;
63
+ return id;
64
+ });
62
65
  return [...acc, ...childrenIds];
63
66
  }, []);
64
67
  expectOrgUnitsToNotBeDisplayed(hiddenChildrenIds);
@@ -3,13 +3,7 @@
3
3
  var _steps = require("cypress-cucumber-preprocessor/steps");
4
4
 
5
5
  const getRootOrgUnitByLabel = label => {
6
- const rootOrgUnitLabelSelector = `
7
- [data-test="dhis2-uiwidgets-orgunittree"]
8
- > [data-test="dhis2-uiwidgets-orgunittree-node"]
9
- > [data-test="dhis2-uiwidgets-orgunittree-node-content"]
10
- > [data-test="dhis2-uiwidgets-orgunittree-node-label"]
11
- label
12
- `;
6
+ const rootOrgUnitLabelSelector = "\n [data-test=\"dhis2-uiwidgets-orgunittree\"]\n > [data-test=\"dhis2-uiwidgets-orgunittree-node\"]\n > [data-test=\"dhis2-uiwidgets-orgunittree-node-content\"]\n > [data-test=\"dhis2-uiwidgets-orgunittree-node-label\"]\n label\n ";
13
7
  return cy.contains(rootOrgUnitLabelSelector, label).parents('[data-test="dhis2-uiwidgets-orgunittree-node"]');
14
8
  };
15
9
 
@@ -55,8 +55,8 @@ const addDisplayedUnit = id => {
55
55
  cy.window().then(win => {
56
56
  const excludedUnitNumbers = win.allUnits.filter(unit => !displayedUnits.includes(unit)).map(id => parseInt(id.replace(/^.*(\d)$/, '$1'), 10) + 1);
57
57
  excludedUnitNumbers.forEach(number => {
58
- const label = `Org Unit ${number}`;
59
- cy.get(`[data-test="dhis2-uiwidgets-orgunittree-node-label"]:contains("${label}")`).should('not.exist');
58
+ const label = "Org Unit ".concat(number);
59
+ cy.get("[data-test=\"dhis2-uiwidgets-orgunittree-node-label\"]:contains(\"".concat(label, "\")")).should('not.exist');
60
60
  });
61
61
  });
62
62
  });
@@ -2,13 +2,7 @@
2
2
 
3
3
  var _steps = require("cypress-cucumber-preprocessor/steps");
4
4
 
5
- const rootOrgUnitLabelSelector = `
6
- [data-test="dhis2-uiwidgets-orgunittree"]
7
- > [data-test="dhis2-uiwidgets-orgunittree-node"]
8
- > [data-test="dhis2-uiwidgets-orgunittree-node-content"]
9
- > [data-test="dhis2-uiwidgets-orgunittree-node-label"]
10
- label
11
- `;
5
+ const rootOrgUnitLabelSelector = "\n [data-test=\"dhis2-uiwidgets-orgunittree\"]\n > [data-test=\"dhis2-uiwidgets-orgunittree-node\"]\n > [data-test=\"dhis2-uiwidgets-orgunittree-node-content\"]\n > [data-test=\"dhis2-uiwidgets-orgunittree-node-label\"]\n label\n";
12
6
  (0, _steps.Given)('a sub org unit is a root org unit', () => {
13
7
  cy.visitStory('OrganisationUnitTree', 'multiple root sub and one main org unit');
14
8
  });
@@ -22,7 +22,7 @@ const extractAllPathsFromPath = path => {
22
22
  const segments = path.replace(/^\//, '').split('/');
23
23
  const withSubPaths = segments.map((segment, index) => {
24
24
  // take all segments from 0 to index and join them with the delimiter
25
- return `/${segments.slice(0, index + 1).join('/')}`;
25
+ return "/".concat(segments.slice(0, index + 1).join('/'));
26
26
  });
27
27
  return removeDuplicates(withSubPaths);
28
28
  };
@@ -16,7 +16,7 @@ const isPathIncluded = (includedPaths, path) => {
16
16
  return true;
17
17
  }
18
18
 
19
- return includedPath.startsWith(`${path}/`);
19
+ return includedPath.startsWith("".concat(path, "/"));
20
20
  });
21
21
  return isIncluded;
22
22
  };
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.leftTrimToRootId = void 0;
7
7
 
8
8
  const leftTrimToRootId = (path, rootId) => {
9
- return path.replace(new RegExp(`^.*(/${rootId})`), '$1');
9
+ return path.replace(new RegExp("^.*(/".concat(rootId, ")")), '$1');
10
10
  };
11
11
 
12
12
  exports.leftTrimToRootId = leftTrimToRootId;
@@ -29,7 +29,7 @@ const computeChildNodes = (node, filter) => {
29
29
  }
30
30
 
31
31
  return node.children.filter(child => {
32
- return (0, _index.isPathIncluded)(filter, `${node.path}/${child.id}`);
32
+ return (0, _index.isPathIncluded)(filter, "".concat(node.path, "/").concat(child.id));
33
33
  });
34
34
  };
35
35
 
@@ -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 ErrorMessage = ({
19
- children,
20
- dataTest
21
- }) => /*#__PURE__*/_react.default.createElement("span", {
22
- "data-test": `${dataTest}-error`,
23
- className: _style.default.dynamic([["3198585030", [_uiConstants.colors.grey800, _uiConstants.spacers.dp4, _uiConstants.theme.error]]])
24
- }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
25
- id: "3198585030",
26
- dynamic: [_uiConstants.colors.grey800, _uiConstants.spacers.dp4, _uiConstants.theme.error]
27
- }, [`span.__jsx-style-dynamic-selector{font-size:14px;color:${_uiConstants.colors.grey800};margin:${_uiConstants.spacers.dp4};color:${_uiConstants.theme.error};}`]));
18
+ const ErrorMessage = _ref => {
19
+ let {
20
+ children,
21
+ dataTest
22
+ } = _ref;
23
+ return /*#__PURE__*/_react.default.createElement("span", {
24
+ "data-test": "".concat(dataTest, "-error"),
25
+ className: _style.default.dynamic([["3198585030", [_uiConstants.colors.grey800, _uiConstants.spacers.dp4, _uiConstants.theme.error]]])
26
+ }, children, /*#__PURE__*/_react.default.createElement(_style.default, {
27
+ id: "3198585030",
28
+ dynamic: [_uiConstants.colors.grey800, _uiConstants.spacers.dp4, _uiConstants.theme.error]
29
+ }, ["span.__jsx-style-dynamic-selector{font-size:14px;color:".concat(_uiConstants.colors.grey800, ";margin:").concat(_uiConstants.spacers.dp4, ";color:").concat(_uiConstants.theme.error, ";}")]));
30
+ };
28
31
 
29
32
  exports.ErrorMessage = ErrorMessage;
30
33
  ErrorMessage.propTypes = {
@@ -15,7 +15,7 @@ exports.hasDescendantSelectedPaths = void 0;
15
15
  */
16
16
  const hasDescendantSelectedPaths = (path, selected) => {
17
17
  return selected.some(selectedPath => {
18
- const isNotPath = !selectedPath.match(new RegExp(`${path}$`));
18
+ const isNotPath = !selectedPath.match(new RegExp("".concat(path, "$")));
19
19
  const isSubPath = selectedPath.match(new RegExp(path));
20
20
  return isNotPath && isSubPath;
21
21
  });
@@ -20,15 +20,18 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
20
  * @param {bool} [props.loading]
21
21
  * @returns {React.Component}
22
22
  */
23
- const DisabledSelectionLabel = ({
24
- children,
25
- loading,
26
- onToggleOpen
27
- }) => /*#__PURE__*/_react.default.createElement(_singleSelectionLabel.SingleSelectionLabel, {
28
- checked: false,
29
- loading: loading,
30
- onChange: onToggleOpen
31
- }, children);
23
+ const DisabledSelectionLabel = _ref => {
24
+ let {
25
+ children,
26
+ loading,
27
+ onToggleOpen
28
+ } = _ref;
29
+ return /*#__PURE__*/_react.default.createElement(_singleSelectionLabel.SingleSelectionLabel, {
30
+ checked: false,
31
+ loading: loading,
32
+ onChange: onToggleOpen
33
+ }, children);
34
+ };
32
35
 
33
36
  exports.DisabledSelectionLabel = DisabledSelectionLabel;
34
37
  DisabledSelectionLabel.propTypes = {
@@ -13,25 +13,28 @@ var _react = _interopRequireDefault(require("react"));
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
- const IconEmpty = ({
17
- dataTest
18
- }) => /*#__PURE__*/_react.default.createElement("svg", {
19
- height: "18px",
20
- version: "1.1",
21
- viewBox: "0 0 18 18",
22
- width: "18px",
23
- "data-test": `${dataTest}-iconempty`,
24
- className: "jsx-3201893673"
25
- }, /*#__PURE__*/_react.default.createElement("g", {
26
- fill: "none",
27
- fillRule: "evenodd",
28
- id: "icon/empty",
29
- stroke: "none",
30
- strokeWidth: "1",
31
- className: "jsx-3201893673"
32
- }), /*#__PURE__*/_react.default.createElement(_style.default, {
33
- id: "3201893673"
34
- }, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
16
+ const IconEmpty = _ref => {
17
+ let {
18
+ dataTest
19
+ } = _ref;
20
+ return /*#__PURE__*/_react.default.createElement("svg", {
21
+ height: "18px",
22
+ version: "1.1",
23
+ viewBox: "0 0 18 18",
24
+ width: "18px",
25
+ "data-test": "".concat(dataTest, "-iconempty"),
26
+ className: "jsx-3201893673"
27
+ }, /*#__PURE__*/_react.default.createElement("g", {
28
+ fill: "none",
29
+ fillRule: "evenodd",
30
+ id: "icon/empty",
31
+ stroke: "none",
32
+ strokeWidth: "1",
33
+ className: "jsx-3201893673"
34
+ }), /*#__PURE__*/_react.default.createElement(_style.default, {
35
+ id: "3201893673"
36
+ }, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
37
+ };
35
38
 
36
39
  exports.IconEmpty = IconEmpty;
37
40
  IconEmpty.propTypes = {
@@ -13,31 +13,34 @@ var _react = _interopRequireDefault(require("react"));
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
- const IconFolderClosed = ({
17
- dataTest
18
- }) => /*#__PURE__*/_react.default.createElement("svg", {
19
- width: "18px",
20
- height: "18px",
21
- viewBox: "0 0 18 18",
22
- version: "1.1",
23
- "data-test": `${dataTest}-iconfolderclosed`,
24
- className: "jsx-3201893673"
25
- }, /*#__PURE__*/_react.default.createElement("g", {
26
- id: "icon/folder/closed",
27
- stroke: "none",
28
- strokeWidth: "1",
29
- fill: "none",
30
- fillRule: "evenodd",
31
- className: "jsx-3201893673"
32
- }, /*#__PURE__*/_react.default.createElement("path", {
33
- d: "M2,3.5 C1.17157288,3.5 0.5,4.17157288 0.5,5 L0.5,13 C0.5,13.8284271 1.17157288,14.5 2,14.5 L12,14.5 C12.8284271,14.5 13.5,13.8284271 13.5,13 L13.5,7 C13.5,6.17157288 12.8284271,5.5 12,5.5 L6.69098301,5.5 L5.82917961,3.7763932 C5.7444836,3.60700119 5.57135204,3.5 5.38196601,3.5 L2,3.5 Z",
34
- id: "Path-2",
35
- stroke: "#6E7A8A",
36
- fill: "#D5DDE5",
37
- className: "jsx-3201893673"
38
- })), /*#__PURE__*/_react.default.createElement(_style.default, {
39
- id: "3201893673"
40
- }, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
16
+ const IconFolderClosed = _ref => {
17
+ let {
18
+ dataTest
19
+ } = _ref;
20
+ return /*#__PURE__*/_react.default.createElement("svg", {
21
+ width: "18px",
22
+ height: "18px",
23
+ viewBox: "0 0 18 18",
24
+ version: "1.1",
25
+ "data-test": "".concat(dataTest, "-iconfolderclosed"),
26
+ className: "jsx-3201893673"
27
+ }, /*#__PURE__*/_react.default.createElement("g", {
28
+ id: "icon/folder/closed",
29
+ stroke: "none",
30
+ strokeWidth: "1",
31
+ fill: "none",
32
+ fillRule: "evenodd",
33
+ className: "jsx-3201893673"
34
+ }, /*#__PURE__*/_react.default.createElement("path", {
35
+ d: "M2,3.5 C1.17157288,3.5 0.5,4.17157288 0.5,5 L0.5,13 C0.5,13.8284271 1.17157288,14.5 2,14.5 L12,14.5 C12.8284271,14.5 13.5,13.8284271 13.5,13 L13.5,7 C13.5,6.17157288 12.8284271,5.5 12,5.5 L6.69098301,5.5 L5.82917961,3.7763932 C5.7444836,3.60700119 5.57135204,3.5 5.38196601,3.5 L2,3.5 Z",
36
+ id: "Path-2",
37
+ stroke: "#6E7A8A",
38
+ fill: "#D5DDE5",
39
+ className: "jsx-3201893673"
40
+ })), /*#__PURE__*/_react.default.createElement(_style.default, {
41
+ id: "3201893673"
42
+ }, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
43
+ };
41
44
 
42
45
  exports.IconFolderClosed = IconFolderClosed;
43
46
  IconFolderClosed.propTypes = {