dtable-ui-component 7.0.1-beta.5 → 7.0.1-beta.btn2
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 +28 -38
- package/lib/AsyncUserSelect/index.js +18 -29
- package/lib/DTableCustomizeCollaboratorSelect/index.css +86 -0
- package/lib/DTableCustomizeCollaboratorSelect/index.js +158 -0
- package/lib/DTableCustomizeSelect/index.css +42 -120
- package/lib/DTableCustomizeSelect/index.js +6 -12
- package/lib/DTableFiltersPopover/index.js +9 -8
- package/lib/DTableFiltersPopover/utils/filter-item-utils.js +19 -7
- package/lib/DTableFiltersPopover/widgets/collaborator-filter/index.js +9 -5
- package/lib/DTableFiltersPopover/widgets/filter-group.js +1 -1
- package/lib/DTableFiltersPopover/widgets/filter-item.js +8 -16
- package/lib/DTableFiltersPopover/widgets/filter-list/index.css +8 -8
- package/lib/DTableGroupSelect/index.css +96 -0
- package/lib/DTableGroupSelect/index.js +131 -0
- package/lib/DTableGroupSelect/option.js +42 -0
- package/lib/DTableGroupSelect/select-option-group.css +54 -0
- package/lib/DTableGroupSelect/select-option-group.js +227 -0
- package/lib/DTableModalHeader/index.js +3 -10
- package/lib/DTableSelect/dtable-select-label.css +3 -8
- package/lib/DTableSelect/dtable-select-label.js +1 -1
- package/lib/DTableSelect/index.js +3 -3
- package/lib/DTableSelect/user-select.css +46 -7
- package/lib/DTableSelect/utils.js +79 -166
- package/lib/FieldDisplaySetting/index.js +1 -1
- package/lib/ImageEditor/images-previewer/image-preview/index.js +2 -1
- package/lib/ImageEditor/pc-editor/addition-previewer/local-image-addition/index.js +2 -2
- package/lib/ImageFormatter/images-lazy-load.js +2 -2
- package/lib/ImageFormatter/index.js +5 -2
- package/lib/ImagePreviewerLightbox/index.js +2 -1
- package/lib/ImageThumbnail/index.js +2 -1
- package/lib/SelectItem/index.js +1 -1
- package/lib/SelectOptionGroup/KeyCodes.js +4 -96
- package/lib/SelectOptionGroup/index.css +54 -44
- package/lib/SelectOptionGroup/index.js +18 -35
- package/lib/SelectOptionGroup/option.js +4 -16
- package/lib/index.js +10 -3
- package/lib/utils/url.js +10 -35
- package/package.json +2 -2
- package/lib/DTableCustomizeSearchInput/index.css +0 -75
- package/lib/DTableCustomizeSearchInput/index.js +0 -133
- package/lib/DTableModalHeader/index.css +0 -22
- package/lib/DTableSelect/select-dropdown-indicator/index.css +0 -16
- package/lib/DTableSelect/select-dropdown-indicator/index.js +0 -24
- package/lib/assets/icons/close.svg +0 -1
- package/lib/assets/icons/down.svg +0 -3
|
@@ -8,10 +8,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.default = void 0;
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _SelectOptionGroup = _interopRequireDefault(require("../SelectOptionGroup"));
|
|
11
|
-
var _DTableIcon = _interopRequireDefault(require("../DTableIcon"));
|
|
12
11
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
12
|
var _ModalPortal = _interopRequireDefault(require("../ModalPortal"));
|
|
14
|
-
var _utils = require("../utils/utils");
|
|
15
13
|
require("./index.css");
|
|
16
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
15
|
class DTableCustomizeSelect extends _react.Component {
|
|
@@ -24,8 +22,8 @@ class DTableCustomizeSelect extends _react.Component {
|
|
|
24
22
|
so it can be closed when other select is clicked.
|
|
25
23
|
*/
|
|
26
24
|
if (this.state.isShowSelectOptions) event.stopPropagation();
|
|
27
|
-
|
|
28
|
-
if (this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === '
|
|
25
|
+
let eventClassName = event.target.className;
|
|
26
|
+
if (this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'option-group-search') return;
|
|
29
27
|
// Prevent closing by pressing the spacebar in the search input
|
|
30
28
|
if (event.target.value === '') return;
|
|
31
29
|
this.setState({
|
|
@@ -33,7 +31,7 @@ class DTableCustomizeSelect extends _react.Component {
|
|
|
33
31
|
});
|
|
34
32
|
};
|
|
35
33
|
this.onClick = event => {
|
|
36
|
-
if (this.props.isShowSelected &&
|
|
34
|
+
if (this.props.isShowSelected && event.target.className.includes('icon-fork-number')) {
|
|
37
35
|
return;
|
|
38
36
|
}
|
|
39
37
|
if (!this.selector.contains(event.target)) {
|
|
@@ -95,7 +93,7 @@ class DTableCustomizeSelect extends _react.Component {
|
|
|
95
93
|
component = _this$props2.component;
|
|
96
94
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
97
95
|
ref: node => this.selector = node,
|
|
98
|
-
className: (0, _classnames.default)('
|
|
96
|
+
className: (0, _classnames.default)('dtable-select custom-select', {
|
|
99
97
|
'focus': this.state.isShowSelectOptions
|
|
100
98
|
}, {
|
|
101
99
|
'disabled': isLocked
|
|
@@ -109,12 +107,8 @@ class DTableCustomizeSelect extends _react.Component {
|
|
|
109
107
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
110
108
|
className: "select-placeholder",
|
|
111
109
|
children: placeholder
|
|
112
|
-
}), !isLocked && /*#__PURE__*/(0, _jsxRuntime.jsx)("
|
|
113
|
-
className: "
|
|
114
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableIcon.default, {
|
|
115
|
-
symbol: "down",
|
|
116
|
-
color: "var(--bs-icon-color)"
|
|
117
|
-
})
|
|
110
|
+
}), !isLocked && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
111
|
+
className: "dtable-font dtable-icon-down3"
|
|
118
112
|
})]
|
|
119
113
|
}), this.state.isShowSelectOptions && !isInModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_SelectOptionGroup.default, {
|
|
120
114
|
value: value,
|
|
@@ -147,28 +147,29 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
147
147
|
addIconClassName: "popover-add-icon"
|
|
148
148
|
}), isSupportAdvanced && !readOnly && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
149
149
|
className: "add-buttons",
|
|
150
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
151
|
-
className: "
|
|
150
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Button, {
|
|
151
|
+
className: "mr-4",
|
|
152
152
|
onClick: canAddFilter ? () => this.addFilter() : () => {},
|
|
153
|
-
role: "button",
|
|
154
153
|
tabIndex: 0,
|
|
155
154
|
"aria-label": (0, _lang.getLocale)('Add_filter'),
|
|
155
|
+
color: "filled",
|
|
156
|
+
size: "middle",
|
|
156
157
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
157
158
|
"aria-hidden": "true",
|
|
158
|
-
className: "dtable-font dtable-icon-add-table
|
|
159
|
+
className: "dtable-font dtable-icon-add-table"
|
|
159
160
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
160
161
|
className: "add-new-option",
|
|
161
162
|
children: (0, _lang.getLocale)('Add_filter')
|
|
162
163
|
})]
|
|
163
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
164
|
-
className: "btn-add-filter-group",
|
|
164
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactstrap.Button, {
|
|
165
165
|
onClick: canAddFilter ? () => this.addFilterGroup() : () => {},
|
|
166
|
-
|
|
166
|
+
color: "filled",
|
|
167
|
+
size: "middle",
|
|
167
168
|
tabIndex: 0,
|
|
168
169
|
"aria-label": (0, _lang.getLocale)('Add_filter_group'),
|
|
169
170
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
170
171
|
"aria-hidden": "true",
|
|
171
|
-
className: "dtable-font dtable-icon-add-table
|
|
172
|
+
className: "dtable-font dtable-icon-add-table"
|
|
172
173
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
173
174
|
className: "add-new-option",
|
|
174
175
|
children: (0, _lang.getLocale)('Add_filter_group')
|
|
@@ -91,9 +91,9 @@ class FilterItemUtils {
|
|
|
91
91
|
value: {
|
|
92
92
|
columnOption: option
|
|
93
93
|
},
|
|
94
|
-
label: /*#__PURE__*/(0, _jsxRuntime.
|
|
94
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
95
95
|
className: "select-option-name single-select-option-name",
|
|
96
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
96
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
97
97
|
className: "single-select-option",
|
|
98
98
|
style: {
|
|
99
99
|
background: option.color,
|
|
@@ -102,16 +102,23 @@ class FilterItemUtils {
|
|
|
102
102
|
title: option.name,
|
|
103
103
|
"aria-label": option.name,
|
|
104
104
|
children: option.name
|
|
105
|
-
})
|
|
105
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
106
|
+
className: "single-select-check-icon",
|
|
107
|
+
children: (selectedOption === null || selectedOption === void 0 ? void 0 : selectedOption.id) === option.id && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
108
|
+
className: "option-edit dtable-font dtable-icon-check-mark"
|
|
109
|
+
})
|
|
110
|
+
})]
|
|
106
111
|
})
|
|
107
112
|
};
|
|
108
113
|
}
|
|
109
114
|
static generatorMultipleSelectOption(option, filterTerm) {
|
|
110
115
|
return {
|
|
111
|
-
value:
|
|
112
|
-
|
|
116
|
+
value: {
|
|
117
|
+
columnOption: option
|
|
118
|
+
},
|
|
119
|
+
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
113
120
|
className: "select-option-name multiple-option-name",
|
|
114
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
121
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
115
122
|
className: "multiple-select-option",
|
|
116
123
|
style: {
|
|
117
124
|
background: option.color,
|
|
@@ -120,7 +127,12 @@ class FilterItemUtils {
|
|
|
120
127
|
title: option.name,
|
|
121
128
|
"aria-label": option.name,
|
|
122
129
|
children: option.name
|
|
123
|
-
})
|
|
130
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
131
|
+
className: "multiple-check-icon",
|
|
132
|
+
children: filterTerm.indexOf(option.id) > -1 && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
133
|
+
className: "option-edit dtable-font dtable-icon-check-mark"
|
|
134
|
+
})
|
|
135
|
+
})]
|
|
124
136
|
})
|
|
125
137
|
};
|
|
126
138
|
}
|
|
@@ -16,15 +16,16 @@ class CollaboratorFilter extends _react.Component {
|
|
|
16
16
|
super(props);
|
|
17
17
|
this.createCollaboratorOptions = (filterIndex, collaborators, filterTerm) => {
|
|
18
18
|
return collaborators.map(collaborator => {
|
|
19
|
+
let isSelected = filterTerm.findIndex(item => item === collaborator.email) > -1;
|
|
19
20
|
return {
|
|
20
21
|
value: {
|
|
21
22
|
filterIndex,
|
|
22
23
|
columnOption: collaborator
|
|
23
24
|
},
|
|
24
25
|
label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {
|
|
25
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
26
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
26
27
|
className: "select-option-name option-collaborator",
|
|
27
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
28
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
28
29
|
className: "collaborator-container",
|
|
29
30
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
30
31
|
className: "collaborator",
|
|
@@ -45,7 +46,12 @@ class CollaboratorFilter extends _react.Component {
|
|
|
45
46
|
children: collaborator.name
|
|
46
47
|
})]
|
|
47
48
|
})
|
|
48
|
-
})
|
|
49
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
50
|
+
className: "collaborator-check-icon",
|
|
51
|
+
children: isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
52
|
+
className: "option-edit dtable-font dtable-icon-check-mark"
|
|
53
|
+
})
|
|
54
|
+
})]
|
|
49
55
|
})
|
|
50
56
|
})
|
|
51
57
|
};
|
|
@@ -100,9 +106,7 @@ class CollaboratorFilter extends _react.Component {
|
|
|
100
106
|
})]
|
|
101
107
|
}, item);
|
|
102
108
|
});
|
|
103
|
-
let selectCollaborators = Array.isArray(filterTerm) && filterTerm.length > 0 ? collaborators.filter(col => filterTerm.includes(col.email)) : [];
|
|
104
109
|
let value = selectedCollaborators ? {
|
|
105
|
-
value: selectCollaborators,
|
|
106
110
|
label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
107
111
|
children: selectedCollaborators
|
|
108
112
|
})
|
|
@@ -138,7 +138,7 @@ class FilterGroup extends _react.Component {
|
|
|
138
138
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
139
139
|
className: (0, _classnames.default)('filter-item', 'filter-group', "level-".concat(level)),
|
|
140
140
|
children: [!readOnly && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
141
|
-
className: "delete-filter",
|
|
141
|
+
className: "delete-filter seatable-icon-btn",
|
|
142
142
|
onClick: this.deleteFilterGroup,
|
|
143
143
|
role: "button",
|
|
144
144
|
tabIndex: 0,
|
|
@@ -128,7 +128,8 @@ class FilterItem extends _react.default.Component {
|
|
|
128
128
|
const _this$props5 = this.props,
|
|
129
129
|
index = _this$props5.index,
|
|
130
130
|
filter = _this$props5.filter;
|
|
131
|
-
|
|
131
|
+
const option = value.columnOption;
|
|
132
|
+
let newFilter = (0, _utils.getUpdatedFilterBySelectMultiple)(filter, option);
|
|
132
133
|
this.resetState(newFilter);
|
|
133
134
|
this.props.updateFilter(index, newFilter);
|
|
134
135
|
};
|
|
@@ -136,7 +137,8 @@ class FilterItem extends _react.default.Component {
|
|
|
136
137
|
const _this$props6 = this.props,
|
|
137
138
|
index = _this$props6.index,
|
|
138
139
|
filter = _this$props6.filter;
|
|
139
|
-
|
|
140
|
+
const collaborator = value.columnOption;
|
|
141
|
+
let newFilter = (0, _utils.getUpdatedFilterByCollaborator)(filter, collaborator);
|
|
140
142
|
this.resetState(newFilter);
|
|
141
143
|
this.props.updateFilter(index, newFilter);
|
|
142
144
|
};
|
|
@@ -144,10 +146,7 @@ class FilterItem extends _react.default.Component {
|
|
|
144
146
|
const _this$props7 = this.props,
|
|
145
147
|
index = _this$props7.index,
|
|
146
148
|
filter = _this$props7.filter;
|
|
147
|
-
const collaborator = value
|
|
148
|
-
if (!collaborator || !collaborator.email) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
149
|
+
const collaborator = value.columnOption;
|
|
151
150
|
let newFilter = (0, _utils.getUpdatedFilterByCreator)(filter, collaborator);
|
|
152
151
|
// the predicate is 'is' or 'is not'
|
|
153
152
|
if (!newFilter) {
|
|
@@ -295,12 +294,11 @@ class FilterItem extends _react.default.Component {
|
|
|
295
294
|
}
|
|
296
295
|
const className = 'select-option-name multiple-select-option';
|
|
297
296
|
let labelArray = [];
|
|
298
|
-
let valueArray = [];
|
|
299
297
|
if (Array.isArray(options) && Array.isArray(filterTerm)) {
|
|
300
298
|
filterTerm.forEach(item => {
|
|
301
299
|
let inOption = options.find(option => option.id === item);
|
|
302
300
|
let optionStyle = {
|
|
303
|
-
margin: '0
|
|
301
|
+
margin: '0 10px 0 0'
|
|
304
302
|
};
|
|
305
303
|
let optionName = null;
|
|
306
304
|
if (inOption) {
|
|
@@ -311,7 +309,6 @@ class FilterItem extends _react.default.Component {
|
|
|
311
309
|
optionStyle.background = _constants.DELETED_OPTION_BACKGROUND_COLOR;
|
|
312
310
|
optionName = (0, _lang.getLocale)(_constants.DELETED_OPTION_TIPS);
|
|
313
311
|
}
|
|
314
|
-
valueArray.push(inOption);
|
|
315
312
|
labelArray.push(/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
316
313
|
className: className,
|
|
317
314
|
style: optionStyle,
|
|
@@ -322,7 +319,6 @@ class FilterItem extends _react.default.Component {
|
|
|
322
319
|
});
|
|
323
320
|
}
|
|
324
321
|
const selectedOptionNames = labelArray.length > 0 ? {
|
|
325
|
-
value: valueArray,
|
|
326
322
|
label: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react.Fragment, {
|
|
327
323
|
children: labelArray
|
|
328
324
|
})
|
|
@@ -429,9 +425,6 @@ class FilterItem extends _react.default.Component {
|
|
|
429
425
|
color: selectedOption.textColor || null
|
|
430
426
|
};
|
|
431
427
|
selectedOptionName = {
|
|
432
|
-
value: {
|
|
433
|
-
columnOption: selectedOption
|
|
434
|
-
},
|
|
435
428
|
label: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
436
429
|
className: className,
|
|
437
430
|
style: style,
|
|
@@ -514,8 +507,7 @@ class FilterItem extends _react.default.Component {
|
|
|
514
507
|
collaborators: creators,
|
|
515
508
|
onSelectCollaborator: this.onSelectCreator,
|
|
516
509
|
isInModal: this.props.isInModal,
|
|
517
|
-
readOnly: readOnly
|
|
518
|
-
filter_predicate: filter_predicate
|
|
510
|
+
readOnly: readOnly
|
|
519
511
|
});
|
|
520
512
|
}
|
|
521
513
|
case _dtableUtils.CellType.RATE:
|
|
@@ -709,7 +701,7 @@ class FilterItem extends _react.default.Component {
|
|
|
709
701
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
710
702
|
className: "filter-item",
|
|
711
703
|
children: [!readOnly && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
712
|
-
className: "delete-filter",
|
|
704
|
+
className: "delete-filter seatable-icon-btn",
|
|
713
705
|
onClick: this.onDeleteFilter,
|
|
714
706
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
715
707
|
className: "dtable-font dtable-icon-fork-number"
|
|
@@ -289,8 +289,8 @@
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
.dtable-ui-filters-list .delete-filter {
|
|
292
|
-
width:
|
|
293
|
-
height:
|
|
292
|
+
width: 24px;
|
|
293
|
+
height: 24px;
|
|
294
294
|
margin-right: 14px;
|
|
295
295
|
text-align: center;
|
|
296
296
|
}
|
|
@@ -301,8 +301,8 @@
|
|
|
301
301
|
|
|
302
302
|
.dtable-ui-filters-list .delete-filter .dtable-icon-fork-number {
|
|
303
303
|
display: inline-block;
|
|
304
|
-
font-size:
|
|
305
|
-
color:
|
|
304
|
+
font-size: 16px;
|
|
305
|
+
color: var(--bs-icon-color);
|
|
306
306
|
}
|
|
307
307
|
|
|
308
308
|
.dtable-ui-filters-list .multiple-option-name {
|
|
@@ -333,7 +333,7 @@
|
|
|
333
333
|
display: inline-flex;
|
|
334
334
|
align-items: center;
|
|
335
335
|
height: 20px;
|
|
336
|
-
margin-right:
|
|
336
|
+
margin-right: 10px;
|
|
337
337
|
padding: 0 8px 0 2px;
|
|
338
338
|
font-size: 13px;
|
|
339
339
|
border-radius: 10px;
|
|
@@ -388,7 +388,7 @@
|
|
|
388
388
|
}
|
|
389
389
|
|
|
390
390
|
.dtable-ui-filters-list .filter-item .dtable-icon-fork-number:hover {
|
|
391
|
-
color:
|
|
391
|
+
color: var(--bs-icon-color);
|
|
392
392
|
}
|
|
393
393
|
|
|
394
394
|
.dtable-ui-filters-list .filter-container-readonly .dtable-select .selected-option-show,
|
|
@@ -412,14 +412,14 @@
|
|
|
412
412
|
|
|
413
413
|
.filter-header-icon {
|
|
414
414
|
display: inline-block;
|
|
415
|
-
padding
|
|
415
|
+
padding: 0 0.3125rem;
|
|
416
416
|
margin-left: -0.3125rem;
|
|
417
417
|
}
|
|
418
418
|
|
|
419
419
|
.filter-header-icon .dtable-font,
|
|
420
420
|
.filter-header-icon .multicolor-icon {
|
|
421
421
|
font-size: 14px;
|
|
422
|
-
color:
|
|
422
|
+
color: #aaa;
|
|
423
423
|
cursor: default;
|
|
424
424
|
}
|
|
425
425
|
|
|
@@ -0,0 +1,96 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
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 _ModalPortal = _interopRequireDefault(require("../ModalPortal"));
|
|
12
|
+
var _selectOptionGroup = _interopRequireDefault(require("./select-option-group"));
|
|
13
|
+
require("./index.css");
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
class DTableGroupSelect extends _react.Component {
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(props);
|
|
18
|
+
this.onSelectToggle = event => {
|
|
19
|
+
event.preventDefault();
|
|
20
|
+
if (this.state.isShowSelectOptions) event.stopPropagation();
|
|
21
|
+
let eventClassName = event.target.className;
|
|
22
|
+
if (eventClassName.indexOf('dtable-icon-x') > -1 || eventClassName === 'option-group-search') return;
|
|
23
|
+
if (event.target.value === '') return;
|
|
24
|
+
this.setState({
|
|
25
|
+
isShowSelectOptions: !this.state.isShowSelectOptions
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
this.onClickOutside = event => {
|
|
29
|
+
if (this.props.isShowSelected && event.target.className.includes('icon-fork-number')) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (!this.selector.contains(event.target)) {
|
|
33
|
+
this.closeSelect();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
this.closeSelect = () => {
|
|
37
|
+
this.setState({
|
|
38
|
+
isShowSelectOptions: false
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
this.getSelectedOptionTop = () => {
|
|
42
|
+
if (!this.selector) return 38;
|
|
43
|
+
const _this$selector$getBou = this.selector.getBoundingClientRect(),
|
|
44
|
+
height = _this$selector$getBou.height;
|
|
45
|
+
return height;
|
|
46
|
+
};
|
|
47
|
+
this.getFilterOptions = searchValue => {
|
|
48
|
+
const options = this.props.options;
|
|
49
|
+
const validSearchVal = searchValue.trim().toLowerCase();
|
|
50
|
+
if (!validSearchVal) return options || [];
|
|
51
|
+
return options.filter(option => option.name.toLowerCase().includes(validSearchVal));
|
|
52
|
+
};
|
|
53
|
+
this.state = {
|
|
54
|
+
isShowSelectOptions: false
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
58
|
+
if (nextProps.selectedOptions.length !== this.props.selectedOptions.length) {
|
|
59
|
+
// when selectedOptions change and dom rendered, calculate top
|
|
60
|
+
setTimeout(() => {
|
|
61
|
+
this.forceUpdate();
|
|
62
|
+
}, 1);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
render() {
|
|
66
|
+
let _this$props = this.props,
|
|
67
|
+
className = _this$props.className,
|
|
68
|
+
selectedOptions = _this$props.selectedOptions,
|
|
69
|
+
options = _this$props.options,
|
|
70
|
+
placeholder = _this$props.placeholder,
|
|
71
|
+
searchPlaceholder = _this$props.searchPlaceholder,
|
|
72
|
+
noOptionsPlaceholder = _this$props.noOptionsPlaceholder,
|
|
73
|
+
isInModal = _this$props.isInModal;
|
|
74
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
75
|
+
ref: node => this.selector = node,
|
|
76
|
+
className: (0, _classnames.default)('group-select custom-select', {
|
|
77
|
+
'focus': this.state.isShowSelectOptions
|
|
78
|
+
}, className),
|
|
79
|
+
onClick: this.onSelectToggle,
|
|
80
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
81
|
+
className: "selected-option",
|
|
82
|
+
children: [selectedOptions.length > 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
83
|
+
className: "selected-option-show",
|
|
84
|
+
children: selectedOptions.map(item => /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
85
|
+
className: "selected-option-item mr-1 pr-1 pl-2",
|
|
86
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
87
|
+
className: "selected-option-item-name",
|
|
88
|
+
children: item.name
|
|
89
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
90
|
+
className: "dtable-font dtable-icon-x ml-1",
|
|
91
|
+
onClick: () => {
|
|
92
|
+
this.props.onDeleteOption(item);
|
|
93
|
+
}
|
|
94
|
+
})]
|
|
95
|
+
}, item.id))
|
|
96
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
97
|
+
className: "select-placeholder",
|
|
98
|
+
children: placeholder
|
|
99
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
100
|
+
className: "sf3-font-down sf3-font"
|
|
101
|
+
})]
|
|
102
|
+
}), this.state.isShowSelectOptions && !isInModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_selectOptionGroup.default, {
|
|
103
|
+
selectedOptions: selectedOptions,
|
|
104
|
+
top: this.getSelectedOptionTop(),
|
|
105
|
+
options: options,
|
|
106
|
+
onSelectOption: this.props.onSelectOption,
|
|
107
|
+
searchPlaceholder: searchPlaceholder,
|
|
108
|
+
noOptionsPlaceholder: noOptionsPlaceholder,
|
|
109
|
+
onClickOutside: this.onClickOutside,
|
|
110
|
+
closeSelect: this.closeSelect,
|
|
111
|
+
getFilterOptions: this.getFilterOptions
|
|
112
|
+
}), this.state.isShowSelectOptions && isInModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalPortal.default, {
|
|
113
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_selectOptionGroup.default, {
|
|
114
|
+
className: className,
|
|
115
|
+
selectedOptions: selectedOptions,
|
|
116
|
+
position: this.selector.getBoundingClientRect(),
|
|
117
|
+
isInModal: isInModal,
|
|
118
|
+
top: this.getSelectedOptionTop(),
|
|
119
|
+
options: options,
|
|
120
|
+
onSelectOption: this.props.onSelectOption,
|
|
121
|
+
searchPlaceholder: searchPlaceholder,
|
|
122
|
+
noOptionsPlaceholder: noOptionsPlaceholder,
|
|
123
|
+
onClickOutside: this.onClickOutside,
|
|
124
|
+
closeSelect: this.closeSelect,
|
|
125
|
+
getFilterOptions: this.getFilterOptions
|
|
126
|
+
})
|
|
127
|
+
})]
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
var _default = exports.default = DTableGroupSelect;
|
|
@@ -0,0 +1,42 @@
|
|
|
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 _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
class Option extends _react.Component {
|
|
13
|
+
constructor() {
|
|
14
|
+
super(...arguments);
|
|
15
|
+
this.onSelectOption = e => {
|
|
16
|
+
e.stopPropagation();
|
|
17
|
+
this.props.onSelectOption(this.props.option);
|
|
18
|
+
};
|
|
19
|
+
this.onMouseEnter = () => {
|
|
20
|
+
if (!this.props.disableHover) {
|
|
21
|
+
this.props.changeIndex(this.props.index);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
this.onMouseLeave = () => {
|
|
25
|
+
if (!this.props.disableHover) {
|
|
26
|
+
this.props.changeIndex(-1);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
32
|
+
className: (0, _classnames.default)('d-flex option', {
|
|
33
|
+
'option-active': this.props.isActive
|
|
34
|
+
}),
|
|
35
|
+
onClick: this.onSelectOption,
|
|
36
|
+
onMouseEnter: this.onMouseEnter,
|
|
37
|
+
onMouseLeave: this.onMouseLeave,
|
|
38
|
+
children: this.props.children
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
var _default = exports.default = Option;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
.group-selector .option {
|
|
2
|
+
display: block;
|
|
3
|
+
width: 100%;
|
|
4
|
+
line-height: 24px;
|
|
5
|
+
padding: 6px 10px;
|
|
6
|
+
clear: both;
|
|
7
|
+
font-weight: 400;
|
|
8
|
+
text-align: inherit;
|
|
9
|
+
background-color: transparent;
|
|
10
|
+
border: 0;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
text-overflow: ellipsis;
|
|
13
|
+
white-space: nowrap;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: space-between;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.group-selector .option .dtable-icon-check-mark {
|
|
20
|
+
font-size: 12px;
|
|
21
|
+
color: #798d99;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.group-selector .option.option-active {
|
|
25
|
+
background-color: #20a0ff;
|
|
26
|
+
color: #fff;
|
|
27
|
+
cursor: pointer;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.group-selector .option.option-active .dtable-icon-check-mark,
|
|
31
|
+
.group-selector .option.option-active .select-option-name {
|
|
32
|
+
color: #fff !important;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.group-selector .option .select-option-name .single-select-option {
|
|
36
|
+
margin: 0 0 0 12px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.group-selector .option .select-option-name .multiple-select-option {
|
|
40
|
+
margin: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.group-selector .option-group-dtable-ui-single-select-selector .select-option-name {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: space-between;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.group-selector .option-group-dtable-ui-single-select-selector .option:hover,
|
|
50
|
+
.group-selector .option-group-dtable-ui-single-select-selector .option.option-active,
|
|
51
|
+
.group-selector .option-group-dtable-ui-multiple-select-selector .option:hover,
|
|
52
|
+
.group-selector .option-group-dtable-ui-multiple-select-selector .option.option-active {
|
|
53
|
+
background-color: #f5f5f5;
|
|
54
|
+
}
|