@wizishop/img-manager 15.2.3 → 15.2.5

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.
Files changed (32) hide show
  1. package/esm2020/lib/components/pexels-lib/pexels-lib.component.mjs +24 -23
  2. package/esm2020/lib/services/alert.service.mjs +3 -6
  3. package/esm2020/lib/services/canva.service.mjs +3 -6
  4. package/esm2020/lib/services/config/img-cdn.service.mjs +3 -6
  5. package/esm2020/lib/services/dom.service.mjs +3 -6
  6. package/esm2020/lib/services/img-event.service.mjs +4 -7
  7. package/esm2020/lib/services/img-manager.service.mjs +6 -22
  8. package/esm2020/lib/services/img-selection.service.mjs +2 -18
  9. package/esm2020/lib/services/pexels.service.mjs +4 -7
  10. package/esm2020/lib/services/rename-picture.service.mjs +3 -4
  11. package/esm2020/lib/services/snackbar.service.mjs +64 -0
  12. package/esm2020/lib/services/table/filters-table.service.mjs +3 -6
  13. package/esm2020/lib/services/upload.service.mjs +8 -10
  14. package/esm2020/lib/services/user-settings.service.mjs +4 -7
  15. package/esm2020/lib/wz-img-manager.component.mjs +6 -11
  16. package/esm2020/lib/wz-img-manager.module.mjs +28 -2
  17. package/fesm2015/wizishop-img-manager.mjs +257 -246
  18. package/fesm2015/wizishop-img-manager.mjs.map +1 -1
  19. package/fesm2020/wizishop-img-manager.mjs +192 -181
  20. package/fesm2020/wizishop-img-manager.mjs.map +1 -1
  21. package/lib/components/pexels-lib/pexels-lib.component.d.ts +3 -4
  22. package/lib/services/config/img-cdn.service.d.ts +1 -2
  23. package/lib/services/img-event.service.d.ts +0 -1
  24. package/lib/services/img-manager.service.d.ts +1 -8
  25. package/lib/services/img-selection.service.d.ts +0 -6
  26. package/lib/services/snackbar.service.d.ts +19 -0
  27. package/lib/services/upload.service.d.ts +3 -5
  28. package/lib/services/user-settings.service.d.ts +0 -1
  29. package/lib/wz-img-manager.component.d.ts +2 -2
  30. package/package.json +1 -1
  31. package/wizishop-img-manager-15.2.5.tgz +0 -0
  32. package/wizishop-img-manager-15.2.3.tgz +0 -0
@@ -1,18 +1,18 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Optional, SkipSelf, inject, EventEmitter, Directive, Input, Output, Pipe, Component, ViewEncapsulation, HostBinding, HostListener, ViewChild, Inject, NgModule } from '@angular/core';
2
+ import { Injectable, inject, EventEmitter, Directive, Input, Output, Pipe, Component, ViewEncapsulation, HostBinding, HostListener, ViewChild, Inject, NgModule } from '@angular/core';
3
3
  import { BehaviorSubject, Subject, Observable, of, delay, tap, forkJoin } from 'rxjs';
4
4
  import * as i3 from '@ngx-translate/core';
5
5
  import { TranslateModule } from '@ngx-translate/core';
6
6
  import * as i1 from '@wizishop/ng-wizi-bulma';
7
7
  import { NwbAllModule } from '@wizishop/ng-wizi-bulma';
8
8
  import { take, map, takeUntil, debounceTime, distinctUntilChanged, tap as tap$1 } from 'rxjs/operators';
9
- import * as i3$1 from '@angular/common/http';
10
- import { HttpParams, HttpHeaders, HttpClientModule } from '@angular/common/http';
11
9
  import * as i2 from '@angular/common';
12
10
  import { DOCUMENT, CommonModule } from '@angular/common';
13
11
  import { trigger, state, style, transition, animate, query, stagger } from '@angular/animations';
14
12
  import * as i4 from 'ngx-scrollbar';
15
13
  import { NgScrollbarModule } from 'ngx-scrollbar';
14
+ import * as i3$1 from '@angular/common/http';
15
+ import { HttpParams, HttpHeaders, HttpClientModule } from '@angular/common/http';
16
16
  import * as i2$1 from '@angular/forms';
17
17
  import { NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
18
18
  import * as i3$2 from '@angular/router';
@@ -97,22 +97,6 @@ ImgSelectionService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0",
97
97
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ImgSelectionService, decorators: [{
98
98
  type: Injectable
99
99
  }], ctorParameters: function () { return []; } });
100
- const ImgSelectionServiceProvider = {
101
- provide: ImgSelectionService,
102
- useFactory: (parentService) => {
103
- console.log('parentService', !!parentService);
104
- // Vérifie si le service existe déjà dans le provider parent
105
- if (parentService) {
106
- return parentService;
107
- }
108
- else {
109
- // Si le service n'existe pas dans le provider parent, crée un nouveau service
110
- return new ImgSelectionService();
111
- }
112
- },
113
- // Utilise l'injection conditionnelle pour vérifier si le service existe déjà dans le provider parent
114
- deps: [[new Optional(), new SkipSelf(), ImgSelectionService]],
115
- };
116
100
 
117
101
  class UserSettingsService {
118
102
  constructor() {
@@ -132,13 +116,10 @@ class UserSettingsService {
132
116
  }
133
117
  }
134
118
  UserSettingsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: UserSettingsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
135
- UserSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: UserSettingsService, providedIn: 'root' });
119
+ UserSettingsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: UserSettingsService });
136
120
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: UserSettingsService, decorators: [{
137
- type: Injectable,
138
- args: [{
139
- providedIn: 'root'
140
- }]
141
- }], ctorParameters: function () { return []; } });
121
+ type: Injectable
122
+ }] });
142
123
 
143
124
  class AlertService {
144
125
  constructor(nwbAlertService, translateService) {
@@ -179,12 +160,9 @@ class AlertService {
179
160
  }
180
161
  }
181
162
  AlertService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertService, deps: [{ token: i1.NwbAlertService }, { token: i3.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
182
- AlertService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertService, providedIn: 'root' });
163
+ AlertService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertService });
183
164
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: AlertService, decorators: [{
184
- type: Injectable,
185
- args: [{
186
- providedIn: 'root'
187
- }]
165
+ type: Injectable
188
166
  }], ctorParameters: function () { return [{ type: i1.NwbAlertService }, { type: i3.TranslateService }]; } });
189
167
 
190
168
  class ImgEventService {
@@ -220,13 +198,10 @@ class ImgEventService {
220
198
  }
221
199
  }
222
200
  ImgEventService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ImgEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
223
- ImgEventService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ImgEventService, providedIn: 'root' });
201
+ ImgEventService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ImgEventService });
224
202
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ImgEventService, decorators: [{
225
- type: Injectable,
226
- args: [{
227
- providedIn: 'root'
228
- }]
229
- }], ctorParameters: function () { return []; } });
203
+ type: Injectable
204
+ }] });
230
205
 
231
206
  class ApiService {
232
207
  }
@@ -237,8 +212,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
237
212
  }] });
238
213
 
239
214
  class UploadService {
240
- constructor(apiService) {
241
- this.apiService = apiService;
215
+ constructor() {
216
+ this.apiService = inject(ApiService);
242
217
  }
243
218
  uploadFile(formData) {
244
219
  return this.apiService.uploadFile(formData);
@@ -247,12 +222,11 @@ class UploadService {
247
222
  return this.apiService.uploadFileByUrl(url, fileName);
248
223
  }
249
224
  }
250
- UploadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: UploadService, deps: [{ token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable });
251
- UploadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: UploadService, providedIn: 'root' });
225
+ UploadService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: UploadService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
226
+ UploadService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: UploadService });
252
227
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: UploadService, decorators: [{
253
- type: Injectable,
254
- args: [{ providedIn: 'root' }]
255
- }], ctorParameters: function () { return [{ type: ApiService }]; } });
228
+ type: Injectable
229
+ }] });
256
230
 
257
231
  class CanvaService {
258
232
  constructor(wzImgEventService, alertService, translateService, uploadService, apiService) {
@@ -394,12 +368,9 @@ class CanvaService {
394
368
  }
395
369
  }
396
370
  CanvaService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CanvaService, deps: [{ token: ImgEventService }, { token: AlertService }, { token: i3.TranslateService }, { token: UploadService }, { token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable });
397
- CanvaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CanvaService, providedIn: 'root' });
371
+ CanvaService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CanvaService });
398
372
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: CanvaService, decorators: [{
399
- type: Injectable,
400
- args: [{
401
- providedIn: 'root'
402
- }]
373
+ type: Injectable
403
374
  }], ctorParameters: function () { return [{ type: ImgEventService }, { type: AlertService }, { type: i3.TranslateService }, { type: UploadService }, { type: ApiService }]; } });
404
375
 
405
376
  class DomService {
@@ -427,17 +398,74 @@ class DomService {
427
398
  }
428
399
  }
429
400
  DomService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DomService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
430
- DomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DomService, providedIn: 'root' });
401
+ DomService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DomService });
431
402
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: DomService, decorators: [{
432
- type: Injectable,
433
- args: [{
434
- providedIn: 'root'
435
- }]
403
+ type: Injectable
436
404
  }] });
437
405
 
438
- class ImgManagerService {
439
- constructor(apiService) {
406
+ const easeInOut = // the fade-in/fade-out animation.
407
+ trigger('easeInOut', [
408
+ // the "in" style determines the "resting" state of the element when it is visible.
409
+ state('in', style({ opacity: 1 })),
410
+ // fade in when created. this could also be written as transition('void => *')
411
+ transition(':enter', [
412
+ style({ opacity: 0 }),
413
+ animate('0.5s ease-in-out')
414
+ ]),
415
+ ]);
416
+
417
+ class RenamePictureService {
418
+ constructor(apiService, alertService) {
440
419
  this.apiService = apiService;
420
+ this.alertService = alertService;
421
+ this.picturesList = [];
422
+ this.errorRenameImg = 'ImgManager.ImgList.errorRenameImg';
423
+ this.msgSavingImgName = 'ImgManager.ImgLib.savingImgName';
424
+ this.msgImgNameSaved = 'ImgManager.ImgLib.imgNameSaved';
425
+ }
426
+ setPicturesList(picturesList) {
427
+ this.picturesList = picturesList;
428
+ }
429
+ renamePicture(pictureNameUpdate) {
430
+ const picture = this.getPictureById(pictureNameUpdate.id);
431
+ if (!picture) {
432
+ this.alertService.openAlert(this.errorRenameImg);
433
+ return;
434
+ }
435
+ this.alertService.openAlert(this.msgSavingImgName);
436
+ this.apiService
437
+ .changeImgName(picture.display_name, picture.id_file)
438
+ .subscribe((data) => {
439
+ picture.display_name = data.display_name;
440
+ this.alertService.openAlert(this.msgImgNameSaved);
441
+ }, () => {
442
+ picture.display_name = pictureNameUpdate.previousName;
443
+ this.alertService.openAlert(this.errorRenameImg);
444
+ });
445
+ }
446
+ changeImageName(name, idFile) {
447
+ return this.apiService.changeImgName(name, idFile);
448
+ }
449
+ getPictureById(id_file) {
450
+ if (!this.picturesList) {
451
+ return;
452
+ }
453
+ for (const picture of this.picturesList) {
454
+ if (picture.id_file === id_file) {
455
+ return picture;
456
+ }
457
+ }
458
+ return null;
459
+ }
460
+ }
461
+ RenamePictureService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RenamePictureService, deps: [{ token: ApiService }, { token: AlertService }], target: i0.ɵɵFactoryTarget.Injectable });
462
+ RenamePictureService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RenamePictureService });
463
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RenamePictureService, decorators: [{
464
+ type: Injectable
465
+ }], ctorParameters: function () { return [{ type: ApiService }, { type: AlertService }]; } });
466
+
467
+ class ImgManagerService {
468
+ constructor() {
441
469
  this.params = new HttpParams().set("limit", "20").set("page", "1");
442
470
  // Display the img selection
443
471
  this.pageFicheProductConfig = {
@@ -477,6 +505,7 @@ class ImgManagerService {
477
505
  showSelection: false,
478
506
  displayBtn: false
479
507
  };
508
+ this.apiService = inject(ApiService);
480
509
  }
481
510
  getShopImgList(params) {
482
511
  if (params && this.previousParams && this.previousParams.limit === params.limit
@@ -546,88 +575,11 @@ class ImgManagerService {
546
575
  ];
547
576
  }
548
577
  }
549
- ImgManagerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ImgManagerService, deps: [{ token: ApiService }], target: i0.ɵɵFactoryTarget.Injectable });
578
+ ImgManagerService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ImgManagerService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
550
579
  ImgManagerService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ImgManagerService });
551
580
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ImgManagerService, decorators: [{
552
581
  type: Injectable
553
- }], ctorParameters: function () { return [{ type: ApiService }]; } });
554
- const ImgManagerServiceProvider = {
555
- provide: ImgManagerService,
556
- useFactory: (parentService, apiService) => {
557
- // Vérifie si le service existe déjà dans le provider parent
558
- if (parentService) {
559
- return parentService;
560
- }
561
- else {
562
- // Si le service n'existe pas dans le provider parent, crée un nouveau service
563
- return new ImgManagerService(apiService);
564
- }
565
- },
566
- // Utilise l'injection conditionnelle pour vérifier si le service existe déjà dans le provider parent
567
- deps: [[new Optional(), new SkipSelf(), ImgManagerService], ApiService],
568
- };
569
-
570
- const easeInOut = // the fade-in/fade-out animation.
571
- trigger('easeInOut', [
572
- // the "in" style determines the "resting" state of the element when it is visible.
573
- state('in', style({ opacity: 1 })),
574
- // fade in when created. this could also be written as transition('void => *')
575
- transition(':enter', [
576
- style({ opacity: 0 }),
577
- animate('0.5s ease-in-out')
578
- ]),
579
- ]);
580
-
581
- class RenamePictureService {
582
- constructor(apiService, alertService) {
583
- this.apiService = apiService;
584
- this.alertService = alertService;
585
- this.picturesList = [];
586
- this.errorRenameImg = 'ImgManager.ImgList.errorRenameImg';
587
- this.msgSavingImgName = 'ImgManager.ImgLib.savingImgName';
588
- this.msgImgNameSaved = 'ImgManager.ImgLib.imgNameSaved';
589
- }
590
- setPicturesList(picturesList) {
591
- this.picturesList = picturesList;
592
- }
593
- renamePicture(pictureNameUpdate) {
594
- const picture = this.getPictureById(pictureNameUpdate.id);
595
- if (!picture) {
596
- this.alertService.openAlert(this.errorRenameImg);
597
- return;
598
- }
599
- this.alertService.openAlert(this.msgSavingImgName);
600
- this.apiService
601
- .changeImgName(picture.display_name, picture.id_file)
602
- .subscribe((data) => {
603
- picture.display_name = data.display_name;
604
- this.alertService.openAlert(this.msgImgNameSaved);
605
- }, () => {
606
- picture.display_name = pictureNameUpdate.previousName;
607
- this.alertService.openAlert(this.errorRenameImg);
608
- });
609
- }
610
- changeImageName(name, idFile) {
611
- return this.apiService.changeImgName(name, idFile);
612
- }
613
- getPictureById(id_file) {
614
- if (!this.picturesList) {
615
- return;
616
- }
617
- for (const picture of this.picturesList) {
618
- if (picture.id_file === id_file) {
619
- return picture;
620
- }
621
- }
622
- return null;
623
- }
624
- }
625
- RenamePictureService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RenamePictureService, deps: [{ token: ApiService }, { token: AlertService }], target: i0.ɵɵFactoryTarget.Injectable });
626
- RenamePictureService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RenamePictureService, providedIn: 'root' });
627
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RenamePictureService, decorators: [{
628
- type: Injectable,
629
- args: [{ providedIn: 'root' }]
630
- }], ctorParameters: function () { return [{ type: ApiService }, { type: AlertService }]; } });
582
+ }] });
631
583
 
632
584
  class ImgCDNService {
633
585
  constructor() {
@@ -644,12 +596,9 @@ class ImgCDNService {
644
596
  }
645
597
  }
646
598
  ImgCDNService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ImgCDNService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
647
- ImgCDNService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ImgCDNService, providedIn: 'root' });
599
+ ImgCDNService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ImgCDNService });
648
600
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: ImgCDNService, decorators: [{
649
- type: Injectable,
650
- args: [{
651
- providedIn: 'root'
652
- }]
601
+ type: Injectable
653
602
  }] });
654
603
 
655
604
  class ImagesActionHandler {
@@ -1177,7 +1126,7 @@ class PexelsService {
1177
1126
  else { // Search by category or display Pexels selection
1178
1127
  const shopCategory = this.apiService.getShopCategory();
1179
1128
  // Search by shop category
1180
- if (shopCategory && shopCategory !== 'other' && shopCategory !== 'btob') {
1129
+ if (shopCategory && shopCategory !== 'other' && shopCategory !== 'btob' && shopCategory !== 'default') {
1181
1130
  request = `/search?query=${shopCategory}&per_page=${perPage}&page=${page}&locale=en-US`;
1182
1131
  }
1183
1132
  else { // Display Pexels selection
@@ -1190,12 +1139,9 @@ class PexelsService {
1190
1139
  }
1191
1140
  }
1192
1141
  PexelsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: PexelsService, deps: [{ token: i3$1.HttpClient }, { token: ApiService }, { token: i3.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
1193
- PexelsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: PexelsService, providedIn: 'root' });
1142
+ PexelsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: PexelsService });
1194
1143
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: PexelsService, decorators: [{
1195
- type: Injectable,
1196
- args: [{
1197
- providedIn: 'root'
1198
- }]
1144
+ type: Injectable
1199
1145
  }], ctorParameters: function () { return [{ type: i3$1.HttpClient }, { type: ApiService }, { type: i3.TranslateService }]; } });
1200
1146
 
1201
1147
  const listAnnimation = // the fade-in/fade-out animation.
@@ -1354,7 +1300,7 @@ class PexelLibComponent {
1354
1300
  this.isLoading = true;
1355
1301
  this.initComponent = true;
1356
1302
  this.photosColumns = [];
1357
- this.nbColumuns = 6;
1303
+ this.nbColumns = 6;
1358
1304
  this.responsiveColumns = [1250, 1050, 750, 500];
1359
1305
  this.outerElement = null;
1360
1306
  this.uploadingImg = 'ImgManager.PexelLib.uploadingImg';
@@ -1367,8 +1313,6 @@ class PexelLibComponent {
1367
1313
  set content(control) {
1368
1314
  this.outerElement = control;
1369
1315
  }
1370
- ngOnInit() {
1371
- }
1372
1316
  ngAfterViewInit() {
1373
1317
  this.oldSearchValue = this.searchValue;
1374
1318
  this.isLoading = false;
@@ -1379,11 +1323,11 @@ class PexelLibComponent {
1379
1323
  setNbColumnsToDisplayPhoto() {
1380
1324
  const width = this.outerElement.nativeElement.offsetWidth;
1381
1325
  if (this.stateDisplayed !== 'window') {
1382
- this.nbColumuns = 8;
1326
+ this.nbColumns = 8;
1383
1327
  }
1384
1328
  this.responsiveColumns.forEach(value => {
1385
1329
  if (width < value) {
1386
- this.nbColumuns--;
1330
+ this.nbColumns--;
1387
1331
  }
1388
1332
  });
1389
1333
  }
@@ -1408,23 +1352,26 @@ class PexelLibComponent {
1408
1352
  return;
1409
1353
  }
1410
1354
  this.isLoading = true;
1411
- const searchSub = this.wzImgLibService.searchOnPexels(this.searchValue, this.perPage, this.currentPage).subscribe((data) => {
1412
- this.wzImgLibDto = data;
1413
- this.nbResult = this.wzImgLibDto.total_results;
1414
- if (this.nbResult) {
1415
- data.photos.forEach(photo => {
1416
- const bestColumnIndex = this.getBestColumn();
1417
- const height = (photo.height / photo.width) * 1000;
1418
- this.photosColumns[bestColumnIndex].height += height;
1419
- this.photosColumns[bestColumnIndex].photos.push(photo);
1420
- });
1355
+ const searchSub = this.wzImgLibService.searchOnPexels(this.searchValue, this.perPage, this.currentPage).subscribe({
1356
+ next: (data) => {
1357
+ this.wzImgLibDto = data;
1358
+ this.nbResult = this.wzImgLibDto.total_results;
1359
+ if (this.nbResult) {
1360
+ data.photos.forEach(photo => {
1361
+ const bestColumnIndex = this.getBestColumn();
1362
+ const height = (photo.height / photo.width) * 1000;
1363
+ this.photosColumns[bestColumnIndex].height += height;
1364
+ this.photosColumns[bestColumnIndex].photos.push(photo);
1365
+ });
1366
+ }
1367
+ this.isLoading = false;
1368
+ this.initComponent = false;
1369
+ },
1370
+ error: error => {
1371
+ this.isLoading = false;
1372
+ this.initComponent = false;
1373
+ this.alertService.openAlert(this.errorRetrievePhotos);
1421
1374
  }
1422
- this.isLoading = false;
1423
- this.initComponent = false;
1424
- }, error => {
1425
- this.isLoading = false;
1426
- this.initComponent = false;
1427
- this.alertService.openAlert(this.errorRetrievePhotos);
1428
1375
  });
1429
1376
  this.subs.push(searchSub);
1430
1377
  }
@@ -1443,7 +1390,7 @@ class PexelLibComponent {
1443
1390
  }
1444
1391
  }
1445
1392
  setPhotosColumns() {
1446
- for (let indexColumn = 0; indexColumn < this.nbColumuns; indexColumn++) {
1393
+ for (let indexColumn = 0; indexColumn < this.nbColumns; indexColumn++) {
1447
1394
  const photosColumn = {
1448
1395
  height: 0,
1449
1396
  photos: []
@@ -2449,12 +2396,9 @@ class FiltersTableService {
2449
2396
  }
2450
2397
  }
2451
2398
  FiltersTableService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: FiltersTableService, deps: [{ token: i1.NwbFilterRoutingBuilder }], target: i0.ɵɵFactoryTarget.Injectable });
2452
- FiltersTableService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: FiltersTableService, providedIn: 'root' });
2399
+ FiltersTableService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: FiltersTableService });
2453
2400
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: FiltersTableService, decorators: [{
2454
- type: Injectable,
2455
- args: [{
2456
- providedIn: 'root'
2457
- }]
2401
+ type: Injectable
2458
2402
  }], ctorParameters: function () { return [{ type: i1.NwbFilterRoutingBuilder }]; } });
2459
2403
 
2460
2404
  class CheckboxComponent {
@@ -3775,6 +3719,7 @@ class WzImgManagerComponent {
3775
3719
  this.close = false;
3776
3720
  this.listDisplayed = false;
3777
3721
  this.hideTab = false;
3722
+ console.log('WzImgManagerComponent');
3778
3723
  }
3779
3724
  // If forceToOpenCanva is true : Canva will open with the canvaService.expectedImgSizesChange
3780
3725
  // If forceToOpenCanva is a WiziBlockMediaDto, Canva open immediatly
@@ -3807,6 +3752,7 @@ class WzImgManagerComponent {
3807
3752
  }
3808
3753
  }
3809
3754
  ngOnInit() {
3755
+ console.log('WzImgManagerComponent');
3810
3756
  this.imgSelectionService.setMultipleImgMode(this._multipleImgMode);
3811
3757
  this.imgSelectionService.initImgSelectedList(null);
3812
3758
  this.selectImgEvent = this.imgSelectionService.imgSelection$.subscribe(imgSelection => {
@@ -3903,16 +3849,10 @@ class WzImgManagerComponent {
3903
3849
  }
3904
3850
  }
3905
3851
  WzImgManagerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: WzImgManagerComponent, deps: [{ token: ImgSelectionService }, { token: UserSettingsService }, { token: CanvaService }, { token: ImgEventService }, { token: DomService }], target: i0.ɵɵFactoryTarget.Component });
3906
- WzImgManagerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: WzImgManagerComponent, selector: "wz-img-manager", inputs: { stateDisplayed: "stateDisplayed", showSelection: "showSelection", forceToOpenCanva: "forceToOpenCanva", multipleImgMode: "multipleImgMode", showImgManagerModule: "showImgManagerModule" }, outputs: { imgManagerClosed: "imgManagerClosed", imgSelectionChange: "imgSelectionChange" }, host: { listeners: { "document:keydown.escape": "onKeydownHandler($event)" } }, providers: [
3907
- ImgManagerServiceProvider,
3908
- ImgSelectionServiceProvider
3909
- ], ngImport: i0, template: "<div class=\"wz-img-manager\">\n <!-- Img slection handler -->\n <div class=\"wz-img-manager__selectionHandler\" *ngIf=\"showSelection\">\n <img-selection></img-selection>\n </div>\n\n <!-- Img manager module -->\n <div\n *ngIf=\"_showImgManagerModule\"\n class=\"wz-img-manager__module\"\n [ngClass]=\"{\n 'wz-img-manager__module--small': stateDisplayed === 'small',\n 'wz-img-manager__module--full': stateDisplayed === 'full',\n 'wz-img-manager__module--window': stateDisplayed === 'window',\n 'wz-img-manager__module--edit': hideTab}\"\n >\n\n <div class=\"wz-img-manager__module__header\" *ngIf=\"stateDisplayed !== 'window'\">\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'full'\" type=\"button\"><span>Expand</span><i class=\"fal fa-compress-alt\"></i></button>\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'closed'\" type=\"button\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"openFull()\" *ngIf=\"stateDisplayed === 'small'\" type=\"button\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"onClose()\" *ngIf=\"stateDisplayed !== 'closed'\" type=\"button\"><span>Close</span><i class=\"fal fa-times\"></i></button>\n </div>\n\n <div\n class=\"wz-img-manager__module__content wz-block\"\n [ngClass]=\"{'wz-block--window': stateDisplayed === 'window'}\">\n <img-tabs\n [stateDisplayed]=\"stateDisplayed\"\n [multipleImgMode]=\"multipleImgMode\"\n [listDisplayed]=\"listDisplayed\"\n (imgManagerClosed)=\"onImgManagerClosed()\"\n (switchDisplayWindow)=\"changeDisplayTab()\"\n (currentTab)=\"setCurrentTab($event)\">\n </img-tabs>\n </div>\n </div>\n\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ImgTabsComponent, selector: "img-tabs", inputs: ["multipleImgMode", "stateDisplayed", "listDisplayed"], outputs: ["imgManagerClosed", "currentTab", "switchDisplayWindow"] }, { kind: "component", type: ImgSelectionComponent, selector: "img-selection", inputs: ["tabDisplayed"], outputs: ["imgManagerClosed"] }] });
3852
+ WzImgManagerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: WzImgManagerComponent, selector: "wz-img-manager", inputs: { stateDisplayed: "stateDisplayed", showSelection: "showSelection", forceToOpenCanva: "forceToOpenCanva", multipleImgMode: "multipleImgMode", showImgManagerModule: "showImgManagerModule" }, outputs: { imgManagerClosed: "imgManagerClosed", imgSelectionChange: "imgSelectionChange" }, host: { listeners: { "document:keydown.escape": "onKeydownHandler($event)" } }, ngImport: i0, template: "<div class=\"wz-img-manager\">\n <!-- Img slection handler -->\n <div class=\"wz-img-manager__selectionHandler\" *ngIf=\"showSelection\">\n <img-selection></img-selection>\n </div>\n\n <!-- Img manager module -->\n <div\n *ngIf=\"_showImgManagerModule\"\n class=\"wz-img-manager__module\"\n [ngClass]=\"{\n 'wz-img-manager__module--small': stateDisplayed === 'small',\n 'wz-img-manager__module--full': stateDisplayed === 'full',\n 'wz-img-manager__module--window': stateDisplayed === 'window',\n 'wz-img-manager__module--edit': hideTab}\"\n >\n\n <div class=\"wz-img-manager__module__header\" *ngIf=\"stateDisplayed !== 'window'\">\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'full'\" type=\"button\"><span>Expand</span><i class=\"fal fa-compress-alt\"></i></button>\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'closed'\" type=\"button\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"openFull()\" *ngIf=\"stateDisplayed === 'small'\" type=\"button\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"onClose()\" *ngIf=\"stateDisplayed !== 'closed'\" type=\"button\"><span>Close</span><i class=\"fal fa-times\"></i></button>\n </div>\n\n <div\n class=\"wz-img-manager__module__content wz-block\"\n [ngClass]=\"{'wz-block--window': stateDisplayed === 'window'}\">\n <img-tabs\n [stateDisplayed]=\"stateDisplayed\"\n [multipleImgMode]=\"multipleImgMode\"\n [listDisplayed]=\"listDisplayed\"\n (imgManagerClosed)=\"onImgManagerClosed()\"\n (switchDisplayWindow)=\"changeDisplayTab()\"\n (currentTab)=\"setCurrentTab($event)\">\n </img-tabs>\n </div>\n </div>\n\n</div>\n", dependencies: [{ kind: "directive", type: i2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ImgTabsComponent, selector: "img-tabs", inputs: ["multipleImgMode", "stateDisplayed", "listDisplayed"], outputs: ["imgManagerClosed", "currentTab", "switchDisplayWindow"] }, { kind: "component", type: ImgSelectionComponent, selector: "img-selection", inputs: ["tabDisplayed"], outputs: ["imgManagerClosed"] }] });
3910
3853
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: WzImgManagerComponent, decorators: [{
3911
3854
  type: Component,
3912
- args: [{ selector: 'wz-img-manager', providers: [
3913
- ImgManagerServiceProvider,
3914
- ImgSelectionServiceProvider
3915
- ], template: "<div class=\"wz-img-manager\">\n <!-- Img slection handler -->\n <div class=\"wz-img-manager__selectionHandler\" *ngIf=\"showSelection\">\n <img-selection></img-selection>\n </div>\n\n <!-- Img manager module -->\n <div\n *ngIf=\"_showImgManagerModule\"\n class=\"wz-img-manager__module\"\n [ngClass]=\"{\n 'wz-img-manager__module--small': stateDisplayed === 'small',\n 'wz-img-manager__module--full': stateDisplayed === 'full',\n 'wz-img-manager__module--window': stateDisplayed === 'window',\n 'wz-img-manager__module--edit': hideTab}\"\n >\n\n <div class=\"wz-img-manager__module__header\" *ngIf=\"stateDisplayed !== 'window'\">\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'full'\" type=\"button\"><span>Expand</span><i class=\"fal fa-compress-alt\"></i></button>\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'closed'\" type=\"button\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"openFull()\" *ngIf=\"stateDisplayed === 'small'\" type=\"button\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"onClose()\" *ngIf=\"stateDisplayed !== 'closed'\" type=\"button\"><span>Close</span><i class=\"fal fa-times\"></i></button>\n </div>\n\n <div\n class=\"wz-img-manager__module__content wz-block\"\n [ngClass]=\"{'wz-block--window': stateDisplayed === 'window'}\">\n <img-tabs\n [stateDisplayed]=\"stateDisplayed\"\n [multipleImgMode]=\"multipleImgMode\"\n [listDisplayed]=\"listDisplayed\"\n (imgManagerClosed)=\"onImgManagerClosed()\"\n (switchDisplayWindow)=\"changeDisplayTab()\"\n (currentTab)=\"setCurrentTab($event)\">\n </img-tabs>\n </div>\n </div>\n\n</div>\n" }]
3855
+ args: [{ selector: 'wz-img-manager', template: "<div class=\"wz-img-manager\">\n <!-- Img slection handler -->\n <div class=\"wz-img-manager__selectionHandler\" *ngIf=\"showSelection\">\n <img-selection></img-selection>\n </div>\n\n <!-- Img manager module -->\n <div\n *ngIf=\"_showImgManagerModule\"\n class=\"wz-img-manager__module\"\n [ngClass]=\"{\n 'wz-img-manager__module--small': stateDisplayed === 'small',\n 'wz-img-manager__module--full': stateDisplayed === 'full',\n 'wz-img-manager__module--window': stateDisplayed === 'window',\n 'wz-img-manager__module--edit': hideTab}\"\n >\n\n <div class=\"wz-img-manager__module__header\" *ngIf=\"stateDisplayed !== 'window'\">\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'full'\" type=\"button\"><span>Expand</span><i class=\"fal fa-compress-alt\"></i></button>\n <button (click)=\"openSmall()\" *ngIf=\"stateDisplayed === 'closed'\" type=\"button\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"openFull()\" *ngIf=\"stateDisplayed === 'small'\" type=\"button\"><span>Expand</span><i class=\"fal fa-expand-alt\"></i></button>\n <button (click)=\"onClose()\" *ngIf=\"stateDisplayed !== 'closed'\" type=\"button\"><span>Close</span><i class=\"fal fa-times\"></i></button>\n </div>\n\n <div\n class=\"wz-img-manager__module__content wz-block\"\n [ngClass]=\"{'wz-block--window': stateDisplayed === 'window'}\">\n <img-tabs\n [stateDisplayed]=\"stateDisplayed\"\n [multipleImgMode]=\"multipleImgMode\"\n [listDisplayed]=\"listDisplayed\"\n (imgManagerClosed)=\"onImgManagerClosed()\"\n (switchDisplayWindow)=\"changeDisplayTab()\"\n (currentTab)=\"setCurrentTab($event)\">\n </img-tabs>\n </div>\n </div>\n\n</div>\n" }]
3916
3856
  }], ctorParameters: function () { return [{ type: ImgSelectionService }, { type: UserSettingsService }, { type: CanvaService }, { type: ImgEventService }, { type: DomService }]; }, propDecorators: { stateDisplayed: [{
3917
3857
  type: Input
3918
3858
  }], showSelection: [{
@@ -3932,6 +3872,63 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
3932
3872
  type: Output
3933
3873
  }] } });
3934
3874
 
3875
+ class SnackBarService {
3876
+ constructor(nwbSnackbar, translateService) {
3877
+ this.nwbSnackbar = nwbSnackbar;
3878
+ this.translateService = translateService;
3879
+ this.actionMsg = 'ImgManager.snackBar.action';
3880
+ this.snackBarConfigAction = {
3881
+ message: '',
3882
+ duration: 5000
3883
+ };
3884
+ this.snackBarConfig = {
3885
+ message: '',
3886
+ duration: 5000
3887
+ };
3888
+ }
3889
+ openSnackBar(msgKey) {
3890
+ this.closePreviousSnackbar();
3891
+ this.translateService.get(msgKey).subscribe(trans => {
3892
+ this.snackBarConfig.message = trans;
3893
+ this.snackBarRefComponent = this.nwbSnackbar.open(this.snackBarConfig);
3894
+ this.snackBarRefComponent.afterClosed().subscribe();
3895
+ });
3896
+ }
3897
+ openSnackBarWithAction(msgKey) {
3898
+ return new Observable(observer => {
3899
+ this.translateService.get([msgKey, this.actionMsg]).subscribe((trans) => {
3900
+ this.snackBarConfigAction.message = trans[msgKey];
3901
+ this.snackBarConfigAction.action = trans[this.actionMsg];
3902
+ this.closePreviousSnackbar();
3903
+ this.snackBarRefComponent = this.nwbSnackbar.open(this.snackBarConfigAction);
3904
+ this.snackBarRefComponent.afterClosed().subscribe(manualClose => {
3905
+ observer.next(manualClose);
3906
+ observer.complete();
3907
+ });
3908
+ });
3909
+ });
3910
+ }
3911
+ openSnackBarWithBackendRespons(msgKey, msgBackend) {
3912
+ this.translateService.get(msgKey).subscribe(trans => {
3913
+ this.snackBarConfig.message = trans;
3914
+ this.snackBarConfig.message += '<br/>' + JSON.parse(msgBackend).message;
3915
+ this.closePreviousSnackbar();
3916
+ this.snackBarRefComponent = this.nwbSnackbar.open(this.snackBarConfig);
3917
+ this.snackBarRefComponent.afterClosed().subscribe();
3918
+ });
3919
+ }
3920
+ closePreviousSnackbar() {
3921
+ if (this.snackBarRefComponent) {
3922
+ this.snackBarRefComponent.dismiss(false);
3923
+ }
3924
+ }
3925
+ }
3926
+ SnackBarService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: SnackBarService, deps: [{ token: i1.NwbSnackbarService }, { token: i3.TranslateService }], target: i0.ɵɵFactoryTarget.Injectable });
3927
+ SnackBarService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: SnackBarService });
3928
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: SnackBarService, decorators: [{
3929
+ type: Injectable
3930
+ }], ctorParameters: function () { return [{ type: i1.NwbSnackbarService }, { type: i3.TranslateService }]; } });
3931
+
3935
3932
  ;
3936
3933
  const components = [
3937
3934
  WzImgManagerComponent,
@@ -3985,7 +3982,20 @@ class WzImgManagerModule {
3985
3982
  return {
3986
3983
  ngModule: WzImgManagerModule,
3987
3984
  providers: [
3988
- ApiService
3985
+ ImgManagerService,
3986
+ ApiService,
3987
+ ImgCDNService,
3988
+ FiltersTableService,
3989
+ AlertService,
3990
+ CanvaService,
3991
+ DomService,
3992
+ ImgEventService,
3993
+ ImgSelectionService,
3994
+ PexelsService,
3995
+ RenamePictureService,
3996
+ SnackBarService,
3997
+ UploadService,
3998
+ UserSettingsService
3989
3999
  ]
3990
4000
  };
3991
4001
  }
@@ -4102,3 +4112,4 @@ class ImgManagerConfigDto {
4102
4112
 
4103
4113
  export { ApiService, CanvaButtonApi, CanvaService, ImgApiDto, ImgManagerConfigDto, ImgManagerService, ImgSelectionService, RenamePictureService, WzImgManagerComponent, WzImgManagerModule };
4104
4114
  //# sourceMappingURL=wizishop-img-manager.mjs.map
4115
+ //# sourceMappingURL=wizishop-img-manager.mjs.map