@wizishop/img-manager 15.2.41 → 15.2.43

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.
@@ -9,10 +9,10 @@ import { take, map as map$1, takeUntil, debounceTime as debounceTime$1, distinct
9
9
  import * as i2 from '@angular/common';
10
10
  import { DOCUMENT, CommonModule } from '@angular/common';
11
11
  import { trigger, state, style, transition, animate, query, stagger } from '@angular/animations';
12
- import * as i4 from 'ngx-scrollbar';
13
- import { NgScrollbarModule } from 'ngx-scrollbar';
14
12
  import * as i3$1 from '@angular/common/http';
15
13
  import { HttpParams, HttpHeaders, HttpClientModule } from '@angular/common/http';
14
+ import * as i4 from 'ngx-scrollbar';
15
+ import { NgScrollbarModule } from 'ngx-scrollbar';
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';
@@ -409,56 +409,6 @@ const easeInOut = // the fade-in/fade-out animation.
409
409
  ]),
410
410
  ]);
411
411
 
412
- class RenamePictureService {
413
- constructor(apiService, alertService) {
414
- this.apiService = apiService;
415
- this.alertService = alertService;
416
- this.picturesList = [];
417
- this.errorRenameImg = 'ImgManager.ImgList.errorRenameImg';
418
- this.msgSavingImgName = 'ImgManager.ImgLib.savingImgName';
419
- this.msgImgNameSaved = 'ImgManager.ImgLib.imgNameSaved';
420
- }
421
- setPicturesList(picturesList) {
422
- this.picturesList = picturesList;
423
- }
424
- renamePicture(pictureNameUpdate) {
425
- const picture = this.getPictureById(pictureNameUpdate.id);
426
- if (!picture) {
427
- this.alertService.openAlert(this.errorRenameImg);
428
- return;
429
- }
430
- this.alertService.openAlert(this.msgSavingImgName);
431
- this.apiService
432
- .changeImgName(picture.display_name, picture.id_file)
433
- .subscribe((data) => {
434
- picture.display_name = data.display_name;
435
- this.alertService.openAlert(this.msgImgNameSaved);
436
- }, () => {
437
- picture.display_name = pictureNameUpdate.previousName;
438
- this.alertService.openAlert(this.errorRenameImg);
439
- });
440
- }
441
- changeImageName(name, idFile) {
442
- return this.apiService.changeImgName(name, idFile);
443
- }
444
- getPictureById(id_file) {
445
- if (!this.picturesList) {
446
- return;
447
- }
448
- for (const picture of this.picturesList) {
449
- if (picture.id_file === id_file) {
450
- return picture;
451
- }
452
- }
453
- return null;
454
- }
455
- }
456
- 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 });
457
- RenamePictureService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RenamePictureService });
458
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RenamePictureService, decorators: [{
459
- type: Injectable
460
- }], ctorParameters: function () { return [{ type: ApiService }, { type: AlertService }]; } });
461
-
462
412
  class ImgManagerService {
463
413
  constructor() {
464
414
  this.uploadService = inject(UploadService);
@@ -589,6 +539,60 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
589
539
  type: Injectable
590
540
  }] });
591
541
 
542
+ class RenamePictureService {
543
+ constructor(apiService, alertService, imgManagerService) {
544
+ this.apiService = apiService;
545
+ this.alertService = alertService;
546
+ this.imgManagerService = imgManagerService;
547
+ this.picturesList = [];
548
+ this.errorRenameImg = 'ImgManager.ImgList.errorRenameImg';
549
+ this.msgSavingImgName = 'ImgManager.ImgLib.savingImgName';
550
+ this.msgImgNameSaved = 'ImgManager.ImgLib.imgNameSaved';
551
+ }
552
+ setPicturesList(picturesList) {
553
+ this.picturesList = picturesList;
554
+ }
555
+ renamePicture(pictureNameUpdate) {
556
+ const picture = this.getPictureById(pictureNameUpdate.id);
557
+ if (!picture) {
558
+ this.alertService.openAlert(this.errorRenameImg);
559
+ return;
560
+ }
561
+ this.alertService.openAlert(this.msgSavingImgName);
562
+ this.apiService
563
+ .changeImgName(picture.display_name, picture.id_file).pipe(tap(() => this.imgManagerService.refreshImageList$.next()))
564
+ .subscribe({
565
+ next: (data) => {
566
+ picture.display_name = data.display_name;
567
+ this.alertService.openAlert(this.msgImgNameSaved);
568
+ },
569
+ error: () => {
570
+ picture.display_name = pictureNameUpdate.previousName;
571
+ this.alertService.openAlert(this.errorRenameImg);
572
+ }
573
+ });
574
+ }
575
+ changeImageName(name, idFile) {
576
+ return this.apiService.changeImgName(name, idFile).pipe(tap(() => this.imgManagerService.refreshImageList$.next()));
577
+ }
578
+ getPictureById(id_file) {
579
+ if (!this.picturesList) {
580
+ return;
581
+ }
582
+ for (const picture of this.picturesList) {
583
+ if (picture.id_file === id_file) {
584
+ return picture;
585
+ }
586
+ }
587
+ return null;
588
+ }
589
+ }
590
+ RenamePictureService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RenamePictureService, deps: [{ token: ApiService }, { token: AlertService }, { token: ImgManagerService }], target: i0.ɵɵFactoryTarget.Injectable });
591
+ RenamePictureService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RenamePictureService });
592
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: RenamePictureService, decorators: [{
593
+ type: Injectable
594
+ }], ctorParameters: function () { return [{ type: ApiService }, { type: AlertService }, { type: ImgManagerService }]; } });
595
+
592
596
  class ImgCDNService {
593
597
  constructor() {
594
598
  this.imgCDNConfig = inject(ApiService).IMG_SIZE;
@@ -3117,7 +3121,6 @@ class ImagesViewComponent {
3117
3121
  this.setNbImgToDelSelected(picturesList);
3118
3122
  }
3119
3123
  onRenamePicture(pictureRenamed) {
3120
- console.log('onRenamePicture pictureRenamed', pictureRenamed);
3121
3124
  this.renamePictureService.renamePicture(pictureRenamed);
3122
3125
  }
3123
3126
  removeListImg(picturesList) {
@@ -4023,3 +4026,4 @@ class ImgManagerConfigDto {
4023
4026
 
4024
4027
  export { ApiService, CanvaButtonApi, CanvaService, ImageNotFoundService, ImgApiDto, ImgManagerConfigDto, ImgManagerService, ImgSelectionService, RenamePictureService, WzImgManagerComponent, WzImgManagerModule };
4025
4028
  //# sourceMappingURL=wizishop-img-manager.mjs.map
4029
+ //# sourceMappingURL=wizishop-img-manager.mjs.map