包详细信息

rc-dialog

react-component7.2mMIT10.0.0

dialog ui component for react

react, react-component, react-dialog, dialog

自述文件

rc-dialog

react dialog component

NPM version dumi build status Test coverage npm download bundle size

Screenshot

Example

http://localhost:8007/examples/

online example: https://dialog.react-component.vercel.app/

Install

rc-dialog

Usage

var Dialog = require('rc-dialog');

ReactDOM.render(
  <Dialog title={title} onClose={callback1} visible>
      <p>first dialog</p>
  </Dialog>
), document.getElementById('t1'));

// use dialog

API

rc-dialog

Name Type Default Description Version
prefixCls String rc-dialog The dialog dom node's prefixCls
className String additional className for dialog
classNames { header?: string; body?: string; footer?: string; mask?: string; content?: string; wrapper?: string; } pass className to target area
styles { header?: CSSProperties; body?: CSSProperties; footer?: CSSProperties; mask?: CSSProperties; content?: CSSProperties; wrapper?: CSSProperties; } pass styles to target area
style Object {} Root style for dialog element.Such as width, height
zIndex Number
visible Boolean false current dialog's visible status
animation String part of dialog animation css class name
maskAnimation String part of dialog's mask animation css class name
transitionName String dialog animation css class name
maskTransitionName String mask animation css class name
title String\ React.Element Title of the dialog
footer React.Element footer of the dialog
closable Boolean \ ({ closeIcon?: React.ReactNode; disabled?: boolean } & React.AriaAttributes true whether show close button
mask Boolean true whether show mask
maskClosable Boolean true whether click mask to close
keyboard Boolean true whether support press esc to close
mousePosition {x:number,y:number} set pageX and pageY of current mouse(it will cause transform origin to be set).
onClose function() called when click close button or mask
afterClose function() called when close animation end
getContainer function(): HTMLElement to determine where Dialog will be mounted
destroyOnClose Boolean false to unmount child compenents on onClose
closeIcon ReactNode specific the close icon.
forceRender Boolean false Create dialog dom node before dialog first show
focusTriggerAfterClose Boolean true focus trigger element when dialog closed
modalRender (node: ReactNode) => ReactNode Custom modal content render 8.3.0

Development

npm install
npm start

Test Case

npm test
npm run chrome-test

Coverage

npm run coverage

open coverage/ dir

License

rc-dialog is released under the MIT license.

更新日志

Changelog

8.5.1

2021-01-07

  • improve: ScrollLocker call related. #227

8.5.0

2021-01-04

  • refactor: use ScrollLocker. #220

8.4.6

2020-12-19

  • fix: trigger close only when click wrap itself. #218

8.4.5

2020-12-07

  • fix: Dialog should keep refresh when forceRender provided. #217

8.4.4

2020-12-03

  • fix: dialog dont close when mouseDown in content and mouseUp in wrapper. #210

  • chore: Should not re-render when dialog is invisible. #212

8.4.3

2020-10-21

  • chore: support react 17. #207

8.4.2

2020-10-14

  • fix: Dialog should not auto destroy. #206

8.4.1

2020-10-11

  • fix: Portal event bubble. #204

8.4.0

2020-09-29

  • refactor: Use rc-motion. #203

8.3.4 (8.2.2, 8.1.2) / 2020-09-04

8.3.3 / 2020-09-02

  • fix: page scroll position will jump after dialog is closed. #202

8.3.2 / 2020-09-02

  • fix: remove typing from package.json. #201

8.3.1 / 2020-09-02

  • fix: add displayName. #200

8.3.0 / 2020-08-31

  • fate: add modalRender. #195

8.2.0 / 2020-08-27

8.1.1 / 2020-08-19

  • Fix dialog component will only show mask, if initialize a Dialog component with both forceRender and visible are true. #194

8.1.0 / 2020-07-09

  • remove babel runtime.
  • up rc-drawer to 4.1.0.

8.0.0 / 2020-05-29

  • upgrade rc-util to 5.0.0.

7.7.0 / 2020-05-05

  • upgrade rc-animate to 3.0.0.

7.4.0 / 2019-05-10

  • Update accessibility.

7.3.0 / 2018-12-06

  • Support forceRender for dialog.

7.2.0 / 2018-07-30

7.1.0 / 2017-12-28

7.0.0 / 2017-11-02

Notable change: Close animation won't trigger when dialog unmounting after React 16, see facebook/react#10826

6.5.11 / 2017-8-21

6.5.0 / 2016-10-25

  • remove rc-dialog/lib/Modal's entry prop, add animationType prop

6.4.0 / 2016-09-19

  • add rc-dialog/lib/Modal to support react-native

6.2.0 / 2016-07-18

  • use getContainerRenderMixin from 'rc-util'

6.0.0 / 2016-03-18

  • new html structure and class
  • disable window scroll when show

5.4.0 / 2016-02-27

  • add maskClosable

5.3.0 / 2015-11-23

  • separate close and header

5.1.0 / 2015-10-20

  • only support react 0.14

5.0.0 / 2015-08-17

  • refactor to clean api. remove onShow onBeforeClose

4.5.0 / 2015-07-23

use rc-animate & rc-align

4.4.0 / 2015-07-03

support esc to close

4.2.0 / 2015-06-09

add renderToBody props

4.0.0 / 2015-04-28

make dialog render to body and use dom-align to align

3.0.0 / 2015-03-17

support es6 and react 0.13

2.1.0 / 2015-03-05

new #3 support closable requestClose onBeforeClose