exportExcel支持自定义表头

This commit is contained in:
wenjiarui 2023-06-26 13:41:39 +08:00
parent 28b44dd68c
commit 96637ffac8
2 changed files with 9 additions and 7 deletions

7
lib/types/Port.d.ts vendored
View File

@ -1,12 +1,13 @@
import { AsyncContext } from "../store/AsyncRowStore";
import { EntityDict } from "./Entity";
export declare type Exportation<ED extends EntityDict, T extends keyof ED, K extends string> = {
export declare type Exportation<ED extends EntityDict, T extends keyof ED> = {
name: string;
id: string;
entity: T;
projection: ED[T]['Selection']['data'];
headers: K[];
fn: (data: ED[T]['Schema']) => Partial<Record<K, string | number | boolean | null>>;
headers?: string[];
makeHeaders?: (dataList: Partial<ED[T]['Schema']>[]) => string[];
fn: (data: ED[T]['Schema']) => Partial<Record<string, string | number | boolean | null>>;
};
export declare type Importation<ED extends EntityDict, T extends keyof ED, K extends string> = {
name: string;

View File

@ -2,13 +2,14 @@ import { AsyncContext } from "../store/AsyncRowStore";
import { SyncContext } from "../store/SyncRowStore";
import { EntityDict } from "./Entity";
export type Exportation<ED extends EntityDict, T extends keyof ED, K extends string> = {
export type Exportation<ED extends EntityDict, T extends keyof ED> = {
name: string;
id: string;
entity: T;
projection: ED[T]['Selection']['data'];
headers: K[];
fn: (data: ED[T]['Schema']) => Partial<Record<K, string | number | boolean | null>>;
headers?: string[];
makeHeaders?: (dataList: Partial<ED[T]['Schema']>[]) => string[];
fn: (data: ED[T]['Schema']) => Partial<Record<string, string | number | boolean | null>>;
};
export type Importation<ED extends EntityDict, T extends keyof ED, K extends string> = {
@ -17,5 +18,5 @@ export type Importation<ED extends EntityDict, T extends keyof ED, K extends str
entity: T;
headers: K[];
// 解析过程中如果出错请抛出OakImportDataParseException异常
fn: (data: Partial<Record<K, string | number | boolean>>[], context: AsyncContext<ED>, option?: Record<string, any> ) => Promise<ED[T]['CreateMulti']['data']>;
fn: (data: Partial<Record<K, string | number | boolean>>[], context: AsyncContext<ED>, option?: Record<string, any>) => Promise<ED[T]['CreateMulti']['data']>;
};