@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Angular } from "../../loader";
|
|
2
2
|
import { createInjector } from "../../core/di/injector";
|
|
3
3
|
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
|
|
4
|
-
import { FormController } from "
|
|
4
|
+
import { FormController } from "./form";
|
|
5
5
|
|
|
6
6
|
describe("form", () => {
|
|
7
7
|
let doc;
|
|
@@ -679,7 +679,7 @@ describe("form", () => {
|
|
|
679
679
|
$compile(doc)(scope);
|
|
680
680
|
scope.$apply();
|
|
681
681
|
|
|
682
|
-
|
|
682
|
+
const parent = scope.parent,
|
|
683
683
|
child = scope.child;
|
|
684
684
|
|
|
685
685
|
expect(parent).toBeDefined();
|
|
@@ -7,6 +7,13 @@ export const ngIncludeDirective = [
|
|
|
7
7
|
"$templateRequest",
|
|
8
8
|
"$anchorScroll",
|
|
9
9
|
"$animate",
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {*} $templateRequest
|
|
13
|
+
* @param {import("../../services/anchor-scroll").AnchorScrollFunction} $anchorScroll
|
|
14
|
+
* @param {*} $animate
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
10
17
|
($templateRequest, $anchorScroll, $animate) => ({
|
|
11
18
|
restrict: "ECA",
|
|
12
19
|
priority: 400,
|
|
@@ -203,7 +203,7 @@ export function weekParser(isoWeek, existingDate) {
|
|
|
203
203
|
|
|
204
204
|
function getFirstThursdayOfYear(year) {
|
|
205
205
|
// 0 = index of January
|
|
206
|
-
|
|
206
|
+
const dayOfWeekOnFirst = new Date(year, 0, 1).getDay();
|
|
207
207
|
// 4 = index of Thursday (+1 to account for 1st = 5)
|
|
208
208
|
// 11 = index of *next* Thursday (+1 account for 1st = 12)
|
|
209
209
|
return new Date(
|
|
@@ -10,7 +10,10 @@
|
|
|
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
|
|
13
|
+
<script
|
|
14
|
+
type="module"
|
|
15
|
+
src="/src/directive/messages/messages.spec.js"
|
|
16
|
+
></script>
|
|
14
17
|
</head>
|
|
15
18
|
<body>
|
|
16
19
|
<div id="dummy"></div>
|
|
@@ -0,0 +1,339 @@
|
|
|
1
|
+
import { forEach, isString } from "../../shared/utils";
|
|
2
|
+
|
|
3
|
+
ngMessagesDirective.$inject = ["$animate"];
|
|
4
|
+
export function ngMessagesDirective($animate) {
|
|
5
|
+
const ACTIVE_CLASS = "ng-active";
|
|
6
|
+
const INACTIVE_CLASS = "ng-inactive";
|
|
7
|
+
return {
|
|
8
|
+
require: "ngMessages",
|
|
9
|
+
restrict: "AE",
|
|
10
|
+
controller: function ($element, $scope, $attrs) {
|
|
11
|
+
const ctrl = this;
|
|
12
|
+
let latestKey = 0;
|
|
13
|
+
let nextAttachId = 0;
|
|
14
|
+
this.head = undefined;
|
|
15
|
+
this.default = undefined;
|
|
16
|
+
|
|
17
|
+
this.getAttachId = function getAttachId() {
|
|
18
|
+
return nextAttachId++;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const messages = (this.messages = {});
|
|
22
|
+
let renderLater;
|
|
23
|
+
let cachedCollection;
|
|
24
|
+
|
|
25
|
+
this.render = function (collection) {
|
|
26
|
+
collection = collection || {};
|
|
27
|
+
|
|
28
|
+
renderLater = false;
|
|
29
|
+
cachedCollection = collection;
|
|
30
|
+
|
|
31
|
+
// this is true if the attribute is empty or if the attribute value is truthy
|
|
32
|
+
const multiple =
|
|
33
|
+
isAttrTruthy($scope, $attrs.ngMessagesMultiple) ||
|
|
34
|
+
isAttrTruthy($scope, $attrs.multiple);
|
|
35
|
+
|
|
36
|
+
const unmatchedMessages = [];
|
|
37
|
+
const matchedKeys = {};
|
|
38
|
+
let truthyKeys = 0;
|
|
39
|
+
let messageItem = ctrl.head;
|
|
40
|
+
let messageFound = false;
|
|
41
|
+
let totalMessages = 0;
|
|
42
|
+
|
|
43
|
+
// we use != instead of !== to allow for both undefined and null values
|
|
44
|
+
while (messageItem != null) {
|
|
45
|
+
totalMessages++;
|
|
46
|
+
const messageCtrl = messageItem.message;
|
|
47
|
+
|
|
48
|
+
let messageUsed = false;
|
|
49
|
+
if (!messageFound) {
|
|
50
|
+
forEach(collection, (value, key) => {
|
|
51
|
+
if (truthy(value) && !messageUsed) {
|
|
52
|
+
truthyKeys++;
|
|
53
|
+
|
|
54
|
+
if (messageCtrl.test(key)) {
|
|
55
|
+
// this is to prevent the same error name from showing up twice
|
|
56
|
+
if (matchedKeys[key]) return;
|
|
57
|
+
matchedKeys[key] = true;
|
|
58
|
+
|
|
59
|
+
messageUsed = true;
|
|
60
|
+
messageCtrl.attach();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (messageUsed) {
|
|
67
|
+
// unless we want to display multiple messages then we should
|
|
68
|
+
// set a flag here to avoid displaying the next message in the list
|
|
69
|
+
messageFound = !multiple;
|
|
70
|
+
} else {
|
|
71
|
+
unmatchedMessages.push(messageCtrl);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
messageItem = messageItem.next;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
forEach(unmatchedMessages, (messageCtrl) => {
|
|
78
|
+
messageCtrl.detach();
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
const messageMatched = unmatchedMessages.length !== totalMessages;
|
|
82
|
+
const attachDefault = ctrl.default && !messageMatched && truthyKeys > 0;
|
|
83
|
+
|
|
84
|
+
if (attachDefault) {
|
|
85
|
+
ctrl.default.attach();
|
|
86
|
+
} else if (ctrl.default) {
|
|
87
|
+
ctrl.default.detach();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (messageMatched || attachDefault) {
|
|
91
|
+
$animate.setClass($element, ACTIVE_CLASS, INACTIVE_CLASS);
|
|
92
|
+
} else {
|
|
93
|
+
$animate.setClass($element, INACTIVE_CLASS, ACTIVE_CLASS);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
$scope.$watchCollection($attrs.ngMessages || $attrs.for, ctrl.render);
|
|
98
|
+
|
|
99
|
+
this.reRender = function () {
|
|
100
|
+
if (!renderLater) {
|
|
101
|
+
renderLater = true;
|
|
102
|
+
$scope.$evalAsync(() => {
|
|
103
|
+
if (renderLater && cachedCollection) {
|
|
104
|
+
ctrl.render(cachedCollection);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
this.register = function (comment, messageCtrl, isDefault) {
|
|
111
|
+
if (isDefault) {
|
|
112
|
+
ctrl.default = messageCtrl;
|
|
113
|
+
} else {
|
|
114
|
+
const nextKey = latestKey.toString();
|
|
115
|
+
messages[nextKey] = {
|
|
116
|
+
message: messageCtrl,
|
|
117
|
+
};
|
|
118
|
+
insertMessageNode($element[0], comment, nextKey);
|
|
119
|
+
comment.$$ngMessageNode = nextKey;
|
|
120
|
+
latestKey++;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
ctrl.reRender();
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
this.deregister = function (comment, isDefault) {
|
|
127
|
+
if (isDefault) {
|
|
128
|
+
delete ctrl.default;
|
|
129
|
+
} else {
|
|
130
|
+
const key = comment.$$ngMessageNode;
|
|
131
|
+
delete comment.$$ngMessageNode;
|
|
132
|
+
removeMessageNode($element[0], comment, key);
|
|
133
|
+
delete messages[key];
|
|
134
|
+
}
|
|
135
|
+
ctrl.reRender();
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
function findPreviousMessage(parent, comment) {
|
|
139
|
+
let prevNode = comment;
|
|
140
|
+
const parentLookup = [];
|
|
141
|
+
|
|
142
|
+
while (prevNode && prevNode !== parent) {
|
|
143
|
+
const prevKey = prevNode.$$ngMessageNode;
|
|
144
|
+
if (prevKey && prevKey.length) {
|
|
145
|
+
return messages[prevKey];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// dive deeper into the DOM and examine its children for any ngMessage
|
|
149
|
+
// comments that may be in an element that appears deeper in the list
|
|
150
|
+
if (
|
|
151
|
+
prevNode.childNodes.length &&
|
|
152
|
+
parentLookup.indexOf(prevNode) === -1
|
|
153
|
+
) {
|
|
154
|
+
parentLookup.push(prevNode);
|
|
155
|
+
prevNode = prevNode.childNodes[prevNode.childNodes.length - 1];
|
|
156
|
+
} else if (prevNode.previousSibling) {
|
|
157
|
+
prevNode = prevNode.previousSibling;
|
|
158
|
+
} else {
|
|
159
|
+
prevNode = prevNode.parentNode;
|
|
160
|
+
parentLookup.push(prevNode);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function insertMessageNode(parent, comment, key) {
|
|
166
|
+
const messageNode = messages[key];
|
|
167
|
+
if (!ctrl.head) {
|
|
168
|
+
ctrl.head = messageNode;
|
|
169
|
+
} else {
|
|
170
|
+
const match = findPreviousMessage(parent, comment);
|
|
171
|
+
if (match) {
|
|
172
|
+
messageNode.next = match.next;
|
|
173
|
+
match.next = messageNode;
|
|
174
|
+
} else {
|
|
175
|
+
messageNode.next = ctrl.head;
|
|
176
|
+
ctrl.head = messageNode;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
function removeMessageNode(parent, comment, key) {
|
|
182
|
+
const messageNode = messages[key];
|
|
183
|
+
|
|
184
|
+
// This message node may have already been removed by a call to deregister()
|
|
185
|
+
if (!messageNode) return;
|
|
186
|
+
|
|
187
|
+
const match = findPreviousMessage(parent, comment);
|
|
188
|
+
if (match) {
|
|
189
|
+
match.next = messageNode.next;
|
|
190
|
+
} else {
|
|
191
|
+
ctrl.head = messageNode.next;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function isAttrTruthy(scope, attr) {
|
|
199
|
+
return (
|
|
200
|
+
(isString(attr) && attr.length === 0) || // empty attribute
|
|
201
|
+
truthy(scope.$eval(attr))
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function truthy(val) {
|
|
206
|
+
return isString(val) ? val.length : !!val;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
ngMessagesIncludeDirective.$inject = ["$templateRequest", "$compile"];
|
|
210
|
+
export function ngMessagesIncludeDirective($templateRequest, $compile) {
|
|
211
|
+
return {
|
|
212
|
+
restrict: "AE",
|
|
213
|
+
require: "^^ngMessages", // we only require this for validation sake
|
|
214
|
+
link($scope, element, attrs) {
|
|
215
|
+
const src = attrs.ngMessagesInclude || attrs.src;
|
|
216
|
+
$templateRequest(src).then((html) => {
|
|
217
|
+
if ($scope.$$destroyed) return;
|
|
218
|
+
if (isString(html) && !html.trim()) {
|
|
219
|
+
// Empty template - nothing to compile
|
|
220
|
+
} else {
|
|
221
|
+
// Non-empty template - compile and link
|
|
222
|
+
$compile(html)($scope, (contents) => {
|
|
223
|
+
element.after(contents);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export const ngMessageDirective = ngMessageDirectiveFactory(false);
|
|
232
|
+
export const ngMessageExpDirective = ngMessageDirectiveFactory(false);
|
|
233
|
+
export const ngMessageDefaultDirective = ngMessageDirectiveFactory(true);
|
|
234
|
+
|
|
235
|
+
function ngMessageDirectiveFactory(isDefault) {
|
|
236
|
+
ngMessageDirective.$inject = ["$animate"];
|
|
237
|
+
function ngMessageDirective($animate) {
|
|
238
|
+
return {
|
|
239
|
+
restrict: "AE",
|
|
240
|
+
transclude: "element",
|
|
241
|
+
priority: 1, // must run before ngBind, otherwise the text is set on the comment
|
|
242
|
+
terminal: true,
|
|
243
|
+
require: "^^ngMessages",
|
|
244
|
+
link(scope, element, attrs, ngMessagesCtrl, $transclude) {
|
|
245
|
+
let commentNode;
|
|
246
|
+
let records;
|
|
247
|
+
let staticExp;
|
|
248
|
+
let dynamicExp;
|
|
249
|
+
|
|
250
|
+
if (!isDefault) {
|
|
251
|
+
commentNode = element[0];
|
|
252
|
+
staticExp = attrs.ngMessage || attrs.when;
|
|
253
|
+
dynamicExp = attrs.ngMessageExp || attrs.whenExp;
|
|
254
|
+
|
|
255
|
+
const assignRecords = function (items) {
|
|
256
|
+
records = items
|
|
257
|
+
? Array.isArray(items)
|
|
258
|
+
? items
|
|
259
|
+
: items.split(/[\s,]+/)
|
|
260
|
+
: null;
|
|
261
|
+
ngMessagesCtrl.reRender();
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
if (dynamicExp) {
|
|
265
|
+
assignRecords(scope.$eval(dynamicExp));
|
|
266
|
+
scope.$watchCollection(dynamicExp, assignRecords);
|
|
267
|
+
} else {
|
|
268
|
+
assignRecords(staticExp);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
let currentElement;
|
|
273
|
+
let messageCtrl;
|
|
274
|
+
ngMessagesCtrl.register(
|
|
275
|
+
commentNode,
|
|
276
|
+
(messageCtrl = {
|
|
277
|
+
test(name) {
|
|
278
|
+
return contains(records, name);
|
|
279
|
+
},
|
|
280
|
+
attach() {
|
|
281
|
+
if (!currentElement) {
|
|
282
|
+
$transclude((elm, newScope) => {
|
|
283
|
+
$animate.enter(elm, null, element);
|
|
284
|
+
currentElement = elm;
|
|
285
|
+
|
|
286
|
+
// Each time we attach this node to a message we get a new id that we can match
|
|
287
|
+
// when we are destroying the node later.
|
|
288
|
+
const $$attachId = (currentElement.$$attachId =
|
|
289
|
+
ngMessagesCtrl.getAttachId());
|
|
290
|
+
|
|
291
|
+
// in the event that the element or a parent element is destroyed
|
|
292
|
+
// by another structural directive then it's time
|
|
293
|
+
// to deregister the message from the controller
|
|
294
|
+
currentElement.on("$destroy", () => {
|
|
295
|
+
// If the message element was removed via a call to `detach` then `currentElement` will be null
|
|
296
|
+
// So this handler only handles cases where something else removed the message element.
|
|
297
|
+
if (
|
|
298
|
+
currentElement &&
|
|
299
|
+
currentElement.$$attachId === $$attachId
|
|
300
|
+
) {
|
|
301
|
+
ngMessagesCtrl.deregister(commentNode, isDefault);
|
|
302
|
+
messageCtrl.detach();
|
|
303
|
+
}
|
|
304
|
+
newScope.$destroy();
|
|
305
|
+
});
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
},
|
|
309
|
+
detach() {
|
|
310
|
+
if (currentElement) {
|
|
311
|
+
const elm = currentElement;
|
|
312
|
+
currentElement = null;
|
|
313
|
+
$animate.leave(elm);
|
|
314
|
+
}
|
|
315
|
+
},
|
|
316
|
+
}),
|
|
317
|
+
isDefault,
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
// We need to ensure that this directive deregisters itself when it no longer exists
|
|
321
|
+
// Normally this is done when the attached element is destroyed; but if this directive
|
|
322
|
+
// gets removed before we attach the message to the DOM there is nothing to watch
|
|
323
|
+
// in which case we must deregister when the containing scope is destroyed.
|
|
324
|
+
scope.$on("$destroy", () => {
|
|
325
|
+
ngMessagesCtrl.deregister(commentNode, isDefault);
|
|
326
|
+
});
|
|
327
|
+
},
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
return ngMessageDirective;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
function contains(collection, key) {
|
|
334
|
+
if (collection) {
|
|
335
|
+
return Array.isArray(collection)
|
|
336
|
+
? collection.indexOf(key) >= 0
|
|
337
|
+
: Object.prototype.hasOwnProperty.call(collection, key);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
@@ -9,16 +9,13 @@ describe("ngMessages", () => {
|
|
|
9
9
|
|
|
10
10
|
beforeEach(() => {
|
|
11
11
|
window.angular = new Angular();
|
|
12
|
-
window.angular
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
template:
|
|
20
|
-
'<div ng-messages="col"><ng-transclude></ng-transclude></div>',
|
|
21
|
-
}));
|
|
12
|
+
window.angular.module("app", ["ng"]).directive("messageWrap", () => ({
|
|
13
|
+
transclude: true,
|
|
14
|
+
scope: {
|
|
15
|
+
col: "=col",
|
|
16
|
+
},
|
|
17
|
+
template: '<div ng-messages="col"><ng-transclude></ng-transclude></div>',
|
|
18
|
+
}));
|
|
22
19
|
|
|
23
20
|
createInjector(["app"]).invoke(
|
|
24
21
|
(_$rootScope_, _$compile_, _$templateCache_) => {
|
|
@@ -932,7 +929,6 @@ describe("ngMessages", () => {
|
|
|
932
929
|
' <div ng-message="failed">Your value is that of failure</div>' +
|
|
933
930
|
"</div>",
|
|
934
931
|
)($rootScope);
|
|
935
|
-
|
|
936
932
|
$rootScope.data = {
|
|
937
933
|
required: true,
|
|
938
934
|
failed: true,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defaultModelOptions } from "
|
|
1
|
+
import { defaultModelOptions } from "./model-options";
|
|
2
2
|
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
|
|
3
3
|
import { Angular } from "../../loader";
|
|
4
4
|
import { createInjector } from "../../core/di/injector";
|
package/src/filters/filter.js
CHANGED
|
@@ -65,7 +65,6 @@ export function filterFilter() {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// Helper functions for `filterFilter`
|
|
68
|
-
/** @private */
|
|
69
68
|
function createPredicateFn(
|
|
70
69
|
expression,
|
|
71
70
|
comparator,
|
|
@@ -124,7 +123,6 @@ function createPredicateFn(
|
|
|
124
123
|
return predicateFn;
|
|
125
124
|
}
|
|
126
125
|
|
|
127
|
-
/** @private */
|
|
128
126
|
function deepCompare(
|
|
129
127
|
actual,
|
|
130
128
|
expected,
|
|
@@ -161,9 +159,8 @@ function deepCompare(
|
|
|
161
159
|
|
|
162
160
|
switch (actualType) {
|
|
163
161
|
case "object":
|
|
164
|
-
var key;
|
|
165
162
|
if (matchAgainstAnyProp) {
|
|
166
|
-
for (key in actual) {
|
|
163
|
+
for (let key in actual) {
|
|
167
164
|
// Under certain, rare, circumstances, key may not be a string and `charAt` will be undefined
|
|
168
165
|
// See: https://github.com/angular/angular.js/issues/15644
|
|
169
166
|
if (
|
|
@@ -179,7 +176,7 @@ function deepCompare(
|
|
|
179
176
|
: deepCompare(actual, expected, comparator, anyPropertyKey, false);
|
|
180
177
|
}
|
|
181
178
|
if (expectedType === "object") {
|
|
182
|
-
for (key in expected) {
|
|
179
|
+
for (let key in expected) {
|
|
183
180
|
const expectedVal = expected[key];
|
|
184
181
|
if (isFunction(expectedVal) || isUndefined(expectedVal)) {
|
|
185
182
|
continue;
|
|
@@ -212,7 +209,6 @@ function deepCompare(
|
|
|
212
209
|
}
|
|
213
210
|
|
|
214
211
|
// Used for easily differentiating between `null` and actual `object`
|
|
215
|
-
/** @private */
|
|
216
212
|
function getTypeForFilter(val) {
|
|
217
213
|
return val === null ? "null" : typeof val;
|
|
218
214
|
}
|
|
@@ -9,7 +9,7 @@ describe("Filter: filter", () => {
|
|
|
9
9
|
beforeEach(() => {
|
|
10
10
|
window.angular = new Angular();
|
|
11
11
|
window.angular.module("myModule", ["ng"]);
|
|
12
|
-
|
|
12
|
+
const injector = createInjector(["myModule"]);
|
|
13
13
|
filter = injector.get("$filter")("filter");
|
|
14
14
|
});
|
|
15
15
|
|
|
@@ -8,7 +8,7 @@ describe("filters", () => {
|
|
|
8
8
|
beforeEach(() => {
|
|
9
9
|
window.angular = new Angular();
|
|
10
10
|
window.angular.module("myModule", ["ng"]);
|
|
11
|
-
|
|
11
|
+
const injector = createInjector(["myModule"]);
|
|
12
12
|
filter = injector.get("$filter");
|
|
13
13
|
});
|
|
14
14
|
|
package/src/filters/limit-to.js
CHANGED
|
@@ -12,8 +12,8 @@ describe("Filter: limitTo", () => {
|
|
|
12
12
|
beforeEach(() => {
|
|
13
13
|
window.angular = new Angular();
|
|
14
14
|
window.angular.module("myModule", ["ng"]);
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
const injector = createInjector(["myModule"]);
|
|
16
|
+
const $filter = injector.get("$filter");
|
|
17
17
|
|
|
18
18
|
items = ["a", "b", "c", "d", "e", "f", "g", "h"];
|
|
19
19
|
str = "tuvwxyz";
|
package/src/loader.js
CHANGED
package/src/loader.spec.js
CHANGED
package/src/public.js
CHANGED
|
@@ -90,9 +90,28 @@ import { TemplateRequestProvider } from "./services/template-request";
|
|
|
90
90
|
import { $TimeoutProvider } from "./core/timeout/timeout";
|
|
91
91
|
import { SanitizeUriProvider } from "./core/sanitize/sanitize-uri";
|
|
92
92
|
import { initAnimateModule } from "./animations/module";
|
|
93
|
-
import {
|
|
94
|
-
|
|
93
|
+
import {
|
|
94
|
+
ngMessageDefaultDirective,
|
|
95
|
+
ngMessageDirective,
|
|
96
|
+
ngMessageExpDirective,
|
|
97
|
+
ngMessagesDirective,
|
|
98
|
+
ngMessagesIncludeDirective,
|
|
99
|
+
} from "./directive/messages/messages";
|
|
95
100
|
import { initRouter } from "./router/index";
|
|
101
|
+
import {
|
|
102
|
+
AriaProvider,
|
|
103
|
+
ngCheckedAriaDirective,
|
|
104
|
+
ngClickAriaDirective,
|
|
105
|
+
ngDblclickAriaDirective,
|
|
106
|
+
ngDisabledAriaDirective,
|
|
107
|
+
ngHideAriaDirective,
|
|
108
|
+
ngMessagesAriaDirective,
|
|
109
|
+
ngModelAriaDirective,
|
|
110
|
+
ngReadonlyAriaDirective,
|
|
111
|
+
ngRequiredAriaDirective,
|
|
112
|
+
ngShowAriaDirective,
|
|
113
|
+
ngValueAriaDirective,
|
|
114
|
+
} from "./directive/aria/aria";
|
|
96
115
|
|
|
97
116
|
/**
|
|
98
117
|
* @type {string} `version` from `package.json`, injected by Rollup plugin
|
|
@@ -134,11 +153,17 @@ export function publishExternalAPI(angular) {
|
|
|
134
153
|
ngClassOdd: ngClassOddDirective,
|
|
135
154
|
ngCloak: ngCloakDirective,
|
|
136
155
|
ngController: ngControllerDirective,
|
|
156
|
+
ngDisabled: ngDisabledAriaDirective,
|
|
137
157
|
ngForm: ngFormDirective,
|
|
138
158
|
ngHide: ngHideDirective,
|
|
139
159
|
ngIf: ngIfDirective,
|
|
140
160
|
ngInclude: ngIncludeDirective,
|
|
141
161
|
ngInit: ngInitDirective,
|
|
162
|
+
ngMessages: ngMessagesDirective,
|
|
163
|
+
ngMessage: ngMessageDirective,
|
|
164
|
+
ngMessageExp: ngMessageExpDirective,
|
|
165
|
+
ngMessagesInclude: ngMessagesIncludeDirective,
|
|
166
|
+
ngMessageDefault: ngMessageDefaultDirective,
|
|
142
167
|
ngNonBindable: ngNonBindableDirective,
|
|
143
168
|
ngRef: ngRefDirective,
|
|
144
169
|
ngRepeat: ngRepeatDirective,
|
|
@@ -164,12 +189,23 @@ export function publishExternalAPI(angular) {
|
|
|
164
189
|
ngModelOptions: ngModelOptionsDirective,
|
|
165
190
|
})
|
|
166
191
|
.directive({
|
|
167
|
-
ngInclude: ngIncludeFillContentDirective,
|
|
168
192
|
input: hiddenInputBrowserCacheDirective,
|
|
193
|
+
ngChecked: ngCheckedAriaDirective,
|
|
194
|
+
ngClick: ngClickAriaDirective,
|
|
195
|
+
ngDblclick: ngDblclickAriaDirective,
|
|
196
|
+
ngInclude: ngIncludeFillContentDirective,
|
|
197
|
+
ngHide: ngHideAriaDirective,
|
|
198
|
+
ngShow: ngShowAriaDirective,
|
|
199
|
+
ngMessages: ngMessagesAriaDirective,
|
|
200
|
+
ngModel: ngModelAriaDirective,
|
|
201
|
+
ngReadonly: ngReadonlyAriaDirective,
|
|
202
|
+
ngRequired: ngRequiredAriaDirective,
|
|
203
|
+
ngValue: ngValueAriaDirective,
|
|
169
204
|
})
|
|
170
205
|
.directive(ngAttributeAliasDirectives)
|
|
171
206
|
.directive(ngEventDirectives);
|
|
172
207
|
$provide.provider({
|
|
208
|
+
$aria: AriaProvider,
|
|
173
209
|
$anchorScroll: AnchorScrollProvider,
|
|
174
210
|
$animate: AnimateProvider,
|
|
175
211
|
$animateCss: CoreAnimateCssProvider,
|
|
@@ -207,8 +243,6 @@ export function publishExternalAPI(angular) {
|
|
|
207
243
|
.info({ version: VERSION });
|
|
208
244
|
|
|
209
245
|
initAnimateModule(angular);
|
|
210
|
-
initMessageModule(angular);
|
|
211
|
-
initAriaModule(angular);
|
|
212
246
|
initRouter(angular);
|
|
213
247
|
return ng;
|
|
214
248
|
}
|