Skip to content
Open
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,12 @@ ReactDOM.render((
<td></td>
<td>Let popup div stretch with trigger element. enums of 'width', 'minWidth', 'height', 'minHeight'. (You can also mixed with 'height minWidth')</td>
</tr>
<tr>
<td>ignoreVisibilityChangeClassName</td>
<td>string</td>
<td></td>
<td>Ignore the pop visibility change to false when the target has the `ignoreVisibilityChangeClassName`</td>
</tr>
</tbody>
</table>

Expand Down
12 changes: 11 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ export default class Trigger extends React.Component {
maskAnimation: PropTypes.string,
stretch: PropTypes.string,
alignPoint: PropTypes.bool, // Maybe we can support user pass position in the future
ignoreVisibilityChangeClassName: PropTypes.string,
};

static contextTypes = contextTypes;
Expand Down Expand Up @@ -105,6 +106,7 @@ export default class Trigger extends React.Component {
action: [],
showAction: [],
hideAction: [],
ignoreVisibilityChangeClassName: '',
};

constructor(props) {
Expand Down Expand Up @@ -326,8 +328,16 @@ export default class Trigger extends React.Component {
if (this.props.mask && !this.props.maskClosable) {
return;
}

const { ignoreVisibilityChangeClassName } = this.props;
const target = event.target;
if (
ignoreVisibilityChangeClassName &&
typeof target.className === 'string' &&
target.className.split(' ').filter(className => className === ignoreVisibilityChangeClassName)
.length > 0
) {
return;
}
const root = findDOMNode(this);
if (!contains(root, target) && !this.hasPopupMouseDown) {
this.close();
Expand Down