@douyinfe/semi-ui 2.5.0-beta.0 → 2.5.0
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/datePicker/_story/v2/FixInputRangeFocus.jsx +25 -0
- package/datePicker/_story/v2/index.js +2 -1
- package/datePicker/datePicker.tsx +3 -0
- package/dist/umd/semi-ui.js +66 -32
- 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/datePicker/datePicker.js +4 -0
- package/lib/cjs/select/index.d.ts +2 -2
- package/lib/cjs/select/index.js +32 -28
- package/lib/cjs/select/virtualRow.js +2 -2
- package/lib/cjs/tooltip/index.js +6 -2
- package/lib/es/datePicker/datePicker.js +4 -0
- package/lib/es/select/index.d.ts +2 -2
- package/lib/es/select/index.js +30 -26
- package/lib/es/select/virtualRow.js +2 -2
- package/lib/es/tooltip/index.js +6 -2
- package/package.json +9 -9
- package/select/index.tsx +18 -19
- package/select/virtualRow.tsx +2 -2
- package/table/_story/v2/FixedResizable/index.jsx +114 -0
- package/table/_story/v2/index.js +2 -1
- package/tooltip/__test__/tooltip.test.js +48 -4
- package/tooltip/index.tsx +4 -4
package/table/_story/v2/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as DefaultFilteredValue } from './defaultFilteredValue';
|
|
2
2
|
export { default as FixedColumnsChange } from './FixedColumnsChange';
|
|
3
3
|
export { default as FixedZIndex } from './FixedZIndex';
|
|
4
|
-
export { default as FixedHeaderMerge } from './FixedHeaderMerge';
|
|
4
|
+
export { default as FixedHeaderMerge } from './FixedHeaderMerge';
|
|
5
|
+
export { default as FixedResizable } from './FixedResizable';
|
|
@@ -72,8 +72,8 @@ describe(`Tooltip`, () => {
|
|
|
72
72
|
expect(elem.state(`visible`)).toBe(true);
|
|
73
73
|
|
|
74
74
|
// click outside
|
|
75
|
-
document.body.click();
|
|
76
|
-
|
|
75
|
+
// document.body.click();
|
|
76
|
+
document.dispatchEvent(new Event('mousedown', { bubbles: true, cancelable: true }));
|
|
77
77
|
// demo.find(`#${triggerId}`)
|
|
78
78
|
// .at(0)
|
|
79
79
|
// .simulate(`mouseDown`);
|
|
@@ -88,7 +88,8 @@ describe(`Tooltip`, () => {
|
|
|
88
88
|
// unmount elem
|
|
89
89
|
demo.unmount();
|
|
90
90
|
await sleep(100);
|
|
91
|
-
document.body.click();
|
|
91
|
+
// document.body.click();
|
|
92
|
+
document.dispatchEvent(new Event('mousedown', { bubbles: true, cancelable: true }));
|
|
92
93
|
expect(document.getElementsByClassName(`${BASE_CLASS_PREFIX}-tooltip-wrapper`).length).toBe(0);
|
|
93
94
|
});
|
|
94
95
|
|
|
@@ -165,7 +166,8 @@ describe(`Tooltip`, () => {
|
|
|
165
166
|
expect(refFn.called).toBeTruthy();
|
|
166
167
|
|
|
167
168
|
// click outside
|
|
168
|
-
document.body.click();
|
|
169
|
+
// document.body.click();
|
|
170
|
+
document.dispatchEvent(new Event('mousedown', { bubbles: true, cancelable: true }));
|
|
169
171
|
await sleep(100);
|
|
170
172
|
expect(
|
|
171
173
|
demo
|
|
@@ -290,6 +292,48 @@ describe(`Tooltip`, () => {
|
|
|
290
292
|
expect(document.querySelector(`.${BASE_CLASS_PREFIX}-tooltip-wrapper`).getAttribute('x-placement')).toBe(position);
|
|
291
293
|
}
|
|
292
294
|
});
|
|
295
|
+
|
|
296
|
+
it(`test click outside handler`, async () => {
|
|
297
|
+
const containerId = `container`;
|
|
298
|
+
|
|
299
|
+
const demo = mount(
|
|
300
|
+
<div style={{ height: 480, width: 320 }}>
|
|
301
|
+
<div id={containerId}>Hello Semi</div>
|
|
302
|
+
<Tooltip
|
|
303
|
+
content='Content'
|
|
304
|
+
trigger='click'
|
|
305
|
+
>
|
|
306
|
+
<Button >Click here</Button>
|
|
307
|
+
</Tooltip>
|
|
308
|
+
</div>
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
const toolTipElem = demo.find(Tooltip);
|
|
312
|
+
const buttonElem = demo.find(Button);
|
|
313
|
+
// click inside
|
|
314
|
+
buttonElem.simulate('click');
|
|
315
|
+
toolTipElem.update();
|
|
316
|
+
await sleep(100);
|
|
317
|
+
expect(toolTipElem.state(`visible`)).toBe(true);
|
|
318
|
+
|
|
319
|
+
// click outside
|
|
320
|
+
// document.body.click();
|
|
321
|
+
document.dispatchEvent(new Event('mousedown', { bubbles: true, cancelable: true }));
|
|
322
|
+
toolTipElem.update();
|
|
323
|
+
await sleep(100);
|
|
324
|
+
expect(toolTipElem.state('visible')).toBe(false);
|
|
325
|
+
|
|
326
|
+
// click button to show tooltip
|
|
327
|
+
buttonElem.simulate('click');
|
|
328
|
+
toolTipElem.update();
|
|
329
|
+
await sleep(100);
|
|
330
|
+
expect(toolTipElem.state('visible')).toBe(true);
|
|
331
|
+
|
|
332
|
+
document.getElementById(containerId).dispatchEvent(new Event('mousedown', { bubbles: true, cancelable: true }));
|
|
333
|
+
toolTipElem.update();
|
|
334
|
+
await sleep(100);
|
|
335
|
+
expect(toolTipElem.state('visible')).toBe(false);
|
|
336
|
+
});
|
|
293
337
|
});
|
|
294
338
|
|
|
295
339
|
it('wrapperClassName', () => {
|
package/tooltip/index.tsx
CHANGED
|
@@ -280,7 +280,7 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
280
280
|
getDocumentElementBounding: () => document.documentElement.getBoundingClientRect(),
|
|
281
281
|
setPosition: ({ position, ...style }: { position: Position }) => {
|
|
282
282
|
this.setState(
|
|
283
|
-
{
|
|
283
|
+
{
|
|
284
284
|
containerStyle: { ...this.state.containerStyle, ...style },
|
|
285
285
|
placement: position,
|
|
286
286
|
isPositionUpdated: true
|
|
@@ -326,11 +326,11 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
326
326
|
cb();
|
|
327
327
|
}
|
|
328
328
|
};
|
|
329
|
-
document.addEventListener('
|
|
329
|
+
document.addEventListener('mousedown', this.clickOutsideHandler, { capture: true });
|
|
330
330
|
},
|
|
331
331
|
unregisterClickOutsideHandler: () => {
|
|
332
332
|
if (this.clickOutsideHandler) {
|
|
333
|
-
document.removeEventListener('
|
|
333
|
+
document.removeEventListener('mousedown', this.clickOutsideHandler, { capture: true });
|
|
334
334
|
this.clickOutsideHandler = null;
|
|
335
335
|
}
|
|
336
336
|
},
|
|
@@ -661,4 +661,4 @@ export default class Tooltip extends BaseComponent<TooltipProps, TooltipState> {
|
|
|
661
661
|
}
|
|
662
662
|
}
|
|
663
663
|
|
|
664
|
-
export { Position };
|
|
664
|
+
export { Position };
|