Skip to content

Commit

Permalink
Fixed #1199 - Improve type definition for onChange of form components
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Mar 12, 2020
1 parent a3cf76a commit 8824298
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/components/autocomplete/AutoComplete.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface AutoCompleteProps {
completeMethod?(e: {originalEvent: Event, query: string}): void;
itemTemplate?(data: any): JSX.Element | undefined;
selectedItemTemplate?(data: any): JSX.Element | undefined;
onChange?(e: {originalEvent: Event, value: any}): void;
onChange?(e: {originalEvent: Event, value: any, target: {name: string, id: string, value: any}}): void;
onFocus?(event: Event): void;
onBlur?(event: Event): void;
onSelect?(e: {originalEvent: Event, value: any}): void;
Expand Down
2 changes: 1 addition & 1 deletion src/components/calendar/Calendar.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ interface CalendarProps {
onBlur?(event: Event): void;
onInput?(event: Event): void;
onSelect?(e: {originalEvent: Event, value: Date}): void;
onChange?(e: {originalEvent: Event, value: Date|Date[]}): void;
onChange?(e: {originalEvent: Event, value: Date|Date[], target: {name: string, id: string, value: Date|Date[]}}): void;
onTodayButtonClick?(event: Event): void;
onClearButtonClick?(event: Event): void;
onViewDateChange?(e: {originalEvent: Event, value: Date}): void;
Expand Down
2 changes: 1 addition & 1 deletion src/components/checkbox/Checkbox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface CheckboxProps {
ariaLabelledBy?: string;
onMouseDown?(event: Event): void;
onContextMenu?(event: Event): void;
onChange(e: { originalEvent: Event, value: any, checked: boolean}): void;
onChange?(e: {originalEvent: Event, value: any, checked: boolean, target: {type: string, name: string, id: string, value: any, checked: boolean}}): void;
}

export class Checkbox extends React.Component<CheckboxProps,any> {}
2 changes: 1 addition & 1 deletion src/components/chips/Chips.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface ChipsProps {
itemTemplate?(item: any): JSX.Element | undefined;
onAdd?(e: {originalEvent: Event, value: any}): void;
onRemove?(e: {originalEvent: Event, value: any}): void;
onChange?(e: {originalEvent: Event, value: any}): void;
onChange?(e: {originalEvent: Event, value: any, target: {name: string, id: string, value: any}}): void;
onFocus?(event: Event): void;
onBlur?(event: Event): void;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/colorpicker/ColorPicker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface ColorPickerProps {
inputId?: string;
tooltip?: any;
tooltipOptions?: TooltipOptions;
onChange?(value: any): void;
onChange?(value: any, target: {name: string, id: string, value: any}): void;
}

export class ColorPicker extends React.Component<ColorPickerProps,any> {}
2 changes: 1 addition & 1 deletion src/components/dropdown/Dropdown.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface DropdownProps {
ariaLabel?: string,
ariaLabelledBy?: string,
itemTemplate?(option:any): React.ReactNode;
onChange?(e: {originalEvent: Event, value: any}): void;
onChange?(e: {originalEvent: Event, value: any, target: {name: string, id: string, value: any}}): void;
onFocus?(e: Event): void;
onBlur?(e: Event): void;
onMouseDown?(event: Event): void;
Expand Down
2 changes: 1 addition & 1 deletion src/components/inputmask/InputMask.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface InputMaskProps {
tooltipOptions?: TooltipOptions;
ariaLabelledBy?: string;
onComplete?(e: Event): void;
onChange?(e: {originalEvent: Event, value: any}): void;
onChange?(e: {originalEvent: Event, value: any, target: {name: string, id: string, value: any}}): void;
}

export class InputMask extends React.Component<InputMaskProps,any> {}
2 changes: 1 addition & 1 deletion src/components/inputswitch/InputSwitch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface InputSwitchProps {
tooltip?: any;
tooltipOptions?: TooltipOptions;
ariaLabelledBy?: string,
onChange?(e: {originalEvent: Event, value: boolean}): void;
onChange?(e: {originalEvent: Event, value: boolean, target: {name: string, id: string, value: boolean}}): void;
onFocus?(event: Event): void;
onBlur?(event: Event): void;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/listbox/ListBox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ interface ListBoxProps {
tooltipOptions?: TooltipOptions;
ariaLabelledBy?: string,
itemTemplate?(item: any): JSX.Element | undefined;
onChange?(e: {originalEvent: Event, value: any}): void;
onChange?(e: {originalEvent: Event, value: any, target: {name: string, id: string, value: any}}): void;
}

export class ListBox extends React.Component<ListBoxProps,any> {}
2 changes: 1 addition & 1 deletion src/components/multiselect/MultiSelect.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface MultiSelectProps {
selectedItemsLabel?: string;
itemTemplate?(item: any): JSX.Element | undefined;
selectedItemTemplate?(value: any): JSX.Element | undefined;
onChange?(e: {originalEvent: Event, value: any}): void;
onChange?(e: {originalEvent: Event, value: any, target: {name: string, id: string, value: any}}): void;
onFocus?(event: Event): void;
onBlur?(event: Event): void;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/radiobutton/RadioButton.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface RadioButtonProps {
tooltip?: any;
tooltipOptions?: TooltipOptions;
ariaLabelledBy?: string;
onChange(e: {originalEvent: Event, value: any, checked: boolean}): void;
onChange?(e: {originalEvent: Event, value: any, checked: boolean, target: {type: string, name: string, id: string, value: any, checked: boolean}}): void;
}

export class RadioButton extends React.Component<RadioButtonProps,any> {}
1 change: 1 addition & 0 deletions src/components/radiobutton/RadioButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export class RadioButton extends Component {
name: this.props.name,
id: this.props.id,
value: this.props.value,
checked: !this.props.checked
}
});

Expand Down
2 changes: 1 addition & 1 deletion src/components/rating/Rating.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface RatingProps {
className?: string;
tooltip?: any;
tooltipOptions?: TooltipOptions;
onChange?(e: {originalEvent: Event, value: number}): void;
onChange?(e: {originalEvent: Event, value: number, target: {name: string, id: string, value: number}}): void;
}

export class Rating extends React.Component<RatingProps,any> {}
2 changes: 1 addition & 1 deletion src/components/selectbutton/SelectButton.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface SelectButtonProps {
tooltipOptions?: TooltipOptions;
ariaLabelledBy?: string;
itemTemplate?(option:any): React.ReactNode;
onChange?(e: {originalEvent: Event, value: any}): void;
onChange?(e: {originalEvent: Event, value: any, target: {name: string, id: string, value: any}}): void;
}

export class SelectButton extends React.Component<SelectButtonProps,any> {}
2 changes: 1 addition & 1 deletion src/components/spinner/Spinner.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ interface SpinnerProps {
tooltip?: any;
tooltipOptions?: TooltipOptions;
ariaLabelledBy?: string;
onChange?(e: {value: number}): void;
onChange?(e: {originalEvent: Event, value: number, target: {name: string, id: string, value: number}}): void;
onBlur?(e: Event): void;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/togglebutton/ToggleButton.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface ToggleButtonProps {
tooltip?: any;
tooltipOptions?: TooltipOptions;
ariaLabelledBy?:string;
onChange?(e: {originalEvent: Event, value: boolean}): void;
onChange?(e: {originalEvent: Event, value: boolean, target: {type: string, name: string, id: string, value: boolean}}): void;
}

export class ToggleButton extends React.Component<ToggleButtonProps,any> {}
2 changes: 1 addition & 1 deletion src/components/tristatecheckbox/TriStateCheckbox.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface TriStateCheckboxProps {
tooltip?: any;
tooltipOptions?: TooltipOptions;
ariaLabelledBy?: string;
onChange?(e: {originalEvent: Event, value: boolean}): void;
onChange?(e: {originalEvent: Event, value: any, target: {name: string, id: string, value: any}}): void;
}

export class TriStateCheckbox extends React.Component<TriStateCheckboxProps,any> {}
2 changes: 1 addition & 1 deletion src/components/tristatecheckbox/TriStateCheckbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class TriStateCheckbox extends Component {
target: {
name: this.props.name,
id: this.props.id,
value: newValue,
value: newValue
}
})
}
Expand Down

1 comment on commit 8824298

@dattebayorob
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Please sign in to comment.