@guajiritos/image-picker 0.0.1 → 0.0.2

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,610 @@
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
+ 'Max dimensions': 'Max dimensions',
76
+ 'aspect-ratio': 'aspect-ratio',
77
+ 'max-width(px)': 'max-width(px)',
78
+ 'max-height(px)': 'max-height(px)',
79
+ Format: 'Format',
80
+ Crop: 'Crop',
81
+ 'width(px)': 'width(px)',
82
+ 'height(px)': 'height(px)',
83
+ Remove: 'Remove',
84
+ };
85
+ this.labelEs = {
86
+ 'Upload a image': 'Suba una imagen',
87
+ 'You must edit the image in order to resize it': 'Debe editar la imagen para disminuir su tamaño',
88
+ 'too large': 'muy grande',
89
+ 'Open the editor panel': 'Abra el panel de edición',
90
+ 'Download the image': 'Descargue la imagen',
91
+ 'Control Panel': 'Panel de control',
92
+ Remove: 'Quitar',
93
+ Quality: 'Calidad',
94
+ 'Max dimensions': 'Dimensiones',
95
+ 'aspect-ratio': 'relación-aspecto',
96
+ 'max-width(px)': 'max. ancho',
97
+ 'max-height(px)': 'max. alto',
98
+ Format: 'Formato',
99
+ Crop: 'Recortar',
100
+ 'width(px)': 'ancho(px)',
101
+ 'height(px)': 'altura(px)',
102
+ };
103
+ this.labelFr = {
104
+ 'Upload a image': 'Charger une image',
105
+ 'You must edit the image in order to resize it': 'Vous devez éditer l\'image pour changer sa taille',
106
+ 'too large': 'Trop grande',
107
+ 'Open the editor panel': 'Ouvrir le panneau d\'édition',
108
+ 'Download the image': 'Télécharger l\'image',
109
+ 'Control Panel': 'Panneau de commande',
110
+ Remove: 'Supprimer',
111
+ Quality: 'Qualité',
112
+ 'Max dimensions': 'Dimensions maximales',
113
+ 'aspect-ratio': 'rapport de forme',
114
+ 'max-width(px)': 'largeur max.',
115
+ 'max-height(px)': 'hauteur max',
116
+ Format: 'Format',
117
+ Crop: 'Recadrer',
118
+ 'width(px)': 'largeur(px)',
119
+ 'height(px)': 'hauteur(px)',
120
+ };
121
+ this.arrayCopiedImages = [];
122
+ this.config = {
123
+ height: '240px',
124
+ width: '320px',
125
+ borderRadius: '16px',
126
+ compressInitial: true,
127
+ language: 'en',
128
+ hideDeleteBtn: false,
129
+ hideDownloadBtn: false,
130
+ hideEditBtn: false,
131
+ hideAddBtn: false,
132
+ };
133
+ this.showCrop = false;
134
+ this.loadImage = false;
135
+ this.uuidFilePicker = Date.now().toString(20);
136
+ this.showEditPanel = false;
137
+ this.quality = 92;
138
+ this.format = 'jpeg';
139
+ this.allFormats = ['webp', 'jpeg', 'png'];
140
+ this.maxHeight = 2000;
141
+ this.maxWidth = 2000;
142
+ this.cropHeight = 150;
143
+ this.cropWidth = 150;
144
+ this.maintainAspectRatio = true;
145
+ this.imageName = 'download';
146
+ this.appearance = 'outline';
147
+ this.color = 'primary';
148
+ this.imagesAllowed = 'image/*';
149
+ this.$imageChanged = new EventEmitter();
150
+ this.$imageOriginal = new EventEmitter();
151
+ this.labels = this.labelEn;
152
+ }
153
+ set _imageSrc(image) {
154
+ if (image) {
155
+ let types = image.split('.');
156
+ this.format = types[types.length - 1];
157
+ if (!this.format || (this.format !== 'png' && this.format !== 'jpeg' && this.format !== 'webp')) {
158
+ this.format = 'jpeg';
159
+ }
160
+ this.imageSrc = image;
161
+ this.arrayCopiedImages = [];
162
+ this.arrayCopiedImages.push(this.imageSrc);
163
+ this.originImageSrc = image;
164
+ this.lastOriginSrc = image;
165
+ this.$imageOriginal.next(this.originImageSrc);
166
+ this.loadImage = true;
167
+ this._cdRef.markForCheck();
168
+ }
169
+ else {
170
+ this.imageSrc = null;
171
+ this.originImageSrc = null;
172
+ this.loadImage = false;
173
+ this.arrayCopiedImages = [];
174
+ this.lastOriginSrc = null;
175
+ this.$imageOriginal.next(null);
176
+ this.format = 'jpeg';
177
+ this.maxHeight = 2000;
178
+ this.maxWidth = 2000;
179
+ this.cropHeight = 150;
180
+ this.cropWidth = 150;
181
+ this.maintainAspectRatio = true;
182
+ this.showEditPanel = false;
183
+ this._cdRef.markForCheck();
184
+ }
185
+ }
186
+ set _config(value) {
187
+ if (value && value.constructor == Object) {
188
+ this.config = Object.assign(Object.assign({}, this.config), value);
189
+ if ((value === null || value === void 0 ? void 0 : value.language) !== undefined) {
190
+ if (value.language === 'en') {
191
+ this.labels = Object.assign({}, this.labelEn);
192
+ }
193
+ if (value.language === 'es') {
194
+ this.labels = Object.assign({}, this.labelEs);
195
+ }
196
+ if (value.language === 'fr') {
197
+ this.labels = Object.assign({}, this.labelFr);
198
+ }
199
+ }
200
+ }
201
+ }
202
+ handleReaderLoaded(readerEvt) {
203
+ var _a;
204
+ return __awaiter(this, void 0, void 0, function* () {
205
+ const binaryString = readerEvt.target.result;
206
+ const base64textString = btoa(binaryString);
207
+ this.originImageSrc = this.urlImage + base64textString;
208
+ this.lastOriginSrc = this.urlImage + base64textString;
209
+ if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.compressInitial) {
210
+ this.quality = 92;
211
+ const input = {
212
+ dataType: this.format,
213
+ quality: 0.92,
214
+ maintainRatio: true,
215
+ };
216
+ this.imageSrc = yield this.resizeDataURL(this.urlImage + base64textString, input);
217
+ }
218
+ else {
219
+ this.imageSrc = this.urlImage + base64textString;
220
+ this.arrayCopiedImages = [];
221
+ this.arrayCopiedImages.push({
222
+ lastImage: this.imageSrc,
223
+ width: this.maxWidth,
224
+ height: this.maxHeight,
225
+ quality: this.quality,
226
+ });
227
+ this.$imageOriginal.next(this.imageSrc);
228
+ }
229
+ this.$imageChanged.next(this.imageSrc);
230
+ this.loadImage = true;
231
+ });
232
+ }
233
+ resizeDataURL(datas, input) {
234
+ return __awaiter(this, void 0, void 0, function* () {
235
+ return yield new Promise(function (resolve) {
236
+ return __awaiter(this, void 0, void 0, function* () {
237
+ let img = document.createElement('img');
238
+ img.src = datas + '';
239
+ img.crossOrigin = 'Anonymous';
240
+ let quality = input.quality ? input.quality : 1.0;
241
+ let maintainRatio = input.maintainRatio != undefined ? input.maintainRatio : true;
242
+ img.onload = function () {
243
+ const canvas = document.createElement('canvas');
244
+ const ctx = canvas.getContext('2d');
245
+ let ratio = img.width / img.height;
246
+ let width = input.width ? input.width : img.width;
247
+ let height = input.height ? input.height : img.height;
248
+ if (maintainRatio) {
249
+ if (input.changeHeight) {
250
+ canvas.width = height * ratio;
251
+ canvas.height = height;
252
+ }
253
+ else {
254
+ canvas.width = width;
255
+ canvas.height = width / ratio;
256
+ }
257
+ }
258
+ else {
259
+ canvas.width = width;
260
+ canvas.height = height;
261
+ }
262
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
263
+ let type = input.dataType ? input.dataType : 'webp';
264
+ const dataURI = canvas.toDataURL(`image/${type}`, quality);
265
+ resolve({
266
+ dataUri: dataURI,
267
+ width: canvas.width,
268
+ height: canvas.height,
269
+ });
270
+ };
271
+ });
272
+ }).then((data) => {
273
+ var _a;
274
+ this.maxHeight = data === null || data === void 0 ? void 0 : data.height;
275
+ this.maxWidth = data === null || data === void 0 ? void 0 : data.width;
276
+ if (((_a = this.arrayCopiedImages) === null || _a === void 0 ? void 0 : _a.length) <= 20) {
277
+ this.arrayCopiedImages.push({
278
+ lastImage: data === null || data === void 0 ? void 0 : data.dataUri,
279
+ width: this.maxWidth,
280
+ height: this.maxHeight,
281
+ quality: this.quality,
282
+ });
283
+ }
284
+ return data.dataUri;
285
+ });
286
+ });
287
+ }
288
+ wait(ms) {
289
+ ms = ms ? ms : 1000;
290
+ return new Promise((resolve) => {
291
+ setTimeout(() => {
292
+ return resolve(true);
293
+ }, ms);
294
+ });
295
+ }
296
+ dragElement(element) {
297
+ let pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
298
+ let el = document.getElementById(element.id + '-header');
299
+ if (el) {
300
+ el.onmousedown = dragMouseDown;
301
+ el.ontouchstart = dragMouseDown;
302
+ }
303
+ else {
304
+ element.onmousedown = dragMouseDown;
305
+ element.ontouchstart = dragMouseDown;
306
+ }
307
+ function dragMouseDown(e) {
308
+ e = e || window.event;
309
+ e === null || e === void 0 ? void 0 : e.preventDefault();
310
+ pos3 = e === null || e === void 0 ? void 0 : e.clientX;
311
+ pos4 = e === null || e === void 0 ? void 0 : e.clientY;
312
+ document.onmouseup = closeDragElement;
313
+ document.ontouchend = closeDragElement;
314
+ document.onmousemove = elementDrag;
315
+ document.ontouchmove = elementDrag;
316
+ }
317
+ function elementDrag(e) {
318
+ let holderImage = document.getElementById('image-full');
319
+ e = e || window.event;
320
+ e === null || e === void 0 ? void 0 : e.preventDefault();
321
+ pos1 = pos3 - (e === null || e === void 0 ? void 0 : e.clientX);
322
+ pos2 = pos4 - (e === null || e === void 0 ? void 0 : e.clientY);
323
+ pos3 = e === null || e === void 0 ? void 0 : e.clientX;
324
+ pos4 = e === null || e === void 0 ? void 0 : e.clientY;
325
+ const newTop = element.offsetTop - pos2;
326
+ const newLeft = element.offsetLeft - pos1;
327
+ const rectHolder = holderImage.getBoundingClientRect();
328
+ const rectElement = element.getBoundingClientRect();
329
+ if (newTop >= rectHolder.y + 8) {
330
+ element.style.top = Math.min(newTop, rectHolder.y + rectHolder.height - rectElement.height - 4) + 'px';
331
+ }
332
+ if (newLeft > rectHolder.x + 4 && rectHolder.x + rectHolder.width > rectElement.x + rectElement.width + 2) {
333
+ element.style.left = Math.min(newLeft, rectHolder.x + rectHolder.width - rectElement.width - 4) + 'px';
334
+ }
335
+ }
336
+ function closeDragElement() {
337
+ document.onmouseup = null;
338
+ document.onmousemove = null;
339
+ document.ontouchend = null;
340
+ document.ontouchmove = null;
341
+ }
342
+ }
343
+ onUpload(event) {
344
+ var _a;
345
+ event.preventDefault();
346
+ (_a = this.imagePicker) === null || _a === void 0 ? void 0 : _a.nativeElement.click();
347
+ }
348
+ handleFileSelect(evt) {
349
+ var _a;
350
+ const files = (_a = evt.target) === null || _a === void 0 ? void 0 : _a.files;
351
+ if (files) {
352
+ const file = files[0];
353
+ this.imageName = file.name.split('.')[0];
354
+ this.fileType = file.type;
355
+ this.urlImage = `data:${file.type};base64,`;
356
+ if (files && file) {
357
+ const reader = new FileReader();
358
+ reader.onload = this.handleReaderLoaded.bind(this);
359
+ reader.readAsBinaryString(file);
360
+ }
361
+ }
362
+ }
363
+ onCloseEditPanel() {
364
+ if (this.observer instanceof ResizeObserver) {
365
+ let imageCropper = document.getElementById('image-cropper');
366
+ let imageFull = document.getElementById('image-full');
367
+ this.observer.unobserve(imageCropper);
368
+ this.observer.unobserve(imageFull);
369
+ }
370
+ this.showCrop = false;
371
+ this.showEditPanel = false;
372
+ }
373
+ onChangeQuality() {
374
+ return __awaiter(this, void 0, void 0, function* () {
375
+ const qualityItem = this.quality / 100;
376
+ this.maxHeight = this.maxHeight && +this.maxHeight ? this.maxHeight : 2000;
377
+ this.maxWidth = this.maxWidth && +this.maxWidth ? this.maxWidth : 2000;
378
+ yield this.wait(250);
379
+ try {
380
+ const input = {
381
+ height: this.maxHeight,
382
+ width: this.maxWidth,
383
+ dataType: this.format,
384
+ quality: qualityItem,
385
+ maintainRatio: this.maintainAspectRatio,
386
+ };
387
+ this.imageSrc = yield this.resizeDataURL(this.originImageSrc, input);
388
+ this.$imageChanged.next(this.imageSrc);
389
+ this.loadImage = true;
390
+ }
391
+ catch (error) {
392
+ this.loadImage = true;
393
+ }
394
+ });
395
+ }
396
+ onChangeFormat() {
397
+ return __awaiter(this, void 0, void 0, function* () {
398
+ let qualityItem = this.quality / 100;
399
+ this.maxHeight = this.maxHeight && +this.maxHeight ? this.maxHeight : 2000;
400
+ this.maxWidth = this.maxWidth && +this.maxWidth ? this.maxWidth : 2000;
401
+ yield this.wait(250);
402
+ try {
403
+ let input = {
404
+ height: this.maxHeight,
405
+ width: this.maxWidth,
406
+ dataType: this.format,
407
+ quality: qualityItem,
408
+ maintainRatio: this.maintainAspectRatio,
409
+ };
410
+ this.imageSrc = yield this.resizeDataURL(this.originImageSrc, input);
411
+ this.$imageChanged.next(this.imageSrc);
412
+ this.loadImage = true;
413
+ }
414
+ catch (error) {
415
+ this.loadImage = true;
416
+ }
417
+ });
418
+ }
419
+ onChangeSize(changeWidth, changeHeight) {
420
+ return __awaiter(this, void 0, void 0, function* () {
421
+ let qualityItem = this.quality / 100;
422
+ this.maxHeight = this.maxHeight && +this.maxHeight ? this.maxHeight : 2000;
423
+ this.maxWidth = this.maxWidth && +this.maxWidth ? this.maxWidth : 2000;
424
+ yield this.wait(500);
425
+ try {
426
+ let input = {
427
+ height: this.maxHeight,
428
+ width: this.maxWidth,
429
+ dataType: this.format,
430
+ quality: qualityItem,
431
+ maintainRatio: this.maintainAspectRatio,
432
+ changeHeight: changeHeight,
433
+ changeWidth: changeWidth,
434
+ };
435
+ this.imageSrc = yield this.resizeDataURL(this.originImageSrc, input);
436
+ this.$imageChanged.next(this.imageSrc);
437
+ this.loadImage = true;
438
+ }
439
+ catch (error) {
440
+ this.loadImage = true;
441
+ }
442
+ });
443
+ }
444
+ onChangeCrop() {
445
+ const cropper = document.getElementById('image-cropper');
446
+ cropper.style.width = this.cropWidth + 'px';
447
+ cropper.style.height = this.cropHeight + 'px';
448
+ }
449
+ onCropStateChange() {
450
+ const cropper = document.getElementById('image-cropper');
451
+ if (this.showCrop) {
452
+ cropper.style.opacity = '1.0';
453
+ this.dragElement(cropper);
454
+ this.observer = new ResizeObserver((entries) => {
455
+ entries.forEach((entry) => {
456
+ if (this.showEditPanel) {
457
+ const elementCropper = document.getElementById('image-cropper');
458
+ const elementFull = document.getElementById('image-full');
459
+ const rectHolder = elementFull.getBoundingClientRect();
460
+ const rectElement = elementCropper.getBoundingClientRect();
461
+ const maxWidth = rectHolder.x + rectHolder.width - rectElement.x - 4;
462
+ const maxHeight = rectHolder.y + rectHolder.height - rectElement.y - 4;
463
+ elementCropper.style.maxWidth = maxWidth + 'px';
464
+ elementCropper.style.maxHeight = maxHeight + 'px';
465
+ this.cropWidth = rectElement.width;
466
+ this.cropHeight = rectElement.height;
467
+ if (entry.target.id == 'image-full') {
468
+ if (rectHolder.top > 0) {
469
+ elementCropper.style.top = rectHolder.top + 4 + 'px';
470
+ }
471
+ elementCropper.style.left = rectHolder.left + 4 + 'px';
472
+ }
473
+ }
474
+ });
475
+ });
476
+ this.observer.observe(document.getElementById('image-cropper'));
477
+ this.observer.observe(document.getElementById('image-full'));
478
+ }
479
+ else {
480
+ cropper.style.opacity = '0.0';
481
+ if (this.observer instanceof ResizeObserver) {
482
+ const elementCropper = document.getElementById('image-cropper');
483
+ const elementFull = document.getElementById('image-full');
484
+ this.observer.unobserve(elementCropper);
485
+ this.observer.unobserve(elementFull);
486
+ }
487
+ }
488
+ }
489
+ onCrop(type) {
490
+ type = type ? type : this.format;
491
+ const cropper = document.getElementById('image-cropper');
492
+ const elementFull = document.getElementById('image-full');
493
+ const rectCropper = cropper.getBoundingClientRect();
494
+ const dataHolderRect = elementFull.getBoundingClientRect();
495
+ const canvas = document.createElement('canvas');
496
+ new Promise((resolve, reject) => {
497
+ let ctx = canvas.getContext('2d');
498
+ let image = new Image();
499
+ image.src = this.imageSrc;
500
+ image.onload = () => {
501
+ let ratio = image.height / dataHolderRect.height;
502
+ let newWidth = rectCropper.width * ratio;
503
+ let newHeight = rectCropper.height * ratio;
504
+ canvas.height = newHeight;
505
+ canvas.width = newWidth;
506
+ 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);
507
+ // ctx.drawImage(image, 90, 130, 50, 60, 10, 10, 50, 60);
508
+ resolve(canvas.toDataURL(`image/${type}`, 0.98));
509
+ };
510
+ image.onerror = (e) => {
511
+ reject(e);
512
+ };
513
+ })
514
+ .then((dataUri) => {
515
+ this.imageSrc = dataUri;
516
+ this.showCrop = false;
517
+ this.onCropStateChange();
518
+ this.maxWidth = canvas.width;
519
+ this.maxHeight = canvas.height;
520
+ this.lastOriginSrc = this.originImageSrc + '';
521
+ this.originImageSrc = dataUri;
522
+ this.$imageChanged.next(this.imageSrc);
523
+ })
524
+ .catch((e) => {
525
+ console.log(e);
526
+ });
527
+ }
528
+ onRestore() {
529
+ if (this.arrayCopiedImages.length) {
530
+ let lastState = this.arrayCopiedImages.pop();
531
+ this.imageSrc = lastState.lastImage;
532
+ this.maxWidth = lastState.width;
533
+ this.maxHeight = lastState.height;
534
+ this.originImageSrc = this.lastOriginSrc + '';
535
+ }
536
+ else {
537
+ this.imageSrc = this.lastOriginSrc;
538
+ this.originImageSrc = this.lastOriginSrc + '';
539
+ }
540
+ this.$imageChanged.next(this.imageSrc);
541
+ }
542
+ onRemove() {
543
+ this.imageSrc = null;
544
+ this.originImageSrc = null;
545
+ this.loadImage = false;
546
+ this.arrayCopiedImages = [];
547
+ this.lastOriginSrc = null;
548
+ this.$imageOriginal.next(null);
549
+ this.$imageChanged.next(null);
550
+ this.format = 'jpeg';
551
+ this.maxHeight = 2000;
552
+ this.maxWidth = 2000;
553
+ this.cropHeight = 150;
554
+ this.cropWidth = 150;
555
+ this.maintainAspectRatio = true;
556
+ this.showEditPanel = false;
557
+ }
558
+ ngOnDestroy() {
559
+ this.unsubscribeAll$.next();
560
+ this.unsubscribeAll$.complete();
561
+ }
562
+ }
563
+ GuajiritosImagePicker.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: GuajiritosImagePicker, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
564
+ 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 [color]='color' style='max-width: 100%; width: 100%' (change)='onChangeQuality()'\r\n [(ngModel)]='quality' [min]='0' [max]='100' [step]='1'>\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: ["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;font-size:14px;font-weight:500}@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: "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 });
565
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: GuajiritosImagePicker, decorators: [{
566
+ type: Component,
567
+ args: [{ selector: 'guajiritos-image-picker', standalone: true, encapsulation: ViewEncapsulation.None, changeDetection: ChangeDetectionStrategy.OnPush, imports: [
568
+ NgIf,
569
+ NgStyle,
570
+ MatButtonModule,
571
+ MatTooltipModule,
572
+ MatIconModule,
573
+ CalculateSizeModule,
574
+ MatSliderModule,
575
+ MatCheckboxModule,
576
+ MatFormFieldModule,
577
+ MatInputModule,
578
+ MatSelectModule,
579
+ FormsModule,
580
+ NgForOf,
581
+ ], 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'>\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: ["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;font-size:14px;font-weight:500}@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"] }]
582
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { appearance: [{
583
+ type: Input
584
+ }], color: [{
585
+ type: Input
586
+ }], imagesAllowed: [{
587
+ type: Input
588
+ }], imagePicker: [{
589
+ type: ViewChild,
590
+ args: ['imagePicker', { static: false }]
591
+ }], $imageChanged: [{
592
+ type: Output
593
+ }], $imageOriginal: [{
594
+ type: Output
595
+ }], _imageSrc: [{
596
+ type: Input
597
+ }], _config: [{
598
+ type: Input
599
+ }] } });
600
+
601
+ /*
602
+ * Public API Surface of guachos-image-picker
639
603
  */
640
604
 
641
- /**
642
- * Generated bundle index. Do not edit.
605
+ /**
606
+ * Generated bundle index. Do not edit.
643
607
  */
644
608
 
645
- export { GuajiritosImagePickerComponent, GuajiritosImagePickerModule };
609
+ export { GuajiritosImagePicker };
646
610
  //# sourceMappingURL=guajiritos-image-picker.mjs.map