1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | import { coerceBooleanProperty } from '@angular/cdk/coercion';
|
---|
9 | import { Directive, InjectionToken, Input, TemplateRef } from '@angular/core';
|
---|
10 | /**
|
---|
11 | * Injection token that can be used to reference instances of `CdkDragPreview`. It serves as
|
---|
12 | * alternative token to the actual `CdkDragPreview` class which could cause unnecessary
|
---|
13 | * retention of the class and its directive metadata.
|
---|
14 | */
|
---|
15 | export const CDK_DRAG_PREVIEW = new InjectionToken('CdkDragPreview');
|
---|
16 | /**
|
---|
17 | * Element that will be used as a template for the preview
|
---|
18 | * of a CdkDrag when it is being dragged.
|
---|
19 | */
|
---|
20 | export class CdkDragPreview {
|
---|
21 | constructor(templateRef) {
|
---|
22 | this.templateRef = templateRef;
|
---|
23 | this._matchSize = false;
|
---|
24 | }
|
---|
25 | /** Whether the preview should preserve the same size as the item that is being dragged. */
|
---|
26 | get matchSize() { return this._matchSize; }
|
---|
27 | set matchSize(value) { this._matchSize = coerceBooleanProperty(value); }
|
---|
28 | }
|
---|
29 | CdkDragPreview.decorators = [
|
---|
30 | { type: Directive, args: [{
|
---|
31 | selector: 'ng-template[cdkDragPreview]',
|
---|
32 | providers: [{ provide: CDK_DRAG_PREVIEW, useExisting: CdkDragPreview }],
|
---|
33 | },] }
|
---|
34 | ];
|
---|
35 | CdkDragPreview.ctorParameters = () => [
|
---|
36 | { type: TemplateRef }
|
---|
37 | ];
|
---|
38 | CdkDragPreview.propDecorators = {
|
---|
39 | data: [{ type: Input }],
|
---|
40 | matchSize: [{ type: Input }]
|
---|
41 | };
|
---|
42 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHJhZy1wcmV2aWV3LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOls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