mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-21 02:04:26 +08:00
fix the filter dropdown menu not display the selected items after selecting multiple hidden transaction categories or accounts
This commit is contained in:
@@ -440,7 +440,8 @@ html[dir="rtl"] i.icon.icon-with-direction {
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.list > ul > li.item-in-multiple-selection > .item-content > .item-inner > .item-title {
|
.list > ul > li.item-in-multiple-selection > .item-content > .item-inner > .item-title,
|
||||||
|
.list > ul > li.item-in-multiple-selection > .item-link > .item-content > .item-inner > .item-title {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -270,6 +270,20 @@ export function useTransactionListPageBase() {
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function hasSubCategoryInQuery(category: TransactionCategory): boolean {
|
||||||
|
if (!category.subCategories || !category.subCategories.length) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const subCategory of category.subCategories) {
|
||||||
|
if (queryAllFilterCategoryIds.value[subCategory.id]) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function formatAmount(amount: number, hideAmount: boolean, currencyCode: string): string {
|
function formatAmount(amount: number, hideAmount: boolean, currencyCode: string): string {
|
||||||
if (hideAmount) {
|
if (hideAmount) {
|
||||||
return formatAmountToLocalizedNumeralsWithCurrency(DISPLAY_HIDDEN_AMOUNT, currencyCode);
|
return formatAmountToLocalizedNumeralsWithCurrency(DISPLAY_HIDDEN_AMOUNT, currencyCode);
|
||||||
@@ -395,6 +409,7 @@ export function useTransactionListPageBase() {
|
|||||||
currentMonthTransactionData,
|
currentMonthTransactionData,
|
||||||
canAddTransaction,
|
canAddTransaction,
|
||||||
// functions
|
// functions
|
||||||
|
hasSubCategoryInQuery,
|
||||||
getDisplayTime,
|
getDisplayTime,
|
||||||
getDisplayLongDate,
|
getDisplayLongDate,
|
||||||
getDisplayLongYearMonth,
|
getDisplayLongYearMonth,
|
||||||
|
|||||||
@@ -266,7 +266,7 @@
|
|||||||
</v-list-item>
|
</v-list-item>
|
||||||
|
|
||||||
<v-list-group :key="category.id" v-for="category in categories">
|
<v-list-group :key="category.id" v-for="category in categories">
|
||||||
<template #activator="{ props }" v-if="!category.hidden || query.categoryIds === category.id || (allCategories[query.categoryIds] && allCategories[query.categoryIds]!.parentId === category.id)">
|
<template #activator="{ props }" v-if="!category.hidden || queryAllFilterCategoryIds[category.id] || allCategories[query.categoryIds]?.parentId === category.id || hasSubCategoryInQuery(category)">
|
||||||
<v-divider />
|
<v-divider />
|
||||||
<v-list-item class="text-sm" density="compact"
|
<v-list-item class="text-sm" density="compact"
|
||||||
:class="getCategoryListItemCheckedClass(category, queryAllFilterCategoryIds)"
|
:class="getCategoryListItemCheckedClass(category, queryAllFilterCategoryIds)"
|
||||||
@@ -296,12 +296,12 @@
|
|||||||
|
|
||||||
<template :key="subCategory.id"
|
<template :key="subCategory.id"
|
||||||
v-for="subCategory in category.subCategories">
|
v-for="subCategory in category.subCategories">
|
||||||
<v-divider v-if="!subCategory.hidden || query.categoryIds === subCategory.id" />
|
<v-divider v-if="!subCategory.hidden || queryAllFilterCategoryIds[subCategory.id]" />
|
||||||
<v-list-item class="text-sm" density="compact"
|
<v-list-item class="text-sm" density="compact"
|
||||||
:value="subCategory.id"
|
:value="subCategory.id"
|
||||||
:class="{ 'list-item-selected': query.categoryIds === subCategory.id, 'item-in-multiple-selection': queryAllFilterCategoryIdsCount > 1 && queryAllFilterCategoryIds[subCategory.id] }"
|
:class="{ 'list-item-selected': query.categoryIds === subCategory.id, 'item-in-multiple-selection': queryAllFilterCategoryIdsCount > 1 && queryAllFilterCategoryIds[subCategory.id] }"
|
||||||
:append-icon="(query.categoryIds === subCategory.id ? mdiCheck : undefined)"
|
:append-icon="(query.categoryIds === subCategory.id ? mdiCheck : undefined)"
|
||||||
v-if="!subCategory.hidden || query.categoryIds === subCategory.id">
|
v-if="!subCategory.hidden || queryAllFilterCategoryIds[subCategory.id]">
|
||||||
<v-list-item-title class="cursor-pointer"
|
<v-list-item-title class="cursor-pointer"
|
||||||
@click="changeCategoryFilter(subCategory.id)">
|
@click="changeCategoryFilter(subCategory.id)">
|
||||||
<div class="d-flex align-center">
|
<div class="d-flex align-center">
|
||||||
@@ -407,12 +407,12 @@
|
|||||||
</v-list-item>
|
</v-list-item>
|
||||||
<template :key="account.id"
|
<template :key="account.id"
|
||||||
v-for="account in allAccounts">
|
v-for="account in allAccounts">
|
||||||
<v-divider v-if="(!account.hidden && (!allAccountsMap[account.parentId] || !allAccountsMap[account.parentId]!.hidden)) || query.accountIds === account.id" />
|
<v-divider v-if="(!account.hidden && (!allAccountsMap[account.parentId] || !allAccountsMap[account.parentId]!.hidden)) || queryAllFilterAccountIds[account.id]" />
|
||||||
<v-list-item class="text-sm" density="compact"
|
<v-list-item class="text-sm" density="compact"
|
||||||
:value="account.id"
|
:value="account.id"
|
||||||
:class="{ 'list-item-selected': query.accountIds === account.id, 'item-in-multiple-selection': queryAllFilterAccountIdsCount > 1 && queryAllFilterAccountIds[account.id] }"
|
:class="{ 'list-item-selected': query.accountIds === account.id, 'item-in-multiple-selection': queryAllFilterAccountIdsCount > 1 && queryAllFilterAccountIds[account.id] }"
|
||||||
:append-icon="(query.accountIds === account.id ? mdiCheck : undefined)"
|
:append-icon="(query.accountIds === account.id ? mdiCheck : undefined)"
|
||||||
v-if="(!account.hidden && (!allAccountsMap[account.parentId] || !allAccountsMap[account.parentId]!.hidden)) || query.accountIds === account.id">
|
v-if="(!account.hidden && (!allAccountsMap[account.parentId] || !allAccountsMap[account.parentId]!.hidden)) || queryAllFilterAccountIds[account.id]">
|
||||||
<v-list-item-title class="cursor-pointer"
|
<v-list-item-title class="cursor-pointer"
|
||||||
@click="changeAccountFilter(account.id)">
|
@click="changeAccountFilter(account.id)">
|
||||||
<div class="d-flex align-center">
|
<div class="d-flex align-center">
|
||||||
@@ -809,6 +809,7 @@ const {
|
|||||||
transactionCalendarMinDate,
|
transactionCalendarMinDate,
|
||||||
transactionCalendarMaxDate,
|
transactionCalendarMaxDate,
|
||||||
currentMonthTransactionData,
|
currentMonthTransactionData,
|
||||||
|
hasSubCategoryInQuery,
|
||||||
canAddTransaction,
|
canAddTransaction,
|
||||||
getDisplayTime,
|
getDisplayTime,
|
||||||
getDisplayLongDate,
|
getDisplayLongDate,
|
||||||
|
|||||||
@@ -377,7 +377,7 @@
|
|||||||
:class="getCategoryListItemCheckedClass(category, queryAllFilterCategoryIds)"
|
:class="getCategoryListItemCheckedClass(category, queryAllFilterCategoryIds)"
|
||||||
:key="category.id"
|
:key="category.id"
|
||||||
v-for="category in categories"
|
v-for="category in categories"
|
||||||
v-show="!category.hidden || query.categoryIds === category.id || (allCategories[query.categoryIds] && allCategories[query.categoryIds]?.parentId === category.id)"
|
v-show="!category.hidden || queryAllFilterCategoryIds[category.id] || allCategories[query.categoryIds]?.parentId === category.id || hasSubCategoryInQuery(category)"
|
||||||
>
|
>
|
||||||
<template #media>
|
<template #media>
|
||||||
<ItemIcon icon-type="category" :icon-id="category.icon" :color="category.color"></ItemIcon>
|
<ItemIcon icon-type="category" :icon-id="category.icon" :color="category.color"></ItemIcon>
|
||||||
@@ -399,7 +399,7 @@
|
|||||||
:title="subCategory.name"
|
:title="subCategory.name"
|
||||||
:key="subCategory.id"
|
:key="subCategory.id"
|
||||||
v-for="subCategory in category.subCategories"
|
v-for="subCategory in category.subCategories"
|
||||||
v-show="!subCategory.hidden || query.categoryIds === subCategory.id"
|
v-show="!subCategory.hidden || queryAllFilterCategoryIds[subCategory.id]"
|
||||||
@click="changeCategoryFilter(subCategory.id)"
|
@click="changeCategoryFilter(subCategory.id)"
|
||||||
>
|
>
|
||||||
<template #media>
|
<template #media>
|
||||||
@@ -448,7 +448,7 @@
|
|||||||
:title="account.name"
|
:title="account.name"
|
||||||
:key="account.id"
|
:key="account.id"
|
||||||
v-for="account in allAccounts"
|
v-for="account in allAccounts"
|
||||||
v-show="(!account.hidden && (!allAccountsMap[account.parentId] || !allAccountsMap[account.parentId]!.hidden)) || query.accountIds === account.id"
|
v-show="(!account.hidden && (!allAccountsMap[account.parentId] || !allAccountsMap[account.parentId]!.hidden)) || queryAllFilterAccountIds[account.id]"
|
||||||
@click="changeAccountFilter(account.id)"
|
@click="changeAccountFilter(account.id)"
|
||||||
>
|
>
|
||||||
<template #media>
|
<template #media>
|
||||||
@@ -712,6 +712,7 @@ const {
|
|||||||
transactionCalendarMinDate,
|
transactionCalendarMinDate,
|
||||||
transactionCalendarMaxDate,
|
transactionCalendarMaxDate,
|
||||||
currentMonthTransactionData,
|
currentMonthTransactionData,
|
||||||
|
hasSubCategoryInQuery,
|
||||||
canAddTransaction,
|
canAddTransaction,
|
||||||
getDisplayTime,
|
getDisplayTime,
|
||||||
getDisplayLongYearMonth,
|
getDisplayLongYearMonth,
|
||||||
|
|||||||
Reference in New Issue
Block a user