Skip to content

Commit 41830f8

Browse files
Merge branch 'main' of https://github.com/BasicPrimitives/angular into main
2 parents 1edf12e + 5d467cc commit 41830f8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+13976
-14732
lines changed

README.md

+117-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,122 @@ Data visualization diagramming components library for dependencies visualization
77
* [NPM](https://www.npmjs.com/package/ngx-basic-primitives) official - release packages.
88
* [Basic Primitives for Angular Live Demos](https://basicprimitives.github.io/angular/) - github live site
99

10+
## Angular example
11+
Add library from NPM repository:
12+
13+
```Shell
14+
ng add ngx-basic-primitives
15+
i Using package manager: npm
16+
√ Found compatible package version: [email protected].
17+
√ Package information loaded.
18+
19+
The package [email protected] will be installed and executed.
20+
Would you like to proceed? Yes
21+
√ Package successfully installed.
22+
The package that you are trying to add does not support schematics. You can try using a different version of the package or contact the package author to add ng-add support.
23+
```
24+
25+
Add `BasicPrimitivesModule` to the application's `src/app/app.module.ts`
26+
27+
```TypeScript
28+
import { NgModule } from '@angular/core';
29+
import { BrowserModule } from '@angular/platform-browser';
30+
31+
import { AppRoutingModule } from './app-routing.module';
32+
import { AppComponent } from './app.component';
33+
import { BasicPrimitivesModule } from 'ngx-basic-primitives';
34+
35+
@NgModule({
36+
declarations: [
37+
AppComponent
38+
],
39+
imports: [
40+
BrowserModule,
41+
AppRoutingModule,
42+
BasicPrimitivesModule
43+
],
44+
providers: [],
45+
bootstrap: [AppComponent]
46+
})
47+
export class AppModule { }
48+
```
49+
50+
Add `<org-diagram></org-diagram>` component to the application template and define `items` collection to render
51+
52+
```
53+
import { Component } from '@angular/core';
54+
import { OrgItemConfig, Enabled, PageFitMode } from 'ngx-basic-primitives';
55+
56+
@Component({
57+
selector: 'app-root',
58+
template: `
59+
<div style="text-align:center" class="content">
60+
<h1>
61+
Welcome to {{title}}!
62+
</h1>
63+
</div>
64+
<div class="sample">
65+
<org-diagram
66+
[items]="items"
67+
[pageFitMode]=PageFitMode.AutoSize
68+
[cursorItem]=0
69+
[hasSelectorCheckbox]=Enabled.True
70+
[centerOnCursor]=true>
71+
</org-diagram>
72+
</div>
73+
<router-outlet></router-outlet>
74+
`,
75+
styles: []
76+
})
77+
export class AppComponent {
78+
title = 'First Organizational Chart';
79+
80+
PageFitMode = PageFitMode;
81+
Enabled = Enabled;
82+
83+
photos = {
84+
a: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAA8CAIAAACrV36WAAAAAXNSR0IArs4c6QAAAARn' +
85+
'QU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAGnSURBVGhD7dnBbQJBDAVQk1o2QjlQwKYGzpSwKQfq4IxIC' +
86+
'RTB9jLZHCJFwWv7/7EiDt6zmX2yPYMHNq01eb7n5flI36JiIXWpbFW2kAwgsdVblS0kA0hs9db/ZWs+vW/Wno9PxPE3dh' +
87+
'ls6Od+HI1XT1d64Sb8R5utEulwdbA8VY+LZ/kqkfF456pBHxDz5Xxze/p2vsxukBbAshTVOE0PO4B2cUlWKrgUTKsrV0e' +
88+
'ut3RVU/cm5aKKqPXVbjuIDPtDUh2JImq1+jmjkupIFNFStXadHncWXkecpb3393me4oJZnionXyjLV6W4QFZEleHCWNG+' +
89+
'0eKggQJiRVV6vhAXwoqrul0AC1H1uuIsTLUyukYH1jBL7WJ8lgq6oqwkVXSQDrLSVEFXjJWoirlCrFRVyBVhJasirgCr6' +
90+
'5tEv7a5A5jL0tcN7vNl9OVcHqtXRbocVr+Kc9k3H/3qPL69Ise7dh0SsS+2JmtFddgvdy/gGbY7Jdp2GRcyrlu1BfUjxt' +
91+
'iPRm/lqVbGHOMHnU39zQm0I/UbBLA+GVosJHGVrcoWkgEktnoLydYXkF/LiXG21MwAAAAASUVORK5CYII='
92+
};
93+
94+
items = [
95+
new OrgItemConfig({
96+
id: 0,
97+
parent: null,
98+
title: 'James Smith',
99+
description: 'VP, Public Sector',
100+
image: this.photos.a
101+
}),
102+
new OrgItemConfig({
103+
id: 1,
104+
parent: 0,
105+
title: 'Ted Lucas',
106+
description: 'VP, Human Resources',
107+
image: this.photos.a
108+
}),
109+
new OrgItemConfig({
110+
id: 2,
111+
parent: 0,
112+
title: 'Fritz Stuger',
113+
description: 'Business Solutions, US',
114+
image: this.photos.a
115+
})
116+
];
117+
}
118+
```
119+
120+
Start application
121+
122+
```Shell
123+
ng serve
124+
```
125+
10126
## Products
11127
### Basic Primitives Diagrams for JavaScript
12128
* 100% client-side JavaScript layout and rendering.
@@ -83,6 +199,6 @@ Do you want to use a Basic Primitives diagram for a personal website, a school s
83199
## Performance
84200
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!
85201

86-
Copyright (c) 2013 - 2022 Basic Primitives Inc
202+
Copyright (c) 2013 - 2023 Basic Primitives Inc
87203
* [Non-commercial - Free](http://creativecommons.org/licenses/by-nc/3.0/)
88204
* [Commercial and government licenses](license.pdf)

angular.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,5 @@
134134
}
135135
}
136136
}
137-
},
138-
"defaultProject": "ngx-basic-primitives"
137+
}
139138
}

0 commit comments

Comments
 (0)