@doreamonjs/page-detail
Version:
74 lines (73 loc) • 2.26 kB
TypeScript
import { FunctionComponent, CSSProperties } from 'react';
import { InformationItem } from '@doreamonjs/components/lib/Card/Information';
import './index.less';
export interface DetailPageProps {
style?: CSSProperties;
headerStyle?: CSSProperties;
bodyStyle?: CSSProperties;
className?: string;
attributes: Attributes;
datasets: Datasets;
onActionTrigger(action: {
key: string;
namespace?: string;
}, data?: {
values: object;
value?: any;
index?: number;
origin?: any;
initialValue?: any;
}): void;
onReset: () => void;
onRefresh: () => void;
}
interface Attributes {
title?: string;
subTitle?: string;
actions: any[];
detail: {
loading?: (id: string, values: any, context: any) => boolean;
basis: DetailBasis | ((values: any, context: any) => JSX.Element);
modules: DetailModules | ((values: any, context: any) => JSX.Element);
};
}
interface Datasets {
table?: any[];
values?: any;
}
export interface DetailBasis {
items: InfoItem[][];
title?: string | ((values: any, context: any) => string);
subTitle?: string | ((values: any, context: any) => string);
column?: number;
hideContentInMobile?: boolean;
renderBottom?(values: any, context: any): JSX.Element;
}
export interface InfoItem {
key: string;
label: string;
value?: string | JSX.Element | ((value: any, context: any) => string | JSX.Element);
span?: number;
rollout?: string;
}
export interface DetailModules {
items?: TabItem[];
default?: string;
}
export interface TabItem {
key: string;
title: string | ((values: any, context: any) => string);
icon?: string;
disabled?: boolean;
render(values: any, index: number, context: any): JSX.Element;
rollout?: string;
visible?: boolean | ((values: any, tab: TabItem, index: number, context: any) => boolean);
}
export interface DInformationItem extends InformationItem {
rollout?: string;
}
export interface DTabItem extends Omit<TabItem, 'render'> {
render(values: any, index: number, context: any): JSX.Element;
}
export declare const DetailPage: FunctionComponent<DetailPageProps>;
export default DetailPage;