support setting decimal separator and digit grouping symbol

This commit is contained in:
MaysWind
2024-06-29 17:12:22 +08:00
parent d9c8142c51
commit 399413a270
51 changed files with 1280 additions and 582 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ import services from '@/lib/services.js';
import logger from '@/lib/logger.js';
import { isEquals } from '@/lib/common.js';
import { getCurrentUnixTime, formatUnixTime } from '@/lib/datetime.js';
import { getExchangedAmount } from '@/lib/currency.js';
import { getExchangedAmount } from '@/lib/numeral.js';
const exchangeRatesLocalStorageKey = 'ebk_app_exchange_rates';
+4 -1
View File
@@ -380,7 +380,10 @@ export const useRootStore = defineStore('root', {
longDateFormat: profile.longDateFormat,
shortDateFormat: profile.shortDateFormat,
longTimeFormat: profile.longTimeFormat,
shortTimeFormat: profile.shortTimeFormat
shortTimeFormat: profile.shortTimeFormat,
decimalSeparator: profile.decimalSeparator,
digitGroupingSymbol: profile.digitGroupingSymbol,
digitGrouping: profile.digitGrouping
}).then(response => {
const data = response.data;
-5
View File
@@ -14,7 +14,6 @@ export const useSettingsStore = defineStore('settings', {
applicationLockWebAuthn: settings.isEnableApplicationLockWebAuthn(),
autoUpdateExchangeRatesData: settings.isAutoUpdateExchangeRatesData(),
autoGetCurrentGeoLocation: settings.isAutoGetCurrentGeoLocation(),
thousandsSeparator: settings.isEnableThousandsSeparator(),
currencyDisplayMode: settings.getCurrencyDisplayMode(),
showAmountInHomePage: settings.isShowAmountInHomePage(),
timezoneUsedForStatisticsInHomePage: settings.getTimezoneUsedForStatisticsInHomePage(),
@@ -68,10 +67,6 @@ export const useSettingsStore = defineStore('settings', {
settings.setAutoGetCurrentGeoLocation(value);
this.appSettings.autoGetCurrentGeoLocation = value;
},
setEnableThousandsSeparator(value) {
settings.setEnableThousandsSeparator(value);
this.appSettings.thousandsSeparator = value;
},
setCurrencyDisplayMode(value) {
settings.setCurrencyDisplayMode(value);
this.appSettings.currencyDisplayMode = value;
+1 -5
View File
@@ -25,9 +25,6 @@ import {
getDay,
getDayOfWeekName
} from '@/lib/datetime.js';
import {
stringCurrencyToNumeric
} from '@/lib/currency.js';
const emptyTransactionResult = {
items: [],
@@ -353,8 +350,7 @@ export const useTransactionsStore = defineStore('transactions', {
}
if ((!sourceAccount || !destinationAccount || transaction.destinationAmount === oldValue || transaction.destinationAmount === 0) &&
(stringCurrencyToNumeric(transactionConstants.minAmount) <= newValue &&
newValue <= stringCurrencyToNumeric(transactionConstants.maxAmount))) {
(transactionConstants.minAmountNumber <= newValue && newValue <= transactionConstants.maxAmountNumber)) {
transaction.destinationAmount = newValue;
}
}
+12
View File
@@ -58,6 +58,18 @@ export const useUserStore = defineStore('user', {
const settingsStore = useSettingsStore();
const userInfo = state.currentUserInfo || {};
return isNumber(userInfo.shortTimeFormat) ? userInfo.shortTimeFormat : settingsStore.shortTimeFormat;
},
currentUserDecimalSeparator(state) {
const userInfo = state.currentUserInfo || {};
return userInfo.decimalSeparator;
},
currentUserDigitGroupingSymbol(state) {
const userInfo = state.currentUserInfo || {};
return userInfo.digitGroupingSymbol;
},
currentUserDigitGrouping(state) {
const userInfo = state.currentUserInfo || {};
return userInfo.digitGrouping;
}
},
actions: {