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 { EventEmitter, NgZone, InjectionToken, OnDestroy } from '@angular/core';
|
---|
9 | import { Clipboard } from './clipboard';
|
---|
10 | /** Object that can be used to configure the default options for `CdkCopyToClipboard`. */
|
---|
11 | export interface CdkCopyToClipboardConfig {
|
---|
12 | /** Default number of attempts to make when copying text to the clipboard. */
|
---|
13 | attempts?: number;
|
---|
14 | }
|
---|
15 | /** Injection token that can be used to provide the default options to `CdkCopyToClipboard`. */
|
---|
16 | export declare const CDK_COPY_TO_CLIPBOARD_CONFIG: InjectionToken<CdkCopyToClipboardConfig>;
|
---|
17 | /**
|
---|
18 | * @deprecated Use `CDK_COPY_TO_CLIPBOARD_CONFIG` instead.
|
---|
19 | * @breaking-change 13.0.0
|
---|
20 | */
|
---|
21 | export declare const CKD_COPY_TO_CLIPBOARD_CONFIG: InjectionToken<CdkCopyToClipboardConfig>;
|
---|
22 | /**
|
---|
23 | * Provides behavior for a button that when clicked copies content into user's
|
---|
24 | * clipboard.
|
---|
25 | */
|
---|
26 | export declare class CdkCopyToClipboard implements OnDestroy {
|
---|
27 | private _clipboard;
|
---|
28 | private _ngZone;
|
---|
29 | /** Content to be copied. */
|
---|
30 | text: string;
|
---|
31 | /**
|
---|
32 | * How many times to attempt to copy the text. This may be necessary for longer text, because
|
---|
33 | * the browser needs time to fill an intermediate textarea element and copy the content.
|
---|
34 | */
|
---|
35 | attempts: number;
|
---|
36 | /**
|
---|
37 | * Emits when some text is copied to the clipboard. The
|
---|
38 | * emitted value indicates whether copying was successful.
|
---|
39 | */
|
---|
40 | readonly copied: EventEmitter<boolean>;
|
---|
41 | /** Copies that are currently being attempted. */
|
---|
42 | private _pending;
|
---|
43 | /** Whether the directive has been destroyed. */
|
---|
44 | private _destroyed;
|
---|
45 | /** Timeout for the current copy attempt. */
|
---|
46 | private _currentTimeout;
|
---|
47 | constructor(_clipboard: Clipboard, _ngZone: NgZone, config?: CdkCopyToClipboardConfig);
|
---|
48 | /** Copies the current text to the clipboard. */
|
---|
49 | copy(attempts?: number): void;
|
---|
50 | ngOnDestroy(): void;
|
---|
51 | }
|
---|