dtable-ui-component 7.0.4 → 7.0.5-pal.11
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 +92 -63
- 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);
|
|
@@ -66,12 +71,27 @@ const AsyncUserSelect = _ref => {
|
|
|
66
71
|
setSearchValue('');
|
|
67
72
|
setHighlightIndex(-1);
|
|
68
73
|
}, []);
|
|
74
|
+
const isEventInsideComponent = (0, _react.useCallback)(target => {
|
|
75
|
+
if (!target) return false;
|
|
76
|
+
if (selectorRef.current && selectorRef.current.contains(target)) return true;
|
|
77
|
+
if (userSelectContainerRef.current && userSelectContainerRef.current.contains(target)) return true;
|
|
78
|
+
return false;
|
|
79
|
+
}, []);
|
|
69
80
|
const onClickOutside = (0, _react.useCallback)(e => {
|
|
70
|
-
if (isPopoverOpen &&
|
|
81
|
+
if (isPopoverOpen && !isEventInsideComponent(e.target)) {
|
|
82
|
+
setIsPopoverOpen(false);
|
|
83
|
+
clearStatus();
|
|
84
|
+
}
|
|
85
|
+
}, [isPopoverOpen, clearStatus, isEventInsideComponent]);
|
|
86
|
+
const onClickOutsideMenu = (0, _react.useCallback)(event => {
|
|
87
|
+
if (isPopoverOpen && (0, _utils.getEventClassName)(event).includes('icon-fork-number')) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (!isEventInsideComponent(event.target)) {
|
|
71
91
|
setIsPopoverOpen(false);
|
|
72
92
|
clearStatus();
|
|
73
93
|
}
|
|
74
|
-
}, [isPopoverOpen, clearStatus]);
|
|
94
|
+
}, [isPopoverOpen, clearStatus, isEventInsideComponent]);
|
|
75
95
|
const searchUsers = (0, _react.useCallback)(function () {
|
|
76
96
|
let searchValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
77
97
|
const trimmedSearchValue = (searchValue === null || searchValue === void 0 ? void 0 : searchValue.trim()) || '';
|
|
@@ -189,28 +209,39 @@ const AsyncUserSelect = _ref => {
|
|
|
189
209
|
}
|
|
190
210
|
}, [onEnter, onUpArrow, onDownArrow, onEsc]);
|
|
191
211
|
(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
|
-
}
|
|
212
|
+
if (!isPopoverOpen) return;
|
|
199
213
|
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);
|
|
214
|
+
const userItemHeight = userItemContainerRef.current.getBoundingClientRect().height;
|
|
215
|
+
const listMaxHeight = userListContainerRef.current.clientHeight;
|
|
205
216
|
setItemHeight(userItemHeight);
|
|
217
|
+
setMaxItemNum(Math.max(1, Math.floor(listMaxHeight / userItemHeight)));
|
|
206
218
|
}
|
|
207
|
-
}, []);
|
|
219
|
+
}, [isPopoverOpen, searchedUsers]);
|
|
208
220
|
(0, _react.useEffect)(() => {
|
|
209
221
|
document.addEventListener('keydown', onHotKey, true);
|
|
210
222
|
return () => {
|
|
211
223
|
document.removeEventListener('keydown', onHotKey, true);
|
|
212
224
|
};
|
|
213
225
|
}, [onHotKey]);
|
|
226
|
+
const getSelectorRect = () => {
|
|
227
|
+
if (!selectorRef.current) return null;
|
|
228
|
+
return selectorRef.current.getBoundingClientRect();
|
|
229
|
+
};
|
|
230
|
+
(0, _react.useLayoutEffect)(() => {
|
|
231
|
+
if (!isPopoverOpen) {
|
|
232
|
+
setPopoverPosition(null);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const rect = getSelectorRect();
|
|
236
|
+
if (!rect) return;
|
|
237
|
+
setPopoverPosition({
|
|
238
|
+
position: 'fixed',
|
|
239
|
+
top: rect.bottom + 8,
|
|
240
|
+
left: rect.left,
|
|
241
|
+
width: rect.width
|
|
242
|
+
});
|
|
243
|
+
}, [isPopoverOpen, selectedUsers]);
|
|
244
|
+
const popoverStyle = popoverPosition;
|
|
214
245
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickOutside.default, {
|
|
215
246
|
onClickOutside: onClickOutside,
|
|
216
247
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
@@ -238,54 +269,52 @@ const AsyncUserSelect = _ref => {
|
|
|
238
269
|
})
|
|
239
270
|
})]
|
|
240
271
|
})
|
|
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')
|
|
272
|
+
}), isPopoverOpen && popoverStyle && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalPortal.default, {
|
|
273
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ClickOutside.default, {
|
|
274
|
+
onClickOutside: onClickOutsideMenu,
|
|
275
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
276
|
+
className: "dtable-ui-user-select-popover dtable-ui-user-select-container",
|
|
277
|
+
ref: userSelectContainerRef,
|
|
278
|
+
style: popoverStyle,
|
|
279
|
+
onMouseDown: e => e.stopPropagation(),
|
|
280
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
281
|
+
className: "seatable-select-search",
|
|
282
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DTableCustomizeSearchInput.default, {
|
|
283
|
+
className: "option-search-control",
|
|
284
|
+
placeholder: searchPlaceholder || (0, _lang.getLocale)('Search_users'),
|
|
285
|
+
onChange: onSearchValueChanged,
|
|
286
|
+
clearValue: () => onSearchValueChanged(''),
|
|
287
|
+
autoFocus: true,
|
|
288
|
+
isClearable: true,
|
|
289
|
+
value: searchValue
|
|
290
|
+
})
|
|
291
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
292
|
+
className: "dtable-ui-user-list-container",
|
|
293
|
+
ref: userListContainerRef,
|
|
294
|
+
children: [searchedUsers.length > 0 && searchedUsers.map((user, index) => {
|
|
295
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
296
|
+
className: (0, _classnames.default)('dtable-ui-user-item-container', {
|
|
297
|
+
'dtable-ui-user-item-container-highlight': index === highlightIndex
|
|
298
|
+
}),
|
|
299
|
+
ref: index === 0 ? userItemContainerRef : null,
|
|
300
|
+
onClick: () => onUserClick(user),
|
|
301
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_userItem.default, {
|
|
302
|
+
user: user,
|
|
303
|
+
enableShowIDInOrgWhenSearchUser: enableShowIDInOrgWhenSearchUser
|
|
304
|
+
}, "dtable-ui-user-selector-searched-user-".concat(index)), selectedUsers.find(u => u.email === user.email) && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
305
|
+
className: "dtable-ui-collaborator-check-icon",
|
|
306
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("i", {
|
|
307
|
+
className: "dtable-font dtable-icon-check",
|
|
308
|
+
"aria-hidden": "true"
|
|
309
|
+
})
|
|
310
|
+
})]
|
|
311
|
+
}, user.email);
|
|
312
|
+
}), searchedUsers.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
313
|
+
className: "no-user-search-result",
|
|
314
|
+
children: searchValue ? (0, _lang.getLocale)('User_not_found') : (0, _lang.getLocale)('Enter_characters_to_start_searching')
|
|
315
|
+
})]
|
|
287
316
|
})]
|
|
288
|
-
})
|
|
317
|
+
})
|
|
289
318
|
})
|
|
290
319
|
})]
|
|
291
320
|
})
|
|
@@ -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);
|