@douyinfe/semi-ui 2.38.0 → 2.38.2-alpha.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 +31 -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/autoComplete/index.js +19 -0
- package/lib/cjs/datePicker/dateInput.d.ts +1 -1
- package/lib/cjs/datePicker/datePicker.d.ts +1 -1
- package/lib/cjs/datePicker/monthsGrid.d.ts +1 -1
- package/lib/cjs/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/modal/confirm.d.ts +15 -15
- package/lib/es/autoComplete/index.js +19 -0
- package/lib/es/datePicker/dateInput.d.ts +1 -1
- package/lib/es/datePicker/datePicker.d.ts +1 -1
- package/lib/es/datePicker/monthsGrid.d.ts +1 -1
- package/lib/es/datePicker/yearAndMonth.d.ts +1 -1
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/modal/confirm.d.ts +15 -15
- package/package.json +8 -8
package/dist/umd/semi-ui.js
CHANGED
|
@@ -17854,9 +17854,14 @@ class AnchorFoundation extends foundation {
|
|
|
17854
17854
|
*/
|
|
17855
17855
|
behavior: actions => {
|
|
17856
17856
|
// We just need to scroll the innermost target container
|
|
17857
|
-
const
|
|
17858
|
-
|
|
17859
|
-
|
|
17857
|
+
const verticalScrollAction = actions.find(action => {
|
|
17858
|
+
const {
|
|
17859
|
+
el
|
|
17860
|
+
} = action;
|
|
17861
|
+
return el.scrollHeight > el.clientHeight;
|
|
17862
|
+
});
|
|
17863
|
+
const el = get_default()(verticalScrollAction, 'el');
|
|
17864
|
+
const top = get_default()(verticalScrollAction, 'top');
|
|
17860
17865
|
if (el) {
|
|
17861
17866
|
const offsetTop = top - targetOffset;
|
|
17862
17867
|
if (el.scroll && canSmoothScroll) {
|
|
@@ -26676,9 +26681,10 @@ class AutoCompleteFoundation extends foundation {
|
|
|
26676
26681
|
}
|
|
26677
26682
|
}
|
|
26678
26683
|
destroy() {
|
|
26679
|
-
|
|
26684
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
26680
26685
|
// this.unBindKeyBoardEvent();
|
|
26681
26686
|
}
|
|
26687
|
+
|
|
26682
26688
|
_setDropdownWidth() {
|
|
26683
26689
|
const {
|
|
26684
26690
|
style,
|
|
@@ -26715,14 +26721,14 @@ class AutoCompleteFoundation extends foundation {
|
|
|
26715
26721
|
this.isPanelOpen = true;
|
|
26716
26722
|
this._adapter.toggleListVisible(true);
|
|
26717
26723
|
this._setDropdownWidth();
|
|
26718
|
-
|
|
26724
|
+
this._adapter.registerClickOutsideHandler(e => this.closeDropdown(e));
|
|
26719
26725
|
this._adapter.notifyDropdownVisibleChange(true);
|
|
26720
26726
|
this._modifyFocusIndexOnPanelOpen();
|
|
26721
26727
|
}
|
|
26722
26728
|
closeDropdown(e) {
|
|
26723
26729
|
this.isPanelOpen = false;
|
|
26724
26730
|
this._adapter.toggleListVisible(false);
|
|
26725
|
-
|
|
26731
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
26726
26732
|
this._adapter.notifyDropdownVisibleChange(false);
|
|
26727
26733
|
// After closing the panel, you can still open the panel by pressing the enter key
|
|
26728
26734
|
// this.unBindKeyBoardEvent();
|
|
@@ -28306,6 +28312,7 @@ var autoComplete = __webpack_require__("PyaV");
|
|
|
28306
28312
|
|
|
28307
28313
|
|
|
28308
28314
|
|
|
28315
|
+
|
|
28309
28316
|
const autoComplete_prefixCls = autoComplete_constants_cssClasses.PREFIX;
|
|
28310
28317
|
const autoComplete_sizeSet = autoComplete_constants_strings.SIZE;
|
|
28311
28318
|
const autoComplete_positionSet = autoComplete_constants_strings.POSITION;
|
|
@@ -28430,6 +28437,24 @@ class AutoComplete extends BaseComponent {
|
|
|
28430
28437
|
this.setState({
|
|
28431
28438
|
rePosKey
|
|
28432
28439
|
});
|
|
28440
|
+
},
|
|
28441
|
+
registerClickOutsideHandler: cb => {
|
|
28442
|
+
const clickOutsideHandler = e => {
|
|
28443
|
+
const optionInstance = this.optionsRef && this.optionsRef.current;
|
|
28444
|
+
const triggerDom = this.triggerRef && this.triggerRef.current;
|
|
28445
|
+
const optionsDom = external_root_ReactDOM_commonjs2_react_dom_commonjs_react_dom_amd_react_dom_default().findDOMNode(optionInstance);
|
|
28446
|
+
const target = e.target;
|
|
28447
|
+
if (optionsDom && (!optionsDom.contains(target) || !optionsDom.contains(target.parentNode)) && triggerDom && !triggerDom.contains(target)) {
|
|
28448
|
+
cb(e);
|
|
28449
|
+
}
|
|
28450
|
+
};
|
|
28451
|
+
this.clickOutsideHandler = clickOutsideHandler;
|
|
28452
|
+
document.addEventListener('mousedown', clickOutsideHandler, false);
|
|
28453
|
+
},
|
|
28454
|
+
unregisterClickOutsideHandler: () => {
|
|
28455
|
+
if (this.clickOutsideHandler) {
|
|
28456
|
+
document.removeEventListener('mousedown', this.clickOutsideHandler, false);
|
|
28457
|
+
}
|
|
28433
28458
|
}
|
|
28434
28459
|
});
|
|
28435
28460
|
}
|