@wizishop/img-manager 0.2.76 → 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 (27) hide show
  1. package/bundles/wizishop-img-manager.umd.js +136 -20
  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/shared/pagination/page-selector/page-selector.component.js +55 -0
  6. package/esm2015/lib/components/shared/pagination/pagination.component.js +4 -4
  7. package/esm2015/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.js +51 -0
  8. package/esm2015/lib/wz-img-manager.module.js +7 -3
  9. package/esm2015/wizishop-img-manager.js +18 -16
  10. package/esm5/lib/components/shared/pagination/page-selector/page-selector.component.js +64 -0
  11. package/esm5/lib/components/shared/pagination/pagination.component.js +4 -4
  12. package/esm5/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.js +54 -0
  13. package/esm5/lib/wz-img-manager.module.js +7 -3
  14. package/esm5/wizishop-img-manager.js +18 -16
  15. package/fesm2015/wizishop-img-manager.js +108 -6
  16. package/fesm2015/wizishop-img-manager.js.map +1 -1
  17. package/fesm5/wizishop-img-manager.js +120 -6
  18. package/fesm5/wizishop-img-manager.js.map +1 -1
  19. package/lib/components/shared/pagination/page-selector/page-selector.component.d.ts +20 -0
  20. package/lib/components/shared/pagination/pagination.component.d.ts +1 -1
  21. package/lib/pipes/pagination/large-number-of-page/large-number-of-page.pipe.d.ts +10 -0
  22. package/package.json +1 -1
  23. package/wizishop-img-manager-0.2.77.tgz +0 -0
  24. package/wizishop-img-manager.d.ts +17 -15
  25. package/wizishop-img-manager.metadata.json +1 -1
  26. package/wz-img-manager.scss +2117 -2046
  27. package/wizishop-img-manager-0.2.76.tgz +0 -0
@@ -3697,8 +3697,8 @@
3697
3697
  this.pagination.currentPage++;
3698
3698
  this.pageChange.emit(this.pagination);
3699
3699
  };
3700
- PaginationComponent.prototype.onGotoPageChange = function (event) {
3701
- this.pagination.currentPage = parseInt(event.target.value);
3700
+ PaginationComponent.prototype.onGotoPageChange = function (pageNumber) {
3701
+ this.pagination.currentPage = parseInt(pageNumber);
3702
3702
  this.pageChange.emit(this.pagination);
3703
3703
  };
3704
3704
  __decorate([
@@ -3713,7 +3713,7 @@
3713
3713
  PaginationComponent = __decorate([
3714
3714
  core.Component({
3715
3715
  selector: 'wz-pagination',
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 <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"
3717
3717
  }),
3718
3718
  __metadata("design:paramtypes", [])
3719
3719
  ], PaginationComponent);
@@ -4432,6 +4432,118 @@
4432
4432
  return NumberToArray;
4433
4433
  }());
4434
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
+
4435
4547
  ;
4436
4548
  var components = [
4437
4549
  WzImgManagerComponent,
@@ -4454,7 +4566,8 @@
4454
4566
  InputSearchComponent,
4455
4567
  PaginationComponent,
4456
4568
  CheckboxComponent,
4457
- AlertComponent
4569
+ AlertComponent,
4570
+ PageSelectorComponent,
4458
4571
  ];
4459
4572
  var directives = [
4460
4573
  DragDropDirective,
@@ -4473,7 +4586,8 @@
4473
4586
  PagniationIsLastPage,
4474
4587
  PagniationText,
4475
4588
  ImageSrcPipe,
4476
- NumberToArray
4589
+ NumberToArray,
4590
+ LargeNumberOfPagePipe
4477
4591
  ];
4478
4592
  var WzImgManagerModule = /** @class */ (function () {
4479
4593
  function WzImgManagerModule() {
@@ -4548,21 +4662,23 @@
4548
4662
  exports.ɵbd = PaginationComponent;
4549
4663
  exports.ɵbe = CheckboxComponent;
4550
4664
  exports.ɵbf = AlertComponent;
4551
- exports.ɵbg = DragDropDirective;
4552
- exports.ɵbh = LoadingDirective;
4553
- exports.ɵbi = AutoHideDirective;
4554
- exports.ɵbj = CopyClipboardDirective;
4555
- exports.ɵbk = TableColumn;
4556
- exports.ɵbl = CheckBoxRow;
4557
- exports.ɵbm = TableColumnHeader;
4558
- exports.ɵbn = TableRow;
4559
- exports.ɵbo = AbstractDebounceDirective;
4560
- exports.ɵbp = DebounceKeyupDirective;
4561
- exports.ɵbq = PagniationArrayTotalPages;
4562
- exports.ɵbr = PagniationIsLastPage;
4563
- exports.ɵbs = PagniationText;
4564
- exports.ɵbt = ImageSrcPipe;
4565
- 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;
4566
4682
  exports.ɵc = UserSettingsService;
4567
4683
  exports.ɵd = ImgEventService;
4568
4684
  exports.ɵe = DomService;