@dhis2-ui/organisation-unit-tree 9.11.0 → 9.11.1-beta.2
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.js +28 -0
- package/build/cjs/__e2e__/common.js +5 -23
- package/build/cjs/__e2e__/{controlled_expanded.stories.e2e.js → controlled_expanded.js} +6 -29
- package/build/cjs/__e2e__/displaying_loading_error.js +42 -0
- package/build/cjs/__e2e__/{expanded.stories.e2e.js → expanded.js} +7 -19
- package/build/cjs/__e2e__/force_reload.js +60 -0
- package/build/cjs/__e2e__/get-organisation-unit-data.js +2 -12
- package/build/cjs/__e2e__/highlight.js +27 -0
- package/build/cjs/__e2e__/{loading_state.stories.e2e.js → loading_state.js} +11 -17
- package/build/cjs/__e2e__/multi_selection.js +28 -0
- package/build/cjs/__e2e__/namespace.js +1 -2
- package/build/cjs/__e2e__/no_selection.js +38 -0
- package/build/cjs/__e2e__/path_based_filtering.js +43 -0
- package/build/cjs/__e2e__/{single_selection.stories.e2e.js → single_selection.js} +15 -19
- package/build/cjs/__e2e__/sub_unit_as_root.js +29 -0
- package/build/cjs/__e2e__/{tree_api.stories.e2e.js → tree_api.js} +15 -20
- package/build/cjs/__stories__/collapsed.js +1 -7
- package/build/cjs/__stories__/custom-expanded-imperative-open.js +5 -19
- package/build/cjs/__stories__/custom-node-label.js +1 -9
- package/build/cjs/__stories__/development-stories.js +3 -21
- package/build/cjs/__stories__/expanded.js +1 -7
- package/build/cjs/__stories__/filtered-root.js +1 -7
- package/build/cjs/__stories__/filtered.js +1 -7
- package/build/cjs/__stories__/force-reload-all.js +3 -16
- package/build/cjs/__stories__/force-reload-one-unit.js +5 -5
- package/build/cjs/__stories__/highlighted.js +1 -7
- package/build/cjs/__stories__/indeterminate.js +1 -7
- package/build/cjs/__stories__/loading-error-grandchild.js +3 -12
- package/build/cjs/__stories__/loading.js +3 -12
- package/build/cjs/__stories__/multiple-roots.js +1 -7
- package/build/cjs/__stories__/no-selection.js +1 -7
- package/build/cjs/__stories__/replace-roots.js +5 -5
- package/build/cjs/__stories__/root-error.js +3 -12
- package/build/cjs/__stories__/root-loading.js +3 -12
- package/build/cjs/__stories__/rtl.js +1 -7
- package/build/cjs/__stories__/selected-multiple.js +1 -7
- package/build/cjs/__stories__/shared.js +7 -47
- package/build/cjs/__stories__/single-selection.js +1 -7
- package/build/cjs/features/children_as_child_nodes/index.js +0 -1
- package/build/cjs/features/controlled_expanded/index.js +9 -9
- package/build/cjs/features/displaying_loading_error/index.js +2 -3
- package/build/cjs/features/expanded/index.js +10 -6
- package/build/cjs/features/force_reload/index.js +0 -1
- package/build/cjs/features/highlight/index.js +0 -1
- package/build/cjs/features/loading_state/index.js +1 -2
- package/build/cjs/features/multi_selection/index.js +0 -1
- package/build/cjs/features/no_selection/index.js +0 -1
- package/build/cjs/features/path_based_filtering/index.js +3 -6
- package/build/cjs/features/single_selection/index.js +0 -1
- package/build/cjs/features/sub_unit_as_root/index.js +7 -2
- package/build/cjs/features/tree_api/index.js +0 -2
- package/build/cjs/get-all-expanded-paths/get-all-expanded-paths.js +3 -7
- package/build/cjs/get-all-expanded-paths/get-all-expanded-paths.test.js +0 -1
- package/build/cjs/get-all-expanded-paths/index.js +0 -1
- package/build/cjs/helpers/index.js +0 -3
- package/build/cjs/helpers/is-path-included.js +1 -4
- package/build/cjs/helpers/left-trim-to-root-id.js +1 -3
- package/build/cjs/helpers/sort-node-children-alphabetically.js +0 -2
- package/build/cjs/index.js +0 -2
- package/build/cjs/locales/index.js +3 -41
- package/build/cjs/organisation-unit-node/compute-child-nodes.js +1 -6
- package/build/cjs/organisation-unit-node/compute-child-nodes.test.js +0 -1
- package/build/cjs/organisation-unit-node/error-message.js +3 -10
- package/build/cjs/organisation-unit-node/has-descendant-selected-paths.js +1 -3
- package/build/cjs/organisation-unit-node/has-descendant-selected-paths.test.js +0 -1
- package/build/cjs/organisation-unit-node/index.js +0 -1
- package/build/cjs/organisation-unit-node/label/disabled-selection-label.js +1 -7
- package/build/cjs/organisation-unit-node/label/icon-empty.js +2 -8
- package/build/cjs/organisation-unit-node/label/icon-folder-closed.js +2 -8
- package/build/cjs/organisation-unit-node/label/icon-folder-open.js +2 -8
- package/build/cjs/organisation-unit-node/label/icon-single.js +2 -8
- package/build/cjs/organisation-unit-node/label/icon.js +1 -14
- package/build/cjs/organisation-unit-node/label/iconized-checkbox.js +1 -12
- package/build/cjs/organisation-unit-node/label/index.js +0 -1
- package/build/cjs/organisation-unit-node/label/label-container.js +2 -10
- package/build/cjs/organisation-unit-node/label/label.js +6 -26
- package/build/cjs/organisation-unit-node/label/single-selection-label.js +2 -10
- package/build/cjs/organisation-unit-node/loading-spinner.js +1 -8
- package/build/cjs/organisation-unit-node/organisation-unit-node-children.js +4 -17
- package/build/cjs/organisation-unit-node/organisation-unit-node.js +8 -25
- package/build/cjs/organisation-unit-node/use-open-state.js +0 -5
- package/build/cjs/organisation-unit-node/use-open-state.test.js +0 -2
- package/build/cjs/organisation-unit-node/use-org-children.js +6 -11
- package/build/cjs/organisation-unit-node/use-org-children.test.js +16 -34
- package/build/cjs/organisation-unit-node/use-org-data/index.js +0 -1
- package/build/cjs/organisation-unit-node/use-org-data/use-org-data.js +2 -7
- package/build/cjs/organisation-unit-node/use-org-data/use-org-data.test.js +2 -14
- package/build/cjs/organisation-unit-tree/default-render-node-label/default-render-node-label.js +0 -2
- package/build/cjs/organisation-unit-tree/default-render-node-label/index.js +0 -1
- package/build/cjs/organisation-unit-tree/filter-root-ids.js +1 -5
- package/build/cjs/organisation-unit-tree/index.js +0 -3
- package/build/cjs/organisation-unit-tree/organisation-unit-tree-root-error.js +1 -7
- package/build/cjs/organisation-unit-tree/organisation-unit-tree-root-loading.js +1 -8
- package/build/cjs/organisation-unit-tree/organisation-unit-tree.js +4 -37
- package/build/cjs/organisation-unit-tree/organisation-unit-tree.test.js +1 -6
- package/build/cjs/organisation-unit-tree/use-expanded/create-expand-handlers.js +0 -9
- package/build/cjs/organisation-unit-tree/use-expanded/create-expand-handlers.test.js +0 -1
- package/build/cjs/organisation-unit-tree/use-expanded/index.js +0 -1
- package/build/cjs/organisation-unit-tree/use-expanded/use-expanded.js +0 -7
- package/build/cjs/organisation-unit-tree/use-expanded/use-expanded.test.js +0 -7
- package/build/cjs/organisation-unit-tree/use-force-reload.js +0 -3
- package/build/cjs/organisation-unit-tree/use-force-reload.test.js +0 -3
- package/build/cjs/organisation-unit-tree/use-root-org-data/index.js +0 -1
- package/build/cjs/organisation-unit-tree/use-root-org-data/patch-missing-display-name.js +2 -3
- package/build/cjs/organisation-unit-tree/use-root-org-data/patch-missing-display-name.test.js +0 -1
- package/build/cjs/organisation-unit-tree/use-root-org-data/use-root-org-data.js +4 -10
- package/build/cjs/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +3 -16
- package/build/cjs/organisation-unit-tree.e2e.stories.js +136 -0
- package/build/cjs/{organisation-unit-tree.stories.js → organisation-unit-tree.prod.stories.js} +29 -33
- package/build/cjs/prop-types.js +5 -9
- package/build/es/__e2e__/{children_as_child_nodes.stories.e2e.js → children_as_child_nodes.js} +5 -3
- package/build/es/__e2e__/common.js +0 -2
- package/build/es/__e2e__/{controlled_expanded.stories.e2e.js → controlled_expanded.js} +4 -15
- package/build/es/__e2e__/{displaying_loading_error.stories.e2e.js → displaying_loading_error.js} +5 -8
- package/build/es/__e2e__/{expanded.stories.e2e.js → expanded.js} +5 -5
- package/build/es/__e2e__/{force_reload.stories.e2e.js → force_reload.js} +5 -9
- package/build/es/__e2e__/get-organisation-unit-data.js +2 -10
- package/build/es/__e2e__/{highlight.stories.e2e.js → highlight.js} +5 -3
- package/build/es/__e2e__/{loading_state.stories.e2e.js → loading_state.js} +3 -8
- package/build/es/__e2e__/{multi_selection.stories.e2e.js → multi_selection.js} +3 -4
- package/build/es/__e2e__/{no_selection.stories.e2e.js → no_selection.js} +5 -5
- package/build/es/__e2e__/{path_based_filtering.stories.e2e.js → path_based_filtering.js} +6 -8
- package/build/es/__e2e__/{single_selection.stories.e2e.js → single_selection.js} +7 -10
- package/build/es/__e2e__/{sub_unit_as_root.stories.e2e.js → sub_unit_as_root.js} +2 -5
- package/build/es/__e2e__/{tree_api.stories.e2e.js → tree_api.js} +7 -11
- package/build/es/__stories__/custom-expanded-imperative-open.js +3 -8
- package/build/es/__stories__/custom-node-label.js +0 -2
- package/build/es/__stories__/development-stories.js +1 -7
- package/build/es/__stories__/force-reload-all.js +0 -3
- package/build/es/__stories__/force-reload-one-unit.js +5 -1
- package/build/es/__stories__/loading-error-grandchild.js +2 -4
- package/build/es/__stories__/loading.js +2 -4
- package/build/es/__stories__/replace-roots.js +5 -1
- package/build/es/__stories__/root-error.js +2 -4
- package/build/es/__stories__/root-loading.js +2 -4
- package/build/es/__stories__/shared.js +2 -18
- package/build/es/features/controlled_expanded/index.js +9 -7
- package/build/es/features/displaying_loading_error/index.js +2 -2
- package/build/es/features/expanded/index.js +10 -6
- package/build/es/features/loading_state/index.js +1 -1
- package/build/es/features/path_based_filtering/index.js +3 -5
- package/build/es/features/sub_unit_as_root/index.js +7 -1
- package/build/es/features/tree_api/index.js +0 -2
- package/build/es/get-all-expanded-paths/get-all-expanded-paths.js +3 -5
- package/build/es/helpers/is-path-included.js +1 -2
- package/build/es/helpers/left-trim-to-root-id.js +1 -1
- package/build/es/organisation-unit-node/compute-child-nodes.js +2 -4
- package/build/es/organisation-unit-node/error-message.js +2 -2
- package/build/es/organisation-unit-node/has-descendant-selected-paths.js +1 -1
- package/build/es/organisation-unit-node/label/disabled-selection-label.js +1 -1
- package/build/es/organisation-unit-node/label/icon-empty.js +1 -1
- package/build/es/organisation-unit-node/label/icon-folder-closed.js +1 -1
- package/build/es/organisation-unit-node/label/icon-folder-open.js +1 -1
- package/build/es/organisation-unit-node/label/icon-single.js +1 -1
- package/build/es/organisation-unit-node/label/icon.js +1 -5
- package/build/es/organisation-unit-node/label/label-container.js +2 -2
- package/build/es/organisation-unit-node/label/label.js +5 -17
- package/build/es/organisation-unit-node/label/single-selection-label.js +2 -2
- package/build/es/organisation-unit-node/organisation-unit-node-children.js +3 -7
- package/build/es/organisation-unit-node/organisation-unit-node.js +7 -6
- package/build/es/organisation-unit-node/use-open-state.js +1 -3
- package/build/es/organisation-unit-node/use-org-children.js +6 -6
- package/build/es/organisation-unit-node/use-org-children.test.js +15 -28
- package/build/es/organisation-unit-node/use-org-data/use-org-data.js +2 -4
- package/build/es/organisation-unit-node/use-org-data/use-org-data.test.js +1 -8
- package/build/es/organisation-unit-tree/filter-root-ids.js +1 -2
- package/build/es/organisation-unit-tree/organisation-unit-tree.js +1 -19
- package/build/es/organisation-unit-tree/use-expanded/create-expand-handlers.js +0 -7
- package/build/es/organisation-unit-tree/use-expanded/use-expanded.js +1 -3
- package/build/es/organisation-unit-tree/use-force-reload.js +1 -1
- 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 +4 -3
- package/build/es/organisation-unit-tree/use-root-org-data/use-root-org-unit.test.js +2 -10
- package/build/es/organisation-unit-tree.e2e.stories.js +16 -0
- package/build/es/{organisation-unit-tree.stories.js → organisation-unit-tree.prod.stories.js} +26 -1
- package/build/es/prop-types.js +5 -4
- package/package.json +9 -8
- package/build/cjs/__e2e__/children_as_child_nodes.stories.e2e.js +0 -27
- package/build/cjs/__e2e__/displaying_loading_error.stories.e2e.js +0 -45
- package/build/cjs/__e2e__/force_reload.stories.e2e.js +0 -66
- package/build/cjs/__e2e__/highlight.stories.e2e.js +0 -26
- package/build/cjs/__e2e__/multi_selection.stories.e2e.js +0 -30
- package/build/cjs/__e2e__/no_selection.stories.e2e.js +0 -38
- package/build/cjs/__e2e__/path_based_filtering.stories.e2e.js +0 -45
- package/build/cjs/__e2e__/sub_unit_as_root.stories.e2e.js +0 -41
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.ClosedWithChildren = void 0;
|
|
7
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _index = require("../index.js");
|
|
10
|
+
var _common = require("./common.js");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
var _default = exports.default = {
|
|
13
|
+
title: _common.namespace
|
|
14
|
+
};
|
|
15
|
+
const ClosedWithChildren = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
16
|
+
data: _common.dataProviderData
|
|
17
|
+
}, /*#__PURE__*/_react.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
18
|
+
let {
|
|
19
|
+
selected,
|
|
20
|
+
onChange
|
|
21
|
+
} = _ref;
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
23
|
+
roots: "A0000000000",
|
|
24
|
+
onChange: onChange,
|
|
25
|
+
selected: selected
|
|
26
|
+
});
|
|
27
|
+
}));
|
|
28
|
+
exports.ClosedWithChildren = ClosedWithChildren;
|
|
@@ -16,28 +16,19 @@ Object.defineProperty(exports, "namespace", {
|
|
|
16
16
|
return _namespace.namespace;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
|
-
|
|
20
19
|
var _appRuntime = require("@dhis2/app-runtime");
|
|
21
|
-
|
|
22
20
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
-
|
|
24
21
|
var _react = _interopRequireWildcard(require("react"));
|
|
25
|
-
|
|
26
22
|
var _getOrganisationUnitData = require("./get-organisation-unit-data.js");
|
|
27
|
-
|
|
28
23
|
var _namespace = require("./namespace.js");
|
|
29
|
-
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
33
|
-
|
|
34
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
|
-
|
|
24
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
36
27
|
/* eslint-disable react/display-name */
|
|
37
|
-
const delayResponse = (delay, response) => () => new Promise(resolve => setTimeout(() => resolve(response), delay));
|
|
38
28
|
|
|
29
|
+
const delayResponse = (delay, response) => () => new Promise(resolve => setTimeout(() => resolve(response), delay));
|
|
39
30
|
exports.delayResponse = delayResponse;
|
|
40
|
-
const dataProviderData = {
|
|
31
|
+
const dataProviderData = exports.dataProviderData = {
|
|
41
32
|
organisationUnits: (_, _ref) => {
|
|
42
33
|
let {
|
|
43
34
|
id,
|
|
@@ -45,16 +36,12 @@ const dataProviderData = {
|
|
|
45
36
|
} = _ref;
|
|
46
37
|
console.log('id, params', id, params);
|
|
47
38
|
const data = (0, _getOrganisationUnitData.getOrganisationUnitData)(id, params);
|
|
48
|
-
|
|
49
39
|
if (!data) {
|
|
50
40
|
return Promise.reject(new Error('404 - Org unit not found'));
|
|
51
41
|
}
|
|
52
|
-
|
|
53
42
|
return Promise.resolve(data);
|
|
54
43
|
}
|
|
55
44
|
};
|
|
56
|
-
exports.dataProviderData = dataProviderData;
|
|
57
|
-
|
|
58
45
|
const StatefulMultiSelectionWrapper = _ref2 => {
|
|
59
46
|
let {
|
|
60
47
|
children,
|
|
@@ -72,13 +59,11 @@ const StatefulMultiSelectionWrapper = _ref2 => {
|
|
|
72
59
|
}
|
|
73
60
|
});
|
|
74
61
|
};
|
|
75
|
-
|
|
76
62
|
exports.StatefulMultiSelectionWrapper = StatefulMultiSelectionWrapper;
|
|
77
63
|
StatefulMultiSelectionWrapper.propTypes = {
|
|
78
64
|
children: _propTypes.default.func.isRequired,
|
|
79
65
|
onSelectionChange: _propTypes.default.func
|
|
80
66
|
};
|
|
81
|
-
|
|
82
67
|
const createDecoratorStatefulMultiSelection = args => {
|
|
83
68
|
return Story => /*#__PURE__*/_react.default.createElement(StatefulMultiSelectionWrapper, {
|
|
84
69
|
onSelectionChange: args === null || args === void 0 ? void 0 : args.onSelectionChange
|
|
@@ -93,9 +78,7 @@ const createDecoratorStatefulMultiSelection = args => {
|
|
|
93
78
|
});
|
|
94
79
|
});
|
|
95
80
|
};
|
|
96
|
-
|
|
97
81
|
exports.createDecoratorStatefulMultiSelection = createDecoratorStatefulMultiSelection;
|
|
98
|
-
|
|
99
82
|
const createDecoratorCustomDataProvider = args => {
|
|
100
83
|
const data = (args === null || args === void 0 ? void 0 : args.data) || dataProviderData;
|
|
101
84
|
return Story => {
|
|
@@ -105,5 +88,4 @@ const createDecoratorCustomDataProvider = args => {
|
|
|
105
88
|
}, /*#__PURE__*/_react.default.createElement(Story, null));
|
|
106
89
|
};
|
|
107
90
|
};
|
|
108
|
-
|
|
109
91
|
exports.createDecoratorCustomDataProvider = createDecoratorCustomDataProvider;
|
|
@@ -3,64 +3,44 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.MissingProps = exports.Controlled = void 0;
|
|
8
7
|
var _button = require("@dhis2-ui/button");
|
|
9
|
-
|
|
10
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
|
|
12
9
|
var _index = require("../index.js");
|
|
13
|
-
|
|
14
10
|
var _common = require("./common.js");
|
|
15
|
-
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
19
|
-
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
13
|
window.initiallyExpandedPaths = ['/A0000000000/A0000000001'];
|
|
21
14
|
window.orgUnitPathToExpand = '/A0000000000/A0000000001';
|
|
22
|
-
var _default = {
|
|
23
|
-
title: _common.namespace,
|
|
24
|
-
decorators: [(0, _common.createDecoratorCustomDataProvider)()]
|
|
25
|
-
};
|
|
26
|
-
exports.default = _default;
|
|
27
|
-
|
|
28
15
|
const Controlled = () => {
|
|
29
16
|
const initiallyExpanded = (0, _index.getAllExpandedOrgUnitPaths)(window.initiallyExpandedPaths);
|
|
30
17
|
const [expanded, setExpanded] = (0, _react.useState)(initiallyExpanded);
|
|
31
|
-
|
|
32
18
|
const handleExpand = _ref => {
|
|
33
19
|
let {
|
|
34
20
|
path
|
|
35
21
|
} = _ref;
|
|
36
|
-
|
|
37
22
|
if (!expanded.includes(path)) {
|
|
38
23
|
setExpanded([...expanded, path]);
|
|
39
24
|
}
|
|
40
25
|
};
|
|
41
|
-
|
|
42
26
|
const handleCollapse = _ref2 => {
|
|
43
27
|
let {
|
|
44
28
|
path
|
|
45
29
|
} = _ref2;
|
|
46
30
|
const pathIndex = expanded.indexOf(path);
|
|
47
|
-
|
|
48
31
|
if (pathIndex !== -1) {
|
|
49
32
|
const updatedExpanded = pathIndex === 0 ? expanded.slice(1) : [...expanded.slice(0, pathIndex), ...expanded.slice(pathIndex + 1)];
|
|
50
33
|
setExpanded(updatedExpanded);
|
|
51
34
|
}
|
|
52
35
|
};
|
|
53
|
-
|
|
54
36
|
const imperativeToggle = () => {
|
|
55
37
|
if (!expanded.includes('/A0000000000/A0000000001')) {
|
|
56
38
|
// Make sure that all required sub paths are included as well
|
|
57
39
|
const nextPaths = (0, _index.getAllExpandedOrgUnitPaths)([...expanded, window.orgUnitPathToExpand]);
|
|
58
40
|
return setExpanded(nextPaths);
|
|
59
41
|
}
|
|
60
|
-
|
|
61
42
|
setExpanded(expanded.filter(v => v !== '/A0000000000/A0000000001'));
|
|
62
43
|
};
|
|
63
|
-
|
|
64
44
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
65
45
|
onChange: () => null,
|
|
66
46
|
name: "Root org unit",
|
|
@@ -73,14 +53,11 @@ const Controlled = () => {
|
|
|
73
53
|
onClick: imperativeToggle
|
|
74
54
|
}, "Toggle Org Unit 2"));
|
|
75
55
|
};
|
|
76
|
-
|
|
77
56
|
exports.Controlled = Controlled;
|
|
78
|
-
|
|
57
|
+
Controlled.decorators = [(0, _common.createDecoratorCustomDataProvider)()];
|
|
79
58
|
const MissingProps = () => {
|
|
80
59
|
const expanded = [];
|
|
81
|
-
|
|
82
60
|
const handleExpand = () => null;
|
|
83
|
-
|
|
84
61
|
return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
85
62
|
onChange: () => null,
|
|
86
63
|
name: "Root org unit",
|
|
@@ -89,5 +66,5 @@ const MissingProps = () => {
|
|
|
89
66
|
handleExpand: handleExpand
|
|
90
67
|
});
|
|
91
68
|
};
|
|
92
|
-
|
|
93
|
-
|
|
69
|
+
exports.MissingProps = MissingProps;
|
|
70
|
+
MissingProps.decorators = [(0, _common.createDecoratorCustomDataProvider)()];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.A0000000001LoadingErrorAutoexpand = exports.A0000000001LoadingError = void 0;
|
|
7
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _index = require("../index.js");
|
|
10
|
+
var _common = require("./common.js");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const dataProviderDataWithError = {
|
|
13
|
+
organisationUnits: function () {
|
|
14
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
|
+
args[_key] = arguments[_key];
|
|
16
|
+
}
|
|
17
|
+
const [, {
|
|
18
|
+
id
|
|
19
|
+
}] = args;
|
|
20
|
+
if (id === 'A0000000001') {
|
|
21
|
+
return new Promise((resolve, reject) => setTimeout(() => {
|
|
22
|
+
reject(new Error('Foobar custom error message'));
|
|
23
|
+
}, 100));
|
|
24
|
+
}
|
|
25
|
+
return _common.dataProviderData.organisationUnits(...args);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const A0000000001LoadingError = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
29
|
+
data: dataProviderDataWithError
|
|
30
|
+
}, /*#__PURE__*/_react.default.createElement(_common.StatefulMultiSelectionWrapper, null, () => /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
31
|
+
roots: "A0000000000",
|
|
32
|
+
onChange: () => null
|
|
33
|
+
})));
|
|
34
|
+
exports.A0000000001LoadingError = A0000000001LoadingError;
|
|
35
|
+
const A0000000001LoadingErrorAutoexpand = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
36
|
+
data: dataProviderDataWithError
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement(_common.StatefulMultiSelectionWrapper, null, () => /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
38
|
+
autoExpandLoadingError: true,
|
|
39
|
+
roots: "A0000000000",
|
|
40
|
+
onChange: () => null
|
|
41
|
+
})));
|
|
42
|
+
exports.A0000000001LoadingErrorAutoexpand = A0000000001LoadingErrorAutoexpand;
|
|
@@ -3,22 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
|
|
6
|
+
exports.WithRootMainAndRootSubOrgUnit = exports.NoInitiallyExpandedPaths = exports.InitiallyExpandedPaths = void 0;
|
|
8
7
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
|
|
10
8
|
var _index = require("../index.js");
|
|
11
|
-
|
|
12
9
|
var _common = require("./common.js");
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
var _default = {
|
|
17
|
-
title: 'OrganisationUnitTree/expanded',
|
|
18
|
-
decorators: [(0, _common.createDecoratorStatefulMultiSelection)(), (0, _common.createDecoratorCustomDataProvider)()]
|
|
19
|
-
};
|
|
20
|
-
exports.default = _default;
|
|
21
|
-
|
|
10
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
+
const decorators = [(0, _common.createDecoratorStatefulMultiSelection)(), (0, _common.createDecoratorCustomDataProvider)()];
|
|
22
12
|
const NoInitiallyExpandedPaths = (_, _ref) => {
|
|
23
13
|
let {
|
|
24
14
|
onChange,
|
|
@@ -30,9 +20,8 @@ const NoInitiallyExpandedPaths = (_, _ref) => {
|
|
|
30
20
|
onChange: onChange
|
|
31
21
|
});
|
|
32
22
|
};
|
|
33
|
-
|
|
34
23
|
exports.NoInitiallyExpandedPaths = NoInitiallyExpandedPaths;
|
|
35
|
-
|
|
24
|
+
NoInitiallyExpandedPaths.decorators = decorators;
|
|
36
25
|
const InitiallyExpandedPaths = (_, _ref2) => {
|
|
37
26
|
let {
|
|
38
27
|
onChange,
|
|
@@ -45,9 +34,8 @@ const InitiallyExpandedPaths = (_, _ref2) => {
|
|
|
45
34
|
initiallyExpanded: ['/A0000000000']
|
|
46
35
|
});
|
|
47
36
|
};
|
|
48
|
-
|
|
49
37
|
exports.InitiallyExpandedPaths = InitiallyExpandedPaths;
|
|
50
|
-
|
|
38
|
+
InitiallyExpandedPaths.decorators = decorators;
|
|
51
39
|
const WithRootMainAndRootSubOrgUnit = (_, _ref3) => {
|
|
52
40
|
let {
|
|
53
41
|
onChange,
|
|
@@ -59,5 +47,5 @@ const WithRootMainAndRootSubOrgUnit = (_, _ref3) => {
|
|
|
59
47
|
onChange: onChange
|
|
60
48
|
});
|
|
61
49
|
};
|
|
62
|
-
|
|
63
|
-
|
|
50
|
+
exports.WithRootMainAndRootSubOrgUnit = WithRootMainAndRootSubOrgUnit;
|
|
51
|
+
WithRootMainAndRootSubOrgUnit.decorators = decorators;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.ForceReloading = void 0;
|
|
7
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _index = require("../index.js");
|
|
10
|
+
var _common = require("./common.js");
|
|
11
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
|
+
const afterReloadData = {
|
|
14
|
+
organisationUnits: function () {
|
|
15
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
16
|
+
args[_key] = arguments[_key];
|
|
17
|
+
}
|
|
18
|
+
const [, {
|
|
19
|
+
id
|
|
20
|
+
}] = args;
|
|
21
|
+
if (id === 'A0000000000') {
|
|
22
|
+
return (0, _common.delayResponse)(1000, _common.dataProviderData.organisationUnits(...args))();
|
|
23
|
+
}
|
|
24
|
+
if (id === 'A0000000001') {
|
|
25
|
+
return (0, _common.delayResponse)(2200, _common.dataProviderData.organisationUnits(...args))();
|
|
26
|
+
}
|
|
27
|
+
return _common.dataProviderData.organisationUnits(...args);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
const ForceReloading_ = () => {
|
|
31
|
+
const [forceReload, setForceReload] = (0, _react.useState)(false);
|
|
32
|
+
return /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
33
|
+
data: afterReloadData
|
|
34
|
+
}, /*#__PURE__*/_react.default.createElement("button", {
|
|
35
|
+
disabled: forceReload,
|
|
36
|
+
"data-test": "reload-all",
|
|
37
|
+
onClick: () => setForceReload(true)
|
|
38
|
+
}, "Force reload tree"), /*#__PURE__*/_react.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
39
|
+
let {
|
|
40
|
+
selected,
|
|
41
|
+
onChange
|
|
42
|
+
} = _ref;
|
|
43
|
+
return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
44
|
+
roots: "A0000000000",
|
|
45
|
+
onChange: onChange,
|
|
46
|
+
selected: selected,
|
|
47
|
+
forceReload: forceReload,
|
|
48
|
+
onChildrenLoaded: data => {
|
|
49
|
+
if (data.A0000000000) {
|
|
50
|
+
setForceReload(false);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}));
|
|
55
|
+
};
|
|
56
|
+
var _default = exports.default = {
|
|
57
|
+
title: _common.namespace
|
|
58
|
+
};
|
|
59
|
+
const ForceReloading = () => /*#__PURE__*/_react.default.createElement(ForceReloading_, null);
|
|
60
|
+
exports.ForceReloading = ForceReloading;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getOrganisationUnitData = void 0;
|
|
7
|
-
|
|
8
7
|
const createResponse = _ref => {
|
|
9
8
|
let {
|
|
10
9
|
fields,
|
|
@@ -13,7 +12,8 @@ const createResponse = _ref => {
|
|
|
13
12
|
displayName,
|
|
14
13
|
children
|
|
15
14
|
} = _ref;
|
|
16
|
-
return {
|
|
15
|
+
return {
|
|
16
|
+
...(fields.includes('id') ? {
|
|
17
17
|
id
|
|
18
18
|
} : {}),
|
|
19
19
|
...(fields.includes('path') ? {
|
|
@@ -30,13 +30,11 @@ const createResponse = _ref => {
|
|
|
30
30
|
} : {})
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
|
|
34
33
|
const getOrganisationUnitData = (id, _ref2) => {
|
|
35
34
|
let {
|
|
36
35
|
fields
|
|
37
36
|
} = _ref2;
|
|
38
37
|
let data;
|
|
39
|
-
|
|
40
38
|
if (id === 'A0000000000') {
|
|
41
39
|
data = createResponse({
|
|
42
40
|
fields,
|
|
@@ -58,7 +56,6 @@ const getOrganisationUnitData = (id, _ref2) => {
|
|
|
58
56
|
}]
|
|
59
57
|
});
|
|
60
58
|
}
|
|
61
|
-
|
|
62
59
|
if (id === 'A0000000001') {
|
|
63
60
|
data = createResponse({
|
|
64
61
|
fields,
|
|
@@ -78,7 +75,6 @@ const getOrganisationUnitData = (id, _ref2) => {
|
|
|
78
75
|
}]
|
|
79
76
|
});
|
|
80
77
|
}
|
|
81
|
-
|
|
82
78
|
if (id === 'A0000000002') {
|
|
83
79
|
data = createResponse({
|
|
84
80
|
fields,
|
|
@@ -88,7 +84,6 @@ const getOrganisationUnitData = (id, _ref2) => {
|
|
|
88
84
|
children: []
|
|
89
85
|
});
|
|
90
86
|
}
|
|
91
|
-
|
|
92
87
|
if (id === 'A0000000003') {
|
|
93
88
|
data = createResponse({
|
|
94
89
|
fields,
|
|
@@ -103,7 +98,6 @@ const getOrganisationUnitData = (id, _ref2) => {
|
|
|
103
98
|
}]
|
|
104
99
|
});
|
|
105
100
|
}
|
|
106
|
-
|
|
107
101
|
if (id === 'A0000000004') {
|
|
108
102
|
data = createResponse({
|
|
109
103
|
fields,
|
|
@@ -113,7 +107,6 @@ const getOrganisationUnitData = (id, _ref2) => {
|
|
|
113
107
|
children: []
|
|
114
108
|
});
|
|
115
109
|
}
|
|
116
|
-
|
|
117
110
|
if (id === 'A0000000006') {
|
|
118
111
|
data = createResponse({
|
|
119
112
|
fields,
|
|
@@ -123,7 +116,6 @@ const getOrganisationUnitData = (id, _ref2) => {
|
|
|
123
116
|
children: []
|
|
124
117
|
});
|
|
125
118
|
}
|
|
126
|
-
|
|
127
119
|
if (id === 'A0000000007') {
|
|
128
120
|
data = createResponse({
|
|
129
121
|
fields,
|
|
@@ -133,8 +125,6 @@ const getOrganisationUnitData = (id, _ref2) => {
|
|
|
133
125
|
children: []
|
|
134
126
|
});
|
|
135
127
|
}
|
|
136
|
-
|
|
137
128
|
return data;
|
|
138
129
|
};
|
|
139
|
-
|
|
140
130
|
exports.getOrganisationUnitData = getOrganisationUnitData;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.RootHighlighted = void 0;
|
|
7
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _index = require("../index.js");
|
|
10
|
+
var _common = require("./common.js");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
var _default = exports.default = {
|
|
13
|
+
title: _common.namespace
|
|
14
|
+
};
|
|
15
|
+
const RootHighlighted = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
16
|
+
data: _common.dataProviderData
|
|
17
|
+
}, /*#__PURE__*/_react.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
18
|
+
let {
|
|
19
|
+
onChange
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
22
|
+
roots: "A0000000000",
|
|
23
|
+
onChange: onChange,
|
|
24
|
+
highlighted: ['/A0000000000']
|
|
25
|
+
});
|
|
26
|
+
}));
|
|
27
|
+
exports.RootHighlighted = RootHighlighted;
|
|
@@ -1,46 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.A0000000001Loading = void 0;
|
|
3
7
|
var _appRuntime = require("@dhis2/app-runtime");
|
|
4
|
-
|
|
5
|
-
var _react = require("@storybook/react");
|
|
6
|
-
|
|
7
|
-
var _react2 = _interopRequireDefault(require("react"));
|
|
8
|
-
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _index = require("../index.js");
|
|
10
|
-
|
|
11
10
|
var _common = require("./common.js");
|
|
12
|
-
|
|
13
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
-
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
12
|
const data = {
|
|
16
13
|
organisationUnits: function () {
|
|
17
14
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
15
|
args[_key] = arguments[_key];
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
const [, {
|
|
22
18
|
id
|
|
23
19
|
}] = args;
|
|
24
|
-
|
|
25
20
|
if (id === 'A0000000000') {
|
|
26
21
|
return _common.dataProviderData.organisationUnits(...args);
|
|
27
22
|
}
|
|
28
|
-
|
|
29
23
|
if (id === 'A0000000001') {
|
|
30
24
|
return (0, _common.delayResponse)(1000, _common.dataProviderData.organisationUnits(...args))();
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
return Promise.resolve({});
|
|
34
27
|
}
|
|
35
28
|
};
|
|
36
|
-
|
|
29
|
+
const A0000000001Loading = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
37
30
|
data: data
|
|
38
|
-
}, /*#__PURE__*/
|
|
31
|
+
}, /*#__PURE__*/_react.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
39
32
|
let {
|
|
40
33
|
onChange
|
|
41
34
|
} = _ref;
|
|
42
|
-
return /*#__PURE__*/
|
|
35
|
+
return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
43
36
|
roots: "A0000000000",
|
|
44
37
|
onChange: onChange
|
|
45
38
|
});
|
|
46
|
-
}))
|
|
39
|
+
}));
|
|
40
|
+
exports.A0000000001Loading = A0000000001Loading;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.MultipleSelection = void 0;
|
|
7
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _index = require("../index.js");
|
|
10
|
+
var _common = require("./common.js");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
window.selection = [];
|
|
13
|
+
const MultipleSelection = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
14
|
+
data: _common.dataProviderData
|
|
15
|
+
}, /*#__PURE__*/_react.default.createElement(_common.StatefulMultiSelectionWrapper, {
|
|
16
|
+
onSelectionChange: newSelection => window.selection = newSelection
|
|
17
|
+
}, _ref => {
|
|
18
|
+
let {
|
|
19
|
+
selected,
|
|
20
|
+
onChange
|
|
21
|
+
} = _ref;
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
23
|
+
roots: "A0000000000",
|
|
24
|
+
onChange: onChange,
|
|
25
|
+
selected: selected
|
|
26
|
+
});
|
|
27
|
+
}));
|
|
28
|
+
exports.MultipleSelection = MultipleSelection;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.NoSelectionRootOpened = exports.NoSelectionClosed = void 0;
|
|
7
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _index = require("../index.js");
|
|
10
|
+
var _common = require("./common.js");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
const NoSelectionClosed = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
13
|
+
data: _common.dataProviderData
|
|
14
|
+
}, /*#__PURE__*/_react.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
15
|
+
let {
|
|
16
|
+
onChange
|
|
17
|
+
} = _ref;
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
19
|
+
disableSelection: true,
|
|
20
|
+
roots: "A0000000000",
|
|
21
|
+
onChange: onChange
|
|
22
|
+
});
|
|
23
|
+
}));
|
|
24
|
+
exports.NoSelectionClosed = NoSelectionClosed;
|
|
25
|
+
const NoSelectionRootOpened = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
26
|
+
data: _common.dataProviderData
|
|
27
|
+
}, /*#__PURE__*/_react.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref2 => {
|
|
28
|
+
let {
|
|
29
|
+
onChange
|
|
30
|
+
} = _ref2;
|
|
31
|
+
return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
32
|
+
disableSelection: true,
|
|
33
|
+
roots: "A0000000000",
|
|
34
|
+
onChange: onChange,
|
|
35
|
+
initiallyExpanded: ['/A0000000000']
|
|
36
|
+
});
|
|
37
|
+
}));
|
|
38
|
+
exports.NoSelectionRootOpened = NoSelectionRootOpened;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FilteredBy3LevelPathAnd2LevelPath = exports.FilteredBy3LevelPath = void 0;
|
|
7
|
+
var _appRuntime = require("@dhis2/app-runtime");
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _index = require("../index.js");
|
|
10
|
+
var _common = require("./common.js");
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
window.allUnits = [];
|
|
13
|
+
for (let i = 0; i < 7; ++i) {
|
|
14
|
+
window.allUnits.push(`A000000000${i}`);
|
|
15
|
+
}
|
|
16
|
+
const FilteredBy3LevelPath = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
17
|
+
data: _common.dataProviderData
|
|
18
|
+
}, /*#__PURE__*/_react.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
19
|
+
let {
|
|
20
|
+
onChange
|
|
21
|
+
} = _ref;
|
|
22
|
+
return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
23
|
+
roots: "A0000000000",
|
|
24
|
+
onChange: onChange,
|
|
25
|
+
initiallyExpanded: ['/A0000000000', '/A0000000000/A0000000001', '/A0000000000/A0000000002'],
|
|
26
|
+
filter: ['/A0000000000/A0000000001/A0000000003']
|
|
27
|
+
});
|
|
28
|
+
}));
|
|
29
|
+
exports.FilteredBy3LevelPath = FilteredBy3LevelPath;
|
|
30
|
+
const FilteredBy3LevelPathAnd2LevelPath = () => /*#__PURE__*/_react.default.createElement(_appRuntime.CustomDataProvider, {
|
|
31
|
+
data: _common.dataProviderData
|
|
32
|
+
}, /*#__PURE__*/_react.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref2 => {
|
|
33
|
+
let {
|
|
34
|
+
onChange
|
|
35
|
+
} = _ref2;
|
|
36
|
+
return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
37
|
+
roots: "A0000000000",
|
|
38
|
+
onChange: onChange,
|
|
39
|
+
initiallyExpanded: ['/A0000000000', '/A0000000000/A0000000001', '/A0000000000/A0000000002'],
|
|
40
|
+
filter: ['/A0000000000/A0000000001/A0000000003', '/A0000000000/A0000000002']
|
|
41
|
+
});
|
|
42
|
+
}));
|
|
43
|
+
exports.FilteredBy3LevelPathAnd2LevelPath = FilteredBy3LevelPathAnd2LevelPath;
|