@wizishop/img-manager 0.2.75 → 0.2.76

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.
@@ -1667,6 +1667,10 @@ let ImgEditorComponent = class ImgEditorComponent {
1667
1667
  return;
1668
1668
  }
1669
1669
  this.isLoading = true;
1670
+ if (!this.isImgModified && !this.isNameModified) {
1671
+ this.isLoading = false;
1672
+ this.onEditClosed();
1673
+ }
1670
1674
  const obsReplaceImg = this.imgManagerService.replaceImg(this.currentCroppedImage, this.imgToEdit.id_file);
1671
1675
  const obsChangeImgName = this.imgManagerService.changeImgName(this.imgToEdit.display_name, this.imgToEdit.id_file);
1672
1676
  if (this.isImgModified && this.isNameModified) {
@@ -1742,7 +1746,7 @@ __decorate([
1742
1746
  ImgEditorComponent = __decorate([
1743
1747
  Component({
1744
1748
  selector: 'img-editor',
1745
- template: "<div class=\"img-editor\" [@easeInOut]=\"'in'\">\n\n <ng-scrollbar\n #scrollable\n [visibility]=\"'native'\"\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\"\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 </ng-scrollbar>\n</div>\n",
1749
+ template: "<div class=\"img-editor\" [@easeInOut]=\"'in'\">\n\n <ng-scrollbar\n #scrollable\n [visibility]=\"'native'\"\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 </ng-scrollbar>\n</div>\n",
1746
1750
  animations: [
1747
1751
  easeInOut
1748
1752
  ]
@@ -2796,8 +2800,8 @@ let ImagesViewComponent = class ImagesViewComponent {
2796
2800
  _getImgList() {
2797
2801
  this.isLoading = true;
2798
2802
  this.displayPexelsResults = false;
2799
- this.isTotalRetieved = false;
2800
2803
  this.setParams();
2804
+ this.refreshTotalImgList();
2801
2805
  this.imgManager.getShopImgList(this.params).pipe(take(1)).subscribe((data) => {
2802
2806
  this.initVariables(true);
2803
2807
  const nbImgDisplayed = data.data.length;
@@ -2815,19 +2819,25 @@ let ImagesViewComponent = class ImagesViewComponent {
2815
2819
  if (data.totalRecords === 0) {
2816
2820
  this.displayPexelsLib();
2817
2821
  }
2818
- this.refreshTotalImgList();
2819
2822
  }, error => {
2820
2823
  this.alertService.openAlert(this.errorGetAllImg);
2821
2824
  this.initVariables(false);
2822
2825
  });
2823
2826
  }
2824
2827
  refreshTotalImgList() {
2828
+ const searchValue = this.tableFilters.searchValue;
2829
+ if (this.isTotalRetieved && searchValue === this.previousSearchValue) {
2830
+ // Keep current total result
2831
+ return;
2832
+ }
2833
+ this.isTotalRetieved = false;
2825
2834
  this.imgManager.getShopTotalImgList(this.params).pipe(take(1)).subscribe((data) => {
2835
+ this.previousSearchValue = searchValue;
2826
2836
  this.isTotalRetieved = true;
2827
2837
  this.length = data.totalRecords;
2828
2838
  this.tableFilters.totalItems = data.totalRecords;
2829
2839
  }, error => {
2830
- this.alertService.openAlert(this.errorGetTotalImg);
2840
+ //this.alertService.openAlert(this.errorGetTotalImg);
2831
2841
  this.initVariables(false);
2832
2842
  });
2833
2843
  }