Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
szse
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhaochengxiang
szse
Commits
6128a4e0
Commit
6128a4e0
authored
Jul 02, 2021
by
zhaochengxiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
拖拽自动滚动问题
parent
4ff97156
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
4 deletions
+43
-4
ImportActionIndex.jsx
src/view/Manage/Model/Component/ImportActionIndex.jsx
+20
-2
ImportActionTable.jsx
src/view/Manage/Model/Component/ImportActionTable.jsx
+23
-2
No files found.
src/view/Manage/Model/Component/ImportActionIndex.jsx
View file @
6128a4e0
...
...
@@ -603,18 +603,36 @@ const ImportActionIndex = (props) => {
return
hasValidateReports
?
includeValidateColumn
:
columns
;
}
let
pendingUpdateFn
=
undefined
;
let
requestedFrame
=
undefined
;
const
drawFrame
=
()
=>
{
const
newData
=
update
(
data
,
pendingUpdateFn
);
onChange
&&
onChange
(
newData
);
pendingUpdateFn
=
undefined
;
requestedFrame
=
undefined
;
};
const
scheduleUpdate
=
(
updateFn
)
=>
{
pendingUpdateFn
=
updateFn
;
if
(
!
requestedFrame
)
{
requestedFrame
=
requestAnimationFrame
(
drawFrame
);
}
}
const
moveRow
=
useCallback
(
(
dragIndex
,
hoverIndex
)
=>
{
const
dragRow
=
data
[
dragIndex
];
const
newData
=
update
(
data
,
{
scheduleUpdate
(
{
$splice
:
[
[
dragIndex
,
1
],
[
hoverIndex
,
0
,
dragRow
],
],
});
onChange
&&
onChange
(
newData
);
},
//eslint-disable-next-line react-hooks/exhaustive-deps
[
data
],
...
...
src/view/Manage/Model/Component/ImportActionTable.jsx
View file @
6128a4e0
...
...
@@ -672,18 +672,39 @@ const ImportActionTable = (props) => {
return
hasValidateReports
?
includeValidateColumn
:
columns
;
}
//增加拖拽自动滚动功能
//https://codesandbox.io/s/react-dnd-example-12-s3nnf?file=/src/Container.jsx:393-425
let
pendingUpdateFn
=
undefined
;
let
requestedFrame
=
undefined
;
const
drawFrame
=
()
=>
{
const
newData
=
update
(
data
,
pendingUpdateFn
);
onChangeRef
.
current
&&
onChangeRef
.
current
(
newData
);
pendingUpdateFn
=
undefined
;
requestedFrame
=
undefined
;
};
const
scheduleUpdate
=
(
updateFn
)
=>
{
pendingUpdateFn
=
updateFn
;
if
(
!
requestedFrame
)
{
requestedFrame
=
requestAnimationFrame
(
drawFrame
);
}
}
const
moveRow
=
useCallback
(
(
dragIndex
,
hoverIndex
)
=>
{
const
dragRow
=
data
[
dragIndex
];
const
newData
=
update
(
data
,
{
scheduleUpdate
(
{
$splice
:
[
[
dragIndex
,
1
],
[
hoverIndex
,
0
,
dragRow
],
],
});
onChangeRef
.
current
&&
onChangeRef
.
current
(
newData
);
//
onChangeRef.current && onChangeRef.current(newData);
},
//eslint-disable-next-line react-hooks/exhaustive-deps
[
data
],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment