diff --git a/src/lib/account.ts b/src/lib/account.ts index 2d7c2544..8d65e178 100644 --- a/src/lib/account.ts +++ b/src/lib/account.ts @@ -249,6 +249,26 @@ export function selectAccountOrSubAccounts(filterAccountIds: Record, allAccountsMap: Record): 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, allAccountsMap: Record, skipHiddenAccount: boolean): void { for (const accountId of keys(filterAccountIds)) { const account = allAccountsMap[accountId]; diff --git a/src/lib/category.ts b/src/lib/category.ts index f4f2b3b3..7c2a61fa 100644 --- a/src/lib/category.ts +++ b/src/lib/category.ts @@ -414,6 +414,24 @@ export function selectAllSubCategories(filterCategoryIds: Record, allTransactionCategoriesMap: Record): 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, allTransactionCategoriesMap: Record): void { for (const categoryId of keys(filterCategoryIds)) { const category = allTransactionCategoriesMap[categoryId]; diff --git a/src/lib/common.ts b/src/lib/common.ts index 02033d61..479a0317 100644 --- a/src/lib/common.ts +++ b/src/lib/common.ts @@ -482,6 +482,16 @@ export function selectInvert(filterItemIds: Record, allItemsMap } } +export function selectAllVisible(filterItemIds: Record, 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[]>, primarySubItemsField: string, secondaryValueField: string | undefined, secondaryHiddenField: string | undefined, secondaryValue: unknown): boolean { const secondaryItems = primaryItem[primarySubItemsField]; diff --git a/src/locales/de.json b/src/locales/de.json index 205024d4..3ce0ecf2 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -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", diff --git a/src/locales/en.json b/src/locales/en.json index c48cee8b..c394bc71 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -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", diff --git a/src/locales/es.json b/src/locales/es.json index 7214707f..0fbaaff1 100644 --- a/src/locales/es.json +++ b/src/locales/es.json @@ -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", diff --git a/src/locales/fr.json b/src/locales/fr.json index 31d74ac2..4829664c 100644 --- a/src/locales/fr.json +++ b/src/locales/fr.json @@ -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", diff --git a/src/locales/it.json b/src/locales/it.json index 08a78d15..4f2296d2 100644 --- a/src/locales/it.json +++ b/src/locales/it.json @@ -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", diff --git a/src/locales/ja.json b/src/locales/ja.json index 715330ff..4899fa99 100644 --- a/src/locales/ja.json +++ b/src/locales/ja.json @@ -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": "このページの選択を反転", diff --git a/src/locales/ko.json b/src/locales/ko.json index 6c0ff826..b63feb0a 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -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": "현재 페이지 선택 반전", diff --git a/src/locales/nl.json b/src/locales/nl.json index 6c4edfc8..44820471 100644 --- a/src/locales/nl.json +++ b/src/locales/nl.json @@ -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", diff --git a/src/locales/pt_BR.json b/src/locales/pt_BR.json index 902ed89a..e8025ad0 100644 --- a/src/locales/pt_BR.json +++ b/src/locales/pt_BR.json @@ -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", diff --git a/src/locales/ru.json b/src/locales/ru.json index 4ac3fb89..47d4b12b 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -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": "Инвертировать выбор на этой странице", diff --git a/src/locales/th.json b/src/locales/th.json index de6ba3f1..bf05211b 100644 --- a/src/locales/th.json +++ b/src/locales/th.json @@ -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": "สลับการเลือกในหน้านี้", diff --git a/src/locales/uk.json b/src/locales/uk.json index 7ec00ae8..34d6b744 100644 --- a/src/locales/uk.json +++ b/src/locales/uk.json @@ -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": "Інвертувати вибір на цій сторінці", diff --git a/src/locales/vi.json b/src/locales/vi.json index ee19b667..414c6268 100644 --- a/src/locales/vi.json +++ b/src/locales/vi.json @@ -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", diff --git a/src/locales/zh_Hans.json b/src/locales/zh_Hans.json index 59c5fcc5..c4be9a15 100644 --- a/src/locales/zh_Hans.json +++ b/src/locales/zh_Hans.json @@ -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": "本页反选", diff --git a/src/locales/zh_Hant.json b/src/locales/zh_Hant.json index a9728368..7053a82d 100644 --- a/src/locales/zh_Hant.json +++ b/src/locales/zh_Hant.json @@ -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": "本頁反向選擇", diff --git a/src/views/desktop/common/cards/AccountFilterSettingsCard.vue b/src/views/desktop/common/cards/AccountFilterSettingsCard.vue index ddfd3acd..ae3590ab 100644 --- a/src/views/desktop/common/cards/AccountFilterSettingsCard.vue +++ b/src/views/desktop/common/cards/AccountFilterSettingsCard.vue @@ -23,6 +23,12 @@ :disabled="!hasAnyVisibleAccount" @click="selectInvertAccounts"> + + @@ -54,6 +60,12 @@ :disabled="!hasAnyVisibleAccount" @click="selectInvertAccounts"> + + @@ -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); diff --git a/src/views/desktop/common/cards/CategoryFilterSettingsCard.vue b/src/views/desktop/common/cards/CategoryFilterSettingsCard.vue index 3b151d93..66cddc72 100644 --- a/src/views/desktop/common/cards/CategoryFilterSettingsCard.vue +++ b/src/views/desktop/common/cards/CategoryFilterSettingsCard.vue @@ -23,6 +23,11 @@ :disabled="!hasAnyVisibleCategory" @click="selectInvertCategories"> + + @@ -54,6 +59,11 @@ :disabled="!hasAnyVisibleCategory" @click="selectInvertCategories"> + + @@ -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); diff --git a/src/views/desktop/common/cards/TransactionTagFilterSettingsCard.vue b/src/views/desktop/common/cards/TransactionTagFilterSettingsCard.vue index 0a6d60cd..eb6b7b69 100644 --- a/src/views/desktop/common/cards/TransactionTagFilterSettingsCard.vue +++ b/src/views/desktop/common/cards/TransactionTagFilterSettingsCard.vue @@ -23,6 +23,11 @@ :disabled="!hasAnyVisibleTag" @click="selectInvertTransactionTags"> + + @@ -54,6 +59,11 @@ :disabled="!hasAnyVisibleTag" @click="selectInvertTransactionTags"> + + @@ -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); diff --git a/src/views/mobile/settings/AccountFilterSettingsPage.vue b/src/views/mobile/settings/AccountFilterSettingsPage.vue index 2c34860c..60b55b09 100644 --- a/src/views/mobile/settings/AccountFilterSettingsPage.vue +++ b/src/views/mobile/settings/AccountFilterSettingsPage.vue @@ -116,6 +116,9 @@ {{ tt('Select None') }} {{ tt('Invert Selection') }} + + {{ tt('Select All Visible') }} + {{ tt('Show Hidden Accounts') }} {{ tt('Hide Hidden Accounts') }} @@ -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(); diff --git a/src/views/mobile/settings/CategoryFilterSettingsPage.vue b/src/views/mobile/settings/CategoryFilterSettingsPage.vue index 5beb52c2..4719097f 100644 --- a/src/views/mobile/settings/CategoryFilterSettingsPage.vue +++ b/src/views/mobile/settings/CategoryFilterSettingsPage.vue @@ -123,6 +123,9 @@ {{ tt('Select None') }} {{ tt('Invert Selection') }} + + {{ tt('Select All Visible') }} + {{ tt('Show Hidden Transaction Categories') }} {{ tt('Hide Hidden Transaction Categories') }} @@ -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(); diff --git a/src/views/mobile/settings/TransactionTagFilterSettingsPage.vue b/src/views/mobile/settings/TransactionTagFilterSettingsPage.vue index 0a2d61b2..e40456a2 100644 --- a/src/views/mobile/settings/TransactionTagFilterSettingsPage.vue +++ b/src/views/mobile/settings/TransactionTagFilterSettingsPage.vue @@ -95,6 +95,9 @@ {{ tt('Select None') }} {{ tt('Invert Selection') }} + + {{ tt('Select All Visible') }} + {{ tt('Show Hidden Transaction Tags') }} {{ tt('Hide Hidden Transaction Tags') }} @@ -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();