dtable-ui-component 7.0.4-sia.2 → 7.0.5-pal.10

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,15 @@
29
29
  height: 12px;
30
30
  }
31
31
 
32
- .dtable-ui-user-select-popover .popover {
32
+ .dtable-ui-user-select-popover {
33
+ z-index: 1060;
33
34
  width: 385px;
34
35
  max-width: 385px;
35
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);
40
+ border-radius: 4px;
36
41
  }
37
42
 
38
43
  .dtable-ui-user-select-container {
@@ -58,6 +63,10 @@
58
63
  border-radius: 4px;
59
64
  }
60
65
 
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
+
61
70
  .dtable-ui-user-select-container .dtable-ui-user-list-container .dtable-ui-user-item-container:hover,
62
71
  .dtable-ui-user-select-container .dtable-ui-user-list-container .dtable-ui-user-item-container-highlight {
63
72
  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 _reactstrap = require("reactstrap");
11
+ var _ModalPortal = _interopRequireDefault(require("../ModalPortal"));
12
+ var _utils = require("../utils/utils");
12
13
  var _ClickOutside = _interopRequireDefault(require("../ClickOutside"));
13
14
  var _DTableCustomizeSearchInput = _interopRequireDefault(require("../DTableCustomizeSearchInput"));
14
15
  var _userItem = _interopRequireDefault(require("./user-item"));
@@ -57,6 +58,10 @@ const AsyncUserSelect = _ref => {
57
58
  _useState10 = (0, _slicedToArray2.default)(_useState1, 2),
58
59
  itemHeight = _useState10[0],
59
60
  setItemHeight = _useState10[1];
61
+ const _useState11 = (0, _react.useState)(null),
62
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
63
+ popoverPosition = _useState12[0],
64
+ setPopoverPosition = _useState12[1];
60
65
  const selectorRef = (0, _react.useRef)(null);
61
66
  const userSelectContainerRef = (0, _react.useRef)(null);
62
67
  const userListContainerRef = (0, _react.useRef)(null);
@@ -72,6 +77,15 @@ const AsyncUserSelect = _ref => {
72
77
  clearStatus();
73
78
  }
74
79
  }, [isPopoverOpen, clearStatus]);
80
+ const onClickOutsideMenu = (0, _react.useCallback)(event => {
81
+ if (isPopoverOpen && (0, _utils.getEventClassName)(event).includes('icon-fork-number')) {
82
+ return;
83
+ }
84
+ if (!selectorRef.current.contains(event.target)) {
85
+ setIsPopoverOpen(false);
86
+ clearStatus();
87
+ }
88
+ }, [isPopoverOpen, clearStatus]);
75
89
  const searchUsers = (0, _react.useCallback)(function () {
76
90
  let searchValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
77
91
  const trimmedSearchValue = (searchValue === null || searchValue === void 0 ? void 0 : searchValue.trim()) || '';
@@ -189,28 +203,39 @@ const AsyncUserSelect = _ref => {
189
203
  }
190
204
  }, [onEnter, onUpArrow, onDownArrow, onEsc]);
191
205
  (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
- }
206
+ if (!isPopoverOpen) return;
199
207
  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);
208
+ const userItemHeight = userItemContainerRef.current.getBoundingClientRect().height;
209
+ const listMaxHeight = userListContainerRef.current.clientHeight;
205
210
  setItemHeight(userItemHeight);
211
+ setMaxItemNum(Math.max(1, Math.floor(listMaxHeight / userItemHeight)));
206
212
  }
207
- }, []);
213
+ }, [isPopoverOpen, searchedUsers]);
208
214
  (0, _react.useEffect)(() => {
209
215
  document.addEventListener('keydown', onHotKey, true);
210
216
  return () => {
211
217
  document.removeEventListener('keydown', onHotKey, true);
212
218
  };
213
219
  }, [onHotKey]);
220
+ const getSelectorRect = () => {
221
+ if (!selectorRef.current) return null;
222
+ return selectorRef.current.getBoundingClientRect();
223
+ };
224
+ (0, _react.useLayoutEffect)(() => {
225
+ if (!isPopoverOpen) {
226
+ setPopoverPosition(null);
227
+ return;
228
+ }
229
+ const rect = getSelectorRect();
230
+ if (!rect) return;
231
+ setPopoverPosition({
232
+ position: 'fixed',
233
+ top: rect.bottom + 8,
234
+ left: rect.left,
235
+ width: rect.width
236
+ });
237
+ }, [isPopoverOpen, selectedUsers]);
238
+ const popoverStyle = popoverPosition;
214
239
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickOutside.default, {
215
240
  onClickOutside: onClickOutside,
216
241
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
@@ -238,54 +263,52 @@ const AsyncUserSelect = _ref => {
238
263
  })
239
264
  })]
240
265
  })
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')
266
+ }), isPopoverOpen && popoverStyle && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalPortal.default, {
267
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickOutside.default, {
268
+ onClickOutside: onClickOutsideMenu,
269
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
270
+ className: "dtable-ui-user-select-popover dtable-ui-user-select-container",
271
+ ref: userSelectContainerRef,
272
+ style: popoverStyle,
273
+ onMouseDown: e => e.stopPropagation(),
274
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
275
+ className: "seatable-select-search",
276
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableCustomizeSearchInput.default, {
277
+ className: "option-search-control",
278
+ placeholder: searchPlaceholder || (0, _lang.getLocale)('Search_users'),
279
+ onChange: onSearchValueChanged,
280
+ clearValue: () => onSearchValueChanged(''),
281
+ autoFocus: true,
282
+ isClearable: true,
283
+ value: searchValue
284
+ })
285
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
286
+ className: "dtable-ui-user-list-container",
287
+ ref: userListContainerRef,
288
+ children: [searchedUsers.length > 0 && searchedUsers.map((user, index) => {
289
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
290
+ className: (0, _classnames.default)('dtable-ui-user-item-container', {
291
+ 'dtable-ui-user-item-container-highlight': index === highlightIndex
292
+ }),
293
+ ref: index === 0 ? userItemContainerRef : null,
294
+ onClick: () => onUserClick(user),
295
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_userItem.default, {
296
+ user: user,
297
+ enableShowIDInOrgWhenSearchUser: enableShowIDInOrgWhenSearchUser
298
+ }, "dtable-ui-user-selector-searched-user-".concat(index)), selectedUsers.find(u => u.email === user.email) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
299
+ className: "dtable-ui-collaborator-check-icon",
300
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
301
+ className: "dtable-font dtable-icon-check",
302
+ "aria-hidden": "true"
303
+ })
304
+ })]
305
+ }, user.email);
306
+ }), searchedUsers.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
307
+ className: "no-user-search-result",
308
+ children: searchValue ? (0, _lang.getLocale)('User_not_found') : (0, _lang.getLocale)('Enter_characters_to_start_searching')
309
+ })]
287
310
  })]
288
- })]
311
+ })
289
312
  })
290
313
  })]
291
314
  })
@@ -27,11 +27,8 @@ const CollapsibleSettingLayout = props => {
27
27
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
28
28
  className: "collapsible-setting-layout-title",
29
29
  children: title
30
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
31
- className: "seatable-icon-btn",
32
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
33
- className: "dtable-font dtable-icon-right".concat(isShowSettings ? ' dtable-icon-spin' : '')
34
- })
30
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
31
+ className: "dtable-font dtable-icon-right".concat(isShowSettings ? ' dtable-icon-spin' : '')
35
32
  })]
36
33
  }), isShowSettings && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
37
34
  className: "collapsible-setting-layout-body mt-3 pl-2",
@@ -70,6 +70,6 @@
70
70
 
71
71
  .dtable-ui-user-select-popover .select-search-control,
72
72
  .dtable-popover .select-search-control {
73
- border-top-left-radius: 8px;
74
- border-top-right-radius: 8px;
73
+ border-top-left-radius: 4px;
74
+ border-top-right-radius: 4px;
75
75
  }
@@ -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,6 +121,12 @@
125
121
  margin-left: 0 !important;
126
122
  }
127
123
 
124
+ .seatable-customize-select .selected-option .dtable-icon-down3,
125
+ .seatable-customize-select .selected-option .multicolor-icon {
126
+ color: var(--bs-icon-color) !important;
127
+ font-size: 12px;
128
+ }
129
+
128
130
  .selector-group-select .selected-option-show .selected-option-item {
129
131
  align-items: center;
130
132
  border-radius: 4px;
@@ -10,7 +10,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
  var _reactstrap = require("reactstrap");
12
12
  var _IconButton = _interopRequireDefault(require("../IconButton"));
13
- require("./index.css");
14
13
  var _jsxRuntime = require("react/jsx-runtime");
15
14
  const _excluded = ["children"];
16
15
  const DTableModalHeader = _ref => {
@@ -19,8 +18,7 @@ const DTableModalHeader = _ref => {
19
18
  const customCloseBtn = /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconButton.default, {
20
19
  icon: "x",
21
20
  "aria-label": "Close",
22
- onClick: props.toggle,
23
- className: "modal-close-btn"
21
+ onClick: props.toggle
24
22
  });
25
23
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactstrap.ModalHeader, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
26
24
  close: customCloseBtn,
@@ -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",
@@ -9,7 +9,6 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectWithoutProperties"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
11
  var _classnames = _interopRequireDefault(require("classnames"));
12
- require("./index.css");
13
12
  var _jsxRuntime = require("react/jsx-runtime");
14
13
  const _excluded = ["disabled", "className", "icon", "children"];
15
14
  const IconButton = _ref => {
@@ -19,7 +18,7 @@ const IconButton = _ref => {
19
18
  children = _ref.children,
20
19
  otherProperties = (0, _objectWithoutProperties2.default)(_ref, _excluded);
21
20
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread2.default)((0, _objectSpread2.default)({
22
- className: (0, _classnames.default)('seatable-icon-btn icon-button', className, {
21
+ className: (0, _classnames.default)('seatable-icon-btn', className, {
23
22
  'disabled': disabled
24
23
  })
25
24
  }, otherProperties), {}, {
@@ -25,7 +25,11 @@ function ImagePreviewerLightbox(props) {
25
25
  dtableUuid = props.dtableUuid,
26
26
  deleteImage = props.deleteImage,
27
27
  downloadImage = props.downloadImage,
28
- onRotateImage = props.onRotateImage;
28
+ onRotateImage = props.onRotateImage,
29
+ _props$isShowPreLine = props.isShowPreLine,
30
+ isShowPreLine = _props$isShowPreLine === void 0 ? true : _props$isShowPreLine,
31
+ _props$isShowNextLine = props.isShowNextLine,
32
+ isShowNextLine = _props$isShowNextLine === void 0 ? true : _props$isShowNextLine;
29
33
  const imageSrcList = imageItems.map(src => {
30
34
  let name = '';
31
35
  try {
@@ -111,8 +115,8 @@ function ImagePreviewerLightbox(props) {
111
115
  onCloseRequest: props.closeImagePopup,
112
116
  onMovePrevRequest: props.moveToPrevImage,
113
117
  onMoveNextRequest: props.moveToNextImage,
114
- onClickMoveUp: moveToPrevRowImage,
115
- onClickMoveDown: moveToNextRowImage,
118
+ onClickMoveUp: isShowPreLine && moveToPrevRowImage,
119
+ onClickMoveDown: isShowNextLine && moveToNextRowImage,
116
120
  onViewOriginal: props.onViewOriginal,
117
121
  onRotateImage: canRotateImage ? deg => {
118
122
  onRotateImage(currentImageIndex, deg);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dtable-ui-component",
3
- "version": "7.0.4sia.2",
3
+ "version": "7.0.5pal.10",
4
4
  "main": "./lib/index.js",
5
5
  "dependencies": {
6
6
  "@seafile/react-image-lightbox": "5.0.9",
@@ -1,4 +0,0 @@
1
- .modal-close-btn {
2
- font-size: 16px;
3
- font-weight: 700;
4
- }
@@ -1,3 +0,0 @@
1
- .icon-button .seatable-icon {
2
- font-size: 16px;
3
- }