@eo4geo/ngx-bok-visualization 1.2.0

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,1053 @@
1
+ import * as i0 from '@angular/core';
2
+ import { EventEmitter, Component, Input, Output, Pipe, Injectable, ViewContainerRef, ViewChild } from '@angular/core';
3
+ import * as i1 from '@angular/common';
4
+ import { CommonModule } from '@angular/common';
5
+ import * as d3 from 'd3';
6
+ import * as i3$1 from 'primeng/progressspinner';
7
+ import { ProgressSpinnerModule } from 'primeng/progressspinner';
8
+ import * as i2 from '@angular/forms';
9
+ import { FormsModule } from '@angular/forms';
10
+ import * as i1$1 from 'primeng/inputtext';
11
+ import { InputTextModule } from 'primeng/inputtext';
12
+ import { FloatLabel } from 'primeng/floatlabel';
13
+ import * as i3 from 'primeng/checkbox';
14
+ import { CheckboxModule } from 'primeng/checkbox';
15
+ import * as i4 from 'primeng/drawer';
16
+ import { DrawerModule } from 'primeng/drawer';
17
+ import * as i5 from 'primeng/button';
18
+ import { ButtonModule } from 'primeng/button';
19
+ import * as i6 from 'primeng/divider';
20
+ import { DividerModule } from 'primeng/divider';
21
+ import { DataView } from 'primeng/dataview';
22
+ import { BehaviorSubject, switchMap, of, tap, filter, map, forkJoin, catchError, from, concatMap, take } from 'rxjs';
23
+ import * as i1$2 from '@angular/common/http';
24
+
25
+ class CustomD3NodeCollection {
26
+ nodes = [];
27
+ add(node) {
28
+ this.nodes.push(node);
29
+ }
30
+ pop() {
31
+ return this.nodes.pop();
32
+ }
33
+ getNodeByURI(uri) {
34
+ return this.nodes.find(node => node.id?.split("_rev")[0] === uri) || null;
35
+ }
36
+ getNodeByNameShort(nameShort) {
37
+ return this.nodes.find(node => node.nameShort === nameShort) || null;
38
+ }
39
+ getNodesByKeyword(keyword, searchCode = true, searchName = true, searchDes = true, searchSkills = true) {
40
+ const result = [];
41
+ const upperKeyword = keyword.toUpperCase();
42
+ if (searchCode) {
43
+ this.nodes.forEach(node => {
44
+ if (node.nameShort.toUpperCase().includes(upperKeyword) && !result.includes(node)) {
45
+ result.push(node);
46
+ }
47
+ });
48
+ }
49
+ if (searchName) {
50
+ this.nodes.forEach(node => {
51
+ if (node.name && node.name.toUpperCase().includes(upperKeyword) && !result.includes(node)) {
52
+ result.push(node);
53
+ }
54
+ });
55
+ }
56
+ if (searchSkills) {
57
+ this.nodes.forEach(node => {
58
+ if (Array.isArray(node.demonstrableSkills)) {
59
+ node.demonstrableSkills.forEach(skill => {
60
+ if (skill.description.toUpperCase().includes(upperKeyword) && !result.includes(node)) {
61
+ result.push(node);
62
+ }
63
+ });
64
+ }
65
+ });
66
+ }
67
+ if (searchDes) {
68
+ this.nodes.forEach(node => {
69
+ if (node.description && node.description.toUpperCase().includes(upperKeyword) && !result.includes(node)) {
70
+ result.push(node);
71
+ }
72
+ });
73
+ }
74
+ return result;
75
+ }
76
+ getNodesIdByKeyword(keyword, searchCode = true, searchName = true, searchDes = true, searchSkills = true) {
77
+ const result = [];
78
+ const upperKeyword = keyword.toUpperCase();
79
+ if (searchCode) {
80
+ this.nodes.forEach(node => {
81
+ if (node.nameShort.toUpperCase().includes(upperKeyword) && node.id && !result.includes(node.id)) {
82
+ result.push(node.id);
83
+ }
84
+ });
85
+ }
86
+ if (searchName) {
87
+ this.nodes.forEach(node => {
88
+ if (node.name && node.name.toUpperCase().includes(upperKeyword) && node.id && !result.includes(node.id)) {
89
+ result.push(node.id);
90
+ }
91
+ });
92
+ }
93
+ if (searchSkills) {
94
+ this.nodes.forEach(node => {
95
+ if (Array.isArray(node.demonstrableSkills)) {
96
+ node.demonstrableSkills.forEach(skill => {
97
+ if (skill.description.toUpperCase().includes(upperKeyword) && node.id && !result.includes(node.id)) {
98
+ result.push(node.id);
99
+ }
100
+ });
101
+ }
102
+ });
103
+ }
104
+ if (searchDes) {
105
+ this.nodes.forEach(node => {
106
+ if (node.description && node.description.toUpperCase().includes(upperKeyword) && node.id && !result.includes(node.id)) {
107
+ result.push(node.id);
108
+ }
109
+ });
110
+ }
111
+ return result;
112
+ }
113
+ }
114
+
115
+ class CustomD3Node {
116
+ id = null;
117
+ name = null;
118
+ nameShort = "";
119
+ description = "";
120
+ selfAssesment = null;
121
+ size = 100;
122
+ parent = null;
123
+ otherParents = [];
124
+ additionalParents = [];
125
+ children = [];
126
+ prerequisites = [];
127
+ postrequisites = [];
128
+ similarConcepts = [];
129
+ demonstrableSkills = [];
130
+ sourceDocuments = [];
131
+ contributors = [];
132
+ uri = "";
133
+ timestamp = "";
134
+ constructor(init) {
135
+ Object.assign(this, init);
136
+ }
137
+ }
138
+
139
+ class ParsedBokData {
140
+ nodes = new CustomD3Node(); // Root node
141
+ relations = [];
142
+ namehash = {};
143
+ conceptNodeCollection = new CustomD3NodeCollection();
144
+ colors = {};
145
+ constructor(init) {
146
+ Object.assign(this, init);
147
+ }
148
+ }
149
+
150
+ class BubbleComponent {
151
+ bokData = new ParsedBokData();
152
+ COLOR_STROKE_SELECTED = "black";
153
+ margin = 5;
154
+ codSelected = 'GIST';
155
+ selectedNodes = [];
156
+ codSelectedChange = new EventEmitter();
157
+ svgId = 'bubble';
158
+ diameter = 0;
159
+ node;
160
+ circle;
161
+ nodes = [];
162
+ focus;
163
+ view = [0, 0, 1];
164
+ clickedNode;
165
+ ngOnInit() {
166
+ this.createChart();
167
+ this.highlightSearch();
168
+ }
169
+ ngOnChanges(changes) {
170
+ // Reload chart when configurations change
171
+ if ((changes['bokData'] && !changes['bokData'].isFirstChange()) ||
172
+ (changes['COLOR_STROKE_SELECTED'] && !changes['COLOR_STROKE_SELECTED'].isFirstChange()) ||
173
+ (changes['margin'] && !changes['margin'].isFirstChange())) {
174
+ d3.select(this.svgId).select('svg').remove();
175
+ this.createChart();
176
+ }
177
+ // Zoom to the new concept
178
+ if (changes['codSelected'] && !changes['codSelected'].isFirstChange()) {
179
+ const currentValue = changes['codSelected'].currentValue;
180
+ const isSameNode = this.clickedNode?.data.nameShort === currentValue;
181
+ const newNode = isSameNode ? this.clickedNode : this.searchHierarchyCircularNode(currentValue);
182
+ if (newNode) {
183
+ this.zoom(null, newNode);
184
+ }
185
+ }
186
+ // Highlight search
187
+ if (changes['selectedNodes'] && !changes['selectedNodes'].isFirstChange()) {
188
+ this.cleanSearch(changes['selectedNodes'].previousValue);
189
+ this.highlightSearch();
190
+ }
191
+ }
192
+ createChart() {
193
+ const svg = d3.select(this.svgId)
194
+ .append('svg')
195
+ .attr('preserveAspectRatio', 'xMinYMin meet')
196
+ .attr('viewBox', '0 0 300 300')
197
+ .classed('svg-content', true);
198
+ this.diameter = Number(svg.node()?.getAttribute('viewBox')?.split(' ')[2]);
199
+ const g = svg.append('g')
200
+ .attr('transform', `translate(${this.diameter / 2}, ${this.diameter / 2})`);
201
+ const color = d3.scaleLinear()
202
+ .domain([-1, 5])
203
+ .interpolate(d3.interpolateHcl)
204
+ .range(['hsl(152,80%,80%)', 'hsl(228,30%,40%)']);
205
+ const pack = d3.pack()
206
+ .size([this.diameter - this.margin, this.diameter - this.margin])
207
+ .padding(2);
208
+ let root = pack(d3.hierarchy(this.bokData.nodes)
209
+ .sum(function (d) {
210
+ return d.size;
211
+ })
212
+ .sort(function (a, b) {
213
+ return b.value - a.value;
214
+ }));
215
+ this.focus = root;
216
+ this.nodes = root.descendants();
217
+ let colorPalette = d3.scaleOrdinal(d3.schemeCategory10);
218
+ const that = this;
219
+ this.circle = g.selectAll("circle")
220
+ .data(this.nodes)
221
+ .enter().append("circle")
222
+ .attr("r", (d) => d.r)
223
+ .attr("x", (d) => d.x)
224
+ .attr("y", (d) => d.y)
225
+ .attr("id", (d) => d.data.id)
226
+ .attr("class", (d) => {
227
+ return d.parent ? (d.children ? "node" : "node node--leaf") : "node node--root";
228
+ })
229
+ .style("fill", (d) => {
230
+ if (d.depth == 1) {
231
+ return this.bokData.colors[d.data.nameShort.substring(0, 2)] ? this.bokData.colors[d.data.nameShort.substring(0, 2)] : this.bokData.colors['no'];
232
+ }
233
+ else if (d.depth == 2) {
234
+ return this.bokData.colors[d.parent?.data?.nameShort?.substring(0, 2) ?? 'no'];
235
+ }
236
+ else if (d.depth == 3) {
237
+ return this.bokData.colors[d.parent?.data?.nameShort?.substring(0, 2) ?? 'no'];
238
+ }
239
+ else if (d.depth >= 4) {
240
+ return this.bokData.colors[d.parent?.parent?.parent?.data?.nameShort?.substring(0, 2) ?? 'no'];
241
+ }
242
+ else {
243
+ return "#cef4ff";
244
+ }
245
+ })
246
+ .style("fill-opacity", (d) => {
247
+ if (d.depth >= 1) {
248
+ return "0.5";
249
+ }
250
+ else {
251
+ return "1";
252
+ }
253
+ })
254
+ .attr("stroke", "black")
255
+ .attr("stroke-width", "0.2px")
256
+ .on("click", (event, d) => {
257
+ if (this.focus !== d) {
258
+ this.codSelectedChange.emit(d.data.nameShort);
259
+ this.clickedNode = d;
260
+ }
261
+ event.stopPropagation();
262
+ })
263
+ .on("mouseover", function (d) {
264
+ const circleElement = d3.select(this);
265
+ if (circleElement.style("stroke") !== that.COLOR_STROKE_SELECTED) {
266
+ circleElement.style("stroke-width", "1");
267
+ }
268
+ })
269
+ .on("mouseleave", function (d) {
270
+ const circleElement = d3.select(this);
271
+ if (circleElement.style("stroke") !== that.COLOR_STROKE_SELECTED) {
272
+ circleElement.style("stroke-width", "0.2");
273
+ }
274
+ });
275
+ let text = g.selectAll("text").data(this.nodes).enter().append("text").attr("class", "label").style("pointer-events", "none").style("fill-opacity", function (d) {
276
+ return d.parent === root || (d === root && d.children == null) ? 1 : 0;
277
+ })
278
+ .style("display", function (d) {
279
+ return d.parent === root || (d === root && d.children == null) ? "inline" : "none";
280
+ })
281
+ .style("font-size", function (d) {
282
+ var textLengthFactor = Math.min(1, 30 / (d.data?.name?.length ?? 1));
283
+ return (7 * textLengthFactor) + "px";
284
+ })
285
+ .each(function (d) {
286
+ var arr = d.data?.name?.split(" ") ?? "";
287
+ var arr2 = [];
288
+ arr2[0] = arr[0];
289
+ var maxLabelLength = 13;
290
+ for (var i = 1, j = 0; i < arr.length; i++) {
291
+ if (arr2[j].length + arr[i].length < maxLabelLength)
292
+ arr2[j] += " " + arr[i];
293
+ else {
294
+ j++;
295
+ arr2[j] = arr[i];
296
+ }
297
+ }
298
+ for (var i = 0; i < arr2.length; i++) {
299
+ d3.select(this).append("tspan").text(arr2[i]).attr("dy", i ? "1em" : (-0.5 * (j - 1)) + "em").attr("x", 0).attr("text-anchor", "middle").attr("class", "tspan" + i);
300
+ }
301
+ });
302
+ this.node = g.selectAll("circle,text");
303
+ svg
304
+ .style("background", "transparent")
305
+ .on("click", (event) => {
306
+ this.codSelectedChange.emit(root.data.nameShort);
307
+ this.clickedNode = root;
308
+ });
309
+ this.zoomTo([root.x, root.y, root.r * 2 + this.margin]);
310
+ if (this.codSelected != root.data.nameShort) {
311
+ let newNode = this.searchHierarchyCircularNode(this.codSelected);
312
+ if (newNode)
313
+ this.zoom(null, newNode);
314
+ }
315
+ }
316
+ zoom(event, d) {
317
+ let focus0 = this.focus;
318
+ this.focus = d;
319
+ let transition = d3.transition()
320
+ .duration(event && event.altKey ? 7500 : 750)
321
+ .tween("zoom", () => {
322
+ let i = d3.interpolateZoom(this.view, [this.focus?.x ?? 0, this.focus?.y ?? 0, (this.focus?.r ?? 0) * 2 + this.margin]);
323
+ return (t) => {
324
+ this.zoomTo(i(t));
325
+ };
326
+ });
327
+ let that = this;
328
+ transition.selectAll("text")
329
+ .filter(function (d) {
330
+ return d.parent === that.focus || d3.select(this).style("display") === "inline" || (d === that.focus && (d.children == null || d.children.length === 0));
331
+ })
332
+ .style("fill-opacity", (d) => {
333
+ return d.parent === this.focus || (d === this.focus && (d.children == null || d.children.length === 0)) ? 1 : 0;
334
+ })
335
+ .on("start", function (d) {
336
+ if (d.parent === that.focus || (d === that.focus && (d.children == null || d.children.length === 0))) {
337
+ d3.select(this).style("display", "inline");
338
+ }
339
+ })
340
+ .on("end", function (d) {
341
+ if (d.parent !== that.focus && (d !== that.focus && (d.children == null || d.children.length === 0))) {
342
+ d3.select(this).style("display", "none"); // Correcto: usa d3.select() para modificar los estilos
343
+ }
344
+ });
345
+ }
346
+ zoomTo(v) {
347
+ var k = this.diameter / v[2];
348
+ this.view = v;
349
+ this.node?.attr("transform", function (d) {
350
+ return "translate(" + (d.x - v[0]) * k + "," + (d.y - v[1]) * k + ")";
351
+ });
352
+ this.circle?.attr("r", function (d) {
353
+ return d.r * k;
354
+ });
355
+ }
356
+ searchHierarchyCircularNode(code) {
357
+ let newNode = undefined;
358
+ for (let n of this.nodes) {
359
+ if (n.data.nameShort == code) {
360
+ newNode = n;
361
+ break;
362
+ }
363
+ }
364
+ return newNode;
365
+ }
366
+ // Clean old selection
367
+ cleanSearch(previousValues) {
368
+ for (let i = 0; i < previousValues.length; i++) {
369
+ let circle = document.getElementById(previousValues[i]);
370
+ if (circle != null) {
371
+ circle.style.stroke = "";
372
+ circle.style.strokeWidth = "";
373
+ }
374
+ }
375
+ }
376
+ // Highlight new selection
377
+ highlightSearch() {
378
+ for (let i = 0; i < this.selectedNodes.length; i++) {
379
+ let circle = document.getElementById(this.selectedNodes[i]);
380
+ if (circle != null) {
381
+ circle.style.stroke = this.COLOR_STROKE_SELECTED;
382
+ circle.style.strokeWidth = "2px";
383
+ }
384
+ }
385
+ }
386
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: BubbleComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
387
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: BubbleComponent, isStandalone: true, selector: "bubble", inputs: { bokData: "bokData", COLOR_STROKE_SELECTED: "COLOR_STROKE_SELECTED", margin: "margin", codSelected: "codSelected", selectedNodes: "selectedNodes" }, outputs: { codSelectedChange: "codSelectedChange" }, usesOnChanges: true, ngImport: i0, template: "<div [id]=\"svgId\"></div>", styles: [""] });
388
+ }
389
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: BubbleComponent, decorators: [{
390
+ type: Component,
391
+ args: [{ standalone: true, selector: 'bubble', imports: [], template: "<div [id]=\"svgId\"></div>" }]
392
+ }], propDecorators: { bokData: [{
393
+ type: Input
394
+ }], COLOR_STROKE_SELECTED: [{
395
+ type: Input
396
+ }], margin: [{
397
+ type: Input
398
+ }], codSelected: [{
399
+ type: Input
400
+ }], selectedNodes: [{
401
+ type: Input
402
+ }], codSelectedChange: [{
403
+ type: Output
404
+ }] } });
405
+
406
+ class ListComponent {
407
+ array = [];
408
+ propertyname;
409
+ propertyname2;
410
+ headline = '';
411
+ isConcept = false;
412
+ codSelectedChange = new EventEmitter();
413
+ get sortedArray() {
414
+ if (this.array.length > 0 && this.array[0][this.propertyname]) {
415
+ return [...this.array].sort((a, b) => a[this.propertyname].localeCompare(b[this.propertyname]));
416
+ }
417
+ return this.array;
418
+ }
419
+ mapValue(item) {
420
+ let value = this.propertyname ? item[this.propertyname] : item;
421
+ return value;
422
+ }
423
+ browseToConcept(nameShort) {
424
+ this.codSelectedChange.emit(nameShort);
425
+ }
426
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: ListComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
427
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: ListComponent, isStandalone: true, selector: "list", inputs: { array: "array", propertyname: "propertyname", propertyname2: "propertyname2", headline: "headline", isConcept: "isConcept" }, outputs: { codSelectedChange: "codSelectedChange" }, ngImport: i0, template: "<div *ngIf=\"array && array.length > 0\">\r\n <h3>{{ headline }} [{{ array.length }}]</h3>\r\n <div>\r\n <ul [ngStyle]=\"{'list-style-type': isConcept ? 'none' : 'disc', 'padding-left': isConcept ? '1em' : '2em'}\">\r\n <ng-container *ngFor=\"let item of sortedArray; let i = index\">\r\n <li style=\"margin-top: 0.25em;\">\r\n <!-- Conditional Rendering based on the Headline -->\r\n <ng-container [ngSwitch]=\"isConcept\">\r\n <!-- Concept -->\r\n <a\r\n *ngSwitchCase=\"true\"\r\n style=\"font-weight: 400; cursor: pointer;\"\r\n (click)=\"browseToConcept(item[propertyname2!])\"\r\n id=\"sc-{{ mapValue(item) }}\"\r\n >\r\n [{{ item[propertyname2!] }}] {{ mapValue(item) }}\r\n </a>\r\n <!-- No Concept -->\r\n <div *ngSwitchCase=\"false\">\r\n <!-- URL -->\r\n <a\r\n *ngIf=\"propertyname2 && item[propertyname2] && item[propertyname2].trim().length > 0\"\r\n style=\"font-weight: 400; cursor: pointer; text-decoration: none;\"\r\n [href]=\"item[propertyname2]\"\r\n target=\"_blank\"\r\n >\r\n {{ mapValue(item) }}\r\n </a>\r\n <!-- Text -->\r\n <span *ngIf=\"!propertyname2 || !item[propertyname2] || item[propertyname2].trim().length == 0\">\r\n {{ mapValue(item) }}\r\n </span>\r\n </div>\r\n <!-- Default -->\r\n <a *ngSwitchDefault>{{ mapValue(item) }}</a>\r\n </ng-container>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n </div>\r\n</div>\r\n ", styles: ["a{color:var(--secondary-color)}a:hover{color:var(--hover-color)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i1.NgSwitchDefault, selector: "[ngSwitchDefault]" }] });
428
+ }
429
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: ListComponent, decorators: [{
430
+ type: Component,
431
+ args: [{ standalone: true, selector: 'list', imports: [CommonModule], template: "<div *ngIf=\"array && array.length > 0\">\r\n <h3>{{ headline }} [{{ array.length }}]</h3>\r\n <div>\r\n <ul [ngStyle]=\"{'list-style-type': isConcept ? 'none' : 'disc', 'padding-left': isConcept ? '1em' : '2em'}\">\r\n <ng-container *ngFor=\"let item of sortedArray; let i = index\">\r\n <li style=\"margin-top: 0.25em;\">\r\n <!-- Conditional Rendering based on the Headline -->\r\n <ng-container [ngSwitch]=\"isConcept\">\r\n <!-- Concept -->\r\n <a\r\n *ngSwitchCase=\"true\"\r\n style=\"font-weight: 400; cursor: pointer;\"\r\n (click)=\"browseToConcept(item[propertyname2!])\"\r\n id=\"sc-{{ mapValue(item) }}\"\r\n >\r\n [{{ item[propertyname2!] }}] {{ mapValue(item) }}\r\n </a>\r\n <!-- No Concept -->\r\n <div *ngSwitchCase=\"false\">\r\n <!-- URL -->\r\n <a\r\n *ngIf=\"propertyname2 && item[propertyname2] && item[propertyname2].trim().length > 0\"\r\n style=\"font-weight: 400; cursor: pointer; text-decoration: none;\"\r\n [href]=\"item[propertyname2]\"\r\n target=\"_blank\"\r\n >\r\n {{ mapValue(item) }}\r\n </a>\r\n <!-- Text -->\r\n <span *ngIf=\"!propertyname2 || !item[propertyname2] || item[propertyname2].trim().length == 0\">\r\n {{ mapValue(item) }}\r\n </span>\r\n </div>\r\n <!-- Default -->\r\n <a *ngSwitchDefault>{{ mapValue(item) }}</a>\r\n </ng-container>\r\n </li>\r\n </ng-container>\r\n </ul>\r\n </div>\r\n</div>\r\n ", styles: ["a{color:var(--secondary-color)}a:hover{color:var(--hover-color)}\n"] }]
432
+ }], propDecorators: { array: [{
433
+ type: Input
434
+ }], propertyname: [{
435
+ type: Input
436
+ }], propertyname2: [{
437
+ type: Input
438
+ }], headline: [{
439
+ type: Input
440
+ }], isConcept: [{
441
+ type: Input
442
+ }], codSelectedChange: [{
443
+ type: Output
444
+ }] } });
445
+
446
+ class VersionsComponent {
447
+ currentVersion = '';
448
+ bokVersion = '';
449
+ bokVersions = new Map();
450
+ bokVersionChange = new EventEmitter();
451
+ descendingOrder = (a, b) => b.value - a.value;
452
+ loadOldBokVersion(version) {
453
+ this.bokVersionChange.emit(version);
454
+ }
455
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: VersionsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
456
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: VersionsComponent, isStandalone: true, selector: "versions", inputs: { currentVersion: "currentVersion", bokVersion: "bokVersion", bokVersions: "bokVersions" }, outputs: { bokVersionChange: "bokVersionChange" }, ngImport: i0, template: "<div *ngIf=\"bokVersions && bokVersion && currentVersion\">\r\n <h3>Versioning</h3>\r\n <div *ngIf=\"bokVersions.size > 0\">\r\n <div style=\"padding-left: 1em;\">\r\n <dl>\r\n <ng-container *ngFor=\"let version of bokVersions | keyvalue : descendingOrder\">\r\n <dt *ngIf=\"version.key == currentVersion && version.key != bokVersion\" class=\"concept-name dt-link\" \r\n style=\"font-weight: 400; cursor: pointer; margin-top: 0.25em;\"\r\n (click)=\"loadOldBokVersion(version.key)\">\r\n <b>-</b> Version {{ currentVersion[1] }}.0 ({{version.value}}) (Current BoK Version)\r\n </dt>\r\n <dt *ngIf=\"version.key == currentVersion && version.key == bokVersion\" class=\"concept-name\" \r\n style=\"font-weight: 800; margin-top: 0.25em; margin-bottom: 1em;\">\r\n <b>\u2192</b> You are viewing: Version {{ currentVersion[1] }}.0 ({{version.value}}) (Current BoK Version)\r\n </dt>\r\n <dt *ngIf=\"version.key != currentVersion && version.key != bokVersion\" class=\"concept-name dt-link\" \r\n style=\"font-weight: 400; cursor: pointer; margin-top: 0.25em;\"\r\n (click)=\"loadOldBokVersion(version.key)\">\r\n <b>-</b> Version {{ version.key[1] }}.0 ({{version.value}})\r\n </dt>\r\n <dt *ngIf=\"version.key != currentVersion && version.key == bokVersion\" class=\"concept-name\" \r\n style=\"font-weight: 800; margin-top: 0.25em; margin-bottom: 1em;\">\r\n <b>\u2192</b> You are viewing: Version {{ version.key[1] }}.0 ({{version.value}})\r\n </dt>\r\n </ng-container>\r\n </dl>\r\n </div>\r\n </div>\r\n</div>", styles: [".dt-link{color:var(--secondary-color)}.dt-link:hover{color:var(--hover-color)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "pipe", type: i1.KeyValuePipe, name: "keyvalue" }] });
457
+ }
458
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: VersionsComponent, decorators: [{
459
+ type: Component,
460
+ args: [{ standalone: true, selector: 'versions', imports: [CommonModule], template: "<div *ngIf=\"bokVersions && bokVersion && currentVersion\">\r\n <h3>Versioning</h3>\r\n <div *ngIf=\"bokVersions.size > 0\">\r\n <div style=\"padding-left: 1em;\">\r\n <dl>\r\n <ng-container *ngFor=\"let version of bokVersions | keyvalue : descendingOrder\">\r\n <dt *ngIf=\"version.key == currentVersion && version.key != bokVersion\" class=\"concept-name dt-link\" \r\n style=\"font-weight: 400; cursor: pointer; margin-top: 0.25em;\"\r\n (click)=\"loadOldBokVersion(version.key)\">\r\n <b>-</b> Version {{ currentVersion[1] }}.0 ({{version.value}}) (Current BoK Version)\r\n </dt>\r\n <dt *ngIf=\"version.key == currentVersion && version.key == bokVersion\" class=\"concept-name\" \r\n style=\"font-weight: 800; margin-top: 0.25em; margin-bottom: 1em;\">\r\n <b>\u2192</b> You are viewing: Version {{ currentVersion[1] }}.0 ({{version.value}}) (Current BoK Version)\r\n </dt>\r\n <dt *ngIf=\"version.key != currentVersion && version.key != bokVersion\" class=\"concept-name dt-link\" \r\n style=\"font-weight: 400; cursor: pointer; margin-top: 0.25em;\"\r\n (click)=\"loadOldBokVersion(version.key)\">\r\n <b>-</b> Version {{ version.key[1] }}.0 ({{version.value}})\r\n </dt>\r\n <dt *ngIf=\"version.key != currentVersion && version.key == bokVersion\" class=\"concept-name\" \r\n style=\"font-weight: 800; margin-top: 0.25em; margin-bottom: 1em;\">\r\n <b>\u2192</b> You are viewing: Version {{ version.key[1] }}.0 ({{version.value}})\r\n </dt>\r\n </ng-container>\r\n </dl>\r\n </div>\r\n </div>\r\n</div>", styles: [".dt-link{color:var(--secondary-color)}.dt-link:hover{color:var(--hover-color)}\n"] }]
461
+ }], propDecorators: { currentVersion: [{
462
+ type: Input
463
+ }], bokVersion: [{
464
+ type: Input
465
+ }], bokVersions: [{
466
+ type: Input
467
+ }], bokVersionChange: [{
468
+ type: Output
469
+ }] } });
470
+
471
+ class DescriptionComponent {
472
+ bokNode = new CustomD3Node();
473
+ isAnOldVersion = false;
474
+ isAnObsoleteId = false;
475
+ showVersions = true;
476
+ versionMap;
477
+ currentVersion;
478
+ bokVersion;
479
+ codSelectedChange = new EventEmitter();
480
+ bokVersionChange = new EventEmitter();
481
+ get permalink() {
482
+ return `https://bok.eo4geo.eu/${this.bokNode.nameShort}`;
483
+ }
484
+ get statusText() {
485
+ if (this.bokNode.selfAssesment) {
486
+ return `Status: ${this.removeHtmlTags(this.bokNode.selfAssesment)}`;
487
+ }
488
+ return null;
489
+ }
490
+ get formattedTimestamp() {
491
+ if (this.bokNode.timestamp) {
492
+ return `Last Updated: ${new Date(this.bokNode.timestamp).toUTCString()}`;
493
+ }
494
+ return '';
495
+ }
496
+ get parentHierarchy() {
497
+ const parents = [];
498
+ let p = this.bokNode.parent;
499
+ while (p) {
500
+ parents.push(p);
501
+ p = p.parent;
502
+ }
503
+ return parents.reverse();
504
+ }
505
+ get otherParentHierarchies() {
506
+ return this.bokNode.otherParents.map((op) => {
507
+ const hierarchy = [];
508
+ while (op) {
509
+ hierarchy.push(op);
510
+ op = op.parent;
511
+ }
512
+ return hierarchy.reverse();
513
+ });
514
+ }
515
+ browseToConcept(nameShort) {
516
+ this.codSelectedChange.emit(nameShort);
517
+ }
518
+ loadOldBokVersion(version) {
519
+ this.bokVersion = version;
520
+ this.bokVersionChange.emit(version);
521
+ }
522
+ removeHtmlTags(text) {
523
+ return text.replace(/<\/?[^>]+(>|$)/g, "");
524
+ }
525
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DescriptionComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
526
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: DescriptionComponent, isStandalone: true, selector: "description", inputs: { bokNode: "bokNode", isAnOldVersion: "isAnOldVersion", isAnObsoleteId: "isAnObsoleteId", showVersions: "showVersions", versionMap: "versionMap", currentVersion: "currentVersion", bokVersion: "bokVersion" }, outputs: { codSelectedChange: "codSelectedChange", bokVersionChange: "bokVersionChange" }, ngImport: i0, template: "<div>\r\n <!-- Permalink -->\r\n <p>\r\n Permalink: \r\n <a style=\"text-decoration: none;\" [href]=\"permalink\">{{ permalink }}</a>\r\n </p>\r\n\r\n <!-- Title -->\r\n <h2 id=\"boktitle\" style=\"margin-bottom: 0px;\">\r\n [{{ bokNode.nameShort }}] {{ bokNode.name }}\r\n </h2>\r\n\r\n <!-- Status -->\r\n <div *ngIf=\"statusText\" style=\"margin-bottom: 1em;\">\r\n {{ statusText }}\r\n </div>\r\n\r\n <!-- Warning for obsolete BoK concept -->\r\n <p *ngIf=\"isAnObsoleteId && currentVersion\">\r\n <span style=\"color: var(--danger-color); font-weight: normal;\">\r\n warning: this is an obsolete BoK concept - this concept is no longer present in \r\n <a \r\n style=\"color: var(--danger-color); font-weight: normal; cursor: pointer; text-decoration: underline;\"\r\n (click)=\"loadOldBokVersion(currentVersion)\">\r\n the current version of the BoK\r\n </a>\r\n </span>\r\n </p>\r\n \r\n <!-- Warning for old version -->\r\n <p *ngIf=\"isAnOldVersion && !isAnObsoleteId\">\r\n <span style=\"color: var(--warning-color); font-weight: normal;\">\r\n warning: this is an old version of this BoK concept; see \"Versioning\" below for more recent version(s)\r\n </span>\r\n </p>\r\n\r\n <!-- Last Updated -->\r\n <small *ngIf=\"formattedTimestamp\">{{ formattedTimestamp }}</small>\r\n \r\n <!-- Description -->\r\n <h3>Description:</h3>\r\n <div id=\"currentDescription\" class=\"hideContent\">\r\n {{ bokNode.description }}\r\n </div>\r\n\r\n <!-- Superconcepts -->\r\n <div *ngIf=\"parentHierarchy.length > 0\">\r\n <h3>Superconcepts [{{ 1 + bokNode.otherParents.length }}]</h3>\r\n <div style=\"padding-left: 1em;\">\r\n <dl>\r\n <ng-container *ngFor=\"let parent of parentHierarchy; let i = index\">\r\n <dt *ngIf=\"parent === parentHierarchy[0]\" class=\"concept-name dt-link\" \r\n style=\"font-weight: 400; cursor: pointer;\"\r\n (click)=\"browseToConcept(parent.nameShort)\">\r\n <b>-</b> {{ parent.name }}\r\n </dt>\r\n <dd *ngIf=\"parent !== parentHierarchy[0]\"\r\n [style.marginLeft.em]=\"i * 0.8\"\r\n style=\"margin-top: 0.25em;\">\r\n <dl>\r\n <dt class=\"concept-name dt-link\" \r\n style=\"font-weight: 400; cursor: pointer;\"\r\n (click)=\"browseToConcept(parent.nameShort)\">\r\n <b>-</b> [{{ parent.nameShort }}] {{ parent.name }}\r\n </dt>\r\n </dl>\r\n </dd>\r\n </ng-container>\r\n </dl>\r\n </div>\r\n </div>\r\n\r\n <!-- Other Superconcepts -->\r\n <div *ngFor=\"let hierarchy of otherParentHierarchies\">\r\n <div style=\"margin-top: 1em; padding-left: 1em;\">\r\n <dl>\r\n <ng-container *ngFor=\"let other of hierarchy; let i = index\">\r\n <dt *ngIf=\"other === hierarchy[0]\" class=\"concept-name dt-link\" \r\n style=\"font-weight: 400; cursor: pointer;\"\r\n (click)=\"browseToConcept(other.nameShort)\">\r\n <b>-</b> {{ other.name }}\r\n </dt>\r\n <dd *ngIf=\"other !== hierarchy[0]\"\r\n [style.marginLeft.px]=\"i * 8\"\r\n style=\"margin-top: 0.25em;\">\r\n <dl>\r\n <dt class=\"concept-name dt-link\" \r\n style=\"font-weight: 400; cursor: pointer;\"\r\n (click)=\"browseToConcept(other.nameShort)\">\r\n <b>-</b> [{{ other.nameShort }}] {{ other.name }}\r\n </dt>\r\n </dl>\r\n </dd>\r\n </ng-container>\r\n </dl>\r\n </div>\r\n </div>\r\n\r\n <!-- Subconcepts -->\r\n <list [array]=\"bokNode.children\" [propertyname]=\"'name'\" [propertyname2]=\"'nameShort'\" \r\n [headline]=\"'Subconcepts'\" [isConcept]=\"true\" (codSelectedChange)=\"browseToConcept($event)\"></list>\r\n\r\n <!-- Prerequisites -->\r\n <list [array]=\"bokNode.prerequisites\" [propertyname]=\"'name'\" [propertyname2]=\"'nameShort'\" \r\n [headline]=\"'Prerequisites'\" [isConcept]=\"true\" (codSelectedChange)=\"browseToConcept($event)\"></list>\r\n\r\n <!-- postrequisites -->\r\n <list [array]=\"bokNode.postrequisites\" [propertyname]=\"'name'\" [propertyname2]=\"'nameShort'\" \r\n [headline]=\"'Postrequisites'\" [isConcept]=\"true\" (codSelectedChange)=\"browseToConcept($event)\"></list>\r\n\r\n <!-- Similar concepts -->\r\n <list [array]=\"bokNode.similarConcepts\" [propertyname]=\"'name'\" [propertyname2]=\"'nameShort'\" \r\n [headline]=\"'Similar concepts'\" [isConcept]=\"true\" (codSelectedChange)=\"browseToConcept($event)\"></list>\r\n\r\n <!-- Skills -->\r\n <list [array]=\"bokNode.demonstrableSkills\" [propertyname]=\"'description'\" [headline]=\"'Skills'\" [isConcept]=\"false\"></list>\r\n\r\n <!-- Contributors -->\r\n <list [array]=\"bokNode.contributors\" [propertyname]=\"'nameShort'\" [propertyname2]=\"'url'\" \r\n [headline]=\"'Contributors'\" [isConcept]=\"false\"></list>\r\n\r\n <!-- Source Documents -->\r\n <list [array]=\"bokNode.sourceDocuments\" [propertyname]=\"'nameShort'\" [propertyname2]=\"'url'\" \r\n [headline]=\"'Source documents'\" [isConcept]=\"false\"></list>\r\n\r\n <!-- Versions -->\r\n <div *ngIf=\"showVersions && bokVersion && currentVersion && versionMap\">\r\n <versions (bokVersionChange)=\"loadOldBokVersion($event)\" [bokVersion]=\"bokVersion\" [currentVersion]=\"currentVersion\" [bokVersions]=\"versionMap\"></versions>\r\n </div>\r\n\r\n</div>\r\n ", styles: [".dt-link{color:var(--secondary-color)}.dt-link:hover{color:var(--hover-color)}a{color:var(--secondary-color)}a:hover{color:var(--hover-color)}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ListComponent, selector: "list", inputs: ["array", "propertyname", "propertyname2", "headline", "isConcept"], outputs: ["codSelectedChange"] }, { kind: "component", type: VersionsComponent, selector: "versions", inputs: ["currentVersion", "bokVersion", "bokVersions"], outputs: ["bokVersionChange"] }] });
527
+ }
528
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: DescriptionComponent, decorators: [{
529
+ type: Component,
530
+ args: [{ standalone: true, selector: 'description', imports: [CommonModule, ListComponent, VersionsComponent], template: "<div>\r\n <!-- Permalink -->\r\n <p>\r\n Permalink: \r\n <a style=\"text-decoration: none;\" [href]=\"permalink\">{{ permalink }}</a>\r\n </p>\r\n\r\n <!-- Title -->\r\n <h2 id=\"boktitle\" style=\"margin-bottom: 0px;\">\r\n [{{ bokNode.nameShort }}] {{ bokNode.name }}\r\n </h2>\r\n\r\n <!-- Status -->\r\n <div *ngIf=\"statusText\" style=\"margin-bottom: 1em;\">\r\n {{ statusText }}\r\n </div>\r\n\r\n <!-- Warning for obsolete BoK concept -->\r\n <p *ngIf=\"isAnObsoleteId && currentVersion\">\r\n <span style=\"color: var(--danger-color); font-weight: normal;\">\r\n warning: this is an obsolete BoK concept - this concept is no longer present in \r\n <a \r\n style=\"color: var(--danger-color); font-weight: normal; cursor: pointer; text-decoration: underline;\"\r\n (click)=\"loadOldBokVersion(currentVersion)\">\r\n the current version of the BoK\r\n </a>\r\n </span>\r\n </p>\r\n \r\n <!-- Warning for old version -->\r\n <p *ngIf=\"isAnOldVersion && !isAnObsoleteId\">\r\n <span style=\"color: var(--warning-color); font-weight: normal;\">\r\n warning: this is an old version of this BoK concept; see \"Versioning\" below for more recent version(s)\r\n </span>\r\n </p>\r\n\r\n <!-- Last Updated -->\r\n <small *ngIf=\"formattedTimestamp\">{{ formattedTimestamp }}</small>\r\n \r\n <!-- Description -->\r\n <h3>Description:</h3>\r\n <div id=\"currentDescription\" class=\"hideContent\">\r\n {{ bokNode.description }}\r\n </div>\r\n\r\n <!-- Superconcepts -->\r\n <div *ngIf=\"parentHierarchy.length > 0\">\r\n <h3>Superconcepts [{{ 1 + bokNode.otherParents.length }}]</h3>\r\n <div style=\"padding-left: 1em;\">\r\n <dl>\r\n <ng-container *ngFor=\"let parent of parentHierarchy; let i = index\">\r\n <dt *ngIf=\"parent === parentHierarchy[0]\" class=\"concept-name dt-link\" \r\n style=\"font-weight: 400; cursor: pointer;\"\r\n (click)=\"browseToConcept(parent.nameShort)\">\r\n <b>-</b> {{ parent.name }}\r\n </dt>\r\n <dd *ngIf=\"parent !== parentHierarchy[0]\"\r\n [style.marginLeft.em]=\"i * 0.8\"\r\n style=\"margin-top: 0.25em;\">\r\n <dl>\r\n <dt class=\"concept-name dt-link\" \r\n style=\"font-weight: 400; cursor: pointer;\"\r\n (click)=\"browseToConcept(parent.nameShort)\">\r\n <b>-</b> [{{ parent.nameShort }}] {{ parent.name }}\r\n </dt>\r\n </dl>\r\n </dd>\r\n </ng-container>\r\n </dl>\r\n </div>\r\n </div>\r\n\r\n <!-- Other Superconcepts -->\r\n <div *ngFor=\"let hierarchy of otherParentHierarchies\">\r\n <div style=\"margin-top: 1em; padding-left: 1em;\">\r\n <dl>\r\n <ng-container *ngFor=\"let other of hierarchy; let i = index\">\r\n <dt *ngIf=\"other === hierarchy[0]\" class=\"concept-name dt-link\" \r\n style=\"font-weight: 400; cursor: pointer;\"\r\n (click)=\"browseToConcept(other.nameShort)\">\r\n <b>-</b> {{ other.name }}\r\n </dt>\r\n <dd *ngIf=\"other !== hierarchy[0]\"\r\n [style.marginLeft.px]=\"i * 8\"\r\n style=\"margin-top: 0.25em;\">\r\n <dl>\r\n <dt class=\"concept-name dt-link\" \r\n style=\"font-weight: 400; cursor: pointer;\"\r\n (click)=\"browseToConcept(other.nameShort)\">\r\n <b>-</b> [{{ other.nameShort }}] {{ other.name }}\r\n </dt>\r\n </dl>\r\n </dd>\r\n </ng-container>\r\n </dl>\r\n </div>\r\n </div>\r\n\r\n <!-- Subconcepts -->\r\n <list [array]=\"bokNode.children\" [propertyname]=\"'name'\" [propertyname2]=\"'nameShort'\" \r\n [headline]=\"'Subconcepts'\" [isConcept]=\"true\" (codSelectedChange)=\"browseToConcept($event)\"></list>\r\n\r\n <!-- Prerequisites -->\r\n <list [array]=\"bokNode.prerequisites\" [propertyname]=\"'name'\" [propertyname2]=\"'nameShort'\" \r\n [headline]=\"'Prerequisites'\" [isConcept]=\"true\" (codSelectedChange)=\"browseToConcept($event)\"></list>\r\n\r\n <!-- postrequisites -->\r\n <list [array]=\"bokNode.postrequisites\" [propertyname]=\"'name'\" [propertyname2]=\"'nameShort'\" \r\n [headline]=\"'Postrequisites'\" [isConcept]=\"true\" (codSelectedChange)=\"browseToConcept($event)\"></list>\r\n\r\n <!-- Similar concepts -->\r\n <list [array]=\"bokNode.similarConcepts\" [propertyname]=\"'name'\" [propertyname2]=\"'nameShort'\" \r\n [headline]=\"'Similar concepts'\" [isConcept]=\"true\" (codSelectedChange)=\"browseToConcept($event)\"></list>\r\n\r\n <!-- Skills -->\r\n <list [array]=\"bokNode.demonstrableSkills\" [propertyname]=\"'description'\" [headline]=\"'Skills'\" [isConcept]=\"false\"></list>\r\n\r\n <!-- Contributors -->\r\n <list [array]=\"bokNode.contributors\" [propertyname]=\"'nameShort'\" [propertyname2]=\"'url'\" \r\n [headline]=\"'Contributors'\" [isConcept]=\"false\"></list>\r\n\r\n <!-- Source Documents -->\r\n <list [array]=\"bokNode.sourceDocuments\" [propertyname]=\"'nameShort'\" [propertyname2]=\"'url'\" \r\n [headline]=\"'Source documents'\" [isConcept]=\"false\"></list>\r\n\r\n <!-- Versions -->\r\n <div *ngIf=\"showVersions && bokVersion && currentVersion && versionMap\">\r\n <versions (bokVersionChange)=\"loadOldBokVersion($event)\" [bokVersion]=\"bokVersion\" [currentVersion]=\"currentVersion\" [bokVersions]=\"versionMap\"></versions>\r\n </div>\r\n\r\n</div>\r\n ", styles: [".dt-link{color:var(--secondary-color)}.dt-link:hover{color:var(--hover-color)}a{color:var(--secondary-color)}a:hover{color:var(--hover-color)}\n"] }]
531
+ }], propDecorators: { bokNode: [{
532
+ type: Input
533
+ }], isAnOldVersion: [{
534
+ type: Input
535
+ }], isAnObsoleteId: [{
536
+ type: Input
537
+ }], showVersions: [{
538
+ type: Input
539
+ }], versionMap: [{
540
+ type: Input
541
+ }], currentVersion: [{
542
+ type: Input
543
+ }], bokVersion: [{
544
+ type: Input
545
+ }], codSelectedChange: [{
546
+ type: Output
547
+ }], bokVersionChange: [{
548
+ type: Output
549
+ }] } });
550
+
551
+ class TruncatePipe {
552
+ transform(value, searchWord, margin) {
553
+ const limitStart = value.toUpperCase().indexOf(searchWord.toUpperCase());
554
+ const truncateString = limitStart > margin;
555
+ if (limitStart >= 0) {
556
+ let newValue = '';
557
+ if (truncateString)
558
+ newValue += '...' + value.substring(limitStart - margin, limitStart);
559
+ else
560
+ newValue += value.substring(0, limitStart);
561
+ newValue += '<b>' + value.substring(limitStart, limitStart + searchWord.length) + '</b>' + value.substring(limitStart + searchWord.length, limitStart + value.length);
562
+ return newValue;
563
+ }
564
+ return value;
565
+ }
566
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TruncatePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
567
+ static ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.1.1", ngImport: i0, type: TruncatePipe, isStandalone: true, name: "truncate" });
568
+ }
569
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: TruncatePipe, decorators: [{
570
+ type: Pipe,
571
+ args: [{
572
+ name: 'truncate'
573
+ }]
574
+ }] });
575
+
576
+ class SearchResultsComponent {
577
+ nodeSuggestions = [];
578
+ searchValue = '';
579
+ highlightDescription = false;
580
+ codSelectedChange = new EventEmitter();
581
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: SearchResultsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
582
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: SearchResultsComponent, isStandalone: true, selector: "searchResults", inputs: { nodeSuggestions: ["suggestions", "nodeSuggestions"], searchValue: "searchValue", highlightDescription: "highlightDescription" }, outputs: { codSelectedChange: "codSelectedChange" }, ngImport: i0, template: "<p *ngIf=\"nodeSuggestions.length > 0\">{{nodeSuggestions.length}} concepts</p>\r\n<p-dataview [value]=\"nodeSuggestions\" [rows]=\"8\" [paginator]=\"true\" >\r\n <ng-template #list let-items>\r\n <div class=\"h-4rem mt-2 pr-4\" *ngFor=\"let item of items; let first = first\">\r\n <a (click)=\"codSelectedChange.emit(item.nameShort)\" style=\"font-weight: 400; cursor: pointer;\">\r\n <div class=\"white-space-nowrap overflow-hidden text-overflow-ellipsis\">\r\n [{{item.nameShort}}] {{item.name}}\r\n </div>\r\n </a>\r\n <div class=\"mt-1 white-space-nowrap overflow-hidden text-overflow-ellipsis\" style=\"font-size: 0.85em\" \r\n [innerHTML]=\"highlightDescription ? (item.description | truncate : searchValue : 25) : item.description\"></div>\r\n </div>\r\n </ng-template>\r\n</p-dataview>", styles: ["a{color:var(--secondary-color)}a:hover{color:var(--hover-color)}\n"], dependencies: [{ kind: "component", type: DataView, selector: "p-dataView, p-dataview, p-data-view", inputs: ["paginator", "rows", "totalRecords", "pageLinks", "rowsPerPageOptions", "paginatorPosition", "paginatorStyleClass", "alwaysShowPaginator", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showFirstLastIcon", "showPageLinks", "lazy", "lazyLoadOnInit", "emptyMessage", "style", "styleClass", "gridStyleClass", "trackBy", "filterBy", "filterLocale", "loading", "loadingIcon", "first", "sortField", "sortOrder", "value", "layout"], outputs: ["onLazyLoad", "onPage", "onSort", "onChangeLayout"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "pipe", type: TruncatePipe, name: "truncate" }] });
583
+ }
584
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: SearchResultsComponent, decorators: [{
585
+ type: Component,
586
+ args: [{ standalone: true, selector: 'searchResults', imports: [DataView, CommonModule, ButtonModule, TruncatePipe], template: "<p *ngIf=\"nodeSuggestions.length > 0\">{{nodeSuggestions.length}} concepts</p>\r\n<p-dataview [value]=\"nodeSuggestions\" [rows]=\"8\" [paginator]=\"true\" >\r\n <ng-template #list let-items>\r\n <div class=\"h-4rem mt-2 pr-4\" *ngFor=\"let item of items; let first = first\">\r\n <a (click)=\"codSelectedChange.emit(item.nameShort)\" style=\"font-weight: 400; cursor: pointer;\">\r\n <div class=\"white-space-nowrap overflow-hidden text-overflow-ellipsis\">\r\n [{{item.nameShort}}] {{item.name}}\r\n </div>\r\n </a>\r\n <div class=\"mt-1 white-space-nowrap overflow-hidden text-overflow-ellipsis\" style=\"font-size: 0.85em\" \r\n [innerHTML]=\"highlightDescription ? (item.description | truncate : searchValue : 25) : item.description\"></div>\r\n </div>\r\n </ng-template>\r\n</p-dataview>", styles: ["a{color:var(--secondary-color)}a:hover{color:var(--hover-color)}\n"] }]
587
+ }], propDecorators: { nodeSuggestions: [{
588
+ type: Input,
589
+ args: [{ alias: 'suggestions' }]
590
+ }], searchValue: [{
591
+ type: Input
592
+ }], highlightDescription: [{
593
+ type: Input
594
+ }], codSelectedChange: [{
595
+ type: Output
596
+ }] } });
597
+
598
+ class SearchComponent {
599
+ inputValue = '';
600
+ searchBooleans = {
601
+ searchCode: true,
602
+ searchName: true,
603
+ searchDescription: true,
604
+ searchSkills: false,
605
+ };
606
+ nodeSuggestions = [];
607
+ inputValueChange = new EventEmitter();
608
+ searchSettingsChange = new EventEmitter();
609
+ codSelectedChange = new EventEmitter();
610
+ visible = false;
611
+ ngOnChanges(changes) {
612
+ if (changes['inputValue'] && changes['inputValue'].previousValue != changes['inputValue'].currentValue)
613
+ this.onInputValueChange(changes['inputValue'].currentValue);
614
+ if (changes['searchBooleans'] && changes['searchBooleans'].previousValue != changes['searchBooleans'].currentValue)
615
+ this.updateSearchSettings();
616
+ }
617
+ onInputValueChange(value) {
618
+ this.inputValue = value;
619
+ this.inputValueChange.emit(this.inputValue);
620
+ }
621
+ updateSearchSettings() {
622
+ this.searchSettingsChange.emit(this.searchBooleans);
623
+ }
624
+ onCodSelectedChange(value) {
625
+ this.codSelectedChange.emit(value);
626
+ this.visible = false;
627
+ }
628
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: SearchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
629
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: SearchComponent, isStandalone: true, selector: "search", inputs: { inputValue: "inputValue", searchBooleans: "searchBooleans", nodeSuggestions: ["suggestions", "nodeSuggestions"] }, outputs: { inputValueChange: "inputValueChange", searchSettingsChange: "searchSettingsChange", codSelectedChange: "codSelectedChange" }, usesOnChanges: true, ngImport: i0, template: "<p-drawer header=\"Search Concepts\" position=\"right\" [(visible)]=\"visible\" styleClass=\"w-full md:w-25rem xl:w-30rem\">\r\n <div class=\"flex flex-wrap justify-center align-items-center my-4\">\r\n <p-floatlabel variant=\"on\">\r\n <input pInputText id=\"on_label\" [(ngModel)]=\"inputValue\" (ngModelChange)=\"onInputValueChange($event)\" autocomplete=\"off\" class=\"w-19rem custom-input\"/>\r\n <label for=\"on_label\" class=\"custom-label\">Search</label>\r\n </p-floatlabel>\r\n <p-button variant=\"text\" severity=\"secondary\" (click)=\"onInputValueChange('')\" size=\"small\" icon=\"pi pi-times\"/>\r\n </div>\r\n <div class=\"flex flex-wrap justify-center align-items-center gap-3\">\r\n <div class=\"flex items-center\">\r\n <p-checkbox inputId=\"searchCode\" [(ngModel)]=\"searchBooleans.searchCode\" (ngModelChange)=\"updateSearchSettings()\" [binary]=\"true\" class=\"custom-checkbox\"/>\r\n <label for=\"searchCode\" class=\"ml-2\"> Code </label>\r\n </div>\r\n <div class=\"flex items-center\">\r\n <p-checkbox inputId=\"searchName\" [(ngModel)]=\"searchBooleans.searchName\" (ngModelChange)=\"updateSearchSettings()\" [binary]=\"true\" class=\"custom-checkbox\"/>\r\n <label for=\"searchName\" class=\"ml-2\"> Name </label>\r\n </div>\r\n <div class=\"flex items-center\">\r\n <p-checkbox inputId=\"searchDescription\" [(ngModel)]=\"searchBooleans.searchDescription\" (ngModelChange)=\"updateSearchSettings()\" [binary]=\"true\" class=\"custom-checkbox\"/>\r\n <label for=\"searchDescription\" class=\"ml-2\"> Description </label>\r\n </div>\r\n <div class=\"flex items-center\">\r\n <p-checkbox inputId=\"searchSkills\" [(ngModel)]=\"searchBooleans.searchSkills\" (ngModelChange)=\"updateSearchSettings()\" [binary]=\"true\" class=\"custom-checkbox\"/>\r\n <label for=\"searchSkills\" class=\"ml-2\"> Skills </label>\r\n </div>\r\n </div>\r\n <p-divider />\r\n <searchResults [suggestions]=\"nodeSuggestions\" [searchValue]=\"inputValue\" [highlightDescription]=\"searchBooleans.searchDescription\" (codSelectedChange)=\"onCodSelectedChange($event)\"/>\r\n</p-drawer>\r\n<p-button variant=\"text\" severity=\"secondary\" [raised]=\"true\" (click)=\"visible = true\" icon=\"pi pi-search\" class=\"fixed top-0 right-0 m-4 custom-button\"/>\r\n", styles: [".custom-checkbox{--p-checkbox-checked-background: var(--secondary-color);--p-checkbox-checked-border-color: var(--secondary-color);--p-checkbox-checked-hover-background: var(--hover-color);--p-checkbox-checked-hover-border-color: var(--hover-color);--p-checkbox-checked-focus-border-color: var(--secondary-color);--p-checkbox-focus-ring-color: var(--secondary-color)}.custom-input{--p-inputtext-focus-border-color: var(--hover-color)}.custom-label{--p-floatlabel-focus-color: var(--hover-color)}\n"], dependencies: [{ kind: "ngmodule", type: InputTextModule }, { kind: "directive", type: i1$1.InputText, selector: "[pInputText]", inputs: ["variant", "fluid", "pSize"] }, { kind: "component", type: FloatLabel, selector: "p-floatlabel, p-floatLabel, p-float-label", inputs: ["variant"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: CheckboxModule }, { kind: "component", type: i3.Checkbox, selector: "p-checkbox, p-checkBox, p-check-box", inputs: ["value", "name", "disabled", "binary", "ariaLabelledBy", "ariaLabel", "tabindex", "inputId", "style", "inputStyle", "styleClass", "inputClass", "indeterminate", "size", "formControl", "checkboxIcon", "readonly", "required", "autofocus", "trueValue", "falseValue", "variant"], outputs: ["onChange", "onFocus", "onBlur"] }, { kind: "ngmodule", type: DrawerModule }, { kind: "component", type: i4.Drawer, selector: "p-drawer", inputs: ["appendTo", "blockScroll", "style", "styleClass", "ariaCloseLabel", "autoZIndex", "baseZIndex", "modal", "closeButtonProps", "dismissible", "showCloseIcon", "closeOnEscape", "transitionOptions", "visible", "position", "fullScreen", "header", "maskStyle", "closable"], outputs: ["onShow", "onHide", "visibleChange"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i5.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: DividerModule }, { kind: "component", type: i6.Divider, selector: "p-divider", inputs: ["style", "styleClass", "layout", "type", "align"] }, { kind: "component", type: SearchResultsComponent, selector: "searchResults", inputs: ["suggestions", "searchValue", "highlightDescription"], outputs: ["codSelectedChange"] }] });
630
+ }
631
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: SearchComponent, decorators: [{
632
+ type: Component,
633
+ args: [{ standalone: true, selector: 'search', imports: [InputTextModule, FloatLabel,
634
+ FormsModule, CheckboxModule,
635
+ DrawerModule, ButtonModule,
636
+ DividerModule, SearchResultsComponent], template: "<p-drawer header=\"Search Concepts\" position=\"right\" [(visible)]=\"visible\" styleClass=\"w-full md:w-25rem xl:w-30rem\">\r\n <div class=\"flex flex-wrap justify-center align-items-center my-4\">\r\n <p-floatlabel variant=\"on\">\r\n <input pInputText id=\"on_label\" [(ngModel)]=\"inputValue\" (ngModelChange)=\"onInputValueChange($event)\" autocomplete=\"off\" class=\"w-19rem custom-input\"/>\r\n <label for=\"on_label\" class=\"custom-label\">Search</label>\r\n </p-floatlabel>\r\n <p-button variant=\"text\" severity=\"secondary\" (click)=\"onInputValueChange('')\" size=\"small\" icon=\"pi pi-times\"/>\r\n </div>\r\n <div class=\"flex flex-wrap justify-center align-items-center gap-3\">\r\n <div class=\"flex items-center\">\r\n <p-checkbox inputId=\"searchCode\" [(ngModel)]=\"searchBooleans.searchCode\" (ngModelChange)=\"updateSearchSettings()\" [binary]=\"true\" class=\"custom-checkbox\"/>\r\n <label for=\"searchCode\" class=\"ml-2\"> Code </label>\r\n </div>\r\n <div class=\"flex items-center\">\r\n <p-checkbox inputId=\"searchName\" [(ngModel)]=\"searchBooleans.searchName\" (ngModelChange)=\"updateSearchSettings()\" [binary]=\"true\" class=\"custom-checkbox\"/>\r\n <label for=\"searchName\" class=\"ml-2\"> Name </label>\r\n </div>\r\n <div class=\"flex items-center\">\r\n <p-checkbox inputId=\"searchDescription\" [(ngModel)]=\"searchBooleans.searchDescription\" (ngModelChange)=\"updateSearchSettings()\" [binary]=\"true\" class=\"custom-checkbox\"/>\r\n <label for=\"searchDescription\" class=\"ml-2\"> Description </label>\r\n </div>\r\n <div class=\"flex items-center\">\r\n <p-checkbox inputId=\"searchSkills\" [(ngModel)]=\"searchBooleans.searchSkills\" (ngModelChange)=\"updateSearchSettings()\" [binary]=\"true\" class=\"custom-checkbox\"/>\r\n <label for=\"searchSkills\" class=\"ml-2\"> Skills </label>\r\n </div>\r\n </div>\r\n <p-divider />\r\n <searchResults [suggestions]=\"nodeSuggestions\" [searchValue]=\"inputValue\" [highlightDescription]=\"searchBooleans.searchDescription\" (codSelectedChange)=\"onCodSelectedChange($event)\"/>\r\n</p-drawer>\r\n<p-button variant=\"text\" severity=\"secondary\" [raised]=\"true\" (click)=\"visible = true\" icon=\"pi pi-search\" class=\"fixed top-0 right-0 m-4 custom-button\"/>\r\n", styles: [".custom-checkbox{--p-checkbox-checked-background: var(--secondary-color);--p-checkbox-checked-border-color: var(--secondary-color);--p-checkbox-checked-hover-background: var(--hover-color);--p-checkbox-checked-hover-border-color: var(--hover-color);--p-checkbox-checked-focus-border-color: var(--secondary-color);--p-checkbox-focus-ring-color: var(--secondary-color)}.custom-input{--p-inputtext-focus-border-color: var(--hover-color)}.custom-label{--p-floatlabel-focus-color: var(--hover-color)}\n"] }]
637
+ }], propDecorators: { inputValue: [{
638
+ type: Input
639
+ }], searchBooleans: [{
640
+ type: Input
641
+ }], nodeSuggestions: [{
642
+ type: Input,
643
+ args: [{ alias: 'suggestions' }]
644
+ }], inputValueChange: [{
645
+ type: Output
646
+ }], searchSettingsChange: [{
647
+ type: Output
648
+ }], codSelectedChange: [{
649
+ type: Output
650
+ }] } });
651
+
652
+ const environment = {
653
+ URL_ARRAY: [
654
+ 'https://eo4geo-uji-backup.firebaseio.com/',
655
+ 'https://eo4geo-uji-backup2-default-rtdb.europe-west1.firebasedatabase.app/',
656
+ 'https://eo4geo-uji-backup3-default-rtdb.firebaseio.com/'
657
+ ]
658
+ };
659
+
660
+ class BokFirebaseService {
661
+ http;
662
+ bokMap = new Map();
663
+ versionsMap$ = new BehaviorSubject(undefined);
664
+ currentVersion$ = new BehaviorSubject(undefined);
665
+ URL_BASE;
666
+ constructor(http) {
667
+ this.http = http;
668
+ this.URL_BASE = environment.URL_ARRAY[0];
669
+ }
670
+ // Function to get the BOK data for a specific version from Firebase
671
+ getBokVersion(version) {
672
+ return this.getCurrentVersion().pipe(switchMap((currentVersion) => {
673
+ const queryVersion = version === `v${currentVersion}` ? 'current' : version;
674
+ if (this.bokMap.has(queryVersion)) {
675
+ return of(this.bokMap.get(queryVersion));
676
+ }
677
+ const versionUrl = `${queryVersion}.json`;
678
+ return this.getDataFromFirebase(versionUrl).pipe(tap((bok) => {
679
+ this.bokMap.set(queryVersion, bok);
680
+ }));
681
+ }));
682
+ }
683
+ // Function to get a map with old versions (key) and their release year (value)
684
+ getOldVersionsData() {
685
+ if (this.versionsMap$.value == undefined || this.versionsMap$.value.size == 0) {
686
+ const versionsUrl = '.json?shallow=true';
687
+ this.getDataFromFirebase(versionsUrl).pipe(switchMap((versionsObject) => this.getCurrentVersion().pipe(filter((currentVersion) => currentVersion !== undefined), map((currentVersion) => {
688
+ versionsObject[`v${currentVersion}`] = versionsObject['current'];
689
+ delete versionsObject['current'];
690
+ return Object.keys(versionsObject);
691
+ }))), switchMap((versionsArray) => {
692
+ const requests = versionsArray.map((key) => {
693
+ let dateUrl = `${key}/creationYear.json`;
694
+ if (key === `v${this.currentVersion$.value}`)
695
+ dateUrl = `current/creationYear.json`;
696
+ return this.getDataFromFirebase(dateUrl).pipe(map((creationYear) => ({ key, creationYear })));
697
+ });
698
+ return forkJoin(requests).pipe(map((results) => {
699
+ const newMap = new Map();
700
+ results.forEach(({ key, creationYear }) => {
701
+ newMap.set(key, creationYear);
702
+ });
703
+ return newMap;
704
+ }));
705
+ }), tap((map) => this.versionsMap$.next(map)), catchError((error) => {
706
+ console.error('Error fetching old versions data:', error);
707
+ this.versionsMap$.error(error);
708
+ return of(undefined);
709
+ })).subscribe();
710
+ }
711
+ return this.versionsMap$.asObservable();
712
+ }
713
+ // Function to check which is the first working URL and set it as URL_BASE
714
+ checkUrls() {
715
+ return from(environment.URL_ARRAY).pipe(concatMap((url) => this.getDataFromFirebase('current/version.json').pipe(tap((version) => {
716
+ this.URL_BASE = url;
717
+ }), catchError(() => of(null)))), take(1), map((result) => result !== null));
718
+ }
719
+ // Function to get the current version of the BOK from Firebase
720
+ getCurrentVersion() {
721
+ if (!this.currentVersion$.value) {
722
+ const currentVersionUrl = 'current/version.json';
723
+ this.getDataFromFirebase(currentVersionUrl).pipe(tap((version) => {
724
+ this.currentVersion$.next(version);
725
+ }), catchError((error) => {
726
+ this.currentVersion$.error(error);
727
+ return of(undefined);
728
+ })).subscribe();
729
+ }
730
+ return this.currentVersion$.asObservable();
731
+ }
732
+ // Function to fetch data from Firebase given a URL
733
+ getDataFromFirebase(url) {
734
+ if (!this.URL_BASE) {
735
+ throw new Error('URL_BASE is not set');
736
+ }
737
+ const fullUrl = `${this.URL_BASE}${url}`;
738
+ return this.http.get(fullUrl).pipe(catchError((error) => {
739
+ console.error('There was a problem with the HTTP request:', error);
740
+ return this.checkUrls().pipe(// Aquí intentamos obtener una URL válida si falla
741
+ switchMap((isValidUrl) => {
742
+ if (isValidUrl)
743
+ return this.getDataFromFirebase(url);
744
+ else
745
+ throw error;
746
+ }));
747
+ }));
748
+ }
749
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: BokFirebaseService, deps: [{ token: i1$2.HttpClient }], target: i0.ɵɵFactoryTarget.Injectable });
750
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: BokFirebaseService, providedIn: 'root' });
751
+ }
752
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: BokFirebaseService, decorators: [{
753
+ type: Injectable,
754
+ args: [{
755
+ providedIn: 'root',
756
+ }]
757
+ }], ctorParameters: () => [{ type: i1$2.HttpClient }] });
758
+
759
+ class BokDataService {
760
+ Relationtype = {
761
+ SIMILAR: 'similarTo',
762
+ PREREQUISITE: 'prerequisites',
763
+ POSTREQUISITE: 'postrequisites',
764
+ BROADER: 'broader',
765
+ NARROWER: 'narrower',
766
+ DEMONSTRATES: 'demonstrates',
767
+ SUBCONCEPT: 'is subconcept of',
768
+ SIMILARTO: 'is similar to',
769
+ PREREQUISITEOF: 'is prerequisite of',
770
+ };
771
+ colorhash = {
772
+ GI: '#40e0d0',
773
+ IP: '#1f77b4',
774
+ CF: '#aec7e8',
775
+ CV: '#ff7f0e',
776
+ DA: '#ffbb78',
777
+ DM: '#2ca02c',
778
+ DN: '#98df8a',
779
+ PS: '#d62728',
780
+ GD: '#cc5b59',
781
+ GS: '#9467bd',
782
+ AM: '#8c564b',
783
+ MD: '#8c564b',
784
+ OI: '#c49c94',
785
+ GC: '#e377c2',
786
+ PP: '#f7b6d2',
787
+ SD: '#7f7f7f',
788
+ SH: '#c7c7c7',
789
+ TA: '#bcbd22',
790
+ WB: '#07561e',
791
+ GN: '#1ca8dd',
792
+ SC: '#ffcc00',
793
+ SA: '#ff9f4a',
794
+ no: '#17becf',
795
+ };
796
+ parsedBokData$ = new BehaviorSubject(undefined);
797
+ getParsedBokData() {
798
+ return this.parsedBokData$;
799
+ }
800
+ parseBOKData(bokJSON) {
801
+ const allNodes = [];
802
+ const namehash = {};
803
+ // Loop all nodes
804
+ for (let n = 0; n < bokJSON.concepts.length; n++) {
805
+ const newNode = new CustomD3Node({
806
+ name: bokJSON.concepts[n].name,
807
+ nameShort: bokJSON.concepts[n].code,
808
+ description: bokJSON.concepts[n].description,
809
+ selfAssesment: bokJSON.concepts[n].selfAssesment,
810
+ uri: n.toString(),
811
+ id: n.toString(),
812
+ children: [],
813
+ demonstrableSkills: [],
814
+ sourceDocuments: [],
815
+ contributors: [],
816
+ parent: null,
817
+ otherParents: [],
818
+ similarConcepts: [],
819
+ });
820
+ namehash[bokJSON.concepts[n].code] = newNode.name || '';
821
+ allNodes.push(newNode);
822
+ }
823
+ // Handle relations
824
+ for (const relation of bokJSON.relations) {
825
+ const sourceNode = allNodes[relation.source];
826
+ const targetNode = allNodes[relation.target];
827
+ if (relation.name === this.Relationtype.SUBCONCEPT) {
828
+ if (sourceNode.parent) {
829
+ sourceNode.otherParents.push(targetNode);
830
+ }
831
+ else {
832
+ sourceNode.parent = targetNode;
833
+ }
834
+ targetNode.children.push(sourceNode);
835
+ }
836
+ if (relation.name === this.Relationtype.SIMILARTO) {
837
+ targetNode.similarConcepts.push(sourceNode);
838
+ sourceNode.similarConcepts.push(targetNode);
839
+ }
840
+ if (relation.name === this.Relationtype.PREREQUISITEOF) {
841
+ targetNode.prerequisites.push(sourceNode);
842
+ }
843
+ }
844
+ // Handle skills
845
+ for (const skill of bokJSON.skills) {
846
+ for (const conceptIndex of skill.concepts) {
847
+ const node = allNodes[conceptIndex];
848
+ node.demonstrableSkills.push({
849
+ description: skill.name,
850
+ nameShort: skill.name,
851
+ uri: skill.name,
852
+ });
853
+ }
854
+ }
855
+ // Handle references
856
+ for (const reference of bokJSON.references) {
857
+ for (const conceptIndex of reference.concepts) {
858
+ const node = allNodes[conceptIndex];
859
+ node.sourceDocuments.push({
860
+ description: reference.description,
861
+ nameShort: reference.name,
862
+ url: reference.url,
863
+ });
864
+ }
865
+ }
866
+ // Handle contributors
867
+ if (Array.isArray(bokJSON.contributors)) {
868
+ for (const contributor of bokJSON.contributors) {
869
+ for (const conceptIndex of contributor.concepts) {
870
+ const node = allNodes[conceptIndex];
871
+ node.contributors.push({
872
+ description: contributor.description,
873
+ nameShort: contributor.name,
874
+ url: contributor.url,
875
+ });
876
+ node.contributors.sort((a, b) => a.nameShort.localeCompare(b.nameShort));
877
+ }
878
+ }
879
+ }
880
+ // Create and return the collection
881
+ const conceptNodeCollection = new CustomD3NodeCollection();
882
+ for (const node of allNodes) {
883
+ conceptNodeCollection.add(node);
884
+ }
885
+ const parsedData = new ParsedBokData({
886
+ nodes: allNodes[0],
887
+ relations: bokJSON.relations,
888
+ namehash,
889
+ conceptNodeCollection,
890
+ colors: this.colorhash,
891
+ });
892
+ this.parsedBokData$.next(parsedData);
893
+ return parsedData;
894
+ }
895
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: BokDataService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
896
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: BokDataService, providedIn: 'root' });
897
+ }
898
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: BokDataService, decorators: [{
899
+ type: Injectable,
900
+ args: [{
901
+ providedIn: 'root',
902
+ }]
903
+ }] });
904
+
905
+ class BokComponent {
906
+ bokFirebaseService;
907
+ bokDataService;
908
+ // Custom Spinner attributes
909
+ customSpinner;
910
+ container;
911
+ // Bubbles & Description attributes
912
+ codSelected = 'GIST';
913
+ showDescription = true;
914
+ showVersions = true;
915
+ showSearchEngine = true;
916
+ codSelectedChange = new EventEmitter();
917
+ nodeSelected;
918
+ bubbleData;
919
+ versionMap;
920
+ currentVersion;
921
+ bokVersion;
922
+ isAnOldVersion = false;
923
+ isAnObsoleteId = false;
924
+ loading = true;
925
+ // Search attributes
926
+ selectedNodes = [];
927
+ searchInputFieldDoc = '';
928
+ searchBooleans = {
929
+ searchCode: true,
930
+ searchName: true,
931
+ searchDescription: true,
932
+ searchSkills: false,
933
+ };
934
+ suggestions = [];
935
+ constructor(bokFirebaseService, bokDataService) {
936
+ this.bokFirebaseService = bokFirebaseService;
937
+ this.bokDataService = bokDataService;
938
+ }
939
+ ngOnInit() {
940
+ this.bokFirebaseService.getBokVersion('current').subscribe((bok) => {
941
+ this.bokDataService.parseBOKData(bok);
942
+ this.currentVersion = 'v' + bok.version;
943
+ this.bokVersion = this.currentVersion;
944
+ this.loading = false;
945
+ });
946
+ if (this.showVersions) {
947
+ this.bokFirebaseService.getOldVersionsData().subscribe((versionsMap) => {
948
+ if (versionsMap)
949
+ this.versionMap = versionsMap;
950
+ });
951
+ }
952
+ this.bokDataService.getParsedBokData().subscribe((parsedData) => {
953
+ this.bubbleData = parsedData;
954
+ this.onCodeSelectedChange(this.codSelected);
955
+ });
956
+ }
957
+ ngAfterViewInit() {
958
+ if (this.customSpinner) {
959
+ this.container.createComponent(this.customSpinner);
960
+ }
961
+ }
962
+ onCodeSelectedChange(newCodSelected) {
963
+ this.codSelected = newCodSelected;
964
+ // Check if the new code is obsolete
965
+ if (this.isAnOldVersion) {
966
+ this.bokFirebaseService.getBokVersion('current').subscribe(((bok) => {
967
+ this.isAnObsoleteId = !bok.concepts.some((concept) => concept.code === newCodSelected);
968
+ }));
969
+ }
970
+ else
971
+ this.isAnObsoleteId = false;
972
+ // Search the new code bubble
973
+ if (this.bubbleData) {
974
+ this.nodeSelected = this.bubbleData.conceptNodeCollection.getNodeByNameShort(newCodSelected) ?? this.bubbleData.nodes;
975
+ if (this.nodeSelected == this.bubbleData.nodes)
976
+ this.isAnObsoleteId = false;
977
+ }
978
+ this.codSelectedChange.emit(newCodSelected);
979
+ }
980
+ // Version management
981
+ onBokversionChange(newBokVersion) {
982
+ this.bokVersion = newBokVersion;
983
+ let version = this.bokVersion;
984
+ if (newBokVersion === this.currentVersion) {
985
+ version = 'current';
986
+ this.isAnOldVersion = false;
987
+ }
988
+ else {
989
+ this.isAnOldVersion = true;
990
+ }
991
+ this.loading = true;
992
+ this.bokFirebaseService.getBokVersion(version).subscribe((bok) => {
993
+ this.bokDataService.parseBOKData(bok);
994
+ this.loading = false;
995
+ this.searchBubbles();
996
+ });
997
+ }
998
+ onSearchValueChange(searchValue) {
999
+ this.searchInputFieldDoc = searchValue.trim();
1000
+ this.searchBubbles();
1001
+ }
1002
+ onSearchBooleansChange(searchBooleans) {
1003
+ this.searchBooleans = searchBooleans;
1004
+ this.searchBubbles();
1005
+ }
1006
+ // TODO [priority: Low] Improve the search process performance. (2025-01-16)
1007
+ searchBubbles() {
1008
+ if (this.bubbleData) {
1009
+ if (this.searchInputFieldDoc != "" && this.searchInputFieldDoc != " ") {
1010
+ this.selectedNodes = this.bubbleData.conceptNodeCollection.getNodesIdByKeyword(this.searchInputFieldDoc, this.searchBooleans.searchCode, this.searchBooleans.searchName, this.searchBooleans.searchDescription, this.searchBooleans.searchSkills);
1011
+ this.suggestions = this.bubbleData.conceptNodeCollection.getNodesByKeyword(this.searchInputFieldDoc, this.searchBooleans.searchCode, this.searchBooleans.searchName, this.searchBooleans.searchDescription, this.searchBooleans.searchSkills);
1012
+ }
1013
+ else {
1014
+ this.selectedNodes = [];
1015
+ this.suggestions = [];
1016
+ }
1017
+ }
1018
+ }
1019
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: BokComponent, deps: [{ token: BokFirebaseService }, { token: BokDataService }], target: i0.ɵɵFactoryTarget.Component });
1020
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.1", type: BokComponent, isStandalone: true, selector: "bok-visualization", inputs: { customSpinner: "customSpinner", codSelected: ["selectedConcept", "codSelected"], showDescription: "showDescription", showVersions: "showVersions", showSearchEngine: "showSearchEngine" }, outputs: { codSelectedChange: "selectedConceptChange" }, viewQueries: [{ propertyName: "container", first: true, predicate: ["container"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: "<div *ngIf=\"!loading; else spinner\">\r\n <div *ngIf=\"showSearchEngine && this.bubbleData\" class=\"flex justify-content-center\">\r\n <search [inputValue]=\"searchInputFieldDoc\" [searchBooleans]=\"searchBooleans\" (inputValueChange)=\"onSearchValueChange($event)\" \r\n (searchSettingsChange)=\"onSearchBooleansChange($event)\" [suggestions]=\"suggestions\" (codSelectedChange)=\"onCodeSelectedChange($event)\"></search>\r\n </div>\r\n <div class=\"flex flex-wrap\">\r\n <div class=\"flex-1 p-3\" *ngIf=\"bubbleData\">\r\n <bubble [bokData]=\"bubbleData\" [codSelected]=\"codSelected\" [selectedNodes]=\"selectedNodes\" (codSelectedChange)=\"onCodeSelectedChange($event)\"></bubble>\r\n </div>\r\n <div class=\"flex-1 p-3 overflow-auto min-w-screen xl:min-w-0\" *ngIf=\"nodeSelected && showDescription\">\r\n <description [bokNode]=\"nodeSelected\" [showVersions]=\"showVersions\" [versionMap]=\"versionMap\" \r\n [bokVersion]=\"bokVersion\" [currentVersion]=\"currentVersion\" (codSelectedChange)=\"onCodeSelectedChange($event)\"\r\n (bokVersionChange)=\"onBokversionChange($event)\" [isAnOldVersion]=\"isAnOldVersion\"\r\n [isAnObsoleteId]=\"isAnObsoleteId\"></description>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<ng-template #spinner>\r\n <div class=\"flex justify-content-center align-content-center\" style=\"min-height: 100vh\">\r\n <ng-container #container></ng-container>\r\n <p-progress-spinner *ngIf=\"!customSpinner\" strokeWidth=\"3\" ariaLabel=\"loading\" class=\"flex align-items-center justify-content-center\" />\r\n </div>\r\n</ng-template>\r\n", styles: [""], dependencies: [{ kind: "component", type: BubbleComponent, selector: "bubble", inputs: ["bokData", "COLOR_STROKE_SELECTED", "margin", "codSelected", "selectedNodes"], outputs: ["codSelectedChange"] }, { kind: "component", type: DescriptionComponent, selector: "description", inputs: ["bokNode", "isAnOldVersion", "isAnObsoleteId", "showVersions", "versionMap", "currentVersion", "bokVersion"], outputs: ["codSelectedChange", "bokVersionChange"] }, { kind: "component", type: SearchComponent, selector: "search", inputs: ["inputValue", "searchBooleans", "suggestions"], outputs: ["inputValueChange", "searchSettingsChange", "codSelectedChange"] }, { kind: "ngmodule", type: ProgressSpinnerModule }, { kind: "component", type: i3$1.ProgressSpinner, selector: "p-progressSpinner, p-progress-spinner, p-progressspinner", inputs: ["styleClass", "style", "strokeWidth", "fill", "animationDuration", "ariaLabel"] }, { kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
1021
+ }
1022
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.1", ngImport: i0, type: BokComponent, decorators: [{
1023
+ type: Component,
1024
+ args: [{ standalone: true, selector: 'bok-visualization', imports: [BubbleComponent, DescriptionComponent, SearchComponent, ProgressSpinnerModule, CommonModule], template: "<div *ngIf=\"!loading; else spinner\">\r\n <div *ngIf=\"showSearchEngine && this.bubbleData\" class=\"flex justify-content-center\">\r\n <search [inputValue]=\"searchInputFieldDoc\" [searchBooleans]=\"searchBooleans\" (inputValueChange)=\"onSearchValueChange($event)\" \r\n (searchSettingsChange)=\"onSearchBooleansChange($event)\" [suggestions]=\"suggestions\" (codSelectedChange)=\"onCodeSelectedChange($event)\"></search>\r\n </div>\r\n <div class=\"flex flex-wrap\">\r\n <div class=\"flex-1 p-3\" *ngIf=\"bubbleData\">\r\n <bubble [bokData]=\"bubbleData\" [codSelected]=\"codSelected\" [selectedNodes]=\"selectedNodes\" (codSelectedChange)=\"onCodeSelectedChange($event)\"></bubble>\r\n </div>\r\n <div class=\"flex-1 p-3 overflow-auto min-w-screen xl:min-w-0\" *ngIf=\"nodeSelected && showDescription\">\r\n <description [bokNode]=\"nodeSelected\" [showVersions]=\"showVersions\" [versionMap]=\"versionMap\" \r\n [bokVersion]=\"bokVersion\" [currentVersion]=\"currentVersion\" (codSelectedChange)=\"onCodeSelectedChange($event)\"\r\n (bokVersionChange)=\"onBokversionChange($event)\" [isAnOldVersion]=\"isAnOldVersion\"\r\n [isAnObsoleteId]=\"isAnObsoleteId\"></description>\r\n </div>\r\n </div>\r\n</div>\r\n\r\n<ng-template #spinner>\r\n <div class=\"flex justify-content-center align-content-center\" style=\"min-height: 100vh\">\r\n <ng-container #container></ng-container>\r\n <p-progress-spinner *ngIf=\"!customSpinner\" strokeWidth=\"3\" ariaLabel=\"loading\" class=\"flex align-items-center justify-content-center\" />\r\n </div>\r\n</ng-template>\r\n" }]
1025
+ }], ctorParameters: () => [{ type: BokFirebaseService }, { type: BokDataService }], propDecorators: { customSpinner: [{
1026
+ type: Input
1027
+ }], container: [{
1028
+ type: ViewChild,
1029
+ args: ['container', { read: ViewContainerRef, static: false }]
1030
+ }], codSelected: [{
1031
+ type: Input,
1032
+ args: ['selectedConcept']
1033
+ }], showDescription: [{
1034
+ type: Input
1035
+ }], showVersions: [{
1036
+ type: Input
1037
+ }], showSearchEngine: [{
1038
+ type: Input
1039
+ }], codSelectedChange: [{
1040
+ type: Output,
1041
+ args: ['selectedConceptChange']
1042
+ }] } });
1043
+
1044
+ /*
1045
+ * Public API Surface of ngx-bok-visualization
1046
+ */
1047
+
1048
+ /**
1049
+ * Generated bundle index. Do not edit.
1050
+ */
1051
+
1052
+ export { BokComponent };
1053
+ //# sourceMappingURL=eo4geo-ngx-bok-visualization.mjs.map