x-ui-design 0.4.39 → 0.4.41
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 +29 -30
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +29 -30
- package/dist/index.js.map +1 -1
- package/lib/components/Form/Item/Item.tsx +19 -19
- package/lib/components/Form/Item/style.css +4 -3
- package/lib/components/Select/Select.tsx +14 -17
- package/package.json +1 -1
- package/src/app/page.tsx +4 -4
package/dist/index.esm.js
CHANGED
|
@@ -934,10 +934,10 @@ function flattenChildren(children) {
|
|
|
934
934
|
return result;
|
|
935
935
|
}
|
|
936
936
|
|
|
937
|
-
var css_248z$l = ".xUi-form-item{display:flex;
|
|
937
|
+
var css_248z$l = ".xUi-form-item{display:flex;position:relative}.xUi-form-item.noStyle{display:inline-flex;margin-bottom:0}.xUi-form-item-label{align-items:center;color:var(--xui-text-color);display:flex;font-size:var(--xui-font-size-md);font-weight:500;line-height:20px;margin-bottom:4px}.xUi-form-item-error{bottom:10px;color:var(--xui-error-color);display:block;font-size:var(--xui-font-size-xs);line-height:16px;min-height:16px;position:relative;right:0;user-select:none}.xUi-form-item-required{color:var(--xui-error-color);display:inline-block;font-size:var(--xui-font-size-md);line-height:1;margin-left:4px;margin-right:4px}.xUi-form-item.horizontal{align-items:center;flex-direction:row;gap:4px}.xUi-form-item.vertical{align-self:flex-start;flex-direction:column}.xUi-form-item .xUi-input-container{margin-bottom:12px!important;width:-webkit-fill-available}.xUi-form-item .xUi-datepicker-container{margin-bottom:10px}.xUi-form-item .xUi-select{margin-bottom:15px}.xUi-form-item-extra{left:0;margin-top:6px;position:absolute;right:0}";
|
|
938
938
|
styleInject(css_248z$l);
|
|
939
939
|
|
|
940
|
-
const REF_CLIENT_HEIGHT = 24;
|
|
940
|
+
// const REF_CLIENT_HEIGHT = 24;
|
|
941
941
|
const FormItem$1 = ({
|
|
942
942
|
prefixCls = prefixClsFormItem,
|
|
943
943
|
name,
|
|
@@ -992,13 +992,16 @@ const FormItem$1 = ({
|
|
|
992
992
|
}
|
|
993
993
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
994
994
|
}, [dependencies, name]);
|
|
995
|
-
useEffect(() => {
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
995
|
+
// useEffect(() => {
|
|
996
|
+
// if (
|
|
997
|
+
// errorRef.current &&
|
|
998
|
+
// errorRef.current?.clientHeight >= REF_CLIENT_HEIGHT
|
|
999
|
+
// ) {
|
|
1000
|
+
// errorRef.current.style.position = 'relative';
|
|
1001
|
+
// errorRef.current.style.marginTop = '-16px';
|
|
1002
|
+
// }
|
|
1003
|
+
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1004
|
+
// }, [errorRef.current]);
|
|
1002
1005
|
const isRequired = useMemo(() => rules.some(rule => rule.required), [rules]);
|
|
1003
1006
|
const errorMessage = getFieldError(name)?.[0];
|
|
1004
1007
|
return /*#__PURE__*/React.createElement("div", {
|
|
@@ -1041,13 +1044,13 @@ const FormItem$1 = ({
|
|
|
1041
1044
|
size: childProps.size || props.size
|
|
1042
1045
|
})), extra ? /*#__PURE__*/React.createElement("div", {
|
|
1043
1046
|
className: `${prefixCls}-extra`
|
|
1044
|
-
}, extra) : null
|
|
1047
|
+
}, extra) : null, !props.noStyle && /*#__PURE__*/React.createElement("span", {
|
|
1048
|
+
ref: errorRef,
|
|
1049
|
+
className: `${prefixCls}-error`
|
|
1050
|
+
}, errorMessage || ''));
|
|
1045
1051
|
}
|
|
1046
1052
|
return child;
|
|
1047
|
-
})
|
|
1048
|
-
ref: errorRef,
|
|
1049
|
-
className: `${prefixCls}-error`
|
|
1050
|
-
}, errorMessage));
|
|
1053
|
+
}));
|
|
1051
1054
|
};
|
|
1052
1055
|
const FormItemChildComponent = ({
|
|
1053
1056
|
child,
|
|
@@ -3217,6 +3220,7 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3217
3220
|
const selectRef = useRef(null);
|
|
3218
3221
|
const [searchInputWidth, setSearchInputWidth] = useState(0);
|
|
3219
3222
|
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
3223
|
+
const [searchFocused, setSearchFocused] = useState(false);
|
|
3220
3224
|
const [isOpenChecker, setIsOpenChecker] = useState(isOpen);
|
|
3221
3225
|
const [searchQuery, setSearchQuery] = useState(searchValue || '');
|
|
3222
3226
|
const [dropdownPosition, setDropdownPosition] = useState({});
|
|
@@ -3304,8 +3308,10 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3304
3308
|
setIsOpenChecker(isOpen);
|
|
3305
3309
|
if (!isOpen) {
|
|
3306
3310
|
setDropdownPosition({});
|
|
3311
|
+
setSearchFocused(false);
|
|
3307
3312
|
}
|
|
3308
3313
|
}, [isOpen]);
|
|
3314
|
+
useEffect(() => {}, []);
|
|
3309
3315
|
useEffect(() => {
|
|
3310
3316
|
if (!isOpen) return;
|
|
3311
3317
|
const _updateDropdownPosition = () => updateDropdownPosition();
|
|
@@ -3493,19 +3499,10 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3493
3499
|
setSearchInputWidth(searchContent.clientWidth - PADDING_TAG_INPUT);
|
|
3494
3500
|
}
|
|
3495
3501
|
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
3502
|
const searchInput = document.getElementById(`${prefixCls}-search-tag-input`);
|
|
3507
3503
|
if (searchInput) {
|
|
3508
3504
|
searchInput?.focus();
|
|
3505
|
+
setSearchFocused(true);
|
|
3509
3506
|
}
|
|
3510
3507
|
clearTimeout(timeout);
|
|
3511
3508
|
}, 0);
|
|
@@ -3637,9 +3634,9 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3637
3634
|
style: {
|
|
3638
3635
|
opacity: 0.5
|
|
3639
3636
|
}
|
|
3640
|
-
}, placeholder)) : null, isOpen ? /*#__PURE__*/React.createElement("div", {
|
|
3637
|
+
}, searchFocused ? '' : placeholder)) : null, isOpen ? /*#__PURE__*/React.createElement("div", {
|
|
3641
3638
|
className: `${prefixCls}-tag`
|
|
3642
|
-
}, /*#__PURE__*/React.createElement("div", {
|
|
3639
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
|
3643
3640
|
onClick: e => {
|
|
3644
3641
|
if (disabled) {
|
|
3645
3642
|
e.preventDefault();
|
|
@@ -3649,14 +3646,16 @@ const SelectComponent = /*#__PURE__*/forwardRef(({
|
|
|
3649
3646
|
},
|
|
3650
3647
|
onKeyDown: handleOnKeyDown,
|
|
3651
3648
|
style: {
|
|
3652
|
-
width: showSearch && !searchQuery.length ?
|
|
3649
|
+
width: showSearch && !searchQuery.length ? 1 : 'auto',
|
|
3653
3650
|
display: 'ruby',
|
|
3654
3651
|
textAlign: 'center'
|
|
3655
|
-
}
|
|
3656
|
-
|
|
3652
|
+
}
|
|
3653
|
+
}, showSearch ? {
|
|
3654
|
+
contentEditable: 'plaintext-only'
|
|
3655
|
+
} : {}, {
|
|
3657
3656
|
id: `${prefixCls}-search-tag-input`,
|
|
3658
3657
|
className: `${prefixCls}-tag-input`
|
|
3659
|
-
}), !hasMode && !searchQuery.length ? selected === '' ? placeholder : selectedOption : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
|
|
3658
|
+
})), !hasMode && !searchQuery.length ? selected === '' ? placeholder : selectedOption : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
|
|
3660
3659
|
className: `${prefixCls}-input globalEllipsis`,
|
|
3661
3660
|
style: {
|
|
3662
3661
|
opacity: isOpen ? '0.6' : '1'
|