@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
|
@@ -14,11 +14,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
14
14
|
|
|
15
15
|
(0, _react.storiesOf)(_common.namespace, module).add('Closed with children', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
|
|
16
16
|
data: _common.dataProviderData
|
|
17
|
-
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
18
|
+
let {
|
|
19
|
+
selected,
|
|
20
|
+
onChange
|
|
21
|
+
} = _ref;
|
|
22
|
+
return /*#__PURE__*/_react2.default.createElement(_index.OrganisationUnitTree, {
|
|
23
|
+
roots: "A0000000000",
|
|
24
|
+
onChange: onChange,
|
|
25
|
+
selected: selected
|
|
26
|
+
});
|
|
27
|
+
})));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.namespace = exports.getOrganisationUnitData = exports.delayResponse = exports.dataProviderData = exports.createDecoratorStatefulMultiSelection = exports.createDecoratorCustomDataProvider = exports.StatefulMultiSelectionWrapper = void 0;
|
|
7
7
|
|
|
8
8
|
var _appRuntime = require("@dhis2/app-runtime");
|
|
9
9
|
|
|
@@ -25,32 +25,36 @@ const delayResponse = (delay, response) => () => new Promise(resolve => setTimeo
|
|
|
25
25
|
|
|
26
26
|
exports.delayResponse = delayResponse;
|
|
27
27
|
|
|
28
|
-
const createResponse =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}) => ({ ...(fields.includes('id') ? {
|
|
35
|
-
id
|
|
36
|
-
} : {}),
|
|
37
|
-
...(fields.includes('path') ? {
|
|
38
|
-
path
|
|
39
|
-
} : {}),
|
|
40
|
-
...(fields.includes('displayName') ? {
|
|
41
|
-
displayName
|
|
42
|
-
} : {}),
|
|
43
|
-
...(fields.includes('children::size') ? {
|
|
44
|
-
children: children.length
|
|
45
|
-
} : {}),
|
|
46
|
-
...(fields.includes('children[id,path,displayName]') ? {
|
|
28
|
+
const createResponse = _ref => {
|
|
29
|
+
let {
|
|
30
|
+
fields,
|
|
31
|
+
id,
|
|
32
|
+
path,
|
|
33
|
+
displayName,
|
|
47
34
|
children
|
|
48
|
-
}
|
|
49
|
-
|
|
35
|
+
} = _ref;
|
|
36
|
+
return { ...(fields.includes('id') ? {
|
|
37
|
+
id
|
|
38
|
+
} : {}),
|
|
39
|
+
...(fields.includes('path') ? {
|
|
40
|
+
path
|
|
41
|
+
} : {}),
|
|
42
|
+
...(fields.includes('displayName') ? {
|
|
43
|
+
displayName
|
|
44
|
+
} : {}),
|
|
45
|
+
...(fields.includes('children::size') ? {
|
|
46
|
+
children: children.length
|
|
47
|
+
} : {}),
|
|
48
|
+
...(fields.includes('children[id,path,displayName]') ? {
|
|
49
|
+
children
|
|
50
|
+
} : {})
|
|
51
|
+
};
|
|
52
|
+
};
|
|
50
53
|
|
|
51
|
-
const getOrganisationUnitData = (id, {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
const getOrganisationUnitData = (id, _ref2) => {
|
|
55
|
+
let {
|
|
56
|
+
fields
|
|
57
|
+
} = _ref2;
|
|
54
58
|
let data;
|
|
55
59
|
|
|
56
60
|
if (id === 'A0000000000') {
|
|
@@ -155,10 +159,11 @@ const getOrganisationUnitData = (id, {
|
|
|
155
159
|
|
|
156
160
|
exports.getOrganisationUnitData = getOrganisationUnitData;
|
|
157
161
|
const dataProviderData = {
|
|
158
|
-
organisationUnits: (_, {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
+
organisationUnits: (_, _ref3) => {
|
|
163
|
+
let {
|
|
164
|
+
id,
|
|
165
|
+
params = {}
|
|
166
|
+
} = _ref3;
|
|
162
167
|
console.log('id, params', id, params);
|
|
163
168
|
const data = getOrganisationUnitData(id, params);
|
|
164
169
|
|
|
@@ -171,16 +176,18 @@ const dataProviderData = {
|
|
|
171
176
|
};
|
|
172
177
|
exports.dataProviderData = dataProviderData;
|
|
173
178
|
|
|
174
|
-
const StatefulMultiSelectionWrapper =
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
179
|
+
const StatefulMultiSelectionWrapper = _ref4 => {
|
|
180
|
+
let {
|
|
181
|
+
children,
|
|
182
|
+
onSelectionChange = () => null
|
|
183
|
+
} = _ref4;
|
|
178
184
|
const [selected, setSelected] = (0, _react.useState)([]);
|
|
179
185
|
return children({
|
|
180
186
|
selected,
|
|
181
|
-
onChange:
|
|
182
|
-
|
|
183
|
-
|
|
187
|
+
onChange: _ref5 => {
|
|
188
|
+
let {
|
|
189
|
+
selected: newSelected
|
|
190
|
+
} = _ref5;
|
|
184
191
|
setSelected(newSelected);
|
|
185
192
|
onSelectionChange(newSelected);
|
|
186
193
|
}
|
|
@@ -196,13 +203,16 @@ StatefulMultiSelectionWrapper.propTypes = {
|
|
|
196
203
|
const createDecoratorStatefulMultiSelection = args => {
|
|
197
204
|
return Story => /*#__PURE__*/_react.default.createElement(StatefulMultiSelectionWrapper, {
|
|
198
205
|
onSelectionChange: args === null || args === void 0 ? void 0 : args.onSelectionChange
|
|
199
|
-
},
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
+
}, _ref6 => {
|
|
207
|
+
let {
|
|
208
|
+
selected,
|
|
209
|
+
onChange
|
|
210
|
+
} = _ref6;
|
|
211
|
+
return /*#__PURE__*/_react.default.createElement(Story, {
|
|
212
|
+
selected: selected,
|
|
213
|
+
onChange: onChange
|
|
214
|
+
});
|
|
215
|
+
});
|
|
206
216
|
};
|
|
207
217
|
|
|
208
218
|
exports.createDecoratorStatefulMultiSelection = createDecoratorStatefulMultiSelection;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.default = exports.MissingProps = exports.Controlled = void 0;
|
|
7
7
|
|
|
8
8
|
var _button = require("@dhis2-ui/button");
|
|
9
9
|
|
|
@@ -29,17 +29,20 @@ const Controlled = () => {
|
|
|
29
29
|
const initiallyExpanded = (0, _index.getAllExpandedOrgUnitPaths)(window.initiallyExpandedPaths);
|
|
30
30
|
const [expanded, setExpanded] = (0, _react.useState)(initiallyExpanded);
|
|
31
31
|
|
|
32
|
-
const handleExpand =
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const handleExpand = _ref => {
|
|
33
|
+
let {
|
|
34
|
+
path
|
|
35
|
+
} = _ref;
|
|
36
|
+
|
|
35
37
|
if (!expanded.includes(path)) {
|
|
36
38
|
setExpanded([...expanded, path]);
|
|
37
39
|
}
|
|
38
40
|
};
|
|
39
41
|
|
|
40
|
-
const handleCollapse =
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
const handleCollapse = _ref2 => {
|
|
43
|
+
let {
|
|
44
|
+
path
|
|
45
|
+
} = _ref2;
|
|
43
46
|
const pathIndex = expanded.indexOf(path);
|
|
44
47
|
|
|
45
48
|
if (pathIndex !== -1) {
|
|
@@ -13,7 +13,11 @@ var _common = require("./common.js");
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
|
|
15
15
|
const dataProviderDataWithError = {
|
|
16
|
-
organisationUnits: (
|
|
16
|
+
organisationUnits: function () {
|
|
17
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
|
+
args[_key] = arguments[_key];
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
const [, {
|
|
18
22
|
id
|
|
19
23
|
}] = args;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.default = exports.WithRootMainAndRootSubOrgUnit = exports.NoInitiallyExpandedPaths = exports.InitiallyExpandedPaths = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
@@ -19,36 +19,45 @@ var _default = {
|
|
|
19
19
|
};
|
|
20
20
|
exports.default = _default;
|
|
21
21
|
|
|
22
|
-
const NoInitiallyExpandedPaths = (_, {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
const NoInitiallyExpandedPaths = (_, _ref) => {
|
|
23
|
+
let {
|
|
24
|
+
onChange,
|
|
25
|
+
selected
|
|
26
|
+
} = _ref;
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
28
|
+
roots: "A0000000000",
|
|
29
|
+
selected: selected,
|
|
30
|
+
onChange: onChange
|
|
31
|
+
});
|
|
32
|
+
};
|
|
30
33
|
|
|
31
34
|
exports.NoInitiallyExpandedPaths = NoInitiallyExpandedPaths;
|
|
32
35
|
|
|
33
|
-
const InitiallyExpandedPaths = (_, {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
const InitiallyExpandedPaths = (_, _ref2) => {
|
|
37
|
+
let {
|
|
38
|
+
onChange,
|
|
39
|
+
selected
|
|
40
|
+
} = _ref2;
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
42
|
+
roots: "A0000000000",
|
|
43
|
+
selected: selected,
|
|
44
|
+
onChange: onChange,
|
|
45
|
+
initiallyExpanded: ['/A0000000000']
|
|
46
|
+
});
|
|
47
|
+
};
|
|
42
48
|
|
|
43
49
|
exports.InitiallyExpandedPaths = InitiallyExpandedPaths;
|
|
44
50
|
|
|
45
|
-
const WithRootMainAndRootSubOrgUnit = (_, {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const WithRootMainAndRootSubOrgUnit = (_, _ref3) => {
|
|
52
|
+
let {
|
|
53
|
+
onChange,
|
|
54
|
+
selected
|
|
55
|
+
} = _ref3;
|
|
56
|
+
return /*#__PURE__*/_react.default.createElement(_index.OrganisationUnitTree, {
|
|
57
|
+
roots: ['A0000000000', 'A0000000001'],
|
|
58
|
+
selected: selected,
|
|
59
|
+
onChange: onChange
|
|
60
|
+
});
|
|
61
|
+
};
|
|
53
62
|
|
|
54
63
|
exports.WithRootMainAndRootSubOrgUnit = WithRootMainAndRootSubOrgUnit;
|
|
@@ -15,7 +15,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
15
15
|
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; }
|
|
16
16
|
|
|
17
17
|
const afterReloadData = {
|
|
18
|
-
organisationUnits: (
|
|
18
|
+
organisationUnits: function () {
|
|
19
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
+
args[_key] = arguments[_key];
|
|
21
|
+
}
|
|
22
|
+
|
|
19
23
|
const [, {
|
|
20
24
|
id
|
|
21
25
|
}] = args;
|
|
@@ -40,20 +44,23 @@ const ForceReloading = () => {
|
|
|
40
44
|
disabled: forceReload,
|
|
41
45
|
"data-test": "reload-all",
|
|
42
46
|
onClick: () => setForceReload(true)
|
|
43
|
-
}, "Force reload tree"), /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
}, "Force reload tree"), /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
48
|
+
let {
|
|
49
|
+
selected,
|
|
50
|
+
onChange
|
|
51
|
+
} = _ref;
|
|
52
|
+
return /*#__PURE__*/_react2.default.createElement(_index.OrganisationUnitTree, {
|
|
53
|
+
roots: "A0000000000",
|
|
54
|
+
onChange: onChange,
|
|
55
|
+
selected: selected,
|
|
56
|
+
forceReload: forceReload,
|
|
57
|
+
onChildrenLoaded: data => {
|
|
58
|
+
if (data.A0000000000) {
|
|
59
|
+
setForceReload(false);
|
|
60
|
+
}
|
|
54
61
|
}
|
|
55
|
-
}
|
|
56
|
-
}))
|
|
62
|
+
});
|
|
63
|
+
}));
|
|
57
64
|
};
|
|
58
65
|
|
|
59
66
|
(0, _react.storiesOf)(_common.namespace, module).add('Force reloading', () => /*#__PURE__*/_react2.default.createElement(ForceReloading, null));
|
|
@@ -14,10 +14,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
14
14
|
|
|
15
15
|
(0, _react.storiesOf)(_common.namespace, module).add('Root highlighted', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
|
|
16
16
|
data: _common.dataProviderData
|
|
17
|
-
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
18
|
+
let {
|
|
19
|
+
onChange
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/_react2.default.createElement(_index.OrganisationUnitTree, {
|
|
22
|
+
roots: "A0000000000",
|
|
23
|
+
onChange: onChange,
|
|
24
|
+
highlighted: ['/A0000000000']
|
|
25
|
+
});
|
|
26
|
+
})));
|
|
@@ -13,7 +13,11 @@ var _common = require("./common.js");
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
|
|
15
15
|
const data = {
|
|
16
|
-
organisationUnits: (
|
|
16
|
+
organisationUnits: function () {
|
|
17
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
|
+
args[_key] = arguments[_key];
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
const [, {
|
|
18
22
|
id
|
|
19
23
|
}] = args;
|
|
@@ -31,9 +35,12 @@ const data = {
|
|
|
31
35
|
};
|
|
32
36
|
(0, _react.storiesOf)(_common.namespace, module).add('A0000000001 loading', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
|
|
33
37
|
data: data
|
|
34
|
-
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
39
|
+
let {
|
|
40
|
+
onChange
|
|
41
|
+
} = _ref;
|
|
42
|
+
return /*#__PURE__*/_react2.default.createElement(_index.OrganisationUnitTree, {
|
|
43
|
+
roots: "A0000000000",
|
|
44
|
+
onChange: onChange
|
|
45
|
+
});
|
|
46
|
+
})));
|
|
@@ -17,11 +17,14 @@ window.selection = [];
|
|
|
17
17
|
data: _common.dataProviderData
|
|
18
18
|
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, {
|
|
19
19
|
onSelectionChange: newSelection => window.selection = newSelection
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
}, _ref => {
|
|
21
|
+
let {
|
|
22
|
+
selected,
|
|
23
|
+
onChange
|
|
24
|
+
} = _ref;
|
|
25
|
+
return /*#__PURE__*/_react2.default.createElement(_index.OrganisationUnitTree, {
|
|
26
|
+
roots: "A0000000000",
|
|
27
|
+
onChange: onChange,
|
|
28
|
+
selected: selected
|
|
29
|
+
});
|
|
30
|
+
})));
|
|
@@ -14,19 +14,25 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
14
14
|
|
|
15
15
|
(0, _react.storiesOf)(_common.namespace, module).add('No selection closed', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
|
|
16
16
|
data: _common.dataProviderData
|
|
17
|
-
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
18
|
+
let {
|
|
19
|
+
onChange
|
|
20
|
+
} = _ref;
|
|
21
|
+
return /*#__PURE__*/_react2.default.createElement(_index.OrganisationUnitTree, {
|
|
22
|
+
disableSelection: true,
|
|
23
|
+
roots: "A0000000000",
|
|
24
|
+
onChange: onChange
|
|
25
|
+
});
|
|
26
|
+
}))).add('No selection root opened', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
|
|
24
27
|
data: _common.dataProviderData
|
|
25
|
-
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref2 => {
|
|
29
|
+
let {
|
|
30
|
+
onChange
|
|
31
|
+
} = _ref2;
|
|
32
|
+
return /*#__PURE__*/_react2.default.createElement(_index.OrganisationUnitTree, {
|
|
33
|
+
disableSelection: true,
|
|
34
|
+
roots: "A0000000000",
|
|
35
|
+
onChange: onChange,
|
|
36
|
+
initiallyExpanded: ['/A0000000000']
|
|
37
|
+
});
|
|
38
|
+
})));
|
|
@@ -15,25 +15,31 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
15
|
window.allUnits = [];
|
|
16
16
|
|
|
17
17
|
for (let i = 0; i < 7; ++i) {
|
|
18
|
-
window.allUnits.push(
|
|
18
|
+
window.allUnits.push("A000000000".concat(i));
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
(0, _react.storiesOf)(_common.namespace, module).add('Filtered by 3-level-path', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
|
|
22
22
|
data: _common.dataProviderData
|
|
23
|
-
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
24
|
+
let {
|
|
25
|
+
onChange
|
|
26
|
+
} = _ref;
|
|
27
|
+
return /*#__PURE__*/_react2.default.createElement(_index.OrganisationUnitTree, {
|
|
28
|
+
roots: "A0000000000",
|
|
29
|
+
onChange: onChange,
|
|
30
|
+
initiallyExpanded: ['/A0000000000', '/A0000000000/A0000000001', '/A0000000000/A0000000002'],
|
|
31
|
+
filter: ['/A0000000000/A0000000001/A0000000003']
|
|
32
|
+
});
|
|
33
|
+
}))).add('Filtered by 3-level-path and 2-level-path', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
|
|
31
34
|
data: _common.dataProviderData
|
|
32
|
-
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null,
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref2 => {
|
|
36
|
+
let {
|
|
37
|
+
onChange
|
|
38
|
+
} = _ref2;
|
|
39
|
+
return /*#__PURE__*/_react2.default.createElement(_index.OrganisationUnitTree, {
|
|
40
|
+
roots: "A0000000000",
|
|
41
|
+
onChange: onChange,
|
|
42
|
+
initiallyExpanded: ['/A0000000000', '/A0000000000/A0000000001', '/A0000000000/A0000000002'],
|
|
43
|
+
filter: ['/A0000000000/A0000000001/A0000000003', '/A0000000000/A0000000002']
|
|
44
|
+
});
|
|
45
|
+
})));
|
|
@@ -13,7 +13,11 @@ var _common = require("./common.js");
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
|
|
15
15
|
const data = {
|
|
16
|
-
organisationUnits: (
|
|
16
|
+
organisationUnits: function () {
|
|
17
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
|
+
args[_key] = arguments[_key];
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
const [, {
|
|
18
22
|
id
|
|
19
23
|
}] = args;
|
|
@@ -36,12 +40,15 @@ const data = {
|
|
|
36
40
|
};
|
|
37
41
|
(0, _react.storiesOf)(_common.namespace, module).add('Single selection', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
|
|
38
42
|
data: data
|
|
39
|
-
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
43
|
+
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
44
|
+
let {
|
|
45
|
+
selected,
|
|
46
|
+
onChange
|
|
47
|
+
} = _ref;
|
|
48
|
+
return /*#__PURE__*/_react2.default.createElement(_index.OrganisationUnitTree, {
|
|
49
|
+
singleSelection: true,
|
|
50
|
+
roots: ['A0000000000', 'A0000000001'],
|
|
51
|
+
onChange: onChange,
|
|
52
|
+
selected: selected
|
|
53
|
+
});
|
|
54
|
+
})));
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.default = exports.MultipleRootSubAndOneMainOrgUnit = void 0;
|
|
7
7
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
@@ -21,10 +21,11 @@ var _default = {
|
|
|
21
21
|
};
|
|
22
22
|
exports.default = _default;
|
|
23
23
|
|
|
24
|
-
const MultipleRootSubAndOneMainOrgUnit = (_, {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const MultipleRootSubAndOneMainOrgUnit = (_, _ref) => {
|
|
25
|
+
let {
|
|
26
|
+
selected,
|
|
27
|
+
onChange
|
|
28
|
+
} = _ref;
|
|
28
29
|
const [filter, setFilter] = (0, _react.useState)('');
|
|
29
30
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("input", {
|
|
30
31
|
type: "input",
|
|
@@ -13,7 +13,11 @@ var _common = require("./common.js");
|
|
|
13
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
14
|
|
|
15
15
|
const customizedDataProviderData = {
|
|
16
|
-
organisationUnits: (
|
|
16
|
+
organisationUnits: function () {
|
|
17
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
18
|
+
args[_key] = arguments[_key];
|
|
19
|
+
}
|
|
20
|
+
|
|
17
21
|
const [, {
|
|
18
22
|
id,
|
|
19
23
|
params
|
|
@@ -48,17 +52,20 @@ window.onExpand = window.Cypress && window.Cypress.cy.stub();
|
|
|
48
52
|
window.onChildrenLoaded = window.Cypress && window.Cypress.cy.stub();
|
|
49
53
|
(0, _react.storiesOf)(_common.namespace, module).add('Events', () => /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
|
|
50
54
|
data: customizedDataProviderData
|
|
51
|
-
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null,
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
55
|
+
}, /*#__PURE__*/_react2.default.createElement(_common.StatefulMultiSelectionWrapper, null, _ref => {
|
|
56
|
+
let {
|
|
57
|
+
selected,
|
|
58
|
+
onChange
|
|
59
|
+
} = _ref;
|
|
60
|
+
return /*#__PURE__*/_react2.default.createElement(_index.OrganisationUnitTree, {
|
|
61
|
+
roots: "A0000000000",
|
|
62
|
+
selected: selected,
|
|
63
|
+
onChange: function () {
|
|
64
|
+
onChange(...arguments);
|
|
65
|
+
window.onChange(...arguments);
|
|
66
|
+
},
|
|
67
|
+
onExpand: window.onExpand,
|
|
68
|
+
onCollapse: window.onCollapse,
|
|
69
|
+
onChildrenLoaded: window.onChildrenLoaded
|
|
70
|
+
});
|
|
71
|
+
})));
|
|
@@ -22,17 +22,20 @@ const CustomExpandedImperativeOpen = () => {
|
|
|
22
22
|
const initiallyExpanded = (0, _index.getAllExpandedOrgUnitPaths)([]);
|
|
23
23
|
const [expanded, setExpanded] = (0, _react.useState)(initiallyExpanded);
|
|
24
24
|
|
|
25
|
-
const handleExpand =
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
const handleExpand = _ref => {
|
|
26
|
+
let {
|
|
27
|
+
path
|
|
28
|
+
} = _ref;
|
|
29
|
+
|
|
28
30
|
if (!expanded.includes(path)) {
|
|
29
31
|
setExpanded([...expanded, path]);
|
|
30
32
|
}
|
|
31
33
|
};
|
|
32
34
|
|
|
33
|
-
const handleCollapse =
|
|
34
|
-
|
|
35
|
-
|
|
35
|
+
const handleCollapse = _ref2 => {
|
|
36
|
+
let {
|
|
37
|
+
path
|
|
38
|
+
} = _ref2;
|
|
36
39
|
const pathIndex = expanded.indexOf(path);
|
|
37
40
|
|
|
38
41
|
if (pathIndex !== -1) {
|