优化分类选择功能:新增默认展开分类列表设置,更新相关页面以支持此功能
This commit is contained in:
@@ -21,7 +21,7 @@
|
||||
</f7-list>
|
||||
<f7-treeview class="tree-view-selection-treeview">
|
||||
<f7-treeview-item item-toggle
|
||||
:opened="isPrimaryItemHasSecondaryValue(item)"
|
||||
:opened="props.defaultExpanded || isPrimaryItemHasSecondaryValue(item)"
|
||||
:label="ti((primaryTitleField ? item[primaryTitleField] : item) as string, !!primaryTitleI18n)"
|
||||
:key="primaryKeyField ? item[primaryKeyField] : item"
|
||||
v-for="item in filteredItems">
|
||||
@@ -59,6 +59,7 @@ import { type Framework7Dom, scrollSheetToTop } from '@/lib/ui/mobile.ts';
|
||||
|
||||
interface MobileTwoLevelItemSelectionBaseProps extends TwoLevelItemSelectionBaseProps {
|
||||
show: boolean;
|
||||
defaultExpanded?: boolean;
|
||||
}
|
||||
|
||||
const props = defineProps<MobileTwoLevelItemSelectionBaseProps>();
|
||||
|
||||
@@ -36,6 +36,7 @@ export interface ApplicationSettings extends BaseApplicationSetting {
|
||||
showAccountBalance: boolean;
|
||||
swipeBack: boolean;
|
||||
animate: boolean;
|
||||
expandCategoryTreeByDefault: boolean;
|
||||
// Application Lock
|
||||
applicationLock: boolean;
|
||||
applicationLockWebAuthn: boolean;
|
||||
@@ -174,6 +175,7 @@ export const DEFAULT_APPLICATION_SETTINGS: ApplicationSettings = {
|
||||
showAccountBalance: true,
|
||||
swipeBack: true,
|
||||
animate: true,
|
||||
expandCategoryTreeByDefault: false,
|
||||
// Application Lock
|
||||
applicationLock: false,
|
||||
applicationLockWebAuthn: false,
|
||||
|
||||
@@ -2282,6 +2282,7 @@
|
||||
"Exchange Rate": "Exchange Rate",
|
||||
"Enable Swipe Back": "Enable Swipe Back",
|
||||
"Enable Animation": "Enable Animation",
|
||||
"Expand Category List By Default": "Expand Category List By Default",
|
||||
"Basic Information": "Basic Information",
|
||||
"User Information": "User Information",
|
||||
"Already have an account?": "Already have an account?",
|
||||
|
||||
@@ -2282,6 +2282,7 @@
|
||||
"Exchange Rate": "汇率",
|
||||
"Enable Swipe Back": "启用侧滑返回",
|
||||
"Enable Animation": "启用动画",
|
||||
"Expand Category List By Default": "默认展开分类列表",
|
||||
"Basic Information": "基本信息",
|
||||
"User Information": "用户信息",
|
||||
"Already have an account?": "已经有账号?",
|
||||
|
||||
@@ -2282,6 +2282,7 @@
|
||||
"Exchange Rate": "匯率",
|
||||
"Enable Swipe Back": "啟用滑動返回",
|
||||
"Enable Animation": "啟用動畫",
|
||||
"Expand Category List By Default": "預設展開分類列表",
|
||||
"Basic Information": "基本資訊",
|
||||
"User Information": "使用者資訊",
|
||||
"Already have an account?": "已經有帳號?",
|
||||
|
||||
@@ -171,6 +171,11 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
appSettings.value.animate = value;
|
||||
}
|
||||
|
||||
function setExpandCategoryTreeByDefault(value: boolean): void {
|
||||
updateApplicationSettingsValue('expandCategoryTreeByDefault', value);
|
||||
appSettings.value.expandCategoryTreeByDefault = value;
|
||||
}
|
||||
|
||||
// Application Lock
|
||||
function setEnableApplicationLock(value: boolean): void {
|
||||
updateApplicationSettingsValue('applicationLock', value);
|
||||
@@ -528,6 +533,7 @@ export const useSettingsStore = defineStore('settings', () => {
|
||||
setShowAccountBalance,
|
||||
setEnableSwipeBack,
|
||||
setEnableAnimate,
|
||||
setExpandCategoryTreeByDefault,
|
||||
// -- Application Lock
|
||||
setEnableApplicationLock,
|
||||
setEnableApplicationLockWebAuthn,
|
||||
|
||||
@@ -108,6 +108,15 @@
|
||||
</template>
|
||||
</f7-list-item>
|
||||
|
||||
<f7-list-item>
|
||||
<template #after-title>
|
||||
{{ tt('Expand Category List By Default') }}
|
||||
</template>
|
||||
<template #after>
|
||||
<f7-toggle :checked="expandCategoryTreeByDefault" @toggle:change="expandCategoryTreeByDefault = $event"></f7-toggle>
|
||||
</template>
|
||||
</f7-list-item>
|
||||
|
||||
<f7-list-item :title="tt('Browser Cache Management')" link="/settings/browser_caches"></f7-list-item>
|
||||
<f7-list-item link="#" no-chevron :title="tt('Switch to Desktop Version')" @click="switchToDesktopVersion"></f7-list-item>
|
||||
|
||||
@@ -153,7 +162,6 @@ const version = `${getClientDisplayVersion()}`;
|
||||
const logouting = ref<boolean>(false);
|
||||
const showThemePopup = ref<boolean>(false);
|
||||
const showTimezonePopup = ref<boolean>(false);
|
||||
|
||||
const currentNickName = computed<string>(() => userStore.currentUserNickname || tt('User'));
|
||||
|
||||
const currentTheme = computed<string>({
|
||||
@@ -176,6 +184,13 @@ const currentTimezoneName = computed<string>(() => {
|
||||
return '';
|
||||
});
|
||||
|
||||
const expandCategoryTreeByDefault = computed<boolean>({
|
||||
get: () => settingsStore.appSettings.expandCategoryTreeByDefault,
|
||||
set: value => {
|
||||
settingsStore.setExpandCategoryTreeByDefault(value);
|
||||
}
|
||||
});
|
||||
|
||||
const isEnableSwipeBack = computed<boolean>({
|
||||
get: () => settingsStore.appSettings.swipeBack,
|
||||
set: value => {
|
||||
|
||||
@@ -119,6 +119,7 @@
|
||||
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
|
||||
secondary-hidden-field="hidden"
|
||||
:enable-filter="true" :filter-placeholder="tt('Find category')" :filter-no-items-text="tt('No available category')"
|
||||
:default-expanded="settingsStore.appSettings.expandCategoryTreeByDefault"
|
||||
:items="allCategories[CategoryType.Expense]"
|
||||
v-model:show="showCategorySheet"
|
||||
v-model="transaction.expenseCategoryId">
|
||||
@@ -151,6 +152,7 @@
|
||||
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
|
||||
secondary-hidden-field="hidden"
|
||||
:enable-filter="true" :filter-placeholder="tt('Find category')" :filter-no-items-text="tt('No available category')"
|
||||
:default-expanded="settingsStore.appSettings.expandCategoryTreeByDefault"
|
||||
:items="allCategories[CategoryType.Income]"
|
||||
v-model:show="showCategorySheet"
|
||||
v-model="transaction.incomeCategoryId">
|
||||
@@ -183,6 +185,7 @@
|
||||
secondary-icon-field="icon" secondary-icon-type="category" secondary-color-field="color"
|
||||
secondary-hidden-field="hidden"
|
||||
:enable-filter="true" :filter-placeholder="tt('Find category')" :filter-no-items-text="tt('No available category')"
|
||||
:default-expanded="settingsStore.appSettings.expandCategoryTreeByDefault"
|
||||
:items="allCategories[CategoryType.Transfer]"
|
||||
v-model:show="showCategorySheet"
|
||||
v-model="transaction.transferCategoryId">
|
||||
|
||||
Reference in New Issue
Block a user