init research
This commit is contained in:
File diff suppressed because one or more lines are too long
+513
File diff suppressed because one or more lines are too long
+527
@@ -0,0 +1,527 @@
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
:root {
|
||||
--background: #fff;
|
||||
--background-odd: #f5f5f5;
|
||||
--background-hover: #d9edfd;
|
||||
--header-text-color: #474747;
|
||||
--text-color: #848484;
|
||||
--text-color-dark: #000;
|
||||
--text-color-medium: #737373;
|
||||
--text-color-pale: #b3b3b3;
|
||||
--inner-border-color: #aaa;
|
||||
--bold-border-color: #000;
|
||||
--link-color: #296eaa;
|
||||
--link-color-pale: #296eaa;
|
||||
--link-hover: #1a466c;
|
||||
}
|
||||
|
||||
:root[theme="dark"], :root [data-jp-theme-light="false"], .dataframe_dark{
|
||||
--background: #303030;
|
||||
--background-odd: #3c3c3c;
|
||||
--background-hover: #464646;
|
||||
--header-text-color: #dddddd;
|
||||
--text-color: #b3b3b3;
|
||||
--text-color-dark: #dddddd;
|
||||
--text-color-medium: #b2b2b2;
|
||||
--text-color-pale: #737373;
|
||||
--inner-border-color: #707070;
|
||||
--bold-border-color: #777777;
|
||||
--link-color: #008dc0;
|
||||
--link-color-pale: #97e1fb;
|
||||
--link-hover: #00688e;
|
||||
}
|
||||
|
||||
p.dataframe_description {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: var(--background);
|
||||
color: var(--text-color-dark);
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.dataframe th, td {
|
||||
padding: 6px;
|
||||
border: 1px solid transparent;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.dataframe th {
|
||||
background-color: var(--background);
|
||||
color: var(--header-text-color);
|
||||
}
|
||||
|
||||
table.dataframe td {
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.dataframe th.bottomBorder {
|
||||
border-bottom-color: var(--bold-border-color);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(odd) {
|
||||
background: var(--background-odd);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(even) {
|
||||
background: var(--background);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:hover {
|
||||
background: var(--background-hover);
|
||||
}
|
||||
|
||||
table.dataframe a {
|
||||
cursor: pointer;
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.dataframe tr:hover > td a {
|
||||
color: var(--link-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe a:hover {
|
||||
color: var(--link-hover);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
table.dataframe img {
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
table.dataframe th.complex {
|
||||
background-color: var(--background);
|
||||
border: 1px solid var(--background);
|
||||
}
|
||||
|
||||
table.dataframe .leftBorder {
|
||||
border-left-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightBorder {
|
||||
border-right-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightAlign {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table.dataframe .expanderSvg {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
table.dataframe .expander {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* formatting */
|
||||
|
||||
table.dataframe .null {
|
||||
color: var(--text-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe .structural {
|
||||
color: var(--text-color-medium);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .dataFrameCaption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .numbers {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe td:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe tr:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
font-family: "JetBrains Mono",SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
|
||||
}
|
||||
|
||||
:root {
|
||||
color: #19191C;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
:root[theme="dark"] {
|
||||
background-color: #19191C;
|
||||
color: #FFFFFFCC
|
||||
}
|
||||
|
||||
details details {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
summary {
|
||||
padding: 6px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="dataframe" id="df_0"></table>
|
||||
|
||||
<p class="dataframe_description"></p>
|
||||
</body>
|
||||
<script>
|
||||
(function () {
|
||||
window.DataFrame = window.DataFrame || new (function () {
|
||||
this.addTable = function (df) {
|
||||
let cols = df.cols;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
for (let c of cols[i].children) {
|
||||
cols[c].parent = i;
|
||||
}
|
||||
}
|
||||
df.nrow = 0
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
if (df.cols[i].values.length > df.nrow) df.nrow = df.cols[i].values.length
|
||||
}
|
||||
if (df.id === df.rootId) {
|
||||
df.expandedFrames = new Set()
|
||||
df.childFrames = {}
|
||||
const table = this.getTableElement(df.id)
|
||||
table.df = df
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
let col = df.cols[i]
|
||||
if (col.parent === undefined && col.children.length > 0) col.expanded = true
|
||||
}
|
||||
} else {
|
||||
const rootDf = this.getTableData(df.rootId)
|
||||
rootDf.childFrames[df.id] = df
|
||||
}
|
||||
}
|
||||
|
||||
this.computeRenderData = function (df) {
|
||||
let result = []
|
||||
let pos = 0
|
||||
for (let col = 0; col < df.cols.length; col++) {
|
||||
if (df.cols[col].parent === undefined)
|
||||
pos += this.computeRenderDataRec(df.cols, col, pos, 0, result, false, false)
|
||||
}
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let row = result[i]
|
||||
for (let j = 0; j < row.length; j++) {
|
||||
let cell = row[j]
|
||||
if (j === 0)
|
||||
cell.leftBd = false
|
||||
if (j < row.length - 1) {
|
||||
let nextData = row[j + 1]
|
||||
if (nextData.leftBd) cell.rightBd = true
|
||||
else if (cell.rightBd) nextData.leftBd = true
|
||||
} else cell.rightBd = false
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
this.computeRenderDataRec = function (cols, colId, pos, depth, result, leftBorder, rightBorder) {
|
||||
if (result.length === depth) {
|
||||
const array = [];
|
||||
if (pos > 0) {
|
||||
let j = 0
|
||||
for (let i = 0; j < pos; i++) {
|
||||
let c = result[depth - 1][i]
|
||||
j += c.span
|
||||
let copy = Object.assign({empty: true}, c)
|
||||
array.push(copy)
|
||||
}
|
||||
}
|
||||
result.push(array)
|
||||
}
|
||||
const col = cols[colId];
|
||||
let size = 0;
|
||||
if (col.expanded) {
|
||||
let childPos = pos
|
||||
for (let i = 0; i < col.children.length; i++) {
|
||||
let child = col.children[i]
|
||||
let childLeft = i === 0 && (col.children.length > 1 || leftBorder)
|
||||
let childRight = i === col.children.length - 1 && (col.children.length > 1 || rightBorder)
|
||||
let childSize = this.computeRenderDataRec(cols, child, childPos, depth + 1, result, childLeft, childRight)
|
||||
childPos += childSize
|
||||
size += childSize
|
||||
}
|
||||
} else {
|
||||
for (let i = depth + 1; i < result.length; i++)
|
||||
result[i].push({id: colId, span: 1, leftBd: leftBorder, rightBd: rightBorder, empty: true})
|
||||
size = 1
|
||||
}
|
||||
let left = leftBorder
|
||||
let right = rightBorder
|
||||
if (size > 1) {
|
||||
left = true
|
||||
right = true
|
||||
}
|
||||
result[depth].push({id: colId, span: size, leftBd: left, rightBd: right})
|
||||
return size
|
||||
}
|
||||
|
||||
this.getTableElement = function (id) {
|
||||
return document.getElementById("df_" + id)
|
||||
}
|
||||
|
||||
this.getTableData = function (id) {
|
||||
return this.getTableElement(id).df
|
||||
}
|
||||
|
||||
this.createExpander = function (isExpanded) {
|
||||
const svgNs = "http://www.w3.org/2000/svg"
|
||||
let svg = document.createElementNS(svgNs, "svg")
|
||||
svg.classList.add("expanderSvg")
|
||||
let path = document.createElementNS(svgNs, "path")
|
||||
if (isExpanded) {
|
||||
svg.setAttribute("viewBox", "0 -2 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 4 4 4 -4 -1 -1 -3 3Z")
|
||||
} else {
|
||||
svg.setAttribute("viewBox", "-2 0 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 3 3 -3 3 1 1 4 -4Z")
|
||||
}
|
||||
path.setAttribute("fill", "currentColor")
|
||||
svg.appendChild(path)
|
||||
return svg
|
||||
}
|
||||
|
||||
this.renderTable = function (id) {
|
||||
|
||||
let table = this.getTableElement(id)
|
||||
|
||||
if (table === null) return
|
||||
|
||||
table.innerHTML = ""
|
||||
|
||||
let df = table.df
|
||||
let rootDf = df.rootId === df.id ? df : this.getTableData(df.rootId)
|
||||
|
||||
// header
|
||||
let header = document.createElement("thead")
|
||||
table.appendChild(header)
|
||||
|
||||
let renderData = this.computeRenderData(df)
|
||||
for (let j = 0; j < renderData.length; j++) {
|
||||
let rowData = renderData[j]
|
||||
let tr = document.createElement("tr");
|
||||
let isLastRow = j === renderData.length - 1
|
||||
header.appendChild(tr);
|
||||
for (let i = 0; i < rowData.length; i++) {
|
||||
let cell = rowData[i]
|
||||
let th = document.createElement("th");
|
||||
th.setAttribute("colspan", cell.span)
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId];
|
||||
if (!cell.empty) {
|
||||
if (col.children.length === 0) {
|
||||
th.innerHTML = col.name
|
||||
} else {
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
col.expanded = !col.expanded
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(col.expanded))
|
||||
link.innerHTML += col.name
|
||||
th.appendChild(link)
|
||||
}
|
||||
}
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (isLastRow)
|
||||
classes += " bottomBorder"
|
||||
if (classes.length > 0)
|
||||
th.setAttribute("class", classes)
|
||||
tr.appendChild(th)
|
||||
}
|
||||
}
|
||||
|
||||
// body
|
||||
let body = document.createElement("tbody")
|
||||
table.appendChild(body)
|
||||
|
||||
let columns = renderData.pop()
|
||||
for (let row = 0; row < df.nrow; row++) {
|
||||
let tr = document.createElement("tr");
|
||||
body.appendChild(tr)
|
||||
for (let i = 0; i < columns.length; i++) {
|
||||
let cell = columns[i]
|
||||
let td = document.createElement("td");
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId]
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (classes.length > 0)
|
||||
td.setAttribute("class", classes)
|
||||
tr.appendChild(td)
|
||||
let value = col.values[row]
|
||||
if (value.frameId !== undefined) {
|
||||
let frameId = value.frameId
|
||||
let expanded = rootDf.expandedFrames.has(frameId)
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
if (rootDf.expandedFrames.has(frameId))
|
||||
rootDf.expandedFrames.delete(frameId)
|
||||
else rootDf.expandedFrames.add(frameId)
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(expanded))
|
||||
link.innerHTML += value.value
|
||||
if (expanded) {
|
||||
td.appendChild(link)
|
||||
td.appendChild(document.createElement("p"))
|
||||
const childTable = document.createElement("table")
|
||||
childTable.className = "dataframe"
|
||||
childTable.id = "df_" + frameId
|
||||
let childDf = rootDf.childFrames[frameId]
|
||||
childTable.df = childDf
|
||||
td.appendChild(childTable)
|
||||
this.renderTable(frameId)
|
||||
if (childDf.nrow !== childDf.totalRows) {
|
||||
const footer = document.createElement("p")
|
||||
footer.innerText = `... showing only top ${childDf.nrow} of ${childDf.totalRows} rows`
|
||||
td.appendChild(footer)
|
||||
}
|
||||
} else {
|
||||
td.appendChild(link)
|
||||
}
|
||||
} else if (value.style !== undefined) {
|
||||
td.innerHTML = value.value
|
||||
td.setAttribute("style", value.style)
|
||||
} else td.innerHTML = value
|
||||
this.nodeScriptReplace(td)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.nodeScriptReplace = function (node) {
|
||||
if (this.nodeScriptIs(node) === true) {
|
||||
node.parentNode.replaceChild(this.nodeScriptClone(node), node);
|
||||
} else {
|
||||
let i = -1, children = node.childNodes;
|
||||
while (++i < children.length) {
|
||||
this.nodeScriptReplace(children[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
this.nodeScriptClone = function (node) {
|
||||
let script = document.createElement("script");
|
||||
script.text = node.innerHTML;
|
||||
|
||||
let i = -1, attrs = node.attributes, attr;
|
||||
while (++i < attrs.length) {
|
||||
script.setAttribute((attr = attrs[i]).name, attr.value);
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
this.nodeScriptIs = function (node) {
|
||||
return node.tagName === 'SCRIPT';
|
||||
}
|
||||
})()
|
||||
|
||||
window.call_DataFrame = function (f) {
|
||||
return f();
|
||||
};
|
||||
|
||||
let funQueue = window["kotlinQueues"] && window["kotlinQueues"]["DataFrame"];
|
||||
if (funQueue) {
|
||||
funQueue.forEach(function (f) {
|
||||
f();
|
||||
});
|
||||
funQueue = [];
|
||||
}
|
||||
})()
|
||||
|
||||
/*<!--*/
|
||||
call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: "<span title=\"isIntellij: Boolean\">isIntellij</span>", children: [], rightAlign: false, values: ["true","false"] },
|
||||
{ name: "<span title=\"group: DataFrame<*>\">group</span>", children: [], rightAlign: false, values: [{ frameId: 1, value: "<b>DataFrame 7 x 4</b>" },{ frameId: 2, value: "<b>DataFrame 17 x 4</b>" }] },
|
||||
], id: 0, rootId: 0, totalRows: 2 } ) });
|
||||
/*-->*/
|
||||
|
||||
/*<!--*/
|
||||
call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: "<span title=\"name: String\">name</span>", children: [], rightAlign: false, values: ["ideavim","intellij-community","intellij-scala","intellij-plugins","idea-gitignore"] },
|
||||
{ name: "<span title=\"starsCount: Int\">starsCount</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">6120</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">12926</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1066</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1737</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1181</span></span>"] },
|
||||
{ name: "<span title=\"topics: List<String>\">topics</span>", children: [], rightAlign: false, values: ["<span class=\"formatted\" title=\"ideavim\nintellij\nintellij-platform\njb-official\nkotlin\nvim\nvim-emulator\"><span class=\"structural\">[</span>ideavim<span class=\"structural\">, </span>intellij<span class=\"structural\">, </span>intellij-pl<span class=\"structural\">...</span><span class=\"structural\">, </span><span class=\"structural\">...</span><span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"code-editor\nide\nintellij\nintellij-community\nintellij-platform\"><span class=\"structural\">[</span>code-editor<span class=\"structural\">, </span>ide<span class=\"structural\">, </span>intellij<span class=\"structural\">, </span>i<span class=\"structural\">...</span><span class=\"structural\">, </span>i<span class=\"structural\">...</span><span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"intellij-idea\nintellij-plugin\nscala\"><span class=\"structural\">[</span>intellij-idea<span class=\"structural\">, </span>intellij-plugin<span class=\"structural\">, </span>scala<span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"\"><span class=\"structural\">[</span><span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"gitignore\nignore-files\nintellij\nintellij-plugin\njava\"><span class=\"structural\">[</span>gitignore<span class=\"structural\">, </span>ignore-files<span class=\"structural\">, </span>intellij<span class=\"structural\">, </span><span class=\"structural\">...</span><span class=\"structural\">]</span></span>"] },
|
||||
{ name: "<span title=\"isIntellij: Boolean\">isIntellij</span>", children: [], rightAlign: false, values: ["true","true","true","true","true"] },
|
||||
], id: 1, rootId: 0, totalRows: 7 } ) });
|
||||
/*-->*/
|
||||
|
||||
/*<!--*/
|
||||
call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: "<span title=\"name: String\">name</span>", children: [], rightAlign: false, values: ["MPS","kotlin","Exposed","kotlin-web-site","swot"] },
|
||||
{ name: "<span title=\"starsCount: Int\">starsCount</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">1241</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">39402</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">5688</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1074</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1072</span></span>"] },
|
||||
{ name: "<span title=\"topics: List<String>\">topics</span>", children: [], rightAlign: false, values: ["<span class=\"formatted\" title=\"domain-specific-language\ndsl\"><span class=\"structural\">[</span>domain-specific-language<span class=\"structural\">, </span>dsl<span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"compiler\ngradle-plugin\nintellij-plugin\nkotlin\nkotlin-library\nmaven-plugin\nprogramming-language\"><span class=\"structural\">[</span>compiler<span class=\"structural\">, </span>gradle-plugin<span class=\"structural\">, </span>intel<span class=\"structural\">...</span><span class=\"structural\">, </span><span class=\"structural\">...</span><span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"dao\nkotlin\norm\nsql\"><span class=\"structural\">[</span>dao<span class=\"structural\">, </span>kotlin<span class=\"structural\">, </span>orm<span class=\"structural\">, </span>sql<span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"kotlin\"><span class=\"structural\">[</span>kotlin<span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"\"><span class=\"structural\">[</span><span class=\"structural\">]</span></span>"] },
|
||||
{ name: "<span title=\"isIntellij: Boolean\">isIntellij</span>", children: [], rightAlign: false, values: ["false","false","false","false","false"] },
|
||||
], id: 2, rootId: 0, totalRows: 17 } ) });
|
||||
/*-->*/
|
||||
|
||||
call_DataFrame(function() { DataFrame.renderTable(0) });
|
||||
|
||||
function sendHeight() {
|
||||
const table = document.querySelector('table.dataframe');
|
||||
if (!table) return;
|
||||
|
||||
let height = 0;
|
||||
|
||||
const thead = table.querySelector('thead');
|
||||
if (thead) height += thead.offsetHeight;
|
||||
|
||||
const rows = table.querySelectorAll(':scope > tbody > tr');
|
||||
rows.forEach(row => {
|
||||
height += row.offsetHeight;
|
||||
});
|
||||
|
||||
height += getVerticalMargins(table) + 10;
|
||||
|
||||
window.parent.postMessage({ type: 'iframeHeight', height: Math.ceil(height) }, '*');
|
||||
}
|
||||
|
||||
function getVerticalMargins(element) {
|
||||
const style = getComputedStyle(element);
|
||||
return parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
||||
}
|
||||
|
||||
function repeatHeightCalculation(maxRetries = 10, interval = 100) {
|
||||
let retries = 0;
|
||||
const intervalId = setInterval(() => {
|
||||
sendHeight();
|
||||
retries++;
|
||||
if (retries >= maxRetries) clearInterval(intervalId);
|
||||
}, interval);
|
||||
}
|
||||
|
||||
window.addEventListener('load', repeatHeightCalculation);
|
||||
|
||||
const observer = new MutationObserver(() => repeatHeightCalculation(5, 50));
|
||||
observer.observe(document.querySelector('.dataframe'), {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
characterData: true,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</html>
|
||||
+511
@@ -0,0 +1,511 @@
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
:root {
|
||||
--background: #fff;
|
||||
--background-odd: #f5f5f5;
|
||||
--background-hover: #d9edfd;
|
||||
--header-text-color: #474747;
|
||||
--text-color: #848484;
|
||||
--text-color-dark: #000;
|
||||
--text-color-medium: #737373;
|
||||
--text-color-pale: #b3b3b3;
|
||||
--inner-border-color: #aaa;
|
||||
--bold-border-color: #000;
|
||||
--link-color: #296eaa;
|
||||
--link-color-pale: #296eaa;
|
||||
--link-hover: #1a466c;
|
||||
}
|
||||
|
||||
:root[theme="dark"], :root [data-jp-theme-light="false"], .dataframe_dark{
|
||||
--background: #303030;
|
||||
--background-odd: #3c3c3c;
|
||||
--background-hover: #464646;
|
||||
--header-text-color: #dddddd;
|
||||
--text-color: #b3b3b3;
|
||||
--text-color-dark: #dddddd;
|
||||
--text-color-medium: #b2b2b2;
|
||||
--text-color-pale: #737373;
|
||||
--inner-border-color: #707070;
|
||||
--bold-border-color: #777777;
|
||||
--link-color: #008dc0;
|
||||
--link-color-pale: #97e1fb;
|
||||
--link-hover: #00688e;
|
||||
}
|
||||
|
||||
p.dataframe_description {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: var(--background);
|
||||
color: var(--text-color-dark);
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.dataframe th, td {
|
||||
padding: 6px;
|
||||
border: 1px solid transparent;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.dataframe th {
|
||||
background-color: var(--background);
|
||||
color: var(--header-text-color);
|
||||
}
|
||||
|
||||
table.dataframe td {
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.dataframe th.bottomBorder {
|
||||
border-bottom-color: var(--bold-border-color);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(odd) {
|
||||
background: var(--background-odd);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(even) {
|
||||
background: var(--background);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:hover {
|
||||
background: var(--background-hover);
|
||||
}
|
||||
|
||||
table.dataframe a {
|
||||
cursor: pointer;
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.dataframe tr:hover > td a {
|
||||
color: var(--link-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe a:hover {
|
||||
color: var(--link-hover);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
table.dataframe img {
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
table.dataframe th.complex {
|
||||
background-color: var(--background);
|
||||
border: 1px solid var(--background);
|
||||
}
|
||||
|
||||
table.dataframe .leftBorder {
|
||||
border-left-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightBorder {
|
||||
border-right-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightAlign {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table.dataframe .expanderSvg {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
table.dataframe .expander {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* formatting */
|
||||
|
||||
table.dataframe .null {
|
||||
color: var(--text-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe .structural {
|
||||
color: var(--text-color-medium);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .dataFrameCaption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .numbers {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe td:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe tr:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
font-family: "JetBrains Mono",SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
|
||||
}
|
||||
|
||||
:root {
|
||||
color: #19191C;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
:root[theme="dark"] {
|
||||
background-color: #19191C;
|
||||
color: #FFFFFFCC
|
||||
}
|
||||
|
||||
details details {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
summary {
|
||||
padding: 6px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="dataframe" id="df_0"></table>
|
||||
|
||||
<p class="dataframe_description"></p>
|
||||
</body>
|
||||
<script>
|
||||
(function () {
|
||||
window.DataFrame = window.DataFrame || new (function () {
|
||||
this.addTable = function (df) {
|
||||
let cols = df.cols;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
for (let c of cols[i].children) {
|
||||
cols[c].parent = i;
|
||||
}
|
||||
}
|
||||
df.nrow = 0
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
if (df.cols[i].values.length > df.nrow) df.nrow = df.cols[i].values.length
|
||||
}
|
||||
if (df.id === df.rootId) {
|
||||
df.expandedFrames = new Set()
|
||||
df.childFrames = {}
|
||||
const table = this.getTableElement(df.id)
|
||||
table.df = df
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
let col = df.cols[i]
|
||||
if (col.parent === undefined && col.children.length > 0) col.expanded = true
|
||||
}
|
||||
} else {
|
||||
const rootDf = this.getTableData(df.rootId)
|
||||
rootDf.childFrames[df.id] = df
|
||||
}
|
||||
}
|
||||
|
||||
this.computeRenderData = function (df) {
|
||||
let result = []
|
||||
let pos = 0
|
||||
for (let col = 0; col < df.cols.length; col++) {
|
||||
if (df.cols[col].parent === undefined)
|
||||
pos += this.computeRenderDataRec(df.cols, col, pos, 0, result, false, false)
|
||||
}
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let row = result[i]
|
||||
for (let j = 0; j < row.length; j++) {
|
||||
let cell = row[j]
|
||||
if (j === 0)
|
||||
cell.leftBd = false
|
||||
if (j < row.length - 1) {
|
||||
let nextData = row[j + 1]
|
||||
if (nextData.leftBd) cell.rightBd = true
|
||||
else if (cell.rightBd) nextData.leftBd = true
|
||||
} else cell.rightBd = false
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
this.computeRenderDataRec = function (cols, colId, pos, depth, result, leftBorder, rightBorder) {
|
||||
if (result.length === depth) {
|
||||
const array = [];
|
||||
if (pos > 0) {
|
||||
let j = 0
|
||||
for (let i = 0; j < pos; i++) {
|
||||
let c = result[depth - 1][i]
|
||||
j += c.span
|
||||
let copy = Object.assign({empty: true}, c)
|
||||
array.push(copy)
|
||||
}
|
||||
}
|
||||
result.push(array)
|
||||
}
|
||||
const col = cols[colId];
|
||||
let size = 0;
|
||||
if (col.expanded) {
|
||||
let childPos = pos
|
||||
for (let i = 0; i < col.children.length; i++) {
|
||||
let child = col.children[i]
|
||||
let childLeft = i === 0 && (col.children.length > 1 || leftBorder)
|
||||
let childRight = i === col.children.length - 1 && (col.children.length > 1 || rightBorder)
|
||||
let childSize = this.computeRenderDataRec(cols, child, childPos, depth + 1, result, childLeft, childRight)
|
||||
childPos += childSize
|
||||
size += childSize
|
||||
}
|
||||
} else {
|
||||
for (let i = depth + 1; i < result.length; i++)
|
||||
result[i].push({id: colId, span: 1, leftBd: leftBorder, rightBd: rightBorder, empty: true})
|
||||
size = 1
|
||||
}
|
||||
let left = leftBorder
|
||||
let right = rightBorder
|
||||
if (size > 1) {
|
||||
left = true
|
||||
right = true
|
||||
}
|
||||
result[depth].push({id: colId, span: size, leftBd: left, rightBd: right})
|
||||
return size
|
||||
}
|
||||
|
||||
this.getTableElement = function (id) {
|
||||
return document.getElementById("df_" + id)
|
||||
}
|
||||
|
||||
this.getTableData = function (id) {
|
||||
return this.getTableElement(id).df
|
||||
}
|
||||
|
||||
this.createExpander = function (isExpanded) {
|
||||
const svgNs = "http://www.w3.org/2000/svg"
|
||||
let svg = document.createElementNS(svgNs, "svg")
|
||||
svg.classList.add("expanderSvg")
|
||||
let path = document.createElementNS(svgNs, "path")
|
||||
if (isExpanded) {
|
||||
svg.setAttribute("viewBox", "0 -2 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 4 4 4 -4 -1 -1 -3 3Z")
|
||||
} else {
|
||||
svg.setAttribute("viewBox", "-2 0 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 3 3 -3 3 1 1 4 -4Z")
|
||||
}
|
||||
path.setAttribute("fill", "currentColor")
|
||||
svg.appendChild(path)
|
||||
return svg
|
||||
}
|
||||
|
||||
this.renderTable = function (id) {
|
||||
|
||||
let table = this.getTableElement(id)
|
||||
|
||||
if (table === null) return
|
||||
|
||||
table.innerHTML = ""
|
||||
|
||||
let df = table.df
|
||||
let rootDf = df.rootId === df.id ? df : this.getTableData(df.rootId)
|
||||
|
||||
// header
|
||||
let header = document.createElement("thead")
|
||||
table.appendChild(header)
|
||||
|
||||
let renderData = this.computeRenderData(df)
|
||||
for (let j = 0; j < renderData.length; j++) {
|
||||
let rowData = renderData[j]
|
||||
let tr = document.createElement("tr");
|
||||
let isLastRow = j === renderData.length - 1
|
||||
header.appendChild(tr);
|
||||
for (let i = 0; i < rowData.length; i++) {
|
||||
let cell = rowData[i]
|
||||
let th = document.createElement("th");
|
||||
th.setAttribute("colspan", cell.span)
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId];
|
||||
if (!cell.empty) {
|
||||
if (col.children.length === 0) {
|
||||
th.innerHTML = col.name
|
||||
} else {
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
col.expanded = !col.expanded
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(col.expanded))
|
||||
link.innerHTML += col.name
|
||||
th.appendChild(link)
|
||||
}
|
||||
}
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (isLastRow)
|
||||
classes += " bottomBorder"
|
||||
if (classes.length > 0)
|
||||
th.setAttribute("class", classes)
|
||||
tr.appendChild(th)
|
||||
}
|
||||
}
|
||||
|
||||
// body
|
||||
let body = document.createElement("tbody")
|
||||
table.appendChild(body)
|
||||
|
||||
let columns = renderData.pop()
|
||||
for (let row = 0; row < df.nrow; row++) {
|
||||
let tr = document.createElement("tr");
|
||||
body.appendChild(tr)
|
||||
for (let i = 0; i < columns.length; i++) {
|
||||
let cell = columns[i]
|
||||
let td = document.createElement("td");
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId]
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (classes.length > 0)
|
||||
td.setAttribute("class", classes)
|
||||
tr.appendChild(td)
|
||||
let value = col.values[row]
|
||||
if (value.frameId !== undefined) {
|
||||
let frameId = value.frameId
|
||||
let expanded = rootDf.expandedFrames.has(frameId)
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
if (rootDf.expandedFrames.has(frameId))
|
||||
rootDf.expandedFrames.delete(frameId)
|
||||
else rootDf.expandedFrames.add(frameId)
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(expanded))
|
||||
link.innerHTML += value.value
|
||||
if (expanded) {
|
||||
td.appendChild(link)
|
||||
td.appendChild(document.createElement("p"))
|
||||
const childTable = document.createElement("table")
|
||||
childTable.className = "dataframe"
|
||||
childTable.id = "df_" + frameId
|
||||
let childDf = rootDf.childFrames[frameId]
|
||||
childTable.df = childDf
|
||||
td.appendChild(childTable)
|
||||
this.renderTable(frameId)
|
||||
if (childDf.nrow !== childDf.totalRows) {
|
||||
const footer = document.createElement("p")
|
||||
footer.innerText = `... showing only top ${childDf.nrow} of ${childDf.totalRows} rows`
|
||||
td.appendChild(footer)
|
||||
}
|
||||
} else {
|
||||
td.appendChild(link)
|
||||
}
|
||||
} else if (value.style !== undefined) {
|
||||
td.innerHTML = value.value
|
||||
td.setAttribute("style", value.style)
|
||||
} else td.innerHTML = value
|
||||
this.nodeScriptReplace(td)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.nodeScriptReplace = function (node) {
|
||||
if (this.nodeScriptIs(node) === true) {
|
||||
node.parentNode.replaceChild(this.nodeScriptClone(node), node);
|
||||
} else {
|
||||
let i = -1, children = node.childNodes;
|
||||
while (++i < children.length) {
|
||||
this.nodeScriptReplace(children[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
this.nodeScriptClone = function (node) {
|
||||
let script = document.createElement("script");
|
||||
script.text = node.innerHTML;
|
||||
|
||||
let i = -1, attrs = node.attributes, attr;
|
||||
while (++i < attrs.length) {
|
||||
script.setAttribute((attr = attrs[i]).name, attr.value);
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
this.nodeScriptIs = function (node) {
|
||||
return node.tagName === 'SCRIPT';
|
||||
}
|
||||
})()
|
||||
|
||||
window.call_DataFrame = function (f) {
|
||||
return f();
|
||||
};
|
||||
|
||||
let funQueue = window["kotlinQueues"] && window["kotlinQueues"]["DataFrame"];
|
||||
if (funQueue) {
|
||||
funQueue.forEach(function (f) {
|
||||
f();
|
||||
});
|
||||
funQueue = [];
|
||||
}
|
||||
})()
|
||||
|
||||
/*<!--*/
|
||||
call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: "<span title=\"isIntellij: Boolean\">isIntellij</span>", children: [], rightAlign: false, values: ["true","false"] },
|
||||
{ name: "<span title=\"count: Int\">count</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">7</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">17</span></span>"] },
|
||||
], id: 0, rootId: 0, totalRows: 2 } ) });
|
||||
/*-->*/
|
||||
|
||||
call_DataFrame(function() { DataFrame.renderTable(0) });
|
||||
|
||||
function sendHeight() {
|
||||
const table = document.querySelector('table.dataframe');
|
||||
if (!table) return;
|
||||
|
||||
let height = 0;
|
||||
|
||||
const thead = table.querySelector('thead');
|
||||
if (thead) height += thead.offsetHeight;
|
||||
|
||||
const rows = table.querySelectorAll(':scope > tbody > tr');
|
||||
rows.forEach(row => {
|
||||
height += row.offsetHeight;
|
||||
});
|
||||
|
||||
height += getVerticalMargins(table) + 10;
|
||||
|
||||
window.parent.postMessage({ type: 'iframeHeight', height: Math.ceil(height) }, '*');
|
||||
}
|
||||
|
||||
function getVerticalMargins(element) {
|
||||
const style = getComputedStyle(element);
|
||||
return parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
||||
}
|
||||
|
||||
function repeatHeightCalculation(maxRetries = 10, interval = 100) {
|
||||
let retries = 0;
|
||||
const intervalId = setInterval(() => {
|
||||
sendHeight();
|
||||
retries++;
|
||||
if (retries >= maxRetries) clearInterval(intervalId);
|
||||
}, interval);
|
||||
}
|
||||
|
||||
window.addEventListener('load', repeatHeightCalculation);
|
||||
|
||||
const observer = new MutationObserver(() => repeatHeightCalculation(5, 50));
|
||||
observer.observe(document.querySelector('.dataframe'), {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
characterData: true,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</html>
|
||||
+512
@@ -0,0 +1,512 @@
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
:root {
|
||||
--background: #fff;
|
||||
--background-odd: #f5f5f5;
|
||||
--background-hover: #d9edfd;
|
||||
--header-text-color: #474747;
|
||||
--text-color: #848484;
|
||||
--text-color-dark: #000;
|
||||
--text-color-medium: #737373;
|
||||
--text-color-pale: #b3b3b3;
|
||||
--inner-border-color: #aaa;
|
||||
--bold-border-color: #000;
|
||||
--link-color: #296eaa;
|
||||
--link-color-pale: #296eaa;
|
||||
--link-hover: #1a466c;
|
||||
}
|
||||
|
||||
:root[theme="dark"], :root [data-jp-theme-light="false"], .dataframe_dark{
|
||||
--background: #303030;
|
||||
--background-odd: #3c3c3c;
|
||||
--background-hover: #464646;
|
||||
--header-text-color: #dddddd;
|
||||
--text-color: #b3b3b3;
|
||||
--text-color-dark: #dddddd;
|
||||
--text-color-medium: #b2b2b2;
|
||||
--text-color-pale: #737373;
|
||||
--inner-border-color: #707070;
|
||||
--bold-border-color: #777777;
|
||||
--link-color: #008dc0;
|
||||
--link-color-pale: #97e1fb;
|
||||
--link-hover: #00688e;
|
||||
}
|
||||
|
||||
p.dataframe_description {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: var(--background);
|
||||
color: var(--text-color-dark);
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.dataframe th, td {
|
||||
padding: 6px;
|
||||
border: 1px solid transparent;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.dataframe th {
|
||||
background-color: var(--background);
|
||||
color: var(--header-text-color);
|
||||
}
|
||||
|
||||
table.dataframe td {
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.dataframe th.bottomBorder {
|
||||
border-bottom-color: var(--bold-border-color);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(odd) {
|
||||
background: var(--background-odd);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(even) {
|
||||
background: var(--background);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:hover {
|
||||
background: var(--background-hover);
|
||||
}
|
||||
|
||||
table.dataframe a {
|
||||
cursor: pointer;
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.dataframe tr:hover > td a {
|
||||
color: var(--link-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe a:hover {
|
||||
color: var(--link-hover);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
table.dataframe img {
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
table.dataframe th.complex {
|
||||
background-color: var(--background);
|
||||
border: 1px solid var(--background);
|
||||
}
|
||||
|
||||
table.dataframe .leftBorder {
|
||||
border-left-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightBorder {
|
||||
border-right-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightAlign {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table.dataframe .expanderSvg {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
table.dataframe .expander {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* formatting */
|
||||
|
||||
table.dataframe .null {
|
||||
color: var(--text-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe .structural {
|
||||
color: var(--text-color-medium);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .dataFrameCaption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .numbers {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe td:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe tr:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
font-family: "JetBrains Mono",SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
|
||||
}
|
||||
|
||||
:root {
|
||||
color: #19191C;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
:root[theme="dark"] {
|
||||
background-color: #19191C;
|
||||
color: #FFFFFFCC
|
||||
}
|
||||
|
||||
details details {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
summary {
|
||||
padding: 6px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="dataframe" id="df_0"></table>
|
||||
|
||||
<p class="dataframe_description"></p>
|
||||
</body>
|
||||
<script>
|
||||
(function () {
|
||||
window.DataFrame = window.DataFrame || new (function () {
|
||||
this.addTable = function (df) {
|
||||
let cols = df.cols;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
for (let c of cols[i].children) {
|
||||
cols[c].parent = i;
|
||||
}
|
||||
}
|
||||
df.nrow = 0
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
if (df.cols[i].values.length > df.nrow) df.nrow = df.cols[i].values.length
|
||||
}
|
||||
if (df.id === df.rootId) {
|
||||
df.expandedFrames = new Set()
|
||||
df.childFrames = {}
|
||||
const table = this.getTableElement(df.id)
|
||||
table.df = df
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
let col = df.cols[i]
|
||||
if (col.parent === undefined && col.children.length > 0) col.expanded = true
|
||||
}
|
||||
} else {
|
||||
const rootDf = this.getTableData(df.rootId)
|
||||
rootDf.childFrames[df.id] = df
|
||||
}
|
||||
}
|
||||
|
||||
this.computeRenderData = function (df) {
|
||||
let result = []
|
||||
let pos = 0
|
||||
for (let col = 0; col < df.cols.length; col++) {
|
||||
if (df.cols[col].parent === undefined)
|
||||
pos += this.computeRenderDataRec(df.cols, col, pos, 0, result, false, false)
|
||||
}
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let row = result[i]
|
||||
for (let j = 0; j < row.length; j++) {
|
||||
let cell = row[j]
|
||||
if (j === 0)
|
||||
cell.leftBd = false
|
||||
if (j < row.length - 1) {
|
||||
let nextData = row[j + 1]
|
||||
if (nextData.leftBd) cell.rightBd = true
|
||||
else if (cell.rightBd) nextData.leftBd = true
|
||||
} else cell.rightBd = false
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
this.computeRenderDataRec = function (cols, colId, pos, depth, result, leftBorder, rightBorder) {
|
||||
if (result.length === depth) {
|
||||
const array = [];
|
||||
if (pos > 0) {
|
||||
let j = 0
|
||||
for (let i = 0; j < pos; i++) {
|
||||
let c = result[depth - 1][i]
|
||||
j += c.span
|
||||
let copy = Object.assign({empty: true}, c)
|
||||
array.push(copy)
|
||||
}
|
||||
}
|
||||
result.push(array)
|
||||
}
|
||||
const col = cols[colId];
|
||||
let size = 0;
|
||||
if (col.expanded) {
|
||||
let childPos = pos
|
||||
for (let i = 0; i < col.children.length; i++) {
|
||||
let child = col.children[i]
|
||||
let childLeft = i === 0 && (col.children.length > 1 || leftBorder)
|
||||
let childRight = i === col.children.length - 1 && (col.children.length > 1 || rightBorder)
|
||||
let childSize = this.computeRenderDataRec(cols, child, childPos, depth + 1, result, childLeft, childRight)
|
||||
childPos += childSize
|
||||
size += childSize
|
||||
}
|
||||
} else {
|
||||
for (let i = depth + 1; i < result.length; i++)
|
||||
result[i].push({id: colId, span: 1, leftBd: leftBorder, rightBd: rightBorder, empty: true})
|
||||
size = 1
|
||||
}
|
||||
let left = leftBorder
|
||||
let right = rightBorder
|
||||
if (size > 1) {
|
||||
left = true
|
||||
right = true
|
||||
}
|
||||
result[depth].push({id: colId, span: size, leftBd: left, rightBd: right})
|
||||
return size
|
||||
}
|
||||
|
||||
this.getTableElement = function (id) {
|
||||
return document.getElementById("df_" + id)
|
||||
}
|
||||
|
||||
this.getTableData = function (id) {
|
||||
return this.getTableElement(id).df
|
||||
}
|
||||
|
||||
this.createExpander = function (isExpanded) {
|
||||
const svgNs = "http://www.w3.org/2000/svg"
|
||||
let svg = document.createElementNS(svgNs, "svg")
|
||||
svg.classList.add("expanderSvg")
|
||||
let path = document.createElementNS(svgNs, "path")
|
||||
if (isExpanded) {
|
||||
svg.setAttribute("viewBox", "0 -2 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 4 4 4 -4 -1 -1 -3 3Z")
|
||||
} else {
|
||||
svg.setAttribute("viewBox", "-2 0 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 3 3 -3 3 1 1 4 -4Z")
|
||||
}
|
||||
path.setAttribute("fill", "currentColor")
|
||||
svg.appendChild(path)
|
||||
return svg
|
||||
}
|
||||
|
||||
this.renderTable = function (id) {
|
||||
|
||||
let table = this.getTableElement(id)
|
||||
|
||||
if (table === null) return
|
||||
|
||||
table.innerHTML = ""
|
||||
|
||||
let df = table.df
|
||||
let rootDf = df.rootId === df.id ? df : this.getTableData(df.rootId)
|
||||
|
||||
// header
|
||||
let header = document.createElement("thead")
|
||||
table.appendChild(header)
|
||||
|
||||
let renderData = this.computeRenderData(df)
|
||||
for (let j = 0; j < renderData.length; j++) {
|
||||
let rowData = renderData[j]
|
||||
let tr = document.createElement("tr");
|
||||
let isLastRow = j === renderData.length - 1
|
||||
header.appendChild(tr);
|
||||
for (let i = 0; i < rowData.length; i++) {
|
||||
let cell = rowData[i]
|
||||
let th = document.createElement("th");
|
||||
th.setAttribute("colspan", cell.span)
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId];
|
||||
if (!cell.empty) {
|
||||
if (col.children.length === 0) {
|
||||
th.innerHTML = col.name
|
||||
} else {
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
col.expanded = !col.expanded
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(col.expanded))
|
||||
link.innerHTML += col.name
|
||||
th.appendChild(link)
|
||||
}
|
||||
}
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (isLastRow)
|
||||
classes += " bottomBorder"
|
||||
if (classes.length > 0)
|
||||
th.setAttribute("class", classes)
|
||||
tr.appendChild(th)
|
||||
}
|
||||
}
|
||||
|
||||
// body
|
||||
let body = document.createElement("tbody")
|
||||
table.appendChild(body)
|
||||
|
||||
let columns = renderData.pop()
|
||||
for (let row = 0; row < df.nrow; row++) {
|
||||
let tr = document.createElement("tr");
|
||||
body.appendChild(tr)
|
||||
for (let i = 0; i < columns.length; i++) {
|
||||
let cell = columns[i]
|
||||
let td = document.createElement("td");
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId]
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (classes.length > 0)
|
||||
td.setAttribute("class", classes)
|
||||
tr.appendChild(td)
|
||||
let value = col.values[row]
|
||||
if (value.frameId !== undefined) {
|
||||
let frameId = value.frameId
|
||||
let expanded = rootDf.expandedFrames.has(frameId)
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
if (rootDf.expandedFrames.has(frameId))
|
||||
rootDf.expandedFrames.delete(frameId)
|
||||
else rootDf.expandedFrames.add(frameId)
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(expanded))
|
||||
link.innerHTML += value.value
|
||||
if (expanded) {
|
||||
td.appendChild(link)
|
||||
td.appendChild(document.createElement("p"))
|
||||
const childTable = document.createElement("table")
|
||||
childTable.className = "dataframe"
|
||||
childTable.id = "df_" + frameId
|
||||
let childDf = rootDf.childFrames[frameId]
|
||||
childTable.df = childDf
|
||||
td.appendChild(childTable)
|
||||
this.renderTable(frameId)
|
||||
if (childDf.nrow !== childDf.totalRows) {
|
||||
const footer = document.createElement("p")
|
||||
footer.innerText = `... showing only top ${childDf.nrow} of ${childDf.totalRows} rows`
|
||||
td.appendChild(footer)
|
||||
}
|
||||
} else {
|
||||
td.appendChild(link)
|
||||
}
|
||||
} else if (value.style !== undefined) {
|
||||
td.innerHTML = value.value
|
||||
td.setAttribute("style", value.style)
|
||||
} else td.innerHTML = value
|
||||
this.nodeScriptReplace(td)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.nodeScriptReplace = function (node) {
|
||||
if (this.nodeScriptIs(node) === true) {
|
||||
node.parentNode.replaceChild(this.nodeScriptClone(node), node);
|
||||
} else {
|
||||
let i = -1, children = node.childNodes;
|
||||
while (++i < children.length) {
|
||||
this.nodeScriptReplace(children[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
this.nodeScriptClone = function (node) {
|
||||
let script = document.createElement("script");
|
||||
script.text = node.innerHTML;
|
||||
|
||||
let i = -1, attrs = node.attributes, attr;
|
||||
while (++i < attrs.length) {
|
||||
script.setAttribute((attr = attrs[i]).name, attr.value);
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
this.nodeScriptIs = function (node) {
|
||||
return node.tagName === 'SCRIPT';
|
||||
}
|
||||
})()
|
||||
|
||||
window.call_DataFrame = function (f) {
|
||||
return f();
|
||||
};
|
||||
|
||||
let funQueue = window["kotlinQueues"] && window["kotlinQueues"]["DataFrame"];
|
||||
if (funQueue) {
|
||||
funQueue.forEach(function (f) {
|
||||
f();
|
||||
});
|
||||
funQueue = [];
|
||||
}
|
||||
})()
|
||||
|
||||
/*<!--*/
|
||||
call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: "<span title=\"isIntellij: Boolean\">isIntellij</span>", children: [], rightAlign: false, values: ["true","false"] },
|
||||
{ name: "<span title=\"sumStars: Int\">sumStars</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">25221</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">85392</span></span>"] },
|
||||
{ name: "<span title=\"maxStars: Int\">maxStars</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">12926</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">39402</span></span>"] },
|
||||
], id: 0, rootId: 0, totalRows: 2 } ) });
|
||||
/*-->*/
|
||||
|
||||
call_DataFrame(function() { DataFrame.renderTable(0) });
|
||||
|
||||
function sendHeight() {
|
||||
const table = document.querySelector('table.dataframe');
|
||||
if (!table) return;
|
||||
|
||||
let height = 0;
|
||||
|
||||
const thead = table.querySelector('thead');
|
||||
if (thead) height += thead.offsetHeight;
|
||||
|
||||
const rows = table.querySelectorAll(':scope > tbody > tr');
|
||||
rows.forEach(row => {
|
||||
height += row.offsetHeight;
|
||||
});
|
||||
|
||||
height += getVerticalMargins(table) + 10;
|
||||
|
||||
window.parent.postMessage({ type: 'iframeHeight', height: Math.ceil(height) }, '*');
|
||||
}
|
||||
|
||||
function getVerticalMargins(element) {
|
||||
const style = getComputedStyle(element);
|
||||
return parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
||||
}
|
||||
|
||||
function repeatHeightCalculation(maxRetries = 10, interval = 100) {
|
||||
let retries = 0;
|
||||
const intervalId = setInterval(() => {
|
||||
sendHeight();
|
||||
retries++;
|
||||
if (retries >= maxRetries) clearInterval(intervalId);
|
||||
}, interval);
|
||||
}
|
||||
|
||||
window.addEventListener('load', repeatHeightCalculation);
|
||||
|
||||
const observer = new MutationObserver(() => repeatHeightCalculation(5, 50));
|
||||
observer.observe(document.querySelector('.dataframe'), {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
characterData: true,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</html>
|
||||
+513
@@ -0,0 +1,513 @@
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
:root {
|
||||
--background: #fff;
|
||||
--background-odd: #f5f5f5;
|
||||
--background-hover: #d9edfd;
|
||||
--header-text-color: #474747;
|
||||
--text-color: #848484;
|
||||
--text-color-dark: #000;
|
||||
--text-color-medium: #737373;
|
||||
--text-color-pale: #b3b3b3;
|
||||
--inner-border-color: #aaa;
|
||||
--bold-border-color: #000;
|
||||
--link-color: #296eaa;
|
||||
--link-color-pale: #296eaa;
|
||||
--link-hover: #1a466c;
|
||||
}
|
||||
|
||||
:root[theme="dark"], :root [data-jp-theme-light="false"], .dataframe_dark{
|
||||
--background: #303030;
|
||||
--background-odd: #3c3c3c;
|
||||
--background-hover: #464646;
|
||||
--header-text-color: #dddddd;
|
||||
--text-color: #b3b3b3;
|
||||
--text-color-dark: #dddddd;
|
||||
--text-color-medium: #b2b2b2;
|
||||
--text-color-pale: #737373;
|
||||
--inner-border-color: #707070;
|
||||
--bold-border-color: #777777;
|
||||
--link-color: #008dc0;
|
||||
--link-color-pale: #97e1fb;
|
||||
--link-hover: #00688e;
|
||||
}
|
||||
|
||||
p.dataframe_description {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: var(--background);
|
||||
color: var(--text-color-dark);
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.dataframe th, td {
|
||||
padding: 6px;
|
||||
border: 1px solid transparent;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.dataframe th {
|
||||
background-color: var(--background);
|
||||
color: var(--header-text-color);
|
||||
}
|
||||
|
||||
table.dataframe td {
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.dataframe th.bottomBorder {
|
||||
border-bottom-color: var(--bold-border-color);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(odd) {
|
||||
background: var(--background-odd);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(even) {
|
||||
background: var(--background);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:hover {
|
||||
background: var(--background-hover);
|
||||
}
|
||||
|
||||
table.dataframe a {
|
||||
cursor: pointer;
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.dataframe tr:hover > td a {
|
||||
color: var(--link-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe a:hover {
|
||||
color: var(--link-hover);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
table.dataframe img {
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
table.dataframe th.complex {
|
||||
background-color: var(--background);
|
||||
border: 1px solid var(--background);
|
||||
}
|
||||
|
||||
table.dataframe .leftBorder {
|
||||
border-left-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightBorder {
|
||||
border-right-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightAlign {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table.dataframe .expanderSvg {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
table.dataframe .expander {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* formatting */
|
||||
|
||||
table.dataframe .null {
|
||||
color: var(--text-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe .structural {
|
||||
color: var(--text-color-medium);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .dataFrameCaption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .numbers {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe td:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe tr:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
font-family: "JetBrains Mono",SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
|
||||
}
|
||||
|
||||
:root {
|
||||
color: #19191C;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
:root[theme="dark"] {
|
||||
background-color: #19191C;
|
||||
color: #FFFFFFCC
|
||||
}
|
||||
|
||||
details details {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
summary {
|
||||
padding: 6px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="dataframe" id="df_0"></table>
|
||||
|
||||
<p class="dataframe_description"></p>
|
||||
</body>
|
||||
<script>
|
||||
(function () {
|
||||
window.DataFrame = window.DataFrame || new (function () {
|
||||
this.addTable = function (df) {
|
||||
let cols = df.cols;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
for (let c of cols[i].children) {
|
||||
cols[c].parent = i;
|
||||
}
|
||||
}
|
||||
df.nrow = 0
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
if (df.cols[i].values.length > df.nrow) df.nrow = df.cols[i].values.length
|
||||
}
|
||||
if (df.id === df.rootId) {
|
||||
df.expandedFrames = new Set()
|
||||
df.childFrames = {}
|
||||
const table = this.getTableElement(df.id)
|
||||
table.df = df
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
let col = df.cols[i]
|
||||
if (col.parent === undefined && col.children.length > 0) col.expanded = true
|
||||
}
|
||||
} else {
|
||||
const rootDf = this.getTableData(df.rootId)
|
||||
rootDf.childFrames[df.id] = df
|
||||
}
|
||||
}
|
||||
|
||||
this.computeRenderData = function (df) {
|
||||
let result = []
|
||||
let pos = 0
|
||||
for (let col = 0; col < df.cols.length; col++) {
|
||||
if (df.cols[col].parent === undefined)
|
||||
pos += this.computeRenderDataRec(df.cols, col, pos, 0, result, false, false)
|
||||
}
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let row = result[i]
|
||||
for (let j = 0; j < row.length; j++) {
|
||||
let cell = row[j]
|
||||
if (j === 0)
|
||||
cell.leftBd = false
|
||||
if (j < row.length - 1) {
|
||||
let nextData = row[j + 1]
|
||||
if (nextData.leftBd) cell.rightBd = true
|
||||
else if (cell.rightBd) nextData.leftBd = true
|
||||
} else cell.rightBd = false
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
this.computeRenderDataRec = function (cols, colId, pos, depth, result, leftBorder, rightBorder) {
|
||||
if (result.length === depth) {
|
||||
const array = [];
|
||||
if (pos > 0) {
|
||||
let j = 0
|
||||
for (let i = 0; j < pos; i++) {
|
||||
let c = result[depth - 1][i]
|
||||
j += c.span
|
||||
let copy = Object.assign({empty: true}, c)
|
||||
array.push(copy)
|
||||
}
|
||||
}
|
||||
result.push(array)
|
||||
}
|
||||
const col = cols[colId];
|
||||
let size = 0;
|
||||
if (col.expanded) {
|
||||
let childPos = pos
|
||||
for (let i = 0; i < col.children.length; i++) {
|
||||
let child = col.children[i]
|
||||
let childLeft = i === 0 && (col.children.length > 1 || leftBorder)
|
||||
let childRight = i === col.children.length - 1 && (col.children.length > 1 || rightBorder)
|
||||
let childSize = this.computeRenderDataRec(cols, child, childPos, depth + 1, result, childLeft, childRight)
|
||||
childPos += childSize
|
||||
size += childSize
|
||||
}
|
||||
} else {
|
||||
for (let i = depth + 1; i < result.length; i++)
|
||||
result[i].push({id: colId, span: 1, leftBd: leftBorder, rightBd: rightBorder, empty: true})
|
||||
size = 1
|
||||
}
|
||||
let left = leftBorder
|
||||
let right = rightBorder
|
||||
if (size > 1) {
|
||||
left = true
|
||||
right = true
|
||||
}
|
||||
result[depth].push({id: colId, span: size, leftBd: left, rightBd: right})
|
||||
return size
|
||||
}
|
||||
|
||||
this.getTableElement = function (id) {
|
||||
return document.getElementById("df_" + id)
|
||||
}
|
||||
|
||||
this.getTableData = function (id) {
|
||||
return this.getTableElement(id).df
|
||||
}
|
||||
|
||||
this.createExpander = function (isExpanded) {
|
||||
const svgNs = "http://www.w3.org/2000/svg"
|
||||
let svg = document.createElementNS(svgNs, "svg")
|
||||
svg.classList.add("expanderSvg")
|
||||
let path = document.createElementNS(svgNs, "path")
|
||||
if (isExpanded) {
|
||||
svg.setAttribute("viewBox", "0 -2 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 4 4 4 -4 -1 -1 -3 3Z")
|
||||
} else {
|
||||
svg.setAttribute("viewBox", "-2 0 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 3 3 -3 3 1 1 4 -4Z")
|
||||
}
|
||||
path.setAttribute("fill", "currentColor")
|
||||
svg.appendChild(path)
|
||||
return svg
|
||||
}
|
||||
|
||||
this.renderTable = function (id) {
|
||||
|
||||
let table = this.getTableElement(id)
|
||||
|
||||
if (table === null) return
|
||||
|
||||
table.innerHTML = ""
|
||||
|
||||
let df = table.df
|
||||
let rootDf = df.rootId === df.id ? df : this.getTableData(df.rootId)
|
||||
|
||||
// header
|
||||
let header = document.createElement("thead")
|
||||
table.appendChild(header)
|
||||
|
||||
let renderData = this.computeRenderData(df)
|
||||
for (let j = 0; j < renderData.length; j++) {
|
||||
let rowData = renderData[j]
|
||||
let tr = document.createElement("tr");
|
||||
let isLastRow = j === renderData.length - 1
|
||||
header.appendChild(tr);
|
||||
for (let i = 0; i < rowData.length; i++) {
|
||||
let cell = rowData[i]
|
||||
let th = document.createElement("th");
|
||||
th.setAttribute("colspan", cell.span)
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId];
|
||||
if (!cell.empty) {
|
||||
if (col.children.length === 0) {
|
||||
th.innerHTML = col.name
|
||||
} else {
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
col.expanded = !col.expanded
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(col.expanded))
|
||||
link.innerHTML += col.name
|
||||
th.appendChild(link)
|
||||
}
|
||||
}
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (isLastRow)
|
||||
classes += " bottomBorder"
|
||||
if (classes.length > 0)
|
||||
th.setAttribute("class", classes)
|
||||
tr.appendChild(th)
|
||||
}
|
||||
}
|
||||
|
||||
// body
|
||||
let body = document.createElement("tbody")
|
||||
table.appendChild(body)
|
||||
|
||||
let columns = renderData.pop()
|
||||
for (let row = 0; row < df.nrow; row++) {
|
||||
let tr = document.createElement("tr");
|
||||
body.appendChild(tr)
|
||||
for (let i = 0; i < columns.length; i++) {
|
||||
let cell = columns[i]
|
||||
let td = document.createElement("td");
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId]
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (classes.length > 0)
|
||||
td.setAttribute("class", classes)
|
||||
tr.appendChild(td)
|
||||
let value = col.values[row]
|
||||
if (value.frameId !== undefined) {
|
||||
let frameId = value.frameId
|
||||
let expanded = rootDf.expandedFrames.has(frameId)
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
if (rootDf.expandedFrames.has(frameId))
|
||||
rootDf.expandedFrames.delete(frameId)
|
||||
else rootDf.expandedFrames.add(frameId)
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(expanded))
|
||||
link.innerHTML += value.value
|
||||
if (expanded) {
|
||||
td.appendChild(link)
|
||||
td.appendChild(document.createElement("p"))
|
||||
const childTable = document.createElement("table")
|
||||
childTable.className = "dataframe"
|
||||
childTable.id = "df_" + frameId
|
||||
let childDf = rootDf.childFrames[frameId]
|
||||
childTable.df = childDf
|
||||
td.appendChild(childTable)
|
||||
this.renderTable(frameId)
|
||||
if (childDf.nrow !== childDf.totalRows) {
|
||||
const footer = document.createElement("p")
|
||||
footer.innerText = `... showing only top ${childDf.nrow} of ${childDf.totalRows} rows`
|
||||
td.appendChild(footer)
|
||||
}
|
||||
} else {
|
||||
td.appendChild(link)
|
||||
}
|
||||
} else if (value.style !== undefined) {
|
||||
td.innerHTML = value.value
|
||||
td.setAttribute("style", value.style)
|
||||
} else td.innerHTML = value
|
||||
this.nodeScriptReplace(td)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.nodeScriptReplace = function (node) {
|
||||
if (this.nodeScriptIs(node) === true) {
|
||||
node.parentNode.replaceChild(this.nodeScriptClone(node), node);
|
||||
} else {
|
||||
let i = -1, children = node.childNodes;
|
||||
while (++i < children.length) {
|
||||
this.nodeScriptReplace(children[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
this.nodeScriptClone = function (node) {
|
||||
let script = document.createElement("script");
|
||||
script.text = node.innerHTML;
|
||||
|
||||
let i = -1, attrs = node.attributes, attr;
|
||||
while (++i < attrs.length) {
|
||||
script.setAttribute((attr = attrs[i]).name, attr.value);
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
this.nodeScriptIs = function (node) {
|
||||
return node.tagName === 'SCRIPT';
|
||||
}
|
||||
})()
|
||||
|
||||
window.call_DataFrame = function (f) {
|
||||
return f();
|
||||
};
|
||||
|
||||
let funQueue = window["kotlinQueues"] && window["kotlinQueues"]["DataFrame"];
|
||||
if (funQueue) {
|
||||
funQueue.forEach(function (f) {
|
||||
f();
|
||||
});
|
||||
funQueue = [];
|
||||
}
|
||||
})()
|
||||
|
||||
/*<!--*/
|
||||
call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: "<span title=\"name: String\">name</span>", children: [], rightAlign: false, values: ["kotlin","intellij-community","kotlin-native","compose-jb","ideavim","JetBrainsMono","Exposed","ring-ui","kotlinconf-app","create-react-kotlin-app"] },
|
||||
{ name: "<span title=\"starsCount: Int\">starsCount</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">39402</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">12926</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">7101</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">6805</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">6120</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">6059</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">5688</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">2836</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">2628</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">2424</span></span>"] },
|
||||
{ name: "<span title=\"topics: List<String>\">topics</span>", children: [], rightAlign: false, values: ["<span class=\"formatted\" title=\"compiler\ngradle-plugin\nintellij-plugin\nkotlin\nkotlin-library\nmaven-plugin\nprogramming-language\"><span class=\"structural\">[</span>compiler<span class=\"structural\">, </span>gradle-plugin<span class=\"structural\">, </span>intel<span class=\"structural\">...</span><span class=\"structural\">, </span><span class=\"structural\">...</span><span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"code-editor\nide\nintellij\nintellij-community\nintellij-platform\"><span class=\"structural\">[</span>code-editor<span class=\"structural\">, </span>ide<span class=\"structural\">, </span>intellij<span class=\"structural\">, </span>i<span class=\"structural\">...</span><span class=\"structural\">, </span>i<span class=\"structural\">...</span><span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"c\ncompiler\nkotlin\nllvm\nobjective-c\"><span class=\"structural\">[</span>c<span class=\"structural\">, </span>compiler<span class=\"structural\">, </span>kotlin<span class=\"structural\">, </span>llvm<span class=\"structural\">, </span>objective-c<span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"android\nawt\ncompose\ndeclarative-ui\ndesktop\ngui\njavascript\nkotlin\nmultiplatform\nreactive\nswing\nui\"><span class=\"structural\">[</span>android<span class=\"structural\">, </span>awt<span class=\"structural\">, </span>compose<span class=\"structural\">, </span>declara<span class=\"structural\">...</span><span class=\"structural\">, </span><span class=\"structural\">...</span><span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"ideavim\nintellij\nintellij-platform\njb-official\nkotlin\nvim\nvim-emulator\"><span class=\"structural\">[</span>ideavim<span class=\"structural\">, </span>intellij<span class=\"structural\">, </span>intellij-pl<span class=\"structural\">...</span><span class=\"structural\">, </span><span class=\"structural\">...</span><span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"coding-font\nfont\nligatures\nmonospaced-font\nprogramming-font\nprogramming-ligatures\"><span class=\"structural\">[</span>coding-font<span class=\"structural\">, </span>font<span class=\"structural\">, </span>ligatures<span class=\"structural\">, </span><span class=\"structural\">...</span><span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"dao\nkotlin\norm\nsql\"><span class=\"structural\">[</span>dao<span class=\"structural\">, </span>kotlin<span class=\"structural\">, </span>orm<span class=\"structural\">, </span>sql<span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"components\njetbrains-ui\nreact\"><span class=\"structural\">[</span>components<span class=\"structural\">, </span>jetbrains-ui<span class=\"structural\">, </span>react<span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"\"><span class=\"structural\">[</span><span class=\"structural\">]</span></span>","<span class=\"formatted\" title=\"create-react-app\njetbrains-ui\nkotlin\nreact\nwebpack\"><span class=\"structural\">[</span>create-react-app<span class=\"structural\">, </span>jetbrains-ui<span class=\"structural\">, </span><span class=\"structural\">...</span><span class=\"structural\">]</span></span>"] },
|
||||
{ name: "<span title=\"isIntellij: Boolean\">isIntellij</span>", children: [], rightAlign: false, values: ["false","true","false","false","true","false","false","false","false","false"] },
|
||||
], id: 0, rootId: 0, totalRows: 10 } ) });
|
||||
/*-->*/
|
||||
|
||||
call_DataFrame(function() { DataFrame.renderTable(0) });
|
||||
|
||||
function sendHeight() {
|
||||
const table = document.querySelector('table.dataframe');
|
||||
if (!table) return;
|
||||
|
||||
let height = 0;
|
||||
|
||||
const thead = table.querySelector('thead');
|
||||
if (thead) height += thead.offsetHeight;
|
||||
|
||||
const rows = table.querySelectorAll(':scope > tbody > tr');
|
||||
rows.forEach(row => {
|
||||
height += row.offsetHeight;
|
||||
});
|
||||
|
||||
height += getVerticalMargins(table) + 10;
|
||||
|
||||
window.parent.postMessage({ type: 'iframeHeight', height: Math.ceil(height) }, '*');
|
||||
}
|
||||
|
||||
function getVerticalMargins(element) {
|
||||
const style = getComputedStyle(element);
|
||||
return parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
||||
}
|
||||
|
||||
function repeatHeightCalculation(maxRetries = 10, interval = 100) {
|
||||
let retries = 0;
|
||||
const intervalId = setInterval(() => {
|
||||
sendHeight();
|
||||
retries++;
|
||||
if (retries >= maxRetries) clearInterval(intervalId);
|
||||
}, interval);
|
||||
}
|
||||
|
||||
window.addEventListener('load', repeatHeightCalculation);
|
||||
|
||||
const observer = new MutationObserver(() => repeatHeightCalculation(5, 50));
|
||||
observer.observe(document.querySelector('.dataframe'), {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
characterData: true,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</html>
|
||||
+514
@@ -0,0 +1,514 @@
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
:root {
|
||||
--background: #fff;
|
||||
--background-odd: #f5f5f5;
|
||||
--background-hover: #d9edfd;
|
||||
--header-text-color: #474747;
|
||||
--text-color: #848484;
|
||||
--text-color-dark: #000;
|
||||
--text-color-medium: #737373;
|
||||
--text-color-pale: #b3b3b3;
|
||||
--inner-border-color: #aaa;
|
||||
--bold-border-color: #000;
|
||||
--link-color: #296eaa;
|
||||
--link-color-pale: #296eaa;
|
||||
--link-hover: #1a466c;
|
||||
}
|
||||
|
||||
:root[theme="dark"], :root [data-jp-theme-light="false"], .dataframe_dark{
|
||||
--background: #303030;
|
||||
--background-odd: #3c3c3c;
|
||||
--background-hover: #464646;
|
||||
--header-text-color: #dddddd;
|
||||
--text-color: #b3b3b3;
|
||||
--text-color-dark: #dddddd;
|
||||
--text-color-medium: #b2b2b2;
|
||||
--text-color-pale: #737373;
|
||||
--inner-border-color: #707070;
|
||||
--bold-border-color: #777777;
|
||||
--link-color: #008dc0;
|
||||
--link-color-pale: #97e1fb;
|
||||
--link-hover: #00688e;
|
||||
}
|
||||
|
||||
p.dataframe_description {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: var(--background);
|
||||
color: var(--text-color-dark);
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.dataframe th, td {
|
||||
padding: 6px;
|
||||
border: 1px solid transparent;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.dataframe th {
|
||||
background-color: var(--background);
|
||||
color: var(--header-text-color);
|
||||
}
|
||||
|
||||
table.dataframe td {
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.dataframe th.bottomBorder {
|
||||
border-bottom-color: var(--bold-border-color);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(odd) {
|
||||
background: var(--background-odd);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(even) {
|
||||
background: var(--background);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:hover {
|
||||
background: var(--background-hover);
|
||||
}
|
||||
|
||||
table.dataframe a {
|
||||
cursor: pointer;
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.dataframe tr:hover > td a {
|
||||
color: var(--link-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe a:hover {
|
||||
color: var(--link-hover);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
table.dataframe img {
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
table.dataframe th.complex {
|
||||
background-color: var(--background);
|
||||
border: 1px solid var(--background);
|
||||
}
|
||||
|
||||
table.dataframe .leftBorder {
|
||||
border-left-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightBorder {
|
||||
border-right-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightAlign {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table.dataframe .expanderSvg {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
table.dataframe .expander {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* formatting */
|
||||
|
||||
table.dataframe .null {
|
||||
color: var(--text-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe .structural {
|
||||
color: var(--text-color-medium);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .dataFrameCaption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .numbers {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe td:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe tr:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
font-family: "JetBrains Mono",SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
|
||||
}
|
||||
|
||||
:root {
|
||||
color: #19191C;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
:root[theme="dark"] {
|
||||
background-color: #19191C;
|
||||
color: #FFFFFFCC
|
||||
}
|
||||
|
||||
details details {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
summary {
|
||||
padding: 6px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="dataframe" id="df_0"></table>
|
||||
|
||||
<p class="dataframe_description">... showing only top 20 of 562 rows</p><p class="dataframe_description"></p>
|
||||
</body>
|
||||
<script>
|
||||
(function () {
|
||||
window.DataFrame = window.DataFrame || new (function () {
|
||||
this.addTable = function (df) {
|
||||
let cols = df.cols;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
for (let c of cols[i].children) {
|
||||
cols[c].parent = i;
|
||||
}
|
||||
}
|
||||
df.nrow = 0
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
if (df.cols[i].values.length > df.nrow) df.nrow = df.cols[i].values.length
|
||||
}
|
||||
if (df.id === df.rootId) {
|
||||
df.expandedFrames = new Set()
|
||||
df.childFrames = {}
|
||||
const table = this.getTableElement(df.id)
|
||||
table.df = df
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
let col = df.cols[i]
|
||||
if (col.parent === undefined && col.children.length > 0) col.expanded = true
|
||||
}
|
||||
} else {
|
||||
const rootDf = this.getTableData(df.rootId)
|
||||
rootDf.childFrames[df.id] = df
|
||||
}
|
||||
}
|
||||
|
||||
this.computeRenderData = function (df) {
|
||||
let result = []
|
||||
let pos = 0
|
||||
for (let col = 0; col < df.cols.length; col++) {
|
||||
if (df.cols[col].parent === undefined)
|
||||
pos += this.computeRenderDataRec(df.cols, col, pos, 0, result, false, false)
|
||||
}
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let row = result[i]
|
||||
for (let j = 0; j < row.length; j++) {
|
||||
let cell = row[j]
|
||||
if (j === 0)
|
||||
cell.leftBd = false
|
||||
if (j < row.length - 1) {
|
||||
let nextData = row[j + 1]
|
||||
if (nextData.leftBd) cell.rightBd = true
|
||||
else if (cell.rightBd) nextData.leftBd = true
|
||||
} else cell.rightBd = false
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
this.computeRenderDataRec = function (cols, colId, pos, depth, result, leftBorder, rightBorder) {
|
||||
if (result.length === depth) {
|
||||
const array = [];
|
||||
if (pos > 0) {
|
||||
let j = 0
|
||||
for (let i = 0; j < pos; i++) {
|
||||
let c = result[depth - 1][i]
|
||||
j += c.span
|
||||
let copy = Object.assign({empty: true}, c)
|
||||
array.push(copy)
|
||||
}
|
||||
}
|
||||
result.push(array)
|
||||
}
|
||||
const col = cols[colId];
|
||||
let size = 0;
|
||||
if (col.expanded) {
|
||||
let childPos = pos
|
||||
for (let i = 0; i < col.children.length; i++) {
|
||||
let child = col.children[i]
|
||||
let childLeft = i === 0 && (col.children.length > 1 || leftBorder)
|
||||
let childRight = i === col.children.length - 1 && (col.children.length > 1 || rightBorder)
|
||||
let childSize = this.computeRenderDataRec(cols, child, childPos, depth + 1, result, childLeft, childRight)
|
||||
childPos += childSize
|
||||
size += childSize
|
||||
}
|
||||
} else {
|
||||
for (let i = depth + 1; i < result.length; i++)
|
||||
result[i].push({id: colId, span: 1, leftBd: leftBorder, rightBd: rightBorder, empty: true})
|
||||
size = 1
|
||||
}
|
||||
let left = leftBorder
|
||||
let right = rightBorder
|
||||
if (size > 1) {
|
||||
left = true
|
||||
right = true
|
||||
}
|
||||
result[depth].push({id: colId, span: size, leftBd: left, rightBd: right})
|
||||
return size
|
||||
}
|
||||
|
||||
this.getTableElement = function (id) {
|
||||
return document.getElementById("df_" + id)
|
||||
}
|
||||
|
||||
this.getTableData = function (id) {
|
||||
return this.getTableElement(id).df
|
||||
}
|
||||
|
||||
this.createExpander = function (isExpanded) {
|
||||
const svgNs = "http://www.w3.org/2000/svg"
|
||||
let svg = document.createElementNS(svgNs, "svg")
|
||||
svg.classList.add("expanderSvg")
|
||||
let path = document.createElementNS(svgNs, "path")
|
||||
if (isExpanded) {
|
||||
svg.setAttribute("viewBox", "0 -2 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 4 4 4 -4 -1 -1 -3 3Z")
|
||||
} else {
|
||||
svg.setAttribute("viewBox", "-2 0 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 3 3 -3 3 1 1 4 -4Z")
|
||||
}
|
||||
path.setAttribute("fill", "currentColor")
|
||||
svg.appendChild(path)
|
||||
return svg
|
||||
}
|
||||
|
||||
this.renderTable = function (id) {
|
||||
|
||||
let table = this.getTableElement(id)
|
||||
|
||||
if (table === null) return
|
||||
|
||||
table.innerHTML = ""
|
||||
|
||||
let df = table.df
|
||||
let rootDf = df.rootId === df.id ? df : this.getTableData(df.rootId)
|
||||
|
||||
// header
|
||||
let header = document.createElement("thead")
|
||||
table.appendChild(header)
|
||||
|
||||
let renderData = this.computeRenderData(df)
|
||||
for (let j = 0; j < renderData.length; j++) {
|
||||
let rowData = renderData[j]
|
||||
let tr = document.createElement("tr");
|
||||
let isLastRow = j === renderData.length - 1
|
||||
header.appendChild(tr);
|
||||
for (let i = 0; i < rowData.length; i++) {
|
||||
let cell = rowData[i]
|
||||
let th = document.createElement("th");
|
||||
th.setAttribute("colspan", cell.span)
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId];
|
||||
if (!cell.empty) {
|
||||
if (col.children.length === 0) {
|
||||
th.innerHTML = col.name
|
||||
} else {
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
col.expanded = !col.expanded
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(col.expanded))
|
||||
link.innerHTML += col.name
|
||||
th.appendChild(link)
|
||||
}
|
||||
}
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (isLastRow)
|
||||
classes += " bottomBorder"
|
||||
if (classes.length > 0)
|
||||
th.setAttribute("class", classes)
|
||||
tr.appendChild(th)
|
||||
}
|
||||
}
|
||||
|
||||
// body
|
||||
let body = document.createElement("tbody")
|
||||
table.appendChild(body)
|
||||
|
||||
let columns = renderData.pop()
|
||||
for (let row = 0; row < df.nrow; row++) {
|
||||
let tr = document.createElement("tr");
|
||||
body.appendChild(tr)
|
||||
for (let i = 0; i < columns.length; i++) {
|
||||
let cell = columns[i]
|
||||
let td = document.createElement("td");
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId]
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (classes.length > 0)
|
||||
td.setAttribute("class", classes)
|
||||
tr.appendChild(td)
|
||||
let value = col.values[row]
|
||||
if (value.frameId !== undefined) {
|
||||
let frameId = value.frameId
|
||||
let expanded = rootDf.expandedFrames.has(frameId)
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
if (rootDf.expandedFrames.has(frameId))
|
||||
rootDf.expandedFrames.delete(frameId)
|
||||
else rootDf.expandedFrames.add(frameId)
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(expanded))
|
||||
link.innerHTML += value.value
|
||||
if (expanded) {
|
||||
td.appendChild(link)
|
||||
td.appendChild(document.createElement("p"))
|
||||
const childTable = document.createElement("table")
|
||||
childTable.className = "dataframe"
|
||||
childTable.id = "df_" + frameId
|
||||
let childDf = rootDf.childFrames[frameId]
|
||||
childTable.df = childDf
|
||||
td.appendChild(childTable)
|
||||
this.renderTable(frameId)
|
||||
if (childDf.nrow !== childDf.totalRows) {
|
||||
const footer = document.createElement("p")
|
||||
footer.innerText = `... showing only top ${childDf.nrow} of ${childDf.totalRows} rows`
|
||||
td.appendChild(footer)
|
||||
}
|
||||
} else {
|
||||
td.appendChild(link)
|
||||
}
|
||||
} else if (value.style !== undefined) {
|
||||
td.innerHTML = value.value
|
||||
td.setAttribute("style", value.style)
|
||||
} else td.innerHTML = value
|
||||
this.nodeScriptReplace(td)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.nodeScriptReplace = function (node) {
|
||||
if (this.nodeScriptIs(node) === true) {
|
||||
node.parentNode.replaceChild(this.nodeScriptClone(node), node);
|
||||
} else {
|
||||
let i = -1, children = node.childNodes;
|
||||
while (++i < children.length) {
|
||||
this.nodeScriptReplace(children[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
this.nodeScriptClone = function (node) {
|
||||
let script = document.createElement("script");
|
||||
script.text = node.innerHTML;
|
||||
|
||||
let i = -1, attrs = node.attributes, attr;
|
||||
while (++i < attrs.length) {
|
||||
script.setAttribute((attr = attrs[i]).name, attr.value);
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
this.nodeScriptIs = function (node) {
|
||||
return node.tagName === 'SCRIPT';
|
||||
}
|
||||
})()
|
||||
|
||||
window.call_DataFrame = function (f) {
|
||||
return f();
|
||||
};
|
||||
|
||||
let funQueue = window["kotlinQueues"] && window["kotlinQueues"]["DataFrame"];
|
||||
if (funQueue) {
|
||||
funQueue.forEach(function (f) {
|
||||
f();
|
||||
});
|
||||
funQueue = [];
|
||||
}
|
||||
})()
|
||||
|
||||
/*<!--*/
|
||||
call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: "<span title=\"full_name: String\">full_name</span>", children: [], rightAlign: false, values: ["JetBrains/JPS","JetBrains/YouTrackSharp","JetBrains/colorSchemeTool","JetBrains/ideavim","JetBrains/youtrack-vcs-hooks","JetBrains/youtrack-rest-ruby-library","JetBrains/emacs4ij","JetBrains/codereview4intellij","JetBrains/teamcity-nuget-support","JetBrains/Grammar-Kit","JetBrains/intellij-starteam-plugin","JetBrains/la-clojure","JetBrains/MPS","JetBrains/intellij-community","JetBrains/TeamCity.ServiceMessages","JetBrains/youtrack-rest-python-library","JetBrains/intellij-scala","JetBrains/teamcity-messages","JetBrains/teamcity-cpp","JetBrains/kotlin"] },
|
||||
{ name: "<span title=\"html_url: URL\">html_url</span>", children: [], rightAlign: false, values: ["<a href='https://github.com/JetBrains/JPS' target='_blank'>https://github.com/JetBrains/JPS</a>","<span class=\"formatted\" title=\"https://github.com/JetBrains/YouTrackSharp\"><a href='https://github.com/JetBrains/YouTrackSharp' target='_blank'>https://github.com/JetBrains/YouTrack<span class=\"structural\">...</span></a></span>","<span class=\"formatted\" title=\"https://github.com/JetBrains/colorSchemeTool\"><a href='https://github.com/JetBrains/colorSchemeTool' target='_blank'>https://github.com/JetBrains/colorSch<span class=\"structural\">...</span></a></span>","<a href='https://github.com/JetBrains/ideavim' target='_blank'>https://github.com/JetBrains/ideavim</a>","<span class=\"formatted\" title=\"https://github.com/JetBrains/youtrack-vcs-hooks\"><a href='https://github.com/JetBrains/youtrack-vcs-hooks' target='_blank'>https://github.com/JetBrains/youtrack<span class=\"structural\">...</span></a></span>","<span class=\"formatted\" title=\"https://github.com/JetBrains/youtrack-rest-ruby-library\"><a href='https://github.com/JetBrains/youtrack-rest-ruby-library' target='_blank'>https://github.com/JetBrains/youtrack<span class=\"structural\">...</span></a></span>","<a href='https://github.com/JetBrains/emacs4ij' target='_blank'>https://github.com/JetBrains/emacs4ij</a>","<span class=\"formatted\" title=\"https://github.com/JetBrains/codereview4intellij\"><a href='https://github.com/JetBrains/codereview4intellij' target='_blank'>https://github.com/JetBrains/coderevi<span class=\"structural\">...</span></a></span>","<span class=\"formatted\" title=\"https://github.com/JetBrains/teamcity-nuget-support\"><a href='https://github.com/JetBrains/teamcity-nuget-support' target='_blank'>https://github.com/JetBrains/teamcity<span class=\"structural\">...</span></a></span>","<a href='https://github.com/JetBrains/Grammar-Kit' target='_blank'>https://github.com/JetBrains/Grammar-Kit</a>","<span class=\"formatted\" title=\"https://github.com/JetBrains/intellij-starteam-plugin\"><a href='https://github.com/JetBrains/intellij-starteam-plugin' target='_blank'>https://github.com/JetBrains/intellij<span class=\"structural\">...</span></a></span>","<a href='https://github.com/JetBrains/la-clojure' target='_blank'>https://github.com/JetBrains/la-clojure</a>","<a href='https://github.com/JetBrains/MPS' target='_blank'>https://github.com/JetBrains/MPS</a>","<span class=\"formatted\" title=\"https://github.com/JetBrains/intellij-community\"><a href='https://github.com/JetBrains/intellij-community' target='_blank'>https://github.com/JetBrains/intellij<span class=\"structural\">...</span></a></span>","<span class=\"formatted\" title=\"https://github.com/JetBrains/TeamCity.ServiceMessages\"><a href='https://github.com/JetBrains/TeamCity.ServiceMessages' target='_blank'>https://github.com/JetBrains/TeamCity<span class=\"structural\">...</span></a></span>","<span class=\"formatted\" title=\"https://github.com/JetBrains/youtrack-rest-python-library\"><a href='https://github.com/JetBrains/youtrack-rest-python-library' target='_blank'>https://github.com/JetBrains/youtrack<span class=\"structural\">...</span></a></span>","<span class=\"formatted\" title=\"https://github.com/JetBrains/intellij-scala\"><a href='https://github.com/JetBrains/intellij-scala' target='_blank'>https://github.com/JetBrains/intellij<span class=\"structural\">...</span></a></span>","<span class=\"formatted\" title=\"https://github.com/JetBrains/teamcity-messages\"><a href='https://github.com/JetBrains/teamcity-messages' target='_blank'>https://github.com/JetBrains/teamcity<span class=\"structural\">...</span></a></span>","<span class=\"formatted\" title=\"https://github.com/JetBrains/teamcity-cpp\"><a href='https://github.com/JetBrains/teamcity-cpp' target='_blank'>https://github.com/JetBrains/teamcity<span class=\"structural\">...</span></a></span>","<a href='https://github.com/JetBrains/kotlin' target='_blank'>https://github.com/JetBrains/kotlin</a>"] },
|
||||
{ name: "<span title=\"stargazers_count: Int\">stargazers_count</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">23</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">115</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">290</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">6120</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">5</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">8</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">47</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">11</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">41</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">534</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">6</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">218</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1241</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">12926</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">39</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">118</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1066</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">125</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">27</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">39402</span></span>"] },
|
||||
{ name: "<span title=\"topics: String\">topics</span>", children: [], rightAlign: false, values: ["[]","<span class=\"formatted\" title=\"[jetbrains, jetbrains-youtrack, youtrack, youtrack-api]\">[jetbrains, jetbrains-youtrack, youtr<span class=\"structural\">...</span></span>","[]","<span class=\"formatted\" title=\"[ideavim, intellij, intellij-platform, jb-official, kotlin, vim, vim-emulator]\">[ideavim, intellij, intellij-platform<span class=\"structural\">...</span></span>","[]","[]","[]","[]","<span class=\"formatted\" title=\"[nuget, nuget-feed, teamcity, teamcity-plugin]\">[nuget, nuget-feed, teamcity, teamcit<span class=\"structural\">...</span></span>","[]","[]","[]","[domain-specific-language, dsl]","<span class=\"formatted\" title=\"[code-editor, ide, intellij, intellij-community, intellij-platform]\">[code-editor, ide, intellij, intellij<span class=\"structural\">...</span></span>","<span class=\"formatted\" title=\"[c-sharp, teamcity, teamcity-service-messages]\">[c-sharp, teamcity, teamcity-service-<span class=\"structural\">...</span></span>","[]","[intellij-idea, intellij-plugin, scala]","[]","[]","<span class=\"formatted\" title=\"[compiler, gradle-plugin, intellij-plugin, kotlin, kotlin-library, maven-plugin, programming-language]\">[compiler, gradle-plugin, intellij-pl<span class=\"structural\">...</span></span>"] },
|
||||
{ name: "<span title=\"watchers: Int\">watchers</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">23</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">115</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">290</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">6120</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">5</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">8</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">47</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">11</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">41</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">534</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">6</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">218</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1241</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">12926</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">39</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">118</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1066</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">125</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">27</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">39402</span></span>"] },
|
||||
], id: 0, rootId: 0, totalRows: 562 } ) });
|
||||
/*-->*/
|
||||
|
||||
call_DataFrame(function() { DataFrame.renderTable(0) });
|
||||
|
||||
function sendHeight() {
|
||||
const table = document.querySelector('table.dataframe');
|
||||
if (!table) return;
|
||||
|
||||
let height = 0;
|
||||
|
||||
const thead = table.querySelector('thead');
|
||||
if (thead) height += thead.offsetHeight;
|
||||
|
||||
const rows = table.querySelectorAll(':scope > tbody > tr');
|
||||
rows.forEach(row => {
|
||||
height += row.offsetHeight;
|
||||
});
|
||||
|
||||
height += getVerticalMargins(table) + 10;
|
||||
|
||||
window.parent.postMessage({ type: 'iframeHeight', height: Math.ceil(height) }, '*');
|
||||
}
|
||||
|
||||
function getVerticalMargins(element) {
|
||||
const style = getComputedStyle(element);
|
||||
return parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
||||
}
|
||||
|
||||
function repeatHeightCalculation(maxRetries = 10, interval = 100) {
|
||||
let retries = 0;
|
||||
const intervalId = setInterval(() => {
|
||||
sendHeight();
|
||||
retries++;
|
||||
if (retries >= maxRetries) clearInterval(intervalId);
|
||||
}, interval);
|
||||
}
|
||||
|
||||
window.addEventListener('load', repeatHeightCalculation);
|
||||
|
||||
const observer = new MutationObserver(() => repeatHeightCalculation(5, 50));
|
||||
observer.observe(document.querySelector('.dataframe'), {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
characterData: true,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</html>
|
||||
+523
@@ -0,0 +1,523 @@
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
:root {
|
||||
--background: #fff;
|
||||
--background-odd: #f5f5f5;
|
||||
--background-hover: #d9edfd;
|
||||
--header-text-color: #474747;
|
||||
--text-color: #848484;
|
||||
--text-color-dark: #000;
|
||||
--text-color-medium: #737373;
|
||||
--text-color-pale: #b3b3b3;
|
||||
--inner-border-color: #aaa;
|
||||
--bold-border-color: #000;
|
||||
--link-color: #296eaa;
|
||||
--link-color-pale: #296eaa;
|
||||
--link-hover: #1a466c;
|
||||
}
|
||||
|
||||
:root[theme="dark"], :root [data-jp-theme-light="false"], .dataframe_dark{
|
||||
--background: #303030;
|
||||
--background-odd: #3c3c3c;
|
||||
--background-hover: #464646;
|
||||
--header-text-color: #dddddd;
|
||||
--text-color: #b3b3b3;
|
||||
--text-color-dark: #dddddd;
|
||||
--text-color-medium: #b2b2b2;
|
||||
--text-color-pale: #737373;
|
||||
--inner-border-color: #707070;
|
||||
--bold-border-color: #777777;
|
||||
--link-color: #008dc0;
|
||||
--link-color-pale: #97e1fb;
|
||||
--link-hover: #00688e;
|
||||
}
|
||||
|
||||
p.dataframe_description {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: var(--background);
|
||||
color: var(--text-color-dark);
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.dataframe th, td {
|
||||
padding: 6px;
|
||||
border: 1px solid transparent;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.dataframe th {
|
||||
background-color: var(--background);
|
||||
color: var(--header-text-color);
|
||||
}
|
||||
|
||||
table.dataframe td {
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.dataframe th.bottomBorder {
|
||||
border-bottom-color: var(--bold-border-color);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(odd) {
|
||||
background: var(--background-odd);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(even) {
|
||||
background: var(--background);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:hover {
|
||||
background: var(--background-hover);
|
||||
}
|
||||
|
||||
table.dataframe a {
|
||||
cursor: pointer;
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.dataframe tr:hover > td a {
|
||||
color: var(--link-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe a:hover {
|
||||
color: var(--link-hover);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
table.dataframe img {
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
table.dataframe th.complex {
|
||||
background-color: var(--background);
|
||||
border: 1px solid var(--background);
|
||||
}
|
||||
|
||||
table.dataframe .leftBorder {
|
||||
border-left-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightBorder {
|
||||
border-right-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightAlign {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table.dataframe .expanderSvg {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
table.dataframe .expander {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* formatting */
|
||||
|
||||
table.dataframe .null {
|
||||
color: var(--text-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe .structural {
|
||||
color: var(--text-color-medium);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .dataFrameCaption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .numbers {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe td:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe tr:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
font-family: "JetBrains Mono",SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
|
||||
}
|
||||
|
||||
:root {
|
||||
color: #19191C;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
:root[theme="dark"] {
|
||||
background-color: #19191C;
|
||||
color: #FFFFFFCC
|
||||
}
|
||||
|
||||
details details {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
summary {
|
||||
padding: 6px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="dataframe" id="df_0"></table>
|
||||
|
||||
<p class="dataframe_description"></p>
|
||||
</body>
|
||||
<script>
|
||||
(function () {
|
||||
window.DataFrame = window.DataFrame || new (function () {
|
||||
this.addTable = function (df) {
|
||||
let cols = df.cols;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
for (let c of cols[i].children) {
|
||||
cols[c].parent = i;
|
||||
}
|
||||
}
|
||||
df.nrow = 0
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
if (df.cols[i].values.length > df.nrow) df.nrow = df.cols[i].values.length
|
||||
}
|
||||
if (df.id === df.rootId) {
|
||||
df.expandedFrames = new Set()
|
||||
df.childFrames = {}
|
||||
const table = this.getTableElement(df.id)
|
||||
table.df = df
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
let col = df.cols[i]
|
||||
if (col.parent === undefined && col.children.length > 0) col.expanded = true
|
||||
}
|
||||
} else {
|
||||
const rootDf = this.getTableData(df.rootId)
|
||||
rootDf.childFrames[df.id] = df
|
||||
}
|
||||
}
|
||||
|
||||
this.computeRenderData = function (df) {
|
||||
let result = []
|
||||
let pos = 0
|
||||
for (let col = 0; col < df.cols.length; col++) {
|
||||
if (df.cols[col].parent === undefined)
|
||||
pos += this.computeRenderDataRec(df.cols, col, pos, 0, result, false, false)
|
||||
}
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let row = result[i]
|
||||
for (let j = 0; j < row.length; j++) {
|
||||
let cell = row[j]
|
||||
if (j === 0)
|
||||
cell.leftBd = false
|
||||
if (j < row.length - 1) {
|
||||
let nextData = row[j + 1]
|
||||
if (nextData.leftBd) cell.rightBd = true
|
||||
else if (cell.rightBd) nextData.leftBd = true
|
||||
} else cell.rightBd = false
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
this.computeRenderDataRec = function (cols, colId, pos, depth, result, leftBorder, rightBorder) {
|
||||
if (result.length === depth) {
|
||||
const array = [];
|
||||
if (pos > 0) {
|
||||
let j = 0
|
||||
for (let i = 0; j < pos; i++) {
|
||||
let c = result[depth - 1][i]
|
||||
j += c.span
|
||||
let copy = Object.assign({empty: true}, c)
|
||||
array.push(copy)
|
||||
}
|
||||
}
|
||||
result.push(array)
|
||||
}
|
||||
const col = cols[colId];
|
||||
let size = 0;
|
||||
if (col.expanded) {
|
||||
let childPos = pos
|
||||
for (let i = 0; i < col.children.length; i++) {
|
||||
let child = col.children[i]
|
||||
let childLeft = i === 0 && (col.children.length > 1 || leftBorder)
|
||||
let childRight = i === col.children.length - 1 && (col.children.length > 1 || rightBorder)
|
||||
let childSize = this.computeRenderDataRec(cols, child, childPos, depth + 1, result, childLeft, childRight)
|
||||
childPos += childSize
|
||||
size += childSize
|
||||
}
|
||||
} else {
|
||||
for (let i = depth + 1; i < result.length; i++)
|
||||
result[i].push({id: colId, span: 1, leftBd: leftBorder, rightBd: rightBorder, empty: true})
|
||||
size = 1
|
||||
}
|
||||
let left = leftBorder
|
||||
let right = rightBorder
|
||||
if (size > 1) {
|
||||
left = true
|
||||
right = true
|
||||
}
|
||||
result[depth].push({id: colId, span: size, leftBd: left, rightBd: right})
|
||||
return size
|
||||
}
|
||||
|
||||
this.getTableElement = function (id) {
|
||||
return document.getElementById("df_" + id)
|
||||
}
|
||||
|
||||
this.getTableData = function (id) {
|
||||
return this.getTableElement(id).df
|
||||
}
|
||||
|
||||
this.createExpander = function (isExpanded) {
|
||||
const svgNs = "http://www.w3.org/2000/svg"
|
||||
let svg = document.createElementNS(svgNs, "svg")
|
||||
svg.classList.add("expanderSvg")
|
||||
let path = document.createElementNS(svgNs, "path")
|
||||
if (isExpanded) {
|
||||
svg.setAttribute("viewBox", "0 -2 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 4 4 4 -4 -1 -1 -3 3Z")
|
||||
} else {
|
||||
svg.setAttribute("viewBox", "-2 0 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 3 3 -3 3 1 1 4 -4Z")
|
||||
}
|
||||
path.setAttribute("fill", "currentColor")
|
||||
svg.appendChild(path)
|
||||
return svg
|
||||
}
|
||||
|
||||
this.renderTable = function (id) {
|
||||
|
||||
let table = this.getTableElement(id)
|
||||
|
||||
if (table === null) return
|
||||
|
||||
table.innerHTML = ""
|
||||
|
||||
let df = table.df
|
||||
let rootDf = df.rootId === df.id ? df : this.getTableData(df.rootId)
|
||||
|
||||
// header
|
||||
let header = document.createElement("thead")
|
||||
table.appendChild(header)
|
||||
|
||||
let renderData = this.computeRenderData(df)
|
||||
for (let j = 0; j < renderData.length; j++) {
|
||||
let rowData = renderData[j]
|
||||
let tr = document.createElement("tr");
|
||||
let isLastRow = j === renderData.length - 1
|
||||
header.appendChild(tr);
|
||||
for (let i = 0; i < rowData.length; i++) {
|
||||
let cell = rowData[i]
|
||||
let th = document.createElement("th");
|
||||
th.setAttribute("colspan", cell.span)
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId];
|
||||
if (!cell.empty) {
|
||||
if (col.children.length === 0) {
|
||||
th.innerHTML = col.name
|
||||
} else {
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
col.expanded = !col.expanded
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(col.expanded))
|
||||
link.innerHTML += col.name
|
||||
th.appendChild(link)
|
||||
}
|
||||
}
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (isLastRow)
|
||||
classes += " bottomBorder"
|
||||
if (classes.length > 0)
|
||||
th.setAttribute("class", classes)
|
||||
tr.appendChild(th)
|
||||
}
|
||||
}
|
||||
|
||||
// body
|
||||
let body = document.createElement("tbody")
|
||||
table.appendChild(body)
|
||||
|
||||
let columns = renderData.pop()
|
||||
for (let row = 0; row < df.nrow; row++) {
|
||||
let tr = document.createElement("tr");
|
||||
body.appendChild(tr)
|
||||
for (let i = 0; i < columns.length; i++) {
|
||||
let cell = columns[i]
|
||||
let td = document.createElement("td");
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId]
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (classes.length > 0)
|
||||
td.setAttribute("class", classes)
|
||||
tr.appendChild(td)
|
||||
let value = col.values[row]
|
||||
if (value.frameId !== undefined) {
|
||||
let frameId = value.frameId
|
||||
let expanded = rootDf.expandedFrames.has(frameId)
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
if (rootDf.expandedFrames.has(frameId))
|
||||
rootDf.expandedFrames.delete(frameId)
|
||||
else rootDf.expandedFrames.add(frameId)
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(expanded))
|
||||
link.innerHTML += value.value
|
||||
if (expanded) {
|
||||
td.appendChild(link)
|
||||
td.appendChild(document.createElement("p"))
|
||||
const childTable = document.createElement("table")
|
||||
childTable.className = "dataframe"
|
||||
childTable.id = "df_" + frameId
|
||||
let childDf = rootDf.childFrames[frameId]
|
||||
childTable.df = childDf
|
||||
td.appendChild(childTable)
|
||||
this.renderTable(frameId)
|
||||
if (childDf.nrow !== childDf.totalRows) {
|
||||
const footer = document.createElement("p")
|
||||
footer.innerText = `... showing only top ${childDf.nrow} of ${childDf.totalRows} rows`
|
||||
td.appendChild(footer)
|
||||
}
|
||||
} else {
|
||||
td.appendChild(link)
|
||||
}
|
||||
} else if (value.style !== undefined) {
|
||||
td.innerHTML = value.value
|
||||
td.setAttribute("style", value.style)
|
||||
} else td.innerHTML = value
|
||||
this.nodeScriptReplace(td)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.nodeScriptReplace = function (node) {
|
||||
if (this.nodeScriptIs(node) === true) {
|
||||
node.parentNode.replaceChild(this.nodeScriptClone(node), node);
|
||||
} else {
|
||||
let i = -1, children = node.childNodes;
|
||||
while (++i < children.length) {
|
||||
this.nodeScriptReplace(children[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
this.nodeScriptClone = function (node) {
|
||||
let script = document.createElement("script");
|
||||
script.text = node.innerHTML;
|
||||
|
||||
let i = -1, attrs = node.attributes, attr;
|
||||
while (++i < attrs.length) {
|
||||
script.setAttribute((attr = attrs[i]).name, attr.value);
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
this.nodeScriptIs = function (node) {
|
||||
return node.tagName === 'SCRIPT';
|
||||
}
|
||||
})()
|
||||
|
||||
window.call_DataFrame = function (f) {
|
||||
return f();
|
||||
};
|
||||
|
||||
let funQueue = window["kotlinQueues"] && window["kotlinQueues"]["DataFrame"];
|
||||
if (funQueue) {
|
||||
funQueue.forEach(function (f) {
|
||||
f();
|
||||
});
|
||||
funQueue = [];
|
||||
}
|
||||
})()
|
||||
|
||||
/*<!--*/
|
||||
call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: "<span title=\"name: String\">name</span>", children: [], rightAlign: false, values: ["full_name","html_url","stargazers_count","topics","watchers"] },
|
||||
{ name: "<span title=\"type: String\">type</span>", children: [], rightAlign: false, values: ["String","URL","Int","String","Int"] },
|
||||
{ name: "<span title=\"count: Int\">count</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">562</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">562</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">562</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">562</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">562</span></span>"] },
|
||||
{ name: "<span title=\"unique: Int\">unique</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">562</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">562</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">165</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">145</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">165</span></span>"] },
|
||||
{ name: "<span title=\"nulls: Int\">nulls</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">0</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">0</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">0</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">0</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">0</span></span>"] },
|
||||
{ name: "<span title=\"top: java.io.Serializable\">top</span>", children: [], rightAlign: false, values: ["JetBrains/JPS","<a href='https://github.com/JetBrains/JPS' target='_blank'>https://github.com/JetBrains/JPS</a>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1</span></span>","[]","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1</span></span>"] },
|
||||
{ name: "<span title=\"freq: Int\">freq</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">1</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">100</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">401</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">100</span></span>"] },
|
||||
{ name: "<span title=\"mean: Double?\">mean</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"null\">null</span></span>","<span class=\"formatted\" title=\"\"><span class=\"null\">null</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">244.759786</span></span>","<span class=\"formatted\" title=\"\"><span class=\"null\">null</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">244.759786</span></span>"] },
|
||||
{ name: "<span title=\"std: Double?\">std</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"null\">null</span></span>","<span class=\"formatted\" title=\"\"><span class=\"null\">null</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1862.801982</span></span>","<span class=\"formatted\" title=\"\"><span class=\"null\">null</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1862.801982</span></span>"] },
|
||||
{ name: "<span title=\"min: Comparable<*>?\">min</span>", children: [], rightAlign: false, values: ["JetBrains/Android-Tuts-Samples","<span class=\"formatted\" title=\"\"><span class=\"null\">null</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">0</span></span>","[2d, graphics, java, skia]","<span class=\"formatted\" title=\"\"><span class=\"numbers\">0</span></span>"] },
|
||||
{ name: "<span title=\"p25: Comparable<*>?\">p25</span>", children: [], rightAlign: false, values: ["JetBrains/eslint-config","<span class=\"formatted\" title=\"\"><span class=\"null\">null</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">2.0</span></span>","[]","<span class=\"formatted\" title=\"\"><span class=\"numbers\">2.0</span></span>"] },
|
||||
{ name: "<span title=\"median: Comparable<*>?\">median</span>", children: [], rightAlign: false, values: ["JetBrains/lightbeam","<span class=\"formatted\" title=\"\"><span class=\"null\">null</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">8.0</span></span>","[]","<span class=\"formatted\" title=\"\"><span class=\"numbers\">8.0</span></span>"] },
|
||||
{ name: "<span title=\"p75: Comparable<*>?\">p75</span>", children: [], rightAlign: false, values: ["JetBrains/teamcity-bitbucket-issues","<span class=\"formatted\" title=\"\"><span class=\"null\">null</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">48.0</span></span>","[awt, swing]","<span class=\"formatted\" title=\"\"><span class=\"numbers\">48.0</span></span>"] },
|
||||
{ name: "<span title=\"max: Comparable<*>?\">max</span>", children: [], rightAlign: false, values: ["JetBrains/ztools","<span class=\"formatted\" title=\"\"><span class=\"null\">null</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">39402</span></span>","[youtrack, youtrack-workflow]","<span class=\"formatted\" title=\"\"><span class=\"numbers\">39402</span></span>"] },
|
||||
], id: 0, rootId: 0, totalRows: 5 } ) });
|
||||
/*-->*/
|
||||
|
||||
call_DataFrame(function() { DataFrame.renderTable(0) });
|
||||
|
||||
function sendHeight() {
|
||||
const table = document.querySelector('table.dataframe');
|
||||
if (!table) return;
|
||||
|
||||
let height = 0;
|
||||
|
||||
const thead = table.querySelector('thead');
|
||||
if (thead) height += thead.offsetHeight;
|
||||
|
||||
const rows = table.querySelectorAll(':scope > tbody > tr');
|
||||
rows.forEach(row => {
|
||||
height += row.offsetHeight;
|
||||
});
|
||||
|
||||
height += getVerticalMargins(table) + 10;
|
||||
|
||||
window.parent.postMessage({ type: 'iframeHeight', height: Math.ceil(height) }, '*');
|
||||
}
|
||||
|
||||
function getVerticalMargins(element) {
|
||||
const style = getComputedStyle(element);
|
||||
return parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
||||
}
|
||||
|
||||
function repeatHeightCalculation(maxRetries = 10, interval = 100) {
|
||||
let retries = 0;
|
||||
const intervalId = setInterval(() => {
|
||||
sendHeight();
|
||||
retries++;
|
||||
if (retries >= maxRetries) clearInterval(intervalId);
|
||||
}, interval);
|
||||
}
|
||||
|
||||
window.addEventListener('load', repeatHeightCalculation);
|
||||
|
||||
const observer = new MutationObserver(() => repeatHeightCalculation(5, 50));
|
||||
observer.observe(document.querySelector('.dataframe'), {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
characterData: true,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</html>
|
||||
+512
@@ -0,0 +1,512 @@
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
:root {
|
||||
--background: #fff;
|
||||
--background-odd: #f5f5f5;
|
||||
--background-hover: #d9edfd;
|
||||
--header-text-color: #474747;
|
||||
--text-color: #848484;
|
||||
--text-color-dark: #000;
|
||||
--text-color-medium: #737373;
|
||||
--text-color-pale: #b3b3b3;
|
||||
--inner-border-color: #aaa;
|
||||
--bold-border-color: #000;
|
||||
--link-color: #296eaa;
|
||||
--link-color-pale: #296eaa;
|
||||
--link-hover: #1a466c;
|
||||
}
|
||||
|
||||
:root[theme="dark"], :root [data-jp-theme-light="false"], .dataframe_dark{
|
||||
--background: #303030;
|
||||
--background-odd: #3c3c3c;
|
||||
--background-hover: #464646;
|
||||
--header-text-color: #dddddd;
|
||||
--text-color: #b3b3b3;
|
||||
--text-color-dark: #dddddd;
|
||||
--text-color-medium: #b2b2b2;
|
||||
--text-color-pale: #737373;
|
||||
--inner-border-color: #707070;
|
||||
--bold-border-color: #777777;
|
||||
--link-color: #008dc0;
|
||||
--link-color-pale: #97e1fb;
|
||||
--link-hover: #00688e;
|
||||
}
|
||||
|
||||
p.dataframe_description {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: var(--background);
|
||||
color: var(--text-color-dark);
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.dataframe th, td {
|
||||
padding: 6px;
|
||||
border: 1px solid transparent;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.dataframe th {
|
||||
background-color: var(--background);
|
||||
color: var(--header-text-color);
|
||||
}
|
||||
|
||||
table.dataframe td {
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.dataframe th.bottomBorder {
|
||||
border-bottom-color: var(--bold-border-color);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(odd) {
|
||||
background: var(--background-odd);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(even) {
|
||||
background: var(--background);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:hover {
|
||||
background: var(--background-hover);
|
||||
}
|
||||
|
||||
table.dataframe a {
|
||||
cursor: pointer;
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.dataframe tr:hover > td a {
|
||||
color: var(--link-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe a:hover {
|
||||
color: var(--link-hover);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
table.dataframe img {
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
table.dataframe th.complex {
|
||||
background-color: var(--background);
|
||||
border: 1px solid var(--background);
|
||||
}
|
||||
|
||||
table.dataframe .leftBorder {
|
||||
border-left-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightBorder {
|
||||
border-right-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightAlign {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table.dataframe .expanderSvg {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
table.dataframe .expander {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* formatting */
|
||||
|
||||
table.dataframe .null {
|
||||
color: var(--text-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe .structural {
|
||||
color: var(--text-color-medium);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .dataFrameCaption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .numbers {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe td:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe tr:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
font-family: "JetBrains Mono",SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
|
||||
}
|
||||
|
||||
:root {
|
||||
color: #19191C;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
:root[theme="dark"] {
|
||||
background-color: #19191C;
|
||||
color: #FFFFFFCC
|
||||
}
|
||||
|
||||
details details {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
summary {
|
||||
padding: 6px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="dataframe" id="df_0"></table>
|
||||
|
||||
<p class="dataframe_description">... showing only top 20 of 562 rows</p><p class="dataframe_description"></p>
|
||||
</body>
|
||||
<script>
|
||||
(function () {
|
||||
window.DataFrame = window.DataFrame || new (function () {
|
||||
this.addTable = function (df) {
|
||||
let cols = df.cols;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
for (let c of cols[i].children) {
|
||||
cols[c].parent = i;
|
||||
}
|
||||
}
|
||||
df.nrow = 0
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
if (df.cols[i].values.length > df.nrow) df.nrow = df.cols[i].values.length
|
||||
}
|
||||
if (df.id === df.rootId) {
|
||||
df.expandedFrames = new Set()
|
||||
df.childFrames = {}
|
||||
const table = this.getTableElement(df.id)
|
||||
table.df = df
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
let col = df.cols[i]
|
||||
if (col.parent === undefined && col.children.length > 0) col.expanded = true
|
||||
}
|
||||
} else {
|
||||
const rootDf = this.getTableData(df.rootId)
|
||||
rootDf.childFrames[df.id] = df
|
||||
}
|
||||
}
|
||||
|
||||
this.computeRenderData = function (df) {
|
||||
let result = []
|
||||
let pos = 0
|
||||
for (let col = 0; col < df.cols.length; col++) {
|
||||
if (df.cols[col].parent === undefined)
|
||||
pos += this.computeRenderDataRec(df.cols, col, pos, 0, result, false, false)
|
||||
}
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let row = result[i]
|
||||
for (let j = 0; j < row.length; j++) {
|
||||
let cell = row[j]
|
||||
if (j === 0)
|
||||
cell.leftBd = false
|
||||
if (j < row.length - 1) {
|
||||
let nextData = row[j + 1]
|
||||
if (nextData.leftBd) cell.rightBd = true
|
||||
else if (cell.rightBd) nextData.leftBd = true
|
||||
} else cell.rightBd = false
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
this.computeRenderDataRec = function (cols, colId, pos, depth, result, leftBorder, rightBorder) {
|
||||
if (result.length === depth) {
|
||||
const array = [];
|
||||
if (pos > 0) {
|
||||
let j = 0
|
||||
for (let i = 0; j < pos; i++) {
|
||||
let c = result[depth - 1][i]
|
||||
j += c.span
|
||||
let copy = Object.assign({empty: true}, c)
|
||||
array.push(copy)
|
||||
}
|
||||
}
|
||||
result.push(array)
|
||||
}
|
||||
const col = cols[colId];
|
||||
let size = 0;
|
||||
if (col.expanded) {
|
||||
let childPos = pos
|
||||
for (let i = 0; i < col.children.length; i++) {
|
||||
let child = col.children[i]
|
||||
let childLeft = i === 0 && (col.children.length > 1 || leftBorder)
|
||||
let childRight = i === col.children.length - 1 && (col.children.length > 1 || rightBorder)
|
||||
let childSize = this.computeRenderDataRec(cols, child, childPos, depth + 1, result, childLeft, childRight)
|
||||
childPos += childSize
|
||||
size += childSize
|
||||
}
|
||||
} else {
|
||||
for (let i = depth + 1; i < result.length; i++)
|
||||
result[i].push({id: colId, span: 1, leftBd: leftBorder, rightBd: rightBorder, empty: true})
|
||||
size = 1
|
||||
}
|
||||
let left = leftBorder
|
||||
let right = rightBorder
|
||||
if (size > 1) {
|
||||
left = true
|
||||
right = true
|
||||
}
|
||||
result[depth].push({id: colId, span: size, leftBd: left, rightBd: right})
|
||||
return size
|
||||
}
|
||||
|
||||
this.getTableElement = function (id) {
|
||||
return document.getElementById("df_" + id)
|
||||
}
|
||||
|
||||
this.getTableData = function (id) {
|
||||
return this.getTableElement(id).df
|
||||
}
|
||||
|
||||
this.createExpander = function (isExpanded) {
|
||||
const svgNs = "http://www.w3.org/2000/svg"
|
||||
let svg = document.createElementNS(svgNs, "svg")
|
||||
svg.classList.add("expanderSvg")
|
||||
let path = document.createElementNS(svgNs, "path")
|
||||
if (isExpanded) {
|
||||
svg.setAttribute("viewBox", "0 -2 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 4 4 4 -4 -1 -1 -3 3Z")
|
||||
} else {
|
||||
svg.setAttribute("viewBox", "-2 0 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 3 3 -3 3 1 1 4 -4Z")
|
||||
}
|
||||
path.setAttribute("fill", "currentColor")
|
||||
svg.appendChild(path)
|
||||
return svg
|
||||
}
|
||||
|
||||
this.renderTable = function (id) {
|
||||
|
||||
let table = this.getTableElement(id)
|
||||
|
||||
if (table === null) return
|
||||
|
||||
table.innerHTML = ""
|
||||
|
||||
let df = table.df
|
||||
let rootDf = df.rootId === df.id ? df : this.getTableData(df.rootId)
|
||||
|
||||
// header
|
||||
let header = document.createElement("thead")
|
||||
table.appendChild(header)
|
||||
|
||||
let renderData = this.computeRenderData(df)
|
||||
for (let j = 0; j < renderData.length; j++) {
|
||||
let rowData = renderData[j]
|
||||
let tr = document.createElement("tr");
|
||||
let isLastRow = j === renderData.length - 1
|
||||
header.appendChild(tr);
|
||||
for (let i = 0; i < rowData.length; i++) {
|
||||
let cell = rowData[i]
|
||||
let th = document.createElement("th");
|
||||
th.setAttribute("colspan", cell.span)
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId];
|
||||
if (!cell.empty) {
|
||||
if (col.children.length === 0) {
|
||||
th.innerHTML = col.name
|
||||
} else {
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
col.expanded = !col.expanded
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(col.expanded))
|
||||
link.innerHTML += col.name
|
||||
th.appendChild(link)
|
||||
}
|
||||
}
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (isLastRow)
|
||||
classes += " bottomBorder"
|
||||
if (classes.length > 0)
|
||||
th.setAttribute("class", classes)
|
||||
tr.appendChild(th)
|
||||
}
|
||||
}
|
||||
|
||||
// body
|
||||
let body = document.createElement("tbody")
|
||||
table.appendChild(body)
|
||||
|
||||
let columns = renderData.pop()
|
||||
for (let row = 0; row < df.nrow; row++) {
|
||||
let tr = document.createElement("tr");
|
||||
body.appendChild(tr)
|
||||
for (let i = 0; i < columns.length; i++) {
|
||||
let cell = columns[i]
|
||||
let td = document.createElement("td");
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId]
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (classes.length > 0)
|
||||
td.setAttribute("class", classes)
|
||||
tr.appendChild(td)
|
||||
let value = col.values[row]
|
||||
if (value.frameId !== undefined) {
|
||||
let frameId = value.frameId
|
||||
let expanded = rootDf.expandedFrames.has(frameId)
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
if (rootDf.expandedFrames.has(frameId))
|
||||
rootDf.expandedFrames.delete(frameId)
|
||||
else rootDf.expandedFrames.add(frameId)
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(expanded))
|
||||
link.innerHTML += value.value
|
||||
if (expanded) {
|
||||
td.appendChild(link)
|
||||
td.appendChild(document.createElement("p"))
|
||||
const childTable = document.createElement("table")
|
||||
childTable.className = "dataframe"
|
||||
childTable.id = "df_" + frameId
|
||||
let childDf = rootDf.childFrames[frameId]
|
||||
childTable.df = childDf
|
||||
td.appendChild(childTable)
|
||||
this.renderTable(frameId)
|
||||
if (childDf.nrow !== childDf.totalRows) {
|
||||
const footer = document.createElement("p")
|
||||
footer.innerText = `... showing only top ${childDf.nrow} of ${childDf.totalRows} rows`
|
||||
td.appendChild(footer)
|
||||
}
|
||||
} else {
|
||||
td.appendChild(link)
|
||||
}
|
||||
} else if (value.style !== undefined) {
|
||||
td.innerHTML = value.value
|
||||
td.setAttribute("style", value.style)
|
||||
} else td.innerHTML = value
|
||||
this.nodeScriptReplace(td)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.nodeScriptReplace = function (node) {
|
||||
if (this.nodeScriptIs(node) === true) {
|
||||
node.parentNode.replaceChild(this.nodeScriptClone(node), node);
|
||||
} else {
|
||||
let i = -1, children = node.childNodes;
|
||||
while (++i < children.length) {
|
||||
this.nodeScriptReplace(children[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
this.nodeScriptClone = function (node) {
|
||||
let script = document.createElement("script");
|
||||
script.text = node.innerHTML;
|
||||
|
||||
let i = -1, attrs = node.attributes, attr;
|
||||
while (++i < attrs.length) {
|
||||
script.setAttribute((attr = attrs[i]).name, attr.value);
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
this.nodeScriptIs = function (node) {
|
||||
return node.tagName === 'SCRIPT';
|
||||
}
|
||||
})()
|
||||
|
||||
window.call_DataFrame = function (f) {
|
||||
return f();
|
||||
};
|
||||
|
||||
let funQueue = window["kotlinQueues"] && window["kotlinQueues"]["DataFrame"];
|
||||
if (funQueue) {
|
||||
funQueue.forEach(function (f) {
|
||||
f();
|
||||
});
|
||||
funQueue = [];
|
||||
}
|
||||
})()
|
||||
|
||||
/*<!--*/
|
||||
call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: "<span title=\"full_name: String\">full_name</span>", children: [], rightAlign: false, values: ["JetBrains/JPS","JetBrains/YouTrackSharp","JetBrains/colorSchemeTool","JetBrains/ideavim","JetBrains/youtrack-vcs-hooks","JetBrains/youtrack-rest-ruby-library","JetBrains/emacs4ij","JetBrains/codereview4intellij","JetBrains/teamcity-nuget-support","JetBrains/Grammar-Kit","JetBrains/intellij-starteam-plugin","JetBrains/la-clojure","JetBrains/MPS","JetBrains/intellij-community","JetBrains/TeamCity.ServiceMessages","JetBrains/youtrack-rest-python-library","JetBrains/intellij-scala","JetBrains/teamcity-messages","JetBrains/teamcity-cpp","JetBrains/kotlin"] },
|
||||
{ name: "<span title=\"stargazers_count: Int\">stargazers_count</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">23</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">115</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">290</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">6120</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">5</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">8</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">47</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">11</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">41</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">534</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">6</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">218</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1241</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">12926</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">39</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">118</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1066</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">125</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">27</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">39402</span></span>"] },
|
||||
{ name: "<span title=\"topics: String\">topics</span>", children: [], rightAlign: false, values: ["[]","<span class=\"formatted\" title=\"[jetbrains, jetbrains-youtrack, youtrack, youtrack-api]\">[jetbrains, jetbrains-youtrack, youtr<span class=\"structural\">...</span></span>","[]","<span class=\"formatted\" title=\"[ideavim, intellij, intellij-platform, jb-official, kotlin, vim, vim-emulator]\">[ideavim, intellij, intellij-platform<span class=\"structural\">...</span></span>","[]","[]","[]","[]","<span class=\"formatted\" title=\"[nuget, nuget-feed, teamcity, teamcity-plugin]\">[nuget, nuget-feed, teamcity, teamcit<span class=\"structural\">...</span></span>","[]","[]","[]","[domain-specific-language, dsl]","<span class=\"formatted\" title=\"[code-editor, ide, intellij, intellij-community, intellij-platform]\">[code-editor, ide, intellij, intellij<span class=\"structural\">...</span></span>","<span class=\"formatted\" title=\"[c-sharp, teamcity, teamcity-service-messages]\">[c-sharp, teamcity, teamcity-service-<span class=\"structural\">...</span></span>","[]","[intellij-idea, intellij-plugin, scala]","[]","[]","<span class=\"formatted\" title=\"[compiler, gradle-plugin, intellij-plugin, kotlin, kotlin-library, maven-plugin, programming-language]\">[compiler, gradle-plugin, intellij-pl<span class=\"structural\">...</span></span>"] },
|
||||
], id: 0, rootId: 0, totalRows: 562 } ) });
|
||||
/*-->*/
|
||||
|
||||
call_DataFrame(function() { DataFrame.renderTable(0) });
|
||||
|
||||
function sendHeight() {
|
||||
const table = document.querySelector('table.dataframe');
|
||||
if (!table) return;
|
||||
|
||||
let height = 0;
|
||||
|
||||
const thead = table.querySelector('thead');
|
||||
if (thead) height += thead.offsetHeight;
|
||||
|
||||
const rows = table.querySelectorAll(':scope > tbody > tr');
|
||||
rows.forEach(row => {
|
||||
height += row.offsetHeight;
|
||||
});
|
||||
|
||||
height += getVerticalMargins(table) + 10;
|
||||
|
||||
window.parent.postMessage({ type: 'iframeHeight', height: Math.ceil(height) }, '*');
|
||||
}
|
||||
|
||||
function getVerticalMargins(element) {
|
||||
const style = getComputedStyle(element);
|
||||
return parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
||||
}
|
||||
|
||||
function repeatHeightCalculation(maxRetries = 10, interval = 100) {
|
||||
let retries = 0;
|
||||
const intervalId = setInterval(() => {
|
||||
sendHeight();
|
||||
retries++;
|
||||
if (retries >= maxRetries) clearInterval(intervalId);
|
||||
}, interval);
|
||||
}
|
||||
|
||||
window.addEventListener('load', repeatHeightCalculation);
|
||||
|
||||
const observer = new MutationObserver(() => repeatHeightCalculation(5, 50));
|
||||
observer.observe(document.querySelector('.dataframe'), {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
characterData: true,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</html>
|
||||
+512
@@ -0,0 +1,512 @@
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
:root {
|
||||
--background: #fff;
|
||||
--background-odd: #f5f5f5;
|
||||
--background-hover: #d9edfd;
|
||||
--header-text-color: #474747;
|
||||
--text-color: #848484;
|
||||
--text-color-dark: #000;
|
||||
--text-color-medium: #737373;
|
||||
--text-color-pale: #b3b3b3;
|
||||
--inner-border-color: #aaa;
|
||||
--bold-border-color: #000;
|
||||
--link-color: #296eaa;
|
||||
--link-color-pale: #296eaa;
|
||||
--link-hover: #1a466c;
|
||||
}
|
||||
|
||||
:root[theme="dark"], :root [data-jp-theme-light="false"], .dataframe_dark{
|
||||
--background: #303030;
|
||||
--background-odd: #3c3c3c;
|
||||
--background-hover: #464646;
|
||||
--header-text-color: #dddddd;
|
||||
--text-color: #b3b3b3;
|
||||
--text-color-dark: #dddddd;
|
||||
--text-color-medium: #b2b2b2;
|
||||
--text-color-pale: #737373;
|
||||
--inner-border-color: #707070;
|
||||
--bold-border-color: #777777;
|
||||
--link-color: #008dc0;
|
||||
--link-color-pale: #97e1fb;
|
||||
--link-hover: #00688e;
|
||||
}
|
||||
|
||||
p.dataframe_description {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: var(--background);
|
||||
color: var(--text-color-dark);
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.dataframe th, td {
|
||||
padding: 6px;
|
||||
border: 1px solid transparent;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.dataframe th {
|
||||
background-color: var(--background);
|
||||
color: var(--header-text-color);
|
||||
}
|
||||
|
||||
table.dataframe td {
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.dataframe th.bottomBorder {
|
||||
border-bottom-color: var(--bold-border-color);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(odd) {
|
||||
background: var(--background-odd);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(even) {
|
||||
background: var(--background);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:hover {
|
||||
background: var(--background-hover);
|
||||
}
|
||||
|
||||
table.dataframe a {
|
||||
cursor: pointer;
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.dataframe tr:hover > td a {
|
||||
color: var(--link-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe a:hover {
|
||||
color: var(--link-hover);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
table.dataframe img {
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
table.dataframe th.complex {
|
||||
background-color: var(--background);
|
||||
border: 1px solid var(--background);
|
||||
}
|
||||
|
||||
table.dataframe .leftBorder {
|
||||
border-left-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightBorder {
|
||||
border-right-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightAlign {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table.dataframe .expanderSvg {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
table.dataframe .expander {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* formatting */
|
||||
|
||||
table.dataframe .null {
|
||||
color: var(--text-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe .structural {
|
||||
color: var(--text-color-medium);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .dataFrameCaption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .numbers {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe td:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe tr:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
font-family: "JetBrains Mono",SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
|
||||
}
|
||||
|
||||
:root {
|
||||
color: #19191C;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
:root[theme="dark"] {
|
||||
background-color: #19191C;
|
||||
color: #FFFFFFCC
|
||||
}
|
||||
|
||||
details details {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
summary {
|
||||
padding: 6px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="dataframe" id="df_0"></table>
|
||||
|
||||
<p class="dataframe_description">... showing only top 20 of 24 rows</p><p class="dataframe_description"></p>
|
||||
</body>
|
||||
<script>
|
||||
(function () {
|
||||
window.DataFrame = window.DataFrame || new (function () {
|
||||
this.addTable = function (df) {
|
||||
let cols = df.cols;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
for (let c of cols[i].children) {
|
||||
cols[c].parent = i;
|
||||
}
|
||||
}
|
||||
df.nrow = 0
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
if (df.cols[i].values.length > df.nrow) df.nrow = df.cols[i].values.length
|
||||
}
|
||||
if (df.id === df.rootId) {
|
||||
df.expandedFrames = new Set()
|
||||
df.childFrames = {}
|
||||
const table = this.getTableElement(df.id)
|
||||
table.df = df
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
let col = df.cols[i]
|
||||
if (col.parent === undefined && col.children.length > 0) col.expanded = true
|
||||
}
|
||||
} else {
|
||||
const rootDf = this.getTableData(df.rootId)
|
||||
rootDf.childFrames[df.id] = df
|
||||
}
|
||||
}
|
||||
|
||||
this.computeRenderData = function (df) {
|
||||
let result = []
|
||||
let pos = 0
|
||||
for (let col = 0; col < df.cols.length; col++) {
|
||||
if (df.cols[col].parent === undefined)
|
||||
pos += this.computeRenderDataRec(df.cols, col, pos, 0, result, false, false)
|
||||
}
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let row = result[i]
|
||||
for (let j = 0; j < row.length; j++) {
|
||||
let cell = row[j]
|
||||
if (j === 0)
|
||||
cell.leftBd = false
|
||||
if (j < row.length - 1) {
|
||||
let nextData = row[j + 1]
|
||||
if (nextData.leftBd) cell.rightBd = true
|
||||
else if (cell.rightBd) nextData.leftBd = true
|
||||
} else cell.rightBd = false
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
this.computeRenderDataRec = function (cols, colId, pos, depth, result, leftBorder, rightBorder) {
|
||||
if (result.length === depth) {
|
||||
const array = [];
|
||||
if (pos > 0) {
|
||||
let j = 0
|
||||
for (let i = 0; j < pos; i++) {
|
||||
let c = result[depth - 1][i]
|
||||
j += c.span
|
||||
let copy = Object.assign({empty: true}, c)
|
||||
array.push(copy)
|
||||
}
|
||||
}
|
||||
result.push(array)
|
||||
}
|
||||
const col = cols[colId];
|
||||
let size = 0;
|
||||
if (col.expanded) {
|
||||
let childPos = pos
|
||||
for (let i = 0; i < col.children.length; i++) {
|
||||
let child = col.children[i]
|
||||
let childLeft = i === 0 && (col.children.length > 1 || leftBorder)
|
||||
let childRight = i === col.children.length - 1 && (col.children.length > 1 || rightBorder)
|
||||
let childSize = this.computeRenderDataRec(cols, child, childPos, depth + 1, result, childLeft, childRight)
|
||||
childPos += childSize
|
||||
size += childSize
|
||||
}
|
||||
} else {
|
||||
for (let i = depth + 1; i < result.length; i++)
|
||||
result[i].push({id: colId, span: 1, leftBd: leftBorder, rightBd: rightBorder, empty: true})
|
||||
size = 1
|
||||
}
|
||||
let left = leftBorder
|
||||
let right = rightBorder
|
||||
if (size > 1) {
|
||||
left = true
|
||||
right = true
|
||||
}
|
||||
result[depth].push({id: colId, span: size, leftBd: left, rightBd: right})
|
||||
return size
|
||||
}
|
||||
|
||||
this.getTableElement = function (id) {
|
||||
return document.getElementById("df_" + id)
|
||||
}
|
||||
|
||||
this.getTableData = function (id) {
|
||||
return this.getTableElement(id).df
|
||||
}
|
||||
|
||||
this.createExpander = function (isExpanded) {
|
||||
const svgNs = "http://www.w3.org/2000/svg"
|
||||
let svg = document.createElementNS(svgNs, "svg")
|
||||
svg.classList.add("expanderSvg")
|
||||
let path = document.createElementNS(svgNs, "path")
|
||||
if (isExpanded) {
|
||||
svg.setAttribute("viewBox", "0 -2 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 4 4 4 -4 -1 -1 -3 3Z")
|
||||
} else {
|
||||
svg.setAttribute("viewBox", "-2 0 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 3 3 -3 3 1 1 4 -4Z")
|
||||
}
|
||||
path.setAttribute("fill", "currentColor")
|
||||
svg.appendChild(path)
|
||||
return svg
|
||||
}
|
||||
|
||||
this.renderTable = function (id) {
|
||||
|
||||
let table = this.getTableElement(id)
|
||||
|
||||
if (table === null) return
|
||||
|
||||
table.innerHTML = ""
|
||||
|
||||
let df = table.df
|
||||
let rootDf = df.rootId === df.id ? df : this.getTableData(df.rootId)
|
||||
|
||||
// header
|
||||
let header = document.createElement("thead")
|
||||
table.appendChild(header)
|
||||
|
||||
let renderData = this.computeRenderData(df)
|
||||
for (let j = 0; j < renderData.length; j++) {
|
||||
let rowData = renderData[j]
|
||||
let tr = document.createElement("tr");
|
||||
let isLastRow = j === renderData.length - 1
|
||||
header.appendChild(tr);
|
||||
for (let i = 0; i < rowData.length; i++) {
|
||||
let cell = rowData[i]
|
||||
let th = document.createElement("th");
|
||||
th.setAttribute("colspan", cell.span)
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId];
|
||||
if (!cell.empty) {
|
||||
if (col.children.length === 0) {
|
||||
th.innerHTML = col.name
|
||||
} else {
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
col.expanded = !col.expanded
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(col.expanded))
|
||||
link.innerHTML += col.name
|
||||
th.appendChild(link)
|
||||
}
|
||||
}
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (isLastRow)
|
||||
classes += " bottomBorder"
|
||||
if (classes.length > 0)
|
||||
th.setAttribute("class", classes)
|
||||
tr.appendChild(th)
|
||||
}
|
||||
}
|
||||
|
||||
// body
|
||||
let body = document.createElement("tbody")
|
||||
table.appendChild(body)
|
||||
|
||||
let columns = renderData.pop()
|
||||
for (let row = 0; row < df.nrow; row++) {
|
||||
let tr = document.createElement("tr");
|
||||
body.appendChild(tr)
|
||||
for (let i = 0; i < columns.length; i++) {
|
||||
let cell = columns[i]
|
||||
let td = document.createElement("td");
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId]
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (classes.length > 0)
|
||||
td.setAttribute("class", classes)
|
||||
tr.appendChild(td)
|
||||
let value = col.values[row]
|
||||
if (value.frameId !== undefined) {
|
||||
let frameId = value.frameId
|
||||
let expanded = rootDf.expandedFrames.has(frameId)
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
if (rootDf.expandedFrames.has(frameId))
|
||||
rootDf.expandedFrames.delete(frameId)
|
||||
else rootDf.expandedFrames.add(frameId)
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(expanded))
|
||||
link.innerHTML += value.value
|
||||
if (expanded) {
|
||||
td.appendChild(link)
|
||||
td.appendChild(document.createElement("p"))
|
||||
const childTable = document.createElement("table")
|
||||
childTable.className = "dataframe"
|
||||
childTable.id = "df_" + frameId
|
||||
let childDf = rootDf.childFrames[frameId]
|
||||
childTable.df = childDf
|
||||
td.appendChild(childTable)
|
||||
this.renderTable(frameId)
|
||||
if (childDf.nrow !== childDf.totalRows) {
|
||||
const footer = document.createElement("p")
|
||||
footer.innerText = `... showing only top ${childDf.nrow} of ${childDf.totalRows} rows`
|
||||
td.appendChild(footer)
|
||||
}
|
||||
} else {
|
||||
td.appendChild(link)
|
||||
}
|
||||
} else if (value.style !== undefined) {
|
||||
td.innerHTML = value.value
|
||||
td.setAttribute("style", value.style)
|
||||
} else td.innerHTML = value
|
||||
this.nodeScriptReplace(td)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.nodeScriptReplace = function (node) {
|
||||
if (this.nodeScriptIs(node) === true) {
|
||||
node.parentNode.replaceChild(this.nodeScriptClone(node), node);
|
||||
} else {
|
||||
let i = -1, children = node.childNodes;
|
||||
while (++i < children.length) {
|
||||
this.nodeScriptReplace(children[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
this.nodeScriptClone = function (node) {
|
||||
let script = document.createElement("script");
|
||||
script.text = node.innerHTML;
|
||||
|
||||
let i = -1, attrs = node.attributes, attr;
|
||||
while (++i < attrs.length) {
|
||||
script.setAttribute((attr = attrs[i]).name, attr.value);
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
this.nodeScriptIs = function (node) {
|
||||
return node.tagName === 'SCRIPT';
|
||||
}
|
||||
})()
|
||||
|
||||
window.call_DataFrame = function (f) {
|
||||
return f();
|
||||
};
|
||||
|
||||
let funQueue = window["kotlinQueues"] && window["kotlinQueues"]["DataFrame"];
|
||||
if (funQueue) {
|
||||
funQueue.forEach(function (f) {
|
||||
f();
|
||||
});
|
||||
funQueue = [];
|
||||
}
|
||||
})()
|
||||
|
||||
/*<!--*/
|
||||
call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: "<span title=\"full_name: String\">full_name</span>", children: [], rightAlign: false, values: ["JetBrains/ideavim","JetBrains/MPS","JetBrains/intellij-community","JetBrains/intellij-scala","JetBrains/kotlin","JetBrains/intellij-plugins","JetBrains/Exposed","JetBrains/kotlin-web-site","JetBrains/idea-gitignore","JetBrains/swot","JetBrains/phpstorm-stubs","JetBrains/gradle-intellij-plugin","JetBrains/svg-sprite-loader","JetBrains/resharper-unity","JetBrains/kotlin-native","JetBrains/create-react-kotlin-app","JetBrains/ring-ui","JetBrains/kotlinconf-app","JetBrains/JetBrainsMono","<span class=\"formatted\" title=\"JetBrains/intellij-platform-plugin-template\">JetBrains/intellij-platform-plugin-te<span class=\"structural\">...</span></span>"] },
|
||||
{ name: "<span title=\"stargazers_count: Int\">stargazers_count</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">6120</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1241</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">12926</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1066</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">39402</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1737</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">5688</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1074</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1181</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1072</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1110</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1058</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1815</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1017</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">7101</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">2424</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">2836</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">2628</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">6059</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1133</span></span>"] },
|
||||
{ name: "<span title=\"topics: String\">topics</span>", children: [], rightAlign: false, values: ["<span class=\"formatted\" title=\"[ideavim, intellij, intellij-platform, jb-official, kotlin, vim, vim-emulator]\">[ideavim, intellij, intellij-platform<span class=\"structural\">...</span></span>","[domain-specific-language, dsl]","<span class=\"formatted\" title=\"[code-editor, ide, intellij, intellij-community, intellij-platform]\">[code-editor, ide, intellij, intellij<span class=\"structural\">...</span></span>","[intellij-idea, intellij-plugin, scala]","<span class=\"formatted\" title=\"[compiler, gradle-plugin, intellij-plugin, kotlin, kotlin-library, maven-plugin, programming-language]\">[compiler, gradle-plugin, intellij-pl<span class=\"structural\">...</span></span>","[]","[dao, kotlin, orm, sql]","[kotlin]","<span class=\"formatted\" title=\"[gitignore, ignore-files, intellij, intellij-plugin, java]\">[gitignore, ignore-files, intellij, i<span class=\"structural\">...</span></span>","[]","[]","<span class=\"formatted\" title=\"[gradle, gradle-intellij-plugin, gradle-kotlin-dsl, groovy, intellij, intellij-ides, intellij-platform, intellij-plugin, intellij-sdk, jetbrains-plugin, kotlin, plugin-verifier, publishing-dsl, setup-dsl, teamcity, travis-configuration]\">[gradle, gradle-intellij-plugin, grad<span class=\"structural\">...</span></span>","<span class=\"formatted\" title=\"[sprite, svg, svg-sprite, svg-stack, webpack, webpack-loader, webpack-plugin, webpack2, webpack3]\">[sprite, svg, svg-sprite, svg-stack, <span class=\"structural\">...</span></span>","<span class=\"formatted\" title=\"[hacktoberfest, jetbrains, plugin, resharper, resharper-plugin, rider, unity, unity-editor]\">[hacktoberfest, jetbrains, plugin, re<span class=\"structural\">...</span></span>","[c, compiler, kotlin, llvm, objective-c]","<span class=\"formatted\" title=\"[create-react-app, jetbrains-ui, kotlin, react, webpack]\">[create-react-app, jetbrains-ui, kotl<span class=\"structural\">...</span></span>","[components, jetbrains-ui, react]","[]","<span class=\"formatted\" title=\"[coding-font, font, ligatures, monospaced-font, programming-font, programming-ligatures]\">[coding-font, font, ligatures, monosp<span class=\"structural\">...</span></span>","<span class=\"formatted\" title=\"[intellij, intellij-idea, intellij-idea-plugin, intellij-platform, intellij-plugin, intellij-plugins, jetbrains-plugin]\">[intellij, intellij-idea, intellij-id<span class=\"structural\">...</span></span>"] },
|
||||
], id: 0, rootId: 0, totalRows: 24 } ) });
|
||||
/*-->*/
|
||||
|
||||
call_DataFrame(function() { DataFrame.renderTable(0) });
|
||||
|
||||
function sendHeight() {
|
||||
const table = document.querySelector('table.dataframe');
|
||||
if (!table) return;
|
||||
|
||||
let height = 0;
|
||||
|
||||
const thead = table.querySelector('thead');
|
||||
if (thead) height += thead.offsetHeight;
|
||||
|
||||
const rows = table.querySelectorAll(':scope > tbody > tr');
|
||||
rows.forEach(row => {
|
||||
height += row.offsetHeight;
|
||||
});
|
||||
|
||||
height += getVerticalMargins(table) + 10;
|
||||
|
||||
window.parent.postMessage({ type: 'iframeHeight', height: Math.ceil(height) }, '*');
|
||||
}
|
||||
|
||||
function getVerticalMargins(element) {
|
||||
const style = getComputedStyle(element);
|
||||
return parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
||||
}
|
||||
|
||||
function repeatHeightCalculation(maxRetries = 10, interval = 100) {
|
||||
let retries = 0;
|
||||
const intervalId = setInterval(() => {
|
||||
sendHeight();
|
||||
retries++;
|
||||
if (retries >= maxRetries) clearInterval(intervalId);
|
||||
}, interval);
|
||||
}
|
||||
|
||||
window.addEventListener('load', repeatHeightCalculation);
|
||||
|
||||
const observer = new MutationObserver(() => repeatHeightCalculation(5, 50));
|
||||
observer.observe(document.querySelector('.dataframe'), {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
characterData: true,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</html>
|
||||
+512
@@ -0,0 +1,512 @@
|
||||
<html>
|
||||
<head>
|
||||
<style type="text/css">
|
||||
:root {
|
||||
--background: #fff;
|
||||
--background-odd: #f5f5f5;
|
||||
--background-hover: #d9edfd;
|
||||
--header-text-color: #474747;
|
||||
--text-color: #848484;
|
||||
--text-color-dark: #000;
|
||||
--text-color-medium: #737373;
|
||||
--text-color-pale: #b3b3b3;
|
||||
--inner-border-color: #aaa;
|
||||
--bold-border-color: #000;
|
||||
--link-color: #296eaa;
|
||||
--link-color-pale: #296eaa;
|
||||
--link-hover: #1a466c;
|
||||
}
|
||||
|
||||
:root[theme="dark"], :root [data-jp-theme-light="false"], .dataframe_dark{
|
||||
--background: #303030;
|
||||
--background-odd: #3c3c3c;
|
||||
--background-hover: #464646;
|
||||
--header-text-color: #dddddd;
|
||||
--text-color: #b3b3b3;
|
||||
--text-color-dark: #dddddd;
|
||||
--text-color-medium: #b2b2b2;
|
||||
--text-color-pale: #737373;
|
||||
--inner-border-color: #707070;
|
||||
--bold-border-color: #777777;
|
||||
--link-color: #008dc0;
|
||||
--link-color-pale: #97e1fb;
|
||||
--link-hover: #00688e;
|
||||
}
|
||||
|
||||
p.dataframe_description {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe {
|
||||
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-size: 12px;
|
||||
background-color: var(--background);
|
||||
color: var(--text-color-dark);
|
||||
border: none;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
table.dataframe th, td {
|
||||
padding: 6px;
|
||||
border: 1px solid transparent;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.dataframe th {
|
||||
background-color: var(--background);
|
||||
color: var(--header-text-color);
|
||||
}
|
||||
|
||||
table.dataframe td {
|
||||
vertical-align: top;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.dataframe th.bottomBorder {
|
||||
border-bottom-color: var(--bold-border-color);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(odd) {
|
||||
background: var(--background-odd);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:nth-child(even) {
|
||||
background: var(--background);
|
||||
}
|
||||
|
||||
table.dataframe tbody > tr:hover {
|
||||
background: var(--background-hover);
|
||||
}
|
||||
|
||||
table.dataframe a {
|
||||
cursor: pointer;
|
||||
color: var(--link-color);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.dataframe tr:hover > td a {
|
||||
color: var(--link-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe a:hover {
|
||||
color: var(--link-hover);
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
table.dataframe img {
|
||||
max-width: fit-content;
|
||||
}
|
||||
|
||||
table.dataframe th.complex {
|
||||
background-color: var(--background);
|
||||
border: 1px solid var(--background);
|
||||
}
|
||||
|
||||
table.dataframe .leftBorder {
|
||||
border-left-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightBorder {
|
||||
border-right-color: var(--inner-border-color);
|
||||
}
|
||||
|
||||
table.dataframe .rightAlign {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
table.dataframe .expanderSvg {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
||||
table.dataframe .expander {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* formatting */
|
||||
|
||||
table.dataframe .null {
|
||||
color: var(--text-color-pale);
|
||||
}
|
||||
|
||||
table.dataframe .structural {
|
||||
color: var(--text-color-medium);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .dataFrameCaption {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.dataframe .numbers {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe td:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
table.dataframe tr:hover .formatted .structural, .null {
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
font-family: "JetBrains Mono",SFMono-Regular,Consolas,"Liberation Mono",Menlo,Courier,monospace;
|
||||
}
|
||||
|
||||
:root {
|
||||
color: #19191C;
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
:root[theme="dark"] {
|
||||
background-color: #19191C;
|
||||
color: #FFFFFFCC
|
||||
}
|
||||
|
||||
details details {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
summary {
|
||||
padding: 6px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<table class="dataframe" id="df_0"></table>
|
||||
|
||||
<p class="dataframe_description">... showing only top 20 of 24 rows</p><p class="dataframe_description"></p>
|
||||
</body>
|
||||
<script>
|
||||
(function () {
|
||||
window.DataFrame = window.DataFrame || new (function () {
|
||||
this.addTable = function (df) {
|
||||
let cols = df.cols;
|
||||
for (let i = 0; i < cols.length; i++) {
|
||||
for (let c of cols[i].children) {
|
||||
cols[c].parent = i;
|
||||
}
|
||||
}
|
||||
df.nrow = 0
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
if (df.cols[i].values.length > df.nrow) df.nrow = df.cols[i].values.length
|
||||
}
|
||||
if (df.id === df.rootId) {
|
||||
df.expandedFrames = new Set()
|
||||
df.childFrames = {}
|
||||
const table = this.getTableElement(df.id)
|
||||
table.df = df
|
||||
for (let i = 0; i < df.cols.length; i++) {
|
||||
let col = df.cols[i]
|
||||
if (col.parent === undefined && col.children.length > 0) col.expanded = true
|
||||
}
|
||||
} else {
|
||||
const rootDf = this.getTableData(df.rootId)
|
||||
rootDf.childFrames[df.id] = df
|
||||
}
|
||||
}
|
||||
|
||||
this.computeRenderData = function (df) {
|
||||
let result = []
|
||||
let pos = 0
|
||||
for (let col = 0; col < df.cols.length; col++) {
|
||||
if (df.cols[col].parent === undefined)
|
||||
pos += this.computeRenderDataRec(df.cols, col, pos, 0, result, false, false)
|
||||
}
|
||||
for (let i = 0; i < result.length; i++) {
|
||||
let row = result[i]
|
||||
for (let j = 0; j < row.length; j++) {
|
||||
let cell = row[j]
|
||||
if (j === 0)
|
||||
cell.leftBd = false
|
||||
if (j < row.length - 1) {
|
||||
let nextData = row[j + 1]
|
||||
if (nextData.leftBd) cell.rightBd = true
|
||||
else if (cell.rightBd) nextData.leftBd = true
|
||||
} else cell.rightBd = false
|
||||
}
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
this.computeRenderDataRec = function (cols, colId, pos, depth, result, leftBorder, rightBorder) {
|
||||
if (result.length === depth) {
|
||||
const array = [];
|
||||
if (pos > 0) {
|
||||
let j = 0
|
||||
for (let i = 0; j < pos; i++) {
|
||||
let c = result[depth - 1][i]
|
||||
j += c.span
|
||||
let copy = Object.assign({empty: true}, c)
|
||||
array.push(copy)
|
||||
}
|
||||
}
|
||||
result.push(array)
|
||||
}
|
||||
const col = cols[colId];
|
||||
let size = 0;
|
||||
if (col.expanded) {
|
||||
let childPos = pos
|
||||
for (let i = 0; i < col.children.length; i++) {
|
||||
let child = col.children[i]
|
||||
let childLeft = i === 0 && (col.children.length > 1 || leftBorder)
|
||||
let childRight = i === col.children.length - 1 && (col.children.length > 1 || rightBorder)
|
||||
let childSize = this.computeRenderDataRec(cols, child, childPos, depth + 1, result, childLeft, childRight)
|
||||
childPos += childSize
|
||||
size += childSize
|
||||
}
|
||||
} else {
|
||||
for (let i = depth + 1; i < result.length; i++)
|
||||
result[i].push({id: colId, span: 1, leftBd: leftBorder, rightBd: rightBorder, empty: true})
|
||||
size = 1
|
||||
}
|
||||
let left = leftBorder
|
||||
let right = rightBorder
|
||||
if (size > 1) {
|
||||
left = true
|
||||
right = true
|
||||
}
|
||||
result[depth].push({id: colId, span: size, leftBd: left, rightBd: right})
|
||||
return size
|
||||
}
|
||||
|
||||
this.getTableElement = function (id) {
|
||||
return document.getElementById("df_" + id)
|
||||
}
|
||||
|
||||
this.getTableData = function (id) {
|
||||
return this.getTableElement(id).df
|
||||
}
|
||||
|
||||
this.createExpander = function (isExpanded) {
|
||||
const svgNs = "http://www.w3.org/2000/svg"
|
||||
let svg = document.createElementNS(svgNs, "svg")
|
||||
svg.classList.add("expanderSvg")
|
||||
let path = document.createElementNS(svgNs, "path")
|
||||
if (isExpanded) {
|
||||
svg.setAttribute("viewBox", "0 -2 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 4 4 4 -4 -1 -1 -3 3Z")
|
||||
} else {
|
||||
svg.setAttribute("viewBox", "-2 0 8 8")
|
||||
path.setAttribute("d", "M1 0 l-1 1 3 3 -3 3 1 1 4 -4Z")
|
||||
}
|
||||
path.setAttribute("fill", "currentColor")
|
||||
svg.appendChild(path)
|
||||
return svg
|
||||
}
|
||||
|
||||
this.renderTable = function (id) {
|
||||
|
||||
let table = this.getTableElement(id)
|
||||
|
||||
if (table === null) return
|
||||
|
||||
table.innerHTML = ""
|
||||
|
||||
let df = table.df
|
||||
let rootDf = df.rootId === df.id ? df : this.getTableData(df.rootId)
|
||||
|
||||
// header
|
||||
let header = document.createElement("thead")
|
||||
table.appendChild(header)
|
||||
|
||||
let renderData = this.computeRenderData(df)
|
||||
for (let j = 0; j < renderData.length; j++) {
|
||||
let rowData = renderData[j]
|
||||
let tr = document.createElement("tr");
|
||||
let isLastRow = j === renderData.length - 1
|
||||
header.appendChild(tr);
|
||||
for (let i = 0; i < rowData.length; i++) {
|
||||
let cell = rowData[i]
|
||||
let th = document.createElement("th");
|
||||
th.setAttribute("colspan", cell.span)
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId];
|
||||
if (!cell.empty) {
|
||||
if (col.children.length === 0) {
|
||||
th.innerHTML = col.name
|
||||
} else {
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
col.expanded = !col.expanded
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(col.expanded))
|
||||
link.innerHTML += col.name
|
||||
th.appendChild(link)
|
||||
}
|
||||
}
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (isLastRow)
|
||||
classes += " bottomBorder"
|
||||
if (classes.length > 0)
|
||||
th.setAttribute("class", classes)
|
||||
tr.appendChild(th)
|
||||
}
|
||||
}
|
||||
|
||||
// body
|
||||
let body = document.createElement("tbody")
|
||||
table.appendChild(body)
|
||||
|
||||
let columns = renderData.pop()
|
||||
for (let row = 0; row < df.nrow; row++) {
|
||||
let tr = document.createElement("tr");
|
||||
body.appendChild(tr)
|
||||
for (let i = 0; i < columns.length; i++) {
|
||||
let cell = columns[i]
|
||||
let td = document.createElement("td");
|
||||
let colId = cell.id
|
||||
let col = df.cols[colId]
|
||||
let classes = (cell.leftBd ? " leftBorder" : "") + (cell.rightBd ? " rightBorder" : "")
|
||||
if (col.rightAlign)
|
||||
classes += " rightAlign"
|
||||
if (classes.length > 0)
|
||||
td.setAttribute("class", classes)
|
||||
tr.appendChild(td)
|
||||
let value = col.values[row]
|
||||
if (value.frameId !== undefined) {
|
||||
let frameId = value.frameId
|
||||
let expanded = rootDf.expandedFrames.has(frameId)
|
||||
let link = document.createElement("a")
|
||||
link.className = "expander"
|
||||
let that = this
|
||||
link.onclick = function () {
|
||||
if (rootDf.expandedFrames.has(frameId))
|
||||
rootDf.expandedFrames.delete(frameId)
|
||||
else rootDf.expandedFrames.add(frameId)
|
||||
that.renderTable(id)
|
||||
}
|
||||
link.appendChild(this.createExpander(expanded))
|
||||
link.innerHTML += value.value
|
||||
if (expanded) {
|
||||
td.appendChild(link)
|
||||
td.appendChild(document.createElement("p"))
|
||||
const childTable = document.createElement("table")
|
||||
childTable.className = "dataframe"
|
||||
childTable.id = "df_" + frameId
|
||||
let childDf = rootDf.childFrames[frameId]
|
||||
childTable.df = childDf
|
||||
td.appendChild(childTable)
|
||||
this.renderTable(frameId)
|
||||
if (childDf.nrow !== childDf.totalRows) {
|
||||
const footer = document.createElement("p")
|
||||
footer.innerText = `... showing only top ${childDf.nrow} of ${childDf.totalRows} rows`
|
||||
td.appendChild(footer)
|
||||
}
|
||||
} else {
|
||||
td.appendChild(link)
|
||||
}
|
||||
} else if (value.style !== undefined) {
|
||||
td.innerHTML = value.value
|
||||
td.setAttribute("style", value.style)
|
||||
} else td.innerHTML = value
|
||||
this.nodeScriptReplace(td)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.nodeScriptReplace = function (node) {
|
||||
if (this.nodeScriptIs(node) === true) {
|
||||
node.parentNode.replaceChild(this.nodeScriptClone(node), node);
|
||||
} else {
|
||||
let i = -1, children = node.childNodes;
|
||||
while (++i < children.length) {
|
||||
this.nodeScriptReplace(children[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
this.nodeScriptClone = function (node) {
|
||||
let script = document.createElement("script");
|
||||
script.text = node.innerHTML;
|
||||
|
||||
let i = -1, attrs = node.attributes, attr;
|
||||
while (++i < attrs.length) {
|
||||
script.setAttribute((attr = attrs[i]).name, attr.value);
|
||||
}
|
||||
return script;
|
||||
}
|
||||
|
||||
this.nodeScriptIs = function (node) {
|
||||
return node.tagName === 'SCRIPT';
|
||||
}
|
||||
})()
|
||||
|
||||
window.call_DataFrame = function (f) {
|
||||
return f();
|
||||
};
|
||||
|
||||
let funQueue = window["kotlinQueues"] && window["kotlinQueues"]["DataFrame"];
|
||||
if (funQueue) {
|
||||
funQueue.forEach(function (f) {
|
||||
f();
|
||||
});
|
||||
funQueue = [];
|
||||
}
|
||||
})()
|
||||
|
||||
/*<!--*/
|
||||
call_DataFrame(function() { DataFrame.addTable({ cols: [{ name: "<span title=\"name: String\">name</span>", children: [], rightAlign: false, values: ["JetBrains/ideavim","JetBrains/MPS","JetBrains/intellij-community","JetBrains/intellij-scala","JetBrains/kotlin","JetBrains/intellij-plugins","JetBrains/Exposed","JetBrains/kotlin-web-site","JetBrains/idea-gitignore","JetBrains/swot","JetBrains/phpstorm-stubs","JetBrains/gradle-intellij-plugin","JetBrains/svg-sprite-loader","JetBrains/resharper-unity","JetBrains/kotlin-native","JetBrains/create-react-kotlin-app","JetBrains/ring-ui","JetBrains/kotlinconf-app","JetBrains/JetBrainsMono","<span class=\"formatted\" title=\"JetBrains/intellij-platform-plugin-template\">JetBrains/intellij-platform-plugin-te<span class=\"structural\">...</span></span>"] },
|
||||
{ name: "<span title=\"starsCount: Int\">starsCount</span>", children: [], rightAlign: true, values: ["<span class=\"formatted\" title=\"\"><span class=\"numbers\">6120</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1241</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">12926</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1066</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">39402</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1737</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">5688</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1074</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1181</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1072</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1110</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1058</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1815</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1017</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">7101</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">2424</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">2836</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">2628</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">6059</span></span>","<span class=\"formatted\" title=\"\"><span class=\"numbers\">1133</span></span>"] },
|
||||
{ name: "<span title=\"topics: String\">topics</span>", children: [], rightAlign: false, values: ["<span class=\"formatted\" title=\"[ideavim, intellij, intellij-platform, jb-official, kotlin, vim, vim-emulator]\">[ideavim, intellij, intellij-platform<span class=\"structural\">...</span></span>","[domain-specific-language, dsl]","<span class=\"formatted\" title=\"[code-editor, ide, intellij, intellij-community, intellij-platform]\">[code-editor, ide, intellij, intellij<span class=\"structural\">...</span></span>","[intellij-idea, intellij-plugin, scala]","<span class=\"formatted\" title=\"[compiler, gradle-plugin, intellij-plugin, kotlin, kotlin-library, maven-plugin, programming-language]\">[compiler, gradle-plugin, intellij-pl<span class=\"structural\">...</span></span>","[]","[dao, kotlin, orm, sql]","[kotlin]","<span class=\"formatted\" title=\"[gitignore, ignore-files, intellij, intellij-plugin, java]\">[gitignore, ignore-files, intellij, i<span class=\"structural\">...</span></span>","[]","[]","<span class=\"formatted\" title=\"[gradle, gradle-intellij-plugin, gradle-kotlin-dsl, groovy, intellij, intellij-ides, intellij-platform, intellij-plugin, intellij-sdk, jetbrains-plugin, kotlin, plugin-verifier, publishing-dsl, setup-dsl, teamcity, travis-configuration]\">[gradle, gradle-intellij-plugin, grad<span class=\"structural\">...</span></span>","<span class=\"formatted\" title=\"[sprite, svg, svg-sprite, svg-stack, webpack, webpack-loader, webpack-plugin, webpack2, webpack3]\">[sprite, svg, svg-sprite, svg-stack, <span class=\"structural\">...</span></span>","<span class=\"formatted\" title=\"[hacktoberfest, jetbrains, plugin, resharper, resharper-plugin, rider, unity, unity-editor]\">[hacktoberfest, jetbrains, plugin, re<span class=\"structural\">...</span></span>","[c, compiler, kotlin, llvm, objective-c]","<span class=\"formatted\" title=\"[create-react-app, jetbrains-ui, kotlin, react, webpack]\">[create-react-app, jetbrains-ui, kotl<span class=\"structural\">...</span></span>","[components, jetbrains-ui, react]","[]","<span class=\"formatted\" title=\"[coding-font, font, ligatures, monospaced-font, programming-font, programming-ligatures]\">[coding-font, font, ligatures, monosp<span class=\"structural\">...</span></span>","<span class=\"formatted\" title=\"[intellij, intellij-idea, intellij-idea-plugin, intellij-platform, intellij-plugin, intellij-plugins, jetbrains-plugin]\">[intellij, intellij-idea, intellij-id<span class=\"structural\">...</span></span>"] },
|
||||
], id: 0, rootId: 0, totalRows: 24 } ) });
|
||||
/*-->*/
|
||||
|
||||
call_DataFrame(function() { DataFrame.renderTable(0) });
|
||||
|
||||
function sendHeight() {
|
||||
const table = document.querySelector('table.dataframe');
|
||||
if (!table) return;
|
||||
|
||||
let height = 0;
|
||||
|
||||
const thead = table.querySelector('thead');
|
||||
if (thead) height += thead.offsetHeight;
|
||||
|
||||
const rows = table.querySelectorAll(':scope > tbody > tr');
|
||||
rows.forEach(row => {
|
||||
height += row.offsetHeight;
|
||||
});
|
||||
|
||||
height += getVerticalMargins(table) + 10;
|
||||
|
||||
window.parent.postMessage({ type: 'iframeHeight', height: Math.ceil(height) }, '*');
|
||||
}
|
||||
|
||||
function getVerticalMargins(element) {
|
||||
const style = getComputedStyle(element);
|
||||
return parseFloat(style.marginTop) + parseFloat(style.marginBottom);
|
||||
}
|
||||
|
||||
function repeatHeightCalculation(maxRetries = 10, interval = 100) {
|
||||
let retries = 0;
|
||||
const intervalId = setInterval(() => {
|
||||
sendHeight();
|
||||
retries++;
|
||||
if (retries >= maxRetries) clearInterval(intervalId);
|
||||
}, interval);
|
||||
}
|
||||
|
||||
window.addEventListener('load', repeatHeightCalculation);
|
||||
|
||||
const observer = new MutationObserver(() => repeatHeightCalculation(5, 50));
|
||||
observer.observe(document.querySelector('.dataframe'), {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
characterData: true,
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</html>
|
||||
+512
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user