@eo4geo/ngx-bok-visualization 1.3.13 → 1.3.15
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/README.md +179 -179
- package/fesm2022/eo4geo-ngx-bok-visualization.mjs +85 -15
- package/fesm2022/eo4geo-ngx-bok-visualization.mjs.map +1 -1
- package/lib/model/DeprecatedConcept.d.ts +13 -0
- package/lib/services/bok-firebase.service.d.ts +4 -0
- package/lib/services/bok-information.service.d.ts +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,180 +1,180 @@
|
|
|
1
|
-
# bok-visualization
|
|
2
|
-
|
|
3
|
-
`bok-visualization` is an Angular library designed to facilitate the visualisation of the SpaceSUITE Body of Knowledge thanks to **D3.js** and **PrimeNG**. It provides not only a reusable and configurable component for easy integration into Angular applications but also a service that retrieves and offers detailed information about concepts based on their code.
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Visualization Component**: A reusable, configurable Angular component that allows users to visualize the Body of Knowledge interactively.
|
|
8
|
-
- **Concept Information Service**: A service that provides detailed information about concepts based on their code, enabling dynamic retrieval of concept descriptions and related data.
|
|
9
|
-
|
|
10
|
-
## Installation
|
|
11
|
-
|
|
12
|
-
First, install the library in your Angular project:
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npm install bok-visualization
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Make sure the required dependencies are installed in your project, as `bok-visualization` lists them as peerDependencies.
|
|
19
|
-
|
|
20
|
-
## Configuration
|
|
21
|
-
|
|
22
|
-
### Styling Configuration
|
|
23
|
-
|
|
24
|
-
To configure the colours to be used by the component, go to the file ‘src/styles.css’ and set the following variables. Additionally we can define the font and font colour of the project:
|
|
25
|
-
|
|
26
|
-
```css
|
|
27
|
-
:root {
|
|
28
|
-
--primary-color: #0e145d;
|
|
29
|
-
--secondary-color: #3fb3f8;
|
|
30
|
-
--hover-color: #f46524;
|
|
31
|
-
--danger-color: #ce3a41;
|
|
32
|
-
--warning-color: #ffd400;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
body {
|
|
36
|
-
color: var(--primary-color);
|
|
37
|
-
font-family: 'Poppins', sans-serif;
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## PrimeNG Setup in main.ts
|
|
42
|
-
|
|
43
|
-
In your `main.ts` file, add the **PrimeNG** and **Angular animations** setup:
|
|
44
|
-
|
|
45
|
-
```typescript
|
|
46
|
-
import { bootstrapApplication } from '@angular/platform-browser';
|
|
47
|
-
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
|
48
|
-
import { providePrimeNG } from 'primeng/config';
|
|
49
|
-
import Aura from '@primeng/themes/aura';
|
|
50
|
-
import { AppComponent } from './app/app.component';
|
|
51
|
-
|
|
52
|
-
bootstrapApplication(AppComponent, {
|
|
53
|
-
providers: [
|
|
54
|
-
provideAnimationsAsync(),
|
|
55
|
-
providePrimeNG({
|
|
56
|
-
theme: {
|
|
57
|
-
preset: Aura,
|
|
58
|
-
options: {
|
|
59
|
-
prefix: 'p',
|
|
60
|
-
darkModeSelector: false,
|
|
61
|
-
cssLayer: false
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
]
|
|
66
|
-
});
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
## Using the Library
|
|
70
|
-
|
|
71
|
-
Once installed and configured, you can begin using the components from the library in your Angular application.
|
|
72
|
-
|
|
73
|
-
### Example Usage: Visualization Component
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
import { Component } from '@angular/core';
|
|
77
|
-
import { BokComponent } from 'bok-visualization';
|
|
78
|
-
|
|
79
|
-
@Component({
|
|
80
|
-
selector: 'app-my-component',
|
|
81
|
-
template: `
|
|
82
|
-
<h1>Body of Knowledge</h1>
|
|
83
|
-
<bok-visualization [(selectedConcept)]="concept" [showDescription]="true" [showVersion]="true" [showSearchEngine]="true"></bok-visualization>
|
|
84
|
-
`
|
|
85
|
-
})
|
|
86
|
-
export class MyComponent {
|
|
87
|
-
concept: string = 'GIST';
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
#### Inputs & Outputs
|
|
93
|
-
|
|
94
|
-
##### `[selectedConcept]` (Two-way binding)
|
|
95
|
-
|
|
96
|
-
- **Type**: `string`
|
|
97
|
-
- **Default Value**: 'GIST'
|
|
98
|
-
- **Description**: Represents the currently selected concept. This input allows you to bind a variable to track or modify the selected concept. The component will update the bound variable whenever the selected concept changes.
|
|
99
|
-
|
|
100
|
-
##### `[showDescription]`
|
|
101
|
-
|
|
102
|
-
- **Type**: boolean
|
|
103
|
-
- **Default Value**: `true`
|
|
104
|
-
- **Description**: Determines whether the component displays a description for the selected concept. If `true`, a detailed description section will be rendered.
|
|
105
|
-
|
|
106
|
-
##### `[showVersion]`
|
|
107
|
-
|
|
108
|
-
- **Type**: boolean
|
|
109
|
-
- **Default Value**: `true`
|
|
110
|
-
- **Description**: Indicates if the component should display a list of versions of the Body of Knowledge. When set to `true`, the list appears and allow the user to change the version.
|
|
111
|
-
|
|
112
|
-
##### `[showSearchEngine]`
|
|
113
|
-
|
|
114
|
-
- **Type**: boolean
|
|
115
|
-
- **Default Value**: `true`
|
|
116
|
-
- **Description**: Controls the visibility of the search engine functionality within the component. If `true`, a search engine interface will be displayed, allowing users to search for concepts
|
|
117
|
-
|
|
118
|
-
### Example Usage: Concept Information Service
|
|
119
|
-
|
|
120
|
-
```typescript
|
|
121
|
-
import { Component, OnInit } from '@angular/core';
|
|
122
|
-
import { BokInfoService } from 'bok-visualization';
|
|
123
|
-
|
|
124
|
-
@Component({
|
|
125
|
-
selector: 'app-concept-info',
|
|
126
|
-
template: `
|
|
127
|
-
<div *ngIf="conceptName">
|
|
128
|
-
<h2>{{ conceptName }}</h2>
|
|
129
|
-
</div>
|
|
130
|
-
`
|
|
131
|
-
})
|
|
132
|
-
export class ConceptInfoComponent implements OnInit {
|
|
133
|
-
conceptName: any;
|
|
134
|
-
|
|
135
|
-
constructor(private bokInfoService: BokInformationService) {}
|
|
136
|
-
|
|
137
|
-
ngOnInit() {
|
|
138
|
-
this.bokInfoService.getConceptName('GIST').subscribe(name => {
|
|
139
|
-
this.conceptName = name;
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
#### Methods
|
|
147
|
-
|
|
148
|
-
##### getConceptColor(code: string): Observable<string>
|
|
149
|
-
|
|
150
|
-
This method retrieves the color associated with a specific concept, based on its knowledge area. The code parameter is used to extract the knowledge area code (first two characters) and then fetches the corresponding color.
|
|
151
|
-
|
|
152
|
-
##### getConceptName(code: string): Observable<string>
|
|
153
|
-
|
|
154
|
-
This method retrieves the name associated with a concept, using its code.
|
|
155
|
-
|
|
156
|
-
##### getKnowledgeAreas(code: string): Observable<string[]>
|
|
157
|
-
|
|
158
|
-
This method fetches the knowledge areas that are related to a concept, based on its code. It checks the parents of the concept and identifies the relevant knowledge areas.
|
|
159
|
-
|
|
160
|
-
## Dependencies
|
|
161
|
-
|
|
162
|
-
`bok-visualization` requires the following dependencies to be installed in your project:
|
|
163
|
-
|
|
164
|
-
- **Angular**: Version 19.1.x
|
|
165
|
-
- **primeng**: Version 19.0.x
|
|
166
|
-
- **d3**: Version 7.9.x
|
|
167
|
-
- **primeflex**: Version 3.3.x
|
|
168
|
-
- **primeicons**: Version 7.0.x
|
|
169
|
-
|
|
170
|
-
### Installation
|
|
171
|
-
|
|
172
|
-
To install the dependencies, run the following command:
|
|
173
|
-
|
|
174
|
-
```bash
|
|
175
|
-
npm install d3@^7.9.0 primeflex@^3.3.0 primeicons@^7.0.0 primeng@^19.0.0
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
## License
|
|
179
|
-
|
|
1
|
+
# bok-visualization
|
|
2
|
+
|
|
3
|
+
`bok-visualization` is an Angular library designed to facilitate the visualisation of the SpaceSUITE Body of Knowledge thanks to **D3.js** and **PrimeNG**. It provides not only a reusable and configurable component for easy integration into Angular applications but also a service that retrieves and offers detailed information about concepts based on their code.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Visualization Component**: A reusable, configurable Angular component that allows users to visualize the Body of Knowledge interactively.
|
|
8
|
+
- **Concept Information Service**: A service that provides detailed information about concepts based on their code, enabling dynamic retrieval of concept descriptions and related data.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
First, install the library in your Angular project:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install bok-visualization
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Make sure the required dependencies are installed in your project, as `bok-visualization` lists them as peerDependencies.
|
|
19
|
+
|
|
20
|
+
## Configuration
|
|
21
|
+
|
|
22
|
+
### Styling Configuration
|
|
23
|
+
|
|
24
|
+
To configure the colours to be used by the component, go to the file ‘src/styles.css’ and set the following variables. Additionally we can define the font and font colour of the project:
|
|
25
|
+
|
|
26
|
+
```css
|
|
27
|
+
:root {
|
|
28
|
+
--primary-color: #0e145d;
|
|
29
|
+
--secondary-color: #3fb3f8;
|
|
30
|
+
--hover-color: #f46524;
|
|
31
|
+
--danger-color: #ce3a41;
|
|
32
|
+
--warning-color: #ffd400;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
body {
|
|
36
|
+
color: var(--primary-color);
|
|
37
|
+
font-family: 'Poppins', sans-serif;
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## PrimeNG Setup in main.ts
|
|
42
|
+
|
|
43
|
+
In your `main.ts` file, add the **PrimeNG** and **Angular animations** setup:
|
|
44
|
+
|
|
45
|
+
```typescript
|
|
46
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
47
|
+
import { provideAnimationsAsync } from '@angular/platform-browser/animations/async';
|
|
48
|
+
import { providePrimeNG } from 'primeng/config';
|
|
49
|
+
import Aura from '@primeng/themes/aura';
|
|
50
|
+
import { AppComponent } from './app/app.component';
|
|
51
|
+
|
|
52
|
+
bootstrapApplication(AppComponent, {
|
|
53
|
+
providers: [
|
|
54
|
+
provideAnimationsAsync(),
|
|
55
|
+
providePrimeNG({
|
|
56
|
+
theme: {
|
|
57
|
+
preset: Aura,
|
|
58
|
+
options: {
|
|
59
|
+
prefix: 'p',
|
|
60
|
+
darkModeSelector: false,
|
|
61
|
+
cssLayer: false
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Using the Library
|
|
70
|
+
|
|
71
|
+
Once installed and configured, you can begin using the components from the library in your Angular application.
|
|
72
|
+
|
|
73
|
+
### Example Usage: Visualization Component
|
|
74
|
+
|
|
75
|
+
```typescript
|
|
76
|
+
import { Component } from '@angular/core';
|
|
77
|
+
import { BokComponent } from 'bok-visualization';
|
|
78
|
+
|
|
79
|
+
@Component({
|
|
80
|
+
selector: 'app-my-component',
|
|
81
|
+
template: `
|
|
82
|
+
<h1>Body of Knowledge</h1>
|
|
83
|
+
<bok-visualization [(selectedConcept)]="concept" [showDescription]="true" [showVersion]="true" [showSearchEngine]="true"></bok-visualization>
|
|
84
|
+
`
|
|
85
|
+
})
|
|
86
|
+
export class MyComponent {
|
|
87
|
+
concept: string = 'GIST';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
#### Inputs & Outputs
|
|
93
|
+
|
|
94
|
+
##### `[selectedConcept]` (Two-way binding)
|
|
95
|
+
|
|
96
|
+
- **Type**: `string`
|
|
97
|
+
- **Default Value**: 'GIST'
|
|
98
|
+
- **Description**: Represents the currently selected concept. This input allows you to bind a variable to track or modify the selected concept. The component will update the bound variable whenever the selected concept changes.
|
|
99
|
+
|
|
100
|
+
##### `[showDescription]`
|
|
101
|
+
|
|
102
|
+
- **Type**: boolean
|
|
103
|
+
- **Default Value**: `true`
|
|
104
|
+
- **Description**: Determines whether the component displays a description for the selected concept. If `true`, a detailed description section will be rendered.
|
|
105
|
+
|
|
106
|
+
##### `[showVersion]`
|
|
107
|
+
|
|
108
|
+
- **Type**: boolean
|
|
109
|
+
- **Default Value**: `true`
|
|
110
|
+
- **Description**: Indicates if the component should display a list of versions of the Body of Knowledge. When set to `true`, the list appears and allow the user to change the version.
|
|
111
|
+
|
|
112
|
+
##### `[showSearchEngine]`
|
|
113
|
+
|
|
114
|
+
- **Type**: boolean
|
|
115
|
+
- **Default Value**: `true`
|
|
116
|
+
- **Description**: Controls the visibility of the search engine functionality within the component. If `true`, a search engine interface will be displayed, allowing users to search for concepts
|
|
117
|
+
|
|
118
|
+
### Example Usage: Concept Information Service
|
|
119
|
+
|
|
120
|
+
```typescript
|
|
121
|
+
import { Component, OnInit } from '@angular/core';
|
|
122
|
+
import { BokInfoService } from 'bok-visualization';
|
|
123
|
+
|
|
124
|
+
@Component({
|
|
125
|
+
selector: 'app-concept-info',
|
|
126
|
+
template: `
|
|
127
|
+
<div *ngIf="conceptName">
|
|
128
|
+
<h2>{{ conceptName }}</h2>
|
|
129
|
+
</div>
|
|
130
|
+
`
|
|
131
|
+
})
|
|
132
|
+
export class ConceptInfoComponent implements OnInit {
|
|
133
|
+
conceptName: any;
|
|
134
|
+
|
|
135
|
+
constructor(private bokInfoService: BokInformationService) {}
|
|
136
|
+
|
|
137
|
+
ngOnInit() {
|
|
138
|
+
this.bokInfoService.getConceptName('GIST').subscribe(name => {
|
|
139
|
+
this.conceptName = name;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### Methods
|
|
147
|
+
|
|
148
|
+
##### getConceptColor(code: string): Observable<string>
|
|
149
|
+
|
|
150
|
+
This method retrieves the color associated with a specific concept, based on its knowledge area. The code parameter is used to extract the knowledge area code (first two characters) and then fetches the corresponding color.
|
|
151
|
+
|
|
152
|
+
##### getConceptName(code: string): Observable<string>
|
|
153
|
+
|
|
154
|
+
This method retrieves the name associated with a concept, using its code.
|
|
155
|
+
|
|
156
|
+
##### getKnowledgeAreas(code: string): Observable<string[]>
|
|
157
|
+
|
|
158
|
+
This method fetches the knowledge areas that are related to a concept, based on its code. It checks the parents of the concept and identifies the relevant knowledge areas.
|
|
159
|
+
|
|
160
|
+
## Dependencies
|
|
161
|
+
|
|
162
|
+
`bok-visualization` requires the following dependencies to be installed in your project:
|
|
163
|
+
|
|
164
|
+
- **Angular**: Version 19.1.x
|
|
165
|
+
- **primeng**: Version 19.0.x
|
|
166
|
+
- **d3**: Version 7.9.x
|
|
167
|
+
- **primeflex**: Version 3.3.x
|
|
168
|
+
- **primeicons**: Version 7.0.x
|
|
169
|
+
|
|
170
|
+
### Installation
|
|
171
|
+
|
|
172
|
+
To install the dependencies, run the following command:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
npm install d3@^7.9.0 primeflex@^3.3.0 primeicons@^7.0.0 primeng@^19.0.0
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## License
|
|
179
|
+
|
|
180
180
|
This library is licensed under the **MIT** License.
|