turbogui-angular 20.4.0 → 20.6.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.
- package/fesm2022/turbogui-angular.mjs +234 -83
- package/fesm2022/turbogui-angular.mjs.map +1 -1
- package/main/controller/dialog.service.d.ts +93 -4
- package/main/controller/dialog.service.d.ts.map +1 -1
- package/main/view/components/dialog-blob/dialog-blob.component.d.ts +30 -0
- package/main/view/components/dialog-blob/dialog-blob.component.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -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/
|
|
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$
|
|
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,
|
|
@@ -611,6 +711,42 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
|
|
|
611
711
|
args: [MAT_DIALOG_DATA]
|
|
612
712
|
}] }] });
|
|
613
713
|
|
|
714
|
+
/**
|
|
715
|
+
* TurboGUI is A library that helps with the most common and generic UI elements and functionalities
|
|
716
|
+
*
|
|
717
|
+
* Website : -> http://www.turbogui.org
|
|
718
|
+
* License : -> Licensed under the Apache License, Version 2.0. You may not use this file except in compliance with the License.
|
|
719
|
+
* License Url : -> http://www.apache.org/licenses/LICENSE-2.0
|
|
720
|
+
* CopyRight : -> Copyright 2018 Edertone Advanded Solutions. https://www.edertone.com
|
|
721
|
+
*/
|
|
722
|
+
/**
|
|
723
|
+
* A dialog component with a single option button, to be used with dialog service
|
|
724
|
+
*/
|
|
725
|
+
class DialogSingleOptionComponent extends DialogBaseComponent {
|
|
726
|
+
static { this.DIALOG_CLASS_NAME = 'DialogSingleOptionComponent'; }
|
|
727
|
+
constructor(elementRef, dialogRef, data) {
|
|
728
|
+
super(elementRef, dialogRef);
|
|
729
|
+
this.elementRef = elementRef;
|
|
730
|
+
this.dialogRef = dialogRef;
|
|
731
|
+
this.data = data;
|
|
732
|
+
if (data.texts.length < 1) {
|
|
733
|
+
throw new Error('DialogSingleOptionComponent expects 2 texts: The title and optionally a description');
|
|
734
|
+
}
|
|
735
|
+
if (data.options.length !== 1) {
|
|
736
|
+
throw new Error('DialogSingleOptionComponent expects only one option');
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogSingleOptionComponent, deps: [{ token: i0.ElementRef }, { token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
740
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: DialogSingleOptionComponent, isStandalone: true, selector: "tg-dialog-single-option", providers: [], usesInheritance: true, ngImport: i0, template: "<h3>\r\n {{data.texts[0]}}\r\n</h3>\r\n\r\n<p *ngIf=\"data.texts.length > 1\">\r\n {{data.texts[1]}}\r\n</p>\r\n\r\n<button mat-raised-button color=\"primary\"\r\n (click)=\"closeDialog(0)\">\r\n \r\n {{data.options[0]}}\r\n \r\n</button>", styles: [":host{min-height:300px}h3{margin-bottom:25px}p{margin-bottom:52px}button{float:right}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }] }); }
|
|
741
|
+
}
|
|
742
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogSingleOptionComponent, decorators: [{
|
|
743
|
+
type: Component,
|
|
744
|
+
args: [{ selector: 'tg-dialog-single-option', imports: [CommonModule, MatButtonModule], providers: [], template: "<h3>\r\n {{data.texts[0]}}\r\n</h3>\r\n\r\n<p *ngIf=\"data.texts.length > 1\">\r\n {{data.texts[1]}}\r\n</p>\r\n\r\n<button mat-raised-button color=\"primary\"\r\n (click)=\"closeDialog(0)\">\r\n \r\n {{data.options[0]}}\r\n \r\n</button>", styles: [":host{min-height:300px}h3{margin-bottom:25px}p{margin-bottom:52px}button{float:right}\n"] }]
|
|
745
|
+
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.MatDialogRef }, { type: undefined, decorators: [{
|
|
746
|
+
type: Inject,
|
|
747
|
+
args: [MAT_DIALOG_DATA]
|
|
748
|
+
}] }] });
|
|
749
|
+
|
|
614
750
|
/**
|
|
615
751
|
* TurboGUI is A library that helps with the most common and generic UI elements and functionalities
|
|
616
752
|
*
|
|
@@ -939,6 +1075,71 @@ class DialogService extends SingletoneStrictClass {
|
|
|
939
1075
|
});
|
|
940
1076
|
});
|
|
941
1077
|
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Show a dialog with an iframe inside it, to show external web pages or web applications.
|
|
1080
|
+
*
|
|
1081
|
+
* This method is a shortcut for addDialog() method using DialogIFrameComponent as the dialog component class
|
|
1082
|
+
*
|
|
1083
|
+
* @param properties An object containing the different visual and textual options that this dialog allows:
|
|
1084
|
+
* - url (mandatory): The url to load in the iframe
|
|
1085
|
+
* - title: The title to show at the top of the dialog
|
|
1086
|
+
* - id: see addDialog() docs
|
|
1087
|
+
* - width: see addDialog() docs
|
|
1088
|
+
* - maxWidth: see addDialog() docs
|
|
1089
|
+
* - height: see addDialog() docs
|
|
1090
|
+
* - maxHeight: see addDialog() docs
|
|
1091
|
+
* - modal: see addDialog() docs
|
|
1092
|
+
*
|
|
1093
|
+
* @returns A Promise that resolves once the user closes the dialog
|
|
1094
|
+
*/
|
|
1095
|
+
async addIFrameDialog(properties) {
|
|
1096
|
+
if (this._isEnabled) {
|
|
1097
|
+
await this.addDialog(DialogIFrameComponent, {
|
|
1098
|
+
id: properties.id ?? undefined,
|
|
1099
|
+
data: properties.url,
|
|
1100
|
+
texts: properties.title ? [properties.title] : undefined,
|
|
1101
|
+
width: properties.width ?? "85vw",
|
|
1102
|
+
maxWidth: properties.maxWidth ?? "1200px",
|
|
1103
|
+
height: properties.height ?? "98vh",
|
|
1104
|
+
maxHeight: properties.maxHeight ?? "3000px",
|
|
1105
|
+
modal: properties.modal ?? false
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
return null;
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Show a dialog with a pdf from a binary blob data.
|
|
1112
|
+
*
|
|
1113
|
+
* This method is a shortcut for addDialog() method using DialogBlobComponent as the dialog component class, using the received blob
|
|
1114
|
+
* data with a mime type of 'application/pdf'
|
|
1115
|
+
*
|
|
1116
|
+
* @param properties An object containing the different visual and textual options that this dialog allows:
|
|
1117
|
+
* - blob (mandatory): The binary data containing the pdf file to show. It can be a Blob, an ArrayBuffer or a raw binary string
|
|
1118
|
+
* - title: The title to show at the top of the dialog
|
|
1119
|
+
* - id: see addDialog() docs
|
|
1120
|
+
* - width: see addDialog() docs
|
|
1121
|
+
* - maxWidth: see addDialog() docs
|
|
1122
|
+
* - height: see addDialog() docs
|
|
1123
|
+
* - maxHeight: see addDialog() docs
|
|
1124
|
+
* - modal: see addDialog() docs
|
|
1125
|
+
*
|
|
1126
|
+
* @returns A Promise that resolves once the user closes the dialog
|
|
1127
|
+
*/
|
|
1128
|
+
async addPdfDialog(properties) {
|
|
1129
|
+
if (this._isEnabled) {
|
|
1130
|
+
await this.addDialog(DialogBlobComponent, {
|
|
1131
|
+
id: properties.id ?? undefined,
|
|
1132
|
+
data: { blob: properties.blob, mimeType: 'application/pdf' },
|
|
1133
|
+
texts: properties.title ? [properties.title] : undefined,
|
|
1134
|
+
width: properties.width ?? "85vw",
|
|
1135
|
+
maxWidth: properties.maxWidth ?? "1200px",
|
|
1136
|
+
height: properties.height ?? "98vh",
|
|
1137
|
+
maxHeight: properties.maxHeight ?? "3000px",
|
|
1138
|
+
modal: properties.modal ?? false
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
return null;
|
|
1142
|
+
}
|
|
942
1143
|
/**
|
|
943
1144
|
* Show a dialog with a calendar to let the user pick a date.
|
|
944
1145
|
*
|
|
@@ -949,7 +1150,7 @@ class DialogService extends SingletoneStrictClass {
|
|
|
949
1150
|
* - height: see addDialog() docs
|
|
950
1151
|
* - maxHeight: see addDialog() docs
|
|
951
1152
|
* - modal: see addDialog() docs
|
|
952
|
-
* - title:
|
|
1153
|
+
* - title: The title to show at the top of the dialog
|
|
953
1154
|
* - viewContainerRef: see addDialog() docs
|
|
954
1155
|
*
|
|
955
1156
|
* @returns A Promise that resolves to a Date() object selected by the user or null if no selection was made
|
|
@@ -985,7 +1186,8 @@ class DialogService extends SingletoneStrictClass {
|
|
|
985
1186
|
* - height: see addDialog() docs
|
|
986
1187
|
* - maxHeight: see addDialog() docs
|
|
987
1188
|
* - modal: see addDialog() docs
|
|
988
|
-
* -
|
|
1189
|
+
* - dialogClass: A custom component class to use instead of the default DialogErrorComponent.
|
|
1190
|
+
* This custom class must extend DialogErrorComponent
|
|
989
1191
|
*
|
|
990
1192
|
* @returns A Promise that resolves once the user selects the button with the option caption
|
|
991
1193
|
*/
|
|
@@ -995,7 +1197,7 @@ class DialogService extends SingletoneStrictClass {
|
|
|
995
1197
|
if (properties.description && properties.description !== undefined) {
|
|
996
1198
|
texts.push(properties.description);
|
|
997
1199
|
}
|
|
998
|
-
await this.addDialog(properties.
|
|
1200
|
+
await this.addDialog(properties.dialogClass ?? DialogErrorComponent, {
|
|
999
1201
|
id: properties.id ?? undefined,
|
|
1000
1202
|
width: properties.width ?? "70%",
|
|
1001
1203
|
maxWidth: properties.maxWidth ?? "500px",
|
|
@@ -1008,6 +1210,30 @@ class DialogService extends SingletoneStrictClass {
|
|
|
1008
1210
|
}
|
|
1009
1211
|
return null;
|
|
1010
1212
|
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Show a dialog with a message and a single option button to close it.
|
|
1215
|
+
*
|
|
1216
|
+
* This method is a shortcut for addDialog() method using DialogSingleOptionComponent as the dialog component class
|
|
1217
|
+
*
|
|
1218
|
+
* @param properties An object containing the different visual and textual options that this dialog allows:
|
|
1219
|
+
* - title (mandatory): The dialog title
|
|
1220
|
+
* - option (mandatory): The text to place on the single option button
|
|
1221
|
+
* - description: An optional description text to show below the title
|
|
1222
|
+
* - id: see addDialog() docs
|
|
1223
|
+
* - width: see addDialog() docs
|
|
1224
|
+
* - maxWidth: see addDialog() docs
|
|
1225
|
+
* - height: see addDialog() docs
|
|
1226
|
+
* - maxHeight: see addDialog() docs
|
|
1227
|
+
* - modal: see addDialog() docs
|
|
1228
|
+
* - dialogClass: A custom component class to use instead of the default DialogSingleOptionComponent.
|
|
1229
|
+
* This custom class must extend DialogSingleOptionComponent
|
|
1230
|
+
*
|
|
1231
|
+
* @returns A Promise that resolves once the user selects the button with the option caption
|
|
1232
|
+
*/
|
|
1233
|
+
async addMessageDialog(properties) {
|
|
1234
|
+
properties.dialogClass ??= DialogSingleOptionComponent;
|
|
1235
|
+
return this.addErrorDialog(properties);
|
|
1236
|
+
}
|
|
1011
1237
|
/**
|
|
1012
1238
|
* Force the removal of all the dialogs that are currently visible.
|
|
1013
1239
|
*
|
|
@@ -1820,7 +2046,7 @@ class RouterBaseService {
|
|
|
1820
2046
|
// Clean up BehaviorSubject
|
|
1821
2047
|
this._currentRoute.complete();
|
|
1822
2048
|
}
|
|
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$
|
|
2049
|
+
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
2050
|
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: RouterBaseService, providedIn: 'root' }); }
|
|
1825
2051
|
}
|
|
1826
2052
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: RouterBaseService, decorators: [{
|
|
@@ -1828,7 +2054,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
|
|
|
1828
2054
|
args: [{
|
|
1829
2055
|
providedIn: 'root',
|
|
1830
2056
|
}]
|
|
1831
|
-
}], ctorParameters: () => [{ type: i1$2.Router }, { type: i2$
|
|
2057
|
+
}], ctorParameters: () => [{ type: i1$2.Router }, { type: i2$1.Title }] });
|
|
1832
2058
|
|
|
1833
2059
|
/**
|
|
1834
2060
|
* TurboGUI is A library that helps with the most common and generic UI elements and functionalities
|
|
@@ -2347,81 +2573,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
|
|
|
2347
2573
|
}]
|
|
2348
2574
|
}] });
|
|
2349
2575
|
|
|
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
|
-
/**
|
|
2390
|
-
* TurboGUI is A library that helps with the most common and generic UI elements and functionalities
|
|
2391
|
-
*
|
|
2392
|
-
* Website : -> http://www.turbogui.org
|
|
2393
|
-
* License : -> Licensed under the Apache License, Version 2.0. You may not use this file except in compliance with the License.
|
|
2394
|
-
* License Url : -> http://www.apache.org/licenses/LICENSE-2.0
|
|
2395
|
-
* CopyRight : -> Copyright 2018 Edertone Advanded Solutions. https://www.edertone.com
|
|
2396
|
-
*/
|
|
2397
|
-
/**
|
|
2398
|
-
* A dialog component with a single option button, to be used with dialog service
|
|
2399
|
-
*/
|
|
2400
|
-
class DialogSingleOptionComponent extends DialogBaseComponent {
|
|
2401
|
-
static { this.DIALOG_CLASS_NAME = 'DialogSingleOptionComponent'; }
|
|
2402
|
-
constructor(elementRef, dialogRef, data) {
|
|
2403
|
-
super(elementRef, dialogRef);
|
|
2404
|
-
this.elementRef = elementRef;
|
|
2405
|
-
this.dialogRef = dialogRef;
|
|
2406
|
-
this.data = data;
|
|
2407
|
-
if (data.texts.length < 1) {
|
|
2408
|
-
throw new Error('DialogSingleOptionComponent expects 2 texts: The title and optionally a description');
|
|
2409
|
-
}
|
|
2410
|
-
if (data.options.length !== 1) {
|
|
2411
|
-
throw new Error('DialogSingleOptionComponent expects only one option');
|
|
2412
|
-
}
|
|
2413
|
-
}
|
|
2414
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogSingleOptionComponent, deps: [{ token: i0.ElementRef }, { token: i1.MatDialogRef }, { token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component }); }
|
|
2415
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.5", type: DialogSingleOptionComponent, isStandalone: true, selector: "tg-dialog-single-option", providers: [], usesInheritance: true, ngImport: i0, template: "<h3>\r\n {{data.texts[0]}}\r\n</h3>\r\n\r\n<p *ngIf=\"data.texts.length > 1\">\r\n {{data.texts[1]}}\r\n</p>\r\n\r\n<button mat-raised-button color=\"primary\"\r\n (click)=\"closeDialog(0)\">\r\n \r\n {{data.options[0]}}\r\n \r\n</button>", styles: [":host{min-height:300px}h3{margin-bottom:25px}p{margin-bottom:52px}button{float:right}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i3.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }] }); }
|
|
2416
|
-
}
|
|
2417
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogSingleOptionComponent, decorators: [{
|
|
2418
|
-
type: Component,
|
|
2419
|
-
args: [{ selector: 'tg-dialog-single-option', imports: [CommonModule, MatButtonModule], providers: [], template: "<h3>\r\n {{data.texts[0]}}\r\n</h3>\r\n\r\n<p *ngIf=\"data.texts.length > 1\">\r\n {{data.texts[1]}}\r\n</p>\r\n\r\n<button mat-raised-button color=\"primary\"\r\n (click)=\"closeDialog(0)\">\r\n \r\n {{data.options[0]}}\r\n \r\n</button>", styles: [":host{min-height:300px}h3{margin-bottom:25px}p{margin-bottom:52px}button{float:right}\n"] }]
|
|
2420
|
-
}], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.MatDialogRef }, { type: undefined, decorators: [{
|
|
2421
|
-
type: Inject,
|
|
2422
|
-
args: [MAT_DIALOG_DATA]
|
|
2423
|
-
}] }] });
|
|
2424
|
-
|
|
2425
2576
|
/**
|
|
2426
2577
|
* TurboGUI is A library that helps with the most common and generic UI elements and functionalities
|
|
2427
2578
|
*
|