-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: move clipboard module into cdk (#17272)
Moves the `clipboard` module into CDK stable, sets up the API goldens, adjusts some APIs to be more consistent and sets up a live example.
- Loading branch information
Showing
23 changed files
with
137 additions
and
27 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ CDK_ENTRYPOINTS = [ | |
"a11y", | ||
"accordion", | ||
"bidi", | ||
"clipboard", | ||
"coercion", | ||
"collections", | ||
"drag-drop", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package(default_visibility = ["//visibility:public"]) | ||
|
||
load("//tools:defaults.bzl", "ng_module") | ||
|
||
ng_module( | ||
name = "clipboard", | ||
srcs = glob(["**/*.ts"]), | ||
assets = glob([ | ||
"**/*.html", | ||
"**/*.css", | ||
]), | ||
module_name = "@angular/material-examples/cdk/clipboard", | ||
deps = [ | ||
"//src/cdk/clipboard", | ||
"@npm//@angular/forms", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "source-files", | ||
srcs = glob([ | ||
"*/*.html", | ||
"*/*.css", | ||
"*/*.ts", | ||
]), | ||
) |
4 changes: 4 additions & 0 deletions
4
...material-examples/cdk/clipboard/cdk-clipboard-overview/cdk-clipboard-overview-example.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
textarea { | ||
display: block; | ||
margin: 4px 0 8px; | ||
} |
3 changes: 3 additions & 0 deletions
3
...aterial-examples/cdk/clipboard/cdk-clipboard-overview/cdk-clipboard-overview-example.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<label for="clipboard-example-textarea">Text to be copied</label> | ||
<textarea id="clipboard-example-textarea" cols="30" rows="10" [(ngModel)]="value"></textarea> | ||
<button [cdkCopyToClipboard]="value">Copy to clipboard</button> |
21 changes: 21 additions & 0 deletions
21
src/material-examples/cdk/clipboard/cdk-clipboard-overview/cdk-clipboard-overview-example.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import {Component} from '@angular/core'; | ||
|
||
/** | ||
* @title Clipboard overview | ||
*/ | ||
@Component({ | ||
selector: 'cdk-clipboard-overview-example', | ||
templateUrl: 'cdk-clipboard-overview-example.html', | ||
styleUrls: ['cdk-clipboard-overview-example.css'], | ||
}) | ||
export class CdkClipboardOverviewExample { | ||
value = `Did you ever hear the tragedy of Darth Plagueis The Wise? I thought not. It's not ` + | ||
`a story the Jedi would tell you. It's a Sith legend. Darth Plagueis was a Dark Lord ` + | ||
`of the Sith, so powerful and so wise he could use the Force to influence the ` + | ||
`midichlorians to create life… He had such a knowledge of the dark side that he could ` + | ||
`even keep the ones he cared about from dying. The dark side of the Force is a pathway ` + | ||
`to many abilities some consider to be unnatural. He became so powerful… the only ` + | ||
`thing he was afraid of was losing his power, which eventually, of course, he did. ` + | ||
`Unfortunately, he taught his apprentice everything he knew, then his apprentice ` + | ||
`killed him in his sleep. Ironic. He could save others from death, but not himself.`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {NgModule} from '@angular/core'; | ||
import {FormsModule} from '@angular/forms'; | ||
import {ClipboardModule} from '@angular/cdk/clipboard'; | ||
import {CdkClipboardOverviewExample} from './cdk-clipboard-overview/cdk-clipboard-overview-example'; | ||
|
||
export {CdkClipboardOverviewExample}; | ||
|
||
const EXAMPLES = [CdkClipboardOverviewExample]; | ||
|
||
@NgModule({ | ||
imports: [ClipboardModule, FormsModule], | ||
declarations: EXAMPLES, | ||
exports: EXAMPLES, | ||
}) | ||
export class CdkClipboardExamplesModule { | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export declare class CdkCopyToClipboard { | ||
copied: EventEmitter<boolean>; | ||
text: string; | ||
constructor(_clipboard: Clipboard); | ||
copy(): void; | ||
} | ||
|
||
export declare class Clipboard { | ||
constructor(document: any); | ||
beginCopy(text: string): PendingCopy; | ||
copy(text: string): boolean; | ||
} | ||
|
||
export declare class ClipboardModule { | ||
} | ||
|
||
export declare class PendingCopy { | ||
constructor(text: string, _document: Document); | ||
copy(): boolean; | ||
destroy(): void; | ||
} |