Skip to content
Snippets Groups Projects
Commit 91b797bf authored by rhenck's avatar rhenck
Browse files

Add styling props to simple text field

parent adb14e60
No related branches found
No related tags found
No related merge requests found
import { InputElement, UIElement } from '../../models/uI-element';
import {
FontElement,
FontProperties,
InputElement,
SurfaceElement,
SurfaceProperties,
UIElement
} from '../../models/uI-element';
import { initFontElement, initSurfaceElement } from '../../util/unit-interface-initializer';
export class TextFieldSimpleElement extends InputElement implements FontElement, SurfaceElement{
fontProps: FontProperties;
surfaceProps: SurfaceProperties;
export class TextFieldSimpleElement extends InputElement {
constructor(serializedElement: UIElement) {
super(serializedElement);
Object.assign(this, serializedElement);
this.fontProps = initFontElement(serializedElement);
this.surfaceProps = initSurfaceElement(serializedElement);
this.height = serializedElement.height || 25;
}
......
......@@ -8,9 +8,19 @@ import { TextFieldSimpleElement } from './text-field-simple-element';
<input type="text" form="parentForm"
[style.width.px]="elementModel.width"
[style.height.px]="elementModel.height"
[style.line-height.px]="elementModel.fontProps.fontSize"
[style.color]="elementModel.fontProps.fontColor"
[style.font-family]="elementModel.fontProps.font"
[style.font-size.px]="elementModel.fontProps.fontSize"
[style.font-weight]="elementModel.fontProps.bold ? 'bold' : ''"
[style.font-style]="elementModel.fontProps.italic ? 'italic' : ''"
[style.text-decoration]="elementModel.fontProps.underline ? 'underline' : ''"
value="{{elementModel.value}}"
(input)="setFormValue($any($event.target).value)">
`
`,
styles: [
'input {border: 1px solid rgba(0,0,0,.12); border-radius: 5px}'
]
})
export class TextFieldSimpleComponent extends FormElementComponent {
@Input() elementModel!: TextFieldSimpleElement;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment