@@ -3,31 +3,31 @@ import { AfterContentInit, AfterViewInit, Component, ContentChild, ContentChildr
3
3
ViewEncapsulation } from '@angular/core' ;
4
4
import { NgControl } from '@angular/forms' ;
5
5
import { MDCRipple } from '@material/ripple' ;
6
- import { MDCTextfieldFoundation } from '@material/textfield' ;
7
- import { MdcTextfieldAdapter } from './mdc.textfield .adapter' ;
6
+ import { MDCTextFieldFoundation } from '@material/textfield' ;
7
+ import { MdcTextFieldAdapter } from './mdc.text-field .adapter' ;
8
8
import { AbstractMdcInput } from '../abstract/abstract.mdc.input' ;
9
9
import { AbstractMdcLabel } from '../abstract/abstract.mdc.label' ;
10
10
import { asBoolean } from '../../utils/value.utils' ;
11
11
import { AbstractMdcRipple } from '../ripple/abstract.mdc.ripple' ;
12
12
import { MdcEventRegistry } from '../../utils/mdc.event.registry' ;
13
13
14
- const CLASS_BOTTOM_LINE = 'mdc-textfield__bottom -line' ;
14
+ const CLASS_BOTTOM_LINE = 'mdc-text-field__bottom -line' ;
15
15
16
16
let nextId = 1 ;
17
17
18
18
@Directive ( {
19
- selector : 'input[mdcTextfieldInput ], textarea[mdcTextfieldInput ]' ,
20
- providers : [ { provide : AbstractMdcInput , useExisting : forwardRef ( ( ) => MdcTextfieldInputDirective ) } ]
19
+ selector : 'input[mdcTextFieldInput ], textarea[mdcTextFieldInput ]' ,
20
+ providers : [ { provide : AbstractMdcInput , useExisting : forwardRef ( ( ) => MdcTextFieldInputDirective ) } ]
21
21
} )
22
- export class MdcTextfieldInputDirective extends AbstractMdcInput implements OnInit {
22
+ export class MdcTextFieldInputDirective extends AbstractMdcInput implements OnInit {
23
23
_onChange = ( value ) => { } ;
24
24
private _id : string ;
25
25
private _type = 'text' ;
26
26
private _disabled = false ;
27
27
private _required = false ;
28
28
private cachedId : string ;
29
29
_focused = false ;
30
- @HostBinding ( 'class.mdc-textfield__input ' ) _hostClass = true ;
30
+ @HostBinding ( 'class.mdc-text-field__input ' ) _hostClass = true ;
31
31
32
32
constructor ( public _elm : ElementRef , private renderer : Renderer2 , @Optional ( ) @Self ( ) public _cntr : NgControl ) {
33
33
super ( ) ;
@@ -136,37 +136,37 @@ export class MdcTextfieldInputDirective extends AbstractMdcInput implements OnIn
136
136
}
137
137
138
138
@Directive ( {
139
- selector : '[mdcTextfieldIcon ]'
139
+ selector : '[mdcTextFieldIcon ]'
140
140
} )
141
- export class MdcTextfieldIconDirective {
142
- @HostBinding ( 'class.mdc-textfield__icon ' ) _cls = true ;
141
+ export class MdcTextFieldIconDirective {
142
+ @HostBinding ( 'class.mdc-text-field__icon ' ) _cls = true ;
143
143
144
144
constructor ( public _el : ElementRef ) {
145
145
}
146
146
}
147
147
148
148
@Directive ( {
149
- selector : 'label[mdcTextfieldLabel ]' ,
150
- providers : [ { provide : AbstractMdcLabel , useExisting : forwardRef ( ( ) => MdcTextfieldLabelDirective ) } ]
149
+ selector : 'label[mdcTextFieldLabel ]' ,
150
+ providers : [ { provide : AbstractMdcLabel , useExisting : forwardRef ( ( ) => MdcTextFieldLabelDirective ) } ]
151
151
} )
152
- export class MdcTextfieldLabelDirective extends AbstractMdcLabel {
152
+ export class MdcTextFieldLabelDirective extends AbstractMdcLabel {
153
153
/** @docs -private */
154
154
@HostBinding ( ) for : string ;
155
- @HostBinding ( 'class.mdc-textfield__label ' ) _cls = true ;
155
+ @HostBinding ( 'class.mdc-text-field__label ' ) _cls = true ;
156
156
157
157
constructor ( public _elm : ElementRef ) {
158
158
super ( ) ;
159
159
}
160
160
}
161
161
162
162
@Directive ( {
163
- selector : '[mdcTextfieldHelptext ]' ,
163
+ selector : '[mdcTextFieldHelptext ]' ,
164
164
exportAs : 'mdcHelptext'
165
165
} )
166
- export class MdcTextfieldHelptextDirective {
167
- @HostBinding ( 'class.mdc-textfield -helptext' ) _cls = true ;
168
- @HostBinding ( 'class.mdc-textfield -helptext--validation-msg' ) _isValidation = false ;
169
- @HostBinding ( 'class.mdc-textfield -helptext--persistent' ) _isPersistent = false ;
166
+ export class MdcTextFieldHelptextDirective {
167
+ @HostBinding ( 'class.mdc-text-field -helptext' ) _cls = true ;
168
+ @HostBinding ( 'class.mdc-text-field -helptext--validation-msg' ) _isValidation = false ;
169
+ @HostBinding ( 'class.mdc-text-field -helptext--persistent' ) _isPersistent = false ;
170
170
@Input ( ) forceShow = false ; // TODO boolean coercion
171
171
172
172
constructor ( public _elm : ElementRef ) {
@@ -182,22 +182,22 @@ export class MdcTextfieldHelptextDirective {
182
182
}
183
183
184
184
@Directive ( {
185
- selector : '[mdcTextfield ]' ,
186
- providers : [ { provide : AbstractMdcRipple , useExisting : forwardRef ( ( ) => MdcTextfieldDirective ) } ]
185
+ selector : '[mdcTextField ]' ,
186
+ providers : [ { provide : AbstractMdcRipple , useExisting : forwardRef ( ( ) => MdcTextFieldDirective ) } ]
187
187
} )
188
- export class MdcTextfieldDirective extends AbstractMdcRipple implements AfterContentInit , OnDestroy {
189
- @HostBinding ( 'class.mdc-textfield ' ) _cls = true ;
190
- @ContentChild ( MdcTextfieldIconDirective ) _icon : MdcTextfieldIconDirective ;
191
- @ContentChild ( MdcTextfieldInputDirective ) _input : MdcTextfieldInputDirective ;
192
- @ContentChild ( MdcTextfieldLabelDirective ) _label : MdcTextfieldLabelDirective ;
188
+ export class MdcTextFieldDirective extends AbstractMdcRipple implements AfterContentInit , OnDestroy {
189
+ @HostBinding ( 'class.mdc-text-field ' ) _cls = true ;
190
+ @ContentChild ( MdcTextFieldIconDirective ) _icon : MdcTextFieldIconDirective ;
191
+ @ContentChild ( MdcTextFieldInputDirective ) _input : MdcTextFieldInputDirective ;
192
+ @ContentChild ( MdcTextFieldLabelDirective ) _label : MdcTextFieldLabelDirective ;
193
193
@ContentChildren ( 'label' , { descendants : true , read : ElementRef } ) _labels : QueryList < ElementRef > ;
194
- @Input ( ) helptext : MdcTextfieldHelptextDirective ;
194
+ @Input ( ) helptext : MdcTextFieldHelptextDirective ;
195
195
private _initialized = false ;
196
196
private _box = false ;
197
197
private _dense = false ;
198
198
private _bottomLineElm : HTMLElement = null ;
199
199
private valid : boolean = null ;
200
- private mdcAdapter : MdcTextfieldAdapter = {
200
+ private mdcAdapter : MdcTextFieldAdapter = {
201
201
addClass : ( className : string ) => {
202
202
this . renderer . addClass ( this . root . nativeElement , className ) ;
203
203
} ,
@@ -289,7 +289,7 @@ export class MdcTextfieldDirective extends AbstractMdcRipple implements AfterCon
289
289
useCustomValidityChecking_ : boolean ,
290
290
setValid ( isValid : boolean ) ,
291
291
changeValidity_ ( isValid : boolean )
292
- } = new MDCTextfieldFoundation ( this . mdcAdapter ) ;
292
+ } = new MDCTextFieldFoundation ( this . mdcAdapter ) ;
293
293
294
294
constructor ( private renderer : Renderer2 , private root : ElementRef , private registry : MdcEventRegistry ) {
295
295
super ( root , renderer , registry ) ;
@@ -311,9 +311,9 @@ export class MdcTextfieldDirective extends AbstractMdcRipple implements AfterCon
311
311
// programmatic changes to the input value are not seen by the foundation,
312
312
// but some states should be updated with the new value:
313
313
if ( value == null || value . toString ( ) . length === 0 )
314
- this . mdcAdapter . removeClassFromLabel ( 'mdc-textfield__label --float-above' ) ;
314
+ this . mdcAdapter . removeClassFromLabel ( 'mdc-text-field__label --float-above' ) ;
315
315
else
316
- this . mdcAdapter . addClassToLabel ( 'mdc-textfield__label --float-above' ) ;
316
+ this . mdcAdapter . addClassToLabel ( 'mdc-text-field__label --float-above' ) ;
317
317
}
318
318
}
319
319
}
@@ -337,11 +337,11 @@ export class MdcTextfieldDirective extends AbstractMdcRipple implements AfterCon
337
337
* When binding to 'isValid', the value will determine the valid state of the input,
338
338
* instead of it being managed by the underlying input element directly.
339
339
* For most use cases this is not needed. When the input/textarea is an ngControl,
340
- * the mdcTextfield is already aware of that, and is already using the 'valid'
340
+ * the mdcTextField is already aware of that, and is already using the 'valid'
341
341
* property of that control.
342
342
* <p>
343
343
* However, in some specific cases, binding to isValid can help. Example:
344
- * When you want the mdcTextfield to go to 'invalid' state only when the underlying
344
+ * When you want the mdcTextField to go to 'invalid' state only when the underlying
345
345
* control is invalid AND that control is touched, you can bind as follows:
346
346
* <code>isValid="myControl.valid || !myControl.touched"</code>.
347
347
*/
@@ -356,20 +356,20 @@ export class MdcTextfieldDirective extends AbstractMdcRipple implements AfterCon
356
356
}
357
357
}
358
358
359
- @HostBinding ( 'class.mdc-textfield --textarea' ) get _textArea ( ) : boolean {
359
+ @HostBinding ( 'class.mdc-text-field --textarea' ) get _textArea ( ) : boolean {
360
360
return this . _input . _isTextarea ( ) ;
361
361
}
362
362
363
- @HostBinding ( 'class.mdc-textfield --box' ) @Input ( )
363
+ @HostBinding ( 'class.mdc-text-field --box' ) @Input ( )
364
364
get boxed ( ) {
365
365
return this . _box ;
366
366
}
367
367
368
- @HostBinding ( 'class.mdc-textfield --with-leading-icon' ) get _leadingIcon ( ) : boolean {
368
+ @HostBinding ( 'class.mdc-text-field --with-leading-icon' ) get _leadingIcon ( ) : boolean {
369
369
return this . _icon && ! this . _icon . _el . nativeElement . previousElementSibling ;
370
370
}
371
371
372
- @HostBinding ( 'class.mdc-textfield --with-trailing-icon' ) get _trailingIcon ( ) : boolean {
372
+ @HostBinding ( 'class.mdc-text-field --with-trailing-icon' ) get _trailingIcon ( ) : boolean {
373
373
return this . _icon && this . _icon . _el . nativeElement . previousElementSibling ;
374
374
}
375
375
@@ -378,7 +378,7 @@ export class MdcTextfieldDirective extends AbstractMdcRipple implements AfterCon
378
378
this . initBox ( ) ;
379
379
}
380
380
381
- @HostBinding ( 'class.mdc-textfield --dense' ) @Input ( )
381
+ @HostBinding ( 'class.mdc-text-field --dense' ) @Input ( )
382
382
get dense ( ) {
383
383
return this . _dense ;
384
384
}
0 commit comments