Skip to content

Commit 1cb6e12

Browse files
committed
feat: add no-wrap attribute
1 parent 4a0a0d2 commit 1cb6e12

3 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/builders/default-builder.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ export class DefaultTableBuilder extends BaseTableBuilder {
5050
[margin-edge-col] {
5151
border-left: 1px solid var(--border-color, currentColor);
5252
}
53-
`
53+
`,
54+
noWrap: `
55+
td, th { white-space: nowrap; }
56+
`,
5457
}
5558

5659
const composedStyles = Object.entries(styleBlocks)

src/settings/settings-popup.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,10 @@ export class SettingsPopup extends ModalElement {
309309
<input type="checkbox" id="collapse-columns" ${this.options.styling.collapseColumns ? "checked" : ""}>
310310
Collapse columns
311311
</label>
312+
<label for="no-wrap">
313+
<input type="checkbox" id="no-wrap" ${this.options.styling.noWrap ? "checked" : ""}>
314+
No wrapping
315+
</label>
312316
</fieldset>
313317
`
314318
}

src/viewer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export class DataViewer extends HTMLElement {
1212
"show-hover", "margin-labels",
1313
"collapse-columns", "column-border-levels", "section-levels",
1414
"max-rows", "max-columns", "trim-size", "separator",
15+
"no-wrap",
1516
]
1617
}
1718

@@ -39,6 +40,7 @@ export class DataViewer extends HTMLElement {
3940
columnBorderLevels: 1,
4041
rowBorders: true,
4142
marginBorders: true,
43+
noWrap: false,
4244
}
4345
}
4446
}
@@ -116,6 +118,9 @@ export class DataViewer extends HTMLElement {
116118
case "collapse-columns":
117119
this.options.styling.collapseColumns = this.getBooleanAttribute(newValue)
118120
break
121+
case "no-wrap":
122+
this.options.styling.noWrap = this.getBooleanAttribute(newValue)
123+
break
119124
case "column-border-levels": {
120125
const level = parseInt(newValue)
121126
this.options.styling.columnBorderLevels = Number.isNaN(level)

0 commit comments

Comments
 (0)