@angular-wave/angular.ts 0.0.12 → 0.0.14
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 +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/package.json +1 -1
- package/src/exts/messages.md +30 -30
- package/src/router/adapter/directives/stateDirectives.js +14 -23
- package/src/router/adapter/directives/viewDirective.js +34 -44
- package/src/router/adapter/locationServices.js +3 -5
- package/src/router/adapter/services.js +9 -16
- package/src/router/adapter/stateFilters.js +2 -7
- package/src/router/adapter/templateFactory.js +1 -1
- package/src/router/adapter/viewScroll.js +1 -8
- package/src/router/core/common/common.js +1 -11
- package/src/router/core/hooks/coreResolvables.js +2 -2
- package/src/router/core/path/pathUtils.js +1 -2
- package/src/router/core/router.js +4 -2
- package/src/router/core/state/stateBuilder.js +2 -3
- package/src/router/core/state/stateMatcher.js +1 -2
- package/src/router/core/state/stateObject.js +7 -6
- package/src/router/core/state/stateQueueManager.js +1 -1
- package/src/router/core/transition/hookRegistry.js +3 -10
- package/src/router/core/transition/transitionService.js +2 -2
- package/src/router/router.js +43 -19
- package/test/module-test.html +18 -11
- package/test/module-test.js +0 -0
- package/test/ng/directive/if.spec.js +0 -1
- package/test/original-test.html +27 -15
- package/src/router/adapter/urlRouterProvider.js +0 -196
- package/src/router/core/vanilla/baseLocationService.js +0 -31
- package/src/router/core/vanilla/browserLocationConfig.js +0 -42
- package/src/router/core/vanilla/hashLocationService.js +0 -19
- package/src/router/core/vanilla/injector.js +0 -98
- package/src/router/core/vanilla/interface.js +0 -1
- package/src/router/core/vanilla/memoryLocationConfig.js +0 -20
- package/src/router/core/vanilla/memoryLocationService.js +0 -13
- package/src/router/core/vanilla/plugins.js +0 -35
- package/src/router/core/vanilla/pushStateLocationService.js +0 -69
- package/src/router/core/vanilla/q.js +0 -54
- package/src/router/core/vanilla/utils.js +0 -63
package/package.json
CHANGED
package/src/exts/messages.md
CHANGED
|
@@ -518,33 +518,33 @@ _ {@link module:ngMessages Click here} to learn more about`ngMessages`and`ngMess
|
|
|
518
518
|
_ @param {string} ngMessageExp|whenExp an expression value corresponding to the message key.
|
|
519
519
|
_/
|
|
520
520
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
521
|
+
/**
|
|
522
|
+
* @ngdoc directive
|
|
523
|
+
* @name ngMessageDefault
|
|
524
|
+
* @restrict AE
|
|
525
|
+
* @scope
|
|
526
|
+
*
|
|
527
|
+
* @description
|
|
528
|
+
* `ngMessageDefault` is a directive with the purpose to show and hide a default message for
|
|
529
|
+
* {@link directive:ngMessages}, when none of provided messages matches.
|
|
530
|
+
*
|
|
531
|
+
* More information about using `ngMessageDefault` can be found in the
|
|
532
|
+
* {@link module:ngMessages `ngMessages` module documentation}.
|
|
533
|
+
*
|
|
534
|
+
* @usage
|
|
535
|
+
* ```html
|
|
536
|
+
* <!-- using attribute directives -->
|
|
537
|
+
* <ANY ng-messages="expression" role="alert">
|
|
538
|
+
* <ANY ng-message="stringValue">...</ANY>
|
|
539
|
+
* <ANY ng-message="stringValue1, stringValue2, ...">...</ANY>
|
|
540
|
+
* <ANY ng-message-default>...</ANY>
|
|
541
|
+
* </ANY>
|
|
542
|
+
*
|
|
543
|
+
* <!-- or by using element directives -->
|
|
544
|
+
* <ng-messages for="expression" role="alert">
|
|
545
|
+
* <ng-message when="stringValue">...</ng-message>
|
|
546
|
+
* <ng-message when="stringValue1, stringValue2, ...">...</ng-message>
|
|
547
|
+
* <ng-message-default>...</ng-message-default>
|
|
548
|
+
* </ng-messages>
|
|
549
|
+
*
|
|
550
|
+
*/
|
|
@@ -4,23 +4,21 @@
|
|
|
4
4
|
* These are the directives included in UI-Router for Angular 1.
|
|
5
5
|
* These directives are used in templates to create viewports and link/navigate to states.
|
|
6
6
|
*
|
|
7
|
-
|
|
8
|
-
*/ /** */
|
|
7
|
+
*/
|
|
9
8
|
import {
|
|
10
9
|
extend,
|
|
11
10
|
forEach,
|
|
12
11
|
tail,
|
|
13
|
-
isString,
|
|
14
|
-
isObject,
|
|
15
|
-
isArray,
|
|
16
|
-
parse,
|
|
17
12
|
noop,
|
|
18
13
|
unnestR,
|
|
19
14
|
identity,
|
|
20
15
|
uniqR,
|
|
21
16
|
inArray,
|
|
22
17
|
removeFrom,
|
|
23
|
-
} from "../../core/
|
|
18
|
+
} from "../../core/common/common";
|
|
19
|
+
import { isString, isObject, isArray } from "../../core/common/predicates";
|
|
20
|
+
|
|
21
|
+
import { parse } from "../../core/common/hof";
|
|
24
22
|
/** @hidden */
|
|
25
23
|
function parseStateRef(ref) {
|
|
26
24
|
const paramsOnly = ref.match(/^\s*({[^}]*})\s*$/);
|
|
@@ -52,12 +50,12 @@ function processedDef($state, $element, def) {
|
|
|
52
50
|
function getTypeInfo(el) {
|
|
53
51
|
// SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.
|
|
54
52
|
const isSvg =
|
|
55
|
-
Object.prototype.toString.call(el.
|
|
53
|
+
Object.prototype.toString.call(el[0].getAttribute("href")) ===
|
|
56
54
|
"[object SVGAnimatedString]";
|
|
57
55
|
const isForm = el[0].nodeName === "FORM";
|
|
58
56
|
return {
|
|
59
57
|
attr: isForm ? "action" : isSvg ? "xlink:href" : "href",
|
|
60
|
-
isAnchor: el.
|
|
58
|
+
isAnchor: el[0].nodeName === "A",
|
|
61
59
|
clickable: !isForm,
|
|
62
60
|
};
|
|
63
61
|
}
|
|
@@ -252,8 +250,7 @@ function bindEvents(element, scope, hookFn, uiStateOpts) {
|
|
|
252
250
|
* - Unlike the parameter values expression, the state name is not `$watch`ed (for performance reasons).
|
|
253
251
|
* If you need to dynamically update the state being linked to, use the fully dynamic [[uiState]] directive.
|
|
254
252
|
*/
|
|
255
|
-
let uiSrefDirective
|
|
256
|
-
uiSrefDirective = [
|
|
253
|
+
export let uiSrefDirective = [
|
|
257
254
|
"$uiRouter",
|
|
258
255
|
"$timeout",
|
|
259
256
|
function $StateRefDirective($uiRouter, $timeout) {
|
|
@@ -390,8 +387,7 @@ uiSrefDirective = [
|
|
|
390
387
|
* - A middle-click, right-click, or ctrl-click is handled (natively) by the browser to open the href in a new window, for example.
|
|
391
388
|
* ```
|
|
392
389
|
*/
|
|
393
|
-
let uiStateDirective
|
|
394
|
-
uiStateDirective = [
|
|
390
|
+
export let uiStateDirective = [
|
|
395
391
|
"$uiRouter",
|
|
396
392
|
"$timeout",
|
|
397
393
|
function $StateRefDynamicDirective($uiRouter, $timeout) {
|
|
@@ -540,8 +536,7 @@ uiStateDirective = [
|
|
|
540
536
|
*
|
|
541
537
|
* - Multiple classes may be specified in a space-separated format: `ui-sref-active='class1 class2 class3'`
|
|
542
538
|
*/
|
|
543
|
-
let uiSrefActiveDirective
|
|
544
|
-
uiSrefActiveDirective = [
|
|
539
|
+
export let uiSrefActiveDirective = [
|
|
545
540
|
"$state",
|
|
546
541
|
"$stateParams",
|
|
547
542
|
"$interpolate",
|
|
@@ -675,9 +670,11 @@ uiSrefActiveDirective = [
|
|
|
675
670
|
(cls) => !inArray(addClasses, cls),
|
|
676
671
|
);
|
|
677
672
|
$scope.$evalAsync(() => {
|
|
678
|
-
addClasses.forEach((className) =>
|
|
673
|
+
addClasses.forEach((className) =>
|
|
674
|
+
$element[0].classList.add(className),
|
|
675
|
+
);
|
|
679
676
|
removeClasses.forEach((className) =>
|
|
680
|
-
$element.
|
|
677
|
+
$element[0].classList.remove(className),
|
|
681
678
|
);
|
|
682
679
|
});
|
|
683
680
|
}
|
|
@@ -687,9 +684,3 @@ uiSrefActiveDirective = [
|
|
|
687
684
|
};
|
|
688
685
|
},
|
|
689
686
|
];
|
|
690
|
-
window.angular
|
|
691
|
-
.module("ui.router.state")
|
|
692
|
-
.directive("uiSref", uiSrefDirective)
|
|
693
|
-
.directive("uiSrefActive", uiSrefActiveDirective)
|
|
694
|
-
.directive("uiSrefActiveEq", uiSrefActiveDirective)
|
|
695
|
-
.directive("uiState", uiStateDirective);
|
|
@@ -1,21 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
kebobString,
|
|
9
|
-
noop,
|
|
10
|
-
parse,
|
|
11
|
-
ResolveContext,
|
|
12
|
-
tail,
|
|
13
|
-
trace,
|
|
14
|
-
unnestR,
|
|
15
|
-
} from "../../core/index";
|
|
16
|
-
|
|
1
|
+
import { extend, filter, tail, unnestR } from "../../core/common/common";
|
|
2
|
+
import { isDefined, isFunction, isString } from "../../core/common/predicates";
|
|
3
|
+
import { kebobString } from "../../core/common/strings";
|
|
4
|
+
import { noop } from "../../core/common/common";
|
|
5
|
+
import { parse } from "../../core/common/hof";
|
|
6
|
+
import { ResolveContext } from "../../core/resolve/resolveContext";
|
|
7
|
+
import { trace } from "../../core/common/trace";
|
|
17
8
|
import { getLocals } from "../services";
|
|
18
9
|
import { Ng1ViewConfig } from "../statebuilders/views";
|
|
10
|
+
import { jqLite } from "../../../jqLite";
|
|
19
11
|
/**
|
|
20
12
|
* `ui-view`: A viewport directive which is filled in by a view from the active state.
|
|
21
13
|
*
|
|
@@ -141,9 +133,7 @@ import { Ng1ViewConfig } from "../statebuilders/views";
|
|
|
141
133
|
* });
|
|
142
134
|
* ```
|
|
143
135
|
*/
|
|
144
|
-
export let uiView
|
|
145
|
-
// eslint-disable-next-line prefer-const
|
|
146
|
-
uiView = [
|
|
136
|
+
export let uiView = [
|
|
147
137
|
"$view",
|
|
148
138
|
"$animate",
|
|
149
139
|
"$uiViewScroll",
|
|
@@ -153,18 +143,18 @@ uiView = [
|
|
|
153
143
|
function getRenderer() {
|
|
154
144
|
return {
|
|
155
145
|
enter: function (element, target, cb) {
|
|
156
|
-
if (angular.version.minor > 2) {
|
|
157
|
-
|
|
158
|
-
} else {
|
|
159
|
-
|
|
160
|
-
}
|
|
146
|
+
// if (angular.version.minor > 2) {
|
|
147
|
+
//$animate.enter(element, null, target).then(cb);
|
|
148
|
+
// } else {
|
|
149
|
+
$animate.enter(element, null, target, cb);
|
|
150
|
+
// }
|
|
161
151
|
},
|
|
162
152
|
leave: function (element, cb) {
|
|
163
|
-
if (angular.version.minor > 2) {
|
|
164
|
-
|
|
165
|
-
} else {
|
|
166
|
-
|
|
167
|
-
}
|
|
153
|
+
// if (angular.version.minor > 2) {
|
|
154
|
+
//$animate.leave(element).then(cb);
|
|
155
|
+
// } else {
|
|
156
|
+
$animate.leave(element, cb);
|
|
157
|
+
// }
|
|
168
158
|
},
|
|
169
159
|
};
|
|
170
160
|
}
|
|
@@ -324,8 +314,13 @@ $ViewDirectiveFill.$inject = [
|
|
|
324
314
|
"$view",
|
|
325
315
|
"$q",
|
|
326
316
|
];
|
|
327
|
-
|
|
328
|
-
|
|
317
|
+
export function $ViewDirectiveFill(
|
|
318
|
+
$compile,
|
|
319
|
+
$controller,
|
|
320
|
+
$transitions,
|
|
321
|
+
$view,
|
|
322
|
+
$q,
|
|
323
|
+
) {
|
|
329
324
|
const getControllerAs = parse("viewDecl.controllerAs");
|
|
330
325
|
const getResolveAs = parse("viewDecl.resolveAs");
|
|
331
326
|
return {
|
|
@@ -338,14 +333,18 @@ function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q) {
|
|
|
338
333
|
const data = $element.data("$uiView");
|
|
339
334
|
if (!data) {
|
|
340
335
|
$element.html(initial);
|
|
341
|
-
$compile($element.
|
|
336
|
+
$compile($element[0].contentDocument || $element[0].childNodes)(
|
|
337
|
+
scope,
|
|
338
|
+
);
|
|
342
339
|
return;
|
|
343
340
|
}
|
|
344
341
|
const cfg = data.$cfg || { viewDecl: {}, getTemplate: noop };
|
|
345
342
|
const resolveCtx = cfg.path && new ResolveContext(cfg.path);
|
|
346
343
|
$element.html(cfg.getTemplate($element, resolveCtx) || initial);
|
|
347
344
|
trace.traceUIViewFill(data.$uiView, $element.html());
|
|
348
|
-
const link = $compile(
|
|
345
|
+
const link = $compile(
|
|
346
|
+
$element[0].contentDocument || $element[0].childNodes,
|
|
347
|
+
);
|
|
349
348
|
const controller = cfg.controller;
|
|
350
349
|
const controllerAs = getControllerAs(cfg);
|
|
351
350
|
const resolveAs = getResolveAs(cfg);
|
|
@@ -386,7 +385,7 @@ function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q) {
|
|
|
386
385
|
.filter((el) => el && el.tagName && tagRegexp.exec(el.tagName));
|
|
387
386
|
return (
|
|
388
387
|
directiveEl &&
|
|
389
|
-
|
|
388
|
+
jqLite(directiveEl).data(`$${cfg.component}Controller`)
|
|
390
389
|
);
|
|
391
390
|
};
|
|
392
391
|
const deregisterWatch = scope.$watch(
|
|
@@ -410,8 +409,6 @@ function $ViewDirectiveFill($compile, $controller, $transitions, $view, $q) {
|
|
|
410
409
|
};
|
|
411
410
|
}
|
|
412
411
|
/** @hidden */
|
|
413
|
-
const hasComponentImpl =
|
|
414
|
-
typeof angular.module("ui.router")["component"] === "function";
|
|
415
412
|
/** @hidden incrementing id */
|
|
416
413
|
let _uiCanExitId = 0;
|
|
417
414
|
/** @hidden TODO: move these callbacks to $view and/or `/hooks/components.ts` or something */
|
|
@@ -425,10 +422,7 @@ function registerControllerCallbacks(
|
|
|
425
422
|
// Call $onInit() ASAP
|
|
426
423
|
if (
|
|
427
424
|
isFunction(controllerInstance.$onInit) &&
|
|
428
|
-
!(
|
|
429
|
-
(cfg.viewDecl.component || cfg.viewDecl.componentProvider) &&
|
|
430
|
-
hasComponentImpl
|
|
431
|
-
)
|
|
425
|
+
!(cfg.viewDecl.component || cfg.viewDecl.componentProvider)
|
|
432
426
|
) {
|
|
433
427
|
controllerInstance.$onInit();
|
|
434
428
|
}
|
|
@@ -508,7 +502,3 @@ function registerControllerCallbacks(
|
|
|
508
502
|
);
|
|
509
503
|
}
|
|
510
504
|
}
|
|
511
|
-
window.angular
|
|
512
|
-
.module("ui.router.state")
|
|
513
|
-
.directive("uiView", uiView)
|
|
514
|
-
.directive("uiView", $ViewDirectiveFill);
|
|
@@ -32,7 +32,6 @@ export class Ng1LocationServices {
|
|
|
32
32
|
.replace(/(~~|~2F)/g, (m) => ({ "~~": "~", "~2F": "/" })[m])
|
|
33
33
|
: x;
|
|
34
34
|
}
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
36
35
|
dispose() {}
|
|
37
36
|
constructor($locationProvider) {
|
|
38
37
|
// .onChange() registry
|
|
@@ -48,7 +47,7 @@ export class Ng1LocationServices {
|
|
|
48
47
|
html5Mode() {
|
|
49
48
|
let html5Mode = this.$locationProvider.html5Mode();
|
|
50
49
|
html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode;
|
|
51
|
-
return html5Mode &&
|
|
50
|
+
return html5Mode && typeof history !== "undefined";
|
|
52
51
|
}
|
|
53
52
|
baseHref() {
|
|
54
53
|
return (
|
|
@@ -63,11 +62,10 @@ export class Ng1LocationServices {
|
|
|
63
62
|
if (state) this.$location.state(state);
|
|
64
63
|
return this.$location.url();
|
|
65
64
|
}
|
|
66
|
-
_runtimeServices($rootScope, $location, $
|
|
65
|
+
_runtimeServices($rootScope, $location, $browser) {
|
|
67
66
|
this.$location = $location;
|
|
68
|
-
this.$sniffer = $sniffer;
|
|
69
67
|
this.$browser = $browser;
|
|
70
|
-
this.$window =
|
|
68
|
+
this.$window = window;
|
|
71
69
|
// Bind $locationChangeSuccess to the listeners registered in LocationService.onChange
|
|
72
70
|
$rootScope.$on("$locationChangeSuccess", (evt) =>
|
|
73
71
|
this._urlListeners.forEach((fn) => fn(evt)),
|
|
@@ -21,7 +21,6 @@ import {
|
|
|
21
21
|
import { StateProvider } from "./stateProvider";
|
|
22
22
|
import { getStateHookBuilder } from "./statebuilders/onEnterExitRetain";
|
|
23
23
|
import { Ng1LocationServices } from "./locationServices";
|
|
24
|
-
import { UrlRouterProvider } from "./urlRouterProvider";
|
|
25
24
|
|
|
26
25
|
export let router = null;
|
|
27
26
|
$uiRouterProvider.$inject = ["$locationProvider"];
|
|
@@ -52,15 +51,9 @@ export function $uiRouterProvider($locationProvider) {
|
|
|
52
51
|
// backwards compat: also expose router instance as $uiRouterProvider.router
|
|
53
52
|
router["router"] = router;
|
|
54
53
|
router["$get"] = $get;
|
|
55
|
-
$get.$inject = ["$location", "$browser", "$
|
|
56
|
-
function $get($location, $browser, $
|
|
57
|
-
ng1LocationService._runtimeServices(
|
|
58
|
-
$rootScope,
|
|
59
|
-
$location,
|
|
60
|
-
$sniffer,
|
|
61
|
-
$browser,
|
|
62
|
-
$window,
|
|
63
|
-
);
|
|
54
|
+
$get.$inject = ["$location", "$browser", "$rootScope"];
|
|
55
|
+
function $get($location, $browser, $rootScope) {
|
|
56
|
+
ng1LocationService._runtimeServices($rootScope, $location, $browser);
|
|
64
57
|
delete router["router"];
|
|
65
58
|
delete router["$get"];
|
|
66
59
|
return router;
|
|
@@ -69,7 +62,7 @@ export function $uiRouterProvider($locationProvider) {
|
|
|
69
62
|
}
|
|
70
63
|
export const getProviderFor = (serviceName) => [
|
|
71
64
|
"$uiRouterProvider",
|
|
72
|
-
($urp)
|
|
65
|
+
function UrlServiceProvider($urp) {
|
|
73
66
|
const service = $urp.router[serviceName];
|
|
74
67
|
service["$get"] = () => service;
|
|
75
68
|
return service;
|
|
@@ -103,13 +96,13 @@ export function runBlock($injector, $q, $uiRouter) {
|
|
|
103
96
|
)),
|
|
104
97
|
);
|
|
105
98
|
}
|
|
106
|
-
|
|
107
|
-
export const getUrlRouterProvider = (uiRouter) =>
|
|
108
|
-
(uiRouter.urlRouterProvider = new UrlRouterProvider(uiRouter));
|
|
99
|
+
|
|
109
100
|
// $state service and $stateProvider
|
|
110
101
|
// $urlRouter service and $urlRouterProvider
|
|
111
|
-
export
|
|
112
|
-
extend(router.stateProvider, { $get: () => router.stateService });
|
|
102
|
+
export function getStateProvider() {
|
|
103
|
+
return extend(router.stateProvider, { $get: () => router.stateService });
|
|
104
|
+
}
|
|
105
|
+
|
|
113
106
|
watchDigests.$inject = ["$rootScope"];
|
|
114
107
|
export function watchDigests($rootScope) {
|
|
115
108
|
$rootScope.$watch(function () {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
13
|
$IsStateFilter.$inject = ["$state"];
|
|
14
|
-
function $IsStateFilter($state) {
|
|
14
|
+
export function $IsStateFilter($state) {
|
|
15
15
|
const isFilter = function (state, params, options) {
|
|
16
16
|
return $state.is(state, params, options);
|
|
17
17
|
};
|
|
@@ -29,15 +29,10 @@ function $IsStateFilter($state) {
|
|
|
29
29
|
* ```
|
|
30
30
|
*/
|
|
31
31
|
$IncludedByStateFilter.$inject = ["$state"];
|
|
32
|
-
function $IncludedByStateFilter($state) {
|
|
32
|
+
export function $IncludedByStateFilter($state) {
|
|
33
33
|
const includesFilter = function (state, params, options) {
|
|
34
34
|
return $state.includes(state, params, options);
|
|
35
35
|
};
|
|
36
36
|
includesFilter.$stateful = true;
|
|
37
37
|
return includesFilter;
|
|
38
38
|
}
|
|
39
|
-
window.angular
|
|
40
|
-
.module("ui.router.state")
|
|
41
|
-
.filter("isState", $IsStateFilter)
|
|
42
|
-
.filter("includedByState", $IncludedByStateFilter);
|
|
43
|
-
export { $IsStateFilter, $IncludedByStateFilter };
|
|
@@ -154,7 +154,7 @@ export class TemplateFactory {
|
|
|
154
154
|
makeComponentTemplate(uiView, context, component, bindings) {
|
|
155
155
|
bindings = bindings || {};
|
|
156
156
|
// Bind once prefix
|
|
157
|
-
const prefix = angular.version.minor >= 3 ? "::" : "";
|
|
157
|
+
const prefix = "::"; //angular.version.minor >= 3 ? "::" : "";
|
|
158
158
|
// Convert to kebob name. Add x- prefix if the string starts with `x-` or `data-`
|
|
159
159
|
const kebob = (camelCase) => {
|
|
160
160
|
const kebobed = kebobString(camelCase);
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/** @hidden */
|
|
4
|
-
function $ViewScrollProvider() {
|
|
1
|
+
export function $ViewScrollProvider() {
|
|
5
2
|
let useAnchorScroll = false;
|
|
6
3
|
this.useAnchorScroll = function () {
|
|
7
4
|
useAnchorScroll = true;
|
|
@@ -25,7 +22,3 @@ function $ViewScrollProvider() {
|
|
|
25
22
|
},
|
|
26
23
|
];
|
|
27
24
|
}
|
|
28
|
-
|
|
29
|
-
window.angular
|
|
30
|
-
.module("ui.router.state")
|
|
31
|
-
.provider("$uiViewScroll", $ViewScrollProvider);
|
|
@@ -226,17 +226,7 @@ export function map(collection, callback, target) {
|
|
|
226
226
|
forEach(collection, (item, i) => (target[i] = callback(item, i)));
|
|
227
227
|
return target;
|
|
228
228
|
}
|
|
229
|
-
|
|
230
|
-
* Given an object, return its enumerable property values
|
|
231
|
-
*
|
|
232
|
-
* @example
|
|
233
|
-
* ```
|
|
234
|
-
*
|
|
235
|
-
* let foo = { a: 1, b: 2, c: 3 }
|
|
236
|
-
* let vals = values(foo); // [ 1, 2, 3 ]
|
|
237
|
-
* ```
|
|
238
|
-
*/
|
|
239
|
-
export const values = (obj) => Object.keys(obj).map((key) => obj[key]);
|
|
229
|
+
|
|
240
230
|
/**
|
|
241
231
|
* Reduce function that returns true if all of the values are truthy.
|
|
242
232
|
*
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Transition } from "../transition/transition";
|
|
2
2
|
import { UIRouter } from "../router";
|
|
3
3
|
import { Resolvable } from "../resolve/resolvable";
|
|
4
|
-
import { inArray, uniqR, unnestR
|
|
4
|
+
import { inArray, uniqR, unnestR } from "../common/common";
|
|
5
5
|
function addCoreResolvables(trans) {
|
|
6
6
|
trans.addResolvable(Resolvable.fromData(UIRouter, trans.router), "");
|
|
7
7
|
trans.addResolvable(Resolvable.fromData(Transition, trans), "");
|
|
@@ -20,7 +20,7 @@ const isTransition = inArray(TRANSITION_TOKENS);
|
|
|
20
20
|
// This function removes resolves for '$transition$' and `Transition` from the treeChanges.
|
|
21
21
|
// Do not use this on current transitions, only on old ones.
|
|
22
22
|
export const treeChangesCleanup = (trans) => {
|
|
23
|
-
const nodes = values(trans.treeChanges())
|
|
23
|
+
const nodes = Object.values(trans.treeChanges())
|
|
24
24
|
.reduce(unnestR, [])
|
|
25
25
|
.reduce(uniqR, []);
|
|
26
26
|
// If the resolvable is a Transition, return a new resolvable with null data
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
omit,
|
|
6
6
|
tail,
|
|
7
7
|
mergeR,
|
|
8
|
-
values,
|
|
9
8
|
unnestR,
|
|
10
9
|
inArray,
|
|
11
10
|
arrayTuples,
|
|
@@ -55,7 +54,7 @@ export class PathUtils {
|
|
|
55
54
|
path
|
|
56
55
|
.filter((node) => inArray(states, node.state))
|
|
57
56
|
.forEach((node) => {
|
|
58
|
-
const viewDecls = values(node.state.views || {});
|
|
57
|
+
const viewDecls = Object.values(node.state.views || {});
|
|
59
58
|
const subPath = PathUtils.subPath(path, (n) => n === node);
|
|
60
59
|
const viewConfigs = viewDecls.map((view) =>
|
|
61
60
|
$view.createViewConfig(subPath, view),
|
|
@@ -5,7 +5,7 @@ import { ViewService } from "./view/view";
|
|
|
5
5
|
import { StateRegistry } from "./state/stateRegistry";
|
|
6
6
|
import { StateService } from "./state/stateService";
|
|
7
7
|
import { UIRouterGlobals } from "./globals";
|
|
8
|
-
import {
|
|
8
|
+
import { removeFrom } from "./common/common";
|
|
9
9
|
import { isFunction } from "./common/predicates";
|
|
10
10
|
import { UrlService } from "./url/urlService";
|
|
11
11
|
import { trace } from "./common/trace";
|
|
@@ -196,6 +196,8 @@ export class UIRouter {
|
|
|
196
196
|
return (this._plugins[pluginInstance.name] = pluginInstance);
|
|
197
197
|
}
|
|
198
198
|
getPlugin(pluginName) {
|
|
199
|
-
return pluginName
|
|
199
|
+
return pluginName
|
|
200
|
+
? this._plugins[pluginName]
|
|
201
|
+
: Object.values(this._plugins);
|
|
200
202
|
}
|
|
201
203
|
}
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
noop,
|
|
8
8
|
omit,
|
|
9
9
|
tail,
|
|
10
|
-
values,
|
|
11
10
|
copy,
|
|
12
11
|
} from "../common/common";
|
|
13
12
|
import { isArray, isDefined, isFunction, isString } from "../common/predicates";
|
|
@@ -75,7 +74,7 @@ const getParamsBuilder = (paramFactory) =>
|
|
|
75
74
|
paramFactory.fromConfig(id, null, state.self);
|
|
76
75
|
const urlParams =
|
|
77
76
|
(state.url && state.url.parameters({ inherit: false })) || [];
|
|
78
|
-
const nonUrlParams = values(
|
|
77
|
+
const nonUrlParams = Object.values(
|
|
79
78
|
mapObj(
|
|
80
79
|
omit(state.params || {}, urlParams.map(prop("id"))),
|
|
81
80
|
makeConfigParam,
|
|
@@ -292,7 +291,7 @@ export class StateBuilder {
|
|
|
292
291
|
return null;
|
|
293
292
|
}
|
|
294
293
|
for (const key in builders) {
|
|
295
|
-
if (!
|
|
294
|
+
if (!Object.prototype.hasOwnProperty.call(builders, key)) continue;
|
|
296
295
|
const chain = builders[key].reduce(
|
|
297
296
|
(parentFn, step) => (_state) => step(_state, parentFn),
|
|
298
297
|
noop,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { isString } from "../common/predicates";
|
|
2
|
-
import { values } from "../common/common";
|
|
3
2
|
import { safeConsole } from "../common/safeConsole";
|
|
4
3
|
export class StateMatcher {
|
|
5
4
|
constructor(_states) {
|
|
@@ -22,7 +21,7 @@ export class StateMatcher {
|
|
|
22
21
|
) {
|
|
23
22
|
return state;
|
|
24
23
|
} else if (isStr && matchGlob) {
|
|
25
|
-
const _states = values(this._states);
|
|
24
|
+
const _states = Object.values(this._states);
|
|
26
25
|
const matches = _states.filter(
|
|
27
26
|
(_state) =>
|
|
28
27
|
_state.__stateObjectCache.nameGlob &&
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defaults,
|
|
1
|
+
import { defaults, find } from "../common/common";
|
|
2
2
|
import { propEq } from "../common/hof";
|
|
3
3
|
import { Glob } from "../common/glob";
|
|
4
4
|
import { isObject, isFunction } from "../common/predicates";
|
|
@@ -25,7 +25,7 @@ export class StateObject {
|
|
|
25
25
|
stateDecl = StateObject.isStateClass(stateDecl)
|
|
26
26
|
? new stateDecl()
|
|
27
27
|
: stateDecl;
|
|
28
|
-
const state =
|
|
28
|
+
const state = Object.setPrototypeOf(stateDecl, StateObject.prototype);
|
|
29
29
|
stateDecl.$$state = () => state;
|
|
30
30
|
state.self = stateDecl;
|
|
31
31
|
state.__stateObjectCache = {
|
|
@@ -33,7 +33,7 @@ export class StateObject {
|
|
|
33
33
|
};
|
|
34
34
|
return state;
|
|
35
35
|
}
|
|
36
|
-
/** @deprecated use State.create() */
|
|
36
|
+
// /** @deprecated use State.create() */
|
|
37
37
|
constructor(config) {
|
|
38
38
|
return StateObject.create(config || {});
|
|
39
39
|
}
|
|
@@ -83,10 +83,11 @@ export class StateObject {
|
|
|
83
83
|
const inherited =
|
|
84
84
|
(opts.inherit && this.parent && this.parent.parameters()) || [];
|
|
85
85
|
return inherited
|
|
86
|
-
.concat(values(this.params))
|
|
86
|
+
.concat(Object.values(this.params))
|
|
87
87
|
.filter(
|
|
88
88
|
(param) =>
|
|
89
|
-
!opts.matchingKeys ||
|
|
89
|
+
!opts.matchingKeys ||
|
|
90
|
+
Object.prototype.hasOwnProperty.call(opts.matchingKeys, param.id),
|
|
90
91
|
);
|
|
91
92
|
}
|
|
92
93
|
/**
|
|
@@ -99,7 +100,7 @@ export class StateObject {
|
|
|
99
100
|
parameter(id, opts = {}) {
|
|
100
101
|
return (
|
|
101
102
|
(this.url && this.url.parameter(id, opts)) ||
|
|
102
|
-
find(values(this.params), propEq("id", id)) ||
|
|
103
|
+
find(Object.values(this.params), propEq("id", id)) ||
|
|
103
104
|
(opts.inherit && this.parent && this.parent.parameter(id))
|
|
104
105
|
);
|
|
105
106
|
}
|
|
@@ -19,7 +19,7 @@ export class StateQueueManager {
|
|
|
19
19
|
const name = state.name;
|
|
20
20
|
if (!isString(name)) throw new Error("State must have a valid name");
|
|
21
21
|
if (
|
|
22
|
-
|
|
22
|
+
Object.prototype.hasOwnProperty.call(this.states, name) ||
|
|
23
23
|
inArray(queue.map(prop("name")), name)
|
|
24
24
|
)
|
|
25
25
|
throw new Error(`State '${name}' is already defined`);
|