turbogui-angular 20.4.0 → 20.5.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.
@@ -11,13 +11,13 @@ import { CommonModule } from '@angular/common';
11
11
  import { take, filter } from 'rxjs/operators';
12
12
  import { trigger, transition, style, animate } from '@angular/animations';
13
13
  import { ComponentPortal, DomPortalOutlet } from '@angular/cdk/portal';
14
- import * as i2$1 from '@angular/material/datepicker';
14
+ import * as i2$1 from '@angular/platform-browser';
15
+ import * as i2$2 from '@angular/material/datepicker';
15
16
  import { MatDatepickerModule } from '@angular/material/datepicker';
16
17
  import { MatNativeDateModule } from '@angular/material/core';
17
18
  import * as i1$1 from '@angular/material/snack-bar';
18
19
  import * as i1$2 from '@angular/router';
19
20
  import { NavigationEnd } from '@angular/router';
20
- import * as i2$2 from '@angular/platform-browser';
21
21
  import { MatFormFieldModule } from '@angular/material/form-field';
22
22
  import * as i4 from '@angular/material/input';
23
23
  import { MatInputModule } from '@angular/material/input';
@@ -581,6 +581,106 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
581
581
  args: ['@busyStateBaseFade']
582
582
  }] } });
583
583
 
584
+ /**
585
+ * TurboGUI is A library that helps with the most common and generic UI elements and functionalities
586
+ *
587
+ * Website : -> http://www.turbogui.org
588
+ * License : -> Licensed under the Apache License, Version 2.0. You may not use this file except in compliance with the License.
589
+ * License Url : -> http://www.apache.org/licenses/LICENSE-2.0
590
+ * CopyRight : -> Copyright 2018 Edertone Advanded Solutions. https://www.edertone.com
591
+ */
592
+ /**
593
+ * A dialog component with an iframe that can be used to display any url or content.
594
+ *
595
+ * We must specify the url in the data parameter when opening the dialog, and we can also specify the title
596
+ * by placing it at the first position of the texts array.
597
+ */
598
+ class DialogIFrameComponent extends DialogBaseComponent {
599
+ static { this.DIALOG_CLASS_NAME = 'DialogIFrameComponent'; }
600
+ constructor(elementRef, dialogRef, sanitizer, data) {
601
+ super(elementRef, dialogRef);
602
+ this.elementRef = elementRef;
603
+ this.dialogRef = dialogRef;
604
+ this.sanitizer = sanitizer;
605
+ this.data = data;
606
+ this.title = '';
607
+ if (data.texts.length > 0) {
608
+ this.title = data.texts[0];
609
+ }
610
+ this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(data.data);
611
+ }
612
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogIFrameComponent, deps: [{ token: i0.ElementRef }, { token: i1.MatDialogRef }, { token: i2$1.DomSanitizer }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
613
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: DialogIFrameComponent, isStandalone: true, selector: "tg-dialog-iframe", providers: [], usesInheritance: true, ngImport: i0, template: "<h2 *ngIf=\"title !== ''\">{{title}}</h2>\r\n\r\n<iframe [src]=\"safeUrl\" title=\"title\"></iframe>", styles: [":host{display:block;width:100%;height:100%}h2{margin-top:0;margin-bottom:25px;width:82%}iframe{width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
614
+ }
615
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogIFrameComponent, decorators: [{
616
+ type: Component,
617
+ args: [{ selector: 'tg-dialog-iframe', imports: [CommonModule], providers: [], template: "<h2 *ngIf=\"title !== ''\">{{title}}</h2>\r\n\r\n<iframe [src]=\"safeUrl\" title=\"title\"></iframe>", styles: [":host{display:block;width:100%;height:100%}h2{margin-top:0;margin-bottom:25px;width:82%}iframe{width:100%;height:100%}\n"] }]
618
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.MatDialogRef }, { type: i2$1.DomSanitizer }, { type: undefined, decorators: [{
619
+ type: Inject,
620
+ args: [MAT_DIALOG_DATA]
621
+ }] }] });
622
+
623
+ /**
624
+ * TurboGUI is A library that helps with the most common and generic UI elements and functionalities
625
+ *
626
+ * Website : -> http://www.turbogui.org
627
+ * License : -> Licensed under the Apache License, Version 2.0. You may not use this file except in compliance with the License.
628
+ * License Url : -> http://www.apache.org/licenses/LICENSE-2.0
629
+ * CopyRight : -> Copyright 2018 Edertone Advanded Solutions. https://www.edertone.com
630
+ */
631
+ /**
632
+ * A dialog component that shows a blob (pdf, image, etc) inside an iframe.
633
+ *
634
+ * We must specify the blol in the data parameter when opening the dialog, and we can also specify the title
635
+ * by placing it at the first position of the texts array.
636
+ */
637
+ class DialogBlobComponent extends DialogBaseComponent {
638
+ static { this.DIALOG_CLASS_NAME = 'DialogBlobComponent'; }
639
+ constructor(elementRef, sanitizer, dialogRef, data) {
640
+ super(elementRef, dialogRef);
641
+ this.elementRef = elementRef;
642
+ this.sanitizer = sanitizer;
643
+ this.dialogRef = dialogRef;
644
+ this.data = data;
645
+ this.title = '';
646
+ this.mimeType = '';
647
+ this.objectUrl = '';
648
+ this.blobUrl = '';
649
+ if (data.texts.length > 0) {
650
+ this.title = data.texts[0];
651
+ }
652
+ }
653
+ ngOnInit() {
654
+ let blob = null;
655
+ let blobInput = this.data?.data?.blob;
656
+ this.mimeType = this.data?.data?.mimeType || 'application/octet-stream';
657
+ if (typeof blobInput === 'string') {
658
+ blob = new Blob([blobInput], { type: this.mimeType });
659
+ }
660
+ else if (blobInput instanceof Blob) {
661
+ blob = blobInput;
662
+ }
663
+ if (blob instanceof Blob) {
664
+ this.objectUrl = URL.createObjectURL(blob);
665
+ this.blobUrl = this.sanitizer.bypassSecurityTrustResourceUrl(this.objectUrl);
666
+ }
667
+ }
668
+ ngOnDestroy() {
669
+ if (this.blobUrl !== '') {
670
+ URL.revokeObjectURL(this.objectUrl);
671
+ }
672
+ }
673
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogBlobComponent, deps: [{ token: i0.ElementRef }, { token: i2$1.DomSanitizer }, { token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
674
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: DialogBlobComponent, isStandalone: true, selector: "tg-dialog-blob", providers: [], usesInheritance: true, ngImport: i0, template: "<h2 *ngIf=\"title !== ''\">{{title}}</h2>\r\n\r\n<!-- For images -->\r\n<img *ngIf=\"mimeType.startsWith('image/')\" [src]=\"blobUrl\" [alt]=\"title\" />\r\n\r\n<!-- For PDFs and other types -->\r\n<iframe *ngIf=\"!mimeType.startsWith('image/')\" [src]=\"blobUrl\" [title]=\"title\"></iframe>", styles: [":host{display:block;width:100%;height:100%}h2{margin-top:0;margin-bottom:25px;width:82%}iframe,img{width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
675
+ }
676
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogBlobComponent, decorators: [{
677
+ type: Component,
678
+ args: [{ selector: 'tg-dialog-blob', imports: [CommonModule], providers: [], template: "<h2 *ngIf=\"title !== ''\">{{title}}</h2>\r\n\r\n<!-- For images -->\r\n<img *ngIf=\"mimeType.startsWith('image/')\" [src]=\"blobUrl\" [alt]=\"title\" />\r\n\r\n<!-- For PDFs and other types -->\r\n<iframe *ngIf=\"!mimeType.startsWith('image/')\" [src]=\"blobUrl\" [title]=\"title\"></iframe>", styles: [":host{display:block;width:100%;height:100%}h2{margin-top:0;margin-bottom:25px;width:82%}iframe,img{width:100%;height:100%}\n"] }]
679
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i2$1.DomSanitizer }, { type: i1.MatDialogRef }, { type: undefined, decorators: [{
680
+ type: Inject,
681
+ args: [MAT_DIALOG_DATA]
682
+ }] }] });
683
+
584
684
  /**
585
685
  * TurboGUI is A library that helps with the most common and generic UI elements and functionalities
586
686
  *
@@ -601,7 +701,7 @@ class DialogDateSelectionComponent extends DialogBaseComponent {
601
701
  this.data = data;
602
702
  }
603
703
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogDateSelectionComponent, deps: [{ token: i0.ElementRef }, { token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
604
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: DialogDateSelectionComponent, isStandalone: true, selector: "tg-dialog-date-selection", providers: [], usesInheritance: true, ngImport: i0, template: "<h2>{{data.texts[0]}}</h2>\r\n\r\n<mat-calendar #calendar\r\n (selectedChange)=\"closeDialog(0, $event)\">\r\n</mat-calendar>", styles: [":host{position:relative;min-height:300px}h1{margin-top:0;margin-bottom:25px;width:82%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i2$1.MatCalendar, selector: "mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["matCalendar"] }, { kind: "ngmodule", type: MatNativeDateModule }] }); }
704
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: DialogDateSelectionComponent, isStandalone: true, selector: "tg-dialog-date-selection", providers: [], usesInheritance: true, ngImport: i0, template: "<h2>{{data.texts[0]}}</h2>\r\n\r\n<mat-calendar #calendar\r\n (selectedChange)=\"closeDialog(0, $event)\">\r\n</mat-calendar>", styles: [":host{position:relative;min-height:300px}h1{margin-top:0;margin-bottom:25px;width:82%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: MatDatepickerModule }, { kind: "component", type: i2$2.MatCalendar, selector: "mat-calendar", inputs: ["headerComponent", "startAt", "startView", "selected", "minDate", "maxDate", "dateFilter", "dateClass", "comparisonStart", "comparisonEnd", "startDateAccessibleName", "endDateAccessibleName"], outputs: ["selectedChange", "yearSelected", "monthSelected", "viewChanged", "_userSelection", "_userDragDrop"], exportAs: ["matCalendar"] }, { kind: "ngmodule", type: MatNativeDateModule }] }); }
605
705
  }
606
706
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogDateSelectionComponent, decorators: [{
607
707
  type: Component,
@@ -939,6 +1039,71 @@ class DialogService extends SingletoneStrictClass {
939
1039
  });
940
1040
  });
941
1041
  }
1042
+ /**
1043
+ * Show a dialog with an iframe inside it, to show external web pages or web applications.
1044
+ *
1045
+ * This method is a shortcut for addDialog() method using DialogIFrameComponent as the dialog component class
1046
+ *
1047
+ * @param properties An object containing the different visual and textual options that this dialog allows:
1048
+ * - url (mandatory): The url to load in the iframe
1049
+ * - title: The title to show at the top of the dialog
1050
+ * - id: see addDialog() docs
1051
+ * - width: see addDialog() docs
1052
+ * - maxWidth: see addDialog() docs
1053
+ * - height: see addDialog() docs
1054
+ * - maxHeight: see addDialog() docs
1055
+ * - modal: see addDialog() docs
1056
+ *
1057
+ * @returns A Promise that resolves once the user closes the dialog
1058
+ */
1059
+ async addIFrameDialog(properties) {
1060
+ if (this._isEnabled) {
1061
+ await this.addDialog(DialogIFrameComponent, {
1062
+ id: properties.id ?? undefined,
1063
+ data: properties.url,
1064
+ texts: properties.title ? [properties.title] : undefined,
1065
+ width: properties.width ?? "98vw",
1066
+ maxWidth: properties.maxWidth ?? "1000px",
1067
+ height: properties.height ?? "98vh",
1068
+ maxHeight: properties.maxHeight ?? "3000px",
1069
+ modal: properties.modal ?? false
1070
+ });
1071
+ }
1072
+ return null;
1073
+ }
1074
+ /**
1075
+ * Show a dialog with a pdf from a binary blob data.
1076
+ *
1077
+ * This method is a shortcut for addDialog() method using DialogBlobComponent as the dialog component class, using the received blob
1078
+ * data with a mime type of 'application/pdf'
1079
+ *
1080
+ * @param properties An object containing the different visual and textual options that this dialog allows:
1081
+ * - blob (mandatory): The binary data containing the pdf file to show. It can be a Blob, an ArrayBuffer or a raw binary string
1082
+ * - title: The title to show at the top of the dialog
1083
+ * - id: see addDialog() docs
1084
+ * - width: see addDialog() docs
1085
+ * - maxWidth: see addDialog() docs
1086
+ * - height: see addDialog() docs
1087
+ * - maxHeight: see addDialog() docs
1088
+ * - modal: see addDialog() docs
1089
+ *
1090
+ * @returns A Promise that resolves once the user closes the dialog
1091
+ */
1092
+ async addPdfDialog(properties) {
1093
+ if (this._isEnabled) {
1094
+ await this.addDialog(DialogBlobComponent, {
1095
+ id: properties.id ?? undefined,
1096
+ data: { blob: properties.blob, mimeType: 'application/pdf' },
1097
+ texts: properties.title ? [properties.title] : undefined,
1098
+ width: properties.width ?? "98vw",
1099
+ maxWidth: properties.maxWidth ?? "1000px",
1100
+ height: properties.height ?? "98vh",
1101
+ maxHeight: properties.maxHeight ?? "3000px",
1102
+ modal: properties.modal ?? false
1103
+ });
1104
+ }
1105
+ return null;
1106
+ }
942
1107
  /**
943
1108
  * Show a dialog with a calendar to let the user pick a date.
944
1109
  *
@@ -949,7 +1114,7 @@ class DialogService extends SingletoneStrictClass {
949
1114
  * - height: see addDialog() docs
950
1115
  * - maxHeight: see addDialog() docs
951
1116
  * - modal: see addDialog() docs
952
- * - title: see addDialog() docs
1117
+ * - title: The title to show at the top of the dialog
953
1118
  * - viewContainerRef: see addDialog() docs
954
1119
  *
955
1120
  * @returns A Promise that resolves to a Date() object selected by the user or null if no selection was made
@@ -1820,7 +1985,7 @@ class RouterBaseService {
1820
1985
  // Clean up BehaviorSubject
1821
1986
  this._currentRoute.complete();
1822
1987
  }
1823
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: RouterBaseService, deps: [{ token: i1$2.Router }, { token: i2$2.Title }], target: i0.ɵɵFactoryTarget.Injectable }); }
1988
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: RouterBaseService, deps: [{ token: i1$2.Router }, { token: i2$1.Title }], target: i0.ɵɵFactoryTarget.Injectable }); }
1824
1989
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: RouterBaseService, providedIn: 'root' }); }
1825
1990
  }
1826
1991
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: RouterBaseService, decorators: [{
@@ -1828,7 +1993,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
1828
1993
  args: [{
1829
1994
  providedIn: 'root',
1830
1995
  }]
1831
- }], ctorParameters: () => [{ type: i1$2.Router }, { type: i2$2.Title }] });
1996
+ }], ctorParameters: () => [{ type: i1$2.Router }, { type: i2$1.Title }] });
1832
1997
 
1833
1998
  /**
1834
1999
  * TurboGUI is A library that helps with the most common and generic UI elements and functionalities
@@ -2347,45 +2512,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
2347
2512
  }]
2348
2513
  }] });
2349
2514
 
2350
- /**
2351
- * TurboGUI is A library that helps with the most common and generic UI elements and functionalities
2352
- *
2353
- * Website : -> http://www.turbogui.org
2354
- * License : -> Licensed under the Apache License, Version 2.0. You may not use this file except in compliance with the License.
2355
- * License Url : -> http://www.apache.org/licenses/LICENSE-2.0
2356
- * CopyRight : -> Copyright 2018 Edertone Advanded Solutions. https://www.edertone.com
2357
- */
2358
- /**
2359
- * A dialog component with an iframe that can be used to display any url or content.
2360
- *
2361
- * We must specify the url in the data parameter when opening the dialog, and we can also specify the title
2362
- * bi placing it at the first position of the texts array.
2363
- */
2364
- class DialogIFrameComponent extends DialogBaseComponent {
2365
- static { this.DIALOG_CLASS_NAME = 'DialogIFrameComponent'; }
2366
- constructor(elementRef, dialogRef, sanitizer, data) {
2367
- super(elementRef, dialogRef);
2368
- this.elementRef = elementRef;
2369
- this.dialogRef = dialogRef;
2370
- this.sanitizer = sanitizer;
2371
- this.data = data;
2372
- this.title = '';
2373
- if (data.texts.length > 0) {
2374
- this.title = data.texts[0];
2375
- }
2376
- this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(data.data);
2377
- }
2378
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogIFrameComponent, deps: [{ token: i0.ElementRef }, { token: i1.MatDialogRef }, { token: i2$2.DomSanitizer }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
2379
- static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: DialogIFrameComponent, isStandalone: true, selector: "tg-dialog-iframe", providers: [], usesInheritance: true, ngImport: i0, template: "<h2 *ngIf=\"title !== ''\">{{title}}</h2>\r\n\r\n<iframe [src]=\"safeUrl\" title=\"data.texts[0]\"></iframe>", styles: [":host{display:block;width:100%;height:100%}h2{margin-top:0;margin-bottom:25px;width:82%}iframe{width:100%;height:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] }); }
2380
- }
2381
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogIFrameComponent, decorators: [{
2382
- type: Component,
2383
- args: [{ selector: 'tg-dialog-iframe', imports: [CommonModule], providers: [], template: "<h2 *ngIf=\"title !== ''\">{{title}}</h2>\r\n\r\n<iframe [src]=\"safeUrl\" title=\"data.texts[0]\"></iframe>", styles: [":host{display:block;width:100%;height:100%}h2{margin-top:0;margin-bottom:25px;width:82%}iframe{width:100%;height:100%}\n"] }]
2384
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.MatDialogRef }, { type: i2$2.DomSanitizer }, { type: undefined, decorators: [{
2385
- type: Inject,
2386
- args: [MAT_DIALOG_DATA]
2387
- }] }] });
2388
-
2389
2515
  /**
2390
2516
  * TurboGUI is A library that helps with the most common and generic UI elements and functionalities
2391
2517
  *