@wizishop/img-manager 0.2.72 → 0.2.77

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 (34) hide show
  1. package/bundles/wizishop-img-manager.umd.js +151 -25
  2. package/bundles/wizishop-img-manager.umd.js.map +1 -1
  3. package/bundles/wizishop-img-manager.umd.min.js +1 -1
  4. package/bundles/wizishop-img-manager.umd.min.js.map +1 -1
  5. package/esm2015/lib/components/images-view/images-view.component.js +10 -4
  6. package/esm2015/lib/components/img-editor/img-editor.component.js +6 -2
  7. package/esm2015/lib/components/shared/pagination/page-selector/page-selector.component.js +55 -0
  8. package/esm2015/lib/components/shared/pagination/pagination.component.js +4 -4
  9. package/esm2015/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.js +51 -0
  10. package/esm2015/lib/services/img-manager.service.js +2 -2
  11. package/esm2015/lib/wz-img-manager.module.js +7 -3
  12. package/esm2015/wizishop-img-manager.js +18 -16
  13. package/esm5/lib/components/images-view/images-view.component.js +10 -4
  14. package/esm5/lib/components/img-editor/img-editor.component.js +6 -2
  15. package/esm5/lib/components/shared/pagination/page-selector/page-selector.component.js +64 -0
  16. package/esm5/lib/components/shared/pagination/pagination.component.js +4 -4
  17. package/esm5/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.js +54 -0
  18. package/esm5/lib/services/img-manager.service.js +2 -2
  19. package/esm5/lib/wz-img-manager.module.js +7 -3
  20. package/esm5/wizishop-img-manager.js +18 -16
  21. package/fesm2015/wizishop-img-manager.js +123 -11
  22. package/fesm2015/wizishop-img-manager.js.map +1 -1
  23. package/fesm5/wizishop-img-manager.js +135 -11
  24. package/fesm5/wizishop-img-manager.js.map +1 -1
  25. package/lib/components/images-view/images-view.component.d.ts +1 -0
  26. package/lib/components/shared/pagination/page-selector/page-selector.component.d.ts +20 -0
  27. package/lib/components/shared/pagination/pagination.component.d.ts +1 -1
  28. package/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.d.ts +10 -0
  29. package/package.json +1 -1
  30. package/wizishop-img-manager-0.2.77.tgz +0 -0
  31. package/wizishop-img-manager.d.ts +17 -15
  32. package/wizishop-img-manager.metadata.json +1 -1
  33. package/wz-img-manager.scss +1937 -1866
  34. package/wizishop-img-manager-0.2.72.tgz +0 -0
@@ -416,7 +416,7 @@
416
416
  return this.http.get(this.imgManagerRoute + "/images", this.getOptionsHeaders(params));
417
417
  };
418
418
  ImgManagerService.prototype.getShopTotalImgList = function (params) {
419
- return this.http.get(this.imgManagerRoute + "/total/images", this.getOptionsHeaders(params));
419
+ return this.http.get(this.imgManagerRoute + "/total/image", this.getOptionsHeaders(params));
420
420
  };
421
421
  ImgManagerService.prototype.getShopImg = function (idFile) {
422
422
  return this.http.get(this.imgManagerRoute + "/images/" + idFile, this.getOptionsHeaders());
@@ -1984,6 +1984,10 @@
1984
1984
  return;
1985
1985
  }
1986
1986
  this.isLoading = true;
1987
+ if (!this.isImgModified && !this.isNameModified) {
1988
+ this.isLoading = false;
1989
+ this.onEditClosed();
1990
+ }
1987
1991
  var obsReplaceImg = this.imgManagerService.replaceImg(this.currentCroppedImage, this.imgToEdit.id_file);
1988
1992
  var obsChangeImgName = this.imgManagerService.changeImgName(this.imgToEdit.display_name, this.imgToEdit.id_file);
1989
1993
  if (this.isImgModified && this.isNameModified) {
@@ -2059,7 +2063,7 @@
2059
2063
  ImgEditorComponent = __decorate([
2060
2064
  core.Component({
2061
2065
  selector: 'img-editor',
2062
- template: "<div class=\"img-editor\" [@easeInOut]=\"'in'\">\n\n <ng-scrollbar\n #scrollable\n [visibility]=\"'native'\"\n class=\"img-editor__scroll\"\n [ngClass]=\"{\n 'img-editor__scroll--full': stateDisplayed === 'full',\n 'img-editor__scroll--smallDisplay': stateDisplayed === 'small',\n 'img-editor__scroll--window': stateDisplayed === 'window'\n }\"\n >\n <div class=\"columns\">\n <!-- Left section -->\n <div class=\"column is-one-third img-editor__infoSection\">\n\n <info-section\n [imgToEdit]=\"imgToEdit\"\n [(isNameModified)]=\"isNameModified\"\n >\n </info-section>\n\n <!-- Button Action Section -->\n\n <div class=\"img-editor__infoSection__actions\">\n <div>\n <button\n class=\"button img-editor__infoSection__actions__cancel\"\n (click)=\"onCancel()\"\n [disabled]=\"isLoading\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <div\n class=\"button danger button img-editor__infoSection__actions__save\"\n [ngClass]=\"{'img-editor__infoSection__actions__save--disable': isLoading}\"\n (click)=\"onSave()\"\n >\n {{ 'ImgManager.ImgEditor.saveBtn' | translate }}\n <span btnLoadingAnim *ngIf=\"isLoading\" class=\"btnLoadingAnnimation\"></span>\n </div>\n\n </div>\n </div>\n </div>\n\n\n <!-- Right section -->\n <div class=\"column img-editor__container\">\n <cropper\n [imgToEdit]=\"imgToEdit\"\n [(isImgModified)]=\"isImgModified\"\n (currentCroppedImageChange)=\"onImgCropped($event)\"\n (editClosed)=\"onEditClosed($event)\">\n </cropper>\n </div>\n </div>\n </ng-scrollbar>\n</div>\n",
2066
+ template: "<div class=\"img-editor\" [@easeInOut]=\"'in'\">\n\n <ng-scrollbar\n #scrollable\n [visibility]=\"'native'\"\n class=\"img-editor__scroll\"\n [ngClass]=\"{\n 'img-editor__scroll--full': stateDisplayed === 'full',\n 'img-editor__scroll--smallDisplay': stateDisplayed === 'small',\n 'img-editor__scroll--window': stateDisplayed === 'window'\n }\"\n >\n <div class=\"columns\">\n <!-- Left section -->\n <div class=\"column is-one-third img-editor__infoSection\">\n\n <info-section\n [imgToEdit]=\"imgToEdit\"\n [(isNameModified)]=\"isNameModified\"\n >\n </info-section>\n\n <!-- Button Action Section -->\n\n <div class=\"img-editor__infoSection__actions\">\n <div>\n <button\n class=\"button img-editor__infoSection__actions__cancel\"\n (click)=\"onCancel()\"\n [disabled]=\"isLoading || (!isImgModified && !isNameModified)\"\n >\n {{ 'ImgManager.ImgLib.cancel' | translate }}\n </button>\n <div\n class=\"button danger button img-editor__infoSection__actions__save\"\n [ngClass]=\"{'img-editor__infoSection__actions__save--disable': isLoading}\"\n (click)=\"onSave()\"\n >\n {{ 'ImgManager.ImgEditor.saveBtn' | translate }}\n <span btnLoadingAnim *ngIf=\"isLoading\" class=\"btnLoadingAnnimation\"></span>\n </div>\n\n </div>\n </div>\n </div>\n\n\n <!-- Right section -->\n <div class=\"column img-editor__container\">\n <cropper\n [imgToEdit]=\"imgToEdit\"\n [(isImgModified)]=\"isImgModified\"\n (currentCroppedImageChange)=\"onImgCropped($event)\"\n (editClosed)=\"onEditClosed($event)\">\n </cropper>\n </div>\n </div>\n </ng-scrollbar>\n</div>\n",
2063
2067
  animations: [
2064
2068
  easeInOut
2065
2069
  ]
@@ -3183,8 +3187,8 @@
3183
3187
  var _this = this;
3184
3188
  this.isLoading = true;
3185
3189
  this.displayPexelsResults = false;
3186
- this.isTotalRetieved = false;
3187
3190
  this.setParams();
3191
+ this.refreshTotalImgList();
3188
3192
  this.imgManager.getShopImgList(this.params).pipe(operators.take(1)).subscribe(function (data) {
3189
3193
  _this.initVariables(true);
3190
3194
  var nbImgDisplayed = data.data.length;
@@ -3202,7 +3206,6 @@
3202
3206
  if (data.totalRecords === 0) {
3203
3207
  _this.displayPexelsLib();
3204
3208
  }
3205
- _this.refreshTotalImgList();
3206
3209
  }, function (error) {
3207
3210
  _this.alertService.openAlert(_this.errorGetAllImg);
3208
3211
  _this.initVariables(false);
@@ -3210,12 +3213,19 @@
3210
3213
  };
3211
3214
  ImagesViewComponent.prototype.refreshTotalImgList = function () {
3212
3215
  var _this = this;
3216
+ var searchValue = this.tableFilters.searchValue;
3217
+ if (this.isTotalRetieved && searchValue === this.previousSearchValue) {
3218
+ // Keep current total result
3219
+ return;
3220
+ }
3221
+ this.isTotalRetieved = false;
3213
3222
  this.imgManager.getShopTotalImgList(this.params).pipe(operators.take(1)).subscribe(function (data) {
3223
+ _this.previousSearchValue = searchValue;
3214
3224
  _this.isTotalRetieved = true;
3215
3225
  _this.length = data.totalRecords;
3216
3226
  _this.tableFilters.totalItems = data.totalRecords;
3217
3227
  }, function (error) {
3218
- _this.alertService.openAlert(_this.errorGetTotalImg);
3228
+ //this.alertService.openAlert(this.errorGetTotalImg);
3219
3229
  _this.initVariables(false);
3220
3230
  });
3221
3231
  };
@@ -3687,8 +3697,8 @@
3687
3697
  this.pagination.currentPage++;
3688
3698
  this.pageChange.emit(this.pagination);
3689
3699
  };
3690
- PaginationComponent.prototype.onGotoPageChange = function (event) {
3691
- this.pagination.currentPage = parseInt(event.target.value);
3700
+ PaginationComponent.prototype.onGotoPageChange = function (pageNumber) {
3701
+ this.pagination.currentPage = parseInt(pageNumber);
3692
3702
  this.pageChange.emit(this.pagination);
3693
3703
  };
3694
3704
  __decorate([
@@ -3703,7 +3713,7 @@
3703
3713
  PaginationComponent = __decorate([
3704
3714
  core.Component({
3705
3715
  selector: 'wz-pagination',
3706
- template: "<div class=\"wz-pagination\" *ngIf=\"pagination && pagination.itemsPerPage\">\n <div class=\"wz-pagination__wrapper\">\n <div class=\"wz-pagination__wrapper__page\">\n <p>{{ 'PaginationComponent.page' | translate }}</p>\n\n <select name=\"page\" (change)=\"onGotoPageChange($event)\" [ngStyle]=\"{'width': 40 + (10*pagination.currentPage.toString().length) + 'px'}\">\n <ng-container *ngFor=\"let pageIndex of pagination.totalItems | ArrayTotalPages: pagination.itemsPerPage\">\n <option [selected]=\"pageIndex === pagination.currentPage\" [value]=\"pageIndex\">\n {{ pageIndex }}\n </option>\n </ng-container>\n </select>\n </div>\n\n <div class=\"wz-pagination__wrapper__elements\">\n <p>{{ pagination.currentPage | customPagniationText: pagination.totalItems:pagination.itemsPerPage }}</p>\n </div>\n\n <div class=\"wz-pagination__wrapper__arrows\">\n <div\n (click)=\"decrementPage()\"\n class=\"wz-pagination__wrapper__arrows__arrow wz-pagination__wrapper__arrows__arrow--left\"\n [ngClass]=\"{ 'wz-pagination__wrapper__arrows__arrow--disabled': pagination.currentPage === 1 }\"\n >\n <span class=\"wz-pagination__wrapper__arrows__arrow__icon\"></span>\n </div>\n <div\n (click)=\"incrementPage()\"\n class=\"wz-pagination__wrapper__arrows__arrow wz-pagination__wrapper__arrows__arrow--right\"\n [ngClass]=\"{\n 'wz-pagination__wrapper__arrows__arrow--disabled':\n pagination.currentPage | IsLastPage: pagination.totalItems:pagination.itemsPerPage\n }\"\n >\n <span class=\"wz-pagination__wrapper__arrows__arrow__icon\"></span>\n </div>\n </div>\n </div>\n</div>\n"
3716
+ template: "<div class=\"wz-pagination\" *ngIf=\"pagination && pagination.itemsPerPage\">\n <div class=\"wz-pagination__wrapper\">\n <div class=\"wz-pagination__wrapper__page\">\n <p>{{ 'PaginationComponent.page' | translate }}</p>\n\n <wz-page-selector [pagination]=\"pagination\" [totalItems]=\"pagination.totalItems\" (pageChange)=\"onGotoPageChange($event)\"></wz-page-selector>\n </div>\n\n <div class=\"wz-pagination__wrapper__elements\">\n <p>{{ pagination.currentPage | customPagniationText: pagination.totalItems:pagination.itemsPerPage }}</p>\n </div>\n\n <div class=\"wz-pagination__wrapper__arrows\">\n <div\n (click)=\"decrementPage()\"\n class=\"wz-pagination__wrapper__arrows__arrow wz-pagination__wrapper__arrows__arrow--left\"\n [ngClass]=\"{ 'wz-pagination__wrapper__arrows__arrow--disabled': pagination.currentPage === 1 }\"\n >\n <span class=\"wz-pagination__wrapper__arrows__arrow__icon\"></span>\n </div>\n <div\n (click)=\"incrementPage()\"\n class=\"wz-pagination__wrapper__arrows__arrow wz-pagination__wrapper__arrows__arrow--right\"\n [ngClass]=\"{\n 'wz-pagination__wrapper__arrows__arrow--disabled':\n pagination.currentPage | IsLastPage: pagination.totalItems:pagination.itemsPerPage\n }\"\n >\n <span class=\"wz-pagination__wrapper__arrows__arrow__icon\"></span>\n </div>\n </div>\n </div>\n</div>\n"
3707
3717
  }),
3708
3718
  __metadata("design:paramtypes", [])
3709
3719
  ], PaginationComponent);
@@ -4422,6 +4432,118 @@
4422
4432
  return NumberToArray;
4423
4433
  }());
4424
4434
 
4435
+ var PageSelectorComponent = /** @class */ (function () {
4436
+ function PageSelectorComponent() {
4437
+ this.openAbsoluteSelect = false;
4438
+ this.largeNumberOfPage = false;
4439
+ this.numberOfPage = 0;
4440
+ this.pageChange = new core.EventEmitter();
4441
+ }
4442
+ Object.defineProperty(PageSelectorComponent.prototype, "pagination", {
4443
+ get: function () {
4444
+ return this._pagination;
4445
+ },
4446
+ set: function (pagination) {
4447
+ this._pagination = pagination;
4448
+ },
4449
+ enumerable: true,
4450
+ configurable: true
4451
+ });
4452
+ Object.defineProperty(PageSelectorComponent.prototype, "totalItems", {
4453
+ get: function () {
4454
+ return this._totalItems;
4455
+ },
4456
+ set: function (totalItems) {
4457
+ this.numberOfPage = Math.ceil(totalItems / this.pagination.itemsPerPage);
4458
+ this.largeNumberOfPage = this.numberOfPage > 30;
4459
+ },
4460
+ enumerable: true,
4461
+ configurable: true
4462
+ });
4463
+ PageSelectorComponent.prototype.onGotoPageChange = function (event, directValue) {
4464
+ if (directValue) {
4465
+ this.pageChange.emit(event);
4466
+ this.openAbsoluteSelect = false;
4467
+ }
4468
+ else {
4469
+ this.pageChange.emit(parseInt(event.target.value));
4470
+ }
4471
+ };
4472
+ __decorate([
4473
+ core.Input(),
4474
+ __metadata("design:type", Object),
4475
+ __metadata("design:paramtypes", [Object])
4476
+ ], PageSelectorComponent.prototype, "pagination", null);
4477
+ __decorate([
4478
+ core.Input(),
4479
+ __metadata("design:type", Number),
4480
+ __metadata("design:paramtypes", [Number])
4481
+ ], PageSelectorComponent.prototype, "totalItems", null);
4482
+ __decorate([
4483
+ core.Output(),
4484
+ __metadata("design:type", core.EventEmitter)
4485
+ ], PageSelectorComponent.prototype, "pageChange", void 0);
4486
+ PageSelectorComponent = __decorate([
4487
+ core.Component({
4488
+ selector: 'wz-page-selector',
4489
+ template: "<div class=\"wz-selector\">\n\n <div class=\"wz-selector__default\" [ngStyle]=\"{'width': 40 + (10*pagination.currentPage.toString().length) + 'px'}\">\n <div class=\"wz-selector__default__base\" *ngIf=\"largeNumberOfPage;\" (click)=\"openAbsoluteSelect = !openAbsoluteSelect\">\n <input name=\"page-input\" [value]=\"pagination.currentPage\" (change)=\"onGotoPageChange($event, false);openAbsoluteSelect = false;\" [ngStyle]=\"{'width': 40 + (10*pagination.currentPage.toString().length) + 'px'}\" />\n <i class=\"fas fa-sort-down\"></i>\n </div>\n <div class=\"wz-selector__default__absolute\" *ngIf=\"openAbsoluteSelect\">\n <div class=\"wz-selector__default__absolute__wrapper\" *ngFor=\"let pageIndex of (pagination.totalItems | LargeNumberOfPage: pagination.itemsPerPage : pagination.currentPage).slice().reverse() as result\">\n <div class=\"wz-selector__default__absolute__wrapper__item\" [ngClass]=\"{'selected': pageIndex.value === pagination.currentPage}\" (click)=\"onGotoPageChange(pageIndex.value, true)\">\n <span>{{ pageIndex.display }}</span>\n </div>\n </div>\n </div>\n </div>\n\n <ng-container *ngIf=\"!largeNumberOfPage\">\n <select name=\"page\" (change)=\"onGotoPageChange($event, false)\" [ngStyle]=\"{'width': 40 + (10*pagination.currentPage.toString().length) + 'px'}\">\n <ng-container *ngFor=\"let pageIndex of pagination.totalItems | ArrayTotalPages: pagination.itemsPerPage\">\n <option [selected]=\"pageIndex === pagination.currentPage\" [value]=\"pageIndex\">\n {{ pageIndex }}\n </option>\n </ng-container>\n </select>\n </ng-container>\n</div>\n"
4490
+ }),
4491
+ __metadata("design:paramtypes", [])
4492
+ ], PageSelectorComponent);
4493
+ return PageSelectorComponent;
4494
+ }());
4495
+
4496
+ var LargeNumberOfPagePipe = /** @class */ (function () {
4497
+ function LargeNumberOfPagePipe() {
4498
+ }
4499
+ /**
4500
+ * Return an incremental array
4501
+ * Display 30 pages, from -15 to +15 of the current page
4502
+ * @param totalItems
4503
+ * @param itemsPerPage
4504
+ */
4505
+ LargeNumberOfPagePipe.prototype.transform = function (totalItems, itemsPerPage, currentPage) {
4506
+ if (!(totalItems >= 0 && itemsPerPage >= 0)) {
4507
+ throw new Error('totalItems or itemsPerPage missing in ArrayTotalPages pipe.');
4508
+ }
4509
+ var arrayLength = 32;
4510
+ var startAtPage = currentPage <= 15 ? 0 : currentPage - 15;
4511
+ var totalPage = Math.ceil(totalItems / itemsPerPage);
4512
+ var arrayWithPageNumber = Array.apply(null, { length: arrayLength })
4513
+ .map(Number.call, Number)
4514
+ .map(function (x) {
4515
+ var pageIndex = {
4516
+ display: startAtPage + x + 1,
4517
+ value: startAtPage + x + 1
4518
+ };
4519
+ if (x === arrayLength - 2) {
4520
+ pageIndex.display = '...';
4521
+ }
4522
+ if (x === arrayLength - 1) {
4523
+ pageIndex.display = totalPage;
4524
+ pageIndex.value = totalPage;
4525
+ }
4526
+ return pageIndex;
4527
+ });
4528
+ if (startAtPage) {
4529
+ arrayWithPageNumber.unshift({
4530
+ display: 1,
4531
+ value: 1
4532
+ }, {
4533
+ display: "...",
4534
+ value: 2
4535
+ });
4536
+ }
4537
+ return arrayWithPageNumber;
4538
+ };
4539
+ LargeNumberOfPagePipe = __decorate([
4540
+ core.Pipe({
4541
+ name: 'LargeNumberOfPage'
4542
+ })
4543
+ ], LargeNumberOfPagePipe);
4544
+ return LargeNumberOfPagePipe;
4545
+ }());
4546
+
4425
4547
  ;
4426
4548
  var components = [
4427
4549
  WzImgManagerComponent,
@@ -4444,7 +4566,8 @@
4444
4566
  InputSearchComponent,
4445
4567
  PaginationComponent,
4446
4568
  CheckboxComponent,
4447
- AlertComponent
4569
+ AlertComponent,
4570
+ PageSelectorComponent,
4448
4571
  ];
4449
4572
  var directives = [
4450
4573
  DragDropDirective,
@@ -4463,7 +4586,8 @@
4463
4586
  PagniationIsLastPage,
4464
4587
  PagniationText,
4465
4588
  ImageSrcPipe,
4466
- NumberToArray
4589
+ NumberToArray,
4590
+ LargeNumberOfPagePipe
4467
4591
  ];
4468
4592
  var WzImgManagerModule = /** @class */ (function () {
4469
4593
  function WzImgManagerModule() {
@@ -4538,21 +4662,23 @@
4538
4662
  exports.ɵbd = PaginationComponent;
4539
4663
  exports.ɵbe = CheckboxComponent;
4540
4664
  exports.ɵbf = AlertComponent;
4541
- exports.ɵbg = DragDropDirective;
4542
- exports.ɵbh = LoadingDirective;
4543
- exports.ɵbi = AutoHideDirective;
4544
- exports.ɵbj = CopyClipboardDirective;
4545
- exports.ɵbk = TableColumn;
4546
- exports.ɵbl = CheckBoxRow;
4547
- exports.ɵbm = TableColumnHeader;
4548
- exports.ɵbn = TableRow;
4549
- exports.ɵbo = AbstractDebounceDirective;
4550
- exports.ɵbp = DebounceKeyupDirective;
4551
- exports.ɵbq = PagniationArrayTotalPages;
4552
- exports.ɵbr = PagniationIsLastPage;
4553
- exports.ɵbs = PagniationText;
4554
- exports.ɵbt = ImageSrcPipe;
4555
- exports.ɵbu = NumberToArray;
4665
+ exports.ɵbg = PageSelectorComponent;
4666
+ exports.ɵbh = DragDropDirective;
4667
+ exports.ɵbi = LoadingDirective;
4668
+ exports.ɵbj = AutoHideDirective;
4669
+ exports.ɵbk = CopyClipboardDirective;
4670
+ exports.ɵbl = TableColumn;
4671
+ exports.ɵbm = CheckBoxRow;
4672
+ exports.ɵbn = TableColumnHeader;
4673
+ exports.ɵbo = TableRow;
4674
+ exports.ɵbp = AbstractDebounceDirective;
4675
+ exports.ɵbq = DebounceKeyupDirective;
4676
+ exports.ɵbr = PagniationArrayTotalPages;
4677
+ exports.ɵbs = PagniationIsLastPage;
4678
+ exports.ɵbt = PagniationText;
4679
+ exports.ɵbu = ImageSrcPipe;
4680
+ exports.ɵbv = NumberToArray;
4681
+ exports.ɵbw = LargeNumberOfPagePipe;
4556
4682
  exports.ɵc = UserSettingsService;
4557
4683
  exports.ɵd = ImgEventService;
4558
4684
  exports.ɵe = DomService;