@angular/cdk 2.0.0-beta.10 → 2.0.0-beta.11
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/a11y/package.json +2 -2
- package/a11y/typings/aria-describer.d.ts +51 -0
- package/a11y/typings/aria-reference.d.ts +15 -0
- package/a11y/typings/focus-monitor.d.ts +106 -0
- package/a11y/typings/index.metadata.json +1 -1
- package/a11y/typings/public_api.d.ts +5 -3
- package/bidi/package.json +2 -2
- package/bundles/cdk-a11y.umd.js +639 -25
- package/bundles/cdk-a11y.umd.js.map +1 -1
- package/bundles/cdk-a11y.umd.min.js +9 -0
- package/bundles/cdk-a11y.umd.min.js.map +1 -0
- package/bundles/cdk-bidi.umd.min.js +9 -0
- package/bundles/cdk-bidi.umd.min.js.map +1 -0
- package/bundles/cdk-coercion.umd.min.js +9 -0
- package/bundles/cdk-coercion.umd.min.js.map +1 -0
- package/bundles/cdk-collections.umd.min.js +9 -0
- package/bundles/cdk-collections.umd.min.js.map +1 -0
- package/bundles/cdk-keycodes.umd.min.js +9 -0
- package/bundles/cdk-keycodes.umd.min.js.map +1 -0
- package/bundles/cdk-observers.umd.min.js +9 -0
- package/bundles/cdk-observers.umd.min.js.map +1 -0
- package/bundles/cdk-overlay.umd.js +49 -75
- package/bundles/cdk-overlay.umd.js.map +1 -1
- package/bundles/cdk-overlay.umd.min.js +9 -0
- package/bundles/cdk-overlay.umd.min.js.map +1 -0
- package/bundles/cdk-platform.umd.min.js +9 -0
- package/bundles/cdk-platform.umd.min.js.map +1 -0
- package/bundles/cdk-portal.umd.min.js +9 -0
- package/bundles/cdk-portal.umd.min.js.map +1 -0
- package/bundles/cdk-rxjs.umd.js.map +1 -1
- package/bundles/cdk-rxjs.umd.min.js +9 -0
- package/bundles/cdk-rxjs.umd.min.js.map +1 -0
- package/bundles/cdk-scrolling.umd.min.js +9 -0
- package/bundles/cdk-scrolling.umd.min.js.map +1 -0
- package/bundles/cdk-stepper.umd.js +460 -0
- package/bundles/cdk-stepper.umd.js.map +1 -0
- package/bundles/cdk-stepper.umd.min.js +9 -0
- package/bundles/cdk-stepper.umd.min.js.map +1 -0
- package/bundles/cdk-table.umd.js +8 -8
- package/bundles/cdk-table.umd.js.map +1 -1
- package/bundles/cdk-table.umd.min.js +9 -0
- package/bundles/cdk-table.umd.min.js.map +1 -0
- package/bundles/cdk.umd.js +1 -1
- package/bundles/cdk.umd.js.map +1 -1
- package/bundles/cdk.umd.min.js +9 -0
- package/bundles/cdk.umd.min.js.map +1 -0
- package/coercion/package.json +2 -2
- package/collections/package.json +2 -2
- package/collections/typings/selection.d.ts +3 -3
- package/{@angular/cdk → esm2015}/a11y.js +617 -17
- package/esm2015/a11y.js.map +1 -0
- package/{@angular/cdk → esm2015}/bidi.js +0 -0
- package/{@angular/cdk → esm2015}/bidi.js.map +0 -0
- package/{@angular → esm2015}/cdk.js +1 -1
- package/{@angular → esm2015}/cdk.js.map +1 -1
- package/{@angular/cdk → esm2015}/coercion.js +0 -0
- package/{@angular/cdk → esm2015}/coercion.js.map +0 -0
- package/{@angular/cdk → esm2015}/collections.js +0 -0
- package/{@angular/cdk → esm2015}/collections.js.map +0 -0
- package/{@angular/cdk → esm2015}/keycodes.js +0 -0
- package/{@angular/cdk → esm2015}/keycodes.js.map +0 -0
- package/{@angular/cdk → esm2015}/observers.js +0 -0
- package/{@angular/cdk → esm2015}/observers.js.map +0 -0
- package/{@angular/cdk → esm2015}/overlay.js +44 -66
- package/esm2015/overlay.js.map +1 -0
- package/{@angular/cdk → esm2015}/platform.js +0 -0
- package/{@angular/cdk → esm2015}/platform.js.map +0 -0
- package/{@angular/cdk → esm2015}/portal.js +0 -0
- package/{@angular/cdk → esm2015}/portal.js.map +0 -0
- package/{@angular/cdk → esm2015}/rxjs.js +0 -0
- package/esm2015/rxjs.js.map +1 -0
- package/{@angular/cdk → esm2015}/scrolling.js +0 -0
- package/{@angular/cdk → esm2015}/scrolling.js.map +0 -0
- package/esm2015/stepper.js +418 -0
- package/esm2015/stepper.js.map +1 -0
- package/{@angular/cdk → esm2015}/table.js +8 -8
- package/esm2015/table.js.map +1 -0
- package/{@angular/cdk → esm5}/a11y.es5.js +622 -17
- package/esm5/a11y.es5.js.map +1 -0
- package/{@angular/cdk → esm5}/bidi.es5.js +0 -0
- package/{@angular/cdk → esm5}/bidi.es5.js.map +0 -0
- package/{@angular → esm5}/cdk.es5.js +1 -1
- package/{@angular → esm5}/cdk.es5.js.map +1 -1
- package/{@angular/cdk → esm5}/coercion.es5.js +0 -0
- package/{@angular/cdk → esm5}/coercion.es5.js.map +0 -0
- package/{@angular/cdk → esm5}/collections.es5.js +0 -0
- package/{@angular/cdk → esm5}/collections.es5.js.map +0 -0
- package/{@angular/cdk → esm5}/keycodes.es5.js +0 -0
- package/{@angular/cdk → esm5}/keycodes.es5.js.map +0 -0
- package/{@angular/cdk → esm5}/observers.es5.js +0 -0
- package/{@angular/cdk → esm5}/observers.es5.js.map +0 -0
- package/{@angular/cdk → esm5}/overlay.es5.js +46 -71
- package/esm5/overlay.es5.js.map +1 -0
- package/{@angular/cdk → esm5}/platform.es5.js +0 -0
- package/{@angular/cdk → esm5}/platform.es5.js.map +0 -0
- package/{@angular/cdk → esm5}/portal.es5.js +0 -0
- package/{@angular/cdk → esm5}/portal.es5.js.map +0 -0
- package/{@angular/cdk → esm5}/rxjs.es5.js +0 -0
- package/esm5/rxjs.es5.js.map +1 -0
- package/{@angular/cdk → esm5}/scrolling.es5.js +0 -0
- package/{@angular/cdk → esm5}/scrolling.es5.js.map +0 -0
- package/esm5/stepper.es5.js +451 -0
- package/esm5/stepper.es5.js.map +1 -0
- package/{@angular/cdk → esm5}/table.es5.js +8 -8
- package/esm5/table.es5.js.map +1 -0
- package/keycodes/package.json +2 -2
- package/observers/package.json +2 -2
- package/overlay/package.json +2 -2
- package/overlay/typings/index.metadata.json +1 -1
- package/overlay/typings/{overlay-state.d.ts → overlay-config.d.ts} +5 -7
- package/overlay/typings/overlay-container.d.ts +1 -6
- package/overlay/typings/overlay-ref.d.ts +3 -3
- package/overlay/typings/overlay.d.ts +2 -2
- package/overlay/typings/position/connected-position-strategy.d.ts +1 -3
- package/overlay/typings/public_api.d.ts +1 -1
- package/overlay/typings/scroll/reposition-scroll-strategy.d.ts +1 -1
- package/package.json +5 -5
- package/platform/package.json +2 -2
- package/portal/package.json +2 -2
- package/portal/typings/portal-injector.d.ts +19 -0
- package/rxjs/package.json +2 -2
- package/rxjs/typings/rx-chain.d.ts +1 -1
- package/rxjs/typings/rx-operators.d.ts +1 -1
- package/scrolling/package.json +2 -2
- package/stepper/index.d.ts +8 -0
- package/stepper/index.metadata.json +11 -0
- package/stepper/package.json +7 -0
- package/stepper/typings/index.d.ts +4 -0
- package/stepper/typings/index.metadata.json +1 -0
- package/stepper/typings/public_api.d.ts +5 -0
- package/stepper/typings/step-label.d.ts +12 -0
- package/stepper/typings/stepper-button.d.ts +11 -0
- package/stepper/typings/stepper.d.ts +93 -0
- package/stepper.d.ts +8 -0
- package/stepper.metadata.json +11 -0
- package/table/package.json +2 -2
- package/table/typings/index.metadata.json +1 -1
- package/typings/a11y/aria-describer.d.ts +51 -0
- package/typings/a11y/aria-reference.d.ts +15 -0
- package/typings/a11y/focus-monitor.d.ts +106 -0
- package/typings/a11y/index.metadata.json +1 -1
- package/typings/a11y/public_api.d.ts +5 -3
- package/typings/collections/selection.d.ts +3 -3
- package/typings/index.metadata.json +1 -1
- package/typings/overlay/index.metadata.json +1 -1
- package/typings/overlay/{overlay-state.d.ts → overlay-config.d.ts} +5 -7
- package/typings/overlay/overlay-container.d.ts +1 -6
- package/typings/overlay/overlay-ref.d.ts +3 -3
- package/typings/overlay/overlay.d.ts +2 -2
- package/typings/overlay/position/connected-position-strategy.d.ts +1 -3
- package/typings/overlay/public_api.d.ts +1 -1
- package/typings/overlay/scroll/reposition-scroll-strategy.d.ts +1 -1
- package/typings/portal/portal-injector.d.ts +19 -0
- package/typings/rxjs/rx-chain.d.ts +1 -1
- package/typings/rxjs/rx-operators.d.ts +1 -1
- package/typings/stepper/index.d.ts +4 -0
- package/typings/stepper/index.metadata.json +1 -0
- package/typings/stepper/public_api.d.ts +5 -0
- package/typings/stepper/step-label.d.ts +12 -0
- package/typings/stepper/stepper-button.d.ts +11 -0
- package/typings/stepper/stepper.d.ts +93 -0
- package/typings/table/index.metadata.json +1 -1
- package/@angular/cdk/a11y.es5.js.map +0 -1
- package/@angular/cdk/a11y.js.map +0 -1
- package/@angular/cdk/overlay.es5.js.map +0 -1
- package/@angular/cdk/overlay.js.map +0 -1
- package/@angular/cdk/rxjs.es5.js.map +0 -1
- package/@angular/cdk/rxjs.js.map +0 -1
- package/@angular/cdk/table.es5.js.map +0 -1
- package/@angular/cdk/table.js.map +0 -1
package/bundles/cdk-a11y.umd.js
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
(function (global, factory) {
|
|
9
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/cdk/coercion'), require('@angular/cdk/platform'), require('@angular/cdk/rxjs'), require('@angular/common'), require('rxjs/Subject'), require('@angular/cdk/keycodes')) :
|
|
10
|
-
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/cdk/coercion', '@angular/cdk/platform', '@angular/cdk/rxjs', '@angular/common', 'rxjs/Subject', '@angular/cdk/keycodes'], factory) :
|
|
11
|
-
(factory((global.ng = global.ng || {}, global.ng.cdk = global.ng.cdk || {}, global.ng.cdk.a11y = global.ng.cdk.a11y || {}),global.ng.core,global.ng.cdk.coercion,global.ng.cdk.platform,global.ng.cdk.rxjs,global.ng.common,global.Rx,global.ng.cdk.keycodes));
|
|
12
|
-
}(this, (function (exports,_angular_core,_angular_cdk_coercion,_angular_cdk_platform,_angular_cdk_rxjs,_angular_common,rxjs_Subject,_angular_cdk_keycodes) { 'use strict';
|
|
9
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/cdk/coercion'), require('@angular/cdk/platform'), require('@angular/cdk/rxjs'), require('@angular/common'), require('rxjs/Subject'), require('rxjs/observable/of'), require('rxjs/Subscription'), require('@angular/cdk/keycodes')) :
|
|
10
|
+
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/cdk/coercion', '@angular/cdk/platform', '@angular/cdk/rxjs', '@angular/common', 'rxjs/Subject', 'rxjs/observable/of', 'rxjs/Subscription', '@angular/cdk/keycodes'], factory) :
|
|
11
|
+
(factory((global.ng = global.ng || {}, global.ng.cdk = global.ng.cdk || {}, global.ng.cdk.a11y = global.ng.cdk.a11y || {}),global.ng.core,global.ng.cdk.coercion,global.ng.cdk.platform,global.ng.cdk.rxjs,global.ng.common,global.Rx,global.Rx.Observable,global.Rx,global.ng.cdk.keycodes));
|
|
12
|
+
}(this, (function (exports,_angular_core,_angular_cdk_coercion,_angular_cdk_platform,_angular_cdk_rxjs,_angular_common,rxjs_Subject,rxjs_observable_of,rxjs_Subscription,_angular_cdk_keycodes) { 'use strict';
|
|
13
13
|
|
|
14
14
|
/*! *****************************************************************************
|
|
15
15
|
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -526,7 +526,7 @@ var FocusTrap = (function () {
|
|
|
526
526
|
fn();
|
|
527
527
|
}
|
|
528
528
|
else {
|
|
529
|
-
_angular_cdk_rxjs.first.call(this._ngZone.onStable).subscribe(fn);
|
|
529
|
+
_angular_cdk_rxjs.first.call(this._ngZone.onStable.asObservable()).subscribe(fn);
|
|
530
530
|
}
|
|
531
531
|
};
|
|
532
532
|
return FocusTrap;
|
|
@@ -772,17 +772,602 @@ var LIVE_ANNOUNCER_PROVIDER = {
|
|
|
772
772
|
useFactory: LIVE_ANNOUNCER_PROVIDER_FACTORY
|
|
773
773
|
};
|
|
774
774
|
/**
|
|
775
|
-
*
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
* the
|
|
780
|
-
*
|
|
775
|
+
* IDs are deliminated by an empty space, as per the spec.
|
|
776
|
+
*/
|
|
777
|
+
var ID_DELIMINATOR = ' ';
|
|
778
|
+
/**
|
|
779
|
+
* Adds the given ID to the specified ARIA attribute on an element.
|
|
780
|
+
* Used for attributes such as aria-labelledby, aria-owns, etc.
|
|
781
|
+
* @param {?} el
|
|
782
|
+
* @param {?} attr
|
|
783
|
+
* @param {?} id
|
|
781
784
|
* @return {?}
|
|
782
785
|
*/
|
|
783
|
-
function
|
|
784
|
-
|
|
786
|
+
function addAriaReferencedId(el, attr, id) {
|
|
787
|
+
var /** @type {?} */ ids = getAriaReferenceIds(el, attr);
|
|
788
|
+
if (ids.some(function (existingId) { return existingId.trim() == id.trim(); })) {
|
|
789
|
+
return;
|
|
790
|
+
}
|
|
791
|
+
ids.push(id.trim());
|
|
792
|
+
el.setAttribute(attr, ids.join(ID_DELIMINATOR));
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* Removes the given ID from the specified ARIA attribute on an element.
|
|
796
|
+
* Used for attributes such as aria-labelledby, aria-owns, etc.
|
|
797
|
+
* @param {?} el
|
|
798
|
+
* @param {?} attr
|
|
799
|
+
* @param {?} id
|
|
800
|
+
* @return {?}
|
|
801
|
+
*/
|
|
802
|
+
function removeAriaReferencedId(el, attr, id) {
|
|
803
|
+
var /** @type {?} */ ids = getAriaReferenceIds(el, attr);
|
|
804
|
+
var /** @type {?} */ filteredIds = ids.filter(function (val) { return val != id.trim(); });
|
|
805
|
+
el.setAttribute(attr, filteredIds.join(ID_DELIMINATOR));
|
|
806
|
+
}
|
|
807
|
+
/**
|
|
808
|
+
* Gets the list of IDs referenced by the given ARIA attribute on an element.
|
|
809
|
+
* Used for attributes such as aria-labelledby, aria-owns, etc.
|
|
810
|
+
* @param {?} el
|
|
811
|
+
* @param {?} attr
|
|
812
|
+
* @return {?}
|
|
813
|
+
*/
|
|
814
|
+
function getAriaReferenceIds(el, attr) {
|
|
815
|
+
// Get string array of all individual ids (whitespace deliminated) in the attribute value
|
|
816
|
+
return (el.getAttribute(attr) || '').match(/\S+/g) || [];
|
|
785
817
|
}
|
|
818
|
+
/**
|
|
819
|
+
* ID used for the body container where all messages are appended.
|
|
820
|
+
*/
|
|
821
|
+
var MESSAGES_CONTAINER_ID = 'cdk-describedby-message-container';
|
|
822
|
+
/**
|
|
823
|
+
* ID prefix used for each created message element.
|
|
824
|
+
*/
|
|
825
|
+
var CDK_DESCRIBEDBY_ID_PREFIX = 'cdk-describedby-message';
|
|
826
|
+
/**
|
|
827
|
+
* Attribute given to each host element that is described by a message element.
|
|
828
|
+
*/
|
|
829
|
+
var CDK_DESCRIBEDBY_HOST_ATTRIBUTE = 'cdk-describedby-host';
|
|
830
|
+
/**
|
|
831
|
+
* Global incremental identifier for each registered message element.
|
|
832
|
+
*/
|
|
833
|
+
var nextId = 0;
|
|
834
|
+
/**
|
|
835
|
+
* Global map of all registered message elements that have been placed into the document.
|
|
836
|
+
*/
|
|
837
|
+
var messageRegistry = new Map();
|
|
838
|
+
/**
|
|
839
|
+
* Container for all registered messages.
|
|
840
|
+
*/
|
|
841
|
+
var messagesContainer = null;
|
|
842
|
+
/**
|
|
843
|
+
* Utility that creates visually hidden elements with a message content. Useful for elements that
|
|
844
|
+
* want to use aria-describedby to further describe themselves without adding additional visual
|
|
845
|
+
* content.
|
|
846
|
+
* \@docs-private
|
|
847
|
+
*/
|
|
848
|
+
var AriaDescriber = (function () {
|
|
849
|
+
/**
|
|
850
|
+
* @param {?} _platform
|
|
851
|
+
*/
|
|
852
|
+
function AriaDescriber(_platform) {
|
|
853
|
+
this._platform = _platform;
|
|
854
|
+
}
|
|
855
|
+
/**
|
|
856
|
+
* Adds to the host element an aria-describedby reference to a hidden element that contains
|
|
857
|
+
* the message. If the same message has already been registered, then it will reuse the created
|
|
858
|
+
* message element.
|
|
859
|
+
* @param {?} hostElement
|
|
860
|
+
* @param {?} message
|
|
861
|
+
* @return {?}
|
|
862
|
+
*/
|
|
863
|
+
AriaDescriber.prototype.describe = function (hostElement, message) {
|
|
864
|
+
if (!this._platform.isBrowser || !message.trim()) {
|
|
865
|
+
return;
|
|
866
|
+
}
|
|
867
|
+
if (!messageRegistry.has(message)) {
|
|
868
|
+
createMessageElement(message);
|
|
869
|
+
}
|
|
870
|
+
if (!isElementDescribedByMessage(hostElement, message)) {
|
|
871
|
+
addMessageReference(hostElement, message);
|
|
872
|
+
}
|
|
873
|
+
};
|
|
874
|
+
/**
|
|
875
|
+
* Removes the host element's aria-describedby reference to the message element.
|
|
876
|
+
* @param {?} hostElement
|
|
877
|
+
* @param {?} message
|
|
878
|
+
* @return {?}
|
|
879
|
+
*/
|
|
880
|
+
AriaDescriber.prototype.removeDescription = function (hostElement, message) {
|
|
881
|
+
if (!this._platform.isBrowser || !message.trim()) {
|
|
882
|
+
return;
|
|
883
|
+
}
|
|
884
|
+
if (isElementDescribedByMessage(hostElement, message)) {
|
|
885
|
+
removeMessageReference(hostElement, message);
|
|
886
|
+
}
|
|
887
|
+
var /** @type {?} */ registeredMessage = messageRegistry.get(message);
|
|
888
|
+
if (registeredMessage && registeredMessage.referenceCount === 0) {
|
|
889
|
+
deleteMessageElement(message);
|
|
890
|
+
}
|
|
891
|
+
if (messagesContainer && messagesContainer.childNodes.length === 0) {
|
|
892
|
+
deleteMessagesContainer();
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
/**
|
|
896
|
+
* Unregisters all created message elements and removes the message container.
|
|
897
|
+
* @return {?}
|
|
898
|
+
*/
|
|
899
|
+
AriaDescriber.prototype.ngOnDestroy = function () {
|
|
900
|
+
if (!this._platform.isBrowser) {
|
|
901
|
+
return;
|
|
902
|
+
}
|
|
903
|
+
var /** @type {?} */ describedElements = document.querySelectorAll("[" + CDK_DESCRIBEDBY_HOST_ATTRIBUTE + "]");
|
|
904
|
+
for (var /** @type {?} */ i = 0; i < describedElements.length; i++) {
|
|
905
|
+
removeCdkDescribedByReferenceIds(describedElements[i]);
|
|
906
|
+
describedElements[i].removeAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE);
|
|
907
|
+
}
|
|
908
|
+
if (messagesContainer) {
|
|
909
|
+
deleteMessagesContainer();
|
|
910
|
+
}
|
|
911
|
+
messageRegistry.clear();
|
|
912
|
+
};
|
|
913
|
+
return AriaDescriber;
|
|
914
|
+
}());
|
|
915
|
+
AriaDescriber.decorators = [
|
|
916
|
+
{ type: _angular_core.Injectable },
|
|
917
|
+
];
|
|
918
|
+
/**
|
|
919
|
+
* @nocollapse
|
|
920
|
+
*/
|
|
921
|
+
AriaDescriber.ctorParameters = function () { return [
|
|
922
|
+
{ type: _angular_cdk_platform.Platform, },
|
|
923
|
+
]; };
|
|
924
|
+
/**
|
|
925
|
+
* Creates a new element in the visually hidden message container element with the message
|
|
926
|
+
* as its content and adds it to the message registry.
|
|
927
|
+
* @param {?} message
|
|
928
|
+
* @return {?}
|
|
929
|
+
*/
|
|
930
|
+
function createMessageElement(message) {
|
|
931
|
+
var /** @type {?} */ messageElement = document.createElement('div');
|
|
932
|
+
messageElement.setAttribute('id', CDK_DESCRIBEDBY_ID_PREFIX + "-" + nextId++);
|
|
933
|
+
messageElement.appendChild(/** @type {?} */ ((document.createTextNode(message))));
|
|
934
|
+
if (!messagesContainer) {
|
|
935
|
+
createMessagesContainer();
|
|
936
|
+
} /** @type {?} */
|
|
937
|
+
((messagesContainer)).appendChild(messageElement);
|
|
938
|
+
messageRegistry.set(message, { messageElement: messageElement, referenceCount: 0 });
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Deletes the message element from the global messages container.
|
|
942
|
+
* @param {?} message
|
|
943
|
+
* @return {?}
|
|
944
|
+
*/
|
|
945
|
+
function deleteMessageElement(message) {
|
|
946
|
+
var /** @type {?} */ registeredMessage = messageRegistry.get(message);
|
|
947
|
+
var /** @type {?} */ messageElement = registeredMessage && registeredMessage.messageElement;
|
|
948
|
+
if (messagesContainer && messageElement) {
|
|
949
|
+
messagesContainer.removeChild(messageElement);
|
|
950
|
+
}
|
|
951
|
+
messageRegistry.delete(message);
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Creates the global container for all aria-describedby messages.
|
|
955
|
+
* @return {?}
|
|
956
|
+
*/
|
|
957
|
+
function createMessagesContainer() {
|
|
958
|
+
messagesContainer = document.createElement('div');
|
|
959
|
+
messagesContainer.setAttribute('id', MESSAGES_CONTAINER_ID);
|
|
960
|
+
messagesContainer.setAttribute('aria-hidden', 'true');
|
|
961
|
+
messagesContainer.style.display = 'none';
|
|
962
|
+
document.body.appendChild(messagesContainer);
|
|
963
|
+
}
|
|
964
|
+
/**
|
|
965
|
+
* Deletes the global messages container.
|
|
966
|
+
* @return {?}
|
|
967
|
+
*/
|
|
968
|
+
function deleteMessagesContainer() {
|
|
969
|
+
document.body.removeChild(/** @type {?} */ ((messagesContainer)));
|
|
970
|
+
messagesContainer = null;
|
|
971
|
+
}
|
|
972
|
+
/**
|
|
973
|
+
* Removes all cdk-describedby messages that are hosted through the element.
|
|
974
|
+
* @param {?} element
|
|
975
|
+
* @return {?}
|
|
976
|
+
*/
|
|
977
|
+
function removeCdkDescribedByReferenceIds(element) {
|
|
978
|
+
// Remove all aria-describedby reference IDs that are prefixed by CDK_DESCRIBEDBY_ID_PREFIX
|
|
979
|
+
var /** @type {?} */ originalReferenceIds = getAriaReferenceIds(element, 'aria-describedby')
|
|
980
|
+
.filter(function (id) { return id.indexOf(CDK_DESCRIBEDBY_ID_PREFIX) != 0; });
|
|
981
|
+
element.setAttribute('aria-describedby', originalReferenceIds.join(' '));
|
|
982
|
+
}
|
|
983
|
+
/**
|
|
984
|
+
* Adds a message reference to the element using aria-describedby and increments the registered
|
|
985
|
+
* message's reference count.
|
|
986
|
+
* @param {?} element
|
|
987
|
+
* @param {?} message
|
|
988
|
+
* @return {?}
|
|
989
|
+
*/
|
|
990
|
+
function addMessageReference(element, message) {
|
|
991
|
+
var /** @type {?} */ registeredMessage = ((messageRegistry.get(message)));
|
|
992
|
+
// Add the aria-describedby reference and set the describedby_host attribute to mark the element.
|
|
993
|
+
addAriaReferencedId(element, 'aria-describedby', registeredMessage.messageElement.id);
|
|
994
|
+
element.setAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE, '');
|
|
995
|
+
registeredMessage.referenceCount++;
|
|
996
|
+
}
|
|
997
|
+
/**
|
|
998
|
+
* Removes a message reference from the element using aria-describedby and decrements the registered
|
|
999
|
+
* message's reference count.
|
|
1000
|
+
* @param {?} element
|
|
1001
|
+
* @param {?} message
|
|
1002
|
+
* @return {?}
|
|
1003
|
+
*/
|
|
1004
|
+
function removeMessageReference(element, message) {
|
|
1005
|
+
var /** @type {?} */ registeredMessage = ((messageRegistry.get(message)));
|
|
1006
|
+
registeredMessage.referenceCount--;
|
|
1007
|
+
removeAriaReferencedId(element, 'aria-describedby', registeredMessage.messageElement.id);
|
|
1008
|
+
element.removeAttribute(CDK_DESCRIBEDBY_HOST_ATTRIBUTE);
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Returns true if the element has been described by the provided message ID.
|
|
1012
|
+
* @param {?} element
|
|
1013
|
+
* @param {?} message
|
|
1014
|
+
* @return {?}
|
|
1015
|
+
*/
|
|
1016
|
+
function isElementDescribedByMessage(element, message) {
|
|
1017
|
+
var /** @type {?} */ referenceIds = getAriaReferenceIds(element, 'aria-describedby');
|
|
1018
|
+
var /** @type {?} */ registeredMessage = messageRegistry.get(message);
|
|
1019
|
+
var /** @type {?} */ messageId = registeredMessage && registeredMessage.messageElement.id;
|
|
1020
|
+
return !!messageId && referenceIds.indexOf(messageId) != -1;
|
|
1021
|
+
}
|
|
1022
|
+
/**
|
|
1023
|
+
* \@docs-private
|
|
1024
|
+
* @param {?} parentDispatcher
|
|
1025
|
+
* @param {?} platform
|
|
1026
|
+
* @return {?}
|
|
1027
|
+
*/
|
|
1028
|
+
function ARIA_DESCRIBER_PROVIDER_FACTORY(parentDispatcher, platform) {
|
|
1029
|
+
return parentDispatcher || new AriaDescriber(platform);
|
|
1030
|
+
}
|
|
1031
|
+
/**
|
|
1032
|
+
* \@docs-private
|
|
1033
|
+
*/
|
|
1034
|
+
var ARIA_DESCRIBER_PROVIDER = {
|
|
1035
|
+
// If there is already an AriaDescriber available, use that. Otherwise, provide a new one.
|
|
1036
|
+
provide: AriaDescriber,
|
|
1037
|
+
deps: [
|
|
1038
|
+
[new _angular_core.Optional(), new _angular_core.SkipSelf(), AriaDescriber],
|
|
1039
|
+
_angular_cdk_platform.Platform
|
|
1040
|
+
],
|
|
1041
|
+
useFactory: ARIA_DESCRIBER_PROVIDER_FACTORY
|
|
1042
|
+
};
|
|
1043
|
+
// This is the value used by AngularJS Material. Through trial and error (on iPhone 6S) they found
|
|
1044
|
+
// that a value of around 650ms seems appropriate.
|
|
1045
|
+
var TOUCH_BUFFER_MS = 650;
|
|
1046
|
+
/**
|
|
1047
|
+
* Monitors mouse and keyboard events to determine the cause of focus events.
|
|
1048
|
+
*/
|
|
1049
|
+
var FocusMonitor = (function () {
|
|
1050
|
+
/**
|
|
1051
|
+
* @param {?} _ngZone
|
|
1052
|
+
* @param {?} _platform
|
|
1053
|
+
*/
|
|
1054
|
+
function FocusMonitor(_ngZone, _platform) {
|
|
1055
|
+
var _this = this;
|
|
1056
|
+
this._ngZone = _ngZone;
|
|
1057
|
+
this._platform = _platform;
|
|
1058
|
+
/**
|
|
1059
|
+
* The focus origin that the next focus event is a result of.
|
|
1060
|
+
*/
|
|
1061
|
+
this._origin = null;
|
|
1062
|
+
/**
|
|
1063
|
+
* Whether the window has just been focused.
|
|
1064
|
+
*/
|
|
1065
|
+
this._windowFocused = false;
|
|
1066
|
+
/**
|
|
1067
|
+
* Weak map of elements being monitored to their info.
|
|
1068
|
+
*/
|
|
1069
|
+
this._elementInfo = new WeakMap();
|
|
1070
|
+
this._ngZone.runOutsideAngular(function () { return _this._registerDocumentEvents(); });
|
|
1071
|
+
}
|
|
1072
|
+
/**
|
|
1073
|
+
* Monitors focus on an element and applies appropriate CSS classes.
|
|
1074
|
+
* @param {?} element The element to monitor
|
|
1075
|
+
* @param {?} renderer The renderer to use to apply CSS classes to the element.
|
|
1076
|
+
* @param {?} checkChildren Whether to count the element as focused when its children are focused.
|
|
1077
|
+
* @return {?} An observable that emits when the focus state of the element changes.
|
|
1078
|
+
* When the element is blurred, null will be emitted.
|
|
1079
|
+
*/
|
|
1080
|
+
FocusMonitor.prototype.monitor = function (element, renderer, checkChildren) {
|
|
1081
|
+
var _this = this;
|
|
1082
|
+
// Do nothing if we're not on the browser platform.
|
|
1083
|
+
if (!this._platform.isBrowser) {
|
|
1084
|
+
return rxjs_observable_of.of(null);
|
|
1085
|
+
}
|
|
1086
|
+
// Check if we're already monitoring this element.
|
|
1087
|
+
if (this._elementInfo.has(element)) {
|
|
1088
|
+
var /** @type {?} */ cachedInfo = this._elementInfo.get(element); /** @type {?} */
|
|
1089
|
+
((cachedInfo)).checkChildren = checkChildren;
|
|
1090
|
+
return ((cachedInfo)).subject.asObservable();
|
|
1091
|
+
}
|
|
1092
|
+
// Create monitored element info.
|
|
1093
|
+
var /** @type {?} */ info = {
|
|
1094
|
+
unlisten: function () { },
|
|
1095
|
+
checkChildren: checkChildren,
|
|
1096
|
+
renderer: renderer,
|
|
1097
|
+
subject: new rxjs_Subject.Subject()
|
|
1098
|
+
};
|
|
1099
|
+
this._elementInfo.set(element, info);
|
|
1100
|
+
// Start listening. We need to listen in capture phase since focus events don't bubble.
|
|
1101
|
+
var /** @type {?} */ focusListener = function (event) { return _this._onFocus(event, element); };
|
|
1102
|
+
var /** @type {?} */ blurListener = function (event) { return _this._onBlur(event, element); };
|
|
1103
|
+
this._ngZone.runOutsideAngular(function () {
|
|
1104
|
+
element.addEventListener('focus', focusListener, true);
|
|
1105
|
+
element.addEventListener('blur', blurListener, true);
|
|
1106
|
+
});
|
|
1107
|
+
// Create an unlisten function for later.
|
|
1108
|
+
info.unlisten = function () {
|
|
1109
|
+
element.removeEventListener('focus', focusListener, true);
|
|
1110
|
+
element.removeEventListener('blur', blurListener, true);
|
|
1111
|
+
};
|
|
1112
|
+
return info.subject.asObservable();
|
|
1113
|
+
};
|
|
1114
|
+
/**
|
|
1115
|
+
* Stops monitoring an element and removes all focus classes.
|
|
1116
|
+
* @param {?} element The element to stop monitoring.
|
|
1117
|
+
* @return {?}
|
|
1118
|
+
*/
|
|
1119
|
+
FocusMonitor.prototype.stopMonitoring = function (element) {
|
|
1120
|
+
var /** @type {?} */ elementInfo = this._elementInfo.get(element);
|
|
1121
|
+
if (elementInfo) {
|
|
1122
|
+
elementInfo.unlisten();
|
|
1123
|
+
elementInfo.subject.complete();
|
|
1124
|
+
this._setClasses(element);
|
|
1125
|
+
this._elementInfo.delete(element);
|
|
1126
|
+
}
|
|
1127
|
+
};
|
|
1128
|
+
/**
|
|
1129
|
+
* Focuses the element via the specified focus origin.
|
|
1130
|
+
* @param {?} element The element to focus.
|
|
1131
|
+
* @param {?} origin The focus origin.
|
|
1132
|
+
* @return {?}
|
|
1133
|
+
*/
|
|
1134
|
+
FocusMonitor.prototype.focusVia = function (element, origin) {
|
|
1135
|
+
this._setOriginForCurrentEventQueue(origin);
|
|
1136
|
+
element.focus();
|
|
1137
|
+
};
|
|
1138
|
+
/**
|
|
1139
|
+
* Register necessary event listeners on the document and window.
|
|
1140
|
+
* @return {?}
|
|
1141
|
+
*/
|
|
1142
|
+
FocusMonitor.prototype._registerDocumentEvents = function () {
|
|
1143
|
+
var _this = this;
|
|
1144
|
+
// Do nothing if we're not on the browser platform.
|
|
1145
|
+
if (!this._platform.isBrowser) {
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
// Note: we listen to events in the capture phase so we can detect them even if the user stops
|
|
1149
|
+
// propagation.
|
|
1150
|
+
// On keydown record the origin and clear any touch event that may be in progress.
|
|
1151
|
+
document.addEventListener('keydown', function () {
|
|
1152
|
+
_this._lastTouchTarget = null;
|
|
1153
|
+
_this._setOriginForCurrentEventQueue('keyboard');
|
|
1154
|
+
}, true);
|
|
1155
|
+
// On mousedown record the origin only if there is not touch target, since a mousedown can
|
|
1156
|
+
// happen as a result of a touch event.
|
|
1157
|
+
document.addEventListener('mousedown', function () {
|
|
1158
|
+
if (!_this._lastTouchTarget) {
|
|
1159
|
+
_this._setOriginForCurrentEventQueue('mouse');
|
|
1160
|
+
}
|
|
1161
|
+
}, true);
|
|
1162
|
+
// When the touchstart event fires the focus event is not yet in the event queue. This means
|
|
1163
|
+
// we can't rely on the trick used above (setting timeout of 0ms). Instead we wait 650ms to
|
|
1164
|
+
// see if a focus happens.
|
|
1165
|
+
document.addEventListener('touchstart', function (event) {
|
|
1166
|
+
if (_this._touchTimeout != null) {
|
|
1167
|
+
clearTimeout(_this._touchTimeout);
|
|
1168
|
+
}
|
|
1169
|
+
_this._lastTouchTarget = event.target;
|
|
1170
|
+
_this._touchTimeout = setTimeout(function () { return _this._lastTouchTarget = null; }, TOUCH_BUFFER_MS);
|
|
1171
|
+
}, true);
|
|
1172
|
+
// Make a note of when the window regains focus, so we can restore the origin info for the
|
|
1173
|
+
// focused element.
|
|
1174
|
+
window.addEventListener('focus', function () {
|
|
1175
|
+
_this._windowFocused = true;
|
|
1176
|
+
setTimeout(function () { return _this._windowFocused = false; }, 0);
|
|
1177
|
+
});
|
|
1178
|
+
};
|
|
1179
|
+
/**
|
|
1180
|
+
* Sets the focus classes on the element based on the given focus origin.
|
|
1181
|
+
* @param {?} element The element to update the classes on.
|
|
1182
|
+
* @param {?=} origin The focus origin.
|
|
1183
|
+
* @return {?}
|
|
1184
|
+
*/
|
|
1185
|
+
FocusMonitor.prototype._setClasses = function (element, origin) {
|
|
1186
|
+
var /** @type {?} */ elementInfo = this._elementInfo.get(element);
|
|
1187
|
+
if (elementInfo) {
|
|
1188
|
+
var /** @type {?} */ toggleClass = function (className, shouldSet) {
|
|
1189
|
+
shouldSet ? elementInfo.renderer.addClass(element, className) :
|
|
1190
|
+
elementInfo.renderer.removeClass(element, className);
|
|
1191
|
+
};
|
|
1192
|
+
toggleClass('cdk-focused', !!origin);
|
|
1193
|
+
toggleClass('cdk-touch-focused', origin === 'touch');
|
|
1194
|
+
toggleClass('cdk-keyboard-focused', origin === 'keyboard');
|
|
1195
|
+
toggleClass('cdk-mouse-focused', origin === 'mouse');
|
|
1196
|
+
toggleClass('cdk-program-focused', origin === 'program');
|
|
1197
|
+
}
|
|
1198
|
+
};
|
|
1199
|
+
/**
|
|
1200
|
+
* Sets the origin and schedules an async function to clear it at the end of the event queue.
|
|
1201
|
+
* @param {?} origin The origin to set.
|
|
1202
|
+
* @return {?}
|
|
1203
|
+
*/
|
|
1204
|
+
FocusMonitor.prototype._setOriginForCurrentEventQueue = function (origin) {
|
|
1205
|
+
var _this = this;
|
|
1206
|
+
this._origin = origin;
|
|
1207
|
+
setTimeout(function () { return _this._origin = null; }, 0);
|
|
1208
|
+
};
|
|
1209
|
+
/**
|
|
1210
|
+
* Checks whether the given focus event was caused by a touchstart event.
|
|
1211
|
+
* @param {?} event The focus event to check.
|
|
1212
|
+
* @return {?} Whether the event was caused by a touch.
|
|
1213
|
+
*/
|
|
1214
|
+
FocusMonitor.prototype._wasCausedByTouch = function (event) {
|
|
1215
|
+
// Note(mmalerba): This implementation is not quite perfect, there is a small edge case.
|
|
1216
|
+
// Consider the following dom structure:
|
|
1217
|
+
//
|
|
1218
|
+
// <div #parent tabindex="0" cdkFocusClasses>
|
|
1219
|
+
// <div #child (click)="#parent.focus()"></div>
|
|
1220
|
+
// </div>
|
|
1221
|
+
//
|
|
1222
|
+
// If the user touches the #child element and the #parent is programmatically focused as a
|
|
1223
|
+
// result, this code will still consider it to have been caused by the touch event and will
|
|
1224
|
+
// apply the cdk-touch-focused class rather than the cdk-program-focused class. This is a
|
|
1225
|
+
// relatively small edge-case that can be worked around by using
|
|
1226
|
+
// focusVia(parentEl, renderer, 'program') to focus the parent element.
|
|
1227
|
+
//
|
|
1228
|
+
// If we decide that we absolutely must handle this case correctly, we can do so by listening
|
|
1229
|
+
// for the first focus event after the touchstart, and then the first blur event after that
|
|
1230
|
+
// focus event. When that blur event fires we know that whatever follows is not a result of the
|
|
1231
|
+
// touchstart.
|
|
1232
|
+
var /** @type {?} */ focusTarget = event.target;
|
|
1233
|
+
return this._lastTouchTarget instanceof Node && focusTarget instanceof Node &&
|
|
1234
|
+
(focusTarget === this._lastTouchTarget || focusTarget.contains(this._lastTouchTarget));
|
|
1235
|
+
};
|
|
1236
|
+
/**
|
|
1237
|
+
* Handles focus events on a registered element.
|
|
1238
|
+
* @param {?} event The focus event.
|
|
1239
|
+
* @param {?} element The monitored element.
|
|
1240
|
+
* @return {?}
|
|
1241
|
+
*/
|
|
1242
|
+
FocusMonitor.prototype._onFocus = function (event, element) {
|
|
1243
|
+
// NOTE(mmalerba): We currently set the classes based on the focus origin of the most recent
|
|
1244
|
+
// focus event affecting the monitored element. If we want to use the origin of the first event
|
|
1245
|
+
// instead we should check for the cdk-focused class here and return if the element already has
|
|
1246
|
+
// it. (This only matters for elements that have includesChildren = true).
|
|
1247
|
+
// If we are not counting child-element-focus as focused, make sure that the event target is the
|
|
1248
|
+
// monitored element itself.
|
|
1249
|
+
var /** @type {?} */ elementInfo = this._elementInfo.get(element);
|
|
1250
|
+
if (!elementInfo || (!elementInfo.checkChildren && element !== event.target)) {
|
|
1251
|
+
return;
|
|
1252
|
+
}
|
|
1253
|
+
// If we couldn't detect a cause for the focus event, it's due to one of three reasons:
|
|
1254
|
+
// 1) The window has just regained focus, in which case we want to restore the focused state of
|
|
1255
|
+
// the element from before the window blurred.
|
|
1256
|
+
// 2) It was caused by a touch event, in which case we mark the origin as 'touch'.
|
|
1257
|
+
// 3) The element was programmatically focused, in which case we should mark the origin as
|
|
1258
|
+
// 'program'.
|
|
1259
|
+
if (!this._origin) {
|
|
1260
|
+
if (this._windowFocused && this._lastFocusOrigin) {
|
|
1261
|
+
this._origin = this._lastFocusOrigin;
|
|
1262
|
+
}
|
|
1263
|
+
else if (this._wasCausedByTouch(event)) {
|
|
1264
|
+
this._origin = 'touch';
|
|
1265
|
+
}
|
|
1266
|
+
else {
|
|
1267
|
+
this._origin = 'program';
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1270
|
+
this._setClasses(element, this._origin);
|
|
1271
|
+
elementInfo.subject.next(this._origin);
|
|
1272
|
+
this._lastFocusOrigin = this._origin;
|
|
1273
|
+
this._origin = null;
|
|
1274
|
+
};
|
|
1275
|
+
/**
|
|
1276
|
+
* Handles blur events on a registered element.
|
|
1277
|
+
* @param {?} event The blur event.
|
|
1278
|
+
* @param {?} element The monitored element.
|
|
1279
|
+
* @return {?}
|
|
1280
|
+
*/
|
|
1281
|
+
FocusMonitor.prototype._onBlur = function (event, element) {
|
|
1282
|
+
// If we are counting child-element-focus as focused, make sure that we aren't just blurring in
|
|
1283
|
+
// order to focus another child of the monitored element.
|
|
1284
|
+
var /** @type {?} */ elementInfo = this._elementInfo.get(element);
|
|
1285
|
+
if (!elementInfo || (elementInfo.checkChildren && event.relatedTarget instanceof Node &&
|
|
1286
|
+
element.contains(event.relatedTarget))) {
|
|
1287
|
+
return;
|
|
1288
|
+
}
|
|
1289
|
+
this._setClasses(element);
|
|
1290
|
+
elementInfo.subject.next(null);
|
|
1291
|
+
};
|
|
1292
|
+
return FocusMonitor;
|
|
1293
|
+
}());
|
|
1294
|
+
FocusMonitor.decorators = [
|
|
1295
|
+
{ type: _angular_core.Injectable },
|
|
1296
|
+
];
|
|
1297
|
+
/**
|
|
1298
|
+
* @nocollapse
|
|
1299
|
+
*/
|
|
1300
|
+
FocusMonitor.ctorParameters = function () { return [
|
|
1301
|
+
{ type: _angular_core.NgZone, },
|
|
1302
|
+
{ type: _angular_cdk_platform.Platform, },
|
|
1303
|
+
]; };
|
|
1304
|
+
/**
|
|
1305
|
+
* Directive that determines how a particular element was focused (via keyboard, mouse, touch, or
|
|
1306
|
+
* programmatically) and adds corresponding classes to the element.
|
|
1307
|
+
*
|
|
1308
|
+
* There are two variants of this directive:
|
|
1309
|
+
* 1) cdkMonitorElementFocus: does not consider an element to be focused if one of its children is
|
|
1310
|
+
* focused.
|
|
1311
|
+
* 2) cdkMonitorSubtreeFocus: considers an element focused if it or any of its children are focused.
|
|
1312
|
+
*/
|
|
1313
|
+
var CdkMonitorFocus = (function () {
|
|
1314
|
+
/**
|
|
1315
|
+
* @param {?} _elementRef
|
|
1316
|
+
* @param {?} _focusMonitor
|
|
1317
|
+
* @param {?} renderer
|
|
1318
|
+
*/
|
|
1319
|
+
function CdkMonitorFocus(_elementRef, _focusMonitor, renderer) {
|
|
1320
|
+
var _this = this;
|
|
1321
|
+
this._elementRef = _elementRef;
|
|
1322
|
+
this._focusMonitor = _focusMonitor;
|
|
1323
|
+
this.cdkFocusChange = new _angular_core.EventEmitter();
|
|
1324
|
+
this._monitorSubscription = this._focusMonitor.monitor(this._elementRef.nativeElement, renderer, this._elementRef.nativeElement.hasAttribute('cdkMonitorSubtreeFocus'))
|
|
1325
|
+
.subscribe(function (origin) { return _this.cdkFocusChange.emit(origin); });
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* @return {?}
|
|
1329
|
+
*/
|
|
1330
|
+
CdkMonitorFocus.prototype.ngOnDestroy = function () {
|
|
1331
|
+
this._focusMonitor.stopMonitoring(this._elementRef.nativeElement);
|
|
1332
|
+
this._monitorSubscription.unsubscribe();
|
|
1333
|
+
};
|
|
1334
|
+
return CdkMonitorFocus;
|
|
1335
|
+
}());
|
|
1336
|
+
CdkMonitorFocus.decorators = [
|
|
1337
|
+
{ type: _angular_core.Directive, args: [{
|
|
1338
|
+
selector: '[cdkMonitorElementFocus], [cdkMonitorSubtreeFocus]',
|
|
1339
|
+
},] },
|
|
1340
|
+
];
|
|
1341
|
+
/**
|
|
1342
|
+
* @nocollapse
|
|
1343
|
+
*/
|
|
1344
|
+
CdkMonitorFocus.ctorParameters = function () { return [
|
|
1345
|
+
{ type: _angular_core.ElementRef, },
|
|
1346
|
+
{ type: FocusMonitor, },
|
|
1347
|
+
{ type: _angular_core.Renderer2, },
|
|
1348
|
+
]; };
|
|
1349
|
+
CdkMonitorFocus.propDecorators = {
|
|
1350
|
+
'cdkFocusChange': [{ type: _angular_core.Output },],
|
|
1351
|
+
};
|
|
1352
|
+
/**
|
|
1353
|
+
* \@docs-private
|
|
1354
|
+
* @param {?} parentDispatcher
|
|
1355
|
+
* @param {?} ngZone
|
|
1356
|
+
* @param {?} platform
|
|
1357
|
+
* @return {?}
|
|
1358
|
+
*/
|
|
1359
|
+
function FOCUS_MONITOR_PROVIDER_FACTORY(parentDispatcher, ngZone, platform) {
|
|
1360
|
+
return parentDispatcher || new FocusMonitor(ngZone, platform);
|
|
1361
|
+
}
|
|
1362
|
+
/**
|
|
1363
|
+
* \@docs-private
|
|
1364
|
+
*/
|
|
1365
|
+
var FOCUS_MONITOR_PROVIDER = {
|
|
1366
|
+
// If there is already a FocusMonitor available, use that. Otherwise, provide a new one.
|
|
1367
|
+
provide: FocusMonitor,
|
|
1368
|
+
deps: [[new _angular_core.Optional(), new _angular_core.SkipSelf(), FocusMonitor], _angular_core.NgZone, _angular_cdk_platform.Platform],
|
|
1369
|
+
useFactory: FOCUS_MONITOR_PROVIDER_FACTORY
|
|
1370
|
+
};
|
|
786
1371
|
/**
|
|
787
1372
|
* This class manages keyboard events for selectable lists. If you pass it a query list
|
|
788
1373
|
* of items, it will set the active item correctly when arrow events occur.
|
|
@@ -796,6 +1381,7 @@ var ListKeyManager = (function () {
|
|
|
796
1381
|
this._activeItemIndex = -1;
|
|
797
1382
|
this._wrap = false;
|
|
798
1383
|
this._letterKeyStream = new rxjs_Subject.Subject();
|
|
1384
|
+
this._typeaheadSubscription = rxjs_Subscription.Subscription.EMPTY;
|
|
799
1385
|
this._pressedLetters = [];
|
|
800
1386
|
/**
|
|
801
1387
|
* Stream that emits any time the TAB key is pressed, so components can react
|
|
@@ -823,9 +1409,7 @@ var ListKeyManager = (function () {
|
|
|
823
1409
|
if (this._items.length && this._items.some(function (item) { return typeof item.getLabel !== 'function'; })) {
|
|
824
1410
|
throw Error('ListKeyManager items in typeahead mode must implement the `getLabel` method.');
|
|
825
1411
|
}
|
|
826
|
-
|
|
827
|
-
this._typeaheadSubscription.unsubscribe();
|
|
828
|
-
}
|
|
1412
|
+
this._typeaheadSubscription.unsubscribe();
|
|
829
1413
|
// Debounce the presses of non-navigational keys, collect the ones that correspond to letters
|
|
830
1414
|
// and convert those letters back into a string. Afterwards find the first item that starts
|
|
831
1415
|
// with that string and select it.
|
|
@@ -1041,6 +1625,18 @@ var ActiveDescendantKeyManager = (function (_super) {
|
|
|
1041
1625
|
};
|
|
1042
1626
|
return ActiveDescendantKeyManager;
|
|
1043
1627
|
}(ListKeyManager));
|
|
1628
|
+
/**
|
|
1629
|
+
* Screenreaders will often fire fake mousedown events when a focusable element
|
|
1630
|
+
* is activated using the keyboard. We can typically distinguish between these faked
|
|
1631
|
+
* mousedown events and real mousedown events using the "buttons" property. While
|
|
1632
|
+
* real mousedowns will indicate the mouse button that was pressed (e.g. "1" for
|
|
1633
|
+
* the left mouse button), faked mousedowns will usually set the property value to 0.
|
|
1634
|
+
* @param {?} event
|
|
1635
|
+
* @return {?}
|
|
1636
|
+
*/
|
|
1637
|
+
function isFakeMousedownFromScreenReader(event) {
|
|
1638
|
+
return event.buttons === 0;
|
|
1639
|
+
}
|
|
1044
1640
|
var FocusKeyManager = (function (_super) {
|
|
1045
1641
|
__extends(FocusKeyManager, _super);
|
|
1046
1642
|
function FocusKeyManager() {
|
|
@@ -1068,9 +1664,16 @@ var A11yModule = (function () {
|
|
|
1068
1664
|
A11yModule.decorators = [
|
|
1069
1665
|
{ type: _angular_core.NgModule, args: [{
|
|
1070
1666
|
imports: [_angular_common.CommonModule, _angular_cdk_platform.PlatformModule],
|
|
1071
|
-
declarations: [FocusTrapDirective, FocusTrapDeprecatedDirective],
|
|
1072
|
-
exports: [FocusTrapDirective, FocusTrapDeprecatedDirective],
|
|
1073
|
-
providers: [
|
|
1667
|
+
declarations: [FocusTrapDirective, FocusTrapDeprecatedDirective, CdkMonitorFocus],
|
|
1668
|
+
exports: [FocusTrapDirective, FocusTrapDeprecatedDirective, CdkMonitorFocus],
|
|
1669
|
+
providers: [
|
|
1670
|
+
InteractivityChecker,
|
|
1671
|
+
FocusTrapFactory,
|
|
1672
|
+
AriaDescriber,
|
|
1673
|
+
LIVE_ANNOUNCER_PROVIDER,
|
|
1674
|
+
ARIA_DESCRIBER_PROVIDER,
|
|
1675
|
+
FOCUS_MONITOR_PROVIDER,
|
|
1676
|
+
]
|
|
1074
1677
|
},] },
|
|
1075
1678
|
];
|
|
1076
1679
|
/**
|
|
@@ -1079,19 +1682,30 @@ A11yModule.decorators = [
|
|
|
1079
1682
|
A11yModule.ctorParameters = function () { return []; };
|
|
1080
1683
|
|
|
1081
1684
|
exports.A11yModule = A11yModule;
|
|
1082
|
-
exports.
|
|
1083
|
-
exports.
|
|
1084
|
-
exports.
|
|
1085
|
-
exports.
|
|
1685
|
+
exports.ActiveDescendantKeyManager = ActiveDescendantKeyManager;
|
|
1686
|
+
exports.MESSAGES_CONTAINER_ID = MESSAGES_CONTAINER_ID;
|
|
1687
|
+
exports.CDK_DESCRIBEDBY_ID_PREFIX = CDK_DESCRIBEDBY_ID_PREFIX;
|
|
1688
|
+
exports.CDK_DESCRIBEDBY_HOST_ATTRIBUTE = CDK_DESCRIBEDBY_HOST_ATTRIBUTE;
|
|
1689
|
+
exports.AriaDescriber = AriaDescriber;
|
|
1690
|
+
exports.ARIA_DESCRIBER_PROVIDER_FACTORY = ARIA_DESCRIBER_PROVIDER_FACTORY;
|
|
1691
|
+
exports.ARIA_DESCRIBER_PROVIDER = ARIA_DESCRIBER_PROVIDER;
|
|
1086
1692
|
exports.isFakeMousedownFromScreenReader = isFakeMousedownFromScreenReader;
|
|
1693
|
+
exports.FocusKeyManager = FocusKeyManager;
|
|
1087
1694
|
exports.FocusTrap = FocusTrap;
|
|
1088
1695
|
exports.FocusTrapFactory = FocusTrapFactory;
|
|
1089
1696
|
exports.FocusTrapDeprecatedDirective = FocusTrapDeprecatedDirective;
|
|
1090
1697
|
exports.FocusTrapDirective = FocusTrapDirective;
|
|
1091
1698
|
exports.InteractivityChecker = InteractivityChecker;
|
|
1092
1699
|
exports.ListKeyManager = ListKeyManager;
|
|
1093
|
-
exports.
|
|
1094
|
-
exports.
|
|
1700
|
+
exports.LIVE_ANNOUNCER_ELEMENT_TOKEN = LIVE_ANNOUNCER_ELEMENT_TOKEN;
|
|
1701
|
+
exports.LiveAnnouncer = LiveAnnouncer;
|
|
1702
|
+
exports.LIVE_ANNOUNCER_PROVIDER_FACTORY = LIVE_ANNOUNCER_PROVIDER_FACTORY;
|
|
1703
|
+
exports.LIVE_ANNOUNCER_PROVIDER = LIVE_ANNOUNCER_PROVIDER;
|
|
1704
|
+
exports.TOUCH_BUFFER_MS = TOUCH_BUFFER_MS;
|
|
1705
|
+
exports.FocusMonitor = FocusMonitor;
|
|
1706
|
+
exports.CdkMonitorFocus = CdkMonitorFocus;
|
|
1707
|
+
exports.FOCUS_MONITOR_PROVIDER_FACTORY = FOCUS_MONITOR_PROVIDER_FACTORY;
|
|
1708
|
+
exports.FOCUS_MONITOR_PROVIDER = FOCUS_MONITOR_PROVIDER;
|
|
1095
1709
|
|
|
1096
1710
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
1097
1711
|
|