Device Card: improve truncation (#30533)
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
This commit is contained in:
parent
29e5599c99
commit
501789c7bf
2 changed files with 12 additions and 1 deletions
|
|
@ -10,7 +10,7 @@
|
|||
<div class="label overflow-hidden text-truncate flex-shrink-1 flex-grow-1">
|
||||
{{ $t(`config.deviceValue.${entry.name}`) }}
|
||||
</div>
|
||||
<div class="value overflow-hidden text-truncate" :class="valueClasses(entry)">
|
||||
<div class="value" :class="[valueClasses(entry), truncateClasses(entry)]">
|
||||
{{ fmtDeviceValue(entry) }}
|
||||
</div>
|
||||
</span>
|
||||
|
|
@ -175,6 +175,12 @@ export default {
|
|||
},
|
||||
},
|
||||
methods: {
|
||||
truncateClasses(entry) {
|
||||
// don't truncate numeric values
|
||||
return typeof entry.value === "string"
|
||||
? "overflow-hidden text-truncate"
|
||||
: "text-nowrap flex-shrink-0";
|
||||
},
|
||||
valueClasses(entry) {
|
||||
if (entry.error) {
|
||||
return "value--error";
|
||||
|
|
|
|||
|
|
@ -3,4 +3,9 @@ export default {
|
|||
printWidth: 100,
|
||||
trailingComma: "es5",
|
||||
plugins: ["prettier-plugin-sh"],
|
||||
// mirror .editorconfig for editors that resolve prettier config without it (e.g. Zed)
|
||||
overrides: [
|
||||
{ files: ["*.vue", "*.sh"], options: { useTabs: true, tabWidth: 4 } },
|
||||
{ files: "*.css", options: { useTabs: true, tabWidth: 2 } },
|
||||
],
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue