@main-class/componentes 3.11.1 → 4.0.0-next.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/README.md +17 -0
- package/fesm2022/main-class-componentes-arquivo.mjs +851 -369
- package/fesm2022/main-class-componentes-arquivo.mjs.map +1 -1
- package/fesm2022/main-class-componentes-core.mjs +288 -240
- package/fesm2022/main-class-componentes-core.mjs.map +1 -1
- package/fesm2022/main-class-componentes-crud.mjs +1004 -546
- package/fesm2022/main-class-componentes-crud.mjs.map +1 -1
- package/fesm2022/main-class-componentes-dialog.mjs +758 -385
- package/fesm2022/main-class-componentes-dialog.mjs.map +1 -1
- package/fesm2022/main-class-componentes-form.mjs +299 -196
- package/fesm2022/main-class-componentes-form.mjs.map +1 -1
- package/fesm2022/main-class-componentes-input.mjs +4143 -2141
- package/fesm2022/main-class-componentes-input.mjs.map +1 -1
- package/fesm2022/main-class-componentes-loader.mjs +262 -212
- package/fesm2022/main-class-componentes-loader.mjs.map +1 -1
- package/fesm2022/main-class-componentes-misc.mjs +508 -354
- package/fesm2022/main-class-componentes-misc.mjs.map +1 -1
- package/fesm2022/main-class-componentes-pipe.mjs +39 -26
- package/fesm2022/main-class-componentes-pipe.mjs.map +1 -1
- package/fesm2022/main-class-componentes-table.mjs +1331 -624
- package/fesm2022/main-class-componentes-table.mjs.map +1 -1
- package/fesm2022/main-class-componentes.mjs +3 -11
- package/fesm2022/main-class-componentes.mjs.map +1 -1
- package/package.json +32 -16
- package/types/main-class-componentes-arquivo.d.ts +190 -0
- package/types/main-class-componentes-core.d.ts +99 -0
- package/types/main-class-componentes-crud.d.ts +172 -0
- package/types/main-class-componentes-dialog.d.ts +125 -0
- package/types/main-class-componentes-form.d.ts +70 -0
- package/types/main-class-componentes-input.d.ts +687 -0
- package/types/main-class-componentes-loader.d.ts +69 -0
- package/types/main-class-componentes-misc.d.ts +87 -0
- package/types/main-class-componentes-pipe.d.ts +10 -0
- package/types/main-class-componentes-table.d.ts +265 -0
- package/types/main-class-componentes.d.ts +4 -0
- package/arquivo/index.d.ts +0 -5
- package/arquivo/src/arquivo-manager.service.d.ts +0 -13
- package/arquivo/src/download-arquivo.directive.d.ts +0 -12
- package/arquivo/src/imagem.directive.d.ts +0 -21
- package/arquivo/src/preview-arquivo/dialog-preview-arquivo/dialog-preview-arquivo.component.d.ts +0 -23
- package/arquivo/src/preview-arquivo/preview-arquivo.component.d.ts +0 -27
- package/core/index.d.ts +0 -4
- package/core/src/criptografia/criptografia.service.d.ts +0 -6
- package/core/src/mensageria/mensageria.service.d.ts +0 -17
- package/core/src/mobile/mobile.service.d.ts +0 -15
- package/core/src/validator/valida-modulo11.service.d.ts +0 -55
- package/crud/index.d.ts +0 -7
- package/crud/src/abstract-consulta-paginada-component.d.ts +0 -24
- package/crud/src/abstract-edicao-component.d.ts +0 -19
- package/crud/src/abstract-edicao-modal-component.d.ts +0 -19
- package/crud/src/query/query-field/query-field.component.d.ts +0 -40
- package/crud/src/query/query-form-field/query-form-field.component.d.ts +0 -12
- package/crud/src/query/query-form.component.d.ts +0 -28
- package/crud/src/query/query-modal-form/query-modal-form.component.d.ts +0 -13
- package/dialog/index.d.ts +0 -10
- package/dialog/src/dialog-confirmacao/dialog-confirmacao.component.d.ts +0 -23
- package/dialog/src/dialog-iframe/dialog-iframe.component.d.ts +0 -21
- package/dialog/src/dialog-sidebar/modal-template/modal-body.directive.d.ts +0 -9
- package/dialog/src/dialog-sidebar/modal-template/modal-close.directive.d.ts +0 -9
- package/dialog/src/dialog-sidebar/modal-template/modal-footer.directive.d.ts +0 -6
- package/dialog/src/dialog-sidebar/modal-template/modal-header.directive.d.ts +0 -6
- package/dialog/src/dialog-sidebar/modal-template/modal-template.component.d.ts +0 -12
- package/dialog/src/dialog-sidebar/modal.component.d.ts +0 -8
- package/dialog/src/dialog-sidebar/sidebar-modal-ref.d.ts +0 -21
- package/dialog/src/dialog.service.d.ts +0 -26
- package/form/index.d.ts +0 -3
- package/form/src/form.component.d.ts +0 -24
- package/form/src/mensagens-erro/mensagens-erro.component.d.ts +0 -17
- package/form/src/single-click.directive.d.ts +0 -13
- package/index.d.ts +0 -5
- package/input/index.d.ts +0 -26
- package/input/src/abstract-control-value-accessor.d.ts +0 -18
- package/input/src/abstract-mat-form-field-control.d.ts +0 -42
- package/input/src/abstract-mat-form-field-select-control.d.ts +0 -31
- package/input/src/input-currency/input-currency.component.d.ts +0 -9
- package/input/src/input-datetime/input-datetime.component.d.ts +0 -32
- package/input/src/input-fileupload/input-fileupload-validator.directive.d.ts +0 -8
- package/input/src/input-fileupload/input-fileupload.component.d.ts +0 -70
- package/input/src/input-mask/documento-validators.d.ts +0 -7
- package/input/src/input-mask/input-cep.component.d.ts +0 -7
- package/input/src/input-mask/input-cnpj.component.d.ts +0 -7
- package/input/src/input-mask/input-cpf-cnpj.component.d.ts +0 -7
- package/input/src/input-mask/input-cpf.component.d.ts +0 -7
- package/input/src/input-mask/input-mask-validator.directive.d.ts +0 -16
- package/input/src/input-mask/input-mask.component.d.ts +0 -24
- package/input/src/input-mask/input-phone.component.d.ts +0 -7
- package/input/src/input-mask/mask-functions.d.ts +0 -2
- package/input/src/input-telefone-internacional/input-telefone-internacional-validator.directive.d.ts +0 -8
- package/input/src/input-telefone-internacional/input-telefone-internacional.component.d.ts +0 -19
- package/input/src/option-checkbox/all-option-checkbox.component.d.ts +0 -18
- package/input/src/option-checkbox/node-pool.d.ts +0 -23
- package/input/src/option-checkbox/option-checkbox-group.component.d.ts +0 -25
- package/input/src/option-checkbox/option-checkbox.component.d.ts +0 -23
- package/input/src/option-checkbox/option-checkbox.service.d.ts +0 -16
- package/input/src/option-checkbox/option-node.d.ts +0 -13
- package/input/src/select-autocomplete/select-autocomplete.component.d.ts +0 -15
- package/input/src/select-chips/select-chips.component.d.ts +0 -12
- package/input/src/select-many-checkbox/select-many-checkbox.component.d.ts +0 -12
- package/input/src/select-option/delegate-option-provider.directive.d.ts +0 -13
- package/input/src/select-option/select-option-provider.d.ts +0 -10
- package/input/src/select-option/select-option.component.d.ts +0 -10
- package/input/src/select-option/select-option.d.ts +0 -4
- package/input/src/select-radio/select-radio.component.d.ts +0 -9
- package/loader/index.d.ts +0 -2
- package/loader/src/loader.component.d.ts +0 -25
- package/loader/src/loader.service.d.ts +0 -20
- package/misc/index.d.ts +0 -12
- package/misc/src/cnpj/cnpj.directive.d.ts +0 -12
- package/misc/src/cnpj/cnpjs.pipe.d.ts +0 -7
- package/misc/src/cpf/cpf.directive.d.ts +0 -12
- package/misc/src/cpf/cpf.pipe.d.ts +0 -7
- package/misc/src/cpf-cnpj/cpf-cnpj.directive.d.ts +0 -12
- package/misc/src/cpf-cnpj/cpf-cnpj.pipe.d.ts +0 -7
- package/misc/src/mask/mask.pipe.d.ts +0 -8
- package/misc/src/monetario/monetario-mask.d.ts +0 -1
- package/misc/src/monetario/monetario.pipe.d.ts +0 -7
- package/misc/src/porcentagem/porcentagem-mask.d.ts +0 -1
- package/misc/src/porcentagem/porcentagem.pipe.d.ts +0 -7
- package/misc/src/telefone/telefone.pipe.d.ts +0 -7
- package/misc/src/unsafe-inner-html/unsafe-inner-html.directive.d.ts +0 -10
- package/pipe/index.d.ts +0 -1
- package/pipe/src/nome-resumido.pipe.d.ts +0 -7
- package/public-api.d.ts +0 -2
- package/table/index.d.ts +0 -10
- package/table/src/column/column-cell.directive.d.ts +0 -8
- package/table/src/column/column-footer.directive.d.ts +0 -8
- package/table/src/column/column-header.directive.d.ts +0 -8
- package/table/src/column/column.directive.d.ts +0 -16
- package/table/src/numeric-paginator/numeric-paginator.component.d.ts +0 -26
- package/table/src/paginated-table/paginated-table.component.d.ts +0 -58
- package/table/src/paginator-i18n.d.ts +0 -8
- package/table/src/table/table.component.d.ts +0 -41
- package/table/src/td/td.component.d.ts +0 -8
- package/table/src/th/th.component.d.ts +0 -8
- package/table/src/undefined-paginator/undefined-paginator.component.d.ts +0 -25
- package/table/src/virtual-paginated-table/virtual-paginated-table.component.d.ts +0 -28
|
@@ -1,370 +1,852 @@
|
|
|
1
|
-
import * as i0 from
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import { ChangeDetectionStrategy, Component, Directive, ElementRef, EventEmitter, HostListener, Inject, InjectionToken, Input, Optional, Output, Self } from "@angular/core";
|
|
3
|
+
import { MAT_DIALOG_DATA, MatDialog, MatDialogActions, MatDialogClose, MatDialogContent } from "@angular/material/dialog";
|
|
4
|
+
import { PdfViewerComponent } from "ng2-pdf-viewer";
|
|
5
|
+
import { MatProgressSpinner } from "@angular/material/progress-spinner";
|
|
6
|
+
import { MatButton, MatIconButton } from "@angular/material/button";
|
|
7
|
+
import { MatIcon } from "@angular/material/icon";
|
|
8
|
+
import { MatTooltip } from "@angular/material/tooltip";
|
|
9
|
+
import { Observable, lastValueFrom } from "rxjs";
|
|
10
|
+
import { NgStyle } from "@angular/common";
|
|
11
|
+
const ARQUIVO_MANAGER_SERVICE = new InjectionToken("mainclass.ARQUIVO_MANAGER_SERVICE");
|
|
12
|
+
var DownloadArquivoDirective = class DownloadArquivoDirective {
|
|
13
|
+
arquivoService;
|
|
14
|
+
attachment;
|
|
15
|
+
target = "_blank";
|
|
16
|
+
constructor(arquivoService) {
|
|
17
|
+
this.arquivoService = arquivoService;
|
|
18
|
+
}
|
|
19
|
+
async getUrlArquivo() {
|
|
20
|
+
if (typeof this.attachment === "string") return this.attachment;
|
|
21
|
+
return await this.arquivoService.downloadURL(this.attachment).toPromise();
|
|
22
|
+
}
|
|
23
|
+
async download() {
|
|
24
|
+
if (!this.attachment) return;
|
|
25
|
+
const link = document.createElement("a");
|
|
26
|
+
const url = await this.getUrlArquivo();
|
|
27
|
+
if (!!url) {
|
|
28
|
+
link.href = url;
|
|
29
|
+
link.target = this.target;
|
|
30
|
+
document.body.appendChild(link);
|
|
31
|
+
link.click();
|
|
32
|
+
document.body.removeChild(link);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
36
|
+
minVersion: "12.0.0",
|
|
37
|
+
version: "22.3.2",
|
|
38
|
+
ngImport: i0,
|
|
39
|
+
type: DownloadArquivoDirective,
|
|
40
|
+
deps: [{ token: ARQUIVO_MANAGER_SERVICE }],
|
|
41
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
42
|
+
});
|
|
43
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
44
|
+
minVersion: "14.0.0",
|
|
45
|
+
version: "22.3.2",
|
|
46
|
+
type: DownloadArquivoDirective,
|
|
47
|
+
isStandalone: true,
|
|
48
|
+
selector: "[mclDownloadArquivo]",
|
|
49
|
+
inputs: {
|
|
50
|
+
attachment: ["mclDownloadArquivo", "attachment"],
|
|
51
|
+
target: "target"
|
|
52
|
+
},
|
|
53
|
+
host: { listeners: { "click": "download()" } },
|
|
54
|
+
ngImport: i0
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
58
|
+
minVersion: "12.0.0",
|
|
59
|
+
version: "22.3.2",
|
|
60
|
+
ngImport: i0,
|
|
61
|
+
type: DownloadArquivoDirective,
|
|
62
|
+
decorators: [{
|
|
63
|
+
type: Directive,
|
|
64
|
+
args: [{ selector: "[mclDownloadArquivo]" }]
|
|
65
|
+
}],
|
|
66
|
+
ctorParameters: () => [{
|
|
67
|
+
type: void 0,
|
|
68
|
+
decorators: [{
|
|
69
|
+
type: Inject,
|
|
70
|
+
args: [ARQUIVO_MANAGER_SERVICE]
|
|
71
|
+
}]
|
|
72
|
+
}],
|
|
73
|
+
propDecorators: {
|
|
74
|
+
attachment: [{
|
|
75
|
+
type: Input,
|
|
76
|
+
args: ["mclDownloadArquivo"]
|
|
77
|
+
}],
|
|
78
|
+
target: [{ type: Input }],
|
|
79
|
+
download: [{
|
|
80
|
+
type: HostListener,
|
|
81
|
+
args: ["click"]
|
|
82
|
+
}]
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
const ZOOM_MINIMO = .1;
|
|
86
|
+
const ZOOM_MAXIMO = 10;
|
|
87
|
+
var VisualizadorImagemComponent = class VisualizadorImagemComponent {
|
|
88
|
+
static nextId = 0;
|
|
89
|
+
id = `mcl-visualizador-imagem-${VisualizadorImagemComponent.nextId++}`;
|
|
90
|
+
imagens = [];
|
|
91
|
+
set indice(indice) {
|
|
92
|
+
this.$indice = indice >= 0 ? indice : 0;
|
|
93
|
+
this.restaura();
|
|
94
|
+
}
|
|
95
|
+
get indice() {
|
|
96
|
+
return this.$indice;
|
|
97
|
+
}
|
|
98
|
+
indiceChange = new EventEmitter();
|
|
99
|
+
escala = 1;
|
|
100
|
+
rotacao = 0;
|
|
101
|
+
deslocamentoX = 0;
|
|
102
|
+
deslocamentoY = 0;
|
|
103
|
+
carregando = true;
|
|
104
|
+
erro = false;
|
|
105
|
+
$indice = 0;
|
|
106
|
+
arrasto;
|
|
107
|
+
get atual() {
|
|
108
|
+
return this.imagens[this.indice];
|
|
109
|
+
}
|
|
110
|
+
get total() {
|
|
111
|
+
return this.imagens.length;
|
|
112
|
+
}
|
|
113
|
+
get descricao() {
|
|
114
|
+
return this.total > 1 ? `Imagem ${this.indice + 1} de ${this.total}` : "Imagem";
|
|
115
|
+
}
|
|
116
|
+
get transformacao() {
|
|
117
|
+
return `translate(${this.deslocamentoX}px, ${this.deslocamentoY}px) rotate(${this.rotacao}deg) scale(${this.escala})`;
|
|
118
|
+
}
|
|
119
|
+
aumentaZoom() {
|
|
120
|
+
this.escala = Math.min(ZOOM_MAXIMO, this.escala * 1.1);
|
|
121
|
+
}
|
|
122
|
+
diminuiZoom() {
|
|
123
|
+
this.escala = Math.max(ZOOM_MINIMO, this.escala / 1.1);
|
|
124
|
+
}
|
|
125
|
+
giraHorario() {
|
|
126
|
+
this.rotacao += 90;
|
|
127
|
+
}
|
|
128
|
+
giraAntiHorario() {
|
|
129
|
+
this.rotacao -= 90;
|
|
130
|
+
}
|
|
131
|
+
restaura() {
|
|
132
|
+
this.escala = 1;
|
|
133
|
+
this.rotacao = 0;
|
|
134
|
+
this.deslocamentoX = 0;
|
|
135
|
+
this.deslocamentoY = 0;
|
|
136
|
+
}
|
|
137
|
+
anterior() {
|
|
138
|
+
if (this.indice > 0) this.navega(this.indice - 1);
|
|
139
|
+
}
|
|
140
|
+
proxima() {
|
|
141
|
+
if (this.indice < this.total - 1) this.navega(this.indice + 1);
|
|
142
|
+
}
|
|
143
|
+
aoCarregar() {
|
|
144
|
+
this.carregando = false;
|
|
145
|
+
this.erro = false;
|
|
146
|
+
}
|
|
147
|
+
aoFalhar() {
|
|
148
|
+
this.carregando = false;
|
|
149
|
+
this.erro = true;
|
|
150
|
+
}
|
|
151
|
+
aoTeclar(event) {
|
|
152
|
+
const acao = {
|
|
153
|
+
"ArrowLeft": () => this.anterior(),
|
|
154
|
+
"ArrowRight": () => this.proxima(),
|
|
155
|
+
"+": () => this.aumentaZoom(),
|
|
156
|
+
"=": () => this.aumentaZoom(),
|
|
157
|
+
"-": () => this.diminuiZoom(),
|
|
158
|
+
"r": () => this.giraHorario(),
|
|
159
|
+
"R": () => this.giraAntiHorario(),
|
|
160
|
+
"0": () => this.restaura()
|
|
161
|
+
}[event.key];
|
|
162
|
+
if (acao && !event.ctrlKey && !event.metaKey && !event.altKey) {
|
|
163
|
+
event.preventDefault();
|
|
164
|
+
acao();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
aoRolar(event) {
|
|
168
|
+
if (event.ctrlKey) {
|
|
169
|
+
event.preventDefault();
|
|
170
|
+
event.deltaY > 0 ? this.diminuiZoom() : this.aumentaZoom();
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
iniciaArrasto(event) {
|
|
174
|
+
if (event.button !== 0) return;
|
|
175
|
+
event.preventDefault();
|
|
176
|
+
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
177
|
+
this.arrasto = {
|
|
178
|
+
x: event.clientX,
|
|
179
|
+
y: event.clientY,
|
|
180
|
+
ponteiro: event.pointerId
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
arrasta(event) {
|
|
184
|
+
if (this.arrasto?.ponteiro === event.pointerId) {
|
|
185
|
+
this.deslocamentoX += event.clientX - this.arrasto.x;
|
|
186
|
+
this.deslocamentoY += event.clientY - this.arrasto.y;
|
|
187
|
+
this.arrasto = {
|
|
188
|
+
...this.arrasto,
|
|
189
|
+
x: event.clientX,
|
|
190
|
+
y: event.clientY
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
terminaArrasto() {
|
|
195
|
+
this.arrasto = void 0;
|
|
196
|
+
}
|
|
197
|
+
navega(indice) {
|
|
198
|
+
if (this.imagens[indice] !== this.atual) {
|
|
199
|
+
this.carregando = true;
|
|
200
|
+
this.erro = false;
|
|
201
|
+
}
|
|
202
|
+
this.$indice = indice;
|
|
203
|
+
this.restaura();
|
|
204
|
+
this.indiceChange.emit(indice);
|
|
205
|
+
}
|
|
206
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
207
|
+
minVersion: "12.0.0",
|
|
208
|
+
version: "22.3.2",
|
|
209
|
+
ngImport: i0,
|
|
210
|
+
type: VisualizadorImagemComponent,
|
|
211
|
+
deps: [],
|
|
212
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
213
|
+
});
|
|
214
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
215
|
+
minVersion: "17.0.0",
|
|
216
|
+
version: "22.3.2",
|
|
217
|
+
type: VisualizadorImagemComponent,
|
|
218
|
+
isStandalone: true,
|
|
219
|
+
selector: "mcl-visualizador-imagem",
|
|
220
|
+
inputs: {
|
|
221
|
+
imagens: "imagens",
|
|
222
|
+
indice: "indice"
|
|
223
|
+
},
|
|
224
|
+
outputs: { indiceChange: "indiceChange" },
|
|
225
|
+
ngImport: i0,
|
|
226
|
+
template: "<div class=\"barra\" role=\"toolbar\" aria-label=\"Controles da imagem\" [attr.aria-controls]=\"id\">\n <button mat-icon-button type=\"button\" aria-label=\"Diminuir zoom\" matTooltip=\"Diminuir zoom (-)\"\n (click)=\"diminuiZoom()\">\n <mat-icon>zoom_out</mat-icon>\n </button>\n <button mat-icon-button type=\"button\" aria-label=\"Aumentar zoom\" matTooltip=\"Aumentar zoom (+)\"\n (click)=\"aumentaZoom()\">\n <mat-icon>zoom_in</mat-icon>\n </button>\n <button mat-icon-button type=\"button\" aria-label=\"Girar para a esquerda\" matTooltip=\"Girar para a esquerda (Shift+R)\"\n (click)=\"giraAntiHorario()\">\n <mat-icon>rotate_left</mat-icon>\n </button>\n <button mat-icon-button type=\"button\" aria-label=\"Girar para a direita\" matTooltip=\"Girar para a direita (R)\"\n (click)=\"giraHorario()\">\n <mat-icon>rotate_right</mat-icon>\n </button>\n <button mat-icon-button type=\"button\" aria-label=\"Restaurar tamanho e posição\" matTooltip=\"Restaurar (0)\"\n (click)=\"restaura()\">\n <mat-icon>fit_screen</mat-icon>\n </button>\n\n @if (total > 1) {\n <span class=\"espaco\"></span>\n <button mat-icon-button type=\"button\" aria-label=\"Imagem anterior\" matTooltip=\"Imagem anterior (←)\"\n [disabled]=\"indice === 0\" (click)=\"anterior()\">\n <mat-icon>chevron_left</mat-icon>\n </button>\n <span class=\"contador\" aria-live=\"polite\">{{ indice + 1 }} de {{ total }}</span>\n <button mat-icon-button type=\"button\" aria-label=\"Próxima imagem\" matTooltip=\"Próxima imagem (→)\"\n [disabled]=\"indice === total - 1\" (click)=\"proxima()\">\n <mat-icon>chevron_right</mat-icon>\n </button>\n }\n</div>\n\n<div class=\"area\" tabindex=\"0\" role=\"group\" [id]=\"id\"\n [attr.aria-label]=\"descricao\"\n [attr.aria-describedby]=\"id + '-ajuda'\"\n (keydown)=\"aoTeclar($event)\"\n (wheel)=\"aoRolar($event)\">\n @if (atual) {\n <img [src]=\"atual\" [alt]=\"descricao\" draggable=\"false\"\n [style.transform]=\"transformacao\"\n (load)=\"aoCarregar()\" (error)=\"aoFalhar()\"\n (pointerdown)=\"iniciaArrasto($event)\" (pointermove)=\"arrasta($event)\"\n (pointerup)=\"terminaArrasto()\" (pointercancel)=\"terminaArrasto()\"/>\n }\n\n @if (carregando && !erro) {\n <mat-spinner class=\"carregando\" [diameter]=\"40\" aria-label=\"Carregando imagem\"></mat-spinner>\n }\n\n @if (erro) {\n <p class=\"erro\" role=\"alert\">Não foi possível carregar a imagem.</p>\n }\n\n <span class=\"cdk-visually-hidden\" [id]=\"id + '-ajuda'\">\n Atalhos: + e - para zoom, R para girar, 0 para restaurar{{ total > 1 ? ', setas para trocar de imagem' : '' }}.\n </span>\n</div>\n",
|
|
227
|
+
styles: [":host{display:block}.barra{display:flex;align-items:center;flex-wrap:wrap;gap:4px;margin-bottom:8px}.barra .espaco{flex:1 1 auto}.barra .contador{min-width:56px;text-align:center}.area{position:relative;display:flex;align-items:center;justify-content:center;min-width:min(600px,70vw);min-height:300px;height:60vh;overflow:hidden;border-radius:4px;background:#ccc}.area:focus-visible{outline:2px solid currentColor;outline-offset:2px}.area img{display:block;max-width:100%;max-height:100%;cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none;transition:transform .15s}.area img:active{cursor:grabbing;transition:none}.area .carregando{position:absolute}.area .erro{position:absolute;margin:0}\n"],
|
|
228
|
+
dependencies: [
|
|
229
|
+
{
|
|
230
|
+
kind: "component",
|
|
231
|
+
type: MatIconButton,
|
|
232
|
+
selector: "button[mat-icon-button], a[mat-icon-button], button[matIconButton], a[matIconButton]",
|
|
233
|
+
exportAs: ["matButton", "matAnchor"]
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
kind: "component",
|
|
237
|
+
type: MatIcon,
|
|
238
|
+
selector: "mat-icon",
|
|
239
|
+
inputs: [
|
|
240
|
+
"color",
|
|
241
|
+
"inline",
|
|
242
|
+
"svgIcon",
|
|
243
|
+
"fontSet",
|
|
244
|
+
"fontIcon"
|
|
245
|
+
],
|
|
246
|
+
exportAs: ["matIcon"]
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
kind: "directive",
|
|
250
|
+
type: MatTooltip,
|
|
251
|
+
selector: "[matTooltip]",
|
|
252
|
+
inputs: [
|
|
253
|
+
"matTooltipPosition",
|
|
254
|
+
"matTooltipPositionAtOrigin",
|
|
255
|
+
"matTooltipDisabled",
|
|
256
|
+
"matTooltipShowDelay",
|
|
257
|
+
"matTooltipHideDelay",
|
|
258
|
+
"matTooltipTouchGestures",
|
|
259
|
+
"matTooltip",
|
|
260
|
+
"matTooltipClass"
|
|
261
|
+
],
|
|
262
|
+
exportAs: ["matTooltip"]
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
kind: "component",
|
|
266
|
+
type: MatProgressSpinner,
|
|
267
|
+
selector: "mat-progress-spinner, mat-spinner",
|
|
268
|
+
inputs: [
|
|
269
|
+
"color",
|
|
270
|
+
"mode",
|
|
271
|
+
"value",
|
|
272
|
+
"diameter",
|
|
273
|
+
"strokeWidth"
|
|
274
|
+
],
|
|
275
|
+
exportAs: ["matProgressSpinner"]
|
|
276
|
+
}
|
|
277
|
+
],
|
|
278
|
+
changeDetection: i0.ChangeDetectionStrategy.Eager
|
|
279
|
+
});
|
|
280
|
+
};
|
|
281
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
282
|
+
minVersion: "12.0.0",
|
|
283
|
+
version: "22.3.2",
|
|
284
|
+
ngImport: i0,
|
|
285
|
+
type: VisualizadorImagemComponent,
|
|
286
|
+
decorators: [{
|
|
287
|
+
type: Component,
|
|
288
|
+
args: [{
|
|
289
|
+
selector: "mcl-visualizador-imagem",
|
|
290
|
+
imports: [
|
|
291
|
+
MatIconButton,
|
|
292
|
+
MatIcon,
|
|
293
|
+
MatTooltip,
|
|
294
|
+
MatProgressSpinner
|
|
295
|
+
],
|
|
296
|
+
changeDetection: ChangeDetectionStrategy.Eager,
|
|
297
|
+
template: "<div class=\"barra\" role=\"toolbar\" aria-label=\"Controles da imagem\" [attr.aria-controls]=\"id\">\n <button mat-icon-button type=\"button\" aria-label=\"Diminuir zoom\" matTooltip=\"Diminuir zoom (-)\"\n (click)=\"diminuiZoom()\">\n <mat-icon>zoom_out</mat-icon>\n </button>\n <button mat-icon-button type=\"button\" aria-label=\"Aumentar zoom\" matTooltip=\"Aumentar zoom (+)\"\n (click)=\"aumentaZoom()\">\n <mat-icon>zoom_in</mat-icon>\n </button>\n <button mat-icon-button type=\"button\" aria-label=\"Girar para a esquerda\" matTooltip=\"Girar para a esquerda (Shift+R)\"\n (click)=\"giraAntiHorario()\">\n <mat-icon>rotate_left</mat-icon>\n </button>\n <button mat-icon-button type=\"button\" aria-label=\"Girar para a direita\" matTooltip=\"Girar para a direita (R)\"\n (click)=\"giraHorario()\">\n <mat-icon>rotate_right</mat-icon>\n </button>\n <button mat-icon-button type=\"button\" aria-label=\"Restaurar tamanho e posição\" matTooltip=\"Restaurar (0)\"\n (click)=\"restaura()\">\n <mat-icon>fit_screen</mat-icon>\n </button>\n\n @if (total > 1) {\n <span class=\"espaco\"></span>\n <button mat-icon-button type=\"button\" aria-label=\"Imagem anterior\" matTooltip=\"Imagem anterior (←)\"\n [disabled]=\"indice === 0\" (click)=\"anterior()\">\n <mat-icon>chevron_left</mat-icon>\n </button>\n <span class=\"contador\" aria-live=\"polite\">{{ indice + 1 }} de {{ total }}</span>\n <button mat-icon-button type=\"button\" aria-label=\"Próxima imagem\" matTooltip=\"Próxima imagem (→)\"\n [disabled]=\"indice === total - 1\" (click)=\"proxima()\">\n <mat-icon>chevron_right</mat-icon>\n </button>\n }\n</div>\n\n<div class=\"area\" tabindex=\"0\" role=\"group\" [id]=\"id\"\n [attr.aria-label]=\"descricao\"\n [attr.aria-describedby]=\"id + '-ajuda'\"\n (keydown)=\"aoTeclar($event)\"\n (wheel)=\"aoRolar($event)\">\n @if (atual) {\n <img [src]=\"atual\" [alt]=\"descricao\" draggable=\"false\"\n [style.transform]=\"transformacao\"\n (load)=\"aoCarregar()\" (error)=\"aoFalhar()\"\n (pointerdown)=\"iniciaArrasto($event)\" (pointermove)=\"arrasta($event)\"\n (pointerup)=\"terminaArrasto()\" (pointercancel)=\"terminaArrasto()\"/>\n }\n\n @if (carregando && !erro) {\n <mat-spinner class=\"carregando\" [diameter]=\"40\" aria-label=\"Carregando imagem\"></mat-spinner>\n }\n\n @if (erro) {\n <p class=\"erro\" role=\"alert\">Não foi possível carregar a imagem.</p>\n }\n\n <span class=\"cdk-visually-hidden\" [id]=\"id + '-ajuda'\">\n Atalhos: + e - para zoom, R para girar, 0 para restaurar{{ total > 1 ? ', setas para trocar de imagem' : '' }}.\n </span>\n</div>\n",
|
|
298
|
+
styles: [":host{display:block}.barra{display:flex;align-items:center;flex-wrap:wrap;gap:4px;margin-bottom:8px}.barra .espaco{flex:1 1 auto}.barra .contador{min-width:56px;text-align:center}.area{position:relative;display:flex;align-items:center;justify-content:center;min-width:min(600px,70vw);min-height:300px;height:60vh;overflow:hidden;border-radius:4px;background:#ccc}.area:focus-visible{outline:2px solid currentColor;outline-offset:2px}.area img{display:block;max-width:100%;max-height:100%;cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none;transition:transform .15s}.area img:active{cursor:grabbing;transition:none}.area .carregando{position:absolute}.area .erro{position:absolute;margin:0}\n"]
|
|
299
|
+
}]
|
|
300
|
+
}],
|
|
301
|
+
propDecorators: {
|
|
302
|
+
imagens: [{ type: Input }],
|
|
303
|
+
indice: [{ type: Input }],
|
|
304
|
+
indiceChange: [{ type: Output }]
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
var DialogPreviewArquivoComponent = class DialogPreviewArquivoComponent {
|
|
308
|
+
dadosPreview;
|
|
309
|
+
arquivoService;
|
|
310
|
+
loadingFile = true;
|
|
311
|
+
indiceAtual = 0;
|
|
312
|
+
constructor(dadosPreview, arquivoService) {
|
|
313
|
+
this.dadosPreview = dadosPreview;
|
|
314
|
+
this.arquivoService = arquivoService;
|
|
315
|
+
}
|
|
316
|
+
ngOnInit() {
|
|
317
|
+
if (this.type === "image") {
|
|
318
|
+
this.indiceAtual = this.indiceInicial;
|
|
319
|
+
this.previewCarregado();
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
get src() {
|
|
323
|
+
return this.dadosPreview.src;
|
|
324
|
+
}
|
|
325
|
+
get type() {
|
|
326
|
+
return this.dadosPreview.type;
|
|
327
|
+
}
|
|
328
|
+
get group() {
|
|
329
|
+
return this.dadosPreview.group;
|
|
330
|
+
}
|
|
331
|
+
get imagens() {
|
|
332
|
+
return this.group?.length ? this.group : [this.src];
|
|
333
|
+
}
|
|
334
|
+
get indiceInicial() {
|
|
335
|
+
return Math.max(0, this.imagens.indexOf(this.src));
|
|
336
|
+
}
|
|
337
|
+
previewCarregado(e) {
|
|
338
|
+
this.loadingFile = false;
|
|
339
|
+
}
|
|
340
|
+
download() {
|
|
341
|
+
const src = this.type === "image" ? this.imagens[this.indiceAtual] ?? this.src : this.src;
|
|
342
|
+
if (typeof src === "string") {
|
|
343
|
+
const link = document.createElement("a");
|
|
344
|
+
link.href = src;
|
|
345
|
+
link.target = "_blank";
|
|
346
|
+
document.body.appendChild(link);
|
|
347
|
+
link.click();
|
|
348
|
+
document.body.removeChild(link);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
352
|
+
minVersion: "12.0.0",
|
|
353
|
+
version: "22.3.2",
|
|
354
|
+
ngImport: i0,
|
|
355
|
+
type: DialogPreviewArquivoComponent,
|
|
356
|
+
deps: [{ token: MAT_DIALOG_DATA }, { token: ARQUIVO_MANAGER_SERVICE }],
|
|
357
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
358
|
+
});
|
|
359
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
360
|
+
minVersion: "17.0.0",
|
|
361
|
+
version: "22.3.2",
|
|
362
|
+
type: DialogPreviewArquivoComponent,
|
|
363
|
+
isStandalone: true,
|
|
364
|
+
selector: "mcl-dialog-preview-arquivo",
|
|
365
|
+
ngImport: i0,
|
|
366
|
+
template: "<mat-dialog-content>\r\n @if (loadingFile) {\r\n <div class=\"spinner-wrapper\">\r\n <mat-spinner style=\"margin: 0 auto\" [diameter]=\"50\" color=\"warn\"></mat-spinner>\r\n </div>\r\n }\r\n\r\n @switch (type) {\r\n @case ('image') {\r\n <mcl-visualizador-imagem [imagens]=\"imagens\" [indice]=\"indiceInicial\"\r\n (indiceChange)=\"indiceAtual = $event\"></mcl-visualizador-imagem>\r\n }\r\n @case ('pdf') {\r\n <pdf-viewer [src]=\"src\"\r\n (page-rendered)=\"previewCarregado($event)\"\r\n [original-size]=\"false\"\r\n [render-text]=\"false\"\r\n ></pdf-viewer>\r\n }\r\n }\r\n\r\n</mat-dialog-content>\r\n\r\n<div mat-dialog-actions>\r\n <button mat-button mat-dialog-close>\r\n <mat-icon>close</mat-icon>\r\n Fechar\r\n </button>\r\n\r\n <div class=\"spacer\"></div>\r\n\r\n @if (!loadingFile) {\r\n <button mat-stroked-button (click)=\"download()\">\r\n <mat-icon>cloud_download</mat-icon>\r\n Realizar o Download\r\n </button>\r\n }\r\n</div>\r\n",
|
|
367
|
+
styles: ["pdf-viewer{width:min(800px,80vw);height:70vh;display:block}.spinner-wrapper{margin:30px auto;width:800px;height:400px}.dialog-title-text{margin-right:10px;line-height:38px}[mat-dialog-title]{display:flex;padding:8px 24px 7px}[mat-dialog-title] .spacer{flex:1 1 auto}[mat-dialog-actions]{text-align:right}[mat-dialog-actions] button{margin-left:auto}[mat-dialog-actions] button mat-icon{vertical-align:middle;margin-right:10px}\n"],
|
|
368
|
+
dependencies: [
|
|
369
|
+
{
|
|
370
|
+
kind: "directive",
|
|
371
|
+
type: MatDialogContent,
|
|
372
|
+
selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]"
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
kind: "component",
|
|
376
|
+
type: MatProgressSpinner,
|
|
377
|
+
selector: "mat-progress-spinner, mat-spinner",
|
|
378
|
+
inputs: [
|
|
379
|
+
"color",
|
|
380
|
+
"mode",
|
|
381
|
+
"value",
|
|
382
|
+
"diameter",
|
|
383
|
+
"strokeWidth"
|
|
384
|
+
],
|
|
385
|
+
exportAs: ["matProgressSpinner"]
|
|
386
|
+
},
|
|
387
|
+
{
|
|
388
|
+
kind: "component",
|
|
389
|
+
type: PdfViewerComponent,
|
|
390
|
+
selector: "pdf-viewer",
|
|
391
|
+
inputs: [
|
|
392
|
+
"src",
|
|
393
|
+
"page",
|
|
394
|
+
"c-maps-url",
|
|
395
|
+
"render-text",
|
|
396
|
+
"render-text-mode",
|
|
397
|
+
"original-size",
|
|
398
|
+
"show-all",
|
|
399
|
+
"stick-to-page",
|
|
400
|
+
"zoom-scale",
|
|
401
|
+
"zoom",
|
|
402
|
+
"rotation",
|
|
403
|
+
"external-link-target",
|
|
404
|
+
"autoresize",
|
|
405
|
+
"fit-to-page",
|
|
406
|
+
"show-borders"
|
|
407
|
+
],
|
|
408
|
+
outputs: [
|
|
409
|
+
"after-load-complete",
|
|
410
|
+
"page-rendered",
|
|
411
|
+
"pages-initialized",
|
|
412
|
+
"text-layer-rendered",
|
|
413
|
+
"error",
|
|
414
|
+
"on-progress",
|
|
415
|
+
"pageChange"
|
|
416
|
+
]
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
kind: "directive",
|
|
420
|
+
type: MatDialogActions,
|
|
421
|
+
selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]",
|
|
422
|
+
inputs: ["align"]
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
kind: "component",
|
|
426
|
+
type: MatButton,
|
|
427
|
+
selector: " button[matButton], a[matButton], button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button], a[mat-button], a[mat-raised-button], a[mat-flat-button], a[mat-stroked-button] ",
|
|
428
|
+
inputs: ["matButton"],
|
|
429
|
+
exportAs: ["matButton", "matAnchor"]
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
kind: "directive",
|
|
433
|
+
type: MatDialogClose,
|
|
434
|
+
selector: "[mat-dialog-close], [matDialogClose]",
|
|
435
|
+
inputs: [
|
|
436
|
+
"aria-label",
|
|
437
|
+
"type",
|
|
438
|
+
"mat-dialog-close",
|
|
439
|
+
"matDialogClose"
|
|
440
|
+
],
|
|
441
|
+
exportAs: ["matDialogClose"]
|
|
442
|
+
},
|
|
443
|
+
{
|
|
444
|
+
kind: "component",
|
|
445
|
+
type: MatIcon,
|
|
446
|
+
selector: "mat-icon",
|
|
447
|
+
inputs: [
|
|
448
|
+
"color",
|
|
449
|
+
"inline",
|
|
450
|
+
"svgIcon",
|
|
451
|
+
"fontSet",
|
|
452
|
+
"fontIcon"
|
|
453
|
+
],
|
|
454
|
+
exportAs: ["matIcon"]
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
kind: "component",
|
|
458
|
+
type: VisualizadorImagemComponent,
|
|
459
|
+
selector: "mcl-visualizador-imagem",
|
|
460
|
+
inputs: ["imagens", "indice"],
|
|
461
|
+
outputs: ["indiceChange"]
|
|
462
|
+
}
|
|
463
|
+
],
|
|
464
|
+
changeDetection: i0.ChangeDetectionStrategy.Eager
|
|
465
|
+
});
|
|
466
|
+
};
|
|
467
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
468
|
+
minVersion: "12.0.0",
|
|
469
|
+
version: "22.3.2",
|
|
470
|
+
ngImport: i0,
|
|
471
|
+
type: DialogPreviewArquivoComponent,
|
|
472
|
+
decorators: [{
|
|
473
|
+
type: Component,
|
|
474
|
+
args: [{
|
|
475
|
+
selector: "mcl-dialog-preview-arquivo",
|
|
476
|
+
imports: [
|
|
477
|
+
MatDialogContent,
|
|
478
|
+
MatProgressSpinner,
|
|
479
|
+
PdfViewerComponent,
|
|
480
|
+
MatDialogActions,
|
|
481
|
+
MatButton,
|
|
482
|
+
MatDialogClose,
|
|
483
|
+
MatIcon,
|
|
484
|
+
VisualizadorImagemComponent
|
|
485
|
+
],
|
|
486
|
+
changeDetection: ChangeDetectionStrategy.Eager,
|
|
487
|
+
template: "<mat-dialog-content>\r\n @if (loadingFile) {\r\n <div class=\"spinner-wrapper\">\r\n <mat-spinner style=\"margin: 0 auto\" [diameter]=\"50\" color=\"warn\"></mat-spinner>\r\n </div>\r\n }\r\n\r\n @switch (type) {\r\n @case ('image') {\r\n <mcl-visualizador-imagem [imagens]=\"imagens\" [indice]=\"indiceInicial\"\r\n (indiceChange)=\"indiceAtual = $event\"></mcl-visualizador-imagem>\r\n }\r\n @case ('pdf') {\r\n <pdf-viewer [src]=\"src\"\r\n (page-rendered)=\"previewCarregado($event)\"\r\n [original-size]=\"false\"\r\n [render-text]=\"false\"\r\n ></pdf-viewer>\r\n }\r\n }\r\n\r\n</mat-dialog-content>\r\n\r\n<div mat-dialog-actions>\r\n <button mat-button mat-dialog-close>\r\n <mat-icon>close</mat-icon>\r\n Fechar\r\n </button>\r\n\r\n <div class=\"spacer\"></div>\r\n\r\n @if (!loadingFile) {\r\n <button mat-stroked-button (click)=\"download()\">\r\n <mat-icon>cloud_download</mat-icon>\r\n Realizar o Download\r\n </button>\r\n }\r\n</div>\r\n",
|
|
488
|
+
styles: ["pdf-viewer{width:min(800px,80vw);height:70vh;display:block}.spinner-wrapper{margin:30px auto;width:800px;height:400px}.dialog-title-text{margin-right:10px;line-height:38px}[mat-dialog-title]{display:flex;padding:8px 24px 7px}[mat-dialog-title] .spacer{flex:1 1 auto}[mat-dialog-actions]{text-align:right}[mat-dialog-actions] button{margin-left:auto}[mat-dialog-actions] button mat-icon{vertical-align:middle;margin-right:10px}\n"]
|
|
489
|
+
}]
|
|
490
|
+
}],
|
|
491
|
+
ctorParameters: () => [{
|
|
492
|
+
type: void 0,
|
|
493
|
+
decorators: [{
|
|
494
|
+
type: Inject,
|
|
495
|
+
args: [MAT_DIALOG_DATA]
|
|
496
|
+
}]
|
|
497
|
+
}, {
|
|
498
|
+
type: void 0,
|
|
499
|
+
decorators: [{
|
|
500
|
+
type: Inject,
|
|
501
|
+
args: [ARQUIVO_MANAGER_SERVICE]
|
|
502
|
+
}]
|
|
503
|
+
}]
|
|
504
|
+
});
|
|
505
|
+
var PreviewArquivoComponent = class PreviewArquivoComponent {
|
|
506
|
+
arquivoManagerService;
|
|
507
|
+
dialog;
|
|
508
|
+
src;
|
|
509
|
+
filename;
|
|
510
|
+
type;
|
|
511
|
+
showLoading = false;
|
|
512
|
+
height = "200px";
|
|
513
|
+
width = "200px";
|
|
514
|
+
group;
|
|
515
|
+
$arquivo;
|
|
516
|
+
$url;
|
|
517
|
+
constructor(arquivoManagerService, dialog) {
|
|
518
|
+
this.arquivoManagerService = arquivoManagerService;
|
|
519
|
+
this.dialog = dialog;
|
|
520
|
+
}
|
|
521
|
+
ngOnInit() {}
|
|
522
|
+
get arquivo() {
|
|
523
|
+
return this.$url;
|
|
524
|
+
}
|
|
525
|
+
set arquivo(arquivo) {
|
|
526
|
+
if (this.$arquivo !== arquivo) {
|
|
527
|
+
this.$arquivo = arquivo;
|
|
528
|
+
this.parseArquivo(arquivo).subscribe((arq) => {
|
|
529
|
+
this.src = arq.src;
|
|
530
|
+
this.filename = arq.filename;
|
|
531
|
+
this.$url = arq.url;
|
|
532
|
+
this.type = arq.type;
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
parseArquivo(arquivo) {
|
|
537
|
+
return new Observable((observer) => {
|
|
538
|
+
if (arquivo.loading) {
|
|
539
|
+
const type = this.parseType(arquivo.file.name);
|
|
540
|
+
observer.next({
|
|
541
|
+
type,
|
|
542
|
+
filename: arquivo.file.name
|
|
543
|
+
});
|
|
544
|
+
this.carregaArrayBuffFile(arquivo.file).then((src) => {
|
|
545
|
+
observer.next({
|
|
546
|
+
src,
|
|
547
|
+
type,
|
|
548
|
+
filename: arquivo.file.name
|
|
549
|
+
});
|
|
550
|
+
observer.complete();
|
|
551
|
+
}).catch((err) => observer.error(err));
|
|
552
|
+
} else if (typeof arquivo === "string") {
|
|
553
|
+
const type = this.parseType(arquivo.split("?")[0]);
|
|
554
|
+
observer.next({
|
|
555
|
+
type,
|
|
556
|
+
url: arquivo,
|
|
557
|
+
src: arquivo
|
|
558
|
+
});
|
|
559
|
+
observer.complete();
|
|
560
|
+
} else {
|
|
561
|
+
const fileName = this.arquivoManagerService.fileName ? this.arquivoManagerService.fileName(arquivo) : arquivo.nome || arquivo.name || arquivo.filename;
|
|
562
|
+
const type = this.parseType(fileName);
|
|
563
|
+
this.arquivoManagerService.downloadURL(arquivo).subscribe((url) => {
|
|
564
|
+
observer.next({
|
|
565
|
+
type,
|
|
566
|
+
url,
|
|
567
|
+
src: url
|
|
568
|
+
});
|
|
569
|
+
observer.complete();
|
|
570
|
+
}, (err) => observer.error(err));
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
carregaArrayBuffFile(file) {
|
|
575
|
+
return new Promise(((resolve, reject) => {
|
|
576
|
+
if (typeof FileReader !== "undefined") {
|
|
577
|
+
const reader = new FileReader();
|
|
578
|
+
reader.onload = (e) => resolve(e.target.result);
|
|
579
|
+
reader.onerror = (e) => reject(e);
|
|
580
|
+
reader.readAsArrayBuffer(file);
|
|
581
|
+
} else reject("FileReader not defined");
|
|
582
|
+
}));
|
|
583
|
+
}
|
|
584
|
+
parseType(filename) {
|
|
585
|
+
switch (filename.substring(filename.lastIndexOf(".") + 1).toLowerCase()) {
|
|
586
|
+
case "jpeg":
|
|
587
|
+
case "jpg":
|
|
588
|
+
case "png":
|
|
589
|
+
case "gif": return "image";
|
|
590
|
+
case "pdf": return "pdf";
|
|
591
|
+
}
|
|
592
|
+
return "other";
|
|
593
|
+
}
|
|
594
|
+
async abrePreview() {
|
|
595
|
+
let group;
|
|
596
|
+
let src = this.src;
|
|
597
|
+
if (this.group) {
|
|
598
|
+
group = await Promise.all(this.group.map((arq) => this.parseArquivo(arq).toPromise()));
|
|
599
|
+
src = group[this.group.indexOf(this.$arquivo)].src;
|
|
600
|
+
group = group.filter((g) => !!g?.src && g?.type === this.type).map((g) => g?.src);
|
|
601
|
+
}
|
|
602
|
+
this.dialog.open(DialogPreviewArquivoComponent, { data: {
|
|
603
|
+
src,
|
|
604
|
+
group,
|
|
605
|
+
type: this.type
|
|
606
|
+
} });
|
|
607
|
+
}
|
|
608
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
609
|
+
minVersion: "12.0.0",
|
|
610
|
+
version: "22.3.2",
|
|
611
|
+
ngImport: i0,
|
|
612
|
+
type: PreviewArquivoComponent,
|
|
613
|
+
deps: [{ token: ARQUIVO_MANAGER_SERVICE }, { token: MatDialog }],
|
|
614
|
+
target: i0.ɵɵFactoryTarget.Component
|
|
615
|
+
});
|
|
616
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({
|
|
617
|
+
minVersion: "17.0.0",
|
|
618
|
+
version: "22.3.2",
|
|
619
|
+
type: PreviewArquivoComponent,
|
|
620
|
+
isStandalone: true,
|
|
621
|
+
selector: "mcl-preview-arquivo",
|
|
622
|
+
inputs: {
|
|
623
|
+
showLoading: "showLoading",
|
|
624
|
+
height: "height",
|
|
625
|
+
width: "width",
|
|
626
|
+
group: "group",
|
|
627
|
+
arquivo: "arquivo"
|
|
628
|
+
},
|
|
629
|
+
ngImport: i0,
|
|
630
|
+
template: "@if (!!src) {\r\n @switch (type) {\r\n @case ('image') {\r\n <img [src]=\"src\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n (click)=\"abrePreview()\"/>\r\n }\r\n @case ('other') {\r\n <div class=\"other\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n [mclDownloadArquivo]=\"arquivo\">\r\n <mat-icon>insert_drive_file</mat-icon>\r\n <small>{{ filename }}</small>\r\n </div>\r\n }\r\n @case ('pdf') {\r\n <pdf-viewer [src]=\"src\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n [original-size]=\"false\"\r\n [page]=\"1\"\r\n [render-text]=\"false\"\r\n (click)=\"abrePreview()\"\r\n ></pdf-viewer>\r\n }\r\n }\r\n}\r\n",
|
|
631
|
+
styles: ["pdf-viewer,img,.other{overflow:hidden;display:block;border-radius:5px;background:#efefef;border:1px solid #a9a9a9}pdf-viewer.other,img.other,.other.other{display:flex;flex-direction:column;justify-items:center}pdf-viewer.other mat-icon,img.other mat-icon,.other.other mat-icon{margin:auto;text-align:center;font-size:75px;height:75px;width:75px;line-height:75px}pdf-viewer:hover,img:hover,.other:hover{cursor:pointer}\n"],
|
|
632
|
+
dependencies: [
|
|
633
|
+
{
|
|
634
|
+
kind: "directive",
|
|
635
|
+
type: NgStyle,
|
|
636
|
+
selector: "[ngStyle]",
|
|
637
|
+
inputs: ["ngStyle"]
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
kind: "directive",
|
|
641
|
+
type: DownloadArquivoDirective,
|
|
642
|
+
selector: "[mclDownloadArquivo]",
|
|
643
|
+
inputs: ["mclDownloadArquivo", "target"]
|
|
644
|
+
},
|
|
645
|
+
{
|
|
646
|
+
kind: "component",
|
|
647
|
+
type: MatIcon,
|
|
648
|
+
selector: "mat-icon",
|
|
649
|
+
inputs: [
|
|
650
|
+
"color",
|
|
651
|
+
"inline",
|
|
652
|
+
"svgIcon",
|
|
653
|
+
"fontSet",
|
|
654
|
+
"fontIcon"
|
|
655
|
+
],
|
|
656
|
+
exportAs: ["matIcon"]
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
kind: "component",
|
|
660
|
+
type: PdfViewerComponent,
|
|
661
|
+
selector: "pdf-viewer",
|
|
662
|
+
inputs: [
|
|
663
|
+
"src",
|
|
664
|
+
"page",
|
|
665
|
+
"c-maps-url",
|
|
666
|
+
"render-text",
|
|
667
|
+
"render-text-mode",
|
|
668
|
+
"original-size",
|
|
669
|
+
"show-all",
|
|
670
|
+
"stick-to-page",
|
|
671
|
+
"zoom-scale",
|
|
672
|
+
"zoom",
|
|
673
|
+
"rotation",
|
|
674
|
+
"external-link-target",
|
|
675
|
+
"autoresize",
|
|
676
|
+
"fit-to-page",
|
|
677
|
+
"show-borders"
|
|
678
|
+
],
|
|
679
|
+
outputs: [
|
|
680
|
+
"after-load-complete",
|
|
681
|
+
"page-rendered",
|
|
682
|
+
"pages-initialized",
|
|
683
|
+
"text-layer-rendered",
|
|
684
|
+
"error",
|
|
685
|
+
"on-progress",
|
|
686
|
+
"pageChange"
|
|
687
|
+
]
|
|
688
|
+
}
|
|
689
|
+
],
|
|
690
|
+
changeDetection: i0.ChangeDetectionStrategy.Eager
|
|
691
|
+
});
|
|
692
|
+
};
|
|
693
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
694
|
+
minVersion: "12.0.0",
|
|
695
|
+
version: "22.3.2",
|
|
696
|
+
ngImport: i0,
|
|
697
|
+
type: PreviewArquivoComponent,
|
|
698
|
+
decorators: [{
|
|
699
|
+
type: Component,
|
|
700
|
+
args: [{
|
|
701
|
+
selector: "mcl-preview-arquivo",
|
|
702
|
+
imports: [
|
|
703
|
+
NgStyle,
|
|
704
|
+
DownloadArquivoDirective,
|
|
705
|
+
MatIcon,
|
|
706
|
+
PdfViewerComponent
|
|
707
|
+
],
|
|
708
|
+
changeDetection: ChangeDetectionStrategy.Eager,
|
|
709
|
+
template: "@if (!!src) {\r\n @switch (type) {\r\n @case ('image') {\r\n <img [src]=\"src\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n (click)=\"abrePreview()\"/>\r\n }\r\n @case ('other') {\r\n <div class=\"other\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n [mclDownloadArquivo]=\"arquivo\">\r\n <mat-icon>insert_drive_file</mat-icon>\r\n <small>{{ filename }}</small>\r\n </div>\r\n }\r\n @case ('pdf') {\r\n <pdf-viewer [src]=\"src\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n [original-size]=\"false\"\r\n [page]=\"1\"\r\n [render-text]=\"false\"\r\n (click)=\"abrePreview()\"\r\n ></pdf-viewer>\r\n }\r\n }\r\n}\r\n",
|
|
710
|
+
styles: ["pdf-viewer,img,.other{overflow:hidden;display:block;border-radius:5px;background:#efefef;border:1px solid #a9a9a9}pdf-viewer.other,img.other,.other.other{display:flex;flex-direction:column;justify-items:center}pdf-viewer.other mat-icon,img.other mat-icon,.other.other mat-icon{margin:auto;text-align:center;font-size:75px;height:75px;width:75px;line-height:75px}pdf-viewer:hover,img:hover,.other:hover{cursor:pointer}\n"]
|
|
711
|
+
}]
|
|
712
|
+
}],
|
|
713
|
+
ctorParameters: () => [{
|
|
714
|
+
type: void 0,
|
|
715
|
+
decorators: [{
|
|
716
|
+
type: Inject,
|
|
717
|
+
args: [ARQUIVO_MANAGER_SERVICE]
|
|
718
|
+
}]
|
|
719
|
+
}, { type: MatDialog }],
|
|
720
|
+
propDecorators: {
|
|
721
|
+
showLoading: [{ type: Input }],
|
|
722
|
+
height: [{ type: Input }],
|
|
723
|
+
width: [{ type: Input }],
|
|
724
|
+
group: [{ type: Input }],
|
|
725
|
+
arquivo: [{ type: Input }]
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
const MCL_IMAGE_PADRAO = new InjectionToken("mainclass.MCL_IMAGE_PADRAO");
|
|
729
|
+
var ImagemDirective = class ImagemDirective {
|
|
730
|
+
_padrao;
|
|
731
|
+
element;
|
|
732
|
+
arquivoManagerService;
|
|
733
|
+
attachment;
|
|
734
|
+
_setter;
|
|
735
|
+
backgroundSetter = (url) => {
|
|
736
|
+
this.element.nativeElement.style.backgroundImage = `url(${url})`;
|
|
737
|
+
};
|
|
738
|
+
srcSetter = (url) => {
|
|
739
|
+
this.element.nativeElement.src = url;
|
|
740
|
+
};
|
|
741
|
+
constructor(_padrao, element, arquivoManagerService) {
|
|
742
|
+
this._padrao = _padrao;
|
|
743
|
+
this.element = element;
|
|
744
|
+
this.arquivoManagerService = arquivoManagerService;
|
|
745
|
+
}
|
|
746
|
+
set imagemSrc(imagem) {
|
|
747
|
+
this._setter = this.srcSetter;
|
|
748
|
+
if (imagem) {
|
|
749
|
+
if (this.attachment !== imagem) {
|
|
750
|
+
this.attachment = imagem;
|
|
751
|
+
this.setPath();
|
|
752
|
+
}
|
|
753
|
+
} else this._setter(this._padrao);
|
|
754
|
+
}
|
|
755
|
+
set imagemBackground(imagem) {
|
|
756
|
+
this._setter = this.backgroundSetter;
|
|
757
|
+
if (imagem) {
|
|
758
|
+
if (this.attachment !== imagem) {
|
|
759
|
+
this.attachment = imagem;
|
|
760
|
+
this.setPath();
|
|
761
|
+
}
|
|
762
|
+
} else this._setter(this._padrao);
|
|
763
|
+
}
|
|
764
|
+
set padrao(padrao) {
|
|
765
|
+
this._padrao = padrao;
|
|
766
|
+
if (this._setter) this._setter(this.padrao);
|
|
767
|
+
}
|
|
768
|
+
async setPath() {
|
|
769
|
+
if (!!this._setter && !!this.attachment) {
|
|
770
|
+
let url;
|
|
771
|
+
if (typeof this.attachment === "string" && (this.attachment.startsWith("http://") || this.attachment.startsWith("https://") || this.attachment.match(/^\.?\/?.+(\/.+)*\.(jpeg|png|jpg|gif)$/))) url = this.attachment;
|
|
772
|
+
else url = await lastValueFrom(this.arquivoManagerService.downloadURL(this.attachment));
|
|
773
|
+
this._setter(url);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
ngOnInit() {}
|
|
777
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
778
|
+
minVersion: "12.0.0",
|
|
779
|
+
version: "22.3.2",
|
|
780
|
+
ngImport: i0,
|
|
781
|
+
type: ImagemDirective,
|
|
782
|
+
deps: [
|
|
783
|
+
{
|
|
784
|
+
token: MCL_IMAGE_PADRAO,
|
|
785
|
+
optional: true
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
token: ElementRef,
|
|
789
|
+
self: true
|
|
790
|
+
},
|
|
791
|
+
{ token: ARQUIVO_MANAGER_SERVICE }
|
|
792
|
+
],
|
|
793
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
794
|
+
});
|
|
795
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
796
|
+
minVersion: "14.0.0",
|
|
797
|
+
version: "22.3.2",
|
|
798
|
+
type: ImagemDirective,
|
|
799
|
+
isStandalone: true,
|
|
800
|
+
selector: "[mclImagemSrc],[mclImagemBackground]",
|
|
801
|
+
inputs: {
|
|
802
|
+
imagemSrc: ["mclImagemSrc", "imagemSrc"],
|
|
803
|
+
imagemBackground: ["mclImagemBackground", "imagemBackground"],
|
|
804
|
+
padrao: "padrao"
|
|
805
|
+
},
|
|
806
|
+
ngImport: i0
|
|
807
|
+
});
|
|
808
|
+
};
|
|
809
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
810
|
+
minVersion: "12.0.0",
|
|
811
|
+
version: "22.3.2",
|
|
812
|
+
ngImport: i0,
|
|
813
|
+
type: ImagemDirective,
|
|
814
|
+
decorators: [{
|
|
815
|
+
type: Directive,
|
|
816
|
+
args: [{ selector: "[mclImagemSrc],[mclImagemBackground]" }]
|
|
817
|
+
}],
|
|
818
|
+
ctorParameters: () => [
|
|
819
|
+
{
|
|
820
|
+
type: void 0,
|
|
821
|
+
decorators: [{
|
|
822
|
+
type: Inject,
|
|
823
|
+
args: [MCL_IMAGE_PADRAO]
|
|
824
|
+
}, { type: Optional }]
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
type: ElementRef,
|
|
828
|
+
decorators: [{ type: Self }]
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
type: void 0,
|
|
832
|
+
decorators: [{
|
|
833
|
+
type: Inject,
|
|
834
|
+
args: [ARQUIVO_MANAGER_SERVICE]
|
|
835
|
+
}]
|
|
836
|
+
}
|
|
837
|
+
],
|
|
838
|
+
propDecorators: {
|
|
839
|
+
imagemSrc: [{
|
|
840
|
+
type: Input,
|
|
841
|
+
args: ["mclImagemSrc"]
|
|
842
|
+
}],
|
|
843
|
+
imagemBackground: [{
|
|
844
|
+
type: Input,
|
|
845
|
+
args: ["mclImagemBackground"]
|
|
846
|
+
}],
|
|
847
|
+
padrao: [{ type: Input }]
|
|
848
|
+
}
|
|
849
|
+
});
|
|
850
|
+
export { ARQUIVO_MANAGER_SERVICE, DialogPreviewArquivoComponent, DownloadArquivoDirective, ImagemDirective, MCL_IMAGE_PADRAO, PreviewArquivoComponent, VisualizadorImagemComponent };
|
|
14
851
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class DownloadArquivoDirective {
|
|
18
|
-
arquivoService;
|
|
19
|
-
attachment;
|
|
20
|
-
target = '_blank';
|
|
21
|
-
constructor(arquivoService) {
|
|
22
|
-
this.arquivoService = arquivoService;
|
|
23
|
-
}
|
|
24
|
-
async getUrlArquivo() {
|
|
25
|
-
if (typeof this.attachment === 'string') {
|
|
26
|
-
return this.attachment;
|
|
27
|
-
}
|
|
28
|
-
return await this.arquivoService.downloadURL(this.attachment).toPromise();
|
|
29
|
-
}
|
|
30
|
-
async download() {
|
|
31
|
-
if (!this.attachment) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
const link = document.createElement('a');
|
|
35
|
-
const url = await this.getUrlArquivo();
|
|
36
|
-
if (!!url) {
|
|
37
|
-
link.href = url;
|
|
38
|
-
link.target = this.target;
|
|
39
|
-
document.body.appendChild(link);
|
|
40
|
-
link.click();
|
|
41
|
-
document.body.removeChild(link);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: DownloadArquivoDirective, deps: [{ token: ARQUIVO_MANAGER_SERVICE }], target: i0.ɵɵFactoryTarget.Directive });
|
|
45
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.9", type: DownloadArquivoDirective, isStandalone: true, selector: "[mclDownloadArquivo]", inputs: { attachment: ["mclDownloadArquivo", "attachment"], target: "target" }, host: { listeners: { "click": "download()" } }, ngImport: i0 });
|
|
46
|
-
}
|
|
47
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: DownloadArquivoDirective, decorators: [{
|
|
48
|
-
type: Directive,
|
|
49
|
-
args: [{
|
|
50
|
-
selector: '[mclDownloadArquivo]'
|
|
51
|
-
}]
|
|
52
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
53
|
-
type: Inject,
|
|
54
|
-
args: [ARQUIVO_MANAGER_SERVICE]
|
|
55
|
-
}] }], propDecorators: { attachment: [{
|
|
56
|
-
type: Input,
|
|
57
|
-
args: ['mclDownloadArquivo']
|
|
58
|
-
}], target: [{
|
|
59
|
-
type: Input
|
|
60
|
-
}], download: [{
|
|
61
|
-
type: HostListener,
|
|
62
|
-
args: ['click']
|
|
63
|
-
}] } });
|
|
64
|
-
|
|
65
|
-
class DialogPreviewArquivoComponent {
|
|
66
|
-
dadosPreview;
|
|
67
|
-
arquivoService;
|
|
68
|
-
loadingFile = true;
|
|
69
|
-
constructor(dadosPreview, arquivoService) {
|
|
70
|
-
this.dadosPreview = dadosPreview;
|
|
71
|
-
this.arquivoService = arquivoService;
|
|
72
|
-
}
|
|
73
|
-
ngOnInit() {
|
|
74
|
-
if (this.type === 'image') {
|
|
75
|
-
this.previewCarregado();
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
get src() {
|
|
79
|
-
return this.dadosPreview.src;
|
|
80
|
-
}
|
|
81
|
-
get type() {
|
|
82
|
-
return this.dadosPreview.type;
|
|
83
|
-
}
|
|
84
|
-
get group() {
|
|
85
|
-
return this.dadosPreview.group;
|
|
86
|
-
}
|
|
87
|
-
handleEvent(evento) {
|
|
88
|
-
if (evento.name === 'download') {
|
|
89
|
-
this.download();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
previewCarregado(e) {
|
|
93
|
-
this.loadingFile = false;
|
|
94
|
-
}
|
|
95
|
-
download() {
|
|
96
|
-
if (typeof this.src === 'string') {
|
|
97
|
-
const link = document.createElement('a');
|
|
98
|
-
link.href = this.src;
|
|
99
|
-
link.target = '_blank';
|
|
100
|
-
document.body.appendChild(link);
|
|
101
|
-
link.click();
|
|
102
|
-
document.body.removeChild(link);
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: DialogPreviewArquivoComponent, deps: [{ token: MAT_DIALOG_DATA }, { token: ARQUIVO_MANAGER_SERVICE }], target: i0.ɵɵFactoryTarget.Component });
|
|
108
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.9", type: DialogPreviewArquivoComponent, isStandalone: true, selector: "mcl-dialog-preview-arquivo", ngImport: i0, template: "<mat-dialog-content>\r\n @if (loadingFile) {\r\n <div class=\"spinner-wrapper\">\r\n <mat-spinner style=\"margin: 0 auto\" [diameter]=\"50\" color=\"warn\"></mat-spinner>\r\n </div>\r\n }\r\n\r\n @switch (type) {\r\n @case ('image') {\r\n @if (group) {\r\n <ngx-image-viewer [src]=\"group\" [index]=\"group.indexOf(src)\"\r\n [config]=\"{customBtns:[{name: 'download', icon: 'fa fa-download'}]}\"\r\n (customEvent)=\"handleEvent($event)\"></ngx-image-viewer>\r\n } @else {\r\n <ngx-image-viewer [src]=\"[src]\" [index]=\"0\"\r\n [config]=\"{customBtns:[{name: 'download', icon: 'fa fa-download'}]}\"\r\n (customEvent)=\"handleEvent($event)\"></ngx-image-viewer>\r\n }\r\n }\r\n @case ('pdf') {\r\n <pdf-viewer [src]=\"src\"\r\n (page-rendered)=\"previewCarregado($event)\"\r\n [original-size]=\"false\"\r\n [render-text]=\"false\"\r\n ></pdf-viewer>\r\n }\r\n }\r\n\r\n</mat-dialog-content>\r\n\r\n<div mat-dialog-actions>\r\n <button mat-button mat-dialog-close>\r\n <mat-icon>close</mat-icon>\r\n Fechar\r\n </button>\r\n\r\n <div class=\"spacer\"></div>\r\n\r\n @if (!loadingFile) {\r\n <button mat-stroked-button (click)=\"download()\">\r\n <mat-icon>cloud_download</mat-icon>\r\n Realizar o Download\r\n </button>\r\n }\r\n</div>\r\n", styles: ["pdf-viewer{width:100%;display:block}.spinner-wrapper{margin:30px auto;width:800px;height:400px}.dialog-title-text{margin-right:10px;line-height:38px}[mat-dialog-title]{display:flex;padding:8px 24px 7px}[mat-dialog-title] .spacer{flex:1 1 auto}[mat-dialog-actions]{text-align:right}[mat-dialog-actions] button{margin-left:auto}[mat-dialog-actions] button mat-icon{vertical-align:middle;margin-right:10px}\n"], dependencies: [{ kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "component", type: MatProgressSpinner, selector: "mat-progress-spinner, mat-spinner", inputs: ["color", "mode", "value", "diameter", "strokeWidth"], exportAs: ["matProgressSpinner"] }, { kind: "ngmodule", type: PdfViewerModule }, { kind: "component", type: i1.PdfViewerComponent, selector: "pdf-viewer", inputs: ["src", "c-maps-url", "page", "render-text", "render-text-mode", "original-size", "show-all", "stick-to-page", "zoom", "zoom-scale", "rotation", "external-link-target", "autoresize", "fit-to-page", "show-borders"], outputs: ["after-load-complete", "page-rendered", "pages-initialized", "text-layer-rendered", "error", "on-progress", "pageChange"] }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: ImageViewerModule }, { kind: "component", type: i2.ImageViewerComponent, selector: "ngx-image-viewer", inputs: ["src", "index", "config"], outputs: ["indexChange", "configChange", "customEvent"] }] });
|
|
109
|
-
}
|
|
110
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: DialogPreviewArquivoComponent, decorators: [{
|
|
111
|
-
type: Component,
|
|
112
|
-
args: [{ selector: 'mcl-dialog-preview-arquivo', imports: [
|
|
113
|
-
MatDialogContent,
|
|
114
|
-
MatProgressSpinner,
|
|
115
|
-
PdfViewerModule,
|
|
116
|
-
MatDialogActions,
|
|
117
|
-
MatButton,
|
|
118
|
-
MatDialogClose,
|
|
119
|
-
MatIcon,
|
|
120
|
-
ImageViewerModule,
|
|
121
|
-
], template: "<mat-dialog-content>\r\n @if (loadingFile) {\r\n <div class=\"spinner-wrapper\">\r\n <mat-spinner style=\"margin: 0 auto\" [diameter]=\"50\" color=\"warn\"></mat-spinner>\r\n </div>\r\n }\r\n\r\n @switch (type) {\r\n @case ('image') {\r\n @if (group) {\r\n <ngx-image-viewer [src]=\"group\" [index]=\"group.indexOf(src)\"\r\n [config]=\"{customBtns:[{name: 'download', icon: 'fa fa-download'}]}\"\r\n (customEvent)=\"handleEvent($event)\"></ngx-image-viewer>\r\n } @else {\r\n <ngx-image-viewer [src]=\"[src]\" [index]=\"0\"\r\n [config]=\"{customBtns:[{name: 'download', icon: 'fa fa-download'}]}\"\r\n (customEvent)=\"handleEvent($event)\"></ngx-image-viewer>\r\n }\r\n }\r\n @case ('pdf') {\r\n <pdf-viewer [src]=\"src\"\r\n (page-rendered)=\"previewCarregado($event)\"\r\n [original-size]=\"false\"\r\n [render-text]=\"false\"\r\n ></pdf-viewer>\r\n }\r\n }\r\n\r\n</mat-dialog-content>\r\n\r\n<div mat-dialog-actions>\r\n <button mat-button mat-dialog-close>\r\n <mat-icon>close</mat-icon>\r\n Fechar\r\n </button>\r\n\r\n <div class=\"spacer\"></div>\r\n\r\n @if (!loadingFile) {\r\n <button mat-stroked-button (click)=\"download()\">\r\n <mat-icon>cloud_download</mat-icon>\r\n Realizar o Download\r\n </button>\r\n }\r\n</div>\r\n", styles: ["pdf-viewer{width:100%;display:block}.spinner-wrapper{margin:30px auto;width:800px;height:400px}.dialog-title-text{margin-right:10px;line-height:38px}[mat-dialog-title]{display:flex;padding:8px 24px 7px}[mat-dialog-title] .spacer{flex:1 1 auto}[mat-dialog-actions]{text-align:right}[mat-dialog-actions] button{margin-left:auto}[mat-dialog-actions] button mat-icon{vertical-align:middle;margin-right:10px}\n"] }]
|
|
122
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
123
|
-
type: Inject,
|
|
124
|
-
args: [MAT_DIALOG_DATA]
|
|
125
|
-
}] }, { type: undefined, decorators: [{
|
|
126
|
-
type: Inject,
|
|
127
|
-
args: [ARQUIVO_MANAGER_SERVICE]
|
|
128
|
-
}] }] });
|
|
129
|
-
|
|
130
|
-
class PreviewArquivoComponent {
|
|
131
|
-
arquivoManagerService;
|
|
132
|
-
dialog;
|
|
133
|
-
src;
|
|
134
|
-
filename;
|
|
135
|
-
type;
|
|
136
|
-
showLoading = false;
|
|
137
|
-
height = '200px';
|
|
138
|
-
width = '200px';
|
|
139
|
-
group;
|
|
140
|
-
$arquivo;
|
|
141
|
-
$url;
|
|
142
|
-
constructor(arquivoManagerService, dialog) {
|
|
143
|
-
this.arquivoManagerService = arquivoManagerService;
|
|
144
|
-
this.dialog = dialog;
|
|
145
|
-
}
|
|
146
|
-
ngOnInit() {
|
|
147
|
-
}
|
|
148
|
-
get arquivo() {
|
|
149
|
-
return this.$url;
|
|
150
|
-
}
|
|
151
|
-
set arquivo(arquivo) {
|
|
152
|
-
if (this.$arquivo !== arquivo) {
|
|
153
|
-
this.$arquivo = arquivo;
|
|
154
|
-
this.parseArquivo(arquivo)
|
|
155
|
-
.subscribe(arq => {
|
|
156
|
-
this.src = arq.src;
|
|
157
|
-
this.filename = arq.filename;
|
|
158
|
-
this.$url = arq.url;
|
|
159
|
-
this.type = arq.type;
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
parseArquivo(arquivo) {
|
|
164
|
-
return new Observable(observer => {
|
|
165
|
-
if (arquivo.loading) { // uploading
|
|
166
|
-
const type = this.parseType(arquivo.file.name);
|
|
167
|
-
observer.next({
|
|
168
|
-
type,
|
|
169
|
-
filename: arquivo.file.name,
|
|
170
|
-
});
|
|
171
|
-
this.carregaArrayBuffFile(arquivo.file)
|
|
172
|
-
.then(src => {
|
|
173
|
-
observer.next({
|
|
174
|
-
src,
|
|
175
|
-
type,
|
|
176
|
-
filename: arquivo.file.name,
|
|
177
|
-
});
|
|
178
|
-
observer.complete();
|
|
179
|
-
})
|
|
180
|
-
.catch(err => observer.error(err));
|
|
181
|
-
}
|
|
182
|
-
else if (typeof arquivo === 'string') { // puploading
|
|
183
|
-
const type = this.parseType(arquivo.split('?')[0]);
|
|
184
|
-
observer.next({
|
|
185
|
-
type,
|
|
186
|
-
url: arquivo,
|
|
187
|
-
src: arquivo,
|
|
188
|
-
});
|
|
189
|
-
observer.complete();
|
|
190
|
-
}
|
|
191
|
-
else { // attachment
|
|
192
|
-
const fileName = this.arquivoManagerService.fileName ?
|
|
193
|
-
this.arquivoManagerService.fileName(arquivo) :
|
|
194
|
-
arquivo.nome || arquivo.name || arquivo.filename;
|
|
195
|
-
const type = this.parseType(fileName);
|
|
196
|
-
this.arquivoManagerService.downloadURL(arquivo).subscribe(url => {
|
|
197
|
-
observer.next({
|
|
198
|
-
type,
|
|
199
|
-
url,
|
|
200
|
-
src: url,
|
|
201
|
-
});
|
|
202
|
-
observer.complete();
|
|
203
|
-
}, err => observer.error(err));
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
carregaArrayBuffFile(file) {
|
|
208
|
-
return new Promise(((resolve, reject) => {
|
|
209
|
-
if (typeof (FileReader) !== 'undefined') {
|
|
210
|
-
const reader = new FileReader();
|
|
211
|
-
reader.onload = (e) => resolve(e.target.result);
|
|
212
|
-
reader.onerror = e => reject(e);
|
|
213
|
-
reader.readAsArrayBuffer(file);
|
|
214
|
-
}
|
|
215
|
-
else {
|
|
216
|
-
reject('FileReader not defined');
|
|
217
|
-
}
|
|
218
|
-
}));
|
|
219
|
-
}
|
|
220
|
-
parseType(filename) {
|
|
221
|
-
const format = filename.substring(filename.lastIndexOf('.') + 1).toLowerCase();
|
|
222
|
-
switch (format) {
|
|
223
|
-
case 'jpeg':
|
|
224
|
-
case 'jpg':
|
|
225
|
-
case 'png':
|
|
226
|
-
case 'gif':
|
|
227
|
-
return 'image';
|
|
228
|
-
case 'pdf':
|
|
229
|
-
return 'pdf';
|
|
230
|
-
}
|
|
231
|
-
return 'other';
|
|
232
|
-
}
|
|
233
|
-
async abrePreview() {
|
|
234
|
-
let group;
|
|
235
|
-
let src = this.src;
|
|
236
|
-
if (this.group) {
|
|
237
|
-
group = (await Promise.all(this.group.map(arq => this.parseArquivo(arq).toPromise())));
|
|
238
|
-
src = group[this.group.indexOf(this.$arquivo)].src;
|
|
239
|
-
group = group.filter(g => !!g?.src && g?.type === this.type).map(g => g?.src);
|
|
240
|
-
}
|
|
241
|
-
this.dialog.open(DialogPreviewArquivoComponent, {
|
|
242
|
-
data: {
|
|
243
|
-
src,
|
|
244
|
-
group,
|
|
245
|
-
type: this.type,
|
|
246
|
-
},
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: PreviewArquivoComponent, deps: [{ token: ARQUIVO_MANAGER_SERVICE }, { token: i1$1.MatDialog }], target: i0.ɵɵFactoryTarget.Component });
|
|
250
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.9", type: PreviewArquivoComponent, isStandalone: true, selector: "mcl-preview-arquivo", inputs: { showLoading: "showLoading", height: "height", width: "width", group: "group", arquivo: "arquivo" }, ngImport: i0, template: "@if (!!src) {\r\n @switch (type) {\r\n @case ('image') {\r\n <img [src]=\"src\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n (click)=\"abrePreview()\"/>\r\n }\r\n @case ('other') {\r\n <div class=\"other\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n [mclDownloadArquivo]=\"arquivo\">\r\n <mat-icon>insert_drive_file</mat-icon>\r\n <small>{{ filename }}</small>\r\n </div>\r\n }\r\n @case ('pdf') {\r\n <pdf-viewer [src]=\"src\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n [original-size]=\"false\"\r\n [page]=\"1\"\r\n [render-text]=\"false\"\r\n (click)=\"abrePreview()\"\r\n ></pdf-viewer>\r\n }\r\n }\r\n}\r\n", styles: ["pdf-viewer,img,.other{overflow:hidden;display:block;border-radius:5px;background:#efefef;border:1px solid #a9a9a9}pdf-viewer.other,img.other,.other.other{display:flex;flex-direction:column;justify-items:center}pdf-viewer.other mat-icon,img.other mat-icon,.other.other mat-icon{margin:auto;text-align:center;font-size:75px;height:75px;width:75px;line-height:75px}pdf-viewer:hover,img:hover,.other:hover{cursor:pointer}\n"], dependencies: [{ kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: DownloadArquivoDirective, selector: "[mclDownloadArquivo]", inputs: ["mclDownloadArquivo", "target"] }, { kind: "component", type: MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: PdfViewerModule }, { kind: "component", type: i1.PdfViewerComponent, selector: "pdf-viewer", inputs: ["src", "c-maps-url", "page", "render-text", "render-text-mode", "original-size", "show-all", "stick-to-page", "zoom", "zoom-scale", "rotation", "external-link-target", "autoresize", "fit-to-page", "show-borders"], outputs: ["after-load-complete", "page-rendered", "pages-initialized", "text-layer-rendered", "error", "on-progress", "pageChange"] }] });
|
|
251
|
-
}
|
|
252
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: PreviewArquivoComponent, decorators: [{
|
|
253
|
-
type: Component,
|
|
254
|
-
args: [{ selector: 'mcl-preview-arquivo', imports: [
|
|
255
|
-
NgStyle,
|
|
256
|
-
DownloadArquivoDirective,
|
|
257
|
-
MatIcon,
|
|
258
|
-
PdfViewerModule,
|
|
259
|
-
], template: "@if (!!src) {\r\n @switch (type) {\r\n @case ('image') {\r\n <img [src]=\"src\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n (click)=\"abrePreview()\"/>\r\n }\r\n @case ('other') {\r\n <div class=\"other\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n [mclDownloadArquivo]=\"arquivo\">\r\n <mat-icon>insert_drive_file</mat-icon>\r\n <small>{{ filename }}</small>\r\n </div>\r\n }\r\n @case ('pdf') {\r\n <pdf-viewer [src]=\"src\"\r\n [ngStyle]=\"{width:width,height:height}\"\r\n [original-size]=\"false\"\r\n [page]=\"1\"\r\n [render-text]=\"false\"\r\n (click)=\"abrePreview()\"\r\n ></pdf-viewer>\r\n }\r\n }\r\n}\r\n", styles: ["pdf-viewer,img,.other{overflow:hidden;display:block;border-radius:5px;background:#efefef;border:1px solid #a9a9a9}pdf-viewer.other,img.other,.other.other{display:flex;flex-direction:column;justify-items:center}pdf-viewer.other mat-icon,img.other mat-icon,.other.other mat-icon{margin:auto;text-align:center;font-size:75px;height:75px;width:75px;line-height:75px}pdf-viewer:hover,img:hover,.other:hover{cursor:pointer}\n"] }]
|
|
260
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
261
|
-
type: Inject,
|
|
262
|
-
args: [ARQUIVO_MANAGER_SERVICE]
|
|
263
|
-
}] }, { type: i1$1.MatDialog }], propDecorators: { showLoading: [{
|
|
264
|
-
type: Input
|
|
265
|
-
}], height: [{
|
|
266
|
-
type: Input
|
|
267
|
-
}], width: [{
|
|
268
|
-
type: Input
|
|
269
|
-
}], group: [{
|
|
270
|
-
type: Input
|
|
271
|
-
}], arquivo: [{
|
|
272
|
-
type: Input
|
|
273
|
-
}] } });
|
|
274
|
-
|
|
275
|
-
const MCL_IMAGE_PADRAO = new InjectionToken('mainclass.MCL_IMAGE_PADRAO');
|
|
276
|
-
class ImagemDirective {
|
|
277
|
-
_padrao;
|
|
278
|
-
element;
|
|
279
|
-
arquivoManagerService;
|
|
280
|
-
attachment;
|
|
281
|
-
_setter;
|
|
282
|
-
backgroundSetter = (url) => {
|
|
283
|
-
this.element.nativeElement.style.backgroundImage = `url(${url})`;
|
|
284
|
-
};
|
|
285
|
-
srcSetter = (url) => {
|
|
286
|
-
this.element.nativeElement.src = url;
|
|
287
|
-
};
|
|
288
|
-
constructor(_padrao, element, arquivoManagerService) {
|
|
289
|
-
this._padrao = _padrao;
|
|
290
|
-
this.element = element;
|
|
291
|
-
this.arquivoManagerService = arquivoManagerService;
|
|
292
|
-
}
|
|
293
|
-
set imagemSrc(imagem) {
|
|
294
|
-
this._setter = this.srcSetter;
|
|
295
|
-
if (imagem) {
|
|
296
|
-
if (this.attachment !== imagem) {
|
|
297
|
-
this.attachment = imagem;
|
|
298
|
-
this.setPath();
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
else {
|
|
302
|
-
this._setter(this._padrao);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
set imagemBackground(imagem) {
|
|
306
|
-
this._setter = this.backgroundSetter;
|
|
307
|
-
if (imagem) {
|
|
308
|
-
if (this.attachment !== imagem) {
|
|
309
|
-
this.attachment = imagem;
|
|
310
|
-
this.setPath();
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
this._setter(this._padrao);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
set padrao(padrao) {
|
|
318
|
-
this._padrao = padrao;
|
|
319
|
-
if (this._setter) {
|
|
320
|
-
this._setter(this.padrao);
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
async setPath() {
|
|
324
|
-
if (!!this._setter && !!this.attachment) {
|
|
325
|
-
let url;
|
|
326
|
-
if (typeof this.attachment === 'string' && (this.attachment.startsWith('http://') || this.attachment.startsWith('https://') || this.attachment.match(/^\.?\/?.+(\/.+)*\.(jpeg|png|jpg|gif)$/))) {
|
|
327
|
-
url = this.attachment;
|
|
328
|
-
}
|
|
329
|
-
else {
|
|
330
|
-
url = await lastValueFrom(this.arquivoManagerService.downloadURL(this.attachment));
|
|
331
|
-
}
|
|
332
|
-
this._setter(url);
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
ngOnInit() {
|
|
336
|
-
}
|
|
337
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: ImagemDirective, deps: [{ token: MCL_IMAGE_PADRAO, optional: true }, { token: i0.ElementRef, self: true }, { token: ARQUIVO_MANAGER_SERVICE }], target: i0.ɵɵFactoryTarget.Directive });
|
|
338
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.9", type: ImagemDirective, isStandalone: true, selector: "[mclImagemSrc],[mclImagemBackground]", inputs: { imagemSrc: ["mclImagemSrc", "imagemSrc"], imagemBackground: ["mclImagemBackground", "imagemBackground"], padrao: "padrao" }, ngImport: i0 });
|
|
339
|
-
}
|
|
340
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.9", ngImport: i0, type: ImagemDirective, decorators: [{
|
|
341
|
-
type: Directive,
|
|
342
|
-
args: [{
|
|
343
|
-
selector: '[mclImagemSrc],[mclImagemBackground]'
|
|
344
|
-
}]
|
|
345
|
-
}], ctorParameters: () => [{ type: undefined, decorators: [{
|
|
346
|
-
type: Inject,
|
|
347
|
-
args: [MCL_IMAGE_PADRAO]
|
|
348
|
-
}, {
|
|
349
|
-
type: Optional
|
|
350
|
-
}] }, { type: i0.ElementRef, decorators: [{
|
|
351
|
-
type: Self
|
|
352
|
-
}] }, { type: undefined, decorators: [{
|
|
353
|
-
type: Inject,
|
|
354
|
-
args: [ARQUIVO_MANAGER_SERVICE]
|
|
355
|
-
}] }], propDecorators: { imagemSrc: [{
|
|
356
|
-
type: Input,
|
|
357
|
-
args: ['mclImagemSrc']
|
|
358
|
-
}], imagemBackground: [{
|
|
359
|
-
type: Input,
|
|
360
|
-
args: ['mclImagemBackground']
|
|
361
|
-
}], padrao: [{
|
|
362
|
-
type: Input
|
|
363
|
-
}] } });
|
|
364
|
-
|
|
365
|
-
/**
|
|
366
|
-
* Generated bundle index. Do not edit.
|
|
367
|
-
*/
|
|
368
|
-
|
|
369
|
-
export { ARQUIVO_MANAGER_SERVICE, DialogPreviewArquivoComponent, DownloadArquivoDirective, ImagemDirective, MCL_IMAGE_PADRAO, PreviewArquivoComponent };
|
|
370
|
-
//# sourceMappingURL=main-class-componentes-arquivo.mjs.map
|
|
852
|
+
//# sourceMappingURL=main-class-componentes-arquivo.mjs.map
|