@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
|
@@ -2,16 +2,19 @@ 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 =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
export const ErrorMessage = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
dataTest
|
|
9
|
+
} = _ref;
|
|
10
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
11
|
+
"data-test": "".concat(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:".concat(colors.grey800, ";margin:").concat(spacers.dp4, ";color:").concat(theme.error, ";}")]));
|
|
17
|
+
};
|
|
15
18
|
ErrorMessage.propTypes = {
|
|
16
19
|
children: PropTypes.any.isRequired,
|
|
17
20
|
dataTest: PropTypes.string.isRequired
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export const hasDescendantSelectedPaths = (path, selected) => {
|
|
10
10
|
return selected.some(selectedPath => {
|
|
11
|
-
const isNotPath = !selectedPath.match(new RegExp(
|
|
11
|
+
const isNotPath = !selectedPath.match(new RegExp("".concat(path, "$")));
|
|
12
12
|
const isSubPath = selectedPath.match(new RegExp(path));
|
|
13
13
|
return isNotPath && isSubPath;
|
|
14
14
|
});
|
|
@@ -9,15 +9,18 @@ import { SingleSelectionLabel } from './single-selection-label.js';
|
|
|
9
9
|
* @returns {React.Component}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
export const DisabledSelectionLabel =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
};
|
|
21
24
|
DisabledSelectionLabel.propTypes = {
|
|
22
25
|
children: PropTypes.any.isRequired,
|
|
23
26
|
onToggleOpen: PropTypes.func.isRequired,
|
|
@@ -1,25 +1,28 @@
|
|
|
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 =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
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": "".concat(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
|
+
};
|
|
23
26
|
IconEmpty.propTypes = {
|
|
24
27
|
dataTest: PropTypes.string.isRequired
|
|
25
28
|
};
|
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
export const IconFolderClosed =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
4
|
+
export const IconFolderClosed = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
dataTest
|
|
7
|
+
} = _ref;
|
|
8
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
9
|
+
width: "18px",
|
|
10
|
+
height: "18px",
|
|
11
|
+
viewBox: "0 0 18 18",
|
|
12
|
+
version: "1.1",
|
|
13
|
+
"data-test": "".concat(dataTest, "-iconfolderclosed"),
|
|
14
|
+
className: "jsx-3201893673"
|
|
15
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
16
|
+
id: "icon/folder/closed",
|
|
17
|
+
stroke: "none",
|
|
18
|
+
strokeWidth: "1",
|
|
19
|
+
fill: "none",
|
|
20
|
+
fillRule: "evenodd",
|
|
21
|
+
className: "jsx-3201893673"
|
|
22
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
23
|
+
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",
|
|
24
|
+
id: "Path-2",
|
|
25
|
+
stroke: "#6E7A8A",
|
|
26
|
+
fill: "#D5DDE5",
|
|
27
|
+
className: "jsx-3201893673"
|
|
28
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
29
|
+
id: "3201893673"
|
|
30
|
+
}, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
|
|
31
|
+
};
|
|
29
32
|
IconFolderClosed.propTypes = {
|
|
30
33
|
dataTest: PropTypes.string.isRequired
|
|
31
34
|
};
|
|
@@ -1,40 +1,43 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
export const IconFolderOpen =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
4
|
+
export const IconFolderOpen = _ref => {
|
|
5
|
+
let {
|
|
6
|
+
dataTest
|
|
7
|
+
} = _ref;
|
|
8
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
9
|
+
width: "18px",
|
|
10
|
+
height: "18px",
|
|
11
|
+
viewBox: "0 0 18 18",
|
|
12
|
+
version: "1.1",
|
|
13
|
+
"data-test": "".concat(dataTest, "-iconfolderopen"),
|
|
14
|
+
className: "jsx-2091325045"
|
|
15
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
16
|
+
id: "icon/folder/open",
|
|
17
|
+
stroke: "none",
|
|
18
|
+
strokeWidth: "1",
|
|
19
|
+
fill: "none",
|
|
20
|
+
fillRule: "evenodd",
|
|
21
|
+
className: "jsx-2091325045"
|
|
22
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
23
|
+
id: "Group",
|
|
24
|
+
transform: "translate(0.000000, 3.000000)",
|
|
25
|
+
stroke: "#6E7A8A",
|
|
26
|
+
className: "jsx-2091325045"
|
|
27
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
28
|
+
d: "M2,0.5 C1.17157288,0.5 0.5,1.17157288 0.5,2 L0.5,10 C0.5,10.8284271 1.17157288,11.5 2,11.5 L12,11.5 C12.8284271,11.5 13.5,10.8284271 13.5,10 L13.5,4 C13.5,3.17157288 12.8284271,2.5 12,2.5 L6.69098301,2.5 L5.82917961,0.776393202 C5.7444836,0.607001188 5.57135204,0.5 5.38196601,0.5 L2,0.5 Z",
|
|
29
|
+
id: "Path-2",
|
|
30
|
+
fill: "#A0ADBA",
|
|
31
|
+
className: "jsx-2091325045"
|
|
32
|
+
}), /*#__PURE__*/React.createElement("path", {
|
|
33
|
+
d: "M1.53632259,10.7093809 C1.47575089,10.7941813 1.44318932,10.8957885 1.44318932,11 C1.44318932,11.2761424 1.66704695,11.5 1.94318932,11.5 L12.4853821,11.5 C12.6468577,11.5 12.7983931,11.4220172 12.8922488,11.2906191 L16.4636774,6.2906191 C16.5242491,6.20581872 16.5568107,6.10421149 16.5568107,6 C16.5568107,5.72385763 16.3329531,5.5 16.0568107,5.5 L5.5146179,5.5 C5.35314234,5.5 5.20160692,5.57798284 5.10775116,5.7093809 L1.53632259,10.7093809 Z",
|
|
34
|
+
id: "Path-3",
|
|
35
|
+
fill: "#FBFCFD",
|
|
36
|
+
className: "jsx-2091325045"
|
|
37
|
+
}))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
38
|
+
id: "2091325045"
|
|
39
|
+
}, ["svg.jsx-2091325045{margin:3px 0;display:block;}"]));
|
|
40
|
+
};
|
|
38
41
|
IconFolderOpen.propTypes = {
|
|
39
42
|
dataTest: PropTypes.string.isRequired
|
|
40
43
|
};
|
|
@@ -1,34 +1,37 @@
|
|
|
1
1
|
import _JSXStyle from "styled-jsx/style";
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
export const IconSingle =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
4
|
+
export const IconSingle = _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": "".concat(dataTest, "-iconsingle"),
|
|
14
|
+
className: "jsx-3201893673"
|
|
15
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
16
|
+
fill: "none",
|
|
17
|
+
fillRule: "evenodd",
|
|
18
|
+
id: "icon/single",
|
|
19
|
+
stroke: "none",
|
|
20
|
+
strokeWidth: "1",
|
|
21
|
+
className: "jsx-3201893673"
|
|
22
|
+
}, /*#__PURE__*/React.createElement("rect", {
|
|
23
|
+
fill: "#A0ADBA",
|
|
24
|
+
height: "4",
|
|
25
|
+
id: "Rectangle",
|
|
26
|
+
rx: "1",
|
|
27
|
+
width: "4",
|
|
28
|
+
x: "7",
|
|
29
|
+
y: "7",
|
|
30
|
+
className: "jsx-3201893673"
|
|
31
|
+
})), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
32
|
+
id: "3201893673"
|
|
33
|
+
}, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
|
|
34
|
+
};
|
|
32
35
|
IconSingle.propTypes = {
|
|
33
36
|
dataTest: PropTypes.string.isRequired
|
|
34
37
|
};
|
|
@@ -11,12 +11,14 @@ import { IconSingle } from './icon-single.js';
|
|
|
11
11
|
* @returns {React.Component}
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
export const Icon =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
export const Icon = _ref => {
|
|
15
|
+
let {
|
|
16
|
+
loading,
|
|
17
|
+
hasChildren,
|
|
18
|
+
open,
|
|
19
|
+
dataTest
|
|
20
|
+
} = _ref;
|
|
21
|
+
|
|
20
22
|
if (loading) {
|
|
21
23
|
return /*#__PURE__*/React.createElement(IconEmpty, {
|
|
22
24
|
dataTest: dataTest
|
|
@@ -3,18 +3,19 @@ import { Checkbox } from '@dhis2-ui/checkbox';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { Icon } from './icon.js';
|
|
6
|
-
export const IconizedCheckbox =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
6
|
+
export const IconizedCheckbox = _ref => {
|
|
7
|
+
let {
|
|
8
|
+
checked,
|
|
9
|
+
dataTest,
|
|
10
|
+
hasChildren,
|
|
11
|
+
indeterminate,
|
|
12
|
+
children,
|
|
13
|
+
loading,
|
|
14
|
+
name,
|
|
15
|
+
open,
|
|
16
|
+
value,
|
|
17
|
+
onChange
|
|
18
|
+
} = _ref;
|
|
18
19
|
const icon = /*#__PURE__*/React.createElement(Icon, {
|
|
19
20
|
loading: loading,
|
|
20
21
|
open: open,
|
|
@@ -10,19 +10,22 @@ import React from 'react';
|
|
|
10
10
|
* @returns {React.Component}
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
export const LabelContainer =
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
export const LabelContainer = _ref => {
|
|
14
|
+
let {
|
|
15
|
+
highlighted,
|
|
16
|
+
children
|
|
17
|
+
} = _ref;
|
|
18
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
19
|
+
className: _JSXStyle.dynamic([["495975020", [colors.teal200]]]) + " " + (cx({
|
|
20
|
+
highlighted
|
|
21
|
+
}) || "")
|
|
22
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
23
|
+
className: _JSXStyle.dynamic([["495975020", [colors.teal200]]])
|
|
24
|
+
}, children), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
25
|
+
id: "495975020",
|
|
26
|
+
dynamic: [colors.teal200]
|
|
27
|
+
}, ["div.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}", "span.__jsx-style-dynamic-selector{display:block;}", ".highlighted.__jsx-style-dynamic-selector{background:".concat(colors.teal200, ";padding-right:4px;}")]));
|
|
28
|
+
};
|
|
26
29
|
LabelContainer.propTypes = {
|
|
27
30
|
children: PropTypes.node,
|
|
28
31
|
highlighted: PropTypes.bool
|
|
@@ -6,12 +6,13 @@ import { IconizedCheckbox } from './iconized-checkbox.js';
|
|
|
6
6
|
import { LabelContainer } from './label-container.js';
|
|
7
7
|
import { SingleSelectionLabel } from './single-selection-label.js';
|
|
8
8
|
|
|
9
|
-
const createNewSelected =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
const createNewSelected = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
selected,
|
|
12
|
+
path,
|
|
13
|
+
checked,
|
|
14
|
+
singleSelection
|
|
15
|
+
} = _ref;
|
|
15
16
|
const pathIndex = selected.indexOf(path);
|
|
16
17
|
|
|
17
18
|
if (checked && pathIndex !== -1) {
|
|
@@ -43,27 +44,30 @@ const createNewSelected = ({
|
|
|
43
44
|
return [...prevSlice, ...nextSlice];
|
|
44
45
|
};
|
|
45
46
|
|
|
46
|
-
const Label =
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
47
|
+
const Label = _ref2 => {
|
|
48
|
+
let {
|
|
49
|
+
checked,
|
|
50
|
+
children,
|
|
51
|
+
dataTest,
|
|
52
|
+
disableSelection,
|
|
53
|
+
fullPath,
|
|
54
|
+
hasChildren,
|
|
55
|
+
hasSelectedDescendants,
|
|
56
|
+
highlighted,
|
|
57
|
+
loading,
|
|
58
|
+
node,
|
|
59
|
+
onChange,
|
|
60
|
+
onToggleOpen,
|
|
61
|
+
open,
|
|
62
|
+
rootId,
|
|
63
|
+
selected,
|
|
64
|
+
singleSelection
|
|
65
|
+
} = _ref2;
|
|
66
|
+
|
|
67
|
+
const onClick = (_ref3, event) => {
|
|
68
|
+
let {
|
|
69
|
+
checked
|
|
70
|
+
} = _ref3;
|
|
67
71
|
const newSelected = createNewSelected({
|
|
68
72
|
path: fullPath,
|
|
69
73
|
selected,
|
|
@@ -12,26 +12,29 @@ import React from 'react';
|
|
|
12
12
|
* @returns {React.Component}
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
|
-
export const SingleSelectionLabel =
|
|
16
|
-
|
|
17
|
-
children,
|
|
18
|
-
onChange,
|
|
19
|
-
loading
|
|
20
|
-
}) => /*#__PURE__*/React.createElement("span", {
|
|
21
|
-
onClick: event => {
|
|
22
|
-
const payload = {
|
|
23
|
-
checked: !checked
|
|
24
|
-
};
|
|
25
|
-
onChange(payload, event);
|
|
26
|
-
},
|
|
27
|
-
className: _JSXStyle.dynamic([["321503310", [colors.grey900, colors.teal700]]]) + " " + (cx({
|
|
15
|
+
export const SingleSelectionLabel = _ref => {
|
|
16
|
+
let {
|
|
28
17
|
checked,
|
|
18
|
+
children,
|
|
19
|
+
onChange,
|
|
29
20
|
loading
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
} = _ref;
|
|
22
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
23
|
+
onClick: event => {
|
|
24
|
+
const payload = {
|
|
25
|
+
checked: !checked
|
|
26
|
+
};
|
|
27
|
+
onChange(payload, event);
|
|
28
|
+
},
|
|
29
|
+
className: _JSXStyle.dynamic([["321503310", [colors.grey900, colors.teal700]]]) + " " + (cx({
|
|
30
|
+
checked,
|
|
31
|
+
loading
|
|
32
|
+
}) || "")
|
|
33
|
+
}, children, /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
34
|
+
id: "321503310",
|
|
35
|
+
dynamic: [colors.grey900, colors.teal700]
|
|
36
|
+
}, ["span.__jsx-style-dynamic-selector{background:transparent;border-radius:3px;color:".concat(colors.grey900, ";cursor:pointer;display:inline-block;font-size:14px;line-height:24px;padding:0 5px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap;}"), ".checked.__jsx-style-dynamic-selector{background:".concat(colors.teal700, ";color:white;}"), ".loading.__jsx-style-dynamic-selector{cursor:auto;}"]));
|
|
37
|
+
};
|
|
35
38
|
SingleSelectionLabel.propTypes = {
|
|
36
39
|
children: PropTypes.any.isRequired,
|
|
37
40
|
checked: PropTypes.bool,
|
|
@@ -6,41 +6,44 @@ import { orgUnitPathPropType } from '../prop-types.js';
|
|
|
6
6
|
import { LoadingSpinner } from './loading-spinner.js';
|
|
7
7
|
import { useOrgChildren } from './use-org-children.js';
|
|
8
8
|
|
|
9
|
-
const getFilteredChildren =
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
const getFilteredChildren = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
orgChildren,
|
|
12
|
+
filter,
|
|
13
|
+
node
|
|
14
|
+
} = _ref;
|
|
15
|
+
|
|
14
16
|
if (!(filter !== null && filter !== void 0 && filter.length)) {
|
|
15
17
|
return orgChildren;
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
return orgChildren.filter(child => {
|
|
19
|
-
return isPathIncluded(filter,
|
|
21
|
+
return isPathIncluded(filter, "".concat(node.path, "/").concat(child.id));
|
|
20
22
|
});
|
|
21
23
|
};
|
|
22
24
|
|
|
23
|
-
export const OrganisationUnitNodeChildren =
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
25
|
+
export const OrganisationUnitNodeChildren = _ref2 => {
|
|
26
|
+
let {
|
|
27
|
+
node,
|
|
28
|
+
autoExpandLoadingError,
|
|
29
|
+
dataTest,
|
|
30
|
+
disableSelection,
|
|
31
|
+
expanded,
|
|
32
|
+
filter,
|
|
33
|
+
highlighted,
|
|
34
|
+
isUserDataViewFallback,
|
|
35
|
+
onChange,
|
|
36
|
+
onChildrenLoaded,
|
|
37
|
+
onCollapse,
|
|
38
|
+
onExpand,
|
|
39
|
+
parentPath,
|
|
40
|
+
renderNodeLabel,
|
|
41
|
+
rootId,
|
|
42
|
+
selected,
|
|
43
|
+
singleSelection,
|
|
44
|
+
suppressAlphabeticalSorting,
|
|
45
|
+
OrganisationUnitNode
|
|
46
|
+
} = _ref2;
|
|
44
47
|
const orgChildren = useOrgChildren({
|
|
45
48
|
node,
|
|
46
49
|
isUserDataViewFallback,
|
|
@@ -53,8 +56,8 @@ export const OrganisationUnitNodeChildren = ({
|
|
|
53
56
|
filter,
|
|
54
57
|
node
|
|
55
58
|
}) : [];
|
|
56
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, orgChildren.loading && /*#__PURE__*/React.createElement(LoadingSpinner, null), orgChildren.error &&
|
|
57
|
-
const childPath =
|
|
59
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, orgChildren.loading && /*#__PURE__*/React.createElement(LoadingSpinner, null), orgChildren.error && "Error: ".concat(orgChildren.error), displayChildren && !filteredChildren.length && i18n.t('No children match filter'), !!filteredChildren.length && filteredChildren.map(child => {
|
|
60
|
+
const childPath = "".concat(parentPath, "/").concat(child.id);
|
|
58
61
|
return /*#__PURE__*/React.createElement(OrganisationUnitNode, {
|
|
59
62
|
autoExpandLoadingError: autoExpandLoadingError,
|
|
60
63
|
dataTest: dataTest,
|