next-helios-fe 1.8.8 → 1.8.9
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/package.json
CHANGED
@@ -69,25 +69,12 @@ export const MultipleSelect: React.FC<MultipleSelectProps> = ({
|
|
69
69
|
}, []);
|
70
70
|
|
71
71
|
useEffect(() => {
|
72
|
-
if (value) {
|
72
|
+
if (value?.length) {
|
73
73
|
setTempValue(value);
|
74
74
|
return;
|
75
75
|
}
|
76
76
|
}, [value]);
|
77
77
|
|
78
|
-
useEffect(() => {
|
79
|
-
onChange &&
|
80
|
-
onChange({
|
81
|
-
target: { value: tempValue },
|
82
|
-
});
|
83
|
-
}, [tempValue]);
|
84
|
-
|
85
|
-
useEffect(() => {
|
86
|
-
if (tempValue.length === 0) {
|
87
|
-
fakeInputRef.current;
|
88
|
-
}
|
89
|
-
}, [tempValue]);
|
90
|
-
|
91
78
|
useEffect(() => {
|
92
79
|
if (tempValue.length === 0) {
|
93
80
|
inputRef.current?.setCustomValidity(
|
@@ -168,12 +155,7 @@ export const MultipleSelect: React.FC<MultipleSelectProps> = ({
|
|
168
155
|
className="flex items-center gap-2 px-2 py-0.5 rounded-md bg-primary text-white cursor-default pointer-events-auto"
|
169
156
|
>
|
170
157
|
<span>{menus.find((i) => i.value === item)?.label}</span>
|
171
|
-
<div
|
172
|
-
className="cursor-pointer"
|
173
|
-
onClick={() => {
|
174
|
-
setTempValue(tempValue.filter((i) => i !== item));
|
175
|
-
}}
|
176
|
-
>
|
158
|
+
<div className="cursor-pointer">
|
177
159
|
<Icon icon="pajamas:close" />
|
178
160
|
</div>
|
179
161
|
</div>
|
@@ -210,6 +192,13 @@ export const MultipleSelect: React.FC<MultipleSelectProps> = ({
|
|
210
192
|
onClick={() => {
|
211
193
|
if (!disabled) {
|
212
194
|
setTempValue(tempValue.filter((i) => i !== item));
|
195
|
+
if (onChange) {
|
196
|
+
onChange({
|
197
|
+
target: {
|
198
|
+
value: tempValue.filter((i) => i !== item),
|
199
|
+
},
|
200
|
+
} as any);
|
201
|
+
}
|
213
202
|
}
|
214
203
|
}}
|
215
204
|
>
|
@@ -258,6 +247,11 @@ export const MultipleSelect: React.FC<MultipleSelectProps> = ({
|
|
258
247
|
}
|
259
248
|
onClick={() => {
|
260
249
|
setTempValue([...tempValue, item.value]);
|
250
|
+
if (onChange) {
|
251
|
+
onChange({
|
252
|
+
target: { value: [...tempValue, item.value] },
|
253
|
+
} as any);
|
254
|
+
}
|
261
255
|
}}
|
262
256
|
>
|
263
257
|
{item.label}
|