@firestitch/list 9.12.3 → 9.12.4
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 +10 -6
- package/bundles/firestitch-list.umd.js +73 -59
- package/bundles/firestitch-list.umd.js.map +1 -1
- package/bundles/firestitch-list.umd.min.js +1 -1
- package/bundles/firestitch-list.umd.min.js.map +1 -1
- package/esm2015/app/classes/list-controller.js +14 -4
- package/esm2015/app/classes/pagination-controller.js +40 -40
- package/esm5/app/classes/list-controller.js +14 -4
- package/esm5/app/classes/pagination-controller.js +62 -60
- package/fesm2015/firestitch-list.js +52 -40
- package/fesm2015/firestitch-list.js.map +1 -1
- package/fesm5/firestitch-list.js +74 -60
- package/fesm5/firestitch-list.js.map +1 -1
- package/firestitch-list.metadata.json +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
|
-
import { Model } from 'tsmodels';
|
|
3
2
|
import { FsListLoadMoreConfig, FsPaging, PageChange, QueryOffsetStrategy, QueryPageStrategy } from '../interfaces';
|
|
4
3
|
import { PaginationStrategy } from '../enums/pagination-strategy.enum';
|
|
5
|
-
export declare class PaginationController
|
|
4
|
+
export declare class PaginationController {
|
|
6
5
|
limit: number;
|
|
7
6
|
records: number;
|
|
8
7
|
manual: boolean;
|
|
@@ -45,6 +44,7 @@ export declare class PaginationController extends Model {
|
|
|
45
44
|
* Get query for request
|
|
46
45
|
*/
|
|
47
46
|
get query(): QueryPageStrategy | QueryOffsetStrategy;
|
|
47
|
+
get loadMoreQuery(): QueryPageStrategy | QueryOffsetStrategy;
|
|
48
48
|
/**
|
|
49
49
|
* Query for Page Strategy
|
|
50
50
|
*/
|
|
@@ -93,7 +93,6 @@ export declare class PaginationController extends Model {
|
|
|
93
93
|
* Showing 0 results sorted by Name, Ascending
|
|
94
94
|
*/
|
|
95
95
|
get statusLabel(): string;
|
|
96
|
-
_fromJSON(value: any): void;
|
|
97
96
|
initWithConfig(config: FsPaging | false, loadMore: FsListLoadMoreConfig | boolean, infinityScrollEnabled?: boolean): void;
|
|
98
97
|
/**
|
|
99
98
|
* If pagination has prev page when Page Strategy
|
|
@@ -114,10 +113,10 @@ export declare class PaginationController extends Model {
|
|
|
114
113
|
/**
|
|
115
114
|
* Update paging config and all related fields
|
|
116
115
|
* @param config
|
|
117
|
-
* @param
|
|
118
|
-
* @param
|
|
116
|
+
* @param displayedRecords
|
|
117
|
+
* @param loadMoreOperation
|
|
119
118
|
*/
|
|
120
|
-
updatePaging(config: any,
|
|
119
|
+
updatePaging(config: any, displayedRecords?: number, loadMoreOperation?: boolean): void;
|
|
121
120
|
/**
|
|
122
121
|
* Update pages array with new pages count
|
|
123
122
|
*/
|
|
@@ -174,6 +173,11 @@ export declare class PaginationController extends Model {
|
|
|
174
173
|
* Destroy
|
|
175
174
|
*/
|
|
176
175
|
destroy(): void;
|
|
176
|
+
/**
|
|
177
|
+
* Update paging state
|
|
178
|
+
* @param params
|
|
179
|
+
*/
|
|
180
|
+
private _fromParams;
|
|
177
181
|
/**
|
|
178
182
|
* Calc and update offset
|
|
179
183
|
*/
|
|
@@ -1616,27 +1616,24 @@
|
|
|
1616
1616
|
PaginationStrategy["None"] = "none";
|
|
1617
1617
|
})(exports.PaginationStrategy || (exports.PaginationStrategy = {}));
|
|
1618
1618
|
|
|
1619
|
-
var PaginationController = /** @class */ (function (
|
|
1620
|
-
__extends(PaginationController, _super);
|
|
1619
|
+
var PaginationController = /** @class */ (function () {
|
|
1621
1620
|
function PaginationController() {
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
_this.offset = 0;
|
|
1621
|
+
this.limit = 25;
|
|
1622
|
+
this.manual = false;
|
|
1623
|
+
this.page = 1; // Active page
|
|
1624
|
+
this.offset = 0;
|
|
1627
1625
|
// public pagesArray = [];
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
return _this;
|
|
1626
|
+
this.displayed = 0;
|
|
1627
|
+
this._pages$ = new rxjs.BehaviorSubject(0); // Total pages
|
|
1628
|
+
this._strategy = exports.PaginationStrategy.None;
|
|
1629
|
+
this._removedRows = 0;
|
|
1630
|
+
this._pageChanged$ = new rxjs.Subject();
|
|
1631
|
+
this._pageReset$ = new rxjs.Subject();
|
|
1632
|
+
this._onDestroy$ = new rxjs.Subject();
|
|
1633
|
+
this._loadMoreEnabled = false;
|
|
1634
|
+
this._infinityScrollEnabled = false;
|
|
1635
|
+
this._loadMoreText = 'Load More';
|
|
1636
|
+
this._limits = [10, 25, 50, 100, 200];
|
|
1640
1637
|
}
|
|
1641
1638
|
Object.defineProperty(PaginationController.prototype, "pages", {
|
|
1642
1639
|
get: function () {
|
|
@@ -1651,7 +1648,8 @@
|
|
|
1651
1648
|
});
|
|
1652
1649
|
Object.defineProperty(PaginationController.prototype, "pages$", {
|
|
1653
1650
|
get: function () {
|
|
1654
|
-
return this._pages
|
|
1651
|
+
return this._pages$
|
|
1652
|
+
.pipe(operators.distinctUntilChanged());
|
|
1655
1653
|
},
|
|
1656
1654
|
enumerable: true,
|
|
1657
1655
|
configurable: true
|
|
@@ -1722,6 +1720,22 @@
|
|
|
1722
1720
|
enumerable: true,
|
|
1723
1721
|
configurable: true
|
|
1724
1722
|
});
|
|
1723
|
+
Object.defineProperty(PaginationController.prototype, "loadMoreQuery", {
|
|
1724
|
+
get: function () {
|
|
1725
|
+
switch (this.strategy) {
|
|
1726
|
+
case exports.PaginationStrategy.Page:
|
|
1727
|
+
return this.query;
|
|
1728
|
+
case exports.PaginationStrategy.Offset:
|
|
1729
|
+
var query = this.queryOffsetStrategy;
|
|
1730
|
+
query.limit = query.offset + query.limit;
|
|
1731
|
+
query.offset = 0;
|
|
1732
|
+
return query;
|
|
1733
|
+
}
|
|
1734
|
+
return {};
|
|
1735
|
+
},
|
|
1736
|
+
enumerable: true,
|
|
1737
|
+
configurable: true
|
|
1738
|
+
});
|
|
1725
1739
|
Object.defineProperty(PaginationController.prototype, "queryPageStrategy", {
|
|
1726
1740
|
/**
|
|
1727
1741
|
* Query for Page Strategy
|
|
@@ -1884,12 +1898,6 @@
|
|
|
1884
1898
|
enumerable: true,
|
|
1885
1899
|
configurable: true
|
|
1886
1900
|
});
|
|
1887
|
-
PaginationController.prototype._fromJSON = function (value) {
|
|
1888
|
-
_super.prototype._fromJSON.call(this, value);
|
|
1889
|
-
if (!value.limit) {
|
|
1890
|
-
this.limit = 25;
|
|
1891
|
-
}
|
|
1892
|
-
};
|
|
1893
1901
|
PaginationController.prototype.initWithConfig = function (config, loadMore, infinityScrollEnabled) {
|
|
1894
1902
|
if (infinityScrollEnabled === void 0) { infinityScrollEnabled = false; }
|
|
1895
1903
|
if (config) {
|
|
@@ -1899,12 +1907,12 @@
|
|
|
1899
1907
|
if (config.limit) {
|
|
1900
1908
|
this.limit = config.limit;
|
|
1901
1909
|
}
|
|
1902
|
-
if (loadMore) {
|
|
1903
|
-
this.setLoadMore(loadMore);
|
|
1904
|
-
}
|
|
1905
|
-
this._infinityScrollEnabled = infinityScrollEnabled;
|
|
1906
1910
|
this.strategy = config.strategy;
|
|
1907
1911
|
}
|
|
1912
|
+
if (loadMore) {
|
|
1913
|
+
this.setLoadMore(loadMore);
|
|
1914
|
+
}
|
|
1915
|
+
this._infinityScrollEnabled = infinityScrollEnabled;
|
|
1908
1916
|
};
|
|
1909
1917
|
Object.defineProperty(PaginationController.prototype, "_hasPrevPagePageStrategy", {
|
|
1910
1918
|
/**
|
|
@@ -1949,15 +1957,15 @@
|
|
|
1949
1957
|
/**
|
|
1950
1958
|
* Update paging config and all related fields
|
|
1951
1959
|
* @param config
|
|
1952
|
-
* @param
|
|
1953
|
-
* @param
|
|
1960
|
+
* @param displayedRecords
|
|
1961
|
+
* @param loadMoreOperation
|
|
1954
1962
|
*/
|
|
1955
|
-
PaginationController.prototype.updatePaging = function (config,
|
|
1956
|
-
if (
|
|
1957
|
-
if (
|
|
1958
|
-
if (!
|
|
1959
|
-
this.
|
|
1960
|
-
this.displayed =
|
|
1963
|
+
PaginationController.prototype.updatePaging = function (config, displayedRecords, loadMoreOperation) {
|
|
1964
|
+
if (displayedRecords === void 0) { displayedRecords = 0; }
|
|
1965
|
+
if (loadMoreOperation === void 0) { loadMoreOperation = false; }
|
|
1966
|
+
if (!loadMoreOperation) {
|
|
1967
|
+
this._fromParams(config);
|
|
1968
|
+
this.displayed = displayedRecords;
|
|
1961
1969
|
}
|
|
1962
1970
|
else {
|
|
1963
1971
|
this.records = config.records;
|
|
@@ -2144,6 +2152,19 @@
|
|
|
2144
2152
|
this._onDestroy$.next();
|
|
2145
2153
|
this._onDestroy$.complete();
|
|
2146
2154
|
};
|
|
2155
|
+
/**
|
|
2156
|
+
* Update paging state
|
|
2157
|
+
* @param params
|
|
2158
|
+
*/
|
|
2159
|
+
PaginationController.prototype._fromParams = function (params) {
|
|
2160
|
+
var _a;
|
|
2161
|
+
if (!this.loadMoreEnabled) {
|
|
2162
|
+
this.limit = (_a = params.limit, (_a !== null && _a !== void 0 ? _a : 25));
|
|
2163
|
+
}
|
|
2164
|
+
this.records = params.records;
|
|
2165
|
+
this.manual = params.manual;
|
|
2166
|
+
this.pages = params.pages || 0;
|
|
2167
|
+
};
|
|
2147
2168
|
/**
|
|
2148
2169
|
* Calc and update offset
|
|
2149
2170
|
*/
|
|
@@ -2156,25 +2177,8 @@
|
|
|
2156
2177
|
PaginationController.prototype.updateTotalPages = function () {
|
|
2157
2178
|
this.pages = Math.ceil(this.records / this.limit);
|
|
2158
2179
|
};
|
|
2159
|
-
__decorate([
|
|
2160
|
-
tsmodels.Alias(),
|
|
2161
|
-
__metadata("design:type", Object)
|
|
2162
|
-
], PaginationController.prototype, "limit", void 0);
|
|
2163
|
-
__decorate([
|
|
2164
|
-
tsmodels.Alias(),
|
|
2165
|
-
__metadata("design:type", Number)
|
|
2166
|
-
], PaginationController.prototype, "records", void 0);
|
|
2167
|
-
__decorate([
|
|
2168
|
-
tsmodels.Alias(),
|
|
2169
|
-
__metadata("design:type", Object)
|
|
2170
|
-
], PaginationController.prototype, "manual", void 0);
|
|
2171
|
-
__decorate([
|
|
2172
|
-
tsmodels.Alias('pages'),
|
|
2173
|
-
__metadata("design:type", Number),
|
|
2174
|
-
__metadata("design:paramtypes", [Number])
|
|
2175
|
-
], PaginationController.prototype, "pages", null);
|
|
2176
2180
|
return PaginationController;
|
|
2177
|
-
}(
|
|
2181
|
+
}());
|
|
2178
2182
|
|
|
2179
2183
|
|
|
2180
2184
|
(function (SelectionChangeType) {
|
|
@@ -3394,9 +3398,18 @@
|
|
|
3394
3398
|
var _a;
|
|
3395
3399
|
(_a = _this.selection) === null || _a === void 0 ? void 0 : _a.closeSelectionDialog();
|
|
3396
3400
|
}), operators.map(function (params) {
|
|
3397
|
-
var query =
|
|
3398
|
-
|
|
3399
|
-
|
|
3401
|
+
var query = Object.assign({}, _this.filtersQuery);
|
|
3402
|
+
if (_this.paging.hasOffsetStrategy && params && params.loadOffset) {
|
|
3403
|
+
query = Object.assign(query, _this.paging.loadDeletedOffsetQuery);
|
|
3404
|
+
}
|
|
3405
|
+
else {
|
|
3406
|
+
if (_this.initialFetch && _this.paging.loadMoreEnabled) {
|
|
3407
|
+
query = Object.assign(query, _this.paging.loadMoreQuery);
|
|
3408
|
+
}
|
|
3409
|
+
else {
|
|
3410
|
+
query = Object.assign(query, _this.paging.query);
|
|
3411
|
+
}
|
|
3412
|
+
}
|
|
3400
3413
|
if (_this.sorting.sortingColumn) {
|
|
3401
3414
|
Object.assign(query, {
|
|
3402
3415
|
order: _this.sorting.sortingColumn.name + "," + _this.sorting.sortingColumn.direction
|
|
@@ -3423,6 +3436,7 @@
|
|
|
3423
3436
|
return source$;
|
|
3424
3437
|
}), operators.takeUntil(this.onDestroy$))
|
|
3425
3438
|
.subscribe(function (response) {
|
|
3439
|
+
_this.initialFetch = false;
|
|
3426
3440
|
_this.completeFetch(response);
|
|
3427
3441
|
});
|
|
3428
3442
|
};
|