dtable-ui-component 7.0.4 → 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.
- package/lib/AsyncUserSelect/index.css +10 -1
- package/lib/AsyncUserSelect/index.js +84 -61
- package/lib/DTableCustomizeSearchInput/index.css +2 -2
- package/lib/DTableCustomizeSelect/index.css +6 -4
- package/lib/DTableSelect/dtable-select-label.css +7 -0
- package/lib/DTableSelect/utils.js +1 -1
- package/lib/ImagePreviewerLightbox/index.js +7 -3
- package/package.json +1 -1
|
@@ -29,10 +29,15 @@
|
|
|
29
29
|
height: 12px;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
.dtable-ui-user-select-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
|
|
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 (
|
|
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
|
|
201
|
-
const
|
|
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
|
-
}),
|
|
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')
|
|
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
|
})
|
|
@@ -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;
|
|
@@ -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",
|
|
@@ -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);
|