@angular/cdk 8.0.0-beta.2 → 8.0.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/README.md +2 -2
- package/_overlay.scss +4 -4
- package/bundles/cdk-a11y.umd.js +227 -79
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +1 -1
- package/bundles/cdk-a11y.umd.min.js.map +1 -1
- package/bundles/cdk-accordion.umd.js +20 -8
- package/bundles/cdk-accordion.umd.js.map +1 -1
- package/bundles/cdk-accordion.umd.min.js.map +1 -1
- package/bundles/cdk-bidi.umd.js +5 -5
- package/bundles/cdk-bidi.umd.min.js +1 -1
- package/bundles/cdk-bidi.umd.min.js.map +1 -1
- package/bundles/cdk-coercion.umd.js +5 -5
- package/bundles/cdk-collections.umd.js +38 -15
- package/bundles/cdk-collections.umd.js.map +1 -1
- package/bundles/cdk-collections.umd.min.js +1 -1
- package/bundles/cdk-collections.umd.min.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.js +571 -180
- package/bundles/cdk-drag-drop.umd.js.map +1 -1
- package/bundles/cdk-drag-drop.umd.min.js +2 -2
- package/bundles/cdk-drag-drop.umd.min.js.map +1 -1
- package/bundles/cdk-keycodes.umd.js +7 -3
- package/bundles/cdk-keycodes.umd.js.map +1 -1
- package/bundles/cdk-keycodes.umd.min.js.map +1 -1
- package/bundles/cdk-layout.umd.js +83 -30
- package/bundles/cdk-layout.umd.js.map +1 -1
- package/bundles/cdk-layout.umd.min.js +1 -1
- package/bundles/cdk-layout.umd.min.js.map +1 -1
- package/bundles/cdk-observers.umd.js +30 -11
- package/bundles/cdk-observers.umd.js.map +1 -1
- package/bundles/cdk-observers.umd.min.js +1 -1
- package/bundles/cdk-observers.umd.min.js.map +1 -1
- package/bundles/cdk-overlay.umd.js +229 -108
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +2 -2
- package/bundles/cdk-overlay.umd.min.js.map +1 -1
- package/bundles/cdk-platform.umd.js +17 -10
- package/bundles/cdk-platform.umd.js.map +1 -1
- package/bundles/cdk-platform.umd.min.js +1 -1
- package/bundles/cdk-platform.umd.min.js.map +1 -1
- package/bundles/cdk-portal.umd.js +32 -13
- package/bundles/cdk-portal.umd.js.map +1 -1
- package/bundles/cdk-portal.umd.min.js.map +1 -1
- package/bundles/cdk-scrolling.umd.js +184 -62
- package/bundles/cdk-scrolling.umd.js.map +1 -1
- package/bundles/cdk-scrolling.umd.min.js +1 -1
- package/bundles/cdk-scrolling.umd.min.js.map +1 -1
- package/bundles/cdk-stepper.umd.js +30 -12
- package/bundles/cdk-stepper.umd.js.map +1 -1
- package/bundles/cdk-stepper.umd.min.js.map +1 -1
- package/bundles/cdk-table.umd.js +384 -74
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +1 -1
- package/bundles/cdk-table.umd.min.js.map +1 -1
- package/bundles/cdk-text-field.umd.js +61 -21
- package/bundles/cdk-text-field.umd.js.map +1 -1
- package/bundles/cdk-text-field.umd.min.js +1 -1
- package/bundles/cdk-text-field.umd.min.js.map +1 -1
- package/bundles/cdk-tree.umd.js +85 -29
- package/bundles/cdk-tree.umd.js.map +1 -1
- package/bundles/cdk-tree.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +2 -2
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +1 -1
- package/bundles/cdk.umd.min.js.map +1 -1
- package/drag-drop/typings/directives/drag.d.ts +11 -2
- package/drag-drop/typings/drag-events.d.ts +17 -0
- package/drag-drop/typings/drag-ref.d.ts +9 -5
- package/drag-drop/typings/drop-list-ref.d.ts +9 -3
- package/drag-drop/typings/index.metadata.json +1 -1
- package/esm2015/a11y.js +229 -81
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/accordion.js +22 -10
- package/esm2015/accordion.js.map +1 -1
- package/esm2015/bidi.js +8 -8
- package/esm2015/cdk.js +4 -4
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/coercion.js +7 -7
- package/esm2015/collections.js +41 -18
- package/esm2015/collections.js.map +1 -1
- package/esm2015/drag-drop.js +540 -181
- package/esm2015/drag-drop.js.map +1 -1
- package/esm2015/keycodes.js +9 -5
- package/esm2015/keycodes.js.map +1 -1
- package/esm2015/layout.js +89 -36
- package/esm2015/layout.js.map +1 -1
- package/esm2015/observers.js +33 -14
- package/esm2015/observers.js.map +1 -1
- package/esm2015/overlay.js +232 -110
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/platform.js +20 -13
- package/esm2015/platform.js.map +1 -1
- package/esm2015/portal.js +34 -15
- package/esm2015/portal.js.map +1 -1
- package/esm2015/scrolling.js +180 -58
- package/esm2015/scrolling.js.map +1 -1
- package/esm2015/stepper.js +32 -14
- package/esm2015/stepper.js.map +1 -1
- package/esm2015/table.js +369 -69
- package/esm2015/table.js.map +1 -1
- package/esm2015/text-field.js +64 -24
- package/esm2015/text-field.js.map +1 -1
- package/esm2015/tree.js +86 -30
- package/esm2015/tree.js.map +1 -1
- package/esm5/a11y.es5.js +230 -82
- package/esm5/a11y.es5.js.map +1 -1
- package/esm5/accordion.es5.js +22 -10
- package/esm5/accordion.es5.js.map +1 -1
- package/esm5/bidi.es5.js +8 -8
- package/esm5/cdk.es5.js +4 -4
- package/esm5/cdk.es5.js.map +1 -1
- package/esm5/coercion.es5.js +7 -7
- package/esm5/collections.es5.js +42 -19
- package/esm5/collections.es5.js.map +1 -1
- package/esm5/drag-drop.es5.js +574 -183
- package/esm5/drag-drop.es5.js.map +1 -1
- package/esm5/keycodes.es5.js +9 -5
- package/esm5/keycodes.es5.js.map +1 -1
- package/esm5/layout.es5.js +86 -33
- package/esm5/layout.es5.js.map +1 -1
- package/esm5/observers.es5.js +33 -14
- package/esm5/observers.es5.js.map +1 -1
- package/esm5/overlay.es5.js +232 -111
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/platform.es5.js +20 -13
- package/esm5/platform.es5.js.map +1 -1
- package/esm5/portal.es5.js +34 -15
- package/esm5/portal.es5.js.map +1 -1
- package/esm5/scrolling.es5.js +187 -65
- package/esm5/scrolling.es5.js.map +1 -1
- package/esm5/stepper.es5.js +32 -14
- package/esm5/stepper.es5.js.map +1 -1
- package/esm5/table.es5.js +386 -72
- package/esm5/table.es5.js.map +1 -1
- package/esm5/text-field.es5.js +64 -24
- package/esm5/text-field.es5.js.map +1 -1
- package/esm5/tree.es5.js +87 -31
- package/esm5/tree.es5.js.map +1 -1
- package/layout/typings/breakpoints-observer.d.ts +3 -3
- package/layout/typings/index.metadata.json +1 -1
- package/layout/typings/media-matcher.d.ts +2 -2
- package/overlay/typings/index.metadata.json +1 -1
- package/overlay/typings/position/flexible-connected-position-strategy.d.ts +1 -3
- package/package.json +8 -8
- package/portal/typings/portal.d.ts +2 -2
- package/schematics/ng-update/data/attribute-selectors.js +1 -1
- package/schematics/ng-update/data/attribute-selectors.js.map +1 -1
- package/schematics/ng-update/data/class-names.js +3 -3
- package/schematics/ng-update/data/class-names.js.map +1 -1
- package/schematics/ng-update/data/constructor-checks.js +1 -1
- package/schematics/ng-update/data/constructor-checks.js.map +1 -1
- package/schematics/ng-update/data/input-names.js +1 -1
- package/schematics/ng-update/data/input-names.js.map +1 -1
- package/schematics/ng-update/data/method-call-checks.js +1 -1
- package/schematics/ng-update/data/method-call-checks.js.map +1 -1
- package/schematics/ng-update/data/property-names.js +4 -4
- package/schematics/ng-update/data/property-names.js.map +1 -1
- package/schematics/ng-update/upgrade-rules/signature-check/constructorSignatureCheckRule.js +1 -1
- package/schematics/ng-update/upgrade-rules/signature-check/constructorSignatureCheckRule.js.map +1 -1
- package/schematics/tsconfig.tsbuildinfo +5811 -0
- package/schematics/utils/ast.d.ts +1 -1
- package/schematics/utils/build-component.js +1 -1
- package/schematics/utils/build-component.js.map +1 -1
- package/schematics/utils/get-project.d.ts +1 -1
- package/schematics/utils/project-main-file.d.ts +1 -1
- package/schematics/utils/project-style-file.d.ts +1 -1
- package/schematics/utils/project-targets.d.ts +1 -1
- package/schematics/utils/schematic-options.d.ts +1 -1
- package/table/typings/cell.d.ts +3 -2
- package/table/typings/index.metadata.json +1 -1
- package/table/typings/public-api.d.ts +1 -0
- package/table/typings/row.d.ts +5 -4
- package/table/typings/sticky-styler.d.ts +5 -5
- package/table/typings/table-errors.d.ts +10 -0
- package/table/typings/text-column.d.ts +80 -0
- package/typings/drag-drop/directives/drag.d.ts +11 -2
- package/typings/drag-drop/drag-events.d.ts +17 -0
- package/typings/drag-drop/drag-ref.d.ts +9 -5
- package/typings/drag-drop/drop-list-ref.d.ts +9 -3
- package/typings/drag-drop/index.metadata.json +1 -1
- package/typings/esm5/drag-drop/directives/drag.d.ts +11 -2
- package/typings/esm5/drag-drop/drag-events.d.ts +17 -0
- package/typings/esm5/drag-drop/drag-ref.d.ts +9 -5
- package/typings/esm5/drag-drop/drop-list-ref.d.ts +9 -3
- package/typings/esm5/drag-drop/index.metadata.json +1 -1
- package/typings/esm5/index.metadata.json +1 -1
- package/typings/esm5/layout/breakpoints-observer.d.ts +3 -3
- package/typings/esm5/layout/index.metadata.json +1 -1
- package/typings/esm5/layout/media-matcher.d.ts +2 -2
- package/typings/esm5/overlay/index.metadata.json +1 -1
- package/typings/esm5/overlay/position/flexible-connected-position-strategy.d.ts +1 -3
- package/typings/esm5/portal/portal.d.ts +2 -2
- package/typings/esm5/table/cell.d.ts +3 -2
- package/typings/esm5/table/index.metadata.json +1 -1
- package/typings/esm5/table/public-api.d.ts +1 -0
- package/typings/esm5/table/row.d.ts +5 -4
- package/typings/esm5/table/sticky-styler.d.ts +5 -5
- package/typings/esm5/table/table-errors.d.ts +10 -0
- package/typings/esm5/table/text-column.d.ts +80 -0
- package/typings/index.metadata.json +1 -1
- package/typings/layout/breakpoints-observer.d.ts +3 -3
- package/typings/layout/index.metadata.json +1 -1
- package/typings/layout/media-matcher.d.ts +2 -2
- package/typings/overlay/index.metadata.json +1 -1
- package/typings/overlay/position/flexible-connected-position-strategy.d.ts +1 -3
- package/typings/portal/portal.d.ts +2 -2
- package/typings/schematics/utils/ast.d.ts +1 -1
- package/typings/schematics/utils/get-project.d.ts +1 -1
- package/typings/schematics/utils/project-main-file.d.ts +1 -1
- package/typings/schematics/utils/project-style-file.d.ts +1 -1
- package/typings/schematics/utils/project-targets.d.ts +1 -1
- package/typings/schematics/utils/schematic-options.d.ts +1 -1
- package/typings/table/cell.d.ts +3 -2
- package/typings/table/index.metadata.json +1 -1
- package/typings/table/public-api.d.ts +1 -0
- package/typings/table/row.d.ts +5 -4
- package/typings/table/sticky-styler.d.ts +5 -5
- package/typings/table/table-errors.d.ts +10 -0
- package/typings/table/text-column.d.ts +80 -0
package/esm5/text-field.es5.js
CHANGED
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
import { Platform, normalizePassiveListenerOptions, PlatformModule } from '@angular/cdk/platform';
|
|
9
|
-
import { Directive, ElementRef, EventEmitter, Injectable, NgZone, Output, Input, NgModule,
|
|
9
|
+
import { Directive, ElementRef, EventEmitter, Injectable, NgZone, Output, Input, NgModule, ɵɵdefineInjectable, ɵɵinject } from '@angular/core';
|
|
10
10
|
import { coerceElement, coerceBooleanProperty } from '@angular/cdk/coercion';
|
|
11
11
|
import { EMPTY, Subject, fromEvent } from 'rxjs';
|
|
12
12
|
import { auditTime, takeUntil } from 'rxjs/operators';
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* @fileoverview added by tsickle
|
|
16
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
16
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
17
17
|
*/
|
|
18
18
|
/**
|
|
19
19
|
* Options to pass to the animationstart listener.
|
|
@@ -56,30 +56,46 @@ var AutofillMonitor = /** @class */ (function () {
|
|
|
56
56
|
/** @type {?} */
|
|
57
57
|
var cssClass = 'cdk-text-field-autofilled';
|
|
58
58
|
/** @type {?} */
|
|
59
|
-
var listener = (/** @type {?} */ ((
|
|
59
|
+
var listener = (/** @type {?} */ (((/**
|
|
60
|
+
* @param {?} event
|
|
61
|
+
* @return {?}
|
|
62
|
+
*/
|
|
63
|
+
function (event) {
|
|
60
64
|
// Animation events fire on initial element render, we check for the presence of the autofill
|
|
61
65
|
// CSS class to make sure this is a real change in state, not just the initial render before
|
|
62
66
|
// we fire off events.
|
|
63
67
|
if (event.animationName === 'cdk-text-field-autofill-start' &&
|
|
64
68
|
!element.classList.contains(cssClass)) {
|
|
65
69
|
element.classList.add(cssClass);
|
|
66
|
-
_this._ngZone.run(
|
|
70
|
+
_this._ngZone.run((/**
|
|
71
|
+
* @return {?}
|
|
72
|
+
*/
|
|
73
|
+
function () { return result.next({ target: (/** @type {?} */ (event.target)), isAutofilled: true }); }));
|
|
67
74
|
}
|
|
68
75
|
else if (event.animationName === 'cdk-text-field-autofill-end' &&
|
|
69
76
|
element.classList.contains(cssClass)) {
|
|
70
77
|
element.classList.remove(cssClass);
|
|
71
|
-
_this._ngZone.run(
|
|
78
|
+
_this._ngZone.run((/**
|
|
79
|
+
* @return {?}
|
|
80
|
+
*/
|
|
81
|
+
function () { return result.next({ target: (/** @type {?} */ (event.target)), isAutofilled: false }); }));
|
|
72
82
|
}
|
|
73
|
-
})));
|
|
74
|
-
this._ngZone.runOutsideAngular(
|
|
83
|
+
}))));
|
|
84
|
+
this._ngZone.runOutsideAngular((/**
|
|
85
|
+
* @return {?}
|
|
86
|
+
*/
|
|
87
|
+
function () {
|
|
75
88
|
element.addEventListener('animationstart', listener, listenerOptions);
|
|
76
89
|
element.classList.add('cdk-text-field-autofill-monitored');
|
|
77
|
-
});
|
|
90
|
+
}));
|
|
78
91
|
this._monitoredElements.set(element, {
|
|
79
92
|
subject: result,
|
|
80
|
-
unlisten:
|
|
93
|
+
unlisten: (/**
|
|
94
|
+
* @return {?}
|
|
95
|
+
*/
|
|
96
|
+
function () {
|
|
81
97
|
element.removeEventListener('animationstart', listener, listenerOptions);
|
|
82
|
-
}
|
|
98
|
+
})
|
|
83
99
|
});
|
|
84
100
|
return result.asObservable();
|
|
85
101
|
};
|
|
@@ -112,7 +128,12 @@ var AutofillMonitor = /** @class */ (function () {
|
|
|
112
128
|
*/
|
|
113
129
|
function () {
|
|
114
130
|
var _this = this;
|
|
115
|
-
this._monitoredElements.forEach(
|
|
131
|
+
this._monitoredElements.forEach((/**
|
|
132
|
+
* @param {?} _info
|
|
133
|
+
* @param {?} element
|
|
134
|
+
* @return {?}
|
|
135
|
+
*/
|
|
136
|
+
function (_info, element) { return _this.stopMonitoring(element); }));
|
|
116
137
|
};
|
|
117
138
|
AutofillMonitor.decorators = [
|
|
118
139
|
{ type: Injectable, args: [{ providedIn: 'root' },] },
|
|
@@ -122,7 +143,7 @@ var AutofillMonitor = /** @class */ (function () {
|
|
|
122
143
|
{ type: Platform },
|
|
123
144
|
{ type: NgZone }
|
|
124
145
|
]; };
|
|
125
|
-
/** @nocollapse */ AutofillMonitor.ngInjectableDef =
|
|
146
|
+
/** @nocollapse */ AutofillMonitor.ngInjectableDef = ɵɵdefineInjectable({ factory: function AutofillMonitor_Factory() { return new AutofillMonitor(ɵɵinject(Platform), ɵɵinject(NgZone)); }, token: AutofillMonitor, providedIn: "root" });
|
|
126
147
|
return AutofillMonitor;
|
|
127
148
|
}());
|
|
128
149
|
/**
|
|
@@ -147,7 +168,11 @@ var CdkAutofill = /** @class */ (function () {
|
|
|
147
168
|
var _this = this;
|
|
148
169
|
this._autofillMonitor
|
|
149
170
|
.monitor(this._elementRef)
|
|
150
|
-
.subscribe(
|
|
171
|
+
.subscribe((/**
|
|
172
|
+
* @param {?} event
|
|
173
|
+
* @return {?}
|
|
174
|
+
*/
|
|
175
|
+
function (event) { return _this.cdkAutofill.emit(event); }));
|
|
151
176
|
};
|
|
152
177
|
/**
|
|
153
178
|
* @return {?}
|
|
@@ -176,7 +201,7 @@ var CdkAutofill = /** @class */ (function () {
|
|
|
176
201
|
|
|
177
202
|
/**
|
|
178
203
|
* @fileoverview added by tsickle
|
|
179
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
204
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
180
205
|
*/
|
|
181
206
|
/**
|
|
182
207
|
* Directive to automatically resize a textarea to fit its content.
|
|
@@ -300,11 +325,17 @@ var CdkTextareaAutosize = /** @class */ (function () {
|
|
|
300
325
|
// Remember the height which we started with in case autosizing is disabled
|
|
301
326
|
this._initialHeight = this._textareaElement.style.height;
|
|
302
327
|
this.resizeToFitContent();
|
|
303
|
-
this._ngZone.runOutsideAngular(
|
|
328
|
+
this._ngZone.runOutsideAngular((/**
|
|
329
|
+
* @return {?}
|
|
330
|
+
*/
|
|
331
|
+
function () {
|
|
304
332
|
fromEvent(window, 'resize')
|
|
305
333
|
.pipe(auditTime(16), takeUntil(_this._destroyed))
|
|
306
|
-
.subscribe(
|
|
307
|
-
|
|
334
|
+
.subscribe((/**
|
|
335
|
+
* @return {?}
|
|
336
|
+
*/
|
|
337
|
+
function () { return _this.resizeToFitContent(true); }));
|
|
338
|
+
}));
|
|
308
339
|
}
|
|
309
340
|
};
|
|
310
341
|
/**
|
|
@@ -439,14 +470,23 @@ var CdkTextareaAutosize = /** @class */ (function () {
|
|
|
439
470
|
textarea.style.height = height + "px";
|
|
440
471
|
textarea.classList.remove('cdk-textarea-autosize-measuring');
|
|
441
472
|
textarea.placeholder = placeholderText;
|
|
442
|
-
this._ngZone.runOutsideAngular(
|
|
473
|
+
this._ngZone.runOutsideAngular((/**
|
|
474
|
+
* @return {?}
|
|
475
|
+
*/
|
|
476
|
+
function () {
|
|
443
477
|
if (typeof requestAnimationFrame !== 'undefined') {
|
|
444
|
-
requestAnimationFrame(
|
|
478
|
+
requestAnimationFrame((/**
|
|
479
|
+
* @return {?}
|
|
480
|
+
*/
|
|
481
|
+
function () { return _this._scrollToCaretPosition(textarea); }));
|
|
445
482
|
}
|
|
446
483
|
else {
|
|
447
|
-
setTimeout(
|
|
484
|
+
setTimeout((/**
|
|
485
|
+
* @return {?}
|
|
486
|
+
*/
|
|
487
|
+
function () { return _this._scrollToCaretPosition(textarea); }));
|
|
448
488
|
}
|
|
449
|
-
});
|
|
489
|
+
}));
|
|
450
490
|
this._previousValue = value;
|
|
451
491
|
this._previousMinRows = this._minRows;
|
|
452
492
|
};
|
|
@@ -540,7 +580,7 @@ var CdkTextareaAutosize = /** @class */ (function () {
|
|
|
540
580
|
|
|
541
581
|
/**
|
|
542
582
|
* @fileoverview added by tsickle
|
|
543
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
583
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
544
584
|
*/
|
|
545
585
|
var TextFieldModule = /** @class */ (function () {
|
|
546
586
|
function TextFieldModule() {
|
|
@@ -557,12 +597,12 @@ var TextFieldModule = /** @class */ (function () {
|
|
|
557
597
|
|
|
558
598
|
/**
|
|
559
599
|
* @fileoverview added by tsickle
|
|
560
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
600
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
561
601
|
*/
|
|
562
602
|
|
|
563
603
|
/**
|
|
564
604
|
* @fileoverview added by tsickle
|
|
565
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
605
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
566
606
|
*/
|
|
567
607
|
|
|
568
608
|
export { AutofillMonitor, CdkAutofill, CdkTextareaAutosize, TextFieldModule };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-field.es5.js","sources":["../../../src/cdk/text-field/text-field-module.ts","../../../src/cdk/text-field/autosize.ts","../../../src/cdk/text-field/autofill.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.io/license\n */\n\nimport {PlatformModule} from '@angular/cdk/platform';\nimport {NgModule} from '@angular/core';\nimport {CdkAutofill} from './autofill';\nimport {CdkTextareaAutosize} from './autosize';\n\n\n@NgModule({\n declarations: [CdkAutofill, CdkTextareaAutosize],\n imports: [PlatformModule],\n exports: [CdkAutofill, CdkTextareaAutosize],\n})\nexport class TextFieldModule {}\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.io/license\n */\n\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n Input,\n AfterViewInit,\n DoCheck,\n OnDestroy,\n NgZone,\n} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\nimport {auditTime, takeUntil} from 'rxjs/operators';\nimport {fromEvent, Subject} from 'rxjs';\n\n\n/** Directive to automatically resize a textarea to fit its content. */\n@Directive({\n selector: 'textarea[cdkTextareaAutosize]',\n exportAs: 'cdkTextareaAutosize',\n host: {\n 'class': 'cdk-textarea-autosize',\n // Textarea elements that have the directive applied should have a single row by default.\n // Browsers normally show two rows by default and therefore this limits the minRows binding.\n 'rows': '1',\n '(input)': '_noopInputHandler()',\n },\n})\nexport class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {\n /** Keep track of the previous textarea value to avoid resizing when the value hasn't changed. */\n private _previousValue?: string;\n private _initialHeight: string | null;\n private readonly _destroyed = new Subject<void>();\n\n private _minRows: number;\n private _maxRows: number;\n private _enabled: boolean = true;\n\n /**\n * Value of minRows as of last resize. If the minRows has decreased, the\n * height of the textarea needs to be recomputed to reflect the new minimum. The maxHeight\n * does not have the same problem because it does not affect the textarea's scrollHeight.\n */\n private _previousMinRows: number = -1;\n\n private _textareaElement: HTMLTextAreaElement;\n\n /** Minimum amount of rows in the textarea. */\n @Input('cdkAutosizeMinRows')\n get minRows(): number { return this._minRows; }\n set minRows(value: number) {\n this._minRows = value;\n this._setMinHeight();\n }\n\n /** Maximum amount of rows in the textarea. */\n @Input('cdkAutosizeMaxRows')\n get maxRows(): number { return this._maxRows; }\n set maxRows(value: number) {\n this._maxRows = value;\n this._setMaxHeight();\n }\n\n /** Whether autosizing is enabled or not */\n @Input('cdkTextareaAutosize')\n get enabled(): boolean { return this._enabled; }\n set enabled(value: boolean) {\n value = coerceBooleanProperty(value);\n\n // Only act if the actual value changed. This specifically helps to not run\n // resizeToFitContent too early (i.e. before ngAfterViewInit)\n if (this._enabled !== value) {\n (this._enabled = value) ? this.resizeToFitContent(true) : this.reset();\n }\n }\n\n /** Cached height of a textarea with a single row. */\n private _cachedLineHeight: number;\n\n constructor(\n private _elementRef: ElementRef<HTMLElement>,\n private _platform: Platform,\n private _ngZone: NgZone) {\n this._textareaElement = this._elementRef.nativeElement as HTMLTextAreaElement;\n }\n\n /** Sets the minimum height of the textarea as determined by minRows. */\n _setMinHeight(): void {\n const minHeight = this.minRows && this._cachedLineHeight ?\n `${this.minRows * this._cachedLineHeight}px` : null;\n\n if (minHeight) {\n this._textareaElement.style.minHeight = minHeight;\n }\n }\n\n /** Sets the maximum height of the textarea as determined by maxRows. */\n _setMaxHeight(): void {\n const maxHeight = this.maxRows && this._cachedLineHeight ?\n `${this.maxRows * this._cachedLineHeight}px` : null;\n\n if (maxHeight) {\n this._textareaElement.style.maxHeight = maxHeight;\n }\n }\n\n ngAfterViewInit() {\n if (this._platform.isBrowser) {\n // Remember the height which we started with in case autosizing is disabled\n this._initialHeight = this._textareaElement.style.height;\n\n this.resizeToFitContent();\n\n this._ngZone.runOutsideAngular(() => {\n fromEvent(window, 'resize')\n .pipe(auditTime(16), takeUntil(this._destroyed))\n .subscribe(() => this.resizeToFitContent(true));\n });\n }\n }\n\n ngOnDestroy() {\n this._destroyed.next();\n this._destroyed.complete();\n }\n\n /**\n * Cache the height of a single-row textarea if it has not already been cached.\n *\n * We need to know how large a single \"row\" of a textarea is in order to apply minRows and\n * maxRows. For the initial version, we will assume that the height of a single line in the\n * textarea does not ever change.\n */\n private _cacheTextareaLineHeight(): void {\n if (this._cachedLineHeight) {\n return;\n }\n\n // Use a clone element because we have to override some styles.\n let textareaClone = this._textareaElement.cloneNode(false) as HTMLTextAreaElement;\n textareaClone.rows = 1;\n\n // Use `position: absolute` so that this doesn't cause a browser layout and use\n // `visibility: hidden` so that nothing is rendered. Clear any other styles that\n // would affect the height.\n textareaClone.style.position = 'absolute';\n textareaClone.style.visibility = 'hidden';\n textareaClone.style.border = 'none';\n textareaClone.style.padding = '0';\n textareaClone.style.height = '';\n textareaClone.style.minHeight = '';\n textareaClone.style.maxHeight = '';\n\n // In Firefox it happens that textarea elements are always bigger than the specified amount\n // of rows. This is because Firefox tries to add extra space for the horizontal scrollbar.\n // As a workaround that removes the extra space for the scrollbar, we can just set overflow\n // to hidden. This ensures that there is no invalid calculation of the line height.\n // See Firefox bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=33654\n textareaClone.style.overflow = 'hidden';\n\n this._textareaElement.parentNode!.appendChild(textareaClone);\n this._cachedLineHeight = textareaClone.clientHeight;\n this._textareaElement.parentNode!.removeChild(textareaClone);\n\n // Min and max heights have to be re-calculated if the cached line height changes\n this._setMinHeight();\n this._setMaxHeight();\n }\n\n ngDoCheck() {\n if (this._platform.isBrowser) {\n this.resizeToFitContent();\n }\n }\n\n /**\n * Resize the textarea to fit its content.\n * @param force Whether to force a height recalculation. By default the height will be\n * recalculated only if the value changed since the last call.\n */\n resizeToFitContent(force: boolean = false) {\n // If autosizing is disabled, just skip everything else\n if (!this._enabled) {\n return;\n }\n\n this._cacheTextareaLineHeight();\n\n // If we haven't determined the line-height yet, we know we're still hidden and there's no point\n // in checking the height of the textarea.\n if (!this._cachedLineHeight) {\n return;\n }\n\n const textarea = this._elementRef.nativeElement as HTMLTextAreaElement;\n const value = textarea.value;\n\n // Only resize if the value or minRows have changed since these calculations can be expensive.\n if (!force && this._minRows === this._previousMinRows && value === this._previousValue) {\n return;\n }\n\n const placeholderText = textarea.placeholder;\n\n // Reset the textarea height to auto in order to shrink back to its default size.\n // Also temporarily force overflow:hidden, so scroll bars do not interfere with calculations.\n // Long placeholders that are wider than the textarea width may lead to a bigger scrollHeight\n // value. To ensure that the scrollHeight is not bigger than the content, the placeholders\n // need to be removed temporarily.\n textarea.classList.add('cdk-textarea-autosize-measuring');\n textarea.placeholder = '';\n\n // The cdk-textarea-autosize-measuring class includes a 2px padding to workaround an issue with\n // Chrome, so we account for that extra space here by subtracting 4 (2px top + 2px bottom).\n const height = textarea.scrollHeight - 4;\n\n // Use the scrollHeight to know how large the textarea *would* be if fit its entire value.\n textarea.style.height = `${height}px`;\n textarea.classList.remove('cdk-textarea-autosize-measuring');\n textarea.placeholder = placeholderText;\n\n this._ngZone.runOutsideAngular(() => {\n if (typeof requestAnimationFrame !== 'undefined') {\n requestAnimationFrame(() => this._scrollToCaretPosition(textarea));\n } else {\n setTimeout(() => this._scrollToCaretPosition(textarea));\n }\n });\n\n this._previousValue = value;\n this._previousMinRows = this._minRows;\n }\n\n /**\n * Resets the textarea to it's original size\n */\n reset() {\n // Do not try to change the textarea, if the initialHeight has not been determined yet\n // This might potentially remove styles when reset() is called before ngAfterViewInit\n if (this._initialHeight === undefined) {\n return;\n }\n this._textareaElement.style.height = this._initialHeight;\n }\n\n _noopInputHandler() {\n // no-op handler that ensures we're running change detection on input events.\n }\n\n /**\n * Scrolls a textarea to the caret position. On Firefox resizing the textarea will\n * prevent it from scrolling to the caret position. We need to re-set the selection\n * in order for it to scroll to the proper position.\n */\n private _scrollToCaretPosition(textarea: HTMLTextAreaElement) {\n const {selectionStart, selectionEnd} = textarea;\n\n // IE will throw an \"Unspecified error\" if we try to set the selection range after the\n // element has been removed from the DOM. Assert that the directive hasn't been destroyed\n // between the time we requested the animation frame and when it was executed.\n // Also note that we have to assert that the textarea is focused before we set the\n // selection range. Setting the selection range on a non-focused textarea will cause\n // it to receive focus on IE and Edge.\n if (!this._destroyed.isStopped && document.activeElement === textarea) {\n textarea.setSelectionRange(selectionStart, selectionEnd);\n }\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.io/license\n */\n\nimport {Platform, normalizePassiveListenerOptions} from '@angular/cdk/platform';\nimport {\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n NgZone,\n OnDestroy,\n OnInit,\n Output,\n} from '@angular/core';\nimport {coerceElement} from '@angular/cdk/coercion';\nimport {EMPTY, Observable, Subject} from 'rxjs';\n\n\n/** An event that is emitted when the autofill state of an input changes. */\nexport type AutofillEvent = {\n /** The element whose autofill state changes. */\n target: Element;\n /** Whether the element is currently autofilled. */\n isAutofilled: boolean;\n};\n\n\n/** Used to track info about currently monitored elements. */\ntype MonitoredElementInfo = {\n subject: Subject<AutofillEvent>;\n unlisten: () => void;\n};\n\n\n/** Options to pass to the animationstart listener. */\nconst listenerOptions = normalizePassiveListenerOptions({passive: true});\n\n\n/**\n * An injectable service that can be used to monitor the autofill state of an input.\n * Based on the following blog post:\n * https://medium.com/@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7\n */\n@Injectable({providedIn: 'root'})\nexport class AutofillMonitor implements OnDestroy {\n private _monitoredElements = new Map<Element, MonitoredElementInfo>();\n\n constructor(private _platform: Platform, private _ngZone: NgZone) {}\n\n /**\n * Monitor for changes in the autofill state of the given input element.\n * @param element The element to monitor.\n * @return A stream of autofill state changes.\n */\n monitor(element: Element): Observable<AutofillEvent>;\n\n /**\n * Monitor for changes in the autofill state of the given input element.\n * @param element The element to monitor.\n * @return A stream of autofill state changes.\n */\n monitor(element: ElementRef<Element>): Observable<AutofillEvent>;\n\n monitor(elementOrRef: Element | ElementRef<Element>): Observable<AutofillEvent> {\n if (!this._platform.isBrowser) {\n return EMPTY;\n }\n\n const element = coerceElement(elementOrRef);\n const info = this._monitoredElements.get(element);\n\n if (info) {\n return info.subject.asObservable();\n }\n\n const result = new Subject<AutofillEvent>();\n const cssClass = 'cdk-text-field-autofilled';\n const listener = ((event: AnimationEvent) => {\n // Animation events fire on initial element render, we check for the presence of the autofill\n // CSS class to make sure this is a real change in state, not just the initial render before\n // we fire off events.\n if (event.animationName === 'cdk-text-field-autofill-start' &&\n !element.classList.contains(cssClass)) {\n element.classList.add(cssClass);\n this._ngZone.run(() => result.next({target: event.target as Element, isAutofilled: true}));\n } else if (event.animationName === 'cdk-text-field-autofill-end' &&\n element.classList.contains(cssClass)) {\n element.classList.remove(cssClass);\n this._ngZone.run(() => result.next({target: event.target as Element, isAutofilled: false}));\n }\n }) as EventListenerOrEventListenerObject;\n\n this._ngZone.runOutsideAngular(() => {\n element.addEventListener('animationstart', listener, listenerOptions);\n element.classList.add('cdk-text-field-autofill-monitored');\n });\n\n this._monitoredElements.set(element, {\n subject: result,\n unlisten: () => {\n element.removeEventListener('animationstart', listener, listenerOptions);\n }\n });\n\n return result.asObservable();\n }\n\n /**\n * Stop monitoring the autofill state of the given input element.\n * @param element The element to stop monitoring.\n */\n stopMonitoring(element: Element): void;\n\n /**\n * Stop monitoring the autofill state of the given input element.\n * @param element The element to stop monitoring.\n */\n stopMonitoring(element: ElementRef<Element>): void;\n\n stopMonitoring(elementOrRef: Element | ElementRef<Element>): void {\n const element = coerceElement(elementOrRef);\n const info = this._monitoredElements.get(element);\n\n if (info) {\n info.unlisten();\n info.subject.complete();\n element.classList.remove('cdk-text-field-autofill-monitored');\n element.classList.remove('cdk-text-field-autofilled');\n this._monitoredElements.delete(element);\n }\n }\n\n ngOnDestroy() {\n this._monitoredElements.forEach((_info, element) => this.stopMonitoring(element));\n }\n}\n\n\n/** A directive that can be used to monitor the autofill state of an input. */\n@Directive({\n selector: '[cdkAutofill]',\n})\nexport class CdkAutofill implements OnDestroy, OnInit {\n /** Emits when the autofill state of the element changes. */\n @Output() cdkAutofill: EventEmitter<AutofillEvent> = new EventEmitter<AutofillEvent>();\n\n constructor(private _elementRef: ElementRef<HTMLElement>,\n private _autofillMonitor: AutofillMonitor) {}\n\n ngOnInit() {\n this._autofillMonitor\n .monitor(this._elementRef)\n .subscribe(event => this.cdkAutofill.emit(event));\n }\n\n ngOnDestroy() {\n this._autofillMonitor.stopMonitoring(this._elementRef);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AEwCA,IAAM,eAAe,GAAG,+BAA+B,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAxE;;;;;;AAQA,AAAA,IAAA,eAAA,kBAAA,YAAA;IAIE,SAAF,eAAA,CAAsB,SAAmB,EAAU,OAAe,EAAlE;QAAsB,IAAtB,CAAA,SAA+B,GAAT,SAAS,CAAU;QAAU,IAAnD,CAAA,OAA0D,GAAP,OAAO,CAAQ;QAFxD,IAAV,CAAA,kBAA4B,GAAG,IAAI,GAAG,EAAiC,CAAC;KAEF;;;;;IAgBpE,eAAF,CAAA,SAAA,CAAA,OAAS;;;;IAAP,UAAQ,YAA2C,EAArD;QAAE,IAAF,KAAA,GAAA,IAAA,CA0CG;QAzCC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE;YAC7B,OAAO,KAAK,CAAC;SACd;;QAEL,IAAU,OAAO,GAAG,aAAa,CAAC,YAAY,CAAC,CAA/C;;QACA,IAAU,IAAI,GAAG,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,CAArD;QAEI,IAAI,IAAI,EAAE;YACR,OAAO,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;SACpC;;QAEL,IAAU,MAAM,GAAG,IAAI,OAAO,EAAiB,CAA/C;;QACA,IAAU,QAAQ,GAAG,2BA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;;;QAuCA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,IAAA,EAAA,CAAS,oBAAoB,EAA7B,EAAA,CAAA;QAQA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,IAAA,EAAA,CAAS,oBAAoB,EAA7B,EAAA,CAAA;QAQA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAG,KAAK,EAAR,IAAA,EAAA,CAAS,qBAAqB,EAA9B,EAAA,CAAA;;IA2MA,OAAA,mBAAC,CAAD;CAAC,EAAD,CAAA;;;;;;ADpQA,IAAA,eAAA,kBAAA,YAAA;IAAA,SAAA,eAAA,GAAA;KAK+B;;QAL/B,EAAA,IAAA,EAAC,QAAQ,EAAT,IAAA,EAAA,CAAU;oBACR,YAAY,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;oBAChD,OAAO,EAAE,CAAC,cAAc,CAAC;oBACzB,OAAO,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;iBAC5C,EAAD,EAAA;;IAC8B,OAA9B,eAA+B,CAA/B;CAA+B,EAA/B,CAAA;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"text-field.es5.js","sources":["../../../src/cdk/text-field/text-field-module.ts","../../../src/cdk/text-field/autosize.ts","../../../src/cdk/text-field/autofill.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.io/license\n */\n\nimport {PlatformModule} from '@angular/cdk/platform';\nimport {NgModule} from '@angular/core';\nimport {CdkAutofill} from './autofill';\nimport {CdkTextareaAutosize} from './autosize';\n\n\n@NgModule({\n declarations: [CdkAutofill, CdkTextareaAutosize],\n imports: [PlatformModule],\n exports: [CdkAutofill, CdkTextareaAutosize],\n})\nexport class TextFieldModule {}\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.io/license\n */\n\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {\n Directive,\n ElementRef,\n Input,\n AfterViewInit,\n DoCheck,\n OnDestroy,\n NgZone,\n} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\nimport {auditTime, takeUntil} from 'rxjs/operators';\nimport {fromEvent, Subject} from 'rxjs';\n\n\n/** Directive to automatically resize a textarea to fit its content. */\n@Directive({\n selector: 'textarea[cdkTextareaAutosize]',\n exportAs: 'cdkTextareaAutosize',\n host: {\n 'class': 'cdk-textarea-autosize',\n // Textarea elements that have the directive applied should have a single row by default.\n // Browsers normally show two rows by default and therefore this limits the minRows binding.\n 'rows': '1',\n '(input)': '_noopInputHandler()',\n },\n})\nexport class CdkTextareaAutosize implements AfterViewInit, DoCheck, OnDestroy {\n /** Keep track of the previous textarea value to avoid resizing when the value hasn't changed. */\n private _previousValue?: string;\n private _initialHeight: string | null;\n private readonly _destroyed = new Subject<void>();\n\n private _minRows: number;\n private _maxRows: number;\n private _enabled: boolean = true;\n\n /**\n * Value of minRows as of last resize. If the minRows has decreased, the\n * height of the textarea needs to be recomputed to reflect the new minimum. The maxHeight\n * does not have the same problem because it does not affect the textarea's scrollHeight.\n */\n private _previousMinRows: number = -1;\n\n private _textareaElement: HTMLTextAreaElement;\n\n /** Minimum amount of rows in the textarea. */\n @Input('cdkAutosizeMinRows')\n get minRows(): number { return this._minRows; }\n set minRows(value: number) {\n this._minRows = value;\n this._setMinHeight();\n }\n\n /** Maximum amount of rows in the textarea. */\n @Input('cdkAutosizeMaxRows')\n get maxRows(): number { return this._maxRows; }\n set maxRows(value: number) {\n this._maxRows = value;\n this._setMaxHeight();\n }\n\n /** Whether autosizing is enabled or not */\n @Input('cdkTextareaAutosize')\n get enabled(): boolean { return this._enabled; }\n set enabled(value: boolean) {\n value = coerceBooleanProperty(value);\n\n // Only act if the actual value changed. This specifically helps to not run\n // resizeToFitContent too early (i.e. before ngAfterViewInit)\n if (this._enabled !== value) {\n (this._enabled = value) ? this.resizeToFitContent(true) : this.reset();\n }\n }\n\n /** Cached height of a textarea with a single row. */\n private _cachedLineHeight: number;\n\n constructor(\n private _elementRef: ElementRef<HTMLElement>,\n private _platform: Platform,\n private _ngZone: NgZone) {\n this._textareaElement = this._elementRef.nativeElement as HTMLTextAreaElement;\n }\n\n /** Sets the minimum height of the textarea as determined by minRows. */\n _setMinHeight(): void {\n const minHeight = this.minRows && this._cachedLineHeight ?\n `${this.minRows * this._cachedLineHeight}px` : null;\n\n if (minHeight) {\n this._textareaElement.style.minHeight = minHeight;\n }\n }\n\n /** Sets the maximum height of the textarea as determined by maxRows. */\n _setMaxHeight(): void {\n const maxHeight = this.maxRows && this._cachedLineHeight ?\n `${this.maxRows * this._cachedLineHeight}px` : null;\n\n if (maxHeight) {\n this._textareaElement.style.maxHeight = maxHeight;\n }\n }\n\n ngAfterViewInit() {\n if (this._platform.isBrowser) {\n // Remember the height which we started with in case autosizing is disabled\n this._initialHeight = this._textareaElement.style.height;\n\n this.resizeToFitContent();\n\n this._ngZone.runOutsideAngular(() => {\n fromEvent(window, 'resize')\n .pipe(auditTime(16), takeUntil(this._destroyed))\n .subscribe(() => this.resizeToFitContent(true));\n });\n }\n }\n\n ngOnDestroy() {\n this._destroyed.next();\n this._destroyed.complete();\n }\n\n /**\n * Cache the height of a single-row textarea if it has not already been cached.\n *\n * We need to know how large a single \"row\" of a textarea is in order to apply minRows and\n * maxRows. For the initial version, we will assume that the height of a single line in the\n * textarea does not ever change.\n */\n private _cacheTextareaLineHeight(): void {\n if (this._cachedLineHeight) {\n return;\n }\n\n // Use a clone element because we have to override some styles.\n let textareaClone = this._textareaElement.cloneNode(false) as HTMLTextAreaElement;\n textareaClone.rows = 1;\n\n // Use `position: absolute` so that this doesn't cause a browser layout and use\n // `visibility: hidden` so that nothing is rendered. Clear any other styles that\n // would affect the height.\n textareaClone.style.position = 'absolute';\n textareaClone.style.visibility = 'hidden';\n textareaClone.style.border = 'none';\n textareaClone.style.padding = '0';\n textareaClone.style.height = '';\n textareaClone.style.minHeight = '';\n textareaClone.style.maxHeight = '';\n\n // In Firefox it happens that textarea elements are always bigger than the specified amount\n // of rows. This is because Firefox tries to add extra space for the horizontal scrollbar.\n // As a workaround that removes the extra space for the scrollbar, we can just set overflow\n // to hidden. This ensures that there is no invalid calculation of the line height.\n // See Firefox bug report: https://bugzilla.mozilla.org/show_bug.cgi?id=33654\n textareaClone.style.overflow = 'hidden';\n\n this._textareaElement.parentNode!.appendChild(textareaClone);\n this._cachedLineHeight = textareaClone.clientHeight;\n this._textareaElement.parentNode!.removeChild(textareaClone);\n\n // Min and max heights have to be re-calculated if the cached line height changes\n this._setMinHeight();\n this._setMaxHeight();\n }\n\n ngDoCheck() {\n if (this._platform.isBrowser) {\n this.resizeToFitContent();\n }\n }\n\n /**\n * Resize the textarea to fit its content.\n * @param force Whether to force a height recalculation. By default the height will be\n * recalculated only if the value changed since the last call.\n */\n resizeToFitContent(force: boolean = false) {\n // If autosizing is disabled, just skip everything else\n if (!this._enabled) {\n return;\n }\n\n this._cacheTextareaLineHeight();\n\n // If we haven't determined the line-height yet, we know we're still hidden and there's no point\n // in checking the height of the textarea.\n if (!this._cachedLineHeight) {\n return;\n }\n\n const textarea = this._elementRef.nativeElement as HTMLTextAreaElement;\n const value = textarea.value;\n\n // Only resize if the value or minRows have changed since these calculations can be expensive.\n if (!force && this._minRows === this._previousMinRows && value === this._previousValue) {\n return;\n }\n\n const placeholderText = textarea.placeholder;\n\n // Reset the textarea height to auto in order to shrink back to its default size.\n // Also temporarily force overflow:hidden, so scroll bars do not interfere with calculations.\n // Long placeholders that are wider than the textarea width may lead to a bigger scrollHeight\n // value. To ensure that the scrollHeight is not bigger than the content, the placeholders\n // need to be removed temporarily.\n textarea.classList.add('cdk-textarea-autosize-measuring');\n textarea.placeholder = '';\n\n // The cdk-textarea-autosize-measuring class includes a 2px padding to workaround an issue with\n // Chrome, so we account for that extra space here by subtracting 4 (2px top + 2px bottom).\n const height = textarea.scrollHeight - 4;\n\n // Use the scrollHeight to know how large the textarea *would* be if fit its entire value.\n textarea.style.height = `${height}px`;\n textarea.classList.remove('cdk-textarea-autosize-measuring');\n textarea.placeholder = placeholderText;\n\n this._ngZone.runOutsideAngular(() => {\n if (typeof requestAnimationFrame !== 'undefined') {\n requestAnimationFrame(() => this._scrollToCaretPosition(textarea));\n } else {\n setTimeout(() => this._scrollToCaretPosition(textarea));\n }\n });\n\n this._previousValue = value;\n this._previousMinRows = this._minRows;\n }\n\n /**\n * Resets the textarea to it's original size\n */\n reset() {\n // Do not try to change the textarea, if the initialHeight has not been determined yet\n // This might potentially remove styles when reset() is called before ngAfterViewInit\n if (this._initialHeight === undefined) {\n return;\n }\n this._textareaElement.style.height = this._initialHeight;\n }\n\n _noopInputHandler() {\n // no-op handler that ensures we're running change detection on input events.\n }\n\n /**\n * Scrolls a textarea to the caret position. On Firefox resizing the textarea will\n * prevent it from scrolling to the caret position. We need to re-set the selection\n * in order for it to scroll to the proper position.\n */\n private _scrollToCaretPosition(textarea: HTMLTextAreaElement) {\n const {selectionStart, selectionEnd} = textarea;\n\n // IE will throw an \"Unspecified error\" if we try to set the selection range after the\n // element has been removed from the DOM. Assert that the directive hasn't been destroyed\n // between the time we requested the animation frame and when it was executed.\n // Also note that we have to assert that the textarea is focused before we set the\n // selection range. Setting the selection range on a non-focused textarea will cause\n // it to receive focus on IE and Edge.\n if (!this._destroyed.isStopped && document.activeElement === textarea) {\n textarea.setSelectionRange(selectionStart, selectionEnd);\n }\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.io/license\n */\n\nimport {Platform, normalizePassiveListenerOptions} from '@angular/cdk/platform';\nimport {\n Directive,\n ElementRef,\n EventEmitter,\n Injectable,\n NgZone,\n OnDestroy,\n OnInit,\n Output,\n} from '@angular/core';\nimport {coerceElement} from '@angular/cdk/coercion';\nimport {EMPTY, Observable, Subject} from 'rxjs';\n\n\n/** An event that is emitted when the autofill state of an input changes. */\nexport type AutofillEvent = {\n /** The element whose autofill state changes. */\n target: Element;\n /** Whether the element is currently autofilled. */\n isAutofilled: boolean;\n};\n\n\n/** Used to track info about currently monitored elements. */\ntype MonitoredElementInfo = {\n subject: Subject<AutofillEvent>;\n unlisten: () => void;\n};\n\n\n/** Options to pass to the animationstart listener. */\nconst listenerOptions = normalizePassiveListenerOptions({passive: true});\n\n\n/**\n * An injectable service that can be used to monitor the autofill state of an input.\n * Based on the following blog post:\n * https://medium.com/@brunn/detecting-autofilled-fields-in-javascript-aed598d25da7\n */\n@Injectable({providedIn: 'root'})\nexport class AutofillMonitor implements OnDestroy {\n private _monitoredElements = new Map<Element, MonitoredElementInfo>();\n\n constructor(private _platform: Platform, private _ngZone: NgZone) {}\n\n /**\n * Monitor for changes in the autofill state of the given input element.\n * @param element The element to monitor.\n * @return A stream of autofill state changes.\n */\n monitor(element: Element): Observable<AutofillEvent>;\n\n /**\n * Monitor for changes in the autofill state of the given input element.\n * @param element The element to monitor.\n * @return A stream of autofill state changes.\n */\n monitor(element: ElementRef<Element>): Observable<AutofillEvent>;\n\n monitor(elementOrRef: Element | ElementRef<Element>): Observable<AutofillEvent> {\n if (!this._platform.isBrowser) {\n return EMPTY;\n }\n\n const element = coerceElement(elementOrRef);\n const info = this._monitoredElements.get(element);\n\n if (info) {\n return info.subject.asObservable();\n }\n\n const result = new Subject<AutofillEvent>();\n const cssClass = 'cdk-text-field-autofilled';\n const listener = ((event: AnimationEvent) => {\n // Animation events fire on initial element render, we check for the presence of the autofill\n // CSS class to make sure this is a real change in state, not just the initial render before\n // we fire off events.\n if (event.animationName === 'cdk-text-field-autofill-start' &&\n !element.classList.contains(cssClass)) {\n element.classList.add(cssClass);\n this._ngZone.run(() => result.next({target: event.target as Element, isAutofilled: true}));\n } else if (event.animationName === 'cdk-text-field-autofill-end' &&\n element.classList.contains(cssClass)) {\n element.classList.remove(cssClass);\n this._ngZone.run(() => result.next({target: event.target as Element, isAutofilled: false}));\n }\n }) as EventListenerOrEventListenerObject;\n\n this._ngZone.runOutsideAngular(() => {\n element.addEventListener('animationstart', listener, listenerOptions);\n element.classList.add('cdk-text-field-autofill-monitored');\n });\n\n this._monitoredElements.set(element, {\n subject: result,\n unlisten: () => {\n element.removeEventListener('animationstart', listener, listenerOptions);\n }\n });\n\n return result.asObservable();\n }\n\n /**\n * Stop monitoring the autofill state of the given input element.\n * @param element The element to stop monitoring.\n */\n stopMonitoring(element: Element): void;\n\n /**\n * Stop monitoring the autofill state of the given input element.\n * @param element The element to stop monitoring.\n */\n stopMonitoring(element: ElementRef<Element>): void;\n\n stopMonitoring(elementOrRef: Element | ElementRef<Element>): void {\n const element = coerceElement(elementOrRef);\n const info = this._monitoredElements.get(element);\n\n if (info) {\n info.unlisten();\n info.subject.complete();\n element.classList.remove('cdk-text-field-autofill-monitored');\n element.classList.remove('cdk-text-field-autofilled');\n this._monitoredElements.delete(element);\n }\n }\n\n ngOnDestroy() {\n this._monitoredElements.forEach((_info, element) => this.stopMonitoring(element));\n }\n}\n\n\n/** A directive that can be used to monitor the autofill state of an input. */\n@Directive({\n selector: '[cdkAutofill]',\n})\nexport class CdkAutofill implements OnDestroy, OnInit {\n /** Emits when the autofill state of the element changes. */\n @Output() cdkAutofill: EventEmitter<AutofillEvent> = new EventEmitter<AutofillEvent>();\n\n constructor(private _elementRef: ElementRef<HTMLElement>,\n private _autofillMonitor: AutofillMonitor) {}\n\n ngOnInit() {\n this._autofillMonitor\n .monitor(this._elementRef)\n .subscribe(event => this.cdkAutofill.emit(event));\n }\n\n ngOnDestroy() {\n this._autofillMonitor.stopMonitoring(this._elementRef);\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AEwCA,IAAM,eAAe,GAAG,+BAA+B,CAAC,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAxE;;;;;;AAQA,AAAA,IAAA,eAAA,kBAAA,YAAA;IAIE,SAAF,eAAA,C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WAAW,EAAE,mBAAmB,CAAC;oBAChD,OAAO,EAAE,CAAC,cAAc,CAAC;oBACzB,OAAO,EAAE,CAAC,WAAW,EAAE,mBAAmB,CAAC;iBAC5C,EAAD,EAAA;;IAC8B,OAA9B,eAA+B,CAA/B;CAA+B,EAA/B,CAAA;;;;;;;;;;;;;;"}
|
package/esm5/tree.es5.js
CHANGED
|
@@ -17,7 +17,7 @@ import { CommonModule } from '@angular/common';
|
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* @fileoverview added by tsickle
|
|
20
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
20
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
21
21
|
*/
|
|
22
22
|
/**
|
|
23
23
|
* Base tree control. It has basic toggle/expand/collapse operations on a single data node.
|
|
@@ -161,7 +161,7 @@ BaseTreeControl = /** @class */ (function () {
|
|
|
161
161
|
|
|
162
162
|
/**
|
|
163
163
|
* @fileoverview added by tsickle
|
|
164
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
164
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
165
165
|
*/
|
|
166
166
|
/**
|
|
167
167
|
* Flat tree control. Able to expand/collapse a subtree recursively for flattened tree.
|
|
@@ -247,7 +247,7 @@ FlatTreeControl = /** @class */ (function (_super) {
|
|
|
247
247
|
|
|
248
248
|
/**
|
|
249
249
|
* @fileoverview added by tsickle
|
|
250
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
250
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
251
251
|
*/
|
|
252
252
|
/**
|
|
253
253
|
* Nested tree control. Able to expand/collapse a subtree recursively for NestedNode type.
|
|
@@ -290,9 +290,14 @@ NestedTreeControl = /** @class */ (function (_super) {
|
|
|
290
290
|
var _a;
|
|
291
291
|
this.expansionModel.clear();
|
|
292
292
|
/** @type {?} */
|
|
293
|
-
var allNodes = this.dataNodes.reduce(
|
|
293
|
+
var allNodes = this.dataNodes.reduce((/**
|
|
294
|
+
* @param {?} accumulator
|
|
295
|
+
* @param {?} dataNode
|
|
296
|
+
* @return {?}
|
|
297
|
+
*/
|
|
298
|
+
function (accumulator, dataNode) {
|
|
294
299
|
return accumulator.concat(_this.getDescendants(dataNode), [dataNode]);
|
|
295
|
-
}, []);
|
|
300
|
+
}), []);
|
|
296
301
|
(_a = this.expansionModel).select.apply(_a, allNodes);
|
|
297
302
|
};
|
|
298
303
|
/** Gets a list of descendant dataNodes of a subtree rooted at given data node recursively. */
|
|
@@ -334,12 +339,24 @@ NestedTreeControl = /** @class */ (function (_super) {
|
|
|
334
339
|
/** @type {?} */
|
|
335
340
|
var childrenNodes = this.getChildren(dataNode);
|
|
336
341
|
if (Array.isArray(childrenNodes)) {
|
|
337
|
-
childrenNodes.forEach(
|
|
342
|
+
childrenNodes.forEach((/**
|
|
343
|
+
* @param {?} child
|
|
344
|
+
* @return {?}
|
|
345
|
+
*/
|
|
346
|
+
function (child) { return _this._getDescendants(descendants, child); }));
|
|
338
347
|
}
|
|
339
348
|
else if (childrenNodes instanceof Observable) {
|
|
340
|
-
childrenNodes.pipe(take(1), filter(Boolean)).subscribe(
|
|
341
|
-
|
|
342
|
-
|
|
349
|
+
childrenNodes.pipe(take(1), filter(Boolean)).subscribe((/**
|
|
350
|
+
* @param {?} children
|
|
351
|
+
* @return {?}
|
|
352
|
+
*/
|
|
353
|
+
function (children) {
|
|
354
|
+
children.forEach((/**
|
|
355
|
+
* @param {?} child
|
|
356
|
+
* @return {?}
|
|
357
|
+
*/
|
|
358
|
+
function (child) { return _this._getDescendants(descendants, child); }));
|
|
359
|
+
}));
|
|
343
360
|
}
|
|
344
361
|
};
|
|
345
362
|
return NestedTreeControl;
|
|
@@ -347,12 +364,12 @@ NestedTreeControl = /** @class */ (function (_super) {
|
|
|
347
364
|
|
|
348
365
|
/**
|
|
349
366
|
* @fileoverview added by tsickle
|
|
350
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
367
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
351
368
|
*/
|
|
352
369
|
|
|
353
370
|
/**
|
|
354
371
|
* @fileoverview added by tsickle
|
|
355
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
372
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
356
373
|
*/
|
|
357
374
|
/**
|
|
358
375
|
* Injection token used to provide a `CdkTreeNode` to its outlet.
|
|
@@ -385,7 +402,7 @@ var CdkTreeNodeOutlet = /** @class */ (function () {
|
|
|
385
402
|
|
|
386
403
|
/**
|
|
387
404
|
* @fileoverview added by tsickle
|
|
388
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
405
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
389
406
|
*/
|
|
390
407
|
/**
|
|
391
408
|
* Context provided to the tree node component.
|
|
@@ -428,7 +445,7 @@ var CdkTreeNodeDef = /** @class */ (function () {
|
|
|
428
445
|
|
|
429
446
|
/**
|
|
430
447
|
* @fileoverview added by tsickle
|
|
431
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
448
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
432
449
|
*/
|
|
433
450
|
|
|
434
451
|
/**
|
|
@@ -474,7 +491,7 @@ function getTreeControlFunctionsMissingError() {
|
|
|
474
491
|
|
|
475
492
|
/**
|
|
476
493
|
* @fileoverview added by tsickle
|
|
477
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
494
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
478
495
|
*/
|
|
479
496
|
/**
|
|
480
497
|
* CDK tree component that connects with a data source to retrieve data of type `T` and renders
|
|
@@ -564,7 +581,11 @@ var CdkTree = /** @class */ (function () {
|
|
|
564
581
|
*/
|
|
565
582
|
function () {
|
|
566
583
|
/** @type {?} */
|
|
567
|
-
var defaultNodeDefs = this._nodeDefs.filter(
|
|
584
|
+
var defaultNodeDefs = this._nodeDefs.filter((/**
|
|
585
|
+
* @param {?} def
|
|
586
|
+
* @return {?}
|
|
587
|
+
*/
|
|
588
|
+
function (def) { return !def.when; }));
|
|
568
589
|
if (defaultNodeDefs.length > 1) {
|
|
569
590
|
throw getTreeMultipleDefaultNodeDefsError();
|
|
570
591
|
}
|
|
@@ -644,7 +665,11 @@ var CdkTree = /** @class */ (function () {
|
|
|
644
665
|
}
|
|
645
666
|
if (dataStream) {
|
|
646
667
|
this._dataSubscription = dataStream.pipe(takeUntil(this._onDestroy))
|
|
647
|
-
.subscribe(
|
|
668
|
+
.subscribe((/**
|
|
669
|
+
* @param {?} data
|
|
670
|
+
* @return {?}
|
|
671
|
+
*/
|
|
672
|
+
function (data) { return _this.renderNodeChanges(data); }));
|
|
648
673
|
}
|
|
649
674
|
else {
|
|
650
675
|
throw getTreeNoValidDataSourceError();
|
|
@@ -676,7 +701,13 @@ var CdkTree = /** @class */ (function () {
|
|
|
676
701
|
if (!changes) {
|
|
677
702
|
return;
|
|
678
703
|
}
|
|
679
|
-
changes.forEachOperation(
|
|
704
|
+
changes.forEachOperation((/**
|
|
705
|
+
* @param {?} item
|
|
706
|
+
* @param {?} adjustedPreviousIndex
|
|
707
|
+
* @param {?} currentIndex
|
|
708
|
+
* @return {?}
|
|
709
|
+
*/
|
|
710
|
+
function (item, adjustedPreviousIndex, currentIndex) {
|
|
680
711
|
if (item.previousIndex == null) {
|
|
681
712
|
_this.insertNode(data[(/** @type {?} */ (currentIndex))], (/** @type {?} */ (currentIndex)), viewContainer, parentData);
|
|
682
713
|
}
|
|
@@ -689,7 +720,7 @@ var CdkTree = /** @class */ (function () {
|
|
|
689
720
|
var view = viewContainer.get((/** @type {?} */ (adjustedPreviousIndex)));
|
|
690
721
|
viewContainer.move((/** @type {?} */ (view)), currentIndex);
|
|
691
722
|
}
|
|
692
|
-
});
|
|
723
|
+
}));
|
|
693
724
|
this._changeDetectorRef.detectChanges();
|
|
694
725
|
};
|
|
695
726
|
/**
|
|
@@ -721,7 +752,11 @@ var CdkTree = /** @class */ (function () {
|
|
|
721
752
|
return this._nodeDefs.first;
|
|
722
753
|
}
|
|
723
754
|
/** @type {?} */
|
|
724
|
-
var nodeDef = this._nodeDefs.find(
|
|
755
|
+
var nodeDef = this._nodeDefs.find((/**
|
|
756
|
+
* @param {?} def
|
|
757
|
+
* @return {?}
|
|
758
|
+
*/
|
|
759
|
+
function (def) { return def.when && def.when(i, data); })) || this._defaultNodeDef;
|
|
725
760
|
if (!nodeDef) {
|
|
726
761
|
throw getTreeMissingMatchingNodeDefError();
|
|
727
762
|
}
|
|
@@ -924,7 +959,11 @@ var CdkTreeNode = /** @class */ (function () {
|
|
|
924
959
|
}
|
|
925
960
|
else if (childrenNodes instanceof Observable) {
|
|
926
961
|
childrenNodes.pipe(takeUntil(this._destroyed))
|
|
927
|
-
.subscribe(
|
|
962
|
+
.subscribe((/**
|
|
963
|
+
* @param {?} children
|
|
964
|
+
* @return {?}
|
|
965
|
+
*/
|
|
966
|
+
function (children) { return _this._setRoleFromChildren(children); }));
|
|
928
967
|
}
|
|
929
968
|
}
|
|
930
969
|
};
|
|
@@ -971,7 +1010,7 @@ var CdkTreeNode = /** @class */ (function () {
|
|
|
971
1010
|
|
|
972
1011
|
/**
|
|
973
1012
|
* @fileoverview added by tsickle
|
|
974
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1013
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
975
1014
|
*/
|
|
976
1015
|
/**
|
|
977
1016
|
* Nested node is a child of `<cdk-tree>`. It works with nested tree.
|
|
@@ -1023,10 +1062,17 @@ var CdkNestedTreeNode = /** @class */ (function (_super) {
|
|
|
1023
1062
|
}
|
|
1024
1063
|
else if (childrenNodes instanceof Observable) {
|
|
1025
1064
|
childrenNodes.pipe(takeUntil(this._destroyed))
|
|
1026
|
-
.subscribe(
|
|
1065
|
+
.subscribe((/**
|
|
1066
|
+
* @param {?} result
|
|
1067
|
+
* @return {?}
|
|
1068
|
+
*/
|
|
1069
|
+
function (result) { return _this.updateChildrenNodes(result); }));
|
|
1027
1070
|
}
|
|
1028
1071
|
this.nodeOutlet.changes.pipe(takeUntil(this._destroyed))
|
|
1029
|
-
.subscribe(
|
|
1072
|
+
.subscribe((/**
|
|
1073
|
+
* @return {?}
|
|
1074
|
+
*/
|
|
1075
|
+
function () { return _this.updateChildrenNodes(); }));
|
|
1030
1076
|
};
|
|
1031
1077
|
/**
|
|
1032
1078
|
* @return {?}
|
|
@@ -1104,7 +1150,11 @@ var CdkNestedTreeNode = /** @class */ (function (_super) {
|
|
|
1104
1150
|
if (outlets) {
|
|
1105
1151
|
// Note that since we use `descendants: true` on the query, we have to ensure
|
|
1106
1152
|
// that we don't pick up the outlet of a child node by accident.
|
|
1107
|
-
return outlets.find(
|
|
1153
|
+
return outlets.find((/**
|
|
1154
|
+
* @param {?} outlet
|
|
1155
|
+
* @return {?}
|
|
1156
|
+
*/
|
|
1157
|
+
function (outlet) { return !outlet._node || outlet._node === _this; }));
|
|
1108
1158
|
}
|
|
1109
1159
|
};
|
|
1110
1160
|
CdkNestedTreeNode.decorators = [
|
|
@@ -1140,7 +1190,7 @@ var CdkNestedTreeNode = /** @class */ (function (_super) {
|
|
|
1140
1190
|
|
|
1141
1191
|
/**
|
|
1142
1192
|
* @fileoverview added by tsickle
|
|
1143
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1193
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1144
1194
|
*/
|
|
1145
1195
|
/**
|
|
1146
1196
|
* Regex used to split a string on its CSS units.
|
|
@@ -1171,12 +1221,18 @@ var CdkTreeNodePadding = /** @class */ (function () {
|
|
|
1171
1221
|
this._indent = 40;
|
|
1172
1222
|
this._setPadding();
|
|
1173
1223
|
if (_dir) {
|
|
1174
|
-
_dir.change.pipe(takeUntil(this._destroyed)).subscribe(
|
|
1224
|
+
_dir.change.pipe(takeUntil(this._destroyed)).subscribe((/**
|
|
1225
|
+
* @return {?}
|
|
1226
|
+
*/
|
|
1227
|
+
function () { return _this._setPadding(true); }));
|
|
1175
1228
|
}
|
|
1176
1229
|
// In Ivy the indentation binding might be set before the tree node's data has been added,
|
|
1177
1230
|
// which means that we'll miss the first render. We have to subscribe to changes in the
|
|
1178
1231
|
// data to ensure that everything is up to date.
|
|
1179
|
-
_treeNode._dataChanges.subscribe(
|
|
1232
|
+
_treeNode._dataChanges.subscribe((/**
|
|
1233
|
+
* @return {?}
|
|
1234
|
+
*/
|
|
1235
|
+
function () { return _this._setPadding(); }));
|
|
1180
1236
|
}
|
|
1181
1237
|
Object.defineProperty(CdkTreeNodePadding.prototype, "level", {
|
|
1182
1238
|
/** The level of depth of the tree node. The padding will be `level * indent` pixels. */
|
|
@@ -1303,7 +1359,7 @@ var CdkTreeNodePadding = /** @class */ (function () {
|
|
|
1303
1359
|
|
|
1304
1360
|
/**
|
|
1305
1361
|
* @fileoverview added by tsickle
|
|
1306
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1362
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1307
1363
|
*/
|
|
1308
1364
|
/**
|
|
1309
1365
|
* Node toggle to expand/collapse the node.
|
|
@@ -1377,7 +1433,7 @@ var CdkTreeNodeToggle = /** @class */ (function () {
|
|
|
1377
1433
|
|
|
1378
1434
|
/**
|
|
1379
1435
|
* @fileoverview added by tsickle
|
|
1380
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1436
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1381
1437
|
*/
|
|
1382
1438
|
/** @type {?} */
|
|
1383
1439
|
var EXPORTED_DECLARATIONS = [
|
|
@@ -1405,12 +1461,12 @@ var CdkTreeModule = /** @class */ (function () {
|
|
|
1405
1461
|
|
|
1406
1462
|
/**
|
|
1407
1463
|
* @fileoverview added by tsickle
|
|
1408
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1464
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1409
1465
|
*/
|
|
1410
1466
|
|
|
1411
1467
|
/**
|
|
1412
1468
|
* @fileoverview added by tsickle
|
|
1413
|
-
* @suppress {checkTypes,extraRequire,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1469
|
+
* @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
|
|
1414
1470
|
*/
|
|
1415
1471
|
|
|
1416
1472
|
export { BaseTreeControl, FlatTreeControl, NestedTreeControl, CdkNestedTreeNode, CdkTreeNodeOutletContext, CdkTreeNodeDef, CdkTreeNodePadding, CDK_TREE_NODE_OUTLET_NODE, CdkTreeNodeOutlet, CdkTree, CdkTreeNode, getTreeNoValidDataSourceError, getTreeMultipleDefaultNodeDefsError, getTreeMissingMatchingNodeDefError, getTreeControlMissingError, getTreeControlFunctionsMissingError, CdkTreeModule, CdkTreeNodeToggle };
|