UNPKG

@taiga-ui/kit

Version:
94 lines (89 loc) 4.17 kB
import { __decorate, __param } from 'tslib'; import { Optional, Self, Inject, ChangeDetectorRef, Input, ViewChild, HostBinding, Component, ChangeDetectionStrategy, forwardRef, NgModule } from '@angular/core'; import { NgControl, FormsModule } from '@angular/forms'; import { AbstractTuiControl, isNativeFocused, tuiDefaultProp, TUI_FOCUSABLE_ITEM_ACCESSOR, TuiFocusableModule, TuiFocusedModule } from '@taiga-ui/cdk'; import { TUI_VALUE_ACCESSOR_PROVIDER, TuiMaskAccessorModule } from '@taiga-ui/core'; import { CommonModule } from '@angular/common'; var TuiInputInlineComponent_1; let TuiInputInlineComponent = TuiInputInlineComponent_1 = class TuiInputInlineComponent extends AbstractTuiControl { constructor(control, changeDetectorRef) { super(control, changeDetectorRef); this.maxLength = null; } get nativeFocusableElement() { return !this.native ? null : this.native.nativeElement; } get focused() { return isNativeFocused(this.nativeFocusableElement); } get hasValue() { return this.value !== ''; } get maskedValue() { return this.native && this.value ? this.native.nativeElement.value : String(this.value); } onValueChange(value) { this.updateValue(value); } onFocused(focused) { this.updateFocused(focused); } getFallbackValue() { return ''; } }; TuiInputInlineComponent.ctorParameters = () => [ { type: NgControl, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [NgControl,] }] }, { type: ChangeDetectorRef, decorators: [{ type: Inject, args: [ChangeDetectorRef,] }] } ]; __decorate([ Input(), tuiDefaultProp() ], TuiInputInlineComponent.prototype, "maxLength", void 0); __decorate([ ViewChild('native') ], TuiInputInlineComponent.prototype, "native", void 0); __decorate([ HostBinding('attr.data-value') ], TuiInputInlineComponent.prototype, "maskedValue", null); TuiInputInlineComponent = TuiInputInlineComponent_1 = __decorate([ Component({ selector: 'tui-input-inline', template: "<span *ngIf=\"!hasValue\" automation-id=\"tui-input-inline__placeholder\">\n <ng-content></ng-content>\n</span>\n\n<input\n #native\n automation-id=\"tui-input-inline__native\"\n class=\"native\"\n type=\"text\"\n tuiMaskAccessor\n [attr.maxLength]=\"maxLength\"\n [id]=\"id\"\n [disabled]=\"computedDisabled\"\n [readOnly]=\"readOnly\"\n [tuiFocusable]=\"focusable\"\n [ngModel]=\"value\"\n (ngModelChange)=\"onValueChange($event)\"\n (tuiFocusedChange)=\"onFocused($event)\"\n/>\n", changeDetection: ChangeDetectionStrategy.OnPush, providers: [ TUI_VALUE_ACCESSOR_PROVIDER, { provide: TUI_FOCUSABLE_ITEM_ACCESSOR, useExisting: forwardRef(() => TuiInputInlineComponent_1), }, ], styles: [":host{position:relative;display:inline-block;overflow:hidden;white-space:nowrap;box-sizing:border-box}:host:before{content:attr(data-value);padding-right:.02em;visibility:hidden;white-space:pre}.native{position:absolute;top:0;left:0;background-color:transparent;padding:inherit;font:inherit;color:inherit;box-sizing:border-box;width:100%;height:100%;border-width:0;text-align:inherit;letter-spacing:inherit;text-indent:inherit;text-transform:inherit;outline:0}"] }), __param(0, Optional()), __param(0, Self()), __param(0, Inject(NgControl)), __param(1, Inject(ChangeDetectorRef)) ], TuiInputInlineComponent); let TuiInputInlineModule = class TuiInputInlineModule { }; TuiInputInlineModule = __decorate([ NgModule({ imports: [ CommonModule, FormsModule, TuiFocusableModule, TuiFocusedModule, TuiMaskAccessorModule ], declarations: [TuiInputInlineComponent], exports: [TuiInputInlineComponent], }) ], TuiInputInlineModule); /** * Generated bundle index. Do not edit. */ export { TuiInputInlineComponent, TuiInputInlineModule }; //# sourceMappingURL=taiga-ui-kit-components-input-inline.js.map