-
-
Notifications
You must be signed in to change notification settings - Fork 229
/
Copy pathauto-close.js
77 lines (72 loc) · 1.53 KB
/
auto-close.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* eslint no-console:0 */
import React from 'react';
import Trigger from '../src';
import '../assets/index.less';
const builtinPlacements = {
left: {
points: ['cr', 'cl'],
},
right: {
points: ['cl', 'cr'],
},
top: {
points: ['bc', 'tc'],
},
bottom: {
points: ['tc', 'bc'],
},
topLeft: {
points: ['bl', 'tl'],
},
topRight: {
points: ['br', 'tr'],
},
bottomRight: {
points: ['tr', 'br'],
},
bottomLeft: {
points: ['tl', 'bl'],
},
};
const popupBorderStyle = {
border: '1px solid red',
padding: 10,
background: 'rgba(255, 0, 0, 0.1)',
};
class Test extends React.Component {
render() {
return (
<div style={{ margin: 200 }}>
<div onMouseDown={e => e.stopPropagation()}>
<Trigger
popupPlacement="right"
action={['click']}
builtinPlacements={builtinPlacements}
popup={
<div>popup content</div>
}
//effect on react 17
triggerEventListenerOption={{
capture: true
}}
>
<span>Click Me1</span>
</Trigger>
</div>
<div onMouseDown={e => e.stopPropagation()}>
<Trigger
popupPlacement="right"
action={['click']}
builtinPlacements={builtinPlacements}
popup={
<div>popup content2 </div>
}
>
<span>Click Me2</span>
</Trigger>
</div>
</div>
);
}
}
export default Test;