dtable-ui-component 6.0.110-sam.2 → 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.
|
@@ -232,7 +232,7 @@ class SelectOptionGroup extends _react.Component {
|
|
|
232
232
|
ClearIndicator: props => {
|
|
233
233
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
234
234
|
className: (0, _classnames.default)('select-search-text-clear input-icon-addon seatable-icon dtable-font dtable-icon-x'),
|
|
235
|
-
onClick:
|
|
235
|
+
onClick: props.clearValue
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
}
|
|
@@ -31,13 +31,12 @@ class DTableSelect extends _react.default.Component {
|
|
|
31
31
|
className
|
|
32
32
|
} = this.props;
|
|
33
33
|
const processedOptions = (0, _utils.processOptionsWithClear)(options, isClearable);
|
|
34
|
-
const effectiveClearable = isClearable && !isMulti; // 只在非多选模式下显示清除按钮
|
|
35
34
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
|
|
36
35
|
value: value,
|
|
37
|
-
onChange: (0, _utils.createHandleChange)(onChange),
|
|
36
|
+
onChange: (0, _utils.createHandleChange)(onChange, isMulti),
|
|
38
37
|
options: processedOptions,
|
|
39
38
|
isMulti: isMulti,
|
|
40
|
-
isClearable:
|
|
39
|
+
isClearable: false,
|
|
41
40
|
className: className,
|
|
42
41
|
classNamePrefix: classNamePrefix,
|
|
43
42
|
styles: style || _utils.MenuSelectStyle,
|
|
@@ -239,20 +239,31 @@ const processOptionsWithClear = (options, isClearable) => {
|
|
|
239
239
|
return options;
|
|
240
240
|
};
|
|
241
241
|
exports.processOptionsWithClear = processOptionsWithClear;
|
|
242
|
-
const handleSelectChange = (selectedOption, actionMeta, onChangeCallback) => {
|
|
243
|
-
if (
|
|
242
|
+
const handleSelectChange = (selectedOption, actionMeta, onChangeCallback, isMulti) => {
|
|
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
|
+
// 单选模式
|
|
244
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
|
-
const createHandleChange = onChange => {
|
|
264
|
+
const createHandleChange = (onChange, isMulti) => {
|
|
254
265
|
return (selectedOption, actionMeta) => {
|
|
255
|
-
handleSelectChange(selectedOption, actionMeta, onChange);
|
|
266
|
+
handleSelectChange(selectedOption, actionMeta, onChange, isMulti);
|
|
256
267
|
};
|
|
257
268
|
};
|
|
258
269
|
exports.createHandleChange = createHandleChange;
|
|
@@ -274,7 +274,7 @@ class SelectOptionGroup extends _react.Component {
|
|
|
274
274
|
ClearIndicator: props => {
|
|
275
275
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
276
276
|
className: (0, _classnames.default)('select-search-text-clear input-icon-addon seatable-icon dtable-font dtable-icon-x'),
|
|
277
|
-
onClick:
|
|
277
|
+
onClick: props.clearValue
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
280
|
}
|