mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-17 16:24:25 +08:00
disable the sort button when fewer than two items are present
This commit is contained in:
@@ -124,6 +124,20 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
return shownAccountCount;
|
||||
});
|
||||
|
||||
const maxCategoryAccountCount = computed<number>(() => {
|
||||
let maxCount = 0;
|
||||
|
||||
for (const categorizedAccounts of values(allCategorizedAccountsMap.value)) {
|
||||
const accountCount = categorizedAccounts.accounts.length;
|
||||
|
||||
if (accountCount > maxCount) {
|
||||
maxCount = accountCount;
|
||||
}
|
||||
}
|
||||
|
||||
return maxCount;
|
||||
});
|
||||
|
||||
function loadAccountList(accounts: Account[]): void {
|
||||
allAccounts.value = accounts;
|
||||
allAccountsMap.value = {};
|
||||
@@ -1076,6 +1090,7 @@ export const useAccountsStore = defineStore('accounts', () => {
|
||||
allVisiblePlainAccounts,
|
||||
allAvailableAccountsCount,
|
||||
allVisibleAccountsCount,
|
||||
maxCategoryAccountCount,
|
||||
// functions
|
||||
updateAccountListInvalidState,
|
||||
resetAccounts,
|
||||
|
||||
Reference in New Issue
Block a user