@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.
- 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
|
@@ -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
|
-
|
|
22
|
-
|
|
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.
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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: (
|
|
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: (
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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: (
|
|
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: (
|
|
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.
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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 = (
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
|
-
|
|
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
|
-
|
|
178
|
-
|
|
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
|
-
|
|
193
|
-
|
|
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: (
|
|
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
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
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(
|
|
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(
|
|
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
|
-
|
|
61
|
-
|
|
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 =
|
|
59
|
-
cy.get(
|
|
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
|
|
25
|
+
return "/".concat(segments.slice(0, index + 1).join('/'));
|
|
26
26
|
});
|
|
27
27
|
return removeDuplicates(withSubPaths);
|
|
28
28
|
};
|
|
@@ -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(
|
|
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,
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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(
|
|
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
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
},
|
|
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
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
},
|
|
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 = {
|