@angular/cdk 21.0.0-next.9 → 21.0.0-rc.0
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/_adev_assets/cdk_drag_drop.json +13 -12
- package/_adev_assets/cdk_testing.json +9 -9
- package/_adev_assets/cdk_testing_protractor.json +1 -1
- package/_adev_assets/cdk_testing_selenium_webdriver.json +1 -1
- package/_adev_assets/cdk_testing_testbed.json +1 -1
- package/fesm2022/_a11y-module-chunk.mjs +755 -869
- package/fesm2022/_a11y-module-chunk.mjs.map +1 -1
- package/fesm2022/_activedescendant-key-manager-chunk.mjs +8 -8
- package/fesm2022/_activedescendant-key-manager-chunk.mjs.map +1 -1
- package/fesm2022/_array-chunk.mjs +1 -1
- package/fesm2022/_array-chunk.mjs.map +1 -1
- package/fesm2022/_breakpoints-observer-chunk.mjs +149 -152
- package/fesm2022/_breakpoints-observer-chunk.mjs.map +1 -1
- package/fesm2022/_css-pixel-value-chunk.mjs +4 -5
- package/fesm2022/_css-pixel-value-chunk.mjs.map +1 -1
- package/fesm2022/_data-source-chunk.mjs +2 -8
- package/fesm2022/_data-source-chunk.mjs.map +1 -1
- package/fesm2022/_directionality-chunk.mjs +54 -54
- package/fesm2022/_directionality-chunk.mjs.map +1 -1
- package/fesm2022/_dispose-view-repeater-strategy-chunk.mjs +25 -36
- package/fesm2022/_dispose-view-repeater-strategy-chunk.mjs.map +1 -1
- package/fesm2022/_element-chunk.mjs +6 -17
- package/fesm2022/_element-chunk.mjs.map +1 -1
- package/fesm2022/_fake-event-detection-chunk.mjs +3 -17
- package/fesm2022/_fake-event-detection-chunk.mjs.map +1 -1
- package/fesm2022/_focus-key-manager-chunk.mjs +10 -14
- package/fesm2022/_focus-key-manager-chunk.mjs.map +1 -1
- package/fesm2022/_focus-monitor-chunk.mjs +376 -566
- package/fesm2022/_focus-monitor-chunk.mjs.map +1 -1
- package/fesm2022/_id-generator-chunk.mjs +36 -27
- package/fesm2022/_id-generator-chunk.mjs.map +1 -1
- package/fesm2022/_keycodes-chunk.mjs +9 -9
- package/fesm2022/_keycodes-chunk.mjs.map +1 -1
- package/fesm2022/_list-key-manager-chunk.mjs +248 -336
- package/fesm2022/_list-key-manager-chunk.mjs.map +1 -1
- package/fesm2022/_overlay-module-chunk.mjs +2534 -2948
- package/fesm2022/_overlay-module-chunk.mjs.map +1 -1
- package/fesm2022/_passive-listeners-chunk.mjs +10 -22
- package/fesm2022/_passive-listeners-chunk.mjs.map +1 -1
- package/fesm2022/_platform-chunk.mjs +42 -65
- package/fesm2022/_platform-chunk.mjs.map +1 -1
- package/fesm2022/_recycle-view-repeater-strategy-chunk.mjs +78 -134
- package/fesm2022/_recycle-view-repeater-strategy-chunk.mjs.map +1 -1
- package/fesm2022/_scrolling-chunk.mjs +44 -85
- package/fesm2022/_scrolling-chunk.mjs.map +1 -1
- package/fesm2022/_selection-model-chunk.mjs +138 -209
- package/fesm2022/_selection-model-chunk.mjs.map +1 -1
- package/fesm2022/_shadow-dom-chunk.mjs +21 -35
- package/fesm2022/_shadow-dom-chunk.mjs.map +1 -1
- package/fesm2022/_style-loader-chunk.mjs +50 -37
- package/fesm2022/_style-loader-chunk.mjs.map +1 -1
- package/fesm2022/_test-environment-chunk.mjs +2 -14
- package/fesm2022/_test-environment-chunk.mjs.map +1 -1
- package/fesm2022/_tree-key-manager-chunk.mjs +229 -308
- package/fesm2022/_tree-key-manager-chunk.mjs.map +1 -1
- package/fesm2022/_typeahead-chunk.mjs +52 -74
- package/fesm2022/_typeahead-chunk.mjs.map +1 -1
- package/fesm2022/_unique-selection-dispatcher-chunk.mjs +43 -40
- package/fesm2022/_unique-selection-dispatcher-chunk.mjs.map +1 -1
- package/fesm2022/a11y.mjs +351 -449
- package/fesm2022/a11y.mjs.map +1 -1
- package/fesm2022/accordion.mjs +254 -192
- package/fesm2022/accordion.mjs.map +1 -1
- package/fesm2022/bidi.mjs +121 -64
- package/fesm2022/bidi.mjs.map +1 -1
- package/fesm2022/cdk.mjs +1 -2
- package/fesm2022/cdk.mjs.map +1 -1
- package/fesm2022/clipboard.mjs +208 -186
- package/fesm2022/clipboard.mjs.map +1 -1
- package/fesm2022/coercion-private.mjs +4 -8
- package/fesm2022/coercion-private.mjs.map +1 -1
- package/fesm2022/coercion.mjs +11 -29
- package/fesm2022/coercion.mjs.map +1 -1
- package/fesm2022/dialog.mjs +660 -808
- package/fesm2022/dialog.mjs.map +1 -1
- package/fesm2022/drag-drop.mjs +3347 -4286
- package/fesm2022/drag-drop.mjs.map +1 -1
- package/fesm2022/keycodes.mjs +4 -8
- package/fesm2022/keycodes.mjs.map +1 -1
- package/fesm2022/layout.mjs +44 -26
- package/fesm2022/layout.mjs.map +1 -1
- package/fesm2022/listbox.mjs +841 -895
- package/fesm2022/listbox.mjs.map +1 -1
- package/fesm2022/menu.mjs +1942 -1858
- package/fesm2022/menu.mjs.map +1 -1
- package/fesm2022/observers-private.mjs +88 -106
- package/fesm2022/observers-private.mjs.map +1 -1
- package/fesm2022/observers.mjs +262 -184
- package/fesm2022/observers.mjs.map +1 -1
- package/fesm2022/overlay.mjs +72 -68
- package/fesm2022/overlay.mjs.map +1 -1
- package/fesm2022/platform.mjs +43 -54
- package/fesm2022/platform.mjs.map +1 -1
- package/fesm2022/portal.mjs +402 -560
- package/fesm2022/portal.mjs.map +1 -1
- package/fesm2022/private.mjs +38 -10
- package/fesm2022/private.mjs.map +1 -1
- package/fesm2022/scrolling.mjs +1323 -1400
- package/fesm2022/scrolling.mjs.map +1 -1
- package/fesm2022/stepper.mjs +758 -590
- package/fesm2022/stepper.mjs.map +1 -1
- package/fesm2022/table.mjs +2327 -2319
- package/fesm2022/table.mjs.map +1 -1
- package/fesm2022/testing-selenium-webdriver.mjs +252 -325
- package/fesm2022/testing-selenium-webdriver.mjs.map +1 -1
- package/fesm2022/testing-testbed.mjs +592 -709
- package/fesm2022/testing-testbed.mjs.map +1 -1
- package/fesm2022/testing.mjs +368 -889
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/text-field.mjs +459 -388
- package/fesm2022/text-field.mjs.map +1 -1
- package/fesm2022/tree.mjs +1483 -1731
- package/fesm2022/tree.mjs.map +1 -1
- package/overlay/_index.scss +28 -0
- package/overlay-prebuilt.css +1 -1
- package/package.json +1 -1
- package/schematics/ng-add/index.js +1 -1
- package/types/_overlay-module-chunk.d.ts +59 -7
- package/types/_portal-directives-chunk.d.ts +2 -18
- package/types/accordion.d.ts +3 -1
- package/types/dialog.d.ts +1 -1
- package/types/overlay.d.ts +6 -2
- package/types/portal.d.ts +1 -1
package/fesm2022/bidi.mjs
CHANGED
|
@@ -3,76 +3,133 @@ export { DIR_DOCUMENT } from './_directionality-chunk.mjs';
|
|
|
3
3
|
import * as i0 from '@angular/core';
|
|
4
4
|
import { EventEmitter, signal, Directive, Output, Input, NgModule } from '@angular/core';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Directive to listen for changes of direction of part of the DOM.
|
|
8
|
-
*
|
|
9
|
-
* Provides itself as Directionality such that descendant directives only need to ever inject
|
|
10
|
-
* Directionality to get the closest direction.
|
|
11
|
-
*/
|
|
12
6
|
class Dir {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
_isInitialized = false;
|
|
8
|
+
_rawDir;
|
|
9
|
+
change = new EventEmitter();
|
|
10
|
+
get dir() {
|
|
11
|
+
return this.valueSignal();
|
|
12
|
+
}
|
|
13
|
+
set dir(value) {
|
|
14
|
+
const previousValue = this.valueSignal();
|
|
15
|
+
this.valueSignal.set(_resolveDirectionality(value));
|
|
16
|
+
this._rawDir = value;
|
|
17
|
+
if (previousValue !== this.valueSignal() && this._isInitialized) {
|
|
18
|
+
this.change.emit(this.valueSignal());
|
|
22
19
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
20
|
+
}
|
|
21
|
+
get value() {
|
|
22
|
+
return this.dir;
|
|
23
|
+
}
|
|
24
|
+
valueSignal = signal('ltr', ...(ngDevMode ? [{
|
|
25
|
+
debugName: "valueSignal"
|
|
26
|
+
}] : []));
|
|
27
|
+
ngAfterContentInit() {
|
|
28
|
+
this._isInitialized = true;
|
|
29
|
+
}
|
|
30
|
+
ngOnDestroy() {
|
|
31
|
+
this.change.complete();
|
|
32
|
+
}
|
|
33
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
34
|
+
minVersion: "12.0.0",
|
|
35
|
+
version: "20.2.0-next.2",
|
|
36
|
+
ngImport: i0,
|
|
37
|
+
type: Dir,
|
|
38
|
+
deps: [],
|
|
39
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
40
|
+
});
|
|
41
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
42
|
+
minVersion: "14.0.0",
|
|
43
|
+
version: "20.2.0-next.2",
|
|
44
|
+
type: Dir,
|
|
45
|
+
isStandalone: true,
|
|
46
|
+
selector: "[dir]",
|
|
47
|
+
inputs: {
|
|
48
|
+
dir: "dir"
|
|
49
|
+
},
|
|
50
|
+
outputs: {
|
|
51
|
+
change: "dirChange"
|
|
52
|
+
},
|
|
53
|
+
host: {
|
|
54
|
+
properties: {
|
|
55
|
+
"attr.dir": "_rawDir"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
providers: [{
|
|
59
|
+
provide: Directionality,
|
|
60
|
+
useExisting: Dir
|
|
61
|
+
}],
|
|
62
|
+
exportAs: ["dir"],
|
|
63
|
+
ngImport: i0
|
|
64
|
+
});
|
|
48
65
|
}
|
|
49
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
67
|
+
minVersion: "12.0.0",
|
|
68
|
+
version: "20.2.0-next.2",
|
|
69
|
+
ngImport: i0,
|
|
70
|
+
type: Dir,
|
|
71
|
+
decorators: [{
|
|
72
|
+
type: Directive,
|
|
73
|
+
args: [{
|
|
74
|
+
selector: '[dir]',
|
|
75
|
+
providers: [{
|
|
76
|
+
provide: Directionality,
|
|
77
|
+
useExisting: Dir
|
|
78
|
+
}],
|
|
79
|
+
host: {
|
|
80
|
+
'[attr.dir]': '_rawDir'
|
|
81
|
+
},
|
|
82
|
+
exportAs: 'dir'
|
|
83
|
+
}]
|
|
84
|
+
}],
|
|
85
|
+
propDecorators: {
|
|
86
|
+
change: [{
|
|
87
|
+
type: Output,
|
|
88
|
+
args: ['dirChange']
|
|
89
|
+
}],
|
|
90
|
+
dir: [{
|
|
91
|
+
type: Input
|
|
92
|
+
}]
|
|
93
|
+
}
|
|
94
|
+
});
|
|
63
95
|
|
|
64
96
|
class BidiModule {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
97
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
98
|
+
minVersion: "12.0.0",
|
|
99
|
+
version: "20.2.0-next.2",
|
|
100
|
+
ngImport: i0,
|
|
101
|
+
type: BidiModule,
|
|
102
|
+
deps: [],
|
|
103
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
104
|
+
});
|
|
105
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
106
|
+
minVersion: "14.0.0",
|
|
107
|
+
version: "20.2.0-next.2",
|
|
108
|
+
ngImport: i0,
|
|
109
|
+
type: BidiModule,
|
|
110
|
+
imports: [Dir],
|
|
111
|
+
exports: [Dir]
|
|
112
|
+
});
|
|
113
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
114
|
+
minVersion: "12.0.0",
|
|
115
|
+
version: "20.2.0-next.2",
|
|
116
|
+
ngImport: i0,
|
|
117
|
+
type: BidiModule
|
|
118
|
+
});
|
|
68
119
|
}
|
|
69
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
120
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
121
|
+
minVersion: "12.0.0",
|
|
122
|
+
version: "20.2.0-next.2",
|
|
123
|
+
ngImport: i0,
|
|
124
|
+
type: BidiModule,
|
|
125
|
+
decorators: [{
|
|
126
|
+
type: NgModule,
|
|
127
|
+
args: [{
|
|
128
|
+
imports: [Dir],
|
|
129
|
+
exports: [Dir]
|
|
130
|
+
}]
|
|
131
|
+
}]
|
|
132
|
+
});
|
|
76
133
|
|
|
77
134
|
export { BidiModule, Dir, Directionality };
|
|
78
135
|
//# sourceMappingURL=bidi.mjs.map
|
package/fesm2022/bidi.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bidi.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/cdk/bidi/dir.ts","../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/cdk/bidi/bidi-module.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.dev/license\n */\n\nimport {\n AfterContentInit,\n Directive,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n signal,\n} from '@angular/core';\n\nimport {Direction, Directionality, _resolveDirectionality} 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 /** 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') readonly change = new EventEmitter<Direction>();\n\n /** @docs-private */\n @Input()\n get dir(): Direction {\n return this.valueSignal();\n }\n set dir(value: Direction | 'auto') {\n const previousValue = this.valueSignal();\n\n // Note: `_resolveDirectionality` resolves the language based on the browser's language,\n // whereas the browser does it based on the content of the element. Since doing so based\n // on the content can be expensive, for now we're doing the simpler matching.\n this.valueSignal.set(_resolveDirectionality(value));\n this._rawDir = value;\n\n if (previousValue !== this.valueSignal() && this._isInitialized) {\n this.change.emit(this.valueSignal());\n }\n }\n\n /** Current layout direction of the element. */\n get value(): Direction {\n return this.dir;\n }\n\n readonly valueSignal = signal<Direction>('ltr');\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 * @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.dev/license\n */\n\nimport {NgModule} from '@angular/core';\nimport {Dir} from './dir';\n\n@NgModule({\n imports: [Dir],\n exports: [Dir],\n})\nexport class BidiModule {}\n"],"names":[
|
|
1
|
+
{"version":3,"file":"bidi.mjs","sources":["../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/cdk/bidi/dir.ts","../../../../../darwin_arm64-fastbuild-ST-199a4f3c4e20/bin/src/cdk/bidi/bidi-module.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.dev/license\n */\n\nimport {\n AfterContentInit,\n Directive,\n EventEmitter,\n Input,\n OnDestroy,\n Output,\n signal,\n} from '@angular/core';\n\nimport {Direction, Directionality, _resolveDirectionality} 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 /** 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') readonly change = new EventEmitter<Direction>();\n\n /** @docs-private */\n @Input()\n get dir(): Direction {\n return this.valueSignal();\n }\n set dir(value: Direction | 'auto') {\n const previousValue = this.valueSignal();\n\n // Note: `_resolveDirectionality` resolves the language based on the browser's language,\n // whereas the browser does it based on the content of the element. Since doing so based\n // on the content can be expensive, for now we're doing the simpler matching.\n this.valueSignal.set(_resolveDirectionality(value));\n this._rawDir = value;\n\n if (previousValue !== this.valueSignal() && this._isInitialized) {\n this.change.emit(this.valueSignal());\n }\n }\n\n /** Current layout direction of the element. */\n get value(): Direction {\n return this.dir;\n }\n\n readonly valueSignal = signal<Direction>('ltr');\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 * @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.dev/license\n */\n\nimport {NgModule} from '@angular/core';\nimport {Dir} from './dir';\n\n@NgModule({\n imports: [Dir],\n exports: [Dir],\n})\nexport class BidiModule {}\n"],"names":["valueSignal","dir","value","_isInitialized","change","emit","ngDevMode","debugName","Output","minVersion","version","ngImport","i0","type","BidiModule","decorators"],"mappings":";;;;;;;;;;AAgEE,IAAA,OAAA,IAAA,CAAAA,WAAA,EAAA;;SAKkBC,CAAAC,KAAA,EAAA;;;;qBA3CV,KAAA,IAAA,CAAAF,WAAA,EAAA,IAAA,IAAA,CAAAG,cAAA,EAAA;MAAC,IAAA,CAAAC,MAAA,CAAAC,IAAA,KAAA,CAAAL,WAAA,EAAA,CAAA;;;AAKVE,EAAAA,IAAAA,KAAAA,GAAA;;;sBAaQ,CAAA,KAAA,EAAAI,IAAAA,SAAA,GAAA,CAAA;IAAAC,SAAA,EAAA;AAAA,GAAA,CAAA,GAAA,EAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAUL,EAAA;IAAAH,MAAA,EAAA,CAAA;AAAA,MAAA,IAAA,EAAAI,MAAA;YAEI,CAAA,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BC7CC,CAAA;EAAAC,UAAA,EAAA,QAAA;EAAAC,OAAA,EAAA,eAAA;AAAAC,EAAAA,QAAA,EAAAC,EAAA;AAAAC,EAAAA,IAAA,EAAAC,UAAA;EAAAC,UAAA,EAAA,CAAA;;;;;;;;;;;"}
|
package/fesm2022/cdk.mjs
CHANGED
package/fesm2022/cdk.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdk.mjs","sources":[
|
|
1
|
+
{"version":3,"file":"cdk.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
package/fesm2022/clipboard.mjs
CHANGED
|
@@ -1,210 +1,232 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, DOCUMENT, Injectable, InjectionToken, NgZone, EventEmitter, Directive, Input, Output, NgModule } from '@angular/core';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* A pending copy-to-clipboard operation.
|
|
6
|
-
*
|
|
7
|
-
* The implementation of copying text to the clipboard modifies the DOM and
|
|
8
|
-
* forces a re-layout. This re-layout can take too long if the string is large,
|
|
9
|
-
* causing the execCommand('copy') to happen too long after the user clicked.
|
|
10
|
-
* This results in the browser refusing to copy. This object lets the
|
|
11
|
-
* re-layout happen in a separate tick from copying by providing a copy function
|
|
12
|
-
* that can be called later.
|
|
13
|
-
*
|
|
14
|
-
* Destroy must be called when no longer in use, regardless of whether `copy` is
|
|
15
|
-
* called.
|
|
16
|
-
*/
|
|
17
4
|
class PendingCopy {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// Older browsers could throw if copy is not supported.
|
|
44
|
-
if (textarea) {
|
|
45
|
-
const currentFocus = this._document.activeElement;
|
|
46
|
-
textarea.select();
|
|
47
|
-
textarea.setSelectionRange(0, textarea.value.length);
|
|
48
|
-
successful = this._document.execCommand('copy');
|
|
49
|
-
if (currentFocus) {
|
|
50
|
-
currentFocus.focus();
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
// Discard error.
|
|
56
|
-
// Initial setting of {@code successful} will represent failure here.
|
|
57
|
-
}
|
|
58
|
-
return successful;
|
|
59
|
-
}
|
|
60
|
-
/** Cleans up DOM changes used to perform the copy operation. */
|
|
61
|
-
destroy() {
|
|
62
|
-
const textarea = this._textarea;
|
|
63
|
-
if (textarea) {
|
|
64
|
-
textarea.remove();
|
|
65
|
-
this._textarea = undefined;
|
|
5
|
+
_document;
|
|
6
|
+
_textarea;
|
|
7
|
+
constructor(text, _document) {
|
|
8
|
+
this._document = _document;
|
|
9
|
+
const textarea = this._textarea = this._document.createElement('textarea');
|
|
10
|
+
const styles = textarea.style;
|
|
11
|
+
styles.position = 'fixed';
|
|
12
|
+
styles.top = styles.opacity = '0';
|
|
13
|
+
styles.left = '-999em';
|
|
14
|
+
textarea.setAttribute('aria-hidden', 'true');
|
|
15
|
+
textarea.value = text;
|
|
16
|
+
textarea.readOnly = true;
|
|
17
|
+
(this._document.fullscreenElement || this._document.body).appendChild(textarea);
|
|
18
|
+
}
|
|
19
|
+
copy() {
|
|
20
|
+
const textarea = this._textarea;
|
|
21
|
+
let successful = false;
|
|
22
|
+
try {
|
|
23
|
+
if (textarea) {
|
|
24
|
+
const currentFocus = this._document.activeElement;
|
|
25
|
+
textarea.select();
|
|
26
|
+
textarea.setSelectionRange(0, textarea.value.length);
|
|
27
|
+
successful = this._document.execCommand('copy');
|
|
28
|
+
if (currentFocus) {
|
|
29
|
+
currentFocus.focus();
|
|
66
30
|
}
|
|
31
|
+
}
|
|
32
|
+
} catch {}
|
|
33
|
+
return successful;
|
|
34
|
+
}
|
|
35
|
+
destroy() {
|
|
36
|
+
const textarea = this._textarea;
|
|
37
|
+
if (textarea) {
|
|
38
|
+
textarea.remove();
|
|
39
|
+
this._textarea = undefined;
|
|
67
40
|
}
|
|
41
|
+
}
|
|
68
42
|
}
|
|
69
43
|
|
|
70
|
-
/**
|
|
71
|
-
* A service for copying text to the clipboard.
|
|
72
|
-
*/
|
|
73
44
|
class Clipboard {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Clipboard, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
101
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.2.0-next.2", ngImport: i0, type: Clipboard, providedIn: 'root' });
|
|
45
|
+
_document = inject(DOCUMENT);
|
|
46
|
+
constructor() {}
|
|
47
|
+
copy(text) {
|
|
48
|
+
const pendingCopy = this.beginCopy(text);
|
|
49
|
+
const successful = pendingCopy.copy();
|
|
50
|
+
pendingCopy.destroy();
|
|
51
|
+
return successful;
|
|
52
|
+
}
|
|
53
|
+
beginCopy(text) {
|
|
54
|
+
return new PendingCopy(text, this._document);
|
|
55
|
+
}
|
|
56
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
57
|
+
minVersion: "12.0.0",
|
|
58
|
+
version: "20.2.0-next.2",
|
|
59
|
+
ngImport: i0,
|
|
60
|
+
type: Clipboard,
|
|
61
|
+
deps: [],
|
|
62
|
+
target: i0.ɵɵFactoryTarget.Injectable
|
|
63
|
+
});
|
|
64
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({
|
|
65
|
+
minVersion: "12.0.0",
|
|
66
|
+
version: "20.2.0-next.2",
|
|
67
|
+
ngImport: i0,
|
|
68
|
+
type: Clipboard,
|
|
69
|
+
providedIn: 'root'
|
|
70
|
+
});
|
|
102
71
|
}
|
|
103
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
72
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
73
|
+
minVersion: "12.0.0",
|
|
74
|
+
version: "20.2.0-next.2",
|
|
75
|
+
ngImport: i0,
|
|
76
|
+
type: Clipboard,
|
|
77
|
+
decorators: [{
|
|
78
|
+
type: Injectable,
|
|
79
|
+
args: [{
|
|
80
|
+
providedIn: 'root'
|
|
81
|
+
}]
|
|
82
|
+
}],
|
|
83
|
+
ctorParameters: () => []
|
|
84
|
+
});
|
|
107
85
|
|
|
108
|
-
/** Injection token that can be used to provide the default options to `CdkCopyToClipboard`. */
|
|
109
86
|
const CDK_COPY_TO_CLIPBOARD_CONFIG = new InjectionToken('CDK_COPY_TO_CLIPBOARD_CONFIG');
|
|
110
|
-
/**
|
|
111
|
-
* Provides behavior for a button that when clicked copies content into user's
|
|
112
|
-
* clipboard.
|
|
113
|
-
*/
|
|
114
87
|
class CdkCopyToClipboard {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
/** Copies that are currently being attempted. */
|
|
130
|
-
_pending = new Set();
|
|
131
|
-
/** Whether the directive has been destroyed. */
|
|
132
|
-
_destroyed;
|
|
133
|
-
/** Timeout for the current copy attempt. */
|
|
134
|
-
_currentTimeout;
|
|
135
|
-
constructor() {
|
|
136
|
-
const config = inject(CDK_COPY_TO_CLIPBOARD_CONFIG, { optional: true });
|
|
137
|
-
if (config && config.attempts != null) {
|
|
138
|
-
this.attempts = config.attempts;
|
|
139
|
-
}
|
|
88
|
+
_clipboard = inject(Clipboard);
|
|
89
|
+
_ngZone = inject(NgZone);
|
|
90
|
+
text = '';
|
|
91
|
+
attempts = 1;
|
|
92
|
+
copied = new EventEmitter();
|
|
93
|
+
_pending = new Set();
|
|
94
|
+
_destroyed;
|
|
95
|
+
_currentTimeout;
|
|
96
|
+
constructor() {
|
|
97
|
+
const config = inject(CDK_COPY_TO_CLIPBOARD_CONFIG, {
|
|
98
|
+
optional: true
|
|
99
|
+
});
|
|
100
|
+
if (config && config.attempts != null) {
|
|
101
|
+
this.attempts = config.attempts;
|
|
140
102
|
}
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
pending.destroy();
|
|
157
|
-
this.copied.emit(successful);
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
attempt();
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
this.copied.emit(this._clipboard.copy(this.text));
|
|
103
|
+
}
|
|
104
|
+
copy(attempts = this.attempts) {
|
|
105
|
+
if (attempts > 1) {
|
|
106
|
+
let remainingAttempts = attempts;
|
|
107
|
+
const pending = this._clipboard.beginCopy(this.text);
|
|
108
|
+
this._pending.add(pending);
|
|
109
|
+
const attempt = () => {
|
|
110
|
+
const successful = pending.copy();
|
|
111
|
+
if (!successful && --remainingAttempts && !this._destroyed) {
|
|
112
|
+
this._currentTimeout = this._ngZone.runOutsideAngular(() => setTimeout(attempt, 1));
|
|
113
|
+
} else {
|
|
114
|
+
this._currentTimeout = null;
|
|
115
|
+
this._pending.delete(pending);
|
|
116
|
+
pending.destroy();
|
|
117
|
+
this.copied.emit(successful);
|
|
164
118
|
}
|
|
119
|
+
};
|
|
120
|
+
attempt();
|
|
121
|
+
} else {
|
|
122
|
+
this.copied.emit(this._clipboard.copy(this.text));
|
|
165
123
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
this._pending.forEach(copy => copy.destroy());
|
|
171
|
-
this._pending.clear();
|
|
172
|
-
this._destroyed = true;
|
|
124
|
+
}
|
|
125
|
+
ngOnDestroy() {
|
|
126
|
+
if (this._currentTimeout) {
|
|
127
|
+
clearTimeout(this._currentTimeout);
|
|
173
128
|
}
|
|
174
|
-
|
|
175
|
-
|
|
129
|
+
this._pending.forEach(copy => copy.destroy());
|
|
130
|
+
this._pending.clear();
|
|
131
|
+
this._destroyed = true;
|
|
132
|
+
}
|
|
133
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
134
|
+
minVersion: "12.0.0",
|
|
135
|
+
version: "20.2.0-next.2",
|
|
136
|
+
ngImport: i0,
|
|
137
|
+
type: CdkCopyToClipboard,
|
|
138
|
+
deps: [],
|
|
139
|
+
target: i0.ɵɵFactoryTarget.Directive
|
|
140
|
+
});
|
|
141
|
+
static ɵdir = i0.ɵɵngDeclareDirective({
|
|
142
|
+
minVersion: "14.0.0",
|
|
143
|
+
version: "20.2.0-next.2",
|
|
144
|
+
type: CdkCopyToClipboard,
|
|
145
|
+
isStandalone: true,
|
|
146
|
+
selector: "[cdkCopyToClipboard]",
|
|
147
|
+
inputs: {
|
|
148
|
+
text: ["cdkCopyToClipboard", "text"],
|
|
149
|
+
attempts: ["cdkCopyToClipboardAttempts", "attempts"]
|
|
150
|
+
},
|
|
151
|
+
outputs: {
|
|
152
|
+
copied: "cdkCopyToClipboardCopied"
|
|
153
|
+
},
|
|
154
|
+
host: {
|
|
155
|
+
listeners: {
|
|
156
|
+
"click": "copy()"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
ngImport: i0
|
|
160
|
+
});
|
|
176
161
|
}
|
|
177
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
162
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
163
|
+
minVersion: "12.0.0",
|
|
164
|
+
version: "20.2.0-next.2",
|
|
165
|
+
ngImport: i0,
|
|
166
|
+
type: CdkCopyToClipboard,
|
|
167
|
+
decorators: [{
|
|
168
|
+
type: Directive,
|
|
169
|
+
args: [{
|
|
170
|
+
selector: '[cdkCopyToClipboard]',
|
|
171
|
+
host: {
|
|
172
|
+
'(click)': 'copy()'
|
|
173
|
+
}
|
|
174
|
+
}]
|
|
175
|
+
}],
|
|
176
|
+
ctorParameters: () => [],
|
|
177
|
+
propDecorators: {
|
|
178
|
+
text: [{
|
|
179
|
+
type: Input,
|
|
180
|
+
args: ['cdkCopyToClipboard']
|
|
181
|
+
}],
|
|
182
|
+
attempts: [{
|
|
183
|
+
type: Input,
|
|
184
|
+
args: ['cdkCopyToClipboardAttempts']
|
|
185
|
+
}],
|
|
186
|
+
copied: [{
|
|
187
|
+
type: Output,
|
|
188
|
+
args: ['cdkCopyToClipboardCopied']
|
|
189
|
+
}]
|
|
190
|
+
}
|
|
191
|
+
});
|
|
195
192
|
|
|
196
193
|
class ClipboardModule {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
194
|
+
static ɵfac = i0.ɵɵngDeclareFactory({
|
|
195
|
+
minVersion: "12.0.0",
|
|
196
|
+
version: "20.2.0-next.2",
|
|
197
|
+
ngImport: i0,
|
|
198
|
+
type: ClipboardModule,
|
|
199
|
+
deps: [],
|
|
200
|
+
target: i0.ɵɵFactoryTarget.NgModule
|
|
201
|
+
});
|
|
202
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({
|
|
203
|
+
minVersion: "14.0.0",
|
|
204
|
+
version: "20.2.0-next.2",
|
|
205
|
+
ngImport: i0,
|
|
206
|
+
type: ClipboardModule,
|
|
207
|
+
imports: [CdkCopyToClipboard],
|
|
208
|
+
exports: [CdkCopyToClipboard]
|
|
209
|
+
});
|
|
210
|
+
static ɵinj = i0.ɵɵngDeclareInjector({
|
|
211
|
+
minVersion: "12.0.0",
|
|
212
|
+
version: "20.2.0-next.2",
|
|
213
|
+
ngImport: i0,
|
|
214
|
+
type: ClipboardModule
|
|
215
|
+
});
|
|
200
216
|
}
|
|
201
|
-
i0.ɵɵngDeclareClassMetadata({
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
217
|
+
i0.ɵɵngDeclareClassMetadata({
|
|
218
|
+
minVersion: "12.0.0",
|
|
219
|
+
version: "20.2.0-next.2",
|
|
220
|
+
ngImport: i0,
|
|
221
|
+
type: ClipboardModule,
|
|
222
|
+
decorators: [{
|
|
223
|
+
type: NgModule,
|
|
224
|
+
args: [{
|
|
225
|
+
imports: [CdkCopyToClipboard],
|
|
226
|
+
exports: [CdkCopyToClipboard]
|
|
227
|
+
}]
|
|
228
|
+
}]
|
|
229
|
+
});
|
|
208
230
|
|
|
209
231
|
export { CDK_COPY_TO_CLIPBOARD_CONFIG, CdkCopyToClipboard, Clipboard, ClipboardModule, PendingCopy };
|
|
210
232
|
//# sourceMappingURL=clipboard.mjs.map
|