@wizishop/img-manager 15.2.9 → 15.2.10
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/esm2020/lib/components/images-view/images-actions-handler.mjs +2 -2
- package/esm2020/lib/components/images-view/images-view.component.mjs +7 -3
- package/esm2020/lib/components/images-view/mosaic-view/mosaic-view.component.mjs +6 -3
- package/esm2020/lib/services/img-event.service.mjs +3 -9
- package/esm2020/lib/services/img-manager.service.mjs +4 -3
- package/fesm2015/wizishop-img-manager.mjs +16 -14
- package/fesm2015/wizishop-img-manager.mjs.map +1 -1
- package/fesm2020/wizishop-img-manager.mjs +16 -14
- package/fesm2020/wizishop-img-manager.mjs.map +1 -1
- package/lib/components/images-view/images-view.component.d.ts +1 -0
- package/lib/components/images-view/mosaic-view/mosaic-view.component.d.ts +1 -0
- package/lib/services/img-event.service.d.ts +2 -3
- package/lib/services/img-manager.service.d.ts +1 -1
- package/package.json +1 -1
- package/wizishop-img-manager-15.2.10.tgz +0 -0
- package/wizishop-img-manager-15.2.9.tgz +0 -0
|
@@ -123,17 +123,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
123
123
|
|
|
124
124
|
class ImgEventService {
|
|
125
125
|
constructor() {
|
|
126
|
+
this.imgRemoved$ = new BehaviorSubject(undefined);
|
|
126
127
|
this.imgToEditEvent = new Subject();
|
|
127
|
-
this.imgRemoved = new Subject();
|
|
128
128
|
this.imgAdded = new Subject();
|
|
129
129
|
this.listDisplayedChange = new Subject();
|
|
130
130
|
}
|
|
131
|
-
emitImgRemoved(id_file) {
|
|
132
|
-
this.imgRemoved.next(id_file);
|
|
133
|
-
}
|
|
134
|
-
getImgRemovedEventListner() {
|
|
135
|
-
return this.imgRemoved.asObservable();
|
|
136
|
-
}
|
|
137
131
|
emitImgToEdit(imgToEdit) {
|
|
138
132
|
this.imgToEditEvent.next(imgToEdit);
|
|
139
133
|
}
|
|
@@ -1106,8 +1100,9 @@ class ImgManagerService {
|
|
|
1106
1100
|
};
|
|
1107
1101
|
this.apiService = inject(ApiService);
|
|
1108
1102
|
}
|
|
1109
|
-
getShopImgList(params) {
|
|
1110
|
-
if (
|
|
1103
|
+
getShopImgList(params, forceToUpdate = false) {
|
|
1104
|
+
if (!forceToUpdate &&
|
|
1105
|
+
params && this.previousParams && this.previousParams.limit === params.limit
|
|
1111
1106
|
&& this.previousParams.page === params.page && this.shopImgList
|
|
1112
1107
|
&& this.previousParams.search === params.search) {
|
|
1113
1108
|
return of(this.shopImgList).pipe(delay(0));
|
|
@@ -1264,7 +1259,7 @@ class ImagesActionHandler {
|
|
|
1264
1259
|
onRemoveImg(picture) {
|
|
1265
1260
|
picture.deleted = true;
|
|
1266
1261
|
this.imgManager.removeImg(picture.id_file).subscribe(data => {
|
|
1267
|
-
this.imgEventCardService.
|
|
1262
|
+
this.imgEventCardService.imgRemoved$.next(picture.id_file);
|
|
1268
1263
|
this.imgSelectionService.removeImgSelectedById(picture.id_file);
|
|
1269
1264
|
}, error => {
|
|
1270
1265
|
const msg = error.status === 409 ? this.errorAlreadyUsedImg : this.errorRemoveImg;
|
|
@@ -2309,16 +2304,19 @@ class MosaicViewComponent extends ImagesActionHandler {
|
|
|
2309
2304
|
switchDisplayWindowCard() {
|
|
2310
2305
|
this.switchDisplayWindow.emit(true);
|
|
2311
2306
|
}
|
|
2307
|
+
trackById(index, picture) {
|
|
2308
|
+
return picture.id;
|
|
2309
|
+
}
|
|
2312
2310
|
}
|
|
2313
2311
|
MosaicViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: MosaicViewComponent, deps: [{ token: ImgManagerService }, { token: ImgSelectionService }, { token: i3$1.HttpClient }, { token: ImgCDNService }, { token: ImgEventService }, { token: AlertService }, { token: i3.TranslateService }, { token: ApiService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2314
|
-
MosaicViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: MosaicViewComponent, selector: "mosaic-view", inputs: { tabDisplayed: "tabDisplayed", fullSize: "fullSize", nbFakeImg: "nbFakeImg" }, outputs: { switchDisplayWindow: "switchDisplayWindow" }, usesInheritance: true, ngImport: i0, template: "<div class=\"mosaic\" [ngClass]=\"{'fullSize': fullSize, 'small': stateDisplayed === 'small', 'mosaic--displayPexelsImg': displayPexelsResults}\">\n <!-- Search section -->\n <div\n class=\"mosaic__search\"\n [ngClass]=\"{'mosaic__search--small': stateDisplayed === 'small'}\"\n *ngIf=\"tabDisplayed !== 'img-upload'\">\n <wz-input-search\n [(ngModel)]=\"tableFilters.searchValue\"\n (changeDebounced)=\"onSearchChange($event)\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n [smallPadding]=\"stateDisplayed === 'small'\"\n ></wz-input-search>\n </div>\n\n <!-- Cards section -->\n <div\n class=\"mosaic__container__cards\"\n [ngClass]=\"{'mosaic__container__cards--padding': stateDisplayed !== 'window'}\"\n [@listAnimation]=\"picturesList.length\"\n *ngIf=\"!isLoading && !displayPexelsResults\"\n >\n <img-card\n *ngFor=\"let picture of picturesList; let index = index
|
|
2312
|
+
MosaicViewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: MosaicViewComponent, selector: "mosaic-view", inputs: { tabDisplayed: "tabDisplayed", fullSize: "fullSize", nbFakeImg: "nbFakeImg" }, outputs: { switchDisplayWindow: "switchDisplayWindow" }, usesInheritance: true, ngImport: i0, template: "<div class=\"mosaic\" [ngClass]=\"{'fullSize': fullSize, 'small': stateDisplayed === 'small', 'mosaic--displayPexelsImg': displayPexelsResults}\">\n <!-- Search section -->\n <div\n class=\"mosaic__search\"\n [ngClass]=\"{'mosaic__search--small': stateDisplayed === 'small'}\"\n *ngIf=\"tabDisplayed !== 'img-upload'\">\n <wz-input-search\n [(ngModel)]=\"tableFilters.searchValue\"\n (changeDebounced)=\"onSearchChange($event)\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n [smallPadding]=\"stateDisplayed === 'small'\"\n ></wz-input-search>\n </div>\n\n <!-- Cards section -->\n <div\n class=\"mosaic__container__cards\"\n [ngClass]=\"{'mosaic__container__cards--padding': stateDisplayed !== 'window'}\"\n [@listAnimation]=\"picturesList.length\"\n *ngIf=\"!isLoading && !displayPexelsResults\"\n >\n <img-card\n *ngFor=\"let picture of picturesList; let index = index; trackBy: trackById \"\n [picture]=\"picture\"\n [stateDisplayed]=\"stateDisplayed\"\n [tabDisplayed]=\"tabDisplayed\"\n [disable]=\"disable\"\n (toggleImgSelected)=\"onToggleSelectImg(index)\"\n (pictureNameChange)=\"onCardRenamePicture($event)\"\n (switchDisplayWindow)=\"switchDisplayWindowCard()\"\n [fullSize]=\"fullSize\"\n ></img-card>\n <div\n *ngFor=\"let fakeImg of nbFakeImg | numberToArray\"\n class=\"mosaic__container__cards__fakeImg\"\n [ngClass]=\"{'mosaic__container__cards__fakeImg--smallFakeImg': stateDisplayed === 'small' || tabDisplayed === 'img-upload'}\">\n </div>\n </div>\n\n <!-- Loader section -->\n <div class=\"mosaic__container__loader\" *ngIf=\"isLoading\">\n <wz-loader [small]=\"true\"></wz-loader>\n </div>\n\n <!-- Pagination section -->\n <div class=\"mosaic__pagination\" *ngIf=\"picturesList.length && tabDisplayed !== 'img-upload' && !displayPexelsResults\" >\n <wz-pagination\n [pagination]=\"tableFilters\"\n (pageChange)=\"onFiltersChange()\"\n >\n </wz-pagination>\n </div>\n\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "component", type: ImgCardComponent, selector: "img-card", inputs: ["tabDisplayed", "fullSize", "picture", "index"], outputs: ["toggleImgSelected", "switchDisplayWindow"] }, { kind: "component", type: LoaderComponent, selector: "wz-loader", inputs: ["text", "small", "position"] }, { kind: "component", type: InputSearchComponent, selector: "wz-input-search", inputs: ["placeholder", "smallPadding", "id"], outputs: ["changeDebounced"] }, { kind: "component", type: PaginationComponent, selector: "wz-pagination", inputs: ["pagination"], outputs: ["pageChange"] }, { kind: "pipe", type: i3.TranslatePipe, name: "translate" }, { kind: "pipe", type: NumberToArray, name: "numberToArray" }], animations: [
|
|
2315
2313
|
listAnnimation
|
|
2316
2314
|
] });
|
|
2317
2315
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: MosaicViewComponent, decorators: [{
|
|
2318
2316
|
type: Component,
|
|
2319
2317
|
args: [{ selector: 'mosaic-view', animations: [
|
|
2320
2318
|
listAnnimation
|
|
2321
|
-
], template: "<div class=\"mosaic\" [ngClass]=\"{'fullSize': fullSize, 'small': stateDisplayed === 'small', 'mosaic--displayPexelsImg': displayPexelsResults}\">\n <!-- Search section -->\n <div\n class=\"mosaic__search\"\n [ngClass]=\"{'mosaic__search--small': stateDisplayed === 'small'}\"\n *ngIf=\"tabDisplayed !== 'img-upload'\">\n <wz-input-search\n [(ngModel)]=\"tableFilters.searchValue\"\n (changeDebounced)=\"onSearchChange($event)\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n [smallPadding]=\"stateDisplayed === 'small'\"\n ></wz-input-search>\n </div>\n\n <!-- Cards section -->\n <div\n class=\"mosaic__container__cards\"\n [ngClass]=\"{'mosaic__container__cards--padding': stateDisplayed !== 'window'}\"\n [@listAnimation]=\"picturesList.length\"\n *ngIf=\"!isLoading && !displayPexelsResults\"\n >\n <img-card\n *ngFor=\"let picture of picturesList; let index = index
|
|
2319
|
+
], template: "<div class=\"mosaic\" [ngClass]=\"{'fullSize': fullSize, 'small': stateDisplayed === 'small', 'mosaic--displayPexelsImg': displayPexelsResults}\">\n <!-- Search section -->\n <div\n class=\"mosaic__search\"\n [ngClass]=\"{'mosaic__search--small': stateDisplayed === 'small'}\"\n *ngIf=\"tabDisplayed !== 'img-upload'\">\n <wz-input-search\n [(ngModel)]=\"tableFilters.searchValue\"\n (changeDebounced)=\"onSearchChange($event)\"\n [placeholder]=\"'ImgManager.SearchBar.placeholder' | translate\"\n [smallPadding]=\"stateDisplayed === 'small'\"\n ></wz-input-search>\n </div>\n\n <!-- Cards section -->\n <div\n class=\"mosaic__container__cards\"\n [ngClass]=\"{'mosaic__container__cards--padding': stateDisplayed !== 'window'}\"\n [@listAnimation]=\"picturesList.length\"\n *ngIf=\"!isLoading && !displayPexelsResults\"\n >\n <img-card\n *ngFor=\"let picture of picturesList; let index = index; trackBy: trackById \"\n [picture]=\"picture\"\n [stateDisplayed]=\"stateDisplayed\"\n [tabDisplayed]=\"tabDisplayed\"\n [disable]=\"disable\"\n (toggleImgSelected)=\"onToggleSelectImg(index)\"\n (pictureNameChange)=\"onCardRenamePicture($event)\"\n (switchDisplayWindow)=\"switchDisplayWindowCard()\"\n [fullSize]=\"fullSize\"\n ></img-card>\n <div\n *ngFor=\"let fakeImg of nbFakeImg | numberToArray\"\n class=\"mosaic__container__cards__fakeImg\"\n [ngClass]=\"{'mosaic__container__cards__fakeImg--smallFakeImg': stateDisplayed === 'small' || tabDisplayed === 'img-upload'}\">\n </div>\n </div>\n\n <!-- Loader section -->\n <div class=\"mosaic__container__loader\" *ngIf=\"isLoading\">\n <wz-loader [small]=\"true\"></wz-loader>\n </div>\n\n <!-- Pagination section -->\n <div class=\"mosaic__pagination\" *ngIf=\"picturesList.length && tabDisplayed !== 'img-upload' && !displayPexelsResults\" >\n <wz-pagination\n [pagination]=\"tableFilters\"\n (pageChange)=\"onFiltersChange()\"\n >\n </wz-pagination>\n </div>\n\n</div>\n" }]
|
|
2322
2320
|
}], ctorParameters: function () { return [{ type: ImgManagerService }, { type: ImgSelectionService }, { type: i3$1.HttpClient }, { type: ImgCDNService }, { type: ImgEventService }, { type: AlertService }, { type: i3.TranslateService }, { type: ApiService }]; }, propDecorators: { tabDisplayed: [{
|
|
2323
2321
|
type: Input
|
|
2324
2322
|
}], fullSize: [{
|
|
@@ -3281,7 +3279,7 @@ class ImagesViewComponent {
|
|
|
3281
3279
|
this._getImgList();
|
|
3282
3280
|
});
|
|
3283
3281
|
// Reload img when img is/are removed
|
|
3284
|
-
this.imgRemovedEvent = this.imgEventService.
|
|
3282
|
+
this.imgRemovedEvent = this.imgEventService.imgRemoved$.subscribe(id_file => {
|
|
3285
3283
|
this.getImgList();
|
|
3286
3284
|
});
|
|
3287
3285
|
// Create img from Canva
|
|
@@ -3308,7 +3306,8 @@ class ImagesViewComponent {
|
|
|
3308
3306
|
this.displayPexelsResults = false;
|
|
3309
3307
|
this.setParams();
|
|
3310
3308
|
this.refreshTotalImgList();
|
|
3311
|
-
this.
|
|
3309
|
+
const forceToUpdate = this.isLastImgRemovedInList();
|
|
3310
|
+
this.imgManager.getShopImgList(this.params, forceToUpdate).pipe(take(1)).subscribe({
|
|
3312
3311
|
next: (data) => {
|
|
3313
3312
|
this.initVariables(true);
|
|
3314
3313
|
const nbImgDisplayed = data.data.length;
|
|
@@ -3354,6 +3353,9 @@ class ImagesViewComponent {
|
|
|
3354
3353
|
switchDisplayWindowMosaic() {
|
|
3355
3354
|
this.switchDisplayWindow.emit(true);
|
|
3356
3355
|
}
|
|
3356
|
+
isLastImgRemovedInList() {
|
|
3357
|
+
return this.picturesList.some(picture => picture.id_file === this.imgEventService.imgRemoved$.getValue());
|
|
3358
|
+
}
|
|
3357
3359
|
ngOnDestroy() {
|
|
3358
3360
|
this.searchQueryChanged.unsubscribe();
|
|
3359
3361
|
this.imgRemovedEvent.unsubscribe();
|