Hide filtered columns
This commit is contained in:
parent
5eb4ab53c6
commit
12e38589e9
|
@ -52,6 +52,27 @@
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function columnPassFilters(tagOption: TagOption | null, filters: Filter[]): boolean {
|
||||||
|
let is: TagOption[] = [];
|
||||||
|
|
||||||
|
for (const filter of filters) {
|
||||||
|
if ($currentView?.sortTag !== filter.projectTag) continue;
|
||||||
|
if (!filter.tagOption) continue;
|
||||||
|
|
||||||
|
if (filter.filterType === 0) {
|
||||||
|
is.push(filter.tagOption);
|
||||||
|
} else if (filter.filterType === 1) {
|
||||||
|
if (tagOption === filter.tagOption) return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is.length > 0) {
|
||||||
|
if (!is.some((o) => o === tagOption)) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function extractColumnCards(view: View | null, cards: Card[], tagOption: TagOption | null) {
|
function extractColumnCards(view: View | null, cards: Card[], tagOption: TagOption | null) {
|
||||||
if (!view) return cards;
|
if (!view) return cards;
|
||||||
|
|
||||||
|
@ -77,6 +98,17 @@
|
||||||
|
|
||||||
return sortedCards;
|
return sortedCards;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isFiltered(tagOption: TagOption) {
|
||||||
|
if (!$currentView) return false;
|
||||||
|
if (!$currentView.filters) return false;
|
||||||
|
|
||||||
|
for (const filter of $currentView.filters) {
|
||||||
|
if (filter.tagOption === tagOption) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if project}
|
{#if project}
|
||||||
|
@ -87,19 +119,23 @@
|
||||||
<div class="grid">
|
<div class="grid">
|
||||||
{#if $currentView.primaryTag}
|
{#if $currentView.primaryTag}
|
||||||
{#each $currentView.primaryTag.options as option (option.id)}
|
{#each $currentView.primaryTag.options as option (option.id)}
|
||||||
|
{#if columnPassFilters(option, $currentView.filters)}
|
||||||
<Column
|
<Column
|
||||||
{option}
|
{option}
|
||||||
primaryTag={$currentView.primaryTag}
|
primaryTag={$currentView.primaryTag}
|
||||||
columnCards={extractColumnCards($currentView, $cards, option)}
|
columnCards={extractColumnCards($currentView, $cards, option)}
|
||||||
{project}
|
{project}
|
||||||
/>
|
/>
|
||||||
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if columnPassFilters(null, $currentView.filters)}
|
||||||
<Column
|
<Column
|
||||||
primaryTag={$currentView.primaryTag}
|
primaryTag={$currentView.primaryTag}
|
||||||
columnCards={extractColumnCards($currentView, $cards, null)}
|
columnCards={extractColumnCards($currentView, $cards, null)}
|
||||||
{project}
|
{project}
|
||||||
/>
|
/>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
Loading…
Reference in New Issue