mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 00:34:28 +08:00
allow pressing ESC or clicking outside to close add dialog when nothing is modified
This commit is contained in:
@@ -81,6 +81,43 @@ export class Account implements AccountInfoResponse {
|
||||
return !this.visible;
|
||||
}
|
||||
|
||||
public equals(other: Account): boolean {
|
||||
const isEqual = this.id === other.id &&
|
||||
this.name === other.name &&
|
||||
this.parentId === other.parentId &&
|
||||
this.category === other.category &&
|
||||
this.type === other.type &&
|
||||
this.icon === other.icon &&
|
||||
this.color === other.color &&
|
||||
this.currency === other.currency &&
|
||||
this.balance === other.balance &&
|
||||
this.balanceTime === other.balanceTime &&
|
||||
this.comment === other.comment &&
|
||||
this.displayOrder === other.displayOrder &&
|
||||
this.visible === other.visible &&
|
||||
this.creditCardStatementDate === other.creditCardStatementDate;
|
||||
|
||||
if (!isEqual) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.subAccounts && other.subAccounts) {
|
||||
if (this.subAccounts.length !== other.subAccounts.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.subAccounts.length; i++) {
|
||||
if (!this.subAccounts[i].equals(other.subAccounts[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if ((this.subAccounts && this.subAccounts.length) || (other.subAccounts && other.subAccounts.length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public fillFrom(other: Account): void {
|
||||
this.id = other.id;
|
||||
this.category = other.category;
|
||||
|
||||
@@ -37,6 +37,38 @@ export class TransactionCategory implements TransactionCategoryInfoResponse {
|
||||
return !this.visible;
|
||||
}
|
||||
|
||||
public equals(other: TransactionCategory): boolean {
|
||||
const isEqual = this.id === other.id &&
|
||||
this.name === other.name &&
|
||||
this.parentId === other.parentId &&
|
||||
this.type === other.type &&
|
||||
this.icon === other.icon &&
|
||||
this.color === other.color &&
|
||||
this.comment === other.comment &&
|
||||
this.displayOrder === other.displayOrder &&
|
||||
this.visible === other.visible;
|
||||
|
||||
if (!isEqual) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.subCategories && other.subCategories) {
|
||||
if (this.subCategories.length !== other.subCategories.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (let i = 0; i < this.subCategories.length; i++) {
|
||||
if (!this.subCategories[i].equals(other.subCategories[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if ((this.subCategories && this.subCategories.length) || (other.subCategories && other.subCategories.length)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public fillFrom(other: TransactionCategory): void {
|
||||
this.id = other.id;
|
||||
this.name = other.name;
|
||||
|
||||
Reference in New Issue
Block a user