dtable-ui-component 7.0.5-pal.19 → 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.
@@ -30,14 +30,12 @@
30
30
  }
31
31
 
32
32
  .dtable-ui-user-select-popover {
33
- z-index: 1060;
34
- width: 385px;
35
- max-width: 385px;
36
- 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);
33
+ background: #fff;
34
+ border: 1px solid rgba(0, 0, 0, 0.1);
40
35
  border-radius: 4px;
36
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
37
+ z-index: 1060;
38
+ min-width: 260px;
41
39
  }
42
40
 
43
41
  .dtable-ui-user-select-container {
@@ -45,8 +43,7 @@
45
43
  }
46
44
 
47
45
  .dtable-ui-user-select-container .dtable-ui-user-list-container {
48
- min-height: 160px;
49
- max-height: 200px;
46
+ min-height: 32px;
50
47
  padding: 8px;
51
48
  overflow: auto;
52
49
  position: relative;
@@ -63,10 +60,6 @@
63
60
  border-radius: 4px;
64
61
  }
65
62
 
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
63
  .dtable-ui-user-select-container .dtable-ui-user-list-container .dtable-ui-user-item-container:hover,
71
64
  .dtable-ui-user-select-container .dtable-ui-user-list-container .dtable-ui-user-item-container-highlight {
72
65
  background-color: var(--bs-btn-background-hover);
@@ -9,6 +9,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm
9
9
  var _react = require("react");
10
10
  var _classnames = _interopRequireDefault(require("classnames"));
11
11
  var _ModalPortal = _interopRequireDefault(require("../ModalPortal"));
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()) || '';
@@ -200,113 +203,98 @@ const AsyncUserSelect = _ref => {
200
203
  document.removeEventListener('keydown', onHotKey, true);
201
204
  };
202
205
  }, [onHotKey]);
203
- (0, _react.useEffect)(() => {
204
- if (!isPopoverOpen) return;
205
- const isInside = target => {
206
- if (!target) return false;
207
- if (selectorRef.current && selectorRef.current.contains(target)) return true;
208
- if (userSelectContainerRef.current && userSelectContainerRef.current.contains(target)) return true;
209
- return false;
210
- };
211
- const handleDocumentMouseDown = e => {
212
- if (isInside(e.target)) return;
213
- setIsPopoverOpen(false);
214
- clearStatus();
215
- };
216
- document.addEventListener('mousedown', handleDocumentMouseDown, true);
217
- return () => {
218
- document.removeEventListener('mousedown', handleDocumentMouseDown, true);
219
- };
220
- }, [isPopoverOpen, clearStatus]);
221
206
  const getSelectorRect = () => {
222
207
  if (!selectorRef.current) return null;
223
208
  return selectorRef.current.getBoundingClientRect();
224
209
  };
225
- (0, _react.useLayoutEffect)(() => {
226
- if (!isPopoverOpen) {
227
- setPopoverPosition(null);
228
- return;
229
- }
210
+ const popoverStyle = (() => {
211
+ if (!isPopoverOpen) return null;
230
212
  const rect = getSelectorRect();
231
- if (!rect) return;
232
- setPopoverPosition({
213
+ if (!rect) return null;
214
+ return {
233
215
  position: 'fixed',
234
- top: rect.bottom + 8,
216
+ top: rect.bottom + 4,
235
217
  left: rect.left,
236
- width: rect.width
237
- });
238
- }, [isPopoverOpen, selectedUsers]);
239
- const popoverStyle = popoverPosition;
240
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
241
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
242
- className: (0, _classnames.default)('dtable-ui-selected-users-container form-control d-flex align-items-center', className, {
243
- 'focus': isPopoverOpen
244
- }),
245
- onClick: onTogglePopover,
246
- ref: selectorRef,
247
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
248
- className: "dtable-ui-users-input",
249
- children: [selectedUsers.map((user, index) => {
250
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_userItem.default, {
251
- user: user,
252
- deleteUser: deselectUser
253
- }, "dtable-ui-user-selector-selected-user-".concat(index));
254
- }), selectedUsers.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
255
- className: "dtable-ui-user-select-placeholder",
256
- children: emptyPlaceholder || (0, _lang.getLocale)('Search_users')
257
- }), !showDeptBtn && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
258
- className: "select-dropdown-indicator d-inline-flex align-items-center",
259
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableIcon.default, {
260
- symbol: "down",
261
- color: "var(--bs-icon-color)"
262
- })
263
- })]
264
- })
265
- }), isPopoverOpen && popoverStyle && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalPortal.default, {
266
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
267
- className: "dtable-ui-user-select-popover dtable-ui-user-select-container",
268
- ref: userSelectContainerRef,
269
- style: popoverStyle,
270
- onMouseDown: e => e.stopPropagation(),
271
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
272
- className: "seatable-select-search",
273
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableCustomizeSearchInput.default, {
274
- className: "option-search-control",
275
- placeholder: searchPlaceholder || (0, _lang.getLocale)('Search_users'),
276
- onChange: onSearchValueChanged,
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')
218
+ width: rect.width,
219
+ maxHeight: Math.max(160, window.innerHeight - rect.bottom - 8)
220
+ };
221
+ })();
222
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickOutside.default, {
223
+ onClickOutside: onClickOutside,
224
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
225
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
226
+ className: (0, _classnames.default)('dtable-ui-selected-users-container form-control d-flex align-items-center', className, {
227
+ 'focus': isPopoverOpen
228
+ }),
229
+ onClick: onTogglePopover,
230
+ ref: selectorRef,
231
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
232
+ className: "dtable-ui-users-input",
233
+ children: [selectedUsers.map((user, index) => {
234
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_userItem.default, {
235
+ user: user,
236
+ deleteUser: deselectUser
237
+ }, "dtable-ui-user-selector-selected-user-".concat(index));
238
+ }), selectedUsers.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
239
+ className: "dtable-ui-user-select-placeholder",
240
+ children: emptyPlaceholder || (0, _lang.getLocale)('Search_users')
241
+ }), !showDeptBtn && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
242
+ className: "select-dropdown-indicator d-inline-flex align-items-center",
243
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableIcon.default, {
244
+ symbol: "down",
245
+ color: "var(--bs-icon-color)"
246
+ })
306
247
  })]
307
- })]
308
- })
309
- })]
248
+ })
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
+ })]
293
+ })]
294
+ })
295
+ })
296
+ })]
297
+ })
310
298
  });
311
299
  };
312
300
  var _default = exports.default = AsyncUserSelect;
@@ -28,18 +28,6 @@
28
28
  border-top-right-radius: 4px;
29
29
  }
30
30
 
31
- .select-search-control:-webkit-autofill,
32
- .select-search-control:-webkit-autofill:hover,
33
- .select-search-control:-webkit-autofill:focus,
34
- .select-search-control:-webkit-autofill:active,
35
- .select-search-control:-internal-autofill-previewed,
36
- .select-search-control:-internal-autofill-selected {
37
- -webkit-box-shadow: inset 0 0 0 1000px var(--bs-popover-bg) !important;
38
- box-shadow: inset 0 0 0 1000px var(--bs-popover-bg) !important;
39
- -webkit-text-fill-color: var(--bs-body-color) !important;
40
- transition: background-color 5000s ease-in-out 0s !important;
41
- }
42
-
43
31
  .select-search-control:focus {
44
32
  outline: none;
45
33
  box-shadow: none;
@@ -82,6 +70,6 @@
82
70
 
83
71
  .dtable-ui-user-select-popover .select-search-control,
84
72
  .dtable-popover .select-search-control {
85
- border-top-left-radius: 4px;
86
- border-top-right-radius: 4px;
73
+ border-top-left-radius: 8px;
74
+ border-top-right-radius: 8px;
87
75
  }
@@ -161,9 +161,7 @@
161
161
  }
162
162
 
163
163
  .selector-group-select {
164
- height: auto;
165
- min-height: 38px;
166
- padding: 6px 16px 6px 8px;
164
+ padding: 7px 16px 7px 8px;
167
165
  }
168
166
 
169
167
  .selector-group-select .selected-option {
@@ -176,3 +174,7 @@
176
174
  height: auto;
177
175
  min-height: 24px
178
176
  }
177
+
178
+ .selector-group-select {
179
+ height: 38px;
180
+ }
@@ -45,13 +45,6 @@ class DTableCustomizeSelect extends _react.Component {
45
45
  isShowSelectOptions: false
46
46
  });
47
47
  };
48
- this.handleDocumentMouseDown = event => {
49
- if (!this.state.isShowSelectOptions) return;
50
- const target = event.target;
51
- if (this.selector && this.selector.contains(target)) return;
52
- if (target && target.closest && target.closest('.seatable-option-group')) return;
53
- this.closeSelect();
54
- };
55
48
  this.getSelectedOptionTop = () => {
56
49
  if (!this.selector) return 38;
57
50
  const _this$selector$getBou = this.selector.getBoundingClientRect(),
@@ -87,12 +80,6 @@ class DTableCustomizeSelect extends _react.Component {
87
80
  isShowSelectOptions: false
88
81
  };
89
82
  }
90
- componentDidMount() {
91
- document.addEventListener('mousedown', this.handleDocumentMouseDown, true);
92
- }
93
- componentWillUnmount() {
94
- document.removeEventListener('mousedown', this.handleDocumentMouseDown, true);
95
- }
96
83
  render() {
97
84
  let _this$props2 = this.props,
98
85
  className = _this$props2.className,
@@ -9,7 +9,7 @@
9
9
  color: var(--bs-icon-color);
10
10
  }
11
11
 
12
- .seatable-option .seatable-tip-default {
12
+ .seatable-option .select-option-name .seatable-tip-default {
13
13
  font-size: 12px;
14
14
  margin-top: 4px
15
15
  }
@@ -66,9 +66,6 @@
66
66
 
67
67
  .select-label {
68
68
  width: 100%;
69
- overflow: hidden;
70
- white-space: nowrap;
71
- text-overflow: ellipsis;
72
69
  }
73
70
 
74
71
  .seatable-option-group-selector-multiple-select .select-label,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "7.0.5pal.19",
3
+ "version": "7.0.5pal.6",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "5.0.9",