fix: fixed swiping slider during holding group
This commit is contained in:
@ -72,8 +72,13 @@ const useDealsAndStatusesDnd = (): ReturnType => {
|
|||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const swipeSliderDuringDrag = (activeId: number, over: Over) => {
|
const swipeSliderDuringDrag = (activeId: number | string, over: Over) => {
|
||||||
const activeStatus = getStatusByDealId(activeId);
|
let activeStatus: StatusSchema | undefined;
|
||||||
|
if (typeof activeId === "string") {
|
||||||
|
activeStatus = getStatusByGroupId(getGroupId(activeId));
|
||||||
|
} else {
|
||||||
|
activeStatus = getStatusByDealId(Number(activeId));
|
||||||
|
}
|
||||||
const swiperActiveStatus =
|
const swiperActiveStatus =
|
||||||
statuses[swiperRef.current?.swiper.activeIndex ?? 0];
|
statuses[swiperRef.current?.swiper.activeIndex ?? 0];
|
||||||
if (swiperActiveStatus.id !== activeStatus?.id) return;
|
if (swiperActiveStatus.id !== activeStatus?.id) return;
|
||||||
@ -81,11 +86,16 @@ const useDealsAndStatusesDnd = (): ReturnType => {
|
|||||||
const activeStatusLexorank = activeStatus?.lexorank;
|
const activeStatusLexorank = activeStatus?.lexorank;
|
||||||
let overStatusLexorank: string | undefined;
|
let overStatusLexorank: string | undefined;
|
||||||
|
|
||||||
if (typeof over.id === "string" && isContainerId(over.id)) {
|
if (typeof over.id === "string") {
|
||||||
const overStatusId = getContainerId(over.id);
|
if (isContainerId(over.id)) {
|
||||||
overStatusLexorank = statuses.find(
|
const overStatusId = getContainerId(over.id);
|
||||||
s => s.id === overStatusId
|
overStatusLexorank = statuses.find(
|
||||||
)?.lexorank;
|
s => s.id === overStatusId
|
||||||
|
)?.lexorank;
|
||||||
|
} else {
|
||||||
|
const overGroupId = getGroupId(over.id);
|
||||||
|
overStatusLexorank = getStatusByGroupId(overGroupId)?.lexorank;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
overStatusLexorank = getStatusByDealId(Number(over.id))?.lexorank;
|
overStatusLexorank = getStatusByDealId(Number(over.id))?.lexorank;
|
||||||
}
|
}
|
||||||
@ -117,7 +127,7 @@ const useDealsAndStatusesDnd = (): ReturnType => {
|
|||||||
if (!over) return;
|
if (!over) return;
|
||||||
const activeId = active.id as string | number;
|
const activeId = active.id as string | number;
|
||||||
|
|
||||||
if (isMobile && typeof activeId !== "string") {
|
if (isMobile && (typeof activeId !== "string" || isGroupId(activeId))) {
|
||||||
swipeSliderDuringDrag(activeId, over);
|
swipeSliderDuringDrag(activeId, over);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user