Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,6 @@ Do you want to use a Basic Primitives diagram for a personal website, a school s
## Performance
Through a full API, you can add, remove and modify individual items and their properties. The component will only update the visual elements affected by the API changes. We put in much effort to make it happen!

Copyright (c) 2013 - 2024 Basic Primitives Inc
Copyright (c) 2013 - 2025 Basic Primitives Inc
* [Non-commercial - Free](http://creativecommons.org/licenses/by-nc/3.0/)
* [Commercial and government licenses](license.pdf)
15 changes: 8 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@angular/platform-browser": "~18.2.4",
"@angular/platform-browser-dynamic": "~18.2.4",
"@angular/router": "~18.2.4",
"basicprimitives": "^6.5.1",
"basicprimitives": "6.6.1",
"rxjs": "~7.4.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.10"
Expand Down
2 changes: 1 addition & 1 deletion projects/ngx-basic-primitives/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ Do you want to use a Basic Primitives diagram for a personal website, a school s
## Performance
Through a full API, you can add, remove and modify individual items and their properties. The component will only update the visual elements affected by the API changes. We put in much effort to make it happen!

Copyright (c) 2013 - 2024 Basic Primitives Inc
Copyright (c) 2013 - 2025 Basic Primitives Inc
* [Non-commercial - Free](http://creativecommons.org/licenses/by-nc/3.0/)
* [Commercial and government licenses](license.pdf)
4 changes: 2 additions & 2 deletions projects/ngx-basic-primitives/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "ngx-basic-primitives",
"version": "6.5.3",
"version": "6.6.1",
"peerDependencies": {
"@angular/common": "~18.2.4",
"@angular/core": "~18.2.4",
"basicprimitives": "^6.5.1"
"basicprimitives": "6.6.1"
},
"dependencies": {
"tslib": "^2.3.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ConnectorLabelPlacementType, ConnectorPlacementType,
ConnectorShapeType, ZOrderType, AnnotationType, LineType } from '../enums';
ConnectorShapeType, ZOrderType, AnnotationType, LineType,
Enabled} from '../enums';
import { Size, Thickness } from '../structs';


Expand All @@ -18,6 +19,9 @@ export class ConnectorAnnotationConfig {
selectItems: Boolean = true;
label:string | null = null;
size: Size = new Size(60, 30);
showFromEndpoint: Enabled = Enabled.Auto;
showToEndpoint: Enabled = Enabled.Auto;
context: any = null

constructor(config: Partial<ConnectorAnnotationConfig> = {}) {
Object.assign(this, config);
Expand Down
6 changes: 6 additions & 0 deletions projects/ngx-basic-primitives/src/lib/configs/fam-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ export class FamConfig {
levelTitleFontStyle: string = "normal";
levelTitleTemplate: TemplateRef<any> | null = null;
levelBackgroundTemplate: TemplateRef<any> | null = null;
endPointTemplate: TemplateRef<any> | null = null;
showEndPoints: Enabled = Enabled.False;
endPointSize: Size = new Size(8, 8);
endPointCornerRadius: number = 4;
endPointFillColor: string = "#000080";
endPointOpacity: number = 0.5;
distance: number = 3;
scale: number = 1;
minimumScale: number = 0.5;
Expand Down
6 changes: 6 additions & 0 deletions projects/ngx-basic-primitives/src/lib/configs/org-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ export class OrgConfig {
levelTitleFontStyle: string = "normal";
levelTitleTemplate: TemplateRef<any> | null = null;
levelBackgroundTemplate: TemplateRef<any> | null = null;
endPointTemplate: TemplateRef<any> | null = null;
showEndPoints: Enabled = Enabled.False;
endPointSize: Size = new Size(8, 8);
endPointCornerRadius: number = 4;
endPointFillColor: string = "#000080";
endPointOpacity: number = 0.5;
distance: number = 3;
scale: number = 1;
minimumScale: number = 0.5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@
<ng-container *ngSwitchCase="'groupTitleTemplate'">
<bp-group-title [options]="item.context" [itemConfig]="item.context.context" [width]="item.context.width" [height]="item.context.height"></bp-group-title>
</ng-container>
<ng-container *ngSwitchCase="'endPointTemplate'">
<bp-end-point [options]="item.context" [annotationConfig]="item.context.context" [isFromEndPoint]="item.context.context.isFromEndPoint"></bp-end-point>
</ng-container>
<ng-container *ngSwitchCase="'cursorTemplate'">
<bp-cursor [templateConfig]="item.context.templateConfig"></bp-cursor>
</ng-container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import {
CustomRenderTemplate,
LabelAnnotationTemplate,
LevelTitleTemplate,
LevelBackgroundTemplate
LevelBackgroundTemplate,
EndPointTemplate
} from './templates';
import { TemplateConfig } from '../configs/template-config';

Expand Down Expand Up @@ -110,7 +111,8 @@ export class BaseDiagramComponent implements OnInit, AfterViewInit, OnDestroy {
CustomRenderTemplate,
LabelAnnotationTemplate,
LevelTitleTemplate,
LevelBackgroundTemplate
LevelBackgroundTemplate,
EndPointTemplate
}
this.tasks = taskManagerFactory.factory(this.getOptions.bind(this), this.getGraphics.bind(this), this.getLayout.bind(this), this.setLayout.bind(this), templates);

Expand Down Expand Up @@ -166,7 +168,8 @@ export class BaseDiagramComponent implements OnInit, AfterViewInit, OnDestroy {
onGroupTitleRender: !config.groupTitleTemplate ? null : () => config.groupTitleTemplate,
onLevelBackgroundRender: !config.levelBackgroundTemplate ? null : () => config.levelBackgroundTemplate,
onLevelTitleRender: !config.levelTitleTemplate ? null : () => config.levelTitleTemplate,
onButtonsRender: !config.buttonsTemplate ? null : () => config.buttonsTemplate
onButtonsRender: !config.buttonsTemplate ? null : () => config.buttonsTemplate,
onEndPointRender: !config.endPointTemplate ? null : () => config.endPointTemplate,
};
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.end-point {
position: absolute;
font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-user-select: none;
-webkit-touch-callout: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
box-sizing: content-box;

width: 100%;
height: 100%;
left: 0px;
top: 0px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { Component, Input, OnChanges, SimpleChanges } from "@angular/core";
import { Enabled } from "../../enums";
import { Size } from "../../structs";
import { ConnectorAnnotationConfig } from "../../configs/connector-annotation-config";

class EndPointOptions {
showEndPoints: Enabled = Enabled.False;
endPointSize: Size = new Size(8, 8);
endPointCornerRadius: number = 4;
endPointFillColor: string = "#000080";
endPointOpacity: number = 0.5;

constructor(config: Partial<EndPointOptions> = {}) {
Object.assign(this, config);
}
}

@Component({
selector: 'bp-end-point:not(a)',
template: '<div class="end-point" [ngStyle]="divStyle"></div>',
styleUrls: ['./end-point.component.css']
})
export class EndPointComponent implements OnChanges {
@Input()
options: EndPointOptions = new EndPointOptions();

@Input()
annotationConfig: ConnectorAnnotationConfig = new ConnectorAnnotationConfig();

@Input()
isFromEndPoint: boolean = true;

ngOnChanges(changes: SimpleChanges): void {
const { endPointCornerRadius, endPointFillColor, endPointOpacity } = this.options;
this.divStyle = {
"-moz-border-radius": endPointCornerRadius + "px",
"-webkit-border-radius": endPointCornerRadius + "px",
"-khtml-border-radius": endPointCornerRadius + "px",
"border-radius": endPointCornerRadius + "px",
"background": endPointFillColor,
"opacity": endPointOpacity,
"border": "0px"
}
}

divStyle: Object = {};
};
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ export class FamDiagramComponent extends BaseDiagramComponent implements FamConf
@Input() levelTitleFontStyle: string = "normal";
@Input() levelTitleTemplate: TemplateRef<any> | null = null;
@Input() levelBackgroundTemplate: TemplateRef<any> | null = null;
@Input() endPointTemplate: TemplateRef<any> | null = null;
@Input() showEndPoints: Enabled = Enabled.False;
@Input() endPointSize: Size = new Size(8, 8);
@Input() endPointCornerRadius: number = 4;
@Input() endPointFillColor: string = "#000080";
@Input() endPointOpacity: number = 0.5;
@Input() distance: number = 3;
@Input() scale: number = 1;
@Input() minimumScale: number = 0.5;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ export class OrgDiagramComponent extends BaseDiagramComponent implements OrgConf
@Input() levelTitleFontStyle: string = "normal";
@Input() levelTitleTemplate: TemplateRef<any> | null = null;
@Input() levelBackgroundTemplate: TemplateRef<any> | null = null;
@Input() endPointTemplate: TemplateRef<any> | null = null;
@Input() showEndPoints: Enabled = Enabled.False;
@Input() endPointSize: Size = new Size(8, 8);
@Input() endPointCornerRadius: number = 4;
@Input() endPointFillColor: string = "#000080";
@Input() endPointOpacity: number = 0.5;
@Input() distance: number = 3;
@Input() scale: number = 1;
@Input() minimumScale: number = 0.5;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { TemplateConfig } from '../../configs/template-config';
import AbstractTemplate from './AbstractTemplate';

export class EndPointTemplate extends AbstractTemplate {
constructor(options: any, templateConfig: TemplateConfig) {
super("endPointTemplate", {
...options,
templateConfig
});
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from "./CustomRenderTemplate";
export * from "./DotHighlightTemplate";
export * from "./GroupTitleTemplate";
export * from "./HighlightTemplate";
export * from "./EndPointTemplate";
export * from "./ItemTemplate";
export * from "./LabelAnnotationTemplate";
export * from "./LevelBackgroundTemplate";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { GroupTitleComponent } from './diagrams/components/group-title.component
import { DotHighlightComponent } from './diagrams/components/dot-highlight.component';
import { LevelBackgroundComponent } from './diagrams/components/level-background.component';
import { LevelTitleComponent } from './diagrams/components/level-title.component';
import { EndPointComponent } from './diagrams/components/end-point.component';



Expand All @@ -28,6 +29,7 @@ import { LevelTitleComponent } from './diagrams/components/level-title.component
DotHighlightComponent,
CheckboxComponent,
GroupTitleComponent,
EndPointComponent,
LevelBackgroundComponent,
LevelTitleComponent
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ <h1>On-screen Connector Annotation</h1>
<div class="sample">
<org-diagram
[items]="items"
[showEndPoints]=Enabled.Auto
[annotations]="annotations"
[pageFitMode]=PageFitMode.None
[cursorItem]=0
Expand Down