|
|
@ -51,12 +51,14 @@ export default class Drawer extends React.Component<
|
|
|
|
placement: PropTypes.string,
|
|
|
|
placement: PropTypes.string,
|
|
|
|
onClose: PropTypes.func,
|
|
|
|
onClose: PropTypes.func,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static defaultProps = {
|
|
|
|
static defaultProps = {
|
|
|
|
prefixCls: 'ant-drawer',
|
|
|
|
prefixCls: 'ant-drawer',
|
|
|
|
width: 256,
|
|
|
|
width: 256,
|
|
|
|
closable: true,
|
|
|
|
closable: true,
|
|
|
|
maskClosable: true,
|
|
|
|
maskClosable: true,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
close = (e: EventType) => {
|
|
|
|
close = (e: EventType) => {
|
|
|
|
if (this.props.visible !== undefined) {
|
|
|
|
if (this.props.visible !== undefined) {
|
|
|
|
if (this.props.onClose) {
|
|
|
|
if (this.props.onClose) {
|
|
|
@ -65,12 +67,14 @@ export default class Drawer extends React.Component<
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
onMaskClick = (e: EventType) => {
|
|
|
|
onMaskClick = (e: EventType) => {
|
|
|
|
if (!this.props.maskClosable) {
|
|
|
|
if (!this.props.maskClosable) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
this.close(e);
|
|
|
|
this.close(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
renderBody = () => {
|
|
|
|
renderBody = () => {
|
|
|
|
if (this.props.destroyOnClose && !this.props.visible) {
|
|
|
|
if (this.props.destroyOnClose && !this.props.visible) {
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
@ -107,6 +111,7 @@ export default class Drawer extends React.Component<
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
let { width, zIndex, style, ...rest } = this.props;
|
|
|
|
let { width, zIndex, style, ...rest } = this.props;
|
|
|
|
if (typeof width === 'number') {
|
|
|
|
if (typeof width === 'number') {
|
|
|
|