migrate to typescript

This commit is contained in:
MaysWind
2024-12-29 14:24:37 +08:00
parent b638a73e4d
commit 2560a70e5e
171 changed files with 3402 additions and 2557 deletions
+19 -19
View File
@@ -413,12 +413,12 @@
<v-divider v-if="query.tagIds && query.tagIds !== 'none'" />
<template :key="filterType.type"
v-for="filterType in allTransactionTagFilterTypes"
v-if="query.tagIds && query.tagIds !== 'none'">
<template v-if="query.tagIds && query.tagIds !== 'none'">
<v-list-item class="text-sm" density="compact"
:key="filterType.type"
:value="filterType.type"
:append-icon="(query.tagFilterType === filterType.type ? icons.check : null)">
:append-icon="(query.tagFilterType === filterType.type ? icons.check : null)"
v-for="filterType in allTransactionTagFilterTypes">
<v-list-item-title class="cursor-pointer"
@click="changeTagFilterType(filterType.type)">
<div class="d-flex align-center">
@@ -595,12 +595,12 @@ import { useTransactionTagsStore } from '@/stores/transactionTag.js';
import { useTransactionsStore } from '@/stores/transaction.js';
import { useTransactionTemplatesStore } from '@/stores/transactionTemplate.js';
import { AccountType } from '@/core/account.ts';
import { TransactionType, TransactionTagFilterType } from '@/core/transaction.ts';
import { TemplateType } from '@/core/template.ts';
import numeralConstants from '@/consts/numeral.js';
import datetimeConstants from '@/consts/datetime.js';
import accountConstants from '@/consts/account.js';
import transactionConstants from '@/consts/transaction.js';
import templateConstants from '@/consts/template.js';
import { isString, isNumber, getNameByKeyValue } from '@/lib/common.js';
import { isString, isNumber, getNameByKeyValue } from '@/lib/common.ts';
import logger from '@/lib/logger.js';
import {
getCurrentUnixTime,
@@ -629,8 +629,8 @@ import {
} from '@/lib/category.js';
import { getUnifiedSelectedAccountsCurrencyOrDefaultCurrency } from '@/lib/account.js';
import { getTransactionDisplayAmount } from '@/lib/transaction.js';
import { isDataImportingEnabled } from '@/lib/server_settings.js';
import { scrollToSelectedItem } from '@/lib/ui.desktop.js';
import { isDataImportingEnabled } from '@/lib/server_settings.ts';
import { scrollToSelectedItem } from '@/lib/ui/desktop.js';
import {
mdiMagnify,
@@ -729,7 +729,7 @@ export default {
if (this.query.accountIds && this.queryAllFilterAccountIdsCount === 1) {
const account = this.allAccounts[this.query.accountIds];
if (account && account.type === accountConstants.allAccountTypes.MultiSubAccounts) {
if (account && account.type === AccountType.MultiSubAccounts.type) {
return false;
}
}
@@ -980,16 +980,16 @@ export default {
return numeralConstants.allAmountFilterTypeArray;
},
allTransactionTypes() {
return transactionConstants.allTransactionTypes;
return TransactionType;
},
allTransactionTagFilterTypes() {
const allTagFilterTypes = this.$locale.getAllTransactionTagFilterTypes();
const allTagFilterTypesWithIcon = [];
const tagFilterIconMap = {
[transactionConstants.allTransactionTagFilterTypes.HasAny.type]: this.icons.withAnyTags,
[transactionConstants.allTransactionTagFilterTypes.HasAll.type]: this.icons.withAllTags,
[transactionConstants.allTransactionTagFilterTypes.NotHasAny.type]: this.icons.withoutAnyTags,
[transactionConstants.allTransactionTagFilterTypes.NotHasAll.type]: this.icons.withoutAllTags
[TransactionTagFilterType.HasAny.type]: this.icons.withAnyTags,
[TransactionTagFilterType.HasAll.type]: this.icons.withAllTags,
[TransactionTagFilterType.NotHasAny.type]: this.icons.withoutAnyTags,
[TransactionTagFilterType.NotHasAll.type]: this.icons.withoutAllTags
};
for (let i = 0; i < allTagFilterTypes.length; i++) {
@@ -1055,7 +1055,7 @@ export default {
},
allTransactionTemplates() {
const allVisibleTemplates = this.transactionTemplatesStore.allVisibleTemplates;
return allVisibleTemplates[templateConstants.allTemplateTypes.Normal] || [];
return allVisibleTemplates[TemplateType.Normal.type] || [];
},
recentMonthDateRanges() {
return this.$locale.getAllRecentMonthDateRanges(this.userStore, true, true);
@@ -1147,7 +1147,7 @@ export default {
this.reload(false);
this.transactionTemplatesStore.loadAllTemplates({
templateType: templateConstants.allTemplateTypes.Normal,
templateType: TemplateType.Normal.type,
force: false
});
},
@@ -1312,7 +1312,7 @@ export default {
if (type && this.query.categoryIds) {
newCategoryFilter = '';
for (let categoryId in this.queryAllFilterCategoryIds) {
for (const categoryId in this.queryAllFilterCategoryIds) {
if (!Object.prototype.hasOwnProperty.call(this.queryAllFilterCategoryIds, categoryId)) {
continue;
}