@rc-component/select 1.6.8 → 1.6.10
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/es/BaseSelect/index.js
CHANGED
|
@@ -230,7 +230,9 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
230
230
|
// Enter or Space opens dropdown (ARIA combobox: spacebar should open)
|
|
231
231
|
if (isEnterKey || isSpaceKey) {
|
|
232
232
|
// Do not submit form when type in the input; prevent Space from scrolling page
|
|
233
|
-
|
|
233
|
+
const isCombobox = mode === 'combobox';
|
|
234
|
+
const isEditable = isCombobox || showSearch;
|
|
235
|
+
if (isSpaceKey && !isEditable || isEnterKey && !isCombobox) {
|
|
234
236
|
event.preventDefault();
|
|
235
237
|
}
|
|
236
238
|
|
|
@@ -65,6 +65,8 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
|
|
|
65
65
|
}, [combobox, activeValue]);
|
|
66
66
|
|
|
67
67
|
// ========================== Render ==========================
|
|
68
|
+
const showHasValueCls = displayValue && displayValue.label !== null && displayValue.label !== undefined && String(displayValue.label).trim() !== '';
|
|
69
|
+
|
|
68
70
|
// Render value
|
|
69
71
|
const renderValue = displayValue ? hasOptionStyle ? /*#__PURE__*/React.createElement("div", {
|
|
70
72
|
className: clsx(`${prefixCls}-content-value`, optionClassName),
|
|
@@ -81,7 +83,7 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
|
|
|
81
83
|
|
|
82
84
|
// Render
|
|
83
85
|
return /*#__PURE__*/React.createElement("div", {
|
|
84
|
-
className: clsx(`${prefixCls}-content`,
|
|
86
|
+
className: clsx(`${prefixCls}-content`, showHasValueCls && `${prefixCls}-content-has-value`, mergedSearchValue && `${prefixCls}-content-has-search-value`, hasOptionStyle && `${prefixCls}-content-has-option-style`, classNames?.content),
|
|
85
87
|
style: styles?.content,
|
|
86
88
|
title: hasOptionStyle ? undefined : optionTitle
|
|
87
89
|
}, renderValue, /*#__PURE__*/React.createElement(Input, _extends({
|
package/lib/BaseSelect/index.js
CHANGED
|
@@ -239,7 +239,9 @@ const BaseSelect = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
239
239
|
// Enter or Space opens dropdown (ARIA combobox: spacebar should open)
|
|
240
240
|
if (isEnterKey || isSpaceKey) {
|
|
241
241
|
// Do not submit form when type in the input; prevent Space from scrolling page
|
|
242
|
-
|
|
242
|
+
const isCombobox = mode === 'combobox';
|
|
243
|
+
const isEditable = isCombobox || showSearch;
|
|
244
|
+
if (isSpaceKey && !isEditable || isEnterKey && !isCombobox) {
|
|
243
245
|
event.preventDefault();
|
|
244
246
|
}
|
|
245
247
|
|
|
@@ -74,6 +74,8 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
|
|
|
74
74
|
}, [combobox, activeValue]);
|
|
75
75
|
|
|
76
76
|
// ========================== Render ==========================
|
|
77
|
+
const showHasValueCls = displayValue && displayValue.label !== null && displayValue.label !== undefined && String(displayValue.label).trim() !== '';
|
|
78
|
+
|
|
77
79
|
// Render value
|
|
78
80
|
const renderValue = displayValue ? hasOptionStyle ? /*#__PURE__*/React.createElement("div", {
|
|
79
81
|
className: (0, _clsx.clsx)(`${prefixCls}-content-value`, optionClassName),
|
|
@@ -90,7 +92,7 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
|
|
|
90
92
|
|
|
91
93
|
// Render
|
|
92
94
|
return /*#__PURE__*/React.createElement("div", {
|
|
93
|
-
className: (0, _clsx.clsx)(`${prefixCls}-content`,
|
|
95
|
+
className: (0, _clsx.clsx)(`${prefixCls}-content`, showHasValueCls && `${prefixCls}-content-has-value`, mergedSearchValue && `${prefixCls}-content-has-search-value`, hasOptionStyle && `${prefixCls}-content-has-option-style`, classNames?.content),
|
|
94
96
|
style: styles?.content,
|
|
95
97
|
title: hasOptionStyle ? undefined : optionTitle
|
|
96
98
|
}, renderValue, /*#__PURE__*/React.createElement(_Input.default, _extends({
|