x-ui-design 1.0.8 → 1.0.10-beta.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/.github/workflows/x-ui-design.yml +2 -2
- package/compile.sh +1 -1
- package/dist/index.esm.js +25 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +25 -8
- package/dist/index.js.map +1 -1
- package/lib/components/Select/Select.tsx +3 -3
- package/package.json +1 -1
package/compile.sh
CHANGED
package/dist/index.esm.js
CHANGED
|
@@ -4191,7 +4191,8 @@ const Option = ({
|
|
|
4191
4191
|
disabled: disabled
|
|
4192
4192
|
}]),
|
|
4193
4193
|
style: style,
|
|
4194
|
-
onClick: handleClick
|
|
4194
|
+
onClick: handleClick,
|
|
4195
|
+
"data-testid": value || children
|
|
4195
4196
|
}, title ? {
|
|
4196
4197
|
title
|
|
4197
4198
|
} : {}), render ? render(value) : children || value);
|
|
@@ -4628,11 +4629,12 @@ const Select = ({
|
|
|
4628
4629
|
};
|
|
4629
4630
|
const selectedOption = useMemo(() => {
|
|
4630
4631
|
const option = extractedOptions.find(e => e.value === selected || e.label === selected || e.children === selected) || selected;
|
|
4632
|
+
const title = typeof option === 'string' ? option : option?.children || option?.label || option?.value || null;
|
|
4631
4633
|
return /*#__PURE__*/React.createElement("div", {
|
|
4632
4634
|
style: {
|
|
4633
4635
|
display: 'contents'
|
|
4634
4636
|
}
|
|
4635
|
-
},
|
|
4637
|
+
}, title);
|
|
4636
4638
|
}, [extractedOptions, selected]) || selected || null;
|
|
4637
4639
|
const hasMaxTagCount = hasMode && (typeof maxTagCount === 'number' || maxTagCount === 'responsive');
|
|
4638
4640
|
const container = tagtriggerRef.current;
|
|
@@ -4699,7 +4701,8 @@ const Select = ({
|
|
|
4699
4701
|
[`${prefixCls}-tag-container-fixHeight ${prefixClsV3}-tag-container-fixHeight`]: !tagtriggerRef.current
|
|
4700
4702
|
}])
|
|
4701
4703
|
}, hasMode ? /*#__PURE__*/React.createElement(React.Fragment, null, selectedTags.length ? /*#__PURE__*/React.createElement(React.Fragment, null, tagsToDisplay.map((tag, index) => tagRender ? /*#__PURE__*/React.createElement("div", {
|
|
4702
|
-
key: `${index}_${tag}
|
|
4704
|
+
key: `${index}_${tag}`,
|
|
4705
|
+
"data-testid": tag
|
|
4703
4706
|
}, tagRender?.({
|
|
4704
4707
|
label: (() => {
|
|
4705
4708
|
const option = extractedOptions.find(e => e.value === tag || e.label === tag || e.children === tag);
|
|
@@ -4747,18 +4750,30 @@ const Select = ({
|
|
|
4747
4750
|
} : {}, {
|
|
4748
4751
|
id: `${prefixCls}-search-tag-input`,
|
|
4749
4752
|
className: `${prefixCls}-tag-input`
|
|
4750
|
-
})), !hasMode && !searchQuery.length ? selected === '' ?
|
|
4753
|
+
})), !hasMode && !searchQuery.length ? selected === '' ? /*#__PURE__*/React.createElement("div", {
|
|
4754
|
+
style: {
|
|
4755
|
+
display: 'contents'
|
|
4756
|
+
}
|
|
4757
|
+
}, placeholder) : selectedOption : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
|
|
4751
4758
|
className: `${prefixCls}-input ${prefixClsV3}-input globalEllipsis`,
|
|
4752
4759
|
style: {
|
|
4753
4760
|
opacity: isOpen || selected === '' ? '0.6' : '1'
|
|
4754
4761
|
}
|
|
4755
|
-
}, selected === '' ?
|
|
4762
|
+
}, selected === '' ? /*#__PURE__*/React.createElement("div", {
|
|
4763
|
+
style: {
|
|
4764
|
+
display: 'contents'
|
|
4765
|
+
}
|
|
4766
|
+
}, placeholder) : selectedOption) : null) : !hasMode ? /*#__PURE__*/React.createElement("div", {
|
|
4756
4767
|
className: `${prefixCls}-input ${prefixClsV3}-input globalEllipsis`,
|
|
4757
4768
|
onClick: () => !disabled && setIsOpen(!isOpen || defaultOpen),
|
|
4758
4769
|
style: {
|
|
4759
4770
|
opacity: isOpen || selected === '' ? '0.6' : '1'
|
|
4760
4771
|
}
|
|
4761
|
-
}, selected === '' ?
|
|
4772
|
+
}, selected === '' ? /*#__PURE__*/React.createElement("div", {
|
|
4773
|
+
style: {
|
|
4774
|
+
display: 'contents'
|
|
4775
|
+
}
|
|
4776
|
+
}, placeholder) : selectedOption) : null, isHover && !loading ? allowClear && selected ? /*#__PURE__*/React.createElement("button", {
|
|
4762
4777
|
className: `${prefixCls}-clear-btn ${prefixClsV3}-clear-btn`,
|
|
4763
4778
|
onClick: handleClear
|
|
4764
4779
|
}, removeIcon || /*#__PURE__*/React.createElement(ClearIcon, null)) : /*#__PURE__*/React.createElement("span", {
|
|
@@ -4809,7 +4824,8 @@ const Select = ({
|
|
|
4809
4824
|
onClick: e => {
|
|
4810
4825
|
handleSelect(e, searchQuery);
|
|
4811
4826
|
},
|
|
4812
|
-
"data-value": searchQuery
|
|
4827
|
+
"data-value": searchQuery,
|
|
4828
|
+
"data-testid": searchQuery
|
|
4813
4829
|
}, searchQuery), filteredOptions.length ? filteredOptions.map(({
|
|
4814
4830
|
children,
|
|
4815
4831
|
className = '',
|
|
@@ -4835,7 +4851,8 @@ const Select = ({
|
|
|
4835
4851
|
key: `${index}`
|
|
4836
4852
|
});
|
|
4837
4853
|
},
|
|
4838
|
-
"data-value": props.value
|
|
4854
|
+
"data-value": props.value,
|
|
4855
|
+
"data-testid": props.value
|
|
4839
4856
|
}), children || props.label || props.value, menuItemSelectedIcon && hasMode && isSelected && /*#__PURE__*/React.createElement("span", {
|
|
4840
4857
|
className: `${prefixCls}-selected-icon ${prefixClsV3}-selected-icon`
|
|
4841
4858
|
}, menuItemSelectedIcon === true ? /*#__PURE__*/React.createElement(CheckIcon, null) : menuItemSelectedIcon));
|