Skip to content

Commit

Permalink
#46 updated typescript definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
leandrohsilveira committed Feb 7, 2018
1 parent d58a283 commit e68ab12
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/react-formctrl/src/decorators/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,21 @@ declare interface ControlledFieldProps extends FieldStateProperties {
value?: string | number;

/**
* event handler to change event (Automatically handled by react-formctrl)
* An extra change event handler called after "react-formctrl" state change cycle.
* Internally in the controlledField() component, this event handler is injected and automatically handled by react-formctrl.
*/
onChange?: React.ChangeEventHandler<HTMLInputElement>;
onChange?(fieldCtrl?: FieldStateController): void;

/**
* event handler to blur event (Automatically handled by react-formctrl)
* An extra blur event handler called after "react-formctrl" state change cycle.
* Internally in the controlledField() component, this event handler is injected and automatically handled by react-formctrl.
*/
onBlur?: React.FocusEventHandler<HTMLInputElement>;
onBlur?(fieldCtrl?: FieldStateController): void;

/**
* Handler called when the form that this field is attached is reseted.
*/
onReset?(fieldCtrl?: FieldStateController): void;

/**
* The field state controller (Automatically handled by react-formctrl)
Expand Down
5 changes: 5 additions & 0 deletions packages/react-formctrl/src/form/form.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ declare interface FormProps extends React.Props<any> {
* The form submit handler.
*/
onSubmit?(values: {[fieldName: string]: string}, formCtrl?: FormStateController): void;

/**
* The form reset handler.
*/
onReset?(): void;
}

declare interface FormState {
Expand Down

0 comments on commit e68ab12

Please sign in to comment.