@firestitch/list 13.1.0 → 13.2.0
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.
- package/app/classes/pagination-controller.d.ts +5 -4
- package/app/classes/sorting-controller.d.ts +5 -0
- package/app/interfaces/listconfig.interface.d.ts +4 -1
- package/app/models/row-action.model.d.ts +1 -1
- package/esm2020/app/classes/list-controller.mjs +2 -15
- package/esm2020/app/classes/pagination-controller.mjs +30 -17
- package/esm2020/app/classes/sorting-controller.mjs +19 -1
- package/esm2020/app/components/list/list.component.mjs +2 -1
- package/esm2020/app/components/pagination/pagination.component.mjs +3 -3
- package/esm2020/app/enums/{button-type.enum.mjs → action-type.enum.mjs} +1 -1
- package/esm2020/app/interfaces/listconfig.interface.mjs +1 -1
- package/esm2020/app/models/row-action.model.mjs +2 -2
- package/esm2020/public_api.mjs +2 -2
- package/fesm2015/firestitch-list.mjs +46 -31
- package/fesm2015/firestitch-list.mjs.map +1 -1
- package/fesm2020/firestitch-list.mjs +51 -31
- package/fesm2020/firestitch-list.mjs.map +1 -1
- package/package.json +1 -1
- package/public_api.d.ts +2 -2
- /package/app/enums/{button-type.enum.d.ts → action-type.enum.d.ts} +0 -0
|
@@ -2660,6 +2660,24 @@ class SortingController {
|
|
|
2660
2660
|
this.sortBy(column);
|
|
2661
2661
|
this.sortDirection(column.direction || SortingDirection.asc);
|
|
2662
2662
|
}
|
|
2663
|
+
/**
|
|
2664
|
+
* Merge sorting and fake sorting cols
|
|
2665
|
+
* Fake sorting cols it's cols which don't represented in table cols, like abstract cols
|
|
2666
|
+
*/
|
|
2667
|
+
makeSortingList() {
|
|
2668
|
+
return [
|
|
2669
|
+
...this.sortingColumns,
|
|
2670
|
+
...this.fakeSortingColumns,
|
|
2671
|
+
].reduce((acc, column) => {
|
|
2672
|
+
const sortingItem = {
|
|
2673
|
+
name: column.title,
|
|
2674
|
+
value: column.name,
|
|
2675
|
+
default: this.sortingColumn && this.sortingColumn.name === column.name,
|
|
2676
|
+
};
|
|
2677
|
+
acc.push(sortingItem);
|
|
2678
|
+
return acc;
|
|
2679
|
+
}, []);
|
|
2680
|
+
}
|
|
2663
2681
|
getColumn(name) {
|
|
2664
2682
|
return [...this.sortingColumns, ...this.fakeSortingColumns]
|
|
2665
2683
|
.find((col) => col.name === name && col.sortable);
|
|
@@ -3591,7 +3609,6 @@ class PaginationController {
|
|
|
3591
3609
|
this.manual = false;
|
|
3592
3610
|
this.page = 1; // Active page
|
|
3593
3611
|
this.offset = 0;
|
|
3594
|
-
// public pagesArray = [];
|
|
3595
3612
|
this.displayed = 0;
|
|
3596
3613
|
this._pages$ = new BehaviorSubject(0); // Total pages
|
|
3597
3614
|
this._strategy = PaginationStrategy.None;
|
|
@@ -3599,9 +3616,7 @@ class PaginationController {
|
|
|
3599
3616
|
this._pageChanged$ = new Subject();
|
|
3600
3617
|
this._pageReset$ = new Subject();
|
|
3601
3618
|
this._onDestroy$ = new Subject();
|
|
3602
|
-
this._loadMoreEnabled = false;
|
|
3603
3619
|
this._infinityScrollEnabled = false;
|
|
3604
|
-
this._loadMoreText = 'Load More';
|
|
3605
3620
|
this._limits = [10, 25, 50, 100, 200];
|
|
3606
3621
|
}
|
|
3607
3622
|
// Total pages
|
|
@@ -3664,13 +3679,15 @@ class PaginationController {
|
|
|
3664
3679
|
}
|
|
3665
3680
|
get loadMoreQuery() {
|
|
3666
3681
|
switch (this.strategy) {
|
|
3667
|
-
case PaginationStrategy.Page:
|
|
3682
|
+
case PaginationStrategy.Page: {
|
|
3668
3683
|
return this.query;
|
|
3669
|
-
|
|
3684
|
+
}
|
|
3685
|
+
case PaginationStrategy.Offset: {
|
|
3670
3686
|
const query = this.queryOffsetStrategy;
|
|
3671
3687
|
query.limit = query.offset + query.limit;
|
|
3672
3688
|
query.offset = 0;
|
|
3673
3689
|
return query;
|
|
3690
|
+
}
|
|
3674
3691
|
}
|
|
3675
3692
|
return {};
|
|
3676
3693
|
}
|
|
@@ -3761,10 +3778,22 @@ class PaginationController {
|
|
|
3761
3778
|
return false;
|
|
3762
3779
|
}
|
|
3763
3780
|
get loadMoreEnabled() {
|
|
3764
|
-
return this.
|
|
3781
|
+
return this._loadMoreConfig.enabled;
|
|
3765
3782
|
}
|
|
3766
|
-
get
|
|
3767
|
-
return this.
|
|
3783
|
+
get loadMoreLabel() {
|
|
3784
|
+
return this._loadMoreConfig.label;
|
|
3785
|
+
}
|
|
3786
|
+
get loadMoreButtonColor() {
|
|
3787
|
+
return this._loadMoreConfig.buttonColor;
|
|
3788
|
+
}
|
|
3789
|
+
get loadMoreButtonClass() {
|
|
3790
|
+
if (this._loadMoreConfig.buttonType === 'basic') {
|
|
3791
|
+
return '';
|
|
3792
|
+
}
|
|
3793
|
+
return `mat-${this._loadMoreConfig.buttonType}-button`;
|
|
3794
|
+
}
|
|
3795
|
+
get loadMoreButtonType() {
|
|
3796
|
+
return this._loadMoreConfig.buttonType;
|
|
3768
3797
|
}
|
|
3769
3798
|
get infinityScrollEnabled() {
|
|
3770
3799
|
return this._infinityScrollEnabled;
|
|
@@ -3801,9 +3830,7 @@ class PaginationController {
|
|
|
3801
3830
|
}
|
|
3802
3831
|
this.strategy = config.strategy;
|
|
3803
3832
|
}
|
|
3804
|
-
|
|
3805
|
-
this.setLoadMore(loadMore);
|
|
3806
|
-
}
|
|
3833
|
+
this.setLoadMore(loadMore);
|
|
3807
3834
|
this._infinityScrollEnabled = infinityScrollEnabled;
|
|
3808
3835
|
}
|
|
3809
3836
|
/**
|
|
@@ -3892,10 +3919,15 @@ class PaginationController {
|
|
|
3892
3919
|
// this.pagesArray = Object.assign([], pagesArr);
|
|
3893
3920
|
// }
|
|
3894
3921
|
setLoadMore(config) {
|
|
3895
|
-
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3922
|
+
const loadMoreConfig = typeof config === 'boolean' ? {
|
|
3923
|
+
enabled: !!config,
|
|
3924
|
+
} : config;
|
|
3925
|
+
this._loadMoreConfig = {
|
|
3926
|
+
enabled: true,
|
|
3927
|
+
label: 'Load More',
|
|
3928
|
+
buttonType: 'basic',
|
|
3929
|
+
...loadMoreConfig,
|
|
3930
|
+
};
|
|
3899
3931
|
}
|
|
3900
3932
|
/**
|
|
3901
3933
|
* Update dispayed records counter
|
|
@@ -4602,20 +4634,7 @@ class List {
|
|
|
4602
4634
|
if (this.filterConfig) {
|
|
4603
4635
|
return;
|
|
4604
4636
|
}
|
|
4605
|
-
|
|
4606
|
-
// Fake sorting cols it's cols which don't represented in table cols, like abstract cols
|
|
4607
|
-
const sortValues = [
|
|
4608
|
-
...this.sorting.sortingColumns,
|
|
4609
|
-
...this.sorting.fakeSortingColumns,
|
|
4610
|
-
].reduce((acc, column) => {
|
|
4611
|
-
const sortingItem = {
|
|
4612
|
-
name: column.title,
|
|
4613
|
-
value: column.name,
|
|
4614
|
-
default: this.sorting.sortingColumn && this.sorting.sortingColumn.name === column.name,
|
|
4615
|
-
};
|
|
4616
|
-
acc.push(sortingItem);
|
|
4617
|
-
return acc;
|
|
4618
|
-
}, []);
|
|
4637
|
+
const sortValues = this.sorting.makeSortingList();
|
|
4619
4638
|
const sortConfig = this.sorting.sortingColumn
|
|
4620
4639
|
? { value: this.sorting.sortingColumn.name, direction: this.sorting.sortingColumn.direction }
|
|
4621
4640
|
: null;
|
|
@@ -5217,10 +5236,10 @@ class FsPaginationComponent {
|
|
|
5217
5236
|
}
|
|
5218
5237
|
}
|
|
5219
5238
|
FsPaginationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsPaginationComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
5220
|
-
FsPaginationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsPaginationComponent, selector: "fs-list-pagination", inputs: { pagination: "pagination", rows: "rows" }, ngImport: i0, template: "<ng-container *ngIf=\"!pagination.loadMoreEnabled; else loadMoreButton\">\n <ng-container *ngIf=\"pagination?.pages\">\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"first\" [class.disabled]=\"!pagination.hasPrevPage\" (click)=\"pagination.goFirst()\">\n <i class=\"material-icons\">first_page</i>\n </a>\n\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"previous\" [class.disabled]=\"!pagination.hasPrevPage\" (click)=\"pagination.goPrev()\">\n <i class=\"material-icons\">keyboard_arrow_left</i>\n </a>\n\n <div class=\"number\">\n {{ pagination.page | fsFormatNumber }} of {{ pagination.pages | fsFormatNumber }}\n </div>\n\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"next\" [class.disabled]=\"!pagination.hasNextPage\" (click)=\"pagination.goNext()\">\n <i class=\"material-icons\">keyboard_arrow_right</i>\n </a>\n\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"last\" [class.disabled]=\"!pagination.hasNextPage\" (click)=\"pagination.goLast()\">\n <i class=\"material-icons\">last_page</i>\n </a>\n </ng-container>\n</ng-container>\n\n<ng-template #loadMoreButton>\n <div class=\"fs-list-load-more\" *ngIf=\"pagination.hasNextPage\">\n <button mat-button
|
|
5239
|
+
FsPaginationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "12.0.0", version: "13.4.0", type: FsPaginationComponent, selector: "fs-list-pagination", inputs: { pagination: "pagination", rows: "rows" }, ngImport: i0, template: "<ng-container *ngIf=\"!pagination.loadMoreEnabled; else loadMoreButton\">\n <ng-container *ngIf=\"pagination?.pages\">\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"first\" [class.disabled]=\"!pagination.hasPrevPage\" (click)=\"pagination.goFirst()\">\n <i class=\"material-icons\">first_page</i>\n </a>\n\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"previous\" [class.disabled]=\"!pagination.hasPrevPage\" (click)=\"pagination.goPrev()\">\n <i class=\"material-icons\">keyboard_arrow_left</i>\n </a>\n\n <div class=\"number\">\n {{ pagination.page | fsFormatNumber }} of {{ pagination.pages | fsFormatNumber }}\n </div>\n\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"next\" [class.disabled]=\"!pagination.hasNextPage\" (click)=\"pagination.goNext()\">\n <i class=\"material-icons\">keyboard_arrow_right</i>\n </a>\n\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"last\" [class.disabled]=\"!pagination.hasNextPage\" (click)=\"pagination.goLast()\">\n <i class=\"material-icons\">last_page</i>\n </a>\n </ng-container>\n</ng-container>\n\n<ng-template #loadMoreButton>\n <div class=\"fs-list-load-more\" *ngIf=\"pagination.hasNextPage\">\n <button \n mat-button\n type=\"button\"\n [class]=\"pagination.loadMoreButtonClass\"\n [color]=\"pagination.loadMoreButtonColor\"\n (click)=\"pagination.goNext()\">\n {{ pagination.loadMoreLabel }}\n </button>\n </div>\n</ng-template>\n", styles: [":host{display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none;width:100%}a{text-align:center;color:#000000de;text-decoration:none;font-size:15px;cursor:pointer;display:flex}a:not(.page){padding:10px}a.disabled{pointer-events:none;cursor:default;color:#d8d8d8}.number{font-size:90%}.fs-list-load-more button{width:100%;margin-top:10px}\n"], components: [{ type: i1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }], directives: [{ type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { type: i3$2.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }], pipes: { "fsFormatNumber": i4.FsFormatNumberPipe }, changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
5221
5240
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "13.4.0", ngImport: i0, type: FsPaginationComponent, decorators: [{
|
|
5222
5241
|
type: Component,
|
|
5223
|
-
args: [{ selector: 'fs-list-pagination', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"!pagination.loadMoreEnabled; else loadMoreButton\">\n <ng-container *ngIf=\"pagination?.pages\">\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"first\" [class.disabled]=\"!pagination.hasPrevPage\" (click)=\"pagination.goFirst()\">\n <i class=\"material-icons\">first_page</i>\n </a>\n\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"previous\" [class.disabled]=\"!pagination.hasPrevPage\" (click)=\"pagination.goPrev()\">\n <i class=\"material-icons\">keyboard_arrow_left</i>\n </a>\n\n <div class=\"number\">\n {{ pagination.page | fsFormatNumber }} of {{ pagination.pages | fsFormatNumber }}\n </div>\n\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"next\" [class.disabled]=\"!pagination.hasNextPage\" (click)=\"pagination.goNext()\">\n <i class=\"material-icons\">keyboard_arrow_right</i>\n </a>\n\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"last\" [class.disabled]=\"!pagination.hasNextPage\" (click)=\"pagination.goLast()\">\n <i class=\"material-icons\">last_page</i>\n </a>\n </ng-container>\n</ng-container>\n\n<ng-template #loadMoreButton>\n <div class=\"fs-list-load-more\" *ngIf=\"pagination.hasNextPage\">\n <button mat-button
|
|
5242
|
+
args: [{ selector: 'fs-list-pagination', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"!pagination.loadMoreEnabled; else loadMoreButton\">\n <ng-container *ngIf=\"pagination?.pages\">\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"first\" [class.disabled]=\"!pagination.hasPrevPage\" (click)=\"pagination.goFirst()\">\n <i class=\"material-icons\">first_page</i>\n </a>\n\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"previous\" [class.disabled]=\"!pagination.hasPrevPage\" (click)=\"pagination.goPrev()\">\n <i class=\"material-icons\">keyboard_arrow_left</i>\n </a>\n\n <div class=\"number\">\n {{ pagination.page | fsFormatNumber }} of {{ pagination.pages | fsFormatNumber }}\n </div>\n\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"next\" [class.disabled]=\"!pagination.hasNextPage\" (click)=\"pagination.goNext()\">\n <i class=\"material-icons\">keyboard_arrow_right</i>\n </a>\n\n <a matRipple [matRippleRadius]=\"15\" [matRippleCentered]=\"true\" class=\"last\" [class.disabled]=\"!pagination.hasNextPage\" (click)=\"pagination.goLast()\">\n <i class=\"material-icons\">last_page</i>\n </a>\n </ng-container>\n</ng-container>\n\n<ng-template #loadMoreButton>\n <div class=\"fs-list-load-more\" *ngIf=\"pagination.hasNextPage\">\n <button \n mat-button\n type=\"button\"\n [class]=\"pagination.loadMoreButtonClass\"\n [color]=\"pagination.loadMoreButtonColor\"\n (click)=\"pagination.goNext()\">\n {{ pagination.loadMoreLabel }}\n </button>\n </div>\n</ng-template>\n", styles: [":host{display:flex;justify-content:center;align-items:center;-webkit-user-select:none;user-select:none;width:100%}a{text-align:center;color:#000000de;text-decoration:none;font-size:15px;cursor:pointer;display:flex}a:not(.page){padding:10px}a.disabled{pointer-events:none;cursor:default;color:#d8d8d8}.number{font-size:90%}.fs-list-load-more button{width:100%;margin-top:10px}\n"] }]
|
|
5224
5243
|
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { pagination: [{
|
|
5225
5244
|
type: Input
|
|
5226
5245
|
}], rows: [{
|
|
@@ -5419,6 +5438,7 @@ class FsListComponent {
|
|
|
5419
5438
|
*/
|
|
5420
5439
|
columnVisibility(name, show) {
|
|
5421
5440
|
this.columnsVisibility([{ name, show }]);
|
|
5441
|
+
this.filterRef.updateSortings(this.list.sorting.makeSortingList());
|
|
5422
5442
|
}
|
|
5423
5443
|
/**
|
|
5424
5444
|
* Update visibility for list of specific columns
|