@angular-wave/angular.ts 0.0.68 → 0.0.70
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/animate-swap.js +1 -1
- package/src/core/animate/animate.js +5 -5
- package/src/core/compile/compile.js +0 -1
- package/src/core/compile/compile.spec.js +4 -4
- package/src/core/controller/controller.js +5 -1
- package/src/core/cookie-reader.spec.js +1 -1
- package/src/core/di/injector.js +1 -1
- package/src/core/di/injector.spec.js +35 -35
- package/src/core/di/internal-injector.js +1 -1
- package/src/core/filter/filter.spec.js +15 -15
- package/src/core/interpolate/interpolate.spec.js +29 -29
- package/src/core/interval/interval.spec.js +1 -1
- package/src/core/location/location.spec.js +1 -1
- package/src/core/parser/lexer.spec.js +1 -1
- package/src/core/parser/parse.spec.js +1 -1
- package/src/core/q/q.js +1 -0
- package/src/core/q/q.spec.js +1 -1
- package/src/core/scope/scope.js +1 -2
- package/src/core/timeout/timeout.js +5 -21
- 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 +13 -13
- package/src/{exts → directive}/aria/aria.test.js +1 -1
- package/src/directive/attrs/boolean.spec.js +1 -1
- package/src/directive/bind/bind.js +2 -2
- package/src/directive/class/class.js +1 -1
- package/src/directive/form/form.js +1 -18
- package/src/directive/form/form.spec.js +2 -2
- package/src/directive/include/include.js +7 -0
- package/src/directive/input/input.js +1 -1
- package/src/{exts → directive}/messages/messages.html +4 -1
- package/src/directive/messages/messages.js +339 -0
- package/src/{exts → directive}/messages/messages.spec.js +7 -11
- package/src/{exts → directive}/messages/messages.test.js +1 -1
- package/src/directive/model-options/model-options.spec.js +1 -1
- package/src/directive/switch/switch.spec.js +1 -1
- package/src/filters/filter.js +2 -6
- package/src/filters/filter.spec.js +1 -1
- package/src/filters/filters.spec.js +1 -1
- package/src/filters/limit-to.js +0 -1
- package/src/filters/limit-to.spec.js +2 -2
- package/src/loader.js +1 -1
- package/src/loader.spec.js +1 -1
- package/src/public.js +39 -5
- package/src/router/common/glob.spec.js +1 -1
- package/src/router/params/param-factory.js +1 -1
- package/src/router/state/state-builder.spec.js +1 -1
- package/src/router/template-factory.js +6 -4
- package/src/router/view/view.spec.js +8 -11
- package/src/router/view-scroll.js +6 -1
- package/src/services/anchor-scroll.html +83 -0
- package/src/services/anchor-scroll.js +23 -6
- package/src/services/browser.js +1 -1
- package/src/services/http/http.spec.js +40 -40
- package/src/shared/jqlite/jqlite.js +3 -3
- package/src/shared/jqlite/jqlite.spec.js +4 -4
- package/src/shared/utils.js +1 -3
- package/types/core/q/q.d.ts +5 -0
- package/types/core/scope/scope.d.ts +2 -3
- package/types/core/timeout/timeout.d.ts +3 -7
- package/types/directive/aria/aria.d.ts +94 -0
- package/types/directive/form/form.d.ts +3 -20
- package/types/directive/include/include.d.ts +1 -1
- package/types/router/params/param-factory.d.ts +1 -1
- package/types/router/template-factory.d.ts +4 -4
- package/types/router/view-scroll.d.ts +1 -1
- package/types/services/anchor-scroll.d.ts +16 -1
- package/types/services/browser.d.ts +2 -2
- package/types/shared/utils.d.ts +0 -2
- package/src/exts/aria/aria.js +0 -415
- package/src/exts/messages/messages.js +0 -361
- package/types/exts/aria/aria.d.ts +0 -1
- package/types/exts/messages/messages.d.ts +0 -1
- /package/src/{exts → directive}/aria/aria.md +0 -0
- /package/src/{exts → directive}/messages/messages.md +0 -0
package/src/core/q/q.js
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
* @property {function(((reason: any) => (QPromise<never>|QPromise<T>|T))|null): QPromise<T>|T} catch - Shorthand for promise.then(null, errorCallback).
|
|
28
28
|
* @property {function(function(): void): QPromise<T>} finally - Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value.
|
|
29
29
|
* @property {number} [$$intervalId] - Internal id set by the $interval service for callback notifications
|
|
30
|
+
* @property {number} [$$timeoutId] - Timeout id set by the $timeout service for cancelations
|
|
30
31
|
*/
|
|
31
32
|
|
|
32
33
|
/**
|
package/src/core/q/q.spec.js
CHANGED
package/src/core/scope/scope.js
CHANGED
|
@@ -415,7 +415,7 @@ export class Scope {
|
|
|
415
415
|
|
|
416
416
|
lastDirtyWatch = null;
|
|
417
417
|
|
|
418
|
-
if (this.$$watchers.length
|
|
418
|
+
if (this.$$watchers.length === 0) {
|
|
419
419
|
this.$$digestWatchIndex = -1;
|
|
420
420
|
}
|
|
421
421
|
// we use unshift since we use a while loop in $digest for speed.
|
|
@@ -905,7 +905,6 @@ export class Scope {
|
|
|
905
905
|
}
|
|
906
906
|
|
|
907
907
|
/**
|
|
908
|
-
* @private
|
|
909
908
|
* @param {ScopePhase} phase
|
|
910
909
|
*/
|
|
911
910
|
beginPhase(phase) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { markQExceptionHandled } from "../q/q";
|
|
2
|
-
import { isDefined,
|
|
2
|
+
import { isDefined, minErr, sliceArgs } from "../../shared/utils";
|
|
3
3
|
|
|
4
4
|
const $timeoutMinErr = minErr("$timeout");
|
|
5
5
|
|
|
@@ -23,22 +23,16 @@ export function $TimeoutProvider() {
|
|
|
23
23
|
const deferreds = {};
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
* @name $timeout
|
|
28
|
-
*
|
|
29
|
-
* @description
|
|
26
|
+
|
|
30
27
|
* AngularJS's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch
|
|
31
28
|
* block and delegates any exceptions to
|
|
32
|
-
* {@link
|
|
29
|
+
* {@link $exceptionHandler} service.
|
|
33
30
|
*
|
|
34
31
|
* The return value of calling `$timeout` is a promise, which will be resolved when
|
|
35
32
|
* the delay has passed and the timeout function, if provided, is executed.
|
|
36
33
|
*
|
|
37
34
|
* To cancel a timeout request, call `$timeout.cancel(promise)`.
|
|
38
35
|
*
|
|
39
|
-
* In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to
|
|
40
|
-
* synchronously flush the queue of deferred functions.
|
|
41
|
-
*
|
|
42
36
|
* If you only want a promise that will be resolved after some specified delay
|
|
43
37
|
* then you can call `$timeout` without the `fn` function.
|
|
44
38
|
*
|
|
@@ -46,17 +40,11 @@ export function $TimeoutProvider() {
|
|
|
46
40
|
* @param {number=} [delay=0] Delay in milliseconds.
|
|
47
41
|
* @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
|
|
48
42
|
* will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
|
|
49
|
-
* @returns {
|
|
43
|
+
* @returns {import("../q/q").QPromise<any>} Promise that will be resolved when the timeout is reached. The promise
|
|
50
44
|
* will be resolved with the return value of the `fn` function.
|
|
51
45
|
*
|
|
52
46
|
*/
|
|
53
47
|
function timeout(fn, delay, invokeApply = true) {
|
|
54
|
-
if (!isFunction(fn)) {
|
|
55
|
-
invokeApply = delay;
|
|
56
|
-
delay = fn;
|
|
57
|
-
fn = () => {};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
48
|
const args = sliceArgs(arguments, 3);
|
|
61
49
|
const skipApply = isDefined(invokeApply) && !invokeApply;
|
|
62
50
|
const deferred = (skipApply ? $$q : $q).defer();
|
|
@@ -87,14 +75,10 @@ export function $TimeoutProvider() {
|
|
|
87
75
|
}
|
|
88
76
|
|
|
89
77
|
/**
|
|
90
|
-
* @ngdoc method
|
|
91
|
-
* @name $timeout#cancel
|
|
92
|
-
*
|
|
93
|
-
* @description
|
|
94
78
|
* Cancels a task associated with the `promise`. As a result of this, the promise will be
|
|
95
79
|
* resolved with a rejection.
|
|
96
80
|
*
|
|
97
|
-
* @param {
|
|
81
|
+
* @param {import("../q/q").QPromise<any>} promise Promise returned by the `$timeout` function.
|
|
98
82
|
* @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
|
|
99
83
|
* canceled.
|
|
100
84
|
*/
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
|
|
11
11
|
<script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
|
|
12
12
|
<script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
|
|
13
|
-
<script type="module" src="/src/
|
|
13
|
+
<script type="module" src="/src/directive/aria/aria.spec.js"></script>
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="dummy"></div>
|
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
import { extend } from "../../shared/utils";
|
|
2
|
+
|
|
3
|
+
const ARIA_DISABLE_ATTR = "ngAriaDisable";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Internal Utilities
|
|
7
|
+
*/
|
|
8
|
+
const nativeAriaNodeNames = [
|
|
9
|
+
"BUTTON",
|
|
10
|
+
"A",
|
|
11
|
+
"INPUT",
|
|
12
|
+
"TEXTAREA",
|
|
13
|
+
"SELECT",
|
|
14
|
+
"DETAILS",
|
|
15
|
+
"SUMMARY",
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
const isNodeOneOf = function (elem, nodeTypeArray) {
|
|
19
|
+
if (nodeTypeArray.indexOf(elem[0].nodeName) !== -1) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @ngdoc provider
|
|
25
|
+
* @name $ariaProvider
|
|
26
|
+
*
|
|
27
|
+
*
|
|
28
|
+
* @description
|
|
29
|
+
*
|
|
30
|
+
* Used for configuring the ARIA attributes injected and managed by ngAria.
|
|
31
|
+
*
|
|
32
|
+
* ```js
|
|
33
|
+
* angular.module('myApp', ['ngAria'], function config($ariaProvider) {
|
|
34
|
+
* $ariaProvider.config({
|
|
35
|
+
* ariaValue: true,
|
|
36
|
+
* tabindex: false
|
|
37
|
+
* });
|
|
38
|
+
* });
|
|
39
|
+
*```
|
|
40
|
+
*
|
|
41
|
+
* ## Dependencies
|
|
42
|
+
* Requires the {@link ngAria} module to be installed.
|
|
43
|
+
*
|
|
44
|
+
*/
|
|
45
|
+
export function AriaProvider() {
|
|
46
|
+
let config = {
|
|
47
|
+
ariaHidden: true,
|
|
48
|
+
ariaChecked: true,
|
|
49
|
+
ariaReadonly: true,
|
|
50
|
+
ariaDisabled: true,
|
|
51
|
+
ariaRequired: true,
|
|
52
|
+
ariaInvalid: true,
|
|
53
|
+
ariaValue: true,
|
|
54
|
+
tabindex: true,
|
|
55
|
+
bindKeydown: true,
|
|
56
|
+
bindRoleForClick: true,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
this.config = function (newConfig) {
|
|
60
|
+
config = extend(config, newConfig);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
function watchExpr(attrName, ariaAttr, nativeAriaNodeNames, negate) {
|
|
64
|
+
return function (scope, elem, attr) {
|
|
65
|
+
if (Object.prototype.hasOwnProperty.call(attr, ARIA_DISABLE_ATTR)) return;
|
|
66
|
+
|
|
67
|
+
const ariaCamelName = attr.$normalize(ariaAttr);
|
|
68
|
+
if (
|
|
69
|
+
config[ariaCamelName] &&
|
|
70
|
+
!isNodeOneOf(elem, nativeAriaNodeNames) &&
|
|
71
|
+
!attr[ariaCamelName]
|
|
72
|
+
) {
|
|
73
|
+
scope.$watch(attr[attrName], (boolVal) => {
|
|
74
|
+
// ensure boolean value
|
|
75
|
+
boolVal = negate ? !boolVal : !!boolVal;
|
|
76
|
+
elem.attr(ariaAttr, boolVal);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
this.$get = function () {
|
|
83
|
+
return {
|
|
84
|
+
config(key) {
|
|
85
|
+
return config[key];
|
|
86
|
+
},
|
|
87
|
+
$$watchExpr: watchExpr,
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
ngDisabledAriaDirective.$inject = ["$aria"];
|
|
93
|
+
export function ngDisabledAriaDirective($aria) {
|
|
94
|
+
return $aria.$$watchExpr(
|
|
95
|
+
"ngDisabled",
|
|
96
|
+
"aria-disabled",
|
|
97
|
+
nativeAriaNodeNames,
|
|
98
|
+
false,
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
ngShowAriaDirective.$inject = ["$aria"];
|
|
103
|
+
export function ngShowAriaDirective($aria) {
|
|
104
|
+
return $aria.$$watchExpr("ngShow", "aria-hidden", [], true);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function ngMessagesAriaDirective() {
|
|
108
|
+
return {
|
|
109
|
+
restrict: "A",
|
|
110
|
+
require: "?ngMessages",
|
|
111
|
+
link(_scope, elem, attr) {
|
|
112
|
+
if (Object.prototype.hasOwnProperty.call(attr, ARIA_DISABLE_ATTR)) return;
|
|
113
|
+
|
|
114
|
+
if (!elem.attr("aria-live")) {
|
|
115
|
+
elem.attr("aria-live", "assertive");
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
ngClickAriaDirective.$inject = ["$aria", "$parse"];
|
|
122
|
+
export function ngClickAriaDirective($aria, $parse) {
|
|
123
|
+
return {
|
|
124
|
+
restrict: "A",
|
|
125
|
+
compile(elem, attr) {
|
|
126
|
+
if (Object.prototype.hasOwnProperty.call(attr, ARIA_DISABLE_ATTR)) return;
|
|
127
|
+
|
|
128
|
+
const fn = $parse(attr.ngClick);
|
|
129
|
+
return function (scope, elem, attr) {
|
|
130
|
+
if (!isNodeOneOf(elem, nativeAriaNodeNames)) {
|
|
131
|
+
if ($aria.config("bindRoleForClick") && !elem.attr("role")) {
|
|
132
|
+
elem.attr("role", "button");
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if ($aria.config("tabindex") && !elem.attr("tabindex")) {
|
|
136
|
+
elem.attr("tabindex", 0);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (
|
|
140
|
+
$aria.config("bindKeydown") &&
|
|
141
|
+
!attr.ngKeydown &&
|
|
142
|
+
!attr.ngKeypress &&
|
|
143
|
+
!attr.ngKeyup
|
|
144
|
+
) {
|
|
145
|
+
elem.on("keydown", (event) => {
|
|
146
|
+
const keyCode = event.which || event.keyCode;
|
|
147
|
+
|
|
148
|
+
if (keyCode === 13 || keyCode === 32) {
|
|
149
|
+
// If the event is triggered on a non-interactive element ...
|
|
150
|
+
if (
|
|
151
|
+
nativeAriaNodeNames.indexOf(event.target.nodeName) === -1 &&
|
|
152
|
+
!event.target.isContentEditable
|
|
153
|
+
) {
|
|
154
|
+
// ... prevent the default browser behavior (e.g. scrolling when pressing spacebar)
|
|
155
|
+
// See https://github.com/angular/angular.js/issues/16664
|
|
156
|
+
event.preventDefault();
|
|
157
|
+
}
|
|
158
|
+
scope.$apply(callback);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function callback() {
|
|
162
|
+
fn(scope, { $event: event });
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
ngRequiredAriaDirective.$inject = ["$aria"];
|
|
173
|
+
export function ngRequiredAriaDirective($aria) {
|
|
174
|
+
return $aria.$$watchExpr(
|
|
175
|
+
"ngRequired",
|
|
176
|
+
"aria-required",
|
|
177
|
+
nativeAriaNodeNames,
|
|
178
|
+
false,
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
ngCheckedAriaDirective.$inject = ["$aria"];
|
|
183
|
+
export function ngCheckedAriaDirective($aria) {
|
|
184
|
+
return $aria.$$watchExpr(
|
|
185
|
+
"ngChecked",
|
|
186
|
+
"aria-checked",
|
|
187
|
+
nativeAriaNodeNames,
|
|
188
|
+
false,
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
ngValueAriaDirective.$inject = ["$aria"];
|
|
193
|
+
export function ngValueAriaDirective($aria) {
|
|
194
|
+
return $aria.$$watchExpr(
|
|
195
|
+
"ngValue",
|
|
196
|
+
"aria-checked",
|
|
197
|
+
nativeAriaNodeNames,
|
|
198
|
+
false,
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
ngHideAriaDirective.$inject = ["$aria"];
|
|
203
|
+
export function ngHideAriaDirective($aria) {
|
|
204
|
+
return $aria.$$watchExpr("ngHide", "aria-hidden", [], false);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
ngReadonlyAriaDirective.$inject = ["$aria"];
|
|
208
|
+
export function ngReadonlyAriaDirective($aria) {
|
|
209
|
+
return $aria.$$watchExpr(
|
|
210
|
+
"ngReadonly",
|
|
211
|
+
"aria-readonly",
|
|
212
|
+
nativeAriaNodeNames,
|
|
213
|
+
false,
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
ngModelAriaDirective.$inject = ["$aria"];
|
|
218
|
+
export function ngModelAriaDirective($aria) {
|
|
219
|
+
function shouldAttachAttr(attr, normalizedAttr, elem, allowNonAriaNodes) {
|
|
220
|
+
return (
|
|
221
|
+
$aria.config(normalizedAttr) &&
|
|
222
|
+
!elem.attr(attr) &&
|
|
223
|
+
(allowNonAriaNodes || !isNodeOneOf(elem, nativeAriaNodeNames)) &&
|
|
224
|
+
(elem.attr("type") !== "hidden" || elem[0].nodeName !== "INPUT")
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
function shouldAttachRole(role, elem) {
|
|
229
|
+
// if element does not have role attribute
|
|
230
|
+
// AND element type is equal to role (if custom element has a type equaling shape) <-- remove?
|
|
231
|
+
// AND element is not in nativeAriaNodeNames
|
|
232
|
+
return (
|
|
233
|
+
!elem.attr("role") &&
|
|
234
|
+
elem.attr("type") === role &&
|
|
235
|
+
!isNodeOneOf(elem, nativeAriaNodeNames)
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function getShape(attr) {
|
|
240
|
+
const { type } = attr;
|
|
241
|
+
const { role } = attr;
|
|
242
|
+
|
|
243
|
+
return (type || role) === "checkbox" || role === "menuitemcheckbox"
|
|
244
|
+
? "checkbox"
|
|
245
|
+
: (type || role) === "radio" || role === "menuitemradio"
|
|
246
|
+
? "radio"
|
|
247
|
+
: type === "range" || role === "progressbar" || role === "slider"
|
|
248
|
+
? "range"
|
|
249
|
+
: "";
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
return {
|
|
253
|
+
restrict: "A",
|
|
254
|
+
require: "ngModel",
|
|
255
|
+
priority: 200, // Make sure watches are fired after any other directives that affect the ngModel value
|
|
256
|
+
compile(elem, attr) {
|
|
257
|
+
if (Object.prototype.hasOwnProperty.call(attr, ARIA_DISABLE_ATTR)) return;
|
|
258
|
+
|
|
259
|
+
const shape = getShape(attr);
|
|
260
|
+
|
|
261
|
+
return {
|
|
262
|
+
post(scope, elem, attr, ngModel) {
|
|
263
|
+
const needsTabIndex = shouldAttachAttr(
|
|
264
|
+
"tabindex",
|
|
265
|
+
"tabindex",
|
|
266
|
+
elem,
|
|
267
|
+
false,
|
|
268
|
+
);
|
|
269
|
+
|
|
270
|
+
function ngAriaWatchModelValue() {
|
|
271
|
+
return ngModel.$modelValue;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
function getRadioReaction() {
|
|
275
|
+
// Strict comparison would cause a BC
|
|
276
|
+
elem[0].setAttribute(
|
|
277
|
+
"aria-checked",
|
|
278
|
+
(attr.value == ngModel.$viewValue).toString(),
|
|
279
|
+
);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function getCheckboxReaction() {
|
|
283
|
+
elem.attr(
|
|
284
|
+
"aria-checked",
|
|
285
|
+
(!ngModel.$isEmpty(ngModel.$viewValue)).toString(),
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
switch (shape) {
|
|
290
|
+
case "radio":
|
|
291
|
+
case "checkbox":
|
|
292
|
+
if (shouldAttachRole(shape, elem)) {
|
|
293
|
+
elem.attr("role", shape);
|
|
294
|
+
}
|
|
295
|
+
if (
|
|
296
|
+
shouldAttachAttr("aria-checked", "ariaChecked", elem, false)
|
|
297
|
+
) {
|
|
298
|
+
scope.$watch(
|
|
299
|
+
ngAriaWatchModelValue,
|
|
300
|
+
shape === "radio" ? getRadioReaction : getCheckboxReaction,
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
if (needsTabIndex) {
|
|
304
|
+
elem.attr("tabindex", 0);
|
|
305
|
+
}
|
|
306
|
+
break;
|
|
307
|
+
case "range":
|
|
308
|
+
if (shouldAttachRole(shape, elem)) {
|
|
309
|
+
elem.attr("role", "slider");
|
|
310
|
+
}
|
|
311
|
+
if ($aria.config("ariaValue")) {
|
|
312
|
+
const needsAriaValuemin =
|
|
313
|
+
!elem.attr("aria-valuemin") &&
|
|
314
|
+
(Object.prototype.hasOwnProperty.call(attr, "min") ||
|
|
315
|
+
Object.prototype.hasOwnProperty.call(attr, "ngMin"));
|
|
316
|
+
const needsAriaValuemax =
|
|
317
|
+
!elem.attr("aria-valuemax") &&
|
|
318
|
+
(Object.prototype.hasOwnProperty.call(attr, "max") ||
|
|
319
|
+
Object.prototype.hasOwnProperty.call(attr, "ngMax"));
|
|
320
|
+
const needsAriaValuenow = !elem.attr("aria-valuenow");
|
|
321
|
+
|
|
322
|
+
if (needsAriaValuemin) {
|
|
323
|
+
attr.$observe("min", (newVal) => {
|
|
324
|
+
elem.attr("aria-valuemin", newVal);
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
if (needsAriaValuemax) {
|
|
328
|
+
attr.$observe("max", (newVal) => {
|
|
329
|
+
elem.attr("aria-valuemax", newVal);
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
if (needsAriaValuenow) {
|
|
333
|
+
scope.$watch(ngAriaWatchModelValue, (newVal) => {
|
|
334
|
+
elem.attr("aria-valuenow", newVal);
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
if (needsTabIndex) {
|
|
339
|
+
elem.attr("tabindex", 0);
|
|
340
|
+
}
|
|
341
|
+
break;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (
|
|
345
|
+
!Object.prototype.hasOwnProperty.call(attr, "ngRequired") &&
|
|
346
|
+
ngModel.$validators.required &&
|
|
347
|
+
shouldAttachAttr("aria-required", "ariaRequired", elem, false)
|
|
348
|
+
) {
|
|
349
|
+
// ngModel.$error.required is undefined on custom controls
|
|
350
|
+
attr.$observe("required", () => {
|
|
351
|
+
elem.attr("aria-required", (!!attr.required).toString());
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
if (shouldAttachAttr("aria-invalid", "ariaInvalid", elem, true)) {
|
|
356
|
+
scope.$watch(
|
|
357
|
+
() => ngModel.$invalid,
|
|
358
|
+
(newVal) => {
|
|
359
|
+
elem.attr("aria-invalid", (!!newVal).toString());
|
|
360
|
+
},
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
},
|
|
364
|
+
};
|
|
365
|
+
},
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
ngDblclickAriaDirective.$inject = ["$aria"];
|
|
370
|
+
export function ngDblclickAriaDirective($aria) {
|
|
371
|
+
return function (scope, elem, attr) {
|
|
372
|
+
if (Object.prototype.hasOwnProperty.call(attr, ARIA_DISABLE_ATTR)) return;
|
|
373
|
+
|
|
374
|
+
if (
|
|
375
|
+
$aria.config("tabindex") &&
|
|
376
|
+
!elem.attr("tabindex") &&
|
|
377
|
+
!isNodeOneOf(elem, nativeAriaNodeNames)
|
|
378
|
+
) {
|
|
379
|
+
elem.attr("tabindex", 0);
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createInjector } from "../../core/di/injector";
|
|
2
2
|
import { Angular } from "../../loader";
|
|
3
|
-
import { dealoc
|
|
3
|
+
import { dealoc } from "../../shared/jqlite/jqlite";
|
|
4
4
|
|
|
5
5
|
describe("$aria", () => {
|
|
6
6
|
let scope;
|
|
@@ -9,7 +9,7 @@ describe("$aria", () => {
|
|
|
9
9
|
|
|
10
10
|
beforeEach(() => {
|
|
11
11
|
window.angular = new Angular();
|
|
12
|
-
window.angular.module("test", ["
|
|
12
|
+
window.angular.module("test", ["ng"]);
|
|
13
13
|
let injector = createInjector(["test"]);
|
|
14
14
|
scope = injector.get("$rootScope");
|
|
15
15
|
$compile = injector.get("$compile");
|
|
@@ -340,7 +340,7 @@ describe("$aria", () => {
|
|
|
340
340
|
describe("aria-hidden when disabled", () => {
|
|
341
341
|
beforeEach(() => {
|
|
342
342
|
window.angular.module("test", [
|
|
343
|
-
"
|
|
343
|
+
"ng",
|
|
344
344
|
($ariaProvider) => {
|
|
345
345
|
$ariaProvider.config({
|
|
346
346
|
ariaHidden: false,
|
|
@@ -611,7 +611,7 @@ describe("$aria", () => {
|
|
|
611
611
|
describe("aria-checked when disabled", () => {
|
|
612
612
|
beforeEach(() => {
|
|
613
613
|
window.angular.module("test", [
|
|
614
|
-
"
|
|
614
|
+
"ng",
|
|
615
615
|
($ariaProvider) => {
|
|
616
616
|
$ariaProvider.config({
|
|
617
617
|
ariaChecked: false,
|
|
@@ -701,7 +701,7 @@ describe("$aria", () => {
|
|
|
701
701
|
describe("aria-disabled when disabled", () => {
|
|
702
702
|
beforeEach(() => {
|
|
703
703
|
window.angular.module("test", [
|
|
704
|
-
"
|
|
704
|
+
"ng",
|
|
705
705
|
($ariaProvider) => {
|
|
706
706
|
$ariaProvider.config({
|
|
707
707
|
ariaDisabled: false,
|
|
@@ -772,7 +772,7 @@ describe("$aria", () => {
|
|
|
772
772
|
describe("aria-invalid when disabled", () => {
|
|
773
773
|
beforeEach(() => {
|
|
774
774
|
window.angular.module("test", [
|
|
775
|
-
"
|
|
775
|
+
"ng",
|
|
776
776
|
($ariaProvider) => {
|
|
777
777
|
$ariaProvider.config({
|
|
778
778
|
ariaInvalid: false,
|
|
@@ -843,7 +843,7 @@ describe("$aria", () => {
|
|
|
843
843
|
describe("aria-readonly when disabled", () => {
|
|
844
844
|
beforeEach(() => {
|
|
845
845
|
window.angular.module("test", [
|
|
846
|
-
"
|
|
846
|
+
"ng",
|
|
847
847
|
($ariaProvider) => {
|
|
848
848
|
$ariaProvider.config({
|
|
849
849
|
ariaReadonly: false,
|
|
@@ -908,7 +908,7 @@ describe("$aria", () => {
|
|
|
908
908
|
describe("aria-required when disabled", () => {
|
|
909
909
|
beforeEach(() => {
|
|
910
910
|
window.angular.module("test", [
|
|
911
|
-
"
|
|
911
|
+
"ng",
|
|
912
912
|
($ariaProvider) => {
|
|
913
913
|
$ariaProvider.config({
|
|
914
914
|
ariaRequired: false,
|
|
@@ -1019,7 +1019,7 @@ describe("$aria", () => {
|
|
|
1019
1019
|
describe("aria-value when disabled", () => {
|
|
1020
1020
|
beforeEach(() => {
|
|
1021
1021
|
window.angular.module("test", [
|
|
1022
|
-
"
|
|
1022
|
+
"ng",
|
|
1023
1023
|
($ariaProvider) => {
|
|
1024
1024
|
$ariaProvider.config({
|
|
1025
1025
|
ariaValue: false,
|
|
@@ -1126,7 +1126,7 @@ describe("$aria", () => {
|
|
|
1126
1126
|
describe("actions when bindRoleForClick is set to false", () => {
|
|
1127
1127
|
beforeEach(() => {
|
|
1128
1128
|
window.angular.module("test", [
|
|
1129
|
-
"
|
|
1129
|
+
"ng",
|
|
1130
1130
|
($ariaProvider) => {
|
|
1131
1131
|
$ariaProvider.config({
|
|
1132
1132
|
bindRoleForClick: false,
|
|
@@ -1149,7 +1149,7 @@ describe("$aria", () => {
|
|
|
1149
1149
|
describe("actions when bindKeydown is set to false", () => {
|
|
1150
1150
|
beforeEach(() => {
|
|
1151
1151
|
window.angular.module("test", [
|
|
1152
|
-
"
|
|
1152
|
+
"ng",
|
|
1153
1153
|
($ariaProvider) => {
|
|
1154
1154
|
$ariaProvider.config({
|
|
1155
1155
|
bindKeydown: false,
|
|
@@ -1186,7 +1186,7 @@ describe("$aria", () => {
|
|
|
1186
1186
|
describe("tabindex when disabled", () => {
|
|
1187
1187
|
beforeEach(() => {
|
|
1188
1188
|
window.angular.module("test", [
|
|
1189
|
-
"
|
|
1189
|
+
"ng",
|
|
1190
1190
|
($ariaProvider) => {
|
|
1191
1191
|
$ariaProvider.config({
|
|
1192
1192
|
tabindex: false,
|
|
@@ -1216,7 +1216,7 @@ describe("$aria", () => {
|
|
|
1216
1216
|
describe("ngModel", () => {
|
|
1217
1217
|
it("should not break when manually compiling", () => {
|
|
1218
1218
|
window.angular.module("test", [
|
|
1219
|
-
"
|
|
1219
|
+
"ng",
|
|
1220
1220
|
($compileProvider) => {
|
|
1221
1221
|
$compileProvider.directive("foo", () => ({
|
|
1222
1222
|
priority: 10,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Angular } from "../../loader";
|
|
2
2
|
import { createInjector } from "../../core/di/injector";
|
|
3
|
-
import { dealoc
|
|
3
|
+
import { dealoc } from "../../shared/jqlite/jqlite";
|
|
4
4
|
|
|
5
5
|
describe("boolean attr directives", () => {
|
|
6
6
|
let element, $rootScope, $compile, $rootElement;
|
|
@@ -37,8 +37,8 @@ export const ngBindHtmlDirective = [
|
|
|
37
37
|
return {
|
|
38
38
|
restrict: "A",
|
|
39
39
|
compile: (_tElement, tAttrs) => {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const ngBindHtmlGetter = $parse(tAttrs.ngBindHtml);
|
|
41
|
+
const ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, (val) => val);
|
|
42
42
|
return (scope, element) => {
|
|
43
43
|
scope.$watch(ngBindHtmlWatch, () => {
|
|
44
44
|
// The watched value is the unwrapped value. To avoid re-escaping, use the direct getter.
|
|
@@ -153,12 +153,6 @@ FormController.prototype = {
|
|
|
153
153
|
},
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
|
-
* @ngdoc method
|
|
157
|
-
* @name form.FormController#$addControl
|
|
158
|
-
* @param {object} control control object, either a {@link form.FormController} or an
|
|
159
|
-
* {@link ngModel.NgModelController}
|
|
160
|
-
*
|
|
161
|
-
* @description
|
|
162
156
|
* Register a control with the form. Input elements using ngModelController do this automatically
|
|
163
157
|
* when they are linked.
|
|
164
158
|
*
|
|
@@ -187,11 +181,6 @@ FormController.prototype = {
|
|
|
187
181
|
},
|
|
188
182
|
|
|
189
183
|
/**
|
|
190
|
-
* @ngdoc method
|
|
191
|
-
* @name form.FormController#$getControls
|
|
192
|
-
* @returns {Array} the controls that are currently part of this form
|
|
193
|
-
*
|
|
194
|
-
* @description
|
|
195
184
|
* This method returns a **shallow copy** of the controls that are currently part of this form.
|
|
196
185
|
* The controls can be instances of {@link form.FormController `FormController`}
|
|
197
186
|
* ({@link ngForm "child-forms"}) and of {@link ngModel.NgModelController `NgModelController`}.
|
|
@@ -222,12 +211,6 @@ FormController.prototype = {
|
|
|
222
211
|
},
|
|
223
212
|
|
|
224
213
|
/**
|
|
225
|
-
* @ngdoc method
|
|
226
|
-
* @name form.FormController#$removeControl
|
|
227
|
-
* @param {object} control control object, either a {@link form.FormController} or an
|
|
228
|
-
* {@link ngModel.NgModelController}
|
|
229
|
-
*
|
|
230
|
-
* @description
|
|
231
214
|
* Deregister a control from the form.
|
|
232
215
|
*
|
|
233
216
|
* Input elements using ngModelController do this automatically when they are destroyed.
|
|
@@ -382,7 +365,7 @@ FormController.prototype = {
|
|
|
382
365
|
* (undefined), or skipped (null). Pending is used for unfulfilled `$asyncValidators`.
|
|
383
366
|
* Skipped is used by AngularJS when validators do not run because of parse errors and when
|
|
384
367
|
* `$asyncValidators` do not run because any of the `$validators` failed.
|
|
385
|
-
* @param {NgModelController | FormController} controller - The controller whose validity state is
|
|
368
|
+
* @param {import("../model/model").NgModelController | FormController} controller - The controller whose validity state is
|
|
386
369
|
* triggering the change.
|
|
387
370
|
*/
|
|
388
371
|
addSetValidityMethod({
|