@angular/cdk 5.2.1 → 5.2.5
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/_overlay.scss +6 -0
- package/a11y/typings/aria-describer/aria-describer.d.ts +2 -0
- package/a11y/typings/index.metadata.json +1 -1
- package/a11y/typings/key-manager/list-key-manager.d.ts +11 -0
- package/bundles/cdk-a11y.umd.js +65 -13
- 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-collections.umd.js +7 -11
- 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-overlay.umd.js +24 -5
- 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 +3 -3
- 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-scrolling.umd.js +17 -4
- 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 +3 -1
- package/bundles/cdk-stepper.umd.js.map +1 -1
- package/bundles/cdk-stepper.umd.min.js +1 -1
- package/bundles/cdk-stepper.umd.min.js.map +1 -1
- package/bundles/cdk.umd.js +1 -1
- 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/collections/typings/index.metadata.json +1 -1
- package/collections/typings/selection.d.ts +3 -10
- package/esm2015/a11y.js +48 -13
- package/esm2015/a11y.js.map +1 -1
- package/esm2015/cdk.js +1 -1
- package/esm2015/cdk.js.map +1 -1
- package/esm2015/collections.js +8 -15
- package/esm2015/collections.js.map +1 -1
- package/esm2015/overlay.js +20 -5
- package/esm2015/overlay.js.map +1 -1
- package/esm2015/platform.js +3 -3
- package/esm2015/platform.js.map +1 -1
- package/esm2015/scrolling.js +18 -5
- package/esm2015/scrolling.js.map +1 -1
- package/esm2015/stepper.js +3 -1
- package/esm2015/stepper.js.map +1 -1
- package/esm5/a11y.es5.js +65 -13
- package/esm5/a11y.es5.js.map +1 -1
- package/esm5/cdk.es5.js +1 -1
- package/esm5/cdk.es5.js.map +1 -1
- package/esm5/collections.es5.js +8 -11
- package/esm5/collections.es5.js.map +1 -1
- package/esm5/overlay.es5.js +24 -5
- package/esm5/overlay.es5.js.map +1 -1
- package/esm5/platform.es5.js +3 -3
- package/esm5/platform.es5.js.map +1 -1
- package/esm5/scrolling.es5.js +17 -4
- package/esm5/scrolling.es5.js.map +1 -1
- package/esm5/stepper.es5.js +3 -1
- package/esm5/stepper.es5.js.map +1 -1
- package/overlay/typings/index.metadata.json +1 -1
- package/overlay/typings/overlay-directives.d.ts +4 -1
- package/overlay/typings/overlay.d.ts +1 -1
- package/overlay/typings/position/connected-position-strategy.d.ts +0 -2
- package/overlay-prebuilt.css +1 -1
- package/package.json +3 -3
- package/scrolling/typings/index.metadata.json +1 -1
- package/scrolling/typings/viewport-ruler.d.ts +2 -1
- package/typings/a11y/aria-describer/aria-describer.d.ts +2 -0
- package/typings/a11y/index.metadata.json +1 -1
- package/typings/a11y/key-manager/list-key-manager.d.ts +11 -0
- package/typings/collections/index.metadata.json +1 -1
- package/typings/collections/selection.d.ts +3 -10
- package/typings/esm5/a11y/aria-describer/aria-describer.d.ts +2 -0
- package/typings/esm5/a11y/index.metadata.json +1 -1
- package/typings/esm5/a11y/key-manager/list-key-manager.d.ts +11 -0
- package/typings/esm5/collections/index.metadata.json +1 -1
- package/typings/esm5/collections/selection.d.ts +3 -10
- package/typings/esm5/index.metadata.json +1 -1
- package/typings/esm5/overlay/index.metadata.json +1 -1
- package/typings/esm5/overlay/overlay-directives.d.ts +4 -1
- package/typings/esm5/overlay/overlay.d.ts +1 -1
- package/typings/esm5/overlay/position/connected-position-strategy.d.ts +0 -2
- package/typings/esm5/scrolling/index.metadata.json +1 -1
- package/typings/esm5/scrolling/viewport-ruler.d.ts +2 -1
- package/typings/index.metadata.json +1 -1
- package/typings/overlay/index.metadata.json +1 -1
- package/typings/overlay/overlay-directives.d.ts +4 -1
- package/typings/overlay/overlay.d.ts +1 -1
- package/typings/overlay/position/connected-position-strategy.d.ts +0 -2
- package/typings/scrolling/index.metadata.json +1 -1
- package/typings/scrolling/viewport-ruler.d.ts +2 -1
package/esm2015/platform.js
CHANGED
|
@@ -14,7 +14,7 @@ import { Injectable, NgModule } from '@angular/core';
|
|
|
14
14
|
|
|
15
15
|
// Whether the current platform supports the V8 Break Iterator. The V8 check
|
|
16
16
|
// is necessary to detect all Blink based browsers.
|
|
17
|
-
const hasV8BreakIterator = (typeof
|
|
17
|
+
const hasV8BreakIterator = (typeof Intl !== 'undefined' && (/** @type {?} */ (Intl)).v8BreakIterator);
|
|
18
18
|
/**
|
|
19
19
|
* Service to detect the current platform by comparing the userAgent strings and
|
|
20
20
|
* checking browser-specific global properties.
|
|
@@ -36,8 +36,8 @@ class Platform {
|
|
|
36
36
|
/**
|
|
37
37
|
* Whether the current rendering engine is Blink.
|
|
38
38
|
*/
|
|
39
|
-
this.BLINK = this.isBrowser &&
|
|
40
|
-
|
|
39
|
+
this.BLINK = this.isBrowser && (!!((/** @type {?} */ (window)).chrome || hasV8BreakIterator) &&
|
|
40
|
+
typeof CSS !== 'undefined' && !this.EDGE && !this.TRIDENT);
|
|
41
41
|
/**
|
|
42
42
|
* Whether the current rendering engine is WebKit.
|
|
43
43
|
*/
|
package/esm2015/platform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sources":["../../../src/cdk/platform/index.ts","../../../src/cdk/platform/public-api.ts","../../../src/cdk/platform/platform-module.ts","../../../src/cdk/platform/features.ts","../../../src/cdk/platform/platform.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\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\nexport * from './platform';\nexport * from './features';\nexport * from './platform-module';\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 {NgModule} from '@angular/core';\nimport {Platform} from './platform';\n\n\n@NgModule({\n providers: [Platform]\n})\nexport class PlatformModule {}\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\n/** Cached result of whether the user's browser supports passive event listeners. */\nlet supportsPassiveEvents: boolean;\n\n/**\n * Checks whether the user's browser supports passive event listeners.\n * See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n */\nexport function supportsPassiveEventListeners(): boolean {\n if (supportsPassiveEvents == null && typeof window !== 'undefined') {\n try {\n window.addEventListener('test', null!, Object.defineProperty({}, 'passive', {\n get: () => supportsPassiveEvents = true\n }));\n } finally {\n supportsPassiveEvents = supportsPassiveEvents || false;\n }\n }\n\n return supportsPassiveEvents;\n}\n\n/** Cached result Set of input types support by the current browser. */\nlet supportedInputTypes: Set<string>;\n\n/** Types of `<input>` that *might* be supported. */\nconst candidateInputTypes = [\n // `color` must come first. Chrome 56 shows a warning if we change the type to `color` after\n // first changing it to something else:\n // The specified value \"\" does not conform to the required format.\n // The format is \"#rrggbb\" where rr, gg, bb are two-digit hexadecimal numbers.\n 'color',\n 'button',\n 'checkbox',\n 'date',\n 'datetime-local',\n 'email',\n 'file',\n 'hidden',\n 'image',\n 'month',\n 'number',\n 'password',\n 'radio',\n 'range',\n 'reset',\n 'search',\n 'submit',\n 'tel',\n 'text',\n 'time',\n 'url',\n 'week',\n];\n\n/** @returns The input types supported by this browser. */\nexport function getSupportedInputTypes(): Set<string> {\n // Result is cached.\n if (supportedInputTypes) {\n return supportedInputTypes;\n }\n\n // We can't check if an input type is not supported until we're on the browser, so say that\n // everything is supported when not on the browser. We don't use `Platform` here since it's\n // just a helper function and can't inject it.\n if (typeof document !== 'object' || !document) {\n supportedInputTypes = new Set(candidateInputTypes);\n return supportedInputTypes;\n }\n\n let featureTestInput = document.createElement('input');\n supportedInputTypes = new Set(candidateInputTypes.filter(value => {\n featureTestInput.setAttribute('type', value);\n return featureTestInput.type === value;\n }));\n\n return supportedInputTypes;\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 {Injectable} from '@angular/core';\n\n// Whether the current platform supports the V8 Break Iterator. The V8 check\n// is necessary to detect all Blink based browsers.\nconst hasV8BreakIterator = (typeof
|
|
1
|
+
{"version":3,"file":"platform.js","sources":["../../../src/cdk/platform/index.ts","../../../src/cdk/platform/public-api.ts","../../../src/cdk/platform/platform-module.ts","../../../src/cdk/platform/features.ts","../../../src/cdk/platform/platform.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\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\nexport * from './platform';\nexport * from './features';\nexport * from './platform-module';\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 {NgModule} from '@angular/core';\nimport {Platform} from './platform';\n\n\n@NgModule({\n providers: [Platform]\n})\nexport class PlatformModule {}\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\n/** Cached result of whether the user's browser supports passive event listeners. */\nlet supportsPassiveEvents: boolean;\n\n/**\n * Checks whether the user's browser supports passive event listeners.\n * See: https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md\n */\nexport function supportsPassiveEventListeners(): boolean {\n if (supportsPassiveEvents == null && typeof window !== 'undefined') {\n try {\n window.addEventListener('test', null!, Object.defineProperty({}, 'passive', {\n get: () => supportsPassiveEvents = true\n }));\n } finally {\n supportsPassiveEvents = supportsPassiveEvents || false;\n }\n }\n\n return supportsPassiveEvents;\n}\n\n/** Cached result Set of input types support by the current browser. */\nlet supportedInputTypes: Set<string>;\n\n/** Types of `<input>` that *might* be supported. */\nconst candidateInputTypes = [\n // `color` must come first. Chrome 56 shows a warning if we change the type to `color` after\n // first changing it to something else:\n // The specified value \"\" does not conform to the required format.\n // The format is \"#rrggbb\" where rr, gg, bb are two-digit hexadecimal numbers.\n 'color',\n 'button',\n 'checkbox',\n 'date',\n 'datetime-local',\n 'email',\n 'file',\n 'hidden',\n 'image',\n 'month',\n 'number',\n 'password',\n 'radio',\n 'range',\n 'reset',\n 'search',\n 'submit',\n 'tel',\n 'text',\n 'time',\n 'url',\n 'week',\n];\n\n/** @returns The input types supported by this browser. */\nexport function getSupportedInputTypes(): Set<string> {\n // Result is cached.\n if (supportedInputTypes) {\n return supportedInputTypes;\n }\n\n // We can't check if an input type is not supported until we're on the browser, so say that\n // everything is supported when not on the browser. We don't use `Platform` here since it's\n // just a helper function and can't inject it.\n if (typeof document !== 'object' || !document) {\n supportedInputTypes = new Set(candidateInputTypes);\n return supportedInputTypes;\n }\n\n let featureTestInput = document.createElement('input');\n supportedInputTypes = new Set(candidateInputTypes.filter(value => {\n featureTestInput.setAttribute('type', value);\n return featureTestInput.type === value;\n }));\n\n return supportedInputTypes;\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 {Injectable} from '@angular/core';\n\n// Whether the current platform supports the V8 Break Iterator. The V8 check\n// is necessary to detect all Blink based browsers.\nconst hasV8BreakIterator = (typeof Intl !== 'undefined' && (Intl as any).v8BreakIterator);\n\n/**\n * Service to detect the current platform by comparing the userAgent strings and\n * checking browser-specific global properties.\n */\n@Injectable()\nexport class Platform {\n /** Whether the Angular application is being rendered in the browser. */\n isBrowser: boolean = typeof document === 'object' && !!document;\n\n /** Whether the current browser is Microsoft Edge. */\n EDGE: boolean = this.isBrowser && /(edge)/i.test(navigator.userAgent);\n\n /** Whether the current rendering engine is Microsoft Trident. */\n TRIDENT: boolean = this.isBrowser && /(msie|trident)/i.test(navigator.userAgent);\n\n /** Whether the current rendering engine is Blink. */\n // EdgeHTML and Trident mock Blink specific things and need to be excluded from this check.\n BLINK: boolean = this.isBrowser && (!!((window as any).chrome || hasV8BreakIterator) &&\n typeof CSS !== 'undefined' && !this.EDGE && !this.TRIDENT);\n\n /** Whether the current rendering engine is WebKit. */\n // Webkit is part of the userAgent in EdgeHTML, Blink and Trident. Therefore we need to\n // ensure that Webkit runs standalone and is not used as another engine's base.\n WEBKIT: boolean = this.isBrowser &&\n /AppleWebKit/i.test(navigator.userAgent) && !this.BLINK && !this.EDGE && !this.TRIDENT;\n\n /** Whether the current platform is Apple iOS. */\n IOS: boolean = this.isBrowser && /iPad|iPhone|iPod/.test(navigator.userAgent) &&\n !(window as any).MSStream;\n\n /** Whether the current browser is Firefox. */\n // It's difficult to detect the plain Gecko engine, because most of the browsers identify\n // them self as Gecko-like browsers and modify the userAgent's according to that.\n // Since we only cover one explicit Firefox case, we can simply check for Firefox\n // instead of having an unstable check for Gecko.\n FIREFOX: boolean = this.isBrowser && /(firefox|minefield)/i.test(navigator.userAgent);\n\n /** Whether the current platform is Android. */\n // Trident on mobile adds the android platform to the userAgent to trick detections.\n ANDROID: boolean = this.isBrowser && /android/i.test(navigator.userAgent) && !this.TRIDENT;\n\n /** Whether the current browser is Safari. */\n // Safari browsers will include the Safari keyword in their userAgent. Some browsers may fake\n // this and just place the Safari keyword in the userAgent. To be more safe about Safari every\n // Safari browser should also use Webkit as its layout engine.\n SAFARI: boolean = this.isBrowser && /safari/i.test(navigator.userAgent) && this.WEBKIT;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AIQA;;AAIA,MAAM,kBAAkB,IAAI,OAAO,IAAI,KAAK,WAAW,IAAI,mBAAC,IAAW,GAAE,eAAe,CAAC,CAAC;;;;;AAO1F,AAAA,MAAA,QAAA,CAAA;;;;;QAEA,IAAA,CAAA,SAAA,GAAuB,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAjE;;;;QAGA,IAAA,CAAA,IAAA,GAAkB,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAvE;;;;QAGA,IAAA,CAAA,OAAA,GAAqB,IAAI,CAAC,SAAS,IAAI,iBAAiB,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAlF;;;;QAIA,IAAA,CAAA,KAAA,GAAmB,IAAI,CAAC,SAAS,KAAK,CAAC,EAAE,mBAAC,MAAa,GAAE,MAAM,IAAI,kBAAkB,CAAC;YAClF,OAAO,GAAG,KAAK,WAAW,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAA9D;;;;QAKA,IAAA,CAAA,MAAA,GAAoB,IAAI,CAAC,SAAS;YAC5B,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAA5F;;;;QAGA,IAAA,CAAA,GAAA,GAAiB,IAAI,CAAC,SAAS,IAAI,kBAAkB,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC;YACzE,CAAC,mBAAC,MAAa,GAAE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AA,sBAAA,GAAA;;IAEE,IAAI,mBAAmB,EAAE;QACvB,OAAO,mBAAmB,CAAC;KAC5B;;;;IAKD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,CAAC,QAAQ,EAAE;QAC7C,mBAAmB,GAAG,IAAI,GAAG,CAAC,mBAAmB,CAAC,CAAC;QACnD,OAAO,mBAAmB,CAAC;KAC5B;IAED,qBAAI,gBAAgB,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACvD,mBAAmB,GAAG,IAAI,GAAG,CAAC,mBAAmB,CAAC,MAAM,CAAC,KAAK,IAAhE;QACI,gBAAgB,CAAC,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAC7C,OAAO,gBAAgB,CAAC,IAAI,KAAK,KAAK,CAAC;KACxC,CAAC,CAAC,CAAC;IAEJ,OAAO,mBAAmB,CAAC;CAC5B;;;;;;;AD5ED,AACA,AAMA,AAAA,MAAA,cAAA,CAAA;;;IAHA,EAAA,IAAA,EAAC,QAAQ,EAAT,IAAA,EAAA,CAAU;gBACR,SAAS,EAAE,CAAC,QAAQ,CAAC;aACtB,EAAD,EAAA;;;;;;;;GDNA,AACA,AACA,AAAkC;;;;;;;;GDNlC,AAA6B;;"}
|
package/esm2015/scrolling.js
CHANGED
|
@@ -291,11 +291,12 @@ const DEFAULT_RESIZE_TIME = 20;
|
|
|
291
291
|
*/
|
|
292
292
|
class ViewportRuler {
|
|
293
293
|
/**
|
|
294
|
-
* @param {?}
|
|
294
|
+
* @param {?} _platform
|
|
295
295
|
* @param {?} ngZone
|
|
296
296
|
*/
|
|
297
|
-
constructor(
|
|
298
|
-
this.
|
|
297
|
+
constructor(_platform, ngZone) {
|
|
298
|
+
this._platform = _platform;
|
|
299
|
+
this._change = _platform.isBrowser ? ngZone.runOutsideAngular(() => {
|
|
299
300
|
return merge(fromEvent(window, 'resize'), fromEvent(window, 'orientationchange'));
|
|
300
301
|
}) : of();
|
|
301
302
|
this._invalidateCache = this.change().subscribe(() => this._updateViewportSize());
|
|
@@ -314,7 +315,12 @@ class ViewportRuler {
|
|
|
314
315
|
if (!this._viewportSize) {
|
|
315
316
|
this._updateViewportSize();
|
|
316
317
|
}
|
|
317
|
-
|
|
318
|
+
const /** @type {?} */ output = { width: this._viewportSize.width, height: this._viewportSize.height };
|
|
319
|
+
// If we're not on a browser, don't cache the size since it'll be mocked out anyway.
|
|
320
|
+
if (!this._platform.isBrowser) {
|
|
321
|
+
this._viewportSize = /** @type {?} */ ((null));
|
|
322
|
+
}
|
|
323
|
+
return output;
|
|
318
324
|
}
|
|
319
325
|
/**
|
|
320
326
|
* Gets a ClientRect for the viewport's bounds.
|
|
@@ -346,6 +352,11 @@ class ViewportRuler {
|
|
|
346
352
|
* @return {?}
|
|
347
353
|
*/
|
|
348
354
|
getViewportScrollPosition() {
|
|
355
|
+
// While we can get a reference to the fake document
|
|
356
|
+
// during SSR, it doesn't have getBoundingClientRect.
|
|
357
|
+
if (!this._platform.isBrowser) {
|
|
358
|
+
return { top: 0, left: 0 };
|
|
359
|
+
}
|
|
349
360
|
// The top-left-corner of the viewport is determined by the scroll position of the document
|
|
350
361
|
// body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about
|
|
351
362
|
// whether `document.body` or `document.documentElement` is the scrolled element, so reading
|
|
@@ -372,7 +383,9 @@ class ViewportRuler {
|
|
|
372
383
|
* @return {?}
|
|
373
384
|
*/
|
|
374
385
|
_updateViewportSize() {
|
|
375
|
-
this._viewportSize =
|
|
386
|
+
this._viewportSize = this._platform.isBrowser ?
|
|
387
|
+
{ width: window.innerWidth, height: window.innerHeight } :
|
|
388
|
+
{ width: 0, height: 0 };
|
|
376
389
|
}
|
|
377
390
|
}
|
|
378
391
|
ViewportRuler.decorators = [
|
package/esm2015/scrolling.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scrolling.js","sources":["../../../src/cdk/scrolling/index.ts","../../../src/cdk/scrolling/public-api.ts","../../../src/cdk/scrolling/scrolling-module.ts","../../../src/cdk/scrolling/viewport-ruler.ts","../../../src/cdk/scrolling/scrollable.ts","../../../src/cdk/scrolling/scroll-dispatcher.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\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\nexport * from './scroll-dispatcher';\nexport * from './scrollable';\nexport * from './viewport-ruler';\nexport * from './scrolling-module';\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 {NgModule} from '@angular/core';\nimport {SCROLL_DISPATCHER_PROVIDER} from './scroll-dispatcher';\nimport {CdkScrollable} from './scrollable';\nimport {PlatformModule} from '@angular/cdk/platform';\n\n@NgModule({\n imports: [PlatformModule],\n exports: [CdkScrollable],\n declarations: [CdkScrollable],\n providers: [SCROLL_DISPATCHER_PROVIDER],\n})\nexport class ScrollDispatchModule {}\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 {Injectable, Optional, SkipSelf, NgZone, OnDestroy} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\nimport {Observable} from 'rxjs/Observable';\nimport {fromEvent} from 'rxjs/observable/fromEvent';\nimport {merge} from 'rxjs/observable/merge';\nimport {auditTime} from 'rxjs/operators/auditTime';\nimport {Subscription} from 'rxjs/Subscription';\nimport {of as observableOf} from 'rxjs/observable/of';\n\n/** Time in ms to throttle the resize events by default. */\nexport const DEFAULT_RESIZE_TIME = 20;\n\n/**\n * Simple utility for getting the bounds of the browser viewport.\n * @docs-private\n */\n@Injectable()\nexport class ViewportRuler implements OnDestroy {\n /** Cached viewport dimensions. */\n private _viewportSize: {width: number; height: number};\n\n /** Stream of viewport change events. */\n private _change: Observable<Event>;\n\n /** Subscription to streams that invalidate the cached viewport dimensions. */\n private _invalidateCache: Subscription;\n\n constructor(platform: Platform, ngZone: NgZone) {\n this._change = platform.isBrowser ? ngZone.runOutsideAngular(() => {\n return merge<Event>(fromEvent(window, 'resize'), fromEvent(window, 'orientationchange'));\n }) : observableOf();\n\n this._invalidateCache = this.change().subscribe(() => this._updateViewportSize());\n }\n\n ngOnDestroy() {\n this._invalidateCache.unsubscribe();\n }\n\n /** Returns the viewport's width and height. */\n getViewportSize(): Readonly<{width: number, height: number}> {\n if (!this._viewportSize) {\n this._updateViewportSize();\n }\n\n return {width: this._viewportSize.width, height: this._viewportSize.height};\n }\n\n /** Gets a ClientRect for the viewport's bounds. */\n getViewportRect(): ClientRect {\n // Use the document element's bounding rect rather than the window scroll properties\n // (e.g. pageYOffset, scrollY) due to in issue in Chrome and IE where window scroll\n // properties and client coordinates (boundingClientRect, clientX/Y, etc.) are in different\n // conceptual viewports. Under most circumstances these viewports are equivalent, but they\n // can disagree when the page is pinch-zoomed (on devices that support touch).\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=489206#c4\n // We use the documentElement instead of the body because, by default (without a css reset)\n // browsers typically give the document body an 8px margin, which is not included in\n // getBoundingClientRect().\n const scrollPosition = this.getViewportScrollPosition();\n const {width, height} = this.getViewportSize();\n\n return {\n top: scrollPosition.top,\n left: scrollPosition.left,\n bottom: scrollPosition.top + height,\n right: scrollPosition.left + width,\n height,\n width,\n };\n }\n\n /** Gets the (top, left) scroll position of the viewport. */\n getViewportScrollPosition() {\n // The top-left-corner of the viewport is determined by the scroll position of the document\n // body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about\n // whether `document.body` or `document.documentElement` is the scrolled element, so reading\n // `scrollTop` and `scrollLeft` is inconsistent. However, using the bounding rect of\n // `document.documentElement` works consistently, where the `top` and `left` values will\n // equal negative the scroll position.\n const documentRect = document.documentElement.getBoundingClientRect();\n\n const top = -documentRect.top || document.body.scrollTop || window.scrollY ||\n document.documentElement.scrollTop || 0;\n\n const left = -documentRect.left || document.body.scrollLeft || window.scrollX ||\n document.documentElement.scrollLeft || 0;\n\n return {top, left};\n }\n\n /**\n * Returns a stream that emits whenever the size of the viewport changes.\n * @param throttle Time in milliseconds to throttle the stream.\n */\n change(throttleTime: number = DEFAULT_RESIZE_TIME): Observable<Event> {\n return throttleTime > 0 ? this._change.pipe(auditTime(throttleTime)) : this._change;\n }\n\n /** Updates the cached viewport size. */\n private _updateViewportSize() {\n this._viewportSize = {width: window.innerWidth, height: window.innerHeight};\n }\n}\n\n/** @docs-private */\nexport function VIEWPORT_RULER_PROVIDER_FACTORY(parentRuler: ViewportRuler,\n platform: Platform,\n ngZone: NgZone) {\n return parentRuler || new ViewportRuler(platform, ngZone);\n}\n\n/** @docs-private */\nexport const VIEWPORT_RULER_PROVIDER = {\n // If there is already a ViewportRuler available, use that. Otherwise, provide a new one.\n provide: ViewportRuler,\n deps: [[new Optional(), new SkipSelf(), ViewportRuler], Platform, NgZone],\n useFactory: VIEWPORT_RULER_PROVIDER_FACTORY\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 {Directive, ElementRef, OnInit, OnDestroy, NgZone} from '@angular/core';\nimport {Observable} from 'rxjs/Observable';\nimport {Subject} from 'rxjs/Subject';\nimport {ScrollDispatcher} from './scroll-dispatcher';\n\n\n/**\n * Sends an event when the directive's element is scrolled. Registers itself with the\n * ScrollDispatcher service to include itself as part of its collection of scrolling events that it\n * can be listened to through the service.\n */\n@Directive({\n selector: '[cdk-scrollable], [cdkScrollable]'\n})\nexport class CdkScrollable implements OnInit, OnDestroy {\n private _elementScrolled: Subject<Event> = new Subject();\n private _scrollListener = (event: Event) => this._elementScrolled.next(event);\n\n constructor(private _elementRef: ElementRef,\n private _scroll: ScrollDispatcher,\n private _ngZone: NgZone) {}\n\n ngOnInit() {\n this._ngZone.runOutsideAngular(() => {\n this.getElementRef().nativeElement.addEventListener('scroll', this._scrollListener);\n });\n\n this._scroll.register(this);\n }\n\n ngOnDestroy() {\n this._scroll.deregister(this);\n\n if (this._scrollListener) {\n this.getElementRef().nativeElement.removeEventListener('scroll', this._scrollListener);\n }\n }\n\n /**\n * Returns observable that emits when a scroll event is fired on the host element.\n */\n elementScrolled(): Observable<any> {\n return this._elementScrolled.asObservable();\n }\n\n getElementRef(): ElementRef {\n return this._elementRef;\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 {ElementRef, Injectable, NgZone, Optional, SkipSelf, OnDestroy} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\nimport {Subject} from 'rxjs/Subject';\nimport {Subscription} from 'rxjs/Subscription';\nimport {Observable} from 'rxjs/Observable';\nimport {of as observableOf} from 'rxjs/observable/of';\nimport {fromEvent} from 'rxjs/observable/fromEvent';\nimport {auditTime} from 'rxjs/operators/auditTime';\nimport {filter} from 'rxjs/operators/filter';\nimport {CdkScrollable} from './scrollable';\n\n\n/** Time in ms to throttle the scrolling events by default. */\nexport const DEFAULT_SCROLL_TIME = 20;\n\n/**\n * Service contained all registered Scrollable references and emits an event when any one of the\n * Scrollable references emit a scrolled event.\n */\n@Injectable()\nexport class ScrollDispatcher implements OnDestroy {\n constructor(private _ngZone: NgZone, private _platform: Platform) { }\n\n /** Subject for notifying that a registered scrollable reference element has been scrolled. */\n private _scrolled = new Subject<CdkScrollable|void>();\n\n /** Keeps track of the global `scroll` and `resize` subscriptions. */\n _globalSubscription: Subscription | null = null;\n\n /** Keeps track of the amount of subscriptions to `scrolled`. Used for cleaning up afterwards. */\n private _scrolledCount = 0;\n\n /**\n * Map of all the scrollable references that are registered with the service and their\n * scroll event subscriptions.\n */\n scrollContainers: Map<CdkScrollable, Subscription> = new Map();\n\n /**\n * Registers a scrollable instance with the service and listens for its scrolled events. When the\n * scrollable is scrolled, the service emits the event to its scrolled observable.\n * @param scrollable Scrollable instance to be registered.\n */\n register(scrollable: CdkScrollable): void {\n const scrollSubscription = scrollable.elementScrolled()\n .subscribe(() => this._scrolled.next(scrollable));\n\n this.scrollContainers.set(scrollable, scrollSubscription);\n }\n\n /**\n * Deregisters a Scrollable reference and unsubscribes from its scroll event observable.\n * @param scrollable Scrollable instance to be deregistered.\n */\n deregister(scrollable: CdkScrollable): void {\n const scrollableReference = this.scrollContainers.get(scrollable);\n\n if (scrollableReference) {\n scrollableReference.unsubscribe();\n this.scrollContainers.delete(scrollable);\n }\n }\n\n /**\n * Returns an observable that emits an event whenever any of the registered Scrollable\n * references (or window, document, or body) fire a scrolled event. Can provide a time in ms\n * to override the default \"throttle\" time.\n *\n * **Note:** in order to avoid hitting change detection for every scroll event,\n * all of the events emitted from this stream will be run outside the Angular zone.\n * If you need to update any data bindings as a result of a scroll event, you have\n * to run the callback using `NgZone.run`.\n */\n scrolled(auditTimeInMs: number = DEFAULT_SCROLL_TIME): Observable<CdkScrollable|void> {\n return this._platform.isBrowser ? Observable.create(observer => {\n if (!this._globalSubscription) {\n this._addGlobalListener();\n }\n\n // In the case of a 0ms delay, use an observable without auditTime\n // since it does add a perceptible delay in processing overhead.\n const subscription = auditTimeInMs > 0 ?\n this._scrolled.pipe(auditTime(auditTimeInMs)).subscribe(observer) :\n this._scrolled.subscribe(observer);\n\n this._scrolledCount++;\n\n return () => {\n subscription.unsubscribe();\n this._scrolledCount--;\n\n if (!this._scrolledCount) {\n this._removeGlobalListener();\n }\n };\n }) : observableOf<void>();\n }\n\n ngOnDestroy() {\n this._removeGlobalListener();\n this.scrollContainers.forEach((_, container) => this.deregister(container));\n }\n\n /**\n * Returns an observable that emits whenever any of the\n * scrollable ancestors of an element are scrolled.\n * @param elementRef Element whose ancestors to listen for.\n * @param auditTimeInMs Time to throttle the scroll events.\n */\n ancestorScrolled(elementRef: ElementRef, auditTimeInMs?: number): Observable<CdkScrollable|void> {\n const ancestors = this.getAncestorScrollContainers(elementRef);\n\n return this.scrolled(auditTimeInMs).pipe(filter(target => {\n return !target || ancestors.indexOf(target) > -1;\n }));\n }\n\n /** Returns all registered Scrollables that contain the provided element. */\n getAncestorScrollContainers(elementRef: ElementRef): CdkScrollable[] {\n const scrollingContainers: CdkScrollable[] = [];\n\n this.scrollContainers.forEach((_subscription: Subscription, scrollable: CdkScrollable) => {\n if (this._scrollableContainsElement(scrollable, elementRef)) {\n scrollingContainers.push(scrollable);\n }\n });\n\n return scrollingContainers;\n }\n\n /** Returns true if the element is contained within the provided Scrollable. */\n private _scrollableContainsElement(scrollable: CdkScrollable, elementRef: ElementRef): boolean {\n let element = elementRef.nativeElement;\n let scrollableElement = scrollable.getElementRef().nativeElement;\n\n // Traverse through the element parents until we reach null, checking if any of the elements\n // are the scrollable's element.\n do {\n if (element == scrollableElement) { return true; }\n } while (element = element.parentElement);\n\n return false;\n }\n\n /** Sets up the global scroll listeners. */\n private _addGlobalListener() {\n this._globalSubscription = this._ngZone.runOutsideAngular(() => {\n return fromEvent(window.document, 'scroll').subscribe(() => this._scrolled.next());\n });\n }\n\n /** Cleans up the global scroll listener. */\n private _removeGlobalListener() {\n if (this._globalSubscription) {\n this._globalSubscription.unsubscribe();\n this._globalSubscription = null;\n }\n }\n}\n\n/** @docs-private */\nexport function SCROLL_DISPATCHER_PROVIDER_FACTORY(\n parentDispatcher: ScrollDispatcher, ngZone: NgZone, platform: Platform) {\n return parentDispatcher || new ScrollDispatcher(ngZone, platform);\n}\n\n/** @docs-private */\nexport const SCROLL_DISPATCHER_PROVIDER = {\n // If there is already a ScrollDispatcher available, use that. Otherwise, provide a new one.\n provide: ScrollDispatcher,\n deps: [[new Optional(), new SkipSelf(), ScrollDispatcher], NgZone, Platform],\n useFactory: SCROLL_DISPATCHER_PROVIDER_FACTORY\n};\n"],"names":["observableOf"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AKQA,AACA,AACA,AAEA,AACA,AAC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AAgD,WAA0B,EAC1B,QAAkB,EAClB,MAAc,EAF9D;IAGE,OAAO,WAAW,IAAI,IAAI,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;CAC3D;;;;AAGD,AAAO,MAAM,uBAAuB,GAAG;;IAErC,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,CAAC,CAAC,IAAI,QAAQ,EAAE,EAAE,IAAI,QAAQ,EAAE,EAAE,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC;IACzE,UAAU,EAAE,+BAA+B;CAC5C,CAAC;;;;;;;ADtHF,AACA,AACA,AACA,AAQA,AAAA,MAAA,oBAAA,CAAA;;;IANA,EAAA,IAAA,EAAC,QAAQ,EAAT,IAAA,EAAA,CAAU;gBACR,OAAO,EAAE,CAAC,cAAc,CAAC;gBACzB,OAAO,EAAE,CAAC,aAAa,CAAC;gBACxB,YAAY,EAAE,CAAC,aAAa,CAAC;gBAC7B,SAAS,EAAE,CAAC,0BAA0B,CAAC;aACxC,EAAD,EAAA;;;;;;;;GDVA,AACA,AACA,AACA,AAAmC;;;;;;;;GDPnC,AAA6B;;"}
|
|
1
|
+
{"version":3,"file":"scrolling.js","sources":["../../../src/cdk/scrolling/index.ts","../../../src/cdk/scrolling/public-api.ts","../../../src/cdk/scrolling/scrolling-module.ts","../../../src/cdk/scrolling/viewport-ruler.ts","../../../src/cdk/scrolling/scrollable.ts","../../../src/cdk/scrolling/scroll-dispatcher.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\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\nexport * from './scroll-dispatcher';\nexport * from './scrollable';\nexport * from './viewport-ruler';\nexport * from './scrolling-module';\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 {NgModule} from '@angular/core';\nimport {SCROLL_DISPATCHER_PROVIDER} from './scroll-dispatcher';\nimport {CdkScrollable} from './scrollable';\nimport {PlatformModule} from '@angular/cdk/platform';\n\n@NgModule({\n imports: [PlatformModule],\n exports: [CdkScrollable],\n declarations: [CdkScrollable],\n providers: [SCROLL_DISPATCHER_PROVIDER],\n})\nexport class ScrollDispatchModule {}\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 {Injectable, Optional, SkipSelf, NgZone, OnDestroy} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\nimport {Observable} from 'rxjs/Observable';\nimport {fromEvent} from 'rxjs/observable/fromEvent';\nimport {merge} from 'rxjs/observable/merge';\nimport {auditTime} from 'rxjs/operators/auditTime';\nimport {Subscription} from 'rxjs/Subscription';\nimport {of as observableOf} from 'rxjs/observable/of';\n\n/** Time in ms to throttle the resize events by default. */\nexport const DEFAULT_RESIZE_TIME = 20;\n\n/**\n * Simple utility for getting the bounds of the browser viewport.\n * @docs-private\n */\n@Injectable()\nexport class ViewportRuler implements OnDestroy {\n /** Cached viewport dimensions. */\n private _viewportSize: {width: number; height: number};\n\n /** Stream of viewport change events. */\n private _change: Observable<Event>;\n\n /** Subscription to streams that invalidate the cached viewport dimensions. */\n private _invalidateCache: Subscription;\n\n constructor(private _platform: Platform, ngZone: NgZone) {\n this._change = _platform.isBrowser ? ngZone.runOutsideAngular(() => {\n return merge<Event>(fromEvent(window, 'resize'), fromEvent(window, 'orientationchange'));\n }) : observableOf();\n\n this._invalidateCache = this.change().subscribe(() => this._updateViewportSize());\n }\n\n ngOnDestroy() {\n this._invalidateCache.unsubscribe();\n }\n\n /** Returns the viewport's width and height. */\n getViewportSize(): Readonly<{width: number, height: number}> {\n if (!this._viewportSize) {\n this._updateViewportSize();\n }\n\n const output = {width: this._viewportSize.width, height: this._viewportSize.height};\n\n // If we're not on a browser, don't cache the size since it'll be mocked out anyway.\n if (!this._platform.isBrowser) {\n this._viewportSize = null!;\n }\n\n return output;\n }\n\n /** Gets a ClientRect for the viewport's bounds. */\n getViewportRect(): ClientRect {\n // Use the document element's bounding rect rather than the window scroll properties\n // (e.g. pageYOffset, scrollY) due to in issue in Chrome and IE where window scroll\n // properties and client coordinates (boundingClientRect, clientX/Y, etc.) are in different\n // conceptual viewports. Under most circumstances these viewports are equivalent, but they\n // can disagree when the page is pinch-zoomed (on devices that support touch).\n // See https://bugs.chromium.org/p/chromium/issues/detail?id=489206#c4\n // We use the documentElement instead of the body because, by default (without a css reset)\n // browsers typically give the document body an 8px margin, which is not included in\n // getBoundingClientRect().\n const scrollPosition = this.getViewportScrollPosition();\n const {width, height} = this.getViewportSize();\n\n return {\n top: scrollPosition.top,\n left: scrollPosition.left,\n bottom: scrollPosition.top + height,\n right: scrollPosition.left + width,\n height,\n width,\n };\n }\n\n /** Gets the (top, left) scroll position of the viewport. */\n getViewportScrollPosition() {\n // While we can get a reference to the fake document\n // during SSR, it doesn't have getBoundingClientRect.\n if (!this._platform.isBrowser) {\n return {top: 0, left: 0};\n }\n\n // The top-left-corner of the viewport is determined by the scroll position of the document\n // body, normally just (scrollLeft, scrollTop). However, Chrome and Firefox disagree about\n // whether `document.body` or `document.documentElement` is the scrolled element, so reading\n // `scrollTop` and `scrollLeft` is inconsistent. However, using the bounding rect of\n // `document.documentElement` works consistently, where the `top` and `left` values will\n // equal negative the scroll position.\n const documentRect = document.documentElement.getBoundingClientRect();\n\n const top = -documentRect.top || document.body.scrollTop || window.scrollY ||\n document.documentElement.scrollTop || 0;\n\n const left = -documentRect.left || document.body.scrollLeft || window.scrollX ||\n document.documentElement.scrollLeft || 0;\n\n return {top, left};\n }\n\n /**\n * Returns a stream that emits whenever the size of the viewport changes.\n * @param throttle Time in milliseconds to throttle the stream.\n */\n change(throttleTime: number = DEFAULT_RESIZE_TIME): Observable<Event> {\n return throttleTime > 0 ? this._change.pipe(auditTime(throttleTime)) : this._change;\n }\n\n /** Updates the cached viewport size. */\n private _updateViewportSize() {\n this._viewportSize = this._platform.isBrowser ?\n {width: window.innerWidth, height: window.innerHeight} :\n {width: 0, height: 0};\n }\n}\n\n/** @docs-private */\nexport function VIEWPORT_RULER_PROVIDER_FACTORY(parentRuler: ViewportRuler,\n platform: Platform,\n ngZone: NgZone) {\n return parentRuler || new ViewportRuler(platform, ngZone);\n}\n\n/** @docs-private */\nexport const VIEWPORT_RULER_PROVIDER = {\n // If there is already a ViewportRuler available, use that. Otherwise, provide a new one.\n provide: ViewportRuler,\n deps: [[new Optional(), new SkipSelf(), ViewportRuler], Platform, NgZone],\n useFactory: VIEWPORT_RULER_PROVIDER_FACTORY\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 {Directive, ElementRef, OnInit, OnDestroy, NgZone} from '@angular/core';\nimport {Observable} from 'rxjs/Observable';\nimport {Subject} from 'rxjs/Subject';\nimport {ScrollDispatcher} from './scroll-dispatcher';\n\n\n/**\n * Sends an event when the directive's element is scrolled. Registers itself with the\n * ScrollDispatcher service to include itself as part of its collection of scrolling events that it\n * can be listened to through the service.\n */\n@Directive({\n selector: '[cdk-scrollable], [cdkScrollable]'\n})\nexport class CdkScrollable implements OnInit, OnDestroy {\n private _elementScrolled: Subject<Event> = new Subject();\n private _scrollListener = (event: Event) => this._elementScrolled.next(event);\n\n constructor(private _elementRef: ElementRef,\n private _scroll: ScrollDispatcher,\n private _ngZone: NgZone) {}\n\n ngOnInit() {\n this._ngZone.runOutsideAngular(() => {\n this.getElementRef().nativeElement.addEventListener('scroll', this._scrollListener);\n });\n\n this._scroll.register(this);\n }\n\n ngOnDestroy() {\n this._scroll.deregister(this);\n\n if (this._scrollListener) {\n this.getElementRef().nativeElement.removeEventListener('scroll', this._scrollListener);\n }\n }\n\n /**\n * Returns observable that emits when a scroll event is fired on the host element.\n */\n elementScrolled(): Observable<any> {\n return this._elementScrolled.asObservable();\n }\n\n getElementRef(): ElementRef {\n return this._elementRef;\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 {ElementRef, Injectable, NgZone, Optional, SkipSelf, OnDestroy} from '@angular/core';\nimport {Platform} from '@angular/cdk/platform';\nimport {Subject} from 'rxjs/Subject';\nimport {Subscription} from 'rxjs/Subscription';\nimport {Observable} from 'rxjs/Observable';\nimport {of as observableOf} from 'rxjs/observable/of';\nimport {fromEvent} from 'rxjs/observable/fromEvent';\nimport {auditTime} from 'rxjs/operators/auditTime';\nimport {filter} from 'rxjs/operators/filter';\nimport {CdkScrollable} from './scrollable';\n\n\n/** Time in ms to throttle the scrolling events by default. */\nexport const DEFAULT_SCROLL_TIME = 20;\n\n/**\n * Service contained all registered Scrollable references and emits an event when any one of the\n * Scrollable references emit a scrolled event.\n */\n@Injectable()\nexport class ScrollDispatcher implements OnDestroy {\n constructor(private _ngZone: NgZone, private _platform: Platform) { }\n\n /** Subject for notifying that a registered scrollable reference element has been scrolled. */\n private _scrolled = new Subject<CdkScrollable|void>();\n\n /** Keeps track of the global `scroll` and `resize` subscriptions. */\n _globalSubscription: Subscription | null = null;\n\n /** Keeps track of the amount of subscriptions to `scrolled`. Used for cleaning up afterwards. */\n private _scrolledCount = 0;\n\n /**\n * Map of all the scrollable references that are registered with the service and their\n * scroll event subscriptions.\n */\n scrollContainers: Map<CdkScrollable, Subscription> = new Map();\n\n /**\n * Registers a scrollable instance with the service and listens for its scrolled events. When the\n * scrollable is scrolled, the service emits the event to its scrolled observable.\n * @param scrollable Scrollable instance to be registered.\n */\n register(scrollable: CdkScrollable): void {\n const scrollSubscription = scrollable.elementScrolled()\n .subscribe(() => this._scrolled.next(scrollable));\n\n this.scrollContainers.set(scrollable, scrollSubscription);\n }\n\n /**\n * Deregisters a Scrollable reference and unsubscribes from its scroll event observable.\n * @param scrollable Scrollable instance to be deregistered.\n */\n deregister(scrollable: CdkScrollable): void {\n const scrollableReference = this.scrollContainers.get(scrollable);\n\n if (scrollableReference) {\n scrollableReference.unsubscribe();\n this.scrollContainers.delete(scrollable);\n }\n }\n\n /**\n * Returns an observable that emits an event whenever any of the registered Scrollable\n * references (or window, document, or body) fire a scrolled event. Can provide a time in ms\n * to override the default \"throttle\" time.\n *\n * **Note:** in order to avoid hitting change detection for every scroll event,\n * all of the events emitted from this stream will be run outside the Angular zone.\n * If you need to update any data bindings as a result of a scroll event, you have\n * to run the callback using `NgZone.run`.\n */\n scrolled(auditTimeInMs: number = DEFAULT_SCROLL_TIME): Observable<CdkScrollable|void> {\n return this._platform.isBrowser ? Observable.create(observer => {\n if (!this._globalSubscription) {\n this._addGlobalListener();\n }\n\n // In the case of a 0ms delay, use an observable without auditTime\n // since it does add a perceptible delay in processing overhead.\n const subscription = auditTimeInMs > 0 ?\n this._scrolled.pipe(auditTime(auditTimeInMs)).subscribe(observer) :\n this._scrolled.subscribe(observer);\n\n this._scrolledCount++;\n\n return () => {\n subscription.unsubscribe();\n this._scrolledCount--;\n\n if (!this._scrolledCount) {\n this._removeGlobalListener();\n }\n };\n }) : observableOf<void>();\n }\n\n ngOnDestroy() {\n this._removeGlobalListener();\n this.scrollContainers.forEach((_, container) => this.deregister(container));\n }\n\n /**\n * Returns an observable that emits whenever any of the\n * scrollable ancestors of an element are scrolled.\n * @param elementRef Element whose ancestors to listen for.\n * @param auditTimeInMs Time to throttle the scroll events.\n */\n ancestorScrolled(elementRef: ElementRef, auditTimeInMs?: number): Observable<CdkScrollable|void> {\n const ancestors = this.getAncestorScrollContainers(elementRef);\n\n return this.scrolled(auditTimeInMs).pipe(filter(target => {\n return !target || ancestors.indexOf(target) > -1;\n }));\n }\n\n /** Returns all registered Scrollables that contain the provided element. */\n getAncestorScrollContainers(elementRef: ElementRef): CdkScrollable[] {\n const scrollingContainers: CdkScrollable[] = [];\n\n this.scrollContainers.forEach((_subscription: Subscription, scrollable: CdkScrollable) => {\n if (this._scrollableContainsElement(scrollable, elementRef)) {\n scrollingContainers.push(scrollable);\n }\n });\n\n return scrollingContainers;\n }\n\n /** Returns true if the element is contained within the provided Scrollable. */\n private _scrollableContainsElement(scrollable: CdkScrollable, elementRef: ElementRef): boolean {\n let element = elementRef.nativeElement;\n let scrollableElement = scrollable.getElementRef().nativeElement;\n\n // Traverse through the element parents until we reach null, checking if any of the elements\n // are the scrollable's element.\n do {\n if (element == scrollableElement) { return true; }\n } while (element = element.parentElement);\n\n return false;\n }\n\n /** Sets up the global scroll listeners. */\n private _addGlobalListener() {\n this._globalSubscription = this._ngZone.runOutsideAngular(() => {\n return fromEvent(window.document, 'scroll').subscribe(() => this._scrolled.next());\n });\n }\n\n /** Cleans up the global scroll listener. */\n private _removeGlobalListener() {\n if (this._globalSubscription) {\n this._globalSubscription.unsubscribe();\n this._globalSubscription = null;\n }\n }\n}\n\n/** @docs-private */\nexport function SCROLL_DISPATCHER_PROVIDER_FACTORY(\n parentDispatcher: ScrollDispatcher, ngZone: NgZone, platform: Platform) {\n return parentDispatcher || new ScrollDispatcher(ngZone, platform);\n}\n\n/** @docs-private */\nexport const SCROLL_DISPATCHER_PROVIDER = {\n // If there is already a ScrollDispatcher available, use that. Otherwise, provide a new one.\n provide: ScrollDispatcher,\n deps: [[new Optional(), new SkipSelf(), ScrollDispatcher], NgZone, Platform],\n useFactory: SCROLL_DISPATCHER_PROVIDER_FACTORY\n};\n"],"names":["observableOf"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AKQA,AACA,AACA,AAEA,AACA,AACA,AACA,AACA;;;AAKA,AAAO,MAAM,mBAAmB,GAAG,EAAE,CAAC;;;;;AAOtC,AAAA,MAAA,gBAAA,CAAA;;;;;IACE,WAAF,CAAsB,OAAe,EAAU,SAAmB,EAAlE;QAAsB,IAAtB,CAAA,OAA6B,GAAP,OAAO,CAAQ;QAAU,IAA/C,CAAA,SAAwD,GAAT,SAA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AAC,EAAE,MAAM,EAAE,CAAC,EAAC,CAAC;;;;IApG9B,EAAA,IAAA,EAAC,UAAU,EAAX;;;;IAfA,EAAA,IAAA,EAAQ,QAAQ,GAAhB;IADA,EAAA,IAAA,EAAwC,MAAM,GAA9C;;;;;;;;;AAyHA,AAAA,SAAA,+BAAA,CAAgD,WAA0B,EAC1B,QAAkB,EAClB,MAAc,EAF9D;IAGE,OAAO,WAAW,IAAI,IAAI,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;CAC3D;;;;AAGD,AAAO,MAAM,uBAAuB,GAAG;;IAErC,OAAO,EAAE,aAAa;IACtB,IAAI,EAAE,CAAC,CAAC,IAAI,QAAQ,EAAE,EAAE,IAAI,QAAQ,EAAE,EAAE,aAAa,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC;IACzE,UAAU,EAAE,+BAA+B;CAC5C,CAAC;;;;;;;ADrIF,AACA,AACA,AACA,AAQA,AAAA,MAAA,oBAAA,CAAA;;;IANA,EAAA,IAAA,EAAC,QAAQ,EAAT,IAAA,EAAA,CAAU;gBACR,OAAO,EAAE,CAAC,cAAc,CAAC;gBACzB,OAAO,EAAE,CAAC,aAAa,CAAC;gBACxB,YAAY,EAAE,CAAC,aAAa,CAAC;gBAC7B,SAAS,EAAE,CAAC,0BAA0B,CAAC;aACxC,EAAD,EAAA;;;;;;;;GDVA,AACA,AACA,AACA,AAAmC;;;;;;;;GDPnC,AAA6B;;"}
|
package/esm2015/stepper.js
CHANGED
|
@@ -396,7 +396,9 @@ class CdkStepper {
|
|
|
396
396
|
if (this._linear && index >= 0) {
|
|
397
397
|
return steps.slice(0, index).some(step => {
|
|
398
398
|
const /** @type {?} */ control = step.stepControl;
|
|
399
|
-
const /** @type {?} */ isIncomplete = control ?
|
|
399
|
+
const /** @type {?} */ isIncomplete = control ?
|
|
400
|
+
(control.invalid || control.pending || !step.interacted) :
|
|
401
|
+
!step.completed;
|
|
400
402
|
return isIncomplete && !step.optional;
|
|
401
403
|
});
|
|
402
404
|
}
|
package/esm2015/stepper.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stepper.js","sources":["../../../src/cdk/stepper/index.ts","../../../src/cdk/stepper/public-api.ts","../../../src/cdk/stepper/stepper-module.ts","../../../src/cdk/stepper/stepper-button.ts","../../../src/cdk/stepper/stepper.ts","../../../src/cdk/stepper/step-label.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\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\nexport * from './stepper';\nexport * from './step-label';\nexport * from './stepper-button';\nexport * from './stepper-module';\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 {NgModule} from '@angular/core';\nimport {CdkStepper, CdkStep} from './stepper';\nimport {CommonModule} from '@angular/common';\nimport {CdkStepLabel} from './step-label';\nimport {CdkStepperNext, CdkStepperPrevious} from './stepper-button';\nimport {BidiModule} from '@angular/cdk/bidi';\n\n@NgModule({\n imports: [BidiModule, CommonModule],\n exports: [CdkStep, CdkStepper, CdkStepLabel, CdkStepperNext, CdkStepperPrevious],\n declarations: [CdkStep, CdkStepper, CdkStepLabel, CdkStepperNext, CdkStepperPrevious]\n})\nexport class CdkStepperModule {}\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 {Directive, Input} from '@angular/core';\nimport {CdkStepper} from './stepper';\n\n/** Button that moves to the next step in a stepper workflow. */\n@Directive({\n selector: 'button[cdkStepperNext]',\n host: {\n '(click)': '_stepper.next()',\n '[type]': 'type',\n }\n})\nexport class CdkStepperNext {\n /** Type of the next button. Defaults to \"submit\" if not specified. */\n @Input() type: string = 'submit';\n\n constructor(public _stepper: CdkStepper) {}\n}\n\n/** Button that moves to the previous step in a stepper workflow. */\n@Directive({\n selector: 'button[cdkStepperPrevious]',\n host: {\n '(click)': '_stepper.previous()',\n '[type]': 'type',\n }\n})\nexport class CdkStepperPrevious {\n /** Type of the previous button. Defaults to \"button\" if not specified. */\n @Input() type: string = 'button';\n\n constructor(public _stepper: CdkStepper) {}\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 {\n ContentChildren,\n EventEmitter,\n Input,\n Output,\n QueryList,\n Directive,\n ElementRef,\n Component,\n ContentChild,\n ViewChild,\n TemplateRef,\n ViewEncapsulation,\n Optional,\n Inject,\n forwardRef,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnChanges,\n OnDestroy\n} from '@angular/core';\nimport {\n LEFT_ARROW,\n RIGHT_ARROW,\n DOWN_ARROW,\n UP_ARROW,\n ENTER,\n SPACE,\n HOME,\n END,\n} from '@angular/cdk/keycodes';\nimport {CdkStepLabel} from './step-label';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {AbstractControl} from '@angular/forms';\nimport {Direction, Directionality} from '@angular/cdk/bidi';\nimport {Subject} from 'rxjs/Subject';\n\n/** Used to generate unique ID for each stepper component. */\nlet nextId = 0;\n\n/**\n * Position state of the content of each step in stepper that is used for transitioning\n * the content into correct position upon step selection change.\n */\nexport type StepContentPositionState = 'previous' | 'current' | 'next';\n\n/** Possible orientation of a stepper. */\nexport type StepperOrientation = 'horizontal' | 'vertical';\n\n/** Change event emitted on selection changes. */\nexport class StepperSelectionEvent {\n /** Index of the step now selected. */\n selectedIndex: number;\n\n /** Index of the step previously selected. */\n previouslySelectedIndex: number;\n\n /** The step instance now selected. */\n selectedStep: CdkStep;\n\n /** The step instance previously selected. */\n previouslySelectedStep: CdkStep;\n}\n\n@Component({\n moduleId: module.id,\n selector: 'cdk-step',\n exportAs: 'cdkStep',\n templateUrl: 'step.html',\n encapsulation: ViewEncapsulation.None,\n preserveWhitespaces: false,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CdkStep implements OnChanges {\n /** Template for step label if it exists. */\n @ContentChild(CdkStepLabel) stepLabel: CdkStepLabel;\n\n /** Template for step content. */\n @ViewChild(TemplateRef) content: TemplateRef<any>;\n\n /** The top level abstract control of the step. */\n @Input() stepControl: AbstractControl;\n\n /** Whether user has seen the expanded step content or not. */\n interacted = false;\n\n /** Label of the step. */\n @Input() label: string;\n\n /** Whether the user can return to this step once it has been marked as complted. */\n @Input()\n get editable(): boolean { return this._editable; }\n set editable(value: boolean) {\n this._editable = coerceBooleanProperty(value);\n }\n private _editable = true;\n\n /** Whether the completion of step is optional. */\n @Input()\n get optional(): boolean { return this._optional; }\n set optional(value: boolean) {\n this._optional = coerceBooleanProperty(value);\n }\n private _optional = false;\n\n /** Whether step is marked as completed. */\n @Input()\n get completed(): boolean {\n return this._customCompleted == null ? this._defaultCompleted : this._customCompleted;\n }\n set completed(value: boolean) {\n this._customCompleted = coerceBooleanProperty(value);\n }\n private _customCompleted: boolean | null = null;\n\n private get _defaultCompleted() {\n return this.stepControl ? this.stepControl.valid && this.interacted : this.interacted;\n }\n\n constructor(@Inject(forwardRef(() => CdkStepper)) private _stepper: CdkStepper) { }\n\n /** Selects this step component. */\n select(): void {\n this._stepper.selected = this;\n }\n\n /** Resets the step to its initial state. Note that this includes resetting form data. */\n reset(): void {\n this.interacted = false;\n\n if (this._customCompleted != null) {\n this._customCompleted = false;\n }\n\n if (this.stepControl) {\n this.stepControl.reset();\n }\n }\n\n ngOnChanges() {\n // Since basically all inputs of the MatStep get proxied through the view down to the\n // underlying MatStepHeader, we have to make sure that change detection runs correctly.\n this._stepper._stateChanged();\n }\n}\n\n@Directive({\n selector: '[cdkStepper]',\n exportAs: 'cdkStepper',\n})\nexport class CdkStepper implements OnDestroy {\n /** Emits when the component is destroyed. */\n protected _destroyed = new Subject<void>();\n\n /** The list of step components that the stepper is holding. */\n @ContentChildren(CdkStep) _steps: QueryList<CdkStep>;\n\n /** The list of step headers of the steps in the stepper. */\n _stepHeader: QueryList<ElementRef>;\n\n /** Whether the validity of previous steps should be checked or not. */\n @Input()\n get linear(): boolean { return this._linear; }\n set linear(value: boolean) { this._linear = coerceBooleanProperty(value); }\n private _linear = false;\n\n /** The index of the selected step. */\n @Input()\n get selectedIndex() { return this._selectedIndex; }\n set selectedIndex(index: number) {\n if (this._steps) {\n // Ensure that the index can't be out of bounds.\n if (index < 0 || index > this._steps.length - 1) {\n throw Error('cdkStepper: Cannot assign out-of-bounds value to `selectedIndex`.');\n }\n\n if (this._anyControlsInvalidOrPending(index) || index < this._selectedIndex &&\n !this._steps.toArray()[index].editable) {\n // remove focus from clicked step header if the step is not able to be selected\n this._stepHeader.toArray()[index].nativeElement.blur();\n } else if (this._selectedIndex != index) {\n this._emitStepperSelectionEvent(index);\n this._focusIndex = this._selectedIndex;\n }\n } else {\n this._selectedIndex = this._focusIndex = index;\n }\n }\n private _selectedIndex = 0;\n\n /** The step that is selected. */\n @Input()\n get selected(): CdkStep { return this._steps.toArray()[this.selectedIndex]; }\n set selected(step: CdkStep) {\n this.selectedIndex = this._steps.toArray().indexOf(step);\n }\n\n /** Event emitted when the selected step has changed. */\n @Output() selectionChange: EventEmitter<StepperSelectionEvent>\n = new EventEmitter<StepperSelectionEvent>();\n\n /** The index of the step that the focus can be set. */\n _focusIndex: number = 0;\n\n /** Used to track unique ID for each stepper component. */\n _groupId: number;\n\n protected _orientation: StepperOrientation = 'horizontal';\n\n constructor(\n @Optional() private _dir: Directionality,\n private _changeDetectorRef: ChangeDetectorRef) {\n this._groupId = nextId++;\n }\n\n ngOnDestroy() {\n this._destroyed.next();\n this._destroyed.complete();\n }\n\n /** Selects and focuses the next step in list. */\n next(): void {\n this.selectedIndex = Math.min(this._selectedIndex + 1, this._steps.length - 1);\n }\n\n /** Selects and focuses the previous step in list. */\n previous(): void {\n this.selectedIndex = Math.max(this._selectedIndex - 1, 0);\n }\n\n /** Resets the stepper to its initial state. Note that this includes clearing form data. */\n reset(): void {\n this.selectedIndex = 0;\n this._steps.forEach(step => step.reset());\n this._stateChanged();\n }\n\n /** Returns a unique id for each step label element. */\n _getStepLabelId(i: number): string {\n return `cdk-step-label-${this._groupId}-${i}`;\n }\n\n /** Returns unique id for each step content element. */\n _getStepContentId(i: number): string {\n return `cdk-step-content-${this._groupId}-${i}`;\n }\n\n /** Marks the component to be change detected. */\n _stateChanged() {\n this._changeDetectorRef.markForCheck();\n }\n\n /** Returns position state of the step with the given index. */\n _getAnimationDirection(index: number): StepContentPositionState {\n const position = index - this._selectedIndex;\n if (position < 0) {\n return this._layoutDirection() === 'rtl' ? 'next' : 'previous';\n } else if (position > 0) {\n return this._layoutDirection() === 'rtl' ? 'previous' : 'next';\n }\n return 'current';\n }\n\n /** Returns the type of icon to be displayed. */\n _getIndicatorType(index: number): 'number' | 'edit' | 'done' {\n const step = this._steps.toArray()[index];\n if (!step.completed || this._selectedIndex == index) {\n return 'number';\n } else {\n return step.editable ? 'edit' : 'done';\n }\n }\n\n private _emitStepperSelectionEvent(newIndex: number): void {\n const stepsArray = this._steps.toArray();\n this.selectionChange.emit({\n selectedIndex: newIndex,\n previouslySelectedIndex: this._selectedIndex,\n selectedStep: stepsArray[newIndex],\n previouslySelectedStep: stepsArray[this._selectedIndex],\n });\n this._selectedIndex = newIndex;\n this._stateChanged();\n }\n\n _onKeydown(event: KeyboardEvent) {\n const keyCode = event.keyCode;\n\n // Note that the left/right arrows work both in vertical and horizontal mode.\n if (keyCode === RIGHT_ARROW) {\n this._layoutDirection() === 'rtl' ? this._focusPreviousStep() : this._focusNextStep();\n event.preventDefault();\n }\n\n if (keyCode === LEFT_ARROW) {\n this._layoutDirection() === 'rtl' ? this._focusNextStep() : this._focusPreviousStep();\n event.preventDefault();\n }\n\n // Note that the up/down arrows only work in vertical mode.\n // See: https://www.w3.org/TR/wai-aria-practices-1.1/#tabpanel\n if (this._orientation === 'vertical' && (keyCode === UP_ARROW || keyCode === DOWN_ARROW)) {\n keyCode === UP_ARROW ? this._focusPreviousStep() : this._focusNextStep();\n event.preventDefault();\n }\n\n if (keyCode === SPACE || keyCode === ENTER) {\n this.selectedIndex = this._focusIndex;\n event.preventDefault();\n }\n\n if (keyCode === HOME) {\n this._focusStep(0);\n event.preventDefault();\n }\n\n if (keyCode === END) {\n this._focusStep(this._steps.length - 1);\n event.preventDefault();\n }\n }\n\n private _focusNextStep() {\n this._focusStep((this._focusIndex + 1) % this._steps.length);\n }\n\n private _focusPreviousStep() {\n this._focusStep((this._focusIndex + this._steps.length - 1) % this._steps.length);\n }\n\n private _focusStep(index: number) {\n this._focusIndex = index;\n this._stepHeader.toArray()[this._focusIndex].nativeElement.focus();\n }\n\n private _anyControlsInvalidOrPending(index: number): boolean {\n const steps = this._steps.toArray();\n\n steps[this._selectedIndex].interacted = true;\n\n if (this._linear && index >= 0) {\n return steps.slice(0, index).some(step => {\n const control = step.stepControl;\n const isIncomplete = control ? (control.invalid || control.pending) : !step.completed;\n return isIncomplete && !step.optional;\n });\n }\n\n return false;\n }\n\n private _layoutDirection(): Direction {\n return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';\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 {Directive, TemplateRef} from '@angular/core';\n\n@Directive({\n selector: '[cdkStepLabel]',\n})\nexport class CdkStepLabel {\n constructor(/** @docs-private */ public template: TemplateRef<any>) { }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AKQA,AAKA,AAAA,MAAA,YAAA,CAAA;;;;IACE,WAAF,CAA0C,QAA1C,EAAA;QAA0C,IAA1C,CAAA,QAAkD,GAAR,QAAQ,CAAlD;KAAyE;;;IAJzE,EAAA,IAAA,EAAC,SAAS,EAAV,IAAA,EAAA,CAAW;gBACT,QAAQ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per.js","sources":["../../../src/cdk/stepper/index.ts","../../../src/cdk/stepper/public-api.ts","../../../src/cdk/stepper/stepper-module.ts","../../../src/cdk/stepper/stepper-button.ts","../../../src/cdk/stepper/stepper.ts","../../../src/cdk/stepper/step-label.ts"],"sourcesContent":["/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\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\nexport * from './stepper';\nexport * from './step-label';\nexport * from './stepper-button';\nexport * from './stepper-module';\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 {NgModule} from '@angular/core';\nimport {CdkStepper, CdkStep} from './stepper';\nimport {CommonModule} from '@angular/common';\nimport {CdkStepLabel} from './step-label';\nimport {CdkStepperNext, CdkStepperPrevious} from './stepper-button';\nimport {BidiModule} from '@angular/cdk/bidi';\n\n@NgModule({\n imports: [BidiModule, CommonModule],\n exports: [CdkStep, CdkStepper, CdkStepLabel, CdkStepperNext, CdkStepperPrevious],\n declarations: [CdkStep, CdkStepper, CdkStepLabel, CdkStepperNext, CdkStepperPrevious]\n})\nexport class CdkStepperModule {}\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 {Directive, Input} from '@angular/core';\nimport {CdkStepper} from './stepper';\n\n/** Button that moves to the next step in a stepper workflow. */\n@Directive({\n selector: 'button[cdkStepperNext]',\n host: {\n '(click)': '_stepper.next()',\n '[type]': 'type',\n }\n})\nexport class CdkStepperNext {\n /** Type of the next button. Defaults to \"submit\" if not specified. */\n @Input() type: string = 'submit';\n\n constructor(public _stepper: CdkStepper) {}\n}\n\n/** Button that moves to the previous step in a stepper workflow. */\n@Directive({\n selector: 'button[cdkStepperPrevious]',\n host: {\n '(click)': '_stepper.previous()',\n '[type]': 'type',\n }\n})\nexport class CdkStepperPrevious {\n /** Type of the previous button. Defaults to \"button\" if not specified. */\n @Input() type: string = 'button';\n\n constructor(public _stepper: CdkStepper) {}\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 {\n ContentChildren,\n EventEmitter,\n Input,\n Output,\n QueryList,\n Directive,\n ElementRef,\n Component,\n ContentChild,\n ViewChild,\n TemplateRef,\n ViewEncapsulation,\n Optional,\n Inject,\n forwardRef,\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n OnChanges,\n OnDestroy\n} from '@angular/core';\nimport {\n LEFT_ARROW,\n RIGHT_ARROW,\n DOWN_ARROW,\n UP_ARROW,\n ENTER,\n SPACE,\n HOME,\n END,\n} from '@angular/cdk/keycodes';\nimport {CdkStepLabel} from './step-label';\nimport {coerceBooleanProperty} from '@angular/cdk/coercion';\nimport {AbstractControl} from '@angular/forms';\nimport {Direction, Directionality} from '@angular/cdk/bidi';\nimport {Subject} from 'rxjs/Subject';\n\n/** Used to generate unique ID for each stepper component. */\nlet nextId = 0;\n\n/**\n * Position state of the content of each step in stepper that is used for transitioning\n * the content into correct position upon step selection change.\n */\nexport type StepContentPositionState = 'previous' | 'current' | 'next';\n\n/** Possible orientation of a stepper. */\nexport type StepperOrientation = 'horizontal' | 'vertical';\n\n/** Change event emitted on selection changes. */\nexport class StepperSelectionEvent {\n /** Index of the step now selected. */\n selectedIndex: number;\n\n /** Index of the step previously selected. */\n previouslySelectedIndex: number;\n\n /** The step instance now selected. */\n selectedStep: CdkStep;\n\n /** The step instance previously selected. */\n previouslySelectedStep: CdkStep;\n}\n\n@Component({\n moduleId: module.id,\n selector: 'cdk-step',\n exportAs: 'cdkStep',\n templateUrl: 'step.html',\n encapsulation: ViewEncapsulation.None,\n preserveWhitespaces: false,\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class CdkStep implements OnChanges {\n /** Template for step label if it exists. */\n @ContentChild(CdkStepLabel) stepLabel: CdkStepLabel;\n\n /** Template for step content. */\n @ViewChild(TemplateRef) content: TemplateRef<any>;\n\n /** The top level abstract control of the step. */\n @Input() stepControl: AbstractControl;\n\n /** Whether user has seen the expanded step content or not. */\n interacted = false;\n\n /** Label of the step. */\n @Input() label: string;\n\n /** Whether the user can return to this step once it has been marked as complted. */\n @Input()\n get editable(): boolean { return this._editable; }\n set editable(value: boolean) {\n this._editable = coerceBooleanProperty(value);\n }\n private _editable = true;\n\n /** Whether the completion of step is optional. */\n @Input()\n get optional(): boolean { return this._optional; }\n set optional(value: boolean) {\n this._optional = coerceBooleanProperty(value);\n }\n private _optional = false;\n\n /** Whether step is marked as completed. */\n @Input()\n get completed(): boolean {\n return this._customCompleted == null ? this._defaultCompleted : this._customCompleted;\n }\n set completed(value: boolean) {\n this._customCompleted = coerceBooleanProperty(value);\n }\n private _customCompleted: boolean | null = null;\n\n private get _defaultCompleted() {\n return this.stepControl ? this.stepControl.valid && this.interacted : this.interacted;\n }\n\n constructor(@Inject(forwardRef(() => CdkStepper)) private _stepper: CdkStepper) { }\n\n /** Selects this step component. */\n select(): void {\n this._stepper.selected = this;\n }\n\n /** Resets the step to its initial state. Note that this includes resetting form data. */\n reset(): void {\n this.interacted = false;\n\n if (this._customCompleted != null) {\n this._customCompleted = false;\n }\n\n if (this.stepControl) {\n this.stepControl.reset();\n }\n }\n\n ngOnChanges() {\n // Since basically all inputs of the MatStep get proxied through the view down to the\n // underlying MatStepHeader, we have to make sure that change detection runs correctly.\n this._stepper._stateChanged();\n }\n}\n\n@Directive({\n selector: '[cdkStepper]',\n exportAs: 'cdkStepper',\n})\nexport class CdkStepper implements OnDestroy {\n /** Emits when the component is destroyed. */\n protected _destroyed = new Subject<void>();\n\n /** The list of step components that the stepper is holding. */\n @ContentChildren(CdkStep) _steps: QueryList<CdkStep>;\n\n /** The list of step headers of the steps in the stepper. */\n _stepHeader: QueryList<ElementRef>;\n\n /** Whether the validity of previous steps should be checked or not. */\n @Input()\n get linear(): boolean { return this._linear; }\n set linear(value: boolean) { this._linear = coerceBooleanProperty(value); }\n private _linear = false;\n\n /** The index of the selected step. */\n @Input()\n get selectedIndex() { return this._selectedIndex; }\n set selectedIndex(index: number) {\n if (this._steps) {\n // Ensure that the index can't be out of bounds.\n if (index < 0 || index > this._steps.length - 1) {\n throw Error('cdkStepper: Cannot assign out-of-bounds value to `selectedIndex`.');\n }\n\n if (this._anyControlsInvalidOrPending(index) || index < this._selectedIndex &&\n !this._steps.toArray()[index].editable) {\n // remove focus from clicked step header if the step is not able to be selected\n this._stepHeader.toArray()[index].nativeElement.blur();\n } else if (this._selectedIndex != index) {\n this._emitStepperSelectionEvent(index);\n this._focusIndex = this._selectedIndex;\n }\n } else {\n this._selectedIndex = this._focusIndex = index;\n }\n }\n private _selectedIndex = 0;\n\n /** The step that is selected. */\n @Input()\n get selected(): CdkStep { return this._steps.toArray()[this.selectedIndex]; }\n set selected(step: CdkStep) {\n this.selectedIndex = this._steps.toArray().indexOf(step);\n }\n\n /** Event emitted when the selected step has changed. */\n @Output() selectionChange: EventEmitter<StepperSelectionEvent>\n = new EventEmitter<StepperSelectionEvent>();\n\n /** The index of the step that the focus can be set. */\n _focusIndex: number = 0;\n\n /** Used to track unique ID for each stepper component. */\n _groupId: number;\n\n protected _orientation: StepperOrientation = 'horizontal';\n\n constructor(\n @Optional() private _dir: Directionality,\n private _changeDetectorRef: ChangeDetectorRef) {\n this._groupId = nextId++;\n }\n\n ngOnDestroy() {\n this._destroyed.next();\n this._destroyed.complete();\n }\n\n /** Selects and focuses the next step in list. */\n next(): void {\n this.selectedIndex = Math.min(this._selectedIndex + 1, this._steps.length - 1);\n }\n\n /** Selects and focuses the previous step in list. */\n previous(): void {\n this.selectedIndex = Math.max(this._selectedIndex - 1, 0);\n }\n\n /** Resets the stepper to its initial state. Note that this includes clearing form data. */\n reset(): void {\n this.selectedIndex = 0;\n this._steps.forEach(step => step.reset());\n this._stateChanged();\n }\n\n /** Returns a unique id for each step label element. */\n _getStepLabelId(i: number): string {\n return `cdk-step-label-${this._groupId}-${i}`;\n }\n\n /** Returns unique id for each step content element. */\n _getStepContentId(i: number): string {\n return `cdk-step-content-${this._groupId}-${i}`;\n }\n\n /** Marks the component to be change detected. */\n _stateChanged() {\n this._changeDetectorRef.markForCheck();\n }\n\n /** Returns position state of the step with the given index. */\n _getAnimationDirection(index: number): StepContentPositionState {\n const position = index - this._selectedIndex;\n if (position < 0) {\n return this._layoutDirection() === 'rtl' ? 'next' : 'previous';\n } else if (position > 0) {\n return this._layoutDirection() === 'rtl' ? 'previous' : 'next';\n }\n return 'current';\n }\n\n /** Returns the type of icon to be displayed. */\n _getIndicatorType(index: number): 'number' | 'edit' | 'done' {\n const step = this._steps.toArray()[index];\n if (!step.completed || this._selectedIndex == index) {\n return 'number';\n } else {\n return step.editable ? 'edit' : 'done';\n }\n }\n\n private _emitStepperSelectionEvent(newIndex: number): void {\n const stepsArray = this._steps.toArray();\n this.selectionChange.emit({\n selectedIndex: newIndex,\n previouslySelectedIndex: this._selectedIndex,\n selectedStep: stepsArray[newIndex],\n previouslySelectedStep: stepsArray[this._selectedIndex],\n });\n this._selectedIndex = newIndex;\n this._stateChanged();\n }\n\n _onKeydown(event: KeyboardEvent) {\n const keyCode = event.keyCode;\n\n // Note that the left/right arrows work both in vertical and horizontal mode.\n if (keyCode === RIGHT_ARROW) {\n this._layoutDirection() === 'rtl' ? this._focusPreviousStep() : this._focusNextStep();\n event.preventDefault();\n }\n\n if (keyCode === LEFT_ARROW) {\n this._layoutDirection() === 'rtl' ? this._focusNextStep() : this._focusPreviousStep();\n event.preventDefault();\n }\n\n // Note that the up/down arrows only work in vertical mode.\n // See: https://www.w3.org/TR/wai-aria-practices-1.1/#tabpanel\n if (this._orientation === 'vertical' && (keyCode === UP_ARROW || keyCode === DOWN_ARROW)) {\n keyCode === UP_ARROW ? this._focusPreviousStep() : this._focusNextStep();\n event.preventDefault();\n }\n\n if (keyCode === SPACE || keyCode === ENTER) {\n this.selectedIndex = this._focusIndex;\n event.preventDefault();\n }\n\n if (keyCode === HOME) {\n this._focusStep(0);\n event.preventDefault();\n }\n\n if (keyCode === END) {\n this._focusStep(this._steps.length - 1);\n event.preventDefault();\n }\n }\n\n private _focusNextStep() {\n this._focusStep((this._focusIndex + 1) % this._steps.length);\n }\n\n private _focusPreviousStep() {\n this._focusStep((this._focusIndex + this._steps.length - 1) % this._steps.length);\n }\n\n private _focusStep(index: number) {\n this._focusIndex = index;\n this._stepHeader.toArray()[this._focusIndex].nativeElement.focus();\n }\n\n private _anyControlsInvalidOrPending(index: number): boolean {\n const steps = this._steps.toArray();\n\n steps[this._selectedIndex].interacted = true;\n\n if (this._linear && index >= 0) {\n return steps.slice(0, index).some(step => {\n const control = step.stepControl;\n const isIncomplete = control ?\n (control.invalid || control.pending || !step.interacted) :\n !step.completed;\n return isIncomplete && !step.optional;\n });\n }\n\n return false;\n }\n\n private _layoutDirection(): Direction {\n return this._dir && this._dir.value === 'rtl' ? 'rtl' : 'ltr';\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 {Directive, TemplateRef} from '@angular/core';\n\n@Directive({\n selector: '[cdkStepLabel]',\n})\nexport class CdkStepLabel {\n constructor(/** @docs-private */ public template: TemplateRef<any>) { }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AKQA,AAKA,AAAA,MAAA,YAAA,CAAA;;;;IACE,WAAF,CAA0C,QAA1C,EAAA;QAA0C,IAA1C,CAAA,QAAkD,GAAR,QAAQ,CAAlD;KAAyE;;;IAJzE,EAAA,IAAA,EAAC,SAAS,EAAV,IAAA,EAAA,CAAW;gBACT,QAAQ,EAAE,gBAAgB;aAC3B,EAAD,EAAA;;;;IAJA,EAAA,IAAA,EAAmB,WAAW,GAA9B;;;;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
|
|
1003
1003
|
* @return {?}
|
|
1004
1004
|
*/
|
|
1005
1005
|
function (hostElement, message) {
|
|
1006
|
-
if (
|
|
1006
|
+
if (!this._canBeDescribed(hostElement, message)) {
|
|
1007
1007
|
return;
|
|
1008
1008
|
}
|
|
1009
1009
|
if (!messageRegistry.has(message)) {
|
|
@@ -1027,7 +1027,7 @@ var AriaDescriber = /** @class */ (function () {
|
|
|
1027
1027
|
* @return {?}
|
|
1028
1028
|
*/
|
|
1029
1029
|
function (hostElement, message) {
|
|
1030
|
-
if (
|
|
1030
|
+
if (!this._canBeDescribed(hostElement, message)) {
|
|
1031
1031
|
return;
|
|
1032
1032
|
}
|
|
1033
1033
|
if (this._isElementDescribedByMessage(hostElement, message)) {
|
|
@@ -1206,6 +1206,22 @@ var AriaDescriber = /** @class */ (function () {
|
|
|
1206
1206
|
var /** @type {?} */ messageId = registeredMessage && registeredMessage.messageElement.id;
|
|
1207
1207
|
return !!messageId && referenceIds.indexOf(messageId) != -1;
|
|
1208
1208
|
};
|
|
1209
|
+
/**
|
|
1210
|
+
* Determines whether a message can be described on a particular element.
|
|
1211
|
+
* @param {?} element
|
|
1212
|
+
* @param {?} message
|
|
1213
|
+
* @return {?}
|
|
1214
|
+
*/
|
|
1215
|
+
AriaDescriber.prototype._canBeDescribed = /**
|
|
1216
|
+
* Determines whether a message can be described on a particular element.
|
|
1217
|
+
* @param {?} element
|
|
1218
|
+
* @param {?} message
|
|
1219
|
+
* @return {?}
|
|
1220
|
+
*/
|
|
1221
|
+
function (element, message) {
|
|
1222
|
+
return element.nodeType === this._document.ELEMENT_NODE && message != null &&
|
|
1223
|
+
!!("" + message).trim();
|
|
1224
|
+
};
|
|
1209
1225
|
AriaDescriber.decorators = [
|
|
1210
1226
|
{ type: Injectable },
|
|
1211
1227
|
];
|
|
@@ -1260,6 +1276,11 @@ var ListKeyManager = /** @class */ (function () {
|
|
|
1260
1276
|
this._letterKeyStream = new Subject();
|
|
1261
1277
|
this._typeaheadSubscription = Subscription.EMPTY;
|
|
1262
1278
|
this._vertical = true;
|
|
1279
|
+
/**
|
|
1280
|
+
* Predicate function that can be used to check whether an item should be skipped
|
|
1281
|
+
* by the key manager. By default, disabled items are skipped.
|
|
1282
|
+
*/
|
|
1283
|
+
this._skipPredicateFn = function (item) { return item.disabled; };
|
|
1263
1284
|
this._pressedLetters = [];
|
|
1264
1285
|
/**
|
|
1265
1286
|
* Stream that emits any time the TAB key is pressed, so components can react
|
|
@@ -1280,6 +1301,27 @@ var ListKeyManager = /** @class */ (function () {
|
|
|
1280
1301
|
}
|
|
1281
1302
|
});
|
|
1282
1303
|
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Sets the predicate function that determines which items should be skipped by the
|
|
1306
|
+
* list key manager.
|
|
1307
|
+
* @param predicate Function that determines whether the given item should be skipped.
|
|
1308
|
+
*/
|
|
1309
|
+
/**
|
|
1310
|
+
* Sets the predicate function that determines which items should be skipped by the
|
|
1311
|
+
* list key manager.
|
|
1312
|
+
* @param {?} predicate Function that determines whether the given item should be skipped.
|
|
1313
|
+
* @return {?}
|
|
1314
|
+
*/
|
|
1315
|
+
ListKeyManager.prototype.skipPredicate = /**
|
|
1316
|
+
* Sets the predicate function that determines which items should be skipped by the
|
|
1317
|
+
* list key manager.
|
|
1318
|
+
* @param {?} predicate Function that determines whether the given item should be skipped.
|
|
1319
|
+
* @return {?}
|
|
1320
|
+
*/
|
|
1321
|
+
function (predicate) {
|
|
1322
|
+
this._skipPredicateFn = predicate;
|
|
1323
|
+
return this;
|
|
1324
|
+
};
|
|
1283
1325
|
/**
|
|
1284
1326
|
* Turns on wrapping mode, which ensures that the active item will wrap to
|
|
1285
1327
|
* the other end of list when there are no more items in the given direction.
|
|
@@ -1369,7 +1411,7 @@ var ListKeyManager = /** @class */ (function () {
|
|
|
1369
1411
|
for (var /** @type {?} */ i = 1; i < items.length + 1; i++) {
|
|
1370
1412
|
var /** @type {?} */ index = (_this._activeItemIndex + i) % items.length;
|
|
1371
1413
|
var /** @type {?} */ item = items[index];
|
|
1372
|
-
if (!item
|
|
1414
|
+
if (!_this._skipPredicateFn(item) && /** @type {?} */ ((item.getLabel))().toUpperCase().trim().indexOf(inputString) === 0) {
|
|
1373
1415
|
_this.setActiveItem(index);
|
|
1374
1416
|
break;
|
|
1375
1417
|
}
|
|
@@ -1425,11 +1467,17 @@ var ListKeyManager = /** @class */ (function () {
|
|
|
1425
1467
|
this.setNextItemActive();
|
|
1426
1468
|
break;
|
|
1427
1469
|
}
|
|
1470
|
+
else {
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1428
1473
|
case UP_ARROW:
|
|
1429
1474
|
if (this._vertical) {
|
|
1430
1475
|
this.setPreviousItemActive();
|
|
1431
1476
|
break;
|
|
1432
1477
|
}
|
|
1478
|
+
else {
|
|
1479
|
+
return;
|
|
1480
|
+
}
|
|
1433
1481
|
case RIGHT_ARROW:
|
|
1434
1482
|
if (this._horizontal === 'ltr') {
|
|
1435
1483
|
this.setNextItemActive();
|
|
@@ -1439,6 +1487,9 @@ var ListKeyManager = /** @class */ (function () {
|
|
|
1439
1487
|
this.setPreviousItemActive();
|
|
1440
1488
|
break;
|
|
1441
1489
|
}
|
|
1490
|
+
else {
|
|
1491
|
+
return;
|
|
1492
|
+
}
|
|
1442
1493
|
case LEFT_ARROW:
|
|
1443
1494
|
if (this._horizontal === 'ltr') {
|
|
1444
1495
|
this.setPreviousItemActive();
|
|
@@ -1448,6 +1499,9 @@ var ListKeyManager = /** @class */ (function () {
|
|
|
1448
1499
|
this.setNextItemActive();
|
|
1449
1500
|
break;
|
|
1450
1501
|
}
|
|
1502
|
+
else {
|
|
1503
|
+
return;
|
|
1504
|
+
}
|
|
1451
1505
|
default:
|
|
1452
1506
|
// Attempt to use the `event.key` which also maps it to the user's keyboard language,
|
|
1453
1507
|
// otherwise fall back to resolving alphanumeric characters via the keyCode.
|
|
@@ -1592,15 +1646,13 @@ var ListKeyManager = /** @class */ (function () {
|
|
|
1592
1646
|
* @return {?}
|
|
1593
1647
|
*/
|
|
1594
1648
|
function (delta, items) {
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
else {
|
|
1603
|
-
this.setActiveItem(this._activeItemIndex);
|
|
1649
|
+
for (var /** @type {?} */ i = 1; i <= items.length; i++) {
|
|
1650
|
+
var /** @type {?} */ index = (this._activeItemIndex + (delta * i) + items.length) % items.length;
|
|
1651
|
+
var /** @type {?} */ item = items[index];
|
|
1652
|
+
if (!this._skipPredicateFn(item)) {
|
|
1653
|
+
this.setActiveItem(index);
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1604
1656
|
}
|
|
1605
1657
|
};
|
|
1606
1658
|
/**
|
|
@@ -1645,7 +1697,7 @@ var ListKeyManager = /** @class */ (function () {
|
|
|
1645
1697
|
if (!items[index]) {
|
|
1646
1698
|
return;
|
|
1647
1699
|
}
|
|
1648
|
-
while (items[index]
|
|
1700
|
+
while (this._skipPredicateFn(items[index])) {
|
|
1649
1701
|
index += fallbackDelta;
|
|
1650
1702
|
if (!items[index]) {
|
|
1651
1703
|
return;
|