@angular/cdk 9.1.1 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/focus-monitor/focus-monitor.d.ts +36 -2
- package/a11y/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +241 -19
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +25 -10
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-clipboard.umd.js +1 -1
- package/bundles/cdk-clipboard.umd.js.map +1 -1
- package/bundles/cdk-clipboard.umd.min.js +1 -1
- package/bundles/cdk-clipboard.umd.min.js.map +1 -1
- package/bundles/cdk-coercion.umd.js +0 -1
- package/bundles/cdk-coercion.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.min.js.map +1 -1
- package/bundles/cdk-collections.umd.js +203 -6
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.min.js +17 -10
- package/bundles/cdk-collections.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +217 -23
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +25 -10
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +210 -12
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +27 -12
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +11 -0
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +6 -6
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-portal.umd.js +211 -14
- package/bundles/cdk-portal.umd.js.map +1 -1
- package/bundles/cdk-portal.umd.min.js +19 -4
- package/bundles/cdk-portal.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +242 -14
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +14 -6
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +278 -50
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +29 -7
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.js +254 -49
- package/bundles/cdk-testing-protractor.umd.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.min.js +16 -9
- package/bundles/cdk-testing-protractor.umd.min.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.js +257 -54
- package/bundles/cdk-testing-testbed.umd.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.min.js +23 -8
- package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
- package/bundles/cdk-testing.umd.js +243 -46
- package/bundles/cdk-testing.umd.js.map +1 -1
- package/bundles/cdk-testing.umd.min.js +20 -5
- package/bundles/cdk-testing.umd.min.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +21 -6
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +3 -3
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +212 -15
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js +17 -3
- package/bundles/cdk-tree.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/coercion/array.d.ts +1 -0
- package/esm2015/a11y/focus-monitor/focus-monitor.js +93 -12
- package/esm2015/a11y/focus-trap/configurable-focus-trap-factory.js +3 -3
- package/esm2015/a11y/focus-trap/focus-trap.js +1 -1
- package/esm2015/a11y/live-announcer/live-announcer.js +1 -1
- package/esm2015/a11y/public-api.js +2 -2
- package/esm2015/bidi/directionality.js +1 -1
- package/esm2015/clipboard/pending-copy.js +3 -3
- package/esm2015/coercion/array.js +1 -2
- package/esm2015/drag-drop/drag-drop.js +1 -1
- package/esm2015/drag-drop/drag-ref.js +7 -5
- package/esm2015/drag-drop/drop-list-ref.js +11 -19
- package/esm2015/layout/breakpoints-observer.js +1 -1
- package/esm2015/overlay/position/flexible-connected-position-strategy.js +3 -2
- package/esm2015/overlay/position/overlay-position-builder.js +1 -1
- package/esm2015/platform/features/shadow-dom.js +16 -1
- package/esm2015/platform/public-api.js +2 -2
- package/esm2015/scrolling/scroll-dispatcher.js +38 -5
- package/esm2015/scrolling/viewport-ruler.js +44 -5
- package/esm2015/table/cell.js +18 -8
- package/esm2015/table/public-api.js +3 -2
- package/esm2015/table/row.js +24 -8
- package/esm2015/table/table.js +26 -12
- package/esm2015/table/text-column.js +3 -26
- package/esm2015/table/tokens.js +44 -0
- package/esm2015/testing/protractor/protractor-element.js +4 -2
- package/esm2015/testing/protractor/protractor-harness-environment.js +13 -8
- package/esm2015/testing/testbed/testbed-harness-environment.js +16 -10
- package/esm2015/text-field/autosize.js +38 -4
- package/esm2015/version.js +1 -1
- package/esm5/a11y/focus-monitor/focus-monitor.js +39 -13
- package/esm5/a11y/focus-trap/configurable-focus-trap-factory.js +3 -3
- package/esm5/a11y/focus-trap/focus-trap.js +1 -1
- package/esm5/a11y/live-announcer/live-announcer.js +1 -1
- package/esm5/bidi/directionality.js +1 -1
- package/esm5/clipboard/pending-copy.js +2 -2
- package/esm5/coercion/array.js +1 -2
- package/esm5/drag-drop/drag-drop.js +1 -1
- package/esm5/drag-drop/drag-ref.js +7 -5
- package/esm5/drag-drop/drop-list-ref.js +9 -14
- package/esm5/layout/breakpoints-observer.js +1 -1
- package/esm5/overlay/position/flexible-connected-position-strategy.js +3 -2
- package/esm5/overlay/position/overlay-position-builder.js +1 -1
- package/esm5/platform/features/shadow-dom.js +11 -1
- package/esm5/scrolling/scroll-dispatcher.js +21 -5
- package/esm5/scrolling/viewport-ruler.js +24 -5
- package/esm5/table/cell.js +13 -8
- package/esm5/table/public-api.js +2 -1
- package/esm5/table/row.js +21 -11
- package/esm5/table/table.js +16 -11
- package/esm5/table/text-column.js +3 -4
- package/esm5/table/tokens.js +16 -0
- package/esm5/testing/protractor/protractor-element.js +4 -2
- package/esm5/testing/protractor/protractor-harness-environment.js +17 -11
- package/esm5/testing/testbed/testbed-harness-environment.js +17 -11
- package/esm5/text-field/autosize.js +20 -4
- package/esm5/version.js +1 -1
- package/fesm2015/a11y.js +89 -11
- package/fesm2015/a11y.js.map +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/clipboard.js +2 -2
- package/fesm2015/clipboard.js.map +1 -1
- package/fesm2015/coercion.js +0 -1
- package/fesm2015/coercion.js.map +1 -1
- package/fesm2015/drag-drop.js +16 -22
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js +2 -1
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/platform.js +16 -1
- package/fesm2015/platform.js.map +1 -1
- package/fesm2015/scrolling.js +76 -7
- package/fesm2015/scrolling.js.map +1 -1
- package/fesm2015/table.js +98 -49
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/testing/protractor.js +16 -9
- package/fesm2015/testing/protractor.js.map +1 -1
- package/fesm2015/testing/testbed.js +15 -9
- package/fesm2015/testing/testbed.js.map +1 -1
- package/fesm2015/text-field.js +37 -3
- package/fesm2015/text-field.js.map +1 -1
- package/fesm5/a11y.js +36 -12
- package/fesm5/a11y.js.map +1 -1
- package/fesm5/cdk.js +1 -1
- package/fesm5/cdk.js.map +1 -1
- package/fesm5/clipboard.js +1 -1
- package/fesm5/clipboard.js.map +1 -1
- package/fesm5/coercion.js +0 -1
- package/fesm5/coercion.js.map +1 -1
- package/fesm5/drag-drop.js +14 -17
- package/fesm5/drag-drop.js.map +1 -1
- package/fesm5/overlay.js +2 -1
- package/fesm5/overlay.js.map +1 -1
- package/fesm5/platform.js +11 -1
- package/fesm5/platform.js.map +1 -1
- package/fesm5/scrolling.js +39 -7
- package/fesm5/scrolling.js.map +1 -1
- package/fesm5/table.js +59 -29
- package/fesm5/table.js.map +1 -1
- package/fesm5/testing/protractor.js +20 -12
- package/fesm5/testing/protractor.js.map +1 -1
- package/fesm5/testing/testbed.js +16 -10
- package/fesm5/testing/testbed.js.map +1 -1
- package/fesm5/text-field.js +19 -3
- package/fesm5/text-field.js.map +1 -1
- package/package.json +1 -1
- package/platform/features/shadow-dom.d.ts +2 -0
- package/platform/index.metadata.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-update/upgrade-rules/class-names-rule.js +3 -1
- package/schematics/utils/ast/ng-module-imports.js +3 -2
- package/scrolling/index.metadata.json +1 -1
- package/scrolling/scroll-dispatcher.d.ts +9 -1
- package/scrolling/viewport-ruler.d.ts +9 -1
- package/table/cell.d.ts +2 -0
- package/table/index.metadata.json +1 -1
- package/table/public-api.d.ts +1 -0
- package/table/row.d.ts +6 -3
- package/table/table.d.ts +2 -0
- package/table/text-column.d.ts +2 -13
- package/table/tokens.d.ts +25 -0
- package/testing/protractor/protractor-harness-environment.d.ts +10 -3
- package/testing/testbed/testbed-harness-environment.d.ts +12 -4
- package/text-field/autosize.d.ts +9 -1
- package/text-field/index.metadata.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-field.js","sources":["../../../../../../src/cdk/text-field/autofill.ts","../../../../../../src/cdk/text-field/autosize.ts","../../../../../../src/cdk/text-field/text-field-module.ts","../../../../../../src/cdk/text-field/index.ts"],"sourcesContent":["/**\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\nimport {Platform, normalizePassiveListenerOptions} from '@angular/cdk/platform';\nimport {\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n NgZone,\n OnDestroy,\n OnInit,\n Output,\n} from '@angular/core';\nimport {coerceElement} from '@angular/cdk/coercion';\nimport {EMPTY, Observable, Subject} from 'rxjs';\n\n\n/** An event that is emitted when the autofill state of an input changes. */\nexport type AutofillEvent = {\n /** The element whose autofill state changes. */\n target: Element;\n /** Whether the element is currently autofilled. */\n isAutofilled: boolean;\n};\n\n\n/** Used to track info about currently monitored elements. */\ntype MonitoredElementInfo = {\n subject: Subject<AutofillEvent>;\n unlisten: () => void;\n};\n\n\n/** Options to pass to the animationstart listener. */\nconst listenerOptions = normalizePassiveListenerOptions({passive: true});\n\n\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@Injectable({providedIn: 'root'})\nexport class AutofillMonitor implements OnDestroy {\n private _monitoredElements = new Map<Element, MonitoredElementInfo>();\n\n constructor(private _platform: Platform, private _ngZone: NgZone) {}\n\n /**\n * Monitor for changes in the autofill state of the given input element.\n * @param element The element to monitor.\n * @return A stream of autofill state changes.\n */\n monitor(element: Element): Observable<AutofillEvent>;\n\n /**\n * Monitor for changes in the autofill state of the given input element.\n * @param element The element to monitor.\n * @return A stream of autofill state changes.\n */\n monitor(element: ElementRef<Element>): Observable<AutofillEvent>;\n\n monitor(elementOrRef: Element | ElementRef<Element>): Observable<AutofillEvent> {\n if (!this._platform.isBrowser) {\n return EMPTY;\n }\n\n const element = coerceElement(elementOrRef);\n const info = this._monitoredElements.get(element);\n\n if (info) {\n return info.subject.asObservable();\n }\n\n const result = new Subject<AutofillEvent>();\n const cssClass = 'cdk-text-field-autofilled';\n const listener = ((event: AnimationEvent) => {\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(() => result.next({target: event.target as Element, isAutofilled: true}));\n } else if (event.animationName === 'cdk-text-field-autofill-end' &&\n element.classList.contains(cssClass)) {\n element.classList.remove(cssClass);\n this._ngZone.run(() => result.next({target: event.target as Element, isAutofilled: false}));\n }\n }) as EventListenerOrEventListenerObject;\n\n this._ngZone.runOutsideAngular(() => {\n element.addEventListener('animationstart', listener, listenerOptions);\n element.classList.add('cdk-text-field-autofill-monitored');\n });\n\n this._monitoredElements.set(element, {\n subject: result,\n unlisten: () => {\n element.removeEventListener('animationstart', listener, listenerOptions);\n }\n });\n\n return result.asObservable();\n }\n\n /**\n * Stop monitoring the autofill state of the given input element.\n * @param element The element to stop monitoring.\n */\n stopMonitoring(element: Element): void;\n\n /**\n * Stop monitoring the autofill state of the given input element.\n * @param element The element to stop monitoring.\n */\n stopMonitoring(element: ElementRef<Element>): void;\n\n stopMonitoring(elementOrRef: Element | ElementRef<Element>): void {\n const element = coerceElement(elementOrRef);\n const info = this._monitoredElements.get(element);\n\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\n ngOnDestroy() {\n this._monitoredElements.forEach((_info, element) => this.stopMonitoring(element));\n }\n}\n\n\n/** A directive that can be used to monitor the autofill state of an input. */\n@Directive({\n selector: '[cdkAutofill]',\n})\nexport class CdkAutofill implements OnDestroy, OnInit {\n /** Emits when the autofill state of the element changes. */\n @Output() cdkAutofill: EventEmitter<AutofillEvent> = new EventEmitter<AutofillEvent>();\n\n constructor(private _elementRef: ElementRef<HTMLElement>,\n private _autofillMonitor: AutofillMonitor) {}\n\n ngOnInit() {\n this._autofillMonitor\n .monitor(this._elementRef)\n .subscribe(event => this.cdkAutofill.emit(event));\n }\n\n ngOnDestroy() {\n this._autofillMonitor.stopMonitoring(this._elementRef);\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\nimport {\n BooleanInput,\n coerceBooleanProperty,\n coerceNumberProperty,\n NumberInput\n} from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n Input,\n AfterViewInit,\n DoCheck,\n OnDestroy,\n NgZone,\n HostListener,\n} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\nimport {auditTime, takeUntil} from 'rxjs/operators';\nimport {fromEvent, Subject} from 'rxjs';\n\n\n/** Directive to automatically resize a textarea to fit its content. */\n@Directive({\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})\nexport class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {\n /** Keep track of the previous textarea value to avoid resizing when the value hasn't changed. */\n private _previousValue?: string;\n private _initialHeight: string | undefined;\n private readonly _destroyed = new Subject<void>();\n\n private _minRows: number;\n private _maxRows: number;\n private _enabled: boolean = true;\n\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 private _previousMinRows: number = -1;\n\n private _textareaElement: HTMLTextAreaElement;\n\n /** Minimum amount of rows in the textarea. */\n @Input('cdkAutosizeMinRows')\n get minRows(): number { return this._minRows; }\n set minRows(value: number) {\n this._minRows = coerceNumberProperty(value);\n this._setMinHeight();\n }\n\n /** Maximum amount of rows in the textarea. */\n @Input('cdkAutosizeMaxRows')\n get maxRows(): number { return this._maxRows; }\n set maxRows(value: number) {\n this._maxRows = coerceNumberProperty(value);\n this._setMaxHeight();\n }\n\n /** Whether autosizing is enabled or not */\n @Input('cdkTextareaAutosize')\n get enabled(): boolean { return this._enabled; }\n set enabled(value: boolean) {\n value = coerceBooleanProperty(value);\n\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\n /** Cached height of a textarea with a single row. */\n private _cachedLineHeight: number;\n\n constructor(\n private _elementRef: ElementRef<HTMLElement>,\n private _platform: Platform,\n private _ngZone: NgZone) {\n this._textareaElement = this._elementRef.nativeElement as HTMLTextAreaElement;\n }\n\n /** Sets the minimum height of the textarea as determined by minRows. */\n _setMinHeight(): void {\n const minHeight = this.minRows && this._cachedLineHeight ?\n `${this.minRows * this._cachedLineHeight}px` : null;\n\n if (minHeight) {\n this._textareaElement.style.minHeight = minHeight;\n }\n }\n\n /** Sets the maximum height of the textarea as determined by maxRows. */\n _setMaxHeight(): void {\n const maxHeight = this.maxRows && this._cachedLineHeight ?\n `${this.maxRows * this._cachedLineHeight}px` : null;\n\n if (maxHeight) {\n this._textareaElement.style.maxHeight = maxHeight;\n }\n }\n\n ngAfterViewInit() {\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\n this.resizeToFitContent();\n\n this._ngZone.runOutsideAngular(() => {\n fromEvent(window, 'resize')\n .pipe(auditTime(16), takeUntil(this._destroyed))\n .subscribe(() => this.resizeToFitContent(true));\n });\n }\n }\n\n ngOnDestroy() {\n this._destroyed.next();\n this._destroyed.complete();\n }\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 private _cacheTextareaLineHeight(): void {\n if (this._cachedLineHeight) {\n return;\n }\n\n // Use a clone element because we have to override some styles.\n let textareaClone = this._textareaElement.cloneNode(false) as HTMLTextAreaElement;\n textareaClone.rows = 1;\n\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\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\n this._textareaElement.parentNode!.appendChild(textareaClone);\n this._cachedLineHeight = textareaClone.clientHeight;\n this._textareaElement.parentNode!.removeChild(textareaClone);\n\n // Min and max heights have to be re-calculated if the cached line height changes\n this._setMinHeight();\n this._setMaxHeight();\n }\n\n ngDoCheck() {\n if (this._platform.isBrowser) {\n this.resizeToFitContent();\n }\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 resizeToFitContent(force: boolean = false) {\n // If autosizing is disabled, just skip everything else\n if (!this._enabled) {\n return;\n }\n\n this._cacheTextareaLineHeight();\n\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\n const textarea = this._elementRef.nativeElement as HTMLTextAreaElement;\n const value = textarea.value;\n\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\n const placeholderText = textarea.placeholder;\n\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('cdk-textarea-autosize-measuring');\n textarea.placeholder = '';\n\n // The cdk-textarea-autosize-measuring class includes a 2px padding to workaround an issue with\n // Chrome, so we account for that extra space here by subtracting 4 (2px top + 2px bottom).\n const height = textarea.scrollHeight - 4;\n\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('cdk-textarea-autosize-measuring');\n textarea.placeholder = placeholderText;\n\n this._ngZone.runOutsideAngular(() => {\n if (typeof requestAnimationFrame !== 'undefined') {\n requestAnimationFrame(() => this._scrollToCaretPosition(textarea));\n } else {\n setTimeout(() => this._scrollToCaretPosition(textarea));\n }\n });\n\n this._previousValue = value;\n this._previousMinRows = this._minRows;\n }\n\n /**\n * Resets the textarea to its original size\n */\n reset() {\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\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 @HostListener('input')\n _noopInputHandler() {\n // no-op handler that ensures we're running change detection on input events.\n }\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 private _scrollToCaretPosition(textarea: HTMLTextAreaElement) {\n const {selectionStart, selectionEnd} = textarea;\n\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\n static ngAcceptInputType_minRows: NumberInput;\n static ngAcceptInputType_maxRows: NumberInput;\n static ngAcceptInputType_enabled: BooleanInput;\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\nimport {PlatformModule} from '@angular/cdk/platform';\nimport {NgModule} from '@angular/core';\nimport {CdkAutofill} from './autofill';\nimport {CdkTextareaAutosize} from './autosize';\n\n\n@NgModule({\n declarations: [CdkAutofill, CdkTextareaAutosize],\n imports: [PlatformModule],\n exports: [CdkAutofill, CdkTextareaAutosize],\n})\nexport class TextFieldModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;MAwCM,eAAe,GAAG,+BAA+B,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;;;;;;AASxE,MAAa,eAAe;;;;;IAG1B,YAAoB,SAAmB,EAAU,OAAe;QAA5C,cAAS,GAAT,SAAS,CAAU;QAAU,YAAO,GAAP,OAAO,CAAQ;QAFxD,uBAAkB,GAAG,IAAI,GAAG,EAAiC,CAAC;KAEF;;;;;IAgBpE,OAAO,CAAC,YAA2C;QACjD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;YAC7B,OAAO,KAAK,CAAC;SACd;;cAEK,OAAO,GAAG,aAAa,CAAC,YAAY,CAAC;;cACrC,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC;QAEjD,IAAI,IAAI,EAAE;YACR,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;SACpC;;cAEK,MAAM,GAAG,IAAI,OAAO,EAAiB;;cACrC,QAAQ,GAAG,2BAA2B;;cACtC,QAAQ;;;;QAAI,CAAC,KAAqB;;;;YAItC,IAAI,KAAK,CAAC,aAAa,KAAK,+BAA+B;gBACvD,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;gBACzC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAChC,IAAI,CAAC,OAAO,CAAC,GAAG;;;gBAAC,MAAM,MAAM,CAAC,IAAI,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AE,qBAAqB;gBAC/B,IAAI,EAAE;oBACJ,OAAO,EAAE,uBAAuB;;;oBAGhC,MAAM,EAAE,GAAG;iBACZ;aACF;;;;YAvBC,UAAU;YAQJ,QAAQ;YAHd,MAAM;;;sBAuCL,KAAK,SAAC,oBAAoB;sBAQ1B,KAAK,SAAC,oBAAoB;sBAQ1B,KAAK,SAAC,qBAAqB;gCAwL3B,YAAY,SAAC,OAAO;;;;IAwBrB,8CAA8C;;IAC9C,8CAA8C;;IAC9C,8CAA+C;;;;;;IApP/C,6CAAgC;;;;;IAChC,6CAA2C;;;;;IAC3C,yCAAkD;;;;;IAElD,uCAAyB;;;;;IACzB,uCAAyB;;;;;IACzB,uCAAiC;;;;;;;;IAOjC,+CAAsC;;;;;IAEtC,+CAA8C;;;;;;IAgC9C,gDAAkC;;;;;IAGhC,0CAA4C;;;;;IAC5C,wCAA2B;;;;;IAC3B,sCAAuB;;;;;;;;MC3Ed,eAAe;;;YAL3B,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;gBAChD,OAAO,EAAE,CAAC,cAAc,CAAC;gBACzB,OAAO,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;aAC5C;;;;;;;;;AClBD;;GAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"text-field.js","sources":["../../../../../../src/cdk/text-field/autofill.ts","../../../../../../src/cdk/text-field/autosize.ts","../../../../../../src/cdk/text-field/text-field-module.ts","../../../../../../src/cdk/text-field/index.ts"],"sourcesContent":["/**\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\nimport {Platform, normalizePassiveListenerOptions} from '@angular/cdk/platform';\nimport {\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n NgZone,\n OnDestroy,\n OnInit,\n Output,\n} from '@angular/core';\nimport {coerceElement} from '@angular/cdk/coercion';\nimport {EMPTY, Observable, Subject} from 'rxjs';\n\n\n/** An event that is emitted when the autofill state of an input changes. */\nexport type AutofillEvent = {\n /** The element whose autofill state changes. */\n target: Element;\n /** Whether the element is currently autofilled. */\n isAutofilled: boolean;\n};\n\n\n/** Used to track info about currently monitored elements. */\ntype MonitoredElementInfo = {\n subject: Subject<AutofillEvent>;\n unlisten: () => void;\n};\n\n\n/** Options to pass to the animationstart listener. */\nconst listenerOptions = normalizePassiveListenerOptions({passive: true});\n\n\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@Injectable({providedIn: 'root'})\nexport class AutofillMonitor implements OnDestroy {\n private _monitoredElements = new Map<Element, MonitoredElementInfo>();\n\n constructor(private _platform: Platform, private _ngZone: NgZone) {}\n\n /**\n * Monitor for changes in the autofill state of the given input element.\n * @param element The element to monitor.\n * @return A stream of autofill state changes.\n */\n monitor(element: Element): Observable<AutofillEvent>;\n\n /**\n * Monitor for changes in the autofill state of the given input element.\n * @param element The element to monitor.\n * @return A stream of autofill state changes.\n */\n monitor(element: ElementRef<Element>): Observable<AutofillEvent>;\n\n monitor(elementOrRef: Element | ElementRef<Element>): Observable<AutofillEvent> {\n if (!this._platform.isBrowser) {\n return EMPTY;\n }\n\n const element = coerceElement(elementOrRef);\n const info = this._monitoredElements.get(element);\n\n if (info) {\n return info.subject.asObservable();\n }\n\n const result = new Subject<AutofillEvent>();\n const cssClass = 'cdk-text-field-autofilled';\n const listener = ((event: AnimationEvent) => {\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(() => result.next({target: event.target as Element, isAutofilled: true}));\n } else if (event.animationName === 'cdk-text-field-autofill-end' &&\n element.classList.contains(cssClass)) {\n element.classList.remove(cssClass);\n this._ngZone.run(() => result.next({target: event.target as Element, isAutofilled: false}));\n }\n }) as EventListenerOrEventListenerObject;\n\n this._ngZone.runOutsideAngular(() => {\n element.addEventListener('animationstart', listener, listenerOptions);\n element.classList.add('cdk-text-field-autofill-monitored');\n });\n\n this._monitoredElements.set(element, {\n subject: result,\n unlisten: () => {\n element.removeEventListener('animationstart', listener, listenerOptions);\n }\n });\n\n return result.asObservable();\n }\n\n /**\n * Stop monitoring the autofill state of the given input element.\n * @param element The element to stop monitoring.\n */\n stopMonitoring(element: Element): void;\n\n /**\n * Stop monitoring the autofill state of the given input element.\n * @param element The element to stop monitoring.\n */\n stopMonitoring(element: ElementRef<Element>): void;\n\n stopMonitoring(elementOrRef: Element | ElementRef<Element>): void {\n const element = coerceElement(elementOrRef);\n const info = this._monitoredElements.get(element);\n\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\n ngOnDestroy() {\n this._monitoredElements.forEach((_info, element) => this.stopMonitoring(element));\n }\n}\n\n\n/** A directive that can be used to monitor the autofill state of an input. */\n@Directive({\n selector: '[cdkAutofill]',\n})\nexport class CdkAutofill implements OnDestroy, OnInit {\n /** Emits when the autofill state of the element changes. */\n @Output() cdkAutofill: EventEmitter<AutofillEvent> = new EventEmitter<AutofillEvent>();\n\n constructor(private _elementRef: ElementRef<HTMLElement>,\n private _autofillMonitor: AutofillMonitor) {}\n\n ngOnInit() {\n this._autofillMonitor\n .monitor(this._elementRef)\n .subscribe(event => this.cdkAutofill.emit(event));\n }\n\n ngOnDestroy() {\n this._autofillMonitor.stopMonitoring(this._elementRef);\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\nimport {\n BooleanInput,\n coerceBooleanProperty,\n coerceNumberProperty,\n NumberInput\n} from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n Input,\n AfterViewInit,\n DoCheck,\n OnDestroy,\n NgZone,\n HostListener,\n Optional,\n Inject,\n} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\nimport {auditTime, takeUntil} from 'rxjs/operators';\nimport {fromEvent, Subject} from 'rxjs';\nimport {DOCUMENT} from '@angular/common';\n\n/** Directive to automatically resize a textarea to fit its content. */\n@Directive({\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})\nexport class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {\n /** Keep track of the previous textarea value to avoid resizing when the value hasn't changed. */\n private _previousValue?: string;\n private _initialHeight: string | undefined;\n private readonly _destroyed = new Subject<void>();\n\n private _minRows: number;\n private _maxRows: number;\n private _enabled: boolean = true;\n\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 private _previousMinRows: number = -1;\n\n private _textareaElement: HTMLTextAreaElement;\n\n /** Minimum amount of rows in the textarea. */\n @Input('cdkAutosizeMinRows')\n get minRows(): number { return this._minRows; }\n set minRows(value: number) {\n this._minRows = coerceNumberProperty(value);\n this._setMinHeight();\n }\n\n /** Maximum amount of rows in the textarea. */\n @Input('cdkAutosizeMaxRows')\n get maxRows(): number { return this._maxRows; }\n set maxRows(value: number) {\n this._maxRows = coerceNumberProperty(value);\n this._setMaxHeight();\n }\n\n /** Whether autosizing is enabled or not */\n @Input('cdkTextareaAutosize')\n get enabled(): boolean { return this._enabled; }\n set enabled(value: boolean) {\n value = coerceBooleanProperty(value);\n\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\n /** Cached height of a textarea with a single row. */\n private _cachedLineHeight: number;\n\n /** Used to reference correct document/window */\n protected _document?: Document;\n\n constructor(private _elementRef: ElementRef<HTMLElement>,\n private _platform: Platform,\n private _ngZone: NgZone,\n /** @breaking-change 11.0.0 make document required */\n @Optional() @Inject(DOCUMENT) document?: any) {\n this._document = document;\n\n this._textareaElement = this._elementRef.nativeElement as HTMLTextAreaElement;\n }\n\n /** Sets the minimum height of the textarea as determined by minRows. */\n _setMinHeight(): void {\n const minHeight = this.minRows && this._cachedLineHeight ?\n `${this.minRows * this._cachedLineHeight}px` : null;\n\n if (minHeight) {\n this._textareaElement.style.minHeight = minHeight;\n }\n }\n\n /** Sets the maximum height of the textarea as determined by maxRows. */\n _setMaxHeight(): void {\n const maxHeight = this.maxRows && this._cachedLineHeight ?\n `${this.maxRows * this._cachedLineHeight}px` : null;\n\n if (maxHeight) {\n this._textareaElement.style.maxHeight = maxHeight;\n }\n }\n\n ngAfterViewInit() {\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\n this.resizeToFitContent();\n\n this._ngZone.runOutsideAngular(() => {\n const window = this._getWindow();\n\n fromEvent(window, 'resize')\n .pipe(auditTime(16), takeUntil(this._destroyed))\n .subscribe(() => this.resizeToFitContent(true));\n });\n }\n }\n\n ngOnDestroy() {\n this._destroyed.next();\n this._destroyed.complete();\n }\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 private _cacheTextareaLineHeight(): void {\n if (this._cachedLineHeight) {\n return;\n }\n\n // Use a clone element because we have to override some styles.\n let textareaClone = this._textareaElement.cloneNode(false) as HTMLTextAreaElement;\n textareaClone.rows = 1;\n\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\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\n this._textareaElement.parentNode!.appendChild(textareaClone);\n this._cachedLineHeight = textareaClone.clientHeight;\n this._textareaElement.parentNode!.removeChild(textareaClone);\n\n // Min and max heights have to be re-calculated if the cached line height changes\n this._setMinHeight();\n this._setMaxHeight();\n }\n\n ngDoCheck() {\n if (this._platform.isBrowser) {\n this.resizeToFitContent();\n }\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 resizeToFitContent(force: boolean = false) {\n // If autosizing is disabled, just skip everything else\n if (!this._enabled) {\n return;\n }\n\n this._cacheTextareaLineHeight();\n\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\n const textarea = this._elementRef.nativeElement as HTMLTextAreaElement;\n const value = textarea.value;\n\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\n const placeholderText = textarea.placeholder;\n\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('cdk-textarea-autosize-measuring');\n textarea.placeholder = '';\n\n // The cdk-textarea-autosize-measuring class includes a 2px padding to workaround an issue with\n // Chrome, so we account for that extra space here by subtracting 4 (2px top + 2px bottom).\n const height = textarea.scrollHeight - 4;\n\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('cdk-textarea-autosize-measuring');\n textarea.placeholder = placeholderText;\n\n this._ngZone.runOutsideAngular(() => {\n if (typeof requestAnimationFrame !== 'undefined') {\n requestAnimationFrame(() => this._scrollToCaretPosition(textarea));\n } else {\n setTimeout(() => this._scrollToCaretPosition(textarea));\n }\n });\n\n this._previousValue = value;\n this._previousMinRows = this._minRows;\n }\n\n /**\n * Resets the textarea to its original size\n */\n reset() {\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\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 @HostListener('input')\n _noopInputHandler() {\n // no-op handler that ensures we're running change detection on input events.\n }\n\n /** Access injected document if available or fallback to global document reference */\n private _getDocument(): Document {\n return this._document || document;\n }\n\n /** Use defaultView of injected document if available or fallback to global window reference */\n private _getWindow(): Window {\n const doc = this._getDocument();\n return doc.defaultView || window;\n }\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 private _scrollToCaretPosition(textarea: HTMLTextAreaElement) {\n const {selectionStart, selectionEnd} = textarea;\n const document = this._getDocument();\n\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\n static ngAcceptInputType_minRows: NumberInput;\n static ngAcceptInputType_maxRows: NumberInput;\n static ngAcceptInputType_enabled: BooleanInput;\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\nimport {PlatformModule} from '@angular/cdk/platform';\nimport {NgModule} from '@angular/core';\nimport {CdkAutofill} from './autofill';\nimport {CdkTextareaAutosize} from './autosize';\n\n\n@NgModule({\n declarations: [CdkAutofill, CdkTextareaAutosize],\n imports: [PlatformModule],\n exports: [CdkAutofill, CdkTextareaAutosize],\n})\nexport class TextFieldModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;MAwCM,eAAe,GAAG,+BAA+B,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC;;;;;;AASxE,MAAa,eAAe;;;;;IAG1B,YAAoB,SAAmB,EAAU,OAAe;QAA5C,cAAS,GAAT,SAAS,CAAU;QAAU,YAAO,GAAP,OAAO,CAAQ;QAFxD,uBAAkB,GAAG,IAAI,GAAG,EAAiC,CAAC;KAEF;;;;;IAgBpE,OAAO,CAAC,YAA2C;QACjD,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;YAC7B,OAAO,KAAK,CAAC;SACd;;cAEK,OAAO,GAAG,aAAa,CAAC,YAAY,CAAC;;cACrC,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC;QAEjD,IAAI,IAAI,EAAE;YACR,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;SACpC;;cAEK,MAAM,GAAG,IAAI,OAAO,EAAiB;;cACrC,QAAQ,GAAG,2BAA2B;;cACtC,Q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;;;;;IAC3B,sCAAuB;;;;;;;;MC/ExB,eAAe;;;YAL3B,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;gBAChD,OAAO,EAAE,CAAC,cAAc,CAAC;gBACzB,OAAO,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;aAC5C;;;;;;;;;AClBD;;GAEG;;;;"}
|
package/fesm5/a11y.js
CHANGED
|
@@ -1698,6 +1698,8 @@ var CdkAriaLive = /** @class */ (function () {
|
|
|
1698
1698
|
// This is the value used by AngularJS Material. Through trial and error (on iPhone 6S) they found
|
|
1699
1699
|
// that a value of around 650ms seems appropriate.
|
|
1700
1700
|
var TOUCH_BUFFER_MS = 650;
|
|
1701
|
+
/** InjectionToken for FocusMonitorOptions. */
|
|
1702
|
+
var FOCUS_MONITOR_DEFAULT_OPTIONS = new InjectionToken('cdk-focus-monitor-default-options');
|
|
1701
1703
|
/**
|
|
1702
1704
|
* Event listener options that enable capturing and also
|
|
1703
1705
|
* mark the listener as passive if the browser supports it.
|
|
@@ -1708,7 +1710,9 @@ var captureEventListenerOptions = normalizePassiveListenerOptions({
|
|
|
1708
1710
|
});
|
|
1709
1711
|
/** Monitors mouse and keyboard events to determine the cause of focus events. */
|
|
1710
1712
|
var FocusMonitor = /** @class */ (function () {
|
|
1711
|
-
function FocusMonitor(_ngZone, _platform
|
|
1713
|
+
function FocusMonitor(_ngZone, _platform,
|
|
1714
|
+
/** @breaking-change 11.0.0 make document required */
|
|
1715
|
+
document, options) {
|
|
1712
1716
|
var _this = this;
|
|
1713
1717
|
this._ngZone = _ngZone;
|
|
1714
1718
|
this._platform = _platform;
|
|
@@ -1767,6 +1771,8 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1767
1771
|
_this._windowFocused = true;
|
|
1768
1772
|
_this._windowFocusTimeoutId = setTimeout(function () { return _this._windowFocused = false; });
|
|
1769
1773
|
};
|
|
1774
|
+
this._document = document;
|
|
1775
|
+
this._detectionMode = (options === null || options === void 0 ? void 0 : options.detectionMode) || 0 /* IMMEDIATE */;
|
|
1770
1776
|
}
|
|
1771
1777
|
FocusMonitor.prototype.monitor = function (element, checkChildren) {
|
|
1772
1778
|
var _this = this;
|
|
@@ -1828,6 +1834,15 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1828
1834
|
var _this = this;
|
|
1829
1835
|
this._elementInfo.forEach(function (_info, element) { return _this.stopMonitoring(element); });
|
|
1830
1836
|
};
|
|
1837
|
+
/** Access injected document if available or fallback to global document reference */
|
|
1838
|
+
FocusMonitor.prototype._getDocument = function () {
|
|
1839
|
+
return this._document || document;
|
|
1840
|
+
};
|
|
1841
|
+
/** Use defaultView of injected document if available or fallback to global window reference */
|
|
1842
|
+
FocusMonitor.prototype._getWindow = function () {
|
|
1843
|
+
var doc = this._getDocument();
|
|
1844
|
+
return doc.defaultView || window;
|
|
1845
|
+
};
|
|
1831
1846
|
FocusMonitor.prototype._toggleClass = function (element, className, shouldSet) {
|
|
1832
1847
|
if (shouldSet) {
|
|
1833
1848
|
element.classList.add(className);
|
|
@@ -1853,16 +1868,19 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1853
1868
|
};
|
|
1854
1869
|
/**
|
|
1855
1870
|
* Sets the origin and schedules an async function to clear it at the end of the event queue.
|
|
1871
|
+
* If the detection mode is 'eventual', the origin is never cleared.
|
|
1856
1872
|
* @param origin The origin to set.
|
|
1857
1873
|
*/
|
|
1858
1874
|
FocusMonitor.prototype._setOriginForCurrentEventQueue = function (origin) {
|
|
1859
1875
|
var _this = this;
|
|
1860
1876
|
this._ngZone.runOutsideAngular(function () {
|
|
1861
1877
|
_this._origin = origin;
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1878
|
+
if (_this._detectionMode === 0 /* IMMEDIATE */) {
|
|
1879
|
+
// Sometimes the focus origin won't be valid in Firefox because Firefox seems to focus *one*
|
|
1880
|
+
// tick after the interaction event fired. To ensure the focus origin is always correct,
|
|
1881
|
+
// the focus origin will be determined at the beginning of the next tick.
|
|
1882
|
+
_this._originTimeoutId = setTimeout(function () { return _this._origin = null; }, 1);
|
|
1883
|
+
}
|
|
1866
1884
|
});
|
|
1867
1885
|
};
|
|
1868
1886
|
/**
|
|
@@ -1956,6 +1974,8 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1956
1974
|
// Note: we listen to events in the capture phase so we
|
|
1957
1975
|
// can detect them even if the user stops propagation.
|
|
1958
1976
|
this._ngZone.runOutsideAngular(function () {
|
|
1977
|
+
var document = _this._getDocument();
|
|
1978
|
+
var window = _this._getWindow();
|
|
1959
1979
|
document.addEventListener('keydown', _this._documentKeydownListener, captureEventListenerOptions);
|
|
1960
1980
|
document.addEventListener('mousedown', _this._documentMousedownListener, captureEventListenerOptions);
|
|
1961
1981
|
document.addEventListener('touchstart', _this._documentTouchstartListener, captureEventListenerOptions);
|
|
@@ -1966,10 +1986,12 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1966
1986
|
FocusMonitor.prototype._decrementMonitoredElementCount = function () {
|
|
1967
1987
|
// Unregister global listeners when last element is unmonitored.
|
|
1968
1988
|
if (!--this._monitoredElementCount) {
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1989
|
+
var document_1 = this._getDocument();
|
|
1990
|
+
var window_1 = this._getWindow();
|
|
1991
|
+
document_1.removeEventListener('keydown', this._documentKeydownListener, captureEventListenerOptions);
|
|
1992
|
+
document_1.removeEventListener('mousedown', this._documentMousedownListener, captureEventListenerOptions);
|
|
1993
|
+
document_1.removeEventListener('touchstart', this._documentTouchstartListener, captureEventListenerOptions);
|
|
1994
|
+
window_1.removeEventListener('focus', this._windowFocusListener);
|
|
1973
1995
|
// Clear timeouts for all potentially pending timeouts to prevent the leaks.
|
|
1974
1996
|
clearTimeout(this._windowFocusTimeoutId);
|
|
1975
1997
|
clearTimeout(this._touchTimeoutId);
|
|
@@ -1982,9 +2004,11 @@ var FocusMonitor = /** @class */ (function () {
|
|
|
1982
2004
|
/** @nocollapse */
|
|
1983
2005
|
FocusMonitor.ctorParameters = function () { return [
|
|
1984
2006
|
{ type: NgZone },
|
|
1985
|
-
{ type: Platform }
|
|
2007
|
+
{ type: Platform },
|
|
2008
|
+
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DOCUMENT,] }] },
|
|
2009
|
+
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [FOCUS_MONITOR_DEFAULT_OPTIONS,] }] }
|
|
1986
2010
|
]; };
|
|
1987
|
-
FocusMonitor.ɵprov = ɵɵdefineInjectable({ factory: function FocusMonitor_Factory() { return new FocusMonitor(ɵɵinject(NgZone), ɵɵinject(Platform)); }, token: FocusMonitor, providedIn: "root" });
|
|
2011
|
+
FocusMonitor.ɵprov = ɵɵdefineInjectable({ factory: function FocusMonitor_Factory() { return new FocusMonitor(ɵɵinject(NgZone), ɵɵinject(Platform), ɵɵinject(DOCUMENT, 8), ɵɵinject(FOCUS_MONITOR_DEFAULT_OPTIONS, 8)); }, token: FocusMonitor, providedIn: "root" });
|
|
1988
2012
|
return FocusMonitor;
|
|
1989
2013
|
}());
|
|
1990
2014
|
/**
|
|
@@ -2164,5 +2188,5 @@ var A11yModule = /** @class */ (function () {
|
|
|
2164
2188
|
* Generated bundle index. Do not edit.
|
|
2165
2189
|
*/
|
|
2166
2190
|
|
|
2167
|
-
export { A11yModule, ActiveDescendantKeyManager, AriaDescriber, CDK_DESCRIBEDBY_HOST_ATTRIBUTE, CDK_DESCRIBEDBY_ID_PREFIX, CdkAriaLive, CdkMonitorFocus, CdkTrapFocus, ConfigurableFocusTrap, ConfigurableFocusTrapFactory, EventListenerFocusTrapInertStrategy, FOCUS_TRAP_INERT_STRATEGY, FocusKeyManager, FocusMonitor, FocusTrap, FocusTrapFactory, HighContrastModeDetector, InteractivityChecker, LIVE_ANNOUNCER_DEFAULT_OPTIONS, LIVE_ANNOUNCER_ELEMENT_TOKEN, LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY, ListKeyManager, LiveAnnouncer, MESSAGES_CONTAINER_ID, TOUCH_BUFFER_MS, isFakeMousedownFromScreenReader, FocusTrapManager as ɵangular_material_src_cdk_a11y_a11y_a, ConfigurableFocusTrapConfig as ɵangular_material_src_cdk_a11y_a11y_b };
|
|
2191
|
+
export { A11yModule, ActiveDescendantKeyManager, AriaDescriber, CDK_DESCRIBEDBY_HOST_ATTRIBUTE, CDK_DESCRIBEDBY_ID_PREFIX, CdkAriaLive, CdkMonitorFocus, CdkTrapFocus, ConfigurableFocusTrap, ConfigurableFocusTrapFactory, EventListenerFocusTrapInertStrategy, FOCUS_MONITOR_DEFAULT_OPTIONS, FOCUS_TRAP_INERT_STRATEGY, FocusKeyManager, FocusMonitor, FocusTrap, FocusTrapFactory, HighContrastModeDetector, InteractivityChecker, LIVE_ANNOUNCER_DEFAULT_OPTIONS, LIVE_ANNOUNCER_ELEMENT_TOKEN, LIVE_ANNOUNCER_ELEMENT_TOKEN_FACTORY, ListKeyManager, LiveAnnouncer, MESSAGES_CONTAINER_ID, TOUCH_BUFFER_MS, isFakeMousedownFromScreenReader, FocusTrapManager as ɵangular_material_src_cdk_a11y_a11y_a, ConfigurableFocusTrapConfig as ɵangular_material_src_cdk_a11y_a11y_b };
|
|
2168
2192
|
//# sourceMappingURL=a11y.js.map
|