support changing account category order

This commit is contained in:
MaysWind
2026-01-04 22:50:13 +08:00
parent 6e369f39a4
commit 0ce66d9070
50 changed files with 575 additions and 72 deletions
+13
View File
@@ -15,6 +15,9 @@ import {
ALL_ALLOWED_CLOUD_SYNC_APP_SETTING_KEY_TYPES
} from '@/core/setting.ts';
import { AccountCategory } from '@/core/account.ts';
import {
isObject,
isString,
@@ -41,6 +44,8 @@ export const useSettingsStore = defineStore('settings', () => {
const enableApplicationCloudSync = computed<boolean>(() => getObjectOwnFieldCount(syncedAppSettings.value) > 0);
const accountCategoryDisplayOrders = computed<Record<number, number>>(() => AccountCategory.allDisplayOrders(appSettings.value.accountCategoryOrders));
function updateApplicationSettingsValueAndAppSettingsFromCloudSetting(key: string, value: string | number | boolean | Record<string, boolean>): void {
const keyItems = key.split('.');
const keyFirstPart = keyItems[0] as string;
@@ -265,6 +270,12 @@ export const useSettingsStore = defineStore('settings', () => {
updateUserApplicationCloudSettingValue('totalAmountExcludeAccountIds', value);
}
function setAccountCategoryOrders(value: string): void {
updateApplicationSettingsValue('accountCategoryOrders', value);
appSettings.value.accountCategoryOrders = value;
updateUserApplicationCloudSettingValue('accountCategoryOrders', value);
}
function setHideCategoriesWithoutAccounts(value: boolean): void {
updateApplicationSettingsValue('hideCategoriesWithoutAccounts', value);
appSettings.value.hideCategoriesWithoutAccounts = value;
@@ -459,6 +470,7 @@ export const useSettingsStore = defineStore('settings', () => {
localeDefaultSettings,
// computed states
enableApplicationCloudSync,
accountCategoryDisplayOrders,
// functions
// -- Basic Settings
setTheme,
@@ -491,6 +503,7 @@ export const useSettingsStore = defineStore('settings', () => {
setShowTagInInsightsExplorerPage,
// -- Account List Page
setTotalAmountExcludeAccountIds,
setAccountCategoryOrders,
setHideCategoriesWithoutAccounts,
// -- Exchange Rates Data Page
setCurrencySortByInExchangeRatesPage,