diff --git a/src/ui/TreeView.js b/src/ui/TreeView.js index 81105556f3..9bf6526e0f 100644 --- a/src/ui/TreeView.js +++ b/src/ui/TreeView.js @@ -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`
${this.renderProperties(json, true)}
` + 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`` + return yo`` } formatDataInternal (key, data, children, properties, expand) { var renderedProperties = Object.keys(properties).map((item) => { return this.formatDataInternal(item, properties[item], [], [], false) }) - var label = yo`${this.formatData(key, data)}` + var label = yo`${this.formatData(key, data)}` var renderedChildren = '' if (children.length) { - renderedChildren = yo`` + renderedChildren = yo`` 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`
  • ${label}${renderedChildren}
  • ` + return yo`
  • ${label}${renderedChildren}
  • ` } extractPropertiesDefault (key, data) { diff --git a/src/ui/styles/treeView.js b/src/ui/styles/treeView.js index b4c17c9efb..1f9693e450 100644 --- a/src/ui/styles/treeView.js +++ b/src/ui/styles/treeView.js @@ -1,16 +1,31 @@ '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': '10px' + 'margin-left': '5px' }, label: { 'vertical-align': 'top', 'font-family': 'arial,sans-serif' + }, + caret: { + 'position': 'absolute', + 'margin-top': '3px' + }, + data: { + 'margin-left': '10px' } }