Web: Files: added row selection

This commit is contained in:
Nikita Gopienko 2021-10-07 19:42:49 +03:00
parent afa804ed35
commit 0a8fb2d55c
3 changed files with 19 additions and 5 deletions

View File

@ -56,6 +56,8 @@ export default function withFileActions(WrappedFileItem) {
isTrashFolder,
onSelectItem,
item,
bufferSelection,
setBufferSelection,
} = this.props;
const { id, isFolder } = item;
@ -63,15 +65,20 @@ export default function withFileActions(WrappedFileItem) {
const notSelectable = e.target.classList.contains("not-selectable");
const isFileName = e.target.classList.contains("item-file-name");
if (isPrivacy || isTrashFolder || (!draggable && !isFileName)) return e;
if (
isPrivacy ||
isTrashFolder ||
(!draggable && !isFileName && !bufferSelection)
)
return e;
if (window.innerWidth < 1025 || notSelectable || isMobile) {
return e;
}
if (!draggable) {
id !== -1 && onSelectItem({ id, isFolder });
}
// if (!draggable) {
// id !== -1 && onSelectItem({ id, isFolder });
// }
const mouseButton = e.which
? e.which !== 1
@ -85,6 +92,7 @@ export default function withFileActions(WrappedFileItem) {
e.preventDefault();
setTooltipPosition(e.pageX, e.pageY);
setStartDrag(true);
setBufferSelection(null);
};
onMarkAsRead = (id) =>
@ -397,6 +405,7 @@ export default function withFileActions(WrappedFileItem) {
setNewBadgeCount,
isActive,
setBufferSelection,
bufferSelection,
};
}
)(observer(WithFileActions));

View File

@ -56,7 +56,8 @@ const StyledTableRow = styled(TableRow)`
.table-container_cell {
background: ${(props) =>
(props.checked || props.isActive) && "#F3F4F4 !important"};
cursor: ${(props) => props.checked && "url(images/cursor.palm.svg), auto"};
cursor: ${(props) =>
(props.checked || props.isActive) && "url(images/cursor.palm.svg), auto"};
}
&:hover {

View File

@ -30,6 +30,7 @@ const SectionBodyContent = (props) => {
setSelection,
tooltipPageX,
tooltipPageY,
setBufferSelection,
} = props;
useEffect(() => {
@ -67,6 +68,7 @@ const SectionBodyContent = (props) => {
!e.target.closest(".not-selectable")
)
setSelection([]);
setBufferSelection(null);
};
const onMouseMove = (e) => {
@ -223,6 +225,7 @@ export default inject(
setSelection,
tooltipPageX,
tooltipPageY,
setBufferSelection,
} = filesStore;
return {
@ -242,6 +245,7 @@ export default inject(
setSelection,
tooltipPageX,
tooltipPageY,
setBufferSelection,
};
}
)(