@yworks/react-yfiles-company-ownership 1.0.0

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 ADDED
@@ -0,0 +1,24 @@
1
+ This source code can be used as part of a yFiles for HTML application.
2
+ https://www.yworks.com/yfileshtml
3
+ Copyright (c) 2000-2024 by yWorks GmbH, Vor dem Kreuzberg 28,
4
+ 72070 Tübingen, Germany. All rights reserved.
5
+
6
+ Any redistribution of the files in this repository in source code or other form,
7
+ with or without modification, is not permitted.
8
+ The creation of derivative works is prohibited, unless otherwise explicitly permitted.
9
+
10
+ Owners of a valid software license for a yFiles for HTML version
11
+ are allowed to use these sources as basis for their own yFiles for HTML powered applications.
12
+ Use of such programs is governed by the rights and conditions as set out in the
13
+ yFiles for HTML license agreement.
14
+
15
+ THIS SOFTWARE IS PROVIDED ''AS IS'' AND ANY EXPRESS OR IMPLIED
16
+ WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18
+ NO EVENT SHALL yWorks BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
20
+ TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
22
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
23
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,159 @@
1
+ # yFiles React Company Ownership Component
2
+
3
+
4
+ [![yFiles React Company Ownership Component](https://raw.githubusercontent.com/yWorks/react-yfiles-company-ownership/main/assets/react-company-ownership-hero.png)](https://docs.yworks.com/react-yfiles-company-ownership)
5
+
6
+ Welcome to the *yFiles React Company Ownership* component, a powerful and versatile React component based
7
+ on the [yFiles](https://www.yworks.com/yfiles-overview) library. This component enables seamless integration
8
+ for displaying company ownership charts in your React applications.
9
+
10
+ ## Getting Started
11
+
12
+ 1. **Installation:**
13
+ Install the component via npm by running the following command in your project directory:
14
+ ```bash
15
+ npm install @yworks/react-yfiles-company-ownership
16
+ ```
17
+
18
+ The company-ownership module has some peer dependencies that must be installed somewhere in your project. Since it is a React module, `react` and `react-dom` dependencies are needed.
19
+
20
+ Additionally, the component relies on the [yFiles](https://www.yworks.com/yfiles-overview) library which is not published to the public npm registry. You can learn how to work with the yFiles npm module in our [Developer's Guide](https://docs.yworks.com/yfileshtml/#/dguide/yfiles_npm_module).
21
+
22
+ Ensure that the dependencies in the `package.json` file resemble the following:
23
+ ```json
24
+ {
25
+ ...
26
+ "dependencies": {
27
+ "@yworks/react-yfiles-company-ownership": "^1.0.0",
28
+ "react": "^18.2.0",
29
+ "react-dom": "^18.2.0",
30
+ "yfiles": "<yFiles package path>/lib/yfiles-26.0.0.tgz",
31
+ ...
32
+ }
33
+ }
34
+ ```
35
+
36
+ 2. **License:**
37
+ Before using the component, a valid [yFiles for HTML](https://www.yworks.com/products/yfiles-for-html) version is required. You can evaluate yFiles for 60 days free of charge on [my.yworks.com](https://my.yworks.com/signup?product=YFILES_HTML_EVAL).
38
+ Be sure to invoke the <TypeLink type="registerLicense" /> function to furnish the license file before utilizing the company-ownership component.
39
+
40
+ 3. **Usage:**
41
+ Utilize the component in your application. Make sure to import the CSS stylesheet.
42
+
43
+ ```tsx
44
+ import {
45
+ CompanyOwnership,
46
+ CompanyOwnershipData,
47
+ Entity,
48
+ Ownership,
49
+ registerLicense
50
+ } from '@yworks/react-yfiles-company-ownership'
51
+
52
+ import '@yworks/react-yfiles-company-ownership/dist/index.css'
53
+
54
+ import yFilesLicense from './license.json'
55
+
56
+ function App() {
57
+ registerLicense(yFilesLicense)
58
+
59
+ const data: CompanyOwnershipData<Entity, Ownership> = {
60
+ companies: [
61
+ {
62
+ id: 1,
63
+ name: 'Monster Inc',
64
+ type: 'Corporation'
65
+ },
66
+ {
67
+ id: 2,
68
+ name: 'Connect Partner',
69
+ type: 'RCTB'
70
+ },
71
+ {
72
+ id: 3,
73
+ name: 'Large Scale Trust',
74
+ type: 'Trust'
75
+ }
76
+ ],
77
+ connections: [
78
+ {
79
+ type: 'Ownership',
80
+ ownership: 0.4,
81
+ sourceId: 1,
82
+ targetId: 2
83
+ },
84
+ {
85
+ type: 'Ownership',
86
+ ownership: 0.2,
87
+ sourceId: 1,
88
+ targetId: 3
89
+ }
90
+ ]
91
+ }
92
+
93
+ return <CompanyOwnership data={data}></CompanyOwnership>
94
+ }
95
+
96
+ export default App
97
+ ```
98
+
99
+ > **Note:** By default, the `CompanyOwnership` component adjusts its size to match the size of its parent element. Therefore, it is necessary to set the dimensions of the containing element or apply styling directly to the `CompanyOwnership` component. This can be achieved by defining a CSS class or applying inline styles.
100
+
101
+ ## Documentation
102
+
103
+ Find the full documentation, API and many code examples in our [documentation](https://docs.yworks.com/react-yfiles-company-ownership).
104
+
105
+ ## Live Playground
106
+
107
+ [![Live Playground](https://raw.githubusercontent.com/yWorks/react-yfiles-company-ownership/main/assets/playground.png)](https://docs.yworks.com/react-yfiles-company-ownership/introduction/welcome)
108
+
109
+ Try the yFiles React Company Ownership component directly in your browser with our [playground](https://docs.yworks.com/react-yfiles-company-ownership/introduction/welcome)
110
+
111
+ ## Features
112
+
113
+ The component provides versatile features out of the box that can be further tailored to specific use cases.
114
+
115
+ <table>
116
+ <tr>
117
+ <td>
118
+ <a href="https://docs.yworks.com/react-yfiles-company-ownership/introduction/welcome"><img src="https://raw.githubusercontent.com/yWorks/react-yfiles-company-ownership/main/assets/default-shapes.png" title="Default Shapes" alt="Default Shapes"></a><br>
119
+ <a href="https://docs.yworks.com/react-yfiles-company-ownership/introduction/welcome">Default Shapes</a>
120
+ </td>
121
+ <td>
122
+ <a href="https://docs.yworks.com/react-yfiles-company-ownership/features/custom-items"><img src="https://raw.githubusercontent.com/yWorks/react-yfiles-company-ownership/main/assets/custom-visualization.png" title="Custom visualization" alt="Custom visualization"></a><br>
123
+ <a href="https://docs.yworks.com/react-yfiles-company-ownership/features/custom-items">Custom visualization</a>
124
+ </td>
125
+ </tr>
126
+ <tr>
127
+ <td>
128
+ <a href="https://docs.yworks.com/react-yfiles-company-ownership/introduction/welcome"><img src="https://raw.githubusercontent.com/yWorks/react-yfiles-company-ownership/main/assets/level-of-detail.png" title="Level of detail visualization" alt="Level of detail visualization"></a><br>
129
+ <a href="https://docs.yworks.com/react-yfiles-company-ownership/introduction/welcome">Level of detail visualization</a>
130
+ </td>
131
+ <td>
132
+ <a href="https://docs.yworks.com/react-yfiles-company-ownership/features/search"><img src="https://raw.githubusercontent.com/yWorks/react-yfiles-company-ownership/main/assets/search.png" title="Search" alt="Search"></a><br>
133
+ <a href="https://docs.yworks.com/react-yfiles-company-ownership/features/search">Search</a>
134
+ </td>
135
+ </tr>
136
+ </table>
137
+
138
+ Find all features in the [documentation](https://docs.yworks.com/react-yfiles-company-ownership) and try them directly in the
139
+ browser with our integrated code playground.
140
+
141
+ ## Licensing
142
+
143
+ All owners of a valid software license for [yFiles for HTML](https://www.yworks.com/products/yfiles-for-html)
144
+ are allowed to use these sources as the basis for their own [yFiles for HTML](https://www.yworks.com/products/yfiles-for-html)
145
+ powered applications.
146
+
147
+ Use of such programs is governed by the rights and conditions as set out in the
148
+ [yFiles for HTML license agreement](https://www.yworks.com/products/yfiles-for-html/sla).
149
+
150
+ You can evaluate yFiles for 60 days free of charge on [my.yworks.com](https://my.yworks.com/signup?product=YFILES_HTML_EVAL).
151
+
152
+ For more information, see the `LICENSE` file.
153
+
154
+ ## Learn More
155
+
156
+ Explore the possibilities of visualizing large ownership hierarchies with the yFiles Company Ownership Component.
157
+ For further information about [yFiles for HTML](https://www.yworks.com/yfiles-overview) and our company, please visit [yWorks.com](https://www.yworks.com).
158
+
159
+ For support or feedback, please reach out to [our support team](https://www.yworks.com/contact) or open an [issue on GitHub](https://github.com/yWorks/react-yfiles-company-ownership/issues). Happy diagramming!
@@ -0,0 +1,505 @@
1
+ import { GraphComponent, ILayoutAlgorithm } from 'yfiles';
2
+ import * as react_jsx_runtime from 'react/jsx-runtime';
3
+ import { CSSProperties, ComponentType, PropsWithChildren } from 'react';
4
+ import { EdgeStyle, RenderNodeProps, RenderTooltipProps, ContextMenuItemProvider, RenderContextMenuProps, ExportSettings, PrintSettings } from '@yworks/react-yfiles-core';
5
+
6
+ /**
7
+ * The item's unique id.
8
+ */
9
+ type EntityId = string | number;
10
+ /**
11
+ * The basic actor in a company ownership chart. This could be (among others) a company, a bank, or
12
+ * an individual. See the {@link EntityType} for the available types.
13
+ */
14
+ interface Entity {
15
+ /**
16
+ * The item's unique id.
17
+ */
18
+ id: EntityId;
19
+ /**
20
+ * The entity's optional type.
21
+ * The type determines the color and shape of an entity in the default visualization.
22
+ */
23
+ type?: EntityType;
24
+ /**
25
+ * The optional render width of this item. If the width is not specified, it is determined by measuring the
26
+ * item visualization unless a default size is defined by {@link CompanyOwnershipProps.nodeSize}.
27
+ */
28
+ width?: number;
29
+ /**
30
+ * The optional render height of this item. If the height is not specified, it is determined by measuring the
31
+ * item visualization unless a default size is defined by {@link CompanyOwnershipProps.nodeSize}.
32
+ */
33
+ height?: number;
34
+ /**
35
+ * An optional name of the entity. The default visualization renders the name as a label on the entity.
36
+ */
37
+ name?: string;
38
+ /**
39
+ * The optional CSS class name that can be accessed in a custom component that renders the item.
40
+ */
41
+ className?: string;
42
+ /**
43
+ * The optional CSS style that can be accessed in a custom component that renders the item.
44
+ */
45
+ style?: CSSProperties;
46
+ }
47
+ /**
48
+ * The basic data type for the connections between entities visualized by the {@link CompanyOwnership} component.
49
+ */
50
+ interface Connection {
51
+ /**
52
+ * The id of the connection source entity
53
+ */
54
+ sourceId: EntityId;
55
+ /**
56
+ * The id of the connection target entity
57
+ */
58
+ targetId: EntityId;
59
+ /**
60
+ * The optional type of the connection.
61
+ * The type determines the default visualization of the connection.
62
+ */
63
+ type?: ConnectionType;
64
+ }
65
+ /**
66
+ * A connection representing an ownership relation.
67
+ */
68
+ interface Ownership extends Connection {
69
+ type: 'Ownership';
70
+ ownership?: number;
71
+ }
72
+ /**
73
+ * The various types an entity can have.
74
+ * Every type is mapped to a default node visualization.
75
+ */
76
+ type EntityType = 'Asset' | 'Bank' | 'Branch' | 'CTB' | 'Corporation' | 'Disregarded' | 'Dual Resident' | 'Individual' | 'Multiple' | 'Octagon' | 'PE_Risk' | 'Partnership' | 'RCTB' | 'Third Party' | 'Trapezoid' | 'Trust' | 'Unknown';
77
+ /**
78
+ * A connection can either be a simple "Relation" or an "Ownership" connection, which additionally
79
+ * has a numerical ownership property.
80
+ */
81
+ type ConnectionType = 'Ownership' | 'Relation';
82
+ /**
83
+ * A data type that combines custom data props with the {@link Entity}. Data needs to fit in
84
+ * this type so the component can handle the structure of the company ownership chart correctly.
85
+ */
86
+ type UserEntity<TCustomProps = Record<string, unknown>> = TCustomProps & Entity;
87
+ /**
88
+ * A data type that combines custom data props with the {@link Connection}. Data needs to fit in
89
+ * this type so the component can handle the structure of the company ownership chart correctly.
90
+ */
91
+ type UserConnection<TCustomProps = Record<string, unknown>> = TCustomProps & Connection;
92
+ /**
93
+ * A function type that provides connection styles for company ownership links.
94
+ *
95
+ * The connection property is the {@link Connection}, the source and target properties
96
+ * represent the start and end {@link Entity} of the connection, respectively.
97
+ */
98
+ type ConnectionStyleProvider<TEntity extends Entity = Entity, TConnection extends Connection = Connection> = (data: {
99
+ source: TEntity;
100
+ target: TEntity;
101
+ connection: TConnection;
102
+ }) => EdgeStyle | undefined;
103
+ /**
104
+ * A callback type invoked when an item has been focused.
105
+ */
106
+ type ItemFocusedListener<TEntity extends Entity | Connection> = (item: TEntity | null) => void;
107
+ /**
108
+ * A callback type invoked when an item has been selected or deselected.
109
+ */
110
+ type ItemSelectedListener<TEntity extends Entity | Connection> = (selectedItems: TEntity[]) => void;
111
+ /**
112
+ * A callback type invoked when the hovered item has changed.
113
+ */
114
+ type ItemHoveredListener<TEntity extends Entity | Connection> = (item: TEntity | null, oldItem?: TEntity | null) => void;
115
+ /**
116
+ * A function that returns whether the given item matches the search needle.
117
+ */
118
+ type SearchFunction<TEntity extends Entity | Connection, TNeedle = string> = (item: TEntity, needle: TNeedle) => boolean;
119
+ /**
120
+ * A simple label description.
121
+ */
122
+ type SimpleLabel = {
123
+ /**
124
+ * The CSS class name to be used for the label.
125
+ */
126
+ className?: string;
127
+ /**
128
+ * The text to be displayed on the label.
129
+ */
130
+ text: string;
131
+ /**
132
+ * The basic shape of the label. The default is 'round-rectangle'.
133
+ */
134
+ labelShape?: 'hexagon' | 'pill' | 'rectangle' | 'round-rectangle';
135
+ };
136
+ /**
137
+ * A function that provides text to display as a label on a connection.
138
+ */
139
+ type ConnectionLabelProvider<TConnection extends Connection> = (item: TConnection, companyOwnershipModel: CompanyOwnershipModel) => SimpleLabel | undefined;
140
+ /**
141
+ * A function that provides text to display as a label on an entity.
142
+ */
143
+ type EntityLabelProvider<TEntity extends Entity> = (item: TEntity, companyOwnershipModel: CompanyOwnershipModel) => SimpleLabel | undefined;
144
+ /**
145
+ * The company ownership data consisting of {@link Entity}s and {@link Connection}s.
146
+ */
147
+ type CompanyOwnershipData<TEntity extends Entity = Entity, TConnection extends Connection = Connection> = {
148
+ companies: TEntity[];
149
+ connections: TConnection[];
150
+ };
151
+ /**
152
+ * Configures the direction of the flow for the layout.
153
+ */
154
+ type LayoutDirection = 'left-to-right' | 'right-to-left' | 'top-to-bottom' | 'bottom-to-top';
155
+ /**
156
+ * Style describing the visual representation of an edge in the graph.
157
+ * See {@link https://docs.yworks.com/yfileshtml/#/api/HierarchicLayoutEdgeRoutingStyle}
158
+ */
159
+ type EdgeRoutingStyle = 'orthogonal' | 'curved' | 'octilinear' | 'polyline';
160
+ /**
161
+ * Configuration options for the Company Ownership diagram layout.
162
+ */
163
+ interface LayoutOptions {
164
+ /**
165
+ * The direction for the flow in the graph.
166
+ */
167
+ direction?: LayoutDirection;
168
+ /**
169
+ * The style edges are routed in.
170
+ */
171
+ routingStyle?: EdgeRoutingStyle;
172
+ /**
173
+ * The minimum distance between the layers in the hierarchy.
174
+ */
175
+ minimumLayerDistance?: number;
176
+ /**
177
+ * The minimum length for the first segment of an edge.
178
+ */
179
+ minimumFirstSegmentLength?: number;
180
+ /**
181
+ * The minimum length for the last segment of an edge.
182
+ */
183
+ minimumLastSegmentLength?: number;
184
+ /**
185
+ * Limits the time the layout algorithm can use to the provided number of milliseconds.
186
+ * This is an expert option. The main application is for graphs with many edges, where usually
187
+ * the part of the layout calculations that takes the longest time is the edge routing.
188
+ */
189
+ maximumDuration?: number;
190
+ }
191
+ /**
192
+ * The props for the {@link CompanyOwnership} component.
193
+ */
194
+ interface CompanyOwnershipProps<TEntity extends Entity, TConnection extends Connection, TNeedle> {
195
+ /**
196
+ * The data items visualized by the company ownership.
197
+ */
198
+ data: CompanyOwnershipData<TEntity, TConnection>;
199
+ /**
200
+ * An optional callback that's called when an item is focused.
201
+ *
202
+ * Note that the focused item is not changed if the empty canvas is clicked.
203
+ */
204
+ onItemFocus?: ItemFocusedListener<TEntity | TConnection>;
205
+ /**
206
+ * An optional callback that's called when an item is selected or deselected.
207
+ */
208
+ onItemSelect?: ItemSelectedListener<TEntity | TConnection>;
209
+ /**
210
+ * An optional callback that's called when the hovered item has changed.
211
+ */
212
+ onItemHover?: ItemHoveredListener<TEntity | TConnection>;
213
+ /**
214
+ * A string or a complex object to search for.
215
+ *
216
+ * The default search implementation can only handle strings and searches on the properties of the
217
+ * data item. For more complex search logic, provide an {@link CompanyOwnership.onSearch} callback.
218
+ */
219
+ searchNeedle?: TNeedle;
220
+ /**
221
+ * An optional callback that returns whether the given item matches the search needle.
222
+ *
223
+ * The default search implementation only supports string needles and searches all properties of the data item.
224
+ * Provide this callback to implement custom search logic.
225
+ */
226
+ onSearch?: SearchFunction<TEntity | TConnection, TNeedle>;
227
+ /**
228
+ * A custom render component used for rendering the given data item.
229
+ */
230
+ renderEntity?: ComponentType<RenderNodeProps<TEntity>>;
231
+ /**
232
+ * A function that provides a style configuration for the given connection.
233
+ */
234
+ connectionStyleProvider?: ConnectionStyleProvider<TEntity, TConnection>;
235
+ /**
236
+ * Specifies the CSS class used for the {@link CompanyOwnership} component.
237
+ */
238
+ className?: string;
239
+ /**
240
+ * Specifies the CSS style used for the {@link CompanyOwnership} component.
241
+ */
242
+ style?: CSSProperties;
243
+ /**
244
+ * Specifies the default item size used when no explicit width and height are provided.
245
+ */
246
+ itemSize?: {
247
+ width: number;
248
+ height: number;
249
+ };
250
+ /**
251
+ * An optional component that can be used for rendering a custom tooltip.
252
+ */
253
+ renderTooltip?: ComponentType<RenderTooltipProps<TEntity | TConnection>>;
254
+ /**
255
+ * An optional function specifying the context menu items for a data item.
256
+ */
257
+ contextMenuItems?: ContextMenuItemProvider<TEntity | TConnection>;
258
+ /**
259
+ * An optional component that renders a custom context menu.
260
+ */
261
+ renderContextMenu?: ComponentType<RenderContextMenuProps<TEntity>>;
262
+ /**
263
+ * Options for configuring the layout style and behavior.
264
+ */
265
+ layoutOptions?: LayoutOptions;
266
+ /**
267
+ * State setter used to indicate whether the layout is running.
268
+ */
269
+ setLayoutRunning?: React.Dispatch<React.SetStateAction<boolean>>;
270
+ /**
271
+ * Provides a label description for connections.
272
+ */
273
+ connectionLabelProvider?: ConnectionLabelProvider<TConnection>;
274
+ /**
275
+ * Provides a label description for entities.
276
+ * The label is not added if renderEntity is set.
277
+ */
278
+ entityLabelProvider?: EntityLabelProvider<TEntity>;
279
+ /**
280
+ * Optional Web Worker to run the layout calculation.
281
+ * This requires the initialization of a Web Worker, see {@link initializeWebWorker}.
282
+ */
283
+ layoutWorker?: Worker;
284
+ /**
285
+ * Sets the styling options for the different highlight indicators.
286
+ */
287
+ highlightOptions?: HighlightOptions;
288
+ }
289
+ /**
290
+ * Configuration options for styling the hover, selection and neighborhood highlight
291
+ */
292
+ type HighlightOptions = {
293
+ /**
294
+ * The stroke color of the neighborhood highlight
295
+ */
296
+ neighborhoodHighlightColor?: string;
297
+ /**
298
+ * A CSS class that can be used to style the neighborhood highlight
299
+ */
300
+ neighborhoodHighlightCssClass?: string;
301
+ /**
302
+ * The stroke color of the hover highlight
303
+ */
304
+ hoverHighlightColor?: string;
305
+ /**
306
+ * A CSS class that can be used to style the hover highlight
307
+ */
308
+ hoverHighlightCssClass?: string;
309
+ /**
310
+ * The stroke color of the selection highlight
311
+ */
312
+ selectionHighlightColor?: string;
313
+ /**
314
+ * A CSS class that can be used to style the selection highlight
315
+ */
316
+ selectionHighlightCssClass?: string;
317
+ };
318
+ /**
319
+ * The CompanyOwnership component visualizes the given data as a company ownership chart.
320
+ * All data items have to be included in the [data]{@link CompanyOwnershipProps.data}.
321
+ *
322
+ * ```tsx
323
+ * function CompanyOwnershipChart() {
324
+ * return (
325
+ * <CompanyOwnership data={data}> </CompanyOwnership>
326
+ * )
327
+ * }
328
+ * ```
329
+ */
330
+ declare function CompanyOwnership<TEntity extends Entity = UserEntity, TConnection extends Connection = UserConnection, TNeedle = string>(props: CompanyOwnershipProps<TEntity, TConnection, TNeedle> & PropsWithChildren): react_jsx_runtime.JSX.Element;
331
+
332
+ /**
333
+ * The CompanyOwnershipModel provides common functionality to interact with the {@link CompanyOwnership} component.
334
+ */
335
+ interface CompanyOwnershipModel {
336
+ /**
337
+ * The [yFiles GraphComponent]{@link http://docs.yworks.com/yfileshtml/#/api/GraphComponent} used
338
+ * by the {@link CompanyOwnership} component to display the graph.
339
+ *
340
+ * This property is intended for advanced users who have a familiarity with the
341
+ * [yFiles for HTML]{@link https://www.yworks.com/products/yfiles-for-html} library.
342
+ */
343
+ graphComponent: GraphComponent;
344
+ /**
345
+ * Whether the item is a connection.
346
+ */
347
+ isConnection(item: any): item is Connection;
348
+ /**
349
+ * Highlights an item and all other items connected to it.
350
+ * Two items are connected when there exists an edge path
351
+ * between them, even if there are several hops (items)
352
+ * on the path.
353
+ */
354
+ highlightConnectedItems(item: Entity): void;
355
+ /**
356
+ * Whether there is currently a connected items
357
+ * highlight visualized in the graph that can be cleared.
358
+ */
359
+ canClearConnectedItemsHighlight(): boolean;
360
+ /**
361
+ * Clears the connected items highlight visualization.
362
+ */
363
+ clearConnectedItemsHighlight(): void;
364
+ /**
365
+ * Shows all items in the company ownership.
366
+ */
367
+ showAll(): void;
368
+ /**
369
+ * Whether there are any hidden items to show.
370
+ */
371
+ canShowAll(): boolean;
372
+ /**
373
+ * Refreshes the company ownership layout.
374
+ * If the incremental parameter is set to true, the layout considers certain
375
+ * items as fixed and arranges only the items contained in the incrementalItems array.
376
+ */
377
+ applyLayout(incremental?: boolean, incrementalItems?: Entity[], fixedItem?: Entity, fitViewport?: boolean): Promise<void>;
378
+ /**
379
+ * Pans the viewport to the center of the given items.
380
+ */
381
+ zoomTo(items: (Entity | Connection)[]): void;
382
+ /**
383
+ * Increases the zoom level.
384
+ */
385
+ zoomIn(): void;
386
+ /**
387
+ * Decreases the zoom level.
388
+ */
389
+ zoomOut(): void;
390
+ /**
391
+ * Fits the chart inside the viewport.
392
+ */
393
+ fitContent(insets?: number): void;
394
+ /**
395
+ * Resets the zoom level to 1.
396
+ */
397
+ zoomToOriginal(): void;
398
+ /**
399
+ * Retrieves the items that match the search currently.
400
+ */
401
+ getSearchHits: () => Entity[];
402
+ /**
403
+ * Exports the company ownership chart to an SVG file.
404
+ * @throws Exception if the diagram cannot be exported.
405
+ * The exception may occur when the diagram contains images from cross-origin sources.
406
+ * In this case, disable {@link ExportSettings.inlineImages} and encode the icons manually to base64.
407
+ */
408
+ exportToSvg(exportSettings?: ExportSettings): Promise<void>;
409
+ /**
410
+ * Exports the company ownership chart to a PNG Image.
411
+ * @throws Exception if the diagram cannot be exported.
412
+ * The exception may occur when the diagram contains images from cross-origin sources.
413
+ * In this case, disable {@link ExportSettings.inlineImages} and encode the icons manually to base64.
414
+ */
415
+ exportToPng(exportSettings?: ExportSettings): Promise<void>;
416
+ /**
417
+ * Exports and prints the company ownership chart.
418
+ */
419
+ print(printSettings?: PrintSettings): Promise<void>;
420
+ /**
421
+ * Triggers a re-rendering of the chart.
422
+ * This may become useful if properties in the data change and the
423
+ * visualization should update accordingly.
424
+ */
425
+ refresh(): void;
426
+ /**
427
+ * Filters the graph for all items that are connected to
428
+ * the given item.
429
+ * Connections can be over multiple hops.
430
+ */
431
+ showGenealogy(item: Entity): void;
432
+ /**
433
+ * Adds a listener called whenever companies are shown or hidden.
434
+ */
435
+ addGraphUpdatedListener(listener: () => void): void;
436
+ /**
437
+ * Removes a listener added in {@link CompanyOwnershipModel.addGraphUpdatedListener}.
438
+ */
439
+ removeGraphUpdatedListener(listener: () => void): void;
440
+ /**
441
+ * Returns the currently visible items of the company ownership chart.
442
+ */
443
+ getVisibleItems(): Entity[];
444
+ /**
445
+ * Shows the predecessors of the given item.
446
+ */
447
+ showPredecessors(item: Entity): Promise<void>;
448
+ /**
449
+ * Whether the predecessors of the given item is hidden.
450
+ */
451
+ canShowPredecessors(item: Entity): boolean;
452
+ /**
453
+ * Hides the predecessors of the given item.
454
+ */
455
+ hidePredecessors(item: Entity): Promise<void>;
456
+ /**
457
+ * Whether the predecessors of the given item is visible.
458
+ */
459
+ canHidePredecessors(item: Entity): boolean;
460
+ /**
461
+ * Shows the successors of the given item.
462
+ */
463
+ showSuccessors(item: Entity): Promise<void>;
464
+ /**
465
+ * Whether the successors of the given item are hidden.
466
+ */
467
+ canShowSuccessors(item: Entity): boolean;
468
+ /**
469
+ * Hides the successors of the given item.
470
+ */
471
+ hideSuccessors(item: Entity): Promise<void>;
472
+ /**
473
+ * Whether the successors of the given item are visible.
474
+ */
475
+ canHideSuccessors(item: Entity): boolean;
476
+ }
477
+
478
+ declare function createLayout(incremental: boolean, layoutOptions: LayoutOptions): ILayoutAlgorithm;
479
+ /**
480
+ * Initializes the Web Worker for the layout calculation.
481
+ *
482
+ * Web Workers must be provided by the application using the company ownership component,
483
+ * if worker layout is required. The Worker itself is very bare-bones and the Worker
484
+ * layout feature can be used as follows:
485
+ *
486
+ * ```ts
487
+ * // in LayoutWorker.ts
488
+ * import { initializeWebWorker } from '@yworks/react-yfiles-company-ownership/WebWorkerSupport'
489
+ * initializeWebWorker(self)
490
+ * ```
491
+ *
492
+ * ```tsx
493
+ * // in index.tsx
494
+ * const layoutWorker = new Worker(new URL('./LayoutWorker', import.meta.url), {
495
+ * type: 'module'
496
+ * })
497
+ *
498
+ * // ...
499
+ *
500
+ * return <CompanyOwnership data={data} layoutWorker={layoutWorker}></CompanyOwnership>
501
+ * ```
502
+ */
503
+ declare function initializeWebWorker(self: Window): void;
504
+
505
+ export { type CompanyOwnershipModel as C, type Entity as E, type HighlightOptions as H, type ItemFocusedListener as I, type LayoutDirection as L, type Ownership as O, type SearchFunction as S, type UserEntity as U, type Connection as a, type EntityId as b, type EntityType as c, type ConnectionType as d, type UserConnection as e, type ConnectionStyleProvider as f, type ItemSelectedListener as g, type ItemHoveredListener as h, initializeWebWorker as i, type SimpleLabel as j, type ConnectionLabelProvider as k, type EntityLabelProvider as l, type CompanyOwnershipData as m, type EdgeRoutingStyle as n, type LayoutOptions as o, type CompanyOwnershipProps as p, CompanyOwnership as q, createLayout as r };