Fix drag to select in dropdowns, context menu and action bar (#1704)
- fix drag to select disable at many locations
This commit is contained in:
@ -164,7 +164,11 @@ export const PeopleCard = ({
|
|||||||
Icon={IconDotsVertical}
|
Icon={IconDotsVertical}
|
||||||
/>
|
/>
|
||||||
{isOptionsOpen && (
|
{isOptionsOpen && (
|
||||||
<StyledDropdownMenu ref={refs.setFloating} style={floatingStyles}>
|
<StyledDropdownMenu
|
||||||
|
data-select-disable
|
||||||
|
ref={refs.setFloating}
|
||||||
|
style={floatingStyles}
|
||||||
|
>
|
||||||
<StyledDropdownMenuItemsContainer
|
<StyledDropdownMenuItemsContainer
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -117,6 +117,7 @@ export const MatchColumnSelect = ({
|
|||||||
createPortal(
|
createPortal(
|
||||||
<StyledFloatingDropdown ref={refs.setFloating} style={floatingStyles}>
|
<StyledFloatingDropdown ref={refs.setFloating} style={floatingStyles}>
|
||||||
<StyledDropdownMenu
|
<StyledDropdownMenu
|
||||||
|
data-select-disable
|
||||||
ref={dropdownContainerRef}
|
ref={dropdownContainerRef}
|
||||||
width={refs.domReference.current?.clientWidth}
|
width={refs.domReference.current?.clientWidth}
|
||||||
>
|
>
|
||||||
|
|||||||
@ -43,7 +43,11 @@ export const ActionBar = ({ selectedIds }: OwnProps) => {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<StyledContainerActionBar className="action-bar" ref={wrapperRef}>
|
<StyledContainerActionBar
|
||||||
|
data-select-disable
|
||||||
|
className="action-bar"
|
||||||
|
ref={wrapperRef}
|
||||||
|
>
|
||||||
{actionBarEntries.map((item) => (
|
{actionBarEntries.map((item) => (
|
||||||
<ActionBarItem
|
<ActionBarItem
|
||||||
Icon={item.Icon}
|
Icon={item.Icon}
|
||||||
|
|||||||
@ -127,7 +127,7 @@ export const BoardColumnMenu = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledMenuContainer ref={boardColumnMenuRef}>
|
<StyledMenuContainer ref={boardColumnMenuRef}>
|
||||||
<StyledDropdownMenu>
|
<StyledDropdownMenu data-select-disable>
|
||||||
{currentMenu === 'actions' && (
|
{currentMenu === 'actions' && (
|
||||||
<StyledDropdownMenuItemsContainer>
|
<StyledDropdownMenuItemsContainer>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
|
|||||||
@ -66,7 +66,7 @@ export const ContextMenu = ({ selectedIds }: OwnProps) => {
|
|||||||
ref={wrapperRef}
|
ref={wrapperRef}
|
||||||
position={contextMenuPosition}
|
position={contextMenuPosition}
|
||||||
>
|
>
|
||||||
<StyledDropdownMenu>
|
<StyledDropdownMenu data-select-disable>
|
||||||
<StyledDropdownMenuItemsContainer>
|
<StyledDropdownMenuItemsContainer>
|
||||||
{contextMenuEntries.map((item) => (
|
{contextMenuEntries.map((item) => (
|
||||||
<ContextMenuItem
|
<ContextMenuItem
|
||||||
|
|||||||
@ -91,7 +91,7 @@ export const DropdownButton = ({
|
|||||||
<div ref={refs.setReference}>{buttonComponents}</div>
|
<div ref={refs.setReference}>{buttonComponents}</div>
|
||||||
)}
|
)}
|
||||||
{isDropdownButtonOpen && (
|
{isDropdownButtonOpen && (
|
||||||
<div ref={refs.setFloating} style={floatingStyles}>
|
<div data-select-disable ref={refs.setFloating} style={floatingStyles}>
|
||||||
{dropdownComponents}
|
{dropdownComponents}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@ -72,7 +72,7 @@ export const MultipleEntitySelect = <
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledDropdownMenu ref={containerRef}>
|
<StyledDropdownMenu ref={containerRef} data-select-disable>
|
||||||
<DropdownMenuSearchInput
|
<DropdownMenuSearchInput
|
||||||
value={searchFilter}
|
value={searchFilter}
|
||||||
onChange={handleFilterChange}
|
onChange={handleFilterChange}
|
||||||
|
|||||||
@ -62,6 +62,7 @@ export const SingleEntitySelect = <
|
|||||||
disableBlur={disableBackgroundBlur}
|
disableBlur={disableBackgroundBlur}
|
||||||
ref={containerRef}
|
ref={containerRef}
|
||||||
width={width}
|
width={width}
|
||||||
|
data-select-disable
|
||||||
>
|
>
|
||||||
<DropdownMenuSearchInput
|
<DropdownMenuSearchInput
|
||||||
value={searchFilter}
|
value={searchFilter}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import styled from '@emotion/styled';
|
import styled from '@emotion/styled';
|
||||||
import { useRecoilValue } from 'recoil';
|
|
||||||
|
|
||||||
import { DragSelect } from '@/ui/utilities/drag-select/components/DragSelect';
|
import { DragSelect } from '@/ui/utilities/drag-select/components/DragSelect';
|
||||||
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
||||||
@ -15,7 +14,6 @@ import { useLeaveTableFocus } from '../hooks/useLeaveTableFocus';
|
|||||||
import { useMapKeyboardToSoftFocus } from '../hooks/useMapKeyboardToSoftFocus';
|
import { useMapKeyboardToSoftFocus } from '../hooks/useMapKeyboardToSoftFocus';
|
||||||
import { useResetTableRowSelection } from '../hooks/useResetTableRowSelection';
|
import { useResetTableRowSelection } from '../hooks/useResetTableRowSelection';
|
||||||
import { useSetRowSelectedState } from '../hooks/useSetRowSelectedState';
|
import { useSetRowSelectedState } from '../hooks/useSetRowSelectedState';
|
||||||
import { isDraggingAndSelectingState } from '../states/isDraggingAndSelectingState';
|
|
||||||
import { TableHeader } from '../table-header/components/TableHeader';
|
import { TableHeader } from '../table-header/components/TableHeader';
|
||||||
import { TableHotkeyScope } from '../types/TableHotkeyScope';
|
import { TableHotkeyScope } from '../types/TableHotkeyScope';
|
||||||
|
|
||||||
@ -90,7 +88,6 @@ type OwnProps = {
|
|||||||
|
|
||||||
export const EntityTable = ({ updateEntityMutation }: OwnProps) => {
|
export const EntityTable = ({ updateEntityMutation }: OwnProps) => {
|
||||||
const tableBodyRef = useRef<HTMLDivElement>(null);
|
const tableBodyRef = useRef<HTMLDivElement>(null);
|
||||||
const isDraggingAndSelecting = useRecoilValue(isDraggingAndSelectingState);
|
|
||||||
|
|
||||||
const setRowSelectedState = useSetRowSelectedState();
|
const setRowSelectedState = useSetRowSelectedState();
|
||||||
const resetTableRowSelection = useResetTableRowSelection();
|
const resetTableRowSelection = useResetTableRowSelection();
|
||||||
@ -135,13 +132,11 @@ export const EntityTable = ({ updateEntityMutation }: OwnProps) => {
|
|||||||
</StyledTable>
|
</StyledTable>
|
||||||
</div>
|
</div>
|
||||||
</ScrollWrapper>
|
</ScrollWrapper>
|
||||||
{isDraggingAndSelecting && (
|
<DragSelect
|
||||||
<DragSelect
|
dragSelectable={tableBodyRef}
|
||||||
dragSelectable={tableBodyRef}
|
onDragSelectionStart={resetTableRowSelection}
|
||||||
onDragSelectionStart={resetTableRowSelection}
|
onDragSelectionChange={setRowSelectedState}
|
||||||
onDragSelectionChange={setRowSelectedState}
|
/>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
</StyledTableContainer>
|
</StyledTableContainer>
|
||||||
</StyledTableWithHeader>
|
</StyledTableWithHeader>
|
||||||
</EntityUpdateMutationContext.Provider>
|
</EntityUpdateMutationContext.Provider>
|
||||||
|
|||||||
@ -1,11 +1,10 @@
|
|||||||
import { useRecoilState, useResetRecoilState } from 'recoil';
|
import { useResetRecoilState } from 'recoil';
|
||||||
|
|
||||||
import { DropdownButton } from '@/ui/dropdown/components/DropdownButton';
|
import { DropdownButton } from '@/ui/dropdown/components/DropdownButton';
|
||||||
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
import { HotkeyScope } from '@/ui/utilities/hotkey/types/HotkeyScope';
|
||||||
import { viewEditModeState } from '@/ui/view-bar/states/viewEditModeState';
|
import { viewEditModeState } from '@/ui/view-bar/states/viewEditModeState';
|
||||||
|
|
||||||
import { TableOptionsDropdownId } from '../../constants/TableOptionsDropdownId';
|
import { TableOptionsDropdownId } from '../../constants/TableOptionsDropdownId';
|
||||||
import { isDraggingAndSelectingState } from '../../states/isDraggingAndSelectingState';
|
|
||||||
|
|
||||||
import { TableOptionsDropdownButton } from './TableOptionsDropdownButton';
|
import { TableOptionsDropdownButton } from './TableOptionsDropdownButton';
|
||||||
import { TableOptionsDropdownContent } from './TableOptionsDropdownContent';
|
import { TableOptionsDropdownContent } from './TableOptionsDropdownContent';
|
||||||
@ -19,14 +18,6 @@ export const TableOptionsDropdown = ({
|
|||||||
}: TableOptionsDropdownProps) => {
|
}: TableOptionsDropdownProps) => {
|
||||||
const resetViewEditMode = useResetRecoilState(viewEditModeState);
|
const resetViewEditMode = useResetRecoilState(viewEditModeState);
|
||||||
|
|
||||||
const [, setIsDraggingAndSelecting] = useRecoilState(
|
|
||||||
isDraggingAndSelectingState,
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleClose = () => setIsDraggingAndSelecting(true);
|
|
||||||
|
|
||||||
const handleOpen = () => setIsDraggingAndSelecting(false);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownButton
|
<DropdownButton
|
||||||
buttonComponents={<TableOptionsDropdownButton />}
|
buttonComponents={<TableOptionsDropdownButton />}
|
||||||
@ -34,8 +25,6 @@ export const TableOptionsDropdown = ({
|
|||||||
dropdownId={TableOptionsDropdownId}
|
dropdownId={TableOptionsDropdownId}
|
||||||
dropdownComponents={<TableOptionsDropdownContent />}
|
dropdownComponents={<TableOptionsDropdownContent />}
|
||||||
onClickOutside={resetViewEditMode}
|
onClickOutside={resetViewEditMode}
|
||||||
onClose={handleClose}
|
|
||||||
onOpen={handleOpen}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
import { atom } from 'recoil';
|
|
||||||
|
|
||||||
export const isDraggingAndSelectingState = atom<boolean>({
|
|
||||||
key: 'isDraggingAndSelectingState',
|
|
||||||
default: true,
|
|
||||||
});
|
|
||||||
@ -94,7 +94,7 @@ export const SingleEntityFilterDropdownButton = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StyledDropdownButtonContainer>
|
<StyledDropdownButtonContainer data-select-disable>
|
||||||
<StyledHeaderDropdownButton
|
<StyledHeaderDropdownButton
|
||||||
isUnfolded={isFilterDropdownUnfolded}
|
isUnfolded={isFilterDropdownUnfolded}
|
||||||
onClick={() => handleIsUnfoldedChange(!isFilterDropdownUnfolded)}
|
onClick={() => handleIsUnfoldedChange(!isFilterDropdownUnfolded)}
|
||||||
|
|||||||
Reference in New Issue
Block a user