@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.
@@ -1781,6 +1781,10 @@ var ImgEditorComponent = /** @class */ (function () {
1781
1781
  return;
1782
1782
  }
1783
1783
  this.isLoading = true;
1784
+ if (!this.isImgModified && !this.isNameModified) {
1785
+ this.isLoading = false;
1786
+ this.onEditClosed();
1787
+ }
1784
1788
  var obsReplaceImg = this.imgManagerService.replaceImg(this.currentCroppedImage, this.imgToEdit.id_file);
1785
1789
  var obsChangeImgName = this.imgManagerService.changeImgName(this.imgToEdit.display_name, this.imgToEdit.id_file);
1786
1790
  if (this.isImgModified && this.isNameModified) {
@@ -1856,7 +1860,7 @@ var ImgEditorComponent = /** @class */ (function () {
1856
1860
  ImgEditorComponent = __decorate([
1857
1861
  Component({
1858
1862
  selector: 'img-editor',
1859
- 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",
1863
+ 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",
1860
1864
  animations: [
1861
1865
  easeInOut
1862
1866
  ]
@@ -2980,8 +2984,8 @@ var ImagesViewComponent = /** @class */ (function () {
2980
2984
  var _this = this;
2981
2985
  this.isLoading = true;
2982
2986
  this.displayPexelsResults = false;
2983
- this.isTotalRetieved = false;
2984
2987
  this.setParams();
2988
+ this.refreshTotalImgList();
2985
2989
  this.imgManager.getShopImgList(this.params).pipe(take(1)).subscribe(function (data) {
2986
2990
  _this.initVariables(true);
2987
2991
  var nbImgDisplayed = data.data.length;
@@ -2999,7 +3003,6 @@ var ImagesViewComponent = /** @class */ (function () {
2999
3003
  if (data.totalRecords === 0) {
3000
3004
  _this.displayPexelsLib();
3001
3005
  }
3002
- _this.refreshTotalImgList();
3003
3006
  }, function (error) {
3004
3007
  _this.alertService.openAlert(_this.errorGetAllImg);
3005
3008
  _this.initVariables(false);
@@ -3007,12 +3010,19 @@ var ImagesViewComponent = /** @class */ (function () {
3007
3010
  };
3008
3011
  ImagesViewComponent.prototype.refreshTotalImgList = function () {
3009
3012
  var _this = this;
3013
+ var searchValue = this.tableFilters.searchValue;
3014
+ if (this.isTotalRetieved && searchValue === this.previousSearchValue) {
3015
+ // Keep current total result
3016
+ return;
3017
+ }
3018
+ this.isTotalRetieved = false;
3010
3019
  this.imgManager.getShopTotalImgList(this.params).pipe(take(1)).subscribe(function (data) {
3020
+ _this.previousSearchValue = searchValue;
3011
3021
  _this.isTotalRetieved = true;
3012
3022
  _this.length = data.totalRecords;
3013
3023
  _this.tableFilters.totalItems = data.totalRecords;
3014
3024
  }, function (error) {
3015
- _this.alertService.openAlert(_this.errorGetTotalImg);
3025
+ //this.alertService.openAlert(this.errorGetTotalImg);
3016
3026
  _this.initVariables(false);
3017
3027
  });
3018
3028
  };