-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.component.ts
More file actions
51 lines (41 loc) · 1.48 KB
/
input.component.ts
File metadata and controls
51 lines (41 loc) · 1.48 KB
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
46
47
48
49
50
51
import {
ChangeDetectionStrategy,
Component,
Input,
numberAttribute,
} from '@angular/core';
import { ReactiveFormsModule } from '@angular/forms';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatInputModule } from '@angular/material/input';
import { InputLoadingComponent } from '../input-loading/input-loading.component';
import { InputDirective } from '../input.directive';
import { InputAppearance, InputAutocomplete, InputType } from '../types';
@Component({
selector: 'pro-input[label]',
templateUrl: './input.component.html',
imports: [
InputLoadingComponent,
MatFormFieldModule,
MatInputModule,
ReactiveFormsModule,
],
styleUrl: './input.component.scss',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
})
export class InputComponent extends InputDirective<string> {
@Input() public appearance: InputAppearance = 'outline';
@Input() public autocomplete: InputAutocomplete = 'off';
@Input({ transform: numberAttribute })
public max: number | string | undefined;
@Input({ transform: numberAttribute })
public min: number | string | undefined;
@Input({ transform: numberAttribute })
public maxLength: number | string | undefined;
@Input({ transform: numberAttribute })
public minLength: number | string | undefined;
@Input() public name: string | undefined;
@Input({ transform: numberAttribute })
public step: number | string | undefined;
@Input() public type: InputType = 'text';
}