@dev-tcloud/tcloud-ui 6.20.0 → 6.20.1
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 { Injectable, Component, EventEmitter, Input, Output, InjectionToken, Optional, Inject, inject, signal, Pipe, forwardRef, ViewChild, input, effect, Directive, ViewEncapsulation, SkipSelf, ChangeDetectionStrategy, HostListener, ChangeDetectorRef, computed, ApplicationRef, output, model, ContentChildren, viewChild,
|
|
2
|
+
import { Injectable, Component, EventEmitter, Input, Output, InjectionToken, Optional, Inject, inject, signal, Pipe, forwardRef, ViewChild, input, effect, Directive, ViewEncapsulation, SkipSelf, ChangeDetectionStrategy, HostListener, ChangeDetectorRef, computed, ApplicationRef, output, model, ContentChildren, viewChild, NgModule, makeEnvironmentProviders } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/common';
|
|
4
4
|
import { CommonModule, DatePipe, DOCUMENT } from '@angular/common';
|
|
5
5
|
import { Subject, Subscription, BehaviorSubject, debounceTime, distinctUntilChanged, map } from 'rxjs';
|
|
@@ -9270,34 +9270,40 @@ class TCloudUiDialogService {
|
|
|
9270
9270
|
constructor() {
|
|
9271
9271
|
// * [Injects]
|
|
9272
9272
|
this.i18n = inject(I18nService);
|
|
9273
|
-
this.factoryResolver = inject(ComponentFactoryResolver);
|
|
9274
9273
|
}
|
|
9275
9274
|
/**
|
|
9276
9275
|
* Método usado para realizar a configuração de 'ViewContainerRef'
|
|
9277
9276
|
* @param viewContainerRef Obj
|
|
9278
9277
|
*/
|
|
9279
9278
|
setRootViewContainerRef(viewContainerRef) {
|
|
9280
|
-
if (!
|
|
9281
|
-
|
|
9279
|
+
if (!viewContainerRef)
|
|
9280
|
+
return;
|
|
9281
|
+
this.rootViewContainer = viewContainerRef;
|
|
9282
9282
|
}
|
|
9283
9283
|
/**
|
|
9284
9284
|
* Método usado para abrir o modal de dialog
|
|
9285
9285
|
* @param _data Info do dialog
|
|
9286
9286
|
*/
|
|
9287
9287
|
open(_data = {}) {
|
|
9288
|
-
|
|
9289
|
-
|
|
9290
|
-
|
|
9291
|
-
|
|
9288
|
+
if (!this.rootViewContainer) {
|
|
9289
|
+
throw new Error('TCloudUiDialogService: ViewContainerRef não configurado. ' +
|
|
9290
|
+
'Declare no template um âncora (ex.: <ng-container #dialogRoot></ng-container>), ' +
|
|
9291
|
+
'use @ViewChild("dialogRoot", { read: ViewContainerRef }) e chame setRootViewContainerRef(ref) no ngAfterViewInit. ' +
|
|
9292
|
+
'Se #dialogRoot estiver dentro de *ngIf, chame setRootViewContainerRef de novo quando o bloco for exibido.');
|
|
9293
|
+
}
|
|
9294
|
+
const componentRef = this.rootViewContainer.createComponent(TCloudUiDialogComponent, {
|
|
9295
|
+
injector: this.rootViewContainer.injector,
|
|
9296
|
+
});
|
|
9297
|
+
componentRef.instance.data = new TCloudUiDialogModel(_data.title || this.i18n.i18nTranslate('dialogConfirmation.default_title', 'Atenção'), _data.message || this.i18n.i18nTranslate('dialogConfirmation.default_message', 'Deseja realmente executar esta ação?'), _data.loading, _data.disable, _data.disableClickOutside, _data.inputConfirmationText || TCloudUiDialogTextConfirmationEnum.confirm, _data.buttonConfirmText, _data.buttonCancelText);
|
|
9292
9298
|
// * Configura o texto do input de confirmação
|
|
9293
|
-
if (
|
|
9294
|
-
this.setTextConfirmation(
|
|
9295
|
-
|
|
9299
|
+
if (componentRef.instance.data.inputConfirmationText)
|
|
9300
|
+
this.setTextConfirmation(componentRef.instance);
|
|
9301
|
+
componentRef.instance.events.subscribe(event => {
|
|
9296
9302
|
// * Fecha o dialogo
|
|
9297
9303
|
if (event === TCloudUiDialogEventsEnum.close)
|
|
9298
|
-
|
|
9304
|
+
componentRef.destroy();
|
|
9299
9305
|
});
|
|
9300
|
-
return
|
|
9306
|
+
return componentRef.instance;
|
|
9301
9307
|
}
|
|
9302
9308
|
/**
|
|
9303
9309
|
* Método usado para configurar o texto do input de confirmação
|