dtable-ui-component 6.0.110-sam.1 → 6.0.110-sam.11
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,10 @@ 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: e => {
|
|
236
|
+
e.stopPropagation();
|
|
237
|
+
props.clearValue();
|
|
238
|
+
}
|
|
236
239
|
});
|
|
237
240
|
}
|
|
238
241
|
}
|
|
@@ -33,9 +33,10 @@ class DTableSelect extends _react.default.Component {
|
|
|
33
33
|
const processedOptions = (0, _utils.processOptionsWithClear)(options, isClearable);
|
|
34
34
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactSelect.default, {
|
|
35
35
|
value: value,
|
|
36
|
-
onChange: (0, _utils.createHandleChange)(onChange),
|
|
36
|
+
onChange: (0, _utils.createHandleChange)(onChange, isMulti),
|
|
37
37
|
options: processedOptions,
|
|
38
38
|
isMulti: isMulti,
|
|
39
|
+
isClearable: false,
|
|
39
40
|
className: className,
|
|
40
41
|
classNamePrefix: classNamePrefix,
|
|
41
42
|
styles: style || _utils.MenuSelectStyle,
|
|
@@ -239,20 +239,29 @@ 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
|
+
const hasClear = selectedOption && selectedOption.some(opt => opt && opt.value === '__clear__');
|
|
245
|
+
if (hasClear) {
|
|
246
|
+
onChangeCallback([], {
|
|
247
|
+
...actionMeta,
|
|
248
|
+
action: 'clear'
|
|
249
|
+
});
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
} else if (selectedOption && selectedOption.value === '__clear__') {
|
|
244
253
|
onChangeCallback(null, {
|
|
245
254
|
...actionMeta,
|
|
246
255
|
action: 'clear'
|
|
247
256
|
});
|
|
248
|
-
|
|
249
|
-
onChangeCallback(selectedOption, actionMeta);
|
|
257
|
+
return;
|
|
250
258
|
}
|
|
259
|
+
onChangeCallback(selectedOption, actionMeta);
|
|
251
260
|
};
|
|
252
261
|
exports.handleSelectChange = handleSelectChange;
|
|
253
|
-
const createHandleChange = onChange => {
|
|
262
|
+
const createHandleChange = (onChange, isMulti) => {
|
|
254
263
|
return (selectedOption, actionMeta) => {
|
|
255
|
-
handleSelectChange(selectedOption, actionMeta, onChange);
|
|
264
|
+
handleSelectChange(selectedOption, actionMeta, onChange, isMulti);
|
|
256
265
|
};
|
|
257
266
|
};
|
|
258
267
|
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
|
}
|
|
@@ -10,8 +10,11 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
10
10
|
class Option extends _react.Component {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
13
|
-
this.onSelectOption = value => {
|
|
14
|
-
this.props.
|
|
13
|
+
this.onSelectOption = (value, event) => {
|
|
14
|
+
if (this.props.supportMultipleSelect) {
|
|
15
|
+
event.stopPropagation();
|
|
16
|
+
}
|
|
17
|
+
this.props.onSelectOption(value, event);
|
|
15
18
|
};
|
|
16
19
|
this.onMouseEnter = () => {
|
|
17
20
|
if (!this.props.disableHover) {
|
|
@@ -27,10 +30,7 @@ class Option extends _react.Component {
|
|
|
27
30
|
render() {
|
|
28
31
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
29
32
|
className: this.props.isActive ? 'option option-active' : 'option',
|
|
30
|
-
onClick:
|
|
31
|
-
event.stopPropagation();
|
|
32
|
-
this.onSelectOption(this.props.value);
|
|
33
|
-
},
|
|
33
|
+
onClick: this.onSelectOption.bind(this, this.props.value),
|
|
34
34
|
onMouseEnter: this.onMouseEnter,
|
|
35
35
|
onMouseLeave: this.onMouseLeave,
|
|
36
36
|
children: this.props.children
|