dtable-ui-component 6.0.110-oot.24 → 6.0.110-oot.26
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.
|
@@ -32,6 +32,22 @@ class CollaboratorSelect extends _react.Component {
|
|
|
32
32
|
isShowSelectOptions: !this.state.isShowSelectOptions
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
|
+
this.onClick = event => {
|
|
36
|
+
const target = event.target;
|
|
37
|
+
const name = target.className;
|
|
38
|
+
const {
|
|
39
|
+
isShowSelectOptions
|
|
40
|
+
} = this.state;
|
|
41
|
+
if (!isShowSelectOptions || name === 'select-placeholder' || name.includes('icon-fork-number') || this.selector.contains(target)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const {
|
|
45
|
+
isUsePopover
|
|
46
|
+
} = this.props;
|
|
47
|
+
if (isUsePopover && !this.collaboratorSelectPopoverRef.contains(target) || !isUsePopover && !this.selector.contains(target)) {
|
|
48
|
+
this.closeSelect();
|
|
49
|
+
}
|
|
50
|
+
};
|
|
35
51
|
this.onMousedown = event => {
|
|
36
52
|
const name = event.target.className;
|
|
37
53
|
if (name === 'select-placeholder' || name.includes('icon-fork-number')) {
|
|
@@ -54,22 +70,6 @@ class CollaboratorSelect extends _react.Component {
|
|
|
54
70
|
if (!searchable) return options || [];
|
|
55
71
|
return (0, _dtableUtils.searchCollaborators)(options, searchValue);
|
|
56
72
|
};
|
|
57
|
-
this.onClick = event => {
|
|
58
|
-
const target = event.target;
|
|
59
|
-
const name = target.className;
|
|
60
|
-
const {
|
|
61
|
-
isShowSelectOptions
|
|
62
|
-
} = this.state;
|
|
63
|
-
if (!isShowSelectOptions || name === 'select-placeholder' || name.includes('icon-fork-number') || this.selector.contains(target)) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
const {
|
|
67
|
-
isUsePopover
|
|
68
|
-
} = this.props;
|
|
69
|
-
if (isUsePopover && !this.collaboratorSelectPopoverRef.contains(target) || !isUsePopover && !this.selector.contains(target)) {
|
|
70
|
-
this.closeSelect();
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
73
|
this.renderOptionGroup = () => {
|
|
74
74
|
const {
|
|
75
75
|
value,
|
|
@@ -144,7 +144,15 @@ class SelectOptionGroup extends _react.Component {
|
|
|
144
144
|
return this.filterOptions.map((opt, i) => {
|
|
145
145
|
let key = opt.value.column ? opt.value.column.key : i;
|
|
146
146
|
let isActive = this.state.activeIndex === i;
|
|
147
|
-
|
|
147
|
+
let isSelected = false;
|
|
148
|
+
if (value) {
|
|
149
|
+
// Handle both single value and array of values
|
|
150
|
+
if (Array.isArray(value.value)) {
|
|
151
|
+
isSelected = value.value.includes(opt.value);
|
|
152
|
+
} else {
|
|
153
|
+
isSelected = opt.value === value.value || JSON.stringify(opt.value) === JSON.stringify(value.value);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
148
156
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_option.default, {
|
|
149
157
|
index: i,
|
|
150
158
|
isActive: isActive,
|
|
@@ -89,9 +89,18 @@ class DTableSelect extends _react.default.Component {
|
|
|
89
89
|
};
|
|
90
90
|
this.handleSelectChange = val => {
|
|
91
91
|
const {
|
|
92
|
-
onChange
|
|
92
|
+
onChange,
|
|
93
|
+
isMulti
|
|
93
94
|
} = this.props;
|
|
94
|
-
|
|
95
|
+
|
|
96
|
+
// Handle multi-select case
|
|
97
|
+
if (isMulti) {
|
|
98
|
+
onChange(val || []);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Handle single select case
|
|
103
|
+
if (!val || !val.value) {
|
|
95
104
|
onChange('');
|
|
96
105
|
return;
|
|
97
106
|
}
|
|
@@ -9,7 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
11
|
var _option = _interopRequireDefault(require("./option"));
|
|
12
|
-
var
|
|
12
|
+
var _DTableSearchInput = _interopRequireDefault(require("../DTableSearchInput"));
|
|
13
13
|
var _KeyCodes = _interopRequireDefault(require("./KeyCodes"));
|
|
14
14
|
var _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
|
|
15
15
|
require("./index.css");
|
|
@@ -261,15 +261,27 @@ class SelectOptionGroup extends _react.Component {
|
|
|
261
261
|
onClick: e => e.stopPropagation(),
|
|
262
262
|
children: value.label || ''
|
|
263
263
|
}), searchable && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
264
|
-
className: "
|
|
265
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
264
|
+
className: "option-group-search",
|
|
265
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableSearchInput.default, {
|
|
266
|
+
className: "option-search-control",
|
|
266
267
|
placeholder: searchPlaceholder,
|
|
267
268
|
onChange: this.onChangeSearch,
|
|
268
|
-
value: searchVal,
|
|
269
|
-
clearValue: () => this.onChangeSearch(''),
|
|
270
269
|
autoFocus: true,
|
|
270
|
+
ref: this.searchInputRef,
|
|
271
|
+
clearValue: this.clearValue,
|
|
271
272
|
isClearable: true,
|
|
272
|
-
|
|
273
|
+
components: {
|
|
274
|
+
ClearIndicator: props => {
|
|
275
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
276
|
+
className: (0, _classnames.default)('select-search-text-clear input-icon-addon seatable-icon dtable-font dtable-icon-x'),
|
|
277
|
+
onClick: e => {
|
|
278
|
+
e.stopPropagation();
|
|
279
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
280
|
+
props.clearValue();
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
}
|
|
273
285
|
})
|
|
274
286
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
275
287
|
className: "option-group-content ".concat(!searchable && !supportMultipleSelect ? 'option-group-top' : ''),
|