Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
Tia-dev
Project
Project
Details
Activity
Releases
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
Dida Adams Arizona
Tia-dev
Commits
1e490cf1
Commit
1e490cf1
authored
Aug 16, 2020
by
d.arizona
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drag drop
parent
af7e9aed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
31 deletions
+28
-31
VisualReportItems.js
...container/MasterData/formReportItems/VisualReportItems.js
+28
-31
No files found.
src/container/MasterData/formReportItems/VisualReportItems.js
View file @
1e490cf1
...
...
@@ -4,8 +4,6 @@ import { TextField, List, ListSubheader, Typography, Collapse } from '@material-
import
MinimizeIcon
from
'@material-ui/icons/Minimize'
;
import
AddIcon
from
'@material-ui/icons/Add'
;
import
RemoveIcon
from
'@material-ui/icons/Remove'
;
import
TreeView
from
'@material-ui/lab/TreeView'
;
import
TreeItem
from
'@material-ui/lab/TreeItem'
;
import
Nestable
from
'react-nestable'
;
const
useStyles
=
makeStyles
((
theme
)
=>
({
...
...
@@ -73,7 +71,8 @@ export default class VisualReportItems extends Component {
]
},
],
arrayCollapse
:
[]
arrayCollapse
:
[],
defaultCollapsed
:
false
}
}
...
...
@@ -94,32 +93,30 @@ export default class VisualReportItems extends Component {
}
}
renderItem
=
({
item
,
index
})
=>
{
return
(
item
.
text
)
// if (item.children.length > 0) {
// return (
// <TreeView
// defaultCollapseIcon={<RemoveIcon />}
// defaultExpandIcon={< AddIcon/>}
// >
// {item.children.length > 0 &&
// <TreeItem nodeId={item.id} style={{margin: 10}} label={item.text}>
// {item.children.map((items,indexs) => {
// return (
// <TreeItem nodeId={items.id} style={{margin: 10}} label={items.text}/>
// )
// })}
// </TreeItem>
// // :
// // <TreeItem nodeId={item.id} style={{margin: 10}} label={item.text}/>
// }
// </TreeView>
// )
// } else {
// return (
// <TreeItem nodeId={item.id} style={{margin: 10}} label={item.text}/>
// )
// }
onDefaultCollapsed
=
()
=>
this
.
setState
({
defaultCollapsed
:
!
this
.
state
.
defaultCollapsed
});
collapse
=
(
collapseCase
)
=>
{
let
arrayCollapse
=
this
.
state
.
arrayCollapse
let
index
=
arrayCollapse
.
findIndex
((
val
)
=>
val
.
id
===
collapseCase
)
if
(
arrayCollapse
.
includes
(
collapseCase
))
{
arrayCollapse
.
splice
(
index
,
1
)
}
else
{
arrayCollapse
.
push
(
collapseCase
)
}
if
(
this
.
refNestable
)
{
this
.
refNestable
.
collapse
(
arrayCollapse
.
length
>
0
?
arrayCollapse
:
'NONE'
);
}
};
renderItem
=
({
item
,
collapseIcon
})
=>
{
return
(
<
div
>
{
collapseIcon
?
(
this
.
state
.
arrayCollapse
.
includes
(
item
.
id
)?
<
AddIcon
/>
:
<
RemoveIcon
/>
)
:
null
}
<
button
type
=
"button"
onClick
=
{()
=>
this
.
collapse
(
item
.
id
)}
>
{
item
.
text
}
<
/button>
<
/div
>
)
};
render
()
{
...
...
@@ -141,7 +138,6 @@ export default class VisualReportItems extends Component {
style
=
{{
width
:
250
}}
select
label
=
"Item Laporan"
// onChange={handleChange}
helperText
=
""
SelectProps
=
{{
native
:
true
,
...
...
@@ -177,7 +173,6 @@ export default class VisualReportItems extends Component {
style
=
{{
width
:
250
}}
select
label
=
"Perusahaan"
// onChange={handleChange}
helperText
=
""
SelectProps
=
{{
native
:
true
,
...
...
@@ -210,7 +205,9 @@ export default class VisualReportItems extends Component {
<
div
className
=
"margin-top-30px"
>
<
Nestable
items
=
{
this
.
state
.
items
}
collapsed
=
{
this
.
state
.
defaultCollapsed
}
renderItem
=
{
this
.
renderItem
}
ref
=
{
el
=>
this
.
refNestable
=
el
}
onChange
=
{(
e
)
=>
this
.
setState
({
items
:
e
})}
/
>
<
/div
>
...
...
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