dtable-ui-component 7.0.5-pal.2 → 7.0.5-pal.6
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 +8 -6
- package/lib/AsyncUserSelect/index.js +67 -61
- package/lib/DTableCustomizeSelect/index.css +3 -5
- package/lib/DTableCustomizeSelect/index.js +0 -1
- package/lib/DTableSelect/dtable-select-label.css +7 -0
- package/lib/DTableSelect/utils.js +1 -1
- package/package.json +1 -1
|
@@ -29,10 +29,13 @@
|
|
|
29
29
|
height: 12px;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.dtable-ui-user-select-popover
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
.dtable-ui-user-select-popover {
|
|
33
|
+
background: #fff;
|
|
34
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
35
|
+
border-radius: 4px;
|
|
36
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
37
|
+
z-index: 1060;
|
|
38
|
+
min-width: 260px;
|
|
36
39
|
}
|
|
37
40
|
|
|
38
41
|
.dtable-ui-user-select-container {
|
|
@@ -40,8 +43,7 @@
|
|
|
40
43
|
}
|
|
41
44
|
|
|
42
45
|
.dtable-ui-user-select-container .dtable-ui-user-list-container {
|
|
43
|
-
min-height:
|
|
44
|
-
max-height: 200px;
|
|
46
|
+
min-height: 32px;
|
|
45
47
|
padding: 8px;
|
|
46
48
|
overflow: auto;
|
|
47
49
|
position: relative;
|
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
9
9
|
var _react = require("react");
|
|
10
10
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
11
|
-
var
|
|
11
|
+
var _ModalPortal = _interopRequireDefault(require("../ModalPortal"));
|
|
12
12
|
var _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
|
|
13
13
|
var _DTableCustomizeSearchInput = _interopRequireDefault(require("../DTableCustomizeSearchInput"));
|
|
14
14
|
var _userItem = _interopRequireDefault(require("./user-item"));
|
|
@@ -189,28 +189,36 @@ const AsyncUserSelect = _ref => {
|
|
|
189
189
|
}
|
|
190
190
|
}, [onEnter, onUpArrow, onDownArrow, onEsc]);
|
|
191
191
|
(0, _react.useEffect)(() => {
|
|
192
|
-
if (
|
|
193
|
-
const _userSelectContainerR = userSelectContainerRef.current.getBoundingClientRect(),
|
|
194
|
-
bottom = _userSelectContainerR.bottom;
|
|
195
|
-
if (bottom > window.innerHeight) {
|
|
196
|
-
userSelectContainerRef.current.style.top = "".concat(window.innerHeight - bottom, "px");
|
|
197
|
-
}
|
|
198
|
-
}
|
|
192
|
+
if (!isPopoverOpen) return;
|
|
199
193
|
if (userListContainerRef.current && userItemContainerRef.current) {
|
|
200
|
-
const
|
|
201
|
-
const
|
|
202
|
-
const userItemHeight = parseInt(userItemStyle.height);
|
|
203
|
-
const maxContainerItemNum = Math.floor(parseInt(userContainerStyle.maxHeight) / userItemHeight);
|
|
204
|
-
setMaxItemNum(maxContainerItemNum);
|
|
194
|
+
const userItemHeight = userItemContainerRef.current.getBoundingClientRect().height;
|
|
195
|
+
const listMaxHeight = userListContainerRef.current.clientHeight;
|
|
205
196
|
setItemHeight(userItemHeight);
|
|
197
|
+
setMaxItemNum(Math.max(1, Math.floor(listMaxHeight / userItemHeight)));
|
|
206
198
|
}
|
|
207
|
-
}, []);
|
|
199
|
+
}, [isPopoverOpen, searchedUsers]);
|
|
208
200
|
(0, _react.useEffect)(() => {
|
|
209
201
|
document.addEventListener('keydown', onHotKey, true);
|
|
210
202
|
return () => {
|
|
211
203
|
document.removeEventListener('keydown', onHotKey, true);
|
|
212
204
|
};
|
|
213
205
|
}, [onHotKey]);
|
|
206
|
+
const getSelectorRect = () => {
|
|
207
|
+
if (!selectorRef.current) return null;
|
|
208
|
+
return selectorRef.current.getBoundingClientRect();
|
|
209
|
+
};
|
|
210
|
+
const popoverStyle = (() => {
|
|
211
|
+
if (!isPopoverOpen) return null;
|
|
212
|
+
const rect = getSelectorRect();
|
|
213
|
+
if (!rect) return null;
|
|
214
|
+
return {
|
|
215
|
+
position: 'fixed',
|
|
216
|
+
top: rect.bottom + 4,
|
|
217
|
+
left: rect.left,
|
|
218
|
+
width: rect.width,
|
|
219
|
+
maxHeight: Math.max(160, window.innerHeight - rect.bottom - 8)
|
|
220
|
+
};
|
|
221
|
+
})();
|
|
214
222
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickOutside.default, {
|
|
215
223
|
onClickOutside: onClickOutside,
|
|
216
224
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -238,54 +246,52 @@ const AsyncUserSelect = _ref => {
|
|
|
238
246
|
})
|
|
239
247
|
})]
|
|
240
248
|
})
|
|
241
|
-
}),
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
className: "no-user-search-result",
|
|
286
|
-
children: searchValue ? (0, _lang.getLocale)('User_not_found') : (0, _lang.getLocale)('Enter_characters_to_start_searching')
|
|
249
|
+
}), isPopoverOpen && popoverStyle && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalPortal.default, {
|
|
250
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickOutside.default, {
|
|
251
|
+
onClickOutside: onClickOutside,
|
|
252
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
253
|
+
className: "dtable-ui-user-select-popover dtable-ui-user-select-container",
|
|
254
|
+
ref: userSelectContainerRef,
|
|
255
|
+
style: popoverStyle,
|
|
256
|
+
onMouseDown: e => e.stopPropagation(),
|
|
257
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
258
|
+
className: "seatable-select-search",
|
|
259
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableCustomizeSearchInput.default, {
|
|
260
|
+
className: "option-search-control",
|
|
261
|
+
placeholder: searchPlaceholder || (0, _lang.getLocale)('Search_users'),
|
|
262
|
+
onChange: onSearchValueChanged,
|
|
263
|
+
clearValue: () => onSearchValueChanged(''),
|
|
264
|
+
autoFocus: true,
|
|
265
|
+
isClearable: true,
|
|
266
|
+
value: searchValue
|
|
267
|
+
})
|
|
268
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
269
|
+
className: "dtable-ui-user-list-container",
|
|
270
|
+
ref: userListContainerRef,
|
|
271
|
+
children: [searchedUsers.length > 0 && searchedUsers.map((user, index) => {
|
|
272
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
273
|
+
className: (0, _classnames.default)('dtable-ui-user-item-container', {
|
|
274
|
+
'dtable-ui-user-item-container-highlight': index === highlightIndex
|
|
275
|
+
}),
|
|
276
|
+
ref: index === 0 ? userItemContainerRef : null,
|
|
277
|
+
onClick: () => onUserClick(user),
|
|
278
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_userItem.default, {
|
|
279
|
+
user: user,
|
|
280
|
+
enableShowIDInOrgWhenSearchUser: enableShowIDInOrgWhenSearchUser
|
|
281
|
+
}, "dtable-ui-user-selector-searched-user-".concat(index)), selectedUsers.find(u => u.email === user.email) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
282
|
+
className: "dtable-ui-collaborator-check-icon",
|
|
283
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
284
|
+
className: "dtable-font dtable-icon-check",
|
|
285
|
+
"aria-hidden": "true"
|
|
286
|
+
})
|
|
287
|
+
})]
|
|
288
|
+
}, user.email);
|
|
289
|
+
}), searchedUsers.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
290
|
+
className: "no-user-search-result",
|
|
291
|
+
children: searchValue ? (0, _lang.getLocale)('User_not_found') : (0, _lang.getLocale)('Enter_characters_to_start_searching')
|
|
292
|
+
})]
|
|
287
293
|
})]
|
|
288
|
-
})
|
|
294
|
+
})
|
|
289
295
|
})
|
|
290
296
|
})]
|
|
291
297
|
})
|
|
@@ -107,10 +107,6 @@
|
|
|
107
107
|
white-space: nowrap;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
.seatable-customize-select .selected-option .multicolor-icon {
|
|
111
|
-
font-size: 12px;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
110
|
.seatable-customize-select .multiple-check-icon,
|
|
115
111
|
.seatable-customize-select .header-icon .dtable-font,
|
|
116
112
|
.seatable-option-group .select-label .header-icon .dtable-font {
|
|
@@ -125,8 +121,10 @@
|
|
|
125
121
|
margin-left: 0 !important;
|
|
126
122
|
}
|
|
127
123
|
|
|
128
|
-
.seatable-customize-select .selected-option .dtable-icon-down3
|
|
124
|
+
.seatable-customize-select .selected-option .dtable-icon-down3,
|
|
125
|
+
.seatable-customize-select .selected-option .multicolor-icon {
|
|
129
126
|
color: var(--bs-icon-color) !important;
|
|
127
|
+
font-size: 12px;
|
|
130
128
|
}
|
|
131
129
|
|
|
132
130
|
.selector-group-select .selected-option-show .selected-option-item {
|
|
@@ -25,7 +25,6 @@ class DTableCustomizeSelect extends _react.Component {
|
|
|
25
25
|
*/
|
|
26
26
|
if (this.state.isShowSelectOptions) event.stopPropagation();
|
|
27
27
|
const eventClassName = (0, _utils.getEventClassName)(event);
|
|
28
|
-
console.log('eventClassName', eventClassName);
|
|
29
28
|
if (this.props.isLocked || eventClassName.indexOf('option-search-control') > -1 || eventClassName === 'seatable-select-search') return;
|
|
30
29
|
// Prevent closing by pressing the spacebar in the search input
|
|
31
30
|
if (event.target.value === '') return;
|
|
@@ -214,7 +214,7 @@ const Option = props => {
|
|
|
214
214
|
whiteSpace: 'pre-line'
|
|
215
215
|
},
|
|
216
216
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
217
|
-
className: "seatable-option",
|
|
217
|
+
className: "seatable-option option-name",
|
|
218
218
|
children: label
|
|
219
219
|
}), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
220
220
|
className: "dtable-font dtable-icon-check",
|