Add FullWidth Support to Text Input Component

This commit is contained in:
Sebastian
2020-09-04 16:18:58 +02:00
parent c7407c5036
commit 9c4f2b8395
3 changed files with 32 additions and 6 deletions

View File

@@ -25,6 +25,7 @@ export class UiTextInputComponent implements ControlValueAccessor {
@Input() label = '';
@Input() suffix: string;
@Input() placeholder = '';
@Input() fullWidth = true;
constructor(private cdr: ChangeDetectorRef) {}

View File

@@ -1,13 +1,24 @@
<div class="isa-form-field">
<label>
<label [class.expand]="fullWidth">
{{ label }}
<input resize type="text" [(ngModel)]="value" (input)="handleInput()" (blur)="handleBlur()"
(focus)="handleFocus(true)" [disabled]="!editable" [placeholder]="placeholder" />
<input
resize
type="text"
[(ngModel)]="value"
(input)="handleInput()"
(blur)="handleBlur()"
(focus)="handleFocus(true)"
[disabled]="!editable"
[placeholder]="placeholder"
/>
<span class="isa-font-weight-bold suffix">{{ suffix }}</span>
</label>
<button *ngIf="editable && value?.length && touched && focussed" class="isa-input-reset-sm"
(click)="reset()"></button>
<button
*ngIf="editable && value?.length && touched && focussed"
class="isa-input-reset-sm"
(click)="reset()"
></button>
<span *ngIf="!editable" class="status">Nicht Änderbar</span>
</div>
</div>

View File

@@ -1,6 +1,20 @@
$status-width: 115px;
input {
margin-left: 20px;
}
label {
&.expand {
display: flex;
width: calc(95% - #{$status-width});
}
}
.status {
width: $status-width;
}
.suffix {
margin-left: -30px;
}