yao-app-ts-types
Version:
typescript types for yao application
75 lines (67 loc) • 1.52 kB
TypeScript
import { XgenGlobal as Global } from "@/types/xgen";
export declare namespace XgenAction {
interface OpenModal {
width?: number | string;
byDrawer?: { mask?: boolean };
Form?: {
type: "view" | "edit";
model: string;
};
Page?: {
type: "chart";
model: string;
};
}
interface HistoryPush {
pathname: string;
search?: any;
public?: boolean;
}
interface Confirm {
title: string;
content: string;
}
interface YaoParams {
method: string;
args: Array<any>;
}
interface ActionMap {
"Common.openModal": OpenModal;
"Common.closeModal": {};
"Common.historyPush": HistoryPush;
"Common.historyBack": {};
"Common.confirm": Confirm;
"Table.search": {};
"Table.save": Global.StringObject;
"Table.delete": {};
"Form.find": {};
"Form.submit": Global.StringObject;
"Form.delete": {};
"Form.fullscreen": {};
"Service.*": YaoParams;
"Studio.*": YaoParams;
}
type ActionParams = {
[T in keyof ActionMap]: {
name: string;
type: T;
payload: ActionMap[T];
next?: string;
error?: string;
};
}[keyof ActionMap];
interface Props {
title: string;
icon: string;
action: Array<ActionParams>;
style?: "danger" | "success" | "primary";
divideLine?: boolean;
showWhenAdd?: boolean;
showWhenView?: boolean;
hideWhenEdit?: boolean;
disabled?: {
bind: string;
value: string | Array<string>;
};
}
}