turbogui-angular 19.0.1 → 20.0.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.
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { EventEmitter, Output, Directive, HostListener, NgModule, inject, Injectable, Component, Inject, HostBinding, Input } from '@angular/core';
2
+ import { EventEmitter, HostListener, Output, Directive, NgModule, inject, Injectable, Component, Inject, HostBinding, Input } from '@angular/core';
3
3
  import { Subject, BehaviorSubject } from 'rxjs';
4
4
  import { ArrayUtils, NumericUtils, HTTPManager, StringUtils, HTTPManagerGetRequest, HTTPManagerPostRequest, BrowserManager, ConversionUtils } from 'turbocommons-ts';
5
5
  import * as i1 from '@angular/material/dialog';
@@ -8,6 +8,7 @@ import * as i3 from '@angular/material/button';
8
8
  import { MatButtonModule } from '@angular/material/button';
9
9
  import * as i2 from '@angular/common';
10
10
  import { CommonModule } from '@angular/common';
11
+ import { take, filter } from 'rxjs/operators';
11
12
  import { trigger, transition, style, animate } from '@angular/animations';
12
13
  import { ComponentPortal, DomPortalOutlet } from '@angular/cdk/portal';
13
14
  import * as i2$1 from '@angular/material/datepicker';
@@ -16,7 +17,6 @@ import { MatNativeDateModule } from '@angular/material/core';
16
17
  import * as i1$1 from '@angular/material/snack-bar';
17
18
  import * as i1$2 from '@angular/router';
18
19
  import { NavigationEnd } from '@angular/router';
19
- import { filter } from 'rxjs/operators';
20
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';
@@ -24,6 +24,47 @@ import { MatInputModule } from '@angular/material/input';
24
24
  import * as i5 from '@angular/forms';
25
25
  import { FormsModule, Validators } from '@angular/forms';
26
26
 
27
+ /**
28
+ * TurboGUI is A library that helps with the most common and generic UI elements and functionalities
29
+ *
30
+ * Website : -> http://www.turbogui.org
31
+ * License : -> Licensed under the Apache License, Version 2.0. You may not use this file except in compliance with the License.
32
+ * License Url : -> http://www.apache.org/licenses/LICENSE-2.0
33
+ * CopyRight : -> Copyright 2018 Edertone Advanded Solutions. https://www.edertone.com
34
+ */
35
+ /** This directive is used to trigger an event when the user clicks outside of an element */
36
+ /**
37
+ * This directive is used to execute an action when the user clicks outside of an element.
38
+ * If we set the elementClickOutside tag to the html element and set the onClickOutside event to a function: <element elementClickOutside (onClickOutside)="onClickedOutside()" ...,
39
+ * this function will be executed when the user clicks outside of the element.
40
+ */
41
+ class ElementClickOutsideDirective {
42
+ constructor(elementRef) {
43
+ this.elementRef = elementRef;
44
+ this.onClickOutside = new EventEmitter();
45
+ }
46
+ onClick(targetElement) {
47
+ const clickedInside = this.elementRef.nativeElement.contains(targetElement);
48
+ if (!clickedInside) {
49
+ this.onClickOutside.emit();
50
+ }
51
+ }
52
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ElementClickOutsideDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive }); }
53
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.5", type: ElementClickOutsideDirective, isStandalone: false, selector: "[elementClickOutside]", outputs: { onClickOutside: "onClickOutside" }, host: { listeners: { "document:click": "onClick($event.target)" } }, ngImport: i0 }); }
54
+ }
55
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: ElementClickOutsideDirective, decorators: [{
56
+ type: Directive,
57
+ args: [{
58
+ selector: '[elementClickOutside]',
59
+ standalone: false
60
+ }]
61
+ }], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { onClickOutside: [{
62
+ type: Output
63
+ }], onClick: [{
64
+ type: HostListener,
65
+ args: ['document:click', ['$event.target']]
66
+ }] } });
67
+
27
68
  /**
28
69
  * TurboGUI is A library that helps with the most common and generic UI elements and functionalities
29
70
  *
@@ -195,10 +236,12 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
195
236
  */
196
237
  class TurboGuiAngularModule {
197
238
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TurboGuiAngularModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
198
- static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: TurboGuiAngularModule, declarations: [ElementCreatedDirective,
239
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.5", ngImport: i0, type: TurboGuiAngularModule, declarations: [ElementClickOutsideDirective,
240
+ ElementCreatedDirective,
199
241
  ElementDestroyedDirective,
200
242
  AutoFocusOnDisplayDirective,
201
- AutoSelectTextOnFocusDirective], exports: [ElementCreatedDirective,
243
+ AutoSelectTextOnFocusDirective], exports: [ElementClickOutsideDirective,
244
+ ElementCreatedDirective,
202
245
  ElementDestroyedDirective,
203
246
  AutoFocusOnDisplayDirective,
204
247
  AutoSelectTextOnFocusDirective] }); }
@@ -209,6 +252,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
209
252
  args: [{
210
253
  imports: [],
211
254
  declarations: [
255
+ ElementClickOutsideDirective,
212
256
  ElementCreatedDirective,
213
257
  ElementDestroyedDirective,
214
258
  AutoFocusOnDisplayDirective,
@@ -216,6 +260,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
216
260
  ],
217
261
  providers: [],
218
262
  exports: [
263
+ ElementClickOutsideDirective,
219
264
  ElementCreatedDirective,
220
265
  ElementDestroyedDirective,
221
266
  AutoFocusOnDisplayDirective,
@@ -578,13 +623,13 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
578
623
  * Manages the application modal and non modal floating elements
579
624
  */
580
625
  class DialogService extends SingletoneStrictClass {
581
- constructor(rendererFactory, matSnackBar, matDialog, injector, applicationRef, componentFactoryResolver) {
626
+ constructor(rendererFactory, matSnackBar, matDialog, injector, applicationRef, environmentInjector) {
582
627
  super(DialogService);
583
628
  this.matSnackBar = matSnackBar;
584
629
  this.matDialog = matDialog;
585
630
  this.injector = injector;
586
631
  this.applicationRef = applicationRef;
587
- this.componentFactoryResolver = componentFactoryResolver;
632
+ this.environmentInjector = environmentInjector;
588
633
  /**
589
634
  * Used to modify the busy state component that is shown by default by the addModalBusyState() method.
590
635
  *
@@ -614,7 +659,7 @@ class DialogService extends SingletoneStrictClass {
614
659
  */
615
660
  this._isShowingSnackBar = false;
616
661
  /**
617
- * Contains a list of the dialogs that are currently visible to the user.
662
+ * Contains a list of the dialogs (MODAL AND NON MODAL) that are currently visible to the user.
618
663
  * Each item in this list is a hash that is computed when dialog is created to uniquely identify it.
619
664
  *
620
665
  * Empty list means no dialogs are currently visible
@@ -625,6 +670,10 @@ class DialogService extends SingletoneStrictClass {
625
670
  * The list uses the same order as the list of _activeDialogs hash values
626
671
  */
627
672
  this._activeDialogInstances = [];
673
+ /**
674
+ * Counts the number of dialogs that are currently open and that can be closed by the user by navigating with the browser
675
+ */
676
+ this._activeCloseableDialogs = 0;
628
677
  /**
629
678
  * Method that is used to delete the window beforeunload event listener once not used anymore
630
679
  */
@@ -664,9 +713,7 @@ class DialogService extends SingletoneStrictClass {
664
713
  * otherwise it will do nothing.
665
714
  */
666
715
  addCloseApplicationWarning() {
667
- if (this._windowBeforeUnloadUnListen === null) {
668
- this._windowBeforeUnloadUnListen = this._renderer.listen('window', 'beforeunload', (event) => event.returnValue = true);
669
- }
716
+ this._windowBeforeUnloadUnListen ??= this._renderer.listen('window', 'beforeunload', (event) => event.returnValue = true);
670
717
  }
671
718
  /**
672
719
  * Remove the close application warning message if previously assigned
@@ -700,7 +747,7 @@ class DialogService extends SingletoneStrictClass {
700
747
  if (this._componentPortal === null) {
701
748
  this._componentPortal = new ComponentPortal(this.customBusyStateComponentClass);
702
749
  // Create a PortalHost with document.body as its anchor element
703
- this._modalBusyStateHost = new DomPortalOutlet(document.body, this.componentFactoryResolver, this.applicationRef, this.injector);
750
+ this._modalBusyStateHost = new DomPortalOutlet(document.body, this.environmentInjector, this.applicationRef, this.injector);
704
751
  }
705
752
  this._modalBusyStateHost.attach(this._componentPortal);
706
753
  this._isShowingBusyState = true;
@@ -754,12 +801,12 @@ class DialogService extends SingletoneStrictClass {
754
801
  return new Promise((resolve) => {
755
802
  const snackBarRef = this.matSnackBar.open(message, action === '' ? undefined : action, config);
756
803
  // Handle action button click
757
- snackBarRef.onAction().subscribe(() => {
804
+ snackBarRef.onAction().pipe(take(1)).subscribe(() => {
758
805
  this._isShowingSnackBar = false;
759
806
  resolve(true);
760
807
  });
761
808
  // Handle dismiss
762
- snackBarRef.afterDismissed().subscribe(() => {
809
+ snackBarRef.afterDismissed().pipe(take(1)).subscribe(() => {
763
810
  this._isShowingSnackBar = false;
764
811
  resolve(false);
765
812
  });
@@ -788,21 +835,29 @@ class DialogService extends SingletoneStrictClass {
788
835
  * this library or extend DialogBaseComponent to create our own custom ones.
789
836
  *
790
837
  * @param dialogComponentClass A class for a component that extends DialogBaseComponent, which will be the dialog that is shown to the user.
791
- * @param properties An object containing the different visual and textual options that this dialog allows:
838
+ * @param properties An object containing the different visual and textual options that this dialog allows.
839
+ * IMPORTANT: texts, options and data values need to be read at the dialog component by declaring "@Inject(MAT_DIALOG_DATA) public data: any"
840
+ * at the dialog component constructor. This data object will contain the texts, options and data properties
841
+ *
792
842
  * - id: The html unique identifier that the dialog will have once created. If not specified, no id will be explicitly set
793
843
  * - width: 50% by default. Specify the css value for the default dialog width. As the dialog is responsive, the value will be automatically
794
844
  * reduced if the available screen is not enough, and will reach the desired value otherwise. We can set any css unit like pixels,
795
845
  * %, vh, vw, or any other. For example: '400px', '50%', etc.
796
- * - maxWidth: Defines the maximum width that the dialog will have regarding the viewport. We can specify it in % or vw, just like is done in
846
+ * - maxWidth: Defines the maximum width that the dialog will have. We can specify it in % or vw, just like is done in
797
847
  * css. By default it is defined as 96vw, which will fit 96% of the viewport on small devices
798
- * - height: TODO docs
799
- * - maxHeight: TODO docs
848
+ * - height: Unset by default. Specify the css value for the dialog height.
849
+ * - maxHeight: Defines the maximum height that the dialog will have. We can specify it in % or vh, just like is done in
850
+ * css. By default it is defined as 96vh, which will fit 96% of the viewport
800
851
  * - modal: True (default) if selecting an option is mandatory to close the dialog, false if the dialog can be closed
801
852
  * by the user clicking outside it
853
+ * - closeOnNavigation: Tells if the dialog should be closed when the user navigates with the browser. By default is true for non modal and false for modal dialogs.
802
854
  * - texts: A list with strings containing the dialog texts, sorted by importance. When dialog has a title, this should
803
855
  * be placed first, subtitle second and so (Each dialog may accept a different custom number of texts).
856
+ * (add "@Inject(MAT_DIALOG_DATA) public data: any" to dialog constructor and read it with data.texts)
804
857
  * - options: A list of strings that will be used as button captions for each one of the accepted dialog options
805
- * - data: An object that we can use to pass any extra data that we want to the dialog
858
+ * (add "@Inject(MAT_DIALOG_DATA) public data: any" to dialog constructor and read it with data.options)
859
+ * - data: An object to pass any extra data we want to the dialog.
860
+ * (add "@Inject(MAT_DIALOG_DATA) public data: any" to dialog constructor and read it with data.data)
806
861
  * - viewContainerRef: This is important if we want to propagate providers from a parent component to this dialog. We must specify
807
862
  * this reference to make sure the same services injected on the parent are available too at the child dialog
808
863
  *
@@ -817,6 +872,7 @@ class DialogService extends SingletoneStrictClass {
817
872
  return new Promise((resolve) => {
818
873
  // Set the default values for non specified properties
819
874
  properties.modal = properties.modal ?? true;
875
+ properties.closeOnNavigation = properties.closeOnNavigation ?? !properties.modal;
820
876
  properties.texts = properties.texts ?? [];
821
877
  properties.options = properties.options ?? [];
822
878
  properties.data = properties.data ?? {};
@@ -832,24 +888,44 @@ class DialogService extends SingletoneStrictClass {
832
888
  if (this._activeDialogs.includes(dialogHash)) {
833
889
  return resolve({ index: -1 });
834
890
  }
835
- const dialogRef = this.matDialog.open(dialogComponentClass, {
891
+ let dialogRefConfig = {
836
892
  width: properties.width ?? "50%",
837
893
  maxWidth: properties.maxWidth ?? "96vw",
894
+ maxHeight: properties.maxHeight ?? "96vh",
838
895
  disableClose: properties.modal,
839
896
  autoFocus: false,
840
- closeOnNavigation: !properties.modal,
897
+ closeOnNavigation: properties.closeOnNavigation,
841
898
  viewContainerRef: properties.viewContainerRef,
842
899
  data: { texts: properties.texts, options: properties.options, data: properties.data }
843
- });
900
+ };
901
+ // Dialog height will only be set if it is specified on properties
902
+ if (properties.height && properties.height !== undefined) {
903
+ dialogRefConfig['height'] = properties.height;
904
+ }
905
+ const dialogRef = this.matDialog.open(dialogComponentClass, dialogRefConfig);
906
+ // Push a new state to handle browser navigation to close the dialog
907
+ if (properties.closeOnNavigation && this._activeCloseableDialogs === 0) {
908
+ history.pushState({ dialogOpen: true }, '');
909
+ }
844
910
  // Assign the dialog ID only if specifically set on properties
845
911
  if (properties.id && properties.id !== undefined) {
846
912
  dialogRef.id = properties.id;
847
913
  }
848
914
  this._activeDialogs.push(dialogHash);
849
915
  this._activeDialogInstances.push(dialogRef);
850
- dialogRef.beforeClosed().subscribe((selection) => {
916
+ if (properties.closeOnNavigation) {
917
+ this._activeCloseableDialogs += 1;
918
+ }
919
+ dialogRef.beforeClosed().pipe(take(1)).subscribe((selection) => {
851
920
  this._activeDialogs = ArrayUtils.removeElement(this._activeDialogs, dialogHash);
852
921
  this._activeDialogInstances = ArrayUtils.removeElement(this._activeDialogInstances, dialogRef);
922
+ if (properties.closeOnNavigation) {
923
+ // Remove dialog state from browser history
924
+ if (this._activeCloseableDialogs === 1 && window.history.state?.dialogOpen) {
925
+ history.back();
926
+ }
927
+ this._activeCloseableDialogs -= 1;
928
+ }
853
929
  if (!properties.modal && selection === undefined) {
854
930
  selection = { index: -1 };
855
931
  }
@@ -891,7 +967,7 @@ class DialogService extends SingletoneStrictClass {
891
967
  id: properties.id ?? undefined,
892
968
  width: properties.width ?? "50%",
893
969
  maxWidth: properties.maxWidth ?? "96vw",
894
- height: properties.height ?? "50%",
970
+ height: properties.height ?? "auto",
895
971
  maxHeight: properties.maxHeight ?? "92vw",
896
972
  modal: properties.modal ?? false,
897
973
  texts: [properties.title ?? ''],
@@ -908,11 +984,16 @@ class DialogService extends SingletoneStrictClass {
908
984
  if (!this._isEnabled) {
909
985
  return;
910
986
  }
987
+ // If there are dialogs that should close on navigation and a history state was pushed, pop it
988
+ if (this._activeCloseableDialogs > 0 && window.history.state?.dialogOpen) {
989
+ history.back();
990
+ }
911
991
  for (const dialogRef of this._activeDialogInstances) {
912
992
  dialogRef.close({ index: -1 });
913
993
  }
914
994
  this._activeDialogs = [];
915
995
  this._activeDialogInstances = [];
996
+ this._activeCloseableDialogs = 0;
916
997
  }
917
998
  /**
918
999
  * TODO - translate from TS version
@@ -936,15 +1017,9 @@ class DialogService extends SingletoneStrictClass {
936
1017
  * Block all the user interactions with the application (keyboard, touch, mouse, ...)
937
1018
  */
938
1019
  _disableUserInteraction() {
939
- if (this._documentKeydownUnlisten === null) {
940
- this._documentKeydownUnlisten = this._renderer.listen('document', 'keydown', (event) => event.preventDefault());
941
- }
942
- if (this._documentMousedownUnlisten === null) {
943
- this._documentMousedownUnlisten = this._renderer.listen('document', 'mousedown', (event) => event.preventDefault());
944
- }
945
- if (this._documentPointerdownUnlisten === null) {
946
- this._documentPointerdownUnlisten = this._renderer.listen('document', 'pointerdown', (event) => event.preventDefault());
947
- }
1020
+ this._documentKeydownUnlisten ??= this._renderer.listen('document', 'keydown', (event) => event.preventDefault());
1021
+ this._documentMousedownUnlisten ??= this._renderer.listen('document', 'mousedown', (event) => event.preventDefault());
1022
+ this._documentPointerdownUnlisten ??= this._renderer.listen('document', 'pointerdown', (event) => event.preventDefault());
948
1023
  }
949
1024
  /**
950
1025
  * Restore the user interactions that were previously disabled with _disableUserInteraction method
@@ -960,10 +1035,10 @@ class DialogService extends SingletoneStrictClass {
960
1035
  }
961
1036
  if (this._documentPointerdownUnlisten !== null) {
962
1037
  this._documentPointerdownUnlisten();
963
- this._documentMousedownUnlisten = null;
1038
+ this._documentPointerdownUnlisten = null;
964
1039
  }
965
1040
  }
966
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogService, deps: [{ token: i0.RendererFactory2 }, { token: i1$1.MatSnackBar }, { token: i1.MatDialog }, { token: i0.Injector }, { token: i0.ApplicationRef }, { token: i0.ComponentFactoryResolver }], target: i0.ɵɵFactoryTarget.Injectable }); }
1041
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogService, deps: [{ token: i0.RendererFactory2 }, { token: i1$1.MatSnackBar }, { token: i1.MatDialog }, { token: i0.Injector }, { token: i0.ApplicationRef }, { token: i0.EnvironmentInjector }], target: i0.ɵɵFactoryTarget.Injectable }); }
967
1042
  static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogService, providedIn: 'root' }); }
968
1043
  }
969
1044
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogService, decorators: [{
@@ -971,7 +1046,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
971
1046
  args: [{
972
1047
  providedIn: 'root',
973
1048
  }]
974
- }], ctorParameters: () => [{ type: i0.RendererFactory2 }, { type: i1$1.MatSnackBar }, { type: i1.MatDialog }, { type: i0.Injector }, { type: i0.ApplicationRef }, { type: i0.ComponentFactoryResolver }] });
1049
+ }], ctorParameters: () => [{ type: i0.RendererFactory2 }, { type: i1$1.MatSnackBar }, { type: i1.MatDialog }, { type: i0.Injector }, { type: i0.ApplicationRef }, { type: i0.EnvironmentInjector }] });
975
1050
 
976
1051
  /**
977
1052
  * TurboGUI is A library that helps with the most common and generic UI elements and functionalities
@@ -1125,9 +1200,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
1125
1200
  /**
1126
1201
  * Allows us to easily perform requests to a remote API that is developed with Turbo framework.
1127
1202
  */
1128
- class TurboApiCallerService extends SingletoneStrictClass {
1203
+ class TurboApiService {
1129
1204
  constructor(dialogService, browserService) {
1130
- super(TurboApiCallerService);
1131
1205
  this.dialogService = dialogService;
1132
1206
  this.browserService = browserService;
1133
1207
  /**
@@ -1536,10 +1610,10 @@ class TurboApiCallerService extends SingletoneStrictClass {
1536
1610
  this._token = '';
1537
1611
  this.httpManager.setGlobalPostParam('token', '-');
1538
1612
  }
1539
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TurboApiCallerService, deps: [{ token: DialogService }, { token: BrowserService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1540
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TurboApiCallerService, providedIn: 'root' }); }
1613
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TurboApiService, deps: [{ token: DialogService }, { token: BrowserService }], target: i0.ɵɵFactoryTarget.Injectable }); }
1614
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TurboApiService, providedIn: 'root' }); }
1541
1615
  }
1542
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TurboApiCallerService, decorators: [{
1616
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: TurboApiService, decorators: [{
1543
1617
  type: Injectable,
1544
1618
  args: [{
1545
1619
  providedIn: 'root',
@@ -2189,6 +2263,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImpor
2189
2263
  }]
2190
2264
  }] });
2191
2265
 
2266
+ /**
2267
+ * TurboGUI is A library that helps with the most common and generic UI elements and functionalities
2268
+ *
2269
+ * Website : -> http://www.turbogui.org
2270
+ * License : -> Licensed under the Apache License, Version 2.0. You may not use this file except in compliance with the License.
2271
+ * License Url : -> http://www.apache.org/licenses/LICENSE-2.0
2272
+ * CopyRight : -> Copyright 2018 Edertone Advanded Solutions. https://www.edertone.com
2273
+ */
2274
+ /**
2275
+ * A dialog component with an iframe that can be used to display any url or content.
2276
+ *
2277
+ * We must specify the url in the data parameter when opening the dialog, and we can also specify the title
2278
+ * bi placing it at the first position of the texts array.
2279
+ */
2280
+ class DialogIFrameComponent extends DialogBaseComponent {
2281
+ static { this.DIALOG_CLASS_NAME = 'DialogIFrameComponent'; }
2282
+ constructor(elementRef, dialogRef, sanitizer, data) {
2283
+ super(elementRef, dialogRef);
2284
+ this.elementRef = elementRef;
2285
+ this.dialogRef = dialogRef;
2286
+ this.sanitizer = sanitizer;
2287
+ this.data = data;
2288
+ this.title = '';
2289
+ if (data.texts.length > 0) {
2290
+ this.title = data.texts[0];
2291
+ }
2292
+ this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(data.data);
2293
+ }
2294
+ 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 }); }
2295
+ 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"] }] }); }
2296
+ }
2297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.5", ngImport: i0, type: DialogIFrameComponent, decorators: [{
2298
+ type: Component,
2299
+ 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"] }]
2300
+ }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.MatDialogRef }, { type: i2$2.DomSanitizer }, { type: undefined, decorators: [{
2301
+ type: Inject,
2302
+ args: [MAT_DIALOG_DATA]
2303
+ }] }] });
2304
+
2192
2305
  /**
2193
2306
  * TurboGUI is A library that helps with the most common and generic UI elements and functionalities
2194
2307
  *
@@ -2721,7 +2834,6 @@ class ButtonContainerComponent extends ButtonBaseComponent {
2721
2834
  super(...arguments);
2722
2835
  /**
2723
2836
  * This is used to attach the fade animation directly to this component so it fades in and out when created and removed from the app
2724
- * TODO: THIS IS NOT A GOOD IDEA
2725
2837
  */
2726
2838
  this.buttonFade = true;
2727
2839
  }
@@ -2940,5 +3052,5 @@ class ValidatorsPlus extends Validators {
2940
3052
  * Generated bundle index. Do not edit.
2941
3053
  */
2942
3054
 
2943
- export { AutoFocusOnDisplayDirective, AutoSelectTextOnFocusDirective, BrowserService, BusyStateBaseComponent, ButtonContainerComponent, ButtonImageComponent, DelayedMethodCallManager, DialogBaseComponent, DialogDateSelectionComponent, DialogErrorComponent, DialogMultipleOptionComponent, DialogService, DialogSingleInputComponent, DialogSingleOptionComponent, DialogSingleSelectionListComponent, DialogTwoOptionComponent, ElementCreatedDirective, ElementDestroyedDirective, FadeAnimationClass, GUINotification, GlobalErrorService, HTTPService, HTTPServiceGetRequest, HTTPServicePostRequest, LocalesBaseService, NotificationService, RouterBaseService, SingletoneStrictClass, TurboApiCallerService, TurboGuiAngularModule, ValidatorsPlus, View, ViewService };
3055
+ export { AutoFocusOnDisplayDirective, AutoSelectTextOnFocusDirective, BrowserService, BusyStateBaseComponent, ButtonContainerComponent, ButtonImageComponent, DelayedMethodCallManager, DialogBaseComponent, DialogDateSelectionComponent, DialogErrorComponent, DialogIFrameComponent, DialogMultipleOptionComponent, DialogService, DialogSingleInputComponent, DialogSingleOptionComponent, DialogSingleSelectionListComponent, DialogTwoOptionComponent, ElementClickOutsideDirective, ElementCreatedDirective, ElementDestroyedDirective, FadeAnimationClass, GUINotification, GlobalErrorService, HTTPService, HTTPServiceGetRequest, HTTPServicePostRequest, LocalesBaseService, NotificationService, RouterBaseService, SingletoneStrictClass, TurboApiService, TurboGuiAngularModule, ValidatorsPlus, View, ViewService };
2944
3056
  //# sourceMappingURL=turbogui-angular.mjs.map