Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Neos
Commits
a05bea12
Commit
a05bea12
authored
Mar 30, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update checkCardModal.tsx
parent
21cd9e99
Pipeline
#21011
passed with stages
in 22 minutes and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
60 deletions
+38
-60
src/ui/Duel/checkCardModal.tsx
src/ui/Duel/checkCardModal.tsx
+38
-60
No files found.
src/ui/Duel/checkCardModal.tsx
View file @
a05bea12
...
@@ -13,15 +13,14 @@ import {
...
@@ -13,15 +13,14 @@ import {
resetCheckCardModal
,
resetCheckCardModal
,
setCheckCardModalIsOpen
,
setCheckCardModalIsOpen
,
}
from
"
../../reducers/duel/mod
"
;
}
from
"
../../reducers/duel/mod
"
;
import
{
Modal
,
Button
,
Row
,
Col
,
Popover
}
from
"
antd
"
;
import
{
Button
,
Row
,
Col
,
Popover
}
from
"
antd
"
;
import
{
CheckCard
}
from
"
@ant-design/pro-components
"
;
import
{
CheckCard
}
from
"
@ant-design/pro-components
"
;
import
{
import
{
sendSelectCardResponse
,
sendSelectCardResponse
,
sendSelectChainResponse
,
sendSelectChainResponse
,
}
from
"
../../api/ocgcore/ocgHelper
"
;
}
from
"
../../api/ocgcore/ocgHelper
"
;
import
type
{
DraggableData
,
DraggableEvent
}
from
"
react-draggable
"
;
import
Draggable
from
"
react-draggable
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
NeosConfig
from
"
../../../neos.config.json
"
;
import
DragModal
from
"
./dragModal
"
;
const
CheckCardModal
=
()
=>
{
const
CheckCardModal
=
()
=>
{
const
dispatch
=
store
.
dispatch
;
const
dispatch
=
store
.
dispatch
;
...
@@ -36,27 +35,7 @@ const CheckCardModal = () => {
...
@@ -36,27 +35,7 @@ const CheckCardModal = () => {
// Draggable 相关
// Draggable 相关
const
[
draggable
,
setDraggable
]
=
useState
(
false
);
const
[
draggable
,
setDraggable
]
=
useState
(
false
);
const
[
bounds
,
setBounds
]
=
useState
({
left
:
0
,
top
:
0
,
bottom
:
0
,
right
:
0
,
});
const
draggleRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
draggleRef
=
useRef
<
HTMLDivElement
>
(
null
);
const
onStart
=
(
_event
:
DraggableEvent
,
uiData
:
DraggableData
)
=>
{
const
{
clientWidth
,
clientHeight
}
=
window
.
document
.
documentElement
;
const
targetRect
=
draggleRef
.
current
?.
getBoundingClientRect
();
if
(
!
targetRect
)
{
return
;
}
setBounds
({
left
:
-
targetRect
.
left
+
uiData
.
x
,
right
:
clientWidth
-
(
targetRect
.
right
-
uiData
.
x
),
top
:
-
targetRect
.
top
+
uiData
.
y
,
bottom
:
clientHeight
-
(
targetRect
.
bottom
-
uiData
.
y
),
});
};
const
onMouseOver
=
()
=>
{
const
onMouseOver
=
()
=>
{
if
(
draggable
)
{
if
(
draggable
)
{
setDraggable
(
false
);
setDraggable
(
false
);
...
@@ -86,32 +65,17 @@ const CheckCardModal = () => {
...
@@ -86,32 +65,17 @@ const CheckCardModal = () => {
};
};
return
(
return
(
<
Modal
<
DragModal
title=
{
`请选择${min}到${max}张卡片`
}
modalProps=
{
{
open=
{
isOpen
}
title
:
`请选择${min}到${max}张卡片`
,
closable=
{
false
}
open
:
isOpen
,
footer=
{
closable
:
false
,
<>
footer
:
(
<
Button
<>
disabled=
{
response
.
length
<
min
||
response
.
length
>
max
}
onClick=
{
()
=>
{
sendResponseHandler
(
onSubmit
,
response
);
dispatch
(
setCheckCardModalIsOpen
(
false
));
dispatch
(
resetCheckCardModal
());
}
}
onMouseOver=
{
onMouseOver
}
onMouseOut=
{
onMouseOut
}
onFocus=
{
()
=>
{}
}
onBlur=
{
()
=>
{}
}
>
submit
</
Button
>
{
cancelAble
?
(
<
Button
<
Button
disabled=
{
response
.
length
<
min
||
response
.
length
>
max
}
onClick=
{
()
=>
{
onClick=
{
()
=>
{
if
(
cancelResponse
)
{
sendResponseHandler
(
onSubmit
,
response
);
sendResponseHandler
(
onSubmit
,
[
cancelResponse
]);
}
dispatch
(
setCheckCardModalIsOpen
(
false
));
dispatch
(
setCheckCardModalIsOpen
(
false
));
dispatch
(
resetCheckCardModal
());
dispatch
(
resetCheckCardModal
());
}
}
}
}
...
@@ -120,19 +84,33 @@ const CheckCardModal = () => {
...
@@ -120,19 +84,33 @@ const CheckCardModal = () => {
onFocus=
{
()
=>
{}
}
onFocus=
{
()
=>
{}
}
onBlur=
{
()
=>
{}
}
onBlur=
{
()
=>
{}
}
>
>
cancel
submit
</
Button
>
</
Button
>
)
:
(
{
cancelAble
?
(
<></>
<
Button
)
}
onClick=
{
()
=>
{
</>
if
(
cancelResponse
)
{
}
sendResponseHandler
(
onSubmit
,
[
cancelResponse
]);
modalRender=
{
(
modal
)
=>
(
}
<
Draggable
disabled=
{
!
draggable
}
bounds=
{
bounds
}
onStart=
{
onStart
}
>
dispatch
(
setCheckCardModalIsOpen
(
false
));
<
div
ref=
{
draggleRef
}
>
{
modal
}
</
div
>
dispatch
(
resetCheckCardModal
());
</
Draggable
>
}
}
)
}
onMouseOver=
{
onMouseOver
}
width=
{
800
}
onMouseOut=
{
onMouseOut
}
onFocus=
{
()
=>
{}
}
onBlur=
{
()
=>
{}
}
>
cancel
</
Button
>
)
:
(
<></>
)
}
</>
),
width
:
800
,
}
}
dragRef=
{
draggleRef
}
draggable=
{
draggable
}
>
>
<
CheckCard
.
Group
<
CheckCard
.
Group
multiple
multiple
...
@@ -181,7 +159,7 @@ const CheckCardModal = () => {
...
@@ -181,7 +159,7 @@ const CheckCardModal = () => {
);
);
})
}
})
}
</
CheckCard
.
Group
>
</
CheckCard
.
Group
>
</
Modal
>
</
Drag
Modal
>
);
);
};
};
...
...
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