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
+5 -5
View File
@@ -200,12 +200,12 @@ import { useDisplay } from 'vuetify';
import { mapStores } from 'pinia';
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
import categoryConstants from '@/consts/category.js';
import { CategoryType } from '@/core/category.ts';
import {
isNoAvailableCategory,
getAvailableCategoryCount
} from '@/lib/category.js';
import { getNavSideBarOuterHeight } from '@/lib/ui.desktop.js';
import { getNavSideBarOuterHeight } from '@/lib/ui/desktop.js';
import {
mdiRefresh,
@@ -227,7 +227,7 @@ export default {
const { mdAndUp } = useDisplay();
return {
activeCategoryType: categoryConstants.allCategoryTypes.Expense,
activeCategoryType: CategoryType.Expense,
activeTab: 'categoryPage',
primaryCategoryId: '0',
loading: true,
@@ -255,7 +255,7 @@ export default {
computed: {
...mapStores(useTransactionCategoriesStore),
allCategoryTypes() {
return categoryConstants.allCategoryTypes;
return CategoryType;
},
primaryCategories() {
if (!this.transactionCategoriesStore.allTransactionCategories || !this.transactionCategoriesStore.allTransactionCategories[this.activeCategoryType]) {
@@ -501,7 +501,7 @@ export default {
self.$nextTick(() => {
if (self.$refs.navbar && self.$refs.navbar.$el && self.$refs.navbar.$el.nextElementSibling) {
let navbarHeight = getNavSideBarOuterHeight(self.$refs.navbar.$el.nextElementSibling);
const navbarHeight = getNavSideBarOuterHeight(self.$refs.navbar.$el.nextElementSibling);
self.cardMinHeight = Math.max(navbarHeight, 680);
}
});
@@ -97,10 +97,10 @@
import { mapStores } from 'pinia';
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
import categoryConstants from '@/consts/category.js';
import iconConstants from '@/consts/icon.js';
import colorConstants from '@/consts/color.js';
import { generateRandomUUID } from '@/lib/misc.js';
import { CategoryType } from '@/core/category.ts';
import { ALL_CATEGORY_ICONS } from '@/consts/icon.ts';
import { ALL_CATEGORY_COLORS } from '@/consts/color.ts';
import { generateRandomUUID } from '@/lib/misc.ts';
import {
setCategoryModelByAnotherCategory,
allVisiblePrimaryTransactionCategoriesByType
@@ -153,10 +153,10 @@ export default {
}
},
allCategoryIcons() {
return iconConstants.allCategoryIcons;
return ALL_CATEGORY_ICONS;
},
allCategoryColors() {
return colorConstants.allCategoryColors;
return ALL_CATEGORY_COLORS;
},
inputIsEmpty() {
return !!this.inputEmptyProblemMessage;
@@ -205,9 +205,9 @@ export default {
const categoryType = parseInt(options.type);
if (categoryType !== categoryConstants.allCategoryTypes.Income &&
categoryType !== categoryConstants.allCategoryTypes.Expense &&
categoryType !== categoryConstants.allCategoryTypes.Transfer) {
if (categoryType !== CategoryType.Income &&
categoryType !== CategoryType.Expense &&
categoryType !== CategoryType.Transfer) {
self.loading = false;
self.showState = false;
@@ -70,8 +70,8 @@
import { mapStores } from 'pinia';
import { useTransactionCategoriesStore } from '@/stores/transactionCategory.js';
import categoryConstants from '@/consts/category.js';
import { categorizedArrayToPlainArray } from '@/lib/common.js';
import { CategoryType } from '@/core/category.ts';
import { categorizedArrayToPlainArray } from '@/lib/common.ts';
import {
mdiDotsVertical
@@ -152,11 +152,11 @@ export default {
},
getCategoryTypeName(categoryType) {
switch (categoryType) {
case categoryConstants.allCategoryTypes.Income.toString():
case CategoryType.Income.toString():
return this.$t('Income Categories');
case categoryConstants.allCategoryTypes.Expense.toString():
case CategoryType.Expense.toString():
return this.$t('Expense Categories');
case categoryConstants.allCategoryTypes.Transfer.toString():
case CategoryType.Transfer.toString():
return this.$t('Transfer Categories');
default:
return this.$t('Transaction Categories');