import * as t from '@babel/types'; declare global { //config typpings interface Config { projectName: string; languages: Language[]; defaultLanguage: DefaultLanguage; currencies: Currency[]; defaultCurrency: DefaultCurrency; menus: Menu[]; pages: (OverviewPage | ListPage)[]; statusTypes: { [status: string]: 'warning' | 'success' | 'waiting' | 'faild' | 'error'; }; } type Language = | { title: 'EN'; key: 'en-US'; } | { title: 'ID'; key: 'id-ID'; } | { title: 'VN'; key: 'vi-VN'; } | { title: 'ZH'; key: 'zh-CN'; }; type DefaultLanguage = 'en-US' | 'id-ID' | 'vi-VN' | 'zh-CN'; type Currency = | { title: 'USD'; key: 'USD'; } | { title: 'IDR'; key: 'IDR'; } | { title: 'CNY'; key: 'CNY'; } | { title: 'PHP'; key: 'PHP'; } | { title: 'VND'; key: 'VND'; } | { title: 'MYR'; key: 'MYR'; } | { title: 'THB'; key: 'THB'; } | { title: 'AUD'; key: 'AUD'; } | { title: string; key: string; }; type DefaultCurrency = | 'USD' | 'CNY' | 'IDR' | 'PHP' | 'VND' | 'MYR' | 'THB' | 'AUD' | string; interface Menu { title: string; key: string; children: SubMenu[]; } interface SubMenu { title: string; key: string; path: string; icon: | 'Policy' | 'Claim' | 'Overview' | 'Reimburse' | 'Insure' | 'Insurer' | 'Invoice' | 'Refund' | 'Bill' | 'Report' | 'Shop' | 'Quote'; scopeKey: string; } interface OverviewPage { type: 'overview'; title: string; src: string; productName?: string; } interface ListPage { type: 'Policy' | 'Claim' | 'Reimburse' | 'Quote' | 'Insure' | string; columns: Column[]; keyDataIndex: string; filterConfig: Filter; listApi: string; detailApi: string; detail?: DetailPage; productName?: string; } type DataIndex = string | string[]; type DisplayMode = | 'text' | 'date' | 'amount' | 'status' | 'image' | 'documents' | 'date-range' | 'join'; type Column = { title: string; key: string; dataIndex: DataIndex; defaultShow: boolean; displayMode: DisplayMode; sortable?: boolean; }; interface Filter { showIdSelect?: boolean; showDefaultOptions?: boolean; idKeyTypes?: { label: string; value: string }[]; idKeyTypeDefault?: string; searchInputDefault?: string; searchWithFilter?: boolean; deleteAllTagsType?: 'closeAllCanDelete' | 'restFilters'; onFilter?: (filter: any) => void; fillterTitle?: string; placeholder?: string; filterItems?: (FilterDateItem | FilterSelectItem)[]; } interface FilterDateItem { type: 'date'; key: string; filterItemTitle: string; default?: any; format?: string; canNotDelete?: boolean; // defaultRange?: // | 'today' // | 'lastDay' // | 'last7Days' // | 'thisWeek' // | 'thisMonth' // | 'lastMonth'; } interface FilterSelectItem { filterItemTitle: string; type: 'mult' | 'single'; key: string; options: { label: string; value: string; span?: 8 | 12 | 16 | 24 }[]; default?: string | string[]; disabled?: string[]; } type DetailItem = { label: string; dataIndex: DataIndex; displayMode: DisplayMode; span: 4 | 6 | 8 | 12 | 16 | 24; }; type CardGroup = { type?: 'normal' | 'map'; format?: CardGroup; dataIndex?: DataIndex; label?: string; statusDataIndex?: DataIndex; items: DetailItem[]; }; type Card = { statusDataIndex?: DataIndex; title: string; contentTitle?:string; groups: CardGroup[]; }; interface DetailPage { idDataIndex: DataIndex; title?: string; // default title is `${pageName} ID: ${idValue}` statusDataIndex: DataIndex; topItems: DetailItem[]; topGroups: CardGroup[]; cards: Card[]; buttons: Button[]; } type Button = { onClick?:any; // icon?: string; type: 'default' | 'primary'; text: string; }; //processor typpings type AST = t.Node; abstract class Processor { constructor(ast: AST); ast?: AST; next?: Processor; run(): any; handleConfigs(): any; } abstract class Template { constructor(path: string, outputPath: string, config: Config); processor: Processor; ast?: AST; path?: string; outputPath?: string; config?: Config; parse(): void; generate(): void; run(): void; initProcessor(): void; } }