Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
hfpp2012
/
react-spd
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit dafe5f76
authored
Jun 08, 2017
by
hfpp2012 yinsigan
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
constants
1 parent
f4c7e025
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
6 deletions
src/actions/headergroup.js
src/constants/ActionTypes.js
src/reducers/headergroup.js
src/actions/headergroup.js
View file @
dafe5f7
import
*
as
types
from
'../constants/ActionTypes'
export
const
cloneElement
=
(
element
)
=>
({
type
:
'CLONE_ELEMENT'
,
type
:
types
.
CLONE_ELEMENT
,
element
})
export
const
deleteLastElement
=
()
=>
({
type
:
'DELETE_LAST_ELEMENT'
type
:
types
.
DELETE_LAST_ELEMENT
})
export
const
deleteElement
=
(
element
)
=>
({
type
:
'DELETE_ELEMENT'
,
type
:
types
.
DELETE_ELEMENT
,
element
})
src/constants/ActionTypes.js
0 → 100644
View file @
dafe5f7
export
const
CLONE_ELEMENT
=
'CLONE_ELEMENT'
export
const
DELETE_LAST_ELEMENT
=
'DELETE_LAST_ELEMENT'
export
const
DELETE_ELEMENT
=
'DELETE_ELEMENT'
src/reducers/headergroup.js
View file @
dafe5f7
import
{
List
}
from
'immutable'
import
{
CLONE_ELEMENT
,
DELETE_LAST_ELEMENT
,
DELETE_ELEMENT
}
from
'../constants/ActionTypes'
const
init_state
=
List
([
{
id
:
1
,
name
:
"药库"
,
initialPos
:
{
x
:
80
,
y
:
70
},
target_type
:
'RegionalDesign::Repo'
},
...
...
@@ -8,16 +9,16 @@ const init_state = List([
const
headergroup
=
(
state
=
init_state
,
action
)
=>
{
switch
(
action
.
type
)
{
case
'CLONE_ELEMENT'
:
case
CLONE_ELEMENT
:
return
[
...
state
,
action
.
element
]
case
'DELETE_LAST_ELEMENT'
:
case
DELETE_LAST_ELEMENT
:
return
[
...
state
.
slice
(
0
,
-
1
),
]
case
'DELETE_ELEMENT'
:
case
DELETE_ELEMENT
:
const
index
=
state
.
indexOf
(
action
.
element
)
return
[
...
state
.
slice
(
0
,
index
),
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment