@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.
Files changed (199) hide show
  1. package/a11y/focus-monitor/focus-monitor.d.ts +42 -2
  2. package/a11y/index.metadata.json +1 -1
  3. package/bundles/cdk-a11y.umd.js +107 -75
  4. package/bundles/cdk-a11y.umd.js.map +1 -1
  5. package/bundles/cdk-a11y.umd.min.js +7 -7
  6. package/bundles/cdk-a11y.umd.min.js.map +1 -1
  7. package/bundles/cdk-clipboard.umd.js +1 -1
  8. package/bundles/cdk-clipboard.umd.js.map +1 -1
  9. package/bundles/cdk-clipboard.umd.min.js +1 -1
  10. package/bundles/cdk-clipboard.umd.min.js.map +1 -1
  11. package/bundles/cdk-coercion.umd.js +0 -1
  12. package/bundles/cdk-coercion.umd.js.map +1 -1
  13. package/bundles/cdk-coercion.umd.min.js.map +1 -1
  14. package/bundles/cdk-drag-drop.umd.js +121 -95
  15. package/bundles/cdk-drag-drop.umd.js.map +1 -1
  16. package/bundles/cdk-drag-drop.umd.min.js +15 -8
  17. package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
  18. package/bundles/cdk-overlay.umd.js +2 -1
  19. package/bundles/cdk-overlay.umd.js.map +1 -1
  20. package/bundles/cdk-overlay.umd.min.js +4 -4
  21. package/bundles/cdk-overlay.umd.min.js.map +1 -1
  22. package/bundles/cdk-platform.umd.js +11 -0
  23. package/bundles/cdk-platform.umd.js.map +1 -1
  24. package/bundles/cdk-platform.umd.min.js +6 -6
  25. package/bundles/cdk-platform.umd.min.js.map +1 -1
  26. package/bundles/cdk-scrolling.umd.js +41 -10
  27. package/bundles/cdk-scrolling.umd.js.map +1 -1
  28. package/bundles/cdk-scrolling.umd.min.js +8 -8
  29. package/bundles/cdk-scrolling.umd.min.js.map +1 -1
  30. package/bundles/cdk-table.umd.js +58 -27
  31. package/bundles/cdk-table.umd.js.map +1 -1
  32. package/bundles/cdk-table.umd.min.js +12 -5
  33. package/bundles/cdk-table.umd.min.js.map +1 -1
  34. package/bundles/cdk-testing-protractor.umd.js +15 -9
  35. package/bundles/cdk-testing-protractor.umd.js.map +1 -1
  36. package/bundles/cdk-testing-protractor.umd.min.js +2 -2
  37. package/bundles/cdk-testing-protractor.umd.min.js.map +1 -1
  38. package/bundles/cdk-testing-testbed.umd.js +15 -9
  39. package/bundles/cdk-testing-testbed.umd.js.map +1 -1
  40. package/bundles/cdk-testing-testbed.umd.min.js +8 -8
  41. package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
  42. package/bundles/cdk-text-field.umd.js +21 -6
  43. package/bundles/cdk-text-field.umd.js.map +1 -1
  44. package/bundles/cdk-text-field.umd.min.js +3 -3
  45. package/bundles/cdk-text-field.umd.min.js.map +1 -1
  46. package/bundles/cdk-tree.umd.js +8 -4
  47. package/bundles/cdk-tree.umd.js.map +1 -1
  48. package/bundles/cdk-tree.umd.min.js +1 -1
  49. package/bundles/cdk-tree.umd.min.js.map +1 -1
  50. package/bundles/cdk.umd.js +1 -1
  51. package/bundles/cdk.umd.js.map +1 -1
  52. package/bundles/cdk.umd.min.js +1 -1
  53. package/bundles/cdk.umd.min.js.map +1 -1
  54. package/coercion/array.d.ts +1 -0
  55. package/drag-drop/client-rect.d.ts +31 -0
  56. package/drag-drop/directives/config.d.ts +1 -0
  57. package/drag-drop/directives/drop-list.d.ts +4 -3
  58. package/drag-drop/drag-ref.d.ts +4 -0
  59. package/drag-drop/index.metadata.json +1 -1
  60. package/esm2015/a11y/focus-monitor/focus-monitor.js +163 -76
  61. package/esm2015/a11y/focus-trap/configurable-focus-trap-factory.js +3 -3
  62. package/esm2015/a11y/focus-trap/focus-trap.js +1 -1
  63. package/esm2015/a11y/high-contrast-mode/high-contrast-mode-detector.js +8 -4
  64. package/esm2015/a11y/live-announcer/live-announcer.js +1 -1
  65. package/esm2015/a11y/public-api.js +2 -2
  66. package/esm2015/bidi/directionality.js +1 -1
  67. package/esm2015/clipboard/pending-copy.js +3 -3
  68. package/esm2015/coercion/array.js +1 -2
  69. package/esm2015/drag-drop/client-rect.js +75 -0
  70. package/esm2015/drag-drop/directives/config.js +3 -1
  71. package/esm2015/drag-drop/directives/drag.js +3 -2
  72. package/esm2015/drag-drop/directives/drop-list.js +24 -18
  73. package/esm2015/drag-drop/drag-drop.js +1 -1
  74. package/esm2015/drag-drop/drag-ref.js +61 -25
  75. package/esm2015/drag-drop/drop-list-ref.js +15 -82
  76. package/esm2015/layout/breakpoints-observer.js +1 -1
  77. package/esm2015/overlay/position/flexible-connected-position-strategy.js +3 -2
  78. package/esm2015/overlay/position/overlay-position-builder.js +1 -1
  79. package/esm2015/platform/features/shadow-dom.js +16 -1
  80. package/esm2015/platform/public-api.js +2 -2
  81. package/esm2015/scrolling/scroll-dispatcher.js +38 -5
  82. package/esm2015/scrolling/viewport-ruler.js +44 -5
  83. package/esm2015/table/cell.js +18 -8
  84. package/esm2015/table/public-api.js +3 -2
  85. package/esm2015/table/row.js +24 -8
  86. package/esm2015/table/table.js +26 -12
  87. package/esm2015/table/text-column.js +3 -26
  88. package/esm2015/table/tokens.js +44 -0
  89. package/esm2015/testing/protractor/protractor-harness-environment.js +13 -8
  90. package/esm2015/testing/testbed/testbed-harness-environment.js +16 -10
  91. package/esm2015/text-field/autosize.js +38 -4
  92. package/esm2015/tree/padding.js +9 -10
  93. package/esm2015/version.js +1 -1
  94. package/esm5/a11y/focus-monitor/focus-monitor.js +87 -56
  95. package/esm5/a11y/focus-trap/configurable-focus-trap-factory.js +3 -3
  96. package/esm5/a11y/focus-trap/focus-trap.js +1 -1
  97. package/esm5/a11y/high-contrast-mode/high-contrast-mode-detector.js +7 -4
  98. package/esm5/a11y/live-announcer/live-announcer.js +1 -1
  99. package/esm5/bidi/directionality.js +1 -1
  100. package/esm5/clipboard/pending-copy.js +2 -2
  101. package/esm5/coercion/array.js +1 -2
  102. package/esm5/drag-drop/client-rect.js +60 -0
  103. package/esm5/drag-drop/directives/config.js +1 -1
  104. package/esm5/drag-drop/directives/drag.js +3 -2
  105. package/esm5/drag-drop/directives/drop-list.js +13 -10
  106. package/esm5/drag-drop/drag-drop.js +1 -1
  107. package/esm5/drag-drop/drag-ref.js +39 -21
  108. package/esm5/drag-drop/drop-list-ref.js +13 -67
  109. package/esm5/layout/breakpoints-observer.js +1 -1
  110. package/esm5/overlay/position/flexible-connected-position-strategy.js +3 -2
  111. package/esm5/overlay/position/overlay-position-builder.js +1 -1
  112. package/esm5/platform/features/shadow-dom.js +11 -1
  113. package/esm5/scrolling/scroll-dispatcher.js +21 -5
  114. package/esm5/scrolling/viewport-ruler.js +24 -5
  115. package/esm5/table/cell.js +13 -8
  116. package/esm5/table/public-api.js +2 -1
  117. package/esm5/table/row.js +21 -11
  118. package/esm5/table/table.js +16 -11
  119. package/esm5/table/text-column.js +3 -4
  120. package/esm5/table/tokens.js +16 -0
  121. package/esm5/testing/protractor/protractor-harness-environment.js +17 -11
  122. package/esm5/testing/testbed/testbed-harness-environment.js +17 -11
  123. package/esm5/text-field/autosize.js +20 -4
  124. package/esm5/tree/padding.js +9 -5
  125. package/esm5/version.js +1 -1
  126. package/fesm2015/a11y.js +190 -103
  127. package/fesm2015/a11y.js.map +1 -1
  128. package/fesm2015/cdk.js +1 -1
  129. package/fesm2015/cdk.js.map +1 -1
  130. package/fesm2015/clipboard.js +2 -2
  131. package/fesm2015/clipboard.js.map +1 -1
  132. package/fesm2015/coercion.js +0 -1
  133. package/fesm2015/coercion.js.map +1 -1
  134. package/fesm2015/drag-drop.js +174 -123
  135. package/fesm2015/drag-drop.js.map +1 -1
  136. package/fesm2015/overlay.js +2 -1
  137. package/fesm2015/overlay.js.map +1 -1
  138. package/fesm2015/platform.js +16 -1
  139. package/fesm2015/platform.js.map +1 -1
  140. package/fesm2015/scrolling.js +76 -7
  141. package/fesm2015/scrolling.js.map +1 -1
  142. package/fesm2015/table.js +98 -49
  143. package/fesm2015/table.js.map +1 -1
  144. package/fesm2015/testing/protractor.js +13 -8
  145. package/fesm2015/testing/protractor.js.map +1 -1
  146. package/fesm2015/testing/testbed.js +15 -9
  147. package/fesm2015/testing/testbed.js.map +1 -1
  148. package/fesm2015/text-field.js +37 -3
  149. package/fesm2015/text-field.js.map +1 -1
  150. package/fesm2015/tree.js +8 -9
  151. package/fesm2015/tree.js.map +1 -1
  152. package/fesm5/a11y.js +107 -76
  153. package/fesm5/a11y.js.map +1 -1
  154. package/fesm5/cdk.js +1 -1
  155. package/fesm5/cdk.js.map +1 -1
  156. package/fesm5/clipboard.js +1 -1
  157. package/fesm5/clipboard.js.map +1 -1
  158. package/fesm5/coercion.js +0 -1
  159. package/fesm5/coercion.js.map +1 -1
  160. package/fesm5/drag-drop.js +122 -96
  161. package/fesm5/drag-drop.js.map +1 -1
  162. package/fesm5/overlay.js +2 -1
  163. package/fesm5/overlay.js.map +1 -1
  164. package/fesm5/platform.js +11 -1
  165. package/fesm5/platform.js.map +1 -1
  166. package/fesm5/scrolling.js +39 -7
  167. package/fesm5/scrolling.js.map +1 -1
  168. package/fesm5/table.js +59 -29
  169. package/fesm5/table.js.map +1 -1
  170. package/fesm5/testing/protractor.js +17 -11
  171. package/fesm5/testing/protractor.js.map +1 -1
  172. package/fesm5/testing/testbed.js +16 -10
  173. package/fesm5/testing/testbed.js.map +1 -1
  174. package/fesm5/text-field.js +19 -3
  175. package/fesm5/text-field.js.map +1 -1
  176. package/fesm5/tree.js +8 -4
  177. package/fesm5/tree.js.map +1 -1
  178. package/package.json +1 -1
  179. package/platform/features/shadow-dom.d.ts +2 -0
  180. package/platform/index.metadata.json +1 -1
  181. package/schematics/ng-add/index.js +1 -1
  182. package/schematics/ng-update/upgrade-rules/class-names-rule.js +3 -1
  183. package/schematics/utils/ast/ng-module-imports.js +3 -2
  184. package/scrolling/index.metadata.json +1 -1
  185. package/scrolling/scroll-dispatcher.d.ts +9 -1
  186. package/scrolling/viewport-ruler.d.ts +9 -1
  187. package/table/cell.d.ts +2 -0
  188. package/table/index.metadata.json +1 -1
  189. package/table/public-api.d.ts +1 -0
  190. package/table/row.d.ts +6 -3
  191. package/table/table.d.ts +2 -0
  192. package/table/text-column.d.ts +2 -13
  193. package/table/tokens.d.ts +25 -0
  194. package/testing/protractor/protractor-harness-environment.d.ts +10 -3
  195. package/testing/testbed/testbed-harness-environment.d.ts +12 -4
  196. package/text-field/autosize.d.ts +9 -1
  197. package/text-field/index.metadata.json +1 -1
  198. package/tree/index.metadata.json +1 -1
  199. package/tree/padding.d.ts +6 -2
package/fesm5/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
- var VERSION = new Version('9.1.2');
11
+ var VERSION = new Version('9.2.1');
12
12
 
13
13
  /**
14
14
  * @license
package/fesm5/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.2');\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,IAAa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC;;ACXvD;;;;;;GAMG;;ACNH;;;;;;GAMG;;;;"}
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,IAAa,OAAO,GAAG,IAAI,OAAO,CAAC,mBAAmB,CAAC;;ACXvD;;;;;;GAMG;;ACNH;;;;;;GAMG;;;;"}
@@ -45,7 +45,7 @@ var PendingCopy = /** @class */ (function () {
45
45
  textarea.select();
46
46
  textarea.setSelectionRange(0, textarea.value.length);
47
47
  successful = this._document.execCommand('copy');
48
- if (currentFocus && currentFocus instanceof HTMLElement) {
48
+ if (currentFocus) {
49
49
  currentFocus.focus();
50
50
  }
51
51
  }
@@ -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/public-api.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 * @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 './clipboard';\nexport * from './clipboard-module';\nexport * from './copy-to-clipboard';\nexport * from './pending-copy';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;AAqBA;IAGE,qBAAY,IAAY,EAAmB,SAAmB;QAAnB,cAAS,GAAT,SAAS,CAAU;QAC5D,IAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC3E,IAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC;;;QAI9B,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,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;KAC3C;;IAGD,0BAAI,GAAJ;QACE,IAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,UAAU,GAAG,KAAK,CAAC;QAEvB,IAAI;YACF,IAAI,QAAQ,EAAE;gBACZ,IAAM,YAAY,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC;gBAElD,QAAQ,CAAC,MAAM,EAAE,CAAC;gBAClB,QAAQ,CAAC,iBAAiB,CAAC,CAAC,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBACrD,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,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AE,CAAC;oBAClB,KAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;iBAC9B;aACF,CAAC;YACF,SAAO,EAAE,CAAC;SACX;aAAM;YACL,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;SACnD;KACF;IAED,wCAAW,GAAX;QACE,IAAI,IAAI,CAAC,eAAe,EAAE;YACxB,YAAY,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;SACpC;QAED,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,OAAO,EAAE,GAAA,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;KACxB;;gBA3FF,SAAS,SAAC;oBACT,QAAQ,EAAE,sBAAsB;oBAChC,IAAI,EAAE;wBACJ,SAAS,EAAE,QAAQ;qBACpB;iBACF;;;;gBAtBO,SAAS;gBANf,MAAM;gDAqEH,QAAQ,YAAI,MAAM,SAAC,4BAA4B;;;uBAtCjD,KAAK,SAAC,oBAAoB;2BAM1B,KAAK,SAAC,4BAA4B;yBAMlC,MAAM,SAAC,0BAA0B;oCAQjC,MAAM,SAAC,QAAQ;;IAgElB,yBAAC;CA5FD;;ACpCA;;;;;;;AAQA;IAIA;KAKC;;gBALA,QAAQ,SAAC;oBACR,YAAY,EAAE,CAAC,kBAAkB,CAAC;oBAClC,OAAO,EAAE,CAAC,kBAAkB,CAAC;iBAC9B;;IAED,sBAAC;CALD;;ACZA;;;;;;GAMG;;ACNH;;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/public-api.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 * @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 './clipboard';\nexport * from './clipboard-module';\nexport * from './copy-to-clipboard';\nexport * from './pending-copy';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;AAqBA;IAGE,qBAAY,IAAY,EAAmB,SAAmB;QAAnB,cAAS,GAAT,SAAS,CAAU;QAC5D,IAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QAC3E,IAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC;;;QAI9B,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,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;KAC3C;;IAGD,0BAAI,GAAJ;QACE,IAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC;QAChC,IAAI,UAAU,GAAG,KAAK,CAAC;QAEvB,IAAI;YACF,IAAI,QA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AO,EAAE,CAAC,kBAAkB,CAAC;iBAC9B;;IAED,sBAAC;CALD;;ACZA;;;;;;GAMG;;ACNH;;GAEG;;;;"}
package/fesm5/coercion.js CHANGED
@@ -41,7 +41,6 @@ function _isNumberValue(value) {
41
41
  * Use of this source code is governed by an MIT-style license that can be
42
42
  * found in the LICENSE file at https://angular.io/license
43
43
  */
44
- /** Wraps the provided value in an array, unless the provided value is an array. */
45
44
  function coerceArray(value) {
46
45
  return Array.isArray(value) ? value : [value];
47
46
  }
@@ -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,KAAG,KAAO,KAAK,OAAO,CAAC;CAChD;;ACjBD;;;;;;;AAiBA,SAAgB,oBAAoB,CAAC,KAAU,EAAE,aAAiB;IAAjB,8BAAA,EAAA,iBAAiB;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;;;;;;;;AASA,SAAgB,WAAW,CAAI,KAAc;IAC3C,OAAO,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,CAAC;CAC/C;;ACXD;;;;;;;;AASA,SAAgB,mBAAmB,CAAC,KAAU;IAC5C,IAAI,KAAK,IAAI,IAAI,EAAE;QACjB,OAAO,EAAE,CAAC;KACX;IAED,OAAO,OAAO,KAAK,KAAK,QAAQ,GAAG,KAAK,GAAM,KAAK,OAAI,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;;;;"}
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,KAAG,KAAO,KAAK,OAAO,CAAC;CAChD;;ACjBD;;;;;;;AAiBA,SAAgB,oBAAoB,CAAC,KAAU,EAAE,aAAiB;IAAjB,8BAAA,EAAA,iBAAiB;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,GAAM,KAAK,OAAI,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;;;;"}
@@ -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, _supportsShadowDom } from '@angular/cdk/platform';
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';
@@ -82,6 +82,66 @@ function parseCssPropertyValue(computedStyle, name) {
82
82
  return value.split(',').map(function (part) { return part.trim(); });
83
83
  }
84
84
 
85
+ /**
86
+ * @license
87
+ * Copyright Google LLC All Rights Reserved.
88
+ *
89
+ * Use of this source code is governed by an MIT-style license that can be
90
+ * found in the LICENSE file at https://angular.io/license
91
+ */
92
+ /** Gets a mutable version of an element's bounding `ClientRect`. */
93
+ function getMutableClientRect(element) {
94
+ var clientRect = element.getBoundingClientRect();
95
+ // We need to clone the `clientRect` here, because all the values on it are readonly
96
+ // and we need to be able to update them. Also we can't use a spread here, because
97
+ // the values on a `ClientRect` aren't own properties. See:
98
+ // https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#Notes
99
+ return {
100
+ top: clientRect.top,
101
+ right: clientRect.right,
102
+ bottom: clientRect.bottom,
103
+ left: clientRect.left,
104
+ width: clientRect.width,
105
+ height: clientRect.height
106
+ };
107
+ }
108
+ /**
109
+ * Checks whether some coordinates are within a `ClientRect`.
110
+ * @param clientRect ClientRect that is being checked.
111
+ * @param x Coordinates along the X axis.
112
+ * @param y Coordinates along the Y axis.
113
+ */
114
+ function isInsideClientRect(clientRect, x, y) {
115
+ var top = clientRect.top, bottom = clientRect.bottom, left = clientRect.left, right = clientRect.right;
116
+ return y >= top && y <= bottom && x >= left && x <= right;
117
+ }
118
+ /**
119
+ * Updates the top/left positions of a `ClientRect`, as well as their bottom/right counterparts.
120
+ * @param clientRect `ClientRect` that should be updated.
121
+ * @param top Amount to add to the `top` position.
122
+ * @param left Amount to add to the `left` position.
123
+ */
124
+ function adjustClientRect(clientRect, top, left) {
125
+ clientRect.top += top;
126
+ clientRect.bottom = clientRect.top + clientRect.height;
127
+ clientRect.left += left;
128
+ clientRect.right = clientRect.left + clientRect.width;
129
+ }
130
+ /**
131
+ * Checks whether the pointer coordinates are close to a ClientRect.
132
+ * @param rect ClientRect to check against.
133
+ * @param threshold Threshold around the ClientRect.
134
+ * @param pointerX Coordinates along the X axis.
135
+ * @param pointerY Coordinates along the Y axis.
136
+ */
137
+ function isPointerNearClientRect(rect, threshold, pointerX, pointerY) {
138
+ var top = rect.top, right = rect.right, bottom = rect.bottom, left = rect.left, width = rect.width, height = rect.height;
139
+ var xThreshold = width * threshold;
140
+ var yThreshold = height * threshold;
141
+ return pointerY > top - yThreshold && pointerY < bottom + yThreshold &&
142
+ pointerX > left - xThreshold && pointerX < right + xThreshold;
143
+ }
144
+
85
145
  /**
86
146
  * @license
87
147
  * Copyright Google LLC All Rights Reserved.
@@ -187,8 +247,8 @@ var DragRef = /** @class */ (function () {
187
247
  // Prevent the default action as early as possible in order to block
188
248
  // native actions like dragging the selected text or images with the mouse.
189
249
  event.preventDefault();
250
+ var pointerPosition = _this._getPointerPositionOnPage(event);
190
251
  if (!_this._hasStartedDragging) {
191
- var pointerPosition = _this._getPointerPositionOnPage(event);
192
252
  var distanceX = Math.abs(pointerPosition.x - _this._pickupPositionOnPage.x);
193
253
  var distanceY = Math.abs(pointerPosition.y - _this._pickupPositionOnPage.y);
194
254
  var isOverThreshold = distanceX + distanceY >= _this._config.dragStartThreshold;
@@ -220,7 +280,7 @@ var DragRef = /** @class */ (function () {
220
280
  _this._previewRect = (_this._preview || _this._rootElement).getBoundingClientRect();
221
281
  }
222
282
  }
223
- var constrainedPointerPosition = _this._getConstrainedPointerPosition(event);
283
+ var constrainedPointerPosition = _this._getConstrainedPointerPosition(pointerPosition);
224
284
  _this._hasMoved = true;
225
285
  _this._updatePointerDirectionDelta(constrainedPointerPosition);
226
286
  if (_this._dropContainer) {
@@ -323,13 +383,16 @@ var DragRef = /** @class */ (function () {
323
383
  * dragging on an element that you might not have access to.
324
384
  */
325
385
  DragRef.prototype.withRootElement = function (rootElement) {
386
+ var _this = this;
326
387
  var element = coerceElement(rootElement);
327
388
  if (element !== this._rootElement) {
328
389
  if (this._rootElement) {
329
390
  this._removeRootElementListeners(this._rootElement);
330
391
  }
331
- element.addEventListener('mousedown', this._pointerDown, activeEventListenerOptions);
332
- element.addEventListener('touchstart', this._pointerDown, passiveEventListenerOptions);
392
+ this._ngZone.runOutsideAngular(function () {
393
+ element.addEventListener('mousedown', _this._pointerDown, activeEventListenerOptions);
394
+ element.addEventListener('touchstart', _this._pointerDown, passiveEventListenerOptions);
395
+ });
333
396
  this._initialTransform = undefined;
334
397
  this._rootElement = element;
335
398
  }
@@ -438,7 +501,7 @@ var DragRef = /** @class */ (function () {
438
501
  DragRef.prototype._sortFromLastPointerPosition = function () {
439
502
  var position = this._pointerPositionAtLastDirectionChange;
440
503
  if (position && this._dropContainer) {
441
- this._updateActiveDropContainer(position);
504
+ this._updateActiveDropContainer(this._getConstrainedPointerPosition(position));
442
505
  }
443
506
  };
444
507
  /** Unsubscribes from the global subscriptions. */
@@ -590,10 +653,10 @@ var DragRef = /** @class */ (function () {
590
653
  this._pointerMoveSubscription = this._dragDropRegistry.pointerMove.subscribe(this._pointerMove);
591
654
  this._pointerUpSubscription = this._dragDropRegistry.pointerUp.subscribe(this._pointerUp);
592
655
  this._scrollSubscription = this._dragDropRegistry.scroll.pipe(startWith(null)).subscribe(function () {
593
- _this._scrollPosition = _this._viewportRuler.getViewportScrollPosition();
656
+ _this._updateOnScroll();
594
657
  });
595
658
  if (this._boundaryElement) {
596
- this._boundaryRect = this._boundaryElement.getBoundingClientRect();
659
+ this._boundaryRect = getMutableClientRect(this._boundaryElement);
597
660
  }
598
661
  // If we have a custom preview we can't know ahead of time how large it'll be so we position
599
662
  // it next to the cursor. The exception is when the consumer has opted into making the preview
@@ -665,10 +728,10 @@ var DragRef = /** @class */ (function () {
665
728
  _this._dropContainer.exit(_this);
666
729
  // Notify the new container that the item has entered.
667
730
  _this._dropContainer = newContainer;
668
- _this._dropContainer.enter(_this, x, y,
669
- // If we're re-entering the initial container,
670
- // put item the into its starting index to begin with.
671
- newContainer === _this._initialContainer ? _this._initialIndex : undefined);
731
+ _this._dropContainer.enter(_this, x, y, newContainer === _this._initialContainer &&
732
+ // If we're re-entering the initial container and sorting is disabled,
733
+ // put item the into its starting index to begin with.
734
+ newContainer.sortingDisabled ? _this._initialIndex : undefined);
672
735
  _this.entered.next({
673
736
  item: _this,
674
737
  container: newContainer,
@@ -692,6 +755,7 @@ var DragRef = /** @class */ (function () {
692
755
  var preview;
693
756
  if (previewTemplate) {
694
757
  var viewRef = previewConfig.viewContainer.createEmbeddedView(previewTemplate, previewConfig.context);
758
+ viewRef.detectChanges();
695
759
  preview = getRootNode(viewRef, this._document);
696
760
  this._previewRef = viewRef;
697
761
  if (previewConfig.matchSize) {
@@ -716,7 +780,7 @@ var DragRef = /** @class */ (function () {
716
780
  position: 'fixed',
717
781
  top: '0',
718
782
  left: '0',
719
- zIndex: '1000'
783
+ zIndex: "" + (this._config.zIndex || 1000)
720
784
  });
721
785
  toggleNativeDragInteractions(preview, false);
722
786
  preview.classList.add('cdk-drag-preview');
@@ -778,6 +842,7 @@ var DragRef = /** @class */ (function () {
778
842
  var placeholder;
779
843
  if (placeholderTemplate) {
780
844
  this._placeholderRef = placeholderConfig.viewContainer.createEmbeddedView(placeholderTemplate, placeholderConfig.context);
845
+ this._placeholderRef.detectChanges();
781
846
  placeholder = getRootNode(this._placeholderRef, this._document);
782
847
  }
783
848
  else {
@@ -813,8 +878,7 @@ var DragRef = /** @class */ (function () {
813
878
  };
814
879
  };
815
880
  /** Gets the pointer position on the page, accounting for any position constraints. */
816
- DragRef.prototype._getConstrainedPointerPosition = function (event) {
817
- var point = this._getPointerPositionOnPage(event);
881
+ DragRef.prototype._getConstrainedPointerPosition = function (point) {
818
882
  var constrainedPoint = this.constrainPosition ? this.constrainPosition(point, this) : point;
819
883
  var dropContainerLock = this._dropContainer ? this._dropContainer.lockAxis : null;
820
884
  if (this.lockAxis === 'x' || dropContainerLock === 'x') {
@@ -969,6 +1033,19 @@ var DragRef = /** @class */ (function () {
969
1033
  }
970
1034
  return value ? value.mouse : 0;
971
1035
  };
1036
+ /** Updates the internal state of the draggable element when scrolling has occurred. */
1037
+ DragRef.prototype._updateOnScroll = function () {
1038
+ var oldScrollPosition = this._scrollPosition;
1039
+ var currentScrollPosition = this._viewportRuler.getViewportScrollPosition();
1040
+ // ClientRect dimensions are based on the page's scroll position so
1041
+ // we have to update the cached boundary ClientRect if the user has scrolled.
1042
+ if (oldScrollPosition && this._boundaryRect) {
1043
+ var topDifference = oldScrollPosition.top - currentScrollPosition.top;
1044
+ var leftDifference = oldScrollPosition.left - currentScrollPosition.left;
1045
+ adjustClientRect(this._boundaryRect, topDifference, leftDifference);
1046
+ }
1047
+ this._scrollPosition = currentScrollPosition;
1048
+ };
972
1049
  return DragRef;
973
1050
  }());
974
1051
  /**
@@ -1040,13 +1117,13 @@ function getPreviewInsertionPoint(documentRef) {
1040
1117
  * If the root is not an HTML element it gets wrapped in one.
1041
1118
  */
1042
1119
  function getRootNode(viewRef, _document) {
1043
- var rootNode = viewRef.rootNodes[0];
1044
- if (rootNode.nodeType !== _document.ELEMENT_NODE) {
1045
- var wrapper = _document.createElement('div');
1046
- wrapper.appendChild(rootNode);
1047
- return wrapper;
1120
+ var rootNodes = viewRef.rootNodes;
1121
+ if (rootNodes.length === 1 && rootNodes[0].nodeType === _document.ELEMENT_NODE) {
1122
+ return rootNodes[0];
1048
1123
  }
1049
- return rootNode;
1124
+ var wrapper = _document.createElement('div');
1125
+ rootNodes.forEach(function (node) { return wrapper.appendChild(node); });
1126
+ return wrapper;
1050
1127
  }
1051
1128
  /**
1052
1129
  * Matches the target element's size to the source's size.
@@ -1440,7 +1517,8 @@ var DropListRef = /** @class */ (function () {
1440
1517
  */
1441
1518
  DropListRef.prototype._sortItem = function (item, pointerX, pointerY, pointerDelta) {
1442
1519
  // Don't sort the item if sorting is disabled or it's out of range.
1443
- if (this.sortingDisabled || !isPointerNearClientRect(this._clientRect, pointerX, pointerY)) {
1520
+ if (this.sortingDisabled ||
1521
+ !isPointerNearClientRect(this._clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
1444
1522
  return;
1445
1523
  }
1446
1524
  var siblings = this._itemPositions;
@@ -1520,7 +1598,7 @@ var DropListRef = /** @class */ (function () {
1520
1598
  if (element === _this._document || !position.clientRect || scrollNode) {
1521
1599
  return;
1522
1600
  }
1523
- if (isPointerNearClientRect(position.clientRect, pointerX, pointerY)) {
1601
+ if (isPointerNearClientRect(position.clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
1524
1602
  _a = __read(getElementScrollDirections(element, position.clientRect, pointerX, pointerY), 2), verticalScrollDirection = _a[0], horizontalScrollDirection = _a[1];
1525
1603
  if (verticalScrollDirection || horizontalScrollDirection) {
1526
1604
  scrollNode = element;
@@ -1692,13 +1770,17 @@ var DropListRef = /** @class */ (function () {
1692
1770
  */
1693
1771
  DropListRef.prototype._updateAfterScroll = function (scrolledParent, newTop, newLeft) {
1694
1772
  var _this = this;
1773
+ // Used when figuring out whether an element is inside the scroll parent. If the scrolled
1774
+ // parent is the `document`, we use the `documentElement`, because IE doesn't support `contains`
1775
+ // on the `document`.
1776
+ var scrolledParentNode = scrolledParent === this._document ? scrolledParent.documentElement : scrolledParent;
1695
1777
  var scrollPosition = this._parentPositions.get(scrolledParent).scrollPosition;
1696
1778
  var topDifference = scrollPosition.top - newTop;
1697
1779
  var leftDifference = scrollPosition.left - newLeft;
1698
1780
  // Go through and update the cached positions of the scroll
1699
1781
  // parents that are inside the element that was scrolled.
1700
1782
  this._parentPositions.forEach(function (position, node) {
1701
- if (position.clientRect && scrolledParent !== node && scrolledParent.contains(node)) {
1783
+ if (position.clientRect && scrolledParent !== node && scrolledParentNode.contains(node)) {
1702
1784
  adjustClientRect(position.clientRect, topDifference, leftDifference);
1703
1785
  }
1704
1786
  });
@@ -1823,37 +1905,13 @@ var DropListRef = /** @class */ (function () {
1823
1905
  */
1824
1906
  DropListRef.prototype._getShadowRoot = function () {
1825
1907
  if (!this._cachedShadowRoot) {
1826
- this._cachedShadowRoot = getShadowRoot(coerceElement(this.element)) || this._document;
1908
+ var shadowRoot = _getShadowRoot(coerceElement(this.element));
1909
+ this._cachedShadowRoot = shadowRoot || this._document;
1827
1910
  }
1828
1911
  return this._cachedShadowRoot;
1829
1912
  };
1830
1913
  return DropListRef;
1831
1914
  }());
1832
- /**
1833
- * Updates the top/left positions of a `ClientRect`, as well as their bottom/right counterparts.
1834
- * @param clientRect `ClientRect` that should be updated.
1835
- * @param top Amount to add to the `top` position.
1836
- * @param left Amount to add to the `left` position.
1837
- */
1838
- function adjustClientRect(clientRect, top, left) {
1839
- clientRect.top += top;
1840
- clientRect.bottom = clientRect.top + clientRect.height;
1841
- clientRect.left += left;
1842
- clientRect.right = clientRect.left + clientRect.width;
1843
- }
1844
- /**
1845
- * Checks whether the pointer coordinates are close to a ClientRect.
1846
- * @param rect ClientRect to check against.
1847
- * @param pointerX Coordinates along the X axis.
1848
- * @param pointerY Coordinates along the Y axis.
1849
- */
1850
- function isPointerNearClientRect(rect, pointerX, pointerY) {
1851
- var top = rect.top, right = rect.right, bottom = rect.bottom, left = rect.left, width = rect.width, height = rect.height;
1852
- var xThreshold = width * DROP_PROXIMITY_THRESHOLD;
1853
- var yThreshold = height * DROP_PROXIMITY_THRESHOLD;
1854
- return pointerY > top - yThreshold && pointerY < bottom + yThreshold &&
1855
- pointerX > left - xThreshold && pointerX < right + xThreshold;
1856
- }
1857
1915
  /**
1858
1916
  * Finds the index of an item that matches a predicate function. Used as an equivalent
1859
1917
  * of `Array.prototype.findIndex` which isn't part of the standard Google typings.
@@ -1868,32 +1926,6 @@ function findIndex(array, predicate) {
1868
1926
  }
1869
1927
  return -1;
1870
1928
  }
1871
- /**
1872
- * Checks whether some coordinates are within a `ClientRect`.
1873
- * @param clientRect ClientRect that is being checked.
1874
- * @param x Coordinates along the X axis.
1875
- * @param y Coordinates along the Y axis.
1876
- */
1877
- function isInsideClientRect(clientRect, x, y) {
1878
- var top = clientRect.top, bottom = clientRect.bottom, left = clientRect.left, right = clientRect.right;
1879
- return y >= top && y <= bottom && x >= left && x <= right;
1880
- }
1881
- /** Gets a mutable version of an element's bounding `ClientRect`. */
1882
- function getMutableClientRect(element) {
1883
- var clientRect = element.getBoundingClientRect();
1884
- // We need to clone the `clientRect` here, because all the values on it are readonly
1885
- // and we need to be able to update them. Also we can't use a spread here, because
1886
- // the values on a `ClientRect` aren't own properties. See:
1887
- // https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect#Notes
1888
- return {
1889
- top: clientRect.top,
1890
- right: clientRect.right,
1891
- bottom: clientRect.bottom,
1892
- left: clientRect.left,
1893
- width: clientRect.width,
1894
- height: clientRect.height
1895
- };
1896
- }
1897
1929
  /**
1898
1930
  * Increments the vertical scroll position of a node.
1899
1931
  * @param node Node whose scroll position should change.
@@ -1995,16 +2027,6 @@ function getElementScrollDirections(element, clientRect, pointerX, pointerY) {
1995
2027
  }
1996
2028
  return [verticalScrollDirection, horizontalScrollDirection];
1997
2029
  }
1998
- /** Gets the shadow root of an element, if any. */
1999
- function getShadowRoot(element) {
2000
- if (_supportsShadowDom()) {
2001
- var rootNode = element.getRootNode ? element.getRootNode() : null;
2002
- if (rootNode instanceof ShadowRoot) {
2003
- return rootNode;
2004
- }
2005
- }
2006
- return null;
2007
- }
2008
2030
 
2009
2031
  /**
2010
2032
  * @license
@@ -2448,7 +2470,8 @@ var CdkDrag = /** @class */ (function () {
2448
2470
  dragStartThreshold: config && config.dragStartThreshold != null ?
2449
2471
  config.dragStartThreshold : 5,
2450
2472
  pointerDirectionChangeThreshold: config && config.pointerDirectionChangeThreshold != null ?
2451
- config.pointerDirectionChangeThreshold : 5
2473
+ config.pointerDirectionChangeThreshold : 5,
2474
+ zIndex: config === null || config === void 0 ? void 0 : config.zIndex
2452
2475
  });
2453
2476
  this._dragRef.data = this;
2454
2477
  if (config) {
@@ -2880,15 +2903,6 @@ var CdkDropList = /** @class */ (function () {
2880
2903
  enumerable: true,
2881
2904
  configurable: true
2882
2905
  });
2883
- CdkDropList.prototype.ngAfterContentInit = function () {
2884
- // @breaking-change 11.0.0 Remove null check for _scrollDispatcher once it's required.
2885
- if (this._scrollDispatcher) {
2886
- var scrollableParents = this._scrollDispatcher
2887
- .getAncestorScrollContainers(this.element)
2888
- .map(function (scrollable) { return scrollable.getElementRef().nativeElement; });
2889
- this._dropListRef.withScrollableParents(scrollableParents);
2890
- }
2891
- };
2892
2906
  /** Registers an items with the drop list. */
2893
2907
  CdkDropList.prototype.addItem = function (item) {
2894
2908
  this._unsortedItems.add(item);
@@ -2997,6 +3011,18 @@ var CdkDropList = /** @class */ (function () {
2997
3011
  }
2998
3012
  });
2999
3013
  }
3014
+ // Note that we resolve the scrollable parents here so that we delay the resolution
3015
+ // as long as possible, ensuring that the element is in its final place in the DOM.
3016
+ // @breaking-change 11.0.0 Remove null check for _scrollDispatcher once it's required.
3017
+ if (!_this._scrollableParentsResolved && _this._scrollDispatcher) {
3018
+ var scrollableParents = _this._scrollDispatcher
3019
+ .getAncestorScrollContainers(_this.element)
3020
+ .map(function (scrollable) { return scrollable.getElementRef().nativeElement; });
3021
+ _this._dropListRef.withScrollableParents(scrollableParents);
3022
+ // Only do this once since it involves traversing the DOM and the parents
3023
+ // shouldn't be able to change without the drop list being destroyed.
3024
+ _this._scrollableParentsResolved = true;
3025
+ }
3000
3026
  ref.disabled = _this.disabled;
3001
3027
  ref.lockAxis = _this.lockAxis;
3002
3028
  ref.sortingDisabled = coerceBooleanProperty(_this.sortingDisabled);