/
text-value-as-string.component.html
45 lines (41 loc) · 2.75 KB
/
text-value-as-string.component.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<span *ngIf="mode === 'read'; else showForm" class="read-mode-view">
<!-- only use linkify pipe if property's gui-element is not richtext; I had the same issue in regions -->
<span class="rm-value text-value" [innerHtml]="guiElement === 'richText' ? valueFormControl.value : valueFormControl.value | appLinkify" style="white-space: pre-wrap;"></span>
<span class="rm-comment" *ngIf="shouldShowComment">{{commentFormControl.value}}</span>
</span>
<ng-template #showForm>
<span [formGroup]="form">
<mat-form-field *ngIf="guiElement !== 'richText'; else showRichText" class="large-field child-value-component"
floatLabel="never">
<!-- default gui-element: simple text -->
<input *ngIf="guiElement === 'simpleText'" matInput [formControlName]="'value'" class="value"
placeholder="Text value" type="text" [errorStateMatcher]="matcher">
<!-- gui-element: text area -->
<textarea *ngIf="guiElement === 'textArea'" matInput [formControlName]="'value'" class="value"
placeholder="Text value" type="text" [errorStateMatcher]="matcher"
matAutosizeMaxRows="12" matAutosizeMinRows="6"></textarea>
<!-- <textarea *ngSwitchCase="'richText'" matInput [formControlName]="'value'" MatTextareaAutosize [mat-autosize]="true" [matAutosizeMaxRows]="10" class="value" placeholder="Text value" type="text" [errorStateMatcher]="matcher"></textarea> -->
<mat-error *ngIf="valueFormControl.hasError('valueNotChanged') &&
(valueFormControl.touched || valueFormControl.dirty)">
<span class="custom-error-message">New value must be different than the current value.</span>
</mat-error>
<mat-error *ngIf="valueFormControl.hasError('required')">
A text value is <strong>required</strong>.
</mat-error>
<mat-error *ngIf="valueFormControl.hasError('duplicateValue')">
<span class="custom-error-message">This value already exists for this property. Duplicate values are not
allowed.</span>
</mat-error>
</mat-form-field>
<!-- gui-element: rich-text -->
<ng-template #showRichText>
<ckeditor [formControlName]="'value'" [config]="editorConfig" [editor]="editor"></ckeditor>
</ng-template>
<!-- comment -->
<mat-form-field *ngIf="!commentDisabled" class="large-field value-component-comment">
<textarea matInput cdkTextareaAutosize cdkAutosizeMinRows="1" cdkAutosizeMaxRows="6"
[formControlName]="'comment'" class="comment" placeholder="Comment" type="text" spellcheck="false">
</textarea>
</mat-form-field>
</span>
</ng-template>