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
Show 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-
...
@@ -4,8 +4,6 @@ import { TextField, List, ListSubheader, Typography, Collapse } from '@material-
import
MinimizeIcon
from
'@material-ui/icons/Minimize'
;
import
MinimizeIcon
from
'@material-ui/icons/Minimize'
;
import
AddIcon
from
'@material-ui/icons/Add'
;
import
AddIcon
from
'@material-ui/icons/Add'
;
import
RemoveIcon
from
'@material-ui/icons/Remove'
;
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'
;
import
Nestable
from
'react-nestable'
;
const
useStyles
=
makeStyles
((
theme
)
=>
({
const
useStyles
=
makeStyles
((
theme
)
=>
({
...
@@ -73,7 +71,8 @@ export default class VisualReportItems extends Component {
...
@@ -73,7 +71,8 @@ export default class VisualReportItems extends Component {
]
]
},
},
],
],
arrayCollapse
:
[]
arrayCollapse
:
[],
defaultCollapsed
:
false
}
}
}
}
...
@@ -94,32 +93,30 @@ export default class VisualReportItems extends Component {
...
@@ -94,32 +93,30 @@ export default class VisualReportItems extends Component {
}
}
}
}
renderItem
=
({
item
,
index
})
=>
{
onDefaultCollapsed
=
()
=>
this
.
setState
({
return
(
item
.
text
)
defaultCollapsed
:
!
this
.
state
.
defaultCollapsed
// if (item.children.length > 0) {
});
// return (
// <TreeView
collapse
=
(
collapseCase
)
=>
{
// defaultCollapseIcon={<RemoveIcon />}
let
arrayCollapse
=
this
.
state
.
arrayCollapse
// defaultExpandIcon={< AddIcon/>}
let
index
=
arrayCollapse
.
findIndex
((
val
)
=>
val
.
id
===
collapseCase
)
// >
if
(
arrayCollapse
.
includes
(
collapseCase
))
{
// {item.children.length > 0 &&
arrayCollapse
.
splice
(
index
,
1
)
// <TreeItem nodeId={item.id} style={{margin: 10}} label={item.text}>
}
else
{
// {item.children.map((items,indexs) => {
arrayCollapse
.
push
(
collapseCase
)
// return (
}
// <TreeItem nodeId={items.id} style={{margin: 10}} label={items.text}/>
if
(
this
.
refNestable
)
{
// )
this
.
refNestable
.
collapse
(
arrayCollapse
.
length
>
0
?
arrayCollapse
:
'NONE'
);
// })}
}
// </TreeItem>
};
// // :
// // <TreeItem nodeId={item.id} style={{margin: 10}} label={item.text}/>
renderItem
=
({
item
,
collapseIcon
})
=>
{
// }
return
(
// </TreeView>
<
div
>
// )
{
collapseIcon
?
(
this
.
state
.
arrayCollapse
.
includes
(
item
.
id
)?
<
AddIcon
/>
:
<
RemoveIcon
/>
)
:
null
}
// } else {
<
button
type
=
"button"
onClick
=
{()
=>
this
.
collapse
(
item
.
id
)}
>
{
item
.
text
}
<
/button>
// return (
<
/div
>
// <TreeItem nodeId={item.id} style={{margin: 10}} label={item.text}/>
)
// )
// }
};
};
render
()
{
render
()
{
...
@@ -141,7 +138,6 @@ export default class VisualReportItems extends Component {
...
@@ -141,7 +138,6 @@ export default class VisualReportItems extends Component {
style
=
{{
width
:
250
}}
style
=
{{
width
:
250
}}
select
select
label
=
"Item Laporan"
label
=
"Item Laporan"
// onChange={handleChange}
helperText
=
""
helperText
=
""
SelectProps
=
{{
SelectProps
=
{{
native
:
true
,
native
:
true
,
...
@@ -177,7 +173,6 @@ export default class VisualReportItems extends Component {
...
@@ -177,7 +173,6 @@ export default class VisualReportItems extends Component {
style
=
{{
width
:
250
}}
style
=
{{
width
:
250
}}
select
select
label
=
"Perusahaan"
label
=
"Perusahaan"
// onChange={handleChange}
helperText
=
""
helperText
=
""
SelectProps
=
{{
SelectProps
=
{{
native
:
true
,
native
:
true
,
...
@@ -210,7 +205,9 @@ export default class VisualReportItems extends Component {
...
@@ -210,7 +205,9 @@ export default class VisualReportItems extends Component {
<
div
className
=
"margin-top-30px"
>
<
div
className
=
"margin-top-30px"
>
<
Nestable
<
Nestable
items
=
{
this
.
state
.
items
}
items
=
{
this
.
state
.
items
}
collapsed
=
{
this
.
state
.
defaultCollapsed
}
renderItem
=
{
this
.
renderItem
}
renderItem
=
{
this
.
renderItem
}
ref
=
{
el
=>
this
.
refNestable
=
el
}
onChange
=
{(
e
)
=>
this
.
setState
({
items
:
e
})}
onChange
=
{(
e
)
=>
this
.
setState
({
items
:
e
})}
/
>
/
>
<
/div
>
<
/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