@progress/kendo-react-orgchart 5.20.0-dev.202310061256

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.
Files changed (87) hide show
  1. package/LICENSE.md +11 -0
  2. package/NOTICE.txt +117 -0
  3. package/README.md +50 -0
  4. package/about.md +3 -0
  5. package/dist/cdn/js/kendo-react-orgchart.js +1 -0
  6. package/dist/es/OrgChart.d.ts +6 -0
  7. package/dist/es/OrgChart.js +67 -0
  8. package/dist/es/OrgChartOperationDescriptors.d.ts +76 -0
  9. package/dist/es/OrgChartOperationDescriptors.js +2 -0
  10. package/dist/es/client/ClientOrgChart.d.ts +94 -0
  11. package/dist/es/client/ClientOrgChart.js +287 -0
  12. package/dist/es/client/ExpandButton.d.ts +13 -0
  13. package/dist/es/client/ExpandButton.js +23 -0
  14. package/dist/es/client/OrgChartCard.d.ts +19 -0
  15. package/dist/es/client/OrgChartCard.js +68 -0
  16. package/dist/es/client/OrgChartCardBody.d.ts +12 -0
  17. package/dist/es/client/OrgChartCardBody.js +13 -0
  18. package/dist/es/client/OrgChartGroupContainer.d.ts +19 -0
  19. package/dist/es/client/OrgChartGroupContainer.js +71 -0
  20. package/dist/es/interfaces/ChildGroup.d.ts +16 -0
  21. package/dist/es/interfaces/ChildGroup.js +1 -0
  22. package/dist/es/interfaces/OrgChartActionEvent.d.ts +22 -0
  23. package/dist/es/interfaces/OrgChartActionEvent.js +1 -0
  24. package/dist/es/interfaces/OrgChartExpandChangeEvent.d.ts +22 -0
  25. package/dist/es/interfaces/OrgChartExpandChangeEvent.js +1 -0
  26. package/dist/es/interfaces/SeverOrgChartProps.d.ts +106 -0
  27. package/dist/es/interfaces/SeverOrgChartProps.js +1 -0
  28. package/dist/es/main.d.ts +6 -0
  29. package/dist/es/main.js +3 -0
  30. package/dist/es/package-metadata.d.ts +5 -0
  31. package/dist/es/package-metadata.js +11 -0
  32. package/dist/es/processOrgChartItems.d.ts +51 -0
  33. package/dist/es/processOrgChartItems.js +163 -0
  34. package/dist/es/server/ServerGroupedOrgChart.d.ts +9 -0
  35. package/dist/es/server/ServerGroupedOrgChart.js +235 -0
  36. package/dist/es/server/ServerOrgChart.d.ts +9 -0
  37. package/dist/es/server/ServerOrgChart.js +192 -0
  38. package/dist/es/server/ServerOrgChartGroup.d.ts +96 -0
  39. package/dist/es/server/ServerOrgChartGroup.js +59 -0
  40. package/dist/es/server/ServerOrgChartNode.d.ts +75 -0
  41. package/dist/es/server/ServerOrgChartNode.js +57 -0
  42. package/dist/es/theming/theme-service.d.ts +5 -0
  43. package/dist/es/theming/theme-service.js +62 -0
  44. package/dist/es/utils/consts.d.ts +72 -0
  45. package/dist/es/utils/consts.js +72 -0
  46. package/dist/npm/OrgChart.d.ts +6 -0
  47. package/dist/npm/OrgChart.js +71 -0
  48. package/dist/npm/OrgChartOperationDescriptors.d.ts +76 -0
  49. package/dist/npm/OrgChartOperationDescriptors.js +3 -0
  50. package/dist/npm/client/ClientOrgChart.d.ts +94 -0
  51. package/dist/npm/client/ClientOrgChart.js +291 -0
  52. package/dist/npm/client/ExpandButton.d.ts +13 -0
  53. package/dist/npm/client/ExpandButton.js +27 -0
  54. package/dist/npm/client/OrgChartCard.d.ts +19 -0
  55. package/dist/npm/client/OrgChartCard.js +72 -0
  56. package/dist/npm/client/OrgChartCardBody.d.ts +12 -0
  57. package/dist/npm/client/OrgChartCardBody.js +17 -0
  58. package/dist/npm/client/OrgChartGroupContainer.d.ts +19 -0
  59. package/dist/npm/client/OrgChartGroupContainer.js +75 -0
  60. package/dist/npm/interfaces/ChildGroup.d.ts +16 -0
  61. package/dist/npm/interfaces/ChildGroup.js +2 -0
  62. package/dist/npm/interfaces/OrgChartActionEvent.d.ts +22 -0
  63. package/dist/npm/interfaces/OrgChartActionEvent.js +2 -0
  64. package/dist/npm/interfaces/OrgChartExpandChangeEvent.d.ts +22 -0
  65. package/dist/npm/interfaces/OrgChartExpandChangeEvent.js +2 -0
  66. package/dist/npm/interfaces/SeverOrgChartProps.d.ts +106 -0
  67. package/dist/npm/interfaces/SeverOrgChartProps.js +2 -0
  68. package/dist/npm/main.d.ts +6 -0
  69. package/dist/npm/main.js +21 -0
  70. package/dist/npm/package-metadata.d.ts +5 -0
  71. package/dist/npm/package-metadata.js +14 -0
  72. package/dist/npm/processOrgChartItems.d.ts +51 -0
  73. package/dist/npm/processOrgChartItems.js +167 -0
  74. package/dist/npm/server/ServerGroupedOrgChart.d.ts +9 -0
  75. package/dist/npm/server/ServerGroupedOrgChart.js +239 -0
  76. package/dist/npm/server/ServerOrgChart.d.ts +9 -0
  77. package/dist/npm/server/ServerOrgChart.js +196 -0
  78. package/dist/npm/server/ServerOrgChartGroup.d.ts +96 -0
  79. package/dist/npm/server/ServerOrgChartGroup.js +63 -0
  80. package/dist/npm/server/ServerOrgChartNode.d.ts +75 -0
  81. package/dist/npm/server/ServerOrgChartNode.js +61 -0
  82. package/dist/npm/theming/theme-service.d.ts +5 -0
  83. package/dist/npm/theming/theme-service.js +65 -0
  84. package/dist/npm/utils/consts.d.ts +72 -0
  85. package/dist/npm/utils/consts.js +75 -0
  86. package/dist/systemjs/kendo-react-orgchart.js +1 -0
  87. package/package.json +62 -0
@@ -0,0 +1,13 @@
1
+ 'use client';
2
+ import * as React from 'react';
3
+ import { OrgChartEventsContextContext } from './ClientOrgChart';
4
+ import { CardBody } from '@progress/kendo-react-layout';
5
+ /**
6
+ * @hidden
7
+ */
8
+ export var OrgChartCardBody = function (props) {
9
+ var level = props.level, children = props.children;
10
+ var context = React.useContext(OrgChartEventsContextContext);
11
+ var cardColor = context.cardColors ? context.cardColors[level] || 'green' : 'green';
12
+ return (React.createElement(CardBody, { className: "k-hstack", style: { borderTopColor: cardColor } }, children));
13
+ };
@@ -0,0 +1,19 @@
1
+ import * as React from 'react';
2
+ /**
3
+ * @hidden
4
+ */
5
+ export interface OrgChartGroupContainerProps {
6
+ /**
7
+ * @hidden
8
+ */
9
+ children?: React.ReactNode;
10
+ /**
11
+ * The styles that are applied to the OrgChart.
12
+ */
13
+ style?: React.CSSProperties;
14
+ nodes?: any[];
15
+ }
16
+ /**
17
+ * @hidden
18
+ */
19
+ export declare const OrgChartGroupContainer: React.FunctionComponent<OrgChartGroupContainerProps>;
@@ -0,0 +1,71 @@
1
+ 'use client';
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ import * as React from 'react';
25
+ import { classNames } from '@progress/kendo-react-common';
26
+ import { OrgChartEventsContextContext } from './ClientOrgChart';
27
+ /**
28
+ * @hidden
29
+ */
30
+ export var OrgChartGroupContainer = function (props) {
31
+ var nodes = props.nodes, children = props.children, style = props.style, others = __rest(props, ["nodes", "children", "style"]);
32
+ var _a = React.useState(false), selected = _a[0], setSelected = _a[1];
33
+ var context = React.useContext(OrgChartEventsContextContext);
34
+ var containerRef = React.useRef(null);
35
+ var handleKeyDown = function (event) {
36
+ if (context.onKeyDown) {
37
+ context.onKeyDown({
38
+ event: event,
39
+ items: nodes
40
+ });
41
+ }
42
+ };
43
+ var handleClick = function (event) {
44
+ if (context.onGroupAction) {
45
+ context.onGroupAction({
46
+ event: event,
47
+ items: nodes
48
+ });
49
+ }
50
+ };
51
+ var handleFocus = function (event) {
52
+ setSelected(true);
53
+ if (context.onGroupFocus) {
54
+ context.onGroupFocus({
55
+ event: event,
56
+ items: nodes,
57
+ containerRef: containerRef
58
+ });
59
+ }
60
+ };
61
+ var handleBlur = function (event) {
62
+ setSelected(false);
63
+ if (context.onGroupBlur) {
64
+ context.onGroupBlur({
65
+ event: event,
66
+ items: nodes
67
+ });
68
+ }
69
+ };
70
+ return (React.createElement("div", __assign({ role: "treeitem", "aria-selected": selected, ref: containerRef, className: classNames('k-orgchart-node-group-container', 'k-vstack', { 'k-focus': selected }), style: style, onKeyDown: handleKeyDown, onClick: handleClick, onFocus: handleFocus, onBlur: handleBlur }, others), children));
71
+ };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @hidden
3
+ */
4
+ export interface ChildGroup {
5
+ items: any[];
6
+ groupedItems: any[];
7
+ level: number;
8
+ ids: number[];
9
+ parentId: number;
10
+ hasChildren: boolean;
11
+ orientation: 'horizontal' | 'vertical';
12
+ width: number | null;
13
+ childLineWidths?: number[];
14
+ left?: number;
15
+ top?: number;
16
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Represents the OrgChartActionEvent event argument.
4
+ */
5
+ export interface OrgChartActionEvent {
6
+ /**
7
+ * Represents the triggered React event.
8
+ */
9
+ event: React.KeyboardEvent | React.MouseEvent | React.FocusEvent;
10
+ /**
11
+ * Item that triggers the event.
12
+ */
13
+ item?: any;
14
+ /**
15
+ * Items that belong to the group that triggers the event.
16
+ */
17
+ items?: any;
18
+ /**
19
+ * @hidden
20
+ */
21
+ containerRef?: React.RefObject<HTMLDivElement>;
22
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,22 @@
1
+ /// <reference types="react" />
2
+ /**
3
+ * Represents the OrgChartExpandChangeEvent event argument.
4
+ */
5
+ export interface OrgChartExpandChangeEvent {
6
+ /**
7
+ * Represents the triggered React event.
8
+ */
9
+ event: React.MouseEvent | React.KeyboardEvent;
10
+ /**
11
+ * Represents expand value of the item or group.
12
+ */
13
+ expand: boolean;
14
+ /**
15
+ * Item that triggers the event.
16
+ */
17
+ item?: any;
18
+ /**
19
+ * Items that belong to the group that triggers the event.
20
+ */
21
+ items?: any[];
22
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,106 @@
1
+ /// <reference types="react" />
2
+ import { OrgChartGroupSubtitleProps, OrgChartGroupTitleProps } from '../server/ServerOrgChartGroup';
3
+ import { OrgChartItemRenderProps } from '../server/ServerOrgChartNode';
4
+ /**
5
+ * @hidden
6
+ */
7
+ export interface ServerOrgChartProps {
8
+ /**
9
+ * @hidden
10
+ */
11
+ children?: React.ReactNode;
12
+ /**
13
+ * Sets additional classes to the OrgChart.
14
+ */
15
+ className?: string;
16
+ /**
17
+ * Sets custom id to the OrgChart.
18
+ */
19
+ id?: string;
20
+ /**
21
+ * Sets custom aria-label to the OrgChart. The default value is "Org Chart"
22
+ */
23
+ ariaLabel?: string;
24
+ /**
25
+ * Specifies the name of the field which will provide a id for the item. Defaults to `id`.
26
+ */
27
+ idField?: string;
28
+ /**
29
+ * Specifies the name of the field which will provide an array representation of the item children.
30
+ */
31
+ childrenField?: string;
32
+ /**
33
+ * Specifies the name of the field which will provide a Boolean representation for the expanded state of the item. Defaults to `expanded`.
34
+ */
35
+ expandField?: string;
36
+ /**
37
+ * Specifies the name of the field which will provide a title representation for the item. Defaults to `text`.
38
+ */
39
+ titleField?: string;
40
+ /**
41
+ * Specifies the name of the field which indicates to the OrgChart that an item has
42
+ * children even if the children are not initially passed. Used for implementing the load-on-demand feature.
43
+ * Defaults to `undefined`.
44
+ */
45
+ hasChildrenField?: string;
46
+ /**
47
+ * Specifies the name of the field which will provide a subtitle representation for the item. Defaults to `text`.
48
+ */
49
+ subTitleField?: string;
50
+ /**
51
+ * Specifies the avatar of the field which will provide a avatar representation for the item. Defaults to `text`.
52
+ */
53
+ avatarField?: string;
54
+ /**
55
+ * Specifies a string array with the colors applied to the items. By default the colors come from the Kendo Theme that is used.
56
+ */
57
+ cardsColors?: string[];
58
+ /**
59
+ * The styles that are applied to the OrgChart.
60
+ */
61
+ style?: React.CSSProperties;
62
+ /**
63
+ * Sets the data of the OrgChart.
64
+ */
65
+ data?: any[];
66
+ /**
67
+ * Specifies the field by which the OrgChart data is grouped.
68
+ */
69
+ groupField?: string;
70
+ /**
71
+ * Specifies the height of the card of the OrgChart.
72
+ */
73
+ cardHeight?: number;
74
+ /**
75
+ * Specifies the width of the card of the OrgChart.
76
+ */
77
+ cardWidth?: number;
78
+ /**
79
+ * Specifies the height of the title of the grouped OrgChart.
80
+ */
81
+ groupTitleHeight?: number;
82
+ /**
83
+ * Specifies the height of the subtitle of the grouped OrgChart.
84
+ */
85
+ groupSubtitleHeight?: number;
86
+ /**
87
+ * Defines the component that will be used for rendering each of the OrgChart items.
88
+ */
89
+ itemRender?: React.ComponentType<OrgChartItemRenderProps>;
90
+ /**
91
+ * Defines the component that will be used for rendering each of the grouped OrgChart title.
92
+ */
93
+ groupTitleRender?: React.ComponentType<OrgChartGroupTitleProps>;
94
+ /**
95
+ * Defines the component that will be used for rendering each of the grouped OrgChart subtitle.
96
+ */
97
+ groupSubtitleRender?: React.ComponentType<OrgChartGroupSubtitleProps>;
98
+ /**
99
+ * Specifies the height of the vertical line of the OrgChart.
100
+ */
101
+ verticalLine?: number;
102
+ /**
103
+ * Specifies the width the OrgChart.
104
+ */
105
+ height?: string | number;
106
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ export { ServerOrgChart } from './server/ServerOrgChart';
2
+ export { ServerOrgChartProps } from './interfaces/SeverOrgChartProps';
3
+ export * from './OrgChart';
4
+ export { OrgChartExpandChangeEvent } from './interfaces/OrgChartExpandChangeEvent';
5
+ export { OrgChartActionEvent } from './interfaces/OrgChartActionEvent';
6
+ export * from './processOrgChartItems';
@@ -0,0 +1,3 @@
1
+ export { ServerOrgChart } from './server/ServerOrgChart';
2
+ export * from './OrgChart';
3
+ export * from './processOrgChartItems';
@@ -0,0 +1,5 @@
1
+ import { PackageMetadata } from '@progress/kendo-licensing';
2
+ /**
3
+ * @hidden
4
+ */
5
+ export declare const packageMetadata: PackageMetadata;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @hidden
3
+ */
4
+ export var packageMetadata = {
5
+ name: '@progress/kendo-react-orgchart',
6
+ productName: 'KendoReact',
7
+ productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
+ publishDate: 1696596140,
9
+ version: '',
10
+ licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
11
+ };
@@ -0,0 +1,51 @@
1
+ import { OrgChartOperationDescriptors } from './OrgChartOperationDescriptors';
2
+ /**
3
+ * A helper function which applies the specified operation descriptors to the data.
4
+ * * [Expanding and collapsing items]({% slug expansion_ways_treeview %}#toc-using-a-helper-function)
5
+ * * [Selecting and deselecting items]({% slug selection_ways_treeview %}#toc-using-a-helper-function)
6
+ * * [Checking and unchecking items]({% slug check_helper_funcs_treeview %})
7
+ *
8
+ * @param data - The data that will be processed.
9
+ * @param operations - The operation descriptors that will be applied to the data.
10
+ * @returns - The processed copy of the input data.
11
+ *
12
+ * @example
13
+ * ```jsx
14
+ * class App extends React.Component {
15
+ * state = { items: tree, expand: [], select: [], check: [] };
16
+ * render() {
17
+ * const { expand, select, check } = this.state;
18
+ * return (
19
+ * <OrgChart
20
+ * data={processOrgChartItems(this.state.items, { expand, select, check })}
21
+ * expandIcons={true} onExpandChange={this.onExpandChange} checkboxes={true}
22
+ * onCheckChange={event => this.setState({ check: [ event.itemHierarchicalIndex ] })}
23
+ * onItemClick={event => this.setState({ select: [ event.itemHierarchicalIndex ] })}
24
+ * />
25
+ * );
26
+ * }
27
+ * onExpandChange = (event) => {
28
+ * let expand = this.state.expand.slice();
29
+ * const index = expand.indexOf(event.itemHierarchicalIndex);
30
+ * index === -1 ? expand.push(event.itemHierarchicalIndex) : expand.splice(index, 1);
31
+ * this.setState({ expand });
32
+ * }
33
+ * }
34
+ *
35
+ * const tree = [{
36
+ * text: 'Item1',
37
+ * items: [
38
+ * { text: 'Item1.1' },
39
+ * { text: 'Item1.2' },
40
+ * { text: 'Item1.3', items: [{ text: 'Item1.3.1' }] }]
41
+ * }, {
42
+ * text: 'Item2', disabled: true,
43
+ * items: [{ text: 'Item2.1' }, { text: 'Item2.2' }, { text: 'Item2.3' }]
44
+ * }, {
45
+ * text: 'Item3'
46
+ * }];
47
+ *
48
+ * ReactDOM.render(<App />, document.querySelector('my-app'));
49
+ * ```
50
+ */
51
+ export declare function processOrgChartItems(data: any[] | null | undefined, operations: OrgChartOperationDescriptors): any[];
@@ -0,0 +1,163 @@
1
+ /* eslint-disable max-len */
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ import { updateItem, resolveItemsIds, getNestedValue, isArray } from '@progress/kendo-react-common';
14
+ import { EXPAND_FIELD, SELECT_FIELD, CHECK_FIELD, CHECK_INDETERMINATE_FIELD, CHILDREN_FIELD } from './utils/consts';
15
+ /**
16
+ * A helper function which applies the specified operation descriptors to the data.
17
+ * * [Expanding and collapsing items]({% slug expansion_ways_treeview %}#toc-using-a-helper-function)
18
+ * * [Selecting and deselecting items]({% slug selection_ways_treeview %}#toc-using-a-helper-function)
19
+ * * [Checking and unchecking items]({% slug check_helper_funcs_treeview %})
20
+ *
21
+ * @param data - The data that will be processed.
22
+ * @param operations - The operation descriptors that will be applied to the data.
23
+ * @returns - The processed copy of the input data.
24
+ *
25
+ * @example
26
+ * ```jsx
27
+ * class App extends React.Component {
28
+ * state = { items: tree, expand: [], select: [], check: [] };
29
+ * render() {
30
+ * const { expand, select, check } = this.state;
31
+ * return (
32
+ * <OrgChart
33
+ * data={processOrgChartItems(this.state.items, { expand, select, check })}
34
+ * expandIcons={true} onExpandChange={this.onExpandChange} checkboxes={true}
35
+ * onCheckChange={event => this.setState({ check: [ event.itemHierarchicalIndex ] })}
36
+ * onItemClick={event => this.setState({ select: [ event.itemHierarchicalIndex ] })}
37
+ * />
38
+ * );
39
+ * }
40
+ * onExpandChange = (event) => {
41
+ * let expand = this.state.expand.slice();
42
+ * const index = expand.indexOf(event.itemHierarchicalIndex);
43
+ * index === -1 ? expand.push(event.itemHierarchicalIndex) : expand.splice(index, 1);
44
+ * this.setState({ expand });
45
+ * }
46
+ * }
47
+ *
48
+ * const tree = [{
49
+ * text: 'Item1',
50
+ * items: [
51
+ * { text: 'Item1.1' },
52
+ * { text: 'Item1.2' },
53
+ * { text: 'Item1.3', items: [{ text: 'Item1.3.1' }] }]
54
+ * }, {
55
+ * text: 'Item2', disabled: true,
56
+ * items: [{ text: 'Item2.1' }, { text: 'Item2.2' }, { text: 'Item2.3' }]
57
+ * }, {
58
+ * text: 'Item3'
59
+ * }];
60
+ *
61
+ * ReactDOM.render(<App />, document.querySelector('my-app'));
62
+ * ```
63
+ */
64
+ export function processOrgChartItems(data, operations) {
65
+ if (!data || !data.length) {
66
+ return [];
67
+ }
68
+ var result = data;
69
+ var cloneField = operations.cloneField || 'cloned';
70
+ var expandField = operations.expandField || EXPAND_FIELD;
71
+ var selectField = operations.selectField || SELECT_FIELD;
72
+ var checkField = operations.checkField || CHECK_FIELD;
73
+ var childrenField = operations.childrenField || CHILDREN_FIELD;
74
+ result = handleOperation(result, expandField, operations.expand, cloneField, childrenField);
75
+ result = handleOperation(result, selectField, operations.select, cloneField, childrenField);
76
+ result = handleOperation(result, checkField, operations.check, cloneField, childrenField);
77
+ applyCheckIndeterminate(result, childrenField, operations.check);
78
+ return result;
79
+ }
80
+ function handleOperation(items, defaultField, operation, cloneField, childrenField) {
81
+ if (operation) {
82
+ var _a = parseOperation(operation, defaultField), ids = _a.ids, field = _a.field;
83
+ var indices = !isArray(operation) && operation.idField ? resolveItemsIds(ids, operation.idField, items, childrenField) : ids;
84
+ return raiseFlags(items, indices, field, cloneField, childrenField);
85
+ }
86
+ else {
87
+ return items;
88
+ }
89
+ }
90
+ function parseOperation(operation, defaultField) {
91
+ var ids;
92
+ var field;
93
+ if (isArray(operation)) {
94
+ ids = operation;
95
+ field = defaultField;
96
+ }
97
+ else {
98
+ ids = operation.ids || [];
99
+ field = operation.operationField || defaultField;
100
+ }
101
+ return { ids: ids, field: field };
102
+ }
103
+ function raiseFlags(items, indices, field, cloneField, childrenField) {
104
+ var result = items;
105
+ indices.forEach(function (itemIndex) {
106
+ result = updateItem(result, itemIndex, function (item) { return raiseNestedFlag(field, item); }, cloneField, childrenField);
107
+ });
108
+ return result;
109
+ }
110
+ function raiseNestedFlag(fieldName, dataItem) {
111
+ var fields = (fieldName || '').split('.');
112
+ var item = dataItem;
113
+ for (var index = 0; index < fields.length; index++) {
114
+ var field = fields[index];
115
+ if (index === fields.length - 1) {
116
+ item[field] = true;
117
+ }
118
+ else if (item[field] !== undefined) {
119
+ item[field] = __assign({}, item[field]);
120
+ item = item[field];
121
+ }
122
+ else {
123
+ return;
124
+ }
125
+ }
126
+ }
127
+ function applyCheckIndeterminate(items, childrenField, check) {
128
+ if (check && !isArray(check) && check.applyCheckIndeterminate) {
129
+ var checkField = parseOperation(check, CHECK_FIELD).field;
130
+ var checkIndeterminateField = check.checkIndeterminateField || CHECK_INDETERMINATE_FIELD;
131
+ for (var i = 0; i < items.length; i++) {
132
+ var item = items[i];
133
+ var subItems = item[childrenField];
134
+ if (subItems) {
135
+ applyCheckIndeterminateHelper(subItems, getNestedValue(checkField, item) ? [] : [item], childrenField, checkField, checkIndeterminateField);
136
+ }
137
+ }
138
+ }
139
+ }
140
+ function applyCheckIndeterminateHelper(data, parents, childrenField, checkField, checkIndeterminateField) {
141
+ // The updates will be direct because the corresponding items
142
+ // are already cloned because of their checked children.
143
+ var parentsAlreadyUpdated = false;
144
+ for (var i = 0; i < data.length; i++) {
145
+ var item = data[i];
146
+ if (getNestedValue(checkField, item)) {
147
+ if (!parentsAlreadyUpdated) {
148
+ for (var j = 0; j < parents.length; j++) {
149
+ raiseNestedFlag(checkIndeterminateField, parents[j]);
150
+ }
151
+ }
152
+ parentsAlreadyUpdated = true;
153
+ if (item[childrenField]) {
154
+ applyCheckIndeterminateHelper(item[childrenField], [], childrenField, checkField, checkIndeterminateField);
155
+ }
156
+ }
157
+ else {
158
+ if (item[childrenField]) {
159
+ applyCheckIndeterminateHelper(item[childrenField], parentsAlreadyUpdated ? [item] : parents.concat([item]), childrenField, checkField, checkIndeterminateField);
160
+ }
161
+ }
162
+ }
163
+ }
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { ServerOrgChartProps } from '../interfaces/SeverOrgChartProps';
3
+ /**
4
+ * @hidden
5
+ */
6
+ export declare const ServerGroupedOrgChart: {
7
+ (props: ServerOrgChartProps): JSX.Element;
8
+ displayName: string;
9
+ };