@guajiritos/image-picker 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,646 +1,606 @@
1
1
  import { __awaiter } from 'tslib';
2
2
  import * as i0 from '@angular/core';
3
- import { Pipe, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, ViewChild, Output, NgModule } from '@angular/core';
3
+ import { Pipe, NgModule, EventEmitter, Component, ViewEncapsulation, ChangeDetectionStrategy, Input, ViewChild, Output } from '@angular/core';
4
4
  import { ResizeObserver } from 'resize-observer';
5
- import * as i1 from '@angular/common';
6
- import { CommonModule } from '@angular/common';
7
- import * as i2 from '@angular/material/icon';
5
+ import { NgIf, NgStyle, NgForOf } from '@angular/common';
6
+ import * as i1 from '@angular/material/button';
7
+ import { MatButtonModule } from '@angular/material/button';
8
+ import * as i2 from '@angular/material/tooltip';
9
+ import { MatTooltipModule } from '@angular/material/tooltip';
10
+ import * as i3 from '@angular/material/icon';
8
11
  import { MatIconModule } from '@angular/material/icon';
9
- import * as i3 from '@angular/material/legacy-button';
10
- import { MatLegacyButtonModule } from '@angular/material/legacy-button';
11
- import * as i4 from '@angular/material/legacy-tooltip';
12
- import { MatLegacyTooltipModule } from '@angular/material/legacy-tooltip';
13
- import * as i5 from '@angular/material/legacy-slider';
14
- import { MatLegacySliderModule } from '@angular/material/legacy-slider';
15
- import * as i6 from '@angular/forms';
16
- import { FormsModule, ReactiveFormsModule } from '@angular/forms';
17
- import * as i7 from '@angular/material/legacy-form-field';
18
- import { MatLegacyFormFieldModule } from '@angular/material/legacy-form-field';
19
- import * as i8 from '@angular/material/legacy-select';
20
- import { MatLegacySelectModule } from '@angular/material/legacy-select';
21
- import * as i9 from '@angular/material/legacy-core';
22
- import * as i10 from '@angular/material/legacy-input';
23
- import { MatLegacyInputModule } from '@angular/material/legacy-input';
24
- import * as i11 from '@angular/material/legacy-checkbox';
25
- import { MatLegacyCheckboxModule } from '@angular/material/legacy-checkbox';
12
+ import * as i5 from '@angular/material/slider';
13
+ import { MatSliderModule } from '@angular/material/slider';
14
+ import * as i6 from '@angular/material/checkbox';
15
+ import { MatCheckboxModule } from '@angular/material/checkbox';
16
+ import * as i7 from '@angular/material/form-field';
17
+ import { MatFormFieldModule } from '@angular/material/form-field';
18
+ import * as i8 from '@angular/material/input';
19
+ import { MatInputModule } from '@angular/material/input';
20
+ import * as i9 from '@angular/material/select';
21
+ import { MatSelectModule } from '@angular/material/select';
22
+ import * as i11 from '@angular/forms';
23
+ import { FormsModule } from '@angular/forms';
24
+ import { Subject } from 'rxjs';
25
+ import * as i10 from '@angular/material/core';
26
26
 
27
- class CalculateSizePipe {
28
- transform(imageLength) {
29
- if (!imageLength) {
30
- return;
31
- }
32
- if (imageLength) {
33
- return Math.ceil(((3 / 4) * imageLength) / 1024);
34
- }
35
- else {
36
- return;
37
- }
38
- }
39
- }
40
- CalculateSizePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: CalculateSizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
41
- CalculateSizePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: CalculateSizePipe, name: "calculateSize" });
42
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: CalculateSizePipe, decorators: [{
43
- type: Pipe,
44
- args: [{
45
- name: 'calculateSize'
46
- }]
27
+ class CalculateSizePipe {
28
+ transform(imageLength) {
29
+ if (!imageLength) {
30
+ return 0;
31
+ }
32
+ if (imageLength) {
33
+ return Math.ceil(((3 / 4) * imageLength) / 1024);
34
+ }
35
+ else {
36
+ return 0;
37
+ }
38
+ }
39
+ }
40
+ CalculateSizePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: CalculateSizePipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
41
+ CalculateSizePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "15.2.3", ngImport: i0, type: CalculateSizePipe, name: "calculateSize" });
42
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: CalculateSizePipe, decorators: [{
43
+ type: Pipe,
44
+ args: [{
45
+ name: 'calculateSize'
46
+ }]
47
47
  }] });
48
48
 
49
- class GuajiritosImagePickerComponent {
50
- constructor(_cdRef) {
51
- this._cdRef = _cdRef;
52
- this.observer = null;
53
- this.labelEn = {
54
- 'Upload a image': 'Upload a image',
55
- 'You must edit the image in order to resize it': 'You must edit the image in order to resize it',
56
- 'too large': 'too large',
57
- 'Open the editor panel': 'Open the editor panel',
58
- 'Download the image': 'Download the image',
59
- 'Control Panel': 'Control Panel',
60
- Quality: 'Quality',
61
- 'Max dimensions': 'Max dimensions',
62
- 'aspect-ratio': 'aspect-ratio',
63
- 'max-width(px)': 'max-width(px)',
64
- 'max-height(px)': 'max-height(px)',
65
- Format: 'Format',
66
- Crop: 'Crop',
67
- 'width(px)': 'width(px)',
68
- 'height(px)': 'height(px)',
69
- Remove: 'Remove',
70
- };
71
- this.labelEs = {
72
- 'Upload a image': 'Suba una imagen',
73
- 'You must edit the image in order to resize it': 'Debe editar la imagen para disminuir su tamaño',
74
- 'too large': 'muy grande',
75
- 'Open the editor panel': 'Abra el panel de edición',
76
- 'Download the image': 'Descarge la imagen',
77
- 'Control Panel': 'Panel de control',
78
- Remove: 'Quitar',
79
- Quality: 'Calidad',
80
- 'Max dimensions': 'Dimensiones',
81
- 'aspect-ratio': 'relación-aspecto',
82
- 'max-width(px)': 'max. ancho',
83
- 'max-height(px)': 'max. alto',
84
- Format: 'Formato',
85
- Crop: 'Recortar',
86
- 'width(px)': 'ancho(px)',
87
- 'height(px)': 'altura(px)',
88
- };
89
- this.labelFr = {
90
- 'Upload a image': 'Charger une image',
91
- 'You must edit the image in order to resize it': 'Vous devez éditer l\'image pour changer sa taille',
92
- 'too large': 'Trop grande',
93
- 'Open the editor panel': 'Ouvrir le panneau d\'édition',
94
- 'Download the image': 'Télécharger l\'image',
95
- 'Control Panel': 'Panneau de commande',
96
- Remove: 'Supprimer',
97
- Quality: 'Qualité',
98
- 'Max dimensions': 'Dimensions maximales',
99
- 'aspect-ratio': 'rapport de forme',
100
- 'max-width(px)': 'largeur max.',
101
- 'max-height(px)': 'hauteur max',
102
- Format: 'Format',
103
- Crop: 'Recadrer',
104
- 'width(px)': 'largeur(px)',
105
- 'height(px)': 'hauteur(px)',
106
- };
107
- this.arrayCopiedImages = [];
108
- this.config = {
109
- height: '240px',
110
- width: '320px',
111
- borderRadius: '16px',
112
- compressInitial: true,
113
- language: 'en',
114
- hideDeleteBtn: false,
115
- hideDownloadBtn: false,
116
- hideEditBtn: false,
117
- hideAddBtn: false,
118
- };
119
- this.showCrop = false;
120
- this.loadImage = false;
121
- this.uuidFilePicker = Date.now().toString(20);
122
- this.showEditPanel = false;
123
- this.quality = 92;
124
- this.format = 'jpeg';
125
- this.allFormats = ['webp', 'jpeg', 'png'];
126
- this.maxHeight = 2000;
127
- this.maxWidth = 2000;
128
- this.cropHeight = 150;
129
- this.cropWidth = 150;
130
- this.maintainAspectRatio = true;
131
- this.imageName = 'download';
132
- this.appearance = 'outline';
133
- this.color = 'primary';
134
- this.imagesAllowed = 'image/*';
135
- this.$imageChanged = new EventEmitter();
136
- this.$imageOriginal = new EventEmitter();
137
- this.labels = this.labelEn;
138
- }
139
- set _imageSrc(value) {
140
- if (value) {
141
- this.parseToBase64(value).then((dataUri) => {
142
- this.imageSrc = dataUri;
143
- this.arrayCopiedImages = [];
144
- this.arrayCopiedImages.push(this.imageSrc);
145
- this.originImageSrc = value;
146
- this.lastOriginSrc = value;
147
- this.$imageOriginal.next(this.originImageSrc);
148
- this.loadImage = true;
149
- this._cdRef.markForCheck();
150
- });
151
- }
152
- else {
153
- this.imageSrc = null;
154
- this.originImageSrc = null;
155
- this.loadImage = false;
156
- this.arrayCopiedImages = [];
157
- this.lastOriginSrc = null;
158
- this.$imageOriginal.next(null);
159
- this.format = 'jpeg';
160
- this.maxHeight = 2000;
161
- this.maxWidth = 2000;
162
- this.cropHeight = 150;
163
- this.cropWidth = 150;
164
- this.maintainAspectRatio = true;
165
- this.showEditPanel = false;
166
- this._cdRef.markForCheck();
167
- }
168
- }
169
- set _config(value) {
170
- if (value && value.constructor == Object) {
171
- this.config = Object.assign(Object.assign({}, this.config), value);
172
- if ((value === null || value === void 0 ? void 0 : value.language) !== undefined) {
173
- if (value.language === 'en') {
174
- this.labels = Object.assign({}, this.labelEn);
175
- }
176
- if (value.language === 'es') {
177
- this.labels = Object.assign({}, this.labelEs);
178
- }
179
- if (value.language === 'fr') {
180
- this.labels = Object.assign({}, this.labelFr);
181
- }
182
- }
183
- }
184
- }
185
- handleReaderLoaded(readerEvt) {
186
- var _a;
187
- return __awaiter(this, void 0, void 0, function* () {
188
- const binaryString = readerEvt.target.result;
189
- const base64textString = btoa(binaryString);
190
- this.originImageSrc = this.urlImage + base64textString;
191
- this.lastOriginSrc = this.urlImage + base64textString;
192
- if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.compressInitial) {
193
- this.quality = 92;
194
- const input = {
195
- dataType: this.format,
196
- quality: 0.92,
197
- maintainRatio: true,
198
- };
199
- this.imageSrc = yield this.resizeDataURL(this.urlImage + base64textString, input);
200
- }
201
- else {
202
- this.imageSrc = this.urlImage + base64textString;
203
- this.arrayCopiedImages = [];
204
- this.arrayCopiedImages.push({
205
- lastImage: this.imageSrc,
206
- width: this.maxWidth,
207
- height: this.maxHeight,
208
- quality: this.quality,
209
- });
210
- this.$imageOriginal.next(this.imageSrc);
211
- }
212
- this.$imageChanged.next(this.imageSrc);
213
- this.loadImage = true;
214
- });
215
- }
216
- parseToBase64(imageUrl) {
217
- let types = imageUrl.split('.');
218
- let type = types[types.length - 1];
219
- if (!type || (type !== 'png' && type !== 'jpeg' && type !== 'webp')) {
220
- type = 'jpeg';
221
- }
222
- this.format = type;
223
- return new Promise((resolve) => {
224
- let img = document.createElement('img');
225
- img.crossOrigin = 'Anonymous';
226
- img.src = imageUrl;
227
- this.maxHeight = img === null || img === void 0 ? void 0 : img.height;
228
- this.maxWidth = img === null || img === void 0 ? void 0 : img.width;
229
- img.onload = function () {
230
- let canvas = document.createElement('canvas');
231
- let ctx = canvas.getContext('2d');
232
- let ratio = 1.0;
233
- canvas.width = (img === null || img === void 0 ? void 0 : img.width) * ratio;
234
- canvas.height = (img === null || img === void 0 ? void 0 : img.height) * ratio;
235
- ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
236
- let dataURI = canvas.toDataURL(`image/${type}`, 0.92);
237
- return resolve({
238
- dataUri: dataURI,
239
- width: canvas.width,
240
- height: canvas.height,
241
- });
242
- };
243
- }).then((data) => {
244
- this.maxHeight = data === null || data === void 0 ? void 0 : data.height;
245
- this.maxWidth = data === null || data === void 0 ? void 0 : data.width;
246
- return data === null || data === void 0 ? void 0 : data.dataUri;
247
- });
248
- }
249
- resizeDataURL(datas, input) {
250
- return __awaiter(this, void 0, void 0, function* () {
251
- return yield new Promise(function (resolve) {
252
- return __awaiter(this, void 0, void 0, function* () {
253
- let img = document.createElement('img');
254
- img.src = datas + '';
255
- img.crossOrigin = 'Anonymous';
256
- let quality = input.quality ? input.quality : 1.0;
257
- let maintainRatio = input.maintainRatio != undefined ? input.maintainRatio : true;
258
- img.onload = function () {
259
- const canvas = document.createElement('canvas');
260
- const ctx = canvas.getContext('2d');
261
- let ratio = img.width / img.height;
262
- let width = input.width ? input.width : img.width;
263
- let height = input.height ? input.height : img.height;
264
- if (maintainRatio) {
265
- if (input.changeHeight) {
266
- canvas.width = height * ratio;
267
- canvas.height = height;
268
- }
269
- else {
270
- canvas.width = width;
271
- canvas.height = width / ratio;
272
- }
273
- }
274
- else {
275
- canvas.width = width;
276
- canvas.height = height;
277
- }
278
- ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
279
- let type = input.dataType ? input.dataType : 'webp';
280
- const dataURI = canvas.toDataURL(`image/${type}`, quality);
281
- resolve({
282
- dataUri: dataURI,
283
- width: canvas.width,
284
- height: canvas.height,
285
- });
286
- };
287
- });
288
- }).then((data) => {
289
- var _a;
290
- this.maxHeight = data === null || data === void 0 ? void 0 : data.height;
291
- this.maxWidth = data === null || data === void 0 ? void 0 : data.width;
292
- if (((_a = this.arrayCopiedImages) === null || _a === void 0 ? void 0 : _a.length) <= 20) {
293
- this.arrayCopiedImages.push({
294
- lastImage: data === null || data === void 0 ? void 0 : data.dataUri,
295
- width: this.maxWidth,
296
- height: this.maxHeight,
297
- quality: this.quality,
298
- });
299
- }
300
- return data.dataUri;
301
- });
302
- });
303
- }
304
- wait(ms) {
305
- ms = ms ? ms : 1000;
306
- return new Promise((resolve) => {
307
- setTimeout(() => {
308
- return resolve(true);
309
- }, ms);
310
- });
311
- }
312
- dragElement(element) {
313
- let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
314
- if (document.getElementById(element.id + '-header')) {
315
- document.getElementById(element.id + '-header').onmousedown = dragMouseDown;
316
- document.getElementById(element.id + '-header').ontouchstart = dragMouseDown;
317
- }
318
- else {
319
- element.onmousedown = dragMouseDown;
320
- element.ontouchstart = dragMouseDown;
321
- }
322
- function dragMouseDown(e) {
323
- e = e || window.event;
324
- e.preventDefault();
325
- pos3 = e.clientX;
326
- pos4 = e.clientY;
327
- document.onmouseup = closeDragElement;
328
- document.ontouchend = closeDragElement;
329
- document.onmousemove = elementDrag;
330
- document.ontouchmove = elementDrag;
331
- }
332
- function elementDrag(e) {
333
- let holderImage = document.getElementById('image-full');
334
- e = e || window.event;
335
- e.preventDefault();
336
- pos1 = pos3 - e.clientX;
337
- pos2 = pos4 - e.clientY;
338
- pos3 = e.clientX;
339
- pos4 = e.clientY;
340
- const newTop = element.offsetTop - pos2;
341
- const newLeft = element.offsetLeft - pos1;
342
- const rectHolder = holderImage.getBoundingClientRect();
343
- const rectElement = element.getBoundingClientRect();
344
- if (newTop >= rectHolder.y + 8) {
345
- element.style.top = Math.min(newTop, rectHolder.y + rectHolder.height - rectElement.height - 4) + 'px';
346
- }
347
- if (newLeft > rectHolder.x + 4 && rectHolder.x + rectHolder.width > rectElement.x + rectElement.width + 2) {
348
- element.style.left = Math.min(newLeft, rectHolder.x + rectHolder.width - rectElement.width - 4) + 'px';
349
- }
350
- }
351
- function closeDragElement() {
352
- document.onmouseup = null;
353
- document.onmousemove = null;
354
- document.ontouchend = null;
355
- document.ontouchmove = null;
356
- }
357
- }
358
- onUpload(event) {
359
- event.preventDefault();
360
- this.imagePicker.nativeElement.click();
361
- }
362
- handleFileSelect(evt) {
363
- var _a;
364
- const files = (_a = evt.target) === null || _a === void 0 ? void 0 : _a.files;
365
- if (files) {
366
- const file = files[0];
367
- this.imageName = file.name.split('.')[0];
368
- this.fileType = file.type;
369
- this.urlImage = `data:${file.type};base64,`;
370
- if (files && file) {
371
- const reader = new FileReader();
372
- reader.onload = this.handleReaderLoaded.bind(this);
373
- reader.readAsBinaryString(file);
374
- }
375
- }
376
- }
377
- onCloseEditPanel() {
378
- if (this.observer instanceof ResizeObserver) {
379
- this.observer.unobserve(document.getElementById('image-cropper'));
380
- this.observer.unobserve(document.getElementById('image-full'));
381
- }
382
- this.showCrop = false;
383
- this.showEditPanel = false;
384
- }
385
- onChangeQuality() {
386
- return __awaiter(this, void 0, void 0, function* () {
387
- const qualityItem = this.quality / 100;
388
- this.maxHeight = this.maxHeight && +this.maxHeight ? this.maxHeight : 2000;
389
- this.maxWidth = this.maxWidth && +this.maxWidth ? this.maxWidth : 2000;
390
- yield this.wait(250);
391
- try {
392
- const input = {
393
- height: this.maxHeight,
394
- width: this.maxWidth,
395
- dataType: this.format,
396
- quality: qualityItem,
397
- maintainRatio: this.maintainAspectRatio,
398
- };
399
- this.imageSrc = yield this.resizeDataURL(this.originImageSrc, input);
400
- this.$imageChanged.next(this.imageSrc);
401
- this.loadImage = true;
402
- }
403
- catch (error) {
404
- this.loadImage = true;
405
- }
406
- });
407
- }
408
- onChangeFormat() {
409
- return __awaiter(this, void 0, void 0, function* () {
410
- let qualityItem = this.quality / 100;
411
- this.maxHeight = this.maxHeight && +this.maxHeight ? this.maxHeight : 2000;
412
- this.maxWidth = this.maxWidth && +this.maxWidth ? this.maxWidth : 2000;
413
- yield this.wait(250);
414
- try {
415
- let input = {
416
- height: this.maxHeight,
417
- width: this.maxWidth,
418
- dataType: this.format,
419
- quality: qualityItem,
420
- maintainRatio: this.maintainAspectRatio,
421
- };
422
- this.imageSrc = yield this.resizeDataURL(this.originImageSrc, input);
423
- this.$imageChanged.next(this.imageSrc);
424
- this.loadImage = true;
425
- }
426
- catch (error) {
427
- this.loadImage = true;
428
- }
429
- });
430
- }
431
- onChangeSize(changeWidth, changeHeight) {
432
- return __awaiter(this, void 0, void 0, function* () {
433
- let qualityItem = this.quality / 100;
434
- this.maxHeight = this.maxHeight && +this.maxHeight ? this.maxHeight : 2000;
435
- this.maxWidth = this.maxWidth && +this.maxWidth ? this.maxWidth : 2000;
436
- yield this.wait(500);
437
- try {
438
- let input = {
439
- height: this.maxHeight,
440
- width: this.maxWidth,
441
- dataType: this.format,
442
- quality: qualityItem,
443
- maintainRatio: this.maintainAspectRatio,
444
- changeHeight: changeHeight,
445
- changeWidth: changeWidth,
446
- };
447
- this.imageSrc = yield this.resizeDataURL(this.originImageSrc, input);
448
- this.$imageChanged.next(this.imageSrc);
449
- this.loadImage = true;
450
- }
451
- catch (error) {
452
- this.loadImage = true;
453
- }
454
- });
455
- }
456
- onChangeCrop() {
457
- const cropper = document.getElementById('image-cropper');
458
- cropper.style.width = this.cropWidth + 'px';
459
- cropper.style.height = this.cropHeight + 'px';
460
- }
461
- onCropStateChange() {
462
- const cropper = document.getElementById('image-cropper');
463
- if (this.showCrop) {
464
- cropper.style.opacity = '1.0';
465
- this.dragElement(cropper);
466
- this.observer = new ResizeObserver((entries) => {
467
- entries.forEach((entry) => {
468
- if (this.showEditPanel) {
469
- const elementCropper = document.getElementById('image-cropper');
470
- const rectHolder = document.getElementById('image-full').getBoundingClientRect();
471
- const rectElemnt = elementCropper.getBoundingClientRect();
472
- const maxWidth = rectHolder.x + rectHolder.width - rectElemnt.x - 4;
473
- const maxHeight = rectHolder.y + rectHolder.height - rectElemnt.y - 4;
474
- elementCropper.style.maxWidth = maxWidth + 'px';
475
- elementCropper.style.maxHeight = maxHeight + 'px';
476
- this.cropWidth = rectElemnt.width;
477
- this.cropHeight = rectElemnt.height;
478
- if (entry.target.id == 'image-full') {
479
- if (rectHolder.top > 0) {
480
- elementCropper.style.top = rectHolder.top + 4 + 'px';
481
- }
482
- elementCropper.style.left = rectHolder.left + 4 + 'px';
483
- }
484
- }
485
- });
486
- });
487
- this.observer.observe(document.getElementById('image-cropper'));
488
- this.observer.observe(document.getElementById('image-full'));
489
- }
490
- else {
491
- cropper.style.opacity = '0.0';
492
- if (this.observer instanceof ResizeObserver) {
493
- this.observer.unobserve(document.getElementById('image-cropper'));
494
- this.observer.unobserve(document.getElementById('image-full'));
495
- }
496
- }
497
- }
498
- onCrop(type) {
499
- type = type ? type : this.format;
500
- const cropper = document.getElementById('image-cropper');
501
- const rectCropper = cropper.getBoundingClientRect();
502
- const dataHolderRect = document.getElementById('image-full').getBoundingClientRect();
503
- const canvas = document.createElement('canvas');
504
- new Promise((resolve, reject) => {
505
- let ctx = canvas.getContext('2d');
506
- let image = new Image();
507
- image.src = this.imageSrc;
508
- image.onload = () => {
509
- let ratio = image.height / dataHolderRect.height;
510
- let newWidth = rectCropper.width * ratio;
511
- let newHeight = rectCropper.height * ratio;
512
- canvas.height = newHeight;
513
- canvas.width = newWidth;
514
- ctx.drawImage(image, Math.abs(rectCropper.x * ratio) - Math.abs(dataHolderRect.x * ratio), Math.abs(rectCropper.y * ratio) - Math.abs(dataHolderRect.y * ratio), newWidth, newHeight, 0, 0, newWidth, newHeight);
515
- // ctx.drawImage(image, 90, 130, 50, 60, 10, 10, 50, 60);
516
- resolve(canvas.toDataURL(`image/${type}`, 0.98));
517
- };
518
- image.onerror = (e) => {
519
- reject(e);
520
- };
521
- })
522
- .then((dataUri) => {
523
- this.imageSrc = dataUri;
524
- this.showCrop = false;
525
- this.onCropStateChange();
526
- this.maxWidth = canvas.width;
527
- this.maxHeight = canvas.height;
528
- this.lastOriginSrc = this.originImageSrc + '';
529
- this.originImageSrc = dataUri;
530
- this.$imageChanged.next(this.imageSrc);
531
- })
532
- .catch((e) => {
533
- console.log(e);
534
- });
535
- }
536
- onRestore() {
537
- if (this.arrayCopiedImages.length) {
538
- let lastState = this.arrayCopiedImages.pop();
539
- this.imageSrc = lastState.lastImage;
540
- this.maxWidth = lastState.width;
541
- this.maxHeight = lastState.height;
542
- this.originImageSrc = this.lastOriginSrc + '';
543
- }
544
- else {
545
- this.imageSrc = this.lastOriginSrc;
546
- this.originImageSrc = this.lastOriginSrc + '';
547
- }
548
- this.$imageChanged.next(this.imageSrc);
549
- }
550
- onRemove() {
551
- this.imageSrc = null;
552
- this.originImageSrc = null;
553
- this.loadImage = false;
554
- this.arrayCopiedImages = [];
555
- this.lastOriginSrc = null;
556
- this.$imageOriginal.next(null);
557
- this.$imageChanged.next(null);
558
- this.format = 'jpeg';
559
- this.maxHeight = 2000;
560
- this.maxWidth = 2000;
561
- this.cropHeight = 150;
562
- this.cropWidth = 150;
563
- this.maintainAspectRatio = true;
564
- this.showEditPanel = false;
565
- }
566
- }
567
- GuajiritosImagePickerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GuajiritosImagePickerComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
568
- GuajiritosImagePickerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.1.4", type: GuajiritosImagePickerComponent, selector: "guajiritos-image-picker", inputs: { appearance: "appearance", color: "color", imagesAllowed: "imagesAllowed", _imageSrc: "_imageSrc", _config: "_config" }, outputs: { $imageChanged: "$imageChanged", $imageOriginal: "$imageOriginal" }, viewQueries: [{ propertyName: "imagePicker", first: true, predicate: ["imagePicker"], descendants: true }], ngImport: i0, template: "<div *ngIf='!loadImage' class='place-image'>\r\n <div class='image-holder'\r\n [ngStyle]='{ width: config?.width,height: config?.height,borderRadius: config?.borderRadius}'>\r\n <button [matTooltip]=\"labels['Upload a image']\" class='image-upload-btn' mat-icon-button (click)='onUpload($event)'>\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <input #imagePicker type='file' style='display: none' [id]=\"'filePicker-' + uuidFilePicker\"\r\n (change)='handleFileSelect($event)' [accept]='imagesAllowed'>\r\n </div>\r\n</div>\r\n<div *ngIf='loadImage' class='place-image'>\r\n <div class='image-holder-loaded'\r\n [ngStyle]='{width: config?.width,height: config?.height,borderRadius: config?.borderRadius}'>\r\n <img [src]='imageSrc' alt='image-loaded' [ngStyle]='{ borderRadius: config.borderRadius }'>\r\n <input #imagePicker type='file' style='display: none' [id]=\"'filePicker-' + uuidFilePicker\"\r\n (change)='handleFileSelect($event)' [accept]='imagesAllowed'>\r\n </div>\r\n <p *ngIf='imageSrc?.length' class='mat-caption image-caption'\r\n [ngStyle]=\"{color: (imageSrc?.length | calculateSize) > 120 ? '#f44336' : 'unset',fontWeight: (imageSrc?.length | calculateSize) > 120 ? '500' : 'unset'}\">\r\n size: {{ (imageSrc?.length | calculateSize) }}Kb &nbsp; {{ format }}\r\n </p>\r\n\r\n <div class='editing-bar-btn'\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: flex-start; align-items: flex-start'>\r\n <button id='upload-img' *ngIf='!config.hideAddBtn' mat-icon-button [matTooltip]=\"labels['Upload a image']\"\r\n (click)='onUpload($event)'>\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <button id='edit-img' *ngIf='!config.hideEditBtn' mat-icon-button [matTooltip]=\"labels['Open the editor panel']\"\r\n (click)='showEditPanel = true'>\r\n <mat-icon class='mat-18'>edit</mat-icon>\r\n </button>\r\n <a id='download-img' *ngIf='!config.hideDownloadBtn' [matTooltip]=\"labels['Download the image']\"\r\n [href]='imageSrc' mat-icon-button [download]='imageName'>\r\n <mat-icon class='mat-18'>cloud_download</mat-icon>\r\n </a>\r\n <button id='delete-img' *ngIf='!config.hideDeleteBtn' mat-icon-button [matTooltip]=\"labels['Remove']\"\r\n (click)='onRemove()'>\r\n <mat-icon class='mat-18'>delete</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n\r\n<div *ngIf='showEditPanel' id='popup' class='popup'>\r\n <div\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: center flex-end; align-items: center'>\r\n <button mat-icon-button (click)='onCloseEditPanel()'>\r\n <mat-icon class='mat-18'>clear</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <div class='image-container'>\r\n <div class='image-holder-full'>\r\n <img id='image-full' [src]='imageSrc' alt=''>\r\n <div id='image-cropper' class='image-cropper'>\r\n <div id='image-cropper-header'>\r\n <mat-icon>drag_indicator</mat-icon>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class='control-panel'>\r\n <p class='title-panel'>{{ labels['Control Panel'] }}</p>\r\n\r\n <p class='item-panel'>{{ labels['Quality'] }}</p>\r\n <div\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: flex-start; align-items: flex-start'>\r\n <mat-slider [color]='color' style='max-width: 100%; width: 100%' (change)='onChangeQuality()'\r\n [(ngModel)]='quality' [min]='0' [max]='100' [step]='1' [thumbLabel]='true'>\r\n </mat-slider>\r\n </div>\r\n\r\n <p class='item-panel'>\r\n {{ labels['Max dimensions'] }}\r\n <mat-checkbox style='float: right' [(ngModel)]='maintainAspectRatio' [color]='color'>\r\n <span class='mat-caption'>{{ labels['aspect-ratio'] }}</span>\r\n </mat-checkbox>\r\n </p>\r\n <div\r\n style='margin-top: 8px !important; flex-flow: row wrap; box-sizing: border-box; display: flex; place-content: flex-start space-between; align-items: flex-start'>\r\n <mat-form-field class='no-input-style' style='max-width: 48%; width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['max-width(px)'] }}</mat-label>\r\n <input (change)='onChangeSize(true, false)' matInput [placeholder]=\"labels['max-width(px)']\"\r\n [(ngModel)]='maxWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n\r\n <mat-form-field class='no-input-style' style='max-width: 48%; width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['max-height(px)'] }}</mat-label>\r\n <input (change)='onChangeSize(false, true)' matInput [placeholder]=\"labels['max-height(px)']\"\r\n [(ngModel)]='maxHeight' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n </div>\r\n\r\n <p class='item-panel'>{{ labels['Format'] }}</p>\r\n <div\r\n style='margin-top: 8px !important; flex-direction: row; box-sizing: border-box; display: flex; place-content: flex-start; align-items: flex-start'>\r\n <mat-form-field class='no-input-style' style='max-width: 100%; width: 100%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-select [(ngModel)]='format' (selectionChange)='onChangeFormat()'>\r\n <mat-option *ngFor='let format of allFormats' [value]='format'>\r\n {{ format }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-checkbox (change)='onCropStateChange()' [(ngModel)]='showCrop' [color]='color'>\r\n <p class='item-panel'>{{ labels['Crop'] }}</p>\r\n </mat-checkbox>\r\n <button style='float: right' mat-icon-button [color]='color' (click)='onRestore()'>\r\n <mat-icon>refresh</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <ng-container *ngIf='showCrop'>\r\n <div\r\n style='margin-top: 8px !important; flex-flow: row wrap; box-sizing: border-box; display: flex; place-content: flex-start space-between; align-items: flex-start'>\r\n <mat-form-field class='no-input-style' style='max-width: 48%; width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['width(px)'] }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput [placeholder]=\"labels['width(px)']\"\r\n [(ngModel)]='cropWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n <mat-form-field class='no-input-style' style='max-width: 48%; width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['height(px)'] }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput\r\n [placeholder]=\"labels['height(px)']\" [(ngModel)]='cropHeight' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n </div>\r\n\r\n <p style='margin-bottom: 4px !important'>\r\n <button mat-icon-button [color]='color' (click)='onCrop()'>\r\n <mat-icon> crop</mat-icon>\r\n </button>\r\n </p>\r\n </ng-container>\r\n\r\n <div\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: center space-between; align-items: center'>\r\n <button mat-flat-button (click)='onCloseEditPanel()' [color]='color'\r\n style='padding: 0 8px; height: 34px; box-sizing: border-box;'>\r\n Guardar\r\n </button>\r\n\r\n <p *ngIf='imageSrc?.length' class='mat-caption image-caption'\r\n [ngStyle]=\"{color: (imageSrc?.length | calculateSize) > 120 ? '#f44336' : 'unset',fontWeight: (imageSrc?.length | calculateSize) > 120 ? '500' : 'unset'}\">\r\n size: {{ (imageSrc?.length | calculateSize) }}Kb &nbsp; {{ format }}\r\n </p>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["guachos-image-picker p{margin:0!important;padding:0!important}guachos-image-picker .place-image{flex-direction:column;box-sizing:border-box;display:flex;place-content:flex-start;align-items:center}guachos-image-picker .place-image .image-holder{flex-direction:column;box-sizing:border-box;display:flex;place-content:center;align-items:center;position:relative;width:320px;height:240px;border-radius:16px;max-width:100%!important;border:2px rgba(0,0,0,.3) solid;background-color:#fcfcfc}@media (max-width: 599px){guachos-image-picker .place-image .image-holder{max-width:100%!important;max-height:250px!important}}guachos-image-picker .place-image .image-holder .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;color:#424242}guachos-image-picker .place-image .image-holder .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px;color:#424242}@media (max-width: 599px){guachos-image-picker .place-image .image-holder .image-upload-btn{opacity:1;width:30px;height:30px}guachos-image-picker .place-image .image-holder .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}guachos-image-picker .place-image .image-holder:hover .image-upload-btn{opacity:1;transition:all .5s ease}guachos-image-picker .place-image .image-holder-loaded{flex-direction:column;box-sizing:border-box;display:flex;place-content:center;align-items:center;position:relative;max-width:100%!important;width:320px;height:240px;border-radius:4px;padding:2px}guachos-image-picker .place-image .image-holder-loaded .image-caption{position:absolute;right:0;bottom:-22px}guachos-image-picker .place-image .image-holder-loaded img{height:100%;max-height:100%;width:100%;max-width:100%;object-fit:cover;object-position:center}@media (max-width: 599px){guachos-image-picker .place-image .image-holder-loaded{max-height:195px!important}}guachos-image-picker .place-image .image-holder-loaded .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;color:#424242}guachos-image-picker .place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px;color:#424242}@media (max-width: 599px){guachos-image-picker .place-image .image-holder-loaded .image-upload-btn{opacity:1;width:30px;height:30px}guachos-image-picker .place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}guachos-image-picker .place-image .image-holder-loaded:hover .image-upload-btn{opacity:1;transition:all .5s ease}guachos-image-picker .place-image .editing-bar-btn{margin-top:2px}guachos-image-picker .place-image .editing-bar-btn .mat-icon-button{height:20px;line-height:20px;width:24px}guachos-image-picker .place-image .editing-bar-btn mat-icon{line-height:20px!important;font-size:20px!important;width:20px!important;height:20px!important}guachos-image-picker .place-image .editing-bar-btn button{margin:4px;color:#424242;transition:all .5s ease}guachos-image-picker .place-image .editing-bar-btn button:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}guachos-image-picker .place-image .editing-bar-btn a{margin:4px;color:#424242;transition:all .5s ease}guachos-image-picker .place-image .editing-bar-btn a:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}guachos-image-picker .popup{width:100vw;max-height:100%;height:100%;overflow:auto;position:fixed;top:0;left:0;background-color:#000c;z-index:1000;padding:24px;color:#fff;box-sizing:border-box;animation-name:show;animation-duration:.4s}guachos-image-picker .popup .image-container{margin-top:50px;margin-bottom:50px;height:100%;min-height:100%;min-width:100%;width:100%;flex-flow:row wrap;box-sizing:border-box;display:flex;place-content:flex-start center;align-items:flex-start}guachos-image-picker .popup .image-container .image-holder-full{height:auto;width:auto;position:relative;display:contents}guachos-image-picker .popup img{max-height:600px;max-width:100%;object-fit:cover;object-position:center;margin:8px;transition:all .5s ease}@media (max-width: 1024px){guachos-image-picker .popup{background-color:#000000d9;padding:8px}guachos-image-picker .popup img{max-height:100%;max-width:100%}}@media (max-width: 599px){guachos-image-picker .popup img{margin:0}}guachos-image-picker .popup .control-panel{color:#fff;background-color:#000000eb;margin:8px;padding:16px;max-width:100%;width:18rem;border-radius:8px;flex-direction:column;box-sizing:border-box;display:flex;place-content:stretch flex-start;align-items:stretch}@media (max-width: 599px){guachos-image-picker .popup .control-panel{margin:8px 0;width:100%}}guachos-image-picker .popup .control-panel .title-panel{padding:0 4px;font-size:17px;font-weight:500;margin-bottom:16px!important}guachos-image-picker .popup .control-panel .item-panel{padding:0 4px;font-size:14px;font-weight:500}@keyframes show{0%{top:-100vh;opacity:0}to{top:0;opacity:1}}guachos-image-picker .mat-form-field-appearance-fill .mat-form-field-flex{background-color:#fafafa!important}guachos-image-picker .mat-select-panel{background:#fafafa!important}guachos-image-picker input.mat-input-element{color:#000000d9}guachos-image-picker .mat-checkbox-background{background-color:#fff}guachos-image-picker .image-cropper{position:absolute;width:150px;height:150px;border:2.5px solid #fafafa;box-sizing:border-box;resize:both;overflow:auto;opacity:0}guachos-image-picker .image-cropper #image-cropper-header{padding:10px;cursor:move;z-index:10;background-color:transparent;height:85%}guachos-image-picker .image-cropper #image-cropper-header mat-icon{color:#fff}guachos-image-picker .btn{padding:4px 8px;border-radius:4px;cursor:pointer}guachos-image-picker .btn mat-icon{color:#000000d1}\n"], dependencies: [{ kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "component", type: i3.MatLegacyButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i3.MatLegacyAnchor, selector: "a[mat-button], a[mat-raised-button], a[mat-icon-button], a[mat-fab], a[mat-mini-fab], a[mat-stroked-button], a[mat-flat-button]", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matButton", "matAnchor"] }, { kind: "directive", type: i4.MatLegacyTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "component", type: i5.MatLegacySlider, selector: "mat-slider", inputs: ["disabled", "color", "tabIndex", "invert", "max", "min", "step", "thumbLabel", "tickInterval", "value", "displayWith", "valueText", "vertical"], outputs: ["change", "input", "valueChange"], exportAs: ["matSlider"] }, { kind: "directive", type: i6.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i6.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i6.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i6.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i6.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i6.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: i7.MatLegacyFormField, selector: "mat-form-field", inputs: ["color", "appearance", "hideRequiredMarker", "hintLabel", "floatLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7.MatLegacyLabel, selector: "mat-label" }, { kind: "component", type: i8.MatLegacySelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex"], exportAs: ["matSelect"] }, { kind: "component", type: i9.MatLegacyOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "directive", type: i10.MatLegacyInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", exportAs: ["matInput"] }, { kind: "component", type: i11.MatLegacyCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "pipe", type: CalculateSizePipe, name: "calculateSize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
569
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GuajiritosImagePickerComponent, decorators: [{
570
- type: Component,
571
- args: [{ selector: 'guajiritos-image-picker', encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, template: "<div *ngIf='!loadImage' class='place-image'>\r\n <div class='image-holder'\r\n [ngStyle]='{ width: config?.width,height: config?.height,borderRadius: config?.borderRadius}'>\r\n <button [matTooltip]=\"labels['Upload a image']\" class='image-upload-btn' mat-icon-button (click)='onUpload($event)'>\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <input #imagePicker type='file' style='display: none' [id]=\"'filePicker-' + uuidFilePicker\"\r\n (change)='handleFileSelect($event)' [accept]='imagesAllowed'>\r\n </div>\r\n</div>\r\n<div *ngIf='loadImage' class='place-image'>\r\n <div class='image-holder-loaded'\r\n [ngStyle]='{width: config?.width,height: config?.height,borderRadius: config?.borderRadius}'>\r\n <img [src]='imageSrc' alt='image-loaded' [ngStyle]='{ borderRadius: config.borderRadius }'>\r\n <input #imagePicker type='file' style='display: none' [id]=\"'filePicker-' + uuidFilePicker\"\r\n (change)='handleFileSelect($event)' [accept]='imagesAllowed'>\r\n </div>\r\n <p *ngIf='imageSrc?.length' class='mat-caption image-caption'\r\n [ngStyle]=\"{color: (imageSrc?.length | calculateSize) > 120 ? '#f44336' : 'unset',fontWeight: (imageSrc?.length | calculateSize) > 120 ? '500' : 'unset'}\">\r\n size: {{ (imageSrc?.length | calculateSize) }}Kb &nbsp; {{ format }}\r\n </p>\r\n\r\n <div class='editing-bar-btn'\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: flex-start; align-items: flex-start'>\r\n <button id='upload-img' *ngIf='!config.hideAddBtn' mat-icon-button [matTooltip]=\"labels['Upload a image']\"\r\n (click)='onUpload($event)'>\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <button id='edit-img' *ngIf='!config.hideEditBtn' mat-icon-button [matTooltip]=\"labels['Open the editor panel']\"\r\n (click)='showEditPanel = true'>\r\n <mat-icon class='mat-18'>edit</mat-icon>\r\n </button>\r\n <a id='download-img' *ngIf='!config.hideDownloadBtn' [matTooltip]=\"labels['Download the image']\"\r\n [href]='imageSrc' mat-icon-button [download]='imageName'>\r\n <mat-icon class='mat-18'>cloud_download</mat-icon>\r\n </a>\r\n <button id='delete-img' *ngIf='!config.hideDeleteBtn' mat-icon-button [matTooltip]=\"labels['Remove']\"\r\n (click)='onRemove()'>\r\n <mat-icon class='mat-18'>delete</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n\r\n<div *ngIf='showEditPanel' id='popup' class='popup'>\r\n <div\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: center flex-end; align-items: center'>\r\n <button mat-icon-button (click)='onCloseEditPanel()'>\r\n <mat-icon class='mat-18'>clear</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <div class='image-container'>\r\n <div class='image-holder-full'>\r\n <img id='image-full' [src]='imageSrc' alt=''>\r\n <div id='image-cropper' class='image-cropper'>\r\n <div id='image-cropper-header'>\r\n <mat-icon>drag_indicator</mat-icon>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class='control-panel'>\r\n <p class='title-panel'>{{ labels['Control Panel'] }}</p>\r\n\r\n <p class='item-panel'>{{ labels['Quality'] }}</p>\r\n <div\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: flex-start; align-items: flex-start'>\r\n <mat-slider [color]='color' style='max-width: 100%; width: 100%' (change)='onChangeQuality()'\r\n [(ngModel)]='quality' [min]='0' [max]='100' [step]='1' [thumbLabel]='true'>\r\n </mat-slider>\r\n </div>\r\n\r\n <p class='item-panel'>\r\n {{ labels['Max dimensions'] }}\r\n <mat-checkbox style='float: right' [(ngModel)]='maintainAspectRatio' [color]='color'>\r\n <span class='mat-caption'>{{ labels['aspect-ratio'] }}</span>\r\n </mat-checkbox>\r\n </p>\r\n <div\r\n style='margin-top: 8px !important; flex-flow: row wrap; box-sizing: border-box; display: flex; place-content: flex-start space-between; align-items: flex-start'>\r\n <mat-form-field class='no-input-style' style='max-width: 48%; width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['max-width(px)'] }}</mat-label>\r\n <input (change)='onChangeSize(true, false)' matInput [placeholder]=\"labels['max-width(px)']\"\r\n [(ngModel)]='maxWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n\r\n <mat-form-field class='no-input-style' style='max-width: 48%; width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['max-height(px)'] }}</mat-label>\r\n <input (change)='onChangeSize(false, true)' matInput [placeholder]=\"labels['max-height(px)']\"\r\n [(ngModel)]='maxHeight' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n </div>\r\n\r\n <p class='item-panel'>{{ labels['Format'] }}</p>\r\n <div\r\n style='margin-top: 8px !important; flex-direction: row; box-sizing: border-box; display: flex; place-content: flex-start; align-items: flex-start'>\r\n <mat-form-field class='no-input-style' style='max-width: 100%; width: 100%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-select [(ngModel)]='format' (selectionChange)='onChangeFormat()'>\r\n <mat-option *ngFor='let format of allFormats' [value]='format'>\r\n {{ format }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-checkbox (change)='onCropStateChange()' [(ngModel)]='showCrop' [color]='color'>\r\n <p class='item-panel'>{{ labels['Crop'] }}</p>\r\n </mat-checkbox>\r\n <button style='float: right' mat-icon-button [color]='color' (click)='onRestore()'>\r\n <mat-icon>refresh</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <ng-container *ngIf='showCrop'>\r\n <div\r\n style='margin-top: 8px !important; flex-flow: row wrap; box-sizing: border-box; display: flex; place-content: flex-start space-between; align-items: flex-start'>\r\n <mat-form-field class='no-input-style' style='max-width: 48%; width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['width(px)'] }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput [placeholder]=\"labels['width(px)']\"\r\n [(ngModel)]='cropWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n <mat-form-field class='no-input-style' style='max-width: 48%; width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['height(px)'] }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput\r\n [placeholder]=\"labels['height(px)']\" [(ngModel)]='cropHeight' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n </div>\r\n\r\n <p style='margin-bottom: 4px !important'>\r\n <button mat-icon-button [color]='color' (click)='onCrop()'>\r\n <mat-icon> crop</mat-icon>\r\n </button>\r\n </p>\r\n </ng-container>\r\n\r\n <div\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: center space-between; align-items: center'>\r\n <button mat-flat-button (click)='onCloseEditPanel()' [color]='color'\r\n style='padding: 0 8px; height: 34px; box-sizing: border-box;'>\r\n Guardar\r\n </button>\r\n\r\n <p *ngIf='imageSrc?.length' class='mat-caption image-caption'\r\n [ngStyle]=\"{color: (imageSrc?.length | calculateSize) > 120 ? '#f44336' : 'unset',fontWeight: (imageSrc?.length | calculateSize) > 120 ? '500' : 'unset'}\">\r\n size: {{ (imageSrc?.length | calculateSize) }}Kb &nbsp; {{ format }}\r\n </p>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["guachos-image-picker p{margin:0!important;padding:0!important}guachos-image-picker .place-image{flex-direction:column;box-sizing:border-box;display:flex;place-content:flex-start;align-items:center}guachos-image-picker .place-image .image-holder{flex-direction:column;box-sizing:border-box;display:flex;place-content:center;align-items:center;position:relative;width:320px;height:240px;border-radius:16px;max-width:100%!important;border:2px rgba(0,0,0,.3) solid;background-color:#fcfcfc}@media (max-width: 599px){guachos-image-picker .place-image .image-holder{max-width:100%!important;max-height:250px!important}}guachos-image-picker .place-image .image-holder .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;color:#424242}guachos-image-picker .place-image .image-holder .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px;color:#424242}@media (max-width: 599px){guachos-image-picker .place-image .image-holder .image-upload-btn{opacity:1;width:30px;height:30px}guachos-image-picker .place-image .image-holder .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}guachos-image-picker .place-image .image-holder:hover .image-upload-btn{opacity:1;transition:all .5s ease}guachos-image-picker .place-image .image-holder-loaded{flex-direction:column;box-sizing:border-box;display:flex;place-content:center;align-items:center;position:relative;max-width:100%!important;width:320px;height:240px;border-radius:4px;padding:2px}guachos-image-picker .place-image .image-holder-loaded .image-caption{position:absolute;right:0;bottom:-22px}guachos-image-picker .place-image .image-holder-loaded img{height:100%;max-height:100%;width:100%;max-width:100%;object-fit:cover;object-position:center}@media (max-width: 599px){guachos-image-picker .place-image .image-holder-loaded{max-height:195px!important}}guachos-image-picker .place-image .image-holder-loaded .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;color:#424242}guachos-image-picker .place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px;color:#424242}@media (max-width: 599px){guachos-image-picker .place-image .image-holder-loaded .image-upload-btn{opacity:1;width:30px;height:30px}guachos-image-picker .place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}guachos-image-picker .place-image .image-holder-loaded:hover .image-upload-btn{opacity:1;transition:all .5s ease}guachos-image-picker .place-image .editing-bar-btn{margin-top:2px}guachos-image-picker .place-image .editing-bar-btn .mat-icon-button{height:20px;line-height:20px;width:24px}guachos-image-picker .place-image .editing-bar-btn mat-icon{line-height:20px!important;font-size:20px!important;width:20px!important;height:20px!important}guachos-image-picker .place-image .editing-bar-btn button{margin:4px;color:#424242;transition:all .5s ease}guachos-image-picker .place-image .editing-bar-btn button:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}guachos-image-picker .place-image .editing-bar-btn a{margin:4px;color:#424242;transition:all .5s ease}guachos-image-picker .place-image .editing-bar-btn a:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}guachos-image-picker .popup{width:100vw;max-height:100%;height:100%;overflow:auto;position:fixed;top:0;left:0;background-color:#000c;z-index:1000;padding:24px;color:#fff;box-sizing:border-box;animation-name:show;animation-duration:.4s}guachos-image-picker .popup .image-container{margin-top:50px;margin-bottom:50px;height:100%;min-height:100%;min-width:100%;width:100%;flex-flow:row wrap;box-sizing:border-box;display:flex;place-content:flex-start center;align-items:flex-start}guachos-image-picker .popup .image-container .image-holder-full{height:auto;width:auto;position:relative;display:contents}guachos-image-picker .popup img{max-height:600px;max-width:100%;object-fit:cover;object-position:center;margin:8px;transition:all .5s ease}@media (max-width: 1024px){guachos-image-picker .popup{background-color:#000000d9;padding:8px}guachos-image-picker .popup img{max-height:100%;max-width:100%}}@media (max-width: 599px){guachos-image-picker .popup img{margin:0}}guachos-image-picker .popup .control-panel{color:#fff;background-color:#000000eb;margin:8px;padding:16px;max-width:100%;width:18rem;border-radius:8px;flex-direction:column;box-sizing:border-box;display:flex;place-content:stretch flex-start;align-items:stretch}@media (max-width: 599px){guachos-image-picker .popup .control-panel{margin:8px 0;width:100%}}guachos-image-picker .popup .control-panel .title-panel{padding:0 4px;font-size:17px;font-weight:500;margin-bottom:16px!important}guachos-image-picker .popup .control-panel .item-panel{padding:0 4px;font-size:14px;font-weight:500}@keyframes show{0%{top:-100vh;opacity:0}to{top:0;opacity:1}}guachos-image-picker .mat-form-field-appearance-fill .mat-form-field-flex{background-color:#fafafa!important}guachos-image-picker .mat-select-panel{background:#fafafa!important}guachos-image-picker input.mat-input-element{color:#000000d9}guachos-image-picker .mat-checkbox-background{background-color:#fff}guachos-image-picker .image-cropper{position:absolute;width:150px;height:150px;border:2.5px solid #fafafa;box-sizing:border-box;resize:both;overflow:auto;opacity:0}guachos-image-picker .image-cropper #image-cropper-header{padding:10px;cursor:move;z-index:10;background-color:transparent;height:85%}guachos-image-picker .image-cropper #image-cropper-header mat-icon{color:#fff}guachos-image-picker .btn{padding:4px 8px;border-radius:4px;cursor:pointer}guachos-image-picker .btn mat-icon{color:#000000d1}\n"] }]
572
- }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { appearance: [{
573
- type: Input
574
- }], color: [{
575
- type: Input
576
- }], imagesAllowed: [{
577
- type: Input
578
- }], imagePicker: [{
579
- type: ViewChild,
580
- args: ['imagePicker', { static: false }]
581
- }], $imageChanged: [{
582
- type: Output
583
- }], $imageOriginal: [{
584
- type: Output
585
- }], _imageSrc: [{
586
- type: Input
587
- }], _config: [{
588
- type: Input
589
- }] } });
590
-
591
- class GuajiritosImagePickerModule {
592
- }
593
- GuajiritosImagePickerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GuajiritosImagePickerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
594
- GuajiritosImagePickerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.1.4", ngImport: i0, type: GuajiritosImagePickerModule, declarations: [GuajiritosImagePickerComponent, CalculateSizePipe], imports: [CommonModule,
595
- MatIconModule,
596
- MatLegacyButtonModule,
597
- MatLegacyTooltipModule,
598
- MatLegacySliderModule,
599
- FormsModule,
600
- ReactiveFormsModule,
601
- MatLegacyFormFieldModule,
602
- MatLegacySelectModule,
603
- MatLegacyInputModule,
604
- MatLegacyCheckboxModule], exports: [GuajiritosImagePickerComponent] });
605
- GuajiritosImagePickerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GuajiritosImagePickerModule, imports: [CommonModule,
606
- MatIconModule,
607
- MatLegacyButtonModule,
608
- MatLegacyTooltipModule,
609
- MatLegacySliderModule,
610
- FormsModule,
611
- ReactiveFormsModule,
612
- MatLegacyFormFieldModule,
613
- MatLegacySelectModule,
614
- MatLegacyInputModule,
615
- MatLegacyCheckboxModule] });
616
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.1.4", ngImport: i0, type: GuajiritosImagePickerModule, decorators: [{
617
- type: NgModule,
618
- args: [{
619
- declarations: [GuajiritosImagePickerComponent, CalculateSizePipe],
620
- imports: [
621
- CommonModule,
622
- MatIconModule,
623
- MatLegacyButtonModule,
624
- MatLegacyTooltipModule,
625
- MatLegacySliderModule,
626
- FormsModule,
627
- ReactiveFormsModule,
628
- MatLegacyFormFieldModule,
629
- MatLegacySelectModule,
630
- MatLegacyInputModule,
631
- MatLegacyCheckboxModule,
632
- ],
633
- exports: [GuajiritosImagePickerComponent],
634
- }]
49
+ class CalculateSizeModule {
50
+ }
51
+ CalculateSizeModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: CalculateSizeModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
52
+ CalculateSizeModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.3", ngImport: i0, type: CalculateSizeModule, declarations: [CalculateSizePipe], exports: [CalculateSizePipe] });
53
+ CalculateSizeModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: CalculateSizeModule });
54
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: CalculateSizeModule, decorators: [{
55
+ type: NgModule,
56
+ args: [{
57
+ declarations: [CalculateSizePipe],
58
+ exports: [CalculateSizePipe],
59
+ }]
635
60
  }] });
636
61
 
637
- /*
638
- * Public API Surface of guachos-image-picker
62
+ class GuajiritosImagePicker {
63
+ constructor(_cdRef) {
64
+ this._cdRef = _cdRef;
65
+ this.unsubscribeAll$ = new Subject();
66
+ this.observer = null;
67
+ this.labelEn = {
68
+ 'Upload a image': 'Upload a image',
69
+ 'You must edit the image in order to resize it': 'You must edit the image in order to resize it',
70
+ 'too large': 'too large',
71
+ 'Open the editor panel': 'Open the editor panel',
72
+ 'Download the image': 'Download the image',
73
+ 'Control Panel': 'Control Panel',
74
+ Quality: 'Quality',
75
+ save: 'Save',
76
+ 'Max dimensions': 'Max dimensions',
77
+ 'aspect-ratio': 'aspect-ratio',
78
+ 'max-width(px)': 'max-width(px)',
79
+ 'max-height(px)': 'max-height(px)',
80
+ Format: 'Format',
81
+ Crop: 'Crop',
82
+ 'width(px)': 'width(px)',
83
+ 'height(px)': 'height(px)',
84
+ Remove: 'Remove',
85
+ };
86
+ this.labelEs = {
87
+ 'Upload a image': 'Suba una imagen',
88
+ 'You must edit the image in order to resize it': 'Debe editar la imagen para disminuir su tamaño',
89
+ 'too large': 'muy grande',
90
+ 'Open the editor panel': 'Abra el panel de edición',
91
+ 'Download the image': 'Descargue la imagen',
92
+ 'Control Panel': 'Panel de control',
93
+ Remove: 'Quitar',
94
+ save: 'Guardar',
95
+ Quality: 'Calidad',
96
+ 'Max dimensions': 'Dimensiones',
97
+ 'aspect-ratio': 'relación-aspecto',
98
+ 'max-width(px)': 'max. ancho',
99
+ 'max-height(px)': 'max. alto',
100
+ Format: 'Formato',
101
+ Crop: 'Recortar',
102
+ 'width(px)': 'ancho(px)',
103
+ 'height(px)': 'altura(px)',
104
+ };
105
+ this.arrayCopiedImages = [];
106
+ this.config = {
107
+ height: '240px',
108
+ width: '320px',
109
+ borderRadius: '16px',
110
+ compressInitial: true,
111
+ language: 'en',
112
+ hideDeleteBtn: false,
113
+ hideDownloadBtn: false,
114
+ hideEditBtn: false,
115
+ hideAddBtn: false,
116
+ };
117
+ this.showCrop = false;
118
+ this.loadImage = false;
119
+ this.uuidFilePicker = Date.now().toString(20);
120
+ this.showEditPanel = false;
121
+ this.quality = 92;
122
+ this.format = 'jpeg';
123
+ this.allFormats = ['webp', 'jpeg', 'png'];
124
+ this.maxHeight = 2000;
125
+ this.maxWidth = 2000;
126
+ this.cropHeight = 150;
127
+ this.cropWidth = 150;
128
+ this.maintainAspectRatio = true;
129
+ this.imageName = 'download';
130
+ this.labels = this.labelEn;
131
+ this.appearance = 'outline';
132
+ this.color = 'primary';
133
+ this.imagesAllowed = 'image/*';
134
+ this.$imageChanged = new EventEmitter();
135
+ this.$imageOriginal = new EventEmitter();
136
+ }
137
+ set _imageSrc(image) {
138
+ if (image) {
139
+ let types = image.split('.');
140
+ this.format = types[types.length - 1];
141
+ if (!this.format || (this.format !== 'png' && this.format !== 'jpeg' && this.format !== 'webp')) {
142
+ this.format = 'jpeg';
143
+ }
144
+ this.imageSrc = image;
145
+ this.arrayCopiedImages = [];
146
+ this.arrayCopiedImages.push(this.imageSrc);
147
+ this.originImageSrc = image;
148
+ this.lastOriginSrc = image;
149
+ this.$imageOriginal.next(this.originImageSrc);
150
+ this.loadImage = true;
151
+ this._cdRef.detectChanges();
152
+ }
153
+ else {
154
+ this.imageSrc = null;
155
+ this.originImageSrc = null;
156
+ this.loadImage = false;
157
+ this.arrayCopiedImages = [];
158
+ this.lastOriginSrc = null;
159
+ this.$imageOriginal.next(null);
160
+ this.format = 'jpeg';
161
+ this.maxHeight = 2000;
162
+ this.maxWidth = 2000;
163
+ this.cropHeight = 150;
164
+ this.cropWidth = 150;
165
+ this.maintainAspectRatio = true;
166
+ this.showEditPanel = false;
167
+ this._cdRef.detectChanges();
168
+ }
169
+ }
170
+ set _config(value) {
171
+ if (value && value.constructor == Object) {
172
+ this.config = Object.assign(Object.assign({}, this.config), value);
173
+ if ((value === null || value === void 0 ? void 0 : value.language) !== undefined) {
174
+ if (value.language === 'es') {
175
+ this.labels = Object.assign({}, this.labelEs);
176
+ }
177
+ if (value.language === 'en') {
178
+ this.labels = Object.assign({}, this.labelEn);
179
+ }
180
+ }
181
+ }
182
+ }
183
+ handleReaderLoaded(readerEvt) {
184
+ var _a;
185
+ return __awaiter(this, void 0, void 0, function* () {
186
+ const binaryString = readerEvt.target.result;
187
+ const base64textString = btoa(binaryString);
188
+ this.originImageSrc = this.urlImage + base64textString;
189
+ this.lastOriginSrc = this.urlImage + base64textString;
190
+ if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.compressInitial) {
191
+ this.quality = 92;
192
+ const input = {
193
+ dataType: this.format,
194
+ quality: 0.92,
195
+ maintainRatio: true,
196
+ };
197
+ this.imageSrc = yield this.resizeDataURL(this.urlImage + base64textString, input);
198
+ }
199
+ else {
200
+ this.imageSrc = this.urlImage + base64textString;
201
+ this.arrayCopiedImages = [];
202
+ this.arrayCopiedImages.push({
203
+ lastImage: this.imageSrc,
204
+ width: this.maxWidth,
205
+ height: this.maxHeight,
206
+ quality: this.quality,
207
+ });
208
+ this.$imageOriginal.next(this.imageSrc);
209
+ }
210
+ this.$imageChanged.next(this.imageSrc);
211
+ this.loadImage = true;
212
+ this._cdRef.detectChanges();
213
+ });
214
+ }
215
+ resizeDataURL(datas, input) {
216
+ return __awaiter(this, void 0, void 0, function* () {
217
+ return yield new Promise(function (resolve) {
218
+ var _a;
219
+ return __awaiter(this, void 0, void 0, function* () {
220
+ let img = document.createElement('img');
221
+ img.src = datas + '';
222
+ img.crossOrigin = 'Anonymous';
223
+ let quality = (_a = input === null || input === void 0 ? void 0 : input.quality) !== null && _a !== void 0 ? _a : 1.0;
224
+ let maintainRatio = input.maintainRatio !== undefined ? input.maintainRatio : true;
225
+ img.onload = function () {
226
+ var _a, _b;
227
+ const canvas = document.createElement('canvas');
228
+ const ctx = canvas.getContext('2d');
229
+ let ratio = img.width / img.height;
230
+ let width = (_a = input === null || input === void 0 ? void 0 : input.width) !== null && _a !== void 0 ? _a : img.width;
231
+ let height = (_b = input === null || input === void 0 ? void 0 : input.height) !== null && _b !== void 0 ? _b : img.height;
232
+ if (maintainRatio) {
233
+ if (input.changeHeight) {
234
+ canvas.width = height * ratio;
235
+ canvas.height = height;
236
+ }
237
+ else {
238
+ canvas.width = width;
239
+ canvas.height = width / ratio;
240
+ }
241
+ }
242
+ else {
243
+ canvas.width = width;
244
+ canvas.height = height;
245
+ }
246
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
247
+ let type = input.dataType ? input.dataType : 'webp';
248
+ const dataURI = canvas.toDataURL(`image/${type}`, quality);
249
+ resolve({
250
+ dataUri: dataURI,
251
+ width: canvas.width,
252
+ height: canvas.height,
253
+ });
254
+ };
255
+ });
256
+ }).then((data) => {
257
+ var _a;
258
+ this.maxHeight = data === null || data === void 0 ? void 0 : data.height;
259
+ this.maxWidth = data === null || data === void 0 ? void 0 : data.width;
260
+ if (((_a = this.arrayCopiedImages) === null || _a === void 0 ? void 0 : _a.length) <= 20) {
261
+ this.arrayCopiedImages.push({
262
+ lastImage: data === null || data === void 0 ? void 0 : data.dataUri,
263
+ width: this.maxWidth,
264
+ height: this.maxHeight,
265
+ quality: this.quality,
266
+ });
267
+ }
268
+ return data.dataUri;
269
+ });
270
+ });
271
+ }
272
+ wait(ms) {
273
+ ms = ms ? ms : 1000;
274
+ return new Promise((resolve) => {
275
+ setTimeout(() => {
276
+ return resolve(true);
277
+ }, ms);
278
+ });
279
+ }
280
+ dragElement(element) {
281
+ let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
282
+ let el = document.getElementById(element.id + '-header');
283
+ if (el) {
284
+ el.onmousedown = dragMouseDown;
285
+ el.ontouchstart = dragMouseDown;
286
+ }
287
+ else {
288
+ element.onmousedown = dragMouseDown;
289
+ element.ontouchstart = dragMouseDown;
290
+ }
291
+ function dragMouseDown(e) {
292
+ e = e || window.event;
293
+ e === null || e === void 0 ? void 0 : e.preventDefault();
294
+ pos3 = e === null || e === void 0 ? void 0 : e.clientX;
295
+ pos4 = e === null || e === void 0 ? void 0 : e.clientY;
296
+ document.onmouseup = closeDragElement;
297
+ document.ontouchend = closeDragElement;
298
+ document.onmousemove = elementDrag;
299
+ document.ontouchmove = elementDrag;
300
+ }
301
+ function elementDrag(e) {
302
+ let holderImage = document.getElementById('image-full');
303
+ e = e || window.event;
304
+ e === null || e === void 0 ? void 0 : e.preventDefault();
305
+ pos1 = pos3 - (e === null || e === void 0 ? void 0 : e.clientX);
306
+ pos2 = pos4 - (e === null || e === void 0 ? void 0 : e.clientY);
307
+ pos3 = e === null || e === void 0 ? void 0 : e.clientX;
308
+ pos4 = e === null || e === void 0 ? void 0 : e.clientY;
309
+ const newTop = element.offsetTop - pos2;
310
+ const newLeft = element.offsetLeft - pos1;
311
+ const rectHolder = holderImage.getBoundingClientRect();
312
+ const rectElement = element.getBoundingClientRect();
313
+ if (newTop >= rectHolder.y + 8) {
314
+ element.style.top = Math.min(newTop, rectHolder.y + rectHolder.height - rectElement.height - 4) + 'px';
315
+ }
316
+ if (newLeft > rectHolder.x + 4 && rectHolder.x + rectHolder.width > rectElement.x + rectElement.width + 2) {
317
+ element.style.left = Math.min(newLeft, rectHolder.x + rectHolder.width - rectElement.width - 4) + 'px';
318
+ }
319
+ }
320
+ function closeDragElement() {
321
+ document.onmouseup = null;
322
+ document.onmousemove = null;
323
+ document.ontouchend = null;
324
+ document.ontouchmove = null;
325
+ }
326
+ }
327
+ onUpload(event) {
328
+ var _a;
329
+ event.preventDefault();
330
+ (_a = this.imagePicker) === null || _a === void 0 ? void 0 : _a.nativeElement.click();
331
+ }
332
+ handleFileSelect(evt) {
333
+ var _a;
334
+ const files = (_a = evt.target) === null || _a === void 0 ? void 0 : _a.files;
335
+ if (files) {
336
+ const file = files[0];
337
+ this.imageName = file.name.split('.')[0];
338
+ this.fileType = file.type;
339
+ this.urlImage = `data:${file.type};base64,`;
340
+ if (files && file) {
341
+ const reader = new FileReader();
342
+ reader.onload = this.handleReaderLoaded.bind(this);
343
+ reader.readAsBinaryString(file);
344
+ }
345
+ }
346
+ }
347
+ onCloseEditPanel() {
348
+ if (this.observer instanceof ResizeObserver) {
349
+ let imageCropper = document.getElementById('image-cropper');
350
+ let imageFull = document.getElementById('image-full');
351
+ this.observer.unobserve(imageCropper);
352
+ this.observer.unobserve(imageFull);
353
+ }
354
+ this.showCrop = false;
355
+ this.showEditPanel = false;
356
+ }
357
+ onChangeQuality() {
358
+ var _a, _b;
359
+ return __awaiter(this, void 0, void 0, function* () {
360
+ const qualityItem = this.quality / 100;
361
+ this.maxHeight = (_a = this.maxHeight) !== null && _a !== void 0 ? _a : 2000;
362
+ this.maxWidth = (_b = this.maxWidth) !== null && _b !== void 0 ? _b : 2000;
363
+ yield this.wait(250);
364
+ try {
365
+ const input = {
366
+ height: this.maxHeight,
367
+ width: this.maxWidth,
368
+ dataType: this.format,
369
+ quality: qualityItem,
370
+ maintainRatio: this.maintainAspectRatio,
371
+ };
372
+ this.imageSrc = yield this.resizeDataURL(this.originImageSrc, input);
373
+ this.$imageChanged.next(this.imageSrc);
374
+ this.loadImage = true;
375
+ this._cdRef.detectChanges();
376
+ }
377
+ catch (error) {
378
+ this.loadImage = true;
379
+ this._cdRef.detectChanges();
380
+ }
381
+ });
382
+ }
383
+ onChangeFormat() {
384
+ var _a, _b;
385
+ return __awaiter(this, void 0, void 0, function* () {
386
+ let qualityItem = this.quality / 100;
387
+ this.maxHeight = (_a = this.maxHeight) !== null && _a !== void 0 ? _a : 2000;
388
+ this.maxWidth = (_b = this.maxWidth) !== null && _b !== void 0 ? _b : 2000;
389
+ yield this.wait(250);
390
+ try {
391
+ let input = {
392
+ height: this.maxHeight,
393
+ width: this.maxWidth,
394
+ dataType: this.format,
395
+ quality: qualityItem,
396
+ maintainRatio: this.maintainAspectRatio,
397
+ };
398
+ this.imageSrc = yield this.resizeDataURL(this.originImageSrc, input);
399
+ this.$imageChanged.next(this.imageSrc);
400
+ this.loadImage = true;
401
+ this._cdRef.detectChanges();
402
+ }
403
+ catch (error) {
404
+ this.loadImage = true;
405
+ this._cdRef.detectChanges();
406
+ }
407
+ });
408
+ }
409
+ onChangeSize(changeWidth, changeHeight) {
410
+ var _a, _b;
411
+ return __awaiter(this, void 0, void 0, function* () {
412
+ let qualityItem = this.quality / 100;
413
+ this.maxHeight = (_a = this.maxHeight) !== null && _a !== void 0 ? _a : 2000;
414
+ this.maxWidth = (_b = this.maxWidth) !== null && _b !== void 0 ? _b : 2000;
415
+ yield this.wait(500);
416
+ try {
417
+ let input = {
418
+ height: this.maxHeight,
419
+ width: this.maxWidth,
420
+ dataType: this.format,
421
+ quality: qualityItem,
422
+ maintainRatio: this.maintainAspectRatio,
423
+ changeHeight: changeHeight,
424
+ changeWidth: changeWidth,
425
+ };
426
+ this.imageSrc = yield this.resizeDataURL(this.originImageSrc, input);
427
+ this.$imageChanged.next(this.imageSrc);
428
+ this.loadImage = true;
429
+ this._cdRef.detectChanges();
430
+ }
431
+ catch (error) {
432
+ this.loadImage = true;
433
+ this._cdRef.detectChanges();
434
+ }
435
+ });
436
+ }
437
+ onChangeCrop() {
438
+ const cropper = document.getElementById('image-cropper');
439
+ cropper.style.width = this.cropWidth + 'px';
440
+ cropper.style.height = this.cropHeight + 'px';
441
+ }
442
+ onCropStateChange() {
443
+ const cropper = document.getElementById('image-cropper');
444
+ if (this.showCrop) {
445
+ cropper.style.opacity = '1.0';
446
+ this.dragElement(cropper);
447
+ this.observer = new ResizeObserver((entries) => {
448
+ entries.forEach((entry) => {
449
+ if (this.showEditPanel) {
450
+ const elementCropper = document.getElementById('image-cropper');
451
+ const elementFull = document.getElementById('image-full');
452
+ const rectHolder = elementFull.getBoundingClientRect();
453
+ const rectElement = elementCropper.getBoundingClientRect();
454
+ const maxWidth = rectHolder.x + rectHolder.width - rectElement.x - 4;
455
+ const maxHeight = rectHolder.y + rectHolder.height - rectElement.y - 4;
456
+ elementCropper.style.maxWidth = maxWidth + 'px';
457
+ elementCropper.style.maxHeight = maxHeight + 'px';
458
+ this.cropWidth = rectElement.width;
459
+ this.cropHeight = rectElement.height;
460
+ if (entry.target.id == 'image-full') {
461
+ if (rectHolder.top > 0) {
462
+ elementCropper.style.top = rectHolder.top + 4 + 'px';
463
+ }
464
+ elementCropper.style.left = rectHolder.left + 4 + 'px';
465
+ }
466
+ }
467
+ });
468
+ });
469
+ this.observer.observe(document.getElementById('image-cropper'));
470
+ this.observer.observe(document.getElementById('image-full'));
471
+ }
472
+ else {
473
+ cropper.style.opacity = '0.0';
474
+ if (this.observer instanceof ResizeObserver) {
475
+ const elementCropper = document.getElementById('image-cropper');
476
+ const elementFull = document.getElementById('image-full');
477
+ this.observer.unobserve(elementCropper);
478
+ this.observer.unobserve(elementFull);
479
+ }
480
+ }
481
+ }
482
+ onCrop(type) {
483
+ type = type !== null && type !== void 0 ? type : this.format;
484
+ const cropper = document.getElementById('image-cropper');
485
+ const elementFull = document.getElementById('image-full');
486
+ const rectCropper = cropper.getBoundingClientRect();
487
+ const dataHolderRect = elementFull.getBoundingClientRect();
488
+ const canvas = document.createElement('canvas');
489
+ new Promise((resolve, reject) => {
490
+ let ctx = canvas.getContext('2d');
491
+ let image = new Image();
492
+ image.src = this.imageSrc;
493
+ image.onload = () => {
494
+ let ratio = image.height / dataHolderRect.height;
495
+ let newWidth = rectCropper.width * ratio;
496
+ let newHeight = rectCropper.height * ratio;
497
+ canvas.height = newHeight;
498
+ canvas.width = newWidth;
499
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(image, Math.abs(rectCropper.x * ratio) - Math.abs(dataHolderRect.x * ratio), Math.abs(rectCropper.y * ratio) - Math.abs(dataHolderRect.y * ratio), newWidth, newHeight, 0, 0, newWidth, newHeight);
500
+ // ctx.drawImage(image, 90, 130, 50, 60, 10, 10, 50, 60);
501
+ resolve(canvas.toDataURL(`image/${type}`, 0.98));
502
+ };
503
+ image.onerror = (e) => {
504
+ reject(e);
505
+ };
506
+ })
507
+ .then((dataUri) => {
508
+ this.imageSrc = dataUri;
509
+ this.showCrop = false;
510
+ this.onCropStateChange();
511
+ this.maxWidth = canvas.width;
512
+ this.maxHeight = canvas.height;
513
+ this.lastOriginSrc = this.originImageSrc + '';
514
+ this.originImageSrc = dataUri;
515
+ this.$imageChanged.next(this.imageSrc);
516
+ })
517
+ .catch((e) => {
518
+ console.log(e);
519
+ });
520
+ }
521
+ onRestore() {
522
+ if (this.arrayCopiedImages.length) {
523
+ let lastState = this.arrayCopiedImages.pop();
524
+ this.imageSrc = lastState.lastImage;
525
+ this.maxWidth = lastState.width;
526
+ this.maxHeight = lastState.height;
527
+ this.originImageSrc = this.lastOriginSrc + '';
528
+ this._cdRef.detectChanges();
529
+ }
530
+ else {
531
+ this.imageSrc = this.lastOriginSrc;
532
+ this.originImageSrc = this.lastOriginSrc + '';
533
+ this._cdRef.detectChanges();
534
+ }
535
+ this.$imageChanged.next(this.imageSrc);
536
+ }
537
+ onRemove() {
538
+ this.imageSrc = null;
539
+ this.originImageSrc = null;
540
+ this.loadImage = false;
541
+ this.arrayCopiedImages = [];
542
+ this.lastOriginSrc = null;
543
+ this.$imageOriginal.next(null);
544
+ this.$imageChanged.next(null);
545
+ this.format = 'jpeg';
546
+ this.maxHeight = 2000;
547
+ this.maxWidth = 2000;
548
+ this.cropHeight = 150;
549
+ this.cropWidth = 150;
550
+ this.maintainAspectRatio = true;
551
+ this.showEditPanel = false;
552
+ this._cdRef.detectChanges();
553
+ }
554
+ ngOnDestroy() {
555
+ this.unsubscribeAll$.next();
556
+ this.unsubscribeAll$.complete();
557
+ }
558
+ }
559
+ GuajiritosImagePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: GuajiritosImagePicker, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
560
+ GuajiritosImagePicker.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.3", type: GuajiritosImagePicker, isStandalone: true, selector: "guajiritos-image-picker", inputs: { appearance: "appearance", color: "color", imagesAllowed: "imagesAllowed", _imageSrc: "_imageSrc", _config: "_config" }, outputs: { $imageChanged: "$imageChanged", $imageOriginal: "$imageOriginal" }, viewQueries: [{ propertyName: "imagePicker", first: true, predicate: ["imagePicker"], descendants: true }], ngImport: i0, template: "<div *ngIf='!loadImage' class='place-image'>\r\n <div class='image-holder'\r\n [ngStyle]='{ width: config?.width,height: config?.height,borderRadius: config?.borderRadius}'>\r\n <button [matTooltip]=\"labels['Upload a image']\" class='image-upload-btn' mat-icon-button (click)='onUpload($event)'>\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <input #imagePicker type='file' style='display: none' [id]=\"'filePicker-' + uuidFilePicker\"\r\n (change)='handleFileSelect($event)' [accept]='imagesAllowed'>\r\n </div>\r\n</div>\r\n<div *ngIf='loadImage' class='place-image'>\r\n <div class='image-holder-loaded'\r\n [ngStyle]='{width: config?.width,height: config?.height,borderRadius: config?.borderRadius}'>\r\n <img [src]='imageSrc' alt='image-loaded' [ngStyle]='{ borderRadius: config.borderRadius }'>\r\n <input #imagePicker type='file' style='display: none' [id]=\"'filePicker-' + uuidFilePicker\"\r\n (change)='handleFileSelect($event)' [accept]='imagesAllowed'>\r\n </div>\r\n <p *ngIf='imageSrc?.length' class='mat-caption image-caption'\r\n [ngStyle]=\"{color: (imageSrc?.length | calculateSize) > 120 ? '#f44336' : 'unset',fontWeight: (imageSrc?.length | calculateSize) > 120 ? '500' : 'unset'}\">\r\n size: {{ (imageSrc?.length | calculateSize) }}Kb &nbsp; {{ format }}\r\n </p>\r\n\r\n <div class='editing-bar-btn'\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: flex-start; align-items: flex-start'>\r\n <button id='upload-img' *ngIf='!config.hideAddBtn' mat-icon-button [matTooltip]=\"labels['Upload a image']\"\r\n (click)='onUpload($event)'>\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <button id='edit-img' *ngIf='!config.hideEditBtn' mat-icon-button [matTooltip]=\"labels['Open the editor panel']\"\r\n (click)='showEditPanel = true'>\r\n <mat-icon class='mat-18'>edit</mat-icon>\r\n </button>\r\n <a id='download-img' *ngIf='!config.hideDownloadBtn' [matTooltip]=\"labels['Download the image']\"\r\n [href]='imageSrc' mat-icon-button [download]='imageName'>\r\n <mat-icon class='mat-18'>cloud_download</mat-icon>\r\n </a>\r\n <button id='delete-img' *ngIf='!config.hideDeleteBtn' mat-icon-button [matTooltip]=\"labels['Remove']\"\r\n (click)='onRemove()'>\r\n <mat-icon class='mat-18'>delete</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n\r\n<div *ngIf='showEditPanel' id='popup' class='popup'>\r\n <div\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: center flex-end; align-items: center'>\r\n <button mat-icon-button (click)='onCloseEditPanel()'>\r\n <mat-icon class='mat-18'>clear</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <div class='image-container'>\r\n <div class='image-holder-full'>\r\n <img id='image-full' [src]='imageSrc' alt=''>\r\n <div id='image-cropper' class='image-cropper'>\r\n <div id='image-cropper-header'>\r\n <mat-icon>drag_indicator</mat-icon>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class='control-panel'>\r\n <p class='title-panel'>{{ labels['Control Panel'] }}</p>\r\n\r\n <p class='item-panel'>{{ labels['Quality'] }}</p>\r\n <div\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: flex-start; align-items: flex-start'>\r\n <mat-slider ngDefaultControl [color]='color' style='max-width: 100%; width: 100%' (change)='onChangeQuality()'\r\n [max]='100' [min]='0' [step]='1' [discrete]='true' [showTickMarks]='true'>\r\n <input matSliderThumb [(ngModel)]='quality'>\r\n </mat-slider>\r\n </div>\r\n\r\n <div class='item-panel'>\r\n <span>{{ labels['Max dimensions'] }}</span>\r\n <mat-checkbox style='float: right' [(ngModel)]='maintainAspectRatio' [color]='color'>\r\n <span class='mat-caption'>{{ labels['aspect-ratio'] }}</span>\r\n </mat-checkbox>\r\n </div>\r\n\r\n <div\r\n style='margin-top: 16px !important; flex-flow: row; box-sizing: border-box; display: flex; place-content: flex-start space-between; align-items: flex-start'>\r\n <mat-form-field style='width: 48%' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ labels['max-width(px)'] }}</mat-label>\r\n <input (change)='onChangeSize(true, false)' matInput [placeholder]=\"labels['max-width(px)']\"\r\n [(ngModel)]='maxWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n\r\n <mat-form-field style='width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['max-height(px)'] }}</mat-label>\r\n <input (change)='onChangeSize(false, true)' matInput [placeholder]=\"labels['max-height(px)']\"\r\n [(ngModel)]='maxHeight' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n </div>\r\n\r\n <p class='item-panel'>{{ labels['Format'] }}</p>\r\n <div\r\n style='margin-top: 8px !important; flex-direction: row; box-sizing: border-box; display: flex; place-content: flex-start; align-items: flex-start'>\r\n <mat-form-field style='max-width: 100%; width: 100%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-select [(ngModel)]='format' (selectionChange)='onChangeFormat()'>\r\n <mat-option *ngFor='let format of allFormats' [value]='format'>\r\n {{ format }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-checkbox (change)='onCropStateChange()' [(ngModel)]='showCrop' [color]='color'>\r\n <p class='item-panel'>{{ labels['Crop'] }}</p>\r\n </mat-checkbox>\r\n <button style='float: right' mat-icon-button [color]='color' (click)='onRestore()'>\r\n <mat-icon>refresh</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <ng-container *ngIf='showCrop'>\r\n <div\r\n style='margin-top: 8px !important; flex-flow: row wrap; box-sizing: border-box; display: flex; place-content: flex-start space-between; align-items: flex-start'>\r\n <mat-form-field style='max-width: 48%; width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['width(px)'] }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput [placeholder]=\"labels['width(px)']\"\r\n [(ngModel)]='cropWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n <mat-form-field style='max-width: 48%; width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['height(px)'] }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput\r\n [placeholder]=\"labels['height(px)']\" [(ngModel)]='cropHeight' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n </div>\r\n\r\n <p style='margin-bottom: 4px !important'>\r\n <button mat-icon-button [color]='color' (click)='onCrop()'>\r\n <mat-icon> crop</mat-icon>\r\n </button>\r\n </p>\r\n </ng-container>\r\n\r\n <div\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: center space-between; align-items: center'>\r\n <button mat-flat-button (click)='onCloseEditPanel()' [color]='color'\r\n style='padding: 0 8px; height: 34px; box-sizing: border-box;'>\r\n {{labels['save']}}\r\n </button>\r\n\r\n <p *ngIf='imageSrc?.length' class='mat-caption image-caption'\r\n [ngStyle]=\"{color: (imageSrc?.length | calculateSize) > 120 ? '#f44336' : 'unset',fontWeight: (imageSrc?.length | calculateSize) > 120 ? '500' : 'unset'}\">\r\n size: {{ (imageSrc?.length | calculateSize) }}Kb &nbsp; {{ format }}\r\n </p>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["guajiritos-image-picker p{margin:0!important;padding:0!important}guajiritos-image-picker .place-image{flex-direction:column;box-sizing:border-box;display:flex;place-content:flex-start;align-items:center}guajiritos-image-picker .place-image .image-holder{flex-direction:column;box-sizing:border-box;display:flex;place-content:center;align-items:center;position:relative;width:320px;height:240px;border-radius:16px;max-width:100%!important;border:2px rgba(0,0,0,.3) solid;background-color:#fcfcfc}@media (max-width: 599px){guajiritos-image-picker .place-image .image-holder{max-width:100%!important;max-height:250px!important}}guajiritos-image-picker .place-image .image-holder .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;color:#424242}guajiritos-image-picker .place-image .image-holder .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px;color:#424242}@media (max-width: 599px){guajiritos-image-picker .place-image .image-holder .image-upload-btn{opacity:1;width:30px;height:30px}guajiritos-image-picker .place-image .image-holder .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}guajiritos-image-picker .place-image .image-holder:hover .image-upload-btn{opacity:1;transition:all .5s ease}guajiritos-image-picker .place-image .image-holder-loaded{flex-direction:column;box-sizing:border-box;display:flex;place-content:center;align-items:center;position:relative;max-width:100%!important;width:320px;height:240px;border-radius:4px;padding:2px}guajiritos-image-picker .place-image .image-holder-loaded .image-caption{position:absolute;right:0;bottom:-22px}guajiritos-image-picker .place-image .image-holder-loaded img{height:100%;max-height:100%;width:100%;max-width:100%;object-fit:cover;object-position:center}@media (max-width: 599px){guajiritos-image-picker .place-image .image-holder-loaded{max-height:195px!important}}guajiritos-image-picker .place-image .image-holder-loaded .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;color:#424242}guajiritos-image-picker .place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px;color:#424242}@media (max-width: 599px){guajiritos-image-picker .place-image .image-holder-loaded .image-upload-btn{opacity:1;width:30px;height:30px}guajiritos-image-picker .place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}guajiritos-image-picker .place-image .image-holder-loaded:hover .image-upload-btn{opacity:1;transition:all .5s ease}guajiritos-image-picker .place-image .editing-bar-btn{margin-top:2px}guajiritos-image-picker .place-image .editing-bar-btn .mat-icon-button{height:20px;line-height:20px;width:24px}guajiritos-image-picker .place-image .editing-bar-btn mat-icon{line-height:20px!important;font-size:20px!important;width:20px!important;height:20px!important}guajiritos-image-picker .place-image .editing-bar-btn button{margin:4px;color:#424242;transition:all .5s ease}guajiritos-image-picker .place-image .editing-bar-btn button:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}guajiritos-image-picker .place-image .editing-bar-btn a{margin:4px;color:#424242;transition:all .5s ease}guajiritos-image-picker .place-image .editing-bar-btn a:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}guajiritos-image-picker .popup{width:100vw;max-height:100%;height:100%;overflow:auto;position:fixed;top:0;left:0;background-color:#000c;z-index:1000;padding:24px;color:#fff;box-sizing:border-box;animation-name:show;animation-duration:.4s}guajiritos-image-picker .popup .image-container{margin-top:50px;margin-bottom:50px;height:100%;min-height:100%;min-width:100%;width:100%;flex-flow:row wrap;box-sizing:border-box;display:flex;place-content:flex-start center;align-items:flex-start}guajiritos-image-picker .popup .image-container .image-holder-full{height:auto;width:auto;position:relative;display:contents}guajiritos-image-picker .popup img{max-height:600px;max-width:100%;object-fit:cover;object-position:center;margin:8px;transition:all .5s ease}@media (max-width: 1024px){guajiritos-image-picker .popup{background-color:#000000d9;padding:8px}guajiritos-image-picker .popup img{max-height:100%;max-width:100%}}@media (max-width: 599px){guajiritos-image-picker .popup img{margin:0}}guajiritos-image-picker .popup .control-panel{color:#fff;background-color:#000000eb;margin:8px;padding:16px;max-width:100%;width:18rem;border-radius:8px;flex-direction:column;box-sizing:border-box;display:flex;place-content:stretch flex-start;align-items:stretch}@media (max-width: 599px){guajiritos-image-picker .popup .control-panel{margin:8px 0;width:100%}}guajiritos-image-picker .popup .control-panel .title-panel{padding:0 4px;font-size:17px;font-weight:500;margin-bottom:16px!important}guajiritos-image-picker .popup .control-panel .item-panel{padding:0 4px!important;font-size:14px;font-weight:500;display:flex;align-items:center;gap:4px}@keyframes show{0%{top:-100vh;opacity:0}to{top:0;opacity:1}}guajiritos-image-picker .mat-form-field-appearance-fill .mat-form-field-flex{background-color:#fafafa!important}guajiritos-image-picker .mat-select-panel{background:#fafafa!important}guajiritos-image-picker input.mat-input-element{color:#000000d9}guajiritos-image-picker .mat-checkbox-background{background-color:#fff}guajiritos-image-picker .image-cropper{position:absolute;width:150px;height:150px;border:2.5px solid #fafafa;box-sizing:border-box;resize:both;overflow:auto;opacity:0}guajiritos-image-picker .image-cropper #image-cropper-header{padding:10px;cursor:move;z-index:10;background-color:transparent;height:85%}guajiritos-image-picker .image-cropper #image-cropper-header mat-icon{color:#fff}guajiritos-image-picker .btn{padding:4px 8px;border-radius:4px;cursor:pointer}guajiritos-image-picker .btn mat-icon{color:#000000d1}\n"], dependencies: [{ kind: "directive", type: NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i1.MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i1.MatIconAnchor, selector: "a[mat-icon-button]", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i1.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "ngmodule", type: MatTooltipModule }, { kind: "directive", type: i2.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i3.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: CalculateSizeModule }, { kind: "pipe", type: CalculateSizePipe, name: "calculateSize" }, { kind: "ngmodule", type: MatSliderModule }, { kind: "component", type: i5.MatSlider, selector: "mat-slider", inputs: ["color", "disableRipple", "disabled", "discrete", "showTickMarks", "min", "max", "step", "displayWith"], exportAs: ["matSlider"] }, { kind: "directive", type: i5.MatSliderThumb, selector: "input[matSliderThumb]", inputs: ["value"], outputs: ["valueChange", "dragStart", "dragEnd"], exportAs: ["matSliderThumb"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i6.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i7.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i7.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i8.MatInput, selector: "input[matInput], textarea[matInput], select[matNativeControl], input[matNativeControl], textarea[matNativeControl]", inputs: ["disabled", "id", "placeholder", "name", "required", "type", "errorStateMatcher", "aria-describedby", "value", "readonly"], exportAs: ["matInput"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i9.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i10.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i11.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i11.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i11.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i11.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i11.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i11.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
561
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: GuajiritosImagePicker, decorators: [{
562
+ type: Component,
563
+ args: [{ selector: 'guajiritos-image-picker', standalone: true, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
564
+ NgIf,
565
+ NgStyle,
566
+ MatButtonModule,
567
+ MatTooltipModule,
568
+ MatIconModule,
569
+ CalculateSizeModule,
570
+ MatSliderModule,
571
+ MatCheckboxModule,
572
+ MatFormFieldModule,
573
+ MatInputModule,
574
+ MatSelectModule,
575
+ FormsModule,
576
+ NgForOf,
577
+ ], template: "<div *ngIf='!loadImage' class='place-image'>\r\n <div class='image-holder'\r\n [ngStyle]='{ width: config?.width,height: config?.height,borderRadius: config?.borderRadius}'>\r\n <button [matTooltip]=\"labels['Upload a image']\" class='image-upload-btn' mat-icon-button (click)='onUpload($event)'>\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <input #imagePicker type='file' style='display: none' [id]=\"'filePicker-' + uuidFilePicker\"\r\n (change)='handleFileSelect($event)' [accept]='imagesAllowed'>\r\n </div>\r\n</div>\r\n<div *ngIf='loadImage' class='place-image'>\r\n <div class='image-holder-loaded'\r\n [ngStyle]='{width: config?.width,height: config?.height,borderRadius: config?.borderRadius}'>\r\n <img [src]='imageSrc' alt='image-loaded' [ngStyle]='{ borderRadius: config.borderRadius }'>\r\n <input #imagePicker type='file' style='display: none' [id]=\"'filePicker-' + uuidFilePicker\"\r\n (change)='handleFileSelect($event)' [accept]='imagesAllowed'>\r\n </div>\r\n <p *ngIf='imageSrc?.length' class='mat-caption image-caption'\r\n [ngStyle]=\"{color: (imageSrc?.length | calculateSize) > 120 ? '#f44336' : 'unset',fontWeight: (imageSrc?.length | calculateSize) > 120 ? '500' : 'unset'}\">\r\n size: {{ (imageSrc?.length | calculateSize) }}Kb &nbsp; {{ format }}\r\n </p>\r\n\r\n <div class='editing-bar-btn'\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: flex-start; align-items: flex-start'>\r\n <button id='upload-img' *ngIf='!config.hideAddBtn' mat-icon-button [matTooltip]=\"labels['Upload a image']\"\r\n (click)='onUpload($event)'>\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <button id='edit-img' *ngIf='!config.hideEditBtn' mat-icon-button [matTooltip]=\"labels['Open the editor panel']\"\r\n (click)='showEditPanel = true'>\r\n <mat-icon class='mat-18'>edit</mat-icon>\r\n </button>\r\n <a id='download-img' *ngIf='!config.hideDownloadBtn' [matTooltip]=\"labels['Download the image']\"\r\n [href]='imageSrc' mat-icon-button [download]='imageName'>\r\n <mat-icon class='mat-18'>cloud_download</mat-icon>\r\n </a>\r\n <button id='delete-img' *ngIf='!config.hideDeleteBtn' mat-icon-button [matTooltip]=\"labels['Remove']\"\r\n (click)='onRemove()'>\r\n <mat-icon class='mat-18'>delete</mat-icon>\r\n </button>\r\n </div>\r\n</div>\r\n\r\n<div *ngIf='showEditPanel' id='popup' class='popup'>\r\n <div\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: center flex-end; align-items: center'>\r\n <button mat-icon-button (click)='onCloseEditPanel()'>\r\n <mat-icon class='mat-18'>clear</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <div class='image-container'>\r\n <div class='image-holder-full'>\r\n <img id='image-full' [src]='imageSrc' alt=''>\r\n <div id='image-cropper' class='image-cropper'>\r\n <div id='image-cropper-header'>\r\n <mat-icon>drag_indicator</mat-icon>\r\n </div>\r\n </div>\r\n </div>\r\n\r\n <div class='control-panel'>\r\n <p class='title-panel'>{{ labels['Control Panel'] }}</p>\r\n\r\n <p class='item-panel'>{{ labels['Quality'] }}</p>\r\n <div\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: flex-start; align-items: flex-start'>\r\n <mat-slider ngDefaultControl [color]='color' style='max-width: 100%; width: 100%' (change)='onChangeQuality()'\r\n [max]='100' [min]='0' [step]='1' [discrete]='true' [showTickMarks]='true'>\r\n <input matSliderThumb [(ngModel)]='quality'>\r\n </mat-slider>\r\n </div>\r\n\r\n <div class='item-panel'>\r\n <span>{{ labels['Max dimensions'] }}</span>\r\n <mat-checkbox style='float: right' [(ngModel)]='maintainAspectRatio' [color]='color'>\r\n <span class='mat-caption'>{{ labels['aspect-ratio'] }}</span>\r\n </mat-checkbox>\r\n </div>\r\n\r\n <div\r\n style='margin-top: 16px !important; flex-flow: row; box-sizing: border-box; display: flex; place-content: flex-start space-between; align-items: flex-start'>\r\n <mat-form-field style='width: 48%' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ labels['max-width(px)'] }}</mat-label>\r\n <input (change)='onChangeSize(true, false)' matInput [placeholder]=\"labels['max-width(px)']\"\r\n [(ngModel)]='maxWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n\r\n <mat-form-field style='width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['max-height(px)'] }}</mat-label>\r\n <input (change)='onChangeSize(false, true)' matInput [placeholder]=\"labels['max-height(px)']\"\r\n [(ngModel)]='maxHeight' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n </div>\r\n\r\n <p class='item-panel'>{{ labels['Format'] }}</p>\r\n <div\r\n style='margin-top: 8px !important; flex-direction: row; box-sizing: border-box; display: flex; place-content: flex-start; align-items: flex-start'>\r\n <mat-form-field style='max-width: 100%; width: 100%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-select [(ngModel)]='format' (selectionChange)='onChangeFormat()'>\r\n <mat-option *ngFor='let format of allFormats' [value]='format'>\r\n {{ format }}\r\n </mat-option>\r\n </mat-select>\r\n </mat-form-field>\r\n </div>\r\n\r\n <div>\r\n <mat-checkbox (change)='onCropStateChange()' [(ngModel)]='showCrop' [color]='color'>\r\n <p class='item-panel'>{{ labels['Crop'] }}</p>\r\n </mat-checkbox>\r\n <button style='float: right' mat-icon-button [color]='color' (click)='onRestore()'>\r\n <mat-icon>refresh</mat-icon>\r\n </button>\r\n </div>\r\n\r\n <ng-container *ngIf='showCrop'>\r\n <div\r\n style='margin-top: 8px !important; flex-flow: row wrap; box-sizing: border-box; display: flex; place-content: flex-start space-between; align-items: flex-start'>\r\n <mat-form-field style='max-width: 48%; width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['width(px)'] }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput [placeholder]=\"labels['width(px)']\"\r\n [(ngModel)]='cropWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n <mat-form-field style='max-width: 48%; width: 48%' [appearance]='appearance'\r\n [color]='color'>\r\n <mat-label>{{ labels['height(px)'] }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput\r\n [placeholder]=\"labels['height(px)']\" [(ngModel)]='cropHeight' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n </div>\r\n\r\n <p style='margin-bottom: 4px !important'>\r\n <button mat-icon-button [color]='color' (click)='onCrop()'>\r\n <mat-icon> crop</mat-icon>\r\n </button>\r\n </p>\r\n </ng-container>\r\n\r\n <div\r\n style='flex-direction: row; box-sizing: border-box; display: flex; place-content: center space-between; align-items: center'>\r\n <button mat-flat-button (click)='onCloseEditPanel()' [color]='color'\r\n style='padding: 0 8px; height: 34px; box-sizing: border-box;'>\r\n {{labels['save']}}\r\n </button>\r\n\r\n <p *ngIf='imageSrc?.length' class='mat-caption image-caption'\r\n [ngStyle]=\"{color: (imageSrc?.length | calculateSize) > 120 ? '#f44336' : 'unset',fontWeight: (imageSrc?.length | calculateSize) > 120 ? '500' : 'unset'}\">\r\n size: {{ (imageSrc?.length | calculateSize) }}Kb &nbsp; {{ format }}\r\n </p>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: ["guajiritos-image-picker p{margin:0!important;padding:0!important}guajiritos-image-picker .place-image{flex-direction:column;box-sizing:border-box;display:flex;place-content:flex-start;align-items:center}guajiritos-image-picker .place-image .image-holder{flex-direction:column;box-sizing:border-box;display:flex;place-content:center;align-items:center;position:relative;width:320px;height:240px;border-radius:16px;max-width:100%!important;border:2px rgba(0,0,0,.3) solid;background-color:#fcfcfc}@media (max-width: 599px){guajiritos-image-picker .place-image .image-holder{max-width:100%!important;max-height:250px!important}}guajiritos-image-picker .place-image .image-holder .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;color:#424242}guajiritos-image-picker .place-image .image-holder .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px;color:#424242}@media (max-width: 599px){guajiritos-image-picker .place-image .image-holder .image-upload-btn{opacity:1;width:30px;height:30px}guajiritos-image-picker .place-image .image-holder .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}guajiritos-image-picker .place-image .image-holder:hover .image-upload-btn{opacity:1;transition:all .5s ease}guajiritos-image-picker .place-image .image-holder-loaded{flex-direction:column;box-sizing:border-box;display:flex;place-content:center;align-items:center;position:relative;max-width:100%!important;width:320px;height:240px;border-radius:4px;padding:2px}guajiritos-image-picker .place-image .image-holder-loaded .image-caption{position:absolute;right:0;bottom:-22px}guajiritos-image-picker .place-image .image-holder-loaded img{height:100%;max-height:100%;width:100%;max-width:100%;object-fit:cover;object-position:center}@media (max-width: 599px){guajiritos-image-picker .place-image .image-holder-loaded{max-height:195px!important}}guajiritos-image-picker .place-image .image-holder-loaded .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;color:#424242}guajiritos-image-picker .place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px;color:#424242}@media (max-width: 599px){guajiritos-image-picker .place-image .image-holder-loaded .image-upload-btn{opacity:1;width:30px;height:30px}guajiritos-image-picker .place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}guajiritos-image-picker .place-image .image-holder-loaded:hover .image-upload-btn{opacity:1;transition:all .5s ease}guajiritos-image-picker .place-image .editing-bar-btn{margin-top:2px}guajiritos-image-picker .place-image .editing-bar-btn .mat-icon-button{height:20px;line-height:20px;width:24px}guajiritos-image-picker .place-image .editing-bar-btn mat-icon{line-height:20px!important;font-size:20px!important;width:20px!important;height:20px!important}guajiritos-image-picker .place-image .editing-bar-btn button{margin:4px;color:#424242;transition:all .5s ease}guajiritos-image-picker .place-image .editing-bar-btn button:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}guajiritos-image-picker .place-image .editing-bar-btn a{margin:4px;color:#424242;transition:all .5s ease}guajiritos-image-picker .place-image .editing-bar-btn a:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}guajiritos-image-picker .popup{width:100vw;max-height:100%;height:100%;overflow:auto;position:fixed;top:0;left:0;background-color:#000c;z-index:1000;padding:24px;color:#fff;box-sizing:border-box;animation-name:show;animation-duration:.4s}guajiritos-image-picker .popup .image-container{margin-top:50px;margin-bottom:50px;height:100%;min-height:100%;min-width:100%;width:100%;flex-flow:row wrap;box-sizing:border-box;display:flex;place-content:flex-start center;align-items:flex-start}guajiritos-image-picker .popup .image-container .image-holder-full{height:auto;width:auto;position:relative;display:contents}guajiritos-image-picker .popup img{max-height:600px;max-width:100%;object-fit:cover;object-position:center;margin:8px;transition:all .5s ease}@media (max-width: 1024px){guajiritos-image-picker .popup{background-color:#000000d9;padding:8px}guajiritos-image-picker .popup img{max-height:100%;max-width:100%}}@media (max-width: 599px){guajiritos-image-picker .popup img{margin:0}}guajiritos-image-picker .popup .control-panel{color:#fff;background-color:#000000eb;margin:8px;padding:16px;max-width:100%;width:18rem;border-radius:8px;flex-direction:column;box-sizing:border-box;display:flex;place-content:stretch flex-start;align-items:stretch}@media (max-width: 599px){guajiritos-image-picker .popup .control-panel{margin:8px 0;width:100%}}guajiritos-image-picker .popup .control-panel .title-panel{padding:0 4px;font-size:17px;font-weight:500;margin-bottom:16px!important}guajiritos-image-picker .popup .control-panel .item-panel{padding:0 4px!important;font-size:14px;font-weight:500;display:flex;align-items:center;gap:4px}@keyframes show{0%{top:-100vh;opacity:0}to{top:0;opacity:1}}guajiritos-image-picker .mat-form-field-appearance-fill .mat-form-field-flex{background-color:#fafafa!important}guajiritos-image-picker .mat-select-panel{background:#fafafa!important}guajiritos-image-picker input.mat-input-element{color:#000000d9}guajiritos-image-picker .mat-checkbox-background{background-color:#fff}guajiritos-image-picker .image-cropper{position:absolute;width:150px;height:150px;border:2.5px solid #fafafa;box-sizing:border-box;resize:both;overflow:auto;opacity:0}guajiritos-image-picker .image-cropper #image-cropper-header{padding:10px;cursor:move;z-index:10;background-color:transparent;height:85%}guajiritos-image-picker .image-cropper #image-cropper-header mat-icon{color:#fff}guajiritos-image-picker .btn{padding:4px 8px;border-radius:4px;cursor:pointer}guajiritos-image-picker .btn mat-icon{color:#000000d1}\n"] }]
578
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { appearance: [{
579
+ type: Input
580
+ }], color: [{
581
+ type: Input
582
+ }], imagesAllowed: [{
583
+ type: Input
584
+ }], imagePicker: [{
585
+ type: ViewChild,
586
+ args: ['imagePicker', { static: false }]
587
+ }], $imageChanged: [{
588
+ type: Output
589
+ }], $imageOriginal: [{
590
+ type: Output
591
+ }], _imageSrc: [{
592
+ type: Input
593
+ }], _config: [{
594
+ type: Input
595
+ }] } });
596
+
597
+ /*
598
+ * Public API Surface of guachos-image-picker
639
599
  */
640
600
 
641
- /**
642
- * Generated bundle index. Do not edit.
601
+ /**
602
+ * Generated bundle index. Do not edit.
643
603
  */
644
604
 
645
- export { GuajiritosImagePickerComponent, GuajiritosImagePickerModule };
605
+ export { GuajiritosImagePicker };
646
606
  //# sourceMappingURL=guajiritos-image-picker.mjs.map