@progress/kendo-angular-diagrams 21.0.0-develop.2 → 21.0.0-develop.20
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,12 +2,14 @@
|
|
|
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 { events, loadTheme, Diagram } from '@progress/kendo-diagram-common';
|
|
6
|
-
export { ArrowMarker, Circle, CircleMarker, Collate, Connection, Connector, DataInputOutput, DataStorage, Database, Decision, Delay, Diagram, DirectAccessStorage, Display, Document, Extract, FlowchartShapeType, Group, Image, InternalStorage, Layout, Line, LogicalOr, ManualInputOutput, ManualOperation, MarkerType, Merge, MultiLineTextBlock, MultipleDocuments, OffPageConnector, OnPageConnector, Path, Point, Polyline, PredefinedProcess, Preparation, Process, Rect, Rectangle, Shape, Sort, SummingJunction, Terminator, TextBlock } from '@progress/kendo-diagram-common';
|
|
5
|
+
import { placeTooltip, events, convertToDiagramModel, loadTheme, Diagram } from '@progress/kendo-diagram-common';
|
|
6
|
+
export { ArrowMarker, Circle, CircleMarker, Collate, Connection, Connector, DataInputOutput, DataStorage, Database, Decision, Delay, Diagram, DirectAccessStorage, Display, Document, Extract, FlowchartShapeType, Group, Image, InternalStorage, Layout, Line, LogicalOr, ManualInputOutput, ManualOperation, MarkerType, Merge, MultiLineTextBlock, MultipleDocuments, OffPageConnector, OnPageConnector, Path, Point, Polyline, PredefinedProcess, Preparation, Process, Rect, Rectangle, Shape, Sort, SummingJunction, Terminator, TextBlock, convertToDiagramModel } from '@progress/kendo-diagram-common';
|
|
7
7
|
import * as i0 from '@angular/core';
|
|
8
|
-
import { EventEmitter, Component, HostBinding, Input, Output, NgModule } from '@angular/core';
|
|
8
|
+
import { EventEmitter, Component, HostBinding, Input, Output, ViewChild, NgModule } from '@angular/core';
|
|
9
9
|
import { validatePackage } from '@progress/kendo-licensing';
|
|
10
10
|
import { getLicenseMessage, shouldShowValidationUI, hasObservers, isDocumentAvailable, WatermarkOverlayComponent } from '@progress/kendo-angular-common';
|
|
11
|
+
import * as i1 from '@progress/kendo-angular-popup';
|
|
12
|
+
import { PopupService } from '@progress/kendo-angular-popup';
|
|
11
13
|
import { NgIf } from '@angular/common';
|
|
12
14
|
|
|
13
15
|
/**
|
|
@@ -18,8 +20,8 @@ const packageMetadata = {
|
|
|
18
20
|
productName: 'Kendo UI for Angular',
|
|
19
21
|
productCode: 'KENDOUIANGULAR',
|
|
20
22
|
productCodes: ['KENDOUIANGULAR'],
|
|
21
|
-
publishDate:
|
|
22
|
-
version: '21.0.0-develop.
|
|
23
|
+
publishDate: 1762335779,
|
|
24
|
+
version: '21.0.0-develop.20',
|
|
23
25
|
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',
|
|
24
26
|
};
|
|
25
27
|
|
|
@@ -63,41 +65,63 @@ class DiagramComponent {
|
|
|
63
65
|
wrapperElement;
|
|
64
66
|
renderer;
|
|
65
67
|
zone;
|
|
68
|
+
popupService;
|
|
69
|
+
viewContainer;
|
|
66
70
|
diagramClass = true;
|
|
67
71
|
/**
|
|
68
72
|
* Defines the default configuration options applicable to all connections.
|
|
69
|
-
* Changing the property value dynamically triggers a reinitialization of the Diagram
|
|
73
|
+
* Changing the property value dynamically triggers a reinitialization of the `Diagram`.
|
|
74
|
+
*
|
|
70
75
|
*/
|
|
71
76
|
connectionDefaults = CONNECTION_DEFAULTS;
|
|
72
77
|
/**
|
|
73
|
-
* Defines the connections that render between the shapes in the Diagram.
|
|
74
|
-
*
|
|
78
|
+
* Defines the connections that render between the shapes in the `Diagram` (see [Connections article](slug:diagram_connections)).
|
|
79
|
+
* Accepts either an array of `ConnectionOptions` or an array of any objects
|
|
80
|
+
* that will be mapped using the `connectionModelFields` configuration.
|
|
81
|
+
* Changing this property dynamically reinitializes the `Diagram`.
|
|
82
|
+
*
|
|
75
83
|
*/
|
|
76
84
|
connections = [];
|
|
77
85
|
/**
|
|
78
|
-
*
|
|
79
|
-
*
|
|
86
|
+
* Controls whether the `Diagram` tooltips are displayed when hovering over shapes and connections ([see example](slug:diagram_tooltips)).
|
|
87
|
+
* @default false
|
|
88
|
+
*
|
|
89
|
+
*/
|
|
90
|
+
tooltip = false;
|
|
91
|
+
/**
|
|
92
|
+
* Defines the field mapping configuration for connections data binding ([see example](slug:diagram_data_binding#custom-field-mapping)).
|
|
93
|
+
* Maps source object properties to `Diagram` connection properties.
|
|
94
|
+
* Only used when `connections` is an array of custom objects instead of `ConnectionOptions`.
|
|
95
|
+
*/
|
|
96
|
+
connectionModelFields;
|
|
97
|
+
/**
|
|
98
|
+
* A set of settings to configure the `Diagram` behavior when the user attempts to drag, resize, or remove shapes.
|
|
99
|
+
* Changing the property value dynamically triggers a reinitialization of the `Diagram`.
|
|
100
|
+
*
|
|
80
101
|
* @default true
|
|
81
102
|
*/
|
|
82
103
|
editable = { drag: true, resize: true, remove: true };
|
|
83
104
|
/**
|
|
84
|
-
*
|
|
85
|
-
* Changing the property value dynamically triggers a reinitialization of the Diagram
|
|
105
|
+
* Defines the layout configuration for arranging shapes and connections in the `Diagram` (see [Layout article](slug:diagram_layouts)).
|
|
106
|
+
* Changing the property value dynamically triggers a reinitialization of the `Diagram`.
|
|
107
|
+
*
|
|
86
108
|
*/
|
|
87
109
|
layout;
|
|
88
110
|
/**
|
|
89
|
-
* Defines the pannable options. Use this setting to disable Diagram pan or change the key that activates the pan behavior.
|
|
111
|
+
* Defines the pannable options. Use this setting to disable `Diagram` pan or change the key that activates the pan behavior.
|
|
112
|
+
*
|
|
90
113
|
* @default true
|
|
91
114
|
*/
|
|
92
115
|
pannable = true;
|
|
93
116
|
/**
|
|
94
|
-
* Defines the Diagram selection options.
|
|
117
|
+
* Defines the `Diagram` selection options.
|
|
95
118
|
*
|
|
96
|
-
* By default, you can select shapes in the Diagram in one of two ways:
|
|
119
|
+
* By default, you can select shapes in the `Diagram` in one of two ways:
|
|
97
120
|
* - Clicking a single shape to select it and deselect any previously selected shapes.
|
|
98
121
|
* - Holding the `Ctrl/Cmd on MacOS` key while clicking multiple shapes to select them and any other shapes between them.
|
|
99
122
|
*
|
|
100
123
|
* 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.
|
|
124
|
+
*
|
|
101
125
|
* @default true
|
|
102
126
|
*/
|
|
103
127
|
selectable = true;
|
|
@@ -107,30 +131,39 @@ class DiagramComponent {
|
|
|
107
131
|
*/
|
|
108
132
|
shapeDefaults = SHAPE_DEFAULTS;
|
|
109
133
|
/**
|
|
110
|
-
* Defines the shapes that render in the Diagram.
|
|
111
|
-
*
|
|
134
|
+
* Defines the shapes that render in the `Diagram` (see [Shapes article](slug:diagram_shapes)).
|
|
135
|
+
* Accepts either an array of `ShapeOptions` or an array of any objects
|
|
136
|
+
* that will be mapped using the `shapeModelFields` configuration.
|
|
137
|
+
* Changing the property value dynamically triggers a reinitialization of the `Diagram`.
|
|
138
|
+
*
|
|
112
139
|
*/
|
|
113
140
|
shapes = [];
|
|
114
141
|
/**
|
|
115
|
-
* Defines the
|
|
142
|
+
* Defines the field mapping configuration for shapes data binding ([see example](slug:diagram_data_binding#custom-field-mapping)).
|
|
143
|
+
* Maps source object properties to `Diagram` shape properties.
|
|
144
|
+
* Only used when `shapes` is an array of custom objects instead of `ShapeOptions`.
|
|
145
|
+
*/
|
|
146
|
+
shapeModelFields;
|
|
147
|
+
/**
|
|
148
|
+
* Defines the zoom level of the `Diagram`.
|
|
116
149
|
*
|
|
117
150
|
* @default 1
|
|
118
151
|
*/
|
|
119
152
|
zoom = 1;
|
|
120
153
|
/**
|
|
121
|
-
* Defines the maximum zoom level of the Diagram
|
|
154
|
+
* Defines the maximum zoom level of the `Diagram`.
|
|
122
155
|
*
|
|
123
156
|
* @default 2
|
|
124
157
|
*/
|
|
125
158
|
zoomMax = 2;
|
|
126
159
|
/**
|
|
127
|
-
* Defines the minimum zoom level of the Diagram
|
|
160
|
+
* Defines the minimum zoom level of the `Diagram`.
|
|
128
161
|
*
|
|
129
162
|
* @default 0.1
|
|
130
163
|
*/
|
|
131
164
|
zoomMin = 0.1;
|
|
132
165
|
/**
|
|
133
|
-
* Defines the zoom rate of the Diagram
|
|
166
|
+
* Defines the zoom rate of the `Diagram`.
|
|
134
167
|
*
|
|
135
168
|
* @default 0.1
|
|
136
169
|
*/
|
|
@@ -168,7 +201,7 @@ class DiagramComponent {
|
|
|
168
201
|
*/
|
|
169
202
|
mouseLeave = new EventEmitter();
|
|
170
203
|
/**
|
|
171
|
-
* Fires when the user pans the Diagram
|
|
204
|
+
* Fires when the user pans the `Diagram`.
|
|
172
205
|
*/
|
|
173
206
|
onPan = new EventEmitter();
|
|
174
207
|
/**
|
|
@@ -176,32 +209,40 @@ class DiagramComponent {
|
|
|
176
209
|
*/
|
|
177
210
|
onSelect = new EventEmitter();
|
|
178
211
|
/**
|
|
179
|
-
* Fires when the
|
|
212
|
+
* Fires when the `Diagram` has finished zooming out.
|
|
180
213
|
*/
|
|
181
214
|
zoomEnd = new EventEmitter();
|
|
182
215
|
/**
|
|
183
|
-
* Fires when the
|
|
216
|
+
* Fires when the `Diagram` starts zooming in or out.
|
|
184
217
|
*/
|
|
185
218
|
zoomStart = new EventEmitter();
|
|
219
|
+
/**
|
|
220
|
+
* Fires when a tooltip should shown for a shape or connection.
|
|
221
|
+
*/
|
|
222
|
+
tooltipShow = new EventEmitter();
|
|
223
|
+
/**
|
|
224
|
+
* Fires when a tooltip should be hidden.
|
|
225
|
+
*/
|
|
226
|
+
tooltipHide = new EventEmitter();
|
|
186
227
|
/**
|
|
187
228
|
* @hidden
|
|
188
229
|
* Represents the Diagram instance, holding the core functionality of the Diagram.
|
|
189
230
|
*/
|
|
190
231
|
diagramWidget;
|
|
191
232
|
/**
|
|
192
|
-
* The currently selected items in the Diagram
|
|
233
|
+
* The currently selected items in the `Diagram`.
|
|
193
234
|
*/
|
|
194
235
|
get selection() {
|
|
195
236
|
return this.diagramWidget?.select();
|
|
196
237
|
}
|
|
197
238
|
/**
|
|
198
|
-
* The actual shapes created by the Diagram
|
|
239
|
+
* The actual shapes created by the `Diagram`.
|
|
199
240
|
*/
|
|
200
241
|
get diagramShapes() {
|
|
201
242
|
return this.diagramWidget?.shapes;
|
|
202
243
|
}
|
|
203
244
|
/**
|
|
204
|
-
* The actual connections created by the Diagram
|
|
245
|
+
* The actual connections created by the `Diagram`.
|
|
205
246
|
*/
|
|
206
247
|
get diagramConnections() {
|
|
207
248
|
return this.diagramWidget?.connections;
|
|
@@ -226,22 +267,43 @@ class DiagramComponent {
|
|
|
226
267
|
shapeDefaults: this.shapeDefaults,
|
|
227
268
|
connectionDefaults: this.connectionDefaults
|
|
228
269
|
};
|
|
229
|
-
|
|
270
|
+
/**
|
|
271
|
+
* Stores the converted shapes from user data.
|
|
272
|
+
*/
|
|
273
|
+
convertedShapes = [];
|
|
274
|
+
/**
|
|
275
|
+
* Stores the converted connections from user data.
|
|
276
|
+
*/
|
|
277
|
+
convertedConnections = [];
|
|
278
|
+
/**
|
|
279
|
+
* Current popup instance for tooltip.
|
|
280
|
+
*/
|
|
281
|
+
tooltipPopup;
|
|
282
|
+
/**
|
|
283
|
+
* Template reference for tooltip content.
|
|
284
|
+
*/
|
|
285
|
+
tooltipTemplate;
|
|
286
|
+
/**
|
|
287
|
+
* @hidden
|
|
288
|
+
* Current tooltip content for template context.
|
|
289
|
+
*/
|
|
290
|
+
tooltipContent = '';
|
|
291
|
+
constructor(wrapperElement, renderer, zone, popupService, viewContainer) {
|
|
230
292
|
this.wrapperElement = wrapperElement;
|
|
231
293
|
this.renderer = renderer;
|
|
232
294
|
this.zone = zone;
|
|
295
|
+
this.popupService = popupService;
|
|
296
|
+
this.viewContainer = viewContainer;
|
|
233
297
|
const isValid = validatePackage(packageMetadata);
|
|
234
298
|
this.licenseMessage = getLicenseMessage(packageMetadata);
|
|
235
299
|
this.showLicenseWatermark = shouldShowValidationUI(isValid);
|
|
236
300
|
}
|
|
237
301
|
ngOnChanges(changes) {
|
|
238
302
|
let recreate = false;
|
|
239
|
-
if (changes['shapes']) {
|
|
240
|
-
this.
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (changes['connections']) {
|
|
244
|
-
this.options.connections = this.connections;
|
|
303
|
+
if (changes['shapes'] || changes['connections'] || changes['shapeModelFields'] || changes['connectionModelFields']) {
|
|
304
|
+
this.convertUserData();
|
|
305
|
+
this.options.shapes = this.convertedShapes;
|
|
306
|
+
this.options.connections = this.convertedConnections;
|
|
245
307
|
recreate = true;
|
|
246
308
|
}
|
|
247
309
|
if (changes['connectionDefaults']) {
|
|
@@ -301,50 +363,33 @@ class DiagramComponent {
|
|
|
301
363
|
}
|
|
302
364
|
}
|
|
303
365
|
ngAfterViewInit() {
|
|
366
|
+
this.convertUserData();
|
|
367
|
+
this.options.shapes = this.convertedShapes;
|
|
368
|
+
this.options.connections = this.convertedConnections;
|
|
304
369
|
this.renderer.setStyle(this.wrapperElement.nativeElement, 'display', 'block');
|
|
305
370
|
this.init();
|
|
306
|
-
|
|
307
|
-
this.diagramWidget.bind(eventName, (e) => {
|
|
308
|
-
if (eventName === 'click') {
|
|
309
|
-
eventName = 'diagramClick';
|
|
310
|
-
}
|
|
311
|
-
if (eventName === 'select') {
|
|
312
|
-
eventName = 'onSelect';
|
|
313
|
-
}
|
|
314
|
-
if (eventName === 'pan') {
|
|
315
|
-
eventName = 'onPan';
|
|
316
|
-
}
|
|
317
|
-
if (eventName === 'itemBoundsChange') {
|
|
318
|
-
eventName = 'shapeBoundsChange';
|
|
319
|
-
}
|
|
320
|
-
const emitter = this.activeEmitter(eventName);
|
|
321
|
-
if (emitter) {
|
|
322
|
-
this.zone.run(() => {
|
|
323
|
-
emitter.emit(e);
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
});
|
|
371
|
+
this.bindDiagramEvents();
|
|
328
372
|
}
|
|
329
373
|
ngOnDestroy() {
|
|
374
|
+
this.hideTooltip();
|
|
330
375
|
this.diagramWidget?.destroy();
|
|
331
376
|
}
|
|
332
377
|
/**
|
|
333
|
-
* Provides the current Diagram's shapes and connections that can be used to create a new Diagram when needed.
|
|
378
|
+
* Provides the current `Diagram`'s shapes and connections that can be used to create a new `Diagram` when needed.
|
|
334
379
|
* @returns {DiagramState} Object containing shapes and connections arrays.
|
|
335
380
|
*/
|
|
336
381
|
getState() {
|
|
337
382
|
return this.diagramWidget?.save();
|
|
338
383
|
}
|
|
339
384
|
/**
|
|
340
|
-
* Focuses the Diagram
|
|
385
|
+
* Focuses the `Diagram`.
|
|
341
386
|
* @returns {boolean} true if focus was set successfully.
|
|
342
387
|
*/
|
|
343
388
|
focus() {
|
|
344
389
|
return this.diagramWidget?.focus();
|
|
345
390
|
}
|
|
346
391
|
/**
|
|
347
|
-
* Clears the Diagram
|
|
392
|
+
* Clears the `Diagram`.
|
|
348
393
|
*/
|
|
349
394
|
clear() {
|
|
350
395
|
this.diagramWidget?.clear();
|
|
@@ -359,7 +404,7 @@ class DiagramComponent {
|
|
|
359
404
|
return this.diagramWidget?.connected(source, target);
|
|
360
405
|
}
|
|
361
406
|
/**
|
|
362
|
-
* Adds connection to the Diagram
|
|
407
|
+
* Adds connection to the `Diagram`.
|
|
363
408
|
* @param {Connection} Connection.
|
|
364
409
|
* @param {boolean} Boolean.
|
|
365
410
|
* @returns {Connection} The newly created connection.
|
|
@@ -369,7 +414,7 @@ class DiagramComponent {
|
|
|
369
414
|
return newConnection;
|
|
370
415
|
}
|
|
371
416
|
/**
|
|
372
|
-
* Adds shape to the Diagram
|
|
417
|
+
* Adds shape to the `Diagram`.
|
|
373
418
|
* @param {ShapeOptions | Shape | Point} If you pass a `Point`, a new Shape with default options will be created and positioned at that point.
|
|
374
419
|
* @param {boolean} Boolean indicating if the action should be undoable.
|
|
375
420
|
* @returns {Shape} The newly created shape.
|
|
@@ -379,7 +424,7 @@ class DiagramComponent {
|
|
|
379
424
|
return newShape;
|
|
380
425
|
}
|
|
381
426
|
/**
|
|
382
|
-
* Removes shape(s) and/or connection(s) from the Diagram
|
|
427
|
+
* Removes shape(s) and/or connection(s) from the `Diagram`.
|
|
383
428
|
* @param {Shape | Connection | (Shape | Connection)[]} Shape, Connection or an Array of Shapes and/or Connections.
|
|
384
429
|
* @param {Boolean} Boolean indicating if the action should be undoable.
|
|
385
430
|
*/
|
|
@@ -387,7 +432,7 @@ class DiagramComponent {
|
|
|
387
432
|
this.diagramWidget?.remove(items, undoable);
|
|
388
433
|
}
|
|
389
434
|
/**
|
|
390
|
-
* Connects two items in the Diagram
|
|
435
|
+
* Connects two items in the `Diagram`.
|
|
391
436
|
* @param {Shape | Connector | Point} Shape, Shape's Connector or Point.
|
|
392
437
|
* @param {Shape | Connector | Point} Shape, Shape's Connector or Point.
|
|
393
438
|
* @param {ConnectionOptions} Connection options.
|
|
@@ -418,7 +463,7 @@ class DiagramComponent {
|
|
|
418
463
|
return this.diagramWidget?.select(items, options);
|
|
419
464
|
}
|
|
420
465
|
/**
|
|
421
|
-
* Selects all items in the Diagram
|
|
466
|
+
* Selects all items in the `Diagram`.
|
|
422
467
|
*/
|
|
423
468
|
selectAll() {
|
|
424
469
|
this.diagramWidget?.selectAll();
|
|
@@ -602,12 +647,141 @@ class DiagramComponent {
|
|
|
602
647
|
exportVisual() {
|
|
603
648
|
return this.diagramWidget?.exportVisual();
|
|
604
649
|
}
|
|
650
|
+
/**
|
|
651
|
+
* Handles the tooltipShow event from the diagram widget.
|
|
652
|
+
*/
|
|
653
|
+
handleTooltipShow(event) {
|
|
654
|
+
this.hideTooltip();
|
|
655
|
+
if (event.item.options.tooltip?.visible) {
|
|
656
|
+
this.tooltipContent = event.item.options.tooltip?.text;
|
|
657
|
+
this.tooltipPopup = this.popupService.open({
|
|
658
|
+
content: this.tooltipTemplate,
|
|
659
|
+
appendTo: this.viewContainer
|
|
660
|
+
});
|
|
661
|
+
const popupElementRect = this.tooltipPopup.popup.instance.container.nativeElement.querySelector('.k-tooltip').getBoundingClientRect();
|
|
662
|
+
const zoom = event.item.diagram.zoom();
|
|
663
|
+
const pan = event.item.diagram.pan();
|
|
664
|
+
const diagramRect = this.diagramWidget.element.getBoundingClientRect();
|
|
665
|
+
const win = this.diagramWidget.element.ownerDocument.defaultView;
|
|
666
|
+
const lines = this.diagramWidget.connections.map(con => con.allPoints());
|
|
667
|
+
const shapes = this.diagramWidget.shapes.map(shp => shp.bounds());
|
|
668
|
+
const pos = placeTooltip({
|
|
669
|
+
hovered: event.item,
|
|
670
|
+
mouse: event.point,
|
|
671
|
+
shapes: shapes,
|
|
672
|
+
connections: lines,
|
|
673
|
+
diagramRect: diagramRect,
|
|
674
|
+
zoom: zoom,
|
|
675
|
+
pan: pan,
|
|
676
|
+
tooltipSize: { width: popupElementRect.width, height: popupElementRect.height },
|
|
677
|
+
viewportBounds: new DOMRect(0, 0, win.innerWidth, win.innerHeight)
|
|
678
|
+
});
|
|
679
|
+
this.tooltipPopup.popup.instance.offset = { left: pos.left + win.scrollX, top: pos.top + win.scrollY };
|
|
680
|
+
this.tooltipShow.emit(event);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* Handles the tooltipHide event from the diagram widget.
|
|
685
|
+
*/
|
|
686
|
+
handleTooltipHide(event) {
|
|
687
|
+
this.hideTooltip();
|
|
688
|
+
this.tooltipHide.emit(event);
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Hides the current tooltip and cleans up resources.
|
|
692
|
+
*/
|
|
693
|
+
hideTooltip() {
|
|
694
|
+
if (this.tooltipPopup) {
|
|
695
|
+
this.tooltipPopup.close();
|
|
696
|
+
this.tooltipPopup = undefined;
|
|
697
|
+
}
|
|
698
|
+
this.tooltipContent = '';
|
|
699
|
+
}
|
|
605
700
|
activeEmitter(name) {
|
|
606
701
|
const emitter = this[name];
|
|
607
702
|
if (emitter?.emit && hasObservers(emitter)) {
|
|
608
703
|
return emitter;
|
|
609
704
|
}
|
|
610
705
|
}
|
|
706
|
+
/**
|
|
707
|
+
* Binds event handlers to the diagram widget.
|
|
708
|
+
*/
|
|
709
|
+
bindDiagramEvents() {
|
|
710
|
+
events.forEach((eventName) => {
|
|
711
|
+
this.diagramWidget.bind(eventName, (e) => {
|
|
712
|
+
if (eventName === 'click') {
|
|
713
|
+
eventName = 'diagramClick';
|
|
714
|
+
}
|
|
715
|
+
if (eventName === 'select') {
|
|
716
|
+
eventName = 'onSelect';
|
|
717
|
+
}
|
|
718
|
+
if (eventName === 'pan') {
|
|
719
|
+
eventName = 'onPan';
|
|
720
|
+
}
|
|
721
|
+
if (eventName === 'itemBoundsChange') {
|
|
722
|
+
eventName = 'shapeBoundsChange';
|
|
723
|
+
}
|
|
724
|
+
if (this.tooltip && eventName === 'tooltipShow') {
|
|
725
|
+
this.zone.run(() => {
|
|
726
|
+
this.handleTooltipShow(e);
|
|
727
|
+
});
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
730
|
+
if (this.tooltip && eventName === 'tooltipHide') {
|
|
731
|
+
this.zone.run(() => {
|
|
732
|
+
this.handleTooltipHide(e);
|
|
733
|
+
});
|
|
734
|
+
return;
|
|
735
|
+
}
|
|
736
|
+
const emitter = this.activeEmitter(eventName);
|
|
737
|
+
if (emitter) {
|
|
738
|
+
this.zone.run(() => {
|
|
739
|
+
emitter.emit(e);
|
|
740
|
+
});
|
|
741
|
+
}
|
|
742
|
+
});
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Converts user data to Diagram model format using field mappings.
|
|
747
|
+
*/
|
|
748
|
+
convertUserData() {
|
|
749
|
+
if (this.shapeModelFields || this.connectionModelFields) {
|
|
750
|
+
const mapping = {
|
|
751
|
+
shapes: {
|
|
752
|
+
source: () => this.shapes || [],
|
|
753
|
+
map: this.createFieldMapping(this.shapeModelFields)
|
|
754
|
+
},
|
|
755
|
+
connections: {
|
|
756
|
+
source: () => this.connections || [],
|
|
757
|
+
map: this.createFieldMapping(this.connectionModelFields)
|
|
758
|
+
}
|
|
759
|
+
};
|
|
760
|
+
const result = convertToDiagramModel({ shapes: this.shapes, connections: this.connections }, mapping);
|
|
761
|
+
this.convertedShapes = result.shapes;
|
|
762
|
+
this.convertedConnections = result.connections;
|
|
763
|
+
}
|
|
764
|
+
else {
|
|
765
|
+
this.convertedShapes = this.shapes || [];
|
|
766
|
+
this.convertedConnections = this.connections || [];
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Creates field mapping configuration from model fields.
|
|
771
|
+
*/
|
|
772
|
+
createFieldMapping(modelFields) {
|
|
773
|
+
if (!modelFields) {
|
|
774
|
+
return {};
|
|
775
|
+
}
|
|
776
|
+
const mapping = {};
|
|
777
|
+
Object.keys(modelFields).forEach(key => {
|
|
778
|
+
const fieldName = modelFields[key];
|
|
779
|
+
if (fieldName) {
|
|
780
|
+
mapping[key] = fieldName;
|
|
781
|
+
}
|
|
782
|
+
});
|
|
783
|
+
return mapping;
|
|
784
|
+
}
|
|
611
785
|
init() {
|
|
612
786
|
if (!isDocumentAvailable()) {
|
|
613
787
|
return;
|
|
@@ -627,9 +801,12 @@ class DiagramComponent {
|
|
|
627
801
|
this.options[prop] = this[prop];
|
|
628
802
|
this.diagramWidget?.setOptions(this.options);
|
|
629
803
|
}
|
|
630
|
-
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 });
|
|
631
|
-
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: `
|
|
804
|
+
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 });
|
|
805
|
+
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: `
|
|
632
806
|
<div kendoWatermarkOverlay *ngIf="showLicenseWatermark" [licenseMessage]="licenseMessage"></div>
|
|
807
|
+
<ng-template *ngIf="tooltip" #tooltipTemplate let-content="content">
|
|
808
|
+
<div class="k-tooltip">{{tooltipContent}}</div>
|
|
809
|
+
</ng-template>
|
|
633
810
|
`, isInline: true, dependencies: [{ kind: "component", type: WatermarkOverlayComponent, selector: "div[kendoWatermarkOverlay]", inputs: ["licenseMessage"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
634
811
|
}
|
|
635
812
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramComponent, decorators: [{
|
|
@@ -640,16 +817,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
640
817
|
selector: 'kendo-diagram',
|
|
641
818
|
template: `
|
|
642
819
|
<div kendoWatermarkOverlay *ngIf="showLicenseWatermark" [licenseMessage]="licenseMessage"></div>
|
|
820
|
+
<ng-template *ngIf="tooltip" #tooltipTemplate let-content="content">
|
|
821
|
+
<div class="k-tooltip">{{tooltipContent}}</div>
|
|
822
|
+
</ng-template>
|
|
643
823
|
`,
|
|
644
|
-
imports: [WatermarkOverlayComponent, NgIf]
|
|
824
|
+
imports: [WatermarkOverlayComponent, NgIf],
|
|
825
|
+
providers: [PopupService]
|
|
645
826
|
}]
|
|
646
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }], propDecorators: { diagramClass: [{
|
|
827
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i1.PopupService }, { type: i0.ViewContainerRef }], propDecorators: { diagramClass: [{
|
|
647
828
|
type: HostBinding,
|
|
648
829
|
args: ['class.k-diagram']
|
|
649
830
|
}], connectionDefaults: [{
|
|
650
831
|
type: Input
|
|
651
832
|
}], connections: [{
|
|
652
833
|
type: Input
|
|
834
|
+
}], tooltip: [{
|
|
835
|
+
type: Input
|
|
836
|
+
}], connectionModelFields: [{
|
|
837
|
+
type: Input
|
|
653
838
|
}], editable: [{
|
|
654
839
|
type: Input
|
|
655
840
|
}], layout: [{
|
|
@@ -662,6 +847,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
662
847
|
type: Input
|
|
663
848
|
}], shapes: [{
|
|
664
849
|
type: Input
|
|
850
|
+
}], shapeModelFields: [{
|
|
851
|
+
type: Input
|
|
665
852
|
}], zoom: [{
|
|
666
853
|
type: Input
|
|
667
854
|
}], zoomMax: [{
|
|
@@ -696,6 +883,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
696
883
|
type: Output
|
|
697
884
|
}], zoomStart: [{
|
|
698
885
|
type: Output
|
|
886
|
+
}], tooltipShow: [{
|
|
887
|
+
type: Output
|
|
888
|
+
}], tooltipHide: [{
|
|
889
|
+
type: Output
|
|
890
|
+
}], tooltipTemplate: [{
|
|
891
|
+
type: ViewChild,
|
|
892
|
+
args: ['tooltipTemplate']
|
|
699
893
|
}] } });
|
|
700
894
|
|
|
701
895
|
/**
|
package/index.d.ts
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 { DiagramOptions, ShapeConnector, ShapeContent, EditableDefaults, ShapeDefaultsEditable, ShapeEditable, ShapeFillGradientStop, ShapeFillGradient, ShapeFill, ShapeHover, ShapeRotation, Fill, Stroke, DashType, ShapeType, ShapeConnectorHover, ShapeConnectorDefaults, ShapeDefaults, ShapeOptions, Selectable, Pannable, LayoutGrid, DiagramLayout, DiagramEditable, Coordinate, ConnectionOptions, ConnectionDefaults, DiagramDragEvent, DiagramDomEvent, DiagramZoomStartEvent, DiagramZoomEndEvent, DiagramPanEvent, DiagramSelectEvent, DiagramChangeEvent, DiagramItemBoundsChangeEvent, Shape, Connection, Connector, Diagram, Point, Rect, DiagramState, BringIntoViewOptions, SelectionOptions, Direction, 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, ConnectionCap, ConnectionContent, } from '@progress/kendo-diagram-common';
|
|
5
|
+
export { DiagramOptions, ShapeConnector, ShapeContent, EditableDefaults, ShapeDefaultsEditable, ShapeEditable, ShapeFillGradientStop, ShapeFillGradient, ShapeFill, ShapeHover, ShapeRotation, Fill, Stroke, DashType, ShapeType, ShapeConnectorHover, ShapeConnectorDefaults, ShapeDefaults, ShapeOptions, Selectable, Pannable, LayoutGrid, DiagramLayout, DiagramEditable, Coordinate, ConnectionOptions, ConnectionDefaults, DiagramDragEvent, DiagramDomEvent, DiagramZoomStartEvent, DiagramZoomEndEvent, DiagramPanEvent, DiagramSelectEvent, DiagramChangeEvent, DiagramItemBoundsChangeEvent, Shape, Connection, Connector, Diagram, Point, Rect, DiagramState, BringIntoViewOptions, SelectionOptions, Direction, 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, ConnectionCap, ConnectionContent, convertToDiagramModel, DiagramMapping, ConvertResult, ConnectionMapping, ShapeMapping, MapSpec, FromPathOrFn } 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';
|