dtable-ui-component 7.0.1-beta.btn1 → 7.0.1-beta.select1
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/AsyncUserSelect/index.css +38 -28
- package/lib/AsyncUserSelect/index.js +29 -18
- package/lib/DTableCustomizeSearchInput/index.css +75 -0
- package/lib/DTableCustomizeSearchInput/index.js +133 -0
- package/lib/DTableCustomizeSelect/index.css +120 -42
- package/lib/DTableCustomizeSelect/index.js +12 -6
- package/lib/DTableFiltersPopover/index.js +8 -9
- package/lib/DTableFiltersPopover/utils/filter-item-utils.js +7 -19
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +5 -9
- package/lib/DTableFiltersPopover/widgets/filter-group.js +1 -1
- package/lib/DTableFiltersPopover/widgets/filter-item.js +16 -8
- package/lib/DTableFiltersPopover/widgets/filter-list/index.css +8 -6
- package/lib/DTableModalHeader/index.css +22 -0
- package/lib/DTableModalHeader/index.js +10 -3
- package/lib/DTableSelect/dtable-select-label.css +8 -3
- package/lib/DTableSelect/dtable-select-label.js +1 -1
- package/lib/DTableSelect/index.js +3 -3
- package/lib/DTableSelect/select-dropdown-indicator/index.css +16 -0
- package/lib/DTableSelect/select-dropdown-indicator/index.js +24 -0
- package/lib/DTableSelect/user-select.css +7 -46
- package/lib/DTableSelect/utils.js +170 -79
- package/lib/FieldDisplaySetting/index.js +1 -1
- package/lib/SelectItem/index.js +1 -1
- package/lib/SelectOptionGroup/KeyCodes.js +96 -4
- package/lib/SelectOptionGroup/index.css +44 -54
- package/lib/SelectOptionGroup/index.js +35 -18
- package/lib/SelectOptionGroup/option.js +16 -4
- package/lib/assets/icons/close.svg +1 -0
- package/lib/assets/icons/down.svg +3 -0
- package/lib/index.js +3 -10
- package/package.json +1 -1
- package/lib/DTableCustomizeCollaboratorSelect/index.css +0 -86
- package/lib/DTableCustomizeCollaboratorSelect/index.js +0 -158
- package/lib/DTableGroupSelect/index.css +0 -96
- package/lib/DTableGroupSelect/index.js +0 -131
- package/lib/DTableGroupSelect/option.js +0 -42
- package/lib/DTableGroupSelect/select-option-group.css +0 -54
- package/lib/DTableGroupSelect/select-option-group.js +0 -227
|
@@ -8,10 +8,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
+
var _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
|
|
12
|
+
var _DTableCustomizeSearchInput = _interopRequireDefault(require("../DTableCustomizeSearchInput"));
|
|
11
13
|
var _option = _interopRequireDefault(require("./option"));
|
|
12
|
-
var _DTableSearchInput = _interopRequireDefault(require("../DTableSearchInput"));
|
|
13
14
|
var _KeyCodes = _interopRequireDefault(require("./KeyCodes"));
|
|
14
|
-
var _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
|
|
15
15
|
require("./index.css");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
const OPTION_HEIGHT = 32;
|
|
@@ -19,21 +19,16 @@ class SelectOptionGroup extends _react.Component {
|
|
|
19
19
|
constructor(props) {
|
|
20
20
|
super(props);
|
|
21
21
|
this.resetMenuStyle = () => {
|
|
22
|
-
if (!this.optionGroupRef) return;
|
|
23
22
|
const _this$props = this.props,
|
|
24
23
|
isInModal = _this$props.isInModal,
|
|
25
24
|
position = _this$props.position;
|
|
26
25
|
const _this$optionGroupRef$ = this.optionGroupRef.getBoundingClientRect(),
|
|
27
26
|
top = _this$optionGroupRef$.top,
|
|
28
|
-
height = _this$optionGroupRef$.height
|
|
29
|
-
width = _this$optionGroupRef$.width;
|
|
27
|
+
height = _this$optionGroupRef$.height;
|
|
30
28
|
if (isInModal) {
|
|
31
29
|
if (position.y + position.height + height > window.innerHeight) {
|
|
32
30
|
this.optionGroupRef.style.top = position.y - height + 'px';
|
|
33
31
|
}
|
|
34
|
-
if (position && position.x + width > window.innerWidth) {
|
|
35
|
-
this.optionGroupRef.style.left = window.innerWidth - width - 10 + 'px';
|
|
36
|
-
}
|
|
37
32
|
this.optionGroupRef.style.opacity = 1;
|
|
38
33
|
this.searchInputRef.current && this.searchInputRef.current.inputRef.focus();
|
|
39
34
|
} else {
|
|
@@ -127,10 +122,17 @@ class SelectOptionGroup extends _react.Component {
|
|
|
127
122
|
});
|
|
128
123
|
}
|
|
129
124
|
};
|
|
125
|
+
this.clearSearch = () => {
|
|
126
|
+
this.setState({
|
|
127
|
+
searchVal: '',
|
|
128
|
+
activeIndex: -1
|
|
129
|
+
});
|
|
130
|
+
};
|
|
130
131
|
this.renderOptGroup = searchVal => {
|
|
131
132
|
let _this$props2 = this.props,
|
|
132
133
|
noOptionsPlaceholder = _this$props2.noOptionsPlaceholder,
|
|
133
|
-
onSelectOption = _this$props2.onSelectOption
|
|
134
|
+
onSelectOption = _this$props2.onSelectOption,
|
|
135
|
+
value = _this$props2.value;
|
|
134
136
|
this.filterOptions = this.props.getFilterOptions(searchVal);
|
|
135
137
|
if (this.filterOptions.length === 0) {
|
|
136
138
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
@@ -141,7 +143,16 @@ class SelectOptionGroup extends _react.Component {
|
|
|
141
143
|
return this.filterOptions.map((opt, i) => {
|
|
142
144
|
let key = opt.value.column ? opt.value.column.key : i;
|
|
143
145
|
let isActive = this.state.activeIndex === i;
|
|
144
|
-
|
|
146
|
+
let isSelected = false;
|
|
147
|
+
if (value) {
|
|
148
|
+
// Handle both single value and array of values
|
|
149
|
+
if (Array.isArray(value.value)) {
|
|
150
|
+
isSelected = value.value.includes(opt.value);
|
|
151
|
+
} else {
|
|
152
|
+
isSelected = opt.value === value.value || JSON.stringify(opt.value) === JSON.stringify(value.value);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_option.default, {
|
|
145
156
|
index: i,
|
|
146
157
|
isActive: isActive,
|
|
147
158
|
value: opt.value,
|
|
@@ -149,8 +160,13 @@ class SelectOptionGroup extends _react.Component {
|
|
|
149
160
|
changeIndex: this.changeIndex,
|
|
150
161
|
supportMultipleSelect: this.props.supportMultipleSelect,
|
|
151
162
|
disableHover: this.state.disableHover,
|
|
152
|
-
children:
|
|
153
|
-
|
|
163
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
164
|
+
className: "select-label",
|
|
165
|
+
children: opt.label
|
|
166
|
+
}), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
167
|
+
className: "dtable-font dtable-icon-check seatable-check-color"
|
|
168
|
+
})]
|
|
169
|
+
}, key);
|
|
154
170
|
});
|
|
155
171
|
};
|
|
156
172
|
this.state = {
|
|
@@ -215,9 +231,8 @@ class SelectOptionGroup extends _react.Component {
|
|
|
215
231
|
ref: ref => this.clickOutsideRef = ref,
|
|
216
232
|
onClickOutside: this.props.onClickOutside,
|
|
217
233
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
218
|
-
className: (0, _classnames.default)('option-group', className ? 'option-group-' + className : '', {
|
|
219
|
-
'pt-0': isShowSelected
|
|
220
|
-
'create-new-option-group': addOptionAble
|
|
234
|
+
className: (0, _classnames.default)('seatable-option-group', className ? 'seatable-option-group-' + className : '', {
|
|
235
|
+
'pt-0': isShowSelected
|
|
221
236
|
}),
|
|
222
237
|
ref: ref => this.optionGroupRef = ref,
|
|
223
238
|
style: style,
|
|
@@ -227,16 +242,18 @@ class SelectOptionGroup extends _react.Component {
|
|
|
227
242
|
onClick: e => e.stopPropagation(),
|
|
228
243
|
children: value.label || ''
|
|
229
244
|
}), searchable && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
230
|
-
className: "
|
|
231
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
245
|
+
className: "seatable-select-search",
|
|
246
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableCustomizeSearchInput.default, {
|
|
232
247
|
className: "option-search-control",
|
|
233
248
|
placeholder: searchPlaceholder,
|
|
234
249
|
onChange: this.onChangeSearch,
|
|
250
|
+
clearValue: this.clearSearch,
|
|
235
251
|
autoFocus: true,
|
|
252
|
+
isClearable: true,
|
|
236
253
|
ref: this.searchInputRef
|
|
237
254
|
})
|
|
238
255
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
239
|
-
className: "option-group-content",
|
|
256
|
+
className: "seatable-option-group-content",
|
|
240
257
|
ref: ref => this.optionGroupContentRef = ref,
|
|
241
258
|
children: this.renderOptGroup(searchVal)
|
|
242
259
|
}), addOptionAble && AddOption]
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
8
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
12
|
class Option extends _react.Component {
|
|
11
13
|
constructor() {
|
|
12
14
|
super(...arguments);
|
|
13
|
-
this.onSelectOption =
|
|
15
|
+
this.onSelectOption = event => {
|
|
14
16
|
if (this.props.supportMultipleSelect) {
|
|
15
17
|
event.stopPropagation();
|
|
16
18
|
}
|
|
17
|
-
this.props.onSelectOption(value, event);
|
|
19
|
+
this.props.onSelectOption(this.props.value, event);
|
|
18
20
|
};
|
|
19
21
|
this.onMouseEnter = () => {
|
|
20
22
|
if (!this.props.disableHover) {
|
|
@@ -26,11 +28,21 @@ class Option extends _react.Component {
|
|
|
26
28
|
this.props.changeIndex(-1);
|
|
27
29
|
}
|
|
28
30
|
};
|
|
31
|
+
this.onKeyDown = e => {
|
|
32
|
+
if (e.key === 'Enter' || e.key === 'Space') {
|
|
33
|
+
e.target.click();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
29
36
|
}
|
|
30
37
|
render() {
|
|
31
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
32
|
-
className:
|
|
33
|
-
|
|
39
|
+
className: (0, _classnames.default)('seatable-select-option', {
|
|
40
|
+
'seatable-select-option-active': this.props.isActive
|
|
41
|
+
}),
|
|
42
|
+
tabIndex: "0",
|
|
43
|
+
role: "menuitem",
|
|
44
|
+
onClick: this.onSelectOption,
|
|
45
|
+
onKeyDown: this.onKeyDown,
|
|
34
46
|
onMouseEnter: this.onMouseEnter,
|
|
35
47
|
onMouseLeave: this.onMouseLeave,
|
|
36
48
|
children: this.props.children
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1718937171668" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="18368" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M489.6 444.8l294.4-294.4 67.2 67.2-294.4 294.4 294.4 294.4-67.2 67.2-294.4-294.4-272 272-67.2-67.2 272-272-272-272 67.2-67.2z" p-id="18369" fill="currentColor"></path></svg>
|
package/lib/index.js
CHANGED
|
@@ -118,10 +118,10 @@ Object.defineProperty(exports, "DTableCustomFooter", {
|
|
|
118
118
|
return _DTableCustomFooter.default;
|
|
119
119
|
}
|
|
120
120
|
});
|
|
121
|
-
Object.defineProperty(exports, "
|
|
121
|
+
Object.defineProperty(exports, "DTableCustomizeSearchInput", {
|
|
122
122
|
enumerable: true,
|
|
123
123
|
get: function () {
|
|
124
|
-
return
|
|
124
|
+
return _DTableCustomizeSearchInput.default;
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
Object.defineProperty(exports, "DTableCustomizeSelect", {
|
|
@@ -154,12 +154,6 @@ Object.defineProperty(exports, "DTableFiltersPopover", {
|
|
|
154
154
|
return _DTableFiltersPopover.default;
|
|
155
155
|
}
|
|
156
156
|
});
|
|
157
|
-
Object.defineProperty(exports, "DTableGroupSelect", {
|
|
158
|
-
enumerable: true,
|
|
159
|
-
get: function () {
|
|
160
|
-
return _index.default;
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
157
|
Object.defineProperty(exports, "DTableIcon", {
|
|
164
158
|
enumerable: true,
|
|
165
159
|
get: function () {
|
|
@@ -718,12 +712,11 @@ var _DTableRadio = _interopRequireDefault(require("./DTableRadio"));
|
|
|
718
712
|
var _DTableCommonAddTool = _interopRequireDefault(require("./DTableCommonAddTool"));
|
|
719
713
|
var _NotificationPopover = _interopRequireDefault(require("./NotificationPopover"));
|
|
720
714
|
var _DTableSelect = _interopRequireDefault(require("./DTableSelect"));
|
|
721
|
-
var _index = _interopRequireDefault(require("./DTableGroupSelect/index"));
|
|
722
715
|
var _dtableSelectLabel = _interopRequireDefault(require("./DTableSelect/dtable-select-label"));
|
|
723
716
|
var _DTableSwitch = _interopRequireDefault(require("./DTableSwitch"));
|
|
724
717
|
var _DTableCustomizeSelect = _interopRequireDefault(require("./DTableCustomizeSelect"));
|
|
725
|
-
var _DTableCustomizeCollaboratorSelect = _interopRequireDefault(require("./DTableCustomizeCollaboratorSelect"));
|
|
726
718
|
var _DTableSearchInput = _interopRequireDefault(require("./DTableSearchInput"));
|
|
719
|
+
var _DTableCustomizeSearchInput = _interopRequireDefault(require("./DTableCustomizeSearchInput"));
|
|
727
720
|
var _DTableColorPicker = _interopRequireDefault(require("./DTableColorPicker"));
|
|
728
721
|
var _ModalPortal = _interopRequireDefault(require("./ModalPortal"));
|
|
729
722
|
var _RoleStatusEditor = _interopRequireDefault(require("./RoleStatusEditor"));
|
package/package.json
CHANGED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
.dtable-customize-collaborator-select.dtable-select {
|
|
2
|
-
position: unset;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.dtable-customize-collaborator-select .collaborator-avatar {
|
|
6
|
-
width: 16px;
|
|
7
|
-
height: 16px;
|
|
8
|
-
transform: translateY(-1px);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.dtable-customize-collaborator-select .selected-option-show {
|
|
12
|
-
width: calc(100% - 20px);
|
|
13
|
-
height: 20px;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
.dtable-customize-collaborator-select .selected-option {
|
|
17
|
-
width: auto;
|
|
18
|
-
overflow-x: auto;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.dtable-customize-collaborator-select .dtable-icon-down3 {
|
|
22
|
-
margin-left: .5rem;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.dtable-customize-collaborator-select .option-collaborator {
|
|
26
|
-
display: flex;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.dtable-customize-collaborator-select .collaborator-container {
|
|
30
|
-
flex: 1 1;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.dtable-customize-collaborator-select .editor-list-delete .collaborator-container {
|
|
34
|
-
flex: 1 1;
|
|
35
|
-
display: inline;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.dtable-customize-collaborator-select .multiple-check-icon {
|
|
39
|
-
display: inline-flex;
|
|
40
|
-
width: 20px;
|
|
41
|
-
text-align: center;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.dtable-customize-collaborator-select .collaborator-check-icon .dtable-icon-check-mark,
|
|
45
|
-
.dtable-customize-collaborator-select .multiple-check-icon .dtable-icon-check-mark {
|
|
46
|
-
font-size: 12px;
|
|
47
|
-
color: #798d99;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.dtable-customize-collaborator-select.dtable-select .option-active,
|
|
51
|
-
.dtable-customize-collaborator-select.dtable-select .option:hover {
|
|
52
|
-
color: #212529;
|
|
53
|
-
background-color: #f5f5f5;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.dtable-customize-collaborator-select.dtable-select .option.option-active .select-option-name {
|
|
57
|
-
color: #212529;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.collaborator-select .option-group-content .collaborator,
|
|
61
|
-
.dtable-customize-collaborator-select .option-group .option-group-content .collaborator {
|
|
62
|
-
background: none;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.dtable-customize-collaborator-select .collaborator-avatar-container {
|
|
66
|
-
width: 16px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.dtable-customize-collaborator-select .option-group-content .remove-container {
|
|
70
|
-
display: none;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.dtable-customize-collaborator-select .collaborator-container {
|
|
74
|
-
display: flex;
|
|
75
|
-
justify-content: space-between;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
.collaborator-container .collaborator-name {
|
|
79
|
-
margin-left: 5px;
|
|
80
|
-
max-width: 200px;
|
|
81
|
-
color: #212529;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.collaborator-select .option-group {
|
|
85
|
-
max-height: fit-content;
|
|
86
|
-
}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.default = void 0;
|
|
9
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var _reactstrap = require("reactstrap");
|
|
12
|
-
var _dtableUtils = require("dtable-utils");
|
|
13
|
-
var _SelectOptionGroup = _interopRequireDefault(require("../SelectOptionGroup"));
|
|
14
|
-
require("./index.css");
|
|
15
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
class CollaboratorSelect extends _react.Component {
|
|
17
|
-
constructor(props) {
|
|
18
|
-
super(props);
|
|
19
|
-
this.onSelectToggle = event => {
|
|
20
|
-
event.preventDefault();
|
|
21
|
-
/*
|
|
22
|
-
if select is showing, click events do not need to be monitored by other click events,
|
|
23
|
-
so it can be closed when other select is clicked.
|
|
24
|
-
*/
|
|
25
|
-
if (this.state.isShowSelectOptions) event.nativeEvent.stopImmediatePropagation();
|
|
26
|
-
let eventClassName = event.target.className;
|
|
27
|
-
if (this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return;
|
|
28
|
-
// Prevent closing by pressing the spacebar in the search input
|
|
29
|
-
if (event.target.value === '') return;
|
|
30
|
-
this.selectedOptionWidth = this.selectedOptionRef.clientWidth;
|
|
31
|
-
this.setState({
|
|
32
|
-
isShowSelectOptions: !this.state.isShowSelectOptions
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
this.onMousedown = event => {
|
|
36
|
-
const name = event.target.className;
|
|
37
|
-
if (name === 'select-placeholder' || name.includes('icon-fork-number')) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (!this.selector.contains(event.target)) {
|
|
41
|
-
this.closeSelect();
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
this.closeSelect = () => {
|
|
45
|
-
this.setState({
|
|
46
|
-
isShowSelectOptions: false
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
this.getFilterOptions = searchValue => {
|
|
50
|
-
const _this$props = this.props,
|
|
51
|
-
options = _this$props.options,
|
|
52
|
-
searchable = _this$props.searchable;
|
|
53
|
-
if (!searchable) return options || [];
|
|
54
|
-
return (0, _dtableUtils.searchCollaborators)(options, searchValue);
|
|
55
|
-
};
|
|
56
|
-
this.renderOptionGroup = () => {
|
|
57
|
-
const _this$props2 = this.props,
|
|
58
|
-
value = _this$props2.value,
|
|
59
|
-
options = _this$props2.options,
|
|
60
|
-
searchable = _this$props2.searchable,
|
|
61
|
-
searchPlaceholder = _this$props2.searchPlaceholder,
|
|
62
|
-
noOptionsPlaceholder = _this$props2.noOptionsPlaceholder,
|
|
63
|
-
top = _this$props2.top,
|
|
64
|
-
left = _this$props2.left,
|
|
65
|
-
isUsePopover = _this$props2.isUsePopover;
|
|
66
|
-
if (!isUsePopover) {
|
|
67
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOptionGroup.default, {
|
|
68
|
-
value: value,
|
|
69
|
-
top: top,
|
|
70
|
-
left: left,
|
|
71
|
-
minWidth: this.btnWidth + 8 // 8px is padding
|
|
72
|
-
,
|
|
73
|
-
options: options,
|
|
74
|
-
onSelectOption: this.props.onSelectOption,
|
|
75
|
-
searchable: searchable,
|
|
76
|
-
searchPlaceholder: searchPlaceholder,
|
|
77
|
-
noOptionsPlaceholder: noOptionsPlaceholder,
|
|
78
|
-
closeSelect: this.closeSelect,
|
|
79
|
-
getFilterOptions: this.getFilterOptions,
|
|
80
|
-
supportMultipleSelect: this.props.supportMultipleSelect,
|
|
81
|
-
stopClickEvent: true,
|
|
82
|
-
isShowSelected: true
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Popover, {
|
|
86
|
-
placement: "bottom",
|
|
87
|
-
isOpen: true,
|
|
88
|
-
target: this.id,
|
|
89
|
-
fade: false,
|
|
90
|
-
hideArrow: true,
|
|
91
|
-
className: "dtable-customize-collaborator-select dtable-select",
|
|
92
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOptionGroup.default, {
|
|
93
|
-
value: value,
|
|
94
|
-
top: top,
|
|
95
|
-
left: left,
|
|
96
|
-
minWidth: this.btnWidth + 8 // 8px is padding
|
|
97
|
-
,
|
|
98
|
-
options: options,
|
|
99
|
-
onSelectOption: this.props.onSelectOption,
|
|
100
|
-
searchable: searchable,
|
|
101
|
-
searchPlaceholder: searchPlaceholder,
|
|
102
|
-
noOptionsPlaceholder: noOptionsPlaceholder,
|
|
103
|
-
closeSelect: this.closeSelect,
|
|
104
|
-
getFilterOptions: this.getFilterOptions,
|
|
105
|
-
supportMultipleSelect: this.props.supportMultipleSelect,
|
|
106
|
-
stopClickEvent: true,
|
|
107
|
-
isShowSelected: true
|
|
108
|
-
})
|
|
109
|
-
});
|
|
110
|
-
};
|
|
111
|
-
this.state = {
|
|
112
|
-
isShowSelectOptions: false
|
|
113
|
-
};
|
|
114
|
-
this.id = 'collaborator-select-' + Math.trunc(Math.random() * 10000);
|
|
115
|
-
}
|
|
116
|
-
componentDidMount() {
|
|
117
|
-
document.addEventListener('mousedown', this.onMousedown);
|
|
118
|
-
this.btnWidth = this.selector.clientWidth;
|
|
119
|
-
}
|
|
120
|
-
componentWillUnmount() {
|
|
121
|
-
document.removeEventListener('mousedown', this.onMousedown);
|
|
122
|
-
}
|
|
123
|
-
render() {
|
|
124
|
-
let _this$props3 = this.props,
|
|
125
|
-
className = _this$props3.className,
|
|
126
|
-
value = _this$props3.value,
|
|
127
|
-
placeholder = _this$props3.placeholder,
|
|
128
|
-
isLocked = _this$props3.isLocked;
|
|
129
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
130
|
-
ref: node => this.selector = node,
|
|
131
|
-
className: (0, _classnames.default)('dtable-select custom-select collaborator-select', {
|
|
132
|
-
'focus': this.state.isShowSelectOptions
|
|
133
|
-
}, {
|
|
134
|
-
'disabled': isLocked
|
|
135
|
-
}, className),
|
|
136
|
-
id: this.id,
|
|
137
|
-
onClick: this.onSelectToggle,
|
|
138
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
139
|
-
className: "selected-option",
|
|
140
|
-
ref: node => this.selectedOptionRef = node,
|
|
141
|
-
children: [value.label ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
142
|
-
className: "selected-option-show",
|
|
143
|
-
children: value.label
|
|
144
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
145
|
-
className: "select-placeholder",
|
|
146
|
-
children: placeholder
|
|
147
|
-
}), !isLocked && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
148
|
-
className: "dtable-font dtable-icon-down3"
|
|
149
|
-
})]
|
|
150
|
-
}), this.state.isShowSelectOptions && this.renderOptionGroup()]
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
CollaboratorSelect.defaultProps = {
|
|
155
|
-
top: -3,
|
|
156
|
-
left: -3
|
|
157
|
-
};
|
|
158
|
-
var _default = exports.default = CollaboratorSelect;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
.group-select {
|
|
2
|
-
position: relative;
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
.group-select.custom-select {
|
|
6
|
-
display: flex;
|
|
7
|
-
padding: 5px 10px;
|
|
8
|
-
border-radius: 3px;
|
|
9
|
-
align-items: center;
|
|
10
|
-
justify-content: space-between;
|
|
11
|
-
max-width: 900px;
|
|
12
|
-
user-select: none;
|
|
13
|
-
text-align: left;
|
|
14
|
-
border-color: 1px solid rgba(0, 40, 100, 0.12);
|
|
15
|
-
height: auto;
|
|
16
|
-
min-height: 38px;
|
|
17
|
-
cursor: pointer;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
.group-select.custom-select:focus,
|
|
21
|
-
.group-select.custom-select.focus {
|
|
22
|
-
border-color: #1991eb !important;
|
|
23
|
-
box-shadow: 0 0 0 2px rgba(70, 127, 207, 0.25);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.group-select.custom-select.disabled:focus,
|
|
27
|
-
.group-select.custom-select.focus.disabled,
|
|
28
|
-
.group-select.custom-select.disabled:hover {
|
|
29
|
-
border-color: rgba(0, 40, 100, 0.12) !important;
|
|
30
|
-
box-shadow: unset;
|
|
31
|
-
cursor: default;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.group-select .sf3-font-down {
|
|
35
|
-
display: inline-block;
|
|
36
|
-
color: #999;
|
|
37
|
-
transform: translateY(2px);
|
|
38
|
-
transition: all 0.1s;
|
|
39
|
-
font-size: 14px !important;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.group-select .sf3-font-down:hover {
|
|
43
|
-
color: #666;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.group-select .selected-option {
|
|
47
|
-
display: flex;
|
|
48
|
-
flex: 1;
|
|
49
|
-
overflow: hidden;
|
|
50
|
-
flex-wrap: nowrap;
|
|
51
|
-
align-items: center;
|
|
52
|
-
justify-content: space-between;
|
|
53
|
-
background: #fff;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.group-select.dtable-ui-collaborator-selector .option-group .option-group-content {
|
|
57
|
-
padding: 10px;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.group-select.custom-select.dtable-ui-collaborator-selector .option-group .option-group-content {
|
|
61
|
-
padding: 10px 0;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.group-select.custom-select.dtable-ui-collaborator-selector .option {
|
|
65
|
-
padding: 5px 0 5px 10px !important;
|
|
66
|
-
line-height: 20px;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
.group-select .select-placeholder {
|
|
70
|
-
line-height: 1;
|
|
71
|
-
font-size: 14px;
|
|
72
|
-
white-space: nowrap;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
.group-select .selected-option-show {
|
|
76
|
-
display: flex;
|
|
77
|
-
flex-wrap: wrap;
|
|
78
|
-
gap: 4px;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.group-select .selected-option-show .selected-option-item {
|
|
82
|
-
background-color: rgb(240, 240, 240);
|
|
83
|
-
border-radius: 16px;
|
|
84
|
-
display: flex;
|
|
85
|
-
align-items: center;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.group-select .selected-option-show .selected-option-item .selected-option-item-name {
|
|
89
|
-
font-size: 13px;
|
|
90
|
-
color: #212529;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.group-select .selected-option-show .selected-option-item .dtable-icon-x {
|
|
94
|
-
cursor: pointer;
|
|
95
|
-
color: rgb(103, 103, 103);
|
|
96
|
-
}
|