dtable-ui-component 6.0.110-sam.4 → 6.0.110-sam.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/lib/DTableSelect/utils.js +15 -4
- package/package.json +1 -1
|
@@ -240,14 +240,25 @@ const processOptionsWithClear = (options, isClearable) => {
|
|
|
240
240
|
};
|
|
241
241
|
exports.processOptionsWithClear = processOptionsWithClear;
|
|
242
242
|
const handleSelectChange = (selectedOption, actionMeta, onChangeCallback, isMulti) => {
|
|
243
|
-
if (
|
|
244
|
-
|
|
243
|
+
if (isMulti && Array.isArray(selectedOption)) {
|
|
244
|
+
// 多选模式:检查数组中是否有 __clear__ 选项
|
|
245
|
+
const hasClear = selectedOption && selectedOption.some(opt => opt && opt.value === '__clear__');
|
|
246
|
+
if (hasClear) {
|
|
247
|
+
onChangeCallback([], {
|
|
248
|
+
...actionMeta,
|
|
249
|
+
action: 'clear'
|
|
250
|
+
});
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
} else if (selectedOption && selectedOption.value === '__clear__') {
|
|
254
|
+
// 单选模式
|
|
255
|
+
onChangeCallback(null, {
|
|
245
256
|
...actionMeta,
|
|
246
257
|
action: 'clear'
|
|
247
258
|
});
|
|
248
|
-
|
|
249
|
-
onChangeCallback(selectedOption, actionMeta);
|
|
259
|
+
return;
|
|
250
260
|
}
|
|
261
|
+
onChangeCallback(selectedOption, actionMeta);
|
|
251
262
|
};
|
|
252
263
|
exports.handleSelectChange = handleSelectChange;
|
|
253
264
|
const createHandleChange = (onChange, isMulti) => {
|