UNPKG

macoolka-type-model

Version:

`macoolka-type-model` is a library for define model in TypeScript. It easily build a type contain field and method to your Application. It provide a generation model for type and validition

310 lines (309 loc) 6.54 kB
/** * Code generated by github.com/macoolka/macoolka-gen-model, DO NOT EDIT. * @since 0.2.0 */ import { InputModule } from '../types'; export declare type Field = InputModule.MField; export declare type MInfoable = InputModule.MInfoable; export declare type MNameable = InputModule.MNameable; /** * @since 0.2.0 */ /** * The Element when render * @desczh * 渲染要素 * @since 0.2.0 */ export declare type Element = Field | FieldElement | Card | MutationForm | QueryForm | Action; /** * @since 0.2.0 */ export interface Entity extends MInfoable, MNameable { /** * @since 0.2.0 */ fields: Array<Field>; /** * @since 0.2.0 */ mutations: Array<MutationForm>; /** * @since 0.2.0 */ forms: Array<QueryForm>; /** * @since 0.2.0 */ cards: Array<Card>; /** * @since 0.2.0 */ actions: Array<Action>; /** * @since 0.2.0 */ elements: Array<FieldElement>; } /** * The card * @desczh * * @since 0.2.0 */ export interface Card extends MInfoable, MNameable, Pageable { /** * The _kind is a tag that check which Type be used. * @desczh * 标签判断哪一个Type被使用 * @since 0.2.0 */ _kind: 'card'; /** * @since 0.2.0 */ type?: 'Add' | 'Edit' | 'Setting' | 'Display' | 'Manager' | 'Home' | 'Form' | 'App' | 'Grid' | 'Group'; /** * @since 0.2.0 */ image?: string; /** * @since 0.2.0 */ elements: Array<Elements>; /** * @since 0.2.0 */ actions: Array<Elements>; /** * @since 0.2.0 */ links: Array<Elements>; /** * @since 0.2.0 */ mainActions: Array<Elements>; /** * @since 0.2.0 */ moreActions: Array<Elements>; } /** * @since 0.2.0 */ export interface QueryForm extends Formable { /** * The _kind is a tag that check which Type be used. * @desczh * 标签判断哪一个Type被使用 * @since 0.2.0 */ _kind: 'query'; /** * Contain query condition element * @desczh * 查询结果 * @since 0.2.0 */ result: Array<Elements>; } /** * @since 0.2.0 */ export interface MutationForm extends Formable { /** * The _kind is a tag that check which Type be used. * @desczh * 标签判断哪一个Type被使用 * @since 0.2.0 */ _kind: 'mutation'; } /** * The element collection * @desczh * 渲染要素集合 * @since 0.2.0 */ export interface Elements { /** * @since 0.2.0 */ item?: Element; /** * @since 0.2.0 */ order: number; /** * @since 0.2.0 */ items: Array<Elements>; } /** * @since 0.2.0 */ export interface Action extends MInfoable, MNameable, Iconable { /** * The _kind is a tag that check which Type be used. * @desczh * 标签判断哪一个Type被使用 * @since 0.2.0 */ _kind: 'action'; /** * action type * @desczh * 动作类型 * @since 0.2.0 */ actionType?: 'Load' | 'Loads' | 'Query' | 'QueryReset' | 'Reset' | 'QueryMore' | 'LoadWithID' | 'OpenWithID' | 'DeleteWithID' | 'UploadImage' | 'UploadFile' | 'Search' | 'Submit' | 'Link'; /** * link url * @desczh * 链接url * @since 0.2.0 */ link?: string; /** * action target * @desczh * 动作目标 * @since 0.2.0 */ target: 'Main' | 'NewPage' | 'Dialog'; } /** * Type have a icon field * @desczh * 有一个图标字段 * @since 0.2.0 */ export interface Iconable { /** * Icon name * @desczh * 图标名称 * @since 0.2.0 */ icon?: string; } /** * The used with field when render * @desczh * 字段渲染时对应的组件 * @since 0.2.0 */ export interface FieldElement extends MInfoable, MNameable, Iconable { /** * The _kind is a tag that check which Type be used. * @desczh * 标签判断哪一个Type被使用 * @since 0.2.0 */ _kind: 'fieldElement'; /** * The Field used on render * @desczh * 对应字段 * @since 0.2.0 */ field?: Field; /** * The Element type * @desczh * 类型 * @since 0.2.0 */ type?: 'H1' | 'H2' | 'H3' | 'P' | 'P1' | 'P2' | 'P3' | 'Header' | 'Subtitle' | 'Overline' | 'Caption' | 'TextField' | 'Display'; /** * max rows count on render with non-TextField * @desczh * 在渲染中最大行数,用在类型非TextField时 * @since 0.2.0 */ maxRows?: number; } /** * @since 0.2.0 */ export interface Formable extends MInfoable, MNameable, Pageable, Iconable { /** * Contain query condition element * @desczh * 输入容器 * @since 0.2.0 */ input: Array<Elements>; /** * @since 0.2.0 */ style?: 'Add' | 'Edit' | 'Setting' | 'Display'; /** * Execute submit action after change event * @desczh * 当数据改变事件触发后执行submit动作 * @since 0.2.0 */ changeSubmit: boolean; /** * Execute submit action after init action execute when the render is ready * @desczh * 当渲染完毕后以及初始化动作完成后执行submit动作 * @since 0.2.0 */ autoSubmit: boolean; /** * @since 0.2.0 */ actions: Array<Elements>; /** * Get data from input element and execute submit action * @desczh * 提交动作表示从input中得到对应数据并执行预定义方法 * @since 0.2.0 */ submitAction?: string; /** * The action mean init input element.Excute when the render is ready * @desczh * 初始化数据,渲染完成后自动执行 * @since 0.2.0 */ initAction?: string; /** * The action mean init data.Excute on server render * @desczh * 初始化查询条件,服务器端自动执行 * @since 0.2.0 */ initActionOnServer?: string; /** * Show the info when submit success * @desczh * 显示这个信息在提交成功后 * @since 0.2.0 */ success: Array<string>; /** * i18n success * @desczh * 国际化成功消息 * @since 0.2.0 */ successes?: Record<string, any>; } /** * Type have a page information * @desczh * 单独页面 * @since 0.2.0 */ export interface Pageable { /** * The page url * @desczh * 页面url * @since 0.2.0 */ href?: string; }