@sumaris-net/ngx-components 1.6.0 → 1.6.1
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/bundles/sumaris-net.ngx-components.umd.js +46 -0
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/core/table/entities-table-datasource.class.js +29 -1
- package/fesm2015/sumaris-net.ngx-components.js +28 -0
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/core/table/entities-table-datasource.class.d.ts +6 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -23673,6 +23673,7 @@
|
|
|
23673
23673
|
_this._useValidator = false;
|
|
23674
23674
|
_this._stopWatching$ = new rxjs.Subject();
|
|
23675
23675
|
_this._editingRowCount = 0;
|
|
23676
|
+
_this._fetchMoreFn = null;
|
|
23676
23677
|
_this.loadingSubject = new rxjs.BehaviorSubject(undefined);
|
|
23677
23678
|
_this._options = Object.assign({ dataServiceOptions: {}, debug: config && config.suppressErrors === false, keepOriginalDataAfterConfirm: false }, config);
|
|
23678
23679
|
_this._useValidator = isNotNil(validatorService);
|
|
@@ -23723,6 +23724,7 @@
|
|
|
23723
23724
|
var _this = this;
|
|
23724
23725
|
this._stopWatching$.next();
|
|
23725
23726
|
this._editingRowCount = 0;
|
|
23727
|
+
this._fetchMoreFn = null;
|
|
23726
23728
|
this.markAsLoading();
|
|
23727
23729
|
return this.dataService.watchAll(offset, size, sortBy, sortDirection, filter, this.serviceOptions)
|
|
23728
23730
|
.pipe(
|
|
@@ -23736,6 +23738,7 @@
|
|
|
23736
23738
|
}
|
|
23737
23739
|
else {
|
|
23738
23740
|
_this.updateDatasource((res.data || []));
|
|
23741
|
+
_this._fetchMoreFn = res.fetchMore;
|
|
23739
23742
|
}
|
|
23740
23743
|
return res;
|
|
23741
23744
|
}));
|
|
@@ -23986,6 +23989,49 @@
|
|
|
23986
23989
|
});
|
|
23987
23990
|
});
|
|
23988
23991
|
};
|
|
23992
|
+
EntitiesTableDataSource.prototype.getData = function () {
|
|
23993
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
23994
|
+
var rows;
|
|
23995
|
+
return __generator(this, function (_a) {
|
|
23996
|
+
switch (_a.label) {
|
|
23997
|
+
case 0: return [4 /*yield*/, this.getRows()];
|
|
23998
|
+
case 1:
|
|
23999
|
+
rows = _a.sent();
|
|
24000
|
+
return [2 /*return*/, this.getDataFromRows(rows)];
|
|
24001
|
+
}
|
|
24002
|
+
});
|
|
24003
|
+
});
|
|
24004
|
+
};
|
|
24005
|
+
EntitiesTableDataSource.prototype.fetchMore = function (opts) {
|
|
24006
|
+
var _super = Object.create(null, {
|
|
24007
|
+
updateDatasource: { get: function () { return _super_1.prototype.updateDatasource; } }
|
|
24008
|
+
});
|
|
24009
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
24010
|
+
var res, existingData;
|
|
24011
|
+
return __generator(this, function (_a) {
|
|
24012
|
+
switch (_a.label) {
|
|
24013
|
+
case 0:
|
|
24014
|
+
if (!this._fetchMoreFn)
|
|
24015
|
+
return [2 /*return*/];
|
|
24016
|
+
if (this._editingRowCount > 0) {
|
|
24017
|
+
console.warn('Cannot fetch more because still editing row');
|
|
24018
|
+
return [2 /*return*/];
|
|
24019
|
+
}
|
|
24020
|
+
return [4 /*yield*/, this._fetchMoreFn()];
|
|
24021
|
+
case 1:
|
|
24022
|
+
res = _a.sent();
|
|
24023
|
+
if (isNotEmptyArray(res === null || res === void 0 ? void 0 : res.data))
|
|
24024
|
+
return [2 /*return*/];
|
|
24025
|
+
return [4 /*yield*/, this.getData()];
|
|
24026
|
+
case 2:
|
|
24027
|
+
existingData = _a.sent();
|
|
24028
|
+
_super.updateDatasource.call(this, existingData.concat.apply(existingData, __spread(res.data)), opts);
|
|
24029
|
+
this._fetchMoreFn = res.fetchMore;
|
|
24030
|
+
return [2 /*return*/];
|
|
24031
|
+
}
|
|
24032
|
+
});
|
|
24033
|
+
});
|
|
24034
|
+
};
|
|
23989
24035
|
/* -- protected method -- */
|
|
23990
24036
|
EntitiesTableDataSource.prototype.markAsLoading = function () {
|
|
23991
24037
|
if (this.loadingSubject.value !== true) {
|