Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Table formatting #34

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions invert-gradle-plugin/src/main/resources/META-INF/invert.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ window.render3dGraph = function (domElementId, graphDataJson, width, height) {

// https://www.chartjs.org/docs/latest/getting-started/
window.renderChartJs = function (domElementId, graphDataJson, onClick) {
if (window.ForceGraph == undefined) {
if (window.Chart === undefined) {
loadJsFileAsync("https://cdn.jsdelivr.net/npm/chart.js", function (obj) {
const chartJsData = JSON.parse(graphDataJson)
const ctx = document.getElementById(domElementId);
Expand All @@ -92,7 +92,6 @@ window.renderChartJs = function (domElementId, graphDataJson, onClick) {
onClick(label, value)
}
}
// chartJsData['type']='bar'
chartJsData['options']['indexAxis'] = 'y'
new Chart(ctx, chartJsData);
});
Expand Down
25 changes: 25 additions & 0 deletions invert-report/src/jsMain/kotlin/ui/BootstrapComposables.kt
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,18 @@ fun BootstrapTableRow(
}) {
cellValues.forEachIndexed { idx, cellValue ->
Td({
style {
// property("max-width", "350px")

// property("word-wrap", "break-word")
// property("white-space", "normal")
// property("white-space", "nowrap")
if (!cellValue.startsWith("```")) {
property("word-break", "break-all") // Don't allow wrapping for code references
}
// property("overflow", "hidden")
}
// max-width: 150px; /* Set a maximum width for the cells */
if (idx == 0) {
onClicked?.let {
onClick { onClicked(idx) }
Expand Down Expand Up @@ -235,6 +247,19 @@ fun BootstrapTable(
var maxNumberOfRows by remember { mutableStateOf(maxResultsLimitConstant) }
Table({
classes("table table-bordered table-striped table-hover table-sm".split(" "))
style {
property("font-size", "0.6rem")
// : ;
// -overflow: ellipsis;
// white-space: nowrap; /* Prevents wrapping */
// max-width: 150px; /* Set a maximum width for the cells */
// : ; /* Adjust to make text smaller */
// property("transform", "scale(0.7)")
// property("transform-origin", "top left")
// property("width", "100%")
// transform: scale(0.9); /* Adjust the scale factor as needed */
// transform-origin: top left; /* Keeps the table aligned to its original position */
}
}) {
var sortIdx by remember { mutableStateOf(sortByColumn) }
var ascending by remember { mutableStateOf(sortAscending) }
Expand Down