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

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