@sumaris-net/ngx-components 1.5.5 → 1.5.6
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 +18 -13
- 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/doc/changelog.md +1 -1
- package/esm2015/src/app/shared/functions.js +17 -12
- package/fesm2015/sumaris-net.ngx-components.js +16 -11
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -543,26 +543,31 @@
|
|
|
543
543
|
if (target === items)
|
|
544
544
|
target = target.slice();
|
|
545
545
|
target.sort(propertiesPathComparator(keys));
|
|
546
|
-
var
|
|
547
|
-
|
|
546
|
+
var res = {
|
|
547
|
+
total: target.length || 0,
|
|
548
|
+
data: undefined // will be below
|
|
549
|
+
};
|
|
550
|
+
// Page (truncate if need)
|
|
548
551
|
if (opts) {
|
|
549
552
|
if (isNil(opts.offset) && opts.offset > 0) {
|
|
550
|
-
|
|
553
|
+
res.data = target.slice(opts.offset);
|
|
551
554
|
}
|
|
552
555
|
if (isNotNil(opts.size) && target.length > opts.size) {
|
|
553
|
-
|
|
556
|
+
res.data = target.slice(0, opts.size);
|
|
554
557
|
}
|
|
555
558
|
}
|
|
556
|
-
|
|
557
|
-
data
|
|
558
|
-
|
|
559
|
-
};
|
|
559
|
+
else {
|
|
560
|
+
res.data = target;
|
|
561
|
+
}
|
|
560
562
|
// Add fetch more capability, if total was fetched
|
|
561
|
-
var nextOffset = (opts && opts.offset || 0) +
|
|
562
|
-
if (nextOffset < total) {
|
|
563
|
-
res.fetchMore = function (_) { return __awaiter(_this, void 0, void 0, function () {
|
|
564
|
-
return
|
|
565
|
-
|
|
563
|
+
var nextOffset = (opts && opts.offset || 0) + target.length;
|
|
564
|
+
if (nextOffset < res.total) {
|
|
565
|
+
res.fetchMore = function (_) { return __awaiter(_this, void 0, void 0, function () {
|
|
566
|
+
return __generator(this, function (_a) {
|
|
567
|
+
return [2 /*return*/, suggestFromArray(target, undefined /*already applied*/, Object.assign(Object.assign({}, opts), { offset: nextOffset, excludedIds: undefined // not need (already applied)
|
|
568
|
+
}))];
|
|
569
|
+
});
|
|
570
|
+
}); };
|
|
566
571
|
}
|
|
567
572
|
return res;
|
|
568
573
|
}
|