@angular/cdk 7.0.0-rc.1 → 7.0.2
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.scss +32 -0
- package/_overlay.scss +141 -0
- package/_text-field.scss +63 -0
- package/a11y/typings/aria-describer/aria-describer.d.ts +2 -2
- package/a11y/typings/focus-monitor/focus-monitor.d.ts +2 -2
- package/a11y/typings/index.metadata.json +1 -1
- package/a11y/typings/key-manager/list-key-manager.d.ts +1 -1
- package/a11y/typings/live-announcer/live-announcer.d.ts +2 -2
- package/bundles/cdk-a11y.umd.js +26 -21
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +1 -1
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +126 -81
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +1 -1
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +22 -22
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +13 -2
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +1 -1
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +10 -6
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +1 -1
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-stepper.umd.js +1 -1
- package/bundles/cdk-stepper.umd.js.map +1 -1
- package/bundles/cdk-stepper.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +5 -1
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +1 -1
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +10 -3
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +1 -1
- package/bundles/cdk-text-field.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/drag-drop/typings/drag-events.d.ts +5 -5
- package/drag-drop/typings/drag-handle.d.ts +3 -1
- package/drag-drop/typings/drag-parent.d.ts +15 -0
- package/drag-drop/typings/drag-utils.d.ts +10 -0
- package/drag-drop/typings/drag.d.ts +6 -11
- package/drag-drop/typings/{drop-container.d.ts → drop-list-container.d.ts} +5 -5
- package/{typings/drag-drop/drop.d.ts → drag-drop/typings/drop-list.d.ts} +7 -7
- package/drag-drop/typings/index.d.ts +1 -0
- package/drag-drop/typings/index.metadata.json +1 -1
- package/drag-drop/typings/public-api.d.ts +2 -2
- package/esm2015/a11y.js +25 -20
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/cdk.js +1 -1
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/drag-drop.js +108 -57
- package/esm2015/drag-drop.js.map +1 -1
- package/esm2015/overlay.js +12 -12
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/platform.js +13 -3
- package/esm2015/platform.js.map +1 -1
- package/esm2015/scrolling.js +10 -6
- package/esm2015/scrolling.js.map +1 -1
- package/esm2015/stepper.js +1 -1
- package/esm2015/stepper.js.map +1 -1
- package/esm2015/table.js +5 -1
- package/esm2015/table.js.map +1 -1
- package/esm2015/text-field.js +11 -4
- package/esm2015/text-field.js.map +1 -1
- package/esm5/a11y.es5.js +27 -22
- package/esm5/a11y.es5.js.map +1 -1
- package/esm5/cdk.es5.js +1 -1
- package/esm5/cdk.es5.js.map +1 -1
- package/esm5/drag-drop.es5.js +124 -81
- package/esm5/drag-drop.es5.js.map +1 -1
- package/esm5/overlay.es5.js +22 -22
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/platform.es5.js +13 -3
- package/esm5/platform.es5.js.map +1 -1
- package/esm5/scrolling.es5.js +10 -6
- package/esm5/scrolling.es5.js.map +1 -1
- package/esm5/stepper.es5.js +1 -1
- package/esm5/stepper.es5.js.map +1 -1
- package/esm5/table.es5.js +5 -1
- package/esm5/table.es5.js.map +1 -1
- package/esm5/text-field.es5.js +11 -4
- package/esm5/text-field.es5.js.map +1 -1
- package/overlay/typings/keyboard/overlay-keyboard-dispatcher.d.ts +2 -2
- package/overlay/typings/overlay-container.d.ts +2 -2
- package/overlay/typings/overlay-directives.d.ts +1 -1
- package/overlay/typings/overlay-module.d.ts +1 -1
- package/overlay/typings/position/connected-position-strategy.d.ts +1 -1
- package/overlay/typings/position/global-position-strategy.d.ts +2 -2
- package/overlay/typings/position/overlay-position-builder.d.ts +1 -1
- package/package.json +6 -6
- package/platform/typings/features/passive-listeners.d.ts +7 -0
- package/platform/typings/index.metadata.json +1 -1
- package/platform/typings/platform.d.ts +1 -1
- package/schematics/index.d.ts +0 -1
- package/schematics/index.js +0 -1
- package/schematics/index.js.map +1 -1
- package/schematics/ng-add/index.d.ts +4 -0
- package/schematics/ng-add/index.js +7 -3
- package/schematics/ng-add/index.js.map +1 -1
- package/schematics/ng-generate/drag-drop/files/__path__/__name@dasherize@if-flat__/__name@dasherize__.component.html +4 -4
- package/schematics/ng-generate/drag-drop/schema.json +2 -1
- package/schematics/ng-update/index.js +8 -2
- package/schematics/ng-update/index.js.map +1 -1
- package/schematics/utils/build-component.d.ts +7 -0
- package/schematics/utils/build-component.js +4 -5
- package/schematics/utils/build-component.js.map +1 -1
- package/schematics/utils/html-head-element.d.ts +13 -0
- package/schematics/utils/html-head-element.js +54 -0
- package/schematics/utils/html-head-element.js.map +1 -0
- package/schematics/utils/index.d.ts +1 -0
- package/schematics/utils/index.js +1 -0
- package/schematics/utils/index.js.map +1 -1
- package/scrolling/typings/index.metadata.json +1 -1
- package/scrolling/typings/scroll-dispatcher.d.ts +2 -2
- package/scrolling/typings/viewport-ruler.d.ts +2 -2
- package/table/typings/index.metadata.json +1 -1
- package/text-field/typings/autosize.d.ts +7 -1
- package/text-field/typings/index.metadata.json +1 -1
- package/typings/a11y/aria-describer/aria-describer.d.ts +2 -2
- package/typings/a11y/focus-monitor/focus-monitor.d.ts +2 -2
- package/typings/a11y/index.metadata.json +1 -1
- package/typings/a11y/key-manager/list-key-manager.d.ts +1 -1
- package/typings/a11y/live-announcer/live-announcer.d.ts +2 -2
- package/typings/drag-drop/drag-events.d.ts +5 -5
- package/typings/drag-drop/drag-handle.d.ts +3 -1
- package/typings/drag-drop/drag-parent.d.ts +15 -0
- package/typings/drag-drop/drag-utils.d.ts +10 -0
- package/typings/drag-drop/drag.d.ts +6 -11
- package/typings/drag-drop/{drop-container.d.ts → drop-list-container.d.ts} +5 -5
- package/{drag-drop/typings/drop.d.ts → typings/drag-drop/drop-list.d.ts} +7 -7
- package/typings/drag-drop/index.d.ts +1 -0
- package/typings/drag-drop/index.metadata.json +1 -1
- package/typings/drag-drop/public-api.d.ts +2 -2
- package/typings/esm5/a11y/aria-describer/aria-describer.d.ts +2 -2
- package/typings/esm5/a11y/focus-monitor/focus-monitor.d.ts +2 -2
- package/typings/esm5/a11y/index.metadata.json +1 -1
- package/typings/esm5/a11y/key-manager/list-key-manager.d.ts +1 -1
- package/typings/esm5/a11y/live-announcer/live-announcer.d.ts +2 -2
- package/typings/esm5/drag-drop/drag-events.d.ts +5 -5
- package/typings/esm5/drag-drop/drag-handle.d.ts +3 -1
- package/typings/esm5/drag-drop/drag-parent.d.ts +15 -0
- package/typings/esm5/drag-drop/drag-utils.d.ts +10 -0
- package/typings/esm5/drag-drop/drag.d.ts +6 -11
- package/typings/esm5/drag-drop/{drop-container.d.ts → drop-list-container.d.ts} +5 -5
- package/typings/esm5/drag-drop/{drop.d.ts → drop-list.d.ts} +7 -7
- package/typings/esm5/drag-drop/index.d.ts +1 -0
- package/typings/esm5/drag-drop/index.metadata.json +1 -1
- package/typings/esm5/drag-drop/public-api.d.ts +2 -2
- package/typings/esm5/index.metadata.json +1 -1
- package/typings/esm5/overlay/keyboard/overlay-keyboard-dispatcher.d.ts +2 -2
- package/typings/esm5/overlay/overlay-container.d.ts +2 -2
- package/typings/esm5/overlay/overlay-directives.d.ts +1 -1
- package/typings/esm5/overlay/overlay-module.d.ts +1 -1
- package/typings/esm5/overlay/position/connected-position-strategy.d.ts +1 -1
- package/typings/esm5/overlay/position/global-position-strategy.d.ts +2 -2
- package/typings/esm5/overlay/position/overlay-position-builder.d.ts +1 -1
- package/typings/esm5/platform/features/passive-listeners.d.ts +7 -0
- package/typings/esm5/platform/index.metadata.json +1 -1
- package/typings/esm5/platform/platform.d.ts +1 -1
- package/typings/esm5/scrolling/index.metadata.json +1 -1
- package/typings/esm5/scrolling/scroll-dispatcher.d.ts +2 -2
- package/typings/esm5/scrolling/viewport-ruler.d.ts +2 -2
- package/typings/esm5/table/index.metadata.json +1 -1
- package/typings/esm5/text-field/autosize.d.ts +7 -1
- package/typings/esm5/text-field/index.metadata.json +1 -1
- package/typings/index.metadata.json +1 -1
- package/typings/overlay/keyboard/overlay-keyboard-dispatcher.d.ts +2 -2
- package/typings/overlay/overlay-container.d.ts +2 -2
- package/typings/overlay/overlay-directives.d.ts +1 -1
- package/typings/overlay/overlay-module.d.ts +1 -1
- package/typings/overlay/position/connected-position-strategy.d.ts +1 -1
- package/typings/overlay/position/global-position-strategy.d.ts +2 -2
- package/typings/overlay/position/overlay-position-builder.d.ts +1 -1
- package/typings/platform/features/passive-listeners.d.ts +7 -0
- package/typings/platform/index.metadata.json +1 -1
- package/typings/platform/platform.d.ts +1 -1
- package/typings/schematics/index.d.ts +0 -1
- package/typings/schematics/ng-add/index.d.ts +4 -0
- package/typings/schematics/utils/build-component.d.ts +7 -0
- package/typings/schematics/utils/html-head-element.d.ts +13 -0
- package/typings/schematics/utils/index.d.ts +1 -0
- package/typings/scrolling/index.metadata.json +1 -1
- package/typings/scrolling/scroll-dispatcher.d.ts +2 -2
- package/typings/scrolling/viewport-ruler.d.ts +2 -2
- package/typings/table/index.metadata.json +1 -1
- package/typings/text-field/autosize.d.ts +7 -1
- package/typings/text-field/index.metadata.json +1 -1
- package/schematics/testing/index.d.ts +0 -9
- package/schematics/testing/index.js +0 -15
- package/schematics/testing/index.js.map +0 -1
- package/schematics/testing/post-scheduled-tasks.d.ts +0 -18
- package/schematics/testing/post-scheduled-tasks.js +0 -35
- package/schematics/testing/post-scheduled-tasks.js.map +0 -1
- package/schematics/testing/test-app.d.ts +0 -10
- package/schematics/testing/test-app.js +0 -20
- package/schematics/testing/test-app.js.map +0 -1
- package/typings/schematics/testing/index.d.ts +0 -9
- package/typings/schematics/testing/post-scheduled-tasks.d.ts +0 -18
- package/typings/schematics/testing/test-app.d.ts +0 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk-text-field.umd.js","sources":["../../src/cdk/text-field/text-field-module.ts","../../src/cdk/text-field/autosize.ts","../../src/cdk/text-field/autofill.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 {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 * @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 {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n Input,\n AfterViewInit,\n DoCheck,\n OnDestroy,\n NgZone,\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 '(input)': '_noopInputHandler()',\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 | null;\n private readonly _destroyed = new Subject<void>();\n\n private _minRows: number;\n private _maxRows: number;\n private _enabled: boolean = true;\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 = 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 = 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 of the value changed since these calculations can be expensive.\n if (value === this._previousValue && !force) {\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 // On Firefox resizing the textarea will prevent it from scrolling to the caret position.\n // We need to re-set the selection in order for it to scroll to the proper position.\n if (typeof requestAnimationFrame !== 'undefined') {\n this._ngZone.runOutsideAngular(() => requestAnimationFrame(() => {\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\n this._previousValue = value;\n }\n\n /**\n * Resets the textarea to it's 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 return;\n }\n this._textareaElement.style.height = this._initialHeight;\n }\n\n _noopInputHandler() {\n // no-op handler that ensures we're running change detection on input events.\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 {Platform, supportsPassiveEventListeners} 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 {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: any = supportsPassiveEventListeners() ? {passive: true} : false;\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 = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : 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 = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : 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"],"names":["PlatformModule","NgModule","Input","NgZone","Platform","ElementRef","Directive","auditTime","takeUntil","fromEvent","coerceBooleanProperty","Subject","Output","EventEmitter","Injectable","EMPTY","supportsPassiveEventListeners"],"mappings":";;;;;;;;;;;;;;;;;;;;AEuCA,IAAM,eAAe,GAAQgB,sCAA6B,EAAE,GAAG,EAAC,OAAO,EAAE,IAAI,EAAC,GAAG,KAAK,CAAC;;;;;;;IAYrF,SAAF,eAAA,CAAsB,SAAmB,EAAU,OAAe,EAAlE;QAAsB,IAAtB,CAAA,SAA+B,GAAT,SAAS,CAAU;QAAU,IAAnD,CAAA,OAA0D,GAAP,OAAO,CAAQ;QAFlE,IAAA,CAAA,kBAAA,GAA+B,IAAI,GAAG,EAAiC,CAAvE;KAEsE;;;;;IAgBpE,eAAF,CAAA,SAAA,CAAA,OAAS;;;;IAAP,UAAQ,YAA2C,EAArD;QAAE,IAAF,KAAA,GAAA,IAAA,CA0CG;QAzCC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;YAC7B,OAAOD,UAAK,CAAC;SACd;;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AAA,EAAA,IAAA,EAAGA,UAAK,EAAR,IAAA,EAAA,CAAS,qBAAqB,EAA9B,EAAA,CAAA;;IAhEA,OAAA,mBAAA,CAAA;;;;;;;;;;;QDcA,EAAA,IAAA,EAACD,aAAQ,EAAT,IAAA,EAAA,CAAU;oBACR,YAAY,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;oBAChD,OAAO,EAAE,CAACD,uBAAc,CAAC;oBACzB,OAAO,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;iBAC5C,EAAD,EAAA;;IAlBA,OAAA,eAAA,CAAA;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"cdk-text-field.umd.js","sources":["../../src/cdk/text-field/text-field-module.ts","../../src/cdk/text-field/autosize.ts","../../src/cdk/text-field/autofill.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 {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 * @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 {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n Input,\n AfterViewInit,\n DoCheck,\n OnDestroy,\n NgZone,\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 '(input)': '_noopInputHandler()',\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 | null;\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 = 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 = 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 // On Firefox resizing the textarea will prevent it from scrolling to the caret position.\n // We need to re-set the selection in order for it to scroll to the proper position.\n if (typeof requestAnimationFrame !== 'undefined') {\n this._ngZone.runOutsideAngular(() => requestAnimationFrame(() => {\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\n this._previousValue = value;\n this._previousMinRows = this._minRows;\n }\n\n /**\n * Resets the textarea to it's 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 return;\n }\n this._textareaElement.style.height = this._initialHeight;\n }\n\n _noopInputHandler() {\n // no-op handler that ensures we're running change detection on input events.\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 {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 {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 = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : 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 = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : 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"],"names":["PlatformModule","NgModule","Input","NgZone","Platform","ElementRef","Directive","auditTime","takeUntil","fromEvent","coerceBooleanProperty","Subject","Output","EventEmitter","Injectable","EMPTY","normalizePassiveListenerOptions"],"mappings":";;;;;;;;;;;;;;;;;;;;AEuCA,IAAM,eAAe,GAAGgB,wCAA+B,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;;;;;;;IAYvE,SAAF,eAAA,CAAsB,SAAmB,EAAU,OAAe,EAAlE;QAAsB,IAAtB,CAAA,SAA+B,GAAT,SAAS,CAAU;QAAU,IAAnD,CAAA,OAA0D,GAAP,OAAO,CAAQ;QAFlE,IAAA,CAAA,kBAAA,GAA+B,IAAI,GAAG,EAAiC,CAAvE;KAEsE;;;;;IAgBpE,eAAF,CAAA,SAAA,CAAA,OAAS;;;;IAAP,UAAQ,YAA2C,EAArD;QAAE,IAAF,KAAA,GAAA,IAAA,CA0CG;QAzCC,IAAI,CAAC,IAAI,CAAC,SAAS,C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OAAA,EAAA,CAAA,EAAA,IAAA,EAAGD,UAAK,EAAR,IAAA,EAAA,CAAS,oBAAoB,EAA7B,EAAA,CAAA;QAQA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAGA,UAAK,EAAR,IAAA,EAAA,CAAS,oBAAoB,EAA7B,EAAA,CAAA;QAQA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAGA,UAAK,EAAR,IAAA,EAAA,CAAS,qBAAqB,EAA9B,EAAA,CAAA;;IAvEA,OAAA,mBAAA,CAAA;;;;;;;;;;;QDcA,EAAA,IAAA,EAACD,aAAQ,EAAT,IAAA,EAAA,CAAU;oBACR,YAAY,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;oBAChD,OAAO,EAAE,CAACD,uBAAc,CAAC;oBACzB,OAAO,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;iBAC5C,EAAD,EAAA;;IAlBA,OAAA,eAAA,CAAA;;;;;;;;;;;;;;;;"}
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/platform"),require("@angular/core"),require("rxjs"),require("@angular/cdk/coercion"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@angular/cdk/textField",["exports","@angular/cdk/platform","@angular/core","rxjs","@angular/cdk/coercion","rxjs/operators"],t):t((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.textField={}),e.ng.cdk.platform,e.ng.core,e.rxjs,e.ng.cdk.coercion,e.rxjs.operators)}(this,function(e,t,i,n,o,r){"use strict";var s
|
|
8
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/cdk/platform"),require("@angular/core"),require("rxjs"),require("@angular/cdk/coercion"),require("rxjs/operators")):"function"==typeof define&&define.amd?define("@angular/cdk/textField",["exports","@angular/cdk/platform","@angular/core","rxjs","@angular/cdk/coercion","rxjs/operators"],t):t((e.ng=e.ng||{},e.ng.cdk=e.ng.cdk||{},e.ng.cdk.textField={}),e.ng.cdk.platform,e.ng.core,e.rxjs,e.ng.cdk.coercion,e.rxjs.operators)}(this,function(e,t,i,n,o,r){"use strict";var s=t.normalizePassiveListenerOptions({passive:!0}),a=function(){function e(e,t){this._platform=e,this._ngZone=t,this._monitoredElements=new Map}return e.prototype.monitor=function(e){var t=this;if(!this._platform.isBrowser)return n.EMPTY;var o=e instanceof i.ElementRef?e.nativeElement:e,r=this._monitoredElements.get(o);if(r)return r.subject.asObservable();var a=new n.Subject,l="cdk-text-field-autofilled",c=function(e){"cdk-text-field-autofill-start"!==e.animationName||o.classList.contains(l)?"cdk-text-field-autofill-end"===e.animationName&&o.classList.contains(l)&&(o.classList.remove(l),t._ngZone.run(function(){return a.next({target:e.target,isAutofilled:!1})})):(o.classList.add(l),t._ngZone.run(function(){return a.next({target:e.target,isAutofilled:!0})}))};return this._ngZone.runOutsideAngular(function(){o.addEventListener("animationstart",c,s),o.classList.add("cdk-text-field-autofill-monitored")}),this._monitoredElements.set(o,{subject:a,unlisten:function(){o.removeEventListener("animationstart",c,s)}}),a.asObservable()},e.prototype.stopMonitoring=function(e){var t=e instanceof i.ElementRef?e.nativeElement:e,n=this._monitoredElements.get(t);n&&(n.unlisten(),n.subject.complete(),t.classList.remove("cdk-text-field-autofill-monitored"),t.classList.remove("cdk-text-field-autofilled"),this._monitoredElements.delete(t))},e.prototype.ngOnDestroy=function(){var e=this;this._monitoredElements.forEach(function(t,i){return e.stopMonitoring(i)})},e.decorators=[{type:i.Injectable,args:[{providedIn:"root"}]}],e.ctorParameters=function(){return[{type:t.Platform},{type:i.NgZone}]},e.ngInjectableDef=i.defineInjectable({factory:function(){return new e(i.inject(t.Platform),i.inject(i.NgZone))},token:e,providedIn:"root"}),e}(),l=function(){function e(e,t){this._elementRef=e,this._autofillMonitor=t,this.cdkAutofill=new i.EventEmitter}return e.prototype.ngOnInit=function(){var e=this;this._autofillMonitor.monitor(this._elementRef).subscribe(function(t){return e.cdkAutofill.emit(t)})},e.prototype.ngOnDestroy=function(){this._autofillMonitor.stopMonitoring(this._elementRef)},e.decorators=[{type:i.Directive,args:[{selector:"[cdkAutofill]"}]}],e.ctorParameters=function(){return[{type:i.ElementRef},{type:a}]},e.propDecorators={cdkAutofill:[{type:i.Output}]},e}(),c=function(){function e(e,t,i){this._elementRef=e,this._platform=t,this._ngZone=i,this._destroyed=new n.Subject,this._enabled=!0,this._previousMinRows=-1,this._textareaElement=this._elementRef.nativeElement}return Object.defineProperty(e.prototype,"minRows",{get:function(){return this._minRows},set:function(e){this._minRows=e,this._setMinHeight()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxRows",{get:function(){return this._maxRows},set:function(e){this._maxRows=e,this._setMaxHeight()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enabled",{get:function(){return this._enabled},set:function(e){e=o.coerceBooleanProperty(e),this._enabled!==e&&((this._enabled=e)?this.resizeToFitContent(!0):this.reset())},enumerable:!0,configurable:!0}),e.prototype._setMinHeight=function(){var e=this.minRows&&this._cachedLineHeight?this.minRows*this._cachedLineHeight+"px":null;e&&(this._textareaElement.style.minHeight=e)},e.prototype._setMaxHeight=function(){var e=this.maxRows&&this._cachedLineHeight?this.maxRows*this._cachedLineHeight+"px":null;e&&(this._textareaElement.style.maxHeight=e)},e.prototype.ngAfterViewInit=function(){var e=this;this._platform.isBrowser&&(this._initialHeight=this._textareaElement.style.height,this.resizeToFitContent(),this._ngZone.runOutsideAngular(function(){n.fromEvent(window,"resize").pipe(r.auditTime(16),r.takeUntil(e._destroyed)).subscribe(function(){return e.resizeToFitContent(!0)})}))},e.prototype.ngOnDestroy=function(){this._destroyed.next(),this._destroyed.complete()},e.prototype._cacheTextareaLineHeight=function(){if(!this._cachedLineHeight){var e=this._textareaElement.cloneNode(!1);e.rows=1,e.style.position="absolute",e.style.visibility="hidden",e.style.border="none",e.style.padding="0",e.style.height="",e.style.minHeight="",e.style.maxHeight="",e.style.overflow="hidden",this._textareaElement.parentNode.appendChild(e),this._cachedLineHeight=e.clientHeight,this._textareaElement.parentNode.removeChild(e),this._setMinHeight(),this._setMaxHeight()}},e.prototype.ngDoCheck=function(){this._platform.isBrowser&&this.resizeToFitContent()},e.prototype.resizeToFitContent=function(e){var t=this;if(void 0===e&&(e=!1),this._enabled&&(this._cacheTextareaLineHeight(),this._cachedLineHeight)){var i=this._elementRef.nativeElement,n=i.value;if(e||this._minRows!==this._previousMinRows||n!==this._previousValue){var o=i.placeholder;i.classList.add("cdk-textarea-autosize-measuring"),i.placeholder="";var r=i.scrollHeight-4;i.style.height=r+"px",i.classList.remove("cdk-textarea-autosize-measuring"),i.placeholder=o,"undefined"!=typeof requestAnimationFrame&&this._ngZone.runOutsideAngular(function(){return requestAnimationFrame(function(){var e=i.selectionStart,n=i.selectionEnd;t._destroyed.isStopped||document.activeElement!==i||i.setSelectionRange(e,n)})}),this._previousValue=n,this._previousMinRows=this._minRows}}},e.prototype.reset=function(){void 0!==this._initialHeight&&(this._textareaElement.style.height=this._initialHeight)},e.prototype._noopInputHandler=function(){},e.decorators=[{type:i.Directive,args:[{selector:"textarea[cdkTextareaAutosize]",exportAs:"cdkTextareaAutosize",host:{class:"cdk-textarea-autosize",rows:"1","(input)":"_noopInputHandler()"}}]}],e.ctorParameters=function(){return[{type:i.ElementRef},{type:t.Platform},{type:i.NgZone}]},e.propDecorators={minRows:[{type:i.Input,args:["cdkAutosizeMinRows"]}],maxRows:[{type:i.Input,args:["cdkAutosizeMaxRows"]}],enabled:[{type:i.Input,args:["cdkTextareaAutosize"]}]},e}(),u=function(){function e(){}return e.decorators=[{type:i.NgModule,args:[{declarations:[l,c],imports:[t.PlatformModule],exports:[l,c]}]}],e}();e.AutofillMonitor=a,e.CdkAutofill=l,e.CdkTextareaAutosize=c,e.TextFieldModule=u,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
9
9
|
//# sourceMappingURL=cdk-text-field.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk-text-field.umd.min.js","sources":["../../src/cdk/text-field/autofill.ts","../../src/cdk/text-field/autosize.ts","../../src/cdk/text-field/text-field-module.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, supportsPassiveEventListeners} 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 {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: any = supportsPassiveEventListeners() ? {passive: true} : false;\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 = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : 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 = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : 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 {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n Input,\n AfterViewInit,\n DoCheck,\n OnDestroy,\n NgZone,\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 '(input)': '_noopInputHandler()',\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 | null;\n private readonly _destroyed = new Subject<void>();\n\n private _minRows: number;\n private _maxRows: number;\n private _enabled: boolean = true;\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 = 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 = 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 of the value changed since these calculations can be expensive.\n if (value === this._previousValue && !force) {\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 // On Firefox resizing the textarea will prevent it from scrolling to the caret position.\n // We need to re-set the selection in order for it to scroll to the proper position.\n if (typeof requestAnimationFrame !== 'undefined') {\n this._ngZone.runOutsideAngular(() => requestAnimationFrame(() => {\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\n this._previousValue = value;\n }\n\n /**\n * Resets the textarea to it's 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 return;\n }\n this._textareaElement.style.height = this._initialHeight;\n }\n\n _noopInputHandler() {\n // no-op handler that ensures we're running change detection on input events.\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 {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"],"names":["listenerOptions","supportsPassiveEventListeners","passive","AutofillMonitor","_platform","_ngZone","this","_monitoredElements","Map","prototype","monitor","elementOrRef","_this","isBrowser","EMPTY","element","ElementRef","nativeElement","info","get","subject","asObservable","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","type","Injectable","args","providedIn","Platform","NgZone","CdkAutofill","_elementRef","_autofillMonitor","cdkAutofill","EventEmitter","ngOnInit","subscribe","emit","Directive","selector","Output","CdkTextareaAutosize","_destroyed","_enabled","_textareaElement","Object","defineProperty","_minRows","value","_setMinHeight","_maxRows","_setMaxHeight","coerceBooleanProperty","resizeToFitContent","reset","minHeight","minRows","_cachedLineHeight","style","maxHeight","maxRows","ngAfterViewInit","_initialHeight","height","fromEvent","window","pipe","auditTime","takeUntil","_cacheTextareaLineHeight","textareaClone","cloneNode","rows","position","visibility","border","padding","overflow","appendChild","clientHeight","removeChild","ngDoCheck","force","textarea","_previousValue","placeholderText","placeholder","scrollHeight","requestAnimationFrame","selectionStart","selectionEnd","isStopped","document","activeElement","setSelectionRange","undefined","_noopInputHandler","exportAs","host","class","(input)","Input","enabled","NgModule","declarations","imports","PlatformModule","exports","TextFieldModule"],"mappings":";;;;;;;8iBAuCA,IAAMA,KAAuBC,EAAAA,kCAAmCC,SAAS,gBAYvE,QAAFC,GAAsBC,EAA6BC,GAA7BC,KAAtBF,UAAsBA,EAA6BE,KAAnDD,QAAmDA,EAFnDC,KAAAC,mBAA+B,GAAIC,KAjDnC,MAmEEL,GAAFM,UAAAC,QAAE,SAAQC,GAAR,GAAFC,GAAAN,IACI,KAAKA,KAAKF,UAAUS,UAClB,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A,MAAH3E,MAAS,0BAhETe,gCCAA,sBAcAjB,KAAC+E,EAAAA,SAAD7E,OACE8E,cAAe1E,EAAaW,GAC5BgE,SAAUC,EAAAA,gBACVC,SAAU7E,EAAaW,OAjBzBmE"}
|
|
1
|
+
{"version":3,"file":"cdk-text-field.umd.min.js","sources":["../../src/cdk/text-field/autofill.ts","../../src/cdk/text-field/autosize.ts","../../src/cdk/text-field/text-field-module.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 {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 = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : 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 = elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : 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 {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n Input,\n AfterViewInit,\n DoCheck,\n OnDestroy,\n NgZone,\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 '(input)': '_noopInputHandler()',\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 | null;\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 = 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 = 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 // On Firefox resizing the textarea will prevent it from scrolling to the caret position.\n // We need to re-set the selection in order for it to scroll to the proper position.\n if (typeof requestAnimationFrame !== 'undefined') {\n this._ngZone.runOutsideAngular(() => requestAnimationFrame(() => {\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\n this._previousValue = value;\n this._previousMinRows = this._minRows;\n }\n\n /**\n * Resets the textarea to it's 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 return;\n }\n this._textareaElement.style.height = this._initialHeight;\n }\n\n _noopInputHandler() {\n // no-op handler that ensures we're running change detection on input events.\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 {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"],"names":["listenerOptions","normalizePassiveListenerOptions","passive","AutofillMonitor","_platform","_ngZone","this","_monitoredElements","Map","prototype","monitor","elementOrRef","_this","isBrowser","EMPTY","element","ElementRef","nativeElement","info","get","subject","asObservable","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","type","Injectable","args","providedIn","Platform","NgZone","CdkAutofill","_elementRef","_autofillMonitor","cdkAutofill","EventEmitter","ngOnInit","subscribe","emit","Directive","selector","Output","CdkTextareaAutosize","_destroyed","_enabled","_previousMinRows","_textareaElement","Object","defineProperty","_minRows","value","_setMinHeight","_maxRows","_setMaxHeight","coerceBooleanProperty","resizeToFitContent","reset","minHeight","minRows","_cachedLineHeight","style","maxHeight","maxRows","ngAfterViewInit","_initialHeight","height","fromEvent","window","pipe","auditTime","takeUntil","_cacheTextareaLineHeight","textareaClone","cloneNode","rows","position","visibility","border","padding","overflow","appendChild","clientHeight","removeChild","ngDoCheck","force","textarea","_previousValue","placeholderText","placeholder","scrollHeight","requestAnimationFrame","selectionStart","selectionEnd","isStopped","document","activeElement","setSelectionRange","undefined","_noopInputHandler","exportAs","host","class","(input)","Input","enabled","NgModule","declarations","imports","PlatformModule","exports","TextFieldModule"],"mappings":";;;;;;;8iBAuC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KAAKgF,iBAG5CtB,EAAFvD,UAAA+G,kBAAE,4BA9OFzE,KAACc,EAAAA,UAADZ,OACEa,SAAU,gCACV2D,SAAU,sBACVC,MACEC,MAAS,wBAGT3B,KAAQ,IACR4B,UAAW,+DArBf7E,KAAE/B,EAAAA,aAOF+B,KAAQI,EAAAA,WAFRJ,KAAEK,EAAAA,4BAuCF4B,UAAAjC,KAAG8E,EAAAA,MAAH5E,MAAS,wBAQTmC,UAAArC,KAAG8E,EAAAA,MAAH5E,MAAS,wBAQT6E,UAAA/E,KAAG8E,EAAAA,MAAH5E,MAAS,0BAvETe,gCCAA,sBAcAjB,KAACgF,EAAAA,SAAD9E,OACE+E,cAAe3E,EAAaW,GAC5BiE,SAAUC,EAAAA,gBACVC,SAAU9E,EAAaW,OAjBzBoE"}
|
package/bundles/cdk.umd.js
CHANGED
package/bundles/cdk.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.umd.js","sources":["../../src/cdk/version.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 {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('7.0.
|
|
1
|
+
{"version":3,"file":"cdk.umd.js","sources":["../../src/cdk/version.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 {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('7.0.2');\n"],"names":["Version"],"mappings":";;;;;;;;;;;;;;;;;;;;AAWA,AAAA,IAAa,OAAO,GAAG,IAAIA,YAAO,CAAC,mBAAmB,CAAC;;;;;;;;;;;;"}
|
package/bundles/cdk.umd.min.js
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
|
-
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("@angular/cdk",["exports","@angular/core"],n):n((e.ng=e.ng||{},e.ng.cdk={}),e.ng.core)}(this,function(e,n){"use strict";var o=new n.Version("7.0.
|
|
8
|
+
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@angular/core")):"function"==typeof define&&define.amd?define("@angular/cdk",["exports","@angular/core"],n):n((e.ng=e.ng||{},e.ng.cdk={}),e.ng.core)}(this,function(e,n){"use strict";var o=new n.Version("7.0.2");e.VERSION=o,Object.defineProperty(e,"__esModule",{value:!0})});
|
|
9
9
|
//# sourceMappingURL=cdk.umd.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.umd.min.js","sources":["../../src/cdk/version.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 {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('7.0.
|
|
1
|
+
{"version":3,"file":"cdk.umd.min.js","sources":["../../src/cdk/version.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 {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('7.0.2');\n"],"names":["VERSION","Version"],"mappings":";;;;;;;4QAWA,IAAaA,GAAU,GAAIC,GAAAA,QAAQ"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { CdkDrag } from './drag';
|
|
9
|
-
import {
|
|
9
|
+
import { CdkDropListContainer } from './drop-list-container';
|
|
10
10
|
/** Event emitted when the user starts dragging a draggable. */
|
|
11
11
|
export interface CdkDragStart<T = any> {
|
|
12
12
|
/** Draggable that emitted the event. */
|
|
@@ -20,7 +20,7 @@ export interface CdkDragEnd<T = any> {
|
|
|
20
20
|
/** Event emitted when the user moves an item into a new drop container. */
|
|
21
21
|
export interface CdkDragEnter<T = any, I = T> {
|
|
22
22
|
/** Container into which the user has moved the item. */
|
|
23
|
-
container:
|
|
23
|
+
container: CdkDropListContainer<T>;
|
|
24
24
|
/** Item that was removed from the container. */
|
|
25
25
|
item: CdkDrag<I>;
|
|
26
26
|
}
|
|
@@ -30,7 +30,7 @@ export interface CdkDragEnter<T = any, I = T> {
|
|
|
30
30
|
*/
|
|
31
31
|
export interface CdkDragExit<T = any, I = T> {
|
|
32
32
|
/** Container from which the user has a removed an item. */
|
|
33
|
-
container:
|
|
33
|
+
container: CdkDropListContainer<T>;
|
|
34
34
|
/** Item that was removed from the container. */
|
|
35
35
|
item: CdkDrag<I>;
|
|
36
36
|
}
|
|
@@ -43,9 +43,9 @@ export interface CdkDragDrop<T, O = T> {
|
|
|
43
43
|
/** Item that is being dropped. */
|
|
44
44
|
item: CdkDrag;
|
|
45
45
|
/** Container in which the item was dropped. */
|
|
46
|
-
container:
|
|
46
|
+
container: CdkDropListContainer<T>;
|
|
47
47
|
/** Container from which the item was picked up. Can be the same as the `container`. */
|
|
48
|
-
previousContainer:
|
|
48
|
+
previousContainer: CdkDropListContainer<O>;
|
|
49
49
|
}
|
|
50
50
|
/** Event emitted as the user is dragging a draggable item. */
|
|
51
51
|
export interface CdkDragMove<T = any> {
|
|
@@ -9,5 +9,7 @@ import { ElementRef } from '@angular/core';
|
|
|
9
9
|
/** Handle that can be used to drag and CdkDrag instance. */
|
|
10
10
|
export declare class CdkDragHandle {
|
|
11
11
|
element: ElementRef<HTMLElement>;
|
|
12
|
-
|
|
12
|
+
/** Closest parent draggable instance. */
|
|
13
|
+
_parentDrag: {} | undefined;
|
|
14
|
+
constructor(element: ElementRef<HTMLElement>, parentDrag?: any);
|
|
13
15
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.io/license
|
|
7
|
+
*/
|
|
8
|
+
import { InjectionToken } from '@angular/core';
|
|
9
|
+
/**
|
|
10
|
+
* Injection token that can be used for a `CdkDrag` to provide itself as a parent to the
|
|
11
|
+
* drag-specific child directive (`CdkDragHandle`, `CdkDragPreview` etc.). Used primarily
|
|
12
|
+
* to avoid circular imports.
|
|
13
|
+
* @docs-private
|
|
14
|
+
*/
|
|
15
|
+
export declare const CDK_DRAG_PARENT: InjectionToken<{}>;
|
|
@@ -20,3 +20,13 @@ export declare function moveItemInArray<T = any>(array: T[], fromIndex: number,
|
|
|
20
20
|
* @param targetIndex Index at which to insert the item.
|
|
21
21
|
*/
|
|
22
22
|
export declare function transferArrayItem<T = any>(currentArray: T[], targetArray: T[], currentIndex: number, targetIndex: number): void;
|
|
23
|
+
/**
|
|
24
|
+
* Copies an item from one array to another, leaving it in its
|
|
25
|
+
* original position in current array.
|
|
26
|
+
* @param currentArray Array from which to copy the item.
|
|
27
|
+
* @param targetArray Array into which is copy the item.
|
|
28
|
+
* @param currentIndex Index of the item in its current array.
|
|
29
|
+
* @param targetIndex Index at which to insert the item.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export declare function copyArrayItem<T = any>(currentArray: T[], targetArray: T[], currentIndex: number, targetIndex: number): void;
|
|
@@ -14,7 +14,7 @@ import { CdkDragDrop, CdkDragEnd, CdkDragEnter, CdkDragExit, CdkDragMove, CdkDra
|
|
|
14
14
|
import { CdkDragHandle } from './drag-handle';
|
|
15
15
|
import { CdkDragPlaceholder } from './drag-placeholder';
|
|
16
16
|
import { CdkDragPreview } from './drag-preview';
|
|
17
|
-
import {
|
|
17
|
+
import { CdkDropListContainer } from './drop-list-container';
|
|
18
18
|
/** Object that can be used to configure the behavior of CdkDrag. */
|
|
19
19
|
export interface CdkDragConfig {
|
|
20
20
|
/**
|
|
@@ -32,12 +32,12 @@ export interface CdkDragConfig {
|
|
|
32
32
|
export declare const CDK_DRAG_CONFIG: InjectionToken<CdkDragConfig>;
|
|
33
33
|
/** @docs-private */
|
|
34
34
|
export declare function CDK_DRAG_CONFIG_FACTORY(): CdkDragConfig;
|
|
35
|
-
/** Element that can be moved inside a
|
|
35
|
+
/** Element that can be moved inside a CdkDropList container. */
|
|
36
36
|
export declare class CdkDrag<T = any> implements AfterViewInit, OnDestroy {
|
|
37
37
|
/** Element that the draggable is attached to. */
|
|
38
38
|
element: ElementRef<HTMLElement>;
|
|
39
39
|
/** Droppable container that the draggable is a part of. */
|
|
40
|
-
dropContainer:
|
|
40
|
+
dropContainer: CdkDropListContainer;
|
|
41
41
|
private _ngZone;
|
|
42
42
|
private _viewContainerRef;
|
|
43
43
|
private _viewportRuler;
|
|
@@ -71,6 +71,8 @@ export declare class CdkDrag<T = any> implements AfterViewInit, OnDestroy {
|
|
|
71
71
|
private _passiveTransform;
|
|
72
72
|
/** CSS `transform` that is applied to the element while it's being dragged. */
|
|
73
73
|
private _activeTransform;
|
|
74
|
+
/** Inline `transform` value that the element had before the first dragging sequence. */
|
|
75
|
+
private _initialTransform?;
|
|
74
76
|
/**
|
|
75
77
|
* Whether the dragging sequence has been started. Doesn't
|
|
76
78
|
* necessarily mean that the element has been moved.
|
|
@@ -134,7 +136,7 @@ export declare class CdkDrag<T = any> implements AfterViewInit, OnDestroy {
|
|
|
134
136
|
/** Element that the draggable is attached to. */
|
|
135
137
|
element: ElementRef<HTMLElement>,
|
|
136
138
|
/** Droppable container that the draggable is a part of. */
|
|
137
|
-
dropContainer:
|
|
139
|
+
dropContainer: CdkDropListContainer, document: any, _ngZone: NgZone, _viewContainerRef: ViewContainerRef, _viewportRuler: ViewportRuler, _dragDropRegistry: DragDropRegistry<CdkDrag<T>, CdkDropListContainer>, _config: CdkDragConfig, _dir: Directionality);
|
|
138
140
|
/**
|
|
139
141
|
* Returns the element that is being used as a placeholder
|
|
140
142
|
* while the current element is being dragged.
|
|
@@ -186,13 +188,6 @@ export declare class CdkDrag<T = any> implements AfterViewInit, OnDestroy {
|
|
|
186
188
|
* @returns Promise that resolves when the animation completes.
|
|
187
189
|
*/
|
|
188
190
|
private _animatePreviewToPlaceholder;
|
|
189
|
-
/**
|
|
190
|
-
* Sets the `transform` style on an element.
|
|
191
|
-
* @param element Element on which to set the transform.
|
|
192
|
-
* @param x Desired position of the element along the X axis.
|
|
193
|
-
* @param y Desired position of the element along the Y axis.
|
|
194
|
-
*/
|
|
195
|
-
private _setTransform;
|
|
196
191
|
/**
|
|
197
192
|
* Helper to remove an element from the DOM and to do all the necessary null checks.
|
|
198
193
|
* @param element Element to be removed.
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { InjectionToken, QueryList, ElementRef } from '@angular/core';
|
|
9
9
|
import { CdkDrag } from './drag';
|
|
10
|
-
export interface
|
|
10
|
+
export interface CdkDropListContainer<T = any> {
|
|
11
11
|
/** DOM node that corresponds to the drop container. */
|
|
12
12
|
element: ElementRef<HTMLElement>;
|
|
13
13
|
/** Arbitrary data to attach to all events emitted by this container. */
|
|
@@ -26,7 +26,7 @@ export interface CdkDropContainer<T = any> {
|
|
|
26
26
|
* @param currentIndex Index at which the item should be inserted.
|
|
27
27
|
* @param previousContainer Container from which the item got dragged in.
|
|
28
28
|
*/
|
|
29
|
-
drop(item: CdkDrag, currentIndex: number, previousContainer?:
|
|
29
|
+
drop(item: CdkDrag, currentIndex: number, previousContainer?: CdkDropListContainer): void;
|
|
30
30
|
/**
|
|
31
31
|
* Emits an event to indicate that the user moved an item into the container.
|
|
32
32
|
* @param item Item that was moved into the container.
|
|
@@ -49,11 +49,11 @@ export interface CdkDropContainer<T = any> {
|
|
|
49
49
|
y: number;
|
|
50
50
|
}): void;
|
|
51
51
|
_draggables: QueryList<CdkDrag>;
|
|
52
|
-
_getSiblingContainerFromPosition(item: CdkDrag, x: number, y: number):
|
|
52
|
+
_getSiblingContainerFromPosition(item: CdkDrag, x: number, y: number): CdkDropListContainer | null;
|
|
53
53
|
_canReturnItem(item: CdkDrag, x: number, y: number): boolean;
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
-
* Injection token that is used to provide a
|
|
56
|
+
* Injection token that is used to provide a CdkDropList instance to CdkDrag.
|
|
57
57
|
* Used for avoiding circular imports.
|
|
58
58
|
*/
|
|
59
|
-
export declare const
|
|
59
|
+
export declare const CDK_DROP_LIST_CONTAINER: InjectionToken<CdkDropListContainer<any>>;
|
|
@@ -11,7 +11,7 @@ import { CdkDrag } from './drag';
|
|
|
11
11
|
import { DragDropRegistry } from './drag-drop-registry';
|
|
12
12
|
import { CdkDragDrop, CdkDragEnter, CdkDragExit } from './drag-events';
|
|
13
13
|
/** Container that wraps a set of draggable items. */
|
|
14
|
-
export declare class
|
|
14
|
+
export declare class CdkDropList<T = any> implements OnInit, OnDestroy {
|
|
15
15
|
element: ElementRef<HTMLElement>;
|
|
16
16
|
private _dragDropRegistry;
|
|
17
17
|
private _dir?;
|
|
@@ -22,14 +22,14 @@ export declare class CdkDrop<T = any> implements OnInit, OnDestroy {
|
|
|
22
22
|
* container's items can be transferred. Can either be references to other drop containers,
|
|
23
23
|
* or their unique IDs.
|
|
24
24
|
*/
|
|
25
|
-
connectedTo: (
|
|
25
|
+
connectedTo: (CdkDropList | string)[] | CdkDropList | string;
|
|
26
26
|
/** Arbitrary data to attach to this container. */
|
|
27
27
|
data: T;
|
|
28
28
|
/** Direction in which the list is oriented. */
|
|
29
29
|
orientation: 'horizontal' | 'vertical';
|
|
30
30
|
/**
|
|
31
31
|
* Unique ID for the drop zone. Can be used as a reference
|
|
32
|
-
* in the `connectedTo` of another `
|
|
32
|
+
* in the `connectedTo` of another `CdkDropList`.
|
|
33
33
|
*/
|
|
34
34
|
id: string;
|
|
35
35
|
/** Locks the position of the draggable elements inside the container along the specified axis. */
|
|
@@ -38,7 +38,7 @@ export declare class CdkDrop<T = any> implements OnInit, OnDestroy {
|
|
|
38
38
|
* Function that is used to determine whether an item
|
|
39
39
|
* is allowed to be moved into a drop container.
|
|
40
40
|
*/
|
|
41
|
-
enterPredicate: (drag
|
|
41
|
+
enterPredicate: (drag: CdkDrag, drop: CdkDropList) => boolean;
|
|
42
42
|
/** Emits when the user drops an item inside the container. */
|
|
43
43
|
dropped: EventEmitter<CdkDragDrop<T, any>>;
|
|
44
44
|
/**
|
|
@@ -50,7 +50,7 @@ export declare class CdkDrop<T = any> implements OnInit, OnDestroy {
|
|
|
50
50
|
* by dragging it into another container.
|
|
51
51
|
*/
|
|
52
52
|
exited: EventEmitter<CdkDragExit<T>>;
|
|
53
|
-
constructor(element: ElementRef<HTMLElement>, _dragDropRegistry: DragDropRegistry<CdkDrag,
|
|
53
|
+
constructor(element: ElementRef<HTMLElement>, _dragDropRegistry: DragDropRegistry<CdkDrag, CdkDropList<T>>, _dir?: Directionality | undefined);
|
|
54
54
|
ngOnInit(): void;
|
|
55
55
|
ngOnDestroy(): void;
|
|
56
56
|
/** Whether an item in the container is being dragged. */
|
|
@@ -76,7 +76,7 @@ export declare class CdkDrop<T = any> implements OnInit, OnDestroy {
|
|
|
76
76
|
* @param currentIndex Index at which the item should be inserted.
|
|
77
77
|
* @param previousContainer Container from which the item got dragged in.
|
|
78
78
|
*/
|
|
79
|
-
drop(item: CdkDrag, currentIndex: number, previousContainer:
|
|
79
|
+
drop(item: CdkDrag, currentIndex: number, previousContainer: CdkDropList): void;
|
|
80
80
|
/**
|
|
81
81
|
* Emits an event to indicate that the user moved an item into the container.
|
|
82
82
|
* @param item Item that was moved into the container.
|
|
@@ -112,7 +112,7 @@ export declare class CdkDrop<T = any> implements OnInit, OnDestroy {
|
|
|
112
112
|
* @param x Position of the item along the X axis.
|
|
113
113
|
* @param y Position of the item along the Y axis.
|
|
114
114
|
*/
|
|
115
|
-
_getSiblingContainerFromPosition(item: CdkDrag, x: number, y: number):
|
|
115
|
+
_getSiblingContainerFromPosition(item: CdkDrag, x: number, y: number): CdkDropList | null;
|
|
116
116
|
/**
|
|
117
117
|
* Checks whether an item that started in this container can be returned to it,
|
|
118
118
|
* after it was moved out into another container.
|