@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.
- package/LICENSE.md +11 -0
- package/NOTICE.txt +117 -0
- package/README.md +50 -0
- package/about.md +3 -0
- package/dist/cdn/js/kendo-react-orgchart.js +1 -0
- package/dist/es/OrgChart.d.ts +6 -0
- package/dist/es/OrgChart.js +67 -0
- package/dist/es/OrgChartOperationDescriptors.d.ts +76 -0
- package/dist/es/OrgChartOperationDescriptors.js +2 -0
- package/dist/es/client/ClientOrgChart.d.ts +94 -0
- package/dist/es/client/ClientOrgChart.js +287 -0
- package/dist/es/client/ExpandButton.d.ts +13 -0
- package/dist/es/client/ExpandButton.js +23 -0
- package/dist/es/client/OrgChartCard.d.ts +19 -0
- package/dist/es/client/OrgChartCard.js +68 -0
- package/dist/es/client/OrgChartCardBody.d.ts +12 -0
- package/dist/es/client/OrgChartCardBody.js +13 -0
- package/dist/es/client/OrgChartGroupContainer.d.ts +19 -0
- package/dist/es/client/OrgChartGroupContainer.js +71 -0
- package/dist/es/interfaces/ChildGroup.d.ts +16 -0
- package/dist/es/interfaces/ChildGroup.js +1 -0
- package/dist/es/interfaces/OrgChartActionEvent.d.ts +22 -0
- package/dist/es/interfaces/OrgChartActionEvent.js +1 -0
- package/dist/es/interfaces/OrgChartExpandChangeEvent.d.ts +22 -0
- package/dist/es/interfaces/OrgChartExpandChangeEvent.js +1 -0
- package/dist/es/interfaces/SeverOrgChartProps.d.ts +106 -0
- package/dist/es/interfaces/SeverOrgChartProps.js +1 -0
- package/dist/es/main.d.ts +6 -0
- package/dist/es/main.js +3 -0
- package/dist/es/package-metadata.d.ts +5 -0
- package/dist/es/package-metadata.js +11 -0
- package/dist/es/processOrgChartItems.d.ts +51 -0
- package/dist/es/processOrgChartItems.js +163 -0
- package/dist/es/server/ServerGroupedOrgChart.d.ts +9 -0
- package/dist/es/server/ServerGroupedOrgChart.js +235 -0
- package/dist/es/server/ServerOrgChart.d.ts +9 -0
- package/dist/es/server/ServerOrgChart.js +192 -0
- package/dist/es/server/ServerOrgChartGroup.d.ts +96 -0
- package/dist/es/server/ServerOrgChartGroup.js +59 -0
- package/dist/es/server/ServerOrgChartNode.d.ts +75 -0
- package/dist/es/server/ServerOrgChartNode.js +57 -0
- package/dist/es/theming/theme-service.d.ts +5 -0
- package/dist/es/theming/theme-service.js +62 -0
- package/dist/es/utils/consts.d.ts +72 -0
- package/dist/es/utils/consts.js +72 -0
- package/dist/npm/OrgChart.d.ts +6 -0
- package/dist/npm/OrgChart.js +71 -0
- package/dist/npm/OrgChartOperationDescriptors.d.ts +76 -0
- package/dist/npm/OrgChartOperationDescriptors.js +3 -0
- package/dist/npm/client/ClientOrgChart.d.ts +94 -0
- package/dist/npm/client/ClientOrgChart.js +291 -0
- package/dist/npm/client/ExpandButton.d.ts +13 -0
- package/dist/npm/client/ExpandButton.js +27 -0
- package/dist/npm/client/OrgChartCard.d.ts +19 -0
- package/dist/npm/client/OrgChartCard.js +72 -0
- package/dist/npm/client/OrgChartCardBody.d.ts +12 -0
- package/dist/npm/client/OrgChartCardBody.js +17 -0
- package/dist/npm/client/OrgChartGroupContainer.d.ts +19 -0
- package/dist/npm/client/OrgChartGroupContainer.js +75 -0
- package/dist/npm/interfaces/ChildGroup.d.ts +16 -0
- package/dist/npm/interfaces/ChildGroup.js +2 -0
- package/dist/npm/interfaces/OrgChartActionEvent.d.ts +22 -0
- package/dist/npm/interfaces/OrgChartActionEvent.js +2 -0
- package/dist/npm/interfaces/OrgChartExpandChangeEvent.d.ts +22 -0
- package/dist/npm/interfaces/OrgChartExpandChangeEvent.js +2 -0
- package/dist/npm/interfaces/SeverOrgChartProps.d.ts +106 -0
- package/dist/npm/interfaces/SeverOrgChartProps.js +2 -0
- package/dist/npm/main.d.ts +6 -0
- package/dist/npm/main.js +21 -0
- package/dist/npm/package-metadata.d.ts +5 -0
- package/dist/npm/package-metadata.js +14 -0
- package/dist/npm/processOrgChartItems.d.ts +51 -0
- package/dist/npm/processOrgChartItems.js +167 -0
- package/dist/npm/server/ServerGroupedOrgChart.d.ts +9 -0
- package/dist/npm/server/ServerGroupedOrgChart.js +239 -0
- package/dist/npm/server/ServerOrgChart.d.ts +9 -0
- package/dist/npm/server/ServerOrgChart.js +196 -0
- package/dist/npm/server/ServerOrgChartGroup.d.ts +96 -0
- package/dist/npm/server/ServerOrgChartGroup.js +63 -0
- package/dist/npm/server/ServerOrgChartNode.d.ts +75 -0
- package/dist/npm/server/ServerOrgChartNode.js +61 -0
- package/dist/npm/theming/theme-service.d.ts +5 -0
- package/dist/npm/theming/theme-service.js +65 -0
- package/dist/npm/utils/consts.d.ts +72 -0
- package/dist/npm/utils/consts.js +75 -0
- package/dist/systemjs/kendo-react-orgchart.js +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import { classNames, kendoThemeMaps } from '@progress/kendo-react-common';
|
|
14
|
+
import { ServerOrgChartNode } from './ServerOrgChartNode';
|
|
15
|
+
import { ServerOrgChartGroup } from './ServerOrgChartGroup';
|
|
16
|
+
import { groupBy } from '@progress/kendo-data-query';
|
|
17
|
+
import { GROUP_PADDINGS, GROUP_SUBTITLE_HEIGHT, GROUP_TITLE_HEIGHT, HORIZONTAL_GAP, NODE_HEIGHT, NODE_WIDTH, VERTICAL_LINE } from '../utils/consts';
|
|
18
|
+
var setDataByGroups = function (_a) {
|
|
19
|
+
var dataByGroups = _a.dataByGroups, _b = _a.data, data = _b === void 0 ? [] : _b, cardWidth = _a.cardWidth, childrenField = _a.childrenField, idField = _a.idField, expandField = _a.expandField, hasChildrenField = _a.hasChildrenField, groupField = _a.groupField, _c = _a.level, level = _c === void 0 ? 1 : _c, _d = _a.parentId, parentId = _d === void 0 ? 0 : _d;
|
|
20
|
+
data.forEach(function (element) {
|
|
21
|
+
var items = element[childrenField];
|
|
22
|
+
var expanded = element[expandField];
|
|
23
|
+
if (expanded && items && items.length) {
|
|
24
|
+
var hasChildren = items.some(function (it) { return it[childrenField] && it[childrenField].length
|
|
25
|
+
|| (hasChildrenField && it[hasChildrenField]); });
|
|
26
|
+
var orientation_1 = hasChildren ? 'horizontal' : 'vertical';
|
|
27
|
+
var width = hasChildren ? null : cardWidth + 2 * HORIZONTAL_GAP;
|
|
28
|
+
var alreadyAdded = dataByGroups.find(function (dbg) { return dbg.parentId === parentId; });
|
|
29
|
+
var alreadyAddedParent = dataByGroups.find(function (dbg) { return dbg.ids.includes(parentId); });
|
|
30
|
+
var haveSameGroup = false;
|
|
31
|
+
if (alreadyAdded) {
|
|
32
|
+
var addedResourseID_1 = alreadyAdded.ids[0];
|
|
33
|
+
var addedItem = alreadyAddedParent.items.find(function (i) { return i[idField] === addedResourseID_1; });
|
|
34
|
+
var newItem = alreadyAddedParent.items.find(function (i) { return i[idField] === element[idField]; });
|
|
35
|
+
haveSameGroup = addedItem[groupField] === newItem[groupField];
|
|
36
|
+
}
|
|
37
|
+
if (alreadyAdded && haveSameGroup) {
|
|
38
|
+
alreadyAdded.ids.push(element[idField]);
|
|
39
|
+
alreadyAdded.items = alreadyAdded.items.concat(items);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
dataByGroups.push({
|
|
43
|
+
ids: [element[idField]],
|
|
44
|
+
items: items,
|
|
45
|
+
level: level,
|
|
46
|
+
parentId: parentId,
|
|
47
|
+
hasChildren: hasChildren,
|
|
48
|
+
orientation: orientation_1,
|
|
49
|
+
width: width
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
setDataByGroups({
|
|
53
|
+
dataByGroups: dataByGroups,
|
|
54
|
+
data: element[childrenField],
|
|
55
|
+
childrenField: childrenField,
|
|
56
|
+
cardWidth: cardWidth,
|
|
57
|
+
idField: idField,
|
|
58
|
+
expandField: expandField,
|
|
59
|
+
hasChildrenField: hasChildrenField,
|
|
60
|
+
groupField: groupField,
|
|
61
|
+
level: level + 1,
|
|
62
|
+
parentId: element[idField]
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
var setGroupedGroupsWidths = function (dataByGroups, cardWidth) {
|
|
68
|
+
var nodeWidth = cardWidth || NODE_WIDTH;
|
|
69
|
+
var groupsFromLeavesToRoot = dataByGroups.sort(function (a, b) { return b.level - a.level; });
|
|
70
|
+
groupsFromLeavesToRoot.forEach(function (group) {
|
|
71
|
+
if (!group.width) {
|
|
72
|
+
var childGroups = groupsFromLeavesToRoot.filter(function (gr) { return group.ids.includes(gr.parentId); });
|
|
73
|
+
if (childGroups.length) {
|
|
74
|
+
var maxChildGroupWidth = Math.max.apply(Math, childGroups.map(function (chg) { return chg.width || 0; }));
|
|
75
|
+
var maxChildGroupsLength = Math.max.apply(Math, childGroups.map(function (chg) { return chg.groupedItems.length || 0; }));
|
|
76
|
+
var maxSubItemsWidth = Math.max.apply(Math, group.groupedItems.map(function (chg) {
|
|
77
|
+
var subItemsLength = group.orientation === 'horizontal' ? chg.items.length : 1;
|
|
78
|
+
return subItemsLength * (nodeWidth + 2 * HORIZONTAL_GAP) + HORIZONTAL_GAP * (subItemsLength - 1);
|
|
79
|
+
}));
|
|
80
|
+
var newGroupWidth = maxChildGroupWidth * maxChildGroupsLength + HORIZONTAL_GAP * (maxChildGroupsLength - 1);
|
|
81
|
+
group.width = Math.max(newGroupWidth, maxSubItemsWidth);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
var maxSubItemsWidth = Math.max.apply(Math, group.groupedItems.map(function (chg) {
|
|
85
|
+
var subItemsLength = group.orientation === 'horizontal' ? chg.items.length : 1;
|
|
86
|
+
return subItemsLength * (nodeWidth + 2 * HORIZONTAL_GAP) + HORIZONTAL_GAP * (subItemsLength - 1);
|
|
87
|
+
}));
|
|
88
|
+
group.width = maxSubItemsWidth;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
var setGroupedGroupsLeft = function (dataByGroups, idField) {
|
|
94
|
+
var groupsFromRootToLeaves = dataByGroups.sort(function (a, b) { return a.level - b.level; });
|
|
95
|
+
groupsFromRootToLeaves.forEach(function (group) {
|
|
96
|
+
var _a;
|
|
97
|
+
if (group.level === 0) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
var parentGroup = groupsFromRootToLeaves.find(function (gr) { return gr.ids.includes(group.parentId); });
|
|
101
|
+
var groupIndex = (parentGroup === null || parentGroup === void 0 ? void 0 : parentGroup.groupedItems.findIndex(function (g) { return g.items.some(function (it) { return group.ids.includes(it[idField]); }); })) || 0;
|
|
102
|
+
var subLinks = (parentGroup === null || parentGroup === void 0 ? void 0 : parentGroup.groupedItems) || [];
|
|
103
|
+
var subLinkWidth = parentGroup.width
|
|
104
|
+
? (parentGroup.width - ((subLinks.length - 1) * HORIZONTAL_GAP)) / subLinks.length
|
|
105
|
+
: 0;
|
|
106
|
+
if (!group.left) {
|
|
107
|
+
var newLeft_1 = (parentGroup === null || parentGroup === void 0 ? void 0 : parentGroup.left) || 0;
|
|
108
|
+
subLinks.forEach(function (_subG, index) {
|
|
109
|
+
if (index < groupIndex) {
|
|
110
|
+
newLeft_1 += subLinkWidth + HORIZONTAL_GAP;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
group.left = newLeft_1;
|
|
114
|
+
}
|
|
115
|
+
var parentWidth = (parentGroup === null || parentGroup === void 0 ? void 0 : parentGroup.width) || 0;
|
|
116
|
+
var parentGroupItems = (parentGroup === null || parentGroup === void 0 ? void 0 : parentGroup.groupedItems.length) || 1;
|
|
117
|
+
var newWidth = ((parentWidth) - ((parentGroupItems - 1) * HORIZONTAL_GAP)) / parentGroupItems;
|
|
118
|
+
group.width = newWidth;
|
|
119
|
+
if (parentGroup) {
|
|
120
|
+
var childLinewidth = group.width - ((group.width - (group.groupedItems.length - 1) * HORIZONTAL_GAP)) / (group.groupedItems.length);
|
|
121
|
+
if (!parentGroup.childLineWidths) {
|
|
122
|
+
parentGroup.childLineWidths = [childLinewidth];
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
(_a = parentGroup.childLineWidths) === null || _a === void 0 ? void 0 : _a.push(childLinewidth);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
var setGroupsTop = function (dataByGroups, cardHeight, groupTitleHeight, groupSubtitleHeight, verticalLine) {
|
|
131
|
+
var nodeHeight = cardHeight || NODE_HEIGHT;
|
|
132
|
+
var vLineHeight = verticalLine || VERTICAL_LINE;
|
|
133
|
+
var groupNodeHeight = groupTitleHeight + groupSubtitleHeight + GROUP_PADDINGS;
|
|
134
|
+
dataByGroups.forEach(function (group) {
|
|
135
|
+
var level = group.level;
|
|
136
|
+
var newTop = ((nodeHeight + vLineHeight + groupNodeHeight) * level) + (VERTICAL_LINE * (level ? level - 1 : 0)) -
|
|
137
|
+
((vLineHeight - VERTICAL_LINE) * (level ? 1 : 0));
|
|
138
|
+
group.top = newTop;
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
var getHeight = function (dataByGroups, cardHeight, verticalLine, groupTitleHeight, groupSubtitleHeight) {
|
|
142
|
+
var nodeHeight = cardHeight || NODE_HEIGHT;
|
|
143
|
+
var vLineHeight = verticalLine || VERTICAL_LINE;
|
|
144
|
+
var groupHeight = (groupTitleHeight || GROUP_TITLE_HEIGHT) + (groupSubtitleHeight || GROUP_SUBTITLE_HEIGHT);
|
|
145
|
+
var groupNodeHeight = groupHeight + GROUP_PADDINGS;
|
|
146
|
+
var newHeight = Math.max.apply(Math, dataByGroups.map(function (group) {
|
|
147
|
+
var top = group.top || 0;
|
|
148
|
+
var maxItemsLength = Math.max.apply(Math, group.groupedItems.map(function (gr) { return gr.items.length; }));
|
|
149
|
+
var plusButtonHeight = group.hasChildren ? VERTICAL_LINE : 0;
|
|
150
|
+
var height = group.orientation === 'horizontal'
|
|
151
|
+
? nodeHeight + vLineHeight + groupNodeHeight + vLineHeight + plusButtonHeight
|
|
152
|
+
: maxItemsLength * (nodeHeight + vLineHeight) + groupNodeHeight + vLineHeight;
|
|
153
|
+
return top + height;
|
|
154
|
+
}));
|
|
155
|
+
return newHeight;
|
|
156
|
+
};
|
|
157
|
+
/**
|
|
158
|
+
* @hidden
|
|
159
|
+
*/
|
|
160
|
+
export var ServerGroupedOrgChart = function (props) {
|
|
161
|
+
var defaultProps = {
|
|
162
|
+
width: '100%',
|
|
163
|
+
data: [],
|
|
164
|
+
ariaLabel: 'Org Chart',
|
|
165
|
+
idField: 'id',
|
|
166
|
+
childrenField: 'items',
|
|
167
|
+
avatarField: 'avatar',
|
|
168
|
+
titleField: 'title',
|
|
169
|
+
subTitleField: 'subtitle',
|
|
170
|
+
expandField: 'expanded',
|
|
171
|
+
orientation: 'horizontal'
|
|
172
|
+
};
|
|
173
|
+
var _a = __assign(__assign({}, defaultProps), props), id = _a.id, width = _a.width, data = _a.data, groupField = _a.groupField, cardWidth = _a.cardWidth, cardHeight = _a.cardHeight, groupTitleHeight = _a.groupTitleHeight, groupSubtitleHeight = _a.groupSubtitleHeight, verticalLine = _a.verticalLine, idField = _a.idField, childrenField = _a.childrenField, expandField = _a.expandField, hasChildrenField = _a.hasChildrenField, avatarField = _a.avatarField, titleField = _a.titleField, subTitleField = _a.subTitleField, cardsColors = _a.cardsColors, ariaLabel = _a.ariaLabel, itemRender = _a.itemRender, groupTitleRender = _a.groupTitleRender, groupSubtitleRender = _a.groupSubtitleRender, height = _a.height;
|
|
174
|
+
var dataByGroups = [{
|
|
175
|
+
items: data,
|
|
176
|
+
level: 0,
|
|
177
|
+
hasChildren: true,
|
|
178
|
+
orientation: 'horizontal',
|
|
179
|
+
ids: [0],
|
|
180
|
+
parentId: null,
|
|
181
|
+
width: null
|
|
182
|
+
}];
|
|
183
|
+
setDataByGroups({
|
|
184
|
+
dataByGroups: dataByGroups,
|
|
185
|
+
data: data,
|
|
186
|
+
cardWidth: cardWidth,
|
|
187
|
+
expandField: expandField,
|
|
188
|
+
hasChildrenField: hasChildrenField,
|
|
189
|
+
childrenField: childrenField,
|
|
190
|
+
idField: idField,
|
|
191
|
+
groupField: groupField
|
|
192
|
+
});
|
|
193
|
+
dataByGroups.map(function (g) {
|
|
194
|
+
g.groupedItems = groupBy(g.items, [{ field: groupField }]);
|
|
195
|
+
});
|
|
196
|
+
setGroupedGroupsWidths(dataByGroups, cardWidth);
|
|
197
|
+
setGroupedGroupsLeft(dataByGroups, idField);
|
|
198
|
+
setGroupsTop(dataByGroups, cardHeight || NODE_HEIGHT, (groupTitleHeight || GROUP_TITLE_HEIGHT), (groupSubtitleHeight || GROUP_SUBTITLE_HEIGHT), verticalLine);
|
|
199
|
+
var calculatedHeight = getHeight(dataByGroups, cardHeight || NODE_HEIGHT, (groupTitleHeight || GROUP_TITLE_HEIGHT), (groupSubtitleHeight || GROUP_SUBTITLE_HEIGHT));
|
|
200
|
+
return (React.createElement("div", { className: "k-orgchart-container", style: { width: width, height: height || calculatedHeight } }, dataByGroups.map(function (group) {
|
|
201
|
+
var _a;
|
|
202
|
+
var level = group.level;
|
|
203
|
+
var groupInnerItems = group.groupedItems.map(function (grIt) {
|
|
204
|
+
var expanded = grIt.items.some(function (i) { return i[expandField]; });
|
|
205
|
+
return __assign(__assign({}, grIt), { expanded: expanded });
|
|
206
|
+
});
|
|
207
|
+
var groupedInnerExpandedItems = groupInnerItems.filter(function (gII) { return gII.expanded; });
|
|
208
|
+
var justifyContent = level === 0 ? 'center' : 'around';
|
|
209
|
+
var groupOrientation = 'horizontal';
|
|
210
|
+
var cardColor = cardsColors ? cardsColors[level] || 'green' : 'green';
|
|
211
|
+
return (React.createElement("div", { role: level === 0 ? 'tree' : 'group', id: id + '-' + level + '-' + group.ids[0], "aria-label": level === 0 ? ariaLabel : undefined, "aria-orientation": level === 0 ? groupOrientation : undefined, key: group.ids[0] + '_' + level, className: classNames('k-orgchart-group', "k-orgchart-level-".concat(level), 'k-pos-absolute', (_a = {},
|
|
212
|
+
_a["k-".concat(kendoThemeMaps.orientationMap[groupOrientation])] = groupOrientation,
|
|
213
|
+
_a["k-justify-content-".concat(justifyContent)] = justifyContent,
|
|
214
|
+
_a['k-orgchart-group-h'] = props.groupField,
|
|
215
|
+
_a)), style: {
|
|
216
|
+
width: group.width || '100%',
|
|
217
|
+
left: group.left,
|
|
218
|
+
top: group.top
|
|
219
|
+
} }, data.length > 0 &&
|
|
220
|
+
groupInnerItems.map(function (groupedNodes, gIndex) {
|
|
221
|
+
var hasChildren = groupedNodes.items.some(function (it) { return it[childrenField] && it[childrenField].length
|
|
222
|
+
|| (hasChildrenField && it[hasChildrenField]); });
|
|
223
|
+
var subGroupWidth = group.width
|
|
224
|
+
? (group.width - ((groupInnerItems.length - 1) * HORIZONTAL_GAP)) / groupInnerItems.length
|
|
225
|
+
: undefined;
|
|
226
|
+
var expandedIndex = groupedInnerExpandedItems.findIndex((function (gr) { return gr === groupedNodes; }));
|
|
227
|
+
return (React.createElement(ServerOrgChartGroup, { id: id + '-' + (level + 1) + '-' + groupedNodes.items[0][idField], style: { width: subGroupWidth }, groupTitleHeight: groupTitleHeight, groupSubtitleHeight: groupSubtitleHeight, groupTitleRender: groupTitleRender, groupSubtitleRender: groupSubtitleRender, key: gIndex, level: level, verticalLine: verticalLine || VERTICAL_LINE, title: groupedNodes.items[0][groupField || titleField], subtitle: groupField, orientation: group.orientation, childLineWidth: (hasChildren && groupedNodes.expanded && group.orientation === 'horizontal')
|
|
228
|
+
? group.childLineWidths[expandedIndex]
|
|
229
|
+
: 0, line: hasChildren, nodes: groupedNodes.items, expanded: groupedNodes.expanded, plus: hasChildren }, groupedNodes.items.map(function (node, index) {
|
|
230
|
+
return (React.createElement(ServerOrgChartNode, { cardHeight: cardHeight, cardWidth: cardWidth, itemRender: itemRender, color: cardColor, key: index, level: level, avatar: node[avatarField], title: node[titleField], subtitle: node[subTitleField], verticalLine: 0, line: false, node: node, childLineWidth: 0, plus: false }, node.text));
|
|
231
|
+
})));
|
|
232
|
+
})));
|
|
233
|
+
})));
|
|
234
|
+
};
|
|
235
|
+
ServerGroupedOrgChart.displayName = 'KendoServerGroupedOrgChart';
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import * as React from 'react';
|
|
13
|
+
import { classNames, kendoThemeMaps } from '@progress/kendo-react-common';
|
|
14
|
+
import { ServerOrgChartNode } from './ServerOrgChartNode';
|
|
15
|
+
import { HORIZONTAL_GAP, NODE_HEIGHT, NODE_WIDTH, VERTICAL_LINE } from '../utils/consts';
|
|
16
|
+
var setDataByGroups = function (_a) {
|
|
17
|
+
var dataByGroups = _a.dataByGroups, _b = _a.data, data = _b === void 0 ? [] : _b, cardWidth = _a.cardWidth, childrenField = _a.childrenField, idField = _a.idField, expandField = _a.expandField, hasChildrenField = _a.hasChildrenField, groupField = _a.groupField, _c = _a.level, level = _c === void 0 ? 1 : _c, _d = _a.parentId, parentId = _d === void 0 ? 0 : _d;
|
|
18
|
+
data.forEach(function (element) {
|
|
19
|
+
var items = element[childrenField];
|
|
20
|
+
var expanded = element[expandField];
|
|
21
|
+
if (expanded && items && items.length) {
|
|
22
|
+
var hasChildren = items.some(function (it) { return it[childrenField] && it[childrenField].length
|
|
23
|
+
|| (hasChildrenField && it[hasChildrenField]); });
|
|
24
|
+
var orientation_1 = hasChildren ? 'horizontal' : 'vertical';
|
|
25
|
+
var width = hasChildren ? null : cardWidth;
|
|
26
|
+
dataByGroups.push({
|
|
27
|
+
ids: [element[idField]],
|
|
28
|
+
items: items,
|
|
29
|
+
level: level,
|
|
30
|
+
parentId: parentId,
|
|
31
|
+
hasChildren: hasChildren,
|
|
32
|
+
orientation: orientation_1,
|
|
33
|
+
width: width
|
|
34
|
+
});
|
|
35
|
+
setDataByGroups({
|
|
36
|
+
dataByGroups: dataByGroups,
|
|
37
|
+
data: element[childrenField],
|
|
38
|
+
childrenField: childrenField,
|
|
39
|
+
cardWidth: cardWidth,
|
|
40
|
+
idField: idField,
|
|
41
|
+
expandField: expandField,
|
|
42
|
+
hasChildrenField: hasChildrenField,
|
|
43
|
+
groupField: groupField,
|
|
44
|
+
level: level + 1,
|
|
45
|
+
parentId: element[idField]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
var setGroupsWidths = function (dataByGroups, cardWidth) {
|
|
51
|
+
var nodeWidth = cardWidth || NODE_WIDTH;
|
|
52
|
+
var groupsFromLeavesToRoot = dataByGroups.sort(function (a, b) { return b.level - a.level; });
|
|
53
|
+
groupsFromLeavesToRoot.forEach(function (group) {
|
|
54
|
+
if (!group.width) {
|
|
55
|
+
var childGroups = groupsFromLeavesToRoot.filter(function (gr) { return group.ids.includes(gr.parentId); });
|
|
56
|
+
var maxChildGroupWidth = childGroups.length
|
|
57
|
+
? Math.max.apply(Math, childGroups.map(function (chg) { return chg.width || 0; })) : nodeWidth;
|
|
58
|
+
var subItemsLength = group.orientation === 'horizontal' ? group.items.length : 1;
|
|
59
|
+
var newGroupWidth = maxChildGroupWidth * subItemsLength + HORIZONTAL_GAP * (subItemsLength - 1);
|
|
60
|
+
group.width = newGroupWidth;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
var setGroupsLeft = function (dataByGroups, childrenField, idField) {
|
|
65
|
+
var groupsFromRootToLeaves = dataByGroups.sort(function (a, b) { return a.level - b.level; });
|
|
66
|
+
groupsFromRootToLeaves.forEach(function (group) {
|
|
67
|
+
if (group.level === 0) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
var parentGroup = groupsFromRootToLeaves.find(function (gr) { return gr.ids.includes(group.parentId); });
|
|
71
|
+
var groupIndex = (parentGroup === null || parentGroup === void 0 ? void 0 : parentGroup.items.findIndex(function (g) { return group.ids.includes(g[idField]); })) || 0;
|
|
72
|
+
var subLinks = (parentGroup === null || parentGroup === void 0 ? void 0 : parentGroup.items) || [];
|
|
73
|
+
var subLinkWidth = parentGroup.width
|
|
74
|
+
? (parentGroup.width - ((subLinks.length - 1) * HORIZONTAL_GAP)) / subLinks.length
|
|
75
|
+
: 0;
|
|
76
|
+
if (!group.left) {
|
|
77
|
+
var newLeft_1 = (parentGroup === null || parentGroup === void 0 ? void 0 : parentGroup.left) || 0;
|
|
78
|
+
subLinks.forEach(function (_subG, index) {
|
|
79
|
+
if (index < groupIndex) {
|
|
80
|
+
newLeft_1 += subLinkWidth + HORIZONTAL_GAP;
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
group.left = newLeft_1;
|
|
84
|
+
}
|
|
85
|
+
var parentWidth = (parentGroup === null || parentGroup === void 0 ? void 0 : parentGroup.width) || 0;
|
|
86
|
+
var parentGroupItems = (parentGroup === null || parentGroup === void 0 ? void 0 : parentGroup.items.length) || 1;
|
|
87
|
+
var newWidth = ((parentWidth) - ((parentGroupItems - 1) * HORIZONTAL_GAP)) / parentGroupItems;
|
|
88
|
+
group.width = newWidth;
|
|
89
|
+
var childLineWidths = parentGroup === null || parentGroup === void 0 ? void 0 : parentGroup.items.map(function (subitem) {
|
|
90
|
+
var groupNodesCount = subitem[childrenField] ? subitem[childrenField].length : 0;
|
|
91
|
+
var subItem = groupsFromRootToLeaves.find(function (gr) { return gr.ids.includes(subitem[idField]); });
|
|
92
|
+
var subItemWidth = (subItem === null || subItem === void 0 ? void 0 : subItem.width) || 0;
|
|
93
|
+
if ((subItem === null || subItem === void 0 ? void 0 : subItem.orientation) === 'vertical' || groupNodesCount === 0 || !subitem.expanded) {
|
|
94
|
+
return 0;
|
|
95
|
+
}
|
|
96
|
+
return subItemWidth - ((subItemWidth - (groupNodesCount - 1) * HORIZONTAL_GAP)) / (groupNodesCount);
|
|
97
|
+
});
|
|
98
|
+
if (parentGroup) {
|
|
99
|
+
parentGroup.childLineWidths = childLineWidths;
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
var setGroupsTop = function (dataByGroups, cardHeight, verticalLine) {
|
|
104
|
+
var nodeHeight = cardHeight || NODE_HEIGHT;
|
|
105
|
+
var vLineHeight = verticalLine || VERTICAL_LINE;
|
|
106
|
+
dataByGroups.forEach(function (group) {
|
|
107
|
+
var level = group.level;
|
|
108
|
+
var newTop = ((nodeHeight + vLineHeight) * level) + (VERTICAL_LINE * (level ? level - 1 : 0)) -
|
|
109
|
+
((vLineHeight - VERTICAL_LINE) * (level ? 1 : 0));
|
|
110
|
+
group.top = newTop;
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
var getHeight = function (dataByGroups, cardHeight, verticalLine) {
|
|
114
|
+
var nodeHeight = cardHeight || NODE_HEIGHT;
|
|
115
|
+
var vLineHeight = verticalLine || VERTICAL_LINE;
|
|
116
|
+
var newHeight = Math.max.apply(Math, dataByGroups.map(function (group) {
|
|
117
|
+
var top = group.top || 0;
|
|
118
|
+
var itemsLength = group.items.length;
|
|
119
|
+
var height = group.orientation === 'horizontal'
|
|
120
|
+
? nodeHeight + vLineHeight + vLineHeight
|
|
121
|
+
: itemsLength * (nodeHeight + vLineHeight);
|
|
122
|
+
return top + height;
|
|
123
|
+
}));
|
|
124
|
+
return newHeight;
|
|
125
|
+
};
|
|
126
|
+
/**
|
|
127
|
+
* @hidden
|
|
128
|
+
*/
|
|
129
|
+
export var ServerOrgChart = function (props) {
|
|
130
|
+
var defaultProps = {
|
|
131
|
+
width: '100%',
|
|
132
|
+
data: [],
|
|
133
|
+
ariaLabel: 'Org Chart',
|
|
134
|
+
idField: 'id',
|
|
135
|
+
childrenField: 'items',
|
|
136
|
+
avatarField: 'avatar',
|
|
137
|
+
titleField: 'title',
|
|
138
|
+
subTitleField: 'subtitle',
|
|
139
|
+
expandField: 'expanded'
|
|
140
|
+
};
|
|
141
|
+
var _a = __assign(__assign({}, defaultProps), props), id = _a.id, width = _a.width, data = _a.data, groupField = _a.groupField, cardWidth = _a.cardWidth, cardHeight = _a.cardHeight, verticalLine = _a.verticalLine, idField = _a.idField, childrenField = _a.childrenField, hasChildrenField = _a.hasChildrenField, expandField = _a.expandField, avatarField = _a.avatarField, titleField = _a.titleField, subTitleField = _a.subTitleField, ariaLabel = _a.ariaLabel, itemRender = _a.itemRender, height = _a.height;
|
|
142
|
+
var dataByGroups = [{
|
|
143
|
+
items: data,
|
|
144
|
+
level: 0,
|
|
145
|
+
hasChildren: true,
|
|
146
|
+
orientation: 'horizontal',
|
|
147
|
+
ids: [0],
|
|
148
|
+
parentId: null,
|
|
149
|
+
width: null
|
|
150
|
+
}];
|
|
151
|
+
setDataByGroups({
|
|
152
|
+
dataByGroups: dataByGroups,
|
|
153
|
+
data: data,
|
|
154
|
+
cardWidth: cardWidth,
|
|
155
|
+
expandField: expandField,
|
|
156
|
+
hasChildrenField: hasChildrenField,
|
|
157
|
+
childrenField: childrenField,
|
|
158
|
+
idField: idField,
|
|
159
|
+
groupField: groupField
|
|
160
|
+
});
|
|
161
|
+
setGroupsWidths(dataByGroups, cardWidth);
|
|
162
|
+
setGroupsLeft(dataByGroups, childrenField, idField);
|
|
163
|
+
setGroupsTop(dataByGroups, cardHeight, verticalLine);
|
|
164
|
+
var calculatedHeight = getHeight(dataByGroups, cardHeight, verticalLine);
|
|
165
|
+
return (React.createElement("div", { className: "k-orgchart-container", style: { width: width, height: height || calculatedHeight } }, dataByGroups.map(function (group) {
|
|
166
|
+
var _a, _b;
|
|
167
|
+
var level = group.level;
|
|
168
|
+
var groupInnerItems = group.items;
|
|
169
|
+
var justifyContent = level === 0 ? 'center' : 'around';
|
|
170
|
+
var groupOrientation = group.orientation;
|
|
171
|
+
return (React.createElement("div", { role: level === 0 ? 'tree' : 'group', id: id + '-' + level + '-' + group.ids[0], "aria-label": level === 0 ? ariaLabel : undefined, "aria-orientation": level === 0 ? groupOrientation : undefined, key: group.ids[0] + '_' + level, className: classNames('k-orgchart-group', "k-orgchart-level-".concat(level), 'k-pos-absolute', (_a = {},
|
|
172
|
+
_a["k-".concat(kendoThemeMaps.orientationMap[groupOrientation])] = groupOrientation,
|
|
173
|
+
_a["k-justify-content-".concat(justifyContent)] = justifyContent,
|
|
174
|
+
_a)), style: {
|
|
175
|
+
width: group.width || '100%',
|
|
176
|
+
left: group.left,
|
|
177
|
+
top: group.top
|
|
178
|
+
} }, groupInnerItems.length > 0 &&
|
|
179
|
+
React.createElement("div", { role: "group", style: { width: '100%' }, className: classNames('k-orgchart-node-container', 'k-justify-content-around', (_b = {},
|
|
180
|
+
_b["k-".concat(kendoThemeMaps.orientationMap[group.orientation])] = group.orientation,
|
|
181
|
+
_b)) }, groupInnerItems.map(function (node, index) {
|
|
182
|
+
var hasChildren = node[childrenField] && node[childrenField].length
|
|
183
|
+
|| (hasChildrenField && node[hasChildrenField]);
|
|
184
|
+
var hasDownLine = hasChildren || (group.orientation === 'vertical' && index !== groupInnerItems.length - 1);
|
|
185
|
+
var hasVertLine = group.orientation === 'vertical' && index !== 0 ? 0 : verticalLine || VERTICAL_LINE;
|
|
186
|
+
var maxSubGroupWidth = group.childLineWidths ? Math.max.apply(Math, group.childLineWidths) : undefined;
|
|
187
|
+
var expandedNode = node[expandField];
|
|
188
|
+
return (React.createElement(ServerOrgChartNode, { id: id + '-' + (level + 1) + '-' + node[idField], style: { width: maxSubGroupWidth }, itemRender: itemRender, cardHeight: cardHeight, cardWidth: cardWidth, verticalLine: hasVertLine, key: index, level: level, avatar: node[avatarField], title: node[titleField], subtitle: node[subTitleField], line: hasDownLine, expanded: expandedNode, node: node, childLineWidth: (hasChildren && expandedNode && group.orientation === 'horizontal') ? group.childLineWidths[index] : 0, plus: hasChildren }, node.text));
|
|
189
|
+
}))));
|
|
190
|
+
})));
|
|
191
|
+
};
|
|
192
|
+
ServerOrgChart.displayName = 'KendoServerOrgChart';
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* @hidden
|
|
4
|
+
*/
|
|
5
|
+
export interface OrgChartGroupTitleProps {
|
|
6
|
+
/**
|
|
7
|
+
* The styles that are applied to the OrgChart group title.
|
|
8
|
+
*/
|
|
9
|
+
style?: React.CSSProperties;
|
|
10
|
+
/**
|
|
11
|
+
* The default class that is applied to the OrgChart group title.
|
|
12
|
+
*/
|
|
13
|
+
className?: string;
|
|
14
|
+
/**
|
|
15
|
+
* The default title that are passed to the OrgChart group.
|
|
16
|
+
*/
|
|
17
|
+
title?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The collection of inner items of the group.
|
|
20
|
+
*/
|
|
21
|
+
items?: any[];
|
|
22
|
+
/**
|
|
23
|
+
* The level of the group.
|
|
24
|
+
*/
|
|
25
|
+
level?: number;
|
|
26
|
+
/**
|
|
27
|
+
* The expanded state of the group.
|
|
28
|
+
*/
|
|
29
|
+
expanded?: boolean;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
*/
|
|
34
|
+
export interface OrgChartGroupSubtitleProps {
|
|
35
|
+
/**
|
|
36
|
+
* The styles that are applied to the OrgChart.
|
|
37
|
+
*/
|
|
38
|
+
style?: React.CSSProperties;
|
|
39
|
+
/**
|
|
40
|
+
* The default class that is applied to the OrgChart group title.
|
|
41
|
+
*/
|
|
42
|
+
className?: string;
|
|
43
|
+
/**
|
|
44
|
+
* The default subtitle that are passed to the OrgChart group.
|
|
45
|
+
*/
|
|
46
|
+
subtitle?: string;
|
|
47
|
+
/**
|
|
48
|
+
* The collection of inner items of the group.
|
|
49
|
+
*/
|
|
50
|
+
items?: any[];
|
|
51
|
+
/**
|
|
52
|
+
* The level of the group.
|
|
53
|
+
*/
|
|
54
|
+
level?: number;
|
|
55
|
+
/**
|
|
56
|
+
* The expanded state of the group.
|
|
57
|
+
*/
|
|
58
|
+
expanded?: boolean;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @hidden
|
|
62
|
+
*/
|
|
63
|
+
export interface ServerOrgChartGroupProps {
|
|
64
|
+
/**
|
|
65
|
+
* @hidden
|
|
66
|
+
*/
|
|
67
|
+
children?: React.ReactNode;
|
|
68
|
+
/**
|
|
69
|
+
* Sets additional classes to the OrgChart.
|
|
70
|
+
*/
|
|
71
|
+
className?: string;
|
|
72
|
+
id?: string;
|
|
73
|
+
/**
|
|
74
|
+
* The styles that are applied to the OrgChart.
|
|
75
|
+
*/
|
|
76
|
+
style?: React.CSSProperties;
|
|
77
|
+
title?: string;
|
|
78
|
+
subtitle?: string;
|
|
79
|
+
line?: boolean;
|
|
80
|
+
plus?: boolean;
|
|
81
|
+
focus?: boolean;
|
|
82
|
+
expanded?: boolean;
|
|
83
|
+
nodes?: any[];
|
|
84
|
+
level: number;
|
|
85
|
+
groupTitleHeight?: number;
|
|
86
|
+
groupSubtitleHeight?: number;
|
|
87
|
+
childLineWidth?: number;
|
|
88
|
+
verticalLine?: number;
|
|
89
|
+
orientation?: 'horizontal' | 'vertical';
|
|
90
|
+
groupTitleRender?: React.ComponentType<OrgChartGroupTitleProps>;
|
|
91
|
+
groupSubtitleRender?: React.ComponentType<OrgChartGroupSubtitleProps>;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* @hidden
|
|
95
|
+
*/
|
|
96
|
+
export declare const ServerOrgChartGroup: React.FunctionComponent<ServerOrgChartGroupProps>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import * as React from 'react';
|
|
24
|
+
import { classNames, kendoThemeMaps } from '@progress/kendo-react-common';
|
|
25
|
+
import { ExpandButton } from '../client/ExpandButton';
|
|
26
|
+
import { OrgChartGroupContainer } from '../client/OrgChartGroupContainer';
|
|
27
|
+
import { GROUP_SUBTITLE_HEIGHT, GROUP_TITLE_HEIGHT } from '../utils/consts';
|
|
28
|
+
var ORGCHARTGROUP_CLASSNAME = 'k-orgchart-node-group';
|
|
29
|
+
var ORGCHART_NODE_GROUP_TITLE_CLASSNAME = 'k-orgchart-node-group-title';
|
|
30
|
+
var ORGCHART_NODE_GROUP_SUBTITLE_CLASSNAME = 'k-orgchart-node-group-subtitle';
|
|
31
|
+
/**
|
|
32
|
+
* @hidden
|
|
33
|
+
*/
|
|
34
|
+
export var ServerOrgChartGroup = function (props) {
|
|
35
|
+
var _a;
|
|
36
|
+
var defaultProps = {
|
|
37
|
+
orientation: 'horizontal'
|
|
38
|
+
};
|
|
39
|
+
var _b = __assign(__assign({}, defaultProps), props), id = _b.id, title = _b.title, subtitle = _b.subtitle, line = _b.line, plus = _b.plus, focus = _b.focus, level = _b.level, verticalLine = _b.verticalLine, childLineWidth = _b.childLineWidth, orientation = _b.orientation, expanded = _b.expanded, nodes = _b.nodes, groupTitleHeight = _b.groupTitleHeight, groupSubtitleHeight = _b.groupSubtitleHeight, groupTitleRender = _b.groupTitleRender, groupSubtitleRender = _b.groupSubtitleRender, other = __rest(_b, ["id", "title", "subtitle", "line", "plus", "focus", "level", "verticalLine", "childLineWidth", "orientation", "expanded", "nodes", "groupTitleHeight", "groupSubtitleHeight", "groupTitleRender", "groupSubtitleRender"]);
|
|
40
|
+
var TitleRender = groupTitleRender;
|
|
41
|
+
var SubtitleRender = groupSubtitleRender;
|
|
42
|
+
var titleStyle = { height: groupTitleHeight || GROUP_TITLE_HEIGHT };
|
|
43
|
+
var subtitleStyle = { height: groupSubtitleHeight || GROUP_SUBTITLE_HEIGHT };
|
|
44
|
+
return (React.createElement("div", __assign({}, other, { className: classNames(props.className, ORGCHARTGROUP_CLASSNAME, 'k-vstack', 'k-align-items-center') }),
|
|
45
|
+
level !== 0 && React.createElement("div", { className: "k-orgchart-line k-orgchart-line-v k-orgchart-line-v-top", style: { height: verticalLine } }),
|
|
46
|
+
React.createElement(OrgChartGroupContainer, { nodes: nodes, "aria-expanded": !!expanded, "aria-keyshortcuts": "Enter", "aria-level": level + 1, "aria-owns": id },
|
|
47
|
+
TitleRender
|
|
48
|
+
? React.createElement(TitleRender, { style: titleStyle, className: ORGCHART_NODE_GROUP_TITLE_CLASSNAME, title: title, items: nodes, level: level, expanded: expanded })
|
|
49
|
+
: React.createElement("div", { className: ORGCHART_NODE_GROUP_TITLE_CLASSNAME, style: titleStyle }, title),
|
|
50
|
+
SubtitleRender
|
|
51
|
+
? React.createElement(SubtitleRender, { style: subtitleStyle, className: ORGCHART_NODE_GROUP_SUBTITLE_CLASSNAME, subtitle: subtitle, items: nodes, level: level, expanded: expanded })
|
|
52
|
+
: React.createElement("div", { className: ORGCHART_NODE_GROUP_SUBTITLE_CLASSNAME, style: subtitleStyle }, subtitle),
|
|
53
|
+
React.createElement("div", { role: "group", style: { width: '100%' }, className: classNames('k-orgchart-node-container', 'k-justify-content-around', (_a = {},
|
|
54
|
+
_a["k-".concat(kendoThemeMaps.orientationMap[orientation] || orientation)] = orientation,
|
|
55
|
+
_a)) }, props.children)),
|
|
56
|
+
line && React.createElement("div", { className: "k-orgchart-line k-orgchart-line-v" }),
|
|
57
|
+
plus && React.createElement(ExpandButton, { expanded: expanded, nodes: nodes }),
|
|
58
|
+
plus && !!childLineWidth && React.createElement("div", { className: "k-orgchart-line k-orgchart-line-h", style: { width: childLineWidth, marginTop: -15 } })));
|
|
59
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { OrgChartActionEvent, OrgChartExpandChangeEvent } from '../main';
|
|
3
|
+
/**
|
|
4
|
+
* The props that are passed to the itemRender component.
|
|
5
|
+
*/
|
|
6
|
+
export interface OrgChartItemRenderProps {
|
|
7
|
+
/**
|
|
8
|
+
* The item passed to the ItemRender.
|
|
9
|
+
*/
|
|
10
|
+
item?: any;
|
|
11
|
+
/**
|
|
12
|
+
* The title of the item.
|
|
13
|
+
*/
|
|
14
|
+
title?: string;
|
|
15
|
+
/**
|
|
16
|
+
* The subtitle of the item.
|
|
17
|
+
*/
|
|
18
|
+
subtitle?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The level of the item.
|
|
21
|
+
*/
|
|
22
|
+
level?: number;
|
|
23
|
+
/**
|
|
24
|
+
* The expanded state of the item.
|
|
25
|
+
*/
|
|
26
|
+
expanded?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* The color of the item.
|
|
29
|
+
*/
|
|
30
|
+
color?: string;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @hidden
|
|
34
|
+
*/
|
|
35
|
+
export interface ServerOrgChartNodeProps {
|
|
36
|
+
/**
|
|
37
|
+
* @hidden
|
|
38
|
+
*/
|
|
39
|
+
children?: React.ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* Sets additional classes to the OrgChart.
|
|
42
|
+
*/
|
|
43
|
+
className?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Passes the OrgChart id to the node.
|
|
46
|
+
*/
|
|
47
|
+
id?: string;
|
|
48
|
+
/**
|
|
49
|
+
* The styles that are applied to the OrgChart.
|
|
50
|
+
*/
|
|
51
|
+
style?: React.CSSProperties;
|
|
52
|
+
level: number;
|
|
53
|
+
childLineWidth?: number;
|
|
54
|
+
title?: string;
|
|
55
|
+
subtitle?: string;
|
|
56
|
+
details?: boolean;
|
|
57
|
+
color?: string;
|
|
58
|
+
line?: boolean;
|
|
59
|
+
plus?: boolean;
|
|
60
|
+
expanded?: boolean;
|
|
61
|
+
avatar?: string;
|
|
62
|
+
avatarType?: string;
|
|
63
|
+
cardHeight?: number;
|
|
64
|
+
cardWidth?: number;
|
|
65
|
+
verticalLine?: number;
|
|
66
|
+
itemRender?: React.ComponentType<OrgChartItemRenderProps>;
|
|
67
|
+
onExpandChange?: (ev: OrgChartExpandChangeEvent) => void;
|
|
68
|
+
onItemAction?: (ev: OrgChartActionEvent) => void;
|
|
69
|
+
onItemKeyDown?: (ev: OrgChartActionEvent) => void;
|
|
70
|
+
node?: any;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* @hidden
|
|
74
|
+
*/
|
|
75
|
+
export declare const ServerOrgChartNode: React.FunctionComponent<ServerOrgChartNodeProps>;
|