@myrmidon/cadmus-graph-ui-ex 0.0.2 → 1.0.1

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