Skip to content

Commit

Permalink
feat(packages): some the antd component and the react component
Browse files Browse the repository at this point in the history
  • Loading branch information
zsirfs committed Apr 26, 2019
1 parent 66a0d12 commit c663abc
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
"version:patch": "npm run prevesion && lerna version patch --exact",
"version:minor": "npm run prevesion && lerna version minor --exact",
"version:major": "npm run prevesion && lerna version major --exact",
"release:force":"lerna publish from-package --yes",
"release":"lerna publish",
"release:force": "lerna publish from-package --yes",
"release": "lerna publish",
"lint": "eslint \"packages/!(docs)/**/*.js\" \"scripts/**/*.js\""
},
"devDependencies": {
Expand Down
87 changes: 87 additions & 0 deletions packages/antd/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { ButtonProps } from 'antd/lib/button';

declare type SumbitProps = {
status: 'submitting' | string;
} & ButtonProps;

export function Submit(
props: React.ComponentPropsWithRef<SubmitProps>
): React.ComponentType<SubmitProps>;

declare type ResetProps = {
reset: (event: React.MouseEvent<any, MouseEvent>) => void;
} & ButtonProps;

export function Reset(props: React.PropsWithChildren<ResetProps>): React.ComponentType<ResetProps>;

declare type FormButtonGroupProps = {
itemStyle: React.CSSProperties;
};

export function FormButtonGroup(
props: FormButtonGroupProps
): React.ComponentType<FormButtonGroupProps>;

declare type RowProps = {
prefix?: string;
pure?: boolean;
fixed?: boolean;
gutter?: number;
wrap?: boolean;
component?: string;
fixedWidth?: number;
align?: string;
justify?: string;
hidden?: boolean;
className?: string;
[x: string]: any;
};

export class Row extends React.Component<RowProps> {
static defaultProps: {
prefix: string;
pure: boolean;
fixed: boolean;
gutter: number;
wrap: boolean;
component: string;
};

render(): JSX.Element;
}

type PointType =
| {
span?: string | number;
offset?: string | number;
}
| string
| number;

declare type ColProps = {
prefix?: string;
pure?: boolean;
component?: string;
span?: string | number;
offset?: string | number;
fixedSpan?: string | number;
align?: string | number;
hidden?: boolean;
xxs?: PointType;
xs?: PointType;
s?: PointType;
m?: PointType;
l?: PointType;
xl?: PointType;
};

export class Col extends React.Component<ColProps> {
static isNextCol: boolean;
static defaultProps: {
prefix: string;
pure: boolean;
component: string;
};

render(): JSX.Element;
}
1 change: 1 addition & 0 deletions packages/antd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.5",
"license": "MIT",
"main": "lib",
"types": "./index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/alibaba/uform.git"
Expand Down
56 changes: 56 additions & 0 deletions packages/react/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
export type SchemaFormProps = {
className?: string;
[x: string]: any;
};

export const SchemaForm: React.SFC<SchemaFormProps>;

export type SchemaFieldProps = {
[x: string]: any;
};

type ParamsWithContext<P extends any = any, C extends any = any> = (
props: React.PropsWithChildren<P>,
context: React.Context<C>
) => JSX.Element;

export const Field: ParamsWithContext<SchemaFieldProps>;

/**
* set the validation internationalization
*/
export const setValidationLocale: (locale: Record<string, any>) => void;

/**
* set the validation langage
*/
export const setValidationLanguage: (lang: string) => void;

declare type FormActionType = {
getFormState: (callback?: any) => any;
getFieldState: (path?: string, callback: any) => any;
setFormState: (callback?: any) => any;
setFieldState: (path?: string, buffer?: any, callback?: any) => any;
getSchema: (path?: string) => any;
reset: (forceClear?: boolean) => void;
submit: () => Promise<any>;
validate: () => Promise<any>;
dispatch: (type: string, payload?: any) => void;
};

export const createFormActions: () => FormActionType;

declare type FormAsyncActionType = {
getFormState: (callback?: any) => Promise<any>;
getFieldState: (path?: string, callback: any) => Promise<any>;
setFormState: (callback?: any) => Promise<any>;
setFieldState: (path?: string, buffer?: any, callback?: any) => Promise<any>;
getSchema: (path?: string) => Promise<any>;
reset: (forceClear?: boolean) => Promise<any>;
submit: () => Promise<any>;
validate: () => Promise<any>;
dispatch: (type: string, payload?: any) => Promise<any>;
};

export const createAsyncFormActions: () => FormAsyncActionType;

1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.5",
"license": "MIT",
"main": "lib",
"types": "./index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/alibaba/uform.git"
Expand Down

0 comments on commit c663abc

Please sign in to comment.