@progress/kendo-angular-diagrams 21.0.0-develop.26 → 21.0.0-develop.28

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,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 shape tooltips within the `kendo-diagram` component.
9
+ * Use this directive to customize how tooltips appear when hovering over shapes.
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 kendoDiagramShapeTooltipTemplate let-dataItem>
20
+ * {{dataItem.tooltipContent}}
21
+ * </ng-template>
22
+ * </kendo-diagram>
23
+ * `
24
+ * })
25
+ * class AppComponent {
26
+ * }
27
+ *
28
+ * ```
29
+ */
30
+ export class ShapeTooltipTemplateDirective {
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: ShapeTooltipTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
39
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: ShapeTooltipTemplateDirective, isStandalone: true, selector: "[kendoDiagramShapeTooltipTemplate]", ngImport: i0 });
40
+ }
41
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ShapeTooltipTemplateDirective, decorators: [{
42
+ type: Directive,
43
+ args: [{
44
+ selector: '[kendoDiagramShapeTooltipTemplate]',
45
+ standalone: true,
46
+ }]
47
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
@@ -2,15 +2,15 @@
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 { 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';
5
+ import { Shape, Connection, placeTooltip, events, convertToDiagramModel, loadTheme, Diagram } from '@progress/kendo-diagram-common';
6
+ export { ArrowMarker, Circle, CircleMarker, Collate, Connection, Connector, DataInputOutput, DataStorage, Database, Decision, Delay, 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, ViewChild, NgModule } from '@angular/core';
8
+ import { Directive, EventEmitter, Component, HostBinding, Input, Output, ViewChild, ContentChild, 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
11
  import * as i1 from '@progress/kendo-angular-popup';
12
12
  import { PopupService } from '@progress/kendo-angular-popup';
13
- import { NgIf } from '@angular/common';
13
+ import { NgIf, NgTemplateOutlet } from '@angular/common';
14
14
 
15
15
  /**
16
16
  * @hidden
@@ -20,8 +20,8 @@ const packageMetadata = {
20
20
  productName: 'Kendo UI for Angular',
21
21
  productCode: 'KENDOUIANGULAR',
22
22
  productCodes: ['KENDOUIANGULAR'],
23
- publishDate: 1762796695,
24
- version: '21.0.0-develop.26',
23
+ publishDate: 1762875162,
24
+ version: '21.0.0-develop.28',
25
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',
26
26
  };
27
27
 
@@ -51,6 +51,90 @@ const SHAPE_DEFAULTS = {
51
51
  selectable: true,
52
52
  };
53
53
 
54
+ /**
55
+ * Defines a custom template for shape tooltips within the `kendo-diagram` component.
56
+ * Use this directive to customize how tooltips appear when hovering over shapes.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * import { Component } from '@angular/core';
61
+ *
62
+ * _@Component({
63
+ * selector: 'my-app',
64
+ * template: `
65
+ * <kendo-diagram>
66
+ * <ng-template kendoDiagramShapeTooltipTemplate let-dataItem>
67
+ * {{dataItem.tooltipContent}}
68
+ * </ng-template>
69
+ * </kendo-diagram>
70
+ * `
71
+ * })
72
+ * class AppComponent {
73
+ * }
74
+ *
75
+ * ```
76
+ */
77
+ class ShapeTooltipTemplateDirective {
78
+ /**
79
+ * @hidden
80
+ */
81
+ templateRef;
82
+ constructor(templateRef) {
83
+ this.templateRef = templateRef;
84
+ }
85
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ShapeTooltipTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
86
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: ShapeTooltipTemplateDirective, isStandalone: true, selector: "[kendoDiagramShapeTooltipTemplate]", ngImport: i0 });
87
+ }
88
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ShapeTooltipTemplateDirective, decorators: [{
89
+ type: Directive,
90
+ args: [{
91
+ selector: '[kendoDiagramShapeTooltipTemplate]',
92
+ standalone: true,
93
+ }]
94
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
95
+
96
+ /**
97
+ * Defines a custom template for connection tooltips within the `kendo-diagram` component.
98
+ * Use this directive to customize how tooltips appear when hovering over connections.
99
+ *
100
+ * @example
101
+ * ```ts
102
+ * import { Component } from '@angular/core';
103
+ *
104
+ * _@Component({
105
+ * selector: 'my-app',
106
+ * template: `
107
+ * <kendo-diagram>
108
+ * <ng-template kendoDiagramConnectionTooltipTemplate let-dataItem>
109
+ * {{dataItem.tooltipContent}}
110
+ * </ng-template>
111
+ * </kendo-diagram>
112
+ * `
113
+ * })
114
+ * class AppComponent {
115
+ * }
116
+ *
117
+ * ```
118
+ */
119
+ class ConnectionTooltipTemplateDirective {
120
+ /**
121
+ * @hidden
122
+ */
123
+ templateRef;
124
+ constructor(templateRef) {
125
+ this.templateRef = templateRef;
126
+ }
127
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ConnectionTooltipTemplateDirective, deps: [{ token: i0.TemplateRef }], target: i0.ɵɵFactoryTarget.Directive });
128
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: ConnectionTooltipTemplateDirective, isStandalone: true, selector: "[kendoDiagramConnectionTooltipTemplate]", ngImport: i0 });
129
+ }
130
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ConnectionTooltipTemplateDirective, decorators: [{
131
+ type: Directive,
132
+ args: [{
133
+ selector: '[kendoDiagramConnectionTooltipTemplate]',
134
+ standalone: true,
135
+ }]
136
+ }], ctorParameters: () => [{ type: i0.TemplateRef }] });
137
+
54
138
  /**
55
139
  * Represents the [Kendo UI Diagram component for Angular](slug:overview_diagram).
56
140
  *
@@ -82,12 +166,6 @@ class DiagramComponent {
82
166
  *
83
167
  */
84
168
  connections = [];
85
- /**
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
169
  /**
92
170
  * Defines the field mapping configuration for connections data binding ([see example](slug:diagram_data_binding#field-mapping)).
93
171
  * Maps source object properties to `Diagram` connection properties.
@@ -255,6 +333,10 @@ class DiagramComponent {
255
333
  * @hidden
256
334
  */
257
335
  licenseMessage;
336
+ /**
337
+ * @hidden
338
+ */
339
+ customTemplate;
258
340
  options = {
259
341
  shapes: this.shapes,
260
342
  connections: this.connections,
@@ -279,15 +361,15 @@ class DiagramComponent {
279
361
  * Current popup instance for tooltip.
280
362
  */
281
363
  tooltipPopup;
282
- /**
283
- * Template reference for tooltip content.
284
- */
285
- tooltipTemplate;
364
+ defaultTooltipTemplate;
365
+ customTooltipTemplate;
366
+ shapeTooltipTemplate;
367
+ connectionTooltipTemplate;
286
368
  /**
287
369
  * @hidden
288
- * Current tooltip content for template context.
370
+ * The original data item provided by the user. Passed in the tooltip template context.
289
371
  */
290
- tooltipContent = '';
372
+ dataItem;
291
373
  constructor(wrapperElement, renderer, zone, popupService, viewContainer) {
292
374
  this.wrapperElement = wrapperElement;
293
375
  this.renderer = renderer;
@@ -360,6 +442,7 @@ class DiagramComponent {
360
442
  }
361
443
  if (recreate) {
362
444
  this.init();
445
+ this.bindDiagramEvents();
363
446
  }
364
447
  }
365
448
  ngAfterViewInit() {
@@ -652,40 +735,87 @@ class DiagramComponent {
652
735
  */
653
736
  handleTooltipShow(event) {
654
737
  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);
738
+ const dataItem = event.item.dataItem;
739
+ const isShape = event.item instanceof Shape;
740
+ const isConnection = event.item instanceof Connection;
741
+ this.setCustomTemplate(isShape, isConnection);
742
+ const defaultsEnabled = isShape
743
+ ? this.options.shapeDefaults.tooltip?.visible
744
+ : this.options.connectionDefaults.tooltip?.visible;
745
+ const itemTooltipEnabled = dataItem.tooltip?.visible;
746
+ const optionsArray = isShape ? this.options.shapes : this.options.connections;
747
+ const optionsItem = optionsArray?.find((item) => item.id === event.item.id);
748
+ const hasTooltipText = !!dataItem.tooltipText || !!optionsItem?.tooltipText;
749
+ if (!dataItem.tooltipText && optionsItem?.tooltipText) {
750
+ dataItem.tooltipText = optionsItem.tooltipText;
751
+ }
752
+ const shouldShowTooltip = itemTooltipEnabled !== false && hasTooltipText && (defaultsEnabled || itemTooltipEnabled);
753
+ if (shouldShowTooltip) {
754
+ this.dataItem = dataItem;
755
+ let popupContent = this.defaultTooltipTemplate;
756
+ const showCustomTemplate = Boolean((isShape && this.shapeTooltipTemplate) || (isConnection && this.connectionTooltipTemplate));
757
+ if (showCustomTemplate) {
758
+ popupContent = this.customTooltipTemplate;
759
+ }
760
+ const popupClass = this.popupClass(isShape, dataItem);
761
+ this.showTooltip(event, popupContent, popupClass);
762
+ }
763
+ }
764
+ showTooltip(event, content, popupClass) {
765
+ this.tooltipPopup = this.popupService.open({
766
+ content: content,
767
+ appendTo: this.viewContainer,
768
+ popupClass,
769
+ animate: false
770
+ });
771
+ const contentElement = this.tooltipPopup.popupElement.querySelector('.k-popup');
772
+ if (content === this.defaultTooltipTemplate) {
773
+ this.renderer.addClass(contentElement, 'k-tooltip');
774
+ }
775
+ const popupElementRect = contentElement.getBoundingClientRect();
776
+ const zoom = event.item.diagram.zoom();
777
+ const pan = event.item.diagram.pan();
778
+ const diagramRect = this.diagramWidget.element.getBoundingClientRect();
779
+ const win = this.diagramWidget.element.ownerDocument.defaultView;
780
+ const lines = this.diagramWidget.connections.map(con => con.allPoints());
781
+ const shapes = this.diagramWidget.shapes.map(shp => shp.bounds());
782
+ const pos = placeTooltip({
783
+ hovered: event.item,
784
+ mouse: event.point,
785
+ shapes: shapes,
786
+ connections: lines,
787
+ diagramRect: diagramRect,
788
+ zoom: zoom,
789
+ pan: pan,
790
+ tooltipSize: { width: popupElementRect.width, height: popupElementRect.height },
791
+ viewportBounds: new DOMRect(0, 0, win.innerWidth, win.innerHeight)
792
+ });
793
+ this.tooltipPopup.popup.instance.offset = { left: pos.left + win.scrollX, top: pos.top + win.scrollY };
794
+ this.tooltipShow.emit({ ...this.dataItem });
795
+ }
796
+ popupClass(isShape, dataItem) {
797
+ const defaultCssClass = isShape
798
+ ? this.options.shapeDefaults?.tooltip?.cssClass
799
+ : this.options.connectionDefaults?.tooltip?.cssClass;
800
+ const itemCssClass = dataItem.tooltip?.cssClass;
801
+ const popupClass = defaultCssClass || itemCssClass;
802
+ return popupClass;
803
+ }
804
+ setCustomTemplate(isShape, isConnection) {
805
+ this.customTemplate = null;
806
+ if (isShape && this.shapeTooltipTemplate) {
807
+ this.customTemplate = this.shapeTooltipTemplate.templateRef;
808
+ }
809
+ if (isConnection && this.connectionTooltipTemplate) {
810
+ this.customTemplate = this.connectionTooltipTemplate.templateRef;
681
811
  }
682
812
  }
683
813
  /**
684
814
  * Handles the tooltipHide event from the diagram widget.
685
815
  */
686
- handleTooltipHide(event) {
816
+ handleTooltipHide() {
687
817
  this.hideTooltip();
688
- this.tooltipHide.emit(event);
818
+ this.tooltipHide.emit({ ...this.dataItem });
689
819
  }
690
820
  /**
691
821
  * Hides the current tooltip and cleans up resources.
@@ -695,7 +825,6 @@ class DiagramComponent {
695
825
  this.tooltipPopup.close();
696
826
  this.tooltipPopup = undefined;
697
827
  }
698
- this.tooltipContent = '';
699
828
  }
700
829
  activeEmitter(name) {
701
830
  const emitter = this[name];
@@ -721,15 +850,15 @@ class DiagramComponent {
721
850
  if (eventName === 'itemBoundsChange') {
722
851
  eventName = 'shapeBoundsChange';
723
852
  }
724
- if (this.tooltip && eventName === 'tooltipShow') {
853
+ if (eventName === 'tooltipShow') {
725
854
  this.zone.run(() => {
726
855
  this.handleTooltipShow(e);
727
856
  });
728
857
  return;
729
858
  }
730
- if (this.tooltip && eventName === 'tooltipHide') {
859
+ if (eventName === 'tooltipHide') {
731
860
  this.zone.run(() => {
732
- this.handleTooltipHide(e);
861
+ this.handleTooltipHide();
733
862
  });
734
863
  return;
735
864
  }
@@ -757,15 +886,27 @@ class DiagramComponent {
757
886
  map: this.createFieldMapping(this.connectionModelFields)
758
887
  }
759
888
  };
760
- const result = convertToDiagramModel({ shapes: this.shapes, connections: this.connections }, mapping);
761
- this.convertedShapes = result.shapes;
762
- this.convertedConnections = result.connections;
889
+ const result = convertToDiagramModel({ shapes: this.shapes, connections: this.options.connections }, mapping);
890
+ this.convertedShapes = this.addDataItemProperty(result.shapes, this.shapes);
891
+ this.convertedConnections = this.addDataItemProperty(result.connections, this.connections);
763
892
  }
764
893
  else {
765
- this.convertedShapes = this.shapes || [];
766
- this.convertedConnections = this.connections || [];
894
+ this.convertedShapes = this.addDataItemProperty(this.shapes, this.shapes);
895
+ this.convertedConnections = this.addDataItemProperty(this.connections, this.connections);
767
896
  }
768
897
  }
898
+ addDataItemProperty(array, sourceArray) {
899
+ if (!array || !Array.isArray(array) || array.length === 0) {
900
+ return [];
901
+ }
902
+ if (!sourceArray || !Array.isArray(sourceArray)) {
903
+ return array;
904
+ }
905
+ return array.map((item, index) => ({
906
+ ...item,
907
+ dataItem: sourceArray[index]
908
+ }));
909
+ }
769
910
  /**
770
911
  * Creates field mapping configuration from model fields.
771
912
  */
@@ -802,12 +943,17 @@ class DiagramComponent {
802
943
  this.diagramWidget?.setOptions(this.options);
803
944
  }
804
945
  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: `
946
+ 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: `
806
947
  <div kendoWatermarkOverlay *ngIf="showLicenseWatermark" [licenseMessage]="licenseMessage"></div>
807
- <ng-template *ngIf="tooltip" #tooltipTemplate let-content="content">
808
- <div class="k-tooltip">{{tooltipContent}}</div>
948
+
949
+ <ng-template #customTooltipTemplate>
950
+ <ng-container [ngTemplateOutlet]="customTemplate" [ngTemplateOutletContext]="{ $implicit: dataItem }"></ng-container>
809
951
  </ng-template>
810
- `, isInline: true, dependencies: [{ kind: "component", type: WatermarkOverlayComponent, selector: "div[kendoWatermarkOverlay]", inputs: ["licenseMessage"] }, { kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
952
+
953
+ <ng-template #defaultTemplate>
954
+ {{dataItem?.tooltipText}}
955
+ </ng-template>
956
+ `, 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"] }] });
811
957
  }
812
958
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramComponent, decorators: [{
813
959
  type: Component,
@@ -817,11 +963,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
817
963
  selector: 'kendo-diagram',
818
964
  template: `
819
965
  <div kendoWatermarkOverlay *ngIf="showLicenseWatermark" [licenseMessage]="licenseMessage"></div>
820
- <ng-template *ngIf="tooltip" #tooltipTemplate let-content="content">
821
- <div class="k-tooltip">{{tooltipContent}}</div>
966
+
967
+ <ng-template #customTooltipTemplate>
968
+ <ng-container [ngTemplateOutlet]="customTemplate" [ngTemplateOutletContext]="{ $implicit: dataItem }"></ng-container>
969
+ </ng-template>
970
+
971
+ <ng-template #defaultTemplate>
972
+ {{dataItem?.tooltipText}}
822
973
  </ng-template>
823
974
  `,
824
- imports: [WatermarkOverlayComponent, NgIf],
975
+ imports: [WatermarkOverlayComponent, NgIf, NgTemplateOutlet, ShapeTooltipTemplateDirective, ConnectionTooltipTemplateDirective],
825
976
  providers: [PopupService]
826
977
  }]
827
978
  }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i0.Renderer2 }, { type: i0.NgZone }, { type: i1.PopupService }, { type: i0.ViewContainerRef }], propDecorators: { diagramClass: [{
@@ -831,8 +982,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
831
982
  type: Input
832
983
  }], connections: [{
833
984
  type: Input
834
- }], tooltip: [{
835
- type: Input
836
985
  }], connectionModelFields: [{
837
986
  type: Input
838
987
  }], editable: [{
@@ -887,9 +1036,18 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
887
1036
  type: Output
888
1037
  }], tooltipHide: [{
889
1038
  type: Output
890
- }], tooltipTemplate: [{
1039
+ }], defaultTooltipTemplate: [{
891
1040
  type: ViewChild,
892
- args: ['tooltipTemplate']
1041
+ args: ['defaultTemplate']
1042
+ }], customTooltipTemplate: [{
1043
+ type: ViewChild,
1044
+ args: ['customTooltipTemplate']
1045
+ }], shapeTooltipTemplate: [{
1046
+ type: ContentChild,
1047
+ args: [ShapeTooltipTemplateDirective]
1048
+ }], connectionTooltipTemplate: [{
1049
+ type: ContentChild,
1050
+ args: [ConnectionTooltipTemplateDirective]
893
1051
  }] } });
894
1052
 
895
1053
  /**
@@ -912,7 +1070,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
912
1070
  * ```
913
1071
  */
914
1072
  const KENDO_DIAGRAM = [
915
- DiagramComponent
1073
+ DiagramComponent,
1074
+ ShapeTooltipTemplateDirective,
1075
+ ConnectionTooltipTemplateDirective
916
1076
  ];
917
1077
 
918
1078
  /**
@@ -948,8 +1108,8 @@ const KENDO_DIAGRAM = [
948
1108
  */
949
1109
  class DiagramModule {
950
1110
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
951
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: DiagramModule, imports: [DiagramComponent], exports: [DiagramComponent] });
952
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramModule, imports: [KENDO_DIAGRAM] });
1111
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: DiagramModule, imports: [DiagramComponent, ShapeTooltipTemplateDirective, ConnectionTooltipTemplateDirective], exports: [DiagramComponent, ShapeTooltipTemplateDirective, ConnectionTooltipTemplateDirective] });
1112
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramModule, imports: [DiagramComponent] });
953
1113
  }
954
1114
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: DiagramModule, decorators: [{
955
1115
  type: NgModule,
@@ -959,9 +1119,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
959
1119
  }]
960
1120
  }] });
961
1121
 
1122
+ ;
1123
+ ;
1124
+
962
1125
  /**
963
1126
  * Generated bundle index. Do not edit.
964
1127
  */
965
1128
 
966
- export { DiagramComponent, DiagramModule, KENDO_DIAGRAM };
1129
+ export { ConnectionTooltipTemplateDirective, DiagramComponent, DiagramModule, KENDO_DIAGRAM, ShapeTooltipTemplateDirective };
967
1130
 
package/index.d.ts 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 { 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';
5
+ export { ShapeConnector, ShapeContent, EditableDefaults, ShapeDefaultsEditable, ShapeEditable, ShapeFillGradientStop, ShapeFillGradient, ShapeFill, ShapeHover, ShapeRotation, Fill, Stroke, DashType, ShapeType, ShapeConnectorHover, ShapeConnectorDefaults, Selectable, Pannable, LayoutGrid, DiagramLayout, DiagramEditable, Coordinate, DiagramDragEvent, DiagramDomEvent, DiagramZoomStartEvent, DiagramZoomEndEvent, DiagramPanEvent, DiagramSelectEvent, DiagramChangeEvent, DiagramItemBoundsChangeEvent, Shape, Connection, Connector, 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
+ 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';
package/models.d.ts CHANGED
@@ -2,6 +2,81 @@
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 { ShapeDefaults as ShapeDefaultsCommon } from '@progress/kendo-diagram-common';
6
+ import { ConnectionDefaults as ConnectionDefaultsCommon } from '@progress/kendo-diagram-common';
7
+ import { ConnectionOptions as ConnectionOptionsCommon } from '@progress/kendo-diagram-common';
8
+ import { ShapeOptions as ShapeOptionsCommon } from '@progress/kendo-diagram-common';
9
+ import { DiagramOptions as DiagramOptionsCommon } from '@progress/kendo-diagram-common';
10
+ /**
11
+ * Defines the tooltip configuration for shapes and connections.
12
+ * Controls the visibility, content, and styling of tooltips.
13
+ */
14
+ export interface TooltipOptions {
15
+ /**
16
+ * Controls whether the tooltip displays when you hover over the item.
17
+ */
18
+ visible?: boolean;
19
+ /**
20
+ * Sets custom CSS classes for the Tooltip wrapper element. Accepts any value supported by [`ngClass`](link:site.data.urls.angular['ngclassapi']).
21
+ */
22
+ cssClass?: any;
23
+ }
24
+ /**
25
+ * Defines the configuration options for diagram shapes.
26
+ * Extends the base shape options and adds tooltip support.
27
+ */
28
+ export interface ShapeOptions extends ShapeOptionsCommon {
29
+ /**
30
+ * Configures the tooltip that displays when you hover over the shape.
31
+ */
32
+ tooltip?: TooltipOptions;
33
+ /**
34
+ * Sets the text content displayed in the tooltip.
35
+ */
36
+ tooltipText?: string;
37
+ }
38
+ /**
39
+ * Defines the configuration options for diagram connections.
40
+ * Extends the base connection options and adds tooltip support.
41
+ */
42
+ export interface ConnectionOptions extends ConnectionOptionsCommon {
43
+ /**
44
+ * Configures the tooltip that displays when you hover over the connection.
45
+ */
46
+ tooltip?: TooltipOptions;
47
+ /**
48
+ * Sets the text content displayed in the tooltip.
49
+ */
50
+ tooltipText?: string;
51
+ }
52
+ /**
53
+ * Defines the default configuration options for all connections in the `Diagram`.
54
+ * These settings apply to connections unless overridden by individual connection options.
55
+ */
56
+ export interface ConnectionDefaults extends ConnectionDefaultsCommon {
57
+ /**
58
+ * Configures the default tooltip settings for all connections.
59
+ */
60
+ tooltip?: TooltipOptions;
61
+ }
62
+ /**
63
+ * Defines the default configuration options for all shapes in the `Diagram`.
64
+ * These settings apply to shapes unless overridden by individual shape options.
65
+ */
66
+ export interface ShapeDefaults extends ShapeDefaultsCommon {
67
+ /**
68
+ * Configures the default tooltip settings for all shapes.
69
+ */
70
+ tooltip?: TooltipOptions;
71
+ }
72
+ /**
73
+ * @hidden
74
+ *
75
+ */
76
+ export interface DiagramOptions extends DiagramOptionsCommon {
77
+ shapeDefaults?: ShapeDefaults;
78
+ connectionDefaults?: ConnectionDefaults;
79
+ }
5
80
  /**
6
81
  * Defines the field mapping configuration for shapes data binding.
7
82
  * Maps source object properties to `Diagram` shape properties.
@@ -103,6 +178,10 @@ export interface ShapeModelFields {
103
178
  * The field that contains the data item reference.
104
179
  */
105
180
  dataItem?: string;
181
+ /**
182
+ * The field that contains the tooltip text.
183
+ */
184
+ tooltipText?: string;
106
185
  }
107
186
  /**
108
187
  * Defines the field mapping configuration for connections data binding.
@@ -125,4 +204,8 @@ export interface ConnectionModelFields {
125
204
  * The field that contains the data item reference.
126
205
  */
127
206
  dataItem?: string;
207
+ /**
208
+ * The field that contains the tooltip text.
209
+ */
210
+ tooltipText?: string;
128
211
  }