@angular-wave/angular.ts 0.0.71 → 0.0.73
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-children-directive.md +1 -1
- package/src/animations/animate-css-driver.js +1 -1
- package/src/animations/animate-css.html +2 -2
- package/src/animations/animate-js.html +5 -2
- package/src/animations/animate-queue.js +5 -5
- package/src/animations/animate-swap.md +1 -1
- package/src/{core/animate → animations}/animate.html +1 -1
- package/src/{core/animate → animations}/animate.js +4 -138
- package/src/animations/raf-scheduler.js +7 -3
- package/src/animations/raf-scheduler.spec.js +3 -3
- package/src/animations/shared.js +2 -2
- package/src/binding.spec.js +4 -3
- package/src/core/compile/attributes.js +8 -1
- package/src/core/compile/compile.spec.js +44 -28
- package/src/core/controller/controller.js +9 -3
- package/src/core/di/injector.md +1 -1
- package/src/core/di/ng-module.js +46 -3
- package/src/core/prop.spec.js +15 -11
- package/src/core/q/q.js +2 -1
- package/src/directive/bind/bind.spec.js +80 -44
- package/src/directive/change/change.js +3 -1
- package/src/directive/class/class.js +43 -14
- package/src/directive/class/class.spec.js +7 -4
- package/src/directive/form/form.js +5 -4
- package/src/directive/form/form.spec.js +3 -4
- package/src/directive/if/if-animate-css.html +5 -7
- package/src/directive/if/if.js +1 -1
- package/src/directive/if/if.spec.js +3 -2
- package/src/directive/include/include.js +1 -1
- package/src/directive/input/input.spec.js +6 -4
- package/src/directive/list/list.js +3 -3
- package/src/directive/list/list.spec.js +4 -2
- package/src/directive/messages/messages.js +177 -172
- package/src/directive/messages/messages.spec.js +4 -4
- package/src/directive/model/model.js +261 -471
- package/src/directive/model/model.spec.js +4 -3
- package/src/directive/model-options/model-options.spec.js +3 -1
- package/src/directive/repeat/repeat.md +1 -1
- package/src/directive/repeat/repeat.spec.js +1 -1
- package/src/directive/select/select.spec.js +3 -3
- package/src/directive/show-hide/show-hide.js +36 -6
- package/src/directive/switch/switch.js +4 -4
- package/src/directive/switch/switch.spec.js +5 -2
- package/src/directive/validators/validators.spec.js +6 -4
- package/src/loader.js +1 -2
- package/src/public.js +22 -10
- package/src/router/directives/state-directives.js +2 -9
- package/src/router/hooks/core-resolvables.js +5 -3
- package/src/router/path/path-utils.js +1 -2
- package/src/router/resolve/resolve-context.js +14 -29
- package/src/router/state/state-queue-manager.js +1 -2
- package/src/router/state/state-service.js +2 -3
- package/src/router/transition/transition.js +2 -2
- package/src/router/view/view.js +2 -8
- package/src/services/anchor-scroll.html +1 -1
- package/src/shared/common.js +3 -8
- package/src/shared/common.spec.js +1 -19
- package/src/shared/hof.js +1 -8
- package/src/shared/jqlite/jqlite.js +2 -2
- package/src/shared/predicates.js +3 -2
- package/src/types.js +2 -3
- package/types/animations/animate-css-driver.d.ts +1 -1
- package/types/animations/animate-queue.d.ts +1 -2
- package/types/{core/animate → animations}/animate.d.ts +2 -12
- package/types/animations/raf-scheduler.d.ts +7 -2
- package/types/core/compile/attributes.d.ts +10 -1
- package/types/core/di/ng-module.d.ts +55 -12
- package/types/core/q/q.d.ts +4 -2
- package/types/directive/form/form.d.ts +3 -1
- package/types/directive/messages/messages.d.ts +76 -0
- package/types/directive/model/model.d.ts +101 -239
- package/types/router/resolve/resolve-context.d.ts +0 -2
- package/types/router/transition/transition.d.ts +0 -1
- package/types/shared/common.d.ts +0 -3
- package/types/shared/hof.d.ts +0 -1
- package/types/shared/jqlite/jqlite.d.ts +4 -4
- package/types/types.d.ts +4 -2
- package/src/animations/module.js +0 -25
- package/src/core/animate/animate-css.js +0 -88
- package/src/core/animate/anomate.md +0 -13
- package/types/animations/module.d.ts +0 -1
- package/types/core/animate/animate-css.d.ts +0 -19
- /package/src/{core/animate → animations}/animate-runner.js +0 -0
- /package/src/{core/animate → animations}/animate.spec.js +0 -0
- /package/src/{core/animate → animations}/helpers.js +0 -0
- /package/types/{core/animate → animations}/animate-runner.d.ts +0 -0
- /package/types/{core/animate → animations}/helpers.d.ts +0 -0
package/src/core/di/ng-module.js
CHANGED
|
@@ -25,7 +25,6 @@ export const CONTROLLER_LITERAL = "$controllerProvider";
|
|
|
25
25
|
*/
|
|
26
26
|
export class NgModule {
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
28
|
* @param {String} name - Name of the module
|
|
30
29
|
* @param {Array<String>} requires - List of modules which the injector will load before the current module
|
|
31
30
|
* @param {Function} [configFn]
|
|
@@ -78,7 +77,7 @@ export class NgModule {
|
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
/**
|
|
81
|
-
* @param {
|
|
80
|
+
* @param {string} name
|
|
82
81
|
* @param {any} object
|
|
83
82
|
* @returns {NgModule}
|
|
84
83
|
*/
|
|
@@ -88,7 +87,7 @@ export class NgModule {
|
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
/**
|
|
91
|
-
* @param {
|
|
90
|
+
* @param {string} name
|
|
92
91
|
* @param {any} object
|
|
93
92
|
* @returns {NgModule}
|
|
94
93
|
*/
|
|
@@ -107,11 +106,20 @@ export class NgModule {
|
|
|
107
106
|
return this;
|
|
108
107
|
}
|
|
109
108
|
|
|
109
|
+
/**
|
|
110
|
+
* @param {Function} block
|
|
111
|
+
* @returns {NgModule}
|
|
112
|
+
*/
|
|
110
113
|
run(block) {
|
|
111
114
|
this.runBlocks.push(block);
|
|
112
115
|
return this;
|
|
113
116
|
}
|
|
114
117
|
|
|
118
|
+
/**
|
|
119
|
+
* @param {string} name
|
|
120
|
+
* @param {*} options
|
|
121
|
+
* @returns {NgModule}
|
|
122
|
+
*/
|
|
115
123
|
component(name, options) {
|
|
116
124
|
if (options && isFunction(options)) {
|
|
117
125
|
options.$$moduleName = name;
|
|
@@ -120,6 +128,11 @@ export class NgModule {
|
|
|
120
128
|
return this;
|
|
121
129
|
}
|
|
122
130
|
|
|
131
|
+
/**
|
|
132
|
+
* @param {string} name
|
|
133
|
+
* @param {*} providerFunction
|
|
134
|
+
* @returns {NgModule}
|
|
135
|
+
*/
|
|
123
136
|
factory(name, providerFunction) {
|
|
124
137
|
if (providerFunction && isFunction(providerFunction)) {
|
|
125
138
|
providerFunction.$$moduleName = name;
|
|
@@ -132,6 +145,11 @@ export class NgModule {
|
|
|
132
145
|
return this;
|
|
133
146
|
}
|
|
134
147
|
|
|
148
|
+
/**
|
|
149
|
+
* @param {string} name
|
|
150
|
+
* @param {*} serviceFunction
|
|
151
|
+
* @returns {NgModule}
|
|
152
|
+
*/
|
|
135
153
|
service(name, serviceFunction) {
|
|
136
154
|
if (serviceFunction && isFunction(serviceFunction)) {
|
|
137
155
|
serviceFunction.$$moduleName = name;
|
|
@@ -144,6 +162,11 @@ export class NgModule {
|
|
|
144
162
|
return this;
|
|
145
163
|
}
|
|
146
164
|
|
|
165
|
+
/**
|
|
166
|
+
* @param {string} name
|
|
167
|
+
* @param {*} providerType
|
|
168
|
+
* @returns {NgModule}
|
|
169
|
+
*/
|
|
147
170
|
provider(name, providerType) {
|
|
148
171
|
if (providerType && isFunction(providerType)) {
|
|
149
172
|
providerType.$$moduleName = name;
|
|
@@ -152,6 +175,11 @@ export class NgModule {
|
|
|
152
175
|
return this;
|
|
153
176
|
}
|
|
154
177
|
|
|
178
|
+
/**
|
|
179
|
+
* @param {string} name
|
|
180
|
+
* @param {*} decorFn
|
|
181
|
+
* @returns {NgModule}
|
|
182
|
+
*/
|
|
155
183
|
decorator(name, decorFn) {
|
|
156
184
|
if (decorFn && isFunction(decorFn)) {
|
|
157
185
|
decorFn.$$moduleName = name;
|
|
@@ -160,6 +188,11 @@ export class NgModule {
|
|
|
160
188
|
return this;
|
|
161
189
|
}
|
|
162
190
|
|
|
191
|
+
/**
|
|
192
|
+
* @param {string} name
|
|
193
|
+
* @param {*} directiveFactory
|
|
194
|
+
* @returns {NgModule}
|
|
195
|
+
*/
|
|
163
196
|
directive(name, directiveFactory) {
|
|
164
197
|
if (directiveFactory && isFunction(directiveFactory)) {
|
|
165
198
|
directiveFactory.$$moduleName = name;
|
|
@@ -172,6 +205,11 @@ export class NgModule {
|
|
|
172
205
|
return this;
|
|
173
206
|
}
|
|
174
207
|
|
|
208
|
+
/**
|
|
209
|
+
* @param {string} name
|
|
210
|
+
* @param {*} animationFactory
|
|
211
|
+
* @returns {NgModule}
|
|
212
|
+
*/
|
|
175
213
|
animation(name, animationFactory) {
|
|
176
214
|
if (animationFactory && isFunction(animationFactory)) {
|
|
177
215
|
animationFactory.$$moduleName = name;
|
|
@@ -192,6 +230,11 @@ export class NgModule {
|
|
|
192
230
|
return this;
|
|
193
231
|
}
|
|
194
232
|
|
|
233
|
+
/**
|
|
234
|
+
* @param {string} name
|
|
235
|
+
* @param {*} ctlFn
|
|
236
|
+
* @returns {NgModule}
|
|
237
|
+
*/
|
|
195
238
|
controller(name, ctlFn) {
|
|
196
239
|
if (ctlFn && isFunction(ctlFn)) {
|
|
197
240
|
ctlFn.$$moduleName = name;
|
package/src/core/prop.spec.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Angular } from "../loader";
|
|
2
2
|
import { createInjector } from "./di/injector";
|
|
3
3
|
import { valueFn } from "../shared/utils";
|
|
4
|
+
import { dealoc } from "../shared/jqlite/jqlite";
|
|
4
5
|
|
|
5
6
|
fdescribe("ngProp*", () => {
|
|
6
7
|
let $compile, $rootScope, compileProvider, $sce;
|
|
@@ -18,7 +19,7 @@ fdescribe("ngProp*", () => {
|
|
|
18
19
|
};
|
|
19
20
|
});
|
|
20
21
|
|
|
21
|
-
let injector =
|
|
22
|
+
let injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
22
23
|
"myModule",
|
|
23
24
|
function ($compileProvider) {
|
|
24
25
|
compileProvider = $compileProvider;
|
|
@@ -617,16 +618,19 @@ fdescribe("ngProp*", () => {
|
|
|
617
618
|
describe("*[innerHTML]", () => {
|
|
618
619
|
describe("SCE disabled", () => {
|
|
619
620
|
beforeEach(() => {
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
(
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
$
|
|
629
|
-
|
|
621
|
+
dealoc(document.getElementById("dummy"));
|
|
622
|
+
window.angular
|
|
623
|
+
.bootstrap(document.getElementById("dummy"), [
|
|
624
|
+
"myModule",
|
|
625
|
+
($sceProvider) => {
|
|
626
|
+
$sceProvider.enabled(false);
|
|
627
|
+
},
|
|
628
|
+
])
|
|
629
|
+
.invoke((_$compile_, _$rootScope_, _$sce_) => {
|
|
630
|
+
$compile = _$compile_;
|
|
631
|
+
$rootScope = _$rootScope_;
|
|
632
|
+
$sce = _$sce_;
|
|
633
|
+
});
|
|
630
634
|
});
|
|
631
635
|
|
|
632
636
|
it("should set html", () => {
|
package/src/core/q/q.js
CHANGED
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
* @property {function(
|
|
17
17
|
* ((value: T) => (PromiseLike<never>|PromiseLike<T>|T))|null,
|
|
18
18
|
* ((reason: any) => (PromiseLike<never>|PromiseLike<T>|T))|null,
|
|
19
|
-
* ((state: any) => any)
|
|
19
|
+
* ((state: any) => any)=
|
|
20
20
|
* ): QPromise<T|never>} then - Calls one of the success or error callbacks asynchronously as soon as the result is available.
|
|
21
21
|
* @property {function(
|
|
22
22
|
* ((value: T) => (QPromise<never>|QPromise<T>|T))|null,
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
* ): QPromise<T|never>} then - Calls one of the success or error callbacks asynchronously as soon as the result is available.
|
|
26
26
|
* @property {function(((reason: any) => (PromiseLike<never>|PromiseLike<T>|T))|null): QPromise<T>|T} catch - Shorthand for promise.then(null, errorCallback).
|
|
27
27
|
* @property {function(((reason: any) => (QPromise<never>|QPromise<T>|T))|null): QPromise<T>|T} catch - Shorthand for promise.then(null, errorCallback).
|
|
28
|
+
* @property {function(Array.<QPromise<T>>): QPromise<T>} all
|
|
28
29
|
* @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
30
|
* @property {number} [$$intervalId] - Internal id set by the $interval service for callback notifications
|
|
30
31
|
* @property {number} [$$timeoutId] - Timeout id set by the $timeout service for cancelations
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Angular } from "../../loader";
|
|
2
|
-
import { createInjector } from "../../core/di/injector";
|
|
3
2
|
import { dealoc } from "../../shared/jqlite/jqlite";
|
|
4
3
|
|
|
5
4
|
describe("ng-bind", () => {
|
|
@@ -14,15 +13,17 @@ describe("ng-bind", () => {
|
|
|
14
13
|
window.angular
|
|
15
14
|
.module("myModule", ["ng"])
|
|
16
15
|
.decorator("$exceptionHandler", function () {
|
|
17
|
-
return (exception
|
|
16
|
+
return (exception) => {
|
|
18
17
|
throw new Error(exception.message);
|
|
19
18
|
};
|
|
20
19
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
$
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
window.angular
|
|
21
|
+
.bootstrap(document.getElementById("dummy"), ["myModule"])
|
|
22
|
+
.invoke((_$rootScope_, _$compile_, _$sce_) => {
|
|
23
|
+
$rootScope = _$rootScope_;
|
|
24
|
+
$compile = _$compile_;
|
|
25
|
+
$sce = _$sce_;
|
|
26
|
+
});
|
|
26
27
|
});
|
|
27
28
|
|
|
28
29
|
afterEach(() => {
|
|
@@ -197,16 +198,26 @@ describe("ng-bind", () => {
|
|
|
197
198
|
|
|
198
199
|
describe("SCE disabled", () => {
|
|
199
200
|
beforeEach(() => {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
$
|
|
209
|
-
|
|
201
|
+
dealoc(document.getElementById("dummy"));
|
|
202
|
+
window.angular
|
|
203
|
+
.module("myModule", [
|
|
204
|
+
"ng",
|
|
205
|
+
($sceProvider) => {
|
|
206
|
+
$sceProvider.enabled(false);
|
|
207
|
+
},
|
|
208
|
+
])
|
|
209
|
+
.decorator("$exceptionHandler", function () {
|
|
210
|
+
return (exception) => {
|
|
211
|
+
throw new Error(exception.message);
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
window.angular
|
|
215
|
+
.bootstrap(document.getElementById("dummy"), ["myModule"])
|
|
216
|
+
.invoke((_$rootScope_, _$compile_, _$sce_) => {
|
|
217
|
+
$rootScope = _$rootScope_;
|
|
218
|
+
$compile = _$compile_;
|
|
219
|
+
$sce = _$sce_;
|
|
220
|
+
});
|
|
210
221
|
});
|
|
211
222
|
|
|
212
223
|
afterEach(() => dealoc(element));
|
|
@@ -243,16 +254,26 @@ describe("ng-bind", () => {
|
|
|
243
254
|
|
|
244
255
|
describe("SCE enabled", () => {
|
|
245
256
|
beforeEach(() => {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
$
|
|
255
|
-
|
|
257
|
+
dealoc(document.getElementById("dummy"));
|
|
258
|
+
window.angular
|
|
259
|
+
.module("myModule", [
|
|
260
|
+
"ng",
|
|
261
|
+
($sceProvider) => {
|
|
262
|
+
$sceProvider.enabled(true);
|
|
263
|
+
},
|
|
264
|
+
])
|
|
265
|
+
.decorator("$exceptionHandler", function () {
|
|
266
|
+
return (exception) => {
|
|
267
|
+
throw new Error(exception.message);
|
|
268
|
+
};
|
|
269
|
+
});
|
|
270
|
+
window.angular
|
|
271
|
+
.bootstrap(document.getElementById("dummy"), ["myModule"])
|
|
272
|
+
.invoke((_$rootScope_, _$compile_, _$sce_) => {
|
|
273
|
+
$rootScope = _$rootScope_;
|
|
274
|
+
$compile = _$compile_;
|
|
275
|
+
$sce = _$sce_;
|
|
276
|
+
});
|
|
256
277
|
scope = $rootScope.$new();
|
|
257
278
|
});
|
|
258
279
|
|
|
@@ -292,23 +313,38 @@ describe("ng-bind", () => {
|
|
|
292
313
|
this.val = val;
|
|
293
314
|
}
|
|
294
315
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
$
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
316
|
+
dealoc(document.getElementById("dummy"));
|
|
317
|
+
|
|
318
|
+
window.angular
|
|
319
|
+
.module("myModule", [
|
|
320
|
+
"ng",
|
|
321
|
+
|
|
322
|
+
function ($provide) {
|
|
323
|
+
$provide.decorator("$sce", ($delegate) => {
|
|
324
|
+
$delegate.trustAsHtml = function (html) {
|
|
325
|
+
return new MySafeHtml(html);
|
|
326
|
+
};
|
|
327
|
+
$delegate.getTrustedHtml = function (mySafeHtml) {
|
|
328
|
+
return mySafeHtml.val;
|
|
329
|
+
};
|
|
330
|
+
$delegate.valueOf = function (v) {
|
|
331
|
+
return v instanceof MySafeHtml ? v.val : v;
|
|
332
|
+
};
|
|
333
|
+
return $delegate;
|
|
334
|
+
});
|
|
335
|
+
},
|
|
336
|
+
])
|
|
337
|
+
.decorator("$exceptionHandler", function () {
|
|
338
|
+
return (exception) => {
|
|
339
|
+
throw new Error(exception.message);
|
|
340
|
+
};
|
|
341
|
+
});
|
|
342
|
+
let injector = window.angular.bootstrap(
|
|
343
|
+
document.getElementById("dummy"),
|
|
344
|
+
["myModule"],
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
injector.invoke((_$rootScope_, _$compile_, _$sce_) => {
|
|
312
348
|
$rootScope = _$rootScope_.$new();
|
|
313
349
|
$compile = _$compile_;
|
|
314
350
|
$sce = _$sce_;
|
|
@@ -6,7 +6,9 @@ export function ngChangeDirective() {
|
|
|
6
6
|
restrict: "A",
|
|
7
7
|
require: "ngModel",
|
|
8
8
|
link(scope, _element, attr, ctrl) {
|
|
9
|
-
|
|
9
|
+
/** @type {import('../../types').NgModelController} */ (
|
|
10
|
+
ctrl
|
|
11
|
+
).$viewChangeListeners.push(() => scope.$eval(attr.ngChange));
|
|
10
12
|
},
|
|
11
13
|
};
|
|
12
14
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hasAnimate, isObject, isString } from "../../shared/utils";
|
|
2
2
|
|
|
3
3
|
function classDirective(name, selector) {
|
|
4
4
|
name = `ngClass${name}`;
|
|
@@ -34,12 +34,28 @@ function classDirective(name, selector) {
|
|
|
34
34
|
|
|
35
35
|
function addClasses(classString) {
|
|
36
36
|
classString = digestClassCounts(split(classString), 1);
|
|
37
|
-
|
|
37
|
+
if (hasAnimate(element[0])) {
|
|
38
|
+
attr.$addClass(classString);
|
|
39
|
+
} else {
|
|
40
|
+
scope.$$postDigest(() => {
|
|
41
|
+
if (classString !== "") {
|
|
42
|
+
element[0].classList.add(...classString.trim().split(" "));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
function removeClasses(classString) {
|
|
41
49
|
classString = digestClassCounts(split(classString), -1);
|
|
42
|
-
|
|
50
|
+
if (hasAnimate(element[0])) {
|
|
51
|
+
attr.$removeClass(classString);
|
|
52
|
+
} else {
|
|
53
|
+
scope.$$postDigest(() => {
|
|
54
|
+
if (classString !== "") {
|
|
55
|
+
element[0].classList.remove(...classString.trim().split(" "));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
43
59
|
}
|
|
44
60
|
|
|
45
61
|
function updateClasses(oldClassString, newClassString) {
|
|
@@ -52,22 +68,35 @@ function classDirective(name, selector) {
|
|
|
52
68
|
const toRemoveString = digestClassCounts(toRemoveArray, -1);
|
|
53
69
|
const toAddString = digestClassCounts(toAddArray, 1);
|
|
54
70
|
|
|
55
|
-
|
|
56
|
-
|
|
71
|
+
if (hasAnimate(element[0])) {
|
|
72
|
+
attr.$addClass(toAddString);
|
|
73
|
+
attr.$removeClass(toRemoveString);
|
|
74
|
+
} else {
|
|
75
|
+
scope.$$postDigest(() => {
|
|
76
|
+
if (toAddString !== "") {
|
|
77
|
+
element[0].classList.add(...toAddString.trim().split(" "));
|
|
78
|
+
}
|
|
79
|
+
if (toRemoveString !== "") {
|
|
80
|
+
element[0].classList.remove(
|
|
81
|
+
...toRemoveString.trim().split(" "),
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
57
86
|
}
|
|
58
87
|
|
|
59
88
|
function digestClassCounts(classArray, count) {
|
|
60
89
|
const classesToUpdate = [];
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
90
|
+
if (classArray) {
|
|
91
|
+
classArray.forEach((className) => {
|
|
92
|
+
if (count > 0 || classCounts[className]) {
|
|
93
|
+
classCounts[className] = (classCounts[className] || 0) + count;
|
|
94
|
+
if (classCounts[className] === +(count > 0)) {
|
|
95
|
+
classesToUpdate.push(className);
|
|
96
|
+
}
|
|
67
97
|
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
98
|
+
});
|
|
99
|
+
}
|
|
71
100
|
return classesToUpdate.join(" ");
|
|
72
101
|
}
|
|
73
102
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
|
|
2
2
|
import { Angular } from "../../loader";
|
|
3
|
-
import { createInjector } from "../../core/di/injector";
|
|
4
3
|
import { valueFn } from "../../shared/utils";
|
|
5
4
|
|
|
6
5
|
describe("ngClass", () => {
|
|
@@ -11,7 +10,10 @@ describe("ngClass", () => {
|
|
|
11
10
|
|
|
12
11
|
beforeEach(() => {
|
|
13
12
|
window.angular = new Angular();
|
|
14
|
-
|
|
13
|
+
window.angular.module("test", []);
|
|
14
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
15
|
+
"test",
|
|
16
|
+
]);
|
|
15
17
|
$compile = injector.get("$compile");
|
|
16
18
|
$rootScope = injector.get("$rootScope");
|
|
17
19
|
});
|
|
@@ -620,8 +622,9 @@ describe("ngClass", () => {
|
|
|
620
622
|
|
|
621
623
|
// https://github.com/angular/angular.js/issues/15960#issuecomment-299109412
|
|
622
624
|
it("should always reevaluate filters with non-primitive inputs within literals", () => {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
+
dealoc(document.getElementById("dummy"));
|
|
626
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
627
|
+
"test",
|
|
625
628
|
($filterProvider) => {
|
|
626
629
|
$filterProvider.register(
|
|
627
630
|
"foo",
|
|
@@ -21,13 +21,14 @@ export const nullFormCtrl = {
|
|
|
21
21
|
$getControls: valueFn([]),
|
|
22
22
|
$$renameControl: nullFormRenameControl,
|
|
23
23
|
$removeControl: () => {},
|
|
24
|
-
|
|
24
|
+
/** @type {(...any) => any} */
|
|
25
|
+
$setValidity: function () {},
|
|
25
26
|
$setDirty: () => {},
|
|
26
27
|
$setPristine: () => {},
|
|
27
28
|
$setSubmitted: () => {},
|
|
28
29
|
$$setSubmitted: () => {},
|
|
29
30
|
};
|
|
30
|
-
const PENDING_CLASS = "ng-pending";
|
|
31
|
+
export const PENDING_CLASS = "ng-pending";
|
|
31
32
|
const SUBMITTED_CLASS = "ng-submitted";
|
|
32
33
|
|
|
33
34
|
function nullFormRenameControl(control, name) {
|
|
@@ -327,7 +328,7 @@ FormController.prototype = {
|
|
|
327
328
|
* parent forms of the form.
|
|
328
329
|
*/
|
|
329
330
|
$setSubmitted() {
|
|
330
|
-
|
|
331
|
+
/** @type {FormController} */
|
|
331
332
|
let rootForm = this;
|
|
332
333
|
while (rootForm.$$parentForm && rootForm.$$parentForm !== nullFormCtrl) {
|
|
333
334
|
rootForm = rootForm.$$parentForm;
|
|
@@ -695,7 +696,7 @@ export function addSetValidityMethod(context) {
|
|
|
695
696
|
}
|
|
696
697
|
}
|
|
697
698
|
|
|
698
|
-
function isObjectEmpty(obj) {
|
|
699
|
+
export function isObjectEmpty(obj) {
|
|
699
700
|
if (obj) {
|
|
700
701
|
for (const prop in obj) {
|
|
701
702
|
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Angular } from "../../loader";
|
|
2
|
-
import { createInjector } from "../../core/di/injector";
|
|
3
2
|
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
|
|
4
3
|
import { FormController } from "./form";
|
|
5
4
|
|
|
@@ -15,11 +14,11 @@ describe("form", () => {
|
|
|
15
14
|
window.angular
|
|
16
15
|
.module("myModule", ["ng"])
|
|
17
16
|
.decorator("$exceptionHandler", function () {
|
|
18
|
-
return (exception
|
|
17
|
+
return (exception) => {
|
|
19
18
|
throw new Error(exception);
|
|
20
19
|
};
|
|
21
20
|
});
|
|
22
|
-
injector =
|
|
21
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
23
22
|
"myModule",
|
|
24
23
|
($compileProvider) => {
|
|
25
24
|
$compileProvider.directive("storeModelCtrl", () => ({
|
|
@@ -1410,7 +1409,7 @@ describe("form", () => {
|
|
|
1410
1409
|
JQLite(dummy).append(doc);
|
|
1411
1410
|
let angular = new Angular();
|
|
1412
1411
|
window.angular = new Angular();
|
|
1413
|
-
myModule = window.angular.module("myModule", [
|
|
1412
|
+
myModule = window.angular.module("myModule", []);
|
|
1414
1413
|
|
|
1415
1414
|
injector = angular.bootstrap(dummy, ["myModule"]);
|
|
1416
1415
|
injector.invoke((_$compile_, $rootScope, _$animate_) => {
|
|
@@ -8,13 +8,11 @@
|
|
|
8
8
|
<script type="module" src="/src/index.js"></script>
|
|
9
9
|
<script>
|
|
10
10
|
document.addEventListener("DOMContentLoaded", () => {
|
|
11
|
-
window.angular
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
transclude: true,
|
|
17
|
-
}));
|
|
11
|
+
window.angular.module("test", []).directive("svgContainer", () => ({
|
|
12
|
+
template: "<svg ng-transclude></svg>",
|
|
13
|
+
replace: true,
|
|
14
|
+
transclude: true,
|
|
15
|
+
}));
|
|
18
16
|
});
|
|
19
17
|
</script>
|
|
20
18
|
|
package/src/directive/if/if.js
CHANGED
|
@@ -17,8 +17,9 @@ describe("ngIf", () => {
|
|
|
17
17
|
beforeEach(function () {
|
|
18
18
|
angular = new Angular();
|
|
19
19
|
window.angular = new Angular();
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
window.angular.module("test", []);
|
|
21
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
22
|
+
"test",
|
|
22
23
|
function (_$compileProvider_) {
|
|
23
24
|
$compileProvider = _$compileProvider_;
|
|
24
25
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isDefined } from "../../shared/utils";
|
|
2
2
|
import { buildFragment } from "../../shared/jqlite/jqlite";
|
|
3
3
|
import { hasAnimate } from "../../shared/utils";
|
|
4
|
-
import { domInsert } from "../../
|
|
4
|
+
import { domInsert } from "../../animations/animate";
|
|
5
5
|
|
|
6
6
|
export const ngIncludeDirective = [
|
|
7
7
|
"$templateRequest",
|
|
@@ -18,10 +18,12 @@ describe("input", () => {
|
|
|
18
18
|
throw new Error(exception.message);
|
|
19
19
|
};
|
|
20
20
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
window.angular
|
|
22
|
+
.bootstrap(document.getElementById("dummy"), ["myModule"])
|
|
23
|
+
.invoke((_$compile_, $rootScope) => {
|
|
24
|
+
$compile = _$compile_;
|
|
25
|
+
scope = $rootScope.$new();
|
|
26
|
+
});
|
|
25
27
|
});
|
|
26
28
|
|
|
27
29
|
afterEach(() => {
|
|
@@ -28,8 +28,8 @@ export function ngListDirective() {
|
|
|
28
28
|
return list;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
-
ctrl
|
|
32
|
-
ctrl
|
|
31
|
+
ctrl["$parsers"].push(parse);
|
|
32
|
+
ctrl["$formatters"].push((value) => {
|
|
33
33
|
if (Array.isArray(value)) {
|
|
34
34
|
return value.join(ngList);
|
|
35
35
|
}
|
|
@@ -38,7 +38,7 @@ export function ngListDirective() {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
// Override the standard $isEmpty because an empty array means the input is empty.
|
|
41
|
-
ctrl
|
|
41
|
+
ctrl["$isEmpty"] = function (value) {
|
|
42
42
|
return !value || !value.length;
|
|
43
43
|
};
|
|
44
44
|
},
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { dealoc } from "../../shared/jqlite/jqlite";
|
|
2
2
|
import { Angular } from "../../loader";
|
|
3
|
-
import { createInjector } from "../../core/di/injector";
|
|
4
3
|
|
|
5
4
|
describe("ngList", () => {
|
|
6
5
|
let $rootScope;
|
|
@@ -11,7 +10,10 @@ describe("ngList", () => {
|
|
|
11
10
|
|
|
12
11
|
beforeEach(() => {
|
|
13
12
|
window.angular = new Angular();
|
|
14
|
-
|
|
13
|
+
window.angular.module("test", []);
|
|
14
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
15
|
+
"test",
|
|
16
|
+
]);
|
|
15
17
|
$compile = injector.get("$compile");
|
|
16
18
|
$rootScope = injector.get("$rootScope");
|
|
17
19
|
});
|