@dev-tcloud/tcloud-ui 6.21.6 → 6.21.8

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.
@@ -0,0 +1,33 @@
1
+ # tcloud-ui-editor-diff
2
+
3
+ Componente para comparacao de dois textos com destaque de diferencas usando `monaco-editor`.
4
+
5
+ ## Exemplo
6
+
7
+ ```html
8
+ <tcloud-ui-editor-diff
9
+ [(originalValue)]="originalCode"
10
+ [(modifiedValue)]="modifiedCode"
11
+ [language]="'typescript'"
12
+ [theme]="'vs-dark'"
13
+ [readOnly]="true"
14
+ height="420px"
15
+ ></tcloud-ui-editor-diff>
16
+ ```
17
+
18
+ ## Inputs
19
+
20
+ - `originalValue: string` - conteudo do lado original.
21
+ - `modifiedValue: string` - conteudo do lado modificado.
22
+ - `language: string` - linguagem do Monaco.
23
+ - `theme: string` - tema (`vs`, `vs-dark`, `hc-black`).
24
+ - `height: string` - altura do editor de diff.
25
+ - `readOnly: boolean` - quando `true` (padrao), original e modificado ficam somente leitura.
26
+ - `originalEditable: boolean` - so aplica com `readOnly=false`; permite editar apenas o lado original.
27
+ - `showDiagnostics: boolean` - exibe erros de validacao (TypeScript, etc.). Padrao: `false`.
28
+ - `options: IStandaloneDiffEditorConstructionOptions` - opcoes extras do Monaco.
29
+
30
+ ## Outputs
31
+
32
+ - `originalValueChange: EventEmitter<string>` - emite mudancas no lado original.
33
+ - `modifiedValueChange: EventEmitter<string>` - emite mudancas no lado modificado.
@@ -0,0 +1,28 @@
1
+ # tcloud-ui-editor
2
+
3
+ Componente para edição de texto/código com `monaco-editor`.
4
+
5
+ ## Exemplo
6
+
7
+ ```html
8
+ <tcloud-ui-editor
9
+ [(value)]="code"
10
+ [language]="'typescript'"
11
+ [theme]="'vs-dark'"
12
+ [readOnly]="false"
13
+ height="360px"
14
+ ></tcloud-ui-editor>
15
+ ```
16
+
17
+ ## Inputs
18
+
19
+ - `value: string` - valor inicial do editor.
20
+ - `language: string` - linguagem do Monaco (ex: `plaintext`, `json`, `typescript`).
21
+ - `theme: string` - tema (`vs`, `vs-dark`, `hc-black`).
22
+ - `height: string` - altura do editor.
23
+ - `readOnly: boolean` - define modo somente leitura.
24
+ - `options: IStandaloneEditorConstructionOptions` - opcoes extras do Monaco.
25
+
26
+ ## Outputs
27
+
28
+ - `valueChange: EventEmitter<string>` - emite quando o conteudo muda.
@@ -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, NgModule, makeEnvironmentProviders } 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, EnvironmentInjector, createComponent, ViewContainerRef, 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';
@@ -6538,6 +6538,345 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
6538
6538
  type: Input
6539
6539
  }] } });
6540
6540
 
6541
+ const CDN_MONACO_VS_BASE_PATH = 'https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs';
6542
+ let monacoLoaderPromise = null;
6543
+ function appendScript(src) {
6544
+ return new Promise((resolve, reject) => {
6545
+ const script = document.createElement('script');
6546
+ script.type = 'text/javascript';
6547
+ script.src = src;
6548
+ script.async = true;
6549
+ script.onload = () => resolve();
6550
+ script.onerror = (error) => reject(error);
6551
+ document.body.appendChild(script);
6552
+ });
6553
+ }
6554
+ function getWorkerBootstrap(vsBasePath) {
6555
+ const workerSource = `self.MonacoEnvironment={baseUrl:'${vsBasePath}/'};importScripts('${vsBasePath}/base/worker/workerMain.js');`;
6556
+ return `data:text/javascript;charset=utf-8,${encodeURIComponent(workerSource)}`;
6557
+ }
6558
+ async function loadMonacoEditor() {
6559
+ if (typeof window === 'undefined') {
6560
+ throw new Error('Monaco Editor can only be loaded in browser environments.');
6561
+ }
6562
+ if (window.monaco?.editor) {
6563
+ return window.monaco;
6564
+ }
6565
+ if (!monacoLoaderPromise) {
6566
+ monacoLoaderPromise = (async () => {
6567
+ if (!window.require) {
6568
+ await appendScript(`${CDN_MONACO_VS_BASE_PATH}/loader.js`);
6569
+ }
6570
+ if (!window.require) {
6571
+ throw new Error('Monaco AMD loader was not initialized.');
6572
+ }
6573
+ window.require.config({
6574
+ paths: { vs: CDN_MONACO_VS_BASE_PATH }
6575
+ });
6576
+ window.MonacoEnvironment = {
6577
+ getWorkerUrl: () => getWorkerBootstrap(CDN_MONACO_VS_BASE_PATH)
6578
+ };
6579
+ await new Promise((resolve, reject) => {
6580
+ window.require?.(['vs/editor/editor.main'], () => resolve(), (error) => reject(error));
6581
+ });
6582
+ if (!window.monaco) {
6583
+ throw new Error('Monaco Editor global object was not created.');
6584
+ }
6585
+ return window.monaco;
6586
+ })();
6587
+ }
6588
+ return monacoLoaderPromise;
6589
+ }
6590
+
6591
+ class TCloudUiEditorComponent {
6592
+ constructor() {
6593
+ this.value = '';
6594
+ this.language = 'plaintext';
6595
+ this.theme = 'vs-dark';
6596
+ this.height = '320px';
6597
+ this.options = {};
6598
+ this.readOnly = false;
6599
+ this.valueChange = new EventEmitter();
6600
+ this.syncingValue = false;
6601
+ }
6602
+ async ngAfterViewInit() {
6603
+ if (!this.editorContainer) {
6604
+ return;
6605
+ }
6606
+ this.monaco = await loadMonacoEditor();
6607
+ this.monaco.editor.setTheme(this.theme);
6608
+ this.editor = this.monaco.editor.create(this.editorContainer.nativeElement, {
6609
+ value: this.value ?? '',
6610
+ language: this.language,
6611
+ readOnly: this.readOnly,
6612
+ automaticLayout: true,
6613
+ ...this.options
6614
+ });
6615
+ this.onValueChangeDisposable = this.editor.onDidChangeModelContent(() => {
6616
+ if (!this.editor || this.syncingValue) {
6617
+ return;
6618
+ }
6619
+ const currentValue = this.editor.getValue();
6620
+ this.value = currentValue;
6621
+ this.valueChange.emit(currentValue);
6622
+ });
6623
+ }
6624
+ ngOnChanges(changes) {
6625
+ if (!this.editor || !this.monaco) {
6626
+ return;
6627
+ }
6628
+ if (changes['theme'] && !changes['theme'].firstChange) {
6629
+ this.monaco.editor.setTheme(this.theme);
6630
+ }
6631
+ if (changes['language'] && !changes['language'].firstChange) {
6632
+ const model = this.editor.getModel();
6633
+ if (model) {
6634
+ this.monaco.editor.setModelLanguage(model, this.language);
6635
+ }
6636
+ }
6637
+ if (changes['value'] && !changes['value'].firstChange) {
6638
+ this.syncEditorValue(this.value ?? '');
6639
+ }
6640
+ if (changes['readOnly'] || changes['options']) {
6641
+ this.editor.updateOptions({
6642
+ readOnly: this.readOnly,
6643
+ automaticLayout: true,
6644
+ ...this.options
6645
+ });
6646
+ }
6647
+ }
6648
+ ngOnDestroy() {
6649
+ this.onValueChangeDisposable?.dispose();
6650
+ this.editor?.dispose();
6651
+ }
6652
+ syncEditorValue(value) {
6653
+ if (!this.editor || this.editor.getValue() === value) {
6654
+ return;
6655
+ }
6656
+ this.syncingValue = true;
6657
+ this.editor.setValue(value);
6658
+ this.syncingValue = false;
6659
+ }
6660
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TCloudUiEditorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
6661
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: TCloudUiEditorComponent, isStandalone: true, selector: "tcloud-ui-editor", inputs: { value: "value", language: "language", theme: "theme", height: "height", options: "options", readOnly: "readOnly" }, outputs: { valueChange: "valueChange" }, viewQueries: [{ propertyName: "editorContainer", first: true, predicate: ["editorContainer"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"tcloud-ui-editor-wrapper\" [style.height]=\"height\">\n <div #editorContainer class=\"tcloud-ui-editor-container\"></div>\n</div>\n", styles: [":host{display:block}.tcloud-ui-editor-wrapper{width:100%}.tcloud-ui-editor-container{width:100%;height:100%;min-height:180px;border:1px solid var(--c-neutral-300, #d1d5db);border-radius:8px;overflow:hidden}\n"] }); }
6662
+ }
6663
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TCloudUiEditorComponent, decorators: [{
6664
+ type: Component,
6665
+ args: [{ selector: 'tcloud-ui-editor', imports: [], template: "<div class=\"tcloud-ui-editor-wrapper\" [style.height]=\"height\">\n <div #editorContainer class=\"tcloud-ui-editor-container\"></div>\n</div>\n", styles: [":host{display:block}.tcloud-ui-editor-wrapper{width:100%}.tcloud-ui-editor-container{width:100%;height:100%;min-height:180px;border:1px solid var(--c-neutral-300, #d1d5db);border-radius:8px;overflow:hidden}\n"] }]
6666
+ }], propDecorators: { value: [{
6667
+ type: Input
6668
+ }], language: [{
6669
+ type: Input
6670
+ }], theme: [{
6671
+ type: Input
6672
+ }], height: [{
6673
+ type: Input
6674
+ }], options: [{
6675
+ type: Input
6676
+ }], readOnly: [{
6677
+ type: Input
6678
+ }], valueChange: [{
6679
+ type: Output
6680
+ }], editorContainer: [{
6681
+ type: ViewChild,
6682
+ args: ['editorContainer', { static: true }]
6683
+ }] } });
6684
+
6685
+ const DEFAULT_DIAGNOSTICS_OPTIONS = {
6686
+ noSemanticValidation: false,
6687
+ noSyntaxValidation: false,
6688
+ noSuggestionDiagnostics: false
6689
+ };
6690
+ const DISABLED_DIAGNOSTICS_OPTIONS = {
6691
+ noSemanticValidation: true,
6692
+ noSyntaxValidation: true,
6693
+ noSuggestionDiagnostics: true
6694
+ };
6695
+ class TCloudUiEditorDiffComponent {
6696
+ constructor() {
6697
+ this.originalValue = '';
6698
+ this.modifiedValue = '';
6699
+ this.language = 'plaintext';
6700
+ this.theme = 'vs-dark';
6701
+ this.height = '420px';
6702
+ this.options = {};
6703
+ /** Quando true, original e modificado ficam somente leitura. */
6704
+ this.readOnly = true;
6705
+ /** So aplica quando readOnly=false. Permite editar apenas o lado original. */
6706
+ this.originalEditable = false;
6707
+ /** Exibe validacao/sublinhados de erro (TypeScript, JSON, etc.). Padrao: false. */
6708
+ this.showDiagnostics = false;
6709
+ this.originalValueChange = new EventEmitter();
6710
+ this.modifiedValueChange = new EventEmitter();
6711
+ this.syncingOriginalValue = false;
6712
+ this.syncingModifiedValue = false;
6713
+ this.instanceId = `tcloud-ui-editor-diff-${Math.random().toString(36).slice(2)}`;
6714
+ }
6715
+ async ngAfterViewInit() {
6716
+ if (!this.diffEditorContainer) {
6717
+ return;
6718
+ }
6719
+ this.monaco = await loadMonacoEditor();
6720
+ this.monaco.editor.setTheme(this.theme);
6721
+ this.applyLanguageDiagnostics();
6722
+ this.diffEditor = this.monaco.editor.createDiffEditor(this.diffEditorContainer.nativeElement, this.buildDiffEditorOptions());
6723
+ this.originalModel = this.monaco.editor.createModel(this.originalValue ?? '', this.language, this.monaco.Uri.parse(`inmemory://${this.instanceId}/original`));
6724
+ this.modifiedModel = this.monaco.editor.createModel(this.modifiedValue ?? '', this.language, this.monaco.Uri.parse(`inmemory://${this.instanceId}/modified`));
6725
+ this.diffEditor.setModel({
6726
+ original: this.originalModel,
6727
+ modified: this.modifiedModel
6728
+ });
6729
+ this.applyReadOnlyState();
6730
+ this.originalChangeDisposable = this.originalModel.onDidChangeContent(() => {
6731
+ if (this.syncingOriginalValue || this.isReadOnlyEffective()) {
6732
+ return;
6733
+ }
6734
+ this.originalValue = this.originalModel?.getValue() ?? '';
6735
+ this.originalValueChange.emit(this.originalValue);
6736
+ });
6737
+ this.modifiedChangeDisposable = this.modifiedModel.onDidChangeContent(() => {
6738
+ if (this.syncingModifiedValue || this.readOnly) {
6739
+ return;
6740
+ }
6741
+ this.modifiedValue = this.modifiedModel?.getValue() ?? '';
6742
+ this.modifiedValueChange.emit(this.modifiedValue);
6743
+ });
6744
+ }
6745
+ ngOnChanges(changes) {
6746
+ if (!this.monaco || !this.diffEditor) {
6747
+ return;
6748
+ }
6749
+ if (changes['theme'] && !changes['theme'].firstChange) {
6750
+ this.monaco.editor.setTheme(this.theme);
6751
+ }
6752
+ if (changes['language'] && !changes['language'].firstChange) {
6753
+ if (this.originalModel) {
6754
+ this.monaco.editor.setModelLanguage(this.originalModel, this.language);
6755
+ }
6756
+ if (this.modifiedModel) {
6757
+ this.monaco.editor.setModelLanguage(this.modifiedModel, this.language);
6758
+ }
6759
+ this.applyLanguageDiagnostics();
6760
+ }
6761
+ if (changes['showDiagnostics'] && !changes['showDiagnostics'].firstChange) {
6762
+ if (this.showDiagnostics) {
6763
+ this.restoreLanguageDiagnostics();
6764
+ }
6765
+ else {
6766
+ this.applyLanguageDiagnostics();
6767
+ }
6768
+ this.diffEditor.updateOptions(this.buildDiffEditorOptions());
6769
+ }
6770
+ if (changes['originalValue'] && !changes['originalValue'].firstChange) {
6771
+ this.syncOriginalModel(this.originalValue ?? '');
6772
+ }
6773
+ if (changes['modifiedValue'] && !changes['modifiedValue'].firstChange) {
6774
+ this.syncModifiedModel(this.modifiedValue ?? '');
6775
+ }
6776
+ if (changes['readOnly'] || changes['originalEditable'] || changes['options']) {
6777
+ this.applyReadOnlyState();
6778
+ }
6779
+ }
6780
+ ngOnDestroy() {
6781
+ this.restoreLanguageDiagnostics();
6782
+ this.originalChangeDisposable?.dispose();
6783
+ this.modifiedChangeDisposable?.dispose();
6784
+ this.diffEditor?.dispose();
6785
+ this.originalModel?.dispose();
6786
+ this.modifiedModel?.dispose();
6787
+ }
6788
+ isReadOnlyEffective() {
6789
+ return this.readOnly || !this.originalEditable;
6790
+ }
6791
+ buildDiffEditorOptions() {
6792
+ const originalEditable = this.readOnly ? false : this.originalEditable;
6793
+ return {
6794
+ readOnly: this.readOnly,
6795
+ originalEditable,
6796
+ automaticLayout: true,
6797
+ renderValidationDecorations: this.showDiagnostics ? 'on' : 'off',
6798
+ ...this.options
6799
+ };
6800
+ }
6801
+ applyReadOnlyState() {
6802
+ if (!this.diffEditor) {
6803
+ return;
6804
+ }
6805
+ const originalEditable = this.readOnly ? false : this.originalEditable;
6806
+ this.diffEditor.updateOptions(this.buildDiffEditorOptions());
6807
+ this.diffEditor.getOriginalEditor().updateOptions({ readOnly: !originalEditable });
6808
+ this.diffEditor.getModifiedEditor().updateOptions({ readOnly: this.readOnly });
6809
+ }
6810
+ getLanguageDiagnosticsApi() {
6811
+ return this.monaco?.languages;
6812
+ }
6813
+ applyLanguageDiagnostics() {
6814
+ if (!this.monaco || this.showDiagnostics) {
6815
+ return;
6816
+ }
6817
+ const languages = this.getLanguageDiagnosticsApi();
6818
+ languages.typescript?.typescriptDefaults.setDiagnosticsOptions(DISABLED_DIAGNOSTICS_OPTIONS);
6819
+ languages.typescript?.javascriptDefaults.setDiagnosticsOptions(DISABLED_DIAGNOSTICS_OPTIONS);
6820
+ languages.json?.jsonDefaults.setDiagnosticsOptions({ validate: false });
6821
+ }
6822
+ restoreLanguageDiagnostics() {
6823
+ if (!this.monaco) {
6824
+ return;
6825
+ }
6826
+ const languages = this.getLanguageDiagnosticsApi();
6827
+ languages.typescript?.typescriptDefaults.setDiagnosticsOptions(DEFAULT_DIAGNOSTICS_OPTIONS);
6828
+ languages.typescript?.javascriptDefaults.setDiagnosticsOptions(DEFAULT_DIAGNOSTICS_OPTIONS);
6829
+ languages.json?.jsonDefaults.setDiagnosticsOptions({ validate: true });
6830
+ }
6831
+ syncOriginalModel(value) {
6832
+ if (!this.originalModel || this.originalModel.getValue() === value) {
6833
+ return;
6834
+ }
6835
+ this.syncingOriginalValue = true;
6836
+ this.originalModel.setValue(value);
6837
+ this.syncingOriginalValue = false;
6838
+ }
6839
+ syncModifiedModel(value) {
6840
+ if (!this.modifiedModel || this.modifiedModel.getValue() === value) {
6841
+ return;
6842
+ }
6843
+ this.syncingModifiedValue = true;
6844
+ this.modifiedModel.setValue(value);
6845
+ this.syncingModifiedValue = false;
6846
+ }
6847
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TCloudUiEditorDiffComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
6848
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: TCloudUiEditorDiffComponent, isStandalone: true, selector: "tcloud-ui-editor-diff", inputs: { originalValue: "originalValue", modifiedValue: "modifiedValue", language: "language", theme: "theme", height: "height", options: "options", readOnly: "readOnly", originalEditable: "originalEditable", showDiagnostics: "showDiagnostics" }, outputs: { originalValueChange: "originalValueChange", modifiedValueChange: "modifiedValueChange" }, viewQueries: [{ propertyName: "diffEditorContainer", first: true, predicate: ["diffEditorContainer"], descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<div class=\"tcloud-ui-editor-diff-wrapper\" [style.height]=\"height\">\n <div #diffEditorContainer class=\"tcloud-ui-editor-diff-container\"></div>\n</div>\n", styles: [":host{display:block}.tcloud-ui-editor-diff-wrapper{width:100%}.tcloud-ui-editor-diff-container{width:100%;height:100%;min-height:240px;border:1px solid var(--c-neutral-300, #d1d5db);border-radius:8px;overflow:hidden}\n"] }); }
6849
+ }
6850
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TCloudUiEditorDiffComponent, decorators: [{
6851
+ type: Component,
6852
+ args: [{ selector: 'tcloud-ui-editor-diff', imports: [], template: "<div class=\"tcloud-ui-editor-diff-wrapper\" [style.height]=\"height\">\n <div #diffEditorContainer class=\"tcloud-ui-editor-diff-container\"></div>\n</div>\n", styles: [":host{display:block}.tcloud-ui-editor-diff-wrapper{width:100%}.tcloud-ui-editor-diff-container{width:100%;height:100%;min-height:240px;border:1px solid var(--c-neutral-300, #d1d5db);border-radius:8px;overflow:hidden}\n"] }]
6853
+ }], propDecorators: { originalValue: [{
6854
+ type: Input
6855
+ }], modifiedValue: [{
6856
+ type: Input
6857
+ }], language: [{
6858
+ type: Input
6859
+ }], theme: [{
6860
+ type: Input
6861
+ }], height: [{
6862
+ type: Input
6863
+ }], options: [{
6864
+ type: Input
6865
+ }], readOnly: [{
6866
+ type: Input
6867
+ }], originalEditable: [{
6868
+ type: Input
6869
+ }], showDiagnostics: [{
6870
+ type: Input
6871
+ }], originalValueChange: [{
6872
+ type: Output
6873
+ }], modifiedValueChange: [{
6874
+ type: Output
6875
+ }], diffEditorContainer: [{
6876
+ type: ViewChild,
6877
+ args: ['diffEditorContainer', { static: true }]
6878
+ }] } });
6879
+
6541
6880
  class TCloudUiAlignDirective {
6542
6881
  set TCalign(direction) {
6543
6882
  if (direction) {
@@ -9306,47 +9645,49 @@ class TCloudUiDialogModel {
9306
9645
 
9307
9646
  class TCloudUiDialogService {
9308
9647
  constructor() {
9309
- // * [Injects]
9310
9648
  this.i18n = inject(I18nService);
9649
+ this.appRef = inject(ApplicationRef);
9650
+ this.environmentInjector = inject(EnvironmentInjector);
9311
9651
  }
9312
9652
  /**
9313
- * Método usado para realizar a configuração de 'ViewContainerRef'
9314
- * @param viewContainerRef Obj
9653
+ * Opcional. Por padrão o diálogo é criado em `document.body` com o injector da aplicação.
9654
+ * Use apenas quando precisar de um host explícito na árvore de views (ex.: `tcloud-ui-dialog-host`).
9315
9655
  */
9316
9656
  setRootViewContainerRef(viewContainerRef) {
9317
- if (!viewContainerRef)
9318
- return;
9319
- this.rootViewContainer = viewContainerRef;
9657
+ this.rootViewContainer = viewContainerRef ?? undefined;
9320
9658
  }
9321
- /**
9322
- * Método usado para abrir o modal de dialog
9323
- * @param _data Info do dialog
9324
- */
9325
9659
  open(_data = {}) {
9326
- if (!this.rootViewContainer) {
9327
- throw new Error('TCloudUiDialogService: ViewContainerRef não configurado. ' +
9328
- 'Declare no template um âncora (ex.: <ng-container #dialogRoot></ng-container>), ' +
9329
- 'use @ViewChild("dialogRoot", { read: ViewContainerRef }) e chame setRootViewContainerRef(ref) no ngAfterViewInit. ' +
9330
- 'Se #dialogRoot estiver dentro de *ngIf, chame setRootViewContainerRef de novo quando o bloco for exibido.');
9331
- }
9332
- const componentRef = this.rootViewContainer.createComponent(TCloudUiDialogComponent, {
9333
- injector: this.rootViewContainer.injector,
9334
- });
9660
+ const componentRef = this.createDialogComponent();
9335
9661
  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);
9336
- // * Configura o texto do input de confirmação
9337
9662
  if (componentRef.instance.data.inputConfirmationText)
9338
9663
  this.setTextConfirmation(componentRef.instance);
9339
9664
  componentRef.instance.events.subscribe(event => {
9340
- // * Fecha o dialogo
9341
9665
  if (event === TCloudUiDialogEventsEnum.close)
9342
- componentRef.destroy();
9666
+ this.destroyDialog(componentRef);
9343
9667
  });
9344
9668
  return componentRef.instance;
9345
9669
  }
9346
- /**
9347
- * Método usado para configurar o texto do input de confirmação
9348
- * @param component Componente do dialogo
9349
- */
9670
+ createDialogComponent() {
9671
+ if (this.rootViewContainer) {
9672
+ return this.rootViewContainer.createComponent(TCloudUiDialogComponent, {
9673
+ injector: this.rootViewContainer.injector,
9674
+ });
9675
+ }
9676
+ const componentRef = createComponent(TCloudUiDialogComponent, {
9677
+ environmentInjector: this.environmentInjector,
9678
+ });
9679
+ this.appRef.attachView(componentRef.hostView);
9680
+ document.body.appendChild(componentRef.location.nativeElement);
9681
+ return componentRef;
9682
+ }
9683
+ destroyDialog(componentRef) {
9684
+ if (this.rootViewContainer) {
9685
+ componentRef.destroy();
9686
+ return;
9687
+ }
9688
+ this.appRef.detachView(componentRef.hostView);
9689
+ componentRef.destroy();
9690
+ }
9350
9691
  setTextConfirmation(component) {
9351
9692
  switch (component.data.inputConfirmationText) {
9352
9693
  case TCloudUiDialogTextConfirmationEnum.continue:
@@ -9370,6 +9711,35 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
9370
9711
  }]
9371
9712
  }] });
9372
9713
 
9714
+ /**
9715
+ * Opcional: use apenas se precisar ancorar o diálogo em um container específico da árvore de views
9716
+ * (ex.: stacking context, Shadow DOM). Caso contrário, `TCloudUiDialogService.open()` funciona sem setup.
9717
+ */
9718
+ class TCloudUiDialogHostComponent {
9719
+ constructor() {
9720
+ this.dialogService = inject(TCloudUiDialogService);
9721
+ }
9722
+ ngAfterViewInit() {
9723
+ this.dialogService.setRootViewContainerRef(this.dialogRoot);
9724
+ }
9725
+ ngOnDestroy() {
9726
+ this.dialogService.setRootViewContainerRef(null);
9727
+ }
9728
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TCloudUiDialogHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9729
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: TCloudUiDialogHostComponent, isStandalone: true, selector: "tcloud-ui-dialog-host", viewQueries: [{ propertyName: "dialogRoot", first: true, predicate: ["dialogRoot"], descendants: true, read: ViewContainerRef }], ngImport: i0, template: '<ng-container #dialogRoot />', isInline: true }); }
9730
+ }
9731
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: TCloudUiDialogHostComponent, decorators: [{
9732
+ type: Component,
9733
+ args: [{
9734
+ selector: 'tcloud-ui-dialog-host',
9735
+ standalone: true,
9736
+ template: '<ng-container #dialogRoot />',
9737
+ }]
9738
+ }], propDecorators: { dialogRoot: [{
9739
+ type: ViewChild,
9740
+ args: ['dialogRoot', { read: ViewContainerRef }]
9741
+ }] } });
9742
+
9373
9743
  const COMPONENTS = [
9374
9744
  TCloudUiAccordionComponent,
9375
9745
  TCloudUiAccordionBodyComponent,
@@ -9422,6 +9792,7 @@ const COMPONENTS = [
9422
9792
  TCloudUiDropdownComponent,
9423
9793
  TCloudUiDropdownMultiComponent,
9424
9794
  TCloudUiDialogComponent,
9795
+ TCloudUiDialogHostComponent,
9425
9796
  TCloudUiEmptyContentComponent,
9426
9797
  TCloudUiFaqComponent,
9427
9798
  TCloudUiMessageComponent,
@@ -9439,7 +9810,9 @@ const COMPONENTS = [
9439
9810
  TCloudUiFilterBarComponent,
9440
9811
  TCloudUiLegendComponent,
9441
9812
  TCloudUiSearchBarComponent,
9442
- TCloudUiUploadAreaComponent
9813
+ TCloudUiUploadAreaComponent,
9814
+ TCloudUiEditorComponent,
9815
+ TCloudUiEditorDiffComponent
9443
9816
  ];
9444
9817
  const DIRECTIVES = [
9445
9818
  TCloudUiAlignDirective,
@@ -9553,6 +9926,7 @@ class TCloudUiModule {
9553
9926
  TCloudUiDropdownComponent,
9554
9927
  TCloudUiDropdownMultiComponent,
9555
9928
  TCloudUiDialogComponent,
9929
+ TCloudUiDialogHostComponent,
9556
9930
  TCloudUiEmptyContentComponent,
9557
9931
  TCloudUiFaqComponent,
9558
9932
  TCloudUiMessageComponent,
@@ -9570,7 +9944,9 @@ class TCloudUiModule {
9570
9944
  TCloudUiFilterBarComponent,
9571
9945
  TCloudUiLegendComponent,
9572
9946
  TCloudUiSearchBarComponent,
9573
- TCloudUiUploadAreaComponent, TCloudUiAlignDirective,
9947
+ TCloudUiUploadAreaComponent,
9948
+ TCloudUiEditorComponent,
9949
+ TCloudUiEditorDiffComponent, TCloudUiAlignDirective,
9574
9950
  TCloudUiCheckboxDirective,
9575
9951
  TCloudUiCurrencyDirective,
9576
9952
  TCloudUiElCopyDirective,
@@ -9646,6 +10022,7 @@ class TCloudUiModule {
9646
10022
  TCloudUiDropdownComponent,
9647
10023
  TCloudUiDropdownMultiComponent,
9648
10024
  TCloudUiDialogComponent,
10025
+ TCloudUiDialogHostComponent,
9649
10026
  TCloudUiEmptyContentComponent,
9650
10027
  TCloudUiFaqComponent,
9651
10028
  TCloudUiMessageComponent,
@@ -9663,7 +10040,9 @@ class TCloudUiModule {
9663
10040
  TCloudUiFilterBarComponent,
9664
10041
  TCloudUiLegendComponent,
9665
10042
  TCloudUiSearchBarComponent,
9666
- TCloudUiUploadAreaComponent, TCloudUiAlignDirective,
10043
+ TCloudUiUploadAreaComponent,
10044
+ TCloudUiEditorComponent,
10045
+ TCloudUiEditorDiffComponent, TCloudUiAlignDirective,
9667
10046
  TCloudUiCheckboxDirective,
9668
10047
  TCloudUiCurrencyDirective,
9669
10048
  TCloudUiElCopyDirective,
@@ -11777,5 +12156,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
11777
12156
  * Generated bundle index. Do not edit.
11778
12157
  */
11779
12158
 
11780
- export { AcceptedFileType, BytesPipe, CNPJPipe, CPFPipe, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$2 as CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR, DateBRPipe, DropdownGroupedSize, DropdownMultiSize$1 as DropdownMultiSize, DropdownSize$1 as DropdownSize, MonthNamePipe, MultiLevelDropdownSize$1 as MultiLevelDropdownSize, ProductActionPipe, ProgressStatusBarGradientStatus$1 as ProgressStatusBarGradientStatus, RespectivePipe, StatusInfoPipe, TCCondition, TCFiltersType, TCLOUD_UI_CONFIG, TCLOUD_UI_LAYOUT_SERVICE, TCLOUD_UI_LOCALE_SERVICE, TCLOUD_UI_USER_SERVICE, TCLOUD_UI_VIEWPORT_SERVICE, TCloudUiAccordionBodyComponent, TCloudUiAccordionComponent, TCloudUiAccordionTitleComponent, TCloudUiAlertBannerComponent, TCloudUiAlignDirective, TCloudUiBreadcrumbComponent, TCloudUiBreadcrumbService, TCloudUiButtonDirective, TCloudUiCalendarComponent, TCloudUiCardAccordionComponent, TCloudUiCardComponent, TCloudUiCardTitleComponent, TCloudUiCheckAccessDirective, TCloudUiCheckAccessService, TCloudUiCheckboxDirective, TCloudUiChoiceIssuesComponent, TCloudUiContainerColComponent, TCloudUiContainerComponent, TCloudUiContainerContentComponent, TCloudUiCubesComponent, TCloudUiCurrencyDirective, TCloudUiDataListComponent, TCloudUiDataListOptionComponent, TCloudUiDatepickerComponent, TCloudUiDatepickerTimeComponent, TCloudUiDialogComponent, TCloudUiDialogEventsEnum, TCloudUiDialogModel, TCloudUiDialogService, TCloudUiDialogStatusEnum, TCloudUiDialogTextConfirmationEnum, TCloudUiDigitOnlyDirective, TCloudUiDropdownComponent, TCloudUiDropdownMultiComponent, TCloudUiDropdownMultiLevelComponent, TCloudUiElCopyDirective, TCloudUiEmptyContentComponent, TCloudUiFaqComponent, TCloudUiFilterBarComponent, TCloudUiFiltersComponent, TCloudUiFormDirective, TCloudUiHighLightDirective, TCloudUiHoverParentDirective, TCloudUiIconButtonDirective, TCloudUiInputContainerComponent, TCloudUiInputDirective, TCloudUiInputPasswordComponent, TCloudUiInputSearchComponent, TCloudUiIpMaskDirective, TCloudUiLabelTokenComponent, TCloudUiLegendComponent, TCloudUiLineStepCircleComponent, TCloudUiLineStepTitleComponent, TCloudUiLinhaLogoComponent, TCloudUiLoadingComponent, TCloudUiLoadingTransitionsService, TCloudUiMessageComponent, TCloudUiModalBodyComponent, TCloudUiModalComponent, TCloudUiModalFooterComponent, TCloudUiModalHeaderComponent, TCloudUiModule, TCloudUiMultiInputComponent, TCloudUiMultiSelectComponent, TCloudUiMultiplesValuesComponent, TCloudUiNgCheckAccessDirective, TCloudUiNgFeatureFlagsDirective, TCloudUiNotFoundComponent, TCloudUiNumberStepComponent, TCloudUiPaginationComponent, TCloudUiPaginationPipe, TCloudUiProgressBarComponent, TCloudUiProgressStatusBarComponent, TCloudUiRadioDirective, TCloudUiRangeDateComponent, TCloudUiReorderItemsComponent, TCloudUiScrollBoxComponent, TCloudUiSearchBarComponent, TCloudUiSearchInObjectService, TCloudUiSearchInputComponent, TCloudUiSkeletonLoadingComponent, TCloudUiSkeletonLoadingComponentStyle, TCloudUiSlideToggleDirective, TCloudUiSubNavbarComponent, TCloudUiSubNavbarGroupComponent, TCloudUiSubNavbarItemComponent, TCloudUiTabContentComponent, TCloudUiTabGroupComponent, TCloudUiTabHeadComponent, TCloudUiTabItemComponent, TCloudUiTabMenuComponent, TCloudUiTabSubtitleComponent, TCloudUiTabTitleComponent, TCloudUiTableComponent, TCloudUiTagComponent, TCloudUiToastComponent, TCloudUiTooltipDirective, TCloudUiUploadAreaComponent, TCloudUiWelcomeComponent, TCloudUiWizardStepsComponent, TagColorsEnum, TcRevButtonDirective, TcRevCalendarComponent, TcRevCardAccordionComponent, TcRevCardComponent, TcRevCardTitleComponent, TcRevCheckboxDirective, TcRevComponentsLibModule, TcRevDropdownComponent, TcRevDropdownGroupedComponent, TcRevDropdownMultiComponent, TcRevDropdownMultiLevelComponent, TcRevEmptyContentComponent, TcRevFaqComponent, TcRevIconButtonDirective, TcRevInputContainerComponent, TcRevInputDirective, TcRevLoadingComponent, TcRevMessageComponent, TcRevMultiInputComponent, TcRevPaginationComponent, TcRevProgressStatusBarComponent, TcRevRadioDirective, TcRevSearchInputComponent, TcRevSideDrawerComponent, TcRevSkeletonLoadingComponent, TcRevSkeletonLoadingComponentStyle, TcRevSlideToggleDirective, TcRevSmallLoadingComponent, TcRevSmallLoadingComponentStyle, TcRevSubNavbarComponent, TcRevSubNavbarItemComponent, TcRevTabGroupComponent, TcRevTabItemComponent, TcRevTagComponent, TcRevToastComponent, TcRevTooltipDirective, TcRevWizardStepsComponent, ToTextPipe, TopologyEnvironmentPipe, TopologyProductPipe, TopologyRegionPipe, TopologyStatusPipe, echartBarConfig, isTextEllipsed, provideTCloudUi };
12159
+ export { AcceptedFileType, BytesPipe, CNPJPipe, CPFPipe, CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR$2 as CUSTOM_INPUT_CONTROL_VALUE_ACCESSOR, DateBRPipe, DropdownGroupedSize, DropdownMultiSize$1 as DropdownMultiSize, DropdownSize$1 as DropdownSize, MonthNamePipe, MultiLevelDropdownSize$1 as MultiLevelDropdownSize, ProductActionPipe, ProgressStatusBarGradientStatus$1 as ProgressStatusBarGradientStatus, RespectivePipe, StatusInfoPipe, TCCondition, TCFiltersType, TCLOUD_UI_CONFIG, TCLOUD_UI_LAYOUT_SERVICE, TCLOUD_UI_LOCALE_SERVICE, TCLOUD_UI_USER_SERVICE, TCLOUD_UI_VIEWPORT_SERVICE, TCloudUiAccordionBodyComponent, TCloudUiAccordionComponent, TCloudUiAccordionTitleComponent, TCloudUiAlertBannerComponent, TCloudUiAlignDirective, TCloudUiBreadcrumbComponent, TCloudUiBreadcrumbService, TCloudUiButtonDirective, TCloudUiCalendarComponent, TCloudUiCardAccordionComponent, TCloudUiCardComponent, TCloudUiCardTitleComponent, TCloudUiCheckAccessDirective, TCloudUiCheckAccessService, TCloudUiCheckboxDirective, TCloudUiChoiceIssuesComponent, TCloudUiContainerColComponent, TCloudUiContainerComponent, TCloudUiContainerContentComponent, TCloudUiCubesComponent, TCloudUiCurrencyDirective, TCloudUiDataListComponent, TCloudUiDataListOptionComponent, TCloudUiDatepickerComponent, TCloudUiDatepickerTimeComponent, TCloudUiDialogComponent, TCloudUiDialogEventsEnum, TCloudUiDialogHostComponent, TCloudUiDialogModel, TCloudUiDialogService, TCloudUiDialogStatusEnum, TCloudUiDialogTextConfirmationEnum, TCloudUiDigitOnlyDirective, TCloudUiDropdownComponent, TCloudUiDropdownMultiComponent, TCloudUiDropdownMultiLevelComponent, TCloudUiEditorComponent, TCloudUiEditorDiffComponent, TCloudUiElCopyDirective, TCloudUiEmptyContentComponent, TCloudUiFaqComponent, TCloudUiFilterBarComponent, TCloudUiFiltersComponent, TCloudUiFormDirective, TCloudUiHighLightDirective, TCloudUiHoverParentDirective, TCloudUiIconButtonDirective, TCloudUiInputContainerComponent, TCloudUiInputDirective, TCloudUiInputPasswordComponent, TCloudUiInputSearchComponent, TCloudUiIpMaskDirective, TCloudUiLabelTokenComponent, TCloudUiLegendComponent, TCloudUiLineStepCircleComponent, TCloudUiLineStepTitleComponent, TCloudUiLinhaLogoComponent, TCloudUiLoadingComponent, TCloudUiLoadingTransitionsService, TCloudUiMessageComponent, TCloudUiModalBodyComponent, TCloudUiModalComponent, TCloudUiModalFooterComponent, TCloudUiModalHeaderComponent, TCloudUiModule, TCloudUiMultiInputComponent, TCloudUiMultiSelectComponent, TCloudUiMultiplesValuesComponent, TCloudUiNgCheckAccessDirective, TCloudUiNgFeatureFlagsDirective, TCloudUiNotFoundComponent, TCloudUiNumberStepComponent, TCloudUiPaginationComponent, TCloudUiPaginationPipe, TCloudUiProgressBarComponent, TCloudUiProgressStatusBarComponent, TCloudUiRadioDirective, TCloudUiRangeDateComponent, TCloudUiReorderItemsComponent, TCloudUiScrollBoxComponent, TCloudUiSearchBarComponent, TCloudUiSearchInObjectService, TCloudUiSearchInputComponent, TCloudUiSkeletonLoadingComponent, TCloudUiSkeletonLoadingComponentStyle, TCloudUiSlideToggleDirective, TCloudUiSubNavbarComponent, TCloudUiSubNavbarGroupComponent, TCloudUiSubNavbarItemComponent, TCloudUiTabContentComponent, TCloudUiTabGroupComponent, TCloudUiTabHeadComponent, TCloudUiTabItemComponent, TCloudUiTabMenuComponent, TCloudUiTabSubtitleComponent, TCloudUiTabTitleComponent, TCloudUiTableComponent, TCloudUiTagComponent, TCloudUiToastComponent, TCloudUiTooltipDirective, TCloudUiUploadAreaComponent, TCloudUiWelcomeComponent, TCloudUiWizardStepsComponent, TagColorsEnum, TcRevButtonDirective, TcRevCalendarComponent, TcRevCardAccordionComponent, TcRevCardComponent, TcRevCardTitleComponent, TcRevCheckboxDirective, TcRevComponentsLibModule, TcRevDropdownComponent, TcRevDropdownGroupedComponent, TcRevDropdownMultiComponent, TcRevDropdownMultiLevelComponent, TcRevEmptyContentComponent, TcRevFaqComponent, TcRevIconButtonDirective, TcRevInputContainerComponent, TcRevInputDirective, TcRevLoadingComponent, TcRevMessageComponent, TcRevMultiInputComponent, TcRevPaginationComponent, TcRevProgressStatusBarComponent, TcRevRadioDirective, TcRevSearchInputComponent, TcRevSideDrawerComponent, TcRevSkeletonLoadingComponent, TcRevSkeletonLoadingComponentStyle, TcRevSlideToggleDirective, TcRevSmallLoadingComponent, TcRevSmallLoadingComponentStyle, TcRevSubNavbarComponent, TcRevSubNavbarItemComponent, TcRevTabGroupComponent, TcRevTabItemComponent, TcRevTagComponent, TcRevToastComponent, TcRevTooltipDirective, TcRevWizardStepsComponent, ToTextPipe, TopologyEnvironmentPipe, TopologyProductPipe, TopologyRegionPipe, TopologyStatusPipe, echartBarConfig, isTextEllipsed, provideTCloudUi };
11781
12160
  //# sourceMappingURL=dev-tcloud-tcloud-ui.mjs.map