source: trip-planner-front/node_modules/@angular/cdk/esm2015/drag-drop/directives/drag-handle.js@ bdd6491

Last change on this file since bdd6491 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 6.8 KB
Line 
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 */
8import { coerceBooleanProperty } from '@angular/cdk/coercion';
9import { Directive, ElementRef, Inject, InjectionToken, Input, Optional, SkipSelf, } from '@angular/core';
10import { Subject } from 'rxjs';
11import { CDK_DRAG_PARENT } from '../drag-parent';
12import { assertElementNode } from './assertions';
13/**
14 * Injection token that can be used to reference instances of `CdkDragHandle`. It serves as
15 * alternative token to the actual `CdkDragHandle` class which could cause unnecessary
16 * retention of the class and its directive metadata.
17 */
18export const CDK_DRAG_HANDLE = new InjectionToken('CdkDragHandle');
19/** Handle that can be used to drag a CdkDrag instance. */
20export class CdkDragHandle {
21 constructor(element, parentDrag) {
22 this.element = element;
23 /** Emits when the state of the handle has changed. */
24 this._stateChanges = new Subject();
25 this._disabled = false;
26 if (typeof ngDevMode === 'undefined' || ngDevMode) {
27 assertElementNode(element.nativeElement, 'cdkDragHandle');
28 }
29 this._parentDrag = parentDrag;
30 }
31 /** Whether starting to drag through this handle is disabled. */
32 get disabled() { return this._disabled; }
33 set disabled(value) {
34 this._disabled = coerceBooleanProperty(value);
35 this._stateChanges.next(this);
36 }
37 ngOnDestroy() {
38 this._stateChanges.complete();
39 }
40}
41CdkDragHandle.decorators = [
42 { type: Directive, args: [{
43 selector: '[cdkDragHandle]',
44 host: {
45 'class': 'cdk-drag-handle'
46 },
47 providers: [{ provide: CDK_DRAG_HANDLE, useExisting: CdkDragHandle }],
48 },] }
49];
50CdkDragHandle.ctorParameters = () => [
51 { type: ElementRef },
52 { type: undefined, decorators: [{ type: Inject, args: [CDK_DRAG_PARENT,] }, { type: Optional }, { type: SkipSelf }] }
53];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