@guajiritos/image-picker 0.0.12 → 0.0.14

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.
@@ -2,26 +2,25 @@ import * as i0 from '@angular/core';
2
2
  import { Pipe, NgModule, signal, EventEmitter, Component, ChangeDetectionStrategy, Input, ViewChild, Output } from '@angular/core';
3
3
  import { ResizeObserver } from 'resize-observer';
4
4
  import { Subject } from 'rxjs';
5
- import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
6
- import * as i3 from '@angular/material/icon';
5
+ import * as i2 from '@angular/material/icon';
7
6
  import { MatIconModule } from '@angular/material/icon';
8
- import * as i9 from '@angular/forms';
7
+ import * as i12 from '@angular/forms';
9
8
  import { UntypedFormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
10
- import * as i2 from '@angular/material/tooltip';
9
+ import * as i1 from '@angular/material/tooltip';
11
10
  import { MatTooltipModule } from '@angular/material/tooltip';
12
- import * as i5 from '@angular/material/checkbox';
11
+ import * as i7 from '@angular/material/checkbox';
13
12
  import { MatCheckboxModule } from '@angular/material/checkbox';
14
13
  import * as i6 from '@angular/material/slider';
15
14
  import { MatSliderModule } from '@angular/material/slider';
16
- import * as i4 from '@angular/material/button';
15
+ import * as i5 from '@angular/material/button';
17
16
  import { MatButtonModule } from '@angular/material/button';
18
- import * as i7 from '@angular/material/form-field';
17
+ import * as i8 from '@angular/material/form-field';
19
18
  import { MatFormFieldModule } from '@angular/material/form-field';
20
- import * as i8 from '@angular/material/input';
19
+ import * as i9 from '@angular/material/input';
21
20
  import { MatInputModule } from '@angular/material/input';
22
21
  import * as i10 from '@angular/material/select';
23
22
  import { MatSelectModule } from '@angular/material/select';
24
- import * as i1 from '@angular/common';
23
+ import { NgIf, NgStyle, NgForOf } from '@angular/common';
25
24
  import * as i11 from '@angular/material/core';
26
25
 
27
26
  class I18nPipe {
@@ -114,12 +113,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImpor
114
113
  }] });
115
114
 
116
115
  class GuajiritosImagePicker {
117
- constructor() {
118
- }
119
116
  unsubscribeAll$ = new Subject();
120
117
  observer = null;
121
118
  originImageSrc;
122
- fileType;
123
119
  urlImage;
124
120
  lastOriginSrc;
125
121
  arrayCopiedImages = [];
@@ -144,8 +140,8 @@ class GuajiritosImagePicker {
144
140
  maintainAspectRatio = new UntypedFormControl({ value: true, disabled: false });
145
141
  quality = new UntypedFormControl({ value: 70, disabled: false });
146
142
  format = new UntypedFormControl({ value: 'webp', disabled: false });
147
- maxHeight = signal(2000);
148
- maxWidth = signal(2000);
143
+ maxHeight = 2000;
144
+ maxWidth = 2000;
149
145
  cropHeight = new UntypedFormControl({ value: 150, disabled: false });
150
146
  cropWidth = new UntypedFormControl({ value: 150, disabled: false });
151
147
  imageName = signal('download');
@@ -181,8 +177,8 @@ class GuajiritosImagePicker {
181
177
  this.lastOriginSrc = null;
182
178
  this.$imageOriginal.next(null);
183
179
  this.format.setValue('jpeg');
184
- this.maxHeight.set(2000);
185
- this.maxWidth.set(2000);
180
+ this.maxHeight = 2000;
181
+ this.maxWidth = 2000;
186
182
  this.cropHeight.setValue(150);
187
183
  this.cropWidth.setValue(150);
188
184
  this.maintainAspectRatio.setValue(true);
@@ -216,8 +212,8 @@ class GuajiritosImagePicker {
216
212
  this.arrayCopiedImages = [];
217
213
  this.arrayCopiedImages.push({
218
214
  lastImage: this.imageSrc(),
219
- width: this.maxWidth(),
220
- height: this.maxHeight(),
215
+ width: this.maxWidth,
216
+ height: this.maxHeight,
221
217
  quality: this.quality.value,
222
218
  });
223
219
  this.$imageOriginal.next(this.imageSrc());
@@ -339,7 +335,6 @@ class GuajiritosImagePicker {
339
335
  if (files) {
340
336
  const file = files[0];
341
337
  this.imageName.set(file?.name?.split('.')[0]);
342
- this.fileType = file?.type;
343
338
  this.urlImage = `data:${file?.type};base64,`;
344
339
  this.noEdit.set(false);
345
340
  if (files && file) {
@@ -361,13 +356,13 @@ class GuajiritosImagePicker {
361
356
  }
362
357
  async onChangeQuality() {
363
358
  const qualityItem = this.quality.value / 100;
364
- this.maxHeight.set(this.maxHeight() ?? 2000);
365
- this.maxWidth.set(this.maxWidth() ?? 2000);
359
+ this.maxHeight = this.maxHeight ?? 2000;
360
+ this.maxWidth = this.maxWidth ?? 2000;
366
361
  await this.wait(250);
367
362
  try {
368
363
  const input = {
369
- height: this.maxHeight(),
370
- width: this.maxWidth(),
364
+ height: this.maxHeight,
365
+ width: this.maxWidth,
371
366
  dataType: this.format.value,
372
367
  quality: qualityItem,
373
368
  maintainRatio: this.maintainAspectRatio.value,
@@ -382,13 +377,13 @@ class GuajiritosImagePicker {
382
377
  }
383
378
  async onChangeFormat() {
384
379
  let qualityItem = this.quality.value / 100;
385
- this.maxHeight.set(this.maxHeight() ?? 2000);
386
- this.maxWidth.set(this.maxWidth() ?? 2000);
380
+ this.maxHeight = this.maxHeight ?? 2000;
381
+ this.maxWidth = this.maxWidth ?? 2000;
387
382
  await this.wait(250);
388
383
  try {
389
384
  let input = {
390
- height: this.maxHeight(),
391
- width: this.maxWidth(),
385
+ height: this.maxHeight,
386
+ width: this.maxWidth,
392
387
  dataType: this.format.value,
393
388
  quality: qualityItem,
394
389
  maintainRatio: this.maintainAspectRatio.value,
@@ -403,13 +398,13 @@ class GuajiritosImagePicker {
403
398
  }
404
399
  async onChangeSize(changeWidth, changeHeight) {
405
400
  let qualityItem = this.quality.value / 100;
406
- this.maxHeight.set(this.maxHeight() ?? 2000);
407
- this.maxWidth.set(this.maxWidth() ?? 2000);
401
+ this.maxHeight = this.maxHeight ?? 2000;
402
+ this.maxWidth = this.maxWidth ?? 2000;
408
403
  await this.wait(500);
409
404
  try {
410
405
  let input = {
411
- height: this.maxHeight(),
412
- width: this.maxWidth(),
406
+ height: this.maxHeight,
407
+ width: this.maxWidth,
413
408
  dataType: this.format.value,
414
409
  quality: qualityItem,
415
410
  maintainRatio: this.maintainAspectRatio.value,
@@ -517,8 +512,8 @@ class GuajiritosImagePicker {
517
512
  this.imageSrc.set(dataUri);
518
513
  this.showCrop.setValue(false);
519
514
  this.onCropStateChange();
520
- this.maxWidth.set(canvas?.width);
521
- this.maxHeight.set(canvas?.height);
515
+ this.maxWidth = canvas?.width;
516
+ this.maxHeight = canvas?.height;
522
517
  this.lastOriginSrc = this.originImageSrc + '';
523
518
  this.originImageSrc = dataUri;
524
519
  this.$imageChanged.next(this.imageSrc());
@@ -531,8 +526,8 @@ class GuajiritosImagePicker {
531
526
  if (this.arrayCopiedImages.length) {
532
527
  let lastState = this.arrayCopiedImages.pop();
533
528
  this.imageSrc.set(lastState.lastImage);
534
- this.maxWidth.set(lastState.width);
535
- this.maxHeight.set(lastState.height);
529
+ this.maxWidth = lastState?.width;
530
+ this.maxHeight = lastState?.height;
536
531
  this.originImageSrc = this.lastOriginSrc + '';
537
532
  this.noEdit.set(false);
538
533
  }
@@ -552,8 +547,8 @@ class GuajiritosImagePicker {
552
547
  this.$imageOriginal.next(null);
553
548
  this.$imageChanged.next(null);
554
549
  this.format.setValue('jpeg');
555
- this.maxHeight.set(2000);
556
- this.maxWidth.set(2000);
550
+ this.maxHeight = 2000;
551
+ this.maxWidth = 2000;
557
552
  this.cropHeight.setValue(150);
558
553
  this.cropWidth.setValue(150);
559
554
  this.maintainAspectRatio.setValue(true);
@@ -565,25 +560,27 @@ class GuajiritosImagePicker {
565
560
  this.unsubscribeAll$.complete();
566
561
  }
567
562
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: GuajiritosImagePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
568
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", 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]=\"'UPLOAD_A_IMAGE' | i18n: config()?.language\" class='image-upload-btn' mat-icon-button\r\n (click)='onUpload($event)'>\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <input #imagePicker type='file' class='d-none' [id]=\"'filePicker-' + uuidFilePicker\"\r\n (change)='handleFileSelect($event)' [accept]='imagesAllowed'>\r\n </div>\r\n</div>\r\n\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' class='d-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' [class.warn]='(imageSrc()?.length | calculateSize) > 200'\r\n [class.fw-600]='(imageSrc()?.length | calculateSize) > 200'>\r\n {{\"SIZE\" | i18n: currentLanguage()}}: {{ (imageSrc()?.length | calculateSize) }}Kb &nbsp; {{ format.value }}\r\n </p>\r\n\r\n <div class='editing-bar-btn'>\r\n <button id='upload-img' *ngIf='!config()?.hideAddBtn' mat-icon-button (click)='onUpload($event)'\r\n [matTooltip]=\"'UPLOAD_A_IMAGE' | i18n: config()?.language\">\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <button id='edit-img' *ngIf='!config()?.hideEditBtn && !noEdit()' mat-icon-button (click)='showEditPanel.set(true)'\r\n [matTooltip]=\"'OPEN_EDITOR_PANEL' | i18n: config()?.language\">\r\n <mat-icon class='mat-18'>edit</mat-icon>\r\n </button>\r\n <a id='download-img' *ngIf='!config()?.hideDownloadBtn' [matTooltip]=\"'DOWNLOAD' | i18n: config()?.language\"\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 (click)='onRemove()'\r\n [matTooltip]=\"'REMOVE' | i18n: config()?.language\">\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 class='popup-clear'>\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='item-panel fw-600'>{{ 'QUALITY' | i18n: config()?.language }}</p>\r\n <div class='quality-container'>\r\n <mat-slider ngDefaultControl [color]='color' class='w-100 mw-100' (change)='onChangeQuality()'\r\n [max]='100' [min]='0' [step]='1' [discrete]='true' [showTickMarks]='true'>\r\n <input matSliderThumb [formControl]='quality'>\r\n </mat-slider>\r\n </div>\r\n\r\n <div class='item-panel'>\r\n <span class='fw-600'>{{ 'MAX_DIMENSIONS' | i18n: config()?.language }}</span>\r\n <mat-checkbox class='float-right' [formControl]='maintainAspectRatio' [color]='color'>\r\n <span>{{ 'ASPECT_RATIO' | i18n: config()?.language }}</span>\r\n </mat-checkbox>\r\n </div>\r\n\r\n <div class='max-dimension-container'>\r\n <mat-form-field class='w-48' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ 'MAX_WIDTH_PX' | i18n: config()?.language }}</mat-label>\r\n <input (change)='onChangeSize(true, false)' matInput [placeholder]=\"'MAX_WIDTH_PX' | i18n: config()?.language\"\r\n [(ngModel)]='maxWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n\r\n <mat-form-field class='w-48' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ 'MAX_HEIGHT_PX' | i18n: config()?.language }}</mat-label>\r\n <input (change)='onChangeSize(false, true)' matInput [placeholder]=\"'MAX_HEIGHT_PX' | i18n: config()?.language\"\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 fw-600'>{{ 'FORMAT' | i18n: config()?.language }}</p>\r\n <div class='formats-selection'>\r\n <mat-form-field class='w-100 mw-100' [appearance]='appearance' [color]='color'>\r\n <mat-select [formControl]='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 class='refresh-container'>\r\n <mat-checkbox (change)='onCropStateChange()' [formControl]='showCrop' [color]='color'>\r\n <p class='item-panel fw-600'>{{ 'CROP' | i18n: config()?.language }}</p>\r\n </mat-checkbox>\r\n <div class='d-flex '>\r\n <button class='float-right' mat-icon-button [color]='color' (click)='onRestore()'>\r\n <mat-icon>refresh</mat-icon>\r\n </button>\r\n <p *ngIf='showCrop.value'>\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 </div>\r\n </div>\r\n\r\n <ng-container *ngIf='showCrop.value'>\r\n <div class='dimension-container'>\r\n <mat-form-field class='w-48 mw-48' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ 'WIDTH_PX' | i18n: config()?.language }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput [placeholder]=\"'WIDTH_PX' | i18n: config()?.language\"\r\n [formControl]='cropWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n <mat-form-field class='w-48 mw-48' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ 'HEIGHT_PX' | i18n: config()?.language }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput [placeholder]=\"'HEIGHT_PX' | i18n: config()?.language\"\r\n [formControl]='cropHeight' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n\r\n <div class='save-container'>\r\n <button mat-flat-button (click)='onCloseEditPanel()' [color]='color' class='save-button'>\r\n {{ 'SAVE' | i18n: config()?.language}}\r\n </button>\r\n\r\n <p *ngIf='imageSrc()?.length' class='mat-caption image-caption'\r\n [class.warn]='(imageSrc()?.length | calculateSize) > 200'\r\n [class.fw-600]='(imageSrc()?.length | calculateSize) > 200'>\r\n {{\"SIZE\" | i18n: currentLanguage()}}: {{ (imageSrc()?.length | calculateSize) }}Kb &nbsp; {{ format.value }}\r\n </p>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".d-none{display:none}.d-flex{display:flex}.fw-600{font-weight:600}.w-100{width:100%}.mw-100{max-width:100%}.w-48{width:48%}.mw-48{max-width:48%}.float-right{float:right}p{margin:0!important;padding:0!important}.place-image{flex-direction:column;box-sizing:border-box;display:flex;place-content:flex-start;align-items:center}.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;background-color:#fff}@media (max-width: 599px){.place-image .image-holder{max-width:100%!important;max-height:250px!important}}.place-image .image-holder .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;box-sizing:content-box}.place-image .image-holder .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px}@media (max-width: 599px){.place-image .image-holder .image-upload-btn{opacity:1;width:30px;height:30px}.place-image .image-holder .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}.place-image .image-holder:hover .image-upload-btn{opacity:1;transition:all .5s ease}.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}.place-image .image-holder-loaded .image-caption{position:absolute;right:0;bottom:-22px}.place-image .image-holder-loaded img{height:100%;max-height:100%;width:100%;max-width:100%;object-fit:contain;object-position:center}@media (max-width: 599px){.place-image .image-holder-loaded{max-height:195px!important}}.place-image .image-holder-loaded .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;box-sizing:content-box}.place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px}@media (max-width: 599px){.place-image .image-holder-loaded .image-upload-btn{opacity:1;width:30px;height:30px}.place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}.place-image .image-holder-loaded:hover .image-upload-btn{opacity:1;transition:all .5s ease}.place-image .editing-bar-btn{margin-top:2px;display:flex;flex-direction:row;box-sizing:border-box;place-content:flex-start;align-items:flex-start}.place-image .editing-bar-btn .mat-icon-button{height:20px;line-height:20px;width:24px}.place-image .editing-bar-btn mat-icon{line-height:20px!important;font-size:20px!important;width:20px!important;height:20px!important}.place-image .editing-bar-btn button{margin:4px;transition:all .5s ease}.place-image .editing-bar-btn button:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}.place-image .editing-bar-btn a{margin:4px;transition:all .5s ease}.place-image .editing-bar-btn a:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}.popup{width:100vw;max-height:100%;height:100%;overflow:auto;position:fixed;top:0;left:0;z-index:1000;padding:24px;color:#fff;box-sizing:border-box;animation-name:show;animation-duration:.4s}.popup .popup-clear{flex-direction:row;box-sizing:border-box;display:flex;place-content:center flex-end;align-items:center}.popup .image-container{margin-top:50px;margin-bottom:50px;height:calc(100vh - 188px);min-height:calc(100vh - 188px);min-width:100%;width:100%;flex-flow:row wrap;box-sizing:border-box;display:flex;place-content:flex-start center;align-items:flex-start}.popup .image-container .image-holder-full{height:auto;width:auto;position:relative;display:contents}.popup img{max-height:600px;max-width:100%;object-fit:contain;object-position:center;margin:8px;transition:all .5s ease}@media (max-width: 1024px){.popup{background-color:#000000d9;padding:8px}.popup img{max-height:100%;max-width:100%}}@media (max-width: 599px){.popup img{margin:0}}.popup .control-panel{color:#000;background-color:#fff;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){.popup .control-panel{margin:8px 0;width:100%}}.popup .control-panel .title-panel{padding:0 4px;font-size:16px;margin-bottom:16px!important}.popup .control-panel .item-panel{padding:0 4px!important;font-size:12px;display:flex;justify-content:space-between;align-items:center;gap:4px}.popup .control-panel .formats-selection{margin-top:8px!important;flex-direction:row;box-sizing:border-box;display:flex;place-content:flex-start;align-items:flex-start}.popup .control-panel .max-dimension-container{margin-top:16px!important;flex-flow:row;box-sizing:border-box;display:flex;place-content:flex-start space-between;align-items:flex-start}.popup .control-panel .dimension-container{margin-top:8px!important;flex-flow:row wrap;box-sizing:border-box;display:flex;place-content:flex-start space-between;align-items:flex-start}.popup .control-panel .save-container{flex-direction:row;box-sizing:border-box;display:flex;place-content:center space-between;align-items:center}.popup .control-panel .save-container .save-button{padding:0 8px;height:34px;box-sizing:border-box;font-weight:600}.popup .control-panel .quality-container{flex-direction:row;box-sizing:border-box;display:flex;place-content:flex-start;align-items:flex-start}.popup .control-panel .refresh-container{display:flex;justify-content:space-between;align-items:center}.popup .control-panel .refresh-container div{display:flex;align-items:center}@keyframes show{0%{top:-100vh;opacity:0}to{top:0;opacity:1}}.mat-form-field-appearance-fill .mat-form-field-flex{background-color:#fff!important}.mat-select-panel{background:white!important}input.mat-input-element{color:#000000d9}.mat-checkbox-background{background-color:#fff}.image-cropper{position:absolute;width:150px;height:150px;border:2.5px solid white;box-sizing:border-box;resize:both;overflow:auto;opacity:0}.image-cropper #image-cropper-header{padding:10px;cursor:move;z-index:10;background-color:transparent;height:85%}.image-cropper #image-cropper-header mat-icon{color:#fff}.btn{padding:4px 8px;border-radius:4px;cursor:pointer}.btn mat-icon{color:#000000d1}\n"], dependencies: [{ kind: "ngmodule", type: BrowserAnimationsModule }, { 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: "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: MatButtonModule }, { kind: "component", type: i4.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: i4.MatIconAnchor, selector: "a[mat-icon-button]", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i4.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i5.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatSliderModule }, { kind: "component", type: i6.MatSlider, selector: "mat-slider", inputs: ["color", "disableRipple", "disabled", "discrete", "showTickMarks", "min", "max", "step", "displayWith"], exportAs: ["matSlider"] }, { kind: "directive", type: i6.MatSliderThumb, selector: "input[matSliderThumb]", inputs: ["value"], outputs: ["valueChange", "dragStart", "dragEnd"], exportAs: ["matSliderThumb"] }, { 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: FormsModule }, { kind: "directive", type: i9.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: i9.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i9.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i9.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i9.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i9.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: MatSelectModule }, { kind: "component", type: i10.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "panelWidth", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i11.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i9.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: PipesModule }, { kind: "pipe", type: I18nPipe, name: "i18n" }, { kind: "pipe", type: CalculateSizePipe, name: "calculateSize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
563
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.4", 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]=\"'UPLOAD_A_IMAGE' | i18n: config()?.language\" class='image-upload-btn' mat-icon-button\r\n (click)='onUpload($event)'>\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <input #imagePicker type='file' class='d-none' [id]=\"'filePicker-' + uuidFilePicker\"\r\n (change)='handleFileSelect($event)' [accept]='imagesAllowed'>\r\n </div>\r\n</div>\r\n\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' class='d-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' [class.warn]='(imageSrc()?.length | calculateSize) > 200'\r\n [class.fw-600]='(imageSrc()?.length | calculateSize) > 200'>\r\n {{\"SIZE\" | i18n: currentLanguage()}}: {{ (imageSrc()?.length | calculateSize) }}Kb &nbsp; {{ format.value }}\r\n </p>\r\n\r\n <div class='editing-bar-btn'>\r\n <button id='upload-img' *ngIf='!config()?.hideAddBtn' mat-icon-button (click)='onUpload($event)'\r\n [matTooltip]=\"'UPLOAD_A_IMAGE' | i18n: config()?.language\">\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <button id='edit-img' *ngIf='!config()?.hideEditBtn && !noEdit()' mat-icon-button (click)='showEditPanel.set(true)'\r\n [matTooltip]=\"'OPEN_EDITOR_PANEL' | i18n: config()?.language\">\r\n <mat-icon class='mat-18'>edit</mat-icon>\r\n </button>\r\n <a id='download-img' *ngIf='!config()?.hideDownloadBtn' [matTooltip]=\"'DOWNLOAD' | i18n: config()?.language\"\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 (click)='onRemove()'\r\n [matTooltip]=\"'REMOVE' | i18n: config()?.language\">\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 class='popup-clear'>\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='item-panel fw-600'>{{ 'QUALITY' | i18n: config()?.language }}</p>\r\n <div class='quality-container'>\r\n <mat-slider ngDefaultControl [color]='color' class='w-100 mw-100' (change)='onChangeQuality()'\r\n [max]='100' [min]='0' [step]='1' [discrete]='true' [showTickMarks]='true'>\r\n <input matSliderThumb [formControl]='quality'>\r\n </mat-slider>\r\n </div>\r\n\r\n <div class='item-panel'>\r\n <span class='fw-600'>{{ 'MAX_DIMENSIONS' | i18n: config()?.language }}</span>\r\n <mat-checkbox class='float-right' [formControl]='maintainAspectRatio' [color]='color'>\r\n <span>{{ 'ASPECT_RATIO' | i18n: config()?.language }}</span>\r\n </mat-checkbox>\r\n </div>\r\n\r\n <div class='max-dimension-container'>\r\n <mat-form-field class='w-48' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ 'MAX_WIDTH_PX' | i18n: config()?.language }}</mat-label>\r\n <input (change)='onChangeSize(true, false)' matInput [placeholder]=\"'MAX_WIDTH_PX' | i18n: config()?.language\"\r\n [(ngModel)]='maxWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n\r\n <mat-form-field class='w-48' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ 'MAX_HEIGHT_PX' | i18n: config()?.language }}</mat-label>\r\n <input (change)='onChangeSize(false, true)' matInput [placeholder]=\"'MAX_HEIGHT_PX' | i18n: config()?.language\"\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 fw-600'>{{ 'FORMAT' | i18n: config()?.language }}</p>\r\n <div class='formats-selection'>\r\n <mat-form-field class='w-100 mw-100' [appearance]='appearance' [color]='color'>\r\n <mat-select [formControl]='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 class='refresh-container'>\r\n <mat-checkbox (change)='onCropStateChange()' [formControl]='showCrop' [color]='color'>\r\n <p class='item-panel fw-600'>{{ 'CROP' | i18n: config()?.language }}</p>\r\n </mat-checkbox>\r\n <div class='d-flex '>\r\n <button class='float-right' mat-icon-button [color]='color' (click)='onRestore()'>\r\n <mat-icon>refresh</mat-icon>\r\n </button>\r\n <p *ngIf='showCrop.value'>\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 </div>\r\n </div>\r\n\r\n <ng-container *ngIf='showCrop.value'>\r\n <div class='dimension-container'>\r\n <mat-form-field class='w-48 mw-48' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ 'WIDTH_PX' | i18n: config()?.language }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput [placeholder]=\"'WIDTH_PX' | i18n: config()?.language\"\r\n [formControl]='cropWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n <mat-form-field class='w-48 mw-48' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ 'HEIGHT_PX' | i18n: config()?.language }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput [placeholder]=\"'HEIGHT_PX' | i18n: config()?.language\"\r\n [formControl]='cropHeight' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n\r\n <div class='save-container'>\r\n <button mat-flat-button (click)='onCloseEditPanel()' [color]='color' class='save-button'>\r\n {{ 'SAVE' | i18n: config()?.language}}\r\n </button>\r\n\r\n <p *ngIf='imageSrc()?.length' class='mat-caption image-caption'\r\n [class.warn]='(imageSrc()?.length | calculateSize) > 200'\r\n [class.fw-600]='(imageSrc()?.length | calculateSize) > 200'>\r\n {{\"SIZE\" | i18n: currentLanguage()}}: {{ (imageSrc()?.length | calculateSize) }}Kb &nbsp; {{ format.value }}\r\n </p>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".d-none{display:none}.d-flex{display:flex}.fw-600{font-weight:600}.w-100{width:100%}.mw-100{max-width:100%}.w-48{width:48%}.mw-48{max-width:48%}.float-right{float:right}p{margin:0!important;padding:0!important}.place-image{flex-direction:column;box-sizing:border-box;display:flex;place-content:flex-start;align-items:center}.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;background-color:#fff}@media (max-width: 599px){.place-image .image-holder{max-width:100%!important;max-height:250px!important}}.place-image .image-holder .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;box-sizing:content-box}.place-image .image-holder .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px}@media (max-width: 599px){.place-image .image-holder .image-upload-btn{opacity:1;width:30px;height:30px}.place-image .image-holder .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}.place-image .image-holder:hover .image-upload-btn{opacity:1;transition:all .5s ease}.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}.place-image .image-holder-loaded .image-caption{position:absolute;right:0;bottom:-22px}.place-image .image-holder-loaded img{height:100%;max-height:100%;width:100%;max-width:100%;object-fit:contain;object-position:center}@media (max-width: 599px){.place-image .image-holder-loaded{max-height:195px!important}}.place-image .image-holder-loaded .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;box-sizing:content-box}.place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px}@media (max-width: 599px){.place-image .image-holder-loaded .image-upload-btn{opacity:1;width:30px;height:30px}.place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}.place-image .image-holder-loaded:hover .image-upload-btn{opacity:1;transition:all .5s ease}.place-image .editing-bar-btn{margin-top:2px;display:flex;flex-direction:row;box-sizing:border-box;place-content:flex-start;align-items:flex-start}.place-image .editing-bar-btn .mat-icon-button{height:20px;line-height:20px;width:24px}.place-image .editing-bar-btn mat-icon{line-height:20px!important;font-size:20px!important;width:20px!important;height:20px!important}.place-image .editing-bar-btn button{margin:4px;transition:all .5s ease}.place-image .editing-bar-btn button:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}.place-image .editing-bar-btn a{margin:4px;transition:all .5s ease}.place-image .editing-bar-btn a:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}.popup{width:100vw;max-height:100%;height:100%;overflow:auto;position:fixed;top:0;left:0;z-index:1000;padding:24px;color:#fff;box-sizing:border-box;animation-name:show;animation-duration:.4s}.popup .popup-clear{flex-direction:row;box-sizing:border-box;display:flex;place-content:center flex-end;align-items:center}.popup .image-container{margin-top:50px;margin-bottom:50px;height:calc(100vh - 188px);min-height:calc(100vh - 188px);min-width:100%;width:100%;flex-flow:row wrap;box-sizing:border-box;display:flex;place-content:flex-start center;align-items:flex-start}.popup .image-container .image-holder-full{height:auto;width:auto;position:relative;display:contents}.popup img{max-height:600px;max-width:100%;object-fit:contain;object-position:center;margin:8px;transition:all .5s ease}@media (max-width: 1024px){.popup{background-color:#000000d9;padding:8px}.popup img{max-height:100%;max-width:100%}}@media (max-width: 599px){.popup img{margin:0}}.popup .control-panel{color:#000;background-color:#fff;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){.popup .control-panel{margin:8px 0;width:100%}}.popup .control-panel .title-panel{padding:0 4px;font-size:16px;margin-bottom:16px!important}.popup .control-panel .item-panel{padding:0 4px!important;font-size:12px;display:flex;justify-content:space-between;align-items:center;gap:4px}.popup .control-panel .formats-selection{margin-top:8px!important;flex-direction:row;box-sizing:border-box;display:flex;place-content:flex-start;align-items:flex-start}.popup .control-panel .max-dimension-container{margin-top:16px!important;flex-flow:row;box-sizing:border-box;display:flex;place-content:flex-start space-between;align-items:flex-start}.popup .control-panel .dimension-container{margin-top:8px!important;flex-flow:row wrap;box-sizing:border-box;display:flex;place-content:flex-start space-between;align-items:flex-start}.popup .control-panel .save-container{flex-direction:row;box-sizing:border-box;display:flex;place-content:center space-between;align-items:center}.popup .control-panel .save-container .save-button{padding:0 8px;height:34px;box-sizing:border-box;font-weight:600}.popup .control-panel .quality-container{flex-direction:row;box-sizing:border-box;display:flex;place-content:flex-start;align-items:flex-start}.popup .control-panel .refresh-container{display:flex;justify-content:space-between;align-items:center}.popup .control-panel .refresh-container div{display:flex;align-items:center}@keyframes show{0%{top:-100vh;opacity:0}to{top:0;opacity:1}}.mat-form-field-appearance-fill .mat-form-field-flex{background-color:#fff!important}.mat-select-panel{background:white!important}input.mat-input-element{color:#000000d9}.mat-checkbox-background{background-color:#fff}.image-cropper{position:absolute;width:150px;height:150px;border:2.5px solid white;box-sizing:border-box;resize:both;overflow:auto;opacity:0}.image-cropper #image-cropper-header{padding:10px;cursor:move;z-index:10;background-color:transparent;height:85%}.image-cropper #image-cropper-header mat-icon{color:#fff}.btn{padding:4px 8px;border-radius:4px;cursor:pointer}.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: MatTooltipModule }, { kind: "directive", type: i1.MatTooltip, selector: "[matTooltip]", exportAs: ["matTooltip"] }, { kind: "ngmodule", type: MatIconModule }, { kind: "component", type: i2.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "ngmodule", type: PipesModule }, { kind: "pipe", type: I18nPipe, name: "i18n" }, { kind: "pipe", type: CalculateSizePipe, name: "calculateSize" }, { kind: "ngmodule", type: MatButtonModule }, { kind: "component", type: i5.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: i5.MatIconAnchor, selector: "a[mat-icon-button]", inputs: ["disabled", "disableRipple", "color", "tabIndex"], exportAs: ["matButton", "matAnchor"] }, { kind: "component", type: i5.MatIconButton, selector: "button[mat-icon-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "ngmodule", type: MatSliderModule }, { kind: "component", type: i6.MatSlider, selector: "mat-slider", inputs: ["color", "disableRipple", "disabled", "discrete", "showTickMarks", "min", "max", "step", "displayWith"], exportAs: ["matSlider"] }, { kind: "directive", type: i6.MatSliderThumb, selector: "input[matSliderThumb]", inputs: ["value"], outputs: ["valueChange", "dragStart", "dragEnd"], exportAs: ["matSliderThumb"] }, { kind: "ngmodule", type: MatCheckboxModule }, { kind: "component", type: i7.MatCheckbox, selector: "mat-checkbox", inputs: ["disableRipple", "color", "tabIndex"], exportAs: ["matCheckbox"] }, { kind: "ngmodule", type: MatFormFieldModule }, { kind: "component", type: i8.MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: i8.MatLabel, selector: "mat-label" }, { kind: "ngmodule", type: MatInputModule }, { kind: "directive", type: i9.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: i10.MatSelect, selector: "mat-select", inputs: ["disabled", "disableRipple", "tabIndex", "panelWidth", "hideSingleSelectionIndicator"], exportAs: ["matSelect"] }, { kind: "component", type: i11.MatOption, selector: "mat-option", exportAs: ["matOption"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i12.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: i12.NumberValueAccessor, selector: "input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]" }, { kind: "directive", type: i12.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i12.MinValidator, selector: "input[type=number][min][formControlName],input[type=number][min][formControl],input[type=number][min][ngModel]", inputs: ["min"] }, { kind: "directive", type: i12.MaxValidator, selector: "input[type=number][max][formControlName],input[type=number][max][formControl],input[type=number][max][ngModel]", inputs: ["max"] }, { kind: "directive", type: i12.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i12.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
569
564
  }
570
565
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.4", ngImport: i0, type: GuajiritosImagePicker, decorators: [{
571
566
  type: Component,
572
567
  args: [{ selector: 'guajiritos-image-picker', changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [
573
- BrowserAnimationsModule,
568
+ NgIf,
569
+ NgStyle,
574
570
  MatTooltipModule,
575
571
  MatIconModule,
572
+ PipesModule,
576
573
  MatButtonModule,
577
- MatCheckboxModule,
578
574
  MatSliderModule,
575
+ MatCheckboxModule,
579
576
  MatFormFieldModule,
580
577
  MatInputModule,
581
- FormsModule,
582
578
  MatSelectModule,
579
+ FormsModule,
583
580
  ReactiveFormsModule,
584
- PipesModule
581
+ NgForOf,
585
582
  ], 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]=\"'UPLOAD_A_IMAGE' | i18n: config()?.language\" class='image-upload-btn' mat-icon-button\r\n (click)='onUpload($event)'>\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <input #imagePicker type='file' class='d-none' [id]=\"'filePicker-' + uuidFilePicker\"\r\n (change)='handleFileSelect($event)' [accept]='imagesAllowed'>\r\n </div>\r\n</div>\r\n\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' class='d-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' [class.warn]='(imageSrc()?.length | calculateSize) > 200'\r\n [class.fw-600]='(imageSrc()?.length | calculateSize) > 200'>\r\n {{\"SIZE\" | i18n: currentLanguage()}}: {{ (imageSrc()?.length | calculateSize) }}Kb &nbsp; {{ format.value }}\r\n </p>\r\n\r\n <div class='editing-bar-btn'>\r\n <button id='upload-img' *ngIf='!config()?.hideAddBtn' mat-icon-button (click)='onUpload($event)'\r\n [matTooltip]=\"'UPLOAD_A_IMAGE' | i18n: config()?.language\">\r\n <mat-icon class='mat-18'>add_a_photo</mat-icon>\r\n </button>\r\n <button id='edit-img' *ngIf='!config()?.hideEditBtn && !noEdit()' mat-icon-button (click)='showEditPanel.set(true)'\r\n [matTooltip]=\"'OPEN_EDITOR_PANEL' | i18n: config()?.language\">\r\n <mat-icon class='mat-18'>edit</mat-icon>\r\n </button>\r\n <a id='download-img' *ngIf='!config()?.hideDownloadBtn' [matTooltip]=\"'DOWNLOAD' | i18n: config()?.language\"\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 (click)='onRemove()'\r\n [matTooltip]=\"'REMOVE' | i18n: config()?.language\">\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 class='popup-clear'>\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='item-panel fw-600'>{{ 'QUALITY' | i18n: config()?.language }}</p>\r\n <div class='quality-container'>\r\n <mat-slider ngDefaultControl [color]='color' class='w-100 mw-100' (change)='onChangeQuality()'\r\n [max]='100' [min]='0' [step]='1' [discrete]='true' [showTickMarks]='true'>\r\n <input matSliderThumb [formControl]='quality'>\r\n </mat-slider>\r\n </div>\r\n\r\n <div class='item-panel'>\r\n <span class='fw-600'>{{ 'MAX_DIMENSIONS' | i18n: config()?.language }}</span>\r\n <mat-checkbox class='float-right' [formControl]='maintainAspectRatio' [color]='color'>\r\n <span>{{ 'ASPECT_RATIO' | i18n: config()?.language }}</span>\r\n </mat-checkbox>\r\n </div>\r\n\r\n <div class='max-dimension-container'>\r\n <mat-form-field class='w-48' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ 'MAX_WIDTH_PX' | i18n: config()?.language }}</mat-label>\r\n <input (change)='onChangeSize(true, false)' matInput [placeholder]=\"'MAX_WIDTH_PX' | i18n: config()?.language\"\r\n [(ngModel)]='maxWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n\r\n <mat-form-field class='w-48' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ 'MAX_HEIGHT_PX' | i18n: config()?.language }}</mat-label>\r\n <input (change)='onChangeSize(false, true)' matInput [placeholder]=\"'MAX_HEIGHT_PX' | i18n: config()?.language\"\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 fw-600'>{{ 'FORMAT' | i18n: config()?.language }}</p>\r\n <div class='formats-selection'>\r\n <mat-form-field class='w-100 mw-100' [appearance]='appearance' [color]='color'>\r\n <mat-select [formControl]='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 class='refresh-container'>\r\n <mat-checkbox (change)='onCropStateChange()' [formControl]='showCrop' [color]='color'>\r\n <p class='item-panel fw-600'>{{ 'CROP' | i18n: config()?.language }}</p>\r\n </mat-checkbox>\r\n <div class='d-flex '>\r\n <button class='float-right' mat-icon-button [color]='color' (click)='onRestore()'>\r\n <mat-icon>refresh</mat-icon>\r\n </button>\r\n <p *ngIf='showCrop.value'>\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 </div>\r\n </div>\r\n\r\n <ng-container *ngIf='showCrop.value'>\r\n <div class='dimension-container'>\r\n <mat-form-field class='w-48 mw-48' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ 'WIDTH_PX' | i18n: config()?.language }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput [placeholder]=\"'WIDTH_PX' | i18n: config()?.language\"\r\n [formControl]='cropWidth' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n <mat-form-field class='w-48 mw-48' [appearance]='appearance' [color]='color'>\r\n <mat-label>{{ 'HEIGHT_PX' | i18n: config()?.language }}</mat-label>\r\n <input (change)='onChangeCrop()' matInput [placeholder]=\"'HEIGHT_PX' | i18n: config()?.language\"\r\n [formControl]='cropHeight' type='number' [min]='0' [max]='2000'>\r\n </mat-form-field>\r\n </div>\r\n </ng-container>\r\n\r\n <div class='save-container'>\r\n <button mat-flat-button (click)='onCloseEditPanel()' [color]='color' class='save-button'>\r\n {{ 'SAVE' | i18n: config()?.language}}\r\n </button>\r\n\r\n <p *ngIf='imageSrc()?.length' class='mat-caption image-caption'\r\n [class.warn]='(imageSrc()?.length | calculateSize) > 200'\r\n [class.fw-600]='(imageSrc()?.length | calculateSize) > 200'>\r\n {{\"SIZE\" | i18n: currentLanguage()}}: {{ (imageSrc()?.length | calculateSize) }}Kb &nbsp; {{ format.value }}\r\n </p>\r\n </div>\r\n </div>\r\n </div>\r\n</div>\r\n", styles: [".d-none{display:none}.d-flex{display:flex}.fw-600{font-weight:600}.w-100{width:100%}.mw-100{max-width:100%}.w-48{width:48%}.mw-48{max-width:48%}.float-right{float:right}p{margin:0!important;padding:0!important}.place-image{flex-direction:column;box-sizing:border-box;display:flex;place-content:flex-start;align-items:center}.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;background-color:#fff}@media (max-width: 599px){.place-image .image-holder{max-width:100%!important;max-height:250px!important}}.place-image .image-holder .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;box-sizing:content-box}.place-image .image-holder .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px}@media (max-width: 599px){.place-image .image-holder .image-upload-btn{opacity:1;width:30px;height:30px}.place-image .image-holder .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}.place-image .image-holder:hover .image-upload-btn{opacity:1;transition:all .5s ease}.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}.place-image .image-holder-loaded .image-caption{position:absolute;right:0;bottom:-22px}.place-image .image-holder-loaded img{height:100%;max-height:100%;width:100%;max-width:100%;object-fit:contain;object-position:center}@media (max-width: 599px){.place-image .image-holder-loaded{max-height:195px!important}}.place-image .image-holder-loaded .image-upload-btn{transition:all .5s ease;position:relative;opacity:.85;width:50px;height:50px;box-sizing:content-box}.place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:50px;width:50px;height:50px;line-height:50px}@media (max-width: 599px){.place-image .image-holder-loaded .image-upload-btn{opacity:1;width:30px;height:30px}.place-image .image-holder-loaded .image-upload-btn mat-icon{font-size:30px;width:30px;height:30px;line-height:30px}}.place-image .image-holder-loaded:hover .image-upload-btn{opacity:1;transition:all .5s ease}.place-image .editing-bar-btn{margin-top:2px;display:flex;flex-direction:row;box-sizing:border-box;place-content:flex-start;align-items:flex-start}.place-image .editing-bar-btn .mat-icon-button{height:20px;line-height:20px;width:24px}.place-image .editing-bar-btn mat-icon{line-height:20px!important;font-size:20px!important;width:20px!important;height:20px!important}.place-image .editing-bar-btn button{margin:4px;transition:all .5s ease}.place-image .editing-bar-btn button:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}.place-image .editing-bar-btn a{margin:4px;transition:all .5s ease}.place-image .editing-bar-btn a:hover{transform:scale(1.25);margin:4px 8px;transition:all .25s ease-in}.popup{width:100vw;max-height:100%;height:100%;overflow:auto;position:fixed;top:0;left:0;z-index:1000;padding:24px;color:#fff;box-sizing:border-box;animation-name:show;animation-duration:.4s}.popup .popup-clear{flex-direction:row;box-sizing:border-box;display:flex;place-content:center flex-end;align-items:center}.popup .image-container{margin-top:50px;margin-bottom:50px;height:calc(100vh - 188px);min-height:calc(100vh - 188px);min-width:100%;width:100%;flex-flow:row wrap;box-sizing:border-box;display:flex;place-content:flex-start center;align-items:flex-start}.popup .image-container .image-holder-full{height:auto;width:auto;position:relative;display:contents}.popup img{max-height:600px;max-width:100%;object-fit:contain;object-position:center;margin:8px;transition:all .5s ease}@media (max-width: 1024px){.popup{background-color:#000000d9;padding:8px}.popup img{max-height:100%;max-width:100%}}@media (max-width: 599px){.popup img{margin:0}}.popup .control-panel{color:#000;background-color:#fff;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){.popup .control-panel{margin:8px 0;width:100%}}.popup .control-panel .title-panel{padding:0 4px;font-size:16px;margin-bottom:16px!important}.popup .control-panel .item-panel{padding:0 4px!important;font-size:12px;display:flex;justify-content:space-between;align-items:center;gap:4px}.popup .control-panel .formats-selection{margin-top:8px!important;flex-direction:row;box-sizing:border-box;display:flex;place-content:flex-start;align-items:flex-start}.popup .control-panel .max-dimension-container{margin-top:16px!important;flex-flow:row;box-sizing:border-box;display:flex;place-content:flex-start space-between;align-items:flex-start}.popup .control-panel .dimension-container{margin-top:8px!important;flex-flow:row wrap;box-sizing:border-box;display:flex;place-content:flex-start space-between;align-items:flex-start}.popup .control-panel .save-container{flex-direction:row;box-sizing:border-box;display:flex;place-content:center space-between;align-items:center}.popup .control-panel .save-container .save-button{padding:0 8px;height:34px;box-sizing:border-box;font-weight:600}.popup .control-panel .quality-container{flex-direction:row;box-sizing:border-box;display:flex;place-content:flex-start;align-items:flex-start}.popup .control-panel .refresh-container{display:flex;justify-content:space-between;align-items:center}.popup .control-panel .refresh-container div{display:flex;align-items:center}@keyframes show{0%{top:-100vh;opacity:0}to{top:0;opacity:1}}.mat-form-field-appearance-fill .mat-form-field-flex{background-color:#fff!important}.mat-select-panel{background:white!important}input.mat-input-element{color:#000000d9}.mat-checkbox-background{background-color:#fff}.image-cropper{position:absolute;width:150px;height:150px;border:2.5px solid white;box-sizing:border-box;resize:both;overflow:auto;opacity:0}.image-cropper #image-cropper-header{padding:10px;cursor:move;z-index:10;background-color:transparent;height:85%}.image-cropper #image-cropper-header mat-icon{color:#fff}.btn{padding:4px 8px;border-radius:4px;cursor:pointer}.btn mat-icon{color:#000000d1}\n"] }]
586
- }], ctorParameters: function () { return []; }, propDecorators: { appearance: [{
583
+ }], propDecorators: { appearance: [{
587
584
  type: Input
588
585
  }], color: [{
589
586
  type: Input