From 3eea8beea0b16af8b709546289e62db004d44490 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Tue, 5 Oct 2021 12:14:21 +0300 Subject: [PATCH 01/10] Web: Files: fixed row selection --- .../asc-web-components/table-container/TableRow.js | 8 +++++++- .../ASC.Files/Client/src/HOCs/withFileActions.js | 14 ++++++++++++++ .../pages/Home/Section/Body/TableView/TableRow.js | 7 ++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/packages/asc-web-components/table-container/TableRow.js b/packages/asc-web-components/table-container/TableRow.js index f962c546a1..9a252b02f2 100644 --- a/packages/asc-web-components/table-container/TableRow.js +++ b/packages/asc-web-components/table-container/TableRow.js @@ -9,6 +9,7 @@ import Checkbox from "../checkbox"; const TableRow = (props) => { const { fileContextClick, + onHideContextMenu, children, contextOptions, checked, @@ -69,7 +70,11 @@ const TableRow = (props) => { {children}
- + {renderContext ? ( { + this.props.setBufferSelection(null); + }; + onDropZoneUpload = (files, uploadToFolder) => { const { t, dragging, setDragging, startUpload } = this.props; @@ -256,6 +260,7 @@ export default function withFileActions(WrappedFileItem) { onMouseDown={this.onMouseDown} onFilesClick={this.onFilesClick} onMouseClick={this.onMouseClick} + onHideContextMenu={this.onHideContextMenu} getClassName={this.getClassName} className={className} isDragging={isDragging} @@ -318,6 +323,8 @@ export default function withFileActions(WrappedFileItem) { openDocEditor, getFolderInfo, viewAs, + bufferSelection, + setBufferSelection, } = filesStore; const { startUpload } = uploadDataStore; const { type, extension, id } = fileActionStore; @@ -341,6 +348,11 @@ export default function withFileActions(WrappedFileItem) { const canConvert = docserviceStore.canConvert(item.fileExst); const canViewedDocs = docserviceStore.canViewedDocs(item.fileExst); + const isActive = + bufferSelection && + bufferSelection.id === item.id && + bufferSelection.fileExst === item.fileExst; // need for select row item + return { t, item, @@ -383,6 +395,8 @@ export default function withFileActions(WrappedFileItem) { personal: auth.settingsStore.personal, isItemsSelected: selection.length > 0, setNewBadgeCount, + isActive, + setBufferSelection, }; } )(observer(WithFileActions)); diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js b/products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js index 8a934c4347..87b82cf803 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js @@ -24,7 +24,8 @@ const { acceptBackground, background } = Base.dragAndDrop; const StyledTableRow = styled(TableRow)` .table-container_cell { - background: ${(props) => props.checked && "#f8f9f9 !important"}; + background: ${(props) => + (props.checked || props.isActive) && "#f8f9f9 !important"}; cursor: ${(props) => props.checked && "url(images/cursor.palm.svg), auto"}; } `; @@ -95,6 +96,8 @@ const FilesTableRow = (props) => { onMouseDown, showShare, personal, + isActive, + onHideContextMenu, } = props; const sharedButton = @@ -162,6 +165,8 @@ const FilesTableRow = (props) => { onClick={onMouseClick} {...contextOptionsProps} checked={checkedProps} + isActive={isActive} + onHideContextMenu={onHideContextMenu} > From 0a8fb2d55c48b7f8c007284d2b3d6ae1d7a62fd1 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Thu, 7 Oct 2021 19:42:49 +0300 Subject: [PATCH 02/10] Web: Files: added row selection --- .../Client/src/HOCs/withFileActions.js | 17 +++++++++++++---- .../Home/Section/Body/TableView/TableRow.js | 3 ++- .../Client/src/pages/Home/Section/Body/index.js | 4 ++++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/products/ASC.Files/Client/src/HOCs/withFileActions.js b/products/ASC.Files/Client/src/HOCs/withFileActions.js index ac73ae7d52..b7a4e3fe13 100644 --- a/products/ASC.Files/Client/src/HOCs/withFileActions.js +++ b/products/ASC.Files/Client/src/HOCs/withFileActions.js @@ -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)); diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js b/products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js index 4dc3872f08..2916ce8169 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Body/TableView/TableRow.js @@ -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 { diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js b/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js index b1e8bf5d88..36c2568fb0 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js @@ -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, }; } )( From 9feceaf67b8483cd29ed5d1bf3fb718860bb6796 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Thu, 7 Oct 2021 19:55:07 +0300 Subject: [PATCH 03/10] Web: Files: fixed selection when clicking on the context menu --- products/ASC.Files/Client/src/HOCs/withFileActions.js | 2 +- .../ASC.Files/Client/src/pages/Home/Section/Body/index.js | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/products/ASC.Files/Client/src/HOCs/withFileActions.js b/products/ASC.Files/Client/src/HOCs/withFileActions.js index b7a4e3fe13..3a2adfe228 100644 --- a/products/ASC.Files/Client/src/HOCs/withFileActions.js +++ b/products/ASC.Files/Client/src/HOCs/withFileActions.js @@ -27,7 +27,7 @@ export default function withFileActions(WrappedFileItem) { }; onHideContextMenu = () => { - this.props.setBufferSelection(null); + //this.props.setBufferSelection(null); }; onDropZoneUpload = (files, uploadToFolder) => { diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js b/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js index 36c2568fb0..b1e8bf5d88 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js @@ -30,7 +30,6 @@ const SectionBodyContent = (props) => { setSelection, tooltipPageX, tooltipPageY, - setBufferSelection, } = props; useEffect(() => { @@ -68,7 +67,6 @@ const SectionBodyContent = (props) => { !e.target.closest(".not-selectable") ) setSelection([]); - setBufferSelection(null); }; const onMouseMove = (e) => { @@ -225,7 +223,6 @@ export default inject( setSelection, tooltipPageX, tooltipPageY, - setBufferSelection, } = filesStore; return { @@ -245,7 +242,6 @@ export default inject( setSelection, tooltipPageX, tooltipPageY, - setBufferSelection, }; } )( From b2eba16548a3cfb3bef1588c915798a9034cf960 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 8 Oct 2021 11:27:04 +0300 Subject: [PATCH 04/10] Web: Files: added selection to tile and row --- .../src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js | 4 +++- .../src/pages/Home/Section/Body/TilesView/FileTile.js | 2 ++ .../Home/Section/Body/TilesView/sub-components/Tile.js | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js b/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js index fcee53ec79..b85eb9a97a 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Body/RowsView/SimpleFilesRow.js @@ -53,7 +53,7 @@ const StyledWrapper = styled.div` `; const StyledSimpleFilesRow = styled(Row)` - ${(props) => props.checked && checkedStyle}; + ${(props) => (props.checked || props.isActive) && checkedStyle}; ${(props) => props.dragging && draggingStyle} position: unset; cursor: ${(props) => props.checked && `url(images/cursor.palm.svg), auto`}; @@ -116,6 +116,7 @@ const SimpleFilesRow = (props) => { onMouseClick, isEdit, showShare, + isActive, } = props; const sharedButton = @@ -158,6 +159,7 @@ const SimpleFilesRow = (props) => { {...contextOptionsProps} contextButtonSpacerWidth={displayShareButton} dragging={dragging && isDragging} + isActive={isActive} > { onFilesClick, onMouseClick, showShare, + isActive, } = props; const temporaryIcon = getIcon( 96, @@ -86,6 +87,7 @@ const FilesTile = (props) => { checked={checkedProps} {...contextOptionsProps} contextButtonSpacerWidth={displayShareButton} + isActive={isActive} > props.isFolder && FlexBoxStyles} ${(props) => props.isFolder && FolderStyles} - ${(props) => props.checked && checkedStyle} + ${(props) => (props.checked || props.isActive) && checkedStyle} ${(props) => props.isFolder && css` @@ -91,7 +91,7 @@ const StyledTile = styled.div` &:before, &:after { - ${(props) => props.checked && checkedStyle}; + ${(props) => (props.checked || props.isActive) && checkedStyle}; } &:hover:before, @@ -293,6 +293,7 @@ class Tile extends React.PureComponent { dragging, isRecycleBin, item, + isActive, } = this.props; const { isFolder, id, fileExst } = item; @@ -334,6 +335,7 @@ class Tile extends React.PureComponent { isFolder={(isFolder && !fileExst) || (!fileExst && id === -1)} isRecycleBin={isRecycleBin} checked={checked} + isActive={isActive} > {isFolder || (!fileExst && id === -1) ? ( <> From 6a85eca20e1fe92e1befe3377d3c0ad7b1b1ddbc Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Sun, 10 Oct 2021 23:29:01 +0300 Subject: [PATCH 05/10] Web: Components: ContextMenu: Fixed context menu still open after starting drag events --- packages/asc-web-components/context-menu/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/asc-web-components/context-menu/index.js b/packages/asc-web-components/context-menu/index.js index 1a8cdb0eb5..7d47a8ec81 100644 --- a/packages/asc-web-components/context-menu/index.js +++ b/packages/asc-web-components/context-menu/index.js @@ -445,6 +445,7 @@ class ContextMenu extends Component { }; document.addEventListener("click", this.documentClickListener); + document.addEventListener("mousedown", this.documentClickListener); } } @@ -476,6 +477,7 @@ class ContextMenu extends Component { unbindDocumentClickListener() { if (this.documentClickListener) { document.removeEventListener("click", this.documentClickListener); + document.removeEventListener("mousedown", this.documentClickListener); this.documentClickListener = null; } } From 8b9dd7fbb40caeb036a236f7a681909c5efc3106 Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Sun, 10 Oct 2021 23:30:59 +0300 Subject: [PATCH 06/10] Web: Files: HOC: Added item icon element for editing state (Table view), paste default if property undefined --- products/ASC.Files/Client/src/HOCs/withContent.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/products/ASC.Files/Client/src/HOCs/withContent.js b/products/ASC.Files/Client/src/HOCs/withContent.js index 31fbf6e83f..260d996461 100644 --- a/products/ASC.Files/Client/src/HOCs/withContent.js +++ b/products/ASC.Files/Client/src/HOCs/withContent.js @@ -15,6 +15,7 @@ import config from "../../package.json"; import EditingWrapperComponent from "../components/EditingWrapperComponent"; import { getTitleWithoutExst } from "../helpers/files-helpers"; import { getDefaultFileName } from "../helpers/utils"; +import ItemIcon from "../components/ItemIcon"; export default function withContent(WrappedContent) { class WithContent extends React.Component { constructor(props) { @@ -274,11 +275,16 @@ export default function withContent(WrappedContent) { const newItems = item.new || fileStatus === 2; const showNew = !!newItems; + const elementIcon = element ? ( + element + ) : ( + + ); return isEdit ? ( Date: Mon, 11 Oct 2021 11:07:29 +0300 Subject: [PATCH 07/10] Web: Files: fixed selection --- products/ASC.Files/Client/src/store/FilesActionsStore.js | 1 + 1 file changed, 1 insertion(+) diff --git a/products/ASC.Files/Client/src/store/FilesActionsStore.js b/products/ASC.Files/Client/src/store/FilesActionsStore.js index 3ae85308ef..31b490aa65 100644 --- a/products/ASC.Files/Client/src/store/FilesActionsStore.js +++ b/products/ASC.Files/Client/src/store/FilesActionsStore.js @@ -439,6 +439,7 @@ class FilesActionStore { openLocationAction = (locationId, isFolder) => { const locationFilter = isFolder ? this.filesStore.filter : null; + this.filesStore.setBufferSelection(null); return this.filesStore.fetchFiles(locationId, locationFilter); /*.then(() => //isFolder ? null : this.selectRowAction(!checked, item) From 8cf7d046e456b50b39a7f40adc88ef62830671da Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Mon, 11 Oct 2021 12:00:41 +0300 Subject: [PATCH 08/10] Web: Files: fixed selectbox --- products/ASC.Files/Client/src/HOCs/withFileActions.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/products/ASC.Files/Client/src/HOCs/withFileActions.js b/products/ASC.Files/Client/src/HOCs/withFileActions.js index 3a2adfe228..0f7005067f 100644 --- a/products/ASC.Files/Client/src/HOCs/withFileActions.js +++ b/products/ASC.Files/Client/src/HOCs/withFileActions.js @@ -56,8 +56,8 @@ export default function withFileActions(WrappedFileItem) { isTrashFolder, onSelectItem, item, - bufferSelection, setBufferSelection, + isActive, } = this.props; const { id, isFolder } = item; @@ -68,7 +68,7 @@ export default function withFileActions(WrappedFileItem) { if ( isPrivacy || isTrashFolder || - (!draggable && !isFileName && !bufferSelection) + (!draggable && !isFileName && !isActive) ) return e; @@ -359,7 +359,8 @@ export default function withFileActions(WrappedFileItem) { const isActive = bufferSelection && bufferSelection.id === item.id && - bufferSelection.fileExst === item.fileExst; // need for select row item + bufferSelection.fileExst === item.fileExst && + !selection.length; // need for select row item return { t, From 23bcd92528dae21d2e9795381b19bd21d12b7960 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Mon, 11 Oct 2021 12:09:13 +0300 Subject: [PATCH 09/10] Web: Files: added reset buffer selection --- .../ASC.Files/Client/src/pages/Home/Section/Body/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js b/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js index b1e8bf5d88..a5a18d96e6 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Body/index.js @@ -28,6 +28,7 @@ const SectionBodyContent = (props) => { moveDragItems, viewAs, setSelection, + setBufferSelection, tooltipPageX, tooltipPageY, } = props; @@ -65,8 +66,10 @@ const SectionBodyContent = (props) => { e.target.closest(".scroll-body") && !e.target.closest(".files-item") && !e.target.closest(".not-selectable") - ) + ) { setSelection([]); + setBufferSelection(null); + } }; const onMouseMove = (e) => { @@ -223,6 +226,7 @@ export default inject( setSelection, tooltipPageX, tooltipPageY, + setBufferSelection, } = filesStore; return { @@ -240,6 +244,7 @@ export default inject( moveDragItems: filesActionsStore.moveDragItems, viewAs, setSelection, + setBufferSelection, tooltipPageX, tooltipPageY, }; From 1689b8e44b6d87d5f4b69f6e7c853a2adef3ffca Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Mon, 11 Oct 2021 12:56:17 +0300 Subject: [PATCH 10/10] Web: Components: ContextMenu: Fixed check condition for global portals --- packages/asc-web-components/context-menu/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/asc-web-components/context-menu/index.js b/packages/asc-web-components/context-menu/index.js index 7d47a8ec81..5c296d08f2 100644 --- a/packages/asc-web-components/context-menu/index.js +++ b/packages/asc-web-components/context-menu/index.js @@ -435,7 +435,8 @@ class ContextMenu extends Component { bindDocumentClickListener() { if (!this.documentClickListener) { this.documentClickListener = (e) => { - if (this.isOutsideClicked(e) && e.button !== 2) { + if (this.isOutsideClicked(e)) { + //TODO: (&& e.button !== 2) restore after global usage this.hide(e); this.setState({