@wizishop/img-manager 0.2.71 → 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.
- package/assets/i18n/fr.json +1 -1
- package/bundles/wizishop-img-manager.umd.js +33 -5
- package/bundles/wizishop-img-manager.umd.js.map +1 -1
- package/bundles/wizishop-img-manager.umd.min.js +1 -1
- package/bundles/wizishop-img-manager.umd.min.js.map +1 -1
- package/esm2015/lib/components/images-view/images-view.component.js +26 -6
- package/esm2015/lib/components/img-editor/img-editor.component.js +6 -2
- package/esm2015/lib/services/img-manager.service.js +4 -1
- package/esm5/lib/components/images-view/images-view.component.js +27 -6
- package/esm5/lib/components/img-editor/img-editor.component.js +6 -2
- package/esm5/lib/services/img-manager.service.js +4 -1
- package/fesm2015/wizishop-img-manager.js +33 -6
- package/fesm2015/wizishop-img-manager.js.map +1 -1
- package/fesm5/wizishop-img-manager.js +34 -6
- package/fesm5/wizishop-img-manager.js.map +1 -1
- package/lib/components/images-view/images-view.component.d.ts +4 -0
- package/lib/services/img-manager.service.d.ts +1 -0
- package/package.json +1 -1
- package/wizishop-img-manager-0.2.76.tgz +0 -0
- package/wizishop-img-manager.metadata.json +1 -1
- package/wz-img-manager.scss +155 -155
- package/wizishop-img-manager-0.2.71.tgz +0 -0
|
@@ -5,7 +5,7 @@ import { HttpParams, HttpHeaders, HttpClient, HttpClientModule } from '@angular/
|
|
|
5
5
|
import { trigger, state, style, transition, animate, query, stagger } from '@angular/animations';
|
|
6
6
|
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
|
7
7
|
import { NwbAlertService, NwbFilterRoutingBuilder, NwbAllModule } from '@wizishop/ng-wizi-bulma';
|
|
8
|
-
import { debounceTime, map, takeUntil, distinctUntilChanged, tap } from 'rxjs/operators';
|
|
8
|
+
import { debounceTime, map, take, takeUntil, distinctUntilChanged, tap } from 'rxjs/operators';
|
|
9
9
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
10
10
|
import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
|
|
11
11
|
import { NgScrollbarModule } from 'ngx-scrollbar';
|
|
@@ -212,6 +212,9 @@ var ImgManagerService = /** @class */ (function () {
|
|
|
212
212
|
ImgManagerService.prototype.getShopImgList = function (params) {
|
|
213
213
|
return this.http.get(this.imgManagerRoute + "/images", this.getOptionsHeaders(params));
|
|
214
214
|
};
|
|
215
|
+
ImgManagerService.prototype.getShopTotalImgList = function (params) {
|
|
216
|
+
return this.http.get(this.imgManagerRoute + "/total/image", this.getOptionsHeaders(params));
|
|
217
|
+
};
|
|
215
218
|
ImgManagerService.prototype.getShopImg = function (idFile) {
|
|
216
219
|
return this.http.get(this.imgManagerRoute + "/images/" + idFile, this.getOptionsHeaders());
|
|
217
220
|
};
|
|
@@ -1778,6 +1781,10 @@ var ImgEditorComponent = /** @class */ (function () {
|
|
|
1778
1781
|
return;
|
|
1779
1782
|
}
|
|
1780
1783
|
this.isLoading = true;
|
|
1784
|
+
if (!this.isImgModified && !this.isNameModified) {
|
|
1785
|
+
this.isLoading = false;
|
|
1786
|
+
this.onEditClosed();
|
|
1787
|
+
}
|
|
1781
1788
|
var obsReplaceImg = this.imgManagerService.replaceImg(this.currentCroppedImage, this.imgToEdit.id_file);
|
|
1782
1789
|
var obsChangeImgName = this.imgManagerService.changeImgName(this.imgToEdit.display_name, this.imgToEdit.id_file);
|
|
1783
1790
|
if (this.isImgModified && this.isNameModified) {
|
|
@@ -1853,7 +1860,7 @@ var ImgEditorComponent = /** @class */ (function () {
|
|
|
1853
1860
|
ImgEditorComponent = __decorate([
|
|
1854
1861
|
Component({
|
|
1855
1862
|
selector: 'img-editor',
|
|
1856
|
-
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",
|
|
1857
1864
|
animations: [
|
|
1858
1865
|
easeInOut
|
|
1859
1866
|
]
|
|
@@ -2669,6 +2676,7 @@ var ImagesViewComponent = /** @class */ (function () {
|
|
|
2669
2676
|
this.nbImgToDelSelected = 0;
|
|
2670
2677
|
this.disable = false; // Use to disable action during server request
|
|
2671
2678
|
this.isLoading = true;
|
|
2679
|
+
this.isTotalRetieved = false;
|
|
2672
2680
|
this.delListImgLoader = false;
|
|
2673
2681
|
this.initComponent = true;
|
|
2674
2682
|
this.failLoaded = false;
|
|
@@ -2680,6 +2688,7 @@ var ImagesViewComponent = /** @class */ (function () {
|
|
|
2680
2688
|
this.pageSize = 30; // Default value
|
|
2681
2689
|
this.pageSizeOptions = [25, 50, 100, 250];
|
|
2682
2690
|
this.errorGetAllImg = 'ImgManager.ImgLib.errorGetAllImg';
|
|
2691
|
+
this.errorGetTotalImg = 'ImgManager.ImgLib.errorGetTotalImg';
|
|
2683
2692
|
this.errorGetImg = 'ImgManager.ImgLib.errorGetCanvaImg';
|
|
2684
2693
|
this.msgNoImgFound = 'ImgManager.ImgLib.noImgFound';
|
|
2685
2694
|
this.errorRemoveImg = 'ImgManager.ImgList.errorRemoveImg';
|
|
@@ -2887,7 +2896,7 @@ var ImagesViewComponent = /** @class */ (function () {
|
|
|
2887
2896
|
};
|
|
2888
2897
|
ImagesViewComponent.prototype.getImg = function (id_file) {
|
|
2889
2898
|
var _this = this;
|
|
2890
|
-
this.
|
|
2899
|
+
this.imgManager.getShopImg(id_file).pipe(take(1)).subscribe(function (picture) {
|
|
2891
2900
|
if (!_this.imgAlreadyExist(picture.id_file)) {
|
|
2892
2901
|
// check the img is not already present
|
|
2893
2902
|
_this.picturesList.unshift(picture);
|
|
@@ -2976,15 +2985,16 @@ var ImagesViewComponent = /** @class */ (function () {
|
|
|
2976
2985
|
this.isLoading = true;
|
|
2977
2986
|
this.displayPexelsResults = false;
|
|
2978
2987
|
this.setParams();
|
|
2979
|
-
this.
|
|
2988
|
+
this.refreshTotalImgList();
|
|
2989
|
+
this.imgManager.getShopImgList(this.params).pipe(take(1)).subscribe(function (data) {
|
|
2980
2990
|
_this.initVariables(true);
|
|
2981
2991
|
var nbImgDisplayed = data.data.length;
|
|
2982
2992
|
_this.calculNbImgFake(nbImgDisplayed);
|
|
2983
2993
|
_this.picturesList = data.data;
|
|
2984
2994
|
_this.renamePictureService.setPicturesList(_this.picturesList);
|
|
2985
2995
|
_this.selectImgSelected();
|
|
2986
|
-
_this.length = data.totalRecords;
|
|
2987
|
-
_this.tableFilters.totalItems = data.totalRecords;
|
|
2996
|
+
_this.length = _this.isTotalRetieved ? _this.length : data.totalRecords;
|
|
2997
|
+
_this.tableFilters.totalItems = _this.isTotalRetieved ? _this.tableFilters.totalItems : data.totalRecords;
|
|
2988
2998
|
_this.tableFilters.itemsPerPage = _this.tableFilters.itemsPerPage ? _this.tableFilters.itemsPerPage : _this.pageSize;
|
|
2989
2999
|
if (_this.maxLengthCardShow) {
|
|
2990
3000
|
_this.picturesList = _this.picturesList.splice(0, 8);
|
|
@@ -2998,6 +3008,24 @@ var ImagesViewComponent = /** @class */ (function () {
|
|
|
2998
3008
|
_this.initVariables(false);
|
|
2999
3009
|
});
|
|
3000
3010
|
};
|
|
3011
|
+
ImagesViewComponent.prototype.refreshTotalImgList = function () {
|
|
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;
|
|
3019
|
+
this.imgManager.getShopTotalImgList(this.params).pipe(take(1)).subscribe(function (data) {
|
|
3020
|
+
_this.previousSearchValue = searchValue;
|
|
3021
|
+
_this.isTotalRetieved = true;
|
|
3022
|
+
_this.length = data.totalRecords;
|
|
3023
|
+
_this.tableFilters.totalItems = data.totalRecords;
|
|
3024
|
+
}, function (error) {
|
|
3025
|
+
//this.alertService.openAlert(this.errorGetTotalImg);
|
|
3026
|
+
_this.initVariables(false);
|
|
3027
|
+
});
|
|
3028
|
+
};
|
|
3001
3029
|
ImagesViewComponent.prototype.ngOnDestroy = function () {
|
|
3002
3030
|
this.searchQueryChanged.unsubscribe();
|
|
3003
3031
|
this.imgRemovedEvent.unsubscribe();
|