mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-16 07:57:33 +08:00
migrate numeral.js to ts
This commit is contained in:
@@ -142,7 +142,7 @@ import { useUserStore } from '@/stores/user.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import logger from '@/lib/logger.js';
|
||||
import { getConvertedAmount } from '@/lib/numeral.js';
|
||||
import { getConvertedAmount } from '@/lib/numeral.ts';
|
||||
|
||||
import {
|
||||
mdiRefresh,
|
||||
|
||||
@@ -332,7 +332,7 @@ import {
|
||||
getNameByKeyValue,
|
||||
arrayItemToObjectField
|
||||
} from '@/lib/common.ts'
|
||||
import { formatPercent } from '@/lib/numeral.js';
|
||||
import { formatPercent } from '@/lib/numeral.ts';
|
||||
import {
|
||||
getYearAndMonthFromUnixTime,
|
||||
getYearMonthFirstUnixTime,
|
||||
|
||||
@@ -596,10 +596,10 @@ import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
import { useTransactionTemplatesStore } from '@/stores/transactionTemplate.js';
|
||||
|
||||
import { DateRangeScene, DateRange } from '@/core/datetime.ts';
|
||||
import { AmountFilterType } from '@/core/numeral.ts';
|
||||
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 { isString, isNumber, getNameByKeyValue } from '@/lib/common.ts';
|
||||
import logger from '@/lib/logger.js';
|
||||
import {
|
||||
@@ -977,7 +977,7 @@ export default {
|
||||
}
|
||||
},
|
||||
allAmountFilterTypes() {
|
||||
return numeralConstants.allAmountFilterTypeArray;
|
||||
return AmountFilterType.values();
|
||||
},
|
||||
allTransactionTypes() {
|
||||
return TransactionType;
|
||||
@@ -1674,7 +1674,7 @@ export default {
|
||||
return [];
|
||||
},
|
||||
getAmountFilterParameterCount(filterType) {
|
||||
const amountFilterType = numeralConstants.allAmountFilterTypeMap[filterType];
|
||||
const amountFilterType = AmountFilterType.valueOf(filterType);
|
||||
return amountFilterType ? amountFilterType.paramCount : 0;
|
||||
},
|
||||
getFilterLinkUrl() {
|
||||
|
||||
@@ -97,7 +97,7 @@ import { useUserStore } from '@/stores/user.js';
|
||||
import { useExchangeRatesStore } from '@/stores/exchangeRates.js';
|
||||
|
||||
import { TRANSACTION_MIN_AMOUNT, TRANSACTION_MAX_AMOUNT } from '@/consts/transaction.ts';
|
||||
import { getConvertedAmount } from '@/lib/numeral.js';
|
||||
import { getConvertedAmount } from '@/lib/numeral.ts';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
|
||||
@@ -334,7 +334,7 @@ import { useStatisticsStore } from '@/stores/statistics.js';
|
||||
import { DateRangeScene, DateRange } from '@/core/datetime.ts';
|
||||
import statisticsConstants from '@/consts/statistics.js';
|
||||
import { getNameByKeyValue, limitText } from '@/lib/common.ts';
|
||||
import { formatPercent } from '@/lib/numeral.js';
|
||||
import { formatPercent } from '@/lib/numeral.ts';
|
||||
import {
|
||||
getYearAndMonthFromUnixTime,
|
||||
getYearMonthFirstUnixTime,
|
||||
|
||||
@@ -57,7 +57,7 @@ import { useSettingsStore } from '@/stores/setting.js';
|
||||
import { useUserStore } from '@/stores/user.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
|
||||
import numeralConstants from '@/consts/numeral.js';
|
||||
import { AmountFilterType } from '@/core/numeral.ts';
|
||||
import { TRANSACTION_MIN_AMOUNT, TRANSACTION_MAX_AMOUNT } from '@/consts/transaction.ts';
|
||||
import { isString } from '@/lib/common.ts';
|
||||
import logger from '@/lib/logger.js';
|
||||
@@ -79,7 +79,7 @@ export default {
|
||||
computed: {
|
||||
...mapStores(useSettingsStore, useUserStore, useTransactionsStore),
|
||||
allAmountFilterTypes() {
|
||||
return numeralConstants.allAmountFilterTypeArray;
|
||||
return AmountFilterType.values();
|
||||
},
|
||||
allowedMinAmount() {
|
||||
return TRANSACTION_MIN_AMOUNT;
|
||||
@@ -91,24 +91,24 @@ export default {
|
||||
return this.getAmountFilterParameterCount(this.type);
|
||||
},
|
||||
title() {
|
||||
const amountFilterType = numeralConstants.allAmountFilterTypeMap[this.type];
|
||||
const amountFilterType = AmountFilterType.valueOf(this.type);
|
||||
return amountFilterType ? this.$t(amountFilterType.name) : this.$t('Amount');
|
||||
},
|
||||
amount1Header() {
|
||||
if (this.type === numeralConstants.allAmountFilterType.GreaterThan.type
|
||||
|| this.type === numeralConstants.allAmountFilterType.Between.type
|
||||
|| this.type === numeralConstants.allAmountFilterType.NotBetween.type) {
|
||||
if (this.type === AmountFilterType.GreaterThan.type
|
||||
|| this.type === AmountFilterType.Between.type
|
||||
|| this.type === AmountFilterType.NotBetween.type) {
|
||||
return this.$t('Minimum Amount');
|
||||
} else if (this.type === numeralConstants.allAmountFilterType.LessThan.type) {
|
||||
} else if (this.type === AmountFilterType.LessThan.type) {
|
||||
return this.$t('Maximum Amount');
|
||||
} else {
|
||||
return this.$t('Amount');
|
||||
}
|
||||
},
|
||||
amount2Header() {
|
||||
if (this.type === numeralConstants.allAmountFilterType.Between.type) {
|
||||
if (this.type === AmountFilterType.Between.type) {
|
||||
return this.$t('Maximum Amount');
|
||||
} else if (this.type === numeralConstants.allAmountFilterType.NotBetween.type) {
|
||||
} else if (this.type === AmountFilterType.NotBetween.type) {
|
||||
return this.$t('Maximum Amount');
|
||||
} else {
|
||||
return this.$t('Amount');
|
||||
@@ -176,7 +176,7 @@ export default {
|
||||
return this.$locale.formatAmountWithCurrency(this.settingsStore, this.userStore, value, false);
|
||||
},
|
||||
getAmountFilterParameterCount(filterType) {
|
||||
const amountFilterType = numeralConstants.allAmountFilterTypeMap[filterType];
|
||||
const amountFilterType = AmountFilterType.valueOf(filterType);
|
||||
return amountFilterType ? amountFilterType.paramCount : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -529,9 +529,9 @@ import { useTransactionTagsStore } from '@/stores/transactionTag.js';
|
||||
import { useTransactionsStore } from '@/stores/transaction.js';
|
||||
|
||||
import { DateRangeScene, DateRange } from '@/core/datetime.ts';
|
||||
import { AmountFilterType } from '@/core/numeral.ts';
|
||||
import { AccountType } from '@/core/account.ts';
|
||||
import { TransactionType } from '@/core/transaction.ts';
|
||||
import numeralConstants from '@/consts/numeral.js';
|
||||
import { getNameByKeyValue } from '@/lib/common.ts';
|
||||
import {
|
||||
getCurrentUnixTime,
|
||||
@@ -677,7 +677,7 @@ export default {
|
||||
return this.transactionsStore.hasMoreTransaction;
|
||||
},
|
||||
allAmountFilterTypes() {
|
||||
return numeralConstants.allAmountFilterTypeArray;
|
||||
return AmountFilterType.values();
|
||||
},
|
||||
allTransactionTypes() {
|
||||
return TransactionType;
|
||||
|
||||
Reference in New Issue
Block a user