Skip to content

Commit

Permalink
Et2NumberReadonly: Right-align
Browse files Browse the repository at this point in the history
  • Loading branch information
nathangray committed Aug 7, 2024
1 parent 2bdde5d commit 7c1b156
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion api/js/etemplate/Et2Description/Et2Description.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
27 changes: 19 additions & 8 deletions api/js/etemplate/Et2Textbox/Et2NumberReadonly.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 7c1b156

Please sign in to comment.