@yomotech/view-toolkit 0.0.19 → 0.0.20

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.
@@ -75,14 +75,55 @@ class PaginationComponent {
75
75
  this.isMobile = true;
76
76
  }
77
77
  }
78
+ get paginationStyle() {
79
+ return this.getStyle(this.itemInfo?.layoutSchema?.pagination?.style);
80
+ }
81
+ get listStyle() {
82
+ return this.getStyle(this.itemInfo?.layoutSchema?.pagination?.listStyle);
83
+ }
84
+ get sizeControlStyle() {
85
+ return this.getStyle(this.itemInfo?.layoutSchema?.pagination?.sizeControlStyle);
86
+ }
87
+ get labelStyle() {
88
+ return this.getStyle(this.itemInfo?.layoutSchema?.pagination?.labelStyle);
89
+ }
90
+ get selectStyle() {
91
+ return this.getStyle(this.itemInfo?.layoutSchema?.pagination?.selectStyle);
92
+ }
93
+ getStyle(styleObject) {
94
+ if (!styleObject || typeof styleObject !== 'object') {
95
+ return {};
96
+ }
97
+ const { classes, ...styleWithoutClasses } = styleObject;
98
+ return styleWithoutClasses;
99
+ }
100
+ getPageItemStyle(page, disabled = false) {
101
+ const pagination = this.itemInfo?.layoutSchema?.pagination || {};
102
+ const baseStyle = this.getStyle(pagination.itemStyle);
103
+ const activeStyle = page !== undefined && this.currentPage === page
104
+ ? this.getStyle(pagination.activeItemStyle)
105
+ : {};
106
+ const disabledStyle = disabled
107
+ ? this.getStyle(pagination.disabledItemStyle)
108
+ : {};
109
+ return {
110
+ ...baseStyle,
111
+ ...activeStyle,
112
+ ...disabledStyle,
113
+ 'pointer-events': disabled ? 'none' : 'auto'
114
+ };
115
+ }
78
116
  invokeOnPageSizeChange(pageSize) {
79
- this.pageSizeChange.emit(pageSize);
117
+ this.pageSizeChange.emit(Number(pageSize));
80
118
  }
81
119
  invokeGoToPage(page) {
120
+ if (page < 0 || page > this.pages.length - 1 || page === this.currentPage) {
121
+ return;
122
+ }
82
123
  this.onGoToPage.emit(page);
83
124
  }
84
125
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PaginationComponent, deps: [{ token: i1.Platform }], target: i0.ɵɵFactoryTarget.Component });
85
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: PaginationComponent, isStandalone: true, selector: "vl-pagination", inputs: { itemInfo: "itemInfo", pageSize: "pageSize", currentPage: "currentPage", pages: "pages" }, outputs: { pageSizeChange: "pageSizeChange", onGoToPage: "onGoToPage" }, ngImport: i0, template: "<div [class]=\"itemInfo?.layoutSchema?.pagination?.style?.classes[0]\">\r\n <ul class=\"pagination\" [ngStyle]=\"{ 'z-index': isMobile ? 99999 : 'auto' }\">\r\n <li (click)=\"invokeGoToPage(0)\" [class.disabled]=\"currentPage === 0\">\u00AB\u00AB</li>\r\n <li (click)=\"invokeGoToPage(currentPage - 1)\" [class.disabled]=\"currentPage === 0\">\u00AB</li>\r\n <li *ngFor=\"let page of pages\" [class.active]=\"currentPage === page\" (click)=\"invokeGoToPage(page)\">\r\n {{ page + 1 }}\r\n </li>\r\n <li (click)=\"invokeGoToPage(currentPage + 1)\" [class.disabled]=\"currentPage === pages.length -1\">\r\n \u00BB\r\n </li>\r\n <li (click)=\"invokeGoToPage(pages.length -1)\" [class.disabled]=\"currentPage === pages.length -1\">\r\n \u00BB\u00BB\r\n </li>\r\n </ul>\r\n\r\n <!-- Page Size Dropdown -->\r\n <label *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize\" for=\"pageSize\">{{\r\n itemInfo?.layoutSchema?.pagination?.caption }}</label>\r\n <select *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize\" id=\"pageSize\" [(ngModel)]=\"pageSize\"\r\n (change)=\"invokeOnPageSizeChange(pageSize)\">\r\n <option *ngFor=\"let size of [5, 10, 15, 20]\" [value]=\"size\">{{ size }}</option>\r\n </select>\r\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: PlatformModule }] });
126
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.1.2", type: PaginationComponent, isStandalone: true, selector: "vl-pagination", inputs: { itemInfo: "itemInfo", pageSize: "pageSize", currentPage: "currentPage", pages: "pages" }, outputs: { pageSizeChange: "pageSizeChange", onGoToPage: "onGoToPage" }, ngImport: i0, template: "<div [ngStyle]=\"paginationStyle\">\r\n <ul [ngStyle]=\"listStyle\" [style.z-index]=\"isMobile ? 99999 : 'auto'\">\r\n\r\n <li (click)=\"invokeGoToPage(0)\" [ngStyle]=\"getPageItemStyle(undefined, currentPage === 0)\">\r\n \u00AB\u00AB\r\n </li>\r\n\r\n <li (click)=\"invokeGoToPage(currentPage - 1)\" [ngStyle]=\"getPageItemStyle(undefined, currentPage === 0)\">\r\n \u00AB\r\n </li>\r\n\r\n <li *ngFor=\"let page of pages\" (click)=\"invokeGoToPage(page)\" [ngStyle]=\"getPageItemStyle(page)\">\r\n {{ page + 1 }}\r\n </li>\r\n\r\n <li (click)=\"invokeGoToPage(currentPage + 1)\"\r\n [ngStyle]=\"getPageItemStyle(undefined, currentPage === pages.length - 1)\">\r\n \u00BB\r\n </li>\r\n\r\n <li (click)=\"invokeGoToPage(pages.length - 1)\"\r\n [ngStyle]=\"getPageItemStyle(undefined, currentPage === pages.length - 1)\">\r\n \u00BB\u00BB\r\n </li>\r\n </ul>\r\n\r\n <div *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize\" [ngStyle]=\"sizeControlStyle\">\r\n\r\n <label for=\"pageSize\" [ngStyle]=\"labelStyle\">\r\n {{ itemInfo?.layoutSchema?.pagination?.caption }}\r\n </label>\r\n\r\n <select id=\"pageSize\" [(ngModel)]=\"pageSize\" (change)=\"invokeOnPageSizeChange(pageSize)\"\r\n [ngStyle]=\"selectStyle\">\r\n\r\n <option *ngFor=\"let size of [5, 10, 15, 20]\" [value]=\"size\">\r\n {{ size }}\r\n </option>\r\n </select>\r\n </div>\r\n</div>", styles: [""], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i5.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.NgSelectOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.ɵNgSelectMultipleOption, selector: "option", inputs: ["ngValue", "value"] }, { kind: "directive", type: i2.SelectControlValueAccessor, selector: "select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]", inputs: ["compareWith"] }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "ngmodule", type: PlatformModule }] });
86
127
  }
87
128
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImport: i0, type: PaginationComponent, decorators: [{
88
129
  type: Component,
@@ -90,7 +131,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.2", ngImpor
90
131
  CommonModule,
91
132
  FormsModule,
92
133
  PlatformModule
93
- ], template: "<div [class]=\"itemInfo?.layoutSchema?.pagination?.style?.classes[0]\">\r\n <ul class=\"pagination\" [ngStyle]=\"{ 'z-index': isMobile ? 99999 : 'auto' }\">\r\n <li (click)=\"invokeGoToPage(0)\" [class.disabled]=\"currentPage === 0\">\u00AB\u00AB</li>\r\n <li (click)=\"invokeGoToPage(currentPage - 1)\" [class.disabled]=\"currentPage === 0\">\u00AB</li>\r\n <li *ngFor=\"let page of pages\" [class.active]=\"currentPage === page\" (click)=\"invokeGoToPage(page)\">\r\n {{ page + 1 }}\r\n </li>\r\n <li (click)=\"invokeGoToPage(currentPage + 1)\" [class.disabled]=\"currentPage === pages.length -1\">\r\n \u00BB\r\n </li>\r\n <li (click)=\"invokeGoToPage(pages.length -1)\" [class.disabled]=\"currentPage === pages.length -1\">\r\n \u00BB\u00BB\r\n </li>\r\n </ul>\r\n\r\n <!-- Page Size Dropdown -->\r\n <label *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize\" for=\"pageSize\">{{\r\n itemInfo?.layoutSchema?.pagination?.caption }}</label>\r\n <select *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize\" id=\"pageSize\" [(ngModel)]=\"pageSize\"\r\n (change)=\"invokeOnPageSizeChange(pageSize)\">\r\n <option *ngFor=\"let size of [5, 10, 15, 20]\" [value]=\"size\">{{ size }}</option>\r\n </select>\r\n</div>" }]
134
+ ], template: "<div [ngStyle]=\"paginationStyle\">\r\n <ul [ngStyle]=\"listStyle\" [style.z-index]=\"isMobile ? 99999 : 'auto'\">\r\n\r\n <li (click)=\"invokeGoToPage(0)\" [ngStyle]=\"getPageItemStyle(undefined, currentPage === 0)\">\r\n \u00AB\u00AB\r\n </li>\r\n\r\n <li (click)=\"invokeGoToPage(currentPage - 1)\" [ngStyle]=\"getPageItemStyle(undefined, currentPage === 0)\">\r\n \u00AB\r\n </li>\r\n\r\n <li *ngFor=\"let page of pages\" (click)=\"invokeGoToPage(page)\" [ngStyle]=\"getPageItemStyle(page)\">\r\n {{ page + 1 }}\r\n </li>\r\n\r\n <li (click)=\"invokeGoToPage(currentPage + 1)\"\r\n [ngStyle]=\"getPageItemStyle(undefined, currentPage === pages.length - 1)\">\r\n \u00BB\r\n </li>\r\n\r\n <li (click)=\"invokeGoToPage(pages.length - 1)\"\r\n [ngStyle]=\"getPageItemStyle(undefined, currentPage === pages.length - 1)\">\r\n \u00BB\u00BB\r\n </li>\r\n </ul>\r\n\r\n <div *ngIf=\"itemInfo?.layoutSchema?.pagination?.pageSize\" [ngStyle]=\"sizeControlStyle\">\r\n\r\n <label for=\"pageSize\" [ngStyle]=\"labelStyle\">\r\n {{ itemInfo?.layoutSchema?.pagination?.caption }}\r\n </label>\r\n\r\n <select id=\"pageSize\" [(ngModel)]=\"pageSize\" (change)=\"invokeOnPageSizeChange(pageSize)\"\r\n [ngStyle]=\"selectStyle\">\r\n\r\n <option *ngFor=\"let size of [5, 10, 15, 20]\" [value]=\"size\">\r\n {{ size }}\r\n </option>\r\n </select>\r\n </div>\r\n</div>" }]
94
135
  }], ctorParameters: () => [{ type: i1.Platform }], propDecorators: { itemInfo: [{
95
136
  type: Input
96
137
  }], pageSize: [{