Merge pull request #7018 from ngbrown/material-ui-fix2

material-ui - update to new dialog usage.
This commit is contained in:
Masahiro Wakame
2015-12-07 23:32:48 +09:00
2 changed files with 31 additions and 6 deletions

View File

@@ -48,7 +48,13 @@ type CheckboxProps = __MaterialUI.CheckboxProps;
type MuiTheme = __MaterialUI.Styles.MuiTheme;
type TouchTapEvent = __MaterialUI.TouchTapEvent;
class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedStateMixin {
interface MaterialUiTestsState {
showDialogStandardActions: boolean;
showDialogCustomActions: boolean;
showDialogScrollable: boolean;
}
class MaterialUiTests extends React.Component<{}, MaterialUiTestsState> implements React.LinkedStateMixin {
// injected with mixin
linkState: <T>(key: string) => React.ReactLink<T>;
@@ -61,6 +67,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
}
private selectFieldChangeHandler(e: TouchTapEvent, si: number, mi: any) {
}
private handleRequestClose(buttonClicked: boolean) {
}
render() {
@@ -194,7 +202,8 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
title="Dialog With Standard Actions"
actions={standardActions}
actionFocus="submit"
modal={true}>
open={this.state.showDialogStandardActions}
onRequestClose={this.handleRequestClose}>
The actions in this window are created from the json that's passed in.
</Dialog>;
@@ -213,12 +222,23 @@ class MaterialUiTests extends React.Component<{}, {}> implements React.LinkedSta
element = <Dialog
title="Dialog With Custom Actions"
actions={customActions}
modal={false}
autoDetectWindowHeight={true}
autoScrollBodyContent={true}>
open={this.state.showDialogCustomActions}
onRequestClose={this.handleRequestClose}>
The actions in this window were passed in as an array of react objects.
</Dialog>;
element = <Dialog
title="Dialog With Scrollable Content"
actions={customActions}
autoDetectWindowHeight={true}
autoScrollBodyContent={true}
open={this.state.showDialogScrollable}
onRequestClose={this.handleRequestClose}>
<div style={{ height: '1000px' }}>
Really long content
</div>
</Dialog>;
// "http://material-ui.com/#/components/dropdown-menu"
let menuItems = [

View File

@@ -1,4 +1,4 @@
// Type definitions for material-ui v0.13.1
// Type definitions for material-ui v0.13.4
// Project: https://github.com/callemall/material-ui
// Definitions by: Nathan Brown <https://github.com/ngbrown>, Oliver Herrmann <https://github.com/herrmanno>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -379,14 +379,18 @@ declare namespace __MaterialUI {
openImmediately?: boolean;
repositionOnUpdate?: boolean;
title?: React.ReactNode;
defaultOpen?: boolean;
open?: boolean;
onClickAway?: () => void;
onDismiss?: () => void;
onShow?: () => void;
onRequestClose?: (buttonClicked: boolean) => void;
}
export class Dialog extends React.Component<DialogProps, {}> {
dismiss(): void;
show(): void;
isOpen(): boolean;
}
interface DropDownIconProps extends React.Props<DropDownIcon> {
@@ -567,6 +571,7 @@ declare namespace __MaterialUI {
nestedItems?: React.ReactElement<any>[];
onKeyboardFocus?: React.FocusEventHandler;
onNestedListToggle?: (item: ListItem) => void;
onClick?: React.MouseEventHandler;
rightAvatar?: React.ReactElement<any>;
rightIcon?: React.ReactElement<any>;
rightIconButton?: React.ReactElement<any>;