dtable-ui-component 7.0.7 → 7.0.9-beta.1
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.
|
@@ -29,15 +29,10 @@
|
|
|
29
29
|
height: 12px;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.dtable-ui-user-select-popover {
|
|
33
|
-
|
|
34
|
-
width: 385px !important;
|
|
32
|
+
.dtable-ui-user-select-popover .popover {
|
|
33
|
+
width: 385px;
|
|
35
34
|
max-width: 385px;
|
|
36
35
|
margin-top: -4px;
|
|
37
|
-
background-color: var(--bs-popover-bg);
|
|
38
|
-
box-shadow: var(--bs-border-secondary-shadow);
|
|
39
|
-
border: 1px solid var(--bs-border-secondary-color);
|
|
40
|
-
border-radius: 4px;
|
|
41
36
|
}
|
|
42
37
|
|
|
43
38
|
.dtable-ui-user-select-container {
|
|
@@ -63,10 +58,6 @@
|
|
|
63
58
|
border-radius: 4px;
|
|
64
59
|
}
|
|
65
60
|
|
|
66
|
-
.dtable-ui-user-select-container .dtable-ui-user-list-container .dtable-ui-user-item-container .dtable-ui-user-item {
|
|
67
|
-
background: none !important;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
61
|
.dtable-ui-user-select-container .dtable-ui-user-list-container .dtable-ui-user-item-container:hover,
|
|
71
62
|
.dtable-ui-user-select-container .dtable-ui-user-list-container .dtable-ui-user-item-container-highlight {
|
|
72
63
|
background-color: var(--bs-btn-background-hover);
|
|
@@ -8,7 +8,8 @@ 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 _reactstrap = require("reactstrap");
|
|
12
|
+
var _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
|
|
12
13
|
var _DTableCustomizeSearchInput = _interopRequireDefault(require("../DTableCustomizeSearchInput"));
|
|
13
14
|
var _userItem = _interopRequireDefault(require("./user-item"));
|
|
14
15
|
var _lang = require("../lang");
|
|
@@ -56,10 +57,6 @@ const AsyncUserSelect = _ref => {
|
|
|
56
57
|
_useState10 = (0, _slicedToArray2.default)(_useState1, 2),
|
|
57
58
|
itemHeight = _useState10[0],
|
|
58
59
|
setItemHeight = _useState10[1];
|
|
59
|
-
const _useState11 = (0, _react.useState)(null),
|
|
60
|
-
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
61
|
-
popoverPosition = _useState12[0],
|
|
62
|
-
setPopoverPosition = _useState12[1];
|
|
63
60
|
const selectorRef = (0, _react.useRef)(null);
|
|
64
61
|
const userSelectContainerRef = (0, _react.useRef)(null);
|
|
65
62
|
const userListContainerRef = (0, _react.useRef)(null);
|
|
@@ -69,6 +66,12 @@ const AsyncUserSelect = _ref => {
|
|
|
69
66
|
setSearchValue('');
|
|
70
67
|
setHighlightIndex(-1);
|
|
71
68
|
}, []);
|
|
69
|
+
const onClickOutside = (0, _react.useCallback)(e => {
|
|
70
|
+
if (isPopoverOpen && (!selectorRef.current || !selectorRef.current.contains(e.target))) {
|
|
71
|
+
setIsPopoverOpen(false);
|
|
72
|
+
clearStatus();
|
|
73
|
+
}
|
|
74
|
+
}, [isPopoverOpen, clearStatus]);
|
|
72
75
|
const searchUsers = (0, _react.useCallback)(function () {
|
|
73
76
|
let searchValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
74
77
|
const trimmedSearchValue = (searchValue === null || searchValue === void 0 ? void 0 : searchValue.trim()) || '';
|
|
@@ -186,127 +189,106 @@ const AsyncUserSelect = _ref => {
|
|
|
186
189
|
}
|
|
187
190
|
}, [onEnter, onUpArrow, onDownArrow, onEsc]);
|
|
188
191
|
(0, _react.useEffect)(() => {
|
|
189
|
-
if (
|
|
192
|
+
if (userSelectContainerRef.current) {
|
|
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
|
+
}
|
|
190
199
|
if (userListContainerRef.current && userItemContainerRef.current) {
|
|
191
|
-
const
|
|
192
|
-
const
|
|
200
|
+
const userContainerStyle = getComputedStyle(userListContainerRef.current, null);
|
|
201
|
+
const userItemStyle = getComputedStyle(userItemContainerRef.current, null);
|
|
202
|
+
const userItemHeight = parseInt(userItemStyle.height);
|
|
203
|
+
const maxContainerItemNum = Math.floor(parseInt(userContainerStyle.maxHeight) / userItemHeight);
|
|
204
|
+
setMaxItemNum(maxContainerItemNum);
|
|
193
205
|
setItemHeight(userItemHeight);
|
|
194
|
-
setMaxItemNum(Math.max(1, Math.floor(listMaxHeight / userItemHeight)));
|
|
195
206
|
}
|
|
196
|
-
}, [
|
|
207
|
+
}, []);
|
|
197
208
|
(0, _react.useEffect)(() => {
|
|
198
209
|
document.addEventListener('keydown', onHotKey, true);
|
|
199
210
|
return () => {
|
|
200
211
|
document.removeEventListener('keydown', onHotKey, true);
|
|
201
212
|
};
|
|
202
213
|
}, [onHotKey]);
|
|
203
|
-
(0,
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
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
|
-
clearValue: () => onSearchValueChanged(''),
|
|
278
|
-
autoFocus: true,
|
|
279
|
-
isClearable: true,
|
|
280
|
-
value: searchValue
|
|
281
|
-
})
|
|
282
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
283
|
-
className: "dtable-ui-user-list-container",
|
|
284
|
-
ref: userListContainerRef,
|
|
285
|
-
children: [searchedUsers.length > 0 && searchedUsers.map((user, index) => {
|
|
286
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
287
|
-
className: (0, _classnames.default)('dtable-ui-user-item-container', {
|
|
288
|
-
'dtable-ui-user-item-container-highlight': index === highlightIndex
|
|
289
|
-
}),
|
|
290
|
-
ref: index === 0 ? userItemContainerRef : null,
|
|
291
|
-
onClick: () => onUserClick(user),
|
|
292
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_userItem.default, {
|
|
293
|
-
user: user,
|
|
294
|
-
enableShowIDInOrgWhenSearchUser: enableShowIDInOrgWhenSearchUser
|
|
295
|
-
}, "dtable-ui-user-selector-searched-user-".concat(index)), selectedUsers.find(u => u.email === user.email) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
296
|
-
className: "dtable-ui-collaborator-check-icon",
|
|
297
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
298
|
-
className: "dtable-font dtable-icon-check",
|
|
299
|
-
"aria-hidden": "true"
|
|
300
|
-
})
|
|
301
|
-
})]
|
|
302
|
-
}, user.email);
|
|
303
|
-
}), searchedUsers.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
304
|
-
className: "no-user-search-result",
|
|
305
|
-
children: searchValue ? (0, _lang.getLocale)('User_not_found') : (0, _lang.getLocale)('Enter_characters_to_start_searching')
|
|
214
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickOutside.default, {
|
|
215
|
+
onClickOutside: onClickOutside,
|
|
216
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
217
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
218
|
+
className: (0, _classnames.default)('dtable-ui-selected-users-container form-control d-flex align-items-center', className, {
|
|
219
|
+
'focus': isPopoverOpen
|
|
220
|
+
}),
|
|
221
|
+
onClick: onTogglePopover,
|
|
222
|
+
ref: selectorRef,
|
|
223
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
224
|
+
className: "dtable-ui-users-input",
|
|
225
|
+
children: [selectedUsers.map((user, index) => {
|
|
226
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_userItem.default, {
|
|
227
|
+
user: user,
|
|
228
|
+
deleteUser: deselectUser
|
|
229
|
+
}, "dtable-ui-user-selector-selected-user-".concat(index));
|
|
230
|
+
}), selectedUsers.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
231
|
+
className: "dtable-ui-user-select-placeholder",
|
|
232
|
+
children: emptyPlaceholder || (0, _lang.getLocale)('Search_users')
|
|
233
|
+
}), !showDeptBtn && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
234
|
+
className: "select-dropdown-indicator d-inline-flex align-items-center",
|
|
235
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableIcon.default, {
|
|
236
|
+
symbol: "down",
|
|
237
|
+
color: "var(--bs-icon-color)"
|
|
238
|
+
})
|
|
239
|
+
})]
|
|
240
|
+
})
|
|
241
|
+
}), selectorRef.current && /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.Popover, {
|
|
242
|
+
placement: "bottom-start",
|
|
243
|
+
isOpen: isPopoverOpen,
|
|
244
|
+
target: selectorRef.current,
|
|
245
|
+
hideArrow: true,
|
|
246
|
+
fade: false,
|
|
247
|
+
className: "dtable-ui-user-select-popover",
|
|
248
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
249
|
+
className: "dtable-ui-user-select-container",
|
|
250
|
+
ref: userSelectContainerRef,
|
|
251
|
+
onMouseDown: e => e.stopPropagation(),
|
|
252
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
253
|
+
className: "seatable-select-search",
|
|
254
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableCustomizeSearchInput.default, {
|
|
255
|
+
className: "option-search-control",
|
|
256
|
+
placeholder: searchPlaceholder || (0, _lang.getLocale)('Search_users'),
|
|
257
|
+
onChange: onSearchValueChanged,
|
|
258
|
+
clearValue: () => onSearchValueChanged(''),
|
|
259
|
+
autoFocus: true,
|
|
260
|
+
isClearable: true,
|
|
261
|
+
value: searchValue
|
|
262
|
+
})
|
|
263
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
264
|
+
className: "dtable-ui-user-list-container",
|
|
265
|
+
ref: userListContainerRef,
|
|
266
|
+
children: [searchedUsers.length > 0 && searchedUsers.map((user, index) => {
|
|
267
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
268
|
+
className: (0, _classnames.default)('dtable-ui-user-item-container', {
|
|
269
|
+
'dtable-ui-user-item-container-highlight': index === highlightIndex
|
|
270
|
+
}),
|
|
271
|
+
ref: userItemContainerRef,
|
|
272
|
+
onClick: () => onUserClick(user),
|
|
273
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_userItem.default, {
|
|
274
|
+
user: user,
|
|
275
|
+
enableShowIDInOrgWhenSearchUser: enableShowIDInOrgWhenSearchUser
|
|
276
|
+
}, "dtable-ui-user-selector-searched-user-".concat(index)), selectedUsers.find(u => u.email === user.email) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
277
|
+
className: "dtable-ui-collaborator-check-icon",
|
|
278
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
279
|
+
className: "dtable-font dtable-icon-check",
|
|
280
|
+
"aria-hidden": "true"
|
|
281
|
+
})
|
|
282
|
+
})]
|
|
283
|
+
}, user.email);
|
|
284
|
+
}), searchedUsers.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
285
|
+
className: "no-user-search-result",
|
|
286
|
+
children: searchValue ? (0, _lang.getLocale)('User_not_found') : (0, _lang.getLocale)('Enter_characters_to_start_searching')
|
|
287
|
+
})]
|
|
306
288
|
})]
|
|
307
|
-
})
|
|
308
|
-
})
|
|
309
|
-
})
|
|
289
|
+
})
|
|
290
|
+
})]
|
|
291
|
+
})
|
|
310
292
|
});
|
|
311
293
|
};
|
|
312
294
|
var _default = exports.default = AsyncUserSelect;
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
.dtable-tooltip .tooltip .tooltip-inner {
|
|
11
11
|
width: fit-content;
|
|
12
12
|
max-width: 242px;
|
|
13
|
-
font-size:
|
|
13
|
+
font-size: 12px;
|
|
14
14
|
text-align: start;
|
|
15
15
|
background-color: var(--bs-body-color);
|
|
16
16
|
color: var(--bs-body-bg);
|
|
17
|
-
border-radius:
|
|
17
|
+
border-radius: 8px;
|
|
18
18
|
padding: 4px 8px;
|
|
19
19
|
line-height: 20px;
|
|
20
20
|
font-weight: normal;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dtable-ui-component",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.9-beta.1",
|
|
4
4
|
"main": "./lib/index.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@seafile/react-image-lightbox": "5.0.9",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"less-loader": "^11.1.3",
|
|
113
113
|
"mini-css-extract-plugin": "^2.4.5",
|
|
114
114
|
"path-browserify": "^1.0.1",
|
|
115
|
-
"postcss": "^8.5.
|
|
115
|
+
"postcss": "^8.5.23",
|
|
116
116
|
"postcss-flexbugs-fixes": "^5.0.2",
|
|
117
117
|
"postcss-loader": "^6.2.1",
|
|
118
118
|
"postcss-normalize": "^10.0.1",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"terser-webpack-plugin": "^5.2.5",
|
|
137
137
|
"url-loader": "^4.1.1",
|
|
138
138
|
"webpack": "^5.105.4",
|
|
139
|
-
"webpack-dev-server": "^5.2.
|
|
139
|
+
"webpack-dev-server": "^5.2.6",
|
|
140
140
|
"worker-loader": "3.0.8"
|
|
141
141
|
}
|
|
142
142
|
}
|