reconciliation statement page / dialog supports account balance trends chart (#184)

This commit is contained in:
MaysWind
2025-08-04 01:22:36 +08:00
parent 15d1d269ae
commit 14b4e40039
26 changed files with 917 additions and 29 deletions
+27 -1
View File
@@ -147,6 +147,7 @@ import {
getTimezoneOffset,
getTimezoneOffsetMinutes,
getYear,
getQuarter,
isDateRangeMatchFullMonths,
isDateRangeMatchFullYears,
isPM,
@@ -496,6 +497,22 @@ export function useI18n() {
return ret;
}
function getLocalizedChartDateAggregationTypeAndDisplayName(fullName: boolean): TypeAndDisplayName[] {
const ret: TypeAndDisplayName[] = [];
const allTypes: ChartDateAggregationType[] = ChartDateAggregationType.values();
for (let i = 0; i < allTypes.length; i++) {
const type = allTypes[i];
ret.push({
type: type.type,
displayName: t(fullName ? type.fullName : `granularity.${type.shortName}`)
});
}
return ret;
}
function getAllMonthNames(type: string): string[] {
const ret = [];
const allMonths = Month.values();
@@ -1472,6 +1489,13 @@ export function useI18n() {
return formatMonthDay(monthDay, getLocalizedLongMonthDayFormat());
}
function formatUnixTimeToYearQuarter(unixTime: number): string {
const date = parseDateFromUnixTime(unixTime);
const year = getYear(date);
const quarter = getQuarter(date);
return formatYearQuarter(year, quarter);
}
function formatYearQuarter(year: number, quarter: number): string {
if (1 <= quarter && quarter <= 4) {
return t('format.yearQuarter.q' + quarter, {
@@ -1912,7 +1936,8 @@ export function useI18n() {
getAllTrendChartTypes: () => getLocalizedDisplayNameAndType(TrendChartType.values()),
getAllStatisticsChartDataTypes: (analysisType: StatisticsAnalysisType) => getLocalizedDisplayNameAndType(ChartDataType.values(analysisType)),
getAllStatisticsSortingTypes: () => getLocalizedDisplayNameAndType(ChartSortingType.values()),
getAllStatisticsDateAggregationTypes: () => getLocalizedDisplayNameAndType(ChartDateAggregationType.values()),
getAllStatisticsDateAggregationTypes: () => getLocalizedChartDateAggregationTypeAndDisplayName(true),
getAllStatisticsDateAggregationTypesWithShortName: () => getLocalizedChartDateAggregationTypeAndDisplayName(false),
getAllTransactionEditScopeTypes: () => getLocalizedDisplayNameAndType(TransactionEditScopeType.values()),
getAllTransactionTagFilterTypes: () => getLocalizedDisplayNameAndType(TransactionTagFilterType.values()),
getAllTransactionScheduledFrequencyTypes: () => getLocalizedDisplayNameAndType(ScheduledTemplateFrequencyType.values()),
@@ -1961,6 +1986,7 @@ export function useI18n() {
formatUnixTimeToShortTime: (unixTime: number, utcOffset?: number, currentUtcOffset?: number) => formatUnixTime(unixTime, getLocalizedShortTimeFormat(), utcOffset, currentUtcOffset),
formatDateToLongDate,
formatMonthDayToLongDay,
formatUnixTimeToYearQuarter,
formatYearQuarter,
formatDateRange,
formatFiscalYearStartToLongDay,