@sumaris-net/ngx-components 1.3.10 → 1.3.11
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 +17 -5
- package/bundles/sumaris-net.ngx-components.umd.js.map +1 -1
- package/bundles/sumaris-net.ngx-components.umd.min.js +2 -2
- package/bundles/sumaris-net.ngx-components.umd.min.js.map +1 -1
- package/esm2015/src/app/core/services/base-entity-service.class.js +2 -2
- package/esm2015/src/app/shared/functions.js +15 -5
- package/esm2015/src/app/shared/material/autocomplete/material.autocomplete.js +1 -1
- package/fesm2015/sumaris-net.ngx-components.js +14 -5
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/src/app/shared/functions.d.ts +2 -2
- package/src/app/shared/material/autocomplete/material.autocomplete.d.ts +1 -0
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -511,9 +511,12 @@
|
|
|
511
511
|
return value.replace(/([a-z])([A-Z])/g, '$1_$2').toLowerCase();
|
|
512
512
|
}
|
|
513
513
|
function removeDiacritics(text) {
|
|
514
|
-
return text.normalize('NFD')
|
|
514
|
+
return text.normalize('NFD')
|
|
515
|
+
//
|
|
516
|
+
.replace(/[\u0300-\u036f]/g, '');
|
|
515
517
|
}
|
|
516
518
|
function suggestFromArray(items, value, opts) {
|
|
519
|
+
var _this = this;
|
|
517
520
|
if (isNotNil(value) && typeof value === 'object')
|
|
518
521
|
return { data: [value] };
|
|
519
522
|
value = (typeof value === 'string' && value !== '*') && value.toUpperCase() || undefined;
|
|
@@ -543,19 +546,28 @@
|
|
|
543
546
|
target = target.slice();
|
|
544
547
|
target.sort(propertiesPathComparator(keys));
|
|
545
548
|
var total = items.length || 0;
|
|
549
|
+
var fetchMore;
|
|
546
550
|
// Truncate if need
|
|
547
551
|
if (opts) {
|
|
548
|
-
if (opts.offset > 0) {
|
|
552
|
+
if (isNil(opts.offset) && opts.offset > 0) {
|
|
549
553
|
items = items.slice(opts.offset);
|
|
550
554
|
}
|
|
551
|
-
if (isNotNil(opts.size)) {
|
|
555
|
+
if (isNotNil(opts.size) && items.length > opts.size) {
|
|
552
556
|
items = items.slice(0, opts.size);
|
|
553
557
|
}
|
|
554
558
|
}
|
|
555
|
-
|
|
559
|
+
var res = {
|
|
556
560
|
data: items,
|
|
557
561
|
total: total
|
|
558
562
|
};
|
|
563
|
+
// Add fetch more capability, if total was fetched
|
|
564
|
+
var nextOffset = (opts && opts.offset || 0) + items.length;
|
|
565
|
+
if (nextOffset < total) {
|
|
566
|
+
res.fetchMore = function (_) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
567
|
+
return [2 /*return*/, suggestFromArray(items, value, Object.assign({ offset: nextOffset }, opts))];
|
|
568
|
+
}); }); };
|
|
569
|
+
}
|
|
570
|
+
return res;
|
|
559
571
|
}
|
|
560
572
|
function suggestFromStringArray(values, value, options) {
|
|
561
573
|
value = (typeof value === 'string' && value !== '*') && value.toUpperCase() || undefined;
|
|
@@ -23170,7 +23182,7 @@
|
|
|
23170
23182
|
};
|
|
23171
23183
|
// Add fetch more capability, if total was fetched
|
|
23172
23184
|
if (withTotal) {
|
|
23173
|
-
nextOffset_1 = offset + entities.length;
|
|
23185
|
+
nextOffset_1 = (offset || 0) + entities.length;
|
|
23174
23186
|
if (nextOffset_1 < res.total) {
|
|
23175
23187
|
res.fetchMore = function () { return _this.loadAll(nextOffset_1, size, sortBy, sortDirection, filter, opts); };
|
|
23176
23188
|
}
|