@angular-wave/angular.ts 0.0.69 → 0.0.71
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/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/animations/shared.js +14 -5
- package/src/core/compile/attributes.js +326 -0
- package/src/core/compile/compile.js +76 -434
- package/src/core/compile/compile.spec.js +2 -2
- package/src/core/interpolate/interpolate.js +1 -12
- package/src/core/location/location.js +26 -4
- package/src/core/parser/parse.js +50 -47
- package/src/core/scope/scope.js +4 -8
- package/src/{exts → directive}/aria/aria.html +1 -1
- package/src/directive/aria/aria.js +382 -0
- package/src/{exts → directive}/aria/aria.spec.js +12 -12
- package/src/{exts → directive}/aria/aria.test.js +1 -1
- package/src/directive/form/form.js +3 -1
- package/src/directive/messages/messages.js +268 -274
- package/src/filters/filter.js +0 -3
- package/src/filters/limit-to.js +0 -1
- package/src/public.js +27 -3
- package/src/router/state/state-object.js +4 -9
- package/src/router/url/url-matcher.js +1 -1
- package/src/router/url/url-rule.js +5 -1
- package/src/router/url/url-service.js +1 -1
- package/src/shared/jqlite/jqlite.js +13 -1
- package/src/shared/utils.js +0 -2
- package/src/types.js +1 -1
- package/types/animations/shared.d.ts +11 -6
- package/types/core/compile/attributes.d.ts +101 -0
- package/types/core/compile/compile.d.ts +10 -67
- package/types/core/interpolate/interpolate.d.ts +1 -12
- package/types/core/location/location.d.ts +12 -2
- package/types/core/parser/parse.d.ts +10 -10
- package/types/core/scope/scope.d.ts +21 -22
- package/types/directive/aria/aria.d.ts +94 -0
- package/types/directive/form/form.d.ts +2 -11
- package/types/router/state/state-object.d.ts +0 -2
- package/types/router/url/url-matcher.d.ts +2 -2
- package/types/router/url/url-rule.d.ts +2 -1
- package/types/shared/jqlite/jqlite.d.ts +8 -4
- package/types/shared/utils.d.ts +0 -2
- package/types/types.d.ts +1 -1
- package/src/exts/aria/aria.js +0 -415
- package/types/exts/aria/aria.d.ts +0 -1
- /package/src/{exts → directive}/aria/aria.md +0 -0
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ngdoc provider
|
|
3
|
+
* @name $ariaProvider
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* @description
|
|
7
|
+
*
|
|
8
|
+
* Used for configuring the ARIA attributes injected and managed by ngAria.
|
|
9
|
+
*
|
|
10
|
+
* ```js
|
|
11
|
+
* angular.module('myApp', ['ngAria'], function config($ariaProvider) {
|
|
12
|
+
* $ariaProvider.config({
|
|
13
|
+
* ariaValue: true,
|
|
14
|
+
* tabindex: false
|
|
15
|
+
* });
|
|
16
|
+
* });
|
|
17
|
+
*```
|
|
18
|
+
*
|
|
19
|
+
* ## Dependencies
|
|
20
|
+
* Requires the {@link ngAria} module to be installed.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
export function AriaProvider(): void;
|
|
24
|
+
export class AriaProvider {
|
|
25
|
+
config: (newConfig: any) => void;
|
|
26
|
+
$get: () => {
|
|
27
|
+
config(key: any): any;
|
|
28
|
+
$$watchExpr: (attrName: any, ariaAttr: any, nativeAriaNodeNames: any, negate: any) => (scope: any, elem: any, attr: any) => void;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function ngDisabledAriaDirective($aria: any): any;
|
|
32
|
+
export namespace ngDisabledAriaDirective {
|
|
33
|
+
let $inject: string[];
|
|
34
|
+
}
|
|
35
|
+
export function ngShowAriaDirective($aria: any): any;
|
|
36
|
+
export namespace ngShowAriaDirective {
|
|
37
|
+
let $inject_1: string[];
|
|
38
|
+
export { $inject_1 as $inject };
|
|
39
|
+
}
|
|
40
|
+
export function ngMessagesAriaDirective(): {
|
|
41
|
+
restrict: string;
|
|
42
|
+
require: string;
|
|
43
|
+
link(_scope: any, elem: any, attr: any): void;
|
|
44
|
+
};
|
|
45
|
+
export function ngClickAriaDirective($aria: any, $parse: any): {
|
|
46
|
+
restrict: string;
|
|
47
|
+
compile(elem: any, attr: any): (scope: any, elem: any, attr: any) => void;
|
|
48
|
+
};
|
|
49
|
+
export namespace ngClickAriaDirective {
|
|
50
|
+
let $inject_2: string[];
|
|
51
|
+
export { $inject_2 as $inject };
|
|
52
|
+
}
|
|
53
|
+
export function ngRequiredAriaDirective($aria: any): any;
|
|
54
|
+
export namespace ngRequiredAriaDirective {
|
|
55
|
+
let $inject_3: string[];
|
|
56
|
+
export { $inject_3 as $inject };
|
|
57
|
+
}
|
|
58
|
+
export function ngCheckedAriaDirective($aria: any): any;
|
|
59
|
+
export namespace ngCheckedAriaDirective {
|
|
60
|
+
let $inject_4: string[];
|
|
61
|
+
export { $inject_4 as $inject };
|
|
62
|
+
}
|
|
63
|
+
export function ngValueAriaDirective($aria: any): any;
|
|
64
|
+
export namespace ngValueAriaDirective {
|
|
65
|
+
let $inject_5: string[];
|
|
66
|
+
export { $inject_5 as $inject };
|
|
67
|
+
}
|
|
68
|
+
export function ngHideAriaDirective($aria: any): any;
|
|
69
|
+
export namespace ngHideAriaDirective {
|
|
70
|
+
let $inject_6: string[];
|
|
71
|
+
export { $inject_6 as $inject };
|
|
72
|
+
}
|
|
73
|
+
export function ngReadonlyAriaDirective($aria: any): any;
|
|
74
|
+
export namespace ngReadonlyAriaDirective {
|
|
75
|
+
let $inject_7: string[];
|
|
76
|
+
export { $inject_7 as $inject };
|
|
77
|
+
}
|
|
78
|
+
export function ngModelAriaDirective($aria: any): {
|
|
79
|
+
restrict: string;
|
|
80
|
+
require: string;
|
|
81
|
+
priority: number;
|
|
82
|
+
compile(elem: any, attr: any): {
|
|
83
|
+
post(scope: any, elem: any, attr: any, ngModel: any): void;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export namespace ngModelAriaDirective {
|
|
87
|
+
let $inject_8: string[];
|
|
88
|
+
export { $inject_8 as $inject };
|
|
89
|
+
}
|
|
90
|
+
export function ngDblclickAriaDirective($aria: any): (scope: any, elem: any, attr: any) => void;
|
|
91
|
+
export namespace ngDblclickAriaDirective {
|
|
92
|
+
let $inject_9: string[];
|
|
93
|
+
export { $inject_9 as $inject };
|
|
94
|
+
}
|
|
@@ -11,17 +11,8 @@ export class FormController {
|
|
|
11
11
|
$valid: boolean;
|
|
12
12
|
$invalid: boolean;
|
|
13
13
|
$submitted: boolean;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
$getControls: () => any;
|
|
17
|
-
$$renameControl: typeof nullFormRenameControl;
|
|
18
|
-
$removeControl: () => void;
|
|
19
|
-
$setValidity: () => void;
|
|
20
|
-
$setDirty: () => void;
|
|
21
|
-
$setPristine: () => void;
|
|
22
|
-
$setSubmitted: () => void;
|
|
23
|
-
$$setSubmitted: () => void;
|
|
24
|
-
};
|
|
14
|
+
/** @type {FormController|Object} */
|
|
15
|
+
$$parentForm: FormController | any;
|
|
25
16
|
$$element: any;
|
|
26
17
|
$$animate: any;
|
|
27
18
|
/**
|
|
@@ -63,8 +63,6 @@ export class StateObject {
|
|
|
63
63
|
toString(): any;
|
|
64
64
|
}
|
|
65
65
|
export namespace StateObject {
|
|
66
|
-
/** Predicate which returns true if the object is an class with @State() decorator */
|
|
67
|
-
function isStateClass(stateDecl: any): boolean;
|
|
68
66
|
/** Predicate which returns true if the object is a [[StateDeclaration]] object */
|
|
69
67
|
function isStateDeclaration(obj: any): boolean;
|
|
70
68
|
/** Predicate which returns true if the object is an internal [[StateObject]] object */
|
|
@@ -135,9 +135,9 @@ export class UrlMatcher {
|
|
|
135
135
|
*
|
|
136
136
|
* @param id
|
|
137
137
|
* @param opts
|
|
138
|
-
* @returns {
|
|
138
|
+
* @returns {Param|any|boolean|UrlMatcher|null}
|
|
139
139
|
*/
|
|
140
|
-
parameter(id: any, opts?: {}):
|
|
140
|
+
parameter(id: any, opts?: {}): Param | any | boolean | UrlMatcher | null;
|
|
141
141
|
/**
|
|
142
142
|
* Validates the input parameter values against this UrlMatcher
|
|
143
143
|
*
|
|
@@ -2,19 +2,23 @@
|
|
|
2
2
|
* JQLite both a function and an array-like data structure for manipulation of DOM, linking elements to expando cache,
|
|
3
3
|
* and execution of chain functions.
|
|
4
4
|
*
|
|
5
|
-
* @param {string|Node|JQLite|ArrayLike<Element>|(() => void)|Window} element
|
|
5
|
+
* @param {string|Node|Node[]|NodeList|JQLite|ArrayLike<Element>|(() => void)|Window} element
|
|
6
6
|
* @returns {JQLite}
|
|
7
7
|
*/
|
|
8
|
-
export function JQLite(element: string | Node | JQLite | ArrayLike<Element> | (() => void) | Window): JQLite;
|
|
8
|
+
export function JQLite(element: string | Node | Node[] | NodeList | JQLite | ArrayLike<Element> | (() => void) | Window): JQLite;
|
|
9
9
|
export class JQLite {
|
|
10
10
|
/**
|
|
11
11
|
* JQLite both a function and an array-like data structure for manipulation of DOM, linking elements to expando cache,
|
|
12
12
|
* and execution of chain functions.
|
|
13
13
|
*
|
|
14
|
-
* @param {string|Node|JQLite|ArrayLike<Element>|(() => void)|Window} element
|
|
14
|
+
* @param {string|Node|Node[]|NodeList|JQLite|ArrayLike<Element>|(() => void)|Window} element
|
|
15
15
|
* @returns {JQLite}
|
|
16
16
|
*/
|
|
17
|
-
constructor(element: string | Node | JQLite | ArrayLike<Element> | (() => void) | Window);
|
|
17
|
+
constructor(element: string | Node | Node[] | NodeList | JQLite | ArrayLike<Element> | (() => void) | Window);
|
|
18
|
+
/**
|
|
19
|
+
* @returns {Element[]}
|
|
20
|
+
*/
|
|
21
|
+
elements(): Element[];
|
|
18
22
|
/**
|
|
19
23
|
* Remove all child nodes of the set of matched elements from the DOM and clears CACHE data, associated with the node.
|
|
20
24
|
* @returns {JQLite} The current instance of JQLite.
|
package/types/shared/utils.d.ts
CHANGED
|
@@ -106,7 +106,6 @@ export function isFunction(value: any): boolean;
|
|
|
106
106
|
/**
|
|
107
107
|
* Determines if a value is a regular expression object.
|
|
108
108
|
*
|
|
109
|
-
* @private
|
|
110
109
|
* @param {*} value Reference to check.
|
|
111
110
|
* @returns {boolean} True if `value` is a `RegExp`.
|
|
112
111
|
*/
|
|
@@ -114,7 +113,6 @@ export function isRegExp(value: any): boolean;
|
|
|
114
113
|
/**
|
|
115
114
|
* Checks if `obj` is a window object.
|
|
116
115
|
*
|
|
117
|
-
* @private
|
|
118
116
|
* @param {*} obj Object to check
|
|
119
117
|
* @returns {boolean} True if `obj` is a window obj.
|
|
120
118
|
*/
|
package/types/types.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export type TranscludeFunctionObject = {
|
|
|
41
41
|
*/
|
|
42
42
|
isSlotFilled: (arg0: string) => boolean;
|
|
43
43
|
};
|
|
44
|
-
export type TranscludeFunction = (arg0: TScope, arg1: CloneAttachFunction, arg2: import("./shared/jqlite/jqlite").JQLite | undefined, arg3: string | undefined) => import("./shared/jqlite/jqlite").JQLite;
|
|
44
|
+
export type TranscludeFunction = (arg0: TScope | Function, arg1: CloneAttachFunction | undefined, arg2: import("./shared/jqlite/jqlite").JQLite | undefined, arg3: string | undefined) => import("./shared/jqlite/jqlite").JQLite;
|
|
45
45
|
export type transcludeWithScope = (arg0: TScope, arg1: CloneAttachFunction, arg2: import("./shared/jqlite/jqlite").JQLite | undefined, arg3: string | undefined) => import("./shared/jqlite/jqlite").JQLite;
|
|
46
46
|
export type transcludeWithoutScope = (arg0: CloneAttachFunction | undefined, arg1: import("./shared/jqlite/jqlite").JQLite | undefined, arg2: string | undefined) => import("./shared/jqlite/jqlite").JQLite;
|
|
47
47
|
/**
|
package/src/exts/aria/aria.js
DELETED
|
@@ -1,415 +0,0 @@
|
|
|
1
|
-
import { extend } from "../../shared/utils";
|
|
2
|
-
|
|
3
|
-
const ARIA_DISABLE_ATTR = "ngAriaDisable";
|
|
4
|
-
|
|
5
|
-
export function initAriaModule(angular) {
|
|
6
|
-
angular
|
|
7
|
-
.module("ngAria", ["ng"])
|
|
8
|
-
.provider("$aria", $AriaProvider)
|
|
9
|
-
.directive("ngShow", [
|
|
10
|
-
"$aria",
|
|
11
|
-
function ($aria) {
|
|
12
|
-
return $aria.$$watchExpr("ngShow", "aria-hidden", [], true);
|
|
13
|
-
},
|
|
14
|
-
])
|
|
15
|
-
.directive("ngHide", [
|
|
16
|
-
"$aria",
|
|
17
|
-
function ($aria) {
|
|
18
|
-
return $aria.$$watchExpr("ngHide", "aria-hidden", [], false);
|
|
19
|
-
},
|
|
20
|
-
])
|
|
21
|
-
.directive("ngValue", [
|
|
22
|
-
"$aria",
|
|
23
|
-
function ($aria) {
|
|
24
|
-
return $aria.$$watchExpr(
|
|
25
|
-
"ngValue",
|
|
26
|
-
"aria-checked",
|
|
27
|
-
nativeAriaNodeNames,
|
|
28
|
-
false,
|
|
29
|
-
);
|
|
30
|
-
},
|
|
31
|
-
])
|
|
32
|
-
.directive("ngChecked", [
|
|
33
|
-
"$aria",
|
|
34
|
-
function ($aria) {
|
|
35
|
-
return $aria.$$watchExpr(
|
|
36
|
-
"ngChecked",
|
|
37
|
-
"aria-checked",
|
|
38
|
-
nativeAriaNodeNames,
|
|
39
|
-
false,
|
|
40
|
-
);
|
|
41
|
-
},
|
|
42
|
-
])
|
|
43
|
-
.directive("ngReadonly", [
|
|
44
|
-
"$aria",
|
|
45
|
-
function ($aria) {
|
|
46
|
-
return $aria.$$watchExpr(
|
|
47
|
-
"ngReadonly",
|
|
48
|
-
"aria-readonly",
|
|
49
|
-
nativeAriaNodeNames,
|
|
50
|
-
false,
|
|
51
|
-
);
|
|
52
|
-
},
|
|
53
|
-
])
|
|
54
|
-
.directive("ngRequired", [
|
|
55
|
-
"$aria",
|
|
56
|
-
function ($aria) {
|
|
57
|
-
return $aria.$$watchExpr(
|
|
58
|
-
"ngRequired",
|
|
59
|
-
"aria-required",
|
|
60
|
-
nativeAriaNodeNames,
|
|
61
|
-
false,
|
|
62
|
-
);
|
|
63
|
-
},
|
|
64
|
-
])
|
|
65
|
-
.directive("ngModel", [
|
|
66
|
-
"$aria",
|
|
67
|
-
function ($aria) {
|
|
68
|
-
function shouldAttachAttr(
|
|
69
|
-
attr,
|
|
70
|
-
normalizedAttr,
|
|
71
|
-
elem,
|
|
72
|
-
allowNonAriaNodes,
|
|
73
|
-
) {
|
|
74
|
-
return (
|
|
75
|
-
$aria.config(normalizedAttr) &&
|
|
76
|
-
!elem.attr(attr) &&
|
|
77
|
-
(allowNonAriaNodes || !isNodeOneOf(elem, nativeAriaNodeNames)) &&
|
|
78
|
-
(elem.attr("type") !== "hidden" || elem[0].nodeName !== "INPUT")
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function shouldAttachRole(role, elem) {
|
|
83
|
-
// if element does not have role attribute
|
|
84
|
-
// AND element type is equal to role (if custom element has a type equaling shape) <-- remove?
|
|
85
|
-
// AND element is not in nativeAriaNodeNames
|
|
86
|
-
return (
|
|
87
|
-
!elem.attr("role") &&
|
|
88
|
-
elem.attr("type") === role &&
|
|
89
|
-
!isNodeOneOf(elem, nativeAriaNodeNames)
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function getShape(attr) {
|
|
94
|
-
const { type } = attr;
|
|
95
|
-
const { role } = attr;
|
|
96
|
-
|
|
97
|
-
return (type || role) === "checkbox" || role === "menuitemcheckbox"
|
|
98
|
-
? "checkbox"
|
|
99
|
-
: (type || role) === "radio" || role === "menuitemradio"
|
|
100
|
-
? "radio"
|
|
101
|
-
: type === "range" || role === "progressbar" || role === "slider"
|
|
102
|
-
? "range"
|
|
103
|
-
: "";
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return {
|
|
107
|
-
restrict: "A",
|
|
108
|
-
require: "ngModel",
|
|
109
|
-
priority: 200, // Make sure watches are fired after any other directives that affect the ngModel value
|
|
110
|
-
compile(elem, attr) {
|
|
111
|
-
if (Object.prototype.hasOwnProperty.call(attr, ARIA_DISABLE_ATTR))
|
|
112
|
-
return;
|
|
113
|
-
|
|
114
|
-
const shape = getShape(attr);
|
|
115
|
-
|
|
116
|
-
return {
|
|
117
|
-
post(scope, elem, attr, ngModel) {
|
|
118
|
-
const needsTabIndex = shouldAttachAttr(
|
|
119
|
-
"tabindex",
|
|
120
|
-
"tabindex",
|
|
121
|
-
elem,
|
|
122
|
-
false,
|
|
123
|
-
);
|
|
124
|
-
|
|
125
|
-
function ngAriaWatchModelValue() {
|
|
126
|
-
return ngModel.$modelValue;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function getRadioReaction() {
|
|
130
|
-
// Strict comparison would cause a BC
|
|
131
|
-
elem[0].setAttribute(
|
|
132
|
-
"aria-checked",
|
|
133
|
-
(attr.value == ngModel.$viewValue).toString(),
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function getCheckboxReaction() {
|
|
138
|
-
elem.attr(
|
|
139
|
-
"aria-checked",
|
|
140
|
-
(!ngModel.$isEmpty(ngModel.$viewValue)).toString(),
|
|
141
|
-
);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
switch (shape) {
|
|
145
|
-
case "radio":
|
|
146
|
-
case "checkbox":
|
|
147
|
-
if (shouldAttachRole(shape, elem)) {
|
|
148
|
-
elem.attr("role", shape);
|
|
149
|
-
}
|
|
150
|
-
if (
|
|
151
|
-
shouldAttachAttr(
|
|
152
|
-
"aria-checked",
|
|
153
|
-
"ariaChecked",
|
|
154
|
-
elem,
|
|
155
|
-
false,
|
|
156
|
-
)
|
|
157
|
-
) {
|
|
158
|
-
scope.$watch(
|
|
159
|
-
ngAriaWatchModelValue,
|
|
160
|
-
shape === "radio"
|
|
161
|
-
? getRadioReaction
|
|
162
|
-
: getCheckboxReaction,
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
if (needsTabIndex) {
|
|
166
|
-
elem.attr("tabindex", 0);
|
|
167
|
-
}
|
|
168
|
-
break;
|
|
169
|
-
case "range":
|
|
170
|
-
if (shouldAttachRole(shape, elem)) {
|
|
171
|
-
elem.attr("role", "slider");
|
|
172
|
-
}
|
|
173
|
-
if ($aria.config("ariaValue")) {
|
|
174
|
-
const needsAriaValuemin =
|
|
175
|
-
!elem.attr("aria-valuemin") &&
|
|
176
|
-
(Object.prototype.hasOwnProperty.call(attr, "min") ||
|
|
177
|
-
Object.prototype.hasOwnProperty.call(attr, "ngMin"));
|
|
178
|
-
const needsAriaValuemax =
|
|
179
|
-
!elem.attr("aria-valuemax") &&
|
|
180
|
-
(Object.prototype.hasOwnProperty.call(attr, "max") ||
|
|
181
|
-
Object.prototype.hasOwnProperty.call(attr, "ngMax"));
|
|
182
|
-
const needsAriaValuenow = !elem.attr("aria-valuenow");
|
|
183
|
-
|
|
184
|
-
if (needsAriaValuemin) {
|
|
185
|
-
attr.$observe("min", (newVal) => {
|
|
186
|
-
elem.attr("aria-valuemin", newVal);
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
if (needsAriaValuemax) {
|
|
190
|
-
attr.$observe("max", (newVal) => {
|
|
191
|
-
elem.attr("aria-valuemax", newVal);
|
|
192
|
-
});
|
|
193
|
-
}
|
|
194
|
-
if (needsAriaValuenow) {
|
|
195
|
-
scope.$watch(ngAriaWatchModelValue, (newVal) => {
|
|
196
|
-
elem.attr("aria-valuenow", newVal);
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
if (needsTabIndex) {
|
|
201
|
-
elem.attr("tabindex", 0);
|
|
202
|
-
}
|
|
203
|
-
break;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
if (
|
|
207
|
-
!Object.prototype.hasOwnProperty.call(attr, "ngRequired") &&
|
|
208
|
-
ngModel.$validators.required &&
|
|
209
|
-
shouldAttachAttr("aria-required", "ariaRequired", elem, false)
|
|
210
|
-
) {
|
|
211
|
-
// ngModel.$error.required is undefined on custom controls
|
|
212
|
-
attr.$observe("required", () => {
|
|
213
|
-
elem.attr("aria-required", (!!attr.required).toString());
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (
|
|
218
|
-
shouldAttachAttr("aria-invalid", "ariaInvalid", elem, true)
|
|
219
|
-
) {
|
|
220
|
-
scope.$watch(
|
|
221
|
-
() => ngModel.$invalid,
|
|
222
|
-
(newVal) => {
|
|
223
|
-
elem.attr("aria-invalid", (!!newVal).toString());
|
|
224
|
-
},
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
},
|
|
228
|
-
};
|
|
229
|
-
},
|
|
230
|
-
};
|
|
231
|
-
},
|
|
232
|
-
])
|
|
233
|
-
.directive("ngDisabled", [
|
|
234
|
-
"$aria",
|
|
235
|
-
function ($aria) {
|
|
236
|
-
return $aria.$$watchExpr(
|
|
237
|
-
"ngDisabled",
|
|
238
|
-
"aria-disabled",
|
|
239
|
-
nativeAriaNodeNames,
|
|
240
|
-
false,
|
|
241
|
-
);
|
|
242
|
-
},
|
|
243
|
-
])
|
|
244
|
-
.directive("ngMessages", () => ({
|
|
245
|
-
restrict: "A",
|
|
246
|
-
require: "?ngMessages",
|
|
247
|
-
link(_scope, elem, attr) {
|
|
248
|
-
if (Object.prototype.hasOwnProperty.call(attr, ARIA_DISABLE_ATTR))
|
|
249
|
-
return;
|
|
250
|
-
|
|
251
|
-
if (!elem.attr("aria-live")) {
|
|
252
|
-
elem.attr("aria-live", "assertive");
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
}))
|
|
256
|
-
.directive("ngClick", [
|
|
257
|
-
"$aria",
|
|
258
|
-
"$parse",
|
|
259
|
-
function ($aria, $parse) {
|
|
260
|
-
return {
|
|
261
|
-
restrict: "A",
|
|
262
|
-
compile(elem, attr) {
|
|
263
|
-
if (Object.prototype.hasOwnProperty.call(attr, ARIA_DISABLE_ATTR))
|
|
264
|
-
return;
|
|
265
|
-
|
|
266
|
-
const fn = $parse(attr.ngClick);
|
|
267
|
-
return function (scope, elem, attr) {
|
|
268
|
-
if (!isNodeOneOf(elem, nativeAriaNodeNames)) {
|
|
269
|
-
if ($aria.config("bindRoleForClick") && !elem.attr("role")) {
|
|
270
|
-
elem.attr("role", "button");
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if ($aria.config("tabindex") && !elem.attr("tabindex")) {
|
|
274
|
-
elem.attr("tabindex", 0);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (
|
|
278
|
-
$aria.config("bindKeydown") &&
|
|
279
|
-
!attr.ngKeydown &&
|
|
280
|
-
!attr.ngKeypress &&
|
|
281
|
-
!attr.ngKeyup
|
|
282
|
-
) {
|
|
283
|
-
elem.on("keydown", (event) => {
|
|
284
|
-
const keyCode = event.which || event.keyCode;
|
|
285
|
-
|
|
286
|
-
if (keyCode === 13 || keyCode === 32) {
|
|
287
|
-
// If the event is triggered on a non-interactive element ...
|
|
288
|
-
if (
|
|
289
|
-
nativeAriaNodeNames.indexOf(event.target.nodeName) ===
|
|
290
|
-
-1 &&
|
|
291
|
-
!event.target.isContentEditable
|
|
292
|
-
) {
|
|
293
|
-
// ... prevent the default browser behavior (e.g. scrolling when pressing spacebar)
|
|
294
|
-
// See https://github.com/angular/angular.js/issues/16664
|
|
295
|
-
event.preventDefault();
|
|
296
|
-
}
|
|
297
|
-
scope.$apply(callback);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
function callback() {
|
|
301
|
-
fn(scope, { $event: event });
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
},
|
|
308
|
-
};
|
|
309
|
-
},
|
|
310
|
-
])
|
|
311
|
-
.directive("ngDblclick", [
|
|
312
|
-
"$aria",
|
|
313
|
-
function ($aria) {
|
|
314
|
-
return function (scope, elem, attr) {
|
|
315
|
-
if (Object.prototype.hasOwnProperty.call(attr, ARIA_DISABLE_ATTR))
|
|
316
|
-
return;
|
|
317
|
-
|
|
318
|
-
if (
|
|
319
|
-
$aria.config("tabindex") &&
|
|
320
|
-
!elem.attr("tabindex") &&
|
|
321
|
-
!isNodeOneOf(elem, nativeAriaNodeNames)
|
|
322
|
-
) {
|
|
323
|
-
elem.attr("tabindex", 0);
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
},
|
|
327
|
-
]);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Internal Utilities
|
|
332
|
-
*/
|
|
333
|
-
const nativeAriaNodeNames = [
|
|
334
|
-
"BUTTON",
|
|
335
|
-
"A",
|
|
336
|
-
"INPUT",
|
|
337
|
-
"TEXTAREA",
|
|
338
|
-
"SELECT",
|
|
339
|
-
"DETAILS",
|
|
340
|
-
"SUMMARY",
|
|
341
|
-
];
|
|
342
|
-
|
|
343
|
-
const isNodeOneOf = function (elem, nodeTypeArray) {
|
|
344
|
-
if (nodeTypeArray.indexOf(elem[0].nodeName) !== -1) {
|
|
345
|
-
return true;
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
/**
|
|
349
|
-
* @ngdoc provider
|
|
350
|
-
* @name $ariaProvider
|
|
351
|
-
*
|
|
352
|
-
*
|
|
353
|
-
* @description
|
|
354
|
-
*
|
|
355
|
-
* Used for configuring the ARIA attributes injected and managed by ngAria.
|
|
356
|
-
*
|
|
357
|
-
* ```js
|
|
358
|
-
* angular.module('myApp', ['ngAria'], function config($ariaProvider) {
|
|
359
|
-
* $ariaProvider.config({
|
|
360
|
-
* ariaValue: true,
|
|
361
|
-
* tabindex: false
|
|
362
|
-
* });
|
|
363
|
-
* });
|
|
364
|
-
*```
|
|
365
|
-
*
|
|
366
|
-
* ## Dependencies
|
|
367
|
-
* Requires the {@link ngAria} module to be installed.
|
|
368
|
-
*
|
|
369
|
-
*/
|
|
370
|
-
function $AriaProvider() {
|
|
371
|
-
let config = {
|
|
372
|
-
ariaHidden: true,
|
|
373
|
-
ariaChecked: true,
|
|
374
|
-
ariaReadonly: true,
|
|
375
|
-
ariaDisabled: true,
|
|
376
|
-
ariaRequired: true,
|
|
377
|
-
ariaInvalid: true,
|
|
378
|
-
ariaValue: true,
|
|
379
|
-
tabindex: true,
|
|
380
|
-
bindKeydown: true,
|
|
381
|
-
bindRoleForClick: true,
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
this.config = function (newConfig) {
|
|
385
|
-
config = extend(config, newConfig);
|
|
386
|
-
};
|
|
387
|
-
|
|
388
|
-
function watchExpr(attrName, ariaAttr, nativeAriaNodeNames, negate) {
|
|
389
|
-
return function (scope, elem, attr) {
|
|
390
|
-
if (Object.prototype.hasOwnProperty.call(attr, ARIA_DISABLE_ATTR)) return;
|
|
391
|
-
|
|
392
|
-
const ariaCamelName = attr.$normalize(ariaAttr);
|
|
393
|
-
if (
|
|
394
|
-
config[ariaCamelName] &&
|
|
395
|
-
!isNodeOneOf(elem, nativeAriaNodeNames) &&
|
|
396
|
-
!attr[ariaCamelName]
|
|
397
|
-
) {
|
|
398
|
-
scope.$watch(attr[attrName], (boolVal) => {
|
|
399
|
-
// ensure boolean value
|
|
400
|
-
boolVal = negate ? !boolVal : !!boolVal;
|
|
401
|
-
elem.attr(ariaAttr, boolVal);
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
};
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
this.$get = function () {
|
|
408
|
-
return {
|
|
409
|
-
config(key) {
|
|
410
|
-
return config[key];
|
|
411
|
-
},
|
|
412
|
-
$$watchExpr: watchExpr,
|
|
413
|
-
};
|
|
414
|
-
};
|
|
415
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function initAriaModule(angular: any): void;
|
|
File without changes
|