-
Notifications
You must be signed in to change notification settings - Fork 556
/
slider.type.ts
36 lines (34 loc) 路 909 Bytes
/
slider.type.ts
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
import { Component, ViewChild } from '@angular/core';
import { FieldType } from '@ngx-formly/material/form-field';
import { MatSlider } from '@angular/material/slider';
@Component({
selector: 'formly-field-mat-slider',
template: `
<mat-slider
[id]="id"
[style.width]="'100%'"
[formControl]="formControl"
[formlyAttributes]="field"
[tabindex]="to.tabindex || 0"
[color]="to.color"
[thumbLabel]="to.thumbLabel"
[step]="to.step"
[max]="to.max"
[min]="to.min">
</mat-slider>
`,
})
export class FormlySliderTypeComponent extends FieldType {
@ViewChild(MatSlider) slider!: MatSlider;
defaultOptions = {
templateOptions: {
hideFieldUnderline: true,
floatLabel: 'always',
thumbLabel: false,
},
};
onContainerClick(event: MouseEvent): void {
this.slider.focus();
super.onContainerClick(event);
}
}