|
|
@@ -2,123 +2,58 @@ |
|
|
|
<html> |
|
|
|
<head lang="en"> |
|
|
|
<meta charset="UTF-8"> |
|
|
|
<title></title> |
|
|
|
|
|
|
|
<script src="../ga.js"></script> |
|
|
|
<script src="../../webcomponentsjs/webcomponents-lite.js"></script> |
|
|
|
<script src="../../lodash/lodash.js"></script> |
|
|
|
<link rel="import" href="../../polymer/polymer.html"> |
|
|
|
<link rel="import" href="../../hydrolysis/hydrolysis-analyzer.html"> |
|
|
|
<link rel="import" href="../../iron-doc-viewer/iron-doc-viewer.html"> |
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"> |
|
|
|
<title>vaadin-elements</title> |
|
|
|
<style> |
|
|
|
body { |
|
|
|
font-family: 'Roboto', 'Noto', sans-serif; |
|
|
|
font-size: 16px; |
|
|
|
background: #fafafa; |
|
|
|
color: #212121; |
|
|
|
} |
|
|
|
section { |
|
|
|
width: 50%; |
|
|
|
margin: 50px auto; |
|
|
|
background: #fff; |
|
|
|
border: 1px solid #e5e5e5; |
|
|
|
} |
|
|
|
@media (max-width: 700px) { |
|
|
|
section { |
|
|
|
width: 100%; |
|
|
|
} |
|
|
|
} |
|
|
|
h1 { |
|
|
|
font-size: 150%; |
|
|
|
font-weight: 400; |
|
|
|
} |
|
|
|
ul { |
|
|
|
padding-left: 0; |
|
|
|
list-style: none; |
|
|
|
border-bottom: 1px solid #e5e5e5; |
|
|
|
} |
|
|
|
li { |
|
|
|
line-height: 1.4; |
|
|
|
border-top: 1px solid #e5e5e5; |
|
|
|
} |
|
|
|
li p { |
|
|
|
margin: 0; |
|
|
|
} |
|
|
|
h1, |
|
|
|
li { |
|
|
|
padding: 14px 24px; |
|
|
|
} |
|
|
|
</style> |
|
|
|
</head> |
|
|
|
<body> |
|
|
|
<div id="container" style="display:none"> |
|
|
|
<div id="viewer" style="width: 60%;left: 20%; position: absolute;"> |
|
|
|
<iron-doc-viewer></iron-doc-viewer> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<script> |
|
|
|
window.addEventListener("WebComponentsReady", function() { |
|
|
|
var hyd = require('hydrolysis'); |
|
|
|
|
|
|
|
function hidePrivateToggle() { |
|
|
|
document.querySelector('#togglePrivate').setAttribute('style', 'display:none'); |
|
|
|
} |
|
|
|
|
|
|
|
function hideCollapsedToggle() { |
|
|
|
var collapsed = document.querySelector('#toggleCollapsed'); |
|
|
|
if(collapsed) { |
|
|
|
collapsed.setAttribute('style', 'display:none'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function getElementTag() { |
|
|
|
var elementTag = window.location.search.replace('?', ''); |
|
|
|
if(elementTag === '') { |
|
|
|
elementTag = 'vaadin-grid'; |
|
|
|
} |
|
|
|
|
|
|
|
return elementTag; |
|
|
|
} |
|
|
|
|
|
|
|
function getPropertyType(type) { |
|
|
|
return type.textContent.replace('Array.<', '').replace('>', ''); |
|
|
|
} |
|
|
|
|
|
|
|
function createLinkElement(type) { |
|
|
|
var a = document.createElement('a'); |
|
|
|
a.textContent = type.textContent; |
|
|
|
a.setAttribute('href', '?' + getPropertyType(type)); |
|
|
|
|
|
|
|
return a; |
|
|
|
} |
|
|
|
|
|
|
|
function addLinkElementsForDocumentedTypes(result) { |
|
|
|
var types = document.querySelectorAll('.type'); |
|
|
|
|
|
|
|
for(var i=0;i < types.length; i++) { |
|
|
|
var type = getPropertyType(types[i]); |
|
|
|
|
|
|
|
if(result.elementsByTagName[type] || result.behaviorsByName[type]) { |
|
|
|
var a = createLinkElement(types[i]); |
|
|
|
|
|
|
|
types[i].textContent = ''; |
|
|
|
types[i].appendChild(a); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
function hidePropertySetterMethods() { |
|
|
|
var propertyNames = _.map(document.querySelector('#properties').querySelectorAll('.name'), function(p) { |
|
|
|
return p.textContent; |
|
|
|
}); |
|
|
|
|
|
|
|
var methods = document.querySelector('#methods').querySelectorAll('iron-doc-property'); |
|
|
|
|
|
|
|
_.forEach(methods, function(m) { |
|
|
|
if(_.contains(propertyNames, m.querySelector('.name').textContent)) { |
|
|
|
m.setAttribute('style', 'display:none'); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
function hideDefaultValuesForNonPrimitiveTypes(result) { |
|
|
|
function isPrimitiveType(t) { |
|
|
|
return /^([Nn]umber|[Bb]oolean|[Ss]tring).*/.test(t); |
|
|
|
} |
|
|
|
|
|
|
|
_.forEach(document.querySelector('#properties').querySelectorAll('iron-doc-property'), function(p) { |
|
|
|
if(!isPrimitiveType(p.querySelector('#type').textContent)) { |
|
|
|
p.querySelector('.annotation').setAttribute('style', 'display:none'); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
function showDocViewer() { |
|
|
|
document.querySelector('#container').setAttribute('style', 'display:block'); |
|
|
|
} |
|
|
|
|
|
|
|
//*** Main script starts here. ***// |
|
|
|
|
|
|
|
hidePrivateToggle(); |
|
|
|
hideCollapsedToggle(); |
|
|
|
|
|
|
|
hyd.Analyzer.analyze('../../vaadin-grid/vaadin-grid-doc.html') |
|
|
|
.then(function(result) { |
|
|
|
var descriptor = result.elementsByTagName[getElementTag()] || result.behaviorsByName[getElementTag()]; |
|
|
|
document.querySelector('iron-doc-viewer').descriptor = descriptor; |
|
|
|
|
|
|
|
return result; |
|
|
|
}) |
|
|
|
.then(hideDefaultValuesForNonPrimitiveTypes) |
|
|
|
.then(addLinkElementsForDocumentedTypes) |
|
|
|
.then(hidePropertySetterMethods) |
|
|
|
.then(showDocViewer); |
|
|
|
}); |
|
|
|
</script> |
|
|
|
<body> |
|
|
|
<section> |
|
|
|
<h1>API documentation for vaadin-elements</h1> |
|
|
|
<ul> |
|
|
|
<li> |
|
|
|
<a id="vaadin-grid" href="../../vaadin-grid/index.html">vaadin-grid</a> |
|
|
|
<p>Data grid for showing large amounts of tabular data.</p> |
|
|
|
</li> |
|
|
|
</ul> |
|
|
|
</section> |
|
|
|
</body> |
|
|
|
</html> |