@progress/kendo-angular-diagrams 21.0.0-develop.27 → 21.0.0-develop.29

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.
@@ -0,0 +1,38 @@
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
+ import { TemplateRef } from '@angular/core';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Defines a custom template for connection tooltips within the `kendo-diagram` component.
9
+ * Use this directive to customize how tooltips appear when hovering over connections.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { Component } from '@angular/core';
14
+ *
15
+ * _@Component({
16
+ * selector: 'my-app',
17
+ * template: `
18
+ * <kendo-diagram>
19
+ * <ng-template kendoDiagramConnectionTooltipTemplate let-dataItem>
20
+ * {{dataItem.tooltipContent}}
21
+ * </ng-template>
22
+ * </kendo-diagram>
23
+ * `
24
+ * })
25
+ * class AppComponent {
26
+ * }
27
+ *
28
+ * ```
29
+ */
30
+ export declare class ConnectionTooltipTemplateDirective {
31
+ /**
32
+ * @hidden
33
+ */
34
+ templateRef: TemplateRef<any>;
35
+ constructor(templateRef: TemplateRef<any>);
36
+ static ɵfac: i0.ɵɵFactoryDeclaration<ConnectionTooltipTemplateDirective, never>;
37
+ static ɵdir: i0.ɵɵDirectiveDeclaration<ConnectionTooltipTemplateDirective, "[kendoDiagramConnectionTooltipTemplate]", never, {}, {}, never, never, true, never>;
38
+ }
@@ -3,10 +3,12 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { AfterViewInit, ElementRef, EventEmitter, NgZone, OnChanges, OnDestroy, Renderer2, SimpleChanges, TemplateRef, ViewContainerRef } from '@angular/core';
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';
6
+ import { ConnectionOptions, DiagramEditable, DiagramLayout, Pannable, Selectable, Shape, ShapeOptions, DiagramDragEvent, DiagramDomEvent, DiagramZoomStartEvent, DiagramZoomEndEvent, DiagramSelectEvent, DiagramPanEvent, DiagramItemBoundsChangeEvent, DiagramChangeEvent, Connection, Connector, Diagram, Point, Rect, DiagramState, BringIntoViewOptions, SelectionOptions, Direction } from '@progress/kendo-diagram-common';
7
7
  import { PopupService } from '@progress/kendo-angular-popup';
8
8
  import { Group } from '@progress/kendo-drawing';
9
- import { ShapeModelFields, ConnectionModelFields } from './index';
9
+ import { ShapeModelFields, ConnectionModelFields, ShapeDefaults, ConnectionDefaults } from './index';
10
+ import { ShapeTooltipTemplateDirective } from './shape-tooltip-template.directive';
11
+ import { ConnectionTooltipTemplateDirective } from './connection-tooltip-template.directive';
10
12
  import * as i0 from "@angular/core";
11
13
  /**
12
14
  * Represents the [Kendo UI Diagram component for Angular](slug:overview_diagram).
@@ -39,12 +41,6 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
39
41
  *
40
42
  */
41
43
  connections?: any[];
42
- /**
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
44
  /**
49
45
  * Defines the field mapping configuration for connections data binding ([see example](slug:diagram_data_binding#field-mapping)).
50
46
  * Maps source object properties to `Diagram` connection properties.
@@ -176,11 +172,11 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
176
172
  /**
177
173
  * Fires when a tooltip should shown for a shape or connection.
178
174
  */
179
- tooltipShow: EventEmitter<any>;
175
+ tooltipShow: EventEmitter<ShapeOptions | ConnectionOptions>;
180
176
  /**
181
177
  * Fires when a tooltip should be hidden.
182
178
  */
183
- tooltipHide: EventEmitter<any>;
179
+ tooltipHide: EventEmitter<ShapeOptions | ConnectionOptions>;
184
180
  /**
185
181
  * @hidden
186
182
  * Represents the Diagram instance, holding the core functionality of the Diagram.
@@ -206,6 +202,10 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
206
202
  * @hidden
207
203
  */
208
204
  licenseMessage?: string;
205
+ /**
206
+ * @hidden
207
+ */
208
+ customTemplate?: TemplateRef<any>;
209
209
  private options;
210
210
  /**
211
211
  * Stores the converted shapes from user data.
@@ -219,15 +219,15 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
219
219
  * Current popup instance for tooltip.
220
220
  */
221
221
  private tooltipPopup?;
222
- /**
223
- * Template reference for tooltip content.
224
- */
225
- tooltipTemplate: TemplateRef<any>;
222
+ defaultTooltipTemplate: TemplateRef<any>;
223
+ customTooltipTemplate: TemplateRef<any>;
224
+ shapeTooltipTemplate: ShapeTooltipTemplateDirective;
225
+ connectionTooltipTemplate: ConnectionTooltipTemplateDirective;
226
226
  /**
227
227
  * @hidden
228
- * Current tooltip content for template context.
228
+ * The original data item provided by the user. Passed in the tooltip template context.
229
229
  */
230
- tooltipContent: string;
230
+ dataItem: any;
231
231
  constructor(wrapperElement: ElementRef<HTMLElement>, renderer: Renderer2, zone: NgZone, popupService: PopupService, viewContainer: ViewContainerRef);
232
232
  ngOnChanges(changes: SimpleChanges): void;
233
233
  ngAfterViewInit(): void;
@@ -437,6 +437,9 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
437
437
  * Handles the tooltipShow event from the diagram widget.
438
438
  */
439
439
  private handleTooltipShow;
440
+ private showTooltip;
441
+ private popupClass;
442
+ private setCustomTemplate;
440
443
  /**
441
444
  * Handles the tooltipHide event from the diagram widget.
442
445
  */
@@ -454,6 +457,7 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
454
457
  * Converts user data to Diagram model format using field mappings.
455
458
  */
456
459
  private convertUserData;
460
+ private addDataItemProperty;
457
461
  /**
458
462
  * Creates field mapping configuration from model fields.
459
463
  */
@@ -461,5 +465,5 @@ export declare class DiagramComponent implements AfterViewInit, OnChanges, OnDes
461
465
  private init;
462
466
  private updateOptions;
463
467
  static ɵfac: i0.ɵɵFactoryDeclaration<DiagramComponent, 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>;
468
+ static ɵcmp: i0.ɵɵComponentDeclaration<DiagramComponent, "kendo-diagram", ["kendoDiagram"], { "connectionDefaults": { "alias": "connectionDefaults"; "required": false; }; "connections": { "alias": "connections"; "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"; }, ["shapeTooltipTemplate", "connectionTooltipTemplate"], never, true, never>;
465
469
  }
@@ -4,6 +4,8 @@
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import * as i0 from "@angular/core";
6
6
  import * as i1 from "./diagram.component";
7
+ import * as i2 from "./shape-tooltip-template.directive";
8
+ import * as i3 from "./connection-tooltip-template.directive";
7
9
  /**
8
10
  * Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi'])
9
11
  * definition for the Diagram component.
@@ -37,6 +39,6 @@ import * as i1 from "./diagram.component";
37
39
  */
38
40
  export declare class DiagramModule {
39
41
  static ɵfac: i0.ɵɵFactoryDeclaration<DiagramModule, never>;
40
- static ɵmod: i0.ɵɵNgModuleDeclaration<DiagramModule, never, [typeof i1.DiagramComponent], [typeof i1.DiagramComponent]>;
42
+ static ɵmod: i0.ɵɵNgModuleDeclaration<DiagramModule, never, [typeof i1.DiagramComponent, typeof i2.ShapeTooltipTemplateDirective, typeof i3.ConnectionTooltipTemplateDirective], [typeof i1.DiagramComponent, typeof i2.ShapeTooltipTemplateDirective, typeof i3.ConnectionTooltipTemplateDirective]>;
41
43
  static ɵinj: i0.ɵɵInjectorDeclaration<DiagramModule>;
42
44
  }
package/directives.d.ts CHANGED
@@ -3,6 +3,8 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { DiagramComponent } from "./diagram.component";
6
+ import { ConnectionTooltipTemplateDirective } from "./connection-tooltip-template.directive";
7
+ import { ShapeTooltipTemplateDirective } from "./shape-tooltip-template.directive";
6
8
  /**
7
9
  * Represents the utility array that that contains all `Diagram`-related components and directives.
8
10
  *
@@ -22,4 +24,4 @@ import { DiagramComponent } from "./diagram.component";
22
24
  * export class DiagramAppComponent {}
23
25
  * ```
24
26
  */
25
- export declare const KENDO_DIAGRAM: readonly [typeof DiagramComponent];
27
+ export declare const KENDO_DIAGRAM: readonly [typeof DiagramComponent, typeof ShapeTooltipTemplateDirective, typeof ConnectionTooltipTemplateDirective];
@@ -0,0 +1,47 @@
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
+ import { Directive, TemplateRef } from '@angular/core';
6
+ import * as i0 from "@angular/core";
7
+ /**
8
+ * Defines a custom template for connection tooltips within the `kendo-diagram` component.
9
+ * Use this directive to customize how tooltips appear when hovering over connections.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * import { Component } from '@angular/core';
14
+ *
15
+ * _@Component({
16
+ * selector: 'my-app',
17
+ * template: `
18
+ * <kendo-diagram>
19
+ * <ng-template kendoDiagramConnectionTooltipTemplate let-dataItem>
20
+ * {{dataItem.tooltipContent}}
21
+ * </ng-template>
22
+ * </kendo-diagram>
23
+ * `
24
+ * })
25
+ * class AppComponent {
26
+ * }
27
+ *
28
+ * ```
29
+ */
30
+ export class ConnectionTooltipTemplateDirective {
31
+ /**
32
+ * @hidden
33
+ */
34
+ templateRef;
35
+ constructor(templateRef) {
36
+ this.templateRef = templateRef;
37
+ }
38
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ConnectionTooltipTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
39
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: ConnectionTooltipTemplateDirective, isStandalone: true, selector: "[kendoDiagramConnectionTooltipTemplate]", ngImport: i0 });
40
+ }
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ConnectionTooltipTemplateDirective, decorators: [{
42
+ type: Directive,
43
+ args: [{
44
+ selector: '[kendoDiagramConnectionTooltipTemplate]',
45
+ standalone: true,
46
+ }]
47
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
@@ -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, TemplateRef, ViewChild, ViewContainerRef, } from '@angular/core';
6
- import { Diagram, convertToDiagramModel, placeTooltip } from '@progress/kendo-diagram-common';
5
+ import { Component, ContentChild, ElementRef, EventEmitter, HostBinding, Input, NgZone, Output, Renderer2, TemplateRef, ViewChild, ViewContainerRef, } from '@angular/core';
6
+ import { Shape, Connection, 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
10
  import { PopupService } from '@progress/kendo-angular-popup';
11
- import { NgIf } from '@angular/common';
11
+ import { NgIf, NgTemplateOutlet } from '@angular/common';
12
12
  import { events, loadTheme } from '@progress/kendo-diagram-common';
13
13
  import { CONNECTION_DEFAULTS, SHAPE_DEFAULTS } from './utils';
14
+ import { ShapeTooltipTemplateDirective } from './shape-tooltip-template.directive';
15
+ import { ConnectionTooltipTemplateDirective } from './connection-tooltip-template.directive';
14
16
  import * as i0 from "@angular/core";
15
17
  import * as i1 from "@progress/kendo-angular-popup";
16
18
  /**
@@ -44,12 +46,6 @@ export class DiagramComponent {
44
46
  *
45
47
  */
46
48
  connections = [];
47
- /**
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
49
  /**
54
50
  * Defines the field mapping configuration for connections data binding ([see example](slug:diagram_data_binding#field-mapping)).
55
51
  * Maps source object properties to `Diagram` connection properties.
@@ -217,6 +213,10 @@ export class DiagramComponent {
217
213
  * @hidden
218
214
  */
219
215
  licenseMessage;
216
+ /**
217
+ * @hidden
218
+ */
219
+ customTemplate;
220
220
  options = {
221
221
  shapes: this.shapes,
222
222
  connections: this.connections,
@@ -241,15 +241,15 @@ export class DiagramComponent {
241
241
  * Current popup instance for tooltip.
242
242
  */
243
243
  tooltipPopup;
244
- /**
245
- * Template reference for tooltip content.
246
- */
247
- tooltipTemplate;
244
+ defaultTooltipTemplate;
245
+ customTooltipTemplate;
246
+ shapeTooltipTemplate;
247
+ connectionTooltipTemplate;
248
248
  /**
249
249
  * @hidden
250
- * Current tooltip content for template context.
250
+ * The original data item provided by the user. Passed in the tooltip template context.
251
251
  */
252
- tooltipContent = '';
252
+ dataItem;
253
253
  constructor(wrapperElement, renderer, zone, popupService, viewContainer) {
254
254
  this.wrapperElement = wrapperElement;
255
255
  this.renderer = renderer;
@@ -322,6 +322,7 @@ export class DiagramComponent {
322
322
  }
323
323
  if (recreate) {
324
324
  this.init();
325
+ this.bindDiagramEvents();
325
326
  }
326
327
  }
327
328
  ngAfterViewInit() {
@@ -614,40 +615,87 @@ export class DiagramComponent {
614
615
  */
615
616
  handleTooltipShow(event) {
616
617
  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);
618
+ const dataItem = event.item.dataItem;
619
+ const isShape = event.item instanceof Shape;
620
+ const isConnection = event.item instanceof Connection;
621
+ this.setCustomTemplate(isShape, isConnection);
622
+ const defaultsEnabled = isShape
623
+ ? this.options.shapeDefaults.tooltip?.visible
624
+ : this.options.connectionDefaults.tooltip?.visible;
625
+ const itemTooltipEnabled = dataItem.tooltip?.visible;
626
+ const optionsArray = isShape ? this.options.shapes : this.options.connections;
627
+ const optionsItem = optionsArray?.find((item) => item.id === event.item.id);
628
+ const hasTooltipText = !!dataItem.tooltipText || !!optionsItem?.tooltipText;
629
+ if (!dataItem.tooltipText && optionsItem?.tooltipText) {
630
+ dataItem.tooltipText = optionsItem.tooltipText;
631
+ }
632
+ const shouldShowTooltip = itemTooltipEnabled !== false && hasTooltipText && (defaultsEnabled || itemTooltipEnabled);
633
+ if (shouldShowTooltip) {
634
+ this.dataItem = dataItem;
635
+ let popupContent = this.defaultTooltipTemplate;
636
+ const showCustomTemplate = Boolean((isShape && this.shapeTooltipTemplate) || (isConnection && this.connectionTooltipTemplate));
637
+ if (showCustomTemplate) {
638
+ popupContent = this.customTooltipTemplate;
639
+ }
640
+ const popupClass = this.popupClass(isShape, dataItem);
641
+ this.showTooltip(event, popupContent, popupClass);
642
+ }
643
+ }
644
+ showTooltip(event, content, popupClass) {
645
+ this.tooltipPopup = this.popupService.open({
646
+ content: content,
647
+ appendTo: this.viewContainer,
648
+ popupClass,
649
+ animate: false
650
+ });
651
+ const contentElement = this.tooltipPopup.popupElement.querySelector('.k-popup');
652
+ if (content === this.defaultTooltipTemplate) {
653
+ this.renderer.addClass(contentElement, 'k-tooltip');
654
+ }
655
+ const popupElementRect = contentElement.getBoundingClientRect();
656
+ const zoom = event.item.diagram.zoom();
657
+ const pan = event.item.diagram.pan();
658
+ const diagramRect = this.diagramWidget.element.getBoundingClientRect();
659
+ const win = this.diagramWidget.element.ownerDocument.defaultView;
660
+ const lines = this.diagramWidget.connections.map(con => con.allPoints());
661
+ const shapes = this.diagramWidget.shapes.map(shp => shp.bounds());
662
+ const pos = placeTooltip({
663
+ hovered: event.item,
664
+ mouse: event.point,
665
+ shapes: shapes,
666
+ connections: lines,
667
+ diagramRect: diagramRect,
668
+ zoom: zoom,
669
+ pan: pan,
670
+ tooltipSize: { width: popupElementRect.width, height: popupElementRect.height },
671
+ viewportBounds: new DOMRect(0, 0, win.innerWidth, win.innerHeight)
672
+ });
673
+ this.tooltipPopup.popup.instance.offset = { left: pos.left + win.scrollX, top: pos.top + win.scrollY };
674
+ this.tooltipShow.emit({ ...this.dataItem });
675
+ }
676
+ popupClass(isShape, dataItem) {
677
+ const defaultCssClass = isShape
678
+ ? this.options.shapeDefaults?.tooltip?.cssClass
679
+ : this.options.connectionDefaults?.tooltip?.cssClass;
680
+ const itemCssClass = dataItem.tooltip?.cssClass;
681
+ const popupClass = defaultCssClass || itemCssClass;
682
+ return popupClass;
683
+ }
684
+ setCustomTemplate(isShape, isConnection) {
685
+ this.customTemplate = null;
686
+ if (isShape && this.shapeTooltipTemplate) {
687
+ this.customTemplate = this.shapeTooltipTemplate.templateRef;
688
+ }
689
+ if (isConnection && this.connectionTooltipTemplate) {
690
+ this.customTemplate = this.connectionTooltipTemplate.templateRef;
643
691
  }
644
692
  }
645
693
  /**
646
694
  * Handles the tooltipHide event from the diagram widget.
647
695
  */
648
- handleTooltipHide(event) {
696
+ handleTooltipHide() {
649
697
  this.hideTooltip();
650
- this.tooltipHide.emit(event);
698
+ this.tooltipHide.emit({ ...this.dataItem });
651
699
  }
652
700
  /**
653
701
  * Hides the current tooltip and cleans up resources.
@@ -657,7 +705,6 @@ export class DiagramComponent {
657
705
  this.tooltipPopup.close();
658
706
  this.tooltipPopup = undefined;
659
707
  }
660
- this.tooltipContent = '';
661
708
  }
662
709
  activeEmitter(name) {
663
710
  const emitter = this[name];
@@ -683,15 +730,15 @@ export class DiagramComponent {
683
730
  if (eventName === 'itemBoundsChange') {
684
731
  eventName = 'shapeBoundsChange';
685
732
  }
686
- if (this.tooltip && eventName === 'tooltipShow') {
733
+ if (eventName === 'tooltipShow') {
687
734
  this.zone.run(() => {
688
735
  this.handleTooltipShow(e);
689
736
  });
690
737
  return;
691
738
  }
692
- if (this.tooltip && eventName === 'tooltipHide') {
739
+ if (eventName === 'tooltipHide') {
693
740
  this.zone.run(() => {
694
- this.handleTooltipHide(e);
741
+ this.handleTooltipHide();
695
742
  });
696
743
  return;
697
744
  }
@@ -719,14 +766,26 @@ export class DiagramComponent {
719
766
  map: this.createFieldMapping(this.connectionModelFields)
720
767
  }
721
768
  };
722
- const result = convertToDiagramModel({ shapes: this.shapes, connections: this.connections }, mapping);
723
- this.convertedShapes = result.shapes;
724
- this.convertedConnections = result.connections;
769
+ const result = convertToDiagramModel({ shapes: this.shapes, connections: this.options.connections }, mapping);
770
+ this.convertedShapes = this.addDataItemProperty(result.shapes, this.shapes);
771
+ this.convertedConnections = this.addDataItemProperty(result.connections, this.connections);
725
772
  }
726
773
  else {
727
- this.convertedShapes = this.shapes || [];
728
- this.convertedConnections = this.connections || [];
774
+ this.convertedShapes = this.addDataItemProperty(this.shapes, this.shapes);
775
+ this.convertedConnections = this.addDataItemProperty(this.connections, this.connections);
776
+ }
777
+ }
778
+ addDataItemProperty(array, sourceArray) {
779
+ if (!array || !Array.isArray(array) || array.length === 0) {
780
+ return [];
781
+ }
782
+ if (!sourceArray || !Array.isArray(sourceArray)) {
783
+ return array;
729
784
  }
785
+ return array.map((item, index) => ({
786
+ ...item,
787
+ dataItem: sourceArray[index]
788
+ }));
730
789
  }
731
790
  /**
732
791
  * Creates field mapping configuration from model fields.
@@ -764,12 +823,17 @@ export class DiagramComponent {
764
823
  this.diagramWidget?.setOptions(this.options);
765
824
  }
766
825
  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: `
826
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.14", type: DiagramComponent, isStandalone: true, selector: "kendo-diagram", inputs: { connectionDefaults: "connectionDefaults", connections: "connections", 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], queries: [{ propertyName: "shapeTooltipTemplate", first: true, predicate: ShapeTooltipTemplateDirective, descendants: true }, { propertyName: "connectionTooltipTemplate", first: true, predicate: ConnectionTooltipTemplateDirective, descendants: true }], viewQueries: [{ propertyName: "defaultTooltipTemplate", first: true, predicate: ["defaultTemplate"], descendants: true }, { propertyName: "customTooltipTemplate", first: true, predicate: ["customTooltipTemplate"], descendants: true }], exportAs: ["kendoDiagram"], usesOnChanges: true, ngImport: i0, template: `
768
827
  <div kendoWatermarkOverlay *ngIf="showLicenseWatermark" [licenseMessage]="licenseMessage"></div>
769
- <ng-template *ngIf="tooltip" #tooltipTemplate let-content="content">
770
- <div class="k-tooltip">{{tooltipContent}}</div>
828
+
829
+ <ng-template #customTooltipTemplate>
830
+ <ng-container [ngTemplateOutlet]="customTemplate" [ngTemplateOutletContext]="{ $implicit: dataItem }"></ng-container>
831
+ </ng-template>
832
+
833
+ <ng-template #defaultTemplate>
834
+ {{dataItem?.tooltipText}}
771
835
  </ng-template>
772
- `, isInline: true, dependencies: [{ kind: "component", type: WatermarkOverlayComponent, selector: "div[kendoWatermarkOverlay]", inputs: ["licenseMessage"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
836
+ `, isInline: true, dependencies: [{ kind: "component", type: WatermarkOverlayComponent, selector: "div[kendoWatermarkOverlay]", inputs: ["licenseMessage"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
773
837
  }
774
838
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramComponent, decorators: [{
775
839
  type: Component,
@@ -779,11 +843,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
779
843
  selector: 'kendo-diagram',
780
844
  template: `
781
845
  <div kendoWatermarkOverlay *ngIf="showLicenseWatermark" [licenseMessage]="licenseMessage"></div>
782
- <ng-template *ngIf="tooltip" #tooltipTemplate let-content="content">
783
- <div class="k-tooltip">{{tooltipContent}}</div>
846
+
847
+ <ng-template #customTooltipTemplate>
848
+ <ng-container [ngTemplateOutlet]="customTemplate" [ngTemplateOutletContext]="{ $implicit: dataItem }"></ng-container>
849
+ </ng-template>
850
+
851
+ <ng-template #defaultTemplate>
852
+ {{dataItem?.tooltipText}}
784
853
  </ng-template>
785
854
  `,
786
- imports: [WatermarkOverlayComponent, NgIf],
855
+ imports: [WatermarkOverlayComponent, NgIf, NgTemplateOutlet, ShapeTooltipTemplateDirective, ConnectionTooltipTemplateDirective],
787
856
  providers: [PopupService]
788
857
  }]
789
858
  }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i1.PopupService }, { type: i0.ViewContainerRef }], propDecorators: { diagramClass: [{
@@ -793,8 +862,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
793
862
  type: Input
794
863
  }], connections: [{
795
864
  type: Input
796
- }], tooltip: [{
797
- type: Input
798
865
  }], connectionModelFields: [{
799
866
  type: Input
800
867
  }], editable: [{
@@ -849,7 +916,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
849
916
  type: Output
850
917
  }], tooltipHide: [{
851
918
  type: Output
852
- }], tooltipTemplate: [{
919
+ }], defaultTooltipTemplate: [{
920
+ type: ViewChild,
921
+ args: ['defaultTemplate']
922
+ }], customTooltipTemplate: [{
853
923
  type: ViewChild,
854
- args: ['tooltipTemplate']
924
+ args: ['customTooltipTemplate']
925
+ }], shapeTooltipTemplate: [{
926
+ type: ContentChild,
927
+ args: [ShapeTooltipTemplateDirective]
928
+ }], connectionTooltipTemplate: [{
929
+ type: ContentChild,
930
+ args: [ConnectionTooltipTemplateDirective]
855
931
  }] } });
@@ -6,6 +6,8 @@ import { NgModule } from '@angular/core';
6
6
  import { KENDO_DIAGRAM } from './directives';
7
7
  import * as i0 from "@angular/core";
8
8
  import * as i1 from "./diagram.component";
9
+ import * as i2 from "./shape-tooltip-template.directive";
10
+ import * as i3 from "./connection-tooltip-template.directive";
9
11
  /**
10
12
  * Represents the [NgModule](link:site.data.urls.angular['ngmoduleapi'])
11
13
  * definition for the Diagram component.
@@ -39,8 +41,8 @@ import * as i1 from "./diagram.component";
39
41
  */
40
42
  export class DiagramModule {
41
43
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
42
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: DiagramModule, imports: [i1.DiagramComponent], exports: [i1.DiagramComponent] });
43
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramModule, imports: [KENDO_DIAGRAM] });
44
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: DiagramModule, imports: [i1.DiagramComponent, i2.ShapeTooltipTemplateDirective, i3.ConnectionTooltipTemplateDirective], exports: [i1.DiagramComponent, i2.ShapeTooltipTemplateDirective, i3.ConnectionTooltipTemplateDirective] });
45
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramModule, imports: [i1.DiagramComponent] });
44
46
  }
45
47
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramModule, decorators: [{
46
48
  type: NgModule,
@@ -3,6 +3,8 @@
3
3
  * Licensed under commercial license. See LICENSE.md in the project root for more information
4
4
  *-------------------------------------------------------------------------------------------*/
5
5
  import { DiagramComponent } from "./diagram.component";
6
+ import { ConnectionTooltipTemplateDirective } from "./connection-tooltip-template.directive";
7
+ import { ShapeTooltipTemplateDirective } from "./shape-tooltip-template.directive";
6
8
  /**
7
9
  * Represents the utility array that that contains all `Diagram`-related components and directives.
8
10
  *
@@ -23,5 +25,7 @@ import { DiagramComponent } from "./diagram.component";
23
25
  * ```
24
26
  */
25
27
  export const KENDO_DIAGRAM = [
26
- DiagramComponent
28
+ DiagramComponent,
29
+ ShapeTooltipTemplateDirective,
30
+ ConnectionTooltipTemplateDirective
27
31
  ];
package/esm2022/index.mjs CHANGED
@@ -2,8 +2,10 @@
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, convertToDiagramModel } from '@progress/kendo-diagram-common';
5
+ export { Shape, Connection, Connector, 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
+ export { ShapeTooltipTemplateDirective } from './shape-tooltip-template.directive';
9
+ export { ConnectionTooltipTemplateDirective } from './connection-tooltip-template.directive';
8
10
  export * from './directives';
9
11
  export * from './models';
@@ -2,4 +2,6 @@
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
+ ;
6
+ ;
5
7
  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: 1762863300,
14
- version: '21.0.0-develop.27',
13
+ publishDate: 1762889121,
14
+ version: '21.0.0-develop.29',
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
  };