@angular/cdk 11.0.3 → 11.1.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/LICENSE +1 -1
- package/a11y/aria-describer/aria-describer.d.ts +9 -14
- package/a11y/focus-monitor/focus-monitor.d.ts +6 -0
- package/a11y/index.metadata.json +1 -1
- package/bundles/cdk-a11y.umd.js +83 -66
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +13 -21
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-accordion.umd.js.map +1 -1
- package/bundles/cdk-bidi.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.js +9 -1
- package/bundles/cdk-coercion.umd.js.map +1 -1
- package/bundles/cdk-coercion.umd.min.js.map +1 -1
- package/bundles/cdk-collections.umd.js +9 -1
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.min.js +1 -1
- package/bundles/cdk-collections.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +136 -53
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +8 -8
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +49 -11
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +18 -25
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +1 -0
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +1 -1
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-portal.umd.js +9 -1
- package/bundles/cdk-portal.umd.js.map +1 -1
- package/bundles/cdk-portal.umd.min.js +2 -2
- package/bundles/cdk-portal.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +25 -11
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +4 -4
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +99 -30
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +7 -7
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-testing-protractor.umd.js +59 -13
- 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 +40 -15
- package/bundles/cdk-testing-testbed.umd.js.map +1 -1
- package/bundles/cdk-testing-testbed.umd.min.js +7 -7
- package/bundles/cdk-testing-testbed.umd.min.js.map +1 -1
- package/bundles/cdk-testing.umd.js +11 -10
- package/bundles/cdk-testing.umd.js.map +1 -1
- package/bundles/cdk-testing.umd.min.js +2 -2
- package/bundles/cdk-testing.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +9 -1
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js +5 -5
- 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/drag-drop/directives/drag.d.ts +3 -1
- package/drag-drop/directives/drop-list.d.ts +4 -1
- package/drag-drop/drag-drop-registry.d.ts +8 -1
- package/drag-drop/drag-ref.d.ts +6 -0
- package/drag-drop/drop-list-ref.d.ts +7 -1
- package/drag-drop/index.metadata.json +1 -1
- package/esm2015/a11y/aria-describer/aria-describer.js +50 -55
- package/esm2015/a11y/focus-monitor/focus-monitor.js +18 -3
- package/esm2015/drag-drop/directives/drag.js +39 -5
- package/esm2015/drag-drop/directives/drop-list.js +4 -2
- package/esm2015/drag-drop/drag-drop-registry.js +25 -12
- package/esm2015/drag-drop/drag-ref.js +17 -10
- package/esm2015/drag-drop/drop-list-ref.js +46 -28
- package/esm2015/overlay/overlay-ref.js +2 -2
- package/esm2015/overlay/position/flexible-connected-position-strategy.js +25 -3
- package/esm2015/overlay/scroll/block-scroll-strategy.js +13 -4
- package/esm2015/platform/features/scrolling.js +2 -1
- package/esm2015/scrolling/fixed-size-virtual-scroll.js +3 -2
- package/esm2015/scrolling/scroll-dispatcher.js +9 -8
- package/esm2015/scrolling/virtual-for-of.js +8 -4
- package/esm2015/scrolling/virtual-scroll-viewport.js +1 -1
- package/esm2015/table/public-api.js +2 -1
- package/esm2015/table/sticky-position-listener.js +11 -0
- package/esm2015/table/sticky-styler.js +60 -14
- package/esm2015/table/table.js +9 -4
- package/esm2015/testing/change-detection.js +1 -8
- package/esm2015/testing/harness-environment.js +3 -3
- package/esm2015/testing/protractor/protractor-element.js +29 -13
- package/esm2015/testing/test-element.js +1 -1
- package/esm2015/testing/testbed/fake-events/dispatch-events.js +3 -3
- package/esm2015/testing/testbed/fake-events/event-objects.js +6 -6
- package/esm2015/testing/testbed/unit-test-element.js +21 -9
- package/esm2015/tree/nested-node.js +1 -1
- package/esm2015/tree/padding.js +1 -1
- package/esm2015/tree/toggle.js +1 -1
- package/esm2015/tree/tree.js +1 -1
- package/esm2015/version.js +1 -1
- package/fesm2015/a11y.js +67 -55
- package/fesm2015/a11y.js.map +1 -1
- package/fesm2015/accordion.js.map +1 -1
- package/fesm2015/bidi.js.map +1 -1
- package/fesm2015/cdk.js +1 -1
- package/fesm2015/cdk.js.map +1 -1
- package/fesm2015/drag-drop.js +125 -51
- package/fesm2015/drag-drop.js.map +1 -1
- package/fesm2015/overlay.js +37 -7
- package/fesm2015/overlay.js.map +1 -1
- package/fesm2015/platform.js +1 -0
- package/fesm2015/platform.js.map +1 -1
- package/fesm2015/scrolling.js +17 -12
- package/fesm2015/scrolling.js.map +1 -1
- package/fesm2015/table.js +77 -17
- package/fesm2015/table.js.map +1 -1
- package/fesm2015/testing/protractor.js +27 -11
- package/fesm2015/testing/protractor.js.map +1 -1
- package/fesm2015/testing/testbed.js +25 -13
- package/fesm2015/testing/testbed.js.map +1 -1
- package/fesm2015/testing.js +2 -9
- package/fesm2015/testing.js.map +1 -1
- package/fesm2015/tree.js.map +1 -1
- package/overlay/index.metadata.json +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/scrolling/index.metadata.json +1 -1
- package/scrolling/scroll-dispatcher.d.ts +3 -3
- package/table/index.metadata.json +1 -1
- package/table/public-api.d.ts +1 -0
- package/table/sticky-position-listener.d.ts +28 -0
- package/table/sticky-styler.d.ts +7 -2
- package/table/table.d.ts +4 -2
- package/testing/change-detection.d.ts +44 -1
- package/testing/protractor/protractor-element.d.ts +12 -4
- package/testing/test-element.d.ts +11 -5
- package/testing/testbed/fake-events/dispatch-events.d.ts +1 -1
- package/testing/testbed/fake-events/event-objects.d.ts +1 -1
- package/testing/testbed/unit-test-element.d.ts +12 -4
- package/tree/index.metadata.json +1 -1
- package/tree/nested-node.d.ts +3 -3
- package/tree/padding.d.ts +2 -2
- package/tree/toggle.d.ts +4 -4
- package/tree/tree.d.ts +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.js","sources":["../../../../../../src/cdk/accordion/accordion.ts","../../../../../../src/cdk/accordion/accordion-item.ts","../../../../../../src/cdk/accordion/accordion-module.ts","../../../../../../src/cdk/accordion/public-api.ts","../../../../../../src/cdk/accordion/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 {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {Directive, InjectionToken, Input, OnChanges, OnDestroy, SimpleChanges} from '@angular/core';\nimport {Subject} from 'rxjs';\n\n/** Used to generate unique ID for each accordion. */\nlet nextId = 0;\n\n/**\n * Injection token that can be used to reference instances of `CdkAccordion`. It serves\n * as alternative token to the actual `CdkAccordion` class which could cause unnecessary\n * retention of the class and its directive metadata.\n */\nexport const CDK_ACCORDION = new InjectionToken<CdkAccordion>('CdkAccordion');\n\n/**\n * Directive whose purpose is to manage the expanded state of CdkAccordionItem children.\n */\n@Directive({\n selector: 'cdk-accordion, [cdkAccordion]',\n exportAs: 'cdkAccordion',\n providers: [{provide: CDK_ACCORDION, useExisting: CdkAccordion}],\n})\nexport class CdkAccordion implements OnDestroy, OnChanges {\n /** Emits when the state of the accordion changes */\n readonly _stateChanges = new Subject<SimpleChanges>();\n\n /** Stream that emits true/false when openAll/closeAll is triggered. */\n readonly _openCloseAllActions: Subject<boolean> = new Subject<boolean>();\n\n /** A readonly id value to use for unique selection coordination. */\n readonly id = `cdk-accordion-${nextId++}`;\n\n /** Whether the accordion should allow multiple expanded accordion items simultaneously. */\n @Input()\n get multi(): boolean { return this._multi; }\n set multi(multi: boolean) { this._multi = coerceBooleanProperty(multi); }\n private _multi: boolean = false;\n\n /** Opens all enabled accordion items in an accordion where multi is enabled. */\n openAll(): void {\n this._openCloseAll(true);\n }\n\n /** Closes all enabled accordion items in an accordion where multi is enabled. */\n closeAll(): void {\n this._openCloseAll(false);\n }\n\n ngOnChanges(changes: SimpleChanges) {\n this._stateChanges.next(changes);\n }\n\n ngOnDestroy() {\n this._stateChanges.complete();\n }\n\n private _openCloseAll(expanded: boolean): void {\n if (this.multi) {\n this._openCloseAllActions.next(expanded);\n }\n }\n\n static ngAcceptInputType_multi: BooleanInput;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n Output,\n Directive,\n EventEmitter,\n Input,\n OnDestroy,\n Optional,\n ChangeDetectorRef,\n SkipSelf,\n Inject,\n} from '@angular/core';\nimport {UniqueSelectionDispatcher} from '@angular/cdk/collections';\nimport {CDK_ACCORDION, CdkAccordion} from './accordion';\nimport {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {Subscription} from 'rxjs';\n\n/** Used to generate unique ID for each accordion item. */\nlet nextId = 0;\n\n/**\n * An basic directive expected to be extended and decorated as a component. Sets up all\n * events and attributes needed to be managed by a CdkAccordion parent.\n */\n@Directive({\n selector: 'cdk-accordion-item, [cdkAccordionItem]',\n exportAs: 'cdkAccordionItem',\n providers: [\n // Provide `CDK_ACCORDION` as undefined to prevent nested accordion items from\n // registering to the same accordion.\n {provide: CDK_ACCORDION, useValue: undefined},\n ],\n})\nexport class CdkAccordionItem implements OnDestroy {\n /** Subscription to openAll/closeAll events. */\n private _openCloseAllSubscription = Subscription.EMPTY;\n /** Event emitted every time the AccordionItem is closed. */\n @Output() closed: EventEmitter<void> = new EventEmitter<void>();\n /** Event emitted every time the AccordionItem is opened. */\n @Output() opened: EventEmitter<void> = new EventEmitter<void>();\n /** Event emitted when the AccordionItem is destroyed. */\n @Output() destroyed: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * Emits whenever the expanded state of the accordion changes.\n * Primarily used to facilitate two-way binding.\n * @docs-private\n */\n @Output() expandedChange: EventEmitter<boolean> = new EventEmitter<boolean>();\n\n /** The unique AccordionItem id. */\n readonly id: string = `cdk-accordion-child-${nextId++}`;\n\n /** Whether the AccordionItem is expanded. */\n @Input()\n get expanded(): any { return this._expanded; }\n set expanded(expanded: any) {\n expanded = coerceBooleanProperty(expanded);\n\n // Only emit events and update the internal value if the value changes.\n if (this._expanded !== expanded) {\n this._expanded = expanded;\n this.expandedChange.emit(expanded);\n\n if (expanded) {\n this.opened.emit();\n /**\n * In the unique selection dispatcher, the id parameter is the id of the CdkAccordionItem,\n * the name value is the id of the accordion.\n */\n const accordionId = this.accordion ? this.accordion.id : this.id;\n this._expansionDispatcher.notify(this.id, accordionId);\n } else {\n this.closed.emit();\n }\n\n // Ensures that the animation will run when the value is set outside of an `@Input`.\n // This includes cases like the open, close and toggle methods.\n this._changeDetectorRef.markForCheck();\n }\n }\n private _expanded = false;\n\n /** Whether the AccordionItem is disabled. */\n @Input()\n get disabled() { return this._disabled; }\n set disabled(disabled: any) { this._disabled = coerceBooleanProperty(disabled); }\n private _disabled: boolean = false;\n\n /** Unregister function for _expansionDispatcher. */\n private _removeUniqueSelectionListener: () => void = () => {};\n\n constructor(@Optional() @Inject(CDK_ACCORDION) @SkipSelf() public accordion: CdkAccordion,\n private _changeDetectorRef: ChangeDetectorRef,\n protected _expansionDispatcher: UniqueSelectionDispatcher) {\n this._removeUniqueSelectionListener =\n _expansionDispatcher.listen((id: string, accordionId: string) => {\n if (this.accordion && !this.accordion.multi &&\n this.accordion.id === accordionId && this.id !== id) {\n this.expanded = false;\n }\n });\n\n // When an accordion item is hosted in an accordion, subscribe to open/close events.\n if (this.accordion) {\n this._openCloseAllSubscription = this._subscribeToOpenCloseAllActions();\n }\n }\n\n /** Emits an event for the accordion item being destroyed. */\n ngOnDestroy() {\n this.opened.complete();\n this.closed.complete();\n this.destroyed.emit();\n this.destroyed.complete();\n this._removeUniqueSelectionListener();\n this._openCloseAllSubscription.unsubscribe();\n }\n\n /** Toggles the expanded state of the accordion item. */\n toggle(): void {\n if (!this.disabled) {\n this.expanded = !this.expanded;\n }\n }\n\n /** Sets the expanded state of the accordion item to false. */\n close(): void {\n if (!this.disabled) {\n this.expanded = false;\n }\n }\n\n /** Sets the expanded state of the accordion item to true. */\n open(): void {\n if (!this.disabled) {\n this.expanded = true;\n }\n }\n\n private _subscribeToOpenCloseAllActions(): Subscription {\n return this.accordion._openCloseAllActions.subscribe(expanded => {\n // Only change expanded state if item is enabled\n if (!this.disabled) {\n this.expanded = expanded;\n }\n });\n }\n\n static ngAcceptInputType_expanded: BooleanInput;\n static ngAcceptInputType_disabled: BooleanInput;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {NgModule} from '@angular/core';\nimport {CdkAccordion} from './accordion';\nimport {CdkAccordionItem} from './accordion-item';\n\n\n@NgModule({\n exports: [CdkAccordion, CdkAccordionItem],\n declarations: [CdkAccordion, CdkAccordionItem],\n})\nexport class CdkAccordionModule {}\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 {CdkAccordionItem} from './accordion-item';\nexport {CdkAccordion} from './accordion';\nexport * from './accordion-module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {CDK_ACCORDION as ɵangular_material_src_cdk_accordion_accordion_a} from './accordion';"],"names":["nextId"],"mappings":";;;;;AAAA;;;;;;;AAQA,AAIA;AACA,IAAI,MAAM,GAAG,CAAC,CAAC;;;;;;AAOf,MAAa,aAAa,GAAG,IAAI,cAAc,CAAe,cAAc,CAAC,CAAC;;;;AAU9E,MAAa,YAAY;IALzB;;QAOW,kBAAa,GAAG,IAAI,OAAO,EAAiB,CAAC;;QAG7C,yBAAoB,GAAqB,IAAI,OAAO,EAAW,CAAC;;QAGhE,OAAE,GAAG,iBAAiB,MAAM,EAAE,EAAE,CAAC;QAMlC,WAAM,GAAY,KAAK,CAAC;KA2BjC;;IA9BC,IACI,KAAK,KAAc,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE;IAC5C,IAAI,KAAK,CAAC,KAAc,IAAI,IAAI,CAAC,MAAM,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC,EAAE;;IAIzE,OAAO;QACL,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KAC1B;;IAGD,QAAQ;QACN,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;KAC3B;IAED,WAAW,CAAC,OAAsB;QAChC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;KAClC;IAED,WAAW;QACT,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC;KAC/B;IAEO,aAAa,CAAC,QAAiB;QACrC,IAAI,IAAI,CAAC,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sources":["../../../../../../src/cdk/accordion/accordion.ts","../../../../../../src/cdk/accordion/accordion-item.ts","../../../../../../src/cdk/accordion/accordion-module.ts","../../../../../../src/cdk/accordion/public-api.ts","../../../../../../src/cdk/accordion/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 {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {Directive, InjectionToken, Input, OnChanges, OnDestroy, SimpleChanges} from '@angular/core';\nimport {Subject} from 'rxjs';\n\n/** Used to generate unique ID for each accordion. */\nlet nextId = 0;\n\n/**\n * Injection token that can be used to reference instances of `CdkAccordion`. It serves\n * as alternative token to the actual `CdkAccordion` class which could cause unnecessary\n * retention of the class and its directive metadata.\n */\nexport const CDK_ACCORDION = new InjectionToken<CdkAccordion>('CdkAccordion');\n\n/**\n * Directive whose purpose is to manage the expanded state of CdkAccordionItem children.\n */\n@Directive({\n selector: 'cdk-accordion, [cdkAccordion]',\n exportAs: 'cdkAccordion',\n providers: [{provide: CDK_ACCORDION, useExisting: CdkAccordion}],\n})\nexport class CdkAccordion implements OnDestroy, OnChanges {\n /** Emits when the state of the accordion changes */\n readonly _stateChanges = new Subject<SimpleChanges>();\n\n /** Stream that emits true/false when openAll/closeAll is triggered. */\n readonly _openCloseAllActions: Subject<boolean> = new Subject<boolean>();\n\n /** A readonly id value to use for unique selection coordination. */\n readonly id = `cdk-accordion-${nextId++}`;\n\n /** Whether the accordion should allow multiple expanded accordion items simultaneously. */\n @Input()\n get multi(): boolean { return this._multi; }\n set multi(multi: boolean) { this._multi = coerceBooleanProperty(multi); }\n private _multi: boolean = false;\n\n /** Opens all enabled accordion items in an accordion where multi is enabled. */\n openAll(): void {\n this._openCloseAll(true);\n }\n\n /** Closes all enabled accordion items in an accordion where multi is enabled. */\n closeAll(): void {\n this._openCloseAll(false);\n }\n\n ngOnChanges(changes: SimpleChanges) {\n this._stateChanges.next(changes);\n }\n\n ngOnDestroy() {\n this._stateChanges.complete();\n }\n\n private _openCloseAll(expanded: boolean): void {\n if (this.multi) {\n this._openCloseAllActions.next(expanded);\n }\n }\n\n static ngAcceptInputType_multi: BooleanInput;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {\n Output,\n Directive,\n EventEmitter,\n Input,\n OnDestroy,\n Optional,\n ChangeDetectorRef,\n SkipSelf,\n Inject,\n} from '@angular/core';\nimport {UniqueSelectionDispatcher} from '@angular/cdk/collections';\nimport {CDK_ACCORDION, CdkAccordion} from './accordion';\nimport {BooleanInput, coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {Subscription} from 'rxjs';\n\n/** Used to generate unique ID for each accordion item. */\nlet nextId = 0;\n\n/**\n * An basic directive expected to be extended and decorated as a component. Sets up all\n * events and attributes needed to be managed by a CdkAccordion parent.\n */\n@Directive({\n selector: 'cdk-accordion-item, [cdkAccordionItem]',\n exportAs: 'cdkAccordionItem',\n providers: [\n // Provide `CDK_ACCORDION` as undefined to prevent nested accordion items from\n // registering to the same accordion.\n {provide: CDK_ACCORDION, useValue: undefined},\n ],\n})\nexport class CdkAccordionItem implements OnDestroy {\n /** Subscription to openAll/closeAll events. */\n private _openCloseAllSubscription = Subscription.EMPTY;\n /** Event emitted every time the AccordionItem is closed. */\n @Output() closed: EventEmitter<void> = new EventEmitter<void>();\n /** Event emitted every time the AccordionItem is opened. */\n @Output() opened: EventEmitter<void> = new EventEmitter<void>();\n /** Event emitted when the AccordionItem is destroyed. */\n @Output() destroyed: EventEmitter<void> = new EventEmitter<void>();\n\n /**\n * Emits whenever the expanded state of the accordion changes.\n * Primarily used to facilitate two-way binding.\n * @docs-private\n */\n @Output() expandedChange: EventEmitter<boolean> = new EventEmitter<boolean>();\n\n /** The unique AccordionItem id. */\n readonly id: string = `cdk-accordion-child-${nextId++}`;\n\n /** Whether the AccordionItem is expanded. */\n @Input()\n get expanded(): any { return this._expanded; }\n set expanded(expanded: any) {\n expanded = coerceBooleanProperty(expanded);\n\n // Only emit events and update the internal value if the value changes.\n if (this._expanded !== expanded) {\n this._expanded = expanded;\n this.expandedChange.emit(expanded);\n\n if (expanded) {\n this.opened.emit();\n /**\n * In the unique selection dispatcher, the id parameter is the id of the CdkAccordionItem,\n * the name value is the id of the accordion.\n */\n const accordionId = this.accordion ? this.accordion.id : this.id;\n this._expansionDispatcher.notify(this.id, accordionId);\n } else {\n this.closed.emit();\n }\n\n // Ensures that the animation will run when the value is set outside of an `@Input`.\n // This includes cases like the open, close and toggle methods.\n this._changeDetectorRef.markForCheck();\n }\n }\n private _expanded = false;\n\n /** Whether the AccordionItem is disabled. */\n @Input()\n get disabled() { return this._disabled; }\n set disabled(disabled: any) { this._disabled = coerceBooleanProperty(disabled); }\n private _disabled: boolean = false;\n\n /** Unregister function for _expansionDispatcher. */\n private _removeUniqueSelectionListener: () => void = () => {};\n\n constructor(@Optional() @Inject(CDK_ACCORDION) @SkipSelf() public accordion: CdkAccordion,\n private _changeDetectorRef: ChangeDetectorRef,\n protected _expansionDispatcher: UniqueSelectionDispatcher) {\n this._removeUniqueSelectionListener =\n _expansionDispatcher.listen((id: string, accordionId: string) => {\n if (this.accordion && !this.accordion.multi &&\n this.accordion.id === accordionId && this.id !== id) {\n this.expanded = false;\n }\n });\n\n // When an accordion item is hosted in an accordion, subscribe to open/close events.\n if (this.accordion) {\n this._openCloseAllSubscription = this._subscribeToOpenCloseAllActions();\n }\n }\n\n /** Emits an event for the accordion item being destroyed. */\n ngOnDestroy() {\n this.opened.complete();\n this.closed.complete();\n this.destroyed.emit();\n this.destroyed.complete();\n this._removeUniqueSelectionListener();\n this._openCloseAllSubscription.unsubscribe();\n }\n\n /** Toggles the expanded state of the accordion item. */\n toggle(): void {\n if (!this.disabled) {\n this.expanded = !this.expanded;\n }\n }\n\n /** Sets the expanded state of the accordion item to false. */\n close(): void {\n if (!this.disabled) {\n this.expanded = false;\n }\n }\n\n /** Sets the expanded state of the accordion item to true. */\n open(): void {\n if (!this.disabled) {\n this.expanded = true;\n }\n }\n\n private _subscribeToOpenCloseAllActions(): Subscription {\n return this.accordion._openCloseAllActions.subscribe(expanded => {\n // Only change expanded state if item is enabled\n if (!this.disabled) {\n this.expanded = expanded;\n }\n });\n }\n\n static ngAcceptInputType_expanded: BooleanInput;\n static ngAcceptInputType_disabled: BooleanInput;\n}\n","/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {NgModule} from '@angular/core';\nimport {CdkAccordion} from './accordion';\nimport {CdkAccordionItem} from './accordion-item';\n\n\n@NgModule({\n exports: [CdkAccordion, CdkAccordionItem],\n declarations: [CdkAccordion, CdkAccordionItem],\n})\nexport class CdkAccordionModule {}\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 {CdkAccordionItem} from './accordion-item';\nexport {CdkAccordion} from './accordion';\nexport * from './accordion-module';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {CDK_ACCORDION as ɵangular_material_src_cdk_accordion_accordion_a} from './accordion';"],"names":["nextId"],"mappings":";;;;;AAAA;;;;;;;AAQA,AAIA;AACA,IAAI,MAAM,GAAG,CAAC,CAAC;;;;;;AAOf,MAAa,aAAa,GAAG,IAAI,cAAc,CAAe,cAAc,CAAC,CAAC;;;;AAU9E,MAAa,YAAY;IALzB;;QAOW,kBAAa,GAAG,IAAI,OAAO,EAAiB,CAAC;;QAG7C,yBAAoB,GAAqB,IAAI,OAAO,EAAW,CAAC;;QAGhE,OAAE,GAAG,iBAAiB,MAAM,EAAE,EAAE,CAAC;QAMlC,WAAM,GAAY,KAAK,CAAC;KA2BjC;;IA9BC,IACI,KAAK,KAAc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,EAAE,aAAa,EAAE,QAAQ,IAAW,EAAC;iBAC9C;aACF;;;YAnBsB,YAAY,uBA+EpB,QAAQ,YAAI,MAAM,SAAC,aAAa,cAAG,QAAQ;YApFxD,iBAAiB;YAIX,yBAAyB;;;qBAyB9B,MAAM;qBAEN,MAAM;wBAEN,MAAM;6BAON,MAAM;uBAMN,KAAK;uBA8BL,KAAK;;;AC3FR;;;;;;;AAQA,MASa,kBAAkB;;;YAJ9B,QAAQ,SAAC;gBACR,OAAO,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC;gBACzC,YAAY,EAAE,CAAC,YAAY,EAAE,gBAAgB,CAAC;aAC/C;;;AChBD;;;;;;GAMG;;ACNH;;GAEG;;;;"}
|
package/fesm2015/bidi.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bidi.js","sources":["../../../../../../src/cdk/bidi/dir-document-token.ts","../../../../../../src/cdk/bidi/directionality.ts","../../../../../../src/cdk/bidi/dir.ts","../../../../../../src/cdk/bidi/bidi-module.ts","../../../../../../src/cdk/bidi/public-api.ts","../../../../../../src/cdk/bidi/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 {DOCUMENT} from '@angular/common';\nimport {inject, InjectionToken} from '@angular/core';\n\n\n/**\n * Injection token used to inject the document into Directionality.\n * This is used so that the value can be faked in tests.\n *\n * We can't use the real document in tests because changing the real `dir` causes geometry-based\n * tests in Safari to fail.\n *\n * We also can't re-provide the DOCUMENT token from platform-brower because the unit tests\n * themselves use things like `querySelector` in test code.\n *\n * This token is defined in a separate file from Directionality as a workaround for\n * https://github.com/angular/angular/issues/22559\n *\n * @docs-private\n */\nexport const DIR_DOCUMENT = new InjectionToken<Document>('cdk-dir-doc', {\n providedIn: 'root',\n factory: DIR_DOCUMENT_FACTORY,\n});\n\n/** @docs-private */\nexport function DIR_DOCUMENT_FACTORY(): Document {\n return inject(DOCUMENT);\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 {EventEmitter, Inject, Injectable, Optional, OnDestroy} from '@angular/core';\nimport {DIR_DOCUMENT} from './dir-document-token';\n\n\nexport type Direction = 'ltr' | 'rtl';\n\n\n/**\n * The directionality (LTR / RTL) context for the application (or a subtree of it).\n * Exposes the current direction and a stream of direction changes.\n */\n@Injectable({providedIn: 'root'})\nexport class Directionality implements OnDestroy {\n /** The current 'ltr' or 'rtl' value. */\n readonly value: Direction = 'ltr';\n\n /** Stream that emits whenever the 'ltr' / 'rtl' state changes. */\n readonly change = new EventEmitter<Direction>();\n\n constructor(@Optional() @Inject(DIR_DOCUMENT) _document?: any) {\n if (_document) {\n // TODO: handle 'auto' value -\n // We still need to account for dir=\"auto\".\n // It looks like HTMLElemenet.dir is also \"auto\" when that's set to the attribute,\n // but getComputedStyle return either \"ltr\" or \"rtl\". avoiding getComputedStyle for now\n const bodyDir = _document.body ? _document.body.dir : null;\n const htmlDir = _document.documentElement ? _document.documentElement.dir : null;\n const value = bodyDir || htmlDir;\n this.value = (value === 'ltr' || value === 'rtl') ? value : 'ltr';\n }\n }\n\n ngOnDestroy() {\n this.change.complete();\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 Output,\n Input,\n EventEmitter,\n AfterContentInit,\n OnDestroy,\n} from '@angular/core';\n\nimport {Direction, Directionality} from './directionality';\n\n/**\n * Directive to listen for changes of direction of part of the DOM.\n *\n * Provides itself as Directionality such that descendant directives only need to ever inject\n * Directionality to get the closest direction.\n */\n@Directive({\n selector: '[dir]',\n providers: [{provide: Directionality, useExisting: Dir}],\n host: {'[attr.dir]': '_rawDir'},\n exportAs: 'dir',\n})\nexport class Dir implements Directionality, AfterContentInit, OnDestroy {\n /** Normalized direction that accounts for invalid/unsupported values. */\n private _dir: Direction = 'ltr';\n\n /** Whether the `value` has been set to its initial value. */\n private _isInitialized: boolean = false;\n\n /** Direction as passed in by the consumer. */\n _rawDir: string;\n\n /** Event emitted when the direction changes. */\n @Output('dirChange') change = new EventEmitter<Direction>();\n\n /** @docs-private */\n @Input()\n get dir(): Direction { return this._dir; }\n set dir(value: Direction) {\n const old = this._dir;\n const normalizedValue = value ? value.toLowerCase() : value;\n\n this._rawDir = value;\n this._dir = (normalizedValue === 'ltr' || normalizedValue === 'rtl') ? normalizedValue : 'ltr';\n\n if (old !== this._dir && this._isInitialized) {\n this.change.emit(this._dir);\n }\n }\n\n /** Current layout direction of the element. */\n get value(): Direction { return this.dir; }\n\n /** Initialize once default value has been set. */\n ngAfterContentInit() {\n this._isInitialized = true;\n }\n\n ngOnDestroy() {\n this.change.complete();\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 {NgModule} from '@angular/core';\nimport {Dir} from './dir';\n\n\n@NgModule({\n exports: [Dir],\n declarations: [Dir],\n})\nexport class BidiModule { }\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 {Directionality, Direction} from './directionality';\nexport {DIR_DOCUMENT} from './dir-document-token';\nexport {Dir} from './dir';\nexport * from './bidi-module';\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {DIR_DOCUMENT_FACTORY as
|
|
1
|
+
{"version":3,"file":"bidi.js","sources":["../../../../../../src/cdk/bidi/dir-document-token.ts","../../../../../../src/cdk/bidi/directionality.ts","../../../../../../src/cdk/bidi/dir.ts","../../../../../../src/cdk/bidi/bidi-module.ts","../../../../../../src/cdk/bidi/public-api.ts","../../../../../../src/cdk/bidi/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 {DOCUMENT} from '@angular/common';\nimport {inject, InjectionToken} from '@angular/core';\n\n\n/**\n * Injection token used to inject the document into Directionality.\n * This is used so that the value can be faked in tests.\n *\n * We can't use the real document in tests because changing the real `dir` causes geometry-based\n * tests in Safari to fail.\n *\n * We also can't re-provide the DOCUMENT token from platform-brower because the unit tests\n * themselves use things like `querySelector` in test code.\n *\n * This token is defined in a separate file from Directionality as a workaround for\n * https://github.com/angular/angular/issues/22559\n *\n * @docs-private\n */\nexport const DIR_DOCUMENT = new InjectionToken<Document>('cdk-dir-doc', {\n providedIn: 'root',\n factory: DIR_DOCUMENT_FACTORY,\n});\n\n/** @docs-private */\nexport function DIR_DOCUMENT_FACTORY(): Document {\n return inject(DOCUMENT);\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 {EventEmitter, Inject, Injectable, Optional, OnDestroy} from '@angular/core';\nimport {DIR_DOCUMENT} from './dir-document-token';\n\n\nexport type Direction = 'ltr' | 'rtl';\n\n\n/**\n * The directionality (LTR / RTL) context for the application (or a subtree of it).\n * Exposes the current direction and a stream of direction changes.\n */\n@Injectable({providedIn: 'root'})\nexport class Directionality implements OnDestroy {\n /** The current 'ltr' or 'rtl' value. */\n readonly value: Direction = 'ltr';\n\n /** Stream that emits whenever the 'ltr' / 'rtl' state changes. */\n readonly change = new EventEmitter<Direction>();\n\n constructor(@Optional() @Inject(DIR_DOCUMENT) _document?: any) {\n if (_document) {\n // TODO: handle 'auto' value -\n // We still need to account for dir=\"auto\".\n // It looks like HTMLElemenet.dir is also \"auto\" when that's set to the attribute,\n // but getComputedStyle return either \"ltr\" or \"rtl\". avoiding getComputedStyle for now\n const bodyDir = _document.body ? _document.body.dir : null;\n const htmlDir = _document.documentElement ? _document.documentElement.dir : null;\n const value = bodyDir || htmlDir;\n this.value = (value === 'ltr' || value === 'rtl') ? value : 'ltr';\n }\n }\n\n ngOnDestroy() {\n this.change.complete();\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 Output,\n Input,\n EventEmitter,\n AfterContentInit,\n OnDestroy,\n} from '@angular/core';\n\nimport {Direction, Directionality} from './directionality';\n\n/**\n * Directive to listen for changes of direction of part of the DOM.\n *\n * Provides itself as Directionality such that descendant directives only need to ever inject\n * Directionality to get the closest direction.\n */\n@Directive({\n selector: '[dir]',\n providers: [{provide: Directionality, useExisting: Dir}],\n host: {'[attr.dir]': '_rawDir'},\n exportAs: 'dir',\n})\nexport class Dir implements Directionality, AfterContentInit, OnDestroy {\n /** Normalized direction that accounts for invalid/unsupported values. */\n private _dir: Direction = 'ltr';\n\n /** Whether the `value` has been set to its initial value. */\n private _isInitialized: boolean = false;\n\n /** Direction as passed in by the consumer. */\n _rawDir: string;\n\n /** Event emitted when the direction changes. */\n @Output('dirChange') change = new EventEmitter<Direction>();\n\n /** @docs-private */\n @Input()\n get dir(): Direction { return this._dir; }\n set dir(value: Direction) {\n const old = this._dir;\n const normalizedValue = value ? value.toLowerCase() : value;\n\n this._rawDir = value;\n this._dir = (normalizedValue === 'ltr' || normalizedValue === 'rtl') ? normalizedValue : 'ltr';\n\n if (old !== this._dir && this._isInitialized) {\n this.change.emit(this._dir);\n }\n }\n\n /** Current layout direction of the element. */\n get value(): Direction { return this.dir; }\n\n /** Initialize once default value has been set. */\n ngAfterContentInit() {\n this._isInitialized = true;\n }\n\n ngOnDestroy() {\n this.change.complete();\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 {NgModule} from '@angular/core';\nimport {Dir} from './dir';\n\n\n@NgModule({\n exports: [Dir],\n declarations: [Dir],\n})\nexport class BidiModule { }\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 {Directionality, Direction} from './directionality';\nexport {DIR_DOCUMENT} from './dir-document-token';\nexport {Dir} from './dir';\nexport * from './bidi-module';\n\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n\nexport {DIR_DOCUMENT_FACTORY as ɵangular_material_src_cdk_bidi_bidi_a} from './dir-document-token';"],"names":[],"mappings":";;;AAAA;;;;;;;AAQA,AAIA;;;;;;;;;;;;;;;AAeA,MAAa,YAAY,GAAG,IAAI,cAAc,CAAW,aAAa,EAAE;IACtE,UAAU,EAAE,MAAM;IAClB,OAAO,EAAE,oBAAoB;CAC9B,CAAC,CAAC;;AAGH,SAAgB,oBAAoB;IAClC,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;CACzB;;ACnCD;;;;;;;AAQA,AAOA;;;;AAKA,MAAa,cAAc;IAOzB,YAA8C,SAAe;;QALpD,UAAK,GAAc,KAAK,CAAC;;QAGzB,WAAM,GAAG,IAAI,YAAY,EAAa,CAAC;QAG9C,IAAI,SAAS,EAAE;;;;;YAKb,MAAM,OAAO,GAAG,SAAS,CAAC,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC;YAC3D,MAAM,OAAO,GAAG,SAAS,CAAC,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC,GAAG,GAAG,IAAI,CAAC;YACjF,MAAM,KAAK,GAAG,OAAO,IAAI,OAAO,CAAC;YACjC,IAAI,CAAC,KAAK,GAAG,CAAC,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,GAAG,KAAK,CAAC;SACnE;KACF;IAED,WAAW;QACT,IAAI,CAAC,MAAM,CAAC,QAAQ,E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;qBAYE,MAAM,SAAC,WAAW;kBAGlB,KAAK;;;AC7CR;;;;;;;AAQA,MAQa,UAAU;;;YAJtB,QAAQ,SAAC;gBACR,OAAO,EAAE,CAAC,GAAG,CAAC;gBACd,YAAY,EAAE,CAAC,GAAG,CAAC;aACpB;;;ACfD;;;;;;GAMG;;ACNH;;GAEG;;;;"}
|
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('11.
|
|
11
|
+
const VERSION = new Version('11.1.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('11.
|
|
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('11.1.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/drag-drop.js
CHANGED
|
@@ -389,9 +389,6 @@ class DragRef {
|
|
|
389
389
|
};
|
|
390
390
|
/** Handler that is invoked when the user moves their pointer after they've initiated a drag. */
|
|
391
391
|
this._pointerMove = (event) => {
|
|
392
|
-
// Prevent the default action as early as possible in order to block
|
|
393
|
-
// native actions like dragging the selected text or images with the mouse.
|
|
394
|
-
event.preventDefault();
|
|
395
392
|
const pointerPosition = this._getPointerPositionOnPage(event);
|
|
396
393
|
if (!this._hasStartedDragging) {
|
|
397
394
|
const distanceX = Math.abs(pointerPosition.x - this._pickupPositionOnPage.x);
|
|
@@ -426,6 +423,10 @@ class DragRef {
|
|
|
426
423
|
this._previewRect = (this._preview || this._rootElement).getBoundingClientRect();
|
|
427
424
|
}
|
|
428
425
|
}
|
|
426
|
+
// We prevent the default action down here so that we know that dragging has started. This is
|
|
427
|
+
// important for touch devices where doing this too early can unnecessarily block scrolling,
|
|
428
|
+
// if there's a dragging delay.
|
|
429
|
+
event.preventDefault();
|
|
429
430
|
const constrainedPointerPosition = this._getConstrainedPointerPosition(pointerPosition);
|
|
430
431
|
this._hasMoved = true;
|
|
431
432
|
this._lastKnownPointerPosition = pointerPosition;
|
|
@@ -465,7 +466,7 @@ class DragRef {
|
|
|
465
466
|
this._pointerUp = (event) => {
|
|
466
467
|
this._endDragSequence(event);
|
|
467
468
|
};
|
|
468
|
-
this.withRootElement(element);
|
|
469
|
+
this.withRootElement(element).withParent(_config.parentDragRef || null);
|
|
469
470
|
this._parentPositions = new ParentPositionTracker(_document, _viewportRuler);
|
|
470
471
|
_dragDropRegistry.registerDragItem(this);
|
|
471
472
|
}
|
|
@@ -569,6 +570,11 @@ class DragRef {
|
|
|
569
570
|
}
|
|
570
571
|
return this;
|
|
571
572
|
}
|
|
573
|
+
/** Sets the parent ref that the ref is nested in. */
|
|
574
|
+
withParent(parent) {
|
|
575
|
+
this._parentDragRef = parent;
|
|
576
|
+
return this;
|
|
577
|
+
}
|
|
572
578
|
/** Removes the dragging functionality from the DOM element. */
|
|
573
579
|
dispose() {
|
|
574
580
|
this._removeRootElementListeners(this._rootElement);
|
|
@@ -598,7 +604,7 @@ class DragRef {
|
|
|
598
604
|
this._resizeSubscription.unsubscribe();
|
|
599
605
|
this._parentPositions.clear();
|
|
600
606
|
this._boundaryElement = this._rootElement = this._ownerSVGElement = this._placeholderTemplate =
|
|
601
|
-
this._previewTemplate = this._anchor = null;
|
|
607
|
+
this._previewTemplate = this._anchor = this._parentDragRef = null;
|
|
602
608
|
}
|
|
603
609
|
/** Checks whether the element is currently being dragged. */
|
|
604
610
|
isDragging() {
|
|
@@ -782,10 +788,11 @@ class DragRef {
|
|
|
782
788
|
* @param event Browser event object that started the sequence.
|
|
783
789
|
*/
|
|
784
790
|
_initializeDragSequence(referenceElement, event) {
|
|
785
|
-
//
|
|
786
|
-
//
|
|
787
|
-
|
|
788
|
-
|
|
791
|
+
// Stop propagation if the item is inside another
|
|
792
|
+
// draggable so we don't start multiple drag sequences.
|
|
793
|
+
if (this._parentDragRef) {
|
|
794
|
+
event.stopPropagation();
|
|
795
|
+
}
|
|
789
796
|
const isDragging = this.isDragging();
|
|
790
797
|
const isTouchSequence = isTouchEvent(event);
|
|
791
798
|
const isAuxiliaryMouseButton = !isTouchSequence && event.button !== 0;
|
|
@@ -1404,11 +1411,6 @@ const DROP_PROXIMITY_THRESHOLD = 0.05;
|
|
|
1404
1411
|
* viewport. The value comes from trying it out manually until it feels right.
|
|
1405
1412
|
*/
|
|
1406
1413
|
const SCROLL_PROXIMITY_THRESHOLD = 0.05;
|
|
1407
|
-
/**
|
|
1408
|
-
* Number of pixels to scroll for each frame when auto-scrolling an element.
|
|
1409
|
-
* The value comes from trying it out manually until it feels right.
|
|
1410
|
-
*/
|
|
1411
|
-
const AUTO_SCROLL_STEP = 2;
|
|
1412
1414
|
/**
|
|
1413
1415
|
* Reference to a drop list. Used to manipulate or dispose of the container.
|
|
1414
1416
|
*/
|
|
@@ -1426,6 +1428,8 @@ class DropListRef {
|
|
|
1426
1428
|
* moves their pointer close to the edges is disabled.
|
|
1427
1429
|
*/
|
|
1428
1430
|
this.autoScrollDisabled = false;
|
|
1431
|
+
/** Number of pixels to scroll for each frame when auto-scrolling an element. */
|
|
1432
|
+
this.autoScrollStep = 2;
|
|
1429
1433
|
/**
|
|
1430
1434
|
* Function that is used to determine whether an item
|
|
1431
1435
|
* is allowed to be moved into a drop container.
|
|
@@ -1458,6 +1462,8 @@ class DropListRef {
|
|
|
1458
1462
|
* overlap with the swapped item after the swapping occurred.
|
|
1459
1463
|
*/
|
|
1460
1464
|
this._previousSwap = { drag: null, delta: 0, overlaps: false };
|
|
1465
|
+
/** Draggable items in the container. */
|
|
1466
|
+
this._draggables = [];
|
|
1461
1467
|
/** Drop lists that are connected to the current one. */
|
|
1462
1468
|
this._siblings = [];
|
|
1463
1469
|
/** Direction in which the list is oriented. */
|
|
@@ -1483,17 +1489,18 @@ class DropListRef {
|
|
|
1483
1489
|
.pipe(takeUntil(this._stopScrollTimers))
|
|
1484
1490
|
.subscribe(() => {
|
|
1485
1491
|
const node = this._scrollNode;
|
|
1492
|
+
const scrollStep = this.autoScrollStep;
|
|
1486
1493
|
if (this._verticalScrollDirection === 1 /* UP */) {
|
|
1487
|
-
incrementVerticalScroll(node, -
|
|
1494
|
+
incrementVerticalScroll(node, -scrollStep);
|
|
1488
1495
|
}
|
|
1489
1496
|
else if (this._verticalScrollDirection === 2 /* DOWN */) {
|
|
1490
|
-
incrementVerticalScroll(node,
|
|
1497
|
+
incrementVerticalScroll(node, scrollStep);
|
|
1491
1498
|
}
|
|
1492
1499
|
if (this._horizontalScrollDirection === 1 /* LEFT */) {
|
|
1493
|
-
incrementHorizontalScroll(node, -
|
|
1500
|
+
incrementHorizontalScroll(node, -scrollStep);
|
|
1494
1501
|
}
|
|
1495
1502
|
else if (this._horizontalScrollDirection === 2 /* RIGHT */) {
|
|
1496
|
-
incrementHorizontalScroll(node,
|
|
1503
|
+
incrementHorizontalScroll(node, scrollStep);
|
|
1497
1504
|
}
|
|
1498
1505
|
});
|
|
1499
1506
|
};
|
|
@@ -1524,18 +1531,8 @@ class DropListRef {
|
|
|
1524
1531
|
}
|
|
1525
1532
|
/** Starts dragging an item. */
|
|
1526
1533
|
start() {
|
|
1527
|
-
|
|
1528
|
-
this.
|
|
1529
|
-
this._isDragging = true;
|
|
1530
|
-
// We need to disable scroll snapping while the user is dragging, because it breaks automatic
|
|
1531
|
-
// scrolling. The browser seems to round the value based on the snapping points which means
|
|
1532
|
-
// that we can't increment/decrement the scroll position.
|
|
1533
|
-
this._initialScrollSnap = styles.msScrollSnapType || styles.scrollSnapType || '';
|
|
1534
|
-
styles.scrollSnapType = styles.msScrollSnapType = 'none';
|
|
1535
|
-
this._cacheItems();
|
|
1536
|
-
this._siblings.forEach(sibling => sibling._startReceiving(this));
|
|
1537
|
-
this._viewportScrollSubscription.unsubscribe();
|
|
1538
|
-
this._listenToScrollEvents();
|
|
1534
|
+
this._draggingStarted();
|
|
1535
|
+
this._notifyReceivingSiblings();
|
|
1539
1536
|
}
|
|
1540
1537
|
/**
|
|
1541
1538
|
* Emits an event to indicate that the user moved an item into the container.
|
|
@@ -1546,7 +1543,7 @@ class DropListRef {
|
|
|
1546
1543
|
* out automatically.
|
|
1547
1544
|
*/
|
|
1548
1545
|
enter(item, pointerX, pointerY, index) {
|
|
1549
|
-
this.
|
|
1546
|
+
this._draggingStarted();
|
|
1550
1547
|
// If sorting is disabled, we want the item to return to its starting
|
|
1551
1548
|
// position if the user is returning it to its initial container.
|
|
1552
1549
|
let newIndex;
|
|
@@ -1598,6 +1595,8 @@ class DropListRef {
|
|
|
1598
1595
|
// but we need to refresh them since the amount of items has changed and also parent rects.
|
|
1599
1596
|
this._cacheItemPositions();
|
|
1600
1597
|
this._cacheParentPositions();
|
|
1598
|
+
// Notify siblings at the end so that the item has been inserted into the `activeDraggables`.
|
|
1599
|
+
this._notifyReceivingSiblings();
|
|
1601
1600
|
this.entered.next({ item, container: this, currentIndex: this.getItemIndex(item) });
|
|
1602
1601
|
}
|
|
1603
1602
|
/**
|
|
@@ -1720,7 +1719,7 @@ class DropListRef {
|
|
|
1720
1719
|
*/
|
|
1721
1720
|
_sortItem(item, pointerX, pointerY, pointerDelta) {
|
|
1722
1721
|
// Don't sort the item if sorting is disabled or it's out of range.
|
|
1723
|
-
if (this.sortingDisabled ||
|
|
1722
|
+
if (this.sortingDisabled || !this._clientRect ||
|
|
1724
1723
|
!isPointerNearClientRect(this._clientRect, DROP_PROXIMITY_THRESHOLD, pointerX, pointerY)) {
|
|
1725
1724
|
return;
|
|
1726
1725
|
}
|
|
@@ -1834,6 +1833,20 @@ class DropListRef {
|
|
|
1834
1833
|
_stopScrolling() {
|
|
1835
1834
|
this._stopScrollTimers.next();
|
|
1836
1835
|
}
|
|
1836
|
+
/** Starts the dragging sequence within the list. */
|
|
1837
|
+
_draggingStarted() {
|
|
1838
|
+
const styles = coerceElement(this.element).style;
|
|
1839
|
+
this.beforeStarted.next();
|
|
1840
|
+
this._isDragging = true;
|
|
1841
|
+
// We need to disable scroll snapping while the user is dragging, because it breaks automatic
|
|
1842
|
+
// scrolling. The browser seems to round the value based on the snapping points which means
|
|
1843
|
+
// that we can't increment/decrement the scroll position.
|
|
1844
|
+
this._initialScrollSnap = styles.msScrollSnapType || styles.scrollSnapType || '';
|
|
1845
|
+
styles.scrollSnapType = styles.msScrollSnapType = 'none';
|
|
1846
|
+
this._cacheItems();
|
|
1847
|
+
this._viewportScrollSubscription.unsubscribe();
|
|
1848
|
+
this._listenToScrollEvents();
|
|
1849
|
+
}
|
|
1837
1850
|
/** Caches the positions of the configured scrollable parents. */
|
|
1838
1851
|
_cacheParentPositions() {
|
|
1839
1852
|
const element = coerceElement(this.element);
|
|
@@ -1987,7 +2000,7 @@ class DropListRef {
|
|
|
1987
2000
|
* @param y Pointer position along the Y axis.
|
|
1988
2001
|
*/
|
|
1989
2002
|
_isOverContainer(x, y) {
|
|
1990
|
-
return isInsideClientRect(this._clientRect, x, y);
|
|
2003
|
+
return this._clientRect != null && isInsideClientRect(this._clientRect, x, y);
|
|
1991
2004
|
}
|
|
1992
2005
|
/**
|
|
1993
2006
|
* Figures out whether an item should be moved into a sibling
|
|
@@ -2006,7 +2019,8 @@ class DropListRef {
|
|
|
2006
2019
|
* @param y Position of the item along the Y axis.
|
|
2007
2020
|
*/
|
|
2008
2021
|
_canReceive(item, x, y) {
|
|
2009
|
-
if (!isInsideClientRect(this._clientRect, x, y) ||
|
|
2022
|
+
if (!this._clientRect || !isInsideClientRect(this._clientRect, x, y) ||
|
|
2023
|
+
!this.enterPredicate(item, this)) {
|
|
2010
2024
|
return false;
|
|
2011
2025
|
}
|
|
2012
2026
|
const elementFromPoint = this._getShadowRoot().elementFromPoint(x, y);
|
|
@@ -2028,9 +2042,15 @@ class DropListRef {
|
|
|
2028
2042
|
* Called by one of the connected drop lists when a dragging sequence has started.
|
|
2029
2043
|
* @param sibling Sibling in which dragging has started.
|
|
2030
2044
|
*/
|
|
2031
|
-
_startReceiving(sibling) {
|
|
2045
|
+
_startReceiving(sibling, items) {
|
|
2032
2046
|
const activeSiblings = this._activeSiblings;
|
|
2033
|
-
if (!activeSiblings.has(sibling)
|
|
2047
|
+
if (!activeSiblings.has(sibling) && items.every(item => {
|
|
2048
|
+
// Note that we have to add an exception to the `enterPredicate` for items that started off
|
|
2049
|
+
// in this drop list. The drag ref has logic that allows an item to return to its initial
|
|
2050
|
+
// container, if it has left the initial container and none of the connected containers
|
|
2051
|
+
// allow it to enter. See `DragRef._updateActiveDropContainer` for more context.
|
|
2052
|
+
return this.enterPredicate(item, this) || this._draggables.indexOf(item) > -1;
|
|
2053
|
+
})) {
|
|
2034
2054
|
activeSiblings.add(sibling);
|
|
2035
2055
|
this._cacheParentPositions();
|
|
2036
2056
|
this._listenToScrollEvents();
|
|
@@ -2089,6 +2109,11 @@ class DropListRef {
|
|
|
2089
2109
|
}
|
|
2090
2110
|
return this._cachedShadowRoot;
|
|
2091
2111
|
}
|
|
2112
|
+
/** Notifies any siblings that may potentially receive the item. */
|
|
2113
|
+
_notifyReceivingSiblings() {
|
|
2114
|
+
const draggedItems = this._activeDraggables.filter(item => item.isDragging());
|
|
2115
|
+
this._siblings.forEach(sibling => sibling._startReceiving(this, draggedItems));
|
|
2116
|
+
}
|
|
2092
2117
|
}
|
|
2093
2118
|
/**
|
|
2094
2119
|
* Finds the index of an item that matches a predicate function. Used as an equivalent
|
|
@@ -2234,9 +2259,14 @@ class DragDropRegistry {
|
|
|
2234
2259
|
/** Registered drag item instances. */
|
|
2235
2260
|
this._dragInstances = new Set();
|
|
2236
2261
|
/** Drag item instances that are currently being dragged. */
|
|
2237
|
-
this._activeDragInstances =
|
|
2262
|
+
this._activeDragInstances = [];
|
|
2238
2263
|
/** Keeps track of the event listeners that we've bound to the `document`. */
|
|
2239
2264
|
this._globalListeners = new Map();
|
|
2265
|
+
/**
|
|
2266
|
+
* Predicate function to check if an item is being dragged. Moved out into a property,
|
|
2267
|
+
* because it'll be called a lot and we don't want to create a new function every time.
|
|
2268
|
+
*/
|
|
2269
|
+
this._draggingPredicate = (item) => item.isDragging();
|
|
2240
2270
|
/**
|
|
2241
2271
|
* Emits the `touchmove` or `mousemove` events that are dispatched
|
|
2242
2272
|
* while the user is dragging a drag item instance.
|
|
@@ -2254,14 +2284,19 @@ class DragDropRegistry {
|
|
|
2254
2284
|
* @param event Event whose default action should be prevented.
|
|
2255
2285
|
*/
|
|
2256
2286
|
this._preventDefaultWhileDragging = (event) => {
|
|
2257
|
-
if (this._activeDragInstances.
|
|
2287
|
+
if (this._activeDragInstances.length > 0) {
|
|
2258
2288
|
event.preventDefault();
|
|
2259
2289
|
}
|
|
2260
2290
|
};
|
|
2261
2291
|
/** Event listener for `touchmove` that is bound even if no dragging is happening. */
|
|
2262
2292
|
this._persistentTouchmoveListener = (event) => {
|
|
2263
|
-
if (this._activeDragInstances.
|
|
2264
|
-
|
|
2293
|
+
if (this._activeDragInstances.length > 0) {
|
|
2294
|
+
// Note that we only want to prevent the default action after dragging has actually started.
|
|
2295
|
+
// Usually this is the same time at which the item is added to the `_activeDragInstances`,
|
|
2296
|
+
// but it could be pushed back if the user has set up a drag delay or threshold.
|
|
2297
|
+
if (this._activeDragInstances.some(this._draggingPredicate)) {
|
|
2298
|
+
event.preventDefault();
|
|
2299
|
+
}
|
|
2265
2300
|
this.pointerMove.next(event);
|
|
2266
2301
|
}
|
|
2267
2302
|
};
|
|
@@ -2306,11 +2341,11 @@ class DragDropRegistry {
|
|
|
2306
2341
|
*/
|
|
2307
2342
|
startDragging(drag, event) {
|
|
2308
2343
|
// Do not process the same drag twice to avoid memory leaks and redundant listeners
|
|
2309
|
-
if (this._activeDragInstances.
|
|
2344
|
+
if (this._activeDragInstances.indexOf(drag) > -1) {
|
|
2310
2345
|
return;
|
|
2311
2346
|
}
|
|
2312
|
-
this._activeDragInstances.
|
|
2313
|
-
if (this._activeDragInstances.
|
|
2347
|
+
this._activeDragInstances.push(drag);
|
|
2348
|
+
if (this._activeDragInstances.length === 1) {
|
|
2314
2349
|
const isTouchEvent = event.type.startsWith('touch');
|
|
2315
2350
|
// We explicitly bind __active__ listeners here, because newer browsers will default to
|
|
2316
2351
|
// passive ones for `mousemove` and `touchmove`. The events need to be active, because we
|
|
@@ -2351,14 +2386,17 @@ class DragDropRegistry {
|
|
|
2351
2386
|
}
|
|
2352
2387
|
/** Stops dragging a drag item instance. */
|
|
2353
2388
|
stopDragging(drag) {
|
|
2354
|
-
this._activeDragInstances.
|
|
2355
|
-
if (
|
|
2356
|
-
this.
|
|
2389
|
+
const index = this._activeDragInstances.indexOf(drag);
|
|
2390
|
+
if (index > -1) {
|
|
2391
|
+
this._activeDragInstances.splice(index, 1);
|
|
2392
|
+
if (this._activeDragInstances.length === 0) {
|
|
2393
|
+
this._clearGlobalListeners();
|
|
2394
|
+
}
|
|
2357
2395
|
}
|
|
2358
2396
|
}
|
|
2359
2397
|
/** Gets whether a drag item instance is currently being dragged. */
|
|
2360
2398
|
isDragging(drag) {
|
|
2361
|
-
return this._activeDragInstances.
|
|
2399
|
+
return this._activeDragInstances.indexOf(drag) > -1;
|
|
2362
2400
|
}
|
|
2363
2401
|
ngOnDestroy() {
|
|
2364
2402
|
this._dragInstances.forEach(instance => this.removeDragItem(instance));
|
|
@@ -2710,6 +2748,7 @@ class CdkDropList {
|
|
|
2710
2748
|
ref.lockAxis = this.lockAxis;
|
|
2711
2749
|
ref.sortingDisabled = coerceBooleanProperty(this.sortingDisabled);
|
|
2712
2750
|
ref.autoScrollDisabled = coerceBooleanProperty(this.autoScrollDisabled);
|
|
2751
|
+
ref.autoScrollStep = coerceNumberProperty(this.autoScrollStep, 2);
|
|
2713
2752
|
ref
|
|
2714
2753
|
.connectedTo(siblings.filter(drop => drop && drop !== this).map(list => list._dropListRef))
|
|
2715
2754
|
.withOrientation(this.orientation);
|
|
@@ -2814,6 +2853,7 @@ CdkDropList.propDecorators = {
|
|
|
2814
2853
|
enterPredicate: [{ type: Input, args: ['cdkDropListEnterPredicate',] }],
|
|
2815
2854
|
sortPredicate: [{ type: Input, args: ['cdkDropListSortPredicate',] }],
|
|
2816
2855
|
autoScrollDisabled: [{ type: Input, args: ['cdkDropListAutoScrollDisabled',] }],
|
|
2856
|
+
autoScrollStep: [{ type: Input, args: ['cdkDropListAutoScrollStep',] }],
|
|
2817
2857
|
dropped: [{ type: Output, args: ['cdkDropListDropped',] }],
|
|
2818
2858
|
entered: [{ type: Output, args: ['cdkDropListEntered',] }],
|
|
2819
2859
|
exited: [{ type: Output, args: ['cdkDropListExited',] }],
|
|
@@ -2954,6 +2994,7 @@ CdkDragPreview.propDecorators = {
|
|
|
2954
2994
|
* Use of this source code is governed by an MIT-style license that can be
|
|
2955
2995
|
* found in the LICENSE file at https://angular.io/license
|
|
2956
2996
|
*/
|
|
2997
|
+
const DRAG_HOST_CLASS = 'cdk-drag';
|
|
2957
2998
|
/** Element that can be moved inside a CdkDropList container. */
|
|
2958
2999
|
class CdkDrag {
|
|
2959
3000
|
constructor(
|
|
@@ -2965,7 +3006,7 @@ class CdkDrag {
|
|
|
2965
3006
|
* @deprecated `_document` parameter no longer being used and will be removed.
|
|
2966
3007
|
* @breaking-change 12.0.0
|
|
2967
3008
|
*/
|
|
2968
|
-
_document, _ngZone, _viewContainerRef, config, _dir, dragDrop, _changeDetectorRef, _selfHandle) {
|
|
3009
|
+
_document, _ngZone, _viewContainerRef, config, _dir, dragDrop, _changeDetectorRef, _selfHandle, _parentDrag) {
|
|
2969
3010
|
this.element = element;
|
|
2970
3011
|
this.dropContainer = dropContainer;
|
|
2971
3012
|
this._ngZone = _ngZone;
|
|
@@ -2973,6 +3014,7 @@ class CdkDrag {
|
|
|
2973
3014
|
this._dir = _dir;
|
|
2974
3015
|
this._changeDetectorRef = _changeDetectorRef;
|
|
2975
3016
|
this._selfHandle = _selfHandle;
|
|
3017
|
+
this._parentDrag = _parentDrag;
|
|
2976
3018
|
this._destroyed = new Subject();
|
|
2977
3019
|
/** Emits when the user starts dragging the item. */
|
|
2978
3020
|
this.started = new EventEmitter();
|
|
@@ -3007,9 +3049,13 @@ class CdkDrag {
|
|
|
3007
3049
|
config.dragStartThreshold : 5,
|
|
3008
3050
|
pointerDirectionChangeThreshold: config && config.pointerDirectionChangeThreshold != null ?
|
|
3009
3051
|
config.pointerDirectionChangeThreshold : 5,
|
|
3010
|
-
zIndex: config === null || config === void 0 ? void 0 : config.zIndex
|
|
3052
|
+
zIndex: config === null || config === void 0 ? void 0 : config.zIndex,
|
|
3011
3053
|
});
|
|
3012
3054
|
this._dragRef.data = this;
|
|
3055
|
+
// We have to keep track of the drag instances in order to be able to match an element to
|
|
3056
|
+
// a drag instance. We can't go through the global registry of `DragRef`, because the root
|
|
3057
|
+
// element could be different.
|
|
3058
|
+
CdkDrag._dragInstances.push(this);
|
|
3013
3059
|
if (config) {
|
|
3014
3060
|
this._assignDefaults(config);
|
|
3015
3061
|
}
|
|
@@ -3113,6 +3159,10 @@ class CdkDrag {
|
|
|
3113
3159
|
if (this.dropContainer) {
|
|
3114
3160
|
this.dropContainer.removeItem(this);
|
|
3115
3161
|
}
|
|
3162
|
+
const index = CdkDrag._dragInstances.indexOf(this);
|
|
3163
|
+
if (index > -1) {
|
|
3164
|
+
CdkDrag._dragInstances.splice(index, -1);
|
|
3165
|
+
}
|
|
3116
3166
|
this._destroyed.next();
|
|
3117
3167
|
this._destroyed.complete();
|
|
3118
3168
|
this._dragRef.dispose();
|
|
@@ -3175,6 +3225,28 @@ class CdkDrag {
|
|
|
3175
3225
|
}
|
|
3176
3226
|
}
|
|
3177
3227
|
});
|
|
3228
|
+
// This only needs to be resolved once.
|
|
3229
|
+
ref.beforeStarted.pipe(take(1)).subscribe(() => {
|
|
3230
|
+
var _a, _b;
|
|
3231
|
+
// If we managed to resolve a parent through DI, use it.
|
|
3232
|
+
if (this._parentDrag) {
|
|
3233
|
+
ref.withParent(this._parentDrag._dragRef);
|
|
3234
|
+
return;
|
|
3235
|
+
}
|
|
3236
|
+
// Otherwise fall back to resolving the parent by looking up the DOM. This can happen if
|
|
3237
|
+
// the item was projected into another item by something like `ngTemplateOutlet`.
|
|
3238
|
+
let parent = this.element.nativeElement.parentElement;
|
|
3239
|
+
while (parent) {
|
|
3240
|
+
// `classList` needs to be null checked, because IE doesn't have it on some elements.
|
|
3241
|
+
if ((_a = parent.classList) === null || _a === void 0 ? void 0 : _a.contains(DRAG_HOST_CLASS)) {
|
|
3242
|
+
ref.withParent(((_b = CdkDrag._dragInstances.find(drag => {
|
|
3243
|
+
return drag.element.nativeElement === parent;
|
|
3244
|
+
})) === null || _b === void 0 ? void 0 : _b._dragRef) || null);
|
|
3245
|
+
break;
|
|
3246
|
+
}
|
|
3247
|
+
parent = parent.parentElement;
|
|
3248
|
+
}
|
|
3249
|
+
});
|
|
3178
3250
|
}
|
|
3179
3251
|
/** Handles the events from the underlying `DragRef`. */
|
|
3180
3252
|
_handleEvents(ref) {
|
|
@@ -3240,12 +3312,13 @@ class CdkDrag {
|
|
|
3240
3312
|
}
|
|
3241
3313
|
}
|
|
3242
3314
|
}
|
|
3315
|
+
CdkDrag._dragInstances = [];
|
|
3243
3316
|
CdkDrag.decorators = [
|
|
3244
3317
|
{ type: Directive, args: [{
|
|
3245
3318
|
selector: '[cdkDrag]',
|
|
3246
3319
|
exportAs: 'cdkDrag',
|
|
3247
3320
|
host: {
|
|
3248
|
-
'class':
|
|
3321
|
+
'class': DRAG_HOST_CLASS,
|
|
3249
3322
|
'[class.cdk-drag-disabled]': 'disabled',
|
|
3250
3323
|
'[class.cdk-drag-dragging]': '_dragRef.isDragging()',
|
|
3251
3324
|
},
|
|
@@ -3262,7 +3335,8 @@ CdkDrag.ctorParameters = () => [
|
|
|
3262
3335
|
{ type: Directionality, decorators: [{ type: Optional }] },
|
|
3263
3336
|
{ type: DragDrop },
|
|
3264
3337
|
{ type: ChangeDetectorRef },
|
|
3265
|
-
{ type: CdkDragHandle, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [CDK_DRAG_HANDLE,] }] }
|
|
3338
|
+
{ type: CdkDragHandle, decorators: [{ type: Optional }, { type: Self }, { type: Inject, args: [CDK_DRAG_HANDLE,] }] },
|
|
3339
|
+
{ type: CdkDrag, decorators: [{ type: Optional }, { type: SkipSelf }, { type: Inject, args: [CDK_DRAG_PARENT,] }] }
|
|
3266
3340
|
];
|
|
3267
3341
|
CdkDrag.propDecorators = {
|
|
3268
3342
|
_handles: [{ type: ContentChildren, args: [CDK_DRAG_HANDLE, { descendants: true },] }],
|