blob: 20bd36eb77b08e48a12dc9fc977039debd938a03 [file] [log] [blame]
{"version":3,"sources":["src/cdk/cdk-text-field.umd.js"],"names":["global","factory","exports","module","require","define","amd","self","ng","cdk","textField","platform","core","coercion","rxjs","operators","common","this","i1","i0","listenerOptions","normalizePassiveListenerOptions","passive","AutofillMonitor","_platform","_ngZone","_monitoredElements","Map","prototype","monitor","elementOrRef","_this","isBrowser","EMPTY","element","coerceElement","info","get","subject","result","Subject","cssClass","listener","event","animationName","classList","contains","remove","run","next","target","isAutofilled","add","runOutsideAngular","addEventListener","set","unlisten","removeEventListener","stopMonitoring","complete","delete","ngOnDestroy","forEach","_info","ɵprov","ɵɵdefineInjectable","AutofillMonitor_Factory","ɵɵinject","Platform","NgZone","token","providedIn","decorators","type","Injectable","args","ctorParameters","CdkAutofill","_elementRef","_autofillMonitor","cdkAutofill","EventEmitter","ngOnInit","subscribe","emit","Directive","selector","ElementRef","propDecorators","Output","TextFieldModule","CdkTextareaAutosize","document","_destroyed","_enabled","_previousMinRows","_document","_textareaElement","nativeElement","_measuringClass","FIREFOX","Object","defineProperty","_minRows","value","coerceNumberProperty","_setMinHeight","enumerable","configurable","_maxRows","_setMaxHeight","coerceBooleanProperty","resizeToFitContent","reset","minHeight","minRows","_cachedLineHeight","style","maxHeight","maxRows","ngAfterViewInit","_initialHeight","height","window","_getWindow","fromEvent","pipe","auditTime","takeUntil","_cacheTextareaLineHeight","textareaClone","cloneNode","rows","position","visibility","border","padding","overflow","parentNode","appendChild","clientHeight","removeChild","ngDoCheck","force","textarea","_previousValue","placeholderText","placeholder","scrollHeight","requestAnimationFrame","_scrollToCaretPosition","setTimeout","undefined","_noopInputHandler","_getDocument","defaultView","selectionStart","selectionEnd","isStopped","activeElement","setSelectionRange","exportAs","host","class","Optional","Inject","DOCUMENT","Input","enabled","HostListener","NgModule","declarations","imports","PlatformModule"],"mappings":"CAAC,SAAUA,EAAQC,GACI,iBAAZC,SAA0C,oBAAXC,OAAyBF,EAAQC,QAASE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,CAAEC,KAAMtD,EAAGuJ,SAAU/F,KAAM,CAAC,CAChBgG,aAAc,CAAC9F,EAAac,GAC5BiF,QAAS,CAAC1J,EAAG2J,gBACb3K,QAAS,CAAC2E,EAAac;;;;;;;;AAgBvCzF,EAAQqB,gBAAkBA,EAC1BrB,EAAQ2E,YAAcA,EACtB3E,EAAQyF,oBAAsBA,EAC9BzF,EAAQwF,gBAAkBA,EAE1BW,OAAOC,eAAepG,EAAS,aAAc,CAAEsG,OAAO","sourcesContent":["(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/cdk/platform'), require('@angular/core'), require('@angular/cdk/coercion'), require('rxjs'), require('rxjs/operators'), require('@angular/common')) :\n typeof define === 'function' && define.amd ? define('@angular/cdk/text-field', ['exports', '@angular/cdk/platform', '@angular/core', '@angular/cdk/coercion', 'rxjs', 'rxjs/operators', '@angular/common'], factory) :\n (global = global || self, factory((global.ng = global.ng || {}, global.ng.cdk = global.ng.cdk || {}, global.ng.cdk.textField = {}), global.ng.cdk.platform, global.ng.core, global.ng.cdk.coercion, global.rxjs, global.rxjs.operators, global.ng.common));\n}(this, (function (exports, i1, i0, coercion, rxjs, operators, common) { 'use strict';\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /** Options to pass to the animationstart listener. */\n var listenerOptions = i1.normalizePassiveListenerOptions({ passive: true });\n /**\n * An injectable service that can be used to monitor the autofill state of an input.\n * Based on the following blog post:\n * https://medium.com/@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7\n */\n var AutofillMonitor = /** @class */ (function () {\n function AutofillMonitor(_platform, _ngZone) {\n this._platform = _platform;\n this._ngZone = _ngZone;\n this._monitoredElements = new Map();\n }\n AutofillMonitor.prototype.monitor = function (elementOrRef) {\n var _this = this;\n if (!this._platform.isBrowser) {\n return rxjs.EMPTY;\n }\n var element = coercion.coerceElement(elementOrRef);\n var info = this._monitoredElements.get(element);\n if (info) {\n return info.subject;\n }\n var result = new rxjs.Subject();\n var cssClass = 'cdk-text-field-autofilled';\n var listener = (function (event) {\n // Animation events fire on initial element render, we check for the presence of the autofill\n // CSS class to make sure this is a real change in state, not just the initial render before\n // we fire off events.\n if (event.animationName === 'cdk-text-field-autofill-start' &&\n !element.classList.contains(cssClass)) {\n element.classList.add(cssClass);\n _this._ngZone.run(function () { return result.next({ target: event.target, isAutofilled: true }); });\n }\n else if (event.animationName === 'cdk-text-field-autofill-end' &&\n element.classList.contains(cssClass)) {\n element.classList.remove(cssClass);\n _this._ngZone.run(function () { return result.next({ target: event.target, isAutofilled: false }); });\n }\n });\n this._ngZone.runOutsideAngular(function () {\n element.addEventListener('animationstart', listener, listenerOptions);\n element.classList.add('cdk-text-field-autofill-monitored');\n });\n this._monitoredElements.set(element, {\n subject: result,\n unlisten: function () {\n element.removeEventListener('animationstart', listener, listenerOptions);\n }\n });\n return result;\n };\n AutofillMonitor.prototype.stopMonitoring = function (elementOrRef) {\n var element = coercion.coerceElement(elementOrRef);\n var info = this._monitoredElements.get(element);\n if (info) {\n info.unlisten();\n info.subject.complete();\n element.classList.remove('cdk-text-field-autofill-monitored');\n element.classList.remove('cdk-text-field-autofilled');\n this._monitoredElements.delete(element);\n }\n };\n AutofillMonitor.prototype.ngOnDestroy = function () {\n var _this = this;\n this._monitoredElements.forEach(function (_info, element) { return _this.stopMonitoring(element); });\n };\n return AutofillMonitor;\n }());\n AutofillMonitor.ɵprov = i0.ɵɵdefineInjectable({ factory: function AutofillMonitor_Factory() { return new AutofillMonitor(i0.ɵɵinject(i1.Platform), i0.ɵɵinject(i0.NgZone)); }, token: AutofillMonitor, providedIn: \"root\" });\n AutofillMonitor.decorators = [\n { type: i0.Injectable, args: [{ providedIn: 'root' },] }\n ];\n AutofillMonitor.ctorParameters = function () { return [\n { type: i1.Platform },\n { type: i0.NgZone }\n ]; };\n /** A directive that can be used to monitor the autofill state of an input. */\n var CdkAutofill = /** @class */ (function () {\n function CdkAutofill(_elementRef, _autofillMonitor) {\n this._elementRef = _elementRef;\n this._autofillMonitor = _autofillMonitor;\n /** Emits when the autofill state of the element changes. */\n this.cdkAutofill = new i0.EventEmitter();\n }\n CdkAutofill.prototype.ngOnInit = function () {\n var _this = this;\n this._autofillMonitor\n .monitor(this._elementRef)\n .subscribe(function (event) { return _this.cdkAutofill.emit(event); });\n };\n CdkAutofill.prototype.ngOnDestroy = function () {\n this._autofillMonitor.stopMonitoring(this._elementRef);\n };\n return CdkAutofill;\n }());\n CdkAutofill.decorators = [\n { type: i0.Directive, args: [{\n selector: '[cdkAutofill]',\n },] }\n ];\n CdkAutofill.ctorParameters = function () { return [\n { type: i0.ElementRef },\n { type: AutofillMonitor }\n ]; };\n CdkAutofill.propDecorators = {\n cdkAutofill: [{ type: i0.Output }]\n };\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n /** Directive to automatically resize a textarea to fit its content. */\n var CdkTextareaAutosize = /** @class */ (function () {\n function CdkTextareaAutosize(_elementRef, _platform, _ngZone, \n /** @breaking-change 11.0.0 make document required */\n document) {\n this._elementRef = _elementRef;\n this._platform = _platform;\n this._ngZone = _ngZone;\n this._destroyed = new rxjs.Subject();\n this._enabled = true;\n /**\n * Value of minRows as of last resize. If the minRows has decreased, the\n * height of the textarea needs to be recomputed to reflect the new minimum. The maxHeight\n * does not have the same problem because it does not affect the textarea's scrollHeight.\n */\n this._previousMinRows = -1;\n this._document = document;\n this._textareaElement = this._elementRef.nativeElement;\n this._measuringClass = _platform.FIREFOX ?\n 'cdk-textarea-autosize-measuring-firefox' :\n 'cdk-textarea-autosize-measuring';\n }\n Object.defineProperty(CdkTextareaAutosize.prototype, \"minRows\", {\n /** Minimum amount of rows in the textarea. */\n get: function () { return this._minRows; },\n set: function (value) {\n this._minRows = coercion.coerceNumberProperty(value);\n this._setMinHeight();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(CdkTextareaAutosize.prototype, \"maxRows\", {\n /** Maximum amount of rows in the textarea. */\n get: function () { return this._maxRows; },\n set: function (value) {\n this._maxRows = coercion.coerceNumberProperty(value);\n this._setMaxHeight();\n },\n enumerable: false,\n configurable: true\n });\n Object.defineProperty(CdkTextareaAutosize.prototype, \"enabled\", {\n /** Whether autosizing is enabled or not */\n get: function () { return this._enabled; },\n set: function (value) {\n value = coercion.coerceBooleanProperty(value);\n // Only act if the actual value changed. This specifically helps to not run\n // resizeToFitContent too early (i.e. before ngAfterViewInit)\n if (this._enabled !== value) {\n (this._enabled = value) ? this.resizeToFitContent(true) : this.reset();\n }\n },\n enumerable: false,\n configurable: true\n });\n /** Sets the minimum height of the textarea as determined by minRows. */\n CdkTextareaAutosize.prototype._setMinHeight = function () {\n var minHeight = this.minRows && this._cachedLineHeight ?\n this.minRows * this._cachedLineHeight + \"px\" : null;\n if (minHeight) {\n this._textareaElement.style.minHeight = minHeight;\n }\n };\n /** Sets the maximum height of the textarea as determined by maxRows. */\n CdkTextareaAutosize.prototype._setMaxHeight = function () {\n var maxHeight = this.maxRows && this._cachedLineHeight ?\n this.maxRows * this._cachedLineHeight + \"px\" : null;\n if (maxHeight) {\n this._textareaElement.style.maxHeight = maxHeight;\n }\n };\n CdkTextareaAutosize.prototype.ngAfterViewInit = function () {\n var _this = this;\n if (this._platform.isBrowser) {\n // Remember the height which we started with in case autosizing is disabled\n this._initialHeight = this._textareaElement.style.height;\n this.resizeToFitContent();\n this._ngZone.runOutsideAngular(function () {\n var window = _this._getWindow();\n rxjs.fromEvent(window, 'resize')\n .pipe(operators.auditTime(16), operators.takeUntil(_this._destroyed))\n .subscribe(function () { return _this.resizeToFitContent(true); });\n });\n }\n };\n CdkTextareaAutosize.prototype.ngOnDestroy = function () {\n this._destroyed.next();\n this._destroyed.complete();\n };\n /**\n * Cache the height of a single-row textarea if it has not already been cached.\n *\n * We need to know how large a single \"row\" of a textarea is in order to apply minRows and\n * maxRows. For the initial version, we will assume that the height of a single line in the\n * textarea does not ever change.\n */\n CdkTextareaAutosize.prototype._cacheTextareaLineHeight = function () {\n if (this._cachedLineHeight) {\n return;\n }\n // Use a clone element because we have to override some styles.\n var textareaClone = this._textareaElement.cloneNode(false);\n textareaClone.rows = 1;\n // Use `position: absolute` so that this doesn't cause a browser layout and use\n // `visibility: hidden` so that nothing is rendered. Clear any other styles that\n // would affect the height.\n textareaClone.style.position = 'absolute';\n textareaClone.style.visibility = 'hidden';\n textareaClone.style.border = 'none';\n textareaClone.style.padding = '0';\n textareaClone.style.height = '';\n textareaClone.style.minHeight = '';\n textareaClone.style.maxHeight = '';\n // In Firefox it happens that textarea elements are always bigger than the specified amount\n // of rows. This is because Firefox tries to add extra space for the horizontal scrollbar.\n // As a workaround that removes the extra space for the scrollbar, we can just set overflow\n // to hidden. This ensures that there is no invalid calculation of the line height.\n // See Firefox bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=33654\n textareaClone.style.overflow = 'hidden';\n this._textareaElement.parentNode.appendChild(textareaClone);\n this._cachedLineHeight = textareaClone.clientHeight;\n this._textareaElement.parentNode.removeChild(textareaClone);\n // Min and max heights have to be re-calculated if the cached line height changes\n this._setMinHeight();\n this._setMaxHeight();\n };\n CdkTextareaAutosize.prototype.ngDoCheck = function () {\n if (this._platform.isBrowser) {\n this.resizeToFitContent();\n }\n };\n /**\n * Resize the textarea to fit its content.\n * @param force Whether to force a height recalculation. By default the height will be\n * recalculated only if the value changed since the last call.\n */\n CdkTextareaAutosize.prototype.resizeToFitContent = function (force) {\n var _this = this;\n if (force === void 0) { force = false; }\n // If autosizing is disabled, just skip everything else\n if (!this._enabled) {\n return;\n }\n this._cacheTextareaLineHeight();\n // If we haven't determined the line-height yet, we know we're still hidden and there's no point\n // in checking the height of the textarea.\n if (!this._cachedLineHeight) {\n return;\n }\n var textarea = this._elementRef.nativeElement;\n var value = textarea.value;\n // Only resize if the value or minRows have changed since these calculations can be expensive.\n if (!force && this._minRows === this._previousMinRows && value === this._previousValue) {\n return;\n }\n var placeholderText = textarea.placeholder;\n // Reset the textarea height to auto in order to shrink back to its default size.\n // Also temporarily force overflow:hidden, so scroll bars do not interfere with calculations.\n // Long placeholders that are wider than the textarea width may lead to a bigger scrollHeight\n // value. To ensure that the scrollHeight is not bigger than the content, the placeholders\n // need to be removed temporarily.\n textarea.classList.add(this._measuringClass);\n textarea.placeholder = '';\n // The measuring class includes a 2px padding to workaround an issue with Chrome,\n // so we account for that extra space here by subtracting 4 (2px top + 2px bottom).\n var height = textarea.scrollHeight - 4;\n // Use the scrollHeight to know how large the textarea *would* be if fit its entire value.\n textarea.style.height = height + \"px\";\n textarea.classList.remove(this._measuringClass);\n textarea.placeholder = placeholderText;\n this._ngZone.runOutsideAngular(function () {\n if (typeof requestAnimationFrame !== 'undefined') {\n requestAnimationFrame(function () { return _this._scrollToCaretPosition(textarea); });\n }\n else {\n setTimeout(function () { return _this._scrollToCaretPosition(textarea); });\n }\n });\n this._previousValue = value;\n this._previousMinRows = this._minRows;\n };\n /**\n * Resets the textarea to its original size\n */\n CdkTextareaAutosize.prototype.reset = function () {\n // Do not try to change the textarea, if the initialHeight has not been determined yet\n // This might potentially remove styles when reset() is called before ngAfterViewInit\n if (this._initialHeight !== undefined) {\n this._textareaElement.style.height = this._initialHeight;\n }\n };\n // In Ivy the `host` metadata will be merged, whereas in ViewEngine it is overridden. In order\n // to avoid double event listeners, we need to use `HostListener`. Once Ivy is the default, we\n // can move this back into `host`.\n // tslint:disable:no-host-decorator-in-concrete\n CdkTextareaAutosize.prototype._noopInputHandler = function () {\n // no-op handler that ensures we're running change detection on input events.\n };\n /** Access injected document if available or fallback to global document reference */\n CdkTextareaAutosize.prototype._getDocument = function () {\n return this._document || document;\n };\n /** Use defaultView of injected document if available or fallback to global window reference */\n CdkTextareaAutosize.prototype._getWindow = function () {\n var doc = this._getDocument();\n return doc.defaultView || window;\n };\n /**\n * Scrolls a textarea to the caret position. On Firefox resizing the textarea will\n * prevent it from scrolling to the caret position. We need to re-set the selection\n * in order for it to scroll to the proper position.\n */\n CdkTextareaAutosize.prototype._scrollToCaretPosition = function (textarea) {\n var selectionStart = textarea.selectionStart, selectionEnd = textarea.selectionEnd;\n var document = this._getDocument();\n // IE will throw an \"Unspecified error\" if we try to set the selection range after the\n // element has been removed from the DOM. Assert that the directive hasn't been destroyed\n // between the time we requested the animation frame and when it was executed.\n // Also note that we have to assert that the textarea is focused before we set the\n // selection range. Setting the selection range on a non-focused textarea will cause\n // it to receive focus on IE and Edge.\n if (!this._destroyed.isStopped && document.activeElement === textarea) {\n textarea.setSelectionRange(selectionStart, selectionEnd);\n }\n };\n return CdkTextareaAutosize;\n }());\n CdkTextareaAutosize.decorators = [\n { type: i0.Directive, args: [{\n selector: 'textarea[cdkTextareaAutosize]',\n exportAs: 'cdkTextareaAutosize',\n host: {\n 'class': 'cdk-textarea-autosize',\n // Textarea elements that have the directive applied should have a single row by default.\n // Browsers normally show two rows by default and therefore this limits the minRows binding.\n 'rows': '1',\n },\n },] }\n ];\n CdkTextareaAutosize.ctorParameters = function () { return [\n { type: i0.ElementRef },\n { type: i1.Platform },\n { type: i0.NgZone },\n { type: undefined, decorators: [{ type: i0.Optional }, { type: i0.Inject, args: [common.DOCUMENT,] }] }\n ]; };\n CdkTextareaAutosize.propDecorators = {\n minRows: [{ type: i0.Input, args: ['cdkAutosizeMinRows',] }],\n maxRows: [{ type: i0.Input, args: ['cdkAutosizeMaxRows',] }],\n enabled: [{ type: i0.Input, args: ['cdkTextareaAutosize',] }],\n _noopInputHandler: [{ type: i0.HostListener, args: ['input',] }]\n };\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n var TextFieldModule = /** @class */ (function () {\n function TextFieldModule() {\n }\n return TextFieldModule;\n }());\n TextFieldModule.decorators = [\n { type: i0.NgModule, args: [{\n declarations: [CdkAutofill, CdkTextareaAutosize],\n imports: [i1.PlatformModule],\n exports: [CdkAutofill, CdkTextareaAutosize],\n },] }\n ];\n\n /**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n /**\n * Generated bundle index. Do not edit.\n */\n\n exports.AutofillMonitor = AutofillMonitor;\n exports.CdkAutofill = CdkAutofill;\n exports.CdkTextareaAutosize = CdkTextareaAutosize;\n exports.TextFieldModule = TextFieldModule;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n})));\n//# sourceMappingURL=cdk-text-field.umd.js.map\n"]}