@dhis2-ui/organisation-unit-tree 8.14.9 → 8.15.0-alpha.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/index.js +2 -2
- package/build/cjs/locales/index.js +10 -14
- package/build/cjs/organisation-unit-tree/index.js +6 -6
- package/build/cjs/organisation-unit-tree/{root-error.js → organisation-unit-tree-root-error.js} +5 -5
- package/build/cjs/organisation-unit-tree/{root-loading.js → organisation-unit-tree-root-loading.js} +5 -5
- package/build/cjs/organisation-unit-tree/organisation-unit-tree.js +3 -3
- package/build/es/index.js +1 -1
- package/build/es/locales/index.js +2 -4
- package/build/es/organisation-unit-tree/index.js +2 -2
- package/build/es/organisation-unit-tree/{root-error.js → organisation-unit-tree-root-error.js} +3 -3
- package/build/es/organisation-unit-tree/{root-loading.js → organisation-unit-tree-root-loading.js} +3 -3
- package/build/es/organisation-unit-tree/organisation-unit-tree.js +3 -3
- package/package.json +9 -7
- package/types/index.d.ts +165 -0
- package/build/cjs/locales/uz_UZ_Latn/translations.json +0 -5
- package/build/es/locales/uz_UZ_Latn/translations.json +0 -5
- /package/build/cjs/locales/{uz_UZ_Cyrl → uz}/translations.json +0 -0
- /package/build/es/locales/{uz_UZ_Cyrl → uz}/translations.json +0 -0
package/build/cjs/index.js
CHANGED
|
@@ -12,13 +12,13 @@ Object.defineProperty(exports, "OrganisationUnitTree", {
|
|
|
12
12
|
Object.defineProperty(exports, "OrganisationUnitTreeRootError", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return _index.
|
|
15
|
+
return _index.OrganisationUnitTreeRootError;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
18
|
Object.defineProperty(exports, "OrganisationUnitTreeRootLoading", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
21
|
-
return _index.
|
|
21
|
+
return _index.OrganisationUnitTreeRootLoading;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "getAllExpandedOrgUnitPaths", {
|
|
@@ -21,17 +21,15 @@ var _translations6 = _interopRequireDefault(require("./nl/translations.json"));
|
|
|
21
21
|
|
|
22
22
|
var _translations7 = _interopRequireDefault(require("./uk/translations.json"));
|
|
23
23
|
|
|
24
|
-
var _translations8 = _interopRequireDefault(require("./
|
|
24
|
+
var _translations8 = _interopRequireDefault(require("./uz/translations.json"));
|
|
25
25
|
|
|
26
|
-
var _translations9 = _interopRequireDefault(require("./
|
|
26
|
+
var _translations9 = _interopRequireDefault(require("./uz_Latn/translations.json"));
|
|
27
27
|
|
|
28
|
-
var _translations10 = _interopRequireDefault(require("./
|
|
28
|
+
var _translations10 = _interopRequireDefault(require("./vi/translations.json"));
|
|
29
29
|
|
|
30
|
-
var _translations11 = _interopRequireDefault(require("./
|
|
30
|
+
var _translations11 = _interopRequireDefault(require("./zh/translations.json"));
|
|
31
31
|
|
|
32
|
-
var _translations12 = _interopRequireDefault(require("./
|
|
33
|
-
|
|
34
|
-
var _translations13 = _interopRequireDefault(require("./zh_CN/translations.json"));
|
|
32
|
+
var _translations12 = _interopRequireDefault(require("./zh_CN/translations.json"));
|
|
35
33
|
|
|
36
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
35
|
|
|
@@ -59,17 +57,15 @@ _d2I18n.default.addResources('nl', namespace, _translations6.default);
|
|
|
59
57
|
|
|
60
58
|
_d2I18n.default.addResources('uk', namespace, _translations7.default);
|
|
61
59
|
|
|
62
|
-
_d2I18n.default.addResources('
|
|
63
|
-
|
|
64
|
-
_d2I18n.default.addResources('uz_UZ_Cyrl', namespace, _translations9.default);
|
|
60
|
+
_d2I18n.default.addResources('uz', namespace, _translations8.default);
|
|
65
61
|
|
|
66
|
-
_d2I18n.default.addResources('
|
|
62
|
+
_d2I18n.default.addResources('uz_Latn', namespace, _translations9.default);
|
|
67
63
|
|
|
68
|
-
_d2I18n.default.addResources('vi', namespace,
|
|
64
|
+
_d2I18n.default.addResources('vi', namespace, _translations10.default);
|
|
69
65
|
|
|
70
|
-
_d2I18n.default.addResources('zh', namespace,
|
|
66
|
+
_d2I18n.default.addResources('zh', namespace, _translations11.default);
|
|
71
67
|
|
|
72
|
-
_d2I18n.default.addResources('zh_CN', namespace,
|
|
68
|
+
_d2I18n.default.addResources('zh_CN', namespace, _translations12.default);
|
|
73
69
|
|
|
74
70
|
var _default = _d2I18n.default;
|
|
75
71
|
exports.default = _default;
|
|
@@ -9,21 +9,21 @@ Object.defineProperty(exports, "OrganisationUnitTree", {
|
|
|
9
9
|
return _organisationUnitTree.OrganisationUnitTree;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "
|
|
12
|
+
Object.defineProperty(exports, "OrganisationUnitTreeRootError", {
|
|
13
13
|
enumerable: true,
|
|
14
14
|
get: function () {
|
|
15
|
-
return
|
|
15
|
+
return _organisationUnitTreeRootError.OrganisationUnitTreeRootError;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
Object.defineProperty(exports, "
|
|
18
|
+
Object.defineProperty(exports, "OrganisationUnitTreeRootLoading", {
|
|
19
19
|
enumerable: true,
|
|
20
20
|
get: function () {
|
|
21
|
-
return
|
|
21
|
+
return _organisationUnitTreeRootLoading.OrganisationUnitTreeRootLoading;
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
var _organisationUnitTree = require("./organisation-unit-tree.js");
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _organisationUnitTreeRootError = require("./organisation-unit-tree-root-error.js");
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _organisationUnitTreeRootLoading = require("./organisation-unit-tree-root-loading.js");
|
package/build/cjs/organisation-unit-tree/{root-error.js → organisation-unit-tree-root-error.js}
RENAMED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.OrganisationUnitTreeRootError = void 0;
|
|
7
7
|
|
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
9
|
|
|
@@ -13,7 +13,7 @@ var _index = _interopRequireDefault(require("../locales/index.js"));
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
-
const
|
|
16
|
+
const OrganisationUnitTreeRootError = _ref => {
|
|
17
17
|
let {
|
|
18
18
|
dataTest,
|
|
19
19
|
error
|
|
@@ -26,11 +26,11 @@ const RootError = _ref => {
|
|
|
26
26
|
}));
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
exports.
|
|
30
|
-
|
|
29
|
+
exports.OrganisationUnitTreeRootError = OrganisationUnitTreeRootError;
|
|
30
|
+
OrganisationUnitTreeRootError.defaultProps = {
|
|
31
31
|
dataTest: 'dhis2-uiwidgets-orgunittree-error'
|
|
32
32
|
};
|
|
33
|
-
|
|
33
|
+
OrganisationUnitTreeRootError.propTypes = {
|
|
34
34
|
error: _propTypes.default.string.isRequired,
|
|
35
35
|
dataTest: _propTypes.default.string
|
|
36
36
|
};
|
package/build/cjs/organisation-unit-tree/{root-loading.js → organisation-unit-tree-root-loading.js}
RENAMED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.OrganisationUnitTreeRootLoading = void 0;
|
|
7
7
|
|
|
8
8
|
var _style = _interopRequireDefault(require("styled-jsx/style"));
|
|
9
9
|
|
|
@@ -15,7 +15,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
15
15
|
|
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
17
|
|
|
18
|
-
const
|
|
18
|
+
const OrganisationUnitTreeRootLoading = _ref => {
|
|
19
19
|
let {
|
|
20
20
|
dataTest
|
|
21
21
|
} = _ref;
|
|
@@ -29,10 +29,10 @@ const RootLoading = _ref => {
|
|
|
29
29
|
}, ["div.jsx-814846266{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}"]));
|
|
30
30
|
};
|
|
31
31
|
|
|
32
|
-
exports.
|
|
33
|
-
|
|
32
|
+
exports.OrganisationUnitTreeRootLoading = OrganisationUnitTreeRootLoading;
|
|
33
|
+
OrganisationUnitTreeRootLoading.defaultProps = {
|
|
34
34
|
dataTest: 'dhis2-uiwidgets-orgunittree-loading'
|
|
35
35
|
};
|
|
36
|
-
|
|
36
|
+
OrganisationUnitTreeRootLoading.propTypes = {
|
|
37
37
|
dataTest: _propTypes.default.string
|
|
38
38
|
};
|
|
@@ -19,9 +19,9 @@ var _index2 = require("./default-render-node-label/index.js");
|
|
|
19
19
|
|
|
20
20
|
var _filterRootIds = require("./filter-root-ids.js");
|
|
21
21
|
|
|
22
|
-
var
|
|
22
|
+
var _organisationUnitTreeRootError = require("./organisation-unit-tree-root-error.js");
|
|
23
23
|
|
|
24
|
-
var
|
|
24
|
+
var _organisationUnitTreeRootLoading = require("./organisation-unit-tree-root-loading.js");
|
|
25
25
|
|
|
26
26
|
var _index3 = require("./use-expanded/index.js");
|
|
27
27
|
|
|
@@ -95,7 +95,7 @@ const OrganisationUnitTree = _ref => {
|
|
|
95
95
|
const isLoading = !called || loading;
|
|
96
96
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
97
97
|
"data-test": dataTest
|
|
98
|
-
}, isLoading && /*#__PURE__*/_react.default.createElement(
|
|
98
|
+
}, isLoading && /*#__PURE__*/_react.default.createElement(_organisationUnitTreeRootLoading.OrganisationUnitTreeRootLoading, null), error && /*#__PURE__*/_react.default.createElement(_organisationUnitTreeRootError.OrganisationUnitTreeRootError, {
|
|
99
99
|
error: error
|
|
100
100
|
}), !error && !isLoading && rootIds.map(rootId => {
|
|
101
101
|
const rootNode = data[rootId];
|
package/build/es/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { OrganisationUnitTree,
|
|
1
|
+
export { OrganisationUnitTree, OrganisationUnitTreeRootError, OrganisationUnitTreeRootLoading } from './organisation-unit-tree/index.js';
|
|
2
2
|
export { getAllExpandedPaths as getAllExpandedOrgUnitPaths } from './get-all-expanded-paths/index.js';
|
|
@@ -14,9 +14,8 @@ import esTranslations from './es/translations.json';
|
|
|
14
14
|
import nbTranslations from './nb/translations.json';
|
|
15
15
|
import nlTranslations from './nl/translations.json';
|
|
16
16
|
import ukTranslations from './uk/translations.json';
|
|
17
|
+
import uzTranslations from './uz/translations.json';
|
|
17
18
|
import uz_LatnTranslations from './uz_Latn/translations.json';
|
|
18
|
-
import uz_UZ_CyrlTranslations from './uz_UZ_Cyrl/translations.json';
|
|
19
|
-
import uz_UZ_LatnTranslations from './uz_UZ_Latn/translations.json';
|
|
20
19
|
import viTranslations from './vi/translations.json';
|
|
21
20
|
import zhTranslations from './zh/translations.json';
|
|
22
21
|
import zh_CNTranslations from './zh_CN/translations.json';
|
|
@@ -28,9 +27,8 @@ i18n.addResources('es', namespace, esTranslations);
|
|
|
28
27
|
i18n.addResources('nb', namespace, nbTranslations);
|
|
29
28
|
i18n.addResources('nl', namespace, nlTranslations);
|
|
30
29
|
i18n.addResources('uk', namespace, ukTranslations);
|
|
30
|
+
i18n.addResources('uz', namespace, uzTranslations);
|
|
31
31
|
i18n.addResources('uz_Latn', namespace, uz_LatnTranslations);
|
|
32
|
-
i18n.addResources('uz_UZ_Cyrl', namespace, uz_UZ_CyrlTranslations);
|
|
33
|
-
i18n.addResources('uz_UZ_Latn', namespace, uz_UZ_LatnTranslations);
|
|
34
32
|
i18n.addResources('vi', namespace, viTranslations);
|
|
35
33
|
i18n.addResources('zh', namespace, zhTranslations);
|
|
36
34
|
i18n.addResources('zh_CN', namespace, zh_CNTranslations);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { OrganisationUnitTree } from './organisation-unit-tree.js';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
2
|
+
export { OrganisationUnitTreeRootError } from './organisation-unit-tree-root-error.js';
|
|
3
|
+
export { OrganisationUnitTreeRootLoading } from './organisation-unit-tree-root-loading.js';
|
package/build/es/organisation-unit-tree/{root-error.js → organisation-unit-tree-root-error.js}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import i18n from '../locales/index.js';
|
|
4
|
-
export const
|
|
4
|
+
export const OrganisationUnitTreeRootError = _ref => {
|
|
5
5
|
let {
|
|
6
6
|
dataTest,
|
|
7
7
|
error
|
|
@@ -13,10 +13,10 @@ export const RootError = _ref => {
|
|
|
13
13
|
nsSeparator: '>'
|
|
14
14
|
}));
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
OrganisationUnitTreeRootError.defaultProps = {
|
|
17
17
|
dataTest: 'dhis2-uiwidgets-orgunittree-error'
|
|
18
18
|
};
|
|
19
|
-
|
|
19
|
+
OrganisationUnitTreeRootError.propTypes = {
|
|
20
20
|
error: PropTypes.string.isRequired,
|
|
21
21
|
dataTest: PropTypes.string
|
|
22
22
|
};
|
package/build/es/organisation-unit-tree/{root-loading.js → organisation-unit-tree-root-loading.js}
RENAMED
|
@@ -2,7 +2,7 @@ import _JSXStyle from "styled-jsx/style";
|
|
|
2
2
|
import { CircularLoader } from '@dhis2-ui/loader';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
export const
|
|
5
|
+
export const OrganisationUnitTreeRootLoading = _ref => {
|
|
6
6
|
let {
|
|
7
7
|
dataTest
|
|
8
8
|
} = _ref;
|
|
@@ -15,9 +15,9 @@ export const RootLoading = _ref => {
|
|
|
15
15
|
id: "814846266"
|
|
16
16
|
}, ["div.jsx-814846266{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center;}"]));
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
OrganisationUnitTreeRootLoading.defaultProps = {
|
|
19
19
|
dataTest: 'dhis2-uiwidgets-orgunittree-loading'
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
OrganisationUnitTreeRootLoading.propTypes = {
|
|
22
22
|
dataTest: PropTypes.string
|
|
23
23
|
};
|
|
@@ -5,8 +5,8 @@ import { OrganisationUnitNode } from '../organisation-unit-node/index.js';
|
|
|
5
5
|
import { orgUnitPathPropType } from '../prop-types.js';
|
|
6
6
|
import { defaultRenderNodeLabel } from './default-render-node-label/index.js';
|
|
7
7
|
import { filterRootIds } from './filter-root-ids.js';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { OrganisationUnitTreeRootError } from './organisation-unit-tree-root-error.js';
|
|
9
|
+
import { OrganisationUnitTreeRootLoading } from './organisation-unit-tree-root-loading.js';
|
|
10
10
|
import { useExpanded } from './use-expanded/index.js';
|
|
11
11
|
import { useForceReload } from './use-force-reload.js';
|
|
12
12
|
import { useRootOrgData } from './use-root-org-data/index.js';
|
|
@@ -71,7 +71,7 @@ const OrganisationUnitTree = _ref => {
|
|
|
71
71
|
const isLoading = !called || loading;
|
|
72
72
|
return /*#__PURE__*/React.createElement("div", {
|
|
73
73
|
"data-test": dataTest
|
|
74
|
-
}, isLoading && /*#__PURE__*/React.createElement(
|
|
74
|
+
}, isLoading && /*#__PURE__*/React.createElement(OrganisationUnitTreeRootLoading, null), error && /*#__PURE__*/React.createElement(OrganisationUnitTreeRootError, {
|
|
75
75
|
error: error
|
|
76
76
|
}), !error && !isLoading && rootIds.map(rootId => {
|
|
77
77
|
const rootNode = data[rootId];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/organisation-unit-tree",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.15.0-alpha.2",
|
|
4
4
|
"description": "UI OrganisationUnitTree",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -34,15 +34,16 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@dhis2/prop-types": "^3.1.2",
|
|
37
|
-
"@dhis2-ui/checkbox": "8.
|
|
38
|
-
"@dhis2-ui/loader": "8.
|
|
39
|
-
"@dhis2-ui/node": "8.
|
|
40
|
-
"@dhis2/ui-constants": "8.
|
|
37
|
+
"@dhis2-ui/checkbox": "8.15.0-alpha.2",
|
|
38
|
+
"@dhis2-ui/loader": "8.15.0-alpha.2",
|
|
39
|
+
"@dhis2-ui/node": "8.15.0-alpha.2",
|
|
40
|
+
"@dhis2/ui-constants": "8.15.0-alpha.2",
|
|
41
41
|
"classnames": "^2.3.1",
|
|
42
42
|
"prop-types": "^15.7.2"
|
|
43
43
|
},
|
|
44
44
|
"files": [
|
|
45
|
-
"build"
|
|
45
|
+
"build",
|
|
46
|
+
"types"
|
|
46
47
|
],
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"@dhis2/app-runtime": "^3.9.0",
|
|
@@ -50,5 +51,6 @@
|
|
|
50
51
|
"react": "16.13",
|
|
51
52
|
"react-dom": "16.13",
|
|
52
53
|
"styled-jsx": "^4.0.1"
|
|
53
|
-
}
|
|
54
|
+
},
|
|
55
|
+
"types": "types"
|
|
54
56
|
}
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as React from 'react'
|
|
2
|
+
|
|
3
|
+
export type OrganisationUnitTreeRoots = string | string[]
|
|
4
|
+
|
|
5
|
+
export interface OrganisationUnitNode {
|
|
6
|
+
id: string
|
|
7
|
+
displayName: string
|
|
8
|
+
children?: number
|
|
9
|
+
path: string
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface OrganisationUnitEventPayload extends OrganisationUnitNode {
|
|
13
|
+
checked: boolean
|
|
14
|
+
selected: string[]
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface NodeLabelProps {
|
|
18
|
+
disableSelection: boolean
|
|
19
|
+
hasChildren: boolean
|
|
20
|
+
hasSelectedDescendants: boolean
|
|
21
|
+
loading: boolean
|
|
22
|
+
selected: string[]
|
|
23
|
+
open: boolean
|
|
24
|
+
path: string[]
|
|
25
|
+
singleSelection: boolean
|
|
26
|
+
node: OrganisationUnitNode
|
|
27
|
+
label: string
|
|
28
|
+
checked: boolean
|
|
29
|
+
highlighted: boolean
|
|
30
|
+
error?: Error
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface OrganisationUnitTreeProps {
|
|
34
|
+
/**
|
|
35
|
+
* Root org unit ID(s)
|
|
36
|
+
*/
|
|
37
|
+
roots: OrganisationUnitTreeRoots
|
|
38
|
+
/**
|
|
39
|
+
* Will be called with the following object:
|
|
40
|
+
* `{ id: string, displayName: string, path: string, checked: boolean, selected: string[] }`
|
|
41
|
+
*/
|
|
42
|
+
onChange: (
|
|
43
|
+
payload: OrganisationUnitEventPayload,
|
|
44
|
+
event: React.MouseEvent<HTMLSpanElement | HTMLInputElement>
|
|
45
|
+
) => void
|
|
46
|
+
/**
|
|
47
|
+
* When set, the error when loading children fails will be shown automatically
|
|
48
|
+
*/
|
|
49
|
+
autoExpandLoadingError?: boolean
|
|
50
|
+
dataTest?: string
|
|
51
|
+
/**
|
|
52
|
+
* When set to true, no unit can be selected
|
|
53
|
+
*/
|
|
54
|
+
disableSelection?: boolean
|
|
55
|
+
expanded?: boolean
|
|
56
|
+
/**
|
|
57
|
+
* All organisation units with a path that includes the provided paths will be shown.
|
|
58
|
+
* All others will not be rendered. When not provided, all org units will be shown.
|
|
59
|
+
*/
|
|
60
|
+
filter?: string[]
|
|
61
|
+
/**
|
|
62
|
+
* When true, everything will be reloaded. In order to load it again after reloading, `forceReload` has to be set to `false` and then to `true` again
|
|
63
|
+
*/
|
|
64
|
+
forceReload?: boolean
|
|
65
|
+
handleCollapse?: ({ path: string }) => void
|
|
66
|
+
handleExpand?: ({ path: string }) => void
|
|
67
|
+
/**
|
|
68
|
+
* All units provided to "highlighted" as path will be visually
|
|
69
|
+
* highlighted.
|
|
70
|
+
* Note:
|
|
71
|
+
* The d2-ui component used two props for this:
|
|
72
|
+
* * searchResults
|
|
73
|
+
* * highlightSearchResults
|
|
74
|
+
*/
|
|
75
|
+
highlighted?: string[]
|
|
76
|
+
/**
|
|
77
|
+
* An array of OU paths that will be expanded automatically
|
|
78
|
+
* as soon as they are encountered.
|
|
79
|
+
* The path of an OU is the UIDs of the OU
|
|
80
|
+
* and all its parent OUs separated by slashes (/)
|
|
81
|
+
* Note: This replaces "openFirstLevel" as that's redundant
|
|
82
|
+
*/
|
|
83
|
+
initiallyExpanded?: string[]
|
|
84
|
+
/**
|
|
85
|
+
* When provided, the 'isUserDataViewFallback' option will be sent when requesting the org units
|
|
86
|
+
*/
|
|
87
|
+
isUserDataViewFallback?: boolean
|
|
88
|
+
/**
|
|
89
|
+
* Renders the actual node component for each leaf, can be used to
|
|
90
|
+
* customize the node. The default function just returns the node's
|
|
91
|
+
* displayName
|
|
92
|
+
* Shape of the object passed to the callback:
|
|
93
|
+
* ```
|
|
94
|
+
* {
|
|
95
|
+
* label: string,
|
|
96
|
+
* node: {
|
|
97
|
+
* displayName: string,
|
|
98
|
+
* id: string,
|
|
99
|
+
* // Only provided once `loading` is false
|
|
100
|
+
* path?: string,
|
|
101
|
+
* // Only provided once `loading` is false
|
|
102
|
+
* children?: Array.<{
|
|
103
|
+
* id: string,
|
|
104
|
+
* path: string,
|
|
105
|
+
* displayName: string
|
|
106
|
+
* }>
|
|
107
|
+
* },
|
|
108
|
+
* loading: boolean,
|
|
109
|
+
* error: string,
|
|
110
|
+
* open: boolean,
|
|
111
|
+
* selected: string[],
|
|
112
|
+
* singleSelection: boolean,
|
|
113
|
+
* disableSelection: boolean,
|
|
114
|
+
* }
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
renderNodeLabel?: (props: NodeLabelProps) => React.ReactNode
|
|
118
|
+
/**
|
|
119
|
+
* An array of paths of selected OUs. The path of an OU is the UIDs of the OU and all its parent OUs separated by slashes (`/`)
|
|
120
|
+
*/
|
|
121
|
+
selected?: string[]
|
|
122
|
+
/**
|
|
123
|
+
* When set, no checkboxes will be displayed and only the first selected path in `selected` will be highlighted
|
|
124
|
+
*/
|
|
125
|
+
singleSelection?: boolean
|
|
126
|
+
/**
|
|
127
|
+
* Turns off alphabetical sorting of units
|
|
128
|
+
*/
|
|
129
|
+
suppressAlphabeticalSorting?: boolean
|
|
130
|
+
/**
|
|
131
|
+
* Called with the children's data that was loaded
|
|
132
|
+
*/
|
|
133
|
+
onChildrenLoaded?: (
|
|
134
|
+
data: OrganisationUnitNode & {
|
|
135
|
+
children: Array<Omit<OrganisationUnitNode, 'children'>>
|
|
136
|
+
}
|
|
137
|
+
) => void
|
|
138
|
+
/**
|
|
139
|
+
* Called with `{ path: string }` with the path of the parent of the level closed
|
|
140
|
+
*/
|
|
141
|
+
onCollapse?: ({ path: string }) => void
|
|
142
|
+
/**
|
|
143
|
+
* Called with `{ path: string }` with the path of the parent of the level opened
|
|
144
|
+
*/
|
|
145
|
+
onExpand?: ({ path: string }) => void
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export const OrganisationUnitTree: React.FC<OrganisationUnitTreeProps>
|
|
149
|
+
|
|
150
|
+
export interface OrganisationUnitTreeRootErrorProps {
|
|
151
|
+
error: string
|
|
152
|
+
dataTest?: string
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export const OrganisationUnitTreeRootError: React.FC<OrganisationUnitTreeRootErrorProps>
|
|
156
|
+
|
|
157
|
+
export interface OrganisationUnitTreeRootLoadingProps {
|
|
158
|
+
dataTest?: string
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export const OrganisationUnitTreeRootLoading: React.FC<OrganisationUnitTreeRootLoadingProps>
|
|
162
|
+
|
|
163
|
+
export const getAllExpandedOrgUnitPaths: (
|
|
164
|
+
initiallyExpanded: string[]
|
|
165
|
+
) => string[]
|
|
File without changes
|
|
File without changes
|