@myrmidon/cadmus-graph-ui-ex 0.0.3 → 1.0.2

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.
Files changed (31) hide show
  1. package/esm2022/lib/cadmus-graph-ui-ex.module.mjs +147 -0
  2. package/esm2022/lib/components/graph-walker/graph-walker.component.mjs +130 -0
  3. package/esm2022/lib/components/linked-literal-filter/linked-literal-filter.component.mjs +142 -0
  4. package/esm2022/lib/components/linked-node-filter/linked-node-filter.component.mjs +179 -0
  5. package/esm2022/lib/components/triple-filter/triple-filter.component.mjs +220 -0
  6. package/esm2022/lib/graph-walker.mjs +728 -0
  7. package/esm2022/lib/pipes/graph-node-label.pipe.mjs +30 -0
  8. package/{esm2020 → esm2022}/myrmidon-cadmus-graph-ui-ex.mjs +4 -4
  9. package/{esm2020 → esm2022}/public-api.mjs +10 -10
  10. package/{fesm2020 → fesm2022}/myrmidon-cadmus-graph-ui-ex.mjs +1460 -1447
  11. package/fesm2022/myrmidon-cadmus-graph-ui-ex.mjs.map +1 -0
  12. package/index.d.ts +5 -5
  13. package/lib/cadmus-graph-ui-ex.module.d.ts +34 -34
  14. package/lib/components/graph-walker/graph-walker.component.d.ts +66 -57
  15. package/lib/components/linked-literal-filter/linked-literal-filter.component.d.ts +58 -58
  16. package/lib/components/linked-node-filter/linked-node-filter.component.d.ts +62 -62
  17. package/lib/components/triple-filter/triple-filter.component.d.ts +68 -68
  18. package/lib/graph-walker.d.ts +251 -251
  19. package/lib/pipes/graph-node-label.pipe.d.ts +13 -13
  20. package/package.json +8 -14
  21. package/public-api.d.ts +7 -7
  22. package/esm2020/lib/cadmus-graph-ui-ex.module.mjs +0 -146
  23. package/esm2020/lib/components/graph-walker/graph-walker.component.mjs +0 -119
  24. package/esm2020/lib/components/linked-literal-filter/linked-literal-filter.component.mjs +0 -141
  25. package/esm2020/lib/components/linked-node-filter/linked-node-filter.component.mjs +0 -178
  26. package/esm2020/lib/components/triple-filter/triple-filter.component.mjs +0 -219
  27. package/esm2020/lib/graph-walker.mjs +0 -725
  28. package/esm2020/lib/pipes/graph-node-label.pipe.mjs +0 -29
  29. package/fesm2015/myrmidon-cadmus-graph-ui-ex.mjs +0 -1520
  30. package/fesm2015/myrmidon-cadmus-graph-ui-ex.mjs.map +0 -1
  31. package/fesm2020/myrmidon-cadmus-graph-ui-ex.mjs.map +0 -1
@@ -1,1520 +0,0 @@
1
- import * as i0 from '@angular/core';
2
- import { EventEmitter, Component, Input, Output, Pipe, NgModule } from '@angular/core';
3
- import { BehaviorSubject, forkJoin, from, Subject, take as take$1 } from 'rxjs';
4
- import { take } from 'rxjs/operators';
5
- import * as i3 from '@myrmidon/cadmus-api';
6
- import { CadmusApiModule } from '@myrmidon/cadmus-api';
7
- import * as i2$1 from '@myrmidon/ng-mat-tools';
8
- import { NgMatToolsModule } from '@myrmidon/ng-mat-tools';
9
- import * as i4 from '@angular/common';
10
- import { CommonModule } from '@angular/common';
11
- import * as i5 from '@angular/material/button';
12
- import { MatButtonModule } from '@angular/material/button';
13
- import * as i7 from '@angular/material/icon';
14
- import { MatIconModule } from '@angular/material/icon';
15
- import * as i6$1 from '@angular/material/progress-bar';
16
- import { MatProgressBarModule } from '@angular/material/progress-bar';
17
- import * as i7$2 from '@angular/material/tabs';
18
- import { MatTabsModule } from '@angular/material/tabs';
19
- import * as i10 from '@angular/material/tooltip';
20
- import { MatTooltipModule } from '@angular/material/tooltip';
21
- import * as i9$1 from '@swimlane/ngx-graph';
22
- import { NgxGraphModule } from '@swimlane/ngx-graph';
23
- import * as i1 from '@angular/forms';
24
- import { FormsModule, ReactiveFormsModule } from '@angular/forms';
25
- import * as i2 from '@myrmidon/cadmus-graph-ui';
26
- import { CadmusGraphUiModule } from '@myrmidon/cadmus-graph-ui';
27
- import * as i6 from '@angular/material/form-field';
28
- import { MatFormFieldModule } from '@angular/material/form-field';
29
- import * as i8 from '@angular/material/input';
30
- import { MatInputModule } from '@angular/material/input';
31
- import * as i9 from '@angular/material/paginator';
32
- import { MatPaginatorModule } from '@angular/material/paginator';
33
- import * as i11 from '@myrmidon/cadmus-refs-lookup';
34
- import { CadmusRefsLookupModule } from '@myrmidon/cadmus-refs-lookup';
35
- import * as i5$1 from '@angular/material/core';
36
- import * as i7$1 from '@angular/material/checkbox';
37
- import { MatCheckboxModule } from '@angular/material/checkbox';
38
- import * as i8$1 from '@angular/material/chips';
39
- import { MatChipsModule } from '@angular/material/chips';
40
- import * as i13 from '@angular/material/select';
41
- import { MatSelectModule } from '@angular/material/select';
42
- import * as i10$1 from '@angular/material/list';
43
- import { MatListModule } from '@angular/material/list';
44
- import { HttpClientModule } from '@angular/common/http';
45
- import { MatAutocompleteModule } from '@angular/material/autocomplete';
46
- import { NgToolsModule } from '@myrmidon/ng-tools';
47
- import { CadmusCoreModule } from '@myrmidon/cadmus-core';
48
-
49
- //#endregion
50
- /**
51
- * Graph walker.
52
- * This class encapsulates data used for interactively exploring a graph
53
- * starting from a designated origin node.
54
- */
55
- class GraphWalker {
56
- /**
57
- * The nodes of the walker graph, which can represent nodes, literals,
58
- * or property groups. You can easily determine the type of each node
59
- * by looking at the first character of its id (N=node, L=literal,
60
- * P=property).
61
- */
62
- get nodes$() {
63
- return this._nodes$.asObservable();
64
- }
65
- /**
66
- * The edges connecting nodes.
67
- */
68
- get edges$() {
69
- return this._edges$.asObservable();
70
- }
71
- /**
72
- * True if the walker is loading data.
73
- */
74
- get loading$() {
75
- return this._loading$.asObservable();
76
- }
77
- /**
78
- * The last error occurred in communicating with the server, if any.
79
- */
80
- get error$() {
81
- return this._error$.asObservable();
82
- }
83
- /**
84
- * The selected node. Only one node at a time can be selected.
85
- */
86
- get selectedNode$() {
87
- return this._selectedNode$.asObservable();
88
- }
89
- /**
90
- * The outbound linked nodes filter for the selected P node.
91
- */
92
- get pOutFilter$() {
93
- return this._pOutFilter$.asObservable();
94
- }
95
- /**
96
- * The inbound linked nodes filter for the selected P node.
97
- */
98
- get pInFilter$() {
99
- return this._pInFilter$.asObservable();
100
- }
101
- /**
102
- * The literal linked nodes filter for the selected P node.
103
- */
104
- get pLitFilter$() {
105
- return this._pLitFilter$.asObservable();
106
- }
107
- /**
108
- * The outbound triples filter for the selected N node.
109
- */
110
- get nOutFilter$() {
111
- return this._nOutFilter$.asObservable();
112
- }
113
- /**
114
- * The inbound triples filter for the selected N node.
115
- */
116
- get nInFilter$() {
117
- return this._nInFilter$.asObservable();
118
- }
119
- /**
120
- * The total items fetched for each filter of the selected node.
121
- */
122
- get childTotals$() {
123
- return this._childTotals$.asObservable();
124
- }
125
- constructor(_graphService) {
126
- this._graphService = _graphService;
127
- this._nodes$ = new BehaviorSubject([]);
128
- this._edges$ = new BehaviorSubject([]);
129
- this._loading$ = new BehaviorSubject(false);
130
- this._error$ = new BehaviorSubject(null);
131
- this._selectedNode$ = new BehaviorSubject(null);
132
- this._pOutFilter$ = new BehaviorSubject(null);
133
- this._pInFilter$ = new BehaviorSubject(null);
134
- this._pLitFilter$ = new BehaviorSubject(null);
135
- this._nOutFilter$ = new BehaviorSubject(null);
136
- this._nInFilter$ = new BehaviorSubject(null);
137
- this._childTotals$ = new BehaviorSubject({
138
- nOut: 0,
139
- nIn: 0,
140
- pOut: 0,
141
- pIn: 0,
142
- pLit: 0,
143
- });
144
- // defaults
145
- this.pageSize = 10;
146
- this.maxLiteralLen = 30;
147
- }
148
- getSelectedNode() {
149
- return this._selectedNode$.value;
150
- }
151
- toggleLoading(on) {
152
- if (on) {
153
- this._error$.next(null);
154
- this._loading$.next(true);
155
- }
156
- else {
157
- this._loading$.next(false);
158
- }
159
- }
160
- setError(error) {
161
- if (error) {
162
- if (typeof error === 'string') {
163
- this._error$.next(error);
164
- console.error(error);
165
- }
166
- else {
167
- this._error$.next('Walker error');
168
- console.error(JSON.stringify(error));
169
- }
170
- }
171
- else {
172
- this._error$.next('Walker error');
173
- }
174
- }
175
- buildNodeId(id) {
176
- return `N${id}`;
177
- }
178
- /**
179
- * Get the numeric ID of the data node being the source of the graph node
180
- * with the specified ID.
181
- *
182
- * @param id The graph node ID (...N + its data node numeric ID)
183
- * @returns The data node numeric ID.
184
- */
185
- getNodeNumericId(id) {
186
- const i = id.indexOf('N');
187
- return i === -1 ? 0 : +id.substring(i + 1);
188
- }
189
- getPredicateNumericId(id) {
190
- const i = id.indexOf('P');
191
- const j = id.indexOf('N');
192
- return i === -1 ? 0 : +id.substring(i + 1, j);
193
- }
194
- buildEdgeId(source, target) {
195
- return `E${source}_${target}`;
196
- }
197
- buildPropertyId(predicateId, nodeId) {
198
- return `P${predicateId}N${nodeId}`;
199
- }
200
- buildLiteralId(tripleId) {
201
- return `L${tripleId}`;
202
- }
203
- scale(n, domainMin, domainMax, rangeMin, rangeMax) {
204
- // https://stackoverflow.com/questions/5294955/how-to-scale-down-a-range-of-numbers-with-a-known-min-and-max-value
205
- return (((domainMax - domainMin) * (n - rangeMin)) / (rangeMax - rangeMin) +
206
- domainMin);
207
- }
208
- addEdgeIfAbsent(edge, edges) {
209
- const id = edge.id;
210
- if (edges.some((e) => e.id === id)) {
211
- return;
212
- }
213
- const i = id.indexOf('_');
214
- if (i > -1) {
215
- const invId = 'E' + id.substring(i + 1) + '_' + id.substring(1, i);
216
- if (edges.some((e) => e.id === invId)) {
217
- return;
218
- }
219
- }
220
- edges.push(edge);
221
- }
222
- resetFilters() {
223
- this._nOutFilter$.next(null);
224
- this._nInFilter$.next(null);
225
- this._pOutFilter$.next(null);
226
- this._pInFilter$.next(null);
227
- this._pLitFilter$.next(null);
228
- this._childTotals$.next({
229
- nOut: 0,
230
- nIn: 0,
231
- pOut: 0,
232
- pIn: 0,
233
- pLit: 0,
234
- });
235
- }
236
- /**
237
- * Select the specified node. This also implies updating all the current
238
- * filters, which depend on the selected node.
239
- *
240
- * @param id The node ID or null to deselect the selected node.
241
- */
242
- selectNode(id) {
243
- const node = id ? this._nodes$.value.find((n) => n.id === id) : null;
244
- if (!node) {
245
- this._selectedNode$.next(null);
246
- this.resetFilters();
247
- return;
248
- }
249
- // deselect
250
- const old = this._nodes$.value.find((n) => { var _a; return (_a = n.data) === null || _a === void 0 ? void 0 : _a.selected; });
251
- if (old) {
252
- old.data.selected = undefined;
253
- }
254
- // select
255
- node.data.selected = true;
256
- this._selectedNode$.next(node);
257
- switch (node.id.charAt(0)) {
258
- case 'N': // non-literal node
259
- const nd = node.data;
260
- this._nOutFilter$.next(nd.outFilter);
261
- this._nInFilter$.next(nd.inFilter);
262
- this._pOutFilter$.next(null);
263
- this._pInFilter$.next(null);
264
- this._pLitFilter$.next(null);
265
- this._childTotals$.next({
266
- nOut: nd.outTotal || 0,
267
- nIn: nd.inTotal || 0,
268
- pOut: 0,
269
- pIn: 0,
270
- pLit: 0,
271
- });
272
- break;
273
- case 'P': // props group
274
- const pd = node.data;
275
- this._nOutFilter$.next(null);
276
- this._nInFilter$.next(null);
277
- this._pOutFilter$.next(pd.outFilter);
278
- this._pInFilter$.next(pd.inFilter);
279
- this._pLitFilter$.next(pd.litFilter);
280
- this._childTotals$.next({
281
- nOut: 0,
282
- nIn: 0,
283
- pOut: pd.outTotal || 0,
284
- pIn: pd.inTotal || 0,
285
- pLit: pd.litTotal || 0,
286
- });
287
- break;
288
- case 'L': // literal node
289
- this.resetFilters();
290
- break;
291
- }
292
- }
293
- /**
294
- * Reset the graph setting its origin to the specified node.
295
- *
296
- * @param id The ID of the origin node to start from ("root origin").
297
- */
298
- reset(id) {
299
- this.toggleLoading(true);
300
- this._graphService
301
- .getNode(id)
302
- .pipe(take(1))
303
- .subscribe({
304
- next: (node) => {
305
- const nodes = [];
306
- const data = {
307
- uri: node.uri,
308
- sourceType: node.sourceType,
309
- originId: '',
310
- customColor: '#F89427',
311
- outFilter: {
312
- pageNumber: 1,
313
- pageSize: this.pageSize,
314
- },
315
- inFilter: {
316
- pageNumber: 1,
317
- pageSize: this.pageSize,
318
- },
319
- };
320
- const n = {
321
- id: this.buildNodeId(node.id),
322
- label: node.label || node.uri,
323
- data: data,
324
- };
325
- nodes.push(n);
326
- this._rootNode = n;
327
- this._edges$.next([]);
328
- this._nodes$.next(nodes);
329
- this.expandNode(n);
330
- },
331
- error: (error) => {
332
- this.setError(error);
333
- },
334
- complete: () => {
335
- this.toggleLoading(false);
336
- },
337
- });
338
- }
339
- /**
340
- * Get the source and target graph nodes IDs from the specified edge ID.
341
- *
342
- * @param edgeId The ID of the edge graph node.
343
- * @returns IDs of the source and target graph nodes.
344
- */
345
- getEdgeEndIds(edgeId) {
346
- const m = new RegExp('^E([^_]+)_(.+)$').exec(edgeId);
347
- return m ? [m[1], m[2]] : null;
348
- }
349
- /**
350
- * Remove all the nodes with the specified origin node ID.
351
- *
352
- * @param originId The ID of the origin graph node.
353
- * @param nodes The nodes array to remove nodes from.
354
- * @param removedIds The IDs of all the removed nodes.
355
- */
356
- removeDescendantNodes(originId, nodes, removedIds) {
357
- const ids = new Set();
358
- for (let i = nodes.length - 1; i > -1; i--) {
359
- if (nodes[i].data.originId === originId) {
360
- ids.add(nodes[i].id);
361
- nodes.splice(i, 1);
362
- }
363
- }
364
- // recurse for each removed node
365
- // (edges never derive from other edges directly)
366
- ids.forEach((id) => {
367
- this.removeDescendantNodes(id, nodes, removedIds);
368
- });
369
- // update the received IDs set
370
- ids.forEach((id) => {
371
- removedIds.add(id);
372
- });
373
- }
374
- /**
375
- * Remove all the children graph nodes of the specified origin graph node.
376
- *
377
- * @param originId The ID of the origin graph node.
378
- * @param nodes The nodes array to remove nodes from.
379
- * @param edges The edges array to remove edges from.
380
- */
381
- removeChildren(originId, nodes, edges) {
382
- var _a;
383
- const selectedId = (_a = this._selectedNode$.value) === null || _a === void 0 ? void 0 : _a.id;
384
- // remove all the nodes whose origin ID matches,
385
- // collecting their IDs
386
- const removedIds = new Set();
387
- this.removeDescendantNodes(originId, nodes, removedIds);
388
- // remove all the affected edges
389
- for (let i = edges.length - 1; i > -1; i--) {
390
- const endIds = this.getEdgeEndIds(edges[i].id);
391
- if ((endIds === null || endIds === void 0 ? void 0 : endIds.length) &&
392
- (removedIds.has(endIds[0]) || removedIds.has(endIds[1]))) {
393
- edges.splice(i, 1);
394
- }
395
- }
396
- // if the removed node was the selected one, select the root origin
397
- if (selectedId && removedIds.has(selectedId)) {
398
- this.selectNode(this._rootNode.id);
399
- }
400
- }
401
- /**
402
- * Build a new graph node representing a property.
403
- *
404
- * @param sourceId The source node ID.
405
- * @param group The triple group emitting this node.
406
- * @returns A new graph node.
407
- */
408
- buildPropertyNode(sourceId, group) {
409
- const nid = this.getNodeNumericId(sourceId);
410
- const data = {
411
- originId: sourceId,
412
- uri: group.predicateUri,
413
- customColor: '#FF5619',
414
- outFilter: {
415
- pageNumber: 1,
416
- pageSize: this.pageSize,
417
- otherNodeId: nid,
418
- predicateId: group.predicateId,
419
- },
420
- inFilter: {
421
- pageNumber: 1,
422
- pageSize: this.pageSize,
423
- otherNodeId: nid,
424
- predicateId: group.predicateId,
425
- },
426
- litFilter: {
427
- pageNumber: 1,
428
- pageSize: this.pageSize,
429
- predicateId: group.predicateId,
430
- },
431
- };
432
- return {
433
- id: this.buildPropertyId(group.predicateId, nid),
434
- label: group.count.toString(),
435
- data: data,
436
- };
437
- }
438
- /**
439
- * Expand the specified node, by loading its property groups.
440
- *
441
- * @param node The node to expand.
442
- * @param outFilter The properties to update for the output filter.
443
- * @param inFilter The properties to update for the input filter.
444
- */
445
- expandNode(node, outFilter, inFilter) {
446
- // prepare filters
447
- const nid = this.getNodeNumericId(node.id);
448
- // outbound: node=S
449
- const outf = outFilter
450
- ? Object.assign(node.data.outFilter, outFilter, {
451
- subjectId: nid,
452
- })
453
- : {
454
- pageNumber: 1,
455
- pageSize: this.pageSize,
456
- subjectId: nid,
457
- };
458
- // inbound: node=O
459
- const inf = inFilter
460
- ? Object.assign(node.data.inFilter, inFilter, {
461
- objectId: nid,
462
- })
463
- : {
464
- pageNumber: 1,
465
- pageSize: this.pageSize,
466
- objectId: nid,
467
- };
468
- // load
469
- this.toggleLoading(true);
470
- const nodes = [...this._nodes$.value];
471
- const edges = [...this._edges$.value];
472
- forkJoin({
473
- outs: this._graphService.getTripleGroups(outf),
474
- ins: this._graphService.getTripleGroups(inf),
475
- }).subscribe({
476
- next: (result) => {
477
- node.data.expanded = true;
478
- // update origin's filters
479
- node.data.outFilter = outf;
480
- node.data.inFilter = inf;
481
- // remove previous children
482
- this.removeChildren(node.id, nodes, edges);
483
- // add outbound children
484
- node.data.outTotal = result.outs.total;
485
- for (let i = 0; i < result.outs.items.length; i++) {
486
- const group = result.outs.items[i];
487
- const prop = this.buildPropertyNode(node.id, group);
488
- // when expanding a node (e.g. N17) into props, the prop's ID is
489
- // P + predicate ID + N + origin node ID (e.g. P30N17).
490
- // This prop node can then be expanded, too, thus producing
491
- // a node with ID = N + node ID. When this in turn gets expanded,
492
- // it will produce also the prop node it comes from, which
493
- // must not be re-inserted in the graph. This node in the new
494
- // expansion context will get ID from the source node, which
495
- // is different from the node at the other end of the prop node:
496
- // this was e.g. N17, while the new node is e.g. N18. So, the
497
- // prop previously identified as P30N17 would now be identified
498
- // as P30N18, thus producing a duplicate. To avoid this, we
499
- // calculate an alias ID from the origin's origin: for N18,
500
- // its origin being P30N17, this will be N17. This produces an
501
- // alias P30N17, which being already present will avoid duplicates.
502
- const aliasId = `P${group.predicateId}N${this.getNodeNumericId(node.data.originId)}`;
503
- if (!nodes.some((n) => n.id === prop.id || n.id === aliasId)) {
504
- nodes.push(prop);
505
- // edge from origin node to object property
506
- const edge = {
507
- id: this.buildEdgeId(node.id, prop.id),
508
- label: group.predicateUri,
509
- source: node.id,
510
- target: prop.id,
511
- data: {
512
- originId: node.id,
513
- },
514
- };
515
- this.addEdgeIfAbsent(edge, edges);
516
- }
517
- }
518
- // add inbound children
519
- node.data.inTotal = result.ins.total;
520
- for (let i = 0; i < result.ins.items.length; i++) {
521
- const g = result.ins.items[i];
522
- // subject property
523
- const p = this.buildPropertyNode(node.id, g);
524
- // edge from object property to origin node
525
- const edge = {
526
- id: this.buildEdgeId(p.id, node.id),
527
- label: g.predicateUri,
528
- source: p.id,
529
- target: node.id,
530
- data: {
531
- originId: node.id,
532
- },
533
- };
534
- // do not add an edge having the same source P and target N,
535
- // whatever the P's source node
536
- const r = new RegExp('^EP' + g.predicateId + 'N[0-9]+_' + node.id + '$');
537
- if (!edges.some((e) => r.test(e.id))) {
538
- if (!nodes.some((n) => n.id === p.id)) {
539
- nodes.push(p);
540
- }
541
- this.addEdgeIfAbsent(edge, edges);
542
- }
543
- }
544
- // update
545
- this._nodes$.next(nodes);
546
- this._edges$.next(edges);
547
- },
548
- error: (error) => {
549
- node.data.error = 'Error loading properties';
550
- this._nodes$.next(nodes);
551
- this.setError(error);
552
- },
553
- complete: () => {
554
- this.toggleLoading(false);
555
- },
556
- });
557
- }
558
- /**
559
- * Expand the selected node, by loading its property groups.
560
- *
561
- * @param outFilter The properties to update for the output filter.
562
- * @param inFilter The properties to update for the input filter.
563
- */
564
- expandSelectedNode(outFilter, inFilter) {
565
- if (!this._selectedNode$.value ||
566
- !this._selectedNode$.value.id.startsWith('N')) {
567
- return;
568
- }
569
- const node = this._selectedNode$.value;
570
- this.expandNode(node, outFilter, inFilter);
571
- }
572
- buildLiteralLabel(triple) {
573
- let value = triple.objectLiteral || '';
574
- if (this.maxLiteralLen && value.length > this.maxLiteralLen) {
575
- value = value.substring(0, this.maxLiteralLen) + '\u2026';
576
- }
577
- return value;
578
- }
579
- buildNonLiteralNode(sourceId, node) {
580
- const nid = this.getNodeNumericId(sourceId);
581
- const data = {
582
- originId: sourceId,
583
- customColor: '#80ff95',
584
- uri: node.uri,
585
- sourceType: node.sourceType,
586
- isClass: node.isClass,
587
- sid: node.sid,
588
- tag: node.tag,
589
- outFilter: {
590
- pageNumber: 0,
591
- pageSize: this.pageSize,
592
- subjectId: nid,
593
- },
594
- inFilter: {
595
- pageNumber: 0,
596
- pageSize: this.pageSize,
597
- objectId: nid,
598
- },
599
- };
600
- return {
601
- id: this.buildNodeId(node.id),
602
- label: node.label,
603
- data: data,
604
- };
605
- }
606
- buildLiteralNode(sourceId, triple) {
607
- const data = {
608
- originId: sourceId,
609
- customColor: '#ebe2e0',
610
- value: triple.objectLiteral || '',
611
- type: triple.literalType,
612
- language: triple.literalLanguage,
613
- number: triple.literalNumber,
614
- };
615
- return {
616
- id: this.buildLiteralId(triple.id),
617
- label: this.buildLiteralLabel(triple),
618
- data: data,
619
- };
620
- }
621
- /**
622
- * Expand the currently selected properties group node, by loading its
623
- * outbound nodes, inbound nodes, and literal nodes.
624
- *
625
- * @param node The property group node to expand.
626
- * @param outFilter The properties to update for the outbound nodes filter.
627
- * @param inFilter The properties to update for the inbound nodes filter.
628
- * @param litFilter The properties to update for the literal nodes filter.
629
- */
630
- expandProperty(node, outFilter, inFilter, litFilter) {
631
- // prepare filters
632
- const nid = this.getNodeNumericId(node.id);
633
- const data = node.data;
634
- const outf = Object.assign(data.outFilter, outFilter || {}, { isObject: true });
635
- const inf = Object.assign(data.inFilter, inFilter || {}, {
636
- isObject: false,
637
- });
638
- const litf = Object.assign(data.litFilter, litFilter || {}, { subjectId: nid, predicateId: this.getPredicateNumericId(node.id) });
639
- // load
640
- this.toggleLoading(true);
641
- const nodes = [...this._nodes$.value];
642
- const edges = [...this._edges$.value];
643
- forkJoin({
644
- outs: this._graphService.getLinkedNodes(outf),
645
- ins: this._graphService.getLinkedNodes(inf),
646
- lits: this._graphService.getLinkedLiterals(litf),
647
- }).subscribe({
648
- next: (result) => {
649
- node.data.expanded = true;
650
- // update origin's filters
651
- node.data.outFilter = outf;
652
- node.data.inFilter = inf;
653
- node.data.litFilter = litf;
654
- // remove previous children
655
- this.removeChildren(node.id, nodes, edges);
656
- // add outbound children
657
- node.data.outTotal = result.outs.total;
658
- for (let i = 0; i < result.outs.items.length; i++) {
659
- const child = result.outs.items[i];
660
- const obj = this.buildNonLiteralNode(node.id, child);
661
- if (!nodes.some((n) => n.id === obj.id)) {
662
- nodes.push(obj);
663
- }
664
- // edge from property to non literal object node
665
- const edge = {
666
- id: this.buildEdgeId(node.id, obj.id),
667
- label: '',
668
- source: node.id,
669
- target: obj.id,
670
- data: {
671
- originId: node.id,
672
- },
673
- };
674
- this.addEdgeIfAbsent(edge, edges);
675
- }
676
- // add inbound children
677
- node.data.inTotal = result.ins.total;
678
- for (let i = 0; i < result.ins.items.length; i++) {
679
- const child = result.ins.items[i];
680
- const subj = this.buildNonLiteralNode(node.id, child);
681
- if (!nodes.some((n) => n.id === subj.id)) {
682
- nodes.push(subj);
683
- }
684
- // edge from subject node to property
685
- const edge = {
686
- id: this.buildEdgeId(subj.id, node.id),
687
- label: '',
688
- source: subj.id,
689
- target: node.id,
690
- data: {
691
- originId: node.id,
692
- },
693
- };
694
- this.addEdgeIfAbsent(edge, edges);
695
- }
696
- // add literal children
697
- node.data.litTotal = result.lits.total;
698
- for (let i = 0; i < result.lits.items.length; i++) {
699
- const triple = result.lits.items[i];
700
- const lit = this.buildLiteralNode(node.id, triple);
701
- if (!nodes.some((n) => n.id === lit.id)) {
702
- nodes.push(lit);
703
- }
704
- // edge from property to literal
705
- const edge = {
706
- id: this.buildEdgeId(node.id, lit.id),
707
- label: lit.data.literalType || '',
708
- source: node.id,
709
- target: lit.id,
710
- data: {
711
- originId: node.id,
712
- },
713
- };
714
- this.addEdgeIfAbsent(edge, edges);
715
- }
716
- // update
717
- this._nodes$.next(nodes);
718
- this._edges$.next(edges);
719
- },
720
- error: (error) => {
721
- node.data.error = 'Error loading nodes';
722
- this._nodes$.next(nodes);
723
- this.setError(error);
724
- },
725
- complete: () => {
726
- this.toggleLoading(false);
727
- },
728
- });
729
- }
730
- /**
731
- * Expand the currently selected properties group node, by loading its
732
- * outbound nodes, inbound nodes, and literal nodes. If there is no
733
- * selection, or the selected node is not a properties group node, nothing
734
- * is done.
735
- *
736
- * @param outFilter The properties to update for the outbound nodes filter.
737
- * @param inFilter The properties to update for the inbound nodes filter.
738
- * @param litFilter The properties to update for the literal nodes filter.
739
- */
740
- expandSelectedProperty(outFilter, inFilter, litFilter) {
741
- if (!this._selectedNode$.value ||
742
- !this._selectedNode$.value.id.startsWith('P')) {
743
- return;
744
- }
745
- const node = this._selectedNode$.value;
746
- this.expandProperty(node, outFilter, inFilter, litFilter);
747
- }
748
- /**
749
- * Toggle the specified node by expanding or collapsing it.
750
- *
751
- * @param node The node to toggle.
752
- */
753
- toggleNode(node) {
754
- if (node.data.expanded) {
755
- const nodes = [...this._nodes$.value];
756
- const edges = [...this._edges$.value];
757
- this.removeChildren(node.id, nodes, edges);
758
- node.data.expanded = undefined;
759
- this._nodes$.next(nodes);
760
- this._edges$.next(edges);
761
- }
762
- else {
763
- if (node.id.startsWith('N')) {
764
- this.expandNode(node);
765
- }
766
- else if (node.id.startsWith('P')) {
767
- this.expandProperty(node);
768
- }
769
- }
770
- }
771
- }
772
-
773
- /**
774
- * Linked literal filter.
775
- */
776
- class LinkedLiteralFilterComponent {
777
- /**
778
- * The filter.
779
- */
780
- get filter() {
781
- return this._filter;
782
- }
783
- set filter(value) {
784
- if (this._filter === value) {
785
- return;
786
- }
787
- this._filter = value;
788
- this.updateForm(value);
789
- }
790
- constructor(formBuilder, lookupService, _graphService) {
791
- this.lookupService = lookupService;
792
- this._graphService = _graphService;
793
- this._filter = {
794
- pageNumber: 1,
795
- pageSize: 10,
796
- };
797
- this.total = 0;
798
- this.filterChange = new EventEmitter();
799
- // form
800
- this.pageNumber = formBuilder.control(1, { nonNullable: true });
801
- this.pageSize = formBuilder.control(10, { nonNullable: true });
802
- this.litPattern = formBuilder.control(null);
803
- this.litType = formBuilder.control(null);
804
- this.litLanguage = formBuilder.control(null);
805
- this.minLitNumber = formBuilder.control(null);
806
- this.maxLitNumber = formBuilder.control(null);
807
- this.subj = formBuilder.control(null);
808
- this.pred = formBuilder.control(null);
809
- this.form = formBuilder.group({
810
- pageNumber: this.pageNumber,
811
- pageSize: this.pageSize,
812
- litPattern: this.litPattern,
813
- litType: this.litType,
814
- litLanguage: this.litLanguage,
815
- minLitNumber: this.minLitNumber,
816
- maxLitNumber: this.maxLitNumber,
817
- subj: this.subj,
818
- pred: this.pred,
819
- });
820
- }
821
- ngOnInit() { }
822
- updateForm(filter) {
823
- this.pageNumber.setValue(filter.pageNumber);
824
- this.pageSize.setValue(filter.pageSize);
825
- this.litPattern.setValue(filter.literalPattern || null);
826
- this.litType.setValue(filter.literalType || null);
827
- this.litLanguage.setValue(filter.literalLanguage || null);
828
- this.minLitNumber.setValue(filter.minLiteralNumber || null);
829
- this.maxLitNumber.setValue(filter.maxLiteralNumber || null);
830
- // load the referenced triples so we can show them by label
831
- forkJoin({
832
- s: filter.subjectId
833
- ? this._graphService.getNode(filter.subjectId)
834
- : from([null]),
835
- p: filter.predicateId
836
- ? this._graphService.getNode(filter.predicateId)
837
- : from([]),
838
- }).subscribe((result) => {
839
- this.subj.setValue(result.s);
840
- this.pred.setValue(result.p);
841
- this.form.markAsPristine();
842
- });
843
- }
844
- getFilter() {
845
- var _a, _b;
846
- return {
847
- pageNumber: +this.pageNumber.value,
848
- pageSize: +this.pageSize.value,
849
- literalPattern: this.litPattern.value || undefined,
850
- literalType: this.litType.value || undefined,
851
- literalLanguage: this.litLanguage.value || undefined,
852
- minLiteralNumber: this.minLitNumber.value || undefined,
853
- maxLiteralNumber: this.maxLitNumber.value || undefined,
854
- subjectId: (_a = this.subj.value) === null || _a === void 0 ? void 0 : _a.id,
855
- predicateId: (_b = this.pred.value) === null || _b === void 0 ? void 0 : _b.id,
856
- };
857
- }
858
- emitFilterChange() {
859
- this.filterChange.emit(this.getFilter());
860
- }
861
- onSubjectNodeChange(node) {
862
- this.subj.setValue(node);
863
- }
864
- onPredicateNodeChange(node) {
865
- this.pred.setValue(node);
866
- }
867
- onPageChange(page) {
868
- this.pageNumber.setValue(page.pageIndex + 1);
869
- this.emitFilterChange();
870
- }
871
- reset() {
872
- this.form.reset();
873
- this._filter = this.getFilter();
874
- this.filterChange.emit(this._filter);
875
- }
876
- apply() {
877
- if (this.form.invalid) {
878
- return;
879
- }
880
- this.emitFilterChange();
881
- this.form.markAsPristine();
882
- }
883
- }
884
- LinkedLiteralFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: LinkedLiteralFilterComponent, deps: [{ token: i1.FormBuilder }, { token: i2.GraphNodeLookupService }, { token: i3.GraphService }], target: i0.ɵɵFactoryTarget.Component });
885
- LinkedLiteralFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: LinkedLiteralFilterComponent, selector: "cadmus-walker-linked-literal-filter", inputs: { disabled: "disabled", hasPager: "hasPager", total: "total", filter: "filter" }, outputs: { filterChange: "filterChange" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"apply()\" ng-disabled=\"disabled\">\r\n <!-- paginator -->\r\n <mat-paginator\r\n *ngIf=\"hasPager\"\r\n [length]=\"total\"\r\n [pageSize]=\"pageSize.value || 10\"\r\n [pageSizeOptions]=\"[5, 10, 20]\"\r\n (page)=\"onPageChange($event)\"\r\n aria-label=\"Select page\"\r\n >\r\n </mat-paginator>\r\n\r\n <!-- subject ID -->\r\n <div>\r\n <cadmus-ref-lookup\r\n label=\"subject\"\r\n [service]=\"lookupService\"\r\n (itemChange)=\"onSubjectNodeChange($event)\"\r\n ></cadmus-ref-lookup>\r\n </div>\r\n\r\n <!-- predicate ID -->\r\n <div>\r\n <cadmus-ref-lookup\r\n label=\"predicate\"\r\n [service]=\"lookupService\"\r\n [baseFilter]=\"{ tag: 'property' }\"\r\n (itemChange)=\"onPredicateNodeChange($event)\"\r\n ></cadmus-ref-lookup>\r\n </div>\r\n\r\n <!-- LITERAL -->\r\n <!-- litPattern -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"litPattern\" placeholder=\"pattern\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- litType -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"litType\" placeholder=\"type\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- litLanguage-->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"litLanguage\" placeholder=\"language\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- minLitNumber, maxLitNumber -->\r\n <div>\r\n <mat-form-field style=\"width: 5em\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"minLitNumber\"\r\n placeholder=\"min.\"\r\n />\r\n </mat-form-field>\r\n -\r\n <mat-form-field style=\"width: 5em\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"maxLitNumber\"\r\n placeholder=\"max.\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div\r\n class=\"btn-group\"\r\n role=\"group\"\r\n aria-label=\"toolbar\"\r\n style=\"margin-bottom: 10px\"\r\n >\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n (click)=\"reset()\"\r\n color=\"warn\"\r\n matTooltip=\"Reset filters\"\r\n [disabled]=\"disabled\"\r\n >\r\n <mat-icon>clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [disabled]=\"disabled\"\r\n matTooltip=\"Apply filters\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i9.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i11.RefLookupComponent, selector: "cadmus-ref-lookup", inputs: ["label", "limit", "baseFilter", "service", "item", "required", "hasMore", "linkTemplate", "optDialog", "options"], outputs: ["itemChange", "moreRequest"] }] });
886
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: LinkedLiteralFilterComponent, decorators: [{
887
- type: Component,
888
- args: [{ selector: 'cadmus-walker-linked-literal-filter', template: "<form [formGroup]=\"form\" (submit)=\"apply()\" ng-disabled=\"disabled\">\r\n <!-- paginator -->\r\n <mat-paginator\r\n *ngIf=\"hasPager\"\r\n [length]=\"total\"\r\n [pageSize]=\"pageSize.value || 10\"\r\n [pageSizeOptions]=\"[5, 10, 20]\"\r\n (page)=\"onPageChange($event)\"\r\n aria-label=\"Select page\"\r\n >\r\n </mat-paginator>\r\n\r\n <!-- subject ID -->\r\n <div>\r\n <cadmus-ref-lookup\r\n label=\"subject\"\r\n [service]=\"lookupService\"\r\n (itemChange)=\"onSubjectNodeChange($event)\"\r\n ></cadmus-ref-lookup>\r\n </div>\r\n\r\n <!-- predicate ID -->\r\n <div>\r\n <cadmus-ref-lookup\r\n label=\"predicate\"\r\n [service]=\"lookupService\"\r\n [baseFilter]=\"{ tag: 'property' }\"\r\n (itemChange)=\"onPredicateNodeChange($event)\"\r\n ></cadmus-ref-lookup>\r\n </div>\r\n\r\n <!-- LITERAL -->\r\n <!-- litPattern -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"litPattern\" placeholder=\"pattern\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- litType -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"litType\" placeholder=\"type\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- litLanguage-->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"litLanguage\" placeholder=\"language\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- minLitNumber, maxLitNumber -->\r\n <div>\r\n <mat-form-field style=\"width: 5em\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"minLitNumber\"\r\n placeholder=\"min.\"\r\n />\r\n </mat-form-field>\r\n -\r\n <mat-form-field style=\"width: 5em\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"maxLitNumber\"\r\n placeholder=\"max.\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n <div\r\n class=\"btn-group\"\r\n role=\"group\"\r\n aria-label=\"toolbar\"\r\n style=\"margin-bottom: 10px\"\r\n >\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n (click)=\"reset()\"\r\n color=\"warn\"\r\n matTooltip=\"Reset filters\"\r\n [disabled]=\"disabled\"\r\n >\r\n <mat-icon>clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [disabled]=\"disabled\"\r\n matTooltip=\"Apply filters\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n" }]
889
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.GraphNodeLookupService }, { type: i3.GraphService }]; }, propDecorators: { disabled: [{
890
- type: Input
891
- }], hasPager: [{
892
- type: Input
893
- }], total: [{
894
- type: Input
895
- }], filter: [{
896
- type: Input
897
- }], filterChange: [{
898
- type: Output
899
- }] } });
900
-
901
- /**
902
- * Linked non-literal node filter.
903
- */
904
- class LinkedNodeFilterComponent {
905
- /**
906
- * The filter.
907
- */
908
- get filter() {
909
- return this._filter;
910
- }
911
- set filter(value) {
912
- if (this._filter === value) {
913
- return;
914
- }
915
- this._filter = value;
916
- this.updateForm(value);
917
- }
918
- constructor(formBuilder, lookupService, _graphService) {
919
- this.lookupService = lookupService;
920
- this._graphService = _graphService;
921
- this.otherNodeId = 0;
922
- this.predicateId = 0;
923
- this.isObject = false;
924
- this._filter = {
925
- pageNumber: 1,
926
- pageSize: 10,
927
- otherNodeId: 0,
928
- predicateId: 0,
929
- };
930
- this.total = 0;
931
- this.filterChange = new EventEmitter();
932
- // form
933
- this.pageNumber = formBuilder.control(1, { nonNullable: true });
934
- this.pageSize = formBuilder.control(10, { nonNullable: true });
935
- this.uid = formBuilder.control(null);
936
- this.isClass = formBuilder.control(null);
937
- this.tag = formBuilder.control(null);
938
- this.label = formBuilder.control(null);
939
- this.sourceType = formBuilder.control(null);
940
- this.sid = formBuilder.control(null);
941
- this.isSidPrefix = formBuilder.control(false, { nonNullable: true });
942
- this.classes = formBuilder.control([], { nonNullable: true });
943
- this.form = formBuilder.group({
944
- pageNumber: this.pageNumber,
945
- pageSize: this.pageSize,
946
- uid: this.uid,
947
- isClass: this.isClass,
948
- tag: this.tag,
949
- label: this.label,
950
- sourceType: this.sourceType,
951
- sid: this.sid,
952
- isSidPrefix: this.isSidPrefix,
953
- classes: this.classes,
954
- });
955
- }
956
- ngOnInit() { }
957
- updateForm(filter) {
958
- var _a;
959
- this.otherNodeId = filter.otherNodeId;
960
- this.predicateId = filter.predicateId;
961
- this.isObject = filter.isObject || false;
962
- this.pageNumber.setValue(filter.pageNumber);
963
- this.pageSize.setValue(filter.pageSize);
964
- this.uid.setValue(filter.uid || null);
965
- this.isClass.setValue(filter.isClass || null);
966
- this.tag.setValue(filter.tag || null);
967
- this.label.setValue(filter.label || null);
968
- this.sourceType.setValue(filter.sourceType || null);
969
- this.sid.setValue(filter.sid || null);
970
- this.isSidPrefix.setValue(filter.isSidPrefix || false);
971
- // load the referenced class nodes so we can show them by label
972
- if ((_a = filter.classIds) === null || _a === void 0 ? void 0 : _a.length) {
973
- this._graphService
974
- .getNodeSet(filter.classIds)
975
- .pipe(take(1))
976
- .subscribe((nodes) => {
977
- this.classes.setValue(nodes.filter((n) => n));
978
- this.form.markAsPristine();
979
- });
980
- }
981
- else {
982
- this.classes.setValue([]);
983
- this.form.markAsPristine();
984
- }
985
- }
986
- getFilter() {
987
- return {
988
- pageNumber: +this.pageNumber.value,
989
- pageSize: +this.pageSize.value,
990
- uid: this.uid.value || undefined,
991
- isClass: this.isClass.value || undefined,
992
- tag: this.tag.value || undefined,
993
- label: this.label.value || undefined,
994
- sourceType: this.sourceType.value || undefined,
995
- sid: this.sid.value || undefined,
996
- isSidPrefix: this.isSidPrefix.value ? true : undefined,
997
- classIds: this.classes.value.length
998
- ? this.classes.value.map((n) => n.id)
999
- : undefined,
1000
- otherNodeId: this.otherNodeId,
1001
- predicateId: this.predicateId,
1002
- isObject: this.isObject,
1003
- };
1004
- }
1005
- emitFilterChange() {
1006
- this.filterChange.emit(this.getFilter());
1007
- }
1008
- onPageChange(page) {
1009
- this.pageNumber.setValue(page.pageIndex + 1);
1010
- this.emitFilterChange();
1011
- }
1012
- onClassAdd(node) {
1013
- if (!node) {
1014
- return;
1015
- }
1016
- const nodes = [...this.classes.value];
1017
- nodes.push(node);
1018
- this.classes.setValue(nodes);
1019
- this.classes.updateValueAndValidity();
1020
- this.classes.markAsDirty();
1021
- }
1022
- onClassRemove(node) {
1023
- const nodes = [...this.classes.value];
1024
- const i = nodes.indexOf(node);
1025
- if (i > -1) {
1026
- nodes.splice(i, 1);
1027
- this.classes.setValue(nodes);
1028
- this.classes.updateValueAndValidity();
1029
- this.classes.markAsDirty();
1030
- }
1031
- }
1032
- reset() {
1033
- this.form.reset();
1034
- this._filter = this.getFilter();
1035
- this.filterChange.emit(this._filter);
1036
- }
1037
- apply() {
1038
- if (this.form.invalid) {
1039
- return;
1040
- }
1041
- this.emitFilterChange();
1042
- this.form.markAsPristine();
1043
- }
1044
- }
1045
- LinkedNodeFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: LinkedNodeFilterComponent, deps: [{ token: i1.FormBuilder }, { token: i2.GraphNodeLookupService }, { token: i3.GraphService }], target: i0.ɵɵFactoryTarget.Component });
1046
- LinkedNodeFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: LinkedNodeFilterComponent, selector: "cadmus-walker-linked-node-filter", inputs: { disabled: "disabled", hasPager: "hasPager", total: "total", filter: "filter" }, outputs: { filterChange: "filterChange" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"apply()\" ng-disabled=\"disabled\">\r\n <!-- paginator -->\r\n <mat-paginator\r\n *ngIf=\"hasPager\"\r\n [length]=\"total\"\r\n [pageSize]=\"pageSize.value || 10\"\r\n [pageSizeOptions]=\"[5, 10, 20]\"\r\n (page)=\"onPageChange($event)\"\r\n aria-label=\"Select page\"\r\n >\r\n </mat-paginator>\r\n\r\n <!-- label -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"label\" placeholder=\"label\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- uid -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"uid\" placeholder=\"UID\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- isClass -->\r\n <div>\r\n <mat-form-field>\r\n <mat-select [formControl]=\"isClass\" placeholder=\"class\">\r\n <mat-option [value]=\"0\">(any)</mat-option>\r\n <mat-option [value]=\"1\">not-class</mat-option>\r\n <mat-option [value]=\"2\">class</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <!-- tag -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"tag\" placeholder=\"tag\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- sourceType -->\r\n <div>\r\n <mat-form-field>\r\n <mat-select [formControl]=\"sourceType\" placeholder=\"source type\">\r\n <mat-option [value]=\"null\">(any)</mat-option>\r\n <mat-option [value]=\"0\">user</mat-option>\r\n <mat-option [value]=\"1\">item</mat-option>\r\n <mat-option [value]=\"2\">part</mat-option>\r\n <mat-option [value]=\"3\">thesaurus</mat-option>\r\n <mat-option [value]=\"4\">implicit</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div>\r\n <!-- sid -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"sid\" placeholder=\"SID\" />\r\n </mat-form-field>\r\n\r\n <!-- isSidPrefix -->\r\n <mat-checkbox [formControl]=\"isSidPrefix\">prefix</mat-checkbox>\r\n </div>\r\n </div>\r\n <!-- classes -->\r\n <div>\r\n <fieldset>\r\n <legend>classes</legend>\r\n <cadmus-ref-lookup\r\n label=\"class\"\r\n [service]=\"lookupService\"\r\n [baseFilter]=\"{ isClass: true }\"\r\n (itemChange)=\"onClassAdd($event)\"\r\n ></cadmus-ref-lookup>\r\n\r\n <mat-chip-listbox *ngIf=\"classes.value?.length\">\r\n <mat-chip-option\r\n *ngFor=\"let node of classes.value\"\r\n [removable]=\"true\"\r\n (removed)=\"onClassRemove(node)\"\r\n matTooltip=\"{{ node.uri }}\"\r\n >{{ node.label }}\r\n <button type=\"button\" matChipRemove>\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip-option>\r\n </mat-chip-listbox>\r\n </fieldset>\r\n </div>\r\n\r\n <div\r\n class=\"btn-group\"\r\n role=\"group\"\r\n aria-label=\"toolbar\"\r\n style=\"margin-bottom: 10px\"\r\n >\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n (click)=\"reset()\"\r\n color=\"warn\"\r\n matTooltip=\"Reset filters\"\r\n [disabled]=\"disabled\"\r\n >\r\n <mat-icon>clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [disabled]=\"disabled\"\r\n matTooltip=\"Apply filters\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: ["fieldset{border:1px solid silver;border-radius:4px;padding:4px}\n"], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i5$1.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i7$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i8$1.MatChipListbox, selector: "mat-chip-listbox", inputs: ["tabIndex", "multiple", "aria-orientation", "selectable", "compareWith", "required", "value"], outputs: ["change"] }, { kind: "component", type: i8$1.MatChipOption, selector: "mat-basic-chip-option, mat-chip-option", inputs: ["color", "disabled", "disableRipple", "tabIndex", "selectable", "selected"], outputs: ["selectionChange"] }, { kind: "directive", type: i8$1.MatChipRemove, selector: "[matChipRemove]" }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i9.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { kind: "component", type: i13.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i11.RefLookupComponent, selector: "cadmus-ref-lookup", inputs: ["label", "limit", "baseFilter", "service", "item", "required", "hasMore", "linkTemplate", "optDialog", "options"], outputs: ["itemChange", "moreRequest"] }] });
1047
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: LinkedNodeFilterComponent, decorators: [{
1048
- type: Component,
1049
- args: [{ selector: 'cadmus-walker-linked-node-filter', template: "<form [formGroup]=\"form\" (submit)=\"apply()\" ng-disabled=\"disabled\">\r\n <!-- paginator -->\r\n <mat-paginator\r\n *ngIf=\"hasPager\"\r\n [length]=\"total\"\r\n [pageSize]=\"pageSize.value || 10\"\r\n [pageSizeOptions]=\"[5, 10, 20]\"\r\n (page)=\"onPageChange($event)\"\r\n aria-label=\"Select page\"\r\n >\r\n </mat-paginator>\r\n\r\n <!-- label -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"label\" placeholder=\"label\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- uid -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"uid\" placeholder=\"UID\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- isClass -->\r\n <div>\r\n <mat-form-field>\r\n <mat-select [formControl]=\"isClass\" placeholder=\"class\">\r\n <mat-option [value]=\"0\">(any)</mat-option>\r\n <mat-option [value]=\"1\">not-class</mat-option>\r\n <mat-option [value]=\"2\">class</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <!-- tag -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"tag\" placeholder=\"tag\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- sourceType -->\r\n <div>\r\n <mat-form-field>\r\n <mat-select [formControl]=\"sourceType\" placeholder=\"source type\">\r\n <mat-option [value]=\"null\">(any)</mat-option>\r\n <mat-option [value]=\"0\">user</mat-option>\r\n <mat-option [value]=\"1\">item</mat-option>\r\n <mat-option [value]=\"2\">part</mat-option>\r\n <mat-option [value]=\"3\">thesaurus</mat-option>\r\n <mat-option [value]=\"4\">implicit</mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n <div>\r\n <!-- sid -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"sid\" placeholder=\"SID\" />\r\n </mat-form-field>\r\n\r\n <!-- isSidPrefix -->\r\n <mat-checkbox [formControl]=\"isSidPrefix\">prefix</mat-checkbox>\r\n </div>\r\n </div>\r\n <!-- classes -->\r\n <div>\r\n <fieldset>\r\n <legend>classes</legend>\r\n <cadmus-ref-lookup\r\n label=\"class\"\r\n [service]=\"lookupService\"\r\n [baseFilter]=\"{ isClass: true }\"\r\n (itemChange)=\"onClassAdd($event)\"\r\n ></cadmus-ref-lookup>\r\n\r\n <mat-chip-listbox *ngIf=\"classes.value?.length\">\r\n <mat-chip-option\r\n *ngFor=\"let node of classes.value\"\r\n [removable]=\"true\"\r\n (removed)=\"onClassRemove(node)\"\r\n matTooltip=\"{{ node.uri }}\"\r\n >{{ node.label }}\r\n <button type=\"button\" matChipRemove>\r\n <mat-icon>cancel</mat-icon>\r\n </button>\r\n </mat-chip-option>\r\n </mat-chip-listbox>\r\n </fieldset>\r\n </div>\r\n\r\n <div\r\n class=\"btn-group\"\r\n role=\"group\"\r\n aria-label=\"toolbar\"\r\n style=\"margin-bottom: 10px\"\r\n >\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n (click)=\"reset()\"\r\n color=\"warn\"\r\n matTooltip=\"Reset filters\"\r\n [disabled]=\"disabled\"\r\n >\r\n <mat-icon>clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [disabled]=\"disabled\"\r\n matTooltip=\"Apply filters\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: ["fieldset{border:1px solid silver;border-radius:4px;padding:4px}\n"] }]
1050
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.GraphNodeLookupService }, { type: i3.GraphService }]; }, propDecorators: { disabled: [{
1051
- type: Input
1052
- }], hasPager: [{
1053
- type: Input
1054
- }], total: [{
1055
- type: Input
1056
- }], filter: [{
1057
- type: Input
1058
- }], filterChange: [{
1059
- type: Output
1060
- }] } });
1061
-
1062
- /**
1063
- * Triples filter.
1064
- */
1065
- class TripleFilterComponent {
1066
- /**
1067
- * The filter.
1068
- */
1069
- get filter() {
1070
- return this._filter;
1071
- }
1072
- set filter(value) {
1073
- if (this._filter === value) {
1074
- return;
1075
- }
1076
- this._filter = value;
1077
- this.updateForm(value);
1078
- }
1079
- constructor(formBuilder, lookupService, _graphService) {
1080
- this.lookupService = lookupService;
1081
- this._graphService = _graphService;
1082
- this._filter = {
1083
- pageNumber: 1,
1084
- pageSize: 10,
1085
- };
1086
- this.total = 0;
1087
- this.filterChange = new EventEmitter();
1088
- // form
1089
- this.pageNumber = formBuilder.control(1, { nonNullable: true });
1090
- this.pageSize = formBuilder.control(10, { nonNullable: true });
1091
- this.litPattern = formBuilder.control(null);
1092
- this.litType = formBuilder.control(null);
1093
- this.litLanguage = formBuilder.control(null);
1094
- this.minLitNumber = formBuilder.control(null);
1095
- this.maxLitNumber = formBuilder.control(null);
1096
- this.subj = formBuilder.control(null);
1097
- this.preds = formBuilder.control([], { nonNullable: true });
1098
- this.isNotPred = formBuilder.control(false, { nonNullable: true });
1099
- this.notPreds = formBuilder.control([], { nonNullable: true });
1100
- this.hasLiteralObj = formBuilder.control(null);
1101
- this.obj = formBuilder.control(null);
1102
- this.sid = formBuilder.control(null);
1103
- this.isSidPrefix = formBuilder.control(false, { nonNullable: true });
1104
- this.tag = formBuilder.control(null);
1105
- this.form = formBuilder.group({
1106
- pageNumber: this.pageNumber,
1107
- pageSize: this.pageSize,
1108
- litPattern: this.litPattern,
1109
- litType: this.litType,
1110
- litLanguage: this.litLanguage,
1111
- minLitNumber: this.minLitNumber,
1112
- maxLitNumber: this.maxLitNumber,
1113
- subj: this.subj,
1114
- preds: this.preds,
1115
- isNotPred: this.isNotPred,
1116
- notPreds: this.notPreds,
1117
- hasLiteralObj: this.hasLiteralObj,
1118
- obj: this.obj,
1119
- sid: this.sid,
1120
- isSidPrefix: this.isSidPrefix,
1121
- tag: this.tag,
1122
- });
1123
- }
1124
- ngOnInit() { }
1125
- updateForm(filter) {
1126
- var _a;
1127
- this.pageNumber.setValue(filter.pageNumber);
1128
- this.pageSize.setValue(filter.pageSize);
1129
- this.litPattern.setValue(filter.literalPattern || null);
1130
- this.litType.setValue(filter.literalType || null);
1131
- this.litLanguage.setValue(filter.literalLanguage || null);
1132
- this.minLitNumber.setValue(filter.minLiteralNumber || null);
1133
- this.maxLitNumber.setValue(filter.maxLiteralNumber || null);
1134
- this.hasLiteralObj.setValue(filter.hasLiteralObject || null);
1135
- this.sid.setValue(filter.sid || null);
1136
- this.isSidPrefix.setValue(filter.isSidPrefix || false);
1137
- this.tag.setValue(filter.tag || null);
1138
- // load the referenced nodes so we can show them by label
1139
- forkJoin({
1140
- s: filter.subjectId
1141
- ? this._graphService.getNode(filter.subjectId)
1142
- : from([null]),
1143
- p: ((_a = filter.predicateIds) === null || _a === void 0 ? void 0 : _a.length)
1144
- ? this._graphService.getNodeSet(filter.predicateIds)
1145
- : from([]),
1146
- o: filter.objectId
1147
- ? this._graphService.getNode(filter.objectId)
1148
- : from([null]),
1149
- }).subscribe((result) => {
1150
- this.subj.setValue(result.s);
1151
- this.preds.setValue(result.p.filter((n) => n));
1152
- this.obj.setValue(result.o);
1153
- this.form.markAsPristine();
1154
- });
1155
- }
1156
- getFilter() {
1157
- var _a, _b, _c, _d;
1158
- return {
1159
- pageNumber: +this.pageNumber.value,
1160
- pageSize: +this.pageSize.value,
1161
- literalPattern: this.litPattern.value || undefined,
1162
- literalType: this.litType.value || undefined,
1163
- literalLanguage: this.litLanguage.value || undefined,
1164
- minLiteralNumber: this.minLitNumber.value || undefined,
1165
- maxLiteralNumber: this.maxLitNumber.value || undefined,
1166
- subjectId: ((_a = this.subj.value) === null || _a === void 0 ? void 0 : _a.id) || undefined,
1167
- predicateIds: ((_b = this.preds.value) === null || _b === void 0 ? void 0 : _b.length)
1168
- ? this.preds.value.map((n) => n.id)
1169
- : undefined,
1170
- notPredicateIds: ((_c = this.notPreds.value) === null || _c === void 0 ? void 0 : _c.length)
1171
- ? this.notPreds.value.map((n) => n.id)
1172
- : undefined,
1173
- hasLiteralObject: this.hasLiteralObj.value !== null
1174
- ? this.hasLiteralObj.value
1175
- : undefined,
1176
- objectId: ((_d = this.obj.value) === null || _d === void 0 ? void 0 : _d.id) || undefined,
1177
- sid: this.sid.value || undefined,
1178
- isSidPrefix: this.isSidPrefix.value,
1179
- tag: this.tag.value || undefined,
1180
- };
1181
- }
1182
- emitFilterChange() {
1183
- this.filterChange.emit(this.getFilter());
1184
- }
1185
- onPageChange(page) {
1186
- this.pageNumber.setValue(page.pageIndex + 1);
1187
- this.emitFilterChange();
1188
- }
1189
- onSubjectNodeChange(node) {
1190
- this.subj.setValue(node);
1191
- }
1192
- onObjectNodeChange(node) {
1193
- this.obj.setValue(node);
1194
- }
1195
- onPredicateNodeChange(node) {
1196
- if (!node) {
1197
- return;
1198
- }
1199
- if (this.isNotPred.value) {
1200
- const nodes = [...this.notPreds.value];
1201
- if (nodes.some((n) => n.id === node.id)) {
1202
- return;
1203
- }
1204
- nodes.push(node);
1205
- this.notPreds.setValue(nodes);
1206
- this.notPreds.updateValueAndValidity();
1207
- this.notPreds.markAsDirty();
1208
- }
1209
- else {
1210
- const nodes = [...this.preds.value];
1211
- if (nodes.some((n) => n.id === node.id)) {
1212
- return;
1213
- }
1214
- nodes.push(node);
1215
- this.preds.setValue(nodes);
1216
- this.preds.updateValueAndValidity();
1217
- this.preds.markAsDirty();
1218
- }
1219
- }
1220
- deleteNotPred(node) {
1221
- const nodes = [...this.notPreds.value];
1222
- const i = nodes.indexOf(node);
1223
- nodes.splice(i, 1);
1224
- this.notPreds.setValue(nodes);
1225
- this.notPreds.updateValueAndValidity();
1226
- this.notPreds.markAsDirty();
1227
- }
1228
- deletePred(node) {
1229
- const nodes = [...this.preds.value];
1230
- const i = nodes.indexOf(node);
1231
- nodes.splice(i, 1);
1232
- this.preds.setValue(nodes);
1233
- this.preds.updateValueAndValidity();
1234
- this.preds.markAsDirty();
1235
- }
1236
- reset() {
1237
- this.form.reset();
1238
- this._filter = this.getFilter();
1239
- this.filterChange.emit(this._filter);
1240
- }
1241
- apply() {
1242
- if (this.form.invalid) {
1243
- return;
1244
- }
1245
- this.emitFilterChange();
1246
- this.form.markAsPristine();
1247
- }
1248
- }
1249
- TripleFilterComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: TripleFilterComponent, deps: [{ token: i1.FormBuilder }, { token: i2.GraphNodeLookupService }, { token: i3.GraphService }], target: i0.ɵɵFactoryTarget.Component });
1250
- TripleFilterComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: TripleFilterComponent, selector: "cadmus-walker-triple-filter", inputs: { disabled: "disabled", hasPager: "hasPager", total: "total", filter: "filter" }, outputs: { filterChange: "filterChange" }, ngImport: i0, template: "<form [formGroup]=\"form\" (submit)=\"apply()\" ng-disabled=\"disabled\">\r\n <!-- paginator -->\r\n <mat-paginator\r\n *ngIf=\"hasPager\"\r\n [length]=\"total\"\r\n [pageSize]=\"pageSize.value || 10\"\r\n [pageSizeOptions]=\"[5, 10, 20]\"\r\n (page)=\"onPageChange($event)\"\r\n aria-label=\"Select page\"\r\n >\r\n </mat-paginator>\r\n <mat-tab-group>\r\n <!-- TRIPLE -->\r\n <mat-tab label=\"triple\">\r\n <!-- subject ID -->\r\n <div>\r\n <cadmus-ref-lookup\r\n label=\"subject\"\r\n [service]=\"lookupService\"\r\n (itemChange)=\"onSubjectNodeChange($event)\"\r\n ></cadmus-ref-lookup>\r\n </div>\r\n <!-- predicate IDs -->\r\n <div>\r\n <cadmus-ref-lookup\r\n label=\"predicate\"\r\n [service]=\"lookupService\"\r\n [baseFilter]=\"{ tag: 'property' }\"\r\n (itemChange)=\"onPredicateNodeChange($event)\"\r\n ></cadmus-ref-lookup>\r\n <mat-checkbox [formControl]=\"isNotPred\">not</mat-checkbox>\r\n <!-- notPreds -->\r\n <div *ngIf=\"isNotPred?.value\">\r\n <mat-list dense>\r\n <mat-list-item *ngFor=\"let n of notPreds.value\">\r\n <span>{{ n.label }}</span>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"deleteNotPred(n)\"\r\n >\r\n <mat-icon>clear</mat-icon>\r\n </button>\r\n </mat-list-item>\r\n </mat-list>\r\n </div>\r\n <!-- preds -->\r\n <div *ngIf=\"!isNotPred?.value\">\r\n <mat-list dense>\r\n <mat-list-item *ngFor=\"let n of preds.value\">\r\n <span>{{ n.label }}</span>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"deletePred(n)\"\r\n >\r\n <mat-icon>clear</mat-icon>\r\n </button>\r\n </mat-list-item>\r\n </mat-list>\r\n </div>\r\n </div>\r\n <!-- object ID -->\r\n <div>\r\n <cadmus-ref-lookup\r\n label=\"object\"\r\n [service]=\"lookupService\"\r\n (itemChange)=\"onObjectNodeChange($event)\"\r\n ></cadmus-ref-lookup>\r\n </div>\r\n <!-- sid -->\r\n <div>\r\n <mat-form-field>\r\n <input\r\n matInput\r\n [formControl]=\"sid\"\r\n placeholder=\"sid\"\r\n maxlength=\"500\"\r\n />\r\n </mat-form-field>\r\n &nbsp;\r\n <mat-checkbox [formControl]=\"isSidPrefix\">prefix</mat-checkbox>\r\n </div>\r\n <!-- tag -->\r\n <div>\r\n <mat-form-field>\r\n <input\r\n matInput\r\n [formControl]=\"tag\"\r\n placeholder=\"tag\"\r\n maxlength=\"50\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </mat-tab>\r\n <!-- LITERAL -->\r\n <mat-tab label=\"literal\">\r\n <!-- litPattern -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"litPattern\" placeholder=\"pattern\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- litType -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"litType\" placeholder=\"type\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- litLanguage-->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"litLanguage\" placeholder=\"language\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- minLitNumber, maxLitNumber -->\r\n <div>\r\n <mat-form-field style=\"width: 4em\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"minLitNumber\"\r\n placeholder=\"min.\"\r\n />\r\n </mat-form-field>\r\n -\r\n <mat-form-field style=\"width: 4em\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"maxLitNumber\"\r\n placeholder=\"max.\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </mat-tab>\r\n </mat-tab-group>\r\n <div\r\n class=\"btn-group\"\r\n role=\"group\"\r\n aria-label=\"toolbar\"\r\n style=\"margin-bottom: 10px\"\r\n >\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n (click)=\"reset()\"\r\n color=\"warn\"\r\n matTooltip=\"Reset filters\"\r\n [disabled]=\"disabled\"\r\n >\r\n <mat-icon>clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [disabled]=\"disabled\"\r\n matTooltip=\"Apply filters\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n", styles: [""], dependencies: [{ kind: "directive", type: i4.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.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: i1.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.MaxLengthValidator, selector: "[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]", inputs: ["maxlength"] }, { kind: "directive", type: i1.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i7$1.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "component", type: i6.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "component", type: i10$1.MatList, selector: "mat-list", exportAs: ["matList"] }, { kind: "component", type: i10$1.MatListItem, selector: "mat-list-item, a[mat-list-item], button[mat-list-item]", inputs: ["activated"], exportAs: ["matListItem"] }, { kind: "component", type: i9.MatPaginator, selector: "mat-paginator", inputs: ["disabled"], exportAs: ["matPaginator"] }, { kind: "component", type: i7$2.MatTab, selector: "mat-tab", inputs: ["disabled"], exportAs: ["matTab"] }, { kind: "component", type: i7$2.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple", "fitInkBarToContent", "mat-stretch-tabs"], exportAs: ["matTabGroup"] }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i11.RefLookupComponent, selector: "cadmus-ref-lookup", inputs: ["label", "limit", "baseFilter", "service", "item", "required", "hasMore", "linkTemplate", "optDialog", "options"], outputs: ["itemChange", "moreRequest"] }] });
1251
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: TripleFilterComponent, decorators: [{
1252
- type: Component,
1253
- args: [{ selector: 'cadmus-walker-triple-filter', template: "<form [formGroup]=\"form\" (submit)=\"apply()\" ng-disabled=\"disabled\">\r\n <!-- paginator -->\r\n <mat-paginator\r\n *ngIf=\"hasPager\"\r\n [length]=\"total\"\r\n [pageSize]=\"pageSize.value || 10\"\r\n [pageSizeOptions]=\"[5, 10, 20]\"\r\n (page)=\"onPageChange($event)\"\r\n aria-label=\"Select page\"\r\n >\r\n </mat-paginator>\r\n <mat-tab-group>\r\n <!-- TRIPLE -->\r\n <mat-tab label=\"triple\">\r\n <!-- subject ID -->\r\n <div>\r\n <cadmus-ref-lookup\r\n label=\"subject\"\r\n [service]=\"lookupService\"\r\n (itemChange)=\"onSubjectNodeChange($event)\"\r\n ></cadmus-ref-lookup>\r\n </div>\r\n <!-- predicate IDs -->\r\n <div>\r\n <cadmus-ref-lookup\r\n label=\"predicate\"\r\n [service]=\"lookupService\"\r\n [baseFilter]=\"{ tag: 'property' }\"\r\n (itemChange)=\"onPredicateNodeChange($event)\"\r\n ></cadmus-ref-lookup>\r\n <mat-checkbox [formControl]=\"isNotPred\">not</mat-checkbox>\r\n <!-- notPreds -->\r\n <div *ngIf=\"isNotPred?.value\">\r\n <mat-list dense>\r\n <mat-list-item *ngFor=\"let n of notPreds.value\">\r\n <span>{{ n.label }}</span>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"deleteNotPred(n)\"\r\n >\r\n <mat-icon>clear</mat-icon>\r\n </button>\r\n </mat-list-item>\r\n </mat-list>\r\n </div>\r\n <!-- preds -->\r\n <div *ngIf=\"!isNotPred?.value\">\r\n <mat-list dense>\r\n <mat-list-item *ngFor=\"let n of preds.value\">\r\n <span>{{ n.label }}</span>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n color=\"warn\"\r\n (click)=\"deletePred(n)\"\r\n >\r\n <mat-icon>clear</mat-icon>\r\n </button>\r\n </mat-list-item>\r\n </mat-list>\r\n </div>\r\n </div>\r\n <!-- object ID -->\r\n <div>\r\n <cadmus-ref-lookup\r\n label=\"object\"\r\n [service]=\"lookupService\"\r\n (itemChange)=\"onObjectNodeChange($event)\"\r\n ></cadmus-ref-lookup>\r\n </div>\r\n <!-- sid -->\r\n <div>\r\n <mat-form-field>\r\n <input\r\n matInput\r\n [formControl]=\"sid\"\r\n placeholder=\"sid\"\r\n maxlength=\"500\"\r\n />\r\n </mat-form-field>\r\n &nbsp;\r\n <mat-checkbox [formControl]=\"isSidPrefix\">prefix</mat-checkbox>\r\n </div>\r\n <!-- tag -->\r\n <div>\r\n <mat-form-field>\r\n <input\r\n matInput\r\n [formControl]=\"tag\"\r\n placeholder=\"tag\"\r\n maxlength=\"50\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </mat-tab>\r\n <!-- LITERAL -->\r\n <mat-tab label=\"literal\">\r\n <!-- litPattern -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"litPattern\" placeholder=\"pattern\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- litType -->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"litType\" placeholder=\"type\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- litLanguage-->\r\n <div>\r\n <mat-form-field>\r\n <input matInput [formControl]=\"litLanguage\" placeholder=\"language\" />\r\n </mat-form-field>\r\n </div>\r\n <!-- minLitNumber, maxLitNumber -->\r\n <div>\r\n <mat-form-field style=\"width: 4em\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"minLitNumber\"\r\n placeholder=\"min.\"\r\n />\r\n </mat-form-field>\r\n -\r\n <mat-form-field style=\"width: 4em\">\r\n <input\r\n matInput\r\n type=\"number\"\r\n [formControl]=\"maxLitNumber\"\r\n placeholder=\"max.\"\r\n />\r\n </mat-form-field>\r\n </div>\r\n </mat-tab>\r\n </mat-tab-group>\r\n <div\r\n class=\"btn-group\"\r\n role=\"group\"\r\n aria-label=\"toolbar\"\r\n style=\"margin-bottom: 10px\"\r\n >\r\n <button\r\n mat-icon-button\r\n type=\"button\"\r\n (click)=\"reset()\"\r\n color=\"warn\"\r\n matTooltip=\"Reset filters\"\r\n [disabled]=\"disabled\"\r\n >\r\n <mat-icon>clear</mat-icon>\r\n </button>\r\n <button\r\n type=\"submit\"\r\n mat-icon-button\r\n color=\"primary\"\r\n [disabled]=\"disabled\"\r\n matTooltip=\"Apply filters\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n </button>\r\n </div>\r\n</form>\r\n" }]
1254
- }], ctorParameters: function () { return [{ type: i1.FormBuilder }, { type: i2.GraphNodeLookupService }, { type: i3.GraphService }]; }, propDecorators: { disabled: [{
1255
- type: Input
1256
- }], hasPager: [{
1257
- type: Input
1258
- }], total: [{
1259
- type: Input
1260
- }], filter: [{
1261
- type: Input
1262
- }], filterChange: [{
1263
- type: Output
1264
- }] } });
1265
-
1266
- /**
1267
- * Get the extended label for the specified graph node. This returns the label
1268
- * for N nodes, and the uri + "=" + the label for P nodes. That's because P
1269
- * nodes label is just the count of the triples group, so the predicate ID is
1270
- * got from the property node's data uri.
1271
- */
1272
- class GraphNodeLabelPipe {
1273
- transform(value, ...args) {
1274
- const node = value;
1275
- if (!(node === null || node === void 0 ? void 0 : node.id) || !(node === null || node === void 0 ? void 0 : node.label)) {
1276
- return value;
1277
- }
1278
- if (node.id.startsWith('P') && node.data.uri) {
1279
- return `${node.data.uri}=${node.label}`;
1280
- }
1281
- return node.label;
1282
- }
1283
- }
1284
- GraphNodeLabelPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GraphNodeLabelPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
1285
- GraphNodeLabelPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: GraphNodeLabelPipe, name: "graphNodeLabel" });
1286
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GraphNodeLabelPipe, decorators: [{
1287
- type: Pipe,
1288
- args: [{
1289
- name: 'graphNodeLabel'
1290
- }]
1291
- }] });
1292
-
1293
- /**
1294
- * Graph walker component. This starts from a given node, and let users
1295
- * walk along edges to discover new nodes.
1296
- */
1297
- class GraphWalkerComponent {
1298
- /**
1299
- * The root origin node ID.
1300
- */
1301
- get nodeId() {
1302
- return this._nodeId;
1303
- }
1304
- set nodeId(value) {
1305
- if (this._nodeId === value) {
1306
- return;
1307
- }
1308
- this._nodeId = value;
1309
- this.reset(value);
1310
- }
1311
- constructor(graphService, _dialog) {
1312
- this._dialog = _dialog;
1313
- // ngx-graph actions
1314
- this.update$ = new Subject();
1315
- this.center$ = new Subject();
1316
- this.zoomToFit$ = new Subject();
1317
- this._walker = new GraphWalker(graphService);
1318
- this._nodeId = 0;
1319
- this.nodePick = new EventEmitter();
1320
- this.nodes$ = this._walker.nodes$;
1321
- this.edges$ = this._walker.edges$;
1322
- this.loading$ = this._walker.loading$;
1323
- this.error$ = this._walker.error$;
1324
- this.selectedNode$ = this._walker.selectedNode$;
1325
- this.pOutFilter$ = this._walker.pOutFilter$;
1326
- this.pInFilter$ = this._walker.pInFilter$;
1327
- this.pLitFilter$ = this._walker.pLitFilter$;
1328
- this.nOutFilter$ = this._walker.nOutFilter$;
1329
- this.nInFilter$ = this._walker.nInFilter$;
1330
- this.childTotals$ = this._walker.childTotals$;
1331
- }
1332
- ngOnInit() {
1333
- this.update$.subscribe((_) => {
1334
- this.onReset();
1335
- });
1336
- }
1337
- onNodeSelect(node) {
1338
- this._walker.selectNode(node.id);
1339
- }
1340
- reset(id) {
1341
- this._walker.reset(id);
1342
- }
1343
- onReset() {
1344
- if (!this._nodeId) {
1345
- return;
1346
- }
1347
- this._dialog
1348
- .confirm('Reset', 'Reset the whole graph?')
1349
- .pipe(take$1(1))
1350
- .subscribe((yes) => {
1351
- if (yes) {
1352
- this.reset(this._nodeId);
1353
- }
1354
- });
1355
- }
1356
- onNodeDblClick(node) {
1357
- this._walker.toggleNode(node);
1358
- }
1359
- onPOutFilterChange(filter) {
1360
- this._walker.expandSelectedProperty(filter);
1361
- }
1362
- onPInFilterChange(filter) {
1363
- this._walker.expandSelectedProperty(null, filter);
1364
- }
1365
- onPLitFilterChange(filter) {
1366
- this._walker.expandSelectedProperty(null, null, filter);
1367
- }
1368
- onNOutFilterChange(filter) {
1369
- this._walker.expandSelectedNode(filter);
1370
- }
1371
- onNInFilterChange(filter) {
1372
- this._walker.expandSelectedNode(null, filter);
1373
- }
1374
- pickSelectedNode() {
1375
- const node = this._walker.getSelectedNode();
1376
- if (!node) {
1377
- return;
1378
- }
1379
- this.nodePick.emit(node);
1380
- }
1381
- }
1382
- GraphWalkerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GraphWalkerComponent, deps: [{ token: i3.GraphService }, { token: i2$1.DialogService }], target: i0.ɵɵFactoryTarget.Component });
1383
- GraphWalkerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GraphWalkerComponent, selector: "cadmus-graph-walker", inputs: { nodeId: "nodeId", canPick: "canPick" }, outputs: { nodePick: "nodePick" }, ngImport: i0, template: "<div id=\"container\">\r\n <!-- graph -->\r\n <div id=\"graph\">\r\n <ngx-graph\r\n class=\"chart-container\"\r\n [showMiniMap]=\"true\"\r\n [links]=\"(edges$ | async) || []\"\r\n [nodes]=\"(nodes$ | async) || []\"\r\n [update$]=\"update$\"\r\n [center$]=\"center$\"\r\n [zoomToFit$]=\"zoomToFit$\"\r\n layout=\"colaForceDirected\"\r\n (select)=\"onNodeSelect($event)\"\r\n >\r\n <ng-template #defsTemplate>\r\n <svg:marker\r\n id=\"arrow\"\r\n viewBox=\"0 -5 10 10\"\r\n refX=\"8\"\r\n refY=\"0\"\r\n markerWidth=\"4\"\r\n markerHeight=\"4\"\r\n orient=\"auto\"\r\n >\r\n <svg:path d=\"M0,-5L10,0L0,5\" class=\"arrow-head\" />\r\n </svg:marker>\r\n </ng-template>\r\n\r\n <!-- cluster template -->\r\n <ng-template #clusterTemplate let-cluster>\r\n <svg:g class=\"node cluster\">\r\n <svg:rect\r\n rx=\"5\"\r\n ry=\"5\"\r\n [attr.width]=\"cluster.dimension.width\"\r\n [attr.height]=\"cluster.dimension.height\"\r\n [attr.fill]=\"cluster.data.color\"\r\n />\r\n </svg:g>\r\n </ng-template>\r\n\r\n <!-- node template -->\r\n <ng-template #nodeTemplate let-node>\r\n <svg:g class=\"node\" (dblclick)=\"onNodeDblClick(node)\">\r\n <svg:rect\r\n [class.selected]=\"node.data?.selected\"\r\n [attr.width]=\"node.dimension.width\"\r\n [attr.height]=\"node.dimension.height\"\r\n [attr.fill]=\"node.data.customColor || node.data.color\"\r\n />\r\n <svg:text\r\n alignment-baseline=\"central\"\r\n [attr.x]=\"10\"\r\n [attr.y]=\"node.dimension.height / 2\"\r\n >\r\n {{ node.label }}\r\n </svg:text>\r\n </svg:g>\r\n </ng-template>\r\n\r\n <!-- link template -->\r\n <ng-template #linkTemplate let-link>\r\n <svg:g class=\"edge\">\r\n <svg:path\r\n class=\"line\"\r\n stroke-width=\"2\"\r\n marker-end=\"url(#arrow)\"\r\n ></svg:path>\r\n <svg:text class=\"edge-label\" text-anchor=\"middle\">\r\n <textPath\r\n class=\"text-path\"\r\n [attr.href]=\"'#' + link.id\"\r\n [style.dominant-baseline]=\"link.dominantBaseline\"\r\n startOffset=\"50%\"\r\n >\r\n {{ link.label }}\r\n </textPath>\r\n </svg:text>\r\n </svg:g>\r\n </ng-template>\r\n </ngx-graph>\r\n </div>\r\n\r\n <!-- tools -->\r\n <div id=\"tools\">\r\n <div id=\"bar\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Center\"\r\n (click)=\"center$.next(true)\"\r\n >\r\n <mat-icon>filter_center_focus</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Zoom to fit\"\r\n (click)=\"zoomToFit$.next(true)\"\r\n >\r\n <mat-icon>fit_screen</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Reset\"\r\n (click)=\"update$.next(true)\"\r\n >\r\n <mat-icon>restart_alt</mat-icon>\r\n </button>\r\n <span *ngIf=\"nodes$ | async as nodes\" class=\"muted\"\r\n >N:{{ nodes.length }} E:{{ (edges$ | async)?.length }}</span\r\n >\r\n <button\r\n *ngIf=\"canPick\"\r\n type=\"button\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Pick the selected node\"\r\n [disabled]=\"!(selectedNode$ | async)\"\r\n (click)=\"pickSelectedNode()\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n </button>\r\n </div>\r\n <!-- progress -->\r\n <div id=\"progress\">\r\n <mat-progress-bar\r\n mode=\"indeterminate\"\r\n *ngIf=\"loading$ | async\"\r\n ></mat-progress-bar>\r\n </div>\r\n <div id=\"filters\">\r\n <div id=\"filter-head\" *ngIf=\"selectedNode$ | async as node\">\r\n <span [style.color]=\"node.data.color || 'black'\">&#x2b24;</span>\r\n <span style=\"margin-left: 6px\" matTooltip=\"{{ node.data.uri }}\">{{\r\n node | graphNodeLabel\r\n }}</span>\r\n <span class=\"muted\" style=\"margin-left: 8px; font-size: 90%\">{{\r\n node.id\r\n }}</span>\r\n </div>\r\n <mat-tab-group>\r\n <!-- N-outs -->\r\n <mat-tab *ngIf=\"nOutFilter$ | async as nOutFilter\">\r\n <ng-template mat-tab-label>\r\n N<mat-icon>logout</mat-icon>\r\n </ng-template>\r\n <cadmus-walker-triple-filter\r\n [filter]=\"nOutFilter\"\r\n (filterChange)=\"onNOutFilterChange($event)\"\r\n ></cadmus-walker-triple-filter>\r\n </mat-tab>\r\n <!-- N-ins -->\r\n <mat-tab *ngIf=\"nInFilter$ | async as nInFilter\">\r\n <ng-template mat-tab-label> N<mat-icon>login</mat-icon> </ng-template>\r\n <cadmus-walker-triple-filter\r\n [filter]=\"nInFilter\"\r\n (filterChange)=\"onNInFilterChange($event)\"\r\n ></cadmus-walker-triple-filter>\r\n </mat-tab>\r\n <!-- P-outs -->\r\n <mat-tab *ngIf=\"pOutFilter$ | async as pOutFilter\">\r\n <ng-template mat-tab-label>\r\n P<mat-icon>logout</mat-icon>\r\n </ng-template>\r\n <cadmus-walker-linked-node-filter\r\n [filter]=\"pOutFilter\"\r\n (filterChange)=\"onPOutFilterChange($event)\"\r\n ></cadmus-walker-linked-node-filter>\r\n </mat-tab>\r\n <!-- P-ins -->\r\n <mat-tab *ngIf=\"pInFilter$ | async as pInFilter\">\r\n <ng-template mat-tab-label> P<mat-icon>login</mat-icon> </ng-template>\r\n <cadmus-walker-linked-node-filter\r\n [filter]=\"pInFilter\"\r\n (filterChange)=\"onPInFilterChange($event)\"\r\n ></cadmus-walker-linked-node-filter>\r\n </mat-tab>\r\n <!-- P-lit -->\r\n <mat-tab *ngIf=\"pLitFilter$ | async as pLitFilter\">\r\n <ng-template mat-tab-label>\r\n P<mat-icon>exit_to_app</mat-icon>\r\n </ng-template>\r\n <cadmus-walker-linked-literal-filter\r\n [filter]=\"pLitFilter\"\r\n (filterChange)=\"onPLitFilterChange($event)\"\r\n ></cadmus-walker-linked-literal-filter>\r\n </mat-tab>\r\n </mat-tab-group>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["div#filter-head{border:1px solid #f8f1ae;border-radius:4px;padding:4px;margin-bottom:4px;background-color:#f8f1ae;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.muted{color:silver}.selected{stroke-width:2px;stroke:#e7d211}#container{width:100%;max-width:100%;height:100%;max-height:100%;display:grid;grid-template-rows:1fr;grid-template-columns:auto 1fr;grid-template-areas:\"tools graph\";gap:8px}#graph{grid-area:graph}#tools{grid-area:tools;padding:8px;border:1px solid silver;height:100%;max-height:100%;min-width:300px;background-color:#fdfdfd}#tools #bar{display:flex;align-items:center;flex-wrap:wrap}@media only screen and (max-width: 959px){#container{grid-template-rows:auto 1fr;grid-template-columns:1fr;grid-template-areas:\"tools\" \"graph\"}}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i7.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i6$1.MatProgressBar, selector: "mat-progress-bar", inputs: ["color", "value", "bufferValue", "mode"], outputs: ["animationEnd"], exportAs: ["matProgressBar"] }, { kind: "directive", type: i7$2.MatTabLabel, selector: "[mat-tab-label], [matTabLabel]" }, { kind: "component", type: i7$2.MatTab, selector: "mat-tab", inputs: ["disabled"], exportAs: ["matTab"] }, { kind: "component", type: i7$2.MatTabGroup, selector: "mat-tab-group", inputs: ["color", "disableRipple", "fitInkBarToContent", "mat-stretch-tabs"], exportAs: ["matTabGroup"] }, { kind: "directive", type: i10.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i9$1.GraphComponent, selector: "ngx-graph", inputs: ["nodes", "clusters", "links", "activeEntries", "curve", "draggingEnabled", "nodeHeight", "nodeMaxHeight", "nodeMinHeight", "nodeWidth", "nodeMinWidth", "nodeMaxWidth", "panningEnabled", "panningAxis", "enableZoom", "zoomSpeed", "minZoomLevel", "maxZoomLevel", "autoZoom", "panOnZoom", "animate", "autoCenter", "update$", "center$", "zoomToFit$", "panToNode$", "layout", "layoutSettings", "enableTrackpadSupport", "showMiniMap", "miniMapMaxWidth", "miniMapMaxHeight", "miniMapPosition", "view", "scheme", "customColors", "animations", "groupResultsBy", "zoomLevel", "panOffsetX", "panOffsetY"], outputs: ["select", "activate", "deactivate", "zoomChange", "clickHandler"] }, { kind: "component", type: LinkedLiteralFilterComponent, selector: "cadmus-walker-linked-literal-filter", inputs: ["disabled", "hasPager", "total", "filter"], outputs: ["filterChange"] }, { kind: "component", type: LinkedNodeFilterComponent, selector: "cadmus-walker-linked-node-filter", inputs: ["disabled", "hasPager", "total", "filter"], outputs: ["filterChange"] }, { kind: "component", type: TripleFilterComponent, selector: "cadmus-walker-triple-filter", inputs: ["disabled", "hasPager", "total", "filter"], outputs: ["filterChange"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }, { kind: "pipe", type: GraphNodeLabelPipe, name: "graphNodeLabel" }] });
1384
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GraphWalkerComponent, decorators: [{
1385
- type: Component,
1386
- args: [{ selector: 'cadmus-graph-walker', template: "<div id=\"container\">\r\n <!-- graph -->\r\n <div id=\"graph\">\r\n <ngx-graph\r\n class=\"chart-container\"\r\n [showMiniMap]=\"true\"\r\n [links]=\"(edges$ | async) || []\"\r\n [nodes]=\"(nodes$ | async) || []\"\r\n [update$]=\"update$\"\r\n [center$]=\"center$\"\r\n [zoomToFit$]=\"zoomToFit$\"\r\n layout=\"colaForceDirected\"\r\n (select)=\"onNodeSelect($event)\"\r\n >\r\n <ng-template #defsTemplate>\r\n <svg:marker\r\n id=\"arrow\"\r\n viewBox=\"0 -5 10 10\"\r\n refX=\"8\"\r\n refY=\"0\"\r\n markerWidth=\"4\"\r\n markerHeight=\"4\"\r\n orient=\"auto\"\r\n >\r\n <svg:path d=\"M0,-5L10,0L0,5\" class=\"arrow-head\" />\r\n </svg:marker>\r\n </ng-template>\r\n\r\n <!-- cluster template -->\r\n <ng-template #clusterTemplate let-cluster>\r\n <svg:g class=\"node cluster\">\r\n <svg:rect\r\n rx=\"5\"\r\n ry=\"5\"\r\n [attr.width]=\"cluster.dimension.width\"\r\n [attr.height]=\"cluster.dimension.height\"\r\n [attr.fill]=\"cluster.data.color\"\r\n />\r\n </svg:g>\r\n </ng-template>\r\n\r\n <!-- node template -->\r\n <ng-template #nodeTemplate let-node>\r\n <svg:g class=\"node\" (dblclick)=\"onNodeDblClick(node)\">\r\n <svg:rect\r\n [class.selected]=\"node.data?.selected\"\r\n [attr.width]=\"node.dimension.width\"\r\n [attr.height]=\"node.dimension.height\"\r\n [attr.fill]=\"node.data.customColor || node.data.color\"\r\n />\r\n <svg:text\r\n alignment-baseline=\"central\"\r\n [attr.x]=\"10\"\r\n [attr.y]=\"node.dimension.height / 2\"\r\n >\r\n {{ node.label }}\r\n </svg:text>\r\n </svg:g>\r\n </ng-template>\r\n\r\n <!-- link template -->\r\n <ng-template #linkTemplate let-link>\r\n <svg:g class=\"edge\">\r\n <svg:path\r\n class=\"line\"\r\n stroke-width=\"2\"\r\n marker-end=\"url(#arrow)\"\r\n ></svg:path>\r\n <svg:text class=\"edge-label\" text-anchor=\"middle\">\r\n <textPath\r\n class=\"text-path\"\r\n [attr.href]=\"'#' + link.id\"\r\n [style.dominant-baseline]=\"link.dominantBaseline\"\r\n startOffset=\"50%\"\r\n >\r\n {{ link.label }}\r\n </textPath>\r\n </svg:text>\r\n </svg:g>\r\n </ng-template>\r\n </ngx-graph>\r\n </div>\r\n\r\n <!-- tools -->\r\n <div id=\"tools\">\r\n <div id=\"bar\">\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Center\"\r\n (click)=\"center$.next(true)\"\r\n >\r\n <mat-icon>filter_center_focus</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n mat-icon-button\r\n matTooltip=\"Zoom to fit\"\r\n (click)=\"zoomToFit$.next(true)\"\r\n >\r\n <mat-icon>fit_screen</mat-icon>\r\n </button>\r\n <button\r\n type=\"button\"\r\n color=\"warn\"\r\n mat-icon-button\r\n matTooltip=\"Reset\"\r\n (click)=\"update$.next(true)\"\r\n >\r\n <mat-icon>restart_alt</mat-icon>\r\n </button>\r\n <span *ngIf=\"nodes$ | async as nodes\" class=\"muted\"\r\n >N:{{ nodes.length }} E:{{ (edges$ | async)?.length }}</span\r\n >\r\n <button\r\n *ngIf=\"canPick\"\r\n type=\"button\"\r\n color=\"primary\"\r\n mat-icon-button\r\n matTooltip=\"Pick the selected node\"\r\n [disabled]=\"!(selectedNode$ | async)\"\r\n (click)=\"pickSelectedNode()\"\r\n >\r\n <mat-icon>check_circle</mat-icon>\r\n </button>\r\n </div>\r\n <!-- progress -->\r\n <div id=\"progress\">\r\n <mat-progress-bar\r\n mode=\"indeterminate\"\r\n *ngIf=\"loading$ | async\"\r\n ></mat-progress-bar>\r\n </div>\r\n <div id=\"filters\">\r\n <div id=\"filter-head\" *ngIf=\"selectedNode$ | async as node\">\r\n <span [style.color]=\"node.data.color || 'black'\">&#x2b24;</span>\r\n <span style=\"margin-left: 6px\" matTooltip=\"{{ node.data.uri }}\">{{\r\n node | graphNodeLabel\r\n }}</span>\r\n <span class=\"muted\" style=\"margin-left: 8px; font-size: 90%\">{{\r\n node.id\r\n }}</span>\r\n </div>\r\n <mat-tab-group>\r\n <!-- N-outs -->\r\n <mat-tab *ngIf=\"nOutFilter$ | async as nOutFilter\">\r\n <ng-template mat-tab-label>\r\n N<mat-icon>logout</mat-icon>\r\n </ng-template>\r\n <cadmus-walker-triple-filter\r\n [filter]=\"nOutFilter\"\r\n (filterChange)=\"onNOutFilterChange($event)\"\r\n ></cadmus-walker-triple-filter>\r\n </mat-tab>\r\n <!-- N-ins -->\r\n <mat-tab *ngIf=\"nInFilter$ | async as nInFilter\">\r\n <ng-template mat-tab-label> N<mat-icon>login</mat-icon> </ng-template>\r\n <cadmus-walker-triple-filter\r\n [filter]=\"nInFilter\"\r\n (filterChange)=\"onNInFilterChange($event)\"\r\n ></cadmus-walker-triple-filter>\r\n </mat-tab>\r\n <!-- P-outs -->\r\n <mat-tab *ngIf=\"pOutFilter$ | async as pOutFilter\">\r\n <ng-template mat-tab-label>\r\n P<mat-icon>logout</mat-icon>\r\n </ng-template>\r\n <cadmus-walker-linked-node-filter\r\n [filter]=\"pOutFilter\"\r\n (filterChange)=\"onPOutFilterChange($event)\"\r\n ></cadmus-walker-linked-node-filter>\r\n </mat-tab>\r\n <!-- P-ins -->\r\n <mat-tab *ngIf=\"pInFilter$ | async as pInFilter\">\r\n <ng-template mat-tab-label> P<mat-icon>login</mat-icon> </ng-template>\r\n <cadmus-walker-linked-node-filter\r\n [filter]=\"pInFilter\"\r\n (filterChange)=\"onPInFilterChange($event)\"\r\n ></cadmus-walker-linked-node-filter>\r\n </mat-tab>\r\n <!-- P-lit -->\r\n <mat-tab *ngIf=\"pLitFilter$ | async as pLitFilter\">\r\n <ng-template mat-tab-label>\r\n P<mat-icon>exit_to_app</mat-icon>\r\n </ng-template>\r\n <cadmus-walker-linked-literal-filter\r\n [filter]=\"pLitFilter\"\r\n (filterChange)=\"onPLitFilterChange($event)\"\r\n ></cadmus-walker-linked-literal-filter>\r\n </mat-tab>\r\n </mat-tab-group>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["div#filter-head{border:1px solid #f8f1ae;border-radius:4px;padding:4px;margin-bottom:4px;background-color:#f8f1ae;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.muted{color:silver}.selected{stroke-width:2px;stroke:#e7d211}#container{width:100%;max-width:100%;height:100%;max-height:100%;display:grid;grid-template-rows:1fr;grid-template-columns:auto 1fr;grid-template-areas:\"tools graph\";gap:8px}#graph{grid-area:graph}#tools{grid-area:tools;padding:8px;border:1px solid silver;height:100%;max-height:100%;min-width:300px;background-color:#fdfdfd}#tools #bar{display:flex;align-items:center;flex-wrap:wrap}@media only screen and (max-width: 959px){#container{grid-template-rows:auto 1fr;grid-template-columns:1fr;grid-template-areas:\"tools\" \"graph\"}}\n"] }]
1387
- }], ctorParameters: function () { return [{ type: i3.GraphService }, { type: i2$1.DialogService }]; }, propDecorators: { nodeId: [{
1388
- type: Input
1389
- }], canPick: [{
1390
- type: Input
1391
- }], nodePick: [{
1392
- type: Output
1393
- }] } });
1394
-
1395
- class CadmusGraphUiExModule {
1396
- }
1397
- CadmusGraphUiExModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: CadmusGraphUiExModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
1398
- CadmusGraphUiExModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: CadmusGraphUiExModule, declarations: [GraphNodeLabelPipe,
1399
- GraphWalkerComponent,
1400
- LinkedLiteralFilterComponent,
1401
- LinkedNodeFilterComponent,
1402
- TripleFilterComponent], imports: [CommonModule,
1403
- FormsModule,
1404
- ReactiveFormsModule,
1405
- HttpClientModule,
1406
- // material
1407
- MatAutocompleteModule,
1408
- MatButtonModule,
1409
- MatCheckboxModule,
1410
- MatChipsModule,
1411
- MatFormFieldModule,
1412
- MatIconModule,
1413
- MatInputModule,
1414
- MatListModule,
1415
- MatPaginatorModule,
1416
- MatProgressBarModule,
1417
- MatSelectModule,
1418
- MatTabsModule,
1419
- MatTooltipModule,
1420
- // vendor
1421
- NgxGraphModule,
1422
- // Cadmus
1423
- NgToolsModule,
1424
- NgMatToolsModule,
1425
- CadmusCoreModule,
1426
- CadmusApiModule,
1427
- CadmusRefsLookupModule,
1428
- CadmusGraphUiModule], exports: [GraphNodeLabelPipe,
1429
- GraphWalkerComponent,
1430
- CadmusApiModule,
1431
- LinkedLiteralFilterComponent,
1432
- LinkedNodeFilterComponent,
1433
- TripleFilterComponent] });
1434
- CadmusGraphUiExModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: CadmusGraphUiExModule, imports: [CommonModule,
1435
- FormsModule,
1436
- ReactiveFormsModule,
1437
- HttpClientModule,
1438
- // material
1439
- MatAutocompleteModule,
1440
- MatButtonModule,
1441
- MatCheckboxModule,
1442
- MatChipsModule,
1443
- MatFormFieldModule,
1444
- MatIconModule,
1445
- MatInputModule,
1446
- MatListModule,
1447
- MatPaginatorModule,
1448
- MatProgressBarModule,
1449
- MatSelectModule,
1450
- MatTabsModule,
1451
- MatTooltipModule,
1452
- // vendor
1453
- NgxGraphModule,
1454
- // Cadmus
1455
- NgToolsModule,
1456
- NgMatToolsModule,
1457
- CadmusCoreModule,
1458
- CadmusApiModule,
1459
- CadmusRefsLookupModule,
1460
- CadmusGraphUiModule, CadmusApiModule] });
1461
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: CadmusGraphUiExModule, decorators: [{
1462
- type: NgModule,
1463
- args: [{
1464
- declarations: [
1465
- GraphNodeLabelPipe,
1466
- GraphWalkerComponent,
1467
- LinkedLiteralFilterComponent,
1468
- LinkedNodeFilterComponent,
1469
- TripleFilterComponent,
1470
- ],
1471
- imports: [
1472
- CommonModule,
1473
- FormsModule,
1474
- ReactiveFormsModule,
1475
- HttpClientModule,
1476
- // material
1477
- MatAutocompleteModule,
1478
- MatButtonModule,
1479
- MatCheckboxModule,
1480
- MatChipsModule,
1481
- MatFormFieldModule,
1482
- MatIconModule,
1483
- MatInputModule,
1484
- MatListModule,
1485
- MatPaginatorModule,
1486
- MatProgressBarModule,
1487
- MatSelectModule,
1488
- MatTabsModule,
1489
- MatTooltipModule,
1490
- // vendor
1491
- NgxGraphModule,
1492
- // Cadmus
1493
- NgToolsModule,
1494
- NgMatToolsModule,
1495
- CadmusCoreModule,
1496
- CadmusApiModule,
1497
- CadmusRefsLookupModule,
1498
- CadmusGraphUiModule
1499
- ],
1500
- exports: [
1501
- GraphNodeLabelPipe,
1502
- GraphWalkerComponent,
1503
- CadmusApiModule,
1504
- LinkedLiteralFilterComponent,
1505
- LinkedNodeFilterComponent,
1506
- TripleFilterComponent,
1507
- ],
1508
- }]
1509
- }] });
1510
-
1511
- /*
1512
- * Public API Surface of cadmus-graph-ui
1513
- */
1514
-
1515
- /**
1516
- * Generated bundle index. Do not edit.
1517
- */
1518
-
1519
- export { CadmusGraphUiExModule, GraphNodeLabelPipe, GraphWalker, GraphWalkerComponent, LinkedLiteralFilterComponent, LinkedNodeFilterComponent, TripleFilterComponent };
1520
- //# sourceMappingURL=myrmidon-cadmus-graph-ui-ex.mjs.map