@wizishop/img-manager 0.2.103 → 0.2.108

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.
@@ -2046,7 +2046,7 @@ var ImgEditorComponent = /** @class */ (function () {
2046
2046
  ImgEditorComponent = __decorate([
2047
2047
  Component({
2048
2048
  selector: 'img-editor',
2049
- template: "<div class=\"img-editor\" [@easeInOut]=\"'in'\">\n\n <perfect-scrollbar\n class=\"img-editor__scroll\"\n [ngClass]=\"{\n 'img-editor__scroll--full': stateDisplayed === 'full',\n 'img-editor__scroll--smallDisplay': stateDisplayed === 'small',\n 'img-editor__scroll--window': stateDisplayed === 'window'\n }\"\n >\n <div class=\"columns\">\n <!-- Left section -->\n <div class=\"column is-one-third img-editor__infoSection\">\n\n <info-section\n [imgToEdit]=\"imgToEdit\"\n [(isNameModified)]=\"isNameModified\"\n >\n </info-section>\n\n <!-- Button Action Section -->\n\n <div class=\"img-editor__infoSection__actions\">\n <div>\n <button\n class=\"button img-editor__infoSection__actions__cancel\"\n (click)=\"onCancel()\"\n [disabled]=\"isLoading || (!isImgModified && !isNameModified)\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <div\n class=\"button danger button img-editor__infoSection__actions__save\"\n [ngClass]=\"{'img-editor__infoSection__actions__save--disable': isLoading}\"\n (click)=\"onSave()\"\n >\n {{ 'ImgManager.ImgEditor.saveBtn' | translate }}\n <span btnLoadingAnim *ngIf=\"isLoading\" class=\"btnLoadingAnnimation\"></span>\n </div>\n\n </div>\n </div>\n </div>\n\n\n <!-- Right section -->\n <div class=\"column img-editor__container\">\n <cropper\n [imgToEdit]=\"imgToEdit\"\n [(isImgModified)]=\"isImgModified\"\n (currentCroppedImageChange)=\"onImgCropped($event)\"\n (editClosed)=\"onEditClosed($event)\">\n </cropper>\n </div>\n </div>\n </perfect-scrollbar>\n</div>\n",
2049
+ template: "<div class=\"img-editor\" [@easeInOut]=\"'in'\">\n\n <!-- Button Action Section -->\n\n <div class=\"img-editor__infoSection__actions\">\n <div>\n <button\n class=\"button img-editor__infoSection__actions__cancel\"\n (click)=\"onCancel()\"\n [disabled]=\"isLoading || (!isImgModified && !isNameModified)\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <div\n class=\"button danger button img-editor__infoSection__actions__save\"\n [ngClass]=\"{'img-editor__infoSection__actions__save--disable': isLoading}\"\n (click)=\"onSave()\"\n >\n {{ 'ImgManager.ImgEditor.saveBtn' | translate }}\n <span btnLoadingAnim *ngIf=\"isLoading\" class=\"btnLoadingAnnimation\"></span>\n </div>\n\n </div>\n </div>\n\n <perfect-scrollbar\n [config]=\"{suppressScrollX: true}\"\n class=\"img-editor__scroll\"\n [ngClass]=\"{\n 'img-editor__scroll--full': stateDisplayed === 'full',\n 'img-editor__scroll--smallDisplay': stateDisplayed === 'small',\n 'img-editor__scroll--window': stateDisplayed === 'window'\n }\"\n >\n <div class=\"columns\">\n <!-- Left section -->\n <div class=\"column is-one-third img-editor__infoSection\">\n\n <info-section\n [imgToEdit]=\"imgToEdit\"\n [(isNameModified)]=\"isNameModified\"\n >\n </info-section>\n </div>\n\n\n <!-- Right section -->\n <div class=\"column img-editor__container\">\n <cropper\n [imgToEdit]=\"imgToEdit\"\n [(isImgModified)]=\"isImgModified\"\n (currentCroppedImageChange)=\"onImgCropped($event)\"\n (editClosed)=\"onEditClosed($event)\">\n </cropper>\n </div>\n </div>\n </perfect-scrollbar>\n</div>\n",
2050
2050
  animations: [
2051
2051
  easeInOut
2052
2052
  ]
@@ -2422,8 +2422,9 @@ var CropperComponent = /** @class */ (function () {
2422
2422
  this.currentCroppedImage = ''; // Img modified return in base64
2423
2423
  this.isCropped = false;
2424
2424
  this.isLoading = false;
2425
- this.isImgCropped = false;
2426
- this.isImgCroppedInitilized = false;
2425
+ this._isImgCropped = false;
2426
+ this.imgCropperChange = new Subject();
2427
+ this.skipNextImgCropped = 1;
2427
2428
  this.imageChangedEvent = '';
2428
2429
  this.croppedImage = '';
2429
2430
  this.canvasRotation = 0;
@@ -2524,8 +2525,22 @@ var CropperComponent = /** @class */ (function () {
2524
2525
  enumerable: true,
2525
2526
  configurable: true
2526
2527
  });
2528
+ Object.defineProperty(CropperComponent.prototype, "isImgCropped", {
2529
+ get: function () {
2530
+ return this._isImgCropped;
2531
+ },
2532
+ set: function (isImgCropped) {
2533
+ var _this = this;
2534
+ setTimeout(function () {
2535
+ _this._isImgCropped = isImgCropped;
2536
+ }, 0);
2537
+ },
2538
+ enumerable: true,
2539
+ configurable: true
2540
+ });
2527
2541
  CropperComponent.prototype.ngOnInit = function () {
2528
2542
  this.init();
2543
+ this.detectImgCropperChange();
2529
2544
  };
2530
2545
  CropperComponent.prototype.init = function () {
2531
2546
  this.imgRoute = this.getRAWImgRoute();
@@ -2566,7 +2581,7 @@ var CropperComponent = /** @class */ (function () {
2566
2581
  this.imageChangedEvent = event;
2567
2582
  };
2568
2583
  CropperComponent.prototype.imageCropped = function (event) {
2569
- this.detectImgCropperChange();
2584
+ this.imgCropperChange.next();
2570
2585
  this.currentCroppedImage = event.base64;
2571
2586
  this.currentCroppedImageChange.emit(this.currentCroppedImage);
2572
2587
  };
@@ -2586,10 +2601,13 @@ var CropperComponent = /** @class */ (function () {
2586
2601
  this.setCropperProperties(config);
2587
2602
  };
2588
2603
  CropperComponent.prototype.confirmCrop = function () {
2589
- this.imgRoute = null;
2590
- this.croppedImage = this.currentCroppedImage;
2591
- this.isImgCropped = false;
2592
- this.isImgCroppedInitilized = false;
2604
+ var _this = this;
2605
+ setTimeout(function () {
2606
+ _this.imgRoute = null;
2607
+ _this.croppedImage = _this.currentCroppedImage;
2608
+ _this.skipNextImgCropped = 2;
2609
+ _this.isImgCropped = false;
2610
+ }, 0);
2593
2611
  this.resetConfCropper();
2594
2612
  this.onImgModified();
2595
2613
  };
@@ -2611,8 +2629,16 @@ var CropperComponent = /** @class */ (function () {
2611
2629
  }
2612
2630
  };
2613
2631
  CropperComponent.prototype.detectImgCropperChange = function () {
2614
- this.isImgCropped = this.isImgCroppedInitilized;
2615
- this.isImgCroppedInitilized = true;
2632
+ var _this = this;
2633
+ this.imgCropperChange
2634
+ .subscribe(function () {
2635
+ _this.skipNextImgCropped--;
2636
+ if (_this.skipNextImgCropped >= 0) {
2637
+ return;
2638
+ }
2639
+ _this.skipNextImgCropped = 0;
2640
+ _this.isImgCropped = true;
2641
+ });
2616
2642
  };
2617
2643
  /* Rotations functions */
2618
2644
  CropperComponent.prototype.rotateLeft = function () {
@@ -2679,7 +2705,7 @@ var CropperComponent = /** @class */ (function () {
2679
2705
  CropperComponent = __decorate([
2680
2706
  Component({
2681
2707
  selector: 'cropper',
2682
- template: "<div class=\"img-editor__container__toolsContainer\">\n\n <div *ngIf=\"isImgCropped\">\n <div\n class=\"img-editor__container__toolsContainer__tool img-editor__container__toolsContainer__tool--button\"\n (click)=\"confirmCrop()\"\n [nwbToolTip]=\"'ImgManager.ImgEditor.ValidtToolTip' | translate\"\n nwbToolTipPosition=\"left\"\n >\n <i class=\"far fa-check\"></i>\n <p>{{ 'ImgManager.ImgEditor.Valid' | translate }}</p>\n </div>\n </div>\n\n <!-- Resolution -->\n <dropdown dropdownId=\"dropdown-resolution\">\n <ng-container label>\n <div\n class=\"img-editor__container__toolsContainer__tool\"\n >\n <i class=\"far fa-crop\"></i>\n <p>{{ 'ImgManager.ImgEditor.crop' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of resolutionConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"changeResolutionSize(index)\">\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <!-- Zoom -->\n <dropdown dropdownId=\"dropdown-rotation\">\n <ng-container label>\n <div class=\"img-editor__container__toolsContainer__tool\" (click)=\"zoomIn()\">\n <i class=\"far fa-expand-arrows-alt\"></i>\n <p>{{ 'ImgManager.ImgEditor.display' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of zoomConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"applyMethod(item.method)\">\n <i *ngIf=\"item.icon\" [ngClass]=\"item.icon\"></i>\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <!-- Rotation -->\n <dropdown dropdownId=\"dropdown-rotation\" dropDownMenuClass=\"img-editor__container__toolsContainer__RotationDropdown\">\n <ng-container label>\n <div class=\"img-editor__container__toolsContainer__tool\" (click)=\"rotateRight()\">\n <i class=\"far fa-redo\"></i>\n <p>{{ 'ImgManager.ImgEditor.rotation' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of rotationConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"applyMethod(item.method)\">\n <i *ngIf=\"item.icon\" [ngClass]=\"item.icon\"></i>\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <div\n class=\"img-editor__container__toolsContainer__tool\"\n (click)=\"onRestart()\"\n @insertRemoveAnnim\n >\n <i class=\"far fa-retweet-alt\"></i>\n <p>{{ 'ImgManager.ImgEditor.restart' | translate }}</p>\n </div>\n</div>\n\n<div class=\"img-editor__image-cropper\" >\n <image-cropper\n [imageURL] = \"imgRoute\"\n [imageBase64] = \"croppedImage\"\n [maintainAspectRatio]=\"imgCropperConfig.maintainAspectRatio\"\n [containWithinAspectRatio]=\"containWithinAspectRatio\"\n [aspectRatio]=\"imgCropperConfig.aspectRatio\"\n [onlyScaleDown]=\"true\"\n [roundCropper]=\"false\"\n [canvasRotation]=\"canvasRotation\"\n [transform]=\"transform\"\n [alignImage]=\"'center'\"\n [style.display]=\"showCropper ? null : 'none'\"\n [format]=\"imgType\"\n [backgroundColor]=\"'white'\"\n (imageCropped)=\"imageCropped($event)\"\n (imageLoaded)=\"imageLoaded()\"\n (cropperReady)=\"cropperReady()\"\n (loadImageFailed)=\"loadImageFailed()\"\n ></image-cropper>\n</div>\n",
2708
+ template: "<div class=\"img-editor__container__toolsContainer\">\n\n <div *ngIf=\"isImgCropped\">\n <div\n class=\"img-editor__container__toolsContainer__tool img-editor__container__toolsContainer__tool--button\"\n (click)=\"confirmCrop()\"\n [nwbToolTip]=\"'ImgManager.ImgEditor.ValidtToolTip' | translate\"\n nwbToolTipPosition=\"left\"\n >\n <i class=\"far fa-check\"></i>\n <p>{{ 'ImgManager.ImgEditor.Valid' | translate }}</p>\n </div>\n </div>\n\n <!-- Resolution -->\n <dropdown dropdownId=\"dropdown-resolution\">\n <ng-container label>\n <div\n class=\"img-editor__container__toolsContainer__tool\"\n >\n <i class=\"far fa-crop\"></i>\n <p>{{ 'ImgManager.ImgEditor.crop' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of resolutionConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"changeResolutionSize(index)\">\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <!-- Zoom -->\n <dropdown dropdownId=\"dropdown-rotation\">\n <ng-container label>\n <div class=\"img-editor__container__toolsContainer__tool\" (click)=\"zoomIn()\">\n <i class=\"far fa-expand-arrows-alt\"></i>\n <p>{{ 'ImgManager.ImgEditor.display' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of zoomConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"applyMethod(item.method)\">\n <i *ngIf=\"item.icon\" [ngClass]=\"item.icon\"></i>\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <!-- Rotation -->\n <dropdown dropdownId=\"dropdown-rotation\" dropDownMenuClass=\"img-editor__container__toolsContainer__RotationDropdown\">\n <ng-container label>\n <div class=\"img-editor__container__toolsContainer__tool\" (click)=\"rotateRight()\">\n <i class=\"far fa-redo\"></i>\n <p>{{ 'ImgManager.ImgEditor.rotation' | translate }}</p>\n </div>\n </ng-container>\n <ng-container item *ngFor=\"let item of rotationConfig; let index = index;\">\n <div\n class=\"dropdown-item\"\n [ngClass]=\"{'active-item': item.active}\"\n (click)=\"applyMethod(item.method)\">\n <i *ngIf=\"item.icon\" [ngClass]=\"item.icon\"></i>\n <p>{{item.label | translate}}</p>\n </div>\n </ng-container>\n </dropdown>\n\n <div\n class=\"img-editor__container__toolsContainer__tool\"\n (click)=\"onRestart()\"\n @insertRemoveAnnim\n >\n <i class=\"far fa-retweet-alt\"></i>\n <p>{{ 'ImgManager.ImgEditor.restart' | translate }}</p>\n </div>\n</div>\n\n<div class=\"img-editor__image-cropper\" >\n <image-cropper\n [imageURL]=\"imgRoute\"\n [imageBase64]=\"croppedImage\"\n [maintainAspectRatio]=\"imgCropperConfig.maintainAspectRatio\"\n [containWithinAspectRatio]=\"containWithinAspectRatio\"\n [aspectRatio]=\"imgCropperConfig.aspectRatio\"\n [onlyScaleDown]=\"true\"\n [roundCropper]=\"false\"\n [canvasRotation]=\"canvasRotation\"\n [transform]=\"transform\"\n [alignImage]=\"'center'\"\n [style.display]=\"showCropper ? null : 'none'\"\n [format]=\"imgType\"\n [backgroundColor]=\"'white'\"\n (imageCropped)=\"imageCropped($event)\"\n (imageLoaded)=\"imageLoaded()\"\n (cropperReady)=\"cropperReady()\"\n (loadImageFailed)=\"loadImageFailed()\"\n ></image-cropper>\n</div>\n",
2683
2709
  animations: [
2684
2710
  insertRemove
2685
2711
  ]
@@ -4340,7 +4366,7 @@ var AlertComponent = /** @class */ (function () {
4340
4366
  Component({
4341
4367
  selector: 'wz-alert',
4342
4368
  template: "<div class=\"wz-alert\" [ngClass]=\"{ success: success, warning: warning }\">\n <i *ngIf=\"icon\" [ngClass]=\"iconClass\"></i>\n <p><ng-content></ng-content></p>\n</div>\n",
4343
- styles: [".wz-alert{width:100%;background-color:rgba(82,174,205,.15);color:#52aecd;border-radius:3px;display:-webkit-box;display:flex;flex-wrap:nowrap;-webkit-box-pack:justify;justify-content:space-between;padding:20px}.wz-alert.success{background-color:rgba(46,204,113,.15)}.wz-alert.success p,.wz-alert.success p>*{color:#11552e}.wz-alert.success i{color:#2ecc71}.wz-alert.warning{background-color:rgba(233,86,86,.15)}.wz-alert.warning p,.wz-alert.warning p>*{color:#3a0505}.wz-alert.warning i{color:#e95656}.wz-alert p{width:100%;font-size:rem(14);line-height:rem(25);margin:0;padding:0;color:#1e5568}.wz-alert p>*{color:#1e5568}.wz-alert i{width:auto;margin:0 10px 0 0;color:inherit;font-size:rem(14);line-height:rem(25)}"]
4369
+ styles: [".wz-alert{width:100%;background-color:rgba(82,174,205,.15);color:#52aecd;border-radius:3px;display:flex;flex-wrap:nowrap;justify-content:space-between;padding:20px}.wz-alert.success{background-color:rgba(46,204,113,.15)}.wz-alert.success p,.wz-alert.success p>*{color:#11552e}.wz-alert.success i{color:#2ecc71}.wz-alert.warning{background-color:rgba(233,86,86,.15)}.wz-alert.warning p,.wz-alert.warning p>*{color:#3a0505}.wz-alert.warning i{color:#e95656}.wz-alert p{width:100%;font-size:rem(14);line-height:rem(25);margin:0;padding:0;color:#1e5568}.wz-alert p>*{color:#1e5568}.wz-alert i{width:auto;margin:0 10px 0 0;color:inherit;font-size:rem(14);line-height:rem(25)}"]
4344
4370
  }),
4345
4371
  __metadata("design:paramtypes", [])
4346
4372
  ], AlertComponent);