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AAM,CAAC;SAC1C,CAAC;;qBAAA;IAQF,oBAAC;AAAD,CAPA,AAOC,IAAA","file":"input/input.js","sourcesContent":["import {\n forwardRef,\n Component,\n HostBinding,\n Input,\n Directive,\n AfterContentInit,\n ContentChild,\n SimpleChange,\n ContentChildren,\n ViewChild,\n ElementRef,\n QueryList,\n OnChanges,\n EventEmitter,\n Output,\n NgModule,\n ModuleWithProviders,\n} from '@angular/core';\nimport {\n NG_VALUE_ACCESSOR,\n ControlValueAccessor,\n FormsModule,\n} from '@angular/forms';\nimport {CommonModule} from '@angular/common';\nimport {BooleanFieldValue, MdError} from '@angular2-material/core';\nimport {Observable} from 'rxjs/Observable';\n\n\nconst noop = () => {};\n\nexport const MD_INPUT_CONTROL_VALUE_ACCESSOR: any = {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => MdInput),\n multi: true\n};\n\n// Invalid input type. Using one of these will throw an MdInputUnsupportedTypeError.\nconst MD_INPUT_INVALID_INPUT_TYPE = [\n 'file',\n 'radio',\n 'checkbox',\n];\n\n\nlet nextUniqueId = 0;\n\n\nexport class MdInputPlaceholderConflictError extends MdError {\n constructor() {\n super('Placeholder attribute and child element were both specified.');\n }\n}\n\nexport class MdInputUnsupportedTypeError extends MdError {\n constructor(type: string) {\n super(`Input type \"${type}\" isn't supported by md-input.`);\n }\n}\n\nexport class MdInputDuplicatedHintError extends MdError {\n constructor(align: string) {\n super(`A hint was already declared for 'align=\"${align}\"'.`);\n }\n}\n\n\n\n/**\n * The placeholder directive. The content can declare this to implement more\n * complex placeholders.\n */\n@Directive({\n selector: 'md-placeholder'\n})\nexport class MdPlaceholder {}\n\n\n/** The hint directive, used to tag content as hint labels (going under the input). */\n@Directive({\n selector: 'md-hint',\n host: {\n '[class.md-right]': 'align == \"end\"',\n '[class.md-hint]': 'true'\n }\n})\nexport class MdHint {\n // Whether to align the hint label at the start or end of the line.\n @Input() align: 'start' | 'end' = 'start';\n}\n\n\n/**\n * Component that represents a text input. It encapsulates the <input> HTMLElement and\n * improve on its behaviour, along with styling it according to the Material Design.\n */\n@Component({\n moduleId: module.id,\n selector: 'md-input',\n templateUrl: 'input.html',\n styleUrls: ['input.css'],\n providers: [MD_INPUT_CONTROL_VALUE_ACCESSOR],\n host: {'(click)' : 'focus()'}\n})\nexport class MdInput implements ControlValueAccessor, AfterContentInit, OnChanges {\n private _focused: boolean = false;\n private _value: any = '';\n\n /** Callback registered via registerOnTouched (ControlValueAccessor) */\n private _onTouchedCallback: () => void = noop;\n /** Callback registered via registerOnChange (ControlValueAccessor) */\n private _onChangeCallback: (_: any) => void = noop;\n\n /**\n * Aria related inputs.\n */\n @Input('aria-label') ariaLabel: string;\n @Input('aria-labelledby') ariaLabelledBy: string;\n @Input('aria-disabled') @BooleanFieldValue() ariaDisabled: boolean;\n @Input('aria-required') @BooleanFieldValue() ariaRequired: boolean;\n @Input('aria-invalid') @BooleanFieldValue() ariaInvalid: boolean;\n\n /**\n * Content directives.\n */\n @ContentChild(MdPlaceholder) _placeholderChild: MdPlaceholder;\n @ContentChildren(MdHint) _hintChildren: QueryList<MdHint>;\n\n /** Readonly properties. */\n get focused() { return this._focused; }\n get empty() { return this._value == null || this._value === ''; }\n get characterCount(): number {\n return this.empty ? 0 : ('' + this._value).length;\n }\n get inputId(): string { return `${this.id}-input`; }\n\n /**\n * Bindings.\n */\n @Input() align: 'start' | 'end' = 'start';\n @Input() dividerColor: 'primary' | 'accent' | 'warn' = 'primary';\n @Input() @BooleanFieldValue() floatingPlaceholder: boolean = true;\n @Input() hintLabel: string = '';\n\n @Input() autocomplete: string;\n @Input() autocorrect: string;\n @Input() autocapitalize: string;\n @Input() @BooleanFieldValue() autofocus: boolean = false;\n @Input() @BooleanFieldValue() disabled: boolean = false;\n @Input() id: string = `md-input-${nextUniqueId++}`;\n @Input() list: string = null;\n @Input() max: string | number = null;\n @Input() maxlength: number = null;\n @Input() min: string | number = null;\n @Input() minlength: number = null;\n @Input() placeholder: string = null;\n @Input() @BooleanFieldValue() readonly: boolean = false;\n @Input() @BooleanFieldValue() required: boolean = false;\n @Input() @BooleanFieldValue() spellcheck: boolean = false;\n @Input() step: number = null;\n @Input() tabindex: number = null;\n @Input() type: string = 'text';\n @Input() name: string = null;\n\n private _blurEmitter: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n private _focusEmitter: EventEmitter<FocusEvent> = new EventEmitter<FocusEvent>();\n\n @Output('blur')\n get onBlur(): Observable<FocusEvent> {\n return this._blurEmitter.asObservable();\n }\n\n @Output('focus')\n get onFocus(): Observable<FocusEvent> {\n return this._focusEmitter.asObservable();\n }\n\n get value(): any { return this._value; };\n @Input() set value(v: any) {\n v = this._convertValueForInputType(v);\n if (v !== this._value) {\n this._value = v;\n this._onChangeCallback(v);\n }\n }\n\n // This is to remove the `align` property of the `md-input` itself. Otherwise HTML5\n // might place it as RTL when we don't want to. We still want to use `align` as an\n // Input though, so we use HostBinding.\n @HostBinding('attr.align') get _align(): any { return null; }\n\n\n @ViewChild('input') _inputElement: ElementRef;\n\n /** Set focus on input */\n focus() {\n this._inputElement.nativeElement.focus();\n }\n\n _handleFocus(event: FocusEvent) {\n this._focused = true;\n this._focusEmitter.emit(event);\n }\n\n _handleBlur(event: FocusEvent) {\n this._focused = false;\n this._onTouchedCallback();\n this._blurEmitter.emit(event);\n }\n\n _handleChange(event: Event) {\n this.value = (<HTMLInputElement>event.target).value;\n this._onTouchedCallback();\n }\n\n _hasPlaceholder(): boolean {\n return !!this.placeholder || this._placeholderChild != null;\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n * TODO: internal\n */\n writeValue(value: any) {\n this._value = value;\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n * TODO: internal\n */\n registerOnChange(fn: any) {\n this._onChangeCallback = fn;\n }\n\n /**\n * Implemented as part of ControlValueAccessor.\n * TODO: internal\n */\n registerOnTouched(fn: any) {\n this._onTouchedCallback = fn;\n }\n\n /** TODO: internal */\n ngAfterContentInit() {\n this._validateConstraints();\n\n // Trigger validation when the hint children change.\n this._hintChildren.changes.subscribe(() => {\n this._validateConstraints();\n });\n }\n\n /** TODO: internal */\n ngOnChanges(changes: {[key: string]: SimpleChange}) {\n this._validateConstraints();\n }\n\n /**\n * Convert the value passed in to a value that is expected from the type of the md-input.\n * This is normally performed by the *_VALUE_ACCESSOR in forms, but since the type is bound\n * on our internal input it won't work locally.\n * @private\n */\n private _convertValueForInputType(v: any): any {\n switch (this.type) {\n case 'number': return parseFloat(v);\n default: return v;\n }\n }\n\n /**\n * Ensure that all constraints defined by the API are validated, or throw errors otherwise.\n * Constraints for now:\n * - placeholder attribute and <md-placeholder> are mutually exclusive.\n * - type attribute is not one of the forbidden types (see constant at the top).\n * - Maximum one of each `<md-hint>` alignment specified, with the attribute being\n * considered as align=\"start\".\n * @private\n */\n private _validateConstraints() {\n if (this.placeholder != '' && this.placeholder != null && this._placeholderChild != null) {\n throw new MdInputPlaceholderConflictError();\n }\n if (MD_INPUT_INVALID_INPUT_TYPE.indexOf(this.type) != -1) {\n throw new MdInputUnsupportedTypeError(this.type);\n }\n\n if (this._hintChildren) {\n // Validate the hint labels.\n let startHint: MdHint = null;\n let endHint: MdHint = null;\n this._hintChildren.forEach((hint: MdHint) => {\n if (hint.align == 'start') {\n if (startHint || this.hintLabel) {\n throw new MdInputDuplicatedHintError('start');\n }\n startHint = hint;\n } else if (hint.align == 'end') {\n if (endHint) {\n throw new MdInputDuplicatedHintError('end');\n }\n endHint = hint;\n }\n });\n }\n }\n}\n\n\n@NgModule({\n declarations: [MdPlaceholder, MdInput, MdHint],\n imports: [CommonModule, FormsModule],\n exports: [MdPlaceholder, MdInput, MdHint],\n})\nexport class MdInputModule {\n static forRoot(): ModuleWithProviders {\n return {\n ngModule: MdInputModule,\n providers: []\n };\n }\n}\n"],"sourceRoot":"/source/"}
\No newline at end of file