@progress/kendo-angular-diagrams 21.0.0-develop.2 → 21.0.0-develop.21

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.
@@ -2,9 +2,11 @@
2
2
  * Copyright © 2025 Progress Software Corporation. All rights reserved.
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
- import { AfterViewInit, ElementRef, EventEmitter, NgZone, OnChanges, OnDestroy, Renderer2, SimpleChanges } from '@angular/core';
5
+ import { AfterViewInit, ElementRef, EventEmitter, NgZone, OnChanges, OnDestroy, Renderer2, SimpleChanges, TemplateRef, ViewContainerRef } from '@angular/core';
6
6
  import { ConnectionDefaults, ConnectionOptions, DiagramEditable, DiagramLayout, Pannable, Selectable, Shape, ShapeDefaults, ShapeOptions, DiagramDragEvent, DiagramDomEvent, DiagramZoomStartEvent, DiagramZoomEndEvent, DiagramSelectEvent, DiagramPanEvent, DiagramItemBoundsChangeEvent, DiagramChangeEvent, Connection, Connector, Diagram, Point, Rect, DiagramState, BringIntoViewOptions, SelectionOptions, Direction } from '@progress/kendo-diagram-common';
7
+ import { PopupService } from '@progress/kendo-angular-popup';
7
8
  import { Group } from '@progress/kendo-drawing';
9
+ import { ShapeModelFields, ConnectionModelFields } from './index';
8
10
  import * as i0 from "@angular/core";
9
11
  /**
10
12
  * Represents the [Kendo UI Diagram component for Angular](slug:overview_diagram).
@@ -20,41 +22,63 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
20
22
  private wrapperElement;
21
23
  private renderer;
22
24
  private zone;
25
+ private popupService;
26
+ private viewContainer;
23
27
  diagramClass: boolean;
24
28
  /**
25
29
  * Defines the default configuration options applicable to all connections.
26
- * Changing the property value dynamically triggers a reinitialization of the Diagram.
30
+ * Changing the property value dynamically triggers a reinitialization of the `Diagram`.
31
+ *
27
32
  */
28
33
  connectionDefaults?: ConnectionDefaults;
29
34
  /**
30
- * Defines the connections that render between the shapes in the Diagram.
31
- * Changing this property dynamically reinitializes the Diagram.
35
+ * Defines the connections that render between the shapes in the `Diagram` (see [Connections article](slug:diagram_connections)).
36
+ * Accepts either an array of `ConnectionOptions` or an array of any objects
37
+ * that will be mapped using the `connectionModelFields` configuration.
38
+ * Changing this property dynamically reinitializes the `Diagram`.
39
+ *
32
40
  */
33
- connections?: ConnectionOptions[];
41
+ connections?: any[];
34
42
  /**
35
- * A set of settings to configure the Diagram behavior when the user attempts to drag, resize, or remove shapes.
36
- * Changing the property value dynamically triggers a reinitialization of the Diagram.
43
+ * Controls whether the `Diagram` tooltips are displayed when hovering over shapes and connections ([see example](slug:diagram_tooltips)).
44
+ * @default false
45
+ *
46
+ */
47
+ tooltip?: boolean;
48
+ /**
49
+ * Defines the field mapping configuration for connections data binding ([see example](slug:diagram_data_binding#custom-field-mapping)).
50
+ * Maps source object properties to `Diagram` connection properties.
51
+ * Only used when `connections` is an array of custom objects instead of `ConnectionOptions`.
52
+ */
53
+ connectionModelFields?: ConnectionModelFields;
54
+ /**
55
+ * A set of settings to configure the `Diagram` behavior when the user attempts to drag, resize, or remove shapes.
56
+ * Changing the property value dynamically triggers a reinitialization of the `Diagram`.
57
+ *
37
58
  * @default true
38
59
  */
39
60
  editable?: boolean | DiagramEditable;
40
61
  /**
41
- * The layout of a diagram consists of arranging the shapes (sometimes also the connections) in some fashion in order to achieve an aesthetically pleasing experience to the user.
42
- * Changing the property value dynamically triggers a reinitialization of the Diagram.
62
+ * Defines the layout configuration for arranging shapes and connections in the `Diagram` (see [Layout article](slug:diagram_layouts)).
63
+ * Changing the property value dynamically triggers a reinitialization of the `Diagram`.
64
+ *
43
65
  */
44
66
  layout?: DiagramLayout;
45
67
  /**
46
- * Defines the pannable options. Use this setting to disable Diagram pan or change the key that activates the pan behavior.
68
+ * Defines the pannable options. Use this setting to disable `Diagram` pan or change the key that activates the pan behavior.
69
+ *
47
70
  * @default true
48
71
  */
49
72
  pannable?: boolean | Pannable;
50
73
  /**
51
- * Defines the Diagram selection options.
74
+ * Defines the `Diagram` selection options.
52
75
  *
53
- * By default, you can select shapes in the Diagram in one of two ways:
76
+ * By default, you can select shapes in the `Diagram` in one of two ways:
54
77
  * - Clicking a single shape to select it and deselect any previously selected shapes.
55
78
  * - Holding the `Ctrl/Cmd on MacOS` key while clicking multiple shapes to select them and any other shapes between them.
56
79
  *
57
80
  * Use the `selectable` configuration to allow single selection only, enable selection by drawing a rectangular area with the mouse around shapes in the canvas, or disable selection altogether.
81
+ *
58
82
  * @default true
59
83
  */
60
84
  selectable?: boolean | Selectable;
@@ -64,30 +88,39 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
64
88
  */
65
89
  shapeDefaults?: ShapeDefaults;
66
90
  /**
67
- * Defines the shapes that render in the Diagram.
68
- * Changing the property value dynamically triggers a reinitialization of the Diagram.
91
+ * Defines the shapes that render in the `Diagram` (see [Shapes article](slug:diagram_shapes)).
92
+ * Accepts either an array of `ShapeOptions` or an array of any objects
93
+ * that will be mapped using the `shapeModelFields` configuration.
94
+ * Changing the property value dynamically triggers a reinitialization of the `Diagram`.
95
+ *
96
+ */
97
+ shapes?: any[];
98
+ /**
99
+ * Defines the field mapping configuration for shapes data binding ([see example](slug:diagram_data_binding#custom-field-mapping)).
100
+ * Maps source object properties to `Diagram` shape properties.
101
+ * Only used when `shapes` is an array of custom objects instead of `ShapeOptions`.
69
102
  */
70
- shapes?: ShapeOptions[];
103
+ shapeModelFields?: ShapeModelFields;
71
104
  /**
72
- * Defines the zoom level of the Diagram.
105
+ * Defines the zoom level of the `Diagram`.
73
106
  *
74
107
  * @default 1
75
108
  */
76
109
  zoom?: number;
77
110
  /**
78
- * Defines the maximum zoom level of the Diagram.
111
+ * Defines the maximum zoom level of the `Diagram`.
79
112
  *
80
113
  * @default 2
81
114
  */
82
115
  zoomMax?: number;
83
116
  /**
84
- * Defines the minimum zoom level of the Diagram.
117
+ * Defines the minimum zoom level of the `Diagram`.
85
118
  *
86
119
  * @default 0.1
87
120
  */
88
121
  zoomMin?: number;
89
122
  /**
90
- * Defines the zoom rate of the Diagram.
123
+ * Defines the zoom rate of the `Diagram`.
91
124
  *
92
125
  * @default 0.1
93
126
  */
@@ -125,7 +158,7 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
125
158
  */
126
159
  mouseLeave: EventEmitter<DiagramDomEvent>;
127
160
  /**
128
- * Fires when the user pans the Diagram.
161
+ * Fires when the user pans the `Diagram`.
129
162
  */
130
163
  onPan: EventEmitter<DiagramPanEvent>;
131
164
  /**
@@ -133,28 +166,36 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
133
166
  */
134
167
  onSelect: EventEmitter<DiagramSelectEvent>;
135
168
  /**
136
- * Fires when the diagram has finished zooming out.
169
+ * Fires when the `Diagram` has finished zooming out.
137
170
  */
138
171
  zoomEnd: EventEmitter<DiagramZoomEndEvent>;
139
172
  /**
140
- * Fires when the diagram starts zooming in or out.
173
+ * Fires when the `Diagram` starts zooming in or out.
141
174
  */
142
175
  zoomStart: EventEmitter<DiagramZoomStartEvent>;
176
+ /**
177
+ * Fires when a tooltip should shown for a shape or connection.
178
+ */
179
+ tooltipShow: EventEmitter<any>;
180
+ /**
181
+ * Fires when a tooltip should be hidden.
182
+ */
183
+ tooltipHide: EventEmitter<any>;
143
184
  /**
144
185
  * @hidden
145
186
  * Represents the Diagram instance, holding the core functionality of the Diagram.
146
187
  */
147
188
  diagramWidget: Diagram;
148
189
  /**
149
- * The currently selected items in the Diagram.
190
+ * The currently selected items in the `Diagram`.
150
191
  */
151
192
  get selection(): (Shape | Connection)[];
152
193
  /**
153
- * The actual shapes created by the Diagram.
194
+ * The actual shapes created by the `Diagram`.
154
195
  */
155
196
  get diagramShapes(): Shape[];
156
197
  /**
157
- * The actual connections created by the Diagram.
198
+ * The actual connections created by the `Diagram`.
158
199
  */
159
200
  get diagramConnections(): Connection[];
160
201
  /**
@@ -166,22 +207,43 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
166
207
  */
167
208
  licenseMessage?: string;
168
209
  private options;
169
- constructor(wrapperElement: ElementRef<HTMLElement>, renderer: Renderer2, zone: NgZone);
210
+ /**
211
+ * Stores the converted shapes from user data.
212
+ */
213
+ private convertedShapes;
214
+ /**
215
+ * Stores the converted connections from user data.
216
+ */
217
+ private convertedConnections;
218
+ /**
219
+ * Current popup instance for tooltip.
220
+ */
221
+ private tooltipPopup?;
222
+ /**
223
+ * Template reference for tooltip content.
224
+ */
225
+ tooltipTemplate: TemplateRef<any>;
226
+ /**
227
+ * @hidden
228
+ * Current tooltip content for template context.
229
+ */
230
+ tooltipContent: string;
231
+ constructor(wrapperElement: ElementRef<HTMLElement>, renderer: Renderer2, zone: NgZone, popupService: PopupService, viewContainer: ViewContainerRef);
170
232
  ngOnChanges(changes: SimpleChanges): void;
171
233
  ngAfterViewInit(): void;
172
234
  ngOnDestroy(): void;
173
235
  /**
174
- * Provides the current Diagram's shapes and connections that can be used to create a new Diagram when needed.
236
+ * Provides the current `Diagram`'s shapes and connections that can be used to create a new `Diagram` when needed.
175
237
  * @returns {DiagramState} Object containing shapes and connections arrays.
176
238
  */
177
239
  getState(): DiagramState;
178
240
  /**
179
- * Focuses the Diagram.
241
+ * Focuses the `Diagram`.
180
242
  * @returns {boolean} true if focus was set successfully.
181
243
  */
182
244
  focus(): boolean;
183
245
  /**
184
- * Clears the Diagram.
246
+ * Clears the `Diagram`.
185
247
  */
186
248
  clear(): void;
187
249
  /**
@@ -192,27 +254,27 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
192
254
  */
193
255
  connected(source: Shape, target: Shape): boolean;
194
256
  /**
195
- * Adds connection to the Diagram.
257
+ * Adds connection to the `Diagram`.
196
258
  * @param {Connection} Connection.
197
259
  * @param {boolean} Boolean.
198
260
  * @returns {Connection} The newly created connection.
199
261
  */
200
262
  addConnection(connection: Connection, undoable?: boolean): Connection;
201
263
  /**
202
- * Adds shape to the Diagram.
264
+ * Adds shape to the `Diagram`.
203
265
  * @param {ShapeOptions | Shape | Point} If you pass a `Point`, a new Shape with default options will be created and positioned at that point.
204
266
  * @param {boolean} Boolean indicating if the action should be undoable.
205
267
  * @returns {Shape} The newly created shape.
206
268
  */
207
269
  addShape(item: ShapeOptions | Shape | Point, undoable?: boolean): Shape;
208
270
  /**
209
- * Removes shape(s) and/or connection(s) from the Diagram.
271
+ * Removes shape(s) and/or connection(s) from the `Diagram`.
210
272
  * @param {Shape | Connection | (Shape | Connection)[]} Shape, Connection or an Array of Shapes and/or Connections.
211
273
  * @param {Boolean} Boolean indicating if the action should be undoable.
212
274
  */
213
275
  remove(items: Shape | Connection | (Shape | Connection)[], undoable?: boolean): void;
214
276
  /**
215
- * Connects two items in the Diagram.
277
+ * Connects two items in the `Diagram`.
216
278
  * @param {Shape | Connector | Point} Shape, Shape's Connector or Point.
217
279
  * @param {Shape | Connector | Point} Shape, Shape's Connector or Point.
218
280
  * @param {ConnectionOptions} Connection options.
@@ -235,7 +297,7 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
235
297
  */
236
298
  select(items: Shape | Connection | (Shape | Connection)[], options?: SelectionOptions): (Shape | Connection)[];
237
299
  /**
238
- * Selects all items in the Diagram.
300
+ * Selects all items in the `Diagram`.
239
301
  */
240
302
  selectAll(): void;
241
303
  /**
@@ -371,9 +433,33 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
371
433
  * @returns {Group} A drawing Group element containing the exported visual with inverse zoom scaling
372
434
  */
373
435
  exportVisual(): Group;
436
+ /**
437
+ * Handles the tooltipShow event from the diagram widget.
438
+ */
439
+ private handleTooltipShow;
440
+ /**
441
+ * Handles the tooltipHide event from the diagram widget.
442
+ */
443
+ private handleTooltipHide;
444
+ /**
445
+ * Hides the current tooltip and cleans up resources.
446
+ */
447
+ private hideTooltip;
374
448
  protected activeEmitter(name: string): any;
449
+ /**
450
+ * Binds event handlers to the diagram widget.
451
+ */
452
+ private bindDiagramEvents;
453
+ /**
454
+ * Converts user data to Diagram model format using field mappings.
455
+ */
456
+ private convertUserData;
457
+ /**
458
+ * Creates field mapping configuration from model fields.
459
+ */
460
+ private createFieldMapping;
375
461
  private init;
376
462
  private updateOptions;
377
463
  static ɵfac: i0.ɵɵFactoryDeclaration<DiagramComponent, never>;
378
- static ɵcmp: i0.ɵɵComponentDeclaration<DiagramComponent, "kendo-diagram", ["kendoDiagram"], { "connectionDefaults": { "alias": "connectionDefaults"; "required": false; }; "connections": { "alias": "connections"; "required": false; }; "editable": { "alias": "editable"; "required": false; }; "layout": { "alias": "layout"; "required": false; }; "pannable": { "alias": "pannable"; "required": false; }; "selectable": { "alias": "selectable"; "required": false; }; "shapeDefaults": { "alias": "shapeDefaults"; "required": false; }; "shapes": { "alias": "shapes"; "required": false; }; "zoom": { "alias": "zoom"; "required": false; }; "zoomMax": { "alias": "zoomMax"; "required": false; }; "zoomMin": { "alias": "zoomMin"; "required": false; }; "zoomRate": { "alias": "zoomRate"; "required": false; }; }, { "change": "change"; "diagramClick": "diagramClick"; "drag": "drag"; "dragEnd": "dragEnd"; "dragStart": "dragStart"; "shapeBoundsChange": "shapeBoundsChange"; "mouseEnter": "mouseEnter"; "mouseLeave": "mouseLeave"; "onPan": "pan"; "onSelect": "select"; "zoomEnd": "zoomEnd"; "zoomStart": "zoomStart"; }, never, never, true, never>;
464
+ static ɵcmp: i0.ɵɵComponentDeclaration<DiagramComponent, "kendo-diagram", ["kendoDiagram"], { "connectionDefaults": { "alias": "connectionDefaults"; "required": false; }; "connections": { "alias": "connections"; "required": false; }; "tooltip": { "alias": "tooltip"; "required": false; }; "connectionModelFields": { "alias": "connectionModelFields"; "required": false; }; "editable": { "alias": "editable"; "required": false; }; "layout": { "alias": "layout"; "required": false; }; "pannable": { "alias": "pannable"; "required": false; }; "selectable": { "alias": "selectable"; "required": false; }; "shapeDefaults": { "alias": "shapeDefaults"; "required": false; }; "shapes": { "alias": "shapes"; "required": false; }; "shapeModelFields": { "alias": "shapeModelFields"; "required": false; }; "zoom": { "alias": "zoom"; "required": false; }; "zoomMax": { "alias": "zoomMax"; "required": false; }; "zoomMin": { "alias": "zoomMin"; "required": false; }; "zoomRate": { "alias": "zoomRate"; "required": false; }; }, { "change": "change"; "diagramClick": "diagramClick"; "drag": "drag"; "dragEnd": "dragEnd"; "dragStart": "dragStart"; "shapeBoundsChange": "shapeBoundsChange"; "mouseEnter": "mouseEnter"; "mouseLeave": "mouseLeave"; "onPan": "pan"; "onSelect": "select"; "zoomEnd": "zoomEnd"; "zoomStart": "zoomStart"; "tooltipShow": "tooltipShow"; "tooltipHide": "tooltipHide"; }, never, never, true, never>;
379
465
  }