@sumaris-net/ngx-components 1.0.2 → 1.0.3
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 +9 -6
- 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/shared/functions.js +10 -7
- package/fesm2015/sumaris-net.ngx-components.js +9 -6
- package/fesm2015/sumaris-net.ngx-components.js.map +1 -1
- package/package.json +1 -1
- package/sumaris-net.ngx-components.metadata.json +1 -1
|
@@ -522,25 +522,28 @@
|
|
|
522
522
|
return { data: [], total: 0 };
|
|
523
523
|
}
|
|
524
524
|
// Filter items
|
|
525
|
+
var target = items;
|
|
525
526
|
if (isNotNilOrBlank(value)) {
|
|
526
527
|
// If wildcard, search using regexp
|
|
527
528
|
if (value.indexOf('*') !== -1) {
|
|
528
529
|
value = value.replace('*', '.*');
|
|
529
|
-
|
|
530
|
+
target = target.filter(function (v) { return keys.findIndex(function (key) { return matchUpperCase(getPropertyByPathAsString(v, key), value); }) !== -1; });
|
|
530
531
|
}
|
|
531
532
|
// Else (no wildcard), search using startsWith
|
|
532
533
|
else {
|
|
533
|
-
|
|
534
|
+
target = target.filter(function (v) { return keys.findIndex(function (key) { return startsWithUpperCase(getPropertyByPathAsString(v, key), value); }) !== -1; });
|
|
534
535
|
}
|
|
535
536
|
}
|
|
536
537
|
// Exclude ids
|
|
537
538
|
if (isNotEmptyArray(opts === null || opts === void 0 ? void 0 : opts.excludedIds)) {
|
|
538
|
-
|
|
539
|
+
target = target.filter(function (v) { return !opts.excludedIds.includes(+v['id']); });
|
|
539
540
|
}
|
|
540
|
-
// Sort
|
|
541
|
-
items
|
|
542
|
-
|
|
541
|
+
// Sort (copy if need, before sorting)
|
|
542
|
+
if (target === items)
|
|
543
|
+
target = target.slice();
|
|
544
|
+
target.sort(propertiesPathComparator(keys));
|
|
543
545
|
var total = items.length || 0;
|
|
546
|
+
// Truncate if need
|
|
544
547
|
if (opts) {
|
|
545
548
|
if (opts.offset > 0) {
|
|
546
549
|
items = items.slice(opts.offset);
|