@guajiritos/image-picker 0.0.6 → 0.0.8

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