Et2NumberReadonly: Right-align

This commit is contained in:
nathan 2024-08-07 15:15:58 -06:00
parent 2bdde5dc61
commit 7c1b156c2c
2 changed files with 20 additions and 9 deletions

View File

@ -206,7 +206,7 @@ export class Et2Description extends Et2Widget(LitElement) implements et2_IDetach
{
render = html`${this.value}`;
}
return render;
return html`<span part="content" class="description--content">${render}</span>`;
}
render()

View File

@ -10,20 +10,31 @@
import {Et2TextboxReadonly} from "./Et2TextboxReadonly";
import {formatNumber} from "./Et2Number";
import {property} from "lit/decorators/property.js";
import {css} from "lit";
export class Et2NumberReadonly extends Et2TextboxReadonly
{
static get properties()
static get styles()
{
return {
...super.properties,
/**
* Precision of float number or 0 for integer
*/
precision: Number,
}
return [
...(super.styles ? (Array.isArray(super.styles) ? super.styles : [super.styles]) : []),
css`
::slotted(*) {
flex: 1 1 auto;
text-align: right;
padding-right: var(--sl-spacing-small);
}
`,
];
}
/**
* Precision of float number or 0 for integer
*/
@property({type: Number})
precision;
set_value(val)
{
if(val === null)