dtable-ui-component 7.0.5-pal.2 → 7.0.5-pal.7

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,10 +29,14 @@
29
29
  height: 12px;
30
30
  }
31
31
 
32
- .dtable-ui-user-select-popover .popover {
32
+ .dtable-ui-user-select-popover {
33
33
  width: 385px;
34
34
  max-width: 385px;
35
35
  margin-top: -4px;
36
+ background-color: var(--bs-popover-bg);
37
+ box-shadow: var(--bs-border-secondary-shadow);
38
+ border: 1px solid var(--bs-border-secondary-color);
39
+ border-radius: 4px;
36
40
  }
37
41
 
38
42
  .dtable-ui-user-select-container {
@@ -40,8 +44,7 @@
40
44
  }
41
45
 
42
46
  .dtable-ui-user-select-container .dtable-ui-user-list-container {
43
- min-height: 160px;
44
- max-height: 200px;
47
+ min-height: 32px;
45
48
  padding: 8px;
46
49
  overflow: auto;
47
50
  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 _reactstrap = require("reactstrap");
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 (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
- }
192
+ if (!isPopoverOpen) return;
199
193
  if (userListContainerRef.current && userItemContainerRef.current) {
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);
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
- }), 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')
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;
@@ -13,3 +13,10 @@
13
13
  font-size: 12px;
14
14
  margin-top: 4px
15
15
  }
16
+
17
+ .seatable-option.option-name {
18
+ width: 100%;
19
+ overflow: hidden;
20
+ text-overflow: ellipsis;
21
+ white-space: nowrap;
22
+ }
@@ -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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "7.0.5pal.2",
3
+ "version": "7.0.5pal.7",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "5.0.9",