@douyinfe/semi-ui 2.10.0 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/umd/semi-ui.js +9 -6
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/tooltip/index.d.ts +1 -0
- package/lib/cjs/tooltip/index.js +9 -6
- package/lib/es/tooltip/index.d.ts +1 -0
- package/lib/es/tooltip/index.js +9 -6
- package/package.json +9 -9
- package/popover/_story/popover.stories.js +38 -2
- package/tooltip/index.tsx +9 -2
|
@@ -164,6 +164,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
164
164
|
componentDidUpdate(prevProps: TooltipProps, prevState: TooltipState): void;
|
|
165
165
|
renderIcon: () => any;
|
|
166
166
|
handlePortalInnerClick: (e: React.MouseEvent) => void;
|
|
167
|
+
handlePortalMouseDown: (e: React.MouseEvent) => void;
|
|
167
168
|
handlePortalInnerKeyDown: (e: React.KeyboardEvent) => void;
|
|
168
169
|
renderContentNode: (content: TooltipProps['content']) => React.ReactNode;
|
|
169
170
|
renderPortal: () => JSX.Element;
|
package/lib/cjs/tooltip/index.js
CHANGED
|
@@ -187,6 +187,12 @@ class Tooltip extends _baseComponent.default {
|
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
+
this.handlePortalMouseDown = e => {
|
|
191
|
+
if (this.props.stopPropagation) {
|
|
192
|
+
(0, _utils.stopPropagation)(e);
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
|
|
190
196
|
this.handlePortalInnerKeyDown = e => {
|
|
191
197
|
this.foundation.handleContainerKeydown(e);
|
|
192
198
|
};
|
|
@@ -271,6 +277,7 @@ class Tooltip extends _baseComponent.default {
|
|
|
271
277
|
style: portalInnerStyle,
|
|
272
278
|
ref: this.setContainerEl,
|
|
273
279
|
onClick: this.handlePortalInnerClick,
|
|
280
|
+
onMouseDown: this.handlePortalMouseDown,
|
|
274
281
|
onKeyDown: this.handlePortalInnerKeyDown
|
|
275
282
|
}, inner));
|
|
276
283
|
};
|
|
@@ -498,15 +505,11 @@ class Tooltip extends _baseComponent.default {
|
|
|
498
505
|
}
|
|
499
506
|
};
|
|
500
507
|
|
|
501
|
-
|
|
502
|
-
capture: true
|
|
503
|
-
});
|
|
508
|
+
window.addEventListener('mousedown', this.clickOutsideHandler);
|
|
504
509
|
},
|
|
505
510
|
unregisterClickOutsideHandler: () => {
|
|
506
511
|
if (this.clickOutsideHandler) {
|
|
507
|
-
|
|
508
|
-
capture: true
|
|
509
|
-
});
|
|
512
|
+
window.removeEventListener('mousedown', this.clickOutsideHandler);
|
|
510
513
|
this.clickOutsideHandler = null;
|
|
511
514
|
}
|
|
512
515
|
},
|
|
@@ -164,6 +164,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
164
164
|
componentDidUpdate(prevProps: TooltipProps, prevState: TooltipState): void;
|
|
165
165
|
renderIcon: () => any;
|
|
166
166
|
handlePortalInnerClick: (e: React.MouseEvent) => void;
|
|
167
|
+
handlePortalMouseDown: (e: React.MouseEvent) => void;
|
|
167
168
|
handlePortalInnerKeyDown: (e: React.KeyboardEvent) => void;
|
|
168
169
|
renderContentNode: (content: TooltipProps['content']) => React.ReactNode;
|
|
169
170
|
renderPortal: () => JSX.Element;
|
package/lib/es/tooltip/index.js
CHANGED
|
@@ -138,6 +138,12 @@ export default class Tooltip extends BaseComponent {
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
+
this.handlePortalMouseDown = e => {
|
|
142
|
+
if (this.props.stopPropagation) {
|
|
143
|
+
stopPropagation(e);
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
|
|
141
147
|
this.handlePortalInnerKeyDown = e => {
|
|
142
148
|
this.foundation.handleContainerKeydown(e);
|
|
143
149
|
};
|
|
@@ -225,6 +231,7 @@ export default class Tooltip extends BaseComponent {
|
|
|
225
231
|
style: portalInnerStyle,
|
|
226
232
|
ref: this.setContainerEl,
|
|
227
233
|
onClick: this.handlePortalInnerClick,
|
|
234
|
+
onMouseDown: this.handlePortalMouseDown,
|
|
228
235
|
onKeyDown: this.handlePortalInnerKeyDown
|
|
229
236
|
}, inner));
|
|
230
237
|
};
|
|
@@ -457,15 +464,11 @@ export default class Tooltip extends BaseComponent {
|
|
|
457
464
|
}
|
|
458
465
|
};
|
|
459
466
|
|
|
460
|
-
|
|
461
|
-
capture: true
|
|
462
|
-
});
|
|
467
|
+
window.addEventListener('mousedown', this.clickOutsideHandler);
|
|
463
468
|
},
|
|
464
469
|
unregisterClickOutsideHandler: () => {
|
|
465
470
|
if (this.clickOutsideHandler) {
|
|
466
|
-
|
|
467
|
-
capture: true
|
|
468
|
-
});
|
|
471
|
+
window.removeEventListener('mousedown', this.clickOutsideHandler);
|
|
469
472
|
this.clickOutsideHandler = null;
|
|
470
473
|
}
|
|
471
474
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-ui",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es/index.js",
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
17
|
-
"@douyinfe/semi-animation": "2.10.
|
|
18
|
-
"@douyinfe/semi-animation-react": "2.10.
|
|
19
|
-
"@douyinfe/semi-foundation": "2.10.
|
|
20
|
-
"@douyinfe/semi-icons": "2.10.
|
|
21
|
-
"@douyinfe/semi-illustrations": "2.10.
|
|
22
|
-
"@douyinfe/semi-theme-default": "2.10.
|
|
17
|
+
"@douyinfe/semi-animation": "2.10.1",
|
|
18
|
+
"@douyinfe/semi-animation-react": "2.10.1",
|
|
19
|
+
"@douyinfe/semi-foundation": "2.10.1",
|
|
20
|
+
"@douyinfe/semi-icons": "2.10.1",
|
|
21
|
+
"@douyinfe/semi-illustrations": "2.10.1",
|
|
22
|
+
"@douyinfe/semi-theme-default": "2.10.1",
|
|
23
23
|
"@types/react-window": "^1.8.2",
|
|
24
24
|
"async-validator": "^3.5.0",
|
|
25
25
|
"classnames": "^2.2.6",
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
],
|
|
70
70
|
"author": "",
|
|
71
71
|
"license": "MIT",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "1c84b585ff43db35b286e8c24f8333e4170d015c",
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
75
75
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
|
76
76
|
"@babel/preset-env": "^7.15.8",
|
|
77
77
|
"@babel/preset-react": "^7.14.5",
|
|
78
|
-
"@douyinfe/semi-scss-compile": "2.10.
|
|
78
|
+
"@douyinfe/semi-scss-compile": "2.10.1",
|
|
79
79
|
"@storybook/addon-knobs": "^6.3.1",
|
|
80
80
|
"@types/lodash": "^4.14.176",
|
|
81
81
|
"babel-loader": "^8.2.2",
|
|
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import Popover from '../index';
|
|
4
4
|
import { strings } from '@douyinfe/semi-foundation/tooltip/constants';
|
|
5
|
-
import { Button, Input, Table, IconButton, Modal, Tag, Space } from '@douyinfe/semi-ui';
|
|
5
|
+
import { Button, Input, Table, IconButton, Modal, Tag, Space, Select } from '@douyinfe/semi-ui';
|
|
6
6
|
import SelectInPopover from './SelectInPopover';
|
|
7
7
|
import BtnClose from './BtnClose';
|
|
8
8
|
import PopRight from './PopRight';
|
|
@@ -10,6 +10,8 @@ import NestedPopover from './NestedPopover';
|
|
|
10
10
|
import ArrowPointAtCenter from './ArrowPointAtCenter';
|
|
11
11
|
import { IconDelete } from '@douyinfe/semi-icons';
|
|
12
12
|
|
|
13
|
+
const Option = Select.Option;
|
|
14
|
+
|
|
13
15
|
export default {
|
|
14
16
|
title: 'Popover',
|
|
15
17
|
parameters: {
|
|
@@ -645,4 +647,38 @@ export const A11yKeyboard = () => {
|
|
|
645
647
|
</div>
|
|
646
648
|
);
|
|
647
649
|
};
|
|
648
|
-
A11yKeyboard.storyName = "a11y keyboard and focus";
|
|
650
|
+
A11yKeyboard.storyName = "a11y keyboard and focus";
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* fix 嵌套 popover 的弹出层会导致外部 popover 关闭问题
|
|
654
|
+
*
|
|
655
|
+
* @see https://github.com/DouyinFE/semi-design/issues/818
|
|
656
|
+
* @see https://github.com/facebook/react/issues/4335#issuecomment-421705171
|
|
657
|
+
*/
|
|
658
|
+
export const FixNestedPopover = () => {
|
|
659
|
+
return (
|
|
660
|
+
<div data-cy="fix-nested-popover" style={{ paddingLeft: 100 }}>
|
|
661
|
+
<Popover
|
|
662
|
+
content={(
|
|
663
|
+
<div data-cy="select-in-popover" style={{ padding: 20 }}>
|
|
664
|
+
<Select
|
|
665
|
+
defaultValue="abc"
|
|
666
|
+
style={{ width: 120 }}
|
|
667
|
+
>
|
|
668
|
+
<Option value="abc">抖音</Option>
|
|
669
|
+
<Option value="hotsoon">火山</Option>
|
|
670
|
+
<Option value="pipixia" disabled>
|
|
671
|
+
皮皮虾
|
|
672
|
+
</Option>
|
|
673
|
+
<Option value="xigua">西瓜视频</Option>
|
|
674
|
+
</Select>
|
|
675
|
+
</div>
|
|
676
|
+
)}
|
|
677
|
+
trigger="click"
|
|
678
|
+
showArrow
|
|
679
|
+
>
|
|
680
|
+
<Tag>点击此处</Tag>
|
|
681
|
+
</Popover>
|
|
682
|
+
</div>
|
|
683
|
+
);
|
|
684
|
+
}
|
package/tooltip/index.tsx
CHANGED
|
@@ -343,11 +343,11 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
343
343
|
cb();
|
|
344
344
|
}
|
|
345
345
|
};
|
|
346
|
-
|
|
346
|
+
window.addEventListener('mousedown', this.clickOutsideHandler);
|
|
347
347
|
},
|
|
348
348
|
unregisterClickOutsideHandler: () => {
|
|
349
349
|
if (this.clickOutsideHandler) {
|
|
350
|
-
|
|
350
|
+
window.removeEventListener('mousedown', this.clickOutsideHandler);
|
|
351
351
|
this.clickOutsideHandler = null;
|
|
352
352
|
}
|
|
353
353
|
},
|
|
@@ -528,6 +528,12 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
528
528
|
}
|
|
529
529
|
};
|
|
530
530
|
|
|
531
|
+
handlePortalMouseDown = (e: React.MouseEvent) => {
|
|
532
|
+
if (this.props.stopPropagation) {
|
|
533
|
+
stopPropagation(e);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
531
537
|
handlePortalInnerKeyDown = (e: React.KeyboardEvent) => {
|
|
532
538
|
this.foundation.handleContainerKeydown(e);
|
|
533
539
|
}
|
|
@@ -595,6 +601,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
595
601
|
style={portalInnerStyle}
|
|
596
602
|
ref={this.setContainerEl}
|
|
597
603
|
onClick={this.handlePortalInnerClick}
|
|
604
|
+
onMouseDown={this.handlePortalMouseDown}
|
|
598
605
|
onKeyDown={this.handlePortalInnerKeyDown}
|
|
599
606
|
>
|
|
600
607
|
{inner}
|