x-ui-design 0.4.39 → 0.4.40
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/index.esm.js +12 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +12 -16
- package/dist/index.js.map +1 -1
- package/lib/components/Select/Select.tsx +14 -17
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -3217,6 +3217,7 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3217
3217
|
const selectRef = useRef(null);
|
|
3218
3218
|
const [searchInputWidth, setSearchInputWidth] = useState(0);
|
|
3219
3219
|
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
3220
|
+
const [searchFocused, setSearchFocused] = useState(false);
|
|
3220
3221
|
const [isOpenChecker, setIsOpenChecker] = useState(isOpen);
|
|
3221
3222
|
const [searchQuery, setSearchQuery] = useState(searchValue || '');
|
|
3222
3223
|
const [dropdownPosition, setDropdownPosition] = useState({});
|
|
@@ -3304,8 +3305,10 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3304
3305
|
setIsOpenChecker(isOpen);
|
|
3305
3306
|
if (!isOpen) {
|
|
3306
3307
|
setDropdownPosition({});
|
|
3308
|
+
setSearchFocused(false);
|
|
3307
3309
|
}
|
|
3308
3310
|
}, [isOpen]);
|
|
3311
|
+
useEffect(() => {}, []);
|
|
3309
3312
|
useEffect(() => {
|
|
3310
3313
|
if (!isOpen) return;
|
|
3311
3314
|
const _updateDropdownPosition = () => updateDropdownPosition();
|
|
@@ -3493,19 +3496,10 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3493
3496
|
setSearchInputWidth(searchContent.clientWidth - PADDING_TAG_INPUT);
|
|
3494
3497
|
}
|
|
3495
3498
|
const timeout = setTimeout(() => {
|
|
3496
|
-
// if (!hasMode) {
|
|
3497
|
-
// const selectedOption = selectRef.current?.getElementsByClassName('selected')[0];
|
|
3498
|
-
// if (selectedOption) {
|
|
3499
|
-
// const selectedOptionTop: number = selectRef.current?.getElementsByClassName('selected')[0].getBoundingClientRect()?.top || 0;
|
|
3500
|
-
// selectRef.current?.getElementsByClassName(`${prefixCls}-options`)[0]?.scrollTo({
|
|
3501
|
-
// top: selectedOptionTop - selectedOption.clientHeight - PADDING_PLACEMENT - PADDING_TAG_INPUT,
|
|
3502
|
-
// behavior: 'smooth'
|
|
3503
|
-
// })
|
|
3504
|
-
// }
|
|
3505
|
-
// }
|
|
3506
3499
|
const searchInput = document.getElementById(`${prefixCls}-search-tag-input`);
|
|
3507
3500
|
if (searchInput) {
|
|
3508
3501
|
searchInput?.focus();
|
|
3502
|
+
setSearchFocused(true);
|
|
3509
3503
|
}
|
|
3510
3504
|
clearTimeout(timeout);
|
|
3511
3505
|
}, 0);
|
|
@@ -3637,9 +3631,9 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3637
3631
|
style: {
|
|
3638
3632
|
opacity: 0.5
|
|
3639
3633
|
}
|
|
3640
|
-
}, placeholder)) : null, isOpen ? /*#__PURE__*/React.createElement("div", {
|
|
3634
|
+
}, searchFocused ? '' : placeholder)) : null, isOpen ? /*#__PURE__*/React.createElement("div", {
|
|
3641
3635
|
className: `${prefixCls}-tag`
|
|
3642
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
3636
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
3643
3637
|
onClick: e => {
|
|
3644
3638
|
if (disabled) {
|
|
3645
3639
|
e.preventDefault();
|
|
@@ -3649,14 +3643,16 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3649
3643
|
},
|
|
3650
3644
|
onKeyDown: handleOnKeyDown,
|
|
3651
3645
|
style: {
|
|
3652
|
-
width: showSearch && !searchQuery.length ?
|
|
3646
|
+
width: showSearch && !searchQuery.length ? 1 : 'auto',
|
|
3653
3647
|
display: 'ruby',
|
|
3654
3648
|
textAlign: 'center'
|
|
3655
|
-
}
|
|
3656
|
-
|
|
3649
|
+
}
|
|
3650
|
+
}, showSearch ? {
|
|
3651
|
+
contentEditable: 'plaintext-only'
|
|
3652
|
+
} : {}, {
|
|
3657
3653
|
id: `${prefixCls}-search-tag-input`,
|
|
3658
3654
|
className: `${prefixCls}-tag-input`
|
|
3659
|
-
}), !hasMode && !searchQuery.length ? selected === '' ? placeholder : selectedOption : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
|
|
3655
|
+
})), !hasMode && !searchQuery.length ? selected === '' ? placeholder : selectedOption : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
|
|
3660
3656
|
className: `${prefixCls}-input globalEllipsis`,
|
|
3661
3657
|
style: {
|
|
3662
3658
|
opacity: isOpen ? '0.6' : '1'
|