Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
055fd70c
Commit
055fd70c
authored
Jan 19, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix indentation
parent
bb18436a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
8 deletions
+24
-8
TreeView.js
src/ui/TreeView.js
+7
-6
treeView.js
src/ui/styles/treeView.js
+17
-2
No files found.
src/ui/TreeView.js
View file @
055fd70c
...
...
@@ -15,11 +15,12 @@ class TreeView {
this
.
extractProperties
=
opts
.
extractProperties
||
this
.
extractPropertiesDefault
this
.
view
=
null
this
.
cssLabel
=
ui
.
formatCss
(
opts
.
css
||
{},
style
.
label
)
this
.
cssList
=
ui
.
formatCss
(
opts
.
css
||
{},
style
.
list
)
this
.
cssUl
=
ui
.
formatCss
(
opts
.
css
||
{},
style
.
cssUl
)
this
.
cssLi
=
ui
.
formatCss
(
opts
.
css
||
{},
style
.
cssLi
)
}
render
(
json
)
{
var
view
=
yo
`<div>
${
this
.
renderProperties
(
json
,
true
)}
</div>`
var
view
=
this
.
renderProperties
(
json
,
true
)
if
(
!
this
.
view
)
{
this
.
view
=
view
}
...
...
@@ -49,17 +50,17 @@ class TreeView {
var
children
=
Object
.
keys
(
json
).
map
((
innerkey
)
=>
{
return
this
.
renderObject
(
json
[
innerkey
],
json
,
innerkey
,
expand
)
})
return
yo
`<ul style=
${
this
.
css
List
}
>
${
children
}
</ul>`
return
yo
`<ul style=
${
this
.
css
Ul
}
>
${
children
}
</ul>`
}
formatDataInternal
(
key
,
data
,
children
,
properties
,
expand
)
{
var
renderedProperties
=
Object
.
keys
(
properties
).
map
((
item
)
=>
{
return
this
.
formatDataInternal
(
item
,
properties
[
item
],
[],
[],
false
)
})
var
label
=
yo
`<span style=
${
this
.
cssLabel
}
><label style=
'position:absolute;margin-top: 2px'></label><span style='margin-left: 10px'
>
${
this
.
formatData
(
key
,
data
)}
</span></span>`
var
label
=
yo
`<span style=
${
this
.
cssLabel
}
><label style=
${
ui
.
formatCss
(
style
.
caret
)}
></label><span style=
${
ui
.
formatCss
(
style
.
data
)}
>
${
this
.
formatData
(
key
,
data
)}
</span></span>`
var
renderedChildren
=
''
if
(
children
.
length
)
{
renderedChildren
=
yo
`<ul style=
${
this
.
css
List
}
>
${
renderedProperties
}${
children
}
</ul>`
renderedChildren
=
yo
`<ul style=
${
this
.
css
Ul
}
>
${
renderedProperties
}${
children
}
</ul>`
renderedChildren
.
style
.
display
=
expand
?
'block'
:
'none'
label
.
firstElementChild
.
className
=
expand
?
'fa fa-caret-down'
:
'fa fa-caret-right'
label
.
onclick
=
function
()
{
...
...
@@ -68,7 +69,7 @@ class TreeView {
list
.
style
.
display
=
list
.
style
.
display
===
'none'
?
'block'
:
'none'
}
}
return
yo
`<li style=
${
this
.
cssLi
st
}
>
${
label
}${
renderedChildren
}
</li>`
return
yo
`<li style=
${
this
.
cssLi
}
>
${
label
}${
renderedChildren
}
</li>`
}
extractPropertiesDefault
(
key
,
data
)
{
...
...
src/ui/styles/treeView.js
View file @
055fd70c
'use strict'
module
.
exports
=
{
list
:
{
cssUl
:
{
'list-style-type'
:
'none'
,
'-webkit-margin-before'
:
'0px'
,
'-webkit-margin-after'
:
'0px'
,
'-webkit-margin-start'
:
'0px'
,
'-webkit-margin-end'
:
'0px'
,
'-webkit-padding-start'
:
'0px'
},
cssLi
:
{
'list-style-type'
:
'none'
,
'-webkit-margin-before'
:
'0px'
,
'-webkit-margin-after'
:
'0px'
,
'-webkit-margin-start'
:
'0px'
,
'-webkit-margin-end'
:
'0px'
,
'-webkit-padding-start'
:
'0px'
,
'margin-left'
:
'
10
px'
'margin-left'
:
'
5
px'
},
label
:
{
'vertical-align'
:
'top'
,
'font-family'
:
'arial,sans-serif'
},
caret
:
{
'position'
:
'absolute'
,
'margin-top'
:
'3px'
},
data
:
{
'margin-left'
:
'10px'
}
}
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