Browse Source

Fix shift-rangeselect on sorted list view

master
jeffvli 3 years ago
committed by Jeff
parent
commit
d6efbf080a
  1. 4
      src/components/library/AlbumList.tsx
  2. 4
      src/components/library/AlbumView.tsx
  3. 4
      src/components/library/ArtistList.tsx
  4. 4
      src/components/library/ArtistView.tsx
  5. 4
      src/components/library/FolderList.tsx
  6. 4
      src/components/library/GenreList.tsx
  7. 4
      src/components/player/NowPlayingMiniView.tsx
  8. 4
      src/components/player/NowPlayingView.tsx
  9. 4
      src/components/playlist/PlaylistList.tsx
  10. 8
      src/components/playlist/PlaylistView.tsx
  11. 4
      src/components/search/SearchView.tsx
  12. 4
      src/components/settings/ConfigPanels/ListViewConfig.tsx
  13. 4
      src/components/starred/StarredView.tsx
  14. 24
      src/components/viewtypes/ListViewTable.tsx

4
src/components/library/AlbumList.tsx

@ -90,7 +90,7 @@ const AlbumList = () => {
}, [genres]); }, [genres]);
let timeout: any = null; let timeout: any = null;
const handleRowClick = (e: any, rowData: any) => { const handleRowClick = (e: any, rowData: any, tableData: any) => {
if (timeout === null) { if (timeout === null) {
timeout = window.setTimeout(() => { timeout = window.setTimeout(() => {
timeout = null; timeout = null;
@ -99,7 +99,7 @@ const AlbumList = () => {
dispatch(toggleSelected(rowData)); dispatch(toggleSelected(rowData));
} else if (e.shiftKey) { } else if (e.shiftKey) {
dispatch(setRangeSelected(rowData)); dispatch(setRangeSelected(rowData));
dispatch(toggleRangeSelected(searchQuery !== '' ? filteredData : albums)); dispatch(toggleRangeSelected(tableData));
} }
}, 100); }, 100);
} }

4
src/components/library/AlbumView.tsx

@ -64,7 +64,7 @@ const AlbumView = ({ ...rest }: any) => {
]); ]);
let timeout: any = null; let timeout: any = null;
const handleRowClick = (e: any, rowData: any) => { const handleRowClick = (e: any, rowData: any, tableData: any) => {
if (timeout === null) { if (timeout === null) {
timeout = window.setTimeout(() => { timeout = window.setTimeout(() => {
timeout = null; timeout = null;
@ -73,7 +73,7 @@ const AlbumView = ({ ...rest }: any) => {
dispatch(toggleSelected(rowData)); dispatch(toggleSelected(rowData));
} else if (e.shiftKey) { } else if (e.shiftKey) {
dispatch(setRangeSelected(rowData)); dispatch(setRangeSelected(rowData));
dispatch(toggleRangeSelected(searchQuery !== '' ? filteredData : data.song)); dispatch(toggleRangeSelected(tableData));
} }
}, 100); }, 100);
} }

4
src/components/library/ArtistList.tsx

@ -48,7 +48,7 @@ const ArtistList = () => {
const filteredData = useSearchQuery(searchQuery, artists, ['name']); const filteredData = useSearchQuery(searchQuery, artists, ['name']);
let timeout: any = null; let timeout: any = null;
const handleRowClick = (e: any, rowData: any) => { const handleRowClick = (e: any, rowData: any, tableData: any) => {
if (timeout === null) { if (timeout === null) {
timeout = window.setTimeout(() => { timeout = window.setTimeout(() => {
timeout = null; timeout = null;
@ -57,7 +57,7 @@ const ArtistList = () => {
dispatch(toggleSelected(rowData)); dispatch(toggleSelected(rowData));
} else if (e.shiftKey) { } else if (e.shiftKey) {
dispatch(setRangeSelected(rowData)); dispatch(setRangeSelected(rowData));
dispatch(toggleRangeSelected(searchQuery !== '' ? filteredData : artists)); dispatch(toggleRangeSelected(tableData));
} }
}, 100); }, 100);
} }

4
src/components/library/ArtistView.tsx

@ -68,7 +68,7 @@ const ArtistView = ({ ...rest }: any) => {
]); ]);
let timeout: any = null; let timeout: any = null;
const handleRowClick = (e: any, rowData: any) => { const handleRowClick = (e: any, rowData: any, tableData: any) => {
if (timeout === null) { if (timeout === null) {
timeout = window.setTimeout(() => { timeout = window.setTimeout(() => {
timeout = null; timeout = null;
@ -77,7 +77,7 @@ const ArtistView = ({ ...rest }: any) => {
dispatch(toggleSelected(rowData)); dispatch(toggleSelected(rowData));
} else if (e.shiftKey) { } else if (e.shiftKey) {
dispatch(setRangeSelected(rowData)); dispatch(setRangeSelected(rowData));
dispatch(toggleRangeSelected(searchQuery !== '' ? filteredData : data.album)); dispatch(toggleRangeSelected(tableData));
} }
}, 100); }, 100);
} }

4
src/components/library/FolderList.tsx

@ -69,7 +69,7 @@ const FolderList = () => {
}, [dispatch, query]); }, [dispatch, query]);
let timeout: any = null; let timeout: any = null;
const handleRowClick = (e: any, rowData: any) => { const handleRowClick = (e: any, rowData: any, tableData: any) => {
if (timeout === null) { if (timeout === null) {
timeout = window.setTimeout(() => { timeout = window.setTimeout(() => {
timeout = null; timeout = null;
@ -78,7 +78,7 @@ const FolderList = () => {
dispatch(toggleSelected(rowData)); dispatch(toggleSelected(rowData));
} else if (e.shiftKey) { } else if (e.shiftKey) {
dispatch(setRangeSelected(rowData)); dispatch(setRangeSelected(rowData));
dispatch(toggleRangeSelected(folderData.child)); dispatch(toggleRangeSelected(tableData));
} }
}, 100); }, 100);
} }

4
src/components/library/GenreList.tsx

@ -29,7 +29,7 @@ const GenreList = () => {
const filteredData = useSearchQuery(searchQuery, genres, ['value']); const filteredData = useSearchQuery(searchQuery, genres, ['value']);
let timeout: any = null; let timeout: any = null;
const handleRowClick = (e: any, rowData: any) => { const handleRowClick = (e: any, rowData: any, tableData: any) => {
if (timeout === null) { if (timeout === null) {
timeout = window.setTimeout(() => { timeout = window.setTimeout(() => {
timeout = null; timeout = null;
@ -38,7 +38,7 @@ const GenreList = () => {
dispatch(toggleSelected(rowData)); dispatch(toggleSelected(rowData));
} else if (e.shiftKey) { } else if (e.shiftKey) {
dispatch(setRangeSelected(rowData)); dispatch(setRangeSelected(rowData));
dispatch(toggleRangeSelected(searchQuery !== '' ? filteredData : genres)); dispatch(toggleRangeSelected(tableData));
} }
}, 100); }, 100);
} }

4
src/components/player/NowPlayingMiniView.tsx

@ -74,7 +74,7 @@ const NowPlayingMiniView = () => {
}, [playQueue.currentIndex, tableRef, playQueue.displayQueue, playQueue.scrollWithCurrentSong]); }, [playQueue.currentIndex, tableRef, playQueue.displayQueue, playQueue.scrollWithCurrentSong]);
let timeout: any = null; let timeout: any = null;
const handleRowClick = (e: any, rowData: any) => { const handleRowClick = (e: any, rowData: any, tableData: any) => {
if (timeout === null) { if (timeout === null) {
timeout = window.setTimeout(() => { timeout = window.setTimeout(() => {
timeout = null; timeout = null;
@ -83,7 +83,7 @@ const NowPlayingMiniView = () => {
dispatch(toggleSelected(rowData)); dispatch(toggleSelected(rowData));
} else if (e.shiftKey) { } else if (e.shiftKey) {
dispatch(setRangeSelected(rowData)); dispatch(setRangeSelected(rowData));
dispatch(toggleRangeSelected(playQueue[getCurrentEntryList(playQueue)])); dispatch(toggleRangeSelected(tableData));
} }
}, 100); }, 100);
} }

4
src/components/player/NowPlayingView.tsx

@ -118,7 +118,7 @@ const NowPlayingView = () => {
}, [playQueue.currentIndex, playQueue.scrollWithCurrentSong, tableRef]); }, [playQueue.currentIndex, playQueue.scrollWithCurrentSong, tableRef]);
let timeout: any = null; let timeout: any = null;
const handleRowClick = (e: any, rowData: any) => { const handleRowClick = (e: any, rowData: any, tableData: any) => {
if (timeout === null) { if (timeout === null) {
timeout = window.setTimeout(() => { timeout = window.setTimeout(() => {
timeout = null; timeout = null;
@ -130,7 +130,7 @@ const NowPlayingView = () => {
if (searchQuery !== '') { if (searchQuery !== '') {
dispatch(toggleRangeSelected(filteredData)); dispatch(toggleRangeSelected(filteredData));
} else { } else {
dispatch(toggleRangeSelected(playQueue[getCurrentEntryList(playQueue)])); dispatch(toggleRangeSelected(tableData));
} }
} }
}, 100); }, 100);

4
src/components/playlist/PlaylistList.tsx

@ -58,7 +58,7 @@ const PlaylistList = () => {
}; };
let timeout: any = null; let timeout: any = null;
const handleRowClick = (e: any, rowData: any) => { const handleRowClick = (e: any, rowData: any, tableData: any) => {
if (timeout === null) { if (timeout === null) {
timeout = window.setTimeout(() => { timeout = window.setTimeout(() => {
timeout = null; timeout = null;
@ -67,7 +67,7 @@ const PlaylistList = () => {
dispatch(toggleSelected(rowData)); dispatch(toggleSelected(rowData));
} else if (e.shiftKey) { } else if (e.shiftKey) {
dispatch(setRangeSelected(rowData)); dispatch(setRangeSelected(rowData));
dispatch(toggleRangeSelected(searchQuery !== '' ? filteredData : playlists)); dispatch(toggleRangeSelected(tableData));
} }
}, 100); }, 100);
} }

8
src/components/playlist/PlaylistView.tsx

@ -138,7 +138,7 @@ const PlaylistView = ({ ...rest }) => {
}, [data?.song, playlist]); }, [data?.song, playlist]);
let timeout: any = null; let timeout: any = null;
const handleRowClick = (e: any, rowData: any) => { const handleRowClick = (e: any, rowData: any, tableData: any) => {
if (timeout === null) { if (timeout === null) {
timeout = window.setTimeout(() => { timeout = window.setTimeout(() => {
timeout = null; timeout = null;
@ -147,11 +147,7 @@ const PlaylistView = ({ ...rest }) => {
dispatch(toggleSelected(rowData)); dispatch(toggleSelected(rowData));
} else if (e.shiftKey) { } else if (e.shiftKey) {
dispatch(setRangeSelected(rowData)); dispatch(setRangeSelected(rowData));
dispatch( dispatch(toggleRangeSelected(tableData));
toggleRangeSelected(
searchQuery !== '' ? filteredData : playlist[getCurrentEntryList(playlist)]
)
);
} }
}, 100); }, 100);
} }

4
src/components/search/SearchView.tsx

@ -44,7 +44,7 @@ const SearchView = () => {
); );
let timeout: any = null; let timeout: any = null;
const handleRowClick = (e: any, rowData: any) => { const handleRowClick = (e: any, rowData: any, tableData: any) => {
if (timeout === null) { if (timeout === null) {
timeout = window.setTimeout(() => { timeout = window.setTimeout(() => {
timeout = null; timeout = null;
@ -53,7 +53,7 @@ const SearchView = () => {
dispatch(toggleSelected(rowData)); dispatch(toggleSelected(rowData));
} else if (e.shiftKey) { } else if (e.shiftKey) {
dispatch(setRangeSelected(rowData)); dispatch(setRangeSelected(rowData));
dispatch(toggleRangeSelected(data.song)); dispatch(toggleRangeSelected(tableData));
} }
}, 100); }, 100);
} }

4
src/components/settings/ConfigPanels/ListViewConfig.tsx

@ -68,7 +68,7 @@ const ListViewConfig = ({ defaultColumns, columnPicker, columnList, settingsConf
}, [columnListType, config.lookAndFeel.listView, settingsConfig.columnList]); }, [columnListType, config.lookAndFeel.listView, settingsConfig.columnList]);
let timeout: any = null; let timeout: any = null;
const handleRowClick = (e: any, rowData: any) => { const handleRowClick = (e: any, rowData: any, tableData: any) => {
if (timeout === null) { if (timeout === null) {
timeout = window.setTimeout(() => { timeout = window.setTimeout(() => {
timeout = null; timeout = null;
@ -77,7 +77,7 @@ const ListViewConfig = ({ defaultColumns, columnPicker, columnList, settingsConf
dispatch(toggleSelected(rowData)); dispatch(toggleSelected(rowData));
} else if (e.shiftKey) { } else if (e.shiftKey) {
dispatch(setRangeSelected(rowData)); dispatch(setRangeSelected(rowData));
dispatch(toggleRangeSelected(config.lookAndFeel.listView[columnListType].columns)); dispatch(toggleRangeSelected(tableData));
} }
}, 100); }, 100);
} }

4
src/components/starred/StarredView.tsx

@ -57,7 +57,7 @@ const StarredView = () => {
); );
let timeout: any = null; let timeout: any = null;
const handleRowClick = (e: any, rowData: any) => { const handleRowClick = (e: any, rowData: any, tableData: any) => {
if (timeout === null) { if (timeout === null) {
timeout = window.setTimeout(() => { timeout = window.setTimeout(() => {
timeout = null; timeout = null;
@ -74,7 +74,7 @@ const StarredView = () => {
} }
} else if (favorite.active.tab === 'albums') { } else if (favorite.active.tab === 'albums') {
dispatch(setRangeSelected(rowData)); dispatch(setRangeSelected(rowData));
dispatch(toggleRangeSelected(searchQuery !== '' ? filteredData : data?.album)); dispatch(toggleRangeSelected(tableData));
} }
} }
}, 100); }, 100);

24
src/components/viewtypes/ListViewTable.tsx

@ -429,10 +429,14 @@ const ListViewTable = ({
height={rowHeight} height={rowHeight}
onClick={(e: any) => { onClick={(e: any) => {
if (!dnd) { if (!dnd) {
handleRowClick(e, { handleRowClick(
e,
{
...rowData, ...rowData,
rowIndex, rowIndex,
}); },
sortColumn && !nowPlaying ? sortedData : data
);
} }
}} }}
onDoubleClick={() => { onDoubleClick={() => {
@ -529,10 +533,14 @@ const ListViewTable = ({
return ( return (
<TableCellWrapper <TableCellWrapper
onClick={(e: any) => onClick={(e: any) =>
handleRowClick(e, { handleRowClick(
e,
{
...rowData, ...rowData,
rowIndex, rowIndex,
}) },
sortColumn && !nowPlaying ? sortedData : data
)
} }
onDoubleClick={() => onDoubleClick={() =>
handleRowDoubleClick({ handleRowDoubleClick({
@ -752,10 +760,14 @@ const ListViewTable = ({
/starred|userRating|columnResizable|columnDefaultSort/ /starred|userRating|columnResizable|columnDefaultSort/
) )
) { ) {
handleRowClick(e, { handleRowClick(
e,
{
...rowData, ...rowData,
rowIndex, rowIndex,
}); },
sortColumn && !nowPlaying ? sortedData : data
);
} }
}} }}
onDoubleClick={() => { onDoubleClick={() => {

Loading…
Cancel
Save