@angular/cdk 9.1.2 → 9.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/focus-monitor/focus-monitor.d.ts +42 -2
- package/a11y/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +107 -75
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +7 -7
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-clipboard.umd.js +1 -1
- package/bundles/cdk-clipboard.umd.js.map +1 -1
- package/bundles/cdk-clipboard.umd.min.js +1 -1
- package/bundles/cdk-clipboard.umd.min.js.map +1 -1
- package/bundles/cdk-coercion.umd.js +0 -1
- package/bundles/cdk-coercion.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +121 -95
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +15 -8
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +2 -1
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +4 -4
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +11 -0
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +6 -6
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +41 -10
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +8 -8
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +58 -27
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +12 -5
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.js +15 -9
- package/bundles/cdk-testing-protractor.umd.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.min.js +2 -2
- package/bundles/cdk-testing-protractor.umd.min.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.js +15 -9
- package/bundles/cdk-testing-testbed.umd.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.min.js +8 -8
- package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +21 -6
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +3 -3
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +8 -4
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js +1 -1
- package/bundles/cdk-tree.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/coercion/array.d.ts +1 -0
- package/drag-drop/client-rect.d.ts +31 -0
- package/drag-drop/directives/config.d.ts +1 -0
- package/drag-drop/directives/drop-list.d.ts +4 -3
- package/drag-drop/drag-ref.d.ts +4 -0
- package/drag-drop/index.metadata.json +1 -1
- package/esm2015/a11y/focus-monitor/focus-monitor.js +163 -76
- package/esm2015/a11y/focus-trap/configurable-focus-trap-factory.js +3 -3
- package/esm2015/a11y/focus-trap/focus-trap.js +1 -1
- package/esm2015/a11y/high-contrast-mode/high-contrast-mode-detector.js +8 -4
- package/esm2015/a11y/live-announcer/live-announcer.js +1 -1
- package/esm2015/a11y/public-api.js +2 -2
- package/esm2015/bidi/directionality.js +1 -1
- package/esm2015/clipboard/pending-copy.js +3 -3
- package/esm2015/coercion/array.js +1 -2
- package/esm2015/drag-drop/client-rect.js +75 -0
- package/esm2015/drag-drop/directives/config.js +3 -1
- package/esm2015/drag-drop/directives/drag.js +3 -2
- package/esm2015/drag-drop/directives/drop-list.js +24 -18
- package/esm2015/drag-drop/drag-drop.js +1 -1
- package/esm2015/drag-drop/drag-ref.js +61 -25
- package/esm2015/drag-drop/drop-list-ref.js +15 -82
- package/esm2015/layout/breakpoints-observer.js +1 -1
- package/esm2015/overlay/position/flexible-connected-position-strategy.js +3 -2
- package/esm2015/overlay/position/overlay-position-builder.js +1 -1
- package/esm2015/platform/features/shadow-dom.js +16 -1
- package/esm2015/platform/public-api.js +2 -2
- package/esm2015/scrolling/scroll-dispatcher.js +38 -5
- package/esm2015/scrolling/viewport-ruler.js +44 -5
- package/esm2015/table/cell.js +18 -8
- package/esm2015/table/public-api.js +3 -2
- package/esm2015/table/row.js +24 -8
- package/esm2015/table/table.js +26 -12
- package/esm2015/table/text-column.js +3 -26
- package/esm2015/table/tokens.js +44 -0
- package/esm2015/testing/protractor/protractor-harness-environment.js +13 -8
- package/esm2015/testing/testbed/testbed-harness-environment.js +16 -10
- package/esm2015/text-field/autosize.js +38 -4
- package/esm2015/tree/padding.js +9 -10
- package/esm2015/version.js +1 -1
- package/esm5/a11y/focus-monitor/focus-monitor.js +87 -56
- package/esm5/a11y/focus-trap/configurable-focus-trap-factory.js +3 -3
- package/esm5/a11y/focus-trap/focus-trap.js +1 -1
- package/esm5/a11y/high-contrast-mode/high-contrast-mode-detector.js +7 -4
- package/esm5/a11y/live-announcer/live-announcer.js +1 -1
- package/esm5/bidi/directionality.js +1 -1
- package/esm5/clipboard/pending-copy.js +2 -2
- package/esm5/coercion/array.js +1 -2
- package/esm5/drag-drop/client-rect.js +60 -0
- package/esm5/drag-drop/directives/config.js +1 -1
- package/esm5/drag-drop/directives/drag.js +3 -2
- package/esm5/drag-drop/directives/drop-list.js +13 -10
- package/esm5/drag-drop/drag-drop.js +1 -1
- package/esm5/drag-drop/drag-ref.js +39 -21
- package/esm5/drag-drop/drop-list-ref.js +13 -67
- package/esm5/layout/breakpoints-observer.js +1 -1
- package/esm5/overlay/position/flexible-connected-position-strategy.js +3 -2
- package/esm5/overlay/position/overlay-position-builder.js +1 -1
- package/esm5/platform/features/shadow-dom.js +11 -1
- package/esm5/scrolling/scroll-dispatcher.js +21 -5
- package/esm5/scrolling/viewport-ruler.js +24 -5
- package/esm5/table/cell.js +13 -8
- package/esm5/table/public-api.js +2 -1
- package/esm5/table/row.js +21 -11
- package/esm5/table/table.js +16 -11
- package/esm5/table/text-column.js +3 -4
- package/esm5/table/tokens.js +16 -0
- package/esm5/testing/protractor/protractor-harness-environment.js +17 -11
- package/esm5/testing/testbed/testbed-harness-environment.js +17 -11
- package/esm5/text-field/autosize.js +20 -4
- package/esm5/tree/padding.js +9 -5
- package/esm5/version.js +1 -1
- package/fesm2015/a11y.js +190 -103
- package/fesm2015/a11y.js.map +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/clipboard.js +2 -2
- package/fesm2015/clipboard.js.map +1 -1
- package/fesm2015/coercion.js +0 -1
- package/fesm2015/coercion.js.map +1 -1
- package/fesm2015/drag-drop.js +174 -123
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js +2 -1
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/platform.js +16 -1
- package/fesm2015/platform.js.map +1 -1
- package/fesm2015/scrolling.js +76 -7
- package/fesm2015/scrolling.js.map +1 -1
- package/fesm2015/table.js +98 -49
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/testing/protractor.js +13 -8
- package/fesm2015/testing/protractor.js.map +1 -1
- package/fesm2015/testing/testbed.js +15 -9
- package/fesm2015/testing/testbed.js.map +1 -1
- package/fesm2015/text-field.js +37 -3
- package/fesm2015/text-field.js.map +1 -1
- package/fesm2015/tree.js +8 -9
- package/fesm2015/tree.js.map +1 -1
- package/fesm5/a11y.js +107 -76
- package/fesm5/a11y.js.map +1 -1
- package/fesm5/cdk.js +1 -1
- package/fesm5/cdk.js.map +1 -1
- package/fesm5/clipboard.js +1 -1
- package/fesm5/clipboard.js.map +1 -1
- package/fesm5/coercion.js +0 -1
- package/fesm5/coercion.js.map +1 -1
- package/fesm5/drag-drop.js +122 -96
- package/fesm5/drag-drop.js.map +1 -1
- package/fesm5/overlay.js +2 -1
- package/fesm5/overlay.js.map +1 -1
- package/fesm5/platform.js +11 -1
- package/fesm5/platform.js.map +1 -1
- package/fesm5/scrolling.js +39 -7
- package/fesm5/scrolling.js.map +1 -1
- package/fesm5/table.js +59 -29
- package/fesm5/table.js.map +1 -1
- package/fesm5/testing/protractor.js +17 -11
- package/fesm5/testing/protractor.js.map +1 -1
- package/fesm5/testing/testbed.js +16 -10
- package/fesm5/testing/testbed.js.map +1 -1
- package/fesm5/text-field.js +19 -3
- package/fesm5/text-field.js.map +1 -1
- package/fesm5/tree.js +8 -4
- package/fesm5/tree.js.map +1 -1
- package/package.json +1 -1
- package/platform/features/shadow-dom.d.ts +2 -0
- package/platform/index.metadata.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/schematics/ng-update/upgrade-rules/class-names-rule.js +3 -1
- package/schematics/utils/ast/ng-module-imports.js +3 -2
- package/scrolling/index.metadata.json +1 -1
- package/scrolling/scroll-dispatcher.d.ts +9 -1
- package/scrolling/viewport-ruler.d.ts +9 -1
- package/table/cell.d.ts +2 -0
- package/table/index.metadata.json +1 -1
- package/table/public-api.d.ts +1 -0
- package/table/row.d.ts +6 -3
- package/table/table.d.ts +2 -0
- package/table/text-column.d.ts +2 -13
- package/table/tokens.d.ts +25 -0
- package/testing/protractor/protractor-harness-environment.d.ts +10 -3
- package/testing/testbed/testbed-harness-environment.d.ts +12 -4
- package/text-field/autosize.d.ts +9 -1
- package/text-field/index.metadata.json +1 -1
- package/tree/index.metadata.json +1 -1
- package/tree/padding.d.ts +6 -2
package/fesm2015/cdk.js
CHANGED
|
@@ -8,7 +8,7 @@ import { Version } from '@angular/core';
|
|
|
8
8
|
* found in the LICENSE file at https://angular.io/license
|
|
9
9
|
*/
|
|
10
10
|
/** Current version of the Angular Component Development Kit. */
|
|
11
|
-
const VERSION = new Version('9.1
|
|
11
|
+
const VERSION = new Version('9.2.1');
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* @license
|
package/fesm2015/cdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.js","sources":["../../../../../../src/cdk/version.ts","../../../../../../src/cdk/public-api.ts","../../../../../../src/cdk/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('9.1
|
|
1
|
+
{"version":3,"file":"cdk.js","sources":["../../../../../../src/cdk/version.ts","../../../../../../src/cdk/public-api.ts","../../../../../../src/cdk/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {Version} from '@angular/core';\n\n/** Current version of the Angular Component Development Kit. */\nexport const VERSION = new Version('9.2.1');\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\nexport * from './version';\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\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;;;AAQA,AAEA;AACA,MAAa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC;;ACXvD;;;;;;GAMG;;ACNH;;;;;;GAMG;;;;"}
|
package/fesm2015/clipboard.js
CHANGED
|
@@ -58,11 +58,11 @@ class PendingCopy {
|
|
|
58
58
|
try { // Older browsers could throw if copy is not supported.
|
|
59
59
|
if (textarea) {
|
|
60
60
|
/** @type {?} */
|
|
61
|
-
const currentFocus = this._document.activeElement;
|
|
61
|
+
const currentFocus = (/** @type {?} */ (this._document.activeElement));
|
|
62
62
|
textarea.select();
|
|
63
63
|
textarea.setSelectionRange(0, textarea.value.length);
|
|
64
64
|
successful = this._document.execCommand('copy');
|
|
65
|
-
if (currentFocus
|
|
65
|
+
if (currentFocus) {
|
|
66
66
|
currentFocus.focus();
|
|
67
67
|
}
|
|
68
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.js","sources":["../../../../../../src/cdk/clipboard/pending-copy.ts","../../../../../../src/cdk/clipboard/clipboard.ts","../../../../../../src/cdk/clipboard/copy-to-clipboard.ts","../../../../../../src/cdk/clipboard/clipboard-module.ts","../../../../../../src/cdk/clipboard/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * A pending copy-to-clipboard operation.\n *\n * The implementation of copying text to the clipboard modifies the DOM and\n * forces a relayout. This relayout can take too long if the string is large,\n * causing the execCommand('copy') to happen too long after the user clicked.\n * This results in the browser refusing to copy. This object lets the\n * relayout happen in a separate tick from copying by providing a copy function\n * that can be called later.\n *\n * Destroy must be called when no longer in use, regardless of whether `copy` is\n * called.\n */\nexport class PendingCopy {\n private _textarea: HTMLTextAreaElement|undefined;\n\n constructor(text: string, private readonly _document: Document) {\n const textarea = this._textarea = this._document.createElement('textarea');\n const styles = textarea.style;\n\n // Hide the element for display and accessibility. Set an\n // absolute position so the page layout isn't affected.\n styles.opacity = '0';\n styles.position = 'absolute';\n styles.left = styles.top = '-999em';\n textarea.setAttribute('aria-hidden', 'true');\n textarea.value = text;\n this._document.body.appendChild(textarea);\n }\n\n /** Finishes copying the text. */\n copy(): boolean {\n const textarea = this._textarea;\n let successful = false;\n\n try { // Older browsers could throw if copy is not supported.\n if (textarea) {\n const currentFocus = this._document.activeElement;\n\n textarea.select();\n textarea.setSelectionRange(0, textarea.value.length);\n successful = this._document.execCommand('copy');\n\n if (currentFocus && currentFocus instanceof HTMLElement) {\n currentFocus.focus();\n }\n }\n } catch {\n // Discard error.\n // Initial setting of {@code successful} will represent failure here.\n }\n\n return successful;\n }\n\n /** Cleans up DOM changes used to perform the copy operation. */\n destroy() {\n const textarea = this._textarea;\n\n if (textarea) {\n if (textarea.parentNode) {\n textarea.parentNode.removeChild(textarea);\n }\n\n this._textarea = undefined;\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {DOCUMENT} from '@angular/common';\nimport {Inject, Injectable} from '@angular/core';\nimport {PendingCopy} from './pending-copy';\n\n\n/**\n * A service for copying text to the clipboard.\n */\n@Injectable({providedIn: 'root'})\nexport class Clipboard {\n private readonly _document: Document;\n\n constructor(@Inject(DOCUMENT) document: any) {\n this._document = document;\n }\n\n /**\n * Copies the provided text into the user's clipboard.\n *\n * @param text The string to copy.\n * @returns Whether the operation was successful.\n */\n copy(text: string): boolean {\n const pendingCopy = this.beginCopy(text);\n const successful = pendingCopy.copy();\n pendingCopy.destroy();\n\n return successful;\n }\n\n /**\n * Prepares a string to be copied later. This is useful for large strings\n * which take too long to successfully render and be copied in the same tick.\n *\n * The caller must call `destroy` on the returned `PendingCopy`.\n *\n * @param text The string to copy.\n * @returns the pending copy operation.\n */\n beginCopy(text: string): PendingCopy {\n return new PendingCopy(text, this._document);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n Directive,\n EventEmitter,\n Input,\n Output,\n NgZone,\n InjectionToken,\n Inject,\n Optional,\n OnDestroy,\n} from '@angular/core';\nimport {Clipboard} from './clipboard';\nimport {PendingCopy} from './pending-copy';\n\n/** Object that can be used to configure the default options for `CdkCopyToClipboard`. */\nexport interface CdkCopyToClipboardConfig {\n /** Default number of attempts to make when copying text to the clipboard. */\n attempts?: number;\n}\n\n/** Injection token that can be used to provide the default options to `CdkCopyToClipboard`. */\nexport const CKD_COPY_TO_CLIPBOARD_CONFIG =\n new InjectionToken<CdkCopyToClipboardConfig>('CKD_COPY_TO_CLIPBOARD_CONFIG');\n\n/**\n * Provides behavior for a button that when clicked copies content into user's\n * clipboard.\n */\n@Directive({\n selector: '[cdkCopyToClipboard]',\n host: {\n '(click)': 'copy()',\n }\n})\nexport class CdkCopyToClipboard implements OnDestroy {\n /** Content to be copied. */\n @Input('cdkCopyToClipboard') text: string = '';\n\n /**\n * How many times to attempt to copy the text. This may be necessary for longer text, because\n * the browser needs time to fill an intermediate textarea element and copy the content.\n */\n @Input('cdkCopyToClipboardAttempts') attempts: number = 1;\n\n /**\n * Emits when some text is copied to the clipboard. The\n * emitted value indicates whether copying was successful.\n */\n @Output('cdkCopyToClipboardCopied') copied = new EventEmitter<boolean>();\n\n /**\n * Emits when some text is copied to the clipboard. The\n * emitted value indicates whether copying was successful.\n * @deprecated Use `cdkCopyToClipboardCopied` instead.\n * @breaking-change 10.0.0\n */\n @Output('copied') _deprecatedCopied = this.copied;\n\n /** Copies that are currently being attempted. */\n private _pending = new Set<PendingCopy>();\n\n /** Whether the directive has been destroyed. */\n private _destroyed: boolean;\n\n /** Timeout for the current copy attempt. */\n private _currentTimeout: any;\n\n constructor(\n private _clipboard: Clipboard,\n /**\n * @deprecated _ngZone parameter to become required.\n * @breaking-change 10.0.0\n */\n private _ngZone?: NgZone,\n @Optional() @Inject(CKD_COPY_TO_CLIPBOARD_CONFIG) config?: CdkCopyToClipboardConfig) {\n\n if (config && config.attempts != null) {\n this.attempts = config.attempts;\n }\n }\n\n /** Copies the current text to the clipboard. */\n copy(attempts: number = this.attempts): void {\n if (attempts > 1) {\n let remainingAttempts = attempts;\n const pending = this._clipboard.beginCopy(this.text);\n this._pending.add(pending);\n\n const attempt = () => {\n const successful = pending.copy();\n if (!successful && --remainingAttempts && !this._destroyed) {\n // @breaking-change 10.0.0 Remove null check for `_ngZone`.\n if (this._ngZone) {\n this._currentTimeout = this._ngZone.runOutsideAngular(() => setTimeout(attempt, 1));\n } else {\n // We use 1 for the timeout since it's more predictable when flushing in unit tests.\n this._currentTimeout = setTimeout(attempt, 1);\n }\n } else {\n this._currentTimeout = null;\n this._pending.delete(pending);\n pending.destroy();\n this.copied.emit(successful);\n }\n };\n attempt();\n } else {\n this.copied.emit(this._clipboard.copy(this.text));\n }\n }\n\n ngOnDestroy() {\n if (this._currentTimeout) {\n clearTimeout(this._currentTimeout);\n }\n\n this._pending.forEach(copy => copy.destroy());\n this._pending.clear();\n this._destroyed = true;\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 {NgModule} from '@angular/core';\n\nimport {CdkCopyToClipboard} from './copy-to-clipboard';\n\n@NgModule({\n declarations: [CdkCopyToClipboard],\n exports: [CdkCopyToClipboard],\n})\nexport class ClipboardModule {\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,WAAW;;;;;IAGtB,YAAY,IAAY,EAAmB,SAAmB;QAAnB,cAAS,GAAT,SAAS,CAAU;;cACtD,QAAQ,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC;;cACpE,MAAM,GAAG,QAAQ,CAAC,KAAK;;;QAI7B,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC;QACrB,MAAM,CAAC,QAAQ,GAAG,UAAU,CAAC;QAC7B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,GAAG,QAAQ,CAAC;QACpC,QAAQ,CAAC,YAAY,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC;QAC7C,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC;QACtB,IAAI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;;;;;;IAM/C,sCAA0D;;;;;;IAM1D,oCAAyE;;;;;;;;IAQzE,+CAAkD;;;;;;IAGlD,sCAA0C;;;;;;IAG1C,wCAA4B;;;;;;IAG5B,6CAA6B;;;;;IAG3B,wCAA6B;;;;;;;IAK7B,qCAAwB;;;;;;;;MCjEf,eAAe;;;YAJ3B,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,kBAAkB,CAAC;gBAClC,OAAO,EAAE,CAAC,kBAAkB,CAAC;aAC9B;;;;;;;;;ACfD;;GAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"clipboard.js","sources":["../../../../../../src/cdk/clipboard/pending-copy.ts","../../../../../../src/cdk/clipboard/clipboard.ts","../../../../../../src/cdk/clipboard/copy-to-clipboard.ts","../../../../../../src/cdk/clipboard/clipboard-module.ts","../../../../../../src/cdk/clipboard/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * A pending copy-to-clipboard operation.\n *\n * The implementation of copying text to the clipboard modifies the DOM and\n * forces a relayout. This relayout can take too long if the string is large,\n * causing the execCommand('copy') to happen too long after the user clicked.\n * This results in the browser refusing to copy. This object lets the\n * relayout happen in a separate tick from copying by providing a copy function\n * that can be called later.\n *\n * Destroy must be called when no longer in use, regardless of whether `copy` is\n * called.\n */\nexport class PendingCopy {\n private _textarea: HTMLTextAreaElement|undefined;\n\n constructor(text: string, private readonly _document: Document) {\n const textarea = this._textarea = this._document.createElement('textarea');\n const styles = textarea.style;\n\n // Hide the element for display and accessibility. Set an\n // absolute position so the page layout isn't affected.\n styles.opacity = '0';\n styles.position = 'absolute';\n styles.left = styles.top = '-999em';\n textarea.setAttribute('aria-hidden', 'true');\n textarea.value = text;\n this._document.body.appendChild(textarea);\n }\n\n /** Finishes copying the text. */\n copy(): boolean {\n const textarea = this._textarea;\n let successful = false;\n\n try { // Older browsers could throw if copy is not supported.\n if (textarea) {\n const currentFocus = this._document.activeElement as HTMLOrSVGElement | null;\n\n textarea.select();\n textarea.setSelectionRange(0, textarea.value.length);\n successful = this._document.execCommand('copy');\n\n if (currentFocus) {\n currentFocus.focus();\n }\n }\n } catch {\n // Discard error.\n // Initial setting of {@code successful} will represent failure here.\n }\n\n return successful;\n }\n\n /** Cleans up DOM changes used to perform the copy operation. */\n destroy() {\n const textarea = this._textarea;\n\n if (textarea) {\n if (textarea.parentNode) {\n textarea.parentNode.removeChild(textarea);\n }\n\n this._textarea = undefined;\n }\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {DOCUMENT} from '@angular/common';\nimport {Inject, Injectable} from '@angular/core';\nimport {PendingCopy} from './pending-copy';\n\n\n/**\n * A service for copying text to the clipboard.\n */\n@Injectable({providedIn: 'root'})\nexport class Clipboard {\n private readonly _document: Document;\n\n constructor(@Inject(DOCUMENT) document: any) {\n this._document = document;\n }\n\n /**\n * Copies the provided text into the user's clipboard.\n *\n * @param text The string to copy.\n * @returns Whether the operation was successful.\n */\n copy(text: string): boolean {\n const pendingCopy = this.beginCopy(text);\n const successful = pendingCopy.copy();\n pendingCopy.destroy();\n\n return successful;\n }\n\n /**\n * Prepares a string to be copied later. This is useful for large strings\n * which take too long to successfully render and be copied in the same tick.\n *\n * The caller must call `destroy` on the returned `PendingCopy`.\n *\n * @param text The string to copy.\n * @returns the pending copy operation.\n */\n beginCopy(text: string): PendingCopy {\n return new PendingCopy(text, this._document);\n }\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n Directive,\n EventEmitter,\n Input,\n Output,\n NgZone,\n InjectionToken,\n Inject,\n Optional,\n OnDestroy,\n} from '@angular/core';\nimport {Clipboard} from './clipboard';\nimport {PendingCopy} from './pending-copy';\n\n/** Object that can be used to configure the default options for `CdkCopyToClipboard`. */\nexport interface CdkCopyToClipboardConfig {\n /** Default number of attempts to make when copying text to the clipboard. */\n attempts?: number;\n}\n\n/** Injection token that can be used to provide the default options to `CdkCopyToClipboard`. */\nexport const CKD_COPY_TO_CLIPBOARD_CONFIG =\n new InjectionToken<CdkCopyToClipboardConfig>('CKD_COPY_TO_CLIPBOARD_CONFIG');\n\n/**\n * Provides behavior for a button that when clicked copies content into user's\n * clipboard.\n */\n@Directive({\n selector: '[cdkCopyToClipboard]',\n host: {\n '(click)': 'copy()',\n }\n})\nexport class CdkCopyToClipboard implements OnDestroy {\n /** Content to be copied. */\n @Input('cdkCopyToClipboard') text: string = '';\n\n /**\n * How many times to attempt to copy the text. This may be necessary for longer text, because\n * the browser needs time to fill an intermediate textarea element and copy the content.\n */\n @Input('cdkCopyToClipboardAttempts') attempts: number = 1;\n\n /**\n * Emits when some text is copied to the clipboard. The\n * emitted value indicates whether copying was successful.\n */\n @Output('cdkCopyToClipboardCopied') copied = new EventEmitter<boolean>();\n\n /**\n * Emits when some text is copied to the clipboard. The\n * emitted value indicates whether copying was successful.\n * @deprecated Use `cdkCopyToClipboardCopied` instead.\n * @breaking-change 10.0.0\n */\n @Output('copied') _deprecatedCopied = this.copied;\n\n /** Copies that are currently being attempted. */\n private _pending = new Set<PendingCopy>();\n\n /** Whether the directive has been destroyed. */\n private _destroyed: boolean;\n\n /** Timeout for the current copy attempt. */\n private _currentTimeout: any;\n\n constructor(\n private _clipboard: Clipboard,\n /**\n * @deprecated _ngZone parameter to become required.\n * @breaking-change 10.0.0\n */\n private _ngZone?: NgZone,\n @Optional() @Inject(CKD_COPY_TO_CLIPBOARD_CONFIG) config?: CdkCopyToClipboardConfig) {\n\n if (config && config.attempts != null) {\n this.attempts = config.attempts;\n }\n }\n\n /** Copies the current text to the clipboard. */\n copy(attempts: number = this.attempts): void {\n if (attempts > 1) {\n let remainingAttempts = attempts;\n const pending = this._clipboard.beginCopy(this.text);\n this._pending.add(pending);\n\n const attempt = () => {\n const successful = pending.copy();\n if (!successful && --remainingAttempts && !this._destroyed) {\n // @breaking-change 10.0.0 Remove null check for `_ngZone`.\n if (this._ngZone) {\n this._currentTimeout = this._ngZone.runOutsideAngular(() => setTimeout(attempt, 1));\n } else {\n // We use 1 for the timeout since it's more predictable when flushing in unit tests.\n this._currentTimeout = setTimeout(attempt, 1);\n }\n } else {\n this._currentTimeout = null;\n this._pending.delete(pending);\n pending.destroy();\n this.copied.emit(successful);\n }\n };\n attempt();\n } else {\n this.copied.emit(this._clipboard.copy(this.text));\n }\n }\n\n ngOnDestroy() {\n if (this._currentTimeout) {\n clearTimeout(this._currentTimeout);\n }\n\n this._pending.forEach(copy => copy.destroy());\n this._pending.clear();\n this._destroyed = true;\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 {NgModule} from '@angular/core';\n\nimport {CdkCopyToClipboard} from './copy-to-clipboard';\n\n@NgModule({\n declarations: [CdkCopyToClipboard],\n exports: [CdkCopyToClipboard],\n})\nexport class ClipboardModule {\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,WAAW;;;;;IAGtB,YAAY,IAAY,EAAmB,SAAmB;QAAnB,cAAS,GAAT,SAAS,CAAU;;cACtD,QAAQ,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC;;cACpE,MAAM,GAAG,QAAQ,CAAC,KAAK;;;QAI7B,MAAM,CAAC,OAAO,GAAG,GAAG,CAAC;QACrB,MAAM,CAAC,QAAQ,GAAG,UAAU,CAAC;QAC7B,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,GAAG,QAAQ,CAAC;QACpC,QAAQ,CAAC,YAAY,C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MlC,MAAM,SAAC,0BAA0B;gCAQjC,MAAM,SAAC,QAAQ;;;;;;;IApBhB,kCAA+C;;;;;;IAM/C,sCAA0D;;;;;;IAM1D,oCAAyE;;;;;;;;IAQzE,+CAAkD;;;;;;IAGlD,sCAA0C;;;;;;IAG1C,wCAA4B;;;;;;IAG5B,6CAA6B;;;;;IAG3B,wCAA6B;;;;;;;IAK7B,qCAAwB;;;;;;;;MCjEf,eAAe;;;YAJ3B,QAAQ,SAAC;gBACR,YAAY,EAAE,CAAC,kBAAkB,CAAC;gBAClC,OAAO,EAAE,CAAC,kBAAkB,CAAC;aAC9B;;;;;;;;;ACfD;;GAEG;;;;"}
|
package/fesm2015/coercion.js
CHANGED
|
@@ -40,7 +40,6 @@ function _isNumberValue(value) {
|
|
|
40
40
|
* Use of this source code is governed by an MIT-style license that can be
|
|
41
41
|
* found in the LICENSE file at https://angular.io/license
|
|
42
42
|
*/
|
|
43
|
-
/** Wraps the provided value in an array, unless the provided value is an array. */
|
|
44
43
|
function coerceArray(value) {
|
|
45
44
|
return Array.isArray(value) ? value : [value];
|
|
46
45
|
}
|
package/fesm2015/coercion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coercion.js","sources":["../../../../../../src/cdk/coercion/boolean-property.ts","../../../../../../src/cdk/coercion/number-property.ts","../../../../../../src/cdk/coercion/array.ts","../../../../../../src/cdk/coercion/css-pixel-value.ts","../../../../../../src/cdk/coercion/element.ts","../../../../../../src/cdk/coercion/public-api.ts","../../../../../../src/cdk/coercion/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * Type describing the allowed values for a boolean input.\n * @docs-private\n */\nexport type BooleanInput = string | boolean | null | undefined;\n\n/** Coerces a data-bound value (typically a string) to a boolean. */\nexport function coerceBooleanProperty(value: any): boolean {\n return value != null && `${value}` !== 'false';\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * Type describing the allowed values for a number input\n * @docs-private\n */\nexport type NumberInput = string | number | null | undefined;\n\n/** Coerces a data-bound value (typically a string) to a number. */\nexport function coerceNumberProperty(value: any): number;\nexport function coerceNumberProperty<D>(value: any, fallback: D): number | D;\nexport function coerceNumberProperty(value: any, fallbackValue = 0) {\n return _isNumberValue(value) ? Number(value) : fallbackValue;\n}\n\n/**\n * Whether the provided value is considered a number.\n * @docs-private\n */\nexport function _isNumberValue(value: any): boolean {\n // parseFloat(value) handles most of the cases we're interested in (it treats null, empty string,\n // and other non-number values as NaN, where Number just uses 0) but it considers the string\n // '123hello' to be a valid number. Therefore we also check if Number(value) is NaN.\n return !isNaN(parseFloat(value as any)) && !isNaN(Number(value));\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Wraps the provided value in an array, unless the provided value is an array. */\nexport function coerceArray<T>(value: T | T[]): T[] {\n return Array.isArray(value) ? value : [value];\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Coerces a value to a CSS pixel value. */\nexport function coerceCssPixelValue(value: any): string {\n if (value == null) {\n return '';\n }\n\n return typeof value === 'string' ? value : `${value}px`;\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 {ElementRef} from '@angular/core';\n\n/**\n * Coerces an ElementRef or an Element into an element.\n * Useful for APIs that can accept either a ref or the native element itself.\n */\nexport function coerceElement<T>(elementOrRef: ElementRef<T> | T): T {\n return elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;\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\nexport * from './boolean-property';\nexport * from './number-property';\nexport * from './array';\nexport * from './css-pixel-value';\nexport * from './element';\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\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;;;;AAeA,SAAgB,qBAAqB,CAAC,KAAU;IAC9C,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,EAAE,KAAK,OAAO,CAAC;CAChD;;ACjBD;;;;;;;AAiBA,SAAgB,oBAAoB,CAAC,KAAU,EAAE,aAAa,GAAG,CAAC;IAChE,OAAO,cAAc,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC;CAC9D;;;;;AAMD,SAAgB,cAAc,CAAC,KAAU;;;;IAIvC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAY,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CAClE;;AC9BD
|
|
1
|
+
{"version":3,"file":"coercion.js","sources":["../../../../../../src/cdk/coercion/boolean-property.ts","../../../../../../src/cdk/coercion/number-property.ts","../../../../../../src/cdk/coercion/array.ts","../../../../../../src/cdk/coercion/css-pixel-value.ts","../../../../../../src/cdk/coercion/element.ts","../../../../../../src/cdk/coercion/public-api.ts","../../../../../../src/cdk/coercion/index.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * Type describing the allowed values for a boolean input.\n * @docs-private\n */\nexport type BooleanInput = string | boolean | null | undefined;\n\n/** Coerces a data-bound value (typically a string) to a boolean. */\nexport function coerceBooleanProperty(value: any): boolean {\n return value != null && `${value}` !== 'false';\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/**\n * Type describing the allowed values for a number input\n * @docs-private\n */\nexport type NumberInput = string | number | null | undefined;\n\n/** Coerces a data-bound value (typically a string) to a number. */\nexport function coerceNumberProperty(value: any): number;\nexport function coerceNumberProperty<D>(value: any, fallback: D): number | D;\nexport function coerceNumberProperty(value: any, fallbackValue = 0) {\n return _isNumberValue(value) ? Number(value) : fallbackValue;\n}\n\n/**\n * Whether the provided value is considered a number.\n * @docs-private\n */\nexport function _isNumberValue(value: any): boolean {\n // parseFloat(value) handles most of the cases we're interested in (it treats null, empty string,\n // and other non-number values as NaN, where Number just uses 0) but it considers the string\n // '123hello' to be a valid number. Therefore we also check if Number(value) is NaN.\n return !isNaN(parseFloat(value as any)) && !isNaN(Number(value));\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Wraps the provided value in an array, unless the provided value is an array. */\nexport function coerceArray<T>(value: T | T[]): T[];\nexport function coerceArray<T>(value: T | readonly T[]): readonly T[];\nexport function coerceArray<T>(value: T | T[]): T[] {\n return Array.isArray(value) ? value : [value];\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\n/** Coerces a value to a CSS pixel value. */\nexport function coerceCssPixelValue(value: any): string {\n if (value == null) {\n return '';\n }\n\n return typeof value === 'string' ? value : `${value}px`;\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 {ElementRef} from '@angular/core';\n\n/**\n * Coerces an ElementRef or an Element into an element.\n * Useful for APIs that can accept either a ref or the native element itself.\n */\nexport function coerceElement<T>(elementOrRef: ElementRef<T> | T): T {\n return elementOrRef instanceof ElementRef ? elementOrRef.nativeElement : elementOrRef;\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\nexport * from './boolean-property';\nexport * from './number-property';\nexport * from './array';\nexport * from './css-pixel-value';\nexport * from './element';\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\nexport * from './public-api';\n"],"names":[],"mappings":";;AAAA;;;;;;;;AAeA,SAAgB,qBAAqB,CAAC,KAAU;IAC9C,OAAO,KAAK,IAAI,IAAI,IAAI,GAAG,KAAK,EAAE,KAAK,OAAO,CAAC;CAChD;;ACjBD;;;;;;;AAiBA,SAAgB,oBAAoB,CAAC,KAAU,EAAE,aAAa,GAAG,CAAC;IAChE,OAAO,cAAc,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,aAAa,CAAC;CAC9D;;;;;AAMD,SAAgB,cAAc,CAAC,KAAU;;;;IAIvC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,KAAY,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;CAClE;;AC9BD;;;;;;;AAWA,SAAgB,WAAW,CAAI,KAAc;IAC3C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;CAC/C;;ACbD;;;;;;;;AASA,SAAgB,mBAAmB,CAAC,KAAU;IAC5C,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IAED,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,GAAG,GAAG,KAAK,IAAI,CAAC;CACzD;;ACfD;;;;;;;AAQA,AAEA;;;;AAIA,SAAgB,aAAa,CAAI,YAA+B;IAC9D,OAAO,YAAY,YAAY,UAAU,GAAG,YAAY,CAAC,aAAa,GAAG,YAAY,CAAC;CACvF;;AChBD;;;;;;GAMG;;ACNH;;;;;;GAMG;;;;"}
|
package/fesm2015/drag-drop.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Injectable, NgZone, Inject, ɵɵdefineInjectable, ɵɵinject, InjectionToken, Directive, ElementRef, Optional, Input, TemplateRef, EventEmitter, isDevMode, SkipSelf, ViewContainerRef, ChangeDetectorRef, ContentChildren, ContentChild, Output, NgModule } from '@angular/core';
|
|
2
2
|
import { DOCUMENT } from '@angular/common';
|
|
3
3
|
import { ViewportRuler, ScrollDispatcher } from '@angular/cdk/scrolling';
|
|
4
|
-
import { normalizePassiveListenerOptions,
|
|
4
|
+
import { normalizePassiveListenerOptions, _getShadowRoot } from '@angular/cdk/platform';
|
|
5
5
|
import { coerceBooleanProperty, coerceElement, coerceNumberProperty, coerceArray } from '@angular/cdk/coercion';
|
|
6
6
|
import { Subject, Subscription, interval, animationFrameScheduler, Observable, merge } from 'rxjs';
|
|
7
7
|
import { startWith, takeUntil, map, take, tap, switchMap } from 'rxjs/operators';
|
|
@@ -137,6 +137,81 @@ function parseCssPropertyValue(computedStyle, name) {
|
|
|
137
137
|
part => part.trim()));
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
/**
|
|
141
|
+
* @fileoverview added by tsickle
|
|
142
|
+
* Generated from: src/cdk/drag-drop/client-rect.ts
|
|
143
|
+
* @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
144
|
+
*/
|
|
145
|
+
/**
|
|
146
|
+
* @license
|
|
147
|
+
* Copyright Google LLC All Rights Reserved.
|
|
148
|
+
*
|
|
149
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
150
|
+
* found in the LICENSE file at https://angular.io/license
|
|
151
|
+
*/
|
|
152
|
+
/**
|
|
153
|
+
* Gets a mutable version of an element's bounding `ClientRect`.
|
|
154
|
+
* @param {?} element
|
|
155
|
+
* @return {?}
|
|
156
|
+
*/
|
|
157
|
+
function getMutableClientRect(element) {
|
|
158
|
+
/** @type {?} */
|
|
159
|
+
const clientRect = element.getBoundingClientRect();
|
|
160
|
+
// We need to clone the `clientRect` here, because all the values on it are readonly
|
|
161
|
+
// and we need to be able to update them. Also we can't use a spread here, because
|
|
162
|
+
// the values on a `ClientRect` aren't own properties. See:
|
|
163
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#Notes
|
|
164
|
+
return {
|
|
165
|
+
top: clientRect.top,
|
|
166
|
+
right: clientRect.right,
|
|
167
|
+
bottom: clientRect.bottom,
|
|
168
|
+
left: clientRect.left,
|
|
169
|
+
width: clientRect.width,
|
|
170
|
+
height: clientRect.height
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Checks whether some coordinates are within a `ClientRect`.
|
|
175
|
+
* @param {?} clientRect ClientRect that is being checked.
|
|
176
|
+
* @param {?} x Coordinates along the X axis.
|
|
177
|
+
* @param {?} y Coordinates along the Y axis.
|
|
178
|
+
* @return {?}
|
|
179
|
+
*/
|
|
180
|
+
function isInsideClientRect(clientRect, x, y) {
|
|
181
|
+
const { top, bottom, left, right } = clientRect;
|
|
182
|
+
return y >= top && y <= bottom && x >= left && x <= right;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Updates the top/left positions of a `ClientRect`, as well as their bottom/right counterparts.
|
|
186
|
+
* @param {?} clientRect `ClientRect` that should be updated.
|
|
187
|
+
* @param {?} top Amount to add to the `top` position.
|
|
188
|
+
* @param {?} left Amount to add to the `left` position.
|
|
189
|
+
* @return {?}
|
|
190
|
+
*/
|
|
191
|
+
function adjustClientRect(clientRect, top, left) {
|
|
192
|
+
clientRect.top += top;
|
|
193
|
+
clientRect.bottom = clientRect.top + clientRect.height;
|
|
194
|
+
clientRect.left += left;
|
|
195
|
+
clientRect.right = clientRect.left + clientRect.width;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Checks whether the pointer coordinates are close to a ClientRect.
|
|
199
|
+
* @param {?} rect ClientRect to check against.
|
|
200
|
+
* @param {?} threshold Threshold around the ClientRect.
|
|
201
|
+
* @param {?} pointerX Coordinates along the X axis.
|
|
202
|
+
* @param {?} pointerY Coordinates along the Y axis.
|
|
203
|
+
* @return {?}
|
|
204
|
+
*/
|
|
205
|
+
function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
|
|
206
|
+
const { top, right, bottom, left, width, height } = rect;
|
|
207
|
+
/** @type {?} */
|
|
208
|
+
const xThreshold = width * threshold;
|
|
209
|
+
/** @type {?} */
|
|
210
|
+
const yThreshold = height * threshold;
|
|
211
|
+
return pointerY > top - yThreshold && pointerY < bottom + yThreshold &&
|
|
212
|
+
pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
213
|
+
}
|
|
214
|
+
|
|
140
215
|
/**
|
|
141
216
|
* @fileoverview added by tsickle
|
|
142
217
|
* Generated from: src/cdk/drag-drop/drag-ref.ts
|
|
@@ -160,6 +235,11 @@ if (false) {
|
|
|
160
235
|
* @type {?}
|
|
161
236
|
*/
|
|
162
237
|
DragRefConfig.prototype.pointerDirectionChangeThreshold;
|
|
238
|
+
/**
|
|
239
|
+
* `z-index` for the absolutely-positioned elements that are created by the drag item.
|
|
240
|
+
* @type {?|undefined}
|
|
241
|
+
*/
|
|
242
|
+
DragRefConfig.prototype.zIndex;
|
|
163
243
|
}
|
|
164
244
|
/**
|
|
165
245
|
* Options that can be used to bind a passive event listener.
|
|
@@ -370,9 +450,9 @@ class DragRef {
|
|
|
370
450
|
// Prevent the default action as early as possible in order to block
|
|
371
451
|
// native actions like dragging the selected text or images with the mouse.
|
|
372
452
|
event.preventDefault();
|
|
453
|
+
/** @type {?} */
|
|
454
|
+
const pointerPosition = this._getPointerPositionOnPage(event);
|
|
373
455
|
if (!this._hasStartedDragging) {
|
|
374
|
-
/** @type {?} */
|
|
375
|
-
const pointerPosition = this._getPointerPositionOnPage(event);
|
|
376
456
|
/** @type {?} */
|
|
377
457
|
const distanceX = Math.abs(pointerPosition.x - this._pickupPositionOnPage.x);
|
|
378
458
|
/** @type {?} */
|
|
@@ -412,7 +492,7 @@ class DragRef {
|
|
|
412
492
|
}
|
|
413
493
|
}
|
|
414
494
|
/** @type {?} */
|
|
415
|
-
const constrainedPointerPosition = this._getConstrainedPointerPosition(
|
|
495
|
+
const constrainedPointerPosition = this._getConstrainedPointerPosition(pointerPosition);
|
|
416
496
|
this._hasMoved = true;
|
|
417
497
|
this._updatePointerDirectionDelta(constrainedPointerPosition);
|
|
418
498
|
if (this._dropContainer) {
|
|
@@ -565,8 +645,13 @@ class DragRef {
|
|
|
565
645
|
if ((/** @type {?} */ (this))._rootElement) {
|
|
566
646
|
(/** @type {?} */ (this))._removeRootElementListeners((/** @type {?} */ (this))._rootElement);
|
|
567
647
|
}
|
|
568
|
-
|
|
569
|
-
|
|
648
|
+
(/** @type {?} */ (this))._ngZone.runOutsideAngular((/**
|
|
649
|
+
* @return {?}
|
|
650
|
+
*/
|
|
651
|
+
() => {
|
|
652
|
+
element.addEventListener('mousedown', (/** @type {?} */ (this))._pointerDown, activeEventListenerOptions);
|
|
653
|
+
element.addEventListener('touchstart', (/** @type {?} */ (this))._pointerDown, passiveEventListenerOptions);
|
|
654
|
+
}));
|
|
570
655
|
(/** @type {?} */ (this))._initialTransform = undefined;
|
|
571
656
|
(/** @type {?} */ (this))._rootElement = element;
|
|
572
657
|
}
|
|
@@ -711,7 +796,7 @@ class DragRef {
|
|
|
711
796
|
/** @type {?} */
|
|
712
797
|
const position = this._pointerPositionAtLastDirectionChange;
|
|
713
798
|
if (position && this._dropContainer) {
|
|
714
|
-
this._updateActiveDropContainer(position);
|
|
799
|
+
this._updateActiveDropContainer(this._getConstrainedPointerPosition(position));
|
|
715
800
|
}
|
|
716
801
|
}
|
|
717
802
|
/**
|
|
@@ -901,10 +986,10 @@ class DragRef {
|
|
|
901
986
|
* @return {?}
|
|
902
987
|
*/
|
|
903
988
|
() => {
|
|
904
|
-
this.
|
|
989
|
+
this._updateOnScroll();
|
|
905
990
|
}));
|
|
906
991
|
if (this._boundaryElement) {
|
|
907
|
-
this._boundaryRect = this._boundaryElement
|
|
992
|
+
this._boundaryRect = getMutableClientRect(this._boundaryElement);
|
|
908
993
|
}
|
|
909
994
|
// If we have a custom preview we can't know ahead of time how large it'll be so we position
|
|
910
995
|
// it next to the cursor. The exception is when the consumer has opted into making the preview
|
|
@@ -995,10 +1080,10 @@ class DragRef {
|
|
|
995
1080
|
(/** @type {?} */ (this._dropContainer)).exit(this);
|
|
996
1081
|
// Notify the new container that the item has entered.
|
|
997
1082
|
this._dropContainer = (/** @type {?} */ (newContainer));
|
|
998
|
-
this._dropContainer.enter(this, x, y,
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1083
|
+
this._dropContainer.enter(this, x, y, newContainer === this._initialContainer &&
|
|
1084
|
+
// If we're re-entering the initial container and sorting is disabled,
|
|
1085
|
+
// put item the into its starting index to begin with.
|
|
1086
|
+
newContainer.sortingDisabled ? this._initialIndex : undefined);
|
|
1002
1087
|
this.entered.next({
|
|
1003
1088
|
item: this,
|
|
1004
1089
|
container: (/** @type {?} */ (newContainer)),
|
|
@@ -1029,6 +1114,7 @@ class DragRef {
|
|
|
1029
1114
|
if (previewTemplate) {
|
|
1030
1115
|
/** @type {?} */
|
|
1031
1116
|
const viewRef = (/** @type {?} */ (previewConfig)).viewContainer.createEmbeddedView(previewTemplate, (/** @type {?} */ (previewConfig)).context);
|
|
1117
|
+
viewRef.detectChanges();
|
|
1032
1118
|
preview = getRootNode(viewRef, this._document);
|
|
1033
1119
|
this._previewRef = viewRef;
|
|
1034
1120
|
if ((/** @type {?} */ (previewConfig)).matchSize) {
|
|
@@ -1054,7 +1140,7 @@ class DragRef {
|
|
|
1054
1140
|
position: 'fixed',
|
|
1055
1141
|
top: '0',
|
|
1056
1142
|
left: '0',
|
|
1057
|
-
zIndex:
|
|
1143
|
+
zIndex: `${this._config.zIndex || 1000}`
|
|
1058
1144
|
});
|
|
1059
1145
|
toggleNativeDragInteractions(preview, false);
|
|
1060
1146
|
preview.classList.add('cdk-drag-preview');
|
|
@@ -1142,6 +1228,7 @@ class DragRef {
|
|
|
1142
1228
|
let placeholder;
|
|
1143
1229
|
if (placeholderTemplate) {
|
|
1144
1230
|
this._placeholderRef = (/** @type {?} */ (placeholderConfig)).viewContainer.createEmbeddedView(placeholderTemplate, (/** @type {?} */ (placeholderConfig)).context);
|
|
1231
|
+
this._placeholderRef.detectChanges();
|
|
1145
1232
|
placeholder = getRootNode(this._placeholderRef, this._document);
|
|
1146
1233
|
}
|
|
1147
1234
|
else {
|
|
@@ -1193,12 +1280,10 @@ class DragRef {
|
|
|
1193
1280
|
/**
|
|
1194
1281
|
* Gets the pointer position on the page, accounting for any position constraints.
|
|
1195
1282
|
* @private
|
|
1196
|
-
* @param {?}
|
|
1283
|
+
* @param {?} point
|
|
1197
1284
|
* @return {?}
|
|
1198
1285
|
*/
|
|
1199
|
-
_getConstrainedPointerPosition(
|
|
1200
|
-
/** @type {?} */
|
|
1201
|
-
const point = this._getPointerPositionOnPage(event);
|
|
1286
|
+
_getConstrainedPointerPosition(point) {
|
|
1202
1287
|
/** @type {?} */
|
|
1203
1288
|
const constrainedPoint = this.constrainPosition ? this.constrainPosition(point, this) : point;
|
|
1204
1289
|
/** @type {?} */
|
|
@@ -1404,6 +1489,27 @@ class DragRef {
|
|
|
1404
1489
|
}
|
|
1405
1490
|
return value ? value.mouse : 0;
|
|
1406
1491
|
}
|
|
1492
|
+
/**
|
|
1493
|
+
* Updates the internal state of the draggable element when scrolling has occurred.
|
|
1494
|
+
* @private
|
|
1495
|
+
* @return {?}
|
|
1496
|
+
*/
|
|
1497
|
+
_updateOnScroll() {
|
|
1498
|
+
/** @type {?} */
|
|
1499
|
+
const oldScrollPosition = this._scrollPosition;
|
|
1500
|
+
/** @type {?} */
|
|
1501
|
+
const currentScrollPosition = this._viewportRuler.getViewportScrollPosition();
|
|
1502
|
+
// ClientRect dimensions are based on the page's scroll position so
|
|
1503
|
+
// we have to update the cached boundary ClientRect if the user has scrolled.
|
|
1504
|
+
if (oldScrollPosition && this._boundaryRect) {
|
|
1505
|
+
/** @type {?} */
|
|
1506
|
+
const topDifference = oldScrollPosition.top - currentScrollPosition.top;
|
|
1507
|
+
/** @type {?} */
|
|
1508
|
+
const leftDifference = oldScrollPosition.left - currentScrollPosition.left;
|
|
1509
|
+
adjustClientRect(this._boundaryRect, topDifference, leftDifference);
|
|
1510
|
+
}
|
|
1511
|
+
this._scrollPosition = currentScrollPosition;
|
|
1512
|
+
}
|
|
1407
1513
|
}
|
|
1408
1514
|
if (false) {
|
|
1409
1515
|
/**
|
|
@@ -1848,14 +1954,18 @@ function getPreviewInsertionPoint(documentRef) {
|
|
|
1848
1954
|
*/
|
|
1849
1955
|
function getRootNode(viewRef, _document) {
|
|
1850
1956
|
/** @type {?} */
|
|
1851
|
-
const
|
|
1852
|
-
if (
|
|
1853
|
-
/** @type {?} */
|
|
1854
|
-
const wrapper = _document.createElement('div');
|
|
1855
|
-
wrapper.appendChild(rootNode);
|
|
1856
|
-
return wrapper;
|
|
1957
|
+
const rootNodes = viewRef.rootNodes;
|
|
1958
|
+
if (rootNodes.length === 1 && rootNodes[0].nodeType === _document.ELEMENT_NODE) {
|
|
1959
|
+
return (/** @type {?} */ (rootNodes[0]));
|
|
1857
1960
|
}
|
|
1858
|
-
|
|
1961
|
+
/** @type {?} */
|
|
1962
|
+
const wrapper = _document.createElement('div');
|
|
1963
|
+
rootNodes.forEach((/**
|
|
1964
|
+
* @param {?} node
|
|
1965
|
+
* @return {?}
|
|
1966
|
+
*/
|
|
1967
|
+
node => wrapper.appendChild(node)));
|
|
1968
|
+
return wrapper;
|
|
1859
1969
|
}
|
|
1860
1970
|
/**
|
|
1861
1971
|
* Matches the target element's size to the source's size.
|
|
@@ -2429,7 +2539,8 @@ class DropListRef {
|
|
|
2429
2539
|
*/
|
|
2430
2540
|
_sortItem(item, pointerX, pointerY, pointerDelta) {
|
|
2431
2541
|
// Don't sort the item if sorting is disabled or it's out of range.
|
|
2432
|
-
if (this.sortingDisabled ||
|
|
2542
|
+
if (this.sortingDisabled ||
|
|
2543
|
+
!isPointerNearClientRect(this._clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
2433
2544
|
return;
|
|
2434
2545
|
}
|
|
2435
2546
|
/** @type {?} */
|
|
@@ -2539,7 +2650,7 @@ class DropListRef {
|
|
|
2539
2650
|
if (element === this._document || !position.clientRect || scrollNode) {
|
|
2540
2651
|
return;
|
|
2541
2652
|
}
|
|
2542
|
-
if (isPointerNearClientRect(position.clientRect, pointerX, pointerY)) {
|
|
2653
|
+
if (isPointerNearClientRect(position.clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
2543
2654
|
[verticalScrollDirection, horizontalScrollDirection] = getElementScrollDirections((/** @type {?} */ (element)), position.clientRect, pointerX, pointerY);
|
|
2544
2655
|
if (verticalScrollDirection || horizontalScrollDirection) {
|
|
2545
2656
|
scrollNode = (/** @type {?} */ (element));
|
|
@@ -2775,6 +2886,11 @@ class DropListRef {
|
|
|
2775
2886
|
* @return {?}
|
|
2776
2887
|
*/
|
|
2777
2888
|
_updateAfterScroll(scrolledParent, newTop, newLeft) {
|
|
2889
|
+
// Used when figuring out whether an element is inside the scroll parent. If the scrolled
|
|
2890
|
+
// parent is the `document`, we use the `documentElement`, because IE doesn't support `contains`
|
|
2891
|
+
// on the `document`.
|
|
2892
|
+
/** @type {?} */
|
|
2893
|
+
const scrolledParentNode = scrolledParent === this._document ? scrolledParent.documentElement : scrolledParent;
|
|
2778
2894
|
/** @type {?} */
|
|
2779
2895
|
const scrollPosition = (/** @type {?} */ (this._parentPositions.get(scrolledParent))).scrollPosition;
|
|
2780
2896
|
/** @type {?} */
|
|
@@ -2789,7 +2905,7 @@ class DropListRef {
|
|
|
2789
2905
|
* @return {?}
|
|
2790
2906
|
*/
|
|
2791
2907
|
(position, node) => {
|
|
2792
|
-
if (position.clientRect && scrolledParent !== node &&
|
|
2908
|
+
if (position.clientRect && scrolledParent !== node && scrolledParentNode.contains(node)) {
|
|
2793
2909
|
adjustClientRect(position.clientRect, topDifference, leftDifference);
|
|
2794
2910
|
}
|
|
2795
2911
|
}));
|
|
@@ -2944,7 +3060,9 @@ class DropListRef {
|
|
|
2944
3060
|
*/
|
|
2945
3061
|
_getShadowRoot() {
|
|
2946
3062
|
if (!this._cachedShadowRoot) {
|
|
2947
|
-
|
|
3063
|
+
/** @type {?} */
|
|
3064
|
+
const shadowRoot = (/** @type {?} */ (_getShadowRoot(coerceElement(this.element))));
|
|
3065
|
+
this._cachedShadowRoot = shadowRoot || this._document;
|
|
2948
3066
|
}
|
|
2949
3067
|
return this._cachedShadowRoot;
|
|
2950
3068
|
}
|
|
@@ -3158,35 +3276,6 @@ if (false) {
|
|
|
3158
3276
|
*/
|
|
3159
3277
|
DropListRef.prototype._viewportRuler;
|
|
3160
3278
|
}
|
|
3161
|
-
/**
|
|
3162
|
-
* Updates the top/left positions of a `ClientRect`, as well as their bottom/right counterparts.
|
|
3163
|
-
* @param {?} clientRect `ClientRect` that should be updated.
|
|
3164
|
-
* @param {?} top Amount to add to the `top` position.
|
|
3165
|
-
* @param {?} left Amount to add to the `left` position.
|
|
3166
|
-
* @return {?}
|
|
3167
|
-
*/
|
|
3168
|
-
function adjustClientRect(clientRect, top, left) {
|
|
3169
|
-
clientRect.top += top;
|
|
3170
|
-
clientRect.bottom = clientRect.top + clientRect.height;
|
|
3171
|
-
clientRect.left += left;
|
|
3172
|
-
clientRect.right = clientRect.left + clientRect.width;
|
|
3173
|
-
}
|
|
3174
|
-
/**
|
|
3175
|
-
* Checks whether the pointer coordinates are close to a ClientRect.
|
|
3176
|
-
* @param {?} rect ClientRect to check against.
|
|
3177
|
-
* @param {?} pointerX Coordinates along the X axis.
|
|
3178
|
-
* @param {?} pointerY Coordinates along the Y axis.
|
|
3179
|
-
* @return {?}
|
|
3180
|
-
*/
|
|
3181
|
-
function isPointerNearClientRect(rect, pointerX, pointerY) {
|
|
3182
|
-
const { top, right, bottom, left, width, height } = rect;
|
|
3183
|
-
/** @type {?} */
|
|
3184
|
-
const xThreshold = width * DROP_PROXIMITY_THRESHOLD;
|
|
3185
|
-
/** @type {?} */
|
|
3186
|
-
const yThreshold = height * DROP_PROXIMITY_THRESHOLD;
|
|
3187
|
-
return pointerY > top - yThreshold && pointerY < bottom + yThreshold &&
|
|
3188
|
-
pointerX > left - xThreshold && pointerX < right + xThreshold;
|
|
3189
|
-
}
|
|
3190
3279
|
/**
|
|
3191
3280
|
* Finds the index of an item that matches a predicate function. Used as an equivalent
|
|
3192
3281
|
* of `Array.prototype.findIndex` which isn't part of the standard Google typings.
|
|
@@ -3203,38 +3292,6 @@ function findIndex(array, predicate) {
|
|
|
3203
3292
|
}
|
|
3204
3293
|
return -1;
|
|
3205
3294
|
}
|
|
3206
|
-
/**
|
|
3207
|
-
* Checks whether some coordinates are within a `ClientRect`.
|
|
3208
|
-
* @param {?} clientRect ClientRect that is being checked.
|
|
3209
|
-
* @param {?} x Coordinates along the X axis.
|
|
3210
|
-
* @param {?} y Coordinates along the Y axis.
|
|
3211
|
-
* @return {?}
|
|
3212
|
-
*/
|
|
3213
|
-
function isInsideClientRect(clientRect, x, y) {
|
|
3214
|
-
const { top, bottom, left, right } = clientRect;
|
|
3215
|
-
return y >= top && y <= bottom && x >= left && x <= right;
|
|
3216
|
-
}
|
|
3217
|
-
/**
|
|
3218
|
-
* Gets a mutable version of an element's bounding `ClientRect`.
|
|
3219
|
-
* @param {?} element
|
|
3220
|
-
* @return {?}
|
|
3221
|
-
*/
|
|
3222
|
-
function getMutableClientRect(element) {
|
|
3223
|
-
/** @type {?} */
|
|
3224
|
-
const clientRect = element.getBoundingClientRect();
|
|
3225
|
-
// We need to clone the `clientRect` here, because all the values on it are readonly
|
|
3226
|
-
// and we need to be able to update them. Also we can't use a spread here, because
|
|
3227
|
-
// the values on a `ClientRect` aren't own properties. See:
|
|
3228
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#Notes
|
|
3229
|
-
return {
|
|
3230
|
-
top: clientRect.top,
|
|
3231
|
-
right: clientRect.right,
|
|
3232
|
-
bottom: clientRect.bottom,
|
|
3233
|
-
left: clientRect.left,
|
|
3234
|
-
width: clientRect.width,
|
|
3235
|
-
height: clientRect.height
|
|
3236
|
-
};
|
|
3237
|
-
}
|
|
3238
3295
|
/**
|
|
3239
3296
|
* Increments the vertical scroll position of a node.
|
|
3240
3297
|
* @param {?} node Node whose scroll position should change.
|
|
@@ -3349,21 +3406,6 @@ function getElementScrollDirections(element, clientRect, pointerX, pointerY) {
|
|
|
3349
3406
|
}
|
|
3350
3407
|
return [verticalScrollDirection, horizontalScrollDirection];
|
|
3351
3408
|
}
|
|
3352
|
-
/**
|
|
3353
|
-
* Gets the shadow root of an element, if any.
|
|
3354
|
-
* @param {?} element
|
|
3355
|
-
* @return {?}
|
|
3356
|
-
*/
|
|
3357
|
-
function getShadowRoot(element) {
|
|
3358
|
-
if (_supportsShadowDom()) {
|
|
3359
|
-
/** @type {?} */
|
|
3360
|
-
const rootNode = element.getRootNode ? element.getRootNode() : null;
|
|
3361
|
-
if (rootNode instanceof ShadowRoot) {
|
|
3362
|
-
return rootNode;
|
|
3363
|
-
}
|
|
3364
|
-
}
|
|
3365
|
-
return null;
|
|
3366
|
-
}
|
|
3367
3409
|
|
|
3368
3410
|
/**
|
|
3369
3411
|
* @fileoverview added by tsickle
|
|
@@ -4207,6 +4249,8 @@ if (false) {
|
|
|
4207
4249
|
DragDropConfig.prototype.listAutoScrollDisabled;
|
|
4208
4250
|
/** @type {?|undefined} */
|
|
4209
4251
|
DragDropConfig.prototype.listOrientation;
|
|
4252
|
+
/** @type {?|undefined} */
|
|
4253
|
+
DragDropConfig.prototype.zIndex;
|
|
4210
4254
|
}
|
|
4211
4255
|
/**
|
|
4212
4256
|
* @deprecated No longer being used. To be removed.
|
|
@@ -4310,7 +4354,8 @@ class CdkDrag {
|
|
|
4310
4354
|
dragStartThreshold: config && config.dragStartThreshold != null ?
|
|
4311
4355
|
config.dragStartThreshold : 5,
|
|
4312
4356
|
pointerDirectionChangeThreshold: config && config.pointerDirectionChangeThreshold != null ?
|
|
4313
|
-
config.pointerDirectionChangeThreshold : 5
|
|
4357
|
+
config.pointerDirectionChangeThreshold : 5,
|
|
4358
|
+
zIndex: config === null || config === void 0 ? void 0 : config.zIndex
|
|
4314
4359
|
});
|
|
4315
4360
|
this._dragRef.data = this;
|
|
4316
4361
|
if (config) {
|
|
@@ -5057,23 +5102,6 @@ class CdkDropList {
|
|
|
5057
5102
|
// the user in a disabled state, so we also need to sync it as it's being set.
|
|
5058
5103
|
this._dropListRef.disabled = this._disabled = coerceBooleanProperty(value);
|
|
5059
5104
|
}
|
|
5060
|
-
/**
|
|
5061
|
-
* @return {?}
|
|
5062
|
-
*/
|
|
5063
|
-
ngAfterContentInit() {
|
|
5064
|
-
// @breaking-change 11.0.0 Remove null check for _scrollDispatcher once it's required.
|
|
5065
|
-
if (this._scrollDispatcher) {
|
|
5066
|
-
/** @type {?} */
|
|
5067
|
-
const scrollableParents = this._scrollDispatcher
|
|
5068
|
-
.getAncestorScrollContainers(this.element)
|
|
5069
|
-
.map((/**
|
|
5070
|
-
* @param {?} scrollable
|
|
5071
|
-
* @return {?}
|
|
5072
|
-
*/
|
|
5073
|
-
scrollable => scrollable.getElementRef().nativeElement));
|
|
5074
|
-
this._dropListRef.withScrollableParents(scrollableParents);
|
|
5075
|
-
}
|
|
5076
|
-
}
|
|
5077
5105
|
/**
|
|
5078
5106
|
* Registers an items with the drop list.
|
|
5079
5107
|
* @param {?} item
|
|
@@ -5232,6 +5260,23 @@ class CdkDropList {
|
|
|
5232
5260
|
}
|
|
5233
5261
|
}));
|
|
5234
5262
|
}
|
|
5263
|
+
// Note that we resolve the scrollable parents here so that we delay the resolution
|
|
5264
|
+
// as long as possible, ensuring that the element is in its final place in the DOM.
|
|
5265
|
+
// @breaking-change 11.0.0 Remove null check for _scrollDispatcher once it's required.
|
|
5266
|
+
if (!this._scrollableParentsResolved && this._scrollDispatcher) {
|
|
5267
|
+
/** @type {?} */
|
|
5268
|
+
const scrollableParents = this._scrollDispatcher
|
|
5269
|
+
.getAncestorScrollContainers(this.element)
|
|
5270
|
+
.map((/**
|
|
5271
|
+
* @param {?} scrollable
|
|
5272
|
+
* @return {?}
|
|
5273
|
+
*/
|
|
5274
|
+
scrollable => scrollable.getElementRef().nativeElement));
|
|
5275
|
+
this._dropListRef.withScrollableParents(scrollableParents);
|
|
5276
|
+
// Only do this once since it involves traversing the DOM and the parents
|
|
5277
|
+
// shouldn't be able to change without the drop list being destroyed.
|
|
5278
|
+
this._scrollableParentsResolved = true;
|
|
5279
|
+
}
|
|
5235
5280
|
ref.disabled = this.disabled;
|
|
5236
5281
|
ref.lockAxis = this.lockAxis;
|
|
5237
5282
|
ref.sortingDisabled = coerceBooleanProperty(this.sortingDisabled);
|
|
@@ -5411,6 +5456,12 @@ if (false) {
|
|
|
5411
5456
|
* @private
|
|
5412
5457
|
*/
|
|
5413
5458
|
CdkDropList.prototype._destroyed;
|
|
5459
|
+
/**
|
|
5460
|
+
* Whether the element's scrollable parents have been resolved.
|
|
5461
|
+
* @type {?}
|
|
5462
|
+
* @private
|
|
5463
|
+
*/
|
|
5464
|
+
CdkDropList.prototype._scrollableParentsResolved;
|
|
5414
5465
|
/**
|
|
5415
5466
|
* Reference to the underlying drop list instance.
|
|
5416
5467
|
* @type {?}
|