@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
|
@@ -167,17 +167,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
|
|
|
167
167
|
|
|
168
168
|
class ImgEventService {
|
|
169
169
|
constructor() {
|
|
170
|
+
this.imgRemoved$ = new BehaviorSubject(undefined);
|
|
170
171
|
this.imgToEditEvent = new Subject();
|
|
171
|
-
this.imgRemoved = new Subject();
|
|
172
172
|
this.imgAdded = new Subject();
|
|
173
173
|
this.listDisplayedChange = new Subject();
|
|
174
174
|
}
|
|
175
|
-
emitImgRemoved(id_file) {
|
|
176
|
-
this.imgRemoved.next(id_file);
|
|
177
|
-
}
|
|
178
|
-
getImgRemovedEventListner() {
|
|
179
|
-
return this.imgRemoved.asObservable();
|
|
180
|
-
}
|
|
181
175
|
emitImgToEdit(imgToEdit) {
|
|
182
176
|
this.imgToEditEvent.next(imgToEdit);
|
|
183
177
|
}
|
|
@@ -508,8 +502,9 @@ class ImgManagerService {
|
|
|
508
502
|
};
|
|
509
503
|
this.apiService = inject(ApiService);
|
|
510
504
|
}
|
|
511
|
-
getShopImgList(params) {
|
|
512
|
-
if (
|
|
505
|
+
getShopImgList(params, forceToUpdate = false) {
|
|
506
|
+
if (!forceToUpdate &&
|
|
507
|
+
params && this.previousParams && this.previousParams.limit === params.limit
|
|
513
508
|
&& this.previousParams.page === params.page && this.shopImgList
|
|
514
509
|
&& this.previousParams.search === params.search) {
|
|
515
510
|
return of(this.shopImgList).pipe(delay(0));
|
|
@@ -666,7 +661,7 @@ class ImagesActionHandler {
|
|
|
666
661
|
onRemoveImg(picture) {
|
|
667
662
|
picture.deleted = true;
|
|
668
663
|
this.imgManager.removeImg(picture.id_file).subscribe(data => {
|
|
669
|
-
this.imgEventCardService.
|
|
664
|
+
this.imgEventCardService.imgRemoved$.next(picture.id_file);
|
|
670
665
|
this.imgSelectionService.removeImgSelectedById(picture.id_file);
|
|
671
666
|
}, error => {
|
|
672
667
|
const msg = error.status === 409 ? this.errorAlreadyUsedImg : this.errorRemoveImg;
|
|
@@ -2324,16 +2319,19 @@ class MosaicViewComponent extends ImagesActionHandler {
|
|
|
2324
2319
|
switchDisplayWindowCard() {
|
|
2325
2320
|
this.switchDisplayWindow.emit(true);
|
|
2326
2321
|
}
|
|
2322
|
+
trackById(index, picture) {
|
|
2323
|
+
return picture.id;
|
|
2324
|
+
}
|
|
2327
2325
|
}
|
|
2328
2326
|
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 });
|
|
2329
|
-
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
|
|
2327
|
+
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: [
|
|
2330
2328
|
listAnnimation
|
|
2331
2329
|
] });
|
|
2332
2330
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: MosaicViewComponent, decorators: [{
|
|
2333
2331
|
type: Component,
|
|
2334
2332
|
args: [{ selector: 'mosaic-view', animations: [
|
|
2335
2333
|
listAnnimation
|
|
2336
|
-
], 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
|
|
2334
|
+
], 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" }]
|
|
2337
2335
|
}], ctorParameters: function () { return [{ type: ImgManagerService }, { type: ImgSelectionService }, { type: i3$1.HttpClient }, { type: ImgCDNService }, { type: ImgEventService }, { type: AlertService }, { type: i3.TranslateService }, { type: ApiService }]; }, propDecorators: { tabDisplayed: [{
|
|
2338
2336
|
type: Input
|
|
2339
2337
|
}], fullSize: [{
|
|
@@ -3287,7 +3285,7 @@ class ImagesViewComponent {
|
|
|
3287
3285
|
this._getImgList();
|
|
3288
3286
|
});
|
|
3289
3287
|
// Reload img when img is/are removed
|
|
3290
|
-
this.imgRemovedEvent = this.imgEventService.
|
|
3288
|
+
this.imgRemovedEvent = this.imgEventService.imgRemoved$.subscribe(id_file => {
|
|
3291
3289
|
this.getImgList();
|
|
3292
3290
|
});
|
|
3293
3291
|
// Create img from Canva
|
|
@@ -3314,7 +3312,8 @@ class ImagesViewComponent {
|
|
|
3314
3312
|
this.displayPexelsResults = false;
|
|
3315
3313
|
this.setParams();
|
|
3316
3314
|
this.refreshTotalImgList();
|
|
3317
|
-
this.
|
|
3315
|
+
const forceToUpdate = this.isLastImgRemovedInList();
|
|
3316
|
+
this.imgManager.getShopImgList(this.params, forceToUpdate).pipe(take(1)).subscribe({
|
|
3318
3317
|
next: (data) => {
|
|
3319
3318
|
this.initVariables(true);
|
|
3320
3319
|
const nbImgDisplayed = data.data.length;
|
|
@@ -3360,6 +3359,9 @@ class ImagesViewComponent {
|
|
|
3360
3359
|
switchDisplayWindowMosaic() {
|
|
3361
3360
|
this.switchDisplayWindow.emit(true);
|
|
3362
3361
|
}
|
|
3362
|
+
isLastImgRemovedInList() {
|
|
3363
|
+
return this.picturesList.some(picture => picture.id_file === this.imgEventService.imgRemoved$.getValue());
|
|
3364
|
+
}
|
|
3363
3365
|
ngOnDestroy() {
|
|
3364
3366
|
this.searchQueryChanged.unsubscribe();
|
|
3365
3367
|
this.imgRemovedEvent.unsubscribe();
|