This commit is contained in:
Jan Prochazka
2021-09-25 12:08:20 +02:00
parent f92153d957
commit 065af0b4a8
6 changed files with 76 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
<script>
import _ from 'lodash';
import { asyncFilter } from '../utility/common';
import AppObjectGroup from './AppObjectGroup.svelte';
import AppObjectListItem from './AppObjectListItem.svelte';
@@ -16,11 +17,27 @@
export let groupFunc = undefined;
$: filtered = list.filter(data => {
const matcher = module.createMatcher && module.createMatcher(data);
if (matcher && !matcher(filter)) return false;
return true;
});
$: filtered = !groupFunc
? list.filter(data => {
const matcher = module.createMatcher && module.createMatcher(data);
if (matcher && !matcher(filter)) return false;
return true;
})
: null;
// let filtered = [];
// $: {
// if (!groupFunc) {
// asyncFilter(list, async data => {
// const matcher = module.createMatcher && module.createMatcher(data);
// if (matcher && !(await matcher(filter))) return false;
// return true;
// }).then(res => {
// filtered = res;
// });
// }
// }
$: listGrouped = groupFunc
? _.compact(
@@ -34,7 +51,6 @@
: null;
$: groups = groupFunc ? _.groupBy(listGrouped, 'group') : null;
</script>
{#if groupFunc}