• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

eclipsesource / jsonforms / 4701210704

pending completion
4701210704

Pull #2112

github

GitHub
Merge ee119cbb2 into 8b6c9d23c
Pull Request #2112: Draft: Replace TSLint with ESLint and Prettier

110 of 179 branches covered (61.45%)

305 of 362 relevant lines covered (84.25%)

13.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.86
/packages/angular-material/src/controls/text.renderer.ts
1
/*
2
  The MIT License
3
  
4
  Copyright (c) 2017-2019 EclipseSource Munich
5
  https://github.com/eclipsesource/jsonforms
6
  
7
  Permission is hereby granted, free of charge, to any person obtaining a copy
8
  of this software and associated documentation files (the "Software"), to deal
9
  in the Software without restriction, including without limitation the rights
10
  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
  copies of the Software, and to permit persons to whom the Software is
12
  furnished to do so, subject to the following conditions:
13
  
14
  The above copyright notice and this permission notice shall be included in
15
  all copies or substantial portions of the Software.
16
  
17
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
  THE SOFTWARE.
24
*/
25
import { ChangeDetectionStrategy, Component } from '@angular/core';
26
import { JsonFormsAngularService, JsonFormsControl } from '@jsonforms/angular';
27
import { isStringControl, RankedTester, rankWith } from '@jsonforms/core';
28

29
@Component({
30
  selector: 'TextControlRenderer',
31
  template: `
32
    <mat-form-field fxFlex [fxHide]="hidden">
33
      <mat-label>{{ label }}</mat-label>
34
      <input
35
        matInput
36
        [type]="getType()"
37
        (input)="onChange($event)"
38
        [id]="id"
39
        [formControl]="form"
40
        (focus)="focused = true"
41
        (focusout)="focused = false"
42
      />
43
      <mat-hint *ngIf="shouldShowUnfocusedDescription() || focused">{{
44
        description
45
      }}</mat-hint>
46
      <mat-error>{{ error }}</mat-error>
47
    </mat-form-field>
48
  `,
49
  changeDetection: ChangeDetectionStrategy.OnPush,
50
})
51
export class TextControlRenderer extends JsonFormsControl {
1✔
52
  constructor(jsonformsService: JsonFormsAngularService) {
53
    super(jsonformsService);
53!
54
  }
55
  getEventValue = (event: any) => event.target.value || undefined;
53!
56
  getType = (): string => {
53✔
57
    if (this.uischema.options && this.uischema.options.format) {
62✔
58
      return this.uischema.options.format;
1✔
59
    }
60
    if (this.scopedSchema && this.scopedSchema.format) {
61✔
61
      switch (this.scopedSchema.format) {
1✔
62
        case 'email':
1!
63
          return 'email';
1✔
64
        case 'tel':
65
          return 'tel';
×
66
        default:
67
          return 'text';
×
68
      }
69
    }
70
    return 'text';
60✔
71
  };
72
}
1✔
73
export const TextControlRendererTester: RankedTester = rankWith(
1✔
74
  1,
75
  isStringControl
76
);
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc