allow pressing ESC or clicking outside to close add dialog when nothing is modified

This commit is contained in:
MaysWind
2025-03-31 00:00:16 +08:00
parent 433a225b9d
commit 0a5f8862ad
12 changed files with 106 additions and 17 deletions
@@ -1,5 +1,5 @@
<template>
<v-dialog :width="account.type === AccountType.MultiSubAccounts.type ? 1000 : 800" :persistent="!!persistent" v-model="showState">
<v-dialog :width="account.type === AccountType.MultiSubAccounts.type ? 1000 : 800" :persistent="isAccountModified" v-model="showState">
<v-card class="pa-2 pa-sm-4 pa-md-8">
<template #title>
<div class="d-flex align-center justify-center">
@@ -220,7 +220,6 @@ type ConfirmDialogType = InstanceType<typeof ConfirmDialog>;
type SnackBarType = InstanceType<typeof SnackBar>;
defineProps<{
persistent?: boolean;
show?: boolean;
}>();
@@ -270,6 +269,14 @@ const accountAmountTitle = computed<string>(() => {
}
});
const isAccountModified = computed<boolean>(() => {
if (!editAccountId.value) {
return !account.value.equals(Account.createNewAccount(userStore.currentUserDefaultCurrency, account.value.balanceTime ?? getCurrentUnixTime()));
} else {
return true;
}
});
let resolveFunc: ((value: AccountEditResponse) => void) | null = null;
let rejectFunc: ((reason?: unknown) => void) | null = null;