Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
# top-most EditorConfig file
# http://editorconfig.org
root = true

# Unix-style newlines with a newline ending every file
[*.{js,css}]
end_of_line = lf
insert_final_newline = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ coverage
yarn.lock
.storybook
.doc

# umi
.umi
.umi-production
.umi-test
.env.local
17 changes: 17 additions & 0 deletions .umirc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// more config: https://d.umijs.org/config
import { defineConfig } from 'dumi';

export default defineConfig({
title: 'rc-dialog',
favicon:
'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
logo:
'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
outputPath: '.doc',
exportStatic: {},
styles: [
`a img + svg {
display: none;
}`
]
});
117 changes: 0 additions & 117 deletions README.md

This file was deleted.

1 change: 1 addition & 0 deletions README.md
36 changes: 34 additions & 2 deletions HISTORY.md → docs/changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,37 @@
# History
----
# Changelog

## 8.4.4

`2020-12-03`

- fix: dialog dont close when mouseDown in content and mouseUp in wrapper. [#210](https://github.com/react-component/dialog/pull/210)

- chore: Should not re-render when dialog is invisible. [#212](https://github.com/react-component/dialog/pull/212)


## 8.4.3

`2020-10-21`

- chore: support react 17. [#207](https://github.com/react-component/dialog/pull/207)

## 8.4.2

`2020-10-14`

- fix: Dialog should not auto destroy. [#206](https://github.com/react-component/dialog/pull/206)

## 8.4.1

`2020-10-11`

- fix: Portal event bubble. [#204](https://github.com/react-component/dialog/pull/204)

## 8.4.0

`2020-09-29`

- refactor: Use `rc-motion`. [#203](https://github.com/react-component/dialog/pull/203)

## 8.3.4 (8.2.2, 8.1.2) / 2020-09-04
- fix: prevent scroll behavior when focus trigger. [ant-design/ant-design#26582](https://github.com/ant-design/ant-design/issues/26582)
Expand Down
3 changes: 3 additions & 0 deletions docs/demo/ant-design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## ant-design

<code src="../examples/ant-design.tsx">
3 changes: 3 additions & 0 deletions docs/demo/bootstrap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## bootstrap

<code src="../examples/bootstrap.tsx">
3 changes: 3 additions & 0 deletions docs/demo/draggable.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## draggable

<code src="../examples/draggable.tsx">
3 changes: 3 additions & 0 deletions docs/demo/multiple-Portal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## multiple-Portal

<code src="../examples/multiple-Portal.tsx">
4 changes: 2 additions & 2 deletions examples/ant-design.tsx → docs/examples/ant-design.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint no-console:0 */
import '../assets/index.less';
import * as React from 'react';
import Select from 'rc-select';
import 'rc-select/assets/index.less';
import Dialog from '../src/DialogWrap';
import Dialog from 'rc-dialog';
import '../../assets/index.less';

const clearPath =
'M793 242H366v-74c0-6.7-7.7-10.4-12.9' +
Expand Down
4 changes: 2 additions & 2 deletions examples/bootstrap.tsx → docs/examples/bootstrap.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'bootstrap/dist/css/bootstrap.css';
import '../assets/bootstrap.less';
import * as React from 'react';
import Dialog from '../src/DialogWrap';
import Dialog from 'rc-dialog';
import '../../assets/index.less';

// Check for memo update should work
const InnerRender = () => {
Expand Down
4 changes: 2 additions & 2 deletions examples/draggable.tsx → docs/examples/draggable.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'bootstrap/dist/css/bootstrap.css';
import '../assets/bootstrap.less';
import * as React from 'react';
import Draggable from 'react-draggable';
import Dialog from '../src/DialogWrap';
import Dialog from 'rc-dialog';
import '../../assets/index.less';

const MyControl = () => {
const [visible, setVisible] = React.useState(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as React from 'react';
import Drawer from 'rc-drawer';
import Dialog from '../src/DialogWrap';
import 'rc-drawer/assets/index.css';
import '../assets/index.less';
import Dialog from 'rc-dialog';
import '../../assets/index.less';

const { useState } = React;

Expand Down
113 changes: 113 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# rc-dialog
---

react dialog component

[![NPM version][npm-image]][npm-url] [![build status][github-actions-image]][github-actions-url] [![Test coverage][coveralls-image]][coveralls-url] [![Dependencies][david-image]][david-url] [![DevDependencies][david-dev-image]][david-dev-url] [![npm download][download-image]][download-url] [![bundle size][bundlephobia-image]][bundlephobia-url]

[npm-image]: http://img.shields.io/npm/v/rc-dialog.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-dialog
[github-actions-image]: https://github.com/react-component/dialog/workflows/CI/badge.svg
[github-actions-url]: https://github.com/react-component/dialog/actions
[circleci-image]: https://img.shields.io/circleci/react-component/dialog/master?style=flat-square
[circleci-url]: https://circleci.com/gh/react-component/dialog
[coveralls-image]: https://img.shields.io/coveralls/react-component/dialog.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/react-component/dialog?branch=master
[david-url]: https://david-dm.org/react-component/dialog
[david-image]: https://david-dm.org/react-component/dialog/status.svg?style=flat-square
[david-dev-url]: https://david-dm.org/react-component/dialog?type=dev
[david-dev-image]: https://david-dm.org/react-component/dialog/dev-status.svg?style=flat-square
[download-image]: https://img.shields.io/npm/dm/rc-dialog.svg?style=flat-square
[download-url]: https://npmjs.org/package/rc-dialog
[bundlephobia-url]: https://bundlephobia.com/result?p=rc-dialog
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-dialog

## Screenshot

<img src="http://gtms04.alicdn.com/tps/i4/TB1dp5lHXXXXXbmXpXXyVug.FXX-664-480.png" />

## Example

http://localhost:8007/examples/

online example: http://react-component.github.io/dialog/

## Install

[![rc-dialog](https://nodei.co/npm/rc-dialog.png)](https://npmjs.org/package/rc-dialog)

## Usage

```js
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 | |
| style | Object | {} | Root style for dialog element.Such as width, height | |
| zIndex | Number | | | |
| bodyStyle | Object | {} | body style for dialog body element.Such as height | |
| maskStyle | Object | {} | style for mask element | |
| 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 | 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.
3 changes: 3 additions & 0 deletions now.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"use": "@now/static-build",
"config": { "distDir": ".doc" }
}
],
"routes": [
{ "src": "/(.*)", "dest": "/dist/$1" }
]
}
Loading