@rc-component/select 1.6.6 → 1.6.8

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.
@@ -29,7 +29,6 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
29
29
  const [inputChanged, setInputChanged] = React.useState(false);
30
30
  const combobox = mode === 'combobox';
31
31
  const displayValue = displayValues[0];
32
- const hasDisplayValue = displayValue !== null && displayValue !== undefined;
33
32
 
34
33
  // Implement the same logic as the old SingleSelector
35
34
  const mergedSearchValue = React.useMemo(() => {
@@ -42,7 +41,7 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
42
41
  let className;
43
42
  let style;
44
43
  let titleValue;
45
- if (hasDisplayValue && selectContext?.flattenOptions) {
44
+ if (displayValue && selectContext?.flattenOptions) {
46
45
  const option = selectContext.flattenOptions.find(opt => opt.value === displayValue.value);
47
46
  if (option?.data) {
48
47
  className = option.data.className;
@@ -50,7 +49,7 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
50
49
  titleValue = getTitle(option.data);
51
50
  }
52
51
  }
53
- if (hasDisplayValue && !titleValue) {
52
+ if (displayValue && !titleValue) {
54
53
  titleValue = getTitle(displayValue);
55
54
  }
56
55
  if (rootTitle !== undefined) {
@@ -67,7 +66,7 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
67
66
 
68
67
  // ========================== Render ==========================
69
68
  // Render value
70
- const renderValue = hasDisplayValue ? hasOptionStyle ? /*#__PURE__*/React.createElement("div", {
69
+ const renderValue = displayValue ? hasOptionStyle ? /*#__PURE__*/React.createElement("div", {
71
70
  className: clsx(`${prefixCls}-content-value`, optionClassName),
72
71
  style: {
73
72
  ...(mergedSearchValue ? {
@@ -82,7 +81,7 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
82
81
 
83
82
  // Render
84
83
  return /*#__PURE__*/React.createElement("div", {
85
- className: clsx(`${prefixCls}-content`, hasDisplayValue && `${prefixCls}-content-has-value`, mergedSearchValue && `${prefixCls}-content-has-search-value`, hasOptionStyle && `${prefixCls}-content-has-option-style`, classNames?.content),
84
+ className: clsx(`${prefixCls}-content`, displayValue && displayValue.label !== null && displayValue.label !== undefined && displayValue.label !== '' && `${prefixCls}-content-has-value`, mergedSearchValue && `${prefixCls}-content-has-search-value`, hasOptionStyle && `${prefixCls}-content-has-option-style`, classNames?.content),
86
85
  style: styles?.content,
87
86
  title: hasOptionStyle ? undefined : optionTitle
88
87
  }, renderValue, /*#__PURE__*/React.createElement(Input, _extends({
@@ -38,7 +38,6 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
38
38
  const [inputChanged, setInputChanged] = React.useState(false);
39
39
  const combobox = mode === 'combobox';
40
40
  const displayValue = displayValues[0];
41
- const hasDisplayValue = displayValue !== null && displayValue !== undefined;
42
41
 
43
42
  // Implement the same logic as the old SingleSelector
44
43
  const mergedSearchValue = React.useMemo(() => {
@@ -51,7 +50,7 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
51
50
  let className;
52
51
  let style;
53
52
  let titleValue;
54
- if (hasDisplayValue && selectContext?.flattenOptions) {
53
+ if (displayValue && selectContext?.flattenOptions) {
55
54
  const option = selectContext.flattenOptions.find(opt => opt.value === displayValue.value);
56
55
  if (option?.data) {
57
56
  className = option.data.className;
@@ -59,7 +58,7 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
59
58
  titleValue = (0, _commonUtil.getTitle)(option.data);
60
59
  }
61
60
  }
62
- if (hasDisplayValue && !titleValue) {
61
+ if (displayValue && !titleValue) {
63
62
  titleValue = (0, _commonUtil.getTitle)(displayValue);
64
63
  }
65
64
  if (rootTitle !== undefined) {
@@ -76,7 +75,7 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
76
75
 
77
76
  // ========================== Render ==========================
78
77
  // Render value
79
- const renderValue = hasDisplayValue ? hasOptionStyle ? /*#__PURE__*/React.createElement("div", {
78
+ const renderValue = displayValue ? hasOptionStyle ? /*#__PURE__*/React.createElement("div", {
80
79
  className: (0, _clsx.clsx)(`${prefixCls}-content-value`, optionClassName),
81
80
  style: {
82
81
  ...(mergedSearchValue ? {
@@ -91,7 +90,7 @@ const SingleContent = /*#__PURE__*/React.forwardRef(({
91
90
 
92
91
  // Render
93
92
  return /*#__PURE__*/React.createElement("div", {
94
- className: (0, _clsx.clsx)(`${prefixCls}-content`, hasDisplayValue && `${prefixCls}-content-has-value`, mergedSearchValue && `${prefixCls}-content-has-search-value`, hasOptionStyle && `${prefixCls}-content-has-option-style`, classNames?.content),
93
+ className: (0, _clsx.clsx)(`${prefixCls}-content`, displayValue && displayValue.label !== null && displayValue.label !== undefined && displayValue.label !== '' && `${prefixCls}-content-has-value`, mergedSearchValue && `${prefixCls}-content-has-search-value`, hasOptionStyle && `${prefixCls}-content-has-option-style`, classNames?.content),
95
94
  style: styles?.content,
96
95
  title: hasOptionStyle ? undefined : optionTitle
97
96
  }, renderValue, /*#__PURE__*/React.createElement(_Input.default, _extends({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rc-component/select",
3
- "version": "1.6.6",
3
+ "version": "1.6.8",
4
4
  "description": "React Select",
5
5
  "engines": {
6
6
  "node": ">=8.x"