Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add an id to readonly form field #69

Merged
merged 1 commit into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
[multiline]="multiline"
[rows]="rows"
[shrinkIfEmpty]="shrinkIfEmpty"
[id]="id"
matTooltip="{{toolTipText}}"
matTooltipPosition="right"
matTooltipClass="custom-tooltip"
matTooltipDisabled="{{!toolTipForInputEnabled}}">
</mad-readonly-form-field>
</ng-container>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class ReadOnlyFormFieldWrapperComponent implements OnInit, AfterViewInit,
@Input('unit') unit: string | null = null;
@Input('unitPosition') unitPosition: 'right' | 'left' = 'left';
@Input('errorMessage') errorMessage: string | null = null;
@Input() id: string;

/**
* If set to "false", a readonly input will be rendered.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[ngModel]="value"
[ngClass]="'text-' + textAlign"
[errorStateMatcher]="errorMatcher"
[id]="id"
readonly
matInput
#inputEl
Expand All @@ -16,6 +17,7 @@
[ngModel]="value"
class="multiline"
[errorStateMatcher]="errorMatcher"
[id]="id"
readonly
matInput
></textarea>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class ReadOnlyFormFieldComponent implements OnChanges, AfterViewChecked {
@Input('errorMessage') errorMessage: string | null = null;
@Input() multiline = false;
@Input() rows = 3;
@Input() id: string;
/*
* If shrinkIfEmpty is set to "false", nothing changes
* If set to "true" and multiline is also "true", the textarea will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</mad-icon-button>
<mat-checkbox [checked]="textIsEditable" (change)="textIsEditable = !textIsEditable">Text editable</mat-checkbox>
<br/>
<mad-readonly-form-field-wrapper [readonly]="!textIsEditable" [value]="demoIdData">
<mad-readonly-form-field-wrapper [id]="'namex'" [readonly]="!textIsEditable" [value]="demoIdData">
<mat-form-field class="form-group">
<mat-label>First Name</mat-label>
<input [(ngModel)]="demoIdData" autocomplete="off" class="form-control" id="namex" matInput name="id"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<mad-readonly-form-field [value]="'Jennifer Doe'" [label]="'Last changed by'"></mad-readonly-form-field>
<mad-readonly-form-field [id]="'lastChangedBy'" [label]="'Last changed by'"
[value]="'Jennifer Doe'"></mad-readonly-form-field>
<mad-readonly-form-field [value]="'2019-08-09' | date" [label]="'Last changed at'"></mad-readonly-form-field>
<mad-readonly-form-field [label]="'Approved by'"></mad-readonly-form-field>
<mad-readonly-form-field [value]="123456" [label]="'Long number, not formatted (default)'"></mad-readonly-form-field>
Expand Down