show import file type by categories

This commit is contained in:
MaysWind
2025-08-23 02:25:24 +08:00
parent 06a0501633
commit 81727d3b1e
17 changed files with 506 additions and 351 deletions
+27 -3
View File
@@ -1,5 +1,6 @@
<template>
<v-select
class="two-column-main-select"
persistent-placeholder
:density="density"
:variant="variant"
@@ -19,7 +20,8 @@
<span class="text-truncate" v-if="!customSelectionPrimaryText && !selectedPrimaryItem && !selectedSecondaryItem">{{ noSelectionText }}</span>
<span class="text-truncate" v-if="!customSelectionPrimaryText && showSelectionPrimaryText && selectedPrimaryItem">{{ selectionPrimaryItemText }}</span>
<v-icon class="icon-with-direction disabled" :icon="mdiChevronRight" size="23" v-if="!customSelectionPrimaryText && showSelectionPrimaryText && selectedPrimaryItem && selectedSecondaryItem" />
<ItemIcon class="me-2" icon-type="account" size="21.5px"
<ItemIcon class="me-2" size="21.5px"
:icon-type="secondaryIconType"
:icon-id="selectedSecondaryItem && secondaryIconField ? (selectedSecondaryItem as Record<string, unknown>)[secondaryIconField] : null"
:color="selectedSecondaryItem && secondaryColorField ? (selectedSecondaryItem as Record<string, unknown>)[secondaryColorField] : null"
v-if="!customSelectionPrimaryText && selectedSecondaryItem && showSelectionSecondaryIcon" />
@@ -48,7 +50,9 @@
@click="onPrimaryItemClicked(item)">
<template #prepend>
<ItemIcon class="me-2" :icon-type="primaryIconType"
:icon-id="primaryIconField ? (item as Record<string, unknown>)[primaryIconField] : undefined" :color="primaryColorField ? (item as Record<string, unknown>)[primaryColorField] : undefined"></ItemIcon>
:icon-id="primaryIconField ? (item as Record<string, unknown>)[primaryIconField] : undefined"
:color="primaryColorField ? (item as Record<string, unknown>)[primaryColorField] : undefined"
v-if="primaryIconField"></ItemIcon>
</template>
<template #title>
<div class="list-item-header text-truncate" v-if="primaryHeaderField">{{ primaryHeaderField ? ti(item[primaryHeaderField] as string, !!primaryHeaderI18n) : '' }}</div>
@@ -67,7 +71,9 @@
@click="onSecondaryItemClicked(subItem)">
<template #prepend>
<ItemIcon class="me-2" :icon-type="secondaryIconType"
:icon-id="secondaryIconField ? subItem[secondaryIconField] : undefined" :color="secondaryColorField ? subItem[secondaryColorField] : undefined"></ItemIcon>
:icon-id="secondaryIconField ? subItem[secondaryIconField] : undefined"
:color="secondaryColorField ? subItem[secondaryColorField] : undefined"
v-if="secondaryIconField"></ItemIcon>
</template>
<template #title>
<div class="list-item-header text-truncate" v-if="secondaryHeaderField">{{ secondaryHeaderField ? ti(subItem[secondaryHeaderField] as string, !!secondaryHeaderI18n) : '' }}</div>
@@ -113,6 +119,7 @@ interface DesktopTwoColumnListItemSelectionProps extends CommonTwoColumnListItem
customSelectionPrimaryText?: string;
customSelectionSecondaryText?: string;
noItemText?: string;
autoUpdateMenuPosition?: boolean;
}
const props = defineProps<DesktopTwoColumnListItemSelectionProps>();
@@ -208,6 +215,23 @@ function isSecondarySelected(subItem: unknown): boolean {
function onPrimaryItemClicked(item: unknown): void {
updateCurrentPrimaryValue(currentPrimaryValue, item);
if (props.autoUpdateMenuPosition) {
nextTick(() => {
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
const mainSelectRect = document.querySelector('.two-column-main-select')?.getBoundingClientRect();
const selectMenu = document.querySelector('.two-column-select-menu') as (HTMLElement | null);
const selectMenuRect = selectMenu?.getBoundingClientRect();
if (mainSelectRect && selectMenu && selectMenuRect) {
const newTop = scrollTop + mainSelectRect.top + mainSelectRect.height + 0.5;
if (newTop + selectMenuRect.height < document.documentElement.scrollHeight) {
selectMenu.style.top = newTop + 'px';
}
}
});
}
}
function onSecondaryItemClicked(subItem: unknown): void {
+70 -40
View File
@@ -1,4 +1,4 @@
import type { ImportFileType } from '@/core/file.ts';
import type { ImportFileCategoryAndTypes } from '@/core/file.ts';
export const SUPPORTED_IMAGE_EXTENSIONS: string = '.jpg,.jpeg,.png,.gif,.webp';
@@ -62,7 +62,10 @@ export const SUPPORTED_FILE_ENCODINGS: string[] = [
'shift_jis', // Japanese (Shift_JIS)
];
export const SUPPORTED_IMPORT_FILE_TYPES: ImportFileType[] = [
export const SUPPORTED_IMPORT_FILE_CATEGORY_AND_TYPES: ImportFileCategoryAndTypes[] = [
{
categoryName: 'ezBookkeeping File Format',
fileTypes: [
{
type: 'ezbookkeeping',
name: 'ezbookkeeping Data Export File',
@@ -83,7 +86,12 @@ export const SUPPORTED_IMPORT_FILE_TYPES: ImportFileType[] = [
supportMultiLanguages: true,
anchor: 'export-transactions'
}
}
]
},
{
categoryName: 'Custom File Format',
fileTypes: [
{
type: 'dsv',
name: 'Delimiter-separated Values (DSV) File',
@@ -127,7 +135,12 @@ export const SUPPORTED_IMPORT_FILE_TYPES: ImportFileType[] = [
supportMultiLanguages: true,
anchor: 'how-to-import-delimiter-separated-values-dsv-file-or-data'
}
}
]
},
{
categoryName: 'General Data Exchange Format',
fileTypes: [
{
type: 'ofx',
name: 'Open Financial Exchange (OFX) File',
@@ -161,7 +174,12 @@ export const SUPPORTED_IMPORT_FILE_TYPES: ImportFileType[] = [
type: 'iif',
name: 'Intuit Interchange Format (IIF) File',
extensions: '.iif'
}
]
},
{
categoryName: 'General Bank Statement Format',
fileTypes: [
{
type: 'camt053',
name: 'Camt.053 Bank to Customer Statement File',
@@ -171,7 +189,56 @@ export const SUPPORTED_IMPORT_FILE_TYPES: ImportFileType[] = [
type: 'mt940',
name: 'MT940 Consumer Statement Message File',
extensions: '.txt'
}
]
},
{
categoryName: 'Other Bank/Payment App Statement File',
fileTypes: [
{
type: 'alipay_app_csv',
name: 'Alipay (App) Transaction Flow File',
extensions: '.csv',
document: {
supportMultiLanguages: 'zh-Hans',
anchor: '如何获取支付宝app交易流水文件'
}
},
{
type: 'alipay_web_csv',
name: 'Alipay (Web) Transaction Flow File',
extensions: '.csv',
document: {
supportMultiLanguages: 'zh-Hans',
anchor: '如何获取支付宝网页版交易流水文件'
}
},
{
type: 'wechat_pay_app',
name: 'WeChat Pay Billing File',
extensions: '.xlsx,.csv',
subTypes: [
{
type: 'wechat_pay_app_xlsx',
name: 'Excel Workbook File',
extensions: '.xlsx',
},
{
type: 'wechat_pay_app_csv',
name: 'CSV (Comma-separated values) File',
extensions: '.csv',
}
],
document: {
supportMultiLanguages: 'zh-Hans',
anchor: '如何获取微信支付账单文件'
}
}
]
},
{
categoryName: 'Other Finance App File Format',
fileTypes: [
{
type: 'gnucash',
name: 'GnuCash XML Database File',
@@ -221,44 +288,7 @@ export const SUPPORTED_IMPORT_FILE_TYPES: ImportFileType[] = [
supportMultiLanguages: 'zh-Hans',
anchor: '如何获取随手记神象云账本数据导出文件'
}
},
{
type: 'alipay_app_csv',
name: 'Alipay (App) Transaction Flow File',
extensions: '.csv',
document: {
supportMultiLanguages: 'zh-Hans',
anchor: '如何获取支付宝app交易流水文件'
}
},
{
type: 'alipay_web_csv',
name: 'Alipay (Web) Transaction Flow File',
extensions: '.csv',
document: {
supportMultiLanguages: 'zh-Hans',
anchor: '如何获取支付宝网页版交易流水文件'
}
},
{
type: 'wechat_pay_app',
name: 'WeChat Pay Billing File',
extensions: '.xlsx,.csv',
subTypes: [
{
type: 'wechat_pay_app_xlsx',
name: 'Excel Workbook File',
extensions: '.xlsx',
},
{
type: 'wechat_pay_app_csv',
name: 'CSV (Comma-separated values) File',
extensions: '.csv',
}
],
document: {
supportMultiLanguages: 'zh-Hans',
anchor: '如何获取微信支付账单文件'
}
]
}
];
+10
View File
@@ -40,6 +40,11 @@ export interface ImportFileTypeAndExtensions {
readonly extensions?: string;
}
export interface ImportFileCategoryAndTypes {
readonly categoryName: string;
readonly fileTypes: ImportFileType[];
}
export interface ImportFileType extends ImportFileTypeAndExtensions {
readonly type: string;
readonly name: string;
@@ -59,6 +64,11 @@ export interface ImportFileTypeSubType extends ImportFileTypeAndExtensions {
readonly extensions?: string;
}
export interface LocalizedImportFileCategoryAndTypes {
readonly displayCategoryName: string;
readonly fileTypes: LocalizedImportFileType[];
}
export interface LocalizedImportFileType extends ImportFileTypeAndExtensions {
readonly type: string;
readonly displayName: string;
+8
View File
@@ -1727,9 +1727,17 @@
"Check and Modify Your Data": "Überprüfen und Ändern Sie Ihre Daten",
"Data Import Completed": "Datenimport abgeschlossen",
"File Type": "Dateityp",
"Find file type": "Find file type",
"No available file type": "No available file type",
"Filter Description": "Filterbeschreibung",
"How to import this file?": "How to import this file?",
"How to export this file?": "Wie exportiere ich diese Datei?",
"ezBookkeeping File Format": "ezBookkeeping File Format",
"Custom File Format": "Custom File Format",
"General Data Exchange Format": "General Data Exchange Format",
"General Bank Statement Format": "General Bank Statement Format",
"Other Bank/Payment App Statement File": "Other Bank/Payment App Statement File",
"Other Finance App File Format": "Other Finance App File Format",
"ezbookkeeping Data Export File": "ezBookkeeping-Datenexportdatei",
"Excel Workbook File": "Excel Workbook File",
"Open Financial Exchange (OFX) File": "Open Financial Exchange (OFX)-Datei",
+8
View File
@@ -1727,9 +1727,17 @@
"Check and Modify Your Data": "Check and Modify Your Data",
"Data Import Completed": "Data Import Completed",
"File Type": "File Type",
"Find file type": "Find file type",
"No available file type": "No available file type",
"Filter Description": "Filter Description",
"How to import this file?": "How to import this file?",
"How to export this file?": "How to export this file?",
"ezBookkeeping File Format": "ezBookkeeping File Format",
"Custom File Format": "Custom File Format",
"General Data Exchange Format": "General Data Exchange Format",
"General Bank Statement Format": "General Bank Statement Format",
"Other Bank/Payment App Statement File": "Other Bank/Payment App Statement File",
"Other Finance App File Format": "Other Finance App File Format",
"ezbookkeeping Data Export File": "ezbookkeeping Data Export File",
"Excel Workbook File": "Excel Workbook File",
"Open Financial Exchange (OFX) File": "Open Financial Exchange (OFX) File",
+8
View File
@@ -1727,9 +1727,17 @@
"Check and Modify Your Data": "Verifique y modifique sus datos",
"Data Import Completed": "Importación de datos completada",
"File Type": "Tipo de archivo",
"Find file type": "Find file type",
"No available file type": "No available file type",
"Filter Description": "Descripción del filtro",
"How to import this file?": "How to import this file?",
"How to export this file?": "¿Cómo exportar este archivo?",
"ezBookkeeping File Format": "ezBookkeeping File Format",
"Custom File Format": "Custom File Format",
"General Data Exchange Format": "General Data Exchange Format",
"General Bank Statement Format": "General Bank Statement Format",
"Other Bank/Payment App Statement File": "Other Bank/Payment App Statement File",
"Other Finance App File Format": "Other Finance App File Format",
"ezbookkeeping Data Export File": "Archivo de exportación de datos de ezBookkeeping",
"Excel Workbook File": "Excel Workbook File",
"Open Financial Exchange (OFX) File": "Abrir archivo de intercambio financiero (OFX)",
+26 -13
View File
@@ -113,10 +113,11 @@ import {
} from '@/core/statistics.ts';
import {
type LocalizedImportFileCategoryAndTypes,
type LocalizedImportFileType,
type LocalizedImportFileTypeSubType,
type LocalizedImportFileTypeSupportedEncodings,
type LocalizedImportFileDocument,
type LocalizedImportFileDocument
} from '@/core/file.ts';
import type { LocaleDefaultSettings } from '@/core/setting.ts';
@@ -127,7 +128,7 @@ import { UTC_TIMEZONE, ALL_TIMEZONES } from '@/consts/timezone.ts';
import { ALL_CURRENCIES } from '@/consts/currency.ts';
import { DEFAULT_EXPENSE_CATEGORIES, DEFAULT_INCOME_CATEGORIES, DEFAULT_TRANSFER_CATEGORIES } from '@/consts/category.ts';
import { KnownErrorCode, SPECIFIED_API_NOT_FOUND_ERRORS, PARAMETERIZED_ERRORS } from '@/consts/api.ts';
import { DEFAULT_DOCUMENT_LANGUAGE_FOR_IMPORT_FILE, SUPPORTED_DOCUMENT_LANGUAGES_FOR_IMPORT_FILE, SUPPORTED_IMPORT_FILE_TYPES } from '@/consts/file.ts';
import { DEFAULT_DOCUMENT_LANGUAGE_FOR_IMPORT_FILE, SUPPORTED_DOCUMENT_LANGUAGES_FOR_IMPORT_FILE, SUPPORTED_IMPORT_FILE_CATEGORY_AND_TYPES } from '@/consts/file.ts';
import {
type CategorizedAccount,
@@ -1305,11 +1306,19 @@ export function useI18n() {
return availableExchangeRates;
}
function getAllSupportedImportFileTypes(): LocalizedImportFileType[] {
const allSupportedImportFileTypes: LocalizedImportFileType[] = [];
function getAllSupportedImportFileCagtegoryAndTypes(): LocalizedImportFileCategoryAndTypes[] {
const allSupportedImportFileCategoryAndTypes: LocalizedImportFileCategoryAndTypes[] = [];
for (let i = 0; i < SUPPORTED_IMPORT_FILE_TYPES.length; i++) {
const fileType = SUPPORTED_IMPORT_FILE_TYPES[i];
for (let i = 0; i < SUPPORTED_IMPORT_FILE_CATEGORY_AND_TYPES.length; i++) {
const categoryAndTypes = SUPPORTED_IMPORT_FILE_CATEGORY_AND_TYPES[i];
const localizedCategoryAndTypes: LocalizedImportFileCategoryAndTypes = {
displayCategoryName: t(categoryAndTypes.categoryName),
fileTypes: []
};
for (let j = 0; j < categoryAndTypes.fileTypes.length; j++) {
const fileType = categoryAndTypes.fileTypes[j];
let document: LocalizedImportFileDocument | undefined;
if (fileType.document) {
@@ -1362,8 +1371,8 @@ export function useI18n() {
const subTypes: LocalizedImportFileTypeSubType[] = [];
if (fileType.subTypes) {
for (let i = 0; i < fileType.subTypes.length; i++) {
const subType = fileType.subTypes[i];
for (let k = 0; k < fileType.subTypes.length; k++) {
const subType = fileType.subTypes[k];
const localizedSubType: LocalizedImportFileTypeSubType = {
type: subType.type,
displayName: t(subType.name),
@@ -1377,8 +1386,8 @@ export function useI18n() {
const supportedEncodings: LocalizedImportFileTypeSupportedEncodings[] = [];
if (fileType.supportedEncodings) {
for (let i = 0; i < fileType.supportedEncodings.length; i++) {
const encoding = fileType.supportedEncodings[i];
for (let k = 0; k < fileType.supportedEncodings.length; k++) {
const encoding = fileType.supportedEncodings[k];
const localizedEncoding: LocalizedImportFileTypeSupportedEncodings = {
encoding: encoding,
displayName: t(`encoding.${encoding}`)
@@ -1397,10 +1406,14 @@ export function useI18n() {
dataFromTextbox: fileType.dataFromTextbox,
document: document
};
allSupportedImportFileTypes.push(localizedFileType);
localizedCategoryAndTypes.fileTypes.push(localizedFileType);
}
return allSupportedImportFileTypes;
allSupportedImportFileCategoryAndTypes.push(localizedCategoryAndTypes);
}
return allSupportedImportFileCategoryAndTypes;
}
function getLanguageInfo(languageKey: string): LanguageInfo | undefined {
@@ -2110,7 +2123,7 @@ export function useI18n() {
getAllImportTransactionColumnTypes: () => getLocalizedDisplayNameAndType(ImportTransactionColumnType.values()),
getAllTransactionDefaultCategories,
getAllDisplayExchangeRates,
getAllSupportedImportFileTypes,
getAllSupportedImportFileCagtegoryAndTypes,
// get localized info
getLanguageInfo,
getMonthShortName,
+8
View File
@@ -1727,9 +1727,17 @@
"Check and Modify Your Data": "Controlla e modifica i tuoi dati",
"Data Import Completed": "Importazione dati completata",
"File Type": "Tipo di file",
"Find file type": "Find file type",
"No available file type": "No available file type",
"Filter Description": "Filtra descrizione",
"How to import this file?": "How to import this file?",
"How to export this file?": "Come esportare questo file?",
"ezBookkeeping File Format": "ezBookkeeping File Format",
"Custom File Format": "Custom File Format",
"General Data Exchange Format": "General Data Exchange Format",
"General Bank Statement Format": "General Bank Statement Format",
"Other Bank/Payment App Statement File": "Other Bank/Payment App Statement File",
"Other Finance App File Format": "Other Finance App File Format",
"ezbookkeeping Data Export File": "File esportazione dati ezBookkeeping",
"Excel Workbook File": "Excel Workbook File",
"Open Financial Exchange (OFX) File": "File Open Financial Exchange (OFX)",
+8
View File
@@ -1727,9 +1727,17 @@
"Check and Modify Your Data": "データの確認と修正をします",
"Data Import Completed": "データのインポートが完了しました",
"File Type": "ファイルの種類",
"Find file type": "Find file type",
"No available file type": "No available file type",
"Filter Description": "フィルターの説明",
"How to import this file?": "How to import this file?",
"How to export this file?": "このファイルをエクスポートする方法",
"ezBookkeeping File Format": "ezBookkeeping File Format",
"Custom File Format": "Custom File Format",
"General Data Exchange Format": "General Data Exchange Format",
"General Bank Statement Format": "General Bank Statement Format",
"Other Bank/Payment App Statement File": "Other Bank/Payment App Statement File",
"Other Finance App File Format": "Other Finance App File Format",
"ezbookkeeping Data Export File": "ezbookkeepingデータエクスポートファイル",
"Excel Workbook File": "Excel Workbook File",
"Open Financial Exchange (OFX) File": "Open Financial Exchange (OFX) ファイル",
+8
View File
@@ -1727,9 +1727,17 @@
"Check and Modify Your Data": "Controleer en pas je gegevens aan",
"Data Import Completed": "Gegevensimport voltooid",
"File Type": "Bestandstype",
"Find file type": "Find file type",
"No available file type": "No available file type",
"Filter Description": "Filterbeschrijving",
"How to import this file?": "Hoe importeer ik dit bestand?",
"How to export this file?": "Hoe exporteer ik dit bestand?",
"ezBookkeeping File Format": "ezBookkeeping File Format",
"Custom File Format": "Custom File Format",
"General Data Exchange Format": "General Data Exchange Format",
"General Bank Statement Format": "General Bank Statement Format",
"Other Bank/Payment App Statement File": "Other Bank/Payment App Statement File",
"Other Finance App File Format": "Other Finance App File Format",
"ezbookkeeping Data Export File": "ezBookkeeping-gegevensexportbestand",
"Excel Workbook File": "Excel-werkmap",
"Open Financial Exchange (OFX) File": "Open Financial Exchange (OFX)-bestand",
+8
View File
@@ -1727,9 +1727,17 @@
"Check and Modify Your Data": "Verificar e Modificar Seus Dados",
"Data Import Completed": "Importação de Dados Concluída",
"File Type": "Tipo de Arquivo",
"Find file type": "Find file type",
"No available file type": "No available file type",
"Filter Description": "Descrição do Filtro",
"How to import this file?": "Como importar este arquivo?",
"How to export this file?": "Como exportar este arquivo?",
"ezBookkeeping File Format": "ezBookkeeping File Format",
"Custom File Format": "Custom File Format",
"General Data Exchange Format": "General Data Exchange Format",
"General Bank Statement Format": "General Bank Statement Format",
"Other Bank/Payment App Statement File": "Other Bank/Payment App Statement File",
"Other Finance App File Format": "Other Finance App File Format",
"ezbookkeeping Data Export File": "Arquivo de Exportação de Dados ezbookkeeping",
"Excel Workbook File": "Excel Workbook File",
"Open Financial Exchange (OFX) File": "Arquivo Open Financial Exchange (OFX)",
+8
View File
@@ -1727,9 +1727,17 @@
"Check and Modify Your Data": "Проверьте и измените свои данные",
"Data Import Completed": "Импорт данных завершен",
"File Type": "Тип файла",
"Find file type": "Find file type",
"No available file type": "No available file type",
"Filter Description": "Описание фильтра",
"How to import this file?": "How to import this file?",
"How to export this file?": "Как экспортировать этот файл?",
"ezBookkeeping File Format": "ezBookkeeping File Format",
"Custom File Format": "Custom File Format",
"General Data Exchange Format": "General Data Exchange Format",
"General Bank Statement Format": "General Bank Statement Format",
"Other Bank/Payment App Statement File": "Other Bank/Payment App Statement File",
"Other Finance App File Format": "Other Finance App File Format",
"ezbookkeeping Data Export File": "Файл экспорта данных ezbookkeeping",
"Excel Workbook File": "Excel Workbook File",
"Open Financial Exchange (OFX) File": "Файл Open Financial Exchange (OFX)",
+8
View File
@@ -1727,9 +1727,17 @@
"Check and Modify Your Data": "Перевірте та змініть свої дані",
"Data Import Completed": "Імпорт даних завершено",
"File Type": "Тип файлу",
"Find file type": "Find file type",
"No available file type": "No available file type",
"Filter Description": "Опис фільтра",
"How to import this file?": "How to import this file?",
"How to export this file?": "Як експортувати цей файл?",
"ezBookkeeping File Format": "ezBookkeeping File Format",
"Custom File Format": "Custom File Format",
"General Data Exchange Format": "General Data Exchange Format",
"General Bank Statement Format": "General Bank Statement Format",
"Other Bank/Payment App Statement File": "Other Bank/Payment App Statement File",
"Other Finance App File Format": "Other Finance App File Format",
"ezbookkeeping Data Export File": "Файл експорту даних ezbookkeeping",
"Excel Workbook File": "Excel Workbook File",
"Open Financial Exchange (OFX) File": "Файл Open Financial Exchange (OFX)",
+8
View File
@@ -1727,9 +1727,17 @@
"Check and Modify Your Data": "Kiểm tra và sửa đổi dữ liệu của bạn",
"Data Import Completed": "Nhập dữ liệu hoàn tất",
"File Type": "Loại tệp",
"Find file type": "Find file type",
"No available file type": "No available file type",
"Filter Description": "Mô tả bộ lọc",
"How to import this file?": "How to import this file?",
"How to export this file?": "Làm thế nào để xuất tệp này?",
"ezBookkeeping File Format": "ezBookkeeping File Format",
"Custom File Format": "Custom File Format",
"General Data Exchange Format": "General Data Exchange Format",
"General Bank Statement Format": "General Bank Statement Format",
"Other Bank/Payment App Statement File": "Other Bank/Payment App Statement File",
"Other Finance App File Format": "Other Finance App File Format",
"ezbookkeeping Data Export File": "Tệp xuất dữ liệu ezbookkeeping",
"Excel Workbook File": "Excel Workbook File",
"Open Financial Exchange (OFX) File": "Tệp Open Financial Exchange (OFX)",
+8
View File
@@ -1727,9 +1727,17 @@
"Check and Modify Your Data": "检查及修改您的数据",
"Data Import Completed": "数据导入完成",
"File Type": "文件类型",
"Find file type": "查找文件类型",
"No available file type": "没有可用的文件类型",
"Filter Description": "过滤描述",
"How to import this file?": "如何导入该文件?",
"How to export this file?": "如何导出该文件?",
"ezBookkeeping File Format": "ezBookkeeping 文件格式",
"Custom File Format": "自定义文件格式",
"General Data Exchange Format": "通用数据交换格式",
"General Bank Statement Format": "通用银行对账单格式",
"Other Bank/Payment App Statement File": "其他银行/支付应用对账单文件",
"Other Finance App File Format": "其他金融应用文件格式",
"ezbookkeeping Data Export File": "ezbookkeeping 数据导出文件",
"Excel Workbook File": "Excel 工作簿文件",
"Open Financial Exchange (OFX) File": "开放式金融交换 (OFX) 文件",
+8
View File
@@ -1727,9 +1727,17 @@
"Check and Modify Your Data": "檢查及修改您的資料",
"Data Import Completed": "資料匯入完成",
"File Type": "檔案類型",
"Find file type": "搜尋檔案類型",
"No available file type": "沒有可用的檔案類型",
"Filter Description": "篩選描述",
"How to import this file?": "如何匯入此檔案?",
"How to export this file?": "如何匯出此檔案?",
"ezBookkeeping File Format": "ezBookkeeping 檔案格式",
"Custom File Format": "自訂檔案格式",
"General Data Exchange Format": "通用資料交換格式",
"General Bank Statement Format": "通用銀行對帳單格式",
"Other Bank/Payment App Statement File": "其他銀行/支付應用程式對帳單檔案",
"Other Finance App File Format": "其他金融應用程式檔案格式",
"ezbookkeeping Data Export File": "ezbookkeeping 資料匯出檔案",
"Excel Workbook File": "Excel 工作簿檔案",
"Open Financial Exchange (OFX) File": "開放式金融交換 (OFX) 檔案",
@@ -218,15 +218,23 @@
<v-window-item value="uploadFile">
<v-row>
<v-col cols="12" md="12">
<v-select
item-title="displayName"
item-value="type"
<two-column-select primary-key-field="displayCategoryName"
primary-value-field="displayCategoryName"
primary-title-field="displayCategoryName"
primary-sub-items-field="fileTypes"
secondary-key-field="type"
secondary-value-field="type"
secondary-title-field="displayName"
:disabled="submitting"
:enable-filter="true"
:filter-placeholder="tt('Find file type')"
:filter-no-items-text="tt('No available file type')"
:label="tt('File Type')"
:placeholder="tt('File Type')"
:items="allSupportedImportFileTypes"
v-model="fileType"
/>
:items="allSupportedImportFileCategoryAndTypes"
:auto-update-menu-position="true"
v-model="fileType">
</two-column-select>
</v-col>
<v-col cols="12" md="12" v-if="allFileSubTypes">
@@ -907,7 +915,7 @@ import { TransactionType } from '@/core/transaction.ts';
import { ImportTransactionColumnType, ImportTransactionDataMapping } from '@/core/import_transaction.ts';
import { KnownFileType } from '@/core/file.ts';
import type { LocalizedImportFileType, LocalizedImportFileTypeSubType, LocalizedImportFileTypeSupportedEncodings } from '@/core/file.ts';
import type { LocalizedImportFileCategoryAndTypes, LocalizedImportFileType, LocalizedImportFileTypeSubType, LocalizedImportFileTypeSupportedEncodings } from '@/core/file.ts';
import { Account, type CategorizedAccountWithDisplayBalance } from '@/models/account.ts';
import type { TransactionCategory } from '@/models/transaction_category.ts';
import type { TransactionTag } from '@/models/transaction_tag.ts';
@@ -998,7 +1006,7 @@ defineProps<{
const {
tt,
getAllImportTransactionColumnTypes,
getAllSupportedImportFileTypes,
getAllSupportedImportFileCagtegoryAndTypes,
formatUnixTimeToLongDateTime,
formatAmountToLocalizedNumeralsWithCurrency,
formatNumberToLocalizedNumerals,
@@ -1097,7 +1105,22 @@ const allSteps = computed<StepBarItem[]>(() => {
});
const allImportTransactionColumnTypes = computed<TypeAndDisplayName[]>(() => getAllImportTransactionColumnTypes());
const allSupportedImportFileTypes = computed<LocalizedImportFileType[]>(() => getAllSupportedImportFileTypes());
const allSupportedImportFileCategoryAndTypes = computed<LocalizedImportFileCategoryAndTypes[]>(() => getAllSupportedImportFileCagtegoryAndTypes());
const allSupportedImportFileTypesMap = computed<Record<string, LocalizedImportFileType>>(() => {
const ret: Record<string, LocalizedImportFileType> = {};
for (let i = 0; i < allSupportedImportFileCategoryAndTypes.value.length; i++) {
const importFileCategoryAndTypes = allSupportedImportFileCategoryAndTypes.value[i];
for (let j = 0; j < importFileCategoryAndTypes.fileTypes.length; j++) {
const importFileType = importFileCategoryAndTypes.fileTypes[j];
ret[importFileType.type] = importFileType;
}
}
return ret;
});
const allSeparators = computed<NameValue[]>(() => {
const separators: NameValue[] = [
@@ -1126,35 +1149,9 @@ const allSeparators = computed<NameValue[]>(() => {
return separators;
});
const isImportDataFromTextbox = computed<boolean>(() => {
for (const importFileType of allSupportedImportFileTypes.value) {
if (importFileType.type === fileType.value) {
return !!importFileType.dataFromTextbox;
}
}
return false;
});
const allFileSubTypes = computed<LocalizedImportFileTypeSubType[] | undefined>(() => {
for (const importFileType of allSupportedImportFileTypes.value) {
if (importFileType.type === fileType.value) {
return importFileType.subTypes;
}
}
return undefined;
});
const allSupportedEncodings = computed<LocalizedImportFileTypeSupportedEncodings[] | undefined>(() => {
for (const importFileType of allSupportedImportFileTypes.value) {
if (importFileType.type === fileType.value) {
return importFileType.supportedEncodings;
}
}
return undefined;
});
const isImportDataFromTextbox = computed<boolean>(() => allSupportedImportFileTypesMap.value[fileType.value]?.dataFromTextbox ?? false);
const allFileSubTypes = computed<LocalizedImportFileTypeSubType[] | undefined>(() => allSupportedImportFileTypesMap.value[fileType.value]?.subTypes);
const allSupportedEncodings = computed<LocalizedImportFileTypeSupportedEncodings[] | undefined>(() => allSupportedImportFileTypesMap.value[fileType.value]?.supportedEncodings);
const allAccounts = computed<Account[]>(() => accountsStore.allPlainAccounts);
const allVisibleAccounts = computed<Account[]>(() => accountsStore.allVisiblePlainAccounts);
@@ -1179,13 +1176,11 @@ const supportedImportFileExtensions = computed<string | undefined>(() => {
}
}
return findExtensionByType(allSupportedImportFileTypes.value, fileType.value);
return allSupportedImportFileTypesMap.value[fileType.value]?.extensions;
});
const exportFileGuideDocumentUrl = computed<string | undefined>(() => {
for (const importFileType of allSupportedImportFileTypes.value) {
if (importFileType.type === fileType.value) {
const document = importFileType.document;
const document = allSupportedImportFileTypesMap.value[fileType.value]?.document;
if (!document) {
return undefined;
@@ -1194,22 +1189,9 @@ const exportFileGuideDocumentUrl = computed<string | undefined>(() => {
const language = document.language ? document.language + '/' : '';
const anchor = document.anchor ? '#' + document.anchor : '';
return `https://ezbookkeeping.mayswind.net/${language}export_and_import${anchor}`;
}
}
return undefined;
});
const exportFileGuideDocumentLanguageName = computed<string | undefined>(() => {
for (const importFileType of allSupportedImportFileTypes.value) {
if (importFileType.type === fileType.value) {
const document = importFileType.document;
return document?.displayLanguageName;
}
}
return undefined;
});
const exportFileGuideDocumentLanguageName = computed<string | undefined>(() => allSupportedImportFileTypesMap.value[fileType.value]?.document?.displayLanguageName);
const fileName = computed<string>(() => importFile.value?.name || '');
@@ -2695,7 +2677,7 @@ watch(fileSubType, (newValue) => {
let supportedExtensions: string | undefined = findExtensionByType(allFileSubTypes.value, newValue);
if (!supportedExtensions) {
supportedExtensions = findExtensionByType(allSupportedImportFileTypes.value, fileType.value);
supportedExtensions = allSupportedImportFileTypesMap.value[fileType.value]?.extensions;
}
if (importFile.value && importFile.value.name && !isFileExtensionSupported(importFile.value.name, supportedExtensions || '')) {