@net7/components 4.3.2 → 4.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2325,6 +2325,66 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImpo
2325
2325
  type: Input
2326
2326
  }] } });
2327
2327
 
2328
+ //---------------------------
2329
+ // NETWORK.ts
2330
+ //---------------------------
2331
+ class NetworkComponent {
2332
+ constructor() {
2333
+ /** Knows if the component is loaded */
2334
+ this._loaded = false;
2335
+ /** Dynamically load required node modules */
2336
+ this.loadModules = async () => ({
2337
+ ...(await import('vis-network/peer')),
2338
+ ...(await import('vis-data/peer')),
2339
+ });
2340
+ }
2341
+ ngAfterContentChecked() {
2342
+ if (!this.data || this._loaded)
2343
+ return;
2344
+ this._loaded = true;
2345
+ setTimeout(() => {
2346
+ this.loadModules().then((modules) => {
2347
+ const { Network, DataSet } = modules;
2348
+ const nodes = new DataSet(this.data.nodes);
2349
+ const edges = new DataSet(this.data.edges);
2350
+ const network = new Network(document.getElementById(this.data.containerID), // container
2351
+ { nodes, edges }, this.data.libOptions);
2352
+ network.on('click', (params) => {
2353
+ this.onClick(params);
2354
+ });
2355
+ // Set the network instance
2356
+ if (this.data._setInstance)
2357
+ this.data._setInstance(network);
2358
+ });
2359
+ });
2360
+ }
2361
+ onClick(payload) {
2362
+ let url;
2363
+ if (payload.nodes && payload.nodes.length > 0) {
2364
+ const nodeId = payload.nodes[0];
2365
+ const node = this.data.nodes.find(n => n.id === nodeId);
2366
+ // console.log('Node trovato:', node);
2367
+ if (node && node.payload) {
2368
+ url = node.payload;
2369
+ console.log('url:', url);
2370
+ }
2371
+ }
2372
+ if (!this.emit)
2373
+ return;
2374
+ this.emit('click', payload);
2375
+ }
2376
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NetworkComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2377
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "17.3.12", type: NetworkComponent, selector: "n7-network", inputs: { data: "data", emit: "emit" }, ngImport: i0, template: "<div [id]=\"data.containerID\" style=\"width: 100%; height: 100vh;\"></div>" }); }
2378
+ }
2379
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: NetworkComponent, decorators: [{
2380
+ type: Component,
2381
+ args: [{ selector: 'n7-network', template: "<div [id]=\"data.containerID\" style=\"width: 100%; height: 100vh;\"></div>" }]
2382
+ }], propDecorators: { data: [{
2383
+ type: Input
2384
+ }], emit: [{
2385
+ type: Input
2386
+ }] } });
2387
+
2328
2388
  const COMPONENTS = [
2329
2389
  AdvancedAutocompleteComponent,
2330
2390
  AlertComponent,
@@ -2374,6 +2434,7 @@ const COMPONENTS = [
2374
2434
  TreeComponent,
2375
2435
  WizardComponent,
2376
2436
  ProgressLineComponent,
2437
+ NetworkComponent,
2377
2438
  ];
2378
2439
  class DvComponentsLibModule {
2379
2440
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DvComponentsLibModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
@@ -2424,7 +2485,8 @@ class DvComponentsLibModule {
2424
2485
  TooltipContentComponent,
2425
2486
  TreeComponent,
2426
2487
  WizardComponent,
2427
- ProgressLineComponent], imports: [CommonModule, RouterModule], exports: [AdvancedAutocompleteComponent,
2488
+ ProgressLineComponent,
2489
+ NetworkComponent], imports: [CommonModule, RouterModule], exports: [AdvancedAutocompleteComponent,
2428
2490
  AlertComponent,
2429
2491
  AnchorWrapperComponent,
2430
2492
  AvatarComponent,
@@ -2471,7 +2533,8 @@ class DvComponentsLibModule {
2471
2533
  TooltipContentComponent,
2472
2534
  TreeComponent,
2473
2535
  WizardComponent,
2474
- ProgressLineComponent] }); }
2536
+ ProgressLineComponent,
2537
+ NetworkComponent] }); }
2475
2538
  static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DvComponentsLibModule, imports: [CommonModule, RouterModule] }); }
2476
2539
  }
2477
2540
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: DvComponentsLibModule, decorators: [{
@@ -5683,7 +5746,11 @@ const TIMELINE_MOCK = {
5683
5746
  cluster: {
5684
5747
  // contentTemplate: '{count}',
5685
5748
  // fitOnDoubleClick: true,
5686
- clusterCriteria: (f, s) => f.content.charAt(0) === s.content.charAt(0),
5749
+ clusterCriteria: (f, s) => {
5750
+ const fContent = typeof f.content === 'string' ? f.content : '';
5751
+ const sContent = typeof s.content === 'string' ? s.content : '';
5752
+ return fContent.charAt(0) === sContent.charAt(0);
5753
+ },
5687
5754
  },
5688
5755
  showTooltips: false,
5689
5756
  tooltip: {
@@ -5821,7 +5888,11 @@ const TIMELINE_GROUP_MOCK = {
5821
5888
  cluster: {
5822
5889
  // contentTemplate: '{count}',
5823
5890
  // fitOnDoubleClick: true,
5824
- clusterCriteria: (f, s) => f.content.charAt(0) === s.content.charAt(0),
5891
+ clusterCriteria: (f, s) => {
5892
+ const fContent = typeof f.content === 'string' ? f.content : '';
5893
+ const sContent = typeof s.content === 'string' ? s.content : '';
5894
+ return fContent.charAt(0) === sContent.charAt(0);
5895
+ },
5825
5896
  },
5826
5897
  showTooltips: false,
5827
5898
  tooltip: {
@@ -6380,6 +6451,159 @@ const WIZARD_MOCK = {
6380
6451
  ],
6381
6452
  };
6382
6453
 
6454
+ const NETWORK_MOCK = {
6455
+ containerID: 'demo-network',
6456
+ nodes: [
6457
+ { id: 1, label: 'Girolamo Zavattari', group: 'Fulmine', payload: 'https://adalgisa.muruca.cloud/character/65/girolamo-zavattari' },
6458
+ { id: 2, label: 'Pietro e Luigi Borlotti', group: 'Fulmine' },
6459
+ { id: 3, label: 'avvocato Cazzuola', group: 'Fulmine' },
6460
+ { id: 4, label: 'Elsa Delmonte', group: 'Fulmine' },
6461
+ { id: 5, label: 'Maria', group: 'Fulmine' },
6462
+ { id: 6, label: 'Bruno Locati', group: 'Fulmine' },
6463
+ { id: 7, label: 'Felice Testori', group: 'Fulmine' },
6464
+ { id: 8, label: 'Gian Maria Cavenaghi/Caviggioni', group: 'Fulmine' },
6465
+ { id: 9, label: 'Doralice', group: 'Altro (Claudio)' },
6466
+ { id: 10, label: 'Claudio Valeri', group: 'Altro (Claudio)' },
6467
+ { id: 11, label: 'donna Carla', group: 'Altro (Claudio)' },
6468
+ { id: 12, label: 'Antenore', group: 'Altro (Claudio)' },
6469
+ { id: 13, label: 'cav. Bertoloni', group: 'Cognizione' },
6470
+ { id: 14, label: 'Carlos Caçoncellos', group: 'Cognizione' },
6471
+ { id: 15, label: 'Giuseppina', group: 'Cognizione' },
6472
+ { id: 16, label: 'colonnello medico Di Pascuale', group: 'Cognizione' },
6473
+ { id: 17, label: 'dottore', group: 'Cognizione' },
6474
+ { id: 18, label: 'José/Giuseppe', group: 'Cognizione' },
6475
+ { id: 19, label: 'figlio/Gonzalo', group: 'Cognizione' },
6476
+ { id: 20, label: 'mamma/Signora', group: 'Cognizione' }
6477
+ ],
6478
+ edges: [
6479
+ // Relazioni di Girolamo Zavattari (1)
6480
+ { id: 1, from: 1, to: 2, label: 'lavoro (dipendente di)' },
6481
+ { id: 2, from: 1, to: 4, label: 'lavoro (dipendente di)' },
6482
+ { id: 3, from: 1, to: 8, label: 'lavoro (dipendente di)' },
6483
+ // Relazioni di Pietro e Luigi Borlotti (2)
6484
+ { id: 4, from: 2, to: 1, label: 'lavoro (datore di lavoro di)' },
6485
+ // Relazioni di avvocato Cazzuola (3)
6486
+ { id: 5, from: 3, to: 2, label: 'lavoro' },
6487
+ // Relazioni di Elsa Delmonte (4)
6488
+ { id: 6, from: 4, to: 1, label: 'lavoro (datrice di lavoro di)' },
6489
+ { id: 7, from: 4, to: 8, label: 'famiglia (matrimonio con)' },
6490
+ { id: 8, from: 4, to: 6, label: 'relazione amorosa' },
6491
+ // Relazioni di Maria (5)
6492
+ { id: 9, from: 5, to: 4, label: 'lavoro (dipendente di)' },
6493
+ { id: 10, from: 5, to: 8, label: 'lavoro (dipendente di)' },
6494
+ // Relazioni di Bruno Locati (6)
6495
+ { id: 11, from: 6, to: 7, label: 'lavoro (dipendente di)' },
6496
+ { id: 12, from: 6, to: 8, label: 'lavoro (dipendente di)' },
6497
+ // Relazioni di Felice Testori (7)
6498
+ { id: 13, from: 7, to: 7, label: 'lavoro (datore di lavoro di)' },
6499
+ // Relazioni di Gian Maria Cavenaghi/Caviggioni (8)
6500
+ { id: 14, from: 8, to: 1, label: 'lavoro (datore di lavoro di)' },
6501
+ { id: 15, from: 8, to: 4, label: 'famiglia (matrimonio con)' },
6502
+ { id: 16, from: 8, to: 5, label: 'lavoro (datore di lavoro di)' },
6503
+ { id: 17, from: 8, to: 6, label: 'lavoro (datore di lavoro di)' },
6504
+ // Relazioni di Doralice (9)
6505
+ { id: 18, from: 9, to: 10, label: 'relazione amorosa' },
6506
+ // Relazioni di Claudio Valeri (10)
6507
+ { id: 19, from: 10, to: 9, label: 'relazione amorosa' },
6508
+ // Relazioni di donna Carla (11)
6509
+ { id: 20, from: 11, to: 9, label: 'famiglia (zia di)' },
6510
+ // Relazioni di Antenore (12)
6511
+ { id: 21, from: 12, to: 9, label: 'famiglia (zio di)' },
6512
+ // Relazioni di cav. Bertoloni (13)
6513
+ { id: 22, from: 13, to: 14, label: 'proprietario di casa di' },
6514
+ { id: 23, from: 13, to: 16, label: 'proprietario di casa di' },
6515
+ // Relazioni di Carlos Caçoncellos (14)
6516
+ { id: 24, from: 14, to: 13, label: 'affittuario di' },
6517
+ // Relazioni di Giuseppina (15)
6518
+ { id: 25, from: 15, to: 14, label: 'lavoro (dipendente di)' },
6519
+ // Relazioni di colonnello medico Di Pascuale (16)
6520
+ { id: 26, from: 16, to: 13, label: 'affittuario di' },
6521
+ // Relazioni di dottore (17)
6522
+ { id: 27, from: 17, to: 19, label: 'medico di' },
6523
+ // Relazioni di José/Giuseppe (18)
6524
+ { id: 28, from: 18, to: 19, label: 'lavoro (dipendente di)' },
6525
+ { id: 29, from: 18, to: 20, label: 'lavoro (dipendente di)' },
6526
+ // Relazioni di figlio/Gonzalo (19)
6527
+ { id: 30, from: 19, to: 20, label: 'famiglia (figlio di)' },
6528
+ // Relazioni di mamma/Signora (20)
6529
+ { id: 31, from: 20, to: 19, label: 'famiglia (madre di)' }
6530
+ ],
6531
+ libOptions: {
6532
+ nodes: {
6533
+ shape: 'dot',
6534
+ size: 40,
6535
+ font: {
6536
+ size: 14,
6537
+ color: '#333333'
6538
+ }
6539
+ },
6540
+ edges: {
6541
+ arrows: {
6542
+ to: { enabled: true, scaleFactor: 1.2 }
6543
+ },
6544
+ width: 1,
6545
+ font: {
6546
+ size: 10,
6547
+ align: 'middle',
6548
+ color: '#333333'
6549
+ },
6550
+ color: {
6551
+ color: '#666666',
6552
+ highlight: '#333333'
6553
+ }
6554
+ },
6555
+ groups: {
6556
+ 'Fulmine': {
6557
+ color: '#fff2cc',
6558
+ shape: "icon",
6559
+ icon: {
6560
+ face: "'Arial Unicode MS'",
6561
+ code: "☻",
6562
+ size: 40,
6563
+ color: "#fff2cc",
6564
+ }
6565
+ },
6566
+ 'Altro (Claudio)': {
6567
+ color: '#ead1dc',
6568
+ shape: "icon",
6569
+ icon: {
6570
+ face: "'Arial Unicode MS'",
6571
+ code: "☻",
6572
+ size: 40,
6573
+ color: "#ead1dc",
6574
+ }
6575
+ },
6576
+ 'Cognizione': {
6577
+ color: '#c9daf8',
6578
+ shape: "icon",
6579
+ icon: {
6580
+ face: "'Arial Unicode MS'",
6581
+ code: "☻",
6582
+ size: 40,
6583
+ color: "#c9daf8",
6584
+ }
6585
+ }
6586
+ },
6587
+ physics: {
6588
+ stabilization: true,
6589
+ barnesHut: {
6590
+ gravitationalConstant: -3000,
6591
+ springLength: 300,
6592
+ springConstant: 0.02
6593
+ }
6594
+ },
6595
+ interaction: {
6596
+ hover: true,
6597
+ tooltipDelay: 200,
6598
+ zoomView: true,
6599
+ dragView: true
6600
+ },
6601
+ layout: {
6602
+ improvedLayout: true
6603
+ }
6604
+ }
6605
+ };
6606
+
6383
6607
  /*
6384
6608
  * Public API Surface of dv-components-lib
6385
6609
  */
@@ -6389,5 +6613,5 @@ const WIZARD_MOCK = {
6389
6613
  * Generated bundle index. Do not edit.
6390
6614
  */
6391
6615
 
6392
- export { ADVANCED_AUTOCOMPLETE_MOCK, ALERT_MOCK, AVATAR_MOCK, AdvancedAutocompleteComponent, AlertComponent, AnchorWrapperComponent, AvatarComponent, BREADCRUMBS_MOCK, BUBBLECHART_MOCK, BUTTON_MOCK, BreadcrumbsComponent, BubbleChartComponent, ButtonComponent, CAROUSEL_MOCK, CHART_MOCK, CONTENT_PLACEHOLDER_MOCK, CarouselComponent, ChartComponent, ContentPlaceholderComponent, DATA_WIDGET_MOCK, DATEPICKER_MOCK, DataWidgetComponent, DatepickerComponent, DvComponentsLibModule, FACET_HEADER_MOCK, FACET_MOCK, FACET_YEAR_RANGE_MOCK, FILE_SELECTOR_MOCK, FOOTER_MOCK, FacetComponent, FacetHeaderComponent, FacetYearRangeComponent, FileSelectorComponent, FooterComponent, HEADER_MOCK, HERO_MOCK, HISTOGRAM_RANGE_MOCK, HeaderComponent, HeroComponent, HistogramRangeComponent, ICON_MOCK, IMAGE_VIEWER_MOCK, IMAGE_VIEWER_TOOLS_MOCK, INNER_TITLE_MOCK, INPUT_CHECKBOX_MOCK, INPUT_LINK_MOCK, INPUT_SELECT_MOCK, INPUT_TEXTAREA_MOCK, INPUT_TEXT_MOCK, ITEM_PREVIEW_MOCK, IconComponent, ImageViewerComponent, ImageViewerToolsComponent, InnerTitleComponent, InputCheckboxComponent, InputLinkComponent, InputSelectComponent, InputTextComponent, InputTextareaComponent, ItemPreviewComponent, LOADER_MOCK, LoaderComponent, MAP_MOCK, METADATA_VIEWER_MOCK, MIRADOR_MOCK, MapComponent, MetadataViewerComponent, MiradorComponent, NAV_MOCK, NavComponent, PAGINATION_MOCK, PROGRESS_LINE_MOCK, PaginationComponent, ProgressLineComponent, SIDEBAR_HEADER_MOCK, SIGNUP_MOCK, SIMPLE_AUTOCOMPLETE_MOCK, SidebarHeaderComponent, SignupComponent, SimpleAutocompleteComponent, TABLE_MOCK, TAG_MOCK, TEXT_VIEWER_MOCK, TEXT_VIEWER_MOCK_PETRARCA, TIMELINE_GROUP_MOCK, TIMELINE_MOCK, TOAST_MOCK, TOOLTIP_CONTENT_MOCK, TREE_MOCK, TableComponent, TagComponent, TextViewerComponent, TimelineComponent, ToastComponent, TooltipContentComponent, TreeComponent, WIZARD_MOCK, WizardComponent };
6616
+ export { ADVANCED_AUTOCOMPLETE_MOCK, ALERT_MOCK, AVATAR_MOCK, AdvancedAutocompleteComponent, AlertComponent, AnchorWrapperComponent, AvatarComponent, BREADCRUMBS_MOCK, BUBBLECHART_MOCK, BUTTON_MOCK, BreadcrumbsComponent, BubbleChartComponent, ButtonComponent, CAROUSEL_MOCK, CHART_MOCK, CONTENT_PLACEHOLDER_MOCK, CarouselComponent, ChartComponent, ContentPlaceholderComponent, DATA_WIDGET_MOCK, DATEPICKER_MOCK, DataWidgetComponent, DatepickerComponent, DvComponentsLibModule, FACET_HEADER_MOCK, FACET_MOCK, FACET_YEAR_RANGE_MOCK, FILE_SELECTOR_MOCK, FOOTER_MOCK, FacetComponent, FacetHeaderComponent, FacetYearRangeComponent, FileSelectorComponent, FooterComponent, HEADER_MOCK, HERO_MOCK, HISTOGRAM_RANGE_MOCK, HeaderComponent, HeroComponent, HistogramRangeComponent, ICON_MOCK, IMAGE_VIEWER_MOCK, IMAGE_VIEWER_TOOLS_MOCK, INNER_TITLE_MOCK, INPUT_CHECKBOX_MOCK, INPUT_LINK_MOCK, INPUT_SELECT_MOCK, INPUT_TEXTAREA_MOCK, INPUT_TEXT_MOCK, ITEM_PREVIEW_MOCK, IconComponent, ImageViewerComponent, ImageViewerToolsComponent, InnerTitleComponent, InputCheckboxComponent, InputLinkComponent, InputSelectComponent, InputTextComponent, InputTextareaComponent, ItemPreviewComponent, LOADER_MOCK, LoaderComponent, MAP_MOCK, METADATA_VIEWER_MOCK, MIRADOR_MOCK, MapComponent, MetadataViewerComponent, MiradorComponent, NAV_MOCK, NETWORK_MOCK, NavComponent, NetworkComponent, PAGINATION_MOCK, PROGRESS_LINE_MOCK, PaginationComponent, ProgressLineComponent, SIDEBAR_HEADER_MOCK, SIGNUP_MOCK, SIMPLE_AUTOCOMPLETE_MOCK, SidebarHeaderComponent, SignupComponent, SimpleAutocompleteComponent, TABLE_MOCK, TAG_MOCK, TEXT_VIEWER_MOCK, TEXT_VIEWER_MOCK_PETRARCA, TIMELINE_GROUP_MOCK, TIMELINE_MOCK, TOAST_MOCK, TOOLTIP_CONTENT_MOCK, TREE_MOCK, TableComponent, TagComponent, TextViewerComponent, TimelineComponent, ToastComponent, TooltipContentComponent, TreeComponent, WIZARD_MOCK, WizardComponent };
6393
6617
  //# sourceMappingURL=net7-components.mjs.map