@sumaris-net/ngx-components 1.19.5-rc8 → 1.19.5
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 +12 -9
- 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/services/model/entity.model.js +3 -1
- package/esm2015/src/app/core/services/storage/entity-store.class.js +2 -2
- package/esm2015/src/app/shared/services/job.utils.js +4 -3
- package/fesm2015/sumaris-net.ngx-components.js +6 -3
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -11026,6 +11026,8 @@
|
|
|
11026
11026
|
(items || []).forEach(EntityUtils.cleanIdAndUpdateDate);
|
|
11027
11027
|
};
|
|
11028
11028
|
EntityUtils.sort = function (data, sortBy, sortDirection) {
|
|
11029
|
+
if (!data || data.length <= 1)
|
|
11030
|
+
return data;
|
|
11029
11031
|
return data.sort(this.sortComparator(sortBy, sortDirection));
|
|
11030
11032
|
};
|
|
11031
11033
|
EntityUtils.sortComparator = function (sortBy, sortDirection) {
|
|
@@ -13705,7 +13707,7 @@
|
|
|
13705
13707
|
if (variables.size === 0)
|
|
13706
13708
|
return { data: [], total: total };
|
|
13707
13709
|
// Sort by
|
|
13708
|
-
if (
|
|
13710
|
+
if (variables.sortBy) {
|
|
13709
13711
|
EntityUtils.sort(data, variables.sortBy, variables.sortDirection);
|
|
13710
13712
|
}
|
|
13711
13713
|
// Slice in a page (using offset and size)
|
|
@@ -20547,10 +20549,11 @@
|
|
|
20547
20549
|
return progression;
|
|
20548
20550
|
};
|
|
20549
20551
|
JobUtils.fetchAllPages = function (loadPageFn, opts) {
|
|
20552
|
+
var _a, _b;
|
|
20550
20553
|
return __awaiter(this, void 0, void 0, function () {
|
|
20551
20554
|
var maxProgression, progression, total, pageCount, progressionStep, currentPageDataCount, fetchSize, offset, data, res;
|
|
20552
|
-
return __generator(this, function (
|
|
20553
|
-
switch (
|
|
20555
|
+
return __generator(this, function (_c) {
|
|
20556
|
+
switch (_c.label) {
|
|
20554
20557
|
case 0:
|
|
20555
20558
|
maxProgression = toNumber(opts === null || opts === void 0 ? void 0 : opts.maxProgression, 100);
|
|
20556
20559
|
progression = opts === null || opts === void 0 ? void 0 : opts.progression;
|
|
@@ -20559,13 +20562,13 @@
|
|
|
20559
20562
|
throw new Error('Unable to fetch pages: invalid fetchSize: ' + fetchSize);
|
|
20560
20563
|
offset = 0;
|
|
20561
20564
|
data = [];
|
|
20562
|
-
|
|
20565
|
+
_c.label = 1;
|
|
20563
20566
|
case 1:
|
|
20564
20567
|
if (opts && opts.logPrefix)
|
|
20565
20568
|
console.debug(opts.logPrefix + " Fetching page #" + offset / fetchSize + "...");
|
|
20566
20569
|
return [4 /*yield*/, loadPageFn(offset, fetchSize)];
|
|
20567
20570
|
case 2:
|
|
20568
|
-
res =
|
|
20571
|
+
res = _c.sent();
|
|
20569
20572
|
// Concat to previous result
|
|
20570
20573
|
data = data.concat(res.data);
|
|
20571
20574
|
// Compute variables, for next loop
|
|
@@ -20581,7 +20584,7 @@
|
|
|
20581
20584
|
progressionStep = maxProgression / pageCount;
|
|
20582
20585
|
// DEBUG
|
|
20583
20586
|
if (opts && opts.logPrefix)
|
|
20584
|
-
console.debug(opts.logPrefix + " {pageCount: " + pageCount + ",
|
|
20587
|
+
console.debug(opts.logPrefix + " {pageCount: " + pageCount + ", progress: " + ((_a = progression.value) === null || _a === void 0 ? void 0 : _a.toFixed(2)) + ", pageProgressStep: " + (progressionStep === null || progressionStep === void 0 ? void 0 : progressionStep.toFixed(1)) + "}");
|
|
20585
20588
|
}
|
|
20586
20589
|
}
|
|
20587
20590
|
// Increment progression on each iteration (if possible)
|
|
@@ -20590,10 +20593,10 @@
|
|
|
20590
20593
|
}
|
|
20591
20594
|
if (opts === null || opts === void 0 ? void 0 : opts.onPageLoaded)
|
|
20592
20595
|
opts.onPageLoaded(res);
|
|
20593
|
-
|
|
20596
|
+
_c.label = 3;
|
|
20594
20597
|
case 3:
|
|
20595
20598
|
if (currentPageDataCount > 0 && ((isNil(total) && currentPageDataCount === fetchSize) || (isNotNil(total) && (offset < total)))) return [3 /*break*/, 1];
|
|
20596
|
-
|
|
20599
|
+
_c.label = 4;
|
|
20597
20600
|
case 4:
|
|
20598
20601
|
// Complete progression to reach progressionStep value (because of round)
|
|
20599
20602
|
if (isNotNil(progressionStep)) {
|
|
@@ -20612,7 +20615,7 @@
|
|
|
20612
20615
|
}
|
|
20613
20616
|
// DEBUG
|
|
20614
20617
|
if (opts && opts.logPrefix)
|
|
20615
|
-
console.debug(opts.logPrefix + " All pages fetched - {
|
|
20618
|
+
console.debug(opts.logPrefix + " All pages fetched - {progress: " + ((_b = progression.value) === null || _b === void 0 ? void 0 : _b.toFixed(2)) + ", lastProgressStep: " + (progressionStep === null || progressionStep === void 0 ? void 0 : progressionStep.toFixed(1)));
|
|
20616
20619
|
// Final increment
|
|
20617
20620
|
if (progression && progressionStep > 0) {
|
|
20618
20621
|
progression.next(progression.value + progressionStep);
|