@wizishop/img-manager 15.0.4 → 15.0.7
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-view.component.mjs +25 -22
- package/esm2020/lib/components/images-view/mosaic-view/mosaic-view.component.mjs +3 -3
- package/esm2020/lib/services/img-manager.service.mjs +11 -2
- package/fesm2015/wizishop-img-manager.mjs +38 -27
- package/fesm2015/wizishop-img-manager.mjs.map +1 -1
- package/fesm2020/wizishop-img-manager.mjs +38 -27
- package/fesm2020/wizishop-img-manager.mjs.map +1 -1
- package/lib/components/images-view/images-view.component.d.ts +2 -2
- package/lib/services/img-manager.service.d.ts +4 -2
- package/package.json +1 -1
- package/wizishop-img-manager-15.0.7.tgz +0 -0
- package/wizishop-img-manager-15.0.4.tgz +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { Injectable, EventEmitter, Directive, Input, Output, Pipe, Component, ViewEncapsulation, HostBinding, HostListener, ViewChild, Inject, NgModule } from '@angular/core';
|
|
3
|
-
import { ReplaySubject, Observable, Subject, BehaviorSubject, forkJoin } from 'rxjs';
|
|
3
|
+
import { ReplaySubject, Observable, of, delay, tap, Subject, BehaviorSubject, forkJoin } from 'rxjs';
|
|
4
4
|
import * as i3 from '@angular/common/http';
|
|
5
5
|
import { HttpParams, HttpHeaders, HttpClientModule } from '@angular/common/http';
|
|
6
6
|
import * as i7 from '@ngx-translate/core';
|
|
7
7
|
import { TranslateModule } from '@ngx-translate/core';
|
|
8
8
|
import * as i1 from '@wizishop/ng-wizi-bulma';
|
|
9
9
|
import { NwbAllModule } from '@wizishop/ng-wizi-bulma';
|
|
10
|
-
import { take, debounceTime, map, takeUntil, distinctUntilChanged, tap } from 'rxjs/operators';
|
|
10
|
+
import { take, debounceTime, map, takeUntil, distinctUntilChanged, tap as tap$1 } from 'rxjs/operators';
|
|
11
11
|
import * as i2 from '@angular/common';
|
|
12
12
|
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
13
13
|
import { trigger, state, style, transition, animate, query, stagger } from '@angular/animations';
|
|
@@ -209,7 +209,15 @@ class ImgManagerService {
|
|
|
209
209
|
return header;
|
|
210
210
|
}
|
|
211
211
|
getShopImgList(params) {
|
|
212
|
-
|
|
212
|
+
if (params && this.previousParams && this.previousParams.limit === params.limit
|
|
213
|
+
&& this.previousParams.page === params.page && this.shopImgList
|
|
214
|
+
&& this.previousParams["display_name:contains"] === params["display_name:contains"]) {
|
|
215
|
+
return of(this.shopImgList).pipe(delay(0));
|
|
216
|
+
}
|
|
217
|
+
return this.http.get(`${this.imgManagerRoute}/images`, this.getOptionsHeaders(params)).pipe(tap((shopImgList) => {
|
|
218
|
+
this.shopImgList = shopImgList;
|
|
219
|
+
this.previousParams = params;
|
|
220
|
+
}));
|
|
213
221
|
}
|
|
214
222
|
getShopTotalImgList(params) {
|
|
215
223
|
return this.http.get(`${this.imgManagerRoute}/total/image`, this.getOptionsHeaders(params));
|
|
@@ -1279,7 +1287,7 @@ class AbstractDebounceDirective {
|
|
|
1279
1287
|
}
|
|
1280
1288
|
ngOnInit() {
|
|
1281
1289
|
this.emitEvent$
|
|
1282
|
-
.pipe(takeUntil(this.subscription$), debounceTime(this.debounceTime), distinctUntilChanged(), tap(value => this.emitChange(value)))
|
|
1290
|
+
.pipe(takeUntil(this.subscription$), debounceTime(this.debounceTime), distinctUntilChanged(), tap$1(value => this.emitChange(value)))
|
|
1283
1291
|
.subscribe();
|
|
1284
1292
|
}
|
|
1285
1293
|
emitChange(value) {
|
|
@@ -2427,14 +2435,14 @@ class MosaicViewComponent extends ImagesActionHandler {
|
|
|
2427
2435
|
}
|
|
2428
2436
|
}
|
|
2429
2437
|
MosaicViewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: MosaicViewComponent, deps: [{ token: ImgManagerService }, { token: ImgSelectionService }, { token: i3.HttpClient }, { token: ImgCDNService }, { token: ImgEventService }, { token: AlertService }, { token: i7.TranslateService }, { token: ImgManagerConfigService }], target: i0.ɵɵFactoryTarget.Component });
|
|
2430
|
-
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=\"
|
|
2438
|
+
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;\"\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 <!-- 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: i7.TranslatePipe, name: "translate" }, { kind: "pipe", type: NumberToArray, name: "numberToArray" }], animations: [
|
|
2431
2439
|
listAnnimation
|
|
2432
2440
|
] });
|
|
2433
2441
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: MosaicViewComponent, decorators: [{
|
|
2434
2442
|
type: Component,
|
|
2435
2443
|
args: [{ selector: 'mosaic-view', animations: [
|
|
2436
2444
|
listAnnimation
|
|
2437
|
-
], 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=\"
|
|
2445
|
+
], 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;\"\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 <!-- 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" }]
|
|
2438
2446
|
}], ctorParameters: function () { return [{ type: ImgManagerService }, { type: ImgSelectionService }, { type: i3.HttpClient }, { type: ImgCDNService }, { type: ImgEventService }, { type: AlertService }, { type: i7.TranslateService }, { type: ImgManagerConfigService }]; }, propDecorators: { tabDisplayed: [{
|
|
2439
2447
|
type: Input
|
|
2440
2448
|
}], fullSize: [{
|
|
@@ -3143,7 +3151,7 @@ class ImagesViewComponent {
|
|
|
3143
3151
|
this.nbImgToDelSelected = 0;
|
|
3144
3152
|
this.disable = false; // Use to disable action during server request
|
|
3145
3153
|
this.isLoading = true;
|
|
3146
|
-
this.
|
|
3154
|
+
this.isTotalRetrieved = false;
|
|
3147
3155
|
this.delListImgLoader = false;
|
|
3148
3156
|
this.initComponent = true;
|
|
3149
3157
|
this.failLoaded = false;
|
|
@@ -3346,7 +3354,7 @@ class ImagesViewComponent {
|
|
|
3346
3354
|
* Set a img list in order to fill properly all the line of images displayed in mosaic.
|
|
3347
3355
|
* Otherwise, the space-between css will do a bad display
|
|
3348
3356
|
*/
|
|
3349
|
-
|
|
3357
|
+
calculateNbImgFake(nbImgDisplayed) {
|
|
3350
3358
|
const nbImgPerLine = this.stateDisplayed === 'small' || this.tabDisplayed === 'img-upload' ? this.nbMaxImgPerLine : this.nbMinImgPerLine;
|
|
3351
3359
|
if (nbImgDisplayed % nbImgPerLine !== 0) {
|
|
3352
3360
|
this.nbFakeImg = nbImgPerLine - nbImgDisplayed % nbImgPerLine;
|
|
@@ -3417,35 +3425,38 @@ class ImagesViewComponent {
|
|
|
3417
3425
|
this.displayPexelsResults = false;
|
|
3418
3426
|
this.setParams();
|
|
3419
3427
|
this.refreshTotalImgList();
|
|
3420
|
-
this.imgManager.getShopImgList(this.params).pipe(take(1)).subscribe(
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3428
|
+
this.imgManager.getShopImgList(this.params).pipe(take(1)).subscribe({
|
|
3429
|
+
next: (data) => {
|
|
3430
|
+
this.initVariables(true);
|
|
3431
|
+
const nbImgDisplayed = data.data.length;
|
|
3432
|
+
this.calculateNbImgFake(nbImgDisplayed);
|
|
3433
|
+
this.picturesList = data.data;
|
|
3434
|
+
this.renamePictureService.setPicturesList(this.picturesList);
|
|
3435
|
+
this.selectImgSelected();
|
|
3436
|
+
this.length = this.isTotalRetrieved ? this.length : data.totalRecords;
|
|
3437
|
+
this.tableFilters.totalItems = this.isTotalRetrieved ? this.tableFilters.totalItems : data.totalRecords;
|
|
3438
|
+
this.tableFilters.itemsPerPage = this.tableFilters.itemsPerPage ? this.tableFilters.itemsPerPage : this.pageSize;
|
|
3439
|
+
// Display Pexels if no result
|
|
3440
|
+
if (data.totalRecords === 0) {
|
|
3441
|
+
this.displayPexelsLib();
|
|
3442
|
+
}
|
|
3443
|
+
},
|
|
3444
|
+
error: error => {
|
|
3445
|
+
this.alertService.openAlert(this.errorGetAllImg);
|
|
3446
|
+
this.initVariables(false);
|
|
3433
3447
|
}
|
|
3434
|
-
}, error => {
|
|
3435
|
-
this.alertService.openAlert(this.errorGetAllImg);
|
|
3436
|
-
this.initVariables(false);
|
|
3437
3448
|
});
|
|
3438
3449
|
}
|
|
3439
3450
|
refreshTotalImgList() {
|
|
3440
3451
|
const searchValue = this.tableFilters.searchValue;
|
|
3441
|
-
if (this.
|
|
3452
|
+
if (this.isTotalRetrieved && searchValue === this.previousSearchValue) {
|
|
3442
3453
|
// Keep current total result
|
|
3443
3454
|
return;
|
|
3444
3455
|
}
|
|
3445
|
-
this.
|
|
3456
|
+
this.isTotalRetrieved = false;
|
|
3446
3457
|
this.imgManager.getShopTotalImgList(this.params).pipe(take(1)).subscribe((data) => {
|
|
3447
3458
|
this.previousSearchValue = searchValue;
|
|
3448
|
-
this.
|
|
3459
|
+
this.isTotalRetrieved = true;
|
|
3449
3460
|
this.length = data.totalRecords;
|
|
3450
3461
|
this.tableFilters.totalItems = data.totalRecords;
|
|
3451
3462
|
}, error => {
|