@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.
- package/diagram.component.d.ts +121 -35
- package/esm2022/diagram.component.mjs +259 -65
- package/esm2022/index.mjs +2 -1
- package/esm2022/models.mjs +5 -0
- package/esm2022/package-metadata.mjs +2 -2
- package/fesm2022/progress-kendo-angular-diagrams.mjs +262 -68
- package/index.d.ts +2 -1
- package/models.d.ts +128 -0
- package/package.json +11 -11
|
@@ -2,15 +2,17 @@
|
|
|
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 { Component, ElementRef, EventEmitter, HostBinding, Input, NgZone, Output, Renderer2, } from '@angular/core';
|
|
6
|
-
import { Diagram } from '@progress/kendo-diagram-common';
|
|
5
|
+
import { Component, ElementRef, EventEmitter, HostBinding, Input, NgZone, Output, Renderer2, TemplateRef, ViewChild, ViewContainerRef, } from '@angular/core';
|
|
6
|
+
import { Diagram, convertToDiagramModel, placeTooltip } from '@progress/kendo-diagram-common';
|
|
7
7
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
8
8
|
import { packageMetadata } from './package-metadata';
|
|
9
9
|
import { hasObservers, shouldShowValidationUI, getLicenseMessage, WatermarkOverlayComponent, isDocumentAvailable } from '@progress/kendo-angular-common';
|
|
10
|
+
import { PopupService } from '@progress/kendo-angular-popup';
|
|
10
11
|
import { NgIf } from '@angular/common';
|
|
11
12
|
import { events, loadTheme } from '@progress/kendo-diagram-common';
|
|
12
13
|
import { CONNECTION_DEFAULTS, SHAPE_DEFAULTS } from './utils';
|
|
13
14
|
import * as i0 from "@angular/core";
|
|
15
|
+
import * as i1 from "@progress/kendo-angular-popup";
|
|
14
16
|
/**
|
|
15
17
|
* Represents the [Kendo UI Diagram component for Angular](slug:overview_diagram).
|
|
16
18
|
*
|
|
@@ -25,41 +27,63 @@ export class DiagramComponent {
|
|
|
25
27
|
wrapperElement;
|
|
26
28
|
renderer;
|
|
27
29
|
zone;
|
|
30
|
+
popupService;
|
|
31
|
+
viewContainer;
|
|
28
32
|
diagramClass = true;
|
|
29
33
|
/**
|
|
30
34
|
* Defines the default configuration options applicable to all connections.
|
|
31
|
-
* Changing the property value dynamically triggers a reinitialization of the Diagram
|
|
35
|
+
* Changing the property value dynamically triggers a reinitialization of the `Diagram`.
|
|
36
|
+
*
|
|
32
37
|
*/
|
|
33
38
|
connectionDefaults = CONNECTION_DEFAULTS;
|
|
34
39
|
/**
|
|
35
|
-
* Defines the connections that render between the shapes in the Diagram.
|
|
36
|
-
*
|
|
40
|
+
* Defines the connections that render between the shapes in the `Diagram` (see [Connections article](slug:diagram_connections)).
|
|
41
|
+
* Accepts either an array of `ConnectionOptions` or an array of any objects
|
|
42
|
+
* that will be mapped using the `connectionModelFields` configuration.
|
|
43
|
+
* Changing this property dynamically reinitializes the `Diagram`.
|
|
44
|
+
*
|
|
37
45
|
*/
|
|
38
46
|
connections = [];
|
|
39
47
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
48
|
+
* Controls whether the `Diagram` tooltips are displayed when hovering over shapes and connections ([see example](slug:diagram_tooltips)).
|
|
49
|
+
* @default false
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
52
|
+
tooltip = false;
|
|
53
|
+
/**
|
|
54
|
+
* Defines the field mapping configuration for connections data binding ([see example](slug:diagram_data_binding#custom-field-mapping)).
|
|
55
|
+
* Maps source object properties to `Diagram` connection properties.
|
|
56
|
+
* Only used when `connections` is an array of custom objects instead of `ConnectionOptions`.
|
|
57
|
+
*/
|
|
58
|
+
connectionModelFields;
|
|
59
|
+
/**
|
|
60
|
+
* A set of settings to configure the `Diagram` behavior when the user attempts to drag, resize, or remove shapes.
|
|
61
|
+
* Changing the property value dynamically triggers a reinitialization of the `Diagram`.
|
|
62
|
+
*
|
|
42
63
|
* @default true
|
|
43
64
|
*/
|
|
44
65
|
editable = { drag: true, resize: true, remove: true };
|
|
45
66
|
/**
|
|
46
|
-
*
|
|
47
|
-
* Changing the property value dynamically triggers a reinitialization of the Diagram
|
|
67
|
+
* Defines the layout configuration for arranging shapes and connections in the `Diagram` (see [Layout article](slug:diagram_layouts)).
|
|
68
|
+
* Changing the property value dynamically triggers a reinitialization of the `Diagram`.
|
|
69
|
+
*
|
|
48
70
|
*/
|
|
49
71
|
layout;
|
|
50
72
|
/**
|
|
51
|
-
* Defines the pannable options. Use this setting to disable Diagram pan or change the key that activates the pan behavior.
|
|
73
|
+
* Defines the pannable options. Use this setting to disable `Diagram` pan or change the key that activates the pan behavior.
|
|
74
|
+
*
|
|
52
75
|
* @default true
|
|
53
76
|
*/
|
|
54
77
|
pannable = true;
|
|
55
78
|
/**
|
|
56
|
-
* Defines the Diagram selection options.
|
|
79
|
+
* Defines the `Diagram` selection options.
|
|
57
80
|
*
|
|
58
|
-
* By default, you can select shapes in the Diagram in one of two ways:
|
|
81
|
+
* By default, you can select shapes in the `Diagram` in one of two ways:
|
|
59
82
|
* - Clicking a single shape to select it and deselect any previously selected shapes.
|
|
60
83
|
* - Holding the `Ctrl/Cmd on MacOS` key while clicking multiple shapes to select them and any other shapes between them.
|
|
61
84
|
*
|
|
62
85
|
* 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.
|
|
86
|
+
*
|
|
63
87
|
* @default true
|
|
64
88
|
*/
|
|
65
89
|
selectable = true;
|
|
@@ -69,30 +93,39 @@ export class DiagramComponent {
|
|
|
69
93
|
*/
|
|
70
94
|
shapeDefaults = SHAPE_DEFAULTS;
|
|
71
95
|
/**
|
|
72
|
-
* Defines the shapes that render in the Diagram.
|
|
73
|
-
*
|
|
96
|
+
* Defines the shapes that render in the `Diagram` (see [Shapes article](slug:diagram_shapes)).
|
|
97
|
+
* Accepts either an array of `ShapeOptions` or an array of any objects
|
|
98
|
+
* that will be mapped using the `shapeModelFields` configuration.
|
|
99
|
+
* Changing the property value dynamically triggers a reinitialization of the `Diagram`.
|
|
100
|
+
*
|
|
74
101
|
*/
|
|
75
102
|
shapes = [];
|
|
76
103
|
/**
|
|
77
|
-
* Defines the
|
|
104
|
+
* Defines the field mapping configuration for shapes data binding ([see example](slug:diagram_data_binding#custom-field-mapping)).
|
|
105
|
+
* Maps source object properties to `Diagram` shape properties.
|
|
106
|
+
* Only used when `shapes` is an array of custom objects instead of `ShapeOptions`.
|
|
107
|
+
*/
|
|
108
|
+
shapeModelFields;
|
|
109
|
+
/**
|
|
110
|
+
* Defines the zoom level of the `Diagram`.
|
|
78
111
|
*
|
|
79
112
|
* @default 1
|
|
80
113
|
*/
|
|
81
114
|
zoom = 1;
|
|
82
115
|
/**
|
|
83
|
-
* Defines the maximum zoom level of the Diagram
|
|
116
|
+
* Defines the maximum zoom level of the `Diagram`.
|
|
84
117
|
*
|
|
85
118
|
* @default 2
|
|
86
119
|
*/
|
|
87
120
|
zoomMax = 2;
|
|
88
121
|
/**
|
|
89
|
-
* Defines the minimum zoom level of the Diagram
|
|
122
|
+
* Defines the minimum zoom level of the `Diagram`.
|
|
90
123
|
*
|
|
91
124
|
* @default 0.1
|
|
92
125
|
*/
|
|
93
126
|
zoomMin = 0.1;
|
|
94
127
|
/**
|
|
95
|
-
* Defines the zoom rate of the Diagram
|
|
128
|
+
* Defines the zoom rate of the `Diagram`.
|
|
96
129
|
*
|
|
97
130
|
* @default 0.1
|
|
98
131
|
*/
|
|
@@ -130,7 +163,7 @@ export class DiagramComponent {
|
|
|
130
163
|
*/
|
|
131
164
|
mouseLeave = new EventEmitter();
|
|
132
165
|
/**
|
|
133
|
-
* Fires when the user pans the Diagram
|
|
166
|
+
* Fires when the user pans the `Diagram`.
|
|
134
167
|
*/
|
|
135
168
|
onPan = new EventEmitter();
|
|
136
169
|
/**
|
|
@@ -138,32 +171,40 @@ export class DiagramComponent {
|
|
|
138
171
|
*/
|
|
139
172
|
onSelect = new EventEmitter();
|
|
140
173
|
/**
|
|
141
|
-
* Fires when the
|
|
174
|
+
* Fires when the `Diagram` has finished zooming out.
|
|
142
175
|
*/
|
|
143
176
|
zoomEnd = new EventEmitter();
|
|
144
177
|
/**
|
|
145
|
-
* Fires when the
|
|
178
|
+
* Fires when the `Diagram` starts zooming in or out.
|
|
146
179
|
*/
|
|
147
180
|
zoomStart = new EventEmitter();
|
|
181
|
+
/**
|
|
182
|
+
* Fires when a tooltip should shown for a shape or connection.
|
|
183
|
+
*/
|
|
184
|
+
tooltipShow = new EventEmitter();
|
|
185
|
+
/**
|
|
186
|
+
* Fires when a tooltip should be hidden.
|
|
187
|
+
*/
|
|
188
|
+
tooltipHide = new EventEmitter();
|
|
148
189
|
/**
|
|
149
190
|
* @hidden
|
|
150
191
|
* Represents the Diagram instance, holding the core functionality of the Diagram.
|
|
151
192
|
*/
|
|
152
193
|
diagramWidget;
|
|
153
194
|
/**
|
|
154
|
-
* The currently selected items in the Diagram
|
|
195
|
+
* The currently selected items in the `Diagram`.
|
|
155
196
|
*/
|
|
156
197
|
get selection() {
|
|
157
198
|
return this.diagramWidget?.select();
|
|
158
199
|
}
|
|
159
200
|
/**
|
|
160
|
-
* The actual shapes created by the Diagram
|
|
201
|
+
* The actual shapes created by the `Diagram`.
|
|
161
202
|
*/
|
|
162
203
|
get diagramShapes() {
|
|
163
204
|
return this.diagramWidget?.shapes;
|
|
164
205
|
}
|
|
165
206
|
/**
|
|
166
|
-
* The actual connections created by the Diagram
|
|
207
|
+
* The actual connections created by the `Diagram`.
|
|
167
208
|
*/
|
|
168
209
|
get diagramConnections() {
|
|
169
210
|
return this.diagramWidget?.connections;
|
|
@@ -188,22 +229,43 @@ export class DiagramComponent {
|
|
|
188
229
|
shapeDefaults: this.shapeDefaults,
|
|
189
230
|
connectionDefaults: this.connectionDefaults
|
|
190
231
|
};
|
|
191
|
-
|
|
232
|
+
/**
|
|
233
|
+
* Stores the converted shapes from user data.
|
|
234
|
+
*/
|
|
235
|
+
convertedShapes = [];
|
|
236
|
+
/**
|
|
237
|
+
* Stores the converted connections from user data.
|
|
238
|
+
*/
|
|
239
|
+
convertedConnections = [];
|
|
240
|
+
/**
|
|
241
|
+
* Current popup instance for tooltip.
|
|
242
|
+
*/
|
|
243
|
+
tooltipPopup;
|
|
244
|
+
/**
|
|
245
|
+
* Template reference for tooltip content.
|
|
246
|
+
*/
|
|
247
|
+
tooltipTemplate;
|
|
248
|
+
/**
|
|
249
|
+
* @hidden
|
|
250
|
+
* Current tooltip content for template context.
|
|
251
|
+
*/
|
|
252
|
+
tooltipContent = '';
|
|
253
|
+
constructor(wrapperElement, renderer, zone, popupService, viewContainer) {
|
|
192
254
|
this.wrapperElement = wrapperElement;
|
|
193
255
|
this.renderer = renderer;
|
|
194
256
|
this.zone = zone;
|
|
257
|
+
this.popupService = popupService;
|
|
258
|
+
this.viewContainer = viewContainer;
|
|
195
259
|
const isValid = validatePackage(packageMetadata);
|
|
196
260
|
this.licenseMessage = getLicenseMessage(packageMetadata);
|
|
197
261
|
this.showLicenseWatermark = shouldShowValidationUI(isValid);
|
|
198
262
|
}
|
|
199
263
|
ngOnChanges(changes) {
|
|
200
264
|
let recreate = false;
|
|
201
|
-
if (changes['shapes']) {
|
|
202
|
-
this.
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
if (changes['connections']) {
|
|
206
|
-
this.options.connections = this.connections;
|
|
265
|
+
if (changes['shapes'] || changes['connections'] || changes['shapeModelFields'] || changes['connectionModelFields']) {
|
|
266
|
+
this.convertUserData();
|
|
267
|
+
this.options.shapes = this.convertedShapes;
|
|
268
|
+
this.options.connections = this.convertedConnections;
|
|
207
269
|
recreate = true;
|
|
208
270
|
}
|
|
209
271
|
if (changes['connectionDefaults']) {
|
|
@@ -263,50 +325,33 @@ export class DiagramComponent {
|
|
|
263
325
|
}
|
|
264
326
|
}
|
|
265
327
|
ngAfterViewInit() {
|
|
328
|
+
this.convertUserData();
|
|
329
|
+
this.options.shapes = this.convertedShapes;
|
|
330
|
+
this.options.connections = this.convertedConnections;
|
|
266
331
|
this.renderer.setStyle(this.wrapperElement.nativeElement, 'display', 'block');
|
|
267
332
|
this.init();
|
|
268
|
-
|
|
269
|
-
this.diagramWidget.bind(eventName, (e) => {
|
|
270
|
-
if (eventName === 'click') {
|
|
271
|
-
eventName = 'diagramClick';
|
|
272
|
-
}
|
|
273
|
-
if (eventName === 'select') {
|
|
274
|
-
eventName = 'onSelect';
|
|
275
|
-
}
|
|
276
|
-
if (eventName === 'pan') {
|
|
277
|
-
eventName = 'onPan';
|
|
278
|
-
}
|
|
279
|
-
if (eventName === 'itemBoundsChange') {
|
|
280
|
-
eventName = 'shapeBoundsChange';
|
|
281
|
-
}
|
|
282
|
-
const emitter = this.activeEmitter(eventName);
|
|
283
|
-
if (emitter) {
|
|
284
|
-
this.zone.run(() => {
|
|
285
|
-
emitter.emit(e);
|
|
286
|
-
});
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
});
|
|
333
|
+
this.bindDiagramEvents();
|
|
290
334
|
}
|
|
291
335
|
ngOnDestroy() {
|
|
336
|
+
this.hideTooltip();
|
|
292
337
|
this.diagramWidget?.destroy();
|
|
293
338
|
}
|
|
294
339
|
/**
|
|
295
|
-
* Provides the current Diagram's shapes and connections that can be used to create a new Diagram when needed.
|
|
340
|
+
* Provides the current `Diagram`'s shapes and connections that can be used to create a new `Diagram` when needed.
|
|
296
341
|
* @returns {DiagramState} Object containing shapes and connections arrays.
|
|
297
342
|
*/
|
|
298
343
|
getState() {
|
|
299
344
|
return this.diagramWidget?.save();
|
|
300
345
|
}
|
|
301
346
|
/**
|
|
302
|
-
* Focuses the Diagram
|
|
347
|
+
* Focuses the `Diagram`.
|
|
303
348
|
* @returns {boolean} true if focus was set successfully.
|
|
304
349
|
*/
|
|
305
350
|
focus() {
|
|
306
351
|
return this.diagramWidget?.focus();
|
|
307
352
|
}
|
|
308
353
|
/**
|
|
309
|
-
* Clears the Diagram
|
|
354
|
+
* Clears the `Diagram`.
|
|
310
355
|
*/
|
|
311
356
|
clear() {
|
|
312
357
|
this.diagramWidget?.clear();
|
|
@@ -321,7 +366,7 @@ export class DiagramComponent {
|
|
|
321
366
|
return this.diagramWidget?.connected(source, target);
|
|
322
367
|
}
|
|
323
368
|
/**
|
|
324
|
-
* Adds connection to the Diagram
|
|
369
|
+
* Adds connection to the `Diagram`.
|
|
325
370
|
* @param {Connection} Connection.
|
|
326
371
|
* @param {boolean} Boolean.
|
|
327
372
|
* @returns {Connection} The newly created connection.
|
|
@@ -331,7 +376,7 @@ export class DiagramComponent {
|
|
|
331
376
|
return newConnection;
|
|
332
377
|
}
|
|
333
378
|
/**
|
|
334
|
-
* Adds shape to the Diagram
|
|
379
|
+
* Adds shape to the `Diagram`.
|
|
335
380
|
* @param {ShapeOptions | Shape | Point} If you pass a `Point`, a new Shape with default options will be created and positioned at that point.
|
|
336
381
|
* @param {boolean} Boolean indicating if the action should be undoable.
|
|
337
382
|
* @returns {Shape} The newly created shape.
|
|
@@ -341,7 +386,7 @@ export class DiagramComponent {
|
|
|
341
386
|
return newShape;
|
|
342
387
|
}
|
|
343
388
|
/**
|
|
344
|
-
* Removes shape(s) and/or connection(s) from the Diagram
|
|
389
|
+
* Removes shape(s) and/or connection(s) from the `Diagram`.
|
|
345
390
|
* @param {Shape | Connection | (Shape | Connection)[]} Shape, Connection or an Array of Shapes and/or Connections.
|
|
346
391
|
* @param {Boolean} Boolean indicating if the action should be undoable.
|
|
347
392
|
*/
|
|
@@ -349,7 +394,7 @@ export class DiagramComponent {
|
|
|
349
394
|
this.diagramWidget?.remove(items, undoable);
|
|
350
395
|
}
|
|
351
396
|
/**
|
|
352
|
-
* Connects two items in the Diagram
|
|
397
|
+
* Connects two items in the `Diagram`.
|
|
353
398
|
* @param {Shape | Connector | Point} Shape, Shape's Connector or Point.
|
|
354
399
|
* @param {Shape | Connector | Point} Shape, Shape's Connector or Point.
|
|
355
400
|
* @param {ConnectionOptions} Connection options.
|
|
@@ -380,7 +425,7 @@ export class DiagramComponent {
|
|
|
380
425
|
return this.diagramWidget?.select(items, options);
|
|
381
426
|
}
|
|
382
427
|
/**
|
|
383
|
-
* Selects all items in the Diagram
|
|
428
|
+
* Selects all items in the `Diagram`.
|
|
384
429
|
*/
|
|
385
430
|
selectAll() {
|
|
386
431
|
this.diagramWidget?.selectAll();
|
|
@@ -564,12 +609,141 @@ export class DiagramComponent {
|
|
|
564
609
|
exportVisual() {
|
|
565
610
|
return this.diagramWidget?.exportVisual();
|
|
566
611
|
}
|
|
612
|
+
/**
|
|
613
|
+
* Handles the tooltipShow event from the diagram widget.
|
|
614
|
+
*/
|
|
615
|
+
handleTooltipShow(event) {
|
|
616
|
+
this.hideTooltip();
|
|
617
|
+
if (event.item.options.tooltip?.visible) {
|
|
618
|
+
this.tooltipContent = event.item.options.tooltip?.text;
|
|
619
|
+
this.tooltipPopup = this.popupService.open({
|
|
620
|
+
content: this.tooltipTemplate,
|
|
621
|
+
appendTo: this.viewContainer
|
|
622
|
+
});
|
|
623
|
+
const popupElementRect = this.tooltipPopup.popup.instance.container.nativeElement.querySelector('.k-tooltip').getBoundingClientRect();
|
|
624
|
+
const zoom = event.item.diagram.zoom();
|
|
625
|
+
const pan = event.item.diagram.pan();
|
|
626
|
+
const diagramRect = this.diagramWidget.element.getBoundingClientRect();
|
|
627
|
+
const win = this.diagramWidget.element.ownerDocument.defaultView;
|
|
628
|
+
const lines = this.diagramWidget.connections.map(con => con.allPoints());
|
|
629
|
+
const shapes = this.diagramWidget.shapes.map(shp => shp.bounds());
|
|
630
|
+
const pos = placeTooltip({
|
|
631
|
+
hovered: event.item,
|
|
632
|
+
mouse: event.point,
|
|
633
|
+
shapes: shapes,
|
|
634
|
+
connections: lines,
|
|
635
|
+
diagramRect: diagramRect,
|
|
636
|
+
zoom: zoom,
|
|
637
|
+
pan: pan,
|
|
638
|
+
tooltipSize: { width: popupElementRect.width, height: popupElementRect.height },
|
|
639
|
+
viewportBounds: new DOMRect(0, 0, win.innerWidth, win.innerHeight)
|
|
640
|
+
});
|
|
641
|
+
this.tooltipPopup.popup.instance.offset = { left: pos.left + win.scrollX, top: pos.top + win.scrollY };
|
|
642
|
+
this.tooltipShow.emit(event);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Handles the tooltipHide event from the diagram widget.
|
|
647
|
+
*/
|
|
648
|
+
handleTooltipHide(event) {
|
|
649
|
+
this.hideTooltip();
|
|
650
|
+
this.tooltipHide.emit(event);
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* Hides the current tooltip and cleans up resources.
|
|
654
|
+
*/
|
|
655
|
+
hideTooltip() {
|
|
656
|
+
if (this.tooltipPopup) {
|
|
657
|
+
this.tooltipPopup.close();
|
|
658
|
+
this.tooltipPopup = undefined;
|
|
659
|
+
}
|
|
660
|
+
this.tooltipContent = '';
|
|
661
|
+
}
|
|
567
662
|
activeEmitter(name) {
|
|
568
663
|
const emitter = this[name];
|
|
569
664
|
if (emitter?.emit && hasObservers(emitter)) {
|
|
570
665
|
return emitter;
|
|
571
666
|
}
|
|
572
667
|
}
|
|
668
|
+
/**
|
|
669
|
+
* Binds event handlers to the diagram widget.
|
|
670
|
+
*/
|
|
671
|
+
bindDiagramEvents() {
|
|
672
|
+
events.forEach((eventName) => {
|
|
673
|
+
this.diagramWidget.bind(eventName, (e) => {
|
|
674
|
+
if (eventName === 'click') {
|
|
675
|
+
eventName = 'diagramClick';
|
|
676
|
+
}
|
|
677
|
+
if (eventName === 'select') {
|
|
678
|
+
eventName = 'onSelect';
|
|
679
|
+
}
|
|
680
|
+
if (eventName === 'pan') {
|
|
681
|
+
eventName = 'onPan';
|
|
682
|
+
}
|
|
683
|
+
if (eventName === 'itemBoundsChange') {
|
|
684
|
+
eventName = 'shapeBoundsChange';
|
|
685
|
+
}
|
|
686
|
+
if (this.tooltip && eventName === 'tooltipShow') {
|
|
687
|
+
this.zone.run(() => {
|
|
688
|
+
this.handleTooltipShow(e);
|
|
689
|
+
});
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
if (this.tooltip && eventName === 'tooltipHide') {
|
|
693
|
+
this.zone.run(() => {
|
|
694
|
+
this.handleTooltipHide(e);
|
|
695
|
+
});
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
const emitter = this.activeEmitter(eventName);
|
|
699
|
+
if (emitter) {
|
|
700
|
+
this.zone.run(() => {
|
|
701
|
+
emitter.emit(e);
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
});
|
|
705
|
+
});
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Converts user data to Diagram model format using field mappings.
|
|
709
|
+
*/
|
|
710
|
+
convertUserData() {
|
|
711
|
+
if (this.shapeModelFields || this.connectionModelFields) {
|
|
712
|
+
const mapping = {
|
|
713
|
+
shapes: {
|
|
714
|
+
source: () => this.shapes || [],
|
|
715
|
+
map: this.createFieldMapping(this.shapeModelFields)
|
|
716
|
+
},
|
|
717
|
+
connections: {
|
|
718
|
+
source: () => this.connections || [],
|
|
719
|
+
map: this.createFieldMapping(this.connectionModelFields)
|
|
720
|
+
}
|
|
721
|
+
};
|
|
722
|
+
const result = convertToDiagramModel({ shapes: this.shapes, connections: this.connections }, mapping);
|
|
723
|
+
this.convertedShapes = result.shapes;
|
|
724
|
+
this.convertedConnections = result.connections;
|
|
725
|
+
}
|
|
726
|
+
else {
|
|
727
|
+
this.convertedShapes = this.shapes || [];
|
|
728
|
+
this.convertedConnections = this.connections || [];
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Creates field mapping configuration from model fields.
|
|
733
|
+
*/
|
|
734
|
+
createFieldMapping(modelFields) {
|
|
735
|
+
if (!modelFields) {
|
|
736
|
+
return {};
|
|
737
|
+
}
|
|
738
|
+
const mapping = {};
|
|
739
|
+
Object.keys(modelFields).forEach(key => {
|
|
740
|
+
const fieldName = modelFields[key];
|
|
741
|
+
if (fieldName) {
|
|
742
|
+
mapping[key] = fieldName;
|
|
743
|
+
}
|
|
744
|
+
});
|
|
745
|
+
return mapping;
|
|
746
|
+
}
|
|
573
747
|
init() {
|
|
574
748
|
if (!isDocumentAvailable()) {
|
|
575
749
|
return;
|
|
@@ -589,9 +763,12 @@ export class DiagramComponent {
|
|
|
589
763
|
this.options[prop] = this[prop];
|
|
590
764
|
this.diagramWidget?.setOptions(this.options);
|
|
591
765
|
}
|
|
592
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }], target: i0.ɵɵFactoryTarget.Component });
|
|
593
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: DiagramComponent, isStandalone: true, selector: "kendo-diagram", inputs: { connectionDefaults: "connectionDefaults", connections: "connections", editable: "editable", layout: "layout", pannable: "pannable", selectable: "selectable", shapeDefaults: "shapeDefaults", shapes: "shapes", zoom: "zoom", zoomMax: "zoomMax", zoomMin: "zoomMin", zoomRate: "zoomRate" }, outputs: { change: "change", diagramClick: "diagramClick", drag: "drag", dragEnd: "dragEnd", dragStart: "dragStart", shapeBoundsChange: "shapeBoundsChange", mouseEnter: "mouseEnter", mouseLeave: "mouseLeave", onPan: "pan", onSelect: "select", zoomEnd: "zoomEnd", zoomStart: "zoomStart" }, host: { properties: { "class.k-diagram": "this.diagramClass" } }, exportAs: ["kendoDiagram"], usesOnChanges: true, ngImport: i0, template: `
|
|
766
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramComponent, deps: [{ token: i0.ElementRef }, { token: i0.Renderer2 }, { token: i0.NgZone }, { token: i1.PopupService }, { token: i0.ViewContainerRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
767
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: DiagramComponent, isStandalone: true, selector: "kendo-diagram", inputs: { connectionDefaults: "connectionDefaults", connections: "connections", tooltip: "tooltip", connectionModelFields: "connectionModelFields", editable: "editable", layout: "layout", pannable: "pannable", selectable: "selectable", shapeDefaults: "shapeDefaults", shapes: "shapes", shapeModelFields: "shapeModelFields", zoom: "zoom", zoomMax: "zoomMax", zoomMin: "zoomMin", zoomRate: "zoomRate" }, outputs: { 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" }, host: { properties: { "class.k-diagram": "this.diagramClass" } }, providers: [PopupService], viewQueries: [{ propertyName: "tooltipTemplate", first: true, predicate: ["tooltipTemplate"], descendants: true }], exportAs: ["kendoDiagram"], usesOnChanges: true, ngImport: i0, template: `
|
|
594
768
|
<div kendoWatermarkOverlay *ngIf="showLicenseWatermark" [licenseMessage]="licenseMessage"></div>
|
|
769
|
+
<ng-template *ngIf="tooltip" #tooltipTemplate let-content="content">
|
|
770
|
+
<div class="k-tooltip">{{tooltipContent}}</div>
|
|
771
|
+
</ng-template>
|
|
595
772
|
`, isInline: true, dependencies: [{ kind: "component", type: WatermarkOverlayComponent, selector: "div[kendoWatermarkOverlay]", inputs: ["licenseMessage"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
596
773
|
}
|
|
597
774
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramComponent, decorators: [{
|
|
@@ -602,16 +779,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
602
779
|
selector: 'kendo-diagram',
|
|
603
780
|
template: `
|
|
604
781
|
<div kendoWatermarkOverlay *ngIf="showLicenseWatermark" [licenseMessage]="licenseMessage"></div>
|
|
782
|
+
<ng-template *ngIf="tooltip" #tooltipTemplate let-content="content">
|
|
783
|
+
<div class="k-tooltip">{{tooltipContent}}</div>
|
|
784
|
+
</ng-template>
|
|
605
785
|
`,
|
|
606
|
-
imports: [WatermarkOverlayComponent, NgIf]
|
|
786
|
+
imports: [WatermarkOverlayComponent, NgIf],
|
|
787
|
+
providers: [PopupService]
|
|
607
788
|
}]
|
|
608
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }], propDecorators: { diagramClass: [{
|
|
789
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i1.PopupService }, { type: i0.ViewContainerRef }], propDecorators: { diagramClass: [{
|
|
609
790
|
type: HostBinding,
|
|
610
791
|
args: ['class.k-diagram']
|
|
611
792
|
}], connectionDefaults: [{
|
|
612
793
|
type: Input
|
|
613
794
|
}], connections: [{
|
|
614
795
|
type: Input
|
|
796
|
+
}], tooltip: [{
|
|
797
|
+
type: Input
|
|
798
|
+
}], connectionModelFields: [{
|
|
799
|
+
type: Input
|
|
615
800
|
}], editable: [{
|
|
616
801
|
type: Input
|
|
617
802
|
}], layout: [{
|
|
@@ -624,6 +809,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
624
809
|
type: Input
|
|
625
810
|
}], shapes: [{
|
|
626
811
|
type: Input
|
|
812
|
+
}], shapeModelFields: [{
|
|
813
|
+
type: Input
|
|
627
814
|
}], zoom: [{
|
|
628
815
|
type: Input
|
|
629
816
|
}], zoomMax: [{
|
|
@@ -658,4 +845,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
658
845
|
type: Output
|
|
659
846
|
}], zoomStart: [{
|
|
660
847
|
type: Output
|
|
848
|
+
}], tooltipShow: [{
|
|
849
|
+
type: Output
|
|
850
|
+
}], tooltipHide: [{
|
|
851
|
+
type: Output
|
|
852
|
+
}], tooltipTemplate: [{
|
|
853
|
+
type: ViewChild,
|
|
854
|
+
args: ['tooltipTemplate']
|
|
661
855
|
}] } });
|
package/esm2022/index.mjs
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
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
|
-
export { Shape, Connection, Connector, Diagram, Point, Rect, Circle, Group, FlowchartShapeType, ArrowMarker, CircleMarker, Collate, DataInputOutput, DataStorage, Database, Decision, Delay, DirectAccessStorage, Display, Document, MultipleDocuments, Extract, Image, InternalStorage, Layout, Line, LogicalOr, ManualInputOutput, ManualOperation, Merge, MultiLineTextBlock, OffPageConnector, OnPageConnector, Path, Polyline, PredefinedProcess, Preparation, Process, Rectangle, Sort, SummingJunction, Terminator, TextBlock, MarkerType, } from '@progress/kendo-diagram-common';
|
|
5
|
+
export { Shape, Connection, Connector, Diagram, Point, Rect, Circle, Group, FlowchartShapeType, ArrowMarker, CircleMarker, Collate, DataInputOutput, DataStorage, Database, Decision, Delay, DirectAccessStorage, Display, Document, MultipleDocuments, Extract, Image, InternalStorage, Layout, Line, LogicalOr, ManualInputOutput, ManualOperation, Merge, MultiLineTextBlock, OffPageConnector, OnPageConnector, Path, Polyline, PredefinedProcess, Preparation, Process, Rectangle, Sort, SummingJunction, Terminator, TextBlock, MarkerType, convertToDiagramModel } from '@progress/kendo-diagram-common';
|
|
6
6
|
export { DiagramModule } from './diagram.module';
|
|
7
7
|
export { DiagramComponent } from './diagram.component';
|
|
8
8
|
export * from './directives';
|
|
9
|
+
export * from './models';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/**-----------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright © 2025 Progress Software Corporation. All rights reserved.
|
|
3
|
+
* Licensed under commercial license. See LICENSE.md in the project root for more information
|
|
4
|
+
*-------------------------------------------------------------------------------------------*/
|
|
5
|
+
export {};
|
|
@@ -10,7 +10,7 @@ export const packageMetadata = {
|
|
|
10
10
|
productName: 'Kendo UI for Angular',
|
|
11
11
|
productCode: 'KENDOUIANGULAR',
|
|
12
12
|
productCodes: ['KENDOUIANGULAR'],
|
|
13
|
-
publishDate:
|
|
14
|
-
version: '21.0.0-develop.
|
|
13
|
+
publishDate: 1762427043,
|
|
14
|
+
version: '21.0.0-develop.21',
|
|
15
15
|
licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/?utm_medium=product&utm_source=kendoangular&utm_campaign=kendo-ui-angular-purchase-license-keys-warning',
|
|
16
16
|
};
|