@dhis2-ui/organisation-unit-tree 8.1.10 → 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
|
@@ -13,40 +13,43 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
const IconFolderOpen =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
16
|
+
const IconFolderOpen = _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, "-iconfolderopen"),
|
|
26
|
+
className: "jsx-2091325045"
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement("g", {
|
|
28
|
+
id: "icon/folder/open",
|
|
29
|
+
stroke: "none",
|
|
30
|
+
strokeWidth: "1",
|
|
31
|
+
fill: "none",
|
|
32
|
+
fillRule: "evenodd",
|
|
33
|
+
className: "jsx-2091325045"
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement("g", {
|
|
35
|
+
id: "Group",
|
|
36
|
+
transform: "translate(0.000000, 3.000000)",
|
|
37
|
+
stroke: "#6E7A8A",
|
|
38
|
+
className: "jsx-2091325045"
|
|
39
|
+
}, /*#__PURE__*/_react.default.createElement("path", {
|
|
40
|
+
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",
|
|
41
|
+
id: "Path-2",
|
|
42
|
+
fill: "#A0ADBA",
|
|
43
|
+
className: "jsx-2091325045"
|
|
44
|
+
}), /*#__PURE__*/_react.default.createElement("path", {
|
|
45
|
+
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",
|
|
46
|
+
id: "Path-3",
|
|
47
|
+
fill: "#FBFCFD",
|
|
48
|
+
className: "jsx-2091325045"
|
|
49
|
+
}))), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
50
|
+
id: "2091325045"
|
|
51
|
+
}, ["svg.jsx-2091325045{margin:3px 0;display:block;}"]));
|
|
52
|
+
};
|
|
50
53
|
|
|
51
54
|
exports.IconFolderOpen = IconFolderOpen;
|
|
52
55
|
IconFolderOpen.propTypes = {
|
|
@@ -13,34 +13,37 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
const IconSingle =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
16
|
+
const IconSingle = _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, "-iconsingle"),
|
|
26
|
+
className: "jsx-3201893673"
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement("g", {
|
|
28
|
+
fill: "none",
|
|
29
|
+
fillRule: "evenodd",
|
|
30
|
+
id: "icon/single",
|
|
31
|
+
stroke: "none",
|
|
32
|
+
strokeWidth: "1",
|
|
33
|
+
className: "jsx-3201893673"
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement("rect", {
|
|
35
|
+
fill: "#A0ADBA",
|
|
36
|
+
height: "4",
|
|
37
|
+
id: "Rectangle",
|
|
38
|
+
rx: "1",
|
|
39
|
+
width: "4",
|
|
40
|
+
x: "7",
|
|
41
|
+
y: "7",
|
|
42
|
+
className: "jsx-3201893673"
|
|
43
|
+
})), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
44
|
+
id: "3201893673"
|
|
45
|
+
}, ["svg.jsx-3201893673{display:block;margin:3px 0;}"]));
|
|
46
|
+
};
|
|
44
47
|
|
|
45
48
|
exports.IconSingle = IconSingle;
|
|
46
49
|
IconSingle.propTypes = {
|
|
@@ -25,12 +25,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
25
25
|
* @param {bool} props.open
|
|
26
26
|
* @returns {React.Component}
|
|
27
27
|
*/
|
|
28
|
-
const Icon =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
const Icon = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
loading,
|
|
31
|
+
hasChildren,
|
|
32
|
+
open,
|
|
33
|
+
dataTest
|
|
34
|
+
} = _ref;
|
|
35
|
+
|
|
34
36
|
if (loading) {
|
|
35
37
|
return /*#__PURE__*/_react.default.createElement(_iconEmpty.IconEmpty, {
|
|
36
38
|
dataTest: dataTest
|
|
@@ -17,18 +17,20 @@ var _icon = require("./icon.js");
|
|
|
17
17
|
|
|
18
18
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
19
|
|
|
20
|
-
const IconizedCheckbox =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
20
|
+
const IconizedCheckbox = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
checked,
|
|
23
|
+
dataTest,
|
|
24
|
+
hasChildren,
|
|
25
|
+
indeterminate,
|
|
26
|
+
children,
|
|
27
|
+
loading,
|
|
28
|
+
name,
|
|
29
|
+
open,
|
|
30
|
+
value,
|
|
31
|
+
onChange
|
|
32
|
+
} = _ref;
|
|
33
|
+
|
|
32
34
|
const icon = /*#__PURE__*/_react.default.createElement(_icon.Icon, {
|
|
33
35
|
loading: loading,
|
|
34
36
|
open: open,
|
|
@@ -23,19 +23,22 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
23
|
* @param {React.Component|React.Component[]} props.children
|
|
24
24
|
* @returns {React.Component}
|
|
25
25
|
*/
|
|
26
|
-
const LabelContainer =
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
const LabelContainer = _ref => {
|
|
27
|
+
let {
|
|
28
|
+
highlighted,
|
|
29
|
+
children
|
|
30
|
+
} = _ref;
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
32
|
+
className: _style.default.dynamic([["495975020", [_uiConstants.colors.teal200]]]) + " " + ((0, _classnames.default)({
|
|
33
|
+
highlighted
|
|
34
|
+
}) || "")
|
|
35
|
+
}, /*#__PURE__*/_react.default.createElement("span", {
|
|
36
|
+
className: _style.default.dynamic([["495975020", [_uiConstants.colors.teal200]]])
|
|
37
|
+
}, children), /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
38
|
+
id: "495975020",
|
|
39
|
+
dynamic: [_uiConstants.colors.teal200]
|
|
40
|
+
}, ["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(_uiConstants.colors.teal200, ";padding-right:4px;}")]));
|
|
41
|
+
};
|
|
39
42
|
|
|
40
43
|
exports.LabelContainer = LabelContainer;
|
|
41
44
|
LabelContainer.propTypes = {
|
|
@@ -21,12 +21,13 @@ var _singleSelectionLabel = require("./single-selection-label.js");
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
|
-
const createNewSelected =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
const createNewSelected = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
selected,
|
|
27
|
+
path,
|
|
28
|
+
checked,
|
|
29
|
+
singleSelection
|
|
30
|
+
} = _ref;
|
|
30
31
|
const pathIndex = selected.indexOf(path);
|
|
31
32
|
|
|
32
33
|
if (checked && pathIndex !== -1) {
|
|
@@ -58,27 +59,30 @@ const createNewSelected = ({
|
|
|
58
59
|
return [...prevSlice, ...nextSlice];
|
|
59
60
|
};
|
|
60
61
|
|
|
61
|
-
const Label =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
62
|
+
const Label = _ref2 => {
|
|
63
|
+
let {
|
|
64
|
+
checked,
|
|
65
|
+
children,
|
|
66
|
+
dataTest,
|
|
67
|
+
disableSelection,
|
|
68
|
+
fullPath,
|
|
69
|
+
hasChildren,
|
|
70
|
+
hasSelectedDescendants,
|
|
71
|
+
highlighted,
|
|
72
|
+
loading,
|
|
73
|
+
node,
|
|
74
|
+
onChange,
|
|
75
|
+
onToggleOpen,
|
|
76
|
+
open,
|
|
77
|
+
rootId,
|
|
78
|
+
selected,
|
|
79
|
+
singleSelection
|
|
80
|
+
} = _ref2;
|
|
81
|
+
|
|
82
|
+
const onClick = (_ref3, event) => {
|
|
83
|
+
let {
|
|
84
|
+
checked
|
|
85
|
+
} = _ref3;
|
|
82
86
|
const newSelected = createNewSelected({
|
|
83
87
|
path: fullPath,
|
|
84
88
|
selected,
|
|
@@ -25,26 +25,29 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
25
25
|
* @param {Function} [props.onChange]
|
|
26
26
|
* @returns {React.Component}
|
|
27
27
|
*/
|
|
28
|
-
const SingleSelectionLabel =
|
|
29
|
-
|
|
30
|
-
children,
|
|
31
|
-
onChange,
|
|
32
|
-
loading
|
|
33
|
-
}) => /*#__PURE__*/_react.default.createElement("span", {
|
|
34
|
-
onClick: event => {
|
|
35
|
-
const payload = {
|
|
36
|
-
checked: !checked
|
|
37
|
-
};
|
|
38
|
-
onChange(payload, event);
|
|
39
|
-
},
|
|
40
|
-
className: _style.default.dynamic([["321503310", [_uiConstants.colors.grey900, _uiConstants.colors.teal700]]]) + " " + ((0, _classnames.default)({
|
|
28
|
+
const SingleSelectionLabel = _ref => {
|
|
29
|
+
let {
|
|
41
30
|
checked,
|
|
31
|
+
children,
|
|
32
|
+
onChange,
|
|
42
33
|
loading
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
34
|
+
} = _ref;
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement("span", {
|
|
36
|
+
onClick: event => {
|
|
37
|
+
const payload = {
|
|
38
|
+
checked: !checked
|
|
39
|
+
};
|
|
40
|
+
onChange(payload, event);
|
|
41
|
+
},
|
|
42
|
+
className: _style.default.dynamic([["321503310", [_uiConstants.colors.grey900, _uiConstants.colors.teal700]]]) + " " + ((0, _classnames.default)({
|
|
43
|
+
checked,
|
|
44
|
+
loading
|
|
45
|
+
}) || "")
|
|
46
|
+
}, children, /*#__PURE__*/_react.default.createElement(_style.default, {
|
|
47
|
+
id: "321503310",
|
|
48
|
+
dynamic: [_uiConstants.colors.grey900, _uiConstants.colors.teal700]
|
|
49
|
+
}, ["span.__jsx-style-dynamic-selector{background:transparent;border-radius:3px;color:".concat(_uiConstants.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(_uiConstants.colors.teal700, ";color:white;}"), ".loading.__jsx-style-dynamic-selector{cursor:auto;}"]));
|
|
50
|
+
};
|
|
48
51
|
|
|
49
52
|
exports.SingleSelectionLabel = SingleSelectionLabel;
|
|
50
53
|
SingleSelectionLabel.propTypes = {
|
|
@@ -21,41 +21,44 @@ var _useOrgChildren = require("./use-org-children.js");
|
|
|
21
21
|
|
|
22
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
23
|
|
|
24
|
-
const getFilteredChildren =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
const getFilteredChildren = _ref => {
|
|
25
|
+
let {
|
|
26
|
+
orgChildren,
|
|
27
|
+
filter,
|
|
28
|
+
node
|
|
29
|
+
} = _ref;
|
|
30
|
+
|
|
29
31
|
if (!(filter !== null && filter !== void 0 && filter.length)) {
|
|
30
32
|
return orgChildren;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
35
|
return orgChildren.filter(child => {
|
|
34
|
-
return (0, _index.isPathIncluded)(filter,
|
|
36
|
+
return (0, _index.isPathIncluded)(filter, "".concat(node.path, "/").concat(child.id));
|
|
35
37
|
});
|
|
36
38
|
};
|
|
37
39
|
|
|
38
|
-
const OrganisationUnitNodeChildren =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
40
|
+
const OrganisationUnitNodeChildren = _ref2 => {
|
|
41
|
+
let {
|
|
42
|
+
node,
|
|
43
|
+
autoExpandLoadingError,
|
|
44
|
+
dataTest,
|
|
45
|
+
disableSelection,
|
|
46
|
+
expanded,
|
|
47
|
+
filter,
|
|
48
|
+
highlighted,
|
|
49
|
+
isUserDataViewFallback,
|
|
50
|
+
onChange,
|
|
51
|
+
onChildrenLoaded,
|
|
52
|
+
onCollapse,
|
|
53
|
+
onExpand,
|
|
54
|
+
parentPath,
|
|
55
|
+
renderNodeLabel,
|
|
56
|
+
rootId,
|
|
57
|
+
selected,
|
|
58
|
+
singleSelection,
|
|
59
|
+
suppressAlphabeticalSorting,
|
|
60
|
+
OrganisationUnitNode
|
|
61
|
+
} = _ref2;
|
|
59
62
|
const orgChildren = (0, _useOrgChildren.useOrgChildren)({
|
|
60
63
|
node,
|
|
61
64
|
isUserDataViewFallback,
|
|
@@ -68,8 +71,8 @@ const OrganisationUnitNodeChildren = ({
|
|
|
68
71
|
filter,
|
|
69
72
|
node
|
|
70
73
|
}) : [];
|
|
71
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, orgChildren.loading && /*#__PURE__*/_react.default.createElement(_loadingSpinner.LoadingSpinner, null), orgChildren.error &&
|
|
72
|
-
const childPath =
|
|
74
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, orgChildren.loading && /*#__PURE__*/_react.default.createElement(_loadingSpinner.LoadingSpinner, null), orgChildren.error && "Error: ".concat(orgChildren.error), displayChildren && !filteredChildren.length && _index2.default.t('No children match filter'), !!filteredChildren.length && filteredChildren.map(child => {
|
|
75
|
+
const childPath = "".concat(parentPath, "/").concat(child.id);
|
|
73
76
|
return /*#__PURE__*/_react.default.createElement(OrganisationUnitNode, {
|
|
74
77
|
autoExpandLoadingError: autoExpandLoadingError,
|
|
75
78
|
dataTest: dataTest,
|
|
@@ -33,27 +33,28 @@ var _index4 = require("./use-org-data/index.js");
|
|
|
33
33
|
|
|
34
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
35
|
|
|
36
|
-
const OrganisationUnitNode =
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
36
|
+
const OrganisationUnitNode = _ref => {
|
|
37
|
+
let {
|
|
38
|
+
autoExpandLoadingError,
|
|
39
|
+
dataTest,
|
|
40
|
+
disableSelection,
|
|
41
|
+
displayName,
|
|
42
|
+
expanded,
|
|
43
|
+
highlighted,
|
|
44
|
+
id,
|
|
45
|
+
isUserDataViewFallback,
|
|
46
|
+
path,
|
|
47
|
+
renderNodeLabel,
|
|
48
|
+
rootId,
|
|
49
|
+
selected,
|
|
50
|
+
singleSelection,
|
|
51
|
+
filter,
|
|
52
|
+
suppressAlphabeticalSorting,
|
|
53
|
+
onChange,
|
|
54
|
+
onChildrenLoaded,
|
|
55
|
+
onCollapse,
|
|
56
|
+
onExpand
|
|
57
|
+
} = _ref;
|
|
57
58
|
const orgData = (0, _index4.useOrgData)(id, {
|
|
58
59
|
isUserDataViewFallback,
|
|
59
60
|
displayName
|
|
@@ -81,7 +82,7 @@ const OrganisationUnitNode = ({
|
|
|
81
82
|
onExpand,
|
|
82
83
|
onCollapse
|
|
83
84
|
});
|
|
84
|
-
const isSelected = !!selected.find(curPath => curPath.match(new RegExp(
|
|
85
|
+
const isSelected = !!selected.find(curPath => curPath.match(new RegExp("".concat(strippedPath, "$"))));
|
|
85
86
|
const labelContent = renderNodeLabel({
|
|
86
87
|
disableSelection,
|
|
87
88
|
hasChildren,
|
|
@@ -106,7 +107,7 @@ const OrganisationUnitNode = ({
|
|
|
106
107
|
checked: isSelected,
|
|
107
108
|
rootId: rootId,
|
|
108
109
|
onChange: onChange,
|
|
109
|
-
dataTest:
|
|
110
|
+
dataTest: "".concat(dataTest, "-label"),
|
|
110
111
|
selected: selected,
|
|
111
112
|
hasChildren: hasChildren,
|
|
112
113
|
highlighted: isHighlighted,
|
|
@@ -130,7 +131,7 @@ const OrganisationUnitNode = ({
|
|
|
130
131
|
const showPlaceholder = hasChildren && !open && !orgData.error;
|
|
131
132
|
const showChildNodes = hasChildren && open && !orgData.error;
|
|
132
133
|
return /*#__PURE__*/_react.default.createElement(_node.Node, {
|
|
133
|
-
dataTest:
|
|
134
|
+
dataTest: "".concat(dataTest, "-node"),
|
|
134
135
|
open: open,
|
|
135
136
|
onOpen: onToggleOpen,
|
|
136
137
|
onClose: onToggleOpen,
|
|
@@ -139,7 +140,7 @@ const OrganisationUnitNode = ({
|
|
|
139
140
|
}, orgData.error && /*#__PURE__*/_react.default.createElement(_errorMessage.ErrorMessage, {
|
|
140
141
|
dataTest: dataTest
|
|
141
142
|
}, _index2.default.t('Could not load children')), showPlaceholder && /*#__PURE__*/_react.default.createElement("span", {
|
|
142
|
-
"data-test":
|
|
143
|
+
"data-test": "".concat(dataTest, "-placeholder")
|
|
143
144
|
}), showChildNodes && /*#__PURE__*/_react.default.createElement(_organisationUnitNodeChildren.OrganisationUnitNodeChildren // Prevent cirular imports
|
|
144
145
|
, {
|
|
145
146
|
OrganisationUnitNode: OrganisationUnitNode,
|
|
@@ -17,14 +17,15 @@ var _react = require("react");
|
|
|
17
17
|
* @param {Function} [args.onCollapse]
|
|
18
18
|
* @returns {Object}
|
|
19
19
|
*/
|
|
20
|
-
const useOpenState =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
const useOpenState = _ref => {
|
|
21
|
+
let {
|
|
22
|
+
path,
|
|
23
|
+
expanded,
|
|
24
|
+
onExpand,
|
|
25
|
+
onCollapse,
|
|
26
|
+
errorMessage,
|
|
27
|
+
autoExpandLoadingError
|
|
28
|
+
} = _ref;
|
|
28
29
|
const autoExpand = autoExpandLoadingError && !!errorMessage;
|
|
29
30
|
const [openedOnceDueToError, setOpenedOnce] = (0, _react.useState)(!!errorMessage);
|
|
30
31
|
(0, _react.useEffect)(() => {
|
|
@@ -13,10 +13,13 @@ var _index = require("../helpers/index.js");
|
|
|
13
13
|
|
|
14
14
|
const ORG_DATA_QUERY = {
|
|
15
15
|
orgUnit: {
|
|
16
|
-
resource:
|
|
17
|
-
id:
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
resource: "organisationUnits",
|
|
17
|
+
id: _ref => {
|
|
18
|
+
let {
|
|
19
|
+
id
|
|
20
|
+
} = _ref;
|
|
21
|
+
return id;
|
|
22
|
+
},
|
|
20
23
|
params: {
|
|
21
24
|
fields: 'children[id,path,displayName]'
|
|
22
25
|
}
|
|
@@ -30,11 +33,12 @@ const ORG_DATA_QUERY = {
|
|
|
30
33
|
* @returns {Object}
|
|
31
34
|
*/
|
|
32
35
|
|
|
33
|
-
const useOrgChildren =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
const useOrgChildren = _ref2 => {
|
|
37
|
+
let {
|
|
38
|
+
node,
|
|
39
|
+
suppressAlphabeticalSorting,
|
|
40
|
+
onComplete
|
|
41
|
+
} = _ref2;
|
|
38
42
|
const onCompleteCalledRef = (0, _react.useRef)(false);
|
|
39
43
|
const {
|
|
40
44
|
called,
|