lu-lowcode-package-form 0.9.43 → 0.9.44

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.
@@ -71,8 +71,7 @@ const MultipleSelect = ({ onChange, value, ...props }) => {
71
71
  * @returns
72
72
  */
73
73
  const WithSingleSelect = ({ onChange, value, ...props }) => {
74
- const [nValue, setNValue] = React.useState("")
75
-
74
+
76
75
  React.useEffect(() => {
77
76
  if (value && typeof value === "string") {
78
77
  try {
@@ -82,16 +81,11 @@ const WithSingleSelect = ({ onChange, value, ...props }) => {
82
81
 
83
82
  }
84
83
  }
85
- if (value) setNValue(value)
86
- }, [value])
87
84
 
85
+ }, [value])
88
86
 
89
- const onWithSelectChange = (_value, _option) => {
90
- onChange && typeof onChange == "function" && onChange(_option)
91
- setNValue(_option.label)
92
- }
93
87
  return (
94
- <SearchSelect {...props} onChange={onWithSelectChange} value={nValue} mode="single" />
88
+ <SearchSelect {...props} onChange={onChange} value={value} mode="single" />
95
89
  )
96
90
  }
97
91
 
@@ -101,9 +95,7 @@ const WithSingleSelect = ({ onChange, value, ...props }) => {
101
95
  * @returns
102
96
  */
103
97
  const WithMultipleSelect = ({ onChange, value, ...props }) => {
104
- const [nValue, setNValue] = React.useState([])
105
-
106
-
98
+
107
99
  React.useEffect(() => {
108
100
  if (value && typeof value === "string") {
109
101
  try {
@@ -114,16 +106,10 @@ const WithMultipleSelect = ({ onChange, value, ...props }) => {
114
106
  }
115
107
  }
116
108
 
117
- if (Array.isArray(value)) setNValue(value)
118
109
  }, [value])
119
110
 
120
- const onWithSelectChange = (_value, _option) => {
121
- onChange && typeof onChange == "function" && onChange(_option)
122
- const selectLabels = _option.map(item => item.label);
123
- setNValue(_option)
124
- }
125
111
  return (
126
- <SearchSelect {...props} onChange={onWithSelectChange} value={nValue} mode="multiple" />
112
+ <SearchSelect {...props} onChange={onChange} value={value} mode="multiple" />
127
113
  )
128
114
  }
129
115