support selecting all visible in account / category / tag filter dialog / page

This commit is contained in:
MaysWind
2025-10-29 00:52:03 +08:00
parent 48a06c6570
commit 274fb8b4e2
24 changed files with 146 additions and 0 deletions
+20
View File
@@ -249,6 +249,26 @@ export function selectAccountOrSubAccounts(filterAccountIds: Record<string, bool
}
}
export function selectAllVisible(filterAccountIds: Record<string, boolean>, allAccountsMap: Record<string, Account>): void {
for (const accountId of keys(filterAccountIds)) {
const account = allAccountsMap[accountId];
if (account) {
if (account.hidden) {
continue;
}
if (account.parentId && allAccountsMap[account.parentId] && allAccountsMap[account.parentId]!.hidden) {
continue;
}
if (account.type === AccountType.SingleAccount.type) {
filterAccountIds[account.id] = false;
}
}
}
}
export function selectAll(filterAccountIds: Record<string, boolean>, allAccountsMap: Record<string, Account>, skipHiddenAccount: boolean): void {
for (const accountId of keys(filterAccountIds)) {
const account = allAccountsMap[accountId];
+18
View File
@@ -414,6 +414,24 @@ export function selectAllSubCategories(filterCategoryIds: Record<string, boolean
}
}
export function selectAllVisible(filterCategoryIds: Record<string, boolean>, allTransactionCategoriesMap: Record<string, TransactionCategory>): void {
for (const categoryId of keys(filterCategoryIds)) {
const category = allTransactionCategoriesMap[categoryId];
if (category) {
if (category.hidden) {
continue;
}
if (category.parentId && allTransactionCategoriesMap[category.parentId] && allTransactionCategoriesMap[category.parentId]!.hidden) {
continue;
}
filterCategoryIds[category.id] = false;
}
}
}
export function selectAll(filterCategoryIds: Record<string, boolean>, allTransactionCategoriesMap: Record<string, TransactionCategory>): void {
for (const categoryId of keys(filterCategoryIds)) {
const category = allTransactionCategoriesMap[categoryId];
+10
View File
@@ -482,6 +482,16 @@ export function selectInvert(filterItemIds: Record<string, boolean>, allItemsMap
}
}
export function selectAllVisible(filterItemIds: Record<string, boolean>, allItemsMap: { [key: string]: { id: string, hidden?: boolean } }): void {
for (const itemId of keys(filterItemIds)) {
const item = allItemsMap[itemId];
if (item && !item.hidden) {
filterItemIds[item.id] = false;
}
}
}
export function isPrimaryItemHasSecondaryValue(primaryItem: Record<string, Record<string, unknown>[]>, primarySubItemsField: string, secondaryValueField: string | undefined, secondaryHiddenField: string | undefined, secondaryValue: unknown): boolean {
const secondaryItems = primaryItem[primarySubItemsField];
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "Alle auswählen",
"Select None": "Keine auswählen",
"Invert Selection": "Auswahl umkehren",
"Select All Visible": "Select All Visible",
"Select All in This Page": "Alle auf dieser Seite auswählen",
"Select None in This Page": "Keine auf dieser Seite auswählen",
"Invert Selection in This Page": "Auswahl auf dieser Seite umkehren",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "Select All",
"Select None": "Select None",
"Invert Selection": "Invert Selection",
"Select All Visible": "Select All Visible",
"Select All in This Page": "Select All in This Page",
"Select None in This Page": "Select None in This Page",
"Invert Selection in This Page": "Invert Selection in This Page",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "Seleccionar todo",
"Select None": "Seleccionar nada",
"Invert Selection": "Invertir selección",
"Select All Visible": "Select All Visible",
"Select All in This Page": "Seleccionar todo en esta página",
"Select None in This Page": "No seleccionar ninguno en esta página",
"Invert Selection in This Page": "Invertir selección en esta página",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "Tout sélectionner",
"Select None": "Ne rien sélectionner",
"Invert Selection": "Inverser la sélection",
"Select All Visible": "Select All Visible",
"Select All in This Page": "Tout sélectionner dans cette page",
"Select None in This Page": "Ne rien sélectionner dans cette page",
"Invert Selection in This Page": "Inverser la sélection dans cette page",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "Seleziona tutto",
"Select None": "Deseleziona tutto",
"Invert Selection": "Inverti selezione",
"Select All Visible": "Select All Visible",
"Select All in This Page": "Seleziona tutto in questa pagina",
"Select None in This Page": "Deseleziona tutto in questa pagina",
"Invert Selection in This Page": "Inverti selezione in questa pagina",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "すべて選択",
"Select None": "選択解除",
"Invert Selection": "選択を反転",
"Select All Visible": "Select All Visible",
"Select All in This Page": "このページをすべて選択",
"Select None in This Page": "このページの選択を解除",
"Invert Selection in This Page": "このページの選択を反転",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "전체 선택",
"Select None": "선택 해제",
"Invert Selection": "선택 반전",
"Select All Visible": "Select All Visible",
"Select All in This Page": "현재 페이지 전체 선택",
"Select None in This Page": "현재 페이지 선택 해제",
"Invert Selection in This Page": "현재 페이지 선택 반전",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "Alles selecteren",
"Select None": "Niets selecteren",
"Invert Selection": "Selectie omkeren",
"Select All Visible": "Select All Visible",
"Select All in This Page": "Alles op deze pagina selecteren",
"Select None in This Page": "Niets op deze pagina selecteren",
"Invert Selection in This Page": "Selectie op deze pagina omkeren",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "Selecionar Todos",
"Select None": "Selecionar Nenhum",
"Invert Selection": "Inverter Seleção",
"Select All Visible": "Select All Visible",
"Select All in This Page": "Selecionar Todos nesta Página",
"Select None in This Page": "Selecionar Nenhum nesta Página",
"Invert Selection in This Page": "Inverter Seleção nesta Página",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "Выбрать все",
"Select None": "Отменить выбор",
"Invert Selection": "Инвертировать выбор",
"Select All Visible": "Select All Visible",
"Select All in This Page": "Выбрать все на этой странице",
"Select None in This Page": "Отменить выбор на этой странице",
"Invert Selection in This Page": "Инвертировать выбор на этой странице",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "เลือกทั้งหมด",
"Select None": "ยกเลิกการเลือกทั้งหมด",
"Invert Selection": "สลับการเลือก",
"Select All Visible": "Select All Visible",
"Select All in This Page": "เลือกทั้งหมดในหน้านี้",
"Select None in This Page": "ยกเลิกการเลือกทั้งหมดในหน้านี้",
"Invert Selection in This Page": "สลับการเลือกในหน้านี้",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "Вибрати все",
"Select None": "Скасувати вибір",
"Invert Selection": "Інвертувати вибір",
"Select All Visible": "Select All Visible",
"Select All in This Page": "Вибрати все на цій сторінці",
"Select None in This Page": "Скасувати вибір на цій сторінці",
"Invert Selection in This Page": "Інвертувати вибір на цій сторінці",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "Chọn tất cả",
"Select None": "Bỏ chọn tất cả",
"Invert Selection": "Đảo ngược lựa chọn",
"Select All Visible": "Select All Visible",
"Select All in This Page": "Chọn tất cả trong trang này",
"Select None in This Page": "Bỏ chọn tất cả trong trang này",
"Invert Selection in This Page": "Đảo ngược lựa chọn trong trang này",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "全部选择",
"Select None": "全部不选",
"Invert Selection": "反向选择",
"Select All Visible": "全部选择可见",
"Select All in This Page": "本页全选",
"Select None in This Page": "本页不选",
"Invert Selection in This Page": "本页反选",
+1
View File
@@ -1534,6 +1534,7 @@
"Select All": "全選",
"Select None": "取消全選",
"Invert Selection": "反向選擇",
"Select All Visible": "全部選擇可見",
"Select All in This Page": "本頁全選",
"Select None in This Page": "取消本頁全選",
"Invert Selection in This Page": "本頁反向選擇",
@@ -23,6 +23,12 @@
:disabled="!hasAnyVisibleAccount"
@click="selectInvertAccounts"></v-list-item>
<v-divider class="my-2" v-if="allowHiddenAccount"/>
<v-list-item :prepend-icon="mdiSelectAll"
:title="tt('Select All Visible')"
:disabled="!hasAnyVisibleAccount"
@click="selectAllVisibleAccounts"
v-if="allowHiddenAccount"></v-list-item>
<v-divider class="my-2" v-if="allowHiddenAccount"/>
<v-list-item :prepend-icon="mdiEyeOutline"
:title="tt('Show Hidden Accounts')"
v-if="allowHiddenAccount && !showHidden" @click="showHidden = true"></v-list-item>
@@ -54,6 +60,12 @@
:disabled="!hasAnyVisibleAccount"
@click="selectInvertAccounts"></v-list-item>
<v-divider class="my-2" v-if="allowHiddenAccount"/>
<v-list-item :prepend-icon="mdiSelectAll"
:title="tt('Select All Visible')"
:disabled="!hasAnyVisibleAccount"
@click="selectAllVisibleAccounts"
v-if="allowHiddenAccount"></v-list-item>
<v-divider class="my-2" v-if="allowHiddenAccount"/>
<v-list-item :prepend-icon="mdiEyeOutline"
:title="tt('Show Hidden Accounts')"
v-if="allowHiddenAccount && !showHidden" @click="showHidden = true"></v-list-item>
@@ -163,6 +175,7 @@ import type { Account } from '@/models/account.ts';
import {
selectAccountOrSubAccounts,
selectAllVisible,
selectAll,
selectNone,
selectInvert,
@@ -272,6 +285,14 @@ function selectInvertAccounts(): void {
}
}
function selectAllVisibleAccounts(): void {
selectAllVisible(filterAccountIds.value, accountsStore.allAccountsMap);
if (props.autoSave) {
save();
}
}
function save(): void {
const changed = saveFilterAccountIds();
emit('settings:change', changed);
@@ -23,6 +23,11 @@
:disabled="!hasAnyVisibleCategory"
@click="selectInvertCategories"></v-list-item>
<v-divider class="my-2"/>
<v-list-item :prepend-icon="mdiSelectAll"
:title="tt('Select All Visible')"
:disabled="!hasAnyVisibleCategory"
@click="selectAllVisibleCategories"></v-list-item>
<v-divider class="my-2"/>
<v-list-item :prepend-icon="mdiEyeOutline"
:title="tt('Show Hidden Transaction Categories')"
v-if="!showHidden" @click="showHidden = true"></v-list-item>
@@ -54,6 +59,11 @@
:disabled="!hasAnyVisibleCategory"
@click="selectInvertCategories"></v-list-item>
<v-divider class="my-2"/>
<v-list-item :prepend-icon="mdiSelectAll"
:title="tt('Select All Visible')"
:disabled="!hasAnyVisibleCategory"
@click="selectAllVisibleCategories"></v-list-item>
<v-divider class="my-2"/>
<v-list-item :prepend-icon="mdiEyeOutline"
:title="tt('Show Hidden Transaction Categories')"
v-if="!showHidden" @click="showHidden = true"></v-list-item>
@@ -160,6 +170,7 @@ import type { TransactionCategory } from '@/models/transaction_category.ts';
import {
selectAllSubCategories,
selectAllVisible,
selectAll,
selectNone,
selectInvert,
@@ -279,6 +290,14 @@ function selectInvertCategories(): void {
}
}
function selectAllVisibleCategories(): void {
selectAllVisible(filterCategoryIds.value, transactionCategoriesStore.allTransactionCategoriesMap);
if (props.autoSave) {
save();
}
}
function save(): void {
const changed = saveFilterCategoryIds();
emit('settings:change', changed);
@@ -23,6 +23,11 @@
:disabled="!hasAnyVisibleTag"
@click="selectInvertTransactionTags"></v-list-item>
<v-divider class="my-2"/>
<v-list-item :prepend-icon="mdiSelectAll"
:title="tt('Select All Visible')"
:disabled="!hasAnyVisibleTag"
@click="selectAllVisibleTransactionTags"></v-list-item>
<v-divider class="my-2"/>
<v-list-item :prepend-icon="mdiEyeOutline"
:title="tt('Show Hidden Transaction Tags')"
v-if="!showHidden" @click="showHidden = true"></v-list-item>
@@ -54,6 +59,11 @@
:disabled="!hasAnyVisibleTag"
@click="selectInvertTransactionTags"></v-list-item>
<v-divider class="my-2"/>
<v-list-item :prepend-icon="mdiSelectAll"
:title="tt('Select All Visible')"
:disabled="!hasAnyVisibleTag"
@click="selectAllVisibleTransactionTags"></v-list-item>
<v-divider class="my-2"/>
<v-list-item :prepend-icon="mdiEyeOutline"
:title="tt('Show Hidden Transaction Tags')"
v-if="!showHidden" @click="showHidden = true"></v-list-item>
@@ -143,6 +153,7 @@ import { useTransactionTagsStore } from '@/stores/transactionTag.ts';
import type { TransactionTag } from '@/models/transaction_tag.ts';
import {
selectAllVisible,
selectAll,
selectNone,
selectInvert
@@ -244,6 +255,14 @@ function selectInvertTransactionTags(): void {
}
}
function selectAllVisibleTransactionTags(): void {
selectAllVisible(filterTagIds.value, transactionTagsStore.allTransactionTagsMap);
if (props.autoSave) {
save();
}
}
function save(): void {
const changed = saveFilterTagIds();
emit('settings:change', changed);
@@ -116,6 +116,9 @@
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleAccount }" @click="selectNoneAccounts">{{ tt('Select None') }}</f7-actions-button>
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleAccount }" @click="selectInvertAccounts">{{ tt('Invert Selection') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group v-if="allowHiddenAccount">
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleAccount }" @click="selectAllVisibleAccounts">{{ tt('Select All Visible') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group v-if="allowHiddenAccount">
<f7-actions-button v-if="!showHidden" @click="showHidden = true">{{ tt('Show Hidden Accounts') }}</f7-actions-button>
<f7-actions-button v-if="showHidden" @click="showHidden = false">{{ tt('Hide Hidden Accounts') }}</f7-actions-button>
@@ -143,6 +146,7 @@ import { useAccountsStore } from '@/stores/account.ts';
import { AccountType, AccountCategory } from '@/core/account.ts';
import {
selectAccountOrSubAccounts,
selectAllVisible,
selectAll,
selectNone,
selectInvert,
@@ -254,6 +258,10 @@ function selectInvertAccounts(): void {
selectInvert(filterAccountIds.value, accountsStore.allAccountsMap, !allowHiddenAccount.value);
}
function selectAllVisibleAccounts(): void {
selectAllVisible(filterAccountIds.value, accountsStore.allAccountsMap);
}
function save(): void {
saveFilterAccountIds();
props.f7router.back();
@@ -123,6 +123,9 @@
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleCategory }" @click="selectNoneCategories">{{ tt('Select None') }}</f7-actions-button>
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleCategory }" @click="selectInvertCategories">{{ tt('Invert Selection') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group>
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleCategory }" @click="selectAllVisibleCategories">{{ tt('Select All Visible') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group>
<f7-actions-button v-if="!showHidden" @click="showHidden = true">{{ tt('Show Hidden Transaction Categories') }}</f7-actions-button>
<f7-actions-button v-if="showHidden" @click="showHidden = false">{{ tt('Hide Hidden Transaction Categories') }}</f7-actions-button>
@@ -151,6 +154,7 @@ import { CategoryType } from '@/core/category.ts';
import {
selectAllSubCategories,
selectAllVisible,
selectAll,
selectNone,
selectInvert,
@@ -257,6 +261,10 @@ function selectInvertCategories(): void {
selectInvert(filterCategoryIds.value, transactionCategoriesStore.allTransactionCategoriesMap);
}
function selectAllVisibleCategories(): void {
selectAllVisible(filterCategoryIds.value, transactionCategoriesStore.allTransactionCategoriesMap);
}
function save(): void {
saveFilterCategoryIds();
props.f7router.back();
@@ -95,6 +95,9 @@
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleTag }" @click="selectNoneTransactionTags">{{ tt('Select None') }}</f7-actions-button>
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleTag }" @click="selectInvertTransactionTags">{{ tt('Invert Selection') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group>
<f7-actions-button :class="{ 'disabled': !hasAnyVisibleTag }" @click="selectAllVisibleTransactionTags">{{ tt('Select All Visible') }}</f7-actions-button>
</f7-actions-group>
<f7-actions-group>
<f7-actions-button v-if="!showHidden" @click="showHidden = true">{{ tt('Show Hidden Transaction Tags') }}</f7-actions-button>
<f7-actions-button v-if="showHidden" @click="showHidden = false">{{ tt('Hide Hidden Transaction Tags') }}</f7-actions-button>
@@ -117,6 +120,7 @@ import { useTransactionTagFilterSettingPageBase } from '@/views/base/settings/Tr
import { useTransactionTagsStore } from '@/stores/transactionTag.ts';
import {
selectAllVisible,
selectAll,
selectNone,
selectInvert
@@ -206,6 +210,10 @@ function selectInvertTransactionTags(): void {
selectInvert(filterTagIds.value, transactionTagsStore.allTransactionTagsMap);
}
function selectAllVisibleTransactionTags(): void {
selectAllVisible(filterTagIds.value, transactionTagsStore.allTransactionTagsMap);
}
function save(): void {
saveFilterTagIds();
props.f7router.back();