@angular-wave/angular.ts 0.0.14 → 0.0.16
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/rollup.config.js +6 -2
- package/src/animations/animate-css.js +13 -218
- package/src/animations/animate.css.md +263 -0
- package/src/animations/animate.md +933 -0
- package/src/animations/module.js +0 -750
- package/src/animations/shared.js +0 -11
- package/src/core/compile.js +1 -1
- package/src/exts/messages.md +30 -30
- package/src/router/adapter/directives/stateDirectives.js +3 -4
- package/src/router/adapter/directives/viewDirective.js +3 -4
- package/src/router/adapter/services.js +4 -2
- package/src/router/adapter/statebuilders/onEnterExitRetain.js +1 -2
- package/src/router/adapter/statebuilders/views.js +4 -5
- package/src/router/core/common/common.js +10 -22
- package/src/router/core/common/safeConsole.js +1 -2
- package/src/router/core/hooks/resolve.js +3 -4
- package/src/router/core/hooks/views.js +3 -2
- package/src/router/core/params/param.js +5 -5
- package/src/router/core/params/paramType.js +3 -3
- package/src/router/core/params/paramTypes.js +6 -7
- package/src/router/core/params/stateParams.js +3 -3
- package/src/router/core/path/pathNode.js +2 -2
- package/src/router/core/path/pathUtils.js +4 -5
- package/src/router/core/resolve/resolvable.js +2 -2
- package/src/router/core/state/stateBuilder.js +1 -2
- package/src/router/core/state/stateService.js +2 -3
- package/src/router/core/state/targetState.js +8 -5
- package/src/router/core/transition/hookBuilder.js +2 -2
- package/src/router/core/transition/hookRegistry.js +2 -2
- package/src/router/core/transition/rejectFactory.js +2 -3
- package/src/router/core/transition/transition.js +5 -3
- package/src/router/core/url/urlMatcherFactory.js +2 -8
- package/src/router/core/url/urlRule.js +7 -4
- package/src/router/core/url/urlService.js +2 -2
- package/src/router/router.js +11 -10
package/src/animations/shared.js
CHANGED
|
@@ -365,14 +365,3 @@ export function concatWithSpace(a, b) {
|
|
|
365
365
|
if (!b) return a;
|
|
366
366
|
return `${a} ${b}`;
|
|
367
367
|
}
|
|
368
|
-
|
|
369
|
-
export const helpers = {
|
|
370
|
-
blockTransitions(node, duration) {
|
|
371
|
-
// we use a negative delay value since it performs blocking
|
|
372
|
-
// yet it doesn't kill any existing transitions running on the
|
|
373
|
-
// same element which makes this safe for class-based animations
|
|
374
|
-
const value = duration ? `-${duration}s` : "";
|
|
375
|
-
applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]);
|
|
376
|
-
return [TRANSITION_DELAY_PROP, value];
|
|
377
|
-
},
|
|
378
|
-
};
|
package/src/core/compile.js
CHANGED
|
@@ -2147,7 +2147,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
|
|
|
2147
2147
|
!isArray(require) &&
|
|
2148
2148
|
isObject(require)
|
|
2149
2149
|
) {
|
|
2150
|
-
|
|
2150
|
+
Object.assign(
|
|
2151
2151
|
elementControllers[name].instance,
|
|
2152
2152
|
getControllers(name, require, $element, elementControllers),
|
|
2153
2153
|
);
|
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
|
+
*/
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
import {
|
|
9
|
-
extend,
|
|
10
9
|
forEach,
|
|
11
10
|
tail,
|
|
12
11
|
noop,
|
|
@@ -39,7 +38,7 @@ function stateContext(el) {
|
|
|
39
38
|
/** @hidden */
|
|
40
39
|
function processedDef($state, $element, def) {
|
|
41
40
|
const uiState = def.uiState || $state.current.name;
|
|
42
|
-
const uiStateOpts =
|
|
41
|
+
const uiStateOpts = Object.assign(
|
|
43
42
|
defaultOpts($element, $state),
|
|
44
43
|
def.uiStateOpts || {},
|
|
45
44
|
);
|
|
@@ -283,12 +282,12 @@ export let uiSrefDirective = [
|
|
|
283
282
|
scope.$watch(
|
|
284
283
|
ref.paramExpr,
|
|
285
284
|
function (val) {
|
|
286
|
-
rawDef.uiStateParams =
|
|
285
|
+
rawDef.uiStateParams = Object.assign({}, val);
|
|
287
286
|
update();
|
|
288
287
|
},
|
|
289
288
|
true,
|
|
290
289
|
);
|
|
291
|
-
rawDef.uiStateParams =
|
|
290
|
+
rawDef.uiStateParams = Object.assign({}, scope.$eval(ref.paramExpr));
|
|
292
291
|
}
|
|
293
292
|
update();
|
|
294
293
|
scope.$on("$destroy", $uiRouter.stateRegistry.onStatesChanged(update));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { filter, tail, unnestR } from "../../core/common/common";
|
|
2
2
|
import { isDefined, isFunction, isString } from "../../core/common/predicates";
|
|
3
3
|
import { kebobString } from "../../core/common/strings";
|
|
4
|
-
import { noop } from "../../core/common/common";
|
|
5
4
|
import { parse } from "../../core/common/hof";
|
|
6
5
|
import { ResolveContext } from "../../core/resolve/resolveContext";
|
|
7
6
|
import { trace } from "../../core/common/trace";
|
|
@@ -338,7 +337,7 @@ export function $ViewDirectiveFill(
|
|
|
338
337
|
);
|
|
339
338
|
return;
|
|
340
339
|
}
|
|
341
|
-
const cfg = data.$cfg || { viewDecl: {}, getTemplate:
|
|
340
|
+
const cfg = data.$cfg || { viewDecl: {}, getTemplate: () => {} };
|
|
342
341
|
const resolveCtx = cfg.path && new ResolveContext(cfg.path);
|
|
343
342
|
$element.html(cfg.getTemplate($element, resolveCtx) || initial);
|
|
344
343
|
trace.traceUIViewFill(data.$uiView, $element.html());
|
|
@@ -353,7 +352,7 @@ export function $ViewDirectiveFill(
|
|
|
353
352
|
if (controller) {
|
|
354
353
|
const controllerInstance = $controller(
|
|
355
354
|
controller,
|
|
356
|
-
|
|
355
|
+
Object.assign({}, locals, { $scope: scope, $element: $element }),
|
|
357
356
|
);
|
|
358
357
|
if (controllerAs) {
|
|
359
358
|
scope[controllerAs] = controllerInstance;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { services } from "../core/common/coreservices";
|
|
12
12
|
import { applyPairs, unnestR } from "../core/common/common";
|
|
13
|
-
import { isString
|
|
13
|
+
import { isString } from "../../core/utils";
|
|
14
14
|
import { trace } from "../core/common/trace";
|
|
15
15
|
import { UIRouter } from "../core/router";
|
|
16
16
|
import {
|
|
@@ -100,7 +100,9 @@ export function runBlock($injector, $q, $uiRouter) {
|
|
|
100
100
|
// $state service and $stateProvider
|
|
101
101
|
// $urlRouter service and $urlRouterProvider
|
|
102
102
|
export function getStateProvider() {
|
|
103
|
-
return
|
|
103
|
+
return Object.assign(router.stateProvider, {
|
|
104
|
+
$get: () => router.stateService,
|
|
105
|
+
});
|
|
104
106
|
}
|
|
105
107
|
|
|
106
108
|
watchDigests.$inject = ["$rootScope"];
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/** @publicapi @module ng1 */ /** */
|
|
2
2
|
import { getLocals } from "../services";
|
|
3
3
|
import { services } from "../../core/common/coreservices";
|
|
4
|
-
import { extend } from "../../../core/utils";
|
|
5
4
|
import { ResolveContext } from "../../core/resolve/resolveContext";
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -20,7 +19,7 @@ export const getStateHookBuilder = (hookName) =>
|
|
|
20
19
|
function decoratedNg1Hook(trans, state) {
|
|
21
20
|
const resolveContext = new ResolveContext(trans.treeChanges(pathname));
|
|
22
21
|
const subContext = resolveContext.subContext(state.$$state());
|
|
23
|
-
const locals =
|
|
22
|
+
const locals = Object.assign(getLocals(subContext), {
|
|
24
23
|
$state$: state,
|
|
25
24
|
$transition$: trans,
|
|
26
25
|
});
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import { pick, forEach, tail, extend } from "../../core/common/common";
|
|
1
|
+
import { pick, forEach, tail } from "../../core/common/common";
|
|
3
2
|
import { isArray, isDefined, isString } from "../../../core/utils";
|
|
4
3
|
import { isInjectable } from "../../core/common/predicates";
|
|
5
4
|
import { services } from "../../core/common/coreservices";
|
|
@@ -69,7 +68,7 @@ export function ng1ViewsBuilder(state) {
|
|
|
69
68
|
// Account for views: { header: "headerComponent" }
|
|
70
69
|
if (isString(config)) config = { component: config };
|
|
71
70
|
// Make a shallow copy of the config object
|
|
72
|
-
config =
|
|
71
|
+
config = Object.assign({}, config);
|
|
73
72
|
// Do not allow a view to mix props for component-style view with props for template/controller-style view
|
|
74
73
|
if (hasAnyKey(compKeys, config) && hasAnyKey(nonCompKeys, config)) {
|
|
75
74
|
throw new Error(
|
|
@@ -114,7 +113,7 @@ export class Ng1ViewConfig {
|
|
|
114
113
|
const $q = services.$q;
|
|
115
114
|
const context = new ResolveContext(this.path);
|
|
116
115
|
const params = this.path.reduce(
|
|
117
|
-
(acc, node) =>
|
|
116
|
+
(acc, node) => Object.assign(acc, node.paramValues),
|
|
118
117
|
{},
|
|
119
118
|
);
|
|
120
119
|
const promises = {
|
|
@@ -126,7 +125,7 @@ export class Ng1ViewConfig {
|
|
|
126
125
|
return $q.all(promises).then((results) => {
|
|
127
126
|
trace.traceViewServiceEvent("Loaded", this);
|
|
128
127
|
this.controller = results.controller;
|
|
129
|
-
|
|
128
|
+
Object.assign(this, results.template); // Either { template: "tpl" } or { component: "cmpName" }
|
|
130
129
|
return this;
|
|
131
130
|
});
|
|
132
131
|
}
|
|
@@ -13,12 +13,10 @@ export const root =
|
|
|
13
13
|
(typeof self === "object" && self.self === self && self) ||
|
|
14
14
|
(typeof global === "object" && global.global === global && global) ||
|
|
15
15
|
this;
|
|
16
|
-
const
|
|
17
|
-
export const
|
|
18
|
-
export const
|
|
19
|
-
export const
|
|
20
|
-
export const extend = Object.assign || _extend;
|
|
21
|
-
export const equals = angular.equals || _equals;
|
|
16
|
+
export const fromJson = JSON.parse.bind(JSON);
|
|
17
|
+
export const toJson = JSON.stringify.bind(JSON);
|
|
18
|
+
export const forEach = _forEach;
|
|
19
|
+
export const equals = _equals;
|
|
22
20
|
export function identity(x) {
|
|
23
21
|
return x;
|
|
24
22
|
}
|
|
@@ -102,7 +100,7 @@ export function createProxyFunctions(
|
|
|
102
100
|
* prototypal inheritance helper.
|
|
103
101
|
* Creates a new object which has `parent` object as its prototype, and then copies the properties from `extra` onto it
|
|
104
102
|
*/
|
|
105
|
-
export const inherit = (parent, extra) =>
|
|
103
|
+
export const inherit = (parent, extra) => Object.setPrototypeOf(parent, extra);
|
|
106
104
|
/** Given an array, returns true if the object is found in the array, (using indexOf) */
|
|
107
105
|
export const inArray = curry(_inArray);
|
|
108
106
|
export function _inArray(array, obj) {
|
|
@@ -135,11 +133,11 @@ export const deregAll = (functions) =>
|
|
|
135
133
|
* Earlier objects in the defaultsList take precedence when applying defaults.
|
|
136
134
|
*/
|
|
137
135
|
export function defaults(opts, ...defaultsList) {
|
|
138
|
-
const defaultVals =
|
|
139
|
-
return
|
|
136
|
+
const defaultVals = Object.assign({}, ...defaultsList.reverse());
|
|
137
|
+
return Object.assign(defaultVals, pick(opts || {}, Object.keys(defaultVals)));
|
|
140
138
|
}
|
|
141
139
|
/** Reduce function that merges each element of the list into a single object, using extend */
|
|
142
|
-
export const mergeR = (memo, item) =>
|
|
140
|
+
export const mergeR = (memo, item) => Object.assign(memo, item);
|
|
143
141
|
/**
|
|
144
142
|
* Finds the common ancestor path between two states.
|
|
145
143
|
*
|
|
@@ -441,24 +439,14 @@ export function tail(arr) {
|
|
|
441
439
|
export function copy(src, dest) {
|
|
442
440
|
if (dest) Object.keys(dest).forEach((key) => delete dest[key]);
|
|
443
441
|
if (!dest) dest = {};
|
|
444
|
-
return
|
|
442
|
+
return Object.assign(dest, src);
|
|
445
443
|
}
|
|
446
444
|
/** Naive forEach implementation works with Objects or Arrays */
|
|
447
445
|
function _forEach(obj, cb, _this) {
|
|
448
446
|
if (isArray(obj)) return obj.forEach(cb, _this);
|
|
449
447
|
Object.keys(obj).forEach((key) => cb(obj[key], key));
|
|
450
448
|
}
|
|
451
|
-
|
|
452
|
-
for (let i = 1; i < arguments.length; i++) {
|
|
453
|
-
const obj = arguments[i];
|
|
454
|
-
if (!obj) continue;
|
|
455
|
-
const keys = Object.keys(obj);
|
|
456
|
-
for (let j = 0; j < keys.length; j++) {
|
|
457
|
-
toObj[keys[j]] = obj[keys[j]];
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
return toObj;
|
|
461
|
-
}
|
|
449
|
+
|
|
462
450
|
function _equals(o1, o2) {
|
|
463
451
|
if (o1 === o2) return true;
|
|
464
452
|
if (o1 === null || o2 === null) return false;
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* @packageDocumentation
|
|
4
4
|
*/
|
|
5
5
|
/* tslint:disable:no-console */
|
|
6
|
-
|
|
7
|
-
const noopConsoleStub = { log: noop, error: noop, table: noop };
|
|
6
|
+
const noopConsoleStub = { log: () => {}, error: () => {}, table: () => {} };
|
|
8
7
|
function ie9Console(console) {
|
|
9
8
|
const bound = (fn) => Function.prototype.bind.call(fn, console);
|
|
10
9
|
return {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { noop } from "../common/common";
|
|
2
1
|
import { ResolveContext } from "../resolve/resolveContext";
|
|
3
2
|
import { val } from "../common/hof";
|
|
4
3
|
export const RESOLVE_HOOK_PRIORITY = 1000;
|
|
@@ -14,7 +13,7 @@ export const RESOLVE_HOOK_PRIORITY = 1000;
|
|
|
14
13
|
const eagerResolvePath = (trans) =>
|
|
15
14
|
new ResolveContext(trans.treeChanges().to)
|
|
16
15
|
.resolvePath("EAGER", trans)
|
|
17
|
-
.then(
|
|
16
|
+
.then(() => {});
|
|
18
17
|
export const registerEagerResolvePath = (transitionService) =>
|
|
19
18
|
transitionService.onStart({}, eagerResolvePath, {
|
|
20
19
|
priority: RESOLVE_HOOK_PRIORITY,
|
|
@@ -32,7 +31,7 @@ const lazyResolveState = (trans, state) =>
|
|
|
32
31
|
new ResolveContext(trans.treeChanges().to)
|
|
33
32
|
.subContext(state.$$state())
|
|
34
33
|
.resolvePath("LAZY", trans)
|
|
35
|
-
.then(
|
|
34
|
+
.then(() => {});
|
|
36
35
|
export const registerLazyResolveState = (transitionService) =>
|
|
37
36
|
transitionService.onEnter({ entering: val(true) }, lazyResolveState, {
|
|
38
37
|
priority: RESOLVE_HOOK_PRIORITY,
|
|
@@ -50,7 +49,7 @@ export const registerLazyResolveState = (transitionService) =>
|
|
|
50
49
|
const resolveRemaining = (trans) =>
|
|
51
50
|
new ResolveContext(trans.treeChanges().to)
|
|
52
51
|
.resolvePath("LAZY", trans)
|
|
53
|
-
.then(
|
|
52
|
+
.then(() => {});
|
|
54
53
|
export const registerResolveRemaining = (transitionService) =>
|
|
55
54
|
transitionService.onFinish({}, resolveRemaining, {
|
|
56
55
|
priority: RESOLVE_HOOK_PRIORITY,
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { noop } from "../common/common";
|
|
2
1
|
import { services } from "../common/coreservices";
|
|
3
2
|
/**
|
|
4
3
|
* A [[TransitionHookFn]] which waits for the views to load
|
|
@@ -12,7 +11,9 @@ const loadEnteringViews = (transition) => {
|
|
|
12
11
|
const $q = services.$q;
|
|
13
12
|
const enteringViews = transition.views("entering");
|
|
14
13
|
if (!enteringViews.length) return;
|
|
15
|
-
return $q
|
|
14
|
+
return $q
|
|
15
|
+
.all(enteringViews.map((view) => $q.when(view.load())))
|
|
16
|
+
.then(() => {});
|
|
16
17
|
};
|
|
17
18
|
export const registerLoadEnteringViews = (transitionService) =>
|
|
18
19
|
transitionService.onFinish({}, loadEnteringViews);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { filter, map, allTrueR, find } from "../common/common";
|
|
2
2
|
import { prop } from "../common/hof";
|
|
3
3
|
import {
|
|
4
4
|
isInjectable,
|
|
@@ -29,7 +29,7 @@ function getParamDeclaration(paramName, location, state) {
|
|
|
29
29
|
const paramConfig = unwrapShorthand(
|
|
30
30
|
state && state.params && state.params[paramName],
|
|
31
31
|
);
|
|
32
|
-
return
|
|
32
|
+
return Object.assign(defaultConfig, paramConfig);
|
|
33
33
|
}
|
|
34
34
|
function unwrapShorthand(cfg) {
|
|
35
35
|
cfg = isShorthand(cfg) ? { value: cfg } : cfg;
|
|
@@ -38,7 +38,7 @@ function unwrapShorthand(cfg) {
|
|
|
38
38
|
return cfg.value;
|
|
39
39
|
}
|
|
40
40
|
const $$fn = isInjectable(cfg.value) ? cfg.value : getStaticDefaultValue;
|
|
41
|
-
return
|
|
41
|
+
return Object.assign(cfg, { $$fn });
|
|
42
42
|
}
|
|
43
43
|
function getType(cfg, urlType, location, id, paramTypes) {
|
|
44
44
|
if (cfg.type && urlType && urlType.name !== "string")
|
|
@@ -157,9 +157,9 @@ export class Param {
|
|
|
157
157
|
array: location === DefType.SEARCH ? "auto" : false,
|
|
158
158
|
};
|
|
159
159
|
const arrayParamNomenclature = id.match(/\[\]$/) ? { array: true } : {};
|
|
160
|
-
return
|
|
160
|
+
return Object.assign(arrayDefaults, arrayParamNomenclature, config).array;
|
|
161
161
|
}
|
|
162
|
-
|
|
162
|
+
Object.assign(this, {
|
|
163
163
|
id,
|
|
164
164
|
type,
|
|
165
165
|
location,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { filter, map } from "../common/common";
|
|
2
2
|
import { isArray, isDefined } from "../common/predicates";
|
|
3
3
|
/**
|
|
4
4
|
* An internal class which implements [[ParamTypeDefinition]].
|
|
@@ -34,7 +34,7 @@ export class ParamType {
|
|
|
34
34
|
this.pattern = /.*/;
|
|
35
35
|
/** @inheritdoc */
|
|
36
36
|
this.inherit = true;
|
|
37
|
-
|
|
37
|
+
Object.assign(this, def);
|
|
38
38
|
}
|
|
39
39
|
// consider these four methods to be "abstract methods" that should be overridden
|
|
40
40
|
/** @inheritdoc */
|
|
@@ -127,7 +127,7 @@ function ArrayType(type, mode) {
|
|
|
127
127
|
const wrapperFn = name === "equals" ? arrayEqualsHandler : arrayHandler;
|
|
128
128
|
this[name] = wrapperFn(paramTypeFn);
|
|
129
129
|
});
|
|
130
|
-
|
|
130
|
+
Object.assign(this, {
|
|
131
131
|
dynamic: type.dynamic,
|
|
132
132
|
name: type.name,
|
|
133
133
|
pattern: type.pattern,
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
equals,
|
|
6
6
|
inherit,
|
|
7
7
|
map,
|
|
8
|
-
extend,
|
|
9
8
|
pick,
|
|
10
9
|
} from "../common/common";
|
|
11
10
|
import { isDefined, isNullOrUndefined } from "../common/predicates";
|
|
@@ -52,7 +51,7 @@ export class ParamTypes {
|
|
|
52
51
|
]);
|
|
53
52
|
// Register default types. Store them in the prototype of this.types.
|
|
54
53
|
const makeType = (definition, name) =>
|
|
55
|
-
new ParamType(
|
|
54
|
+
new ParamType(Object.assign({ name }, definition));
|
|
56
55
|
this.types = inherit(map(this.defaultTypes, makeType), {});
|
|
57
56
|
}
|
|
58
57
|
dispose() {
|
|
@@ -65,9 +64,9 @@ export class ParamTypes {
|
|
|
65
64
|
*/
|
|
66
65
|
type(name, definition, definitionFn) {
|
|
67
66
|
if (!isDefined(definition)) return this.types[name];
|
|
68
|
-
if (
|
|
67
|
+
if (Object.prototype.hasOwnProperty.call(this.types, name))
|
|
69
68
|
throw new Error(`A type named '${name}' has already been defined.`);
|
|
70
|
-
this.types[name] = new ParamType(
|
|
69
|
+
this.types[name] = new ParamType(Object.assign({ name }, definition));
|
|
71
70
|
if (definitionFn) {
|
|
72
71
|
this.typeQueue.push({ name, def: definitionFn });
|
|
73
72
|
if (!this.enqueue) this._flushTypeQueue();
|
|
@@ -79,7 +78,7 @@ export class ParamTypes {
|
|
|
79
78
|
const type = this.typeQueue.shift();
|
|
80
79
|
if (type.pattern)
|
|
81
80
|
throw new Error("You cannot override a type's .pattern at runtime.");
|
|
82
|
-
|
|
81
|
+
Object.assign(this.types[type.name], services.$injector.invoke(type.def));
|
|
83
82
|
}
|
|
84
83
|
}
|
|
85
84
|
}
|
|
@@ -94,10 +93,10 @@ function initDefaultTypes() {
|
|
|
94
93
|
// tslint:disable-next-line:triple-equals
|
|
95
94
|
equals: (a, b) => a == b, // allow coersion for null/undefined/""
|
|
96
95
|
};
|
|
97
|
-
return
|
|
96
|
+
return Object.assign({}, defaultTypeBase, def);
|
|
98
97
|
};
|
|
99
98
|
// Default Parameter Type Definitions
|
|
100
|
-
|
|
99
|
+
Object.assign(ParamTypes.prototype, {
|
|
101
100
|
string: makeDefaultType({}),
|
|
102
101
|
path: makeDefaultType({
|
|
103
102
|
pattern: /[^/]*/,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ancestors } from "../common/common";
|
|
2
2
|
export class StateParams {
|
|
3
3
|
constructor(params = {}) {
|
|
4
|
-
|
|
4
|
+
Object.assign(this, params);
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
7
|
* Merges a set of parameters with all parameters inherited between the common parents of the
|
|
@@ -30,6 +30,6 @@ export class StateParams {
|
|
|
30
30
|
inherited[parentParamsKeys[j]] = this[parentParamsKeys[j]];
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
return
|
|
33
|
+
return Object.assign({}, inherited, newParams);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { applyPairs, find } from "../common/common";
|
|
2
2
|
import { propEq } from "../common/hof";
|
|
3
3
|
import { Param } from "../params/param";
|
|
4
4
|
/**
|
|
@@ -14,7 +14,7 @@ export class PathNode {
|
|
|
14
14
|
const node = stateOrNode;
|
|
15
15
|
this.state = node.state;
|
|
16
16
|
this.paramSchema = node.paramSchema.slice();
|
|
17
|
-
this.paramValues =
|
|
17
|
+
this.paramValues = Object.assign({}, node.paramValues);
|
|
18
18
|
this.resolvables = node.resolvables.slice();
|
|
19
19
|
this.views = node.views && node.views.slice();
|
|
20
20
|
} else {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import {
|
|
2
|
-
extend,
|
|
3
2
|
find,
|
|
4
3
|
pick,
|
|
5
4
|
omit,
|
|
@@ -76,7 +75,7 @@ export class PathUtils {
|
|
|
76
75
|
static inheritParams(fromPath, toPath, toKeys = []) {
|
|
77
76
|
function nodeParamVals(path, state) {
|
|
78
77
|
const node = find(path, propEq("state", state));
|
|
79
|
-
return
|
|
78
|
+
return Object.assign({}, node && node.paramValues);
|
|
80
79
|
}
|
|
81
80
|
const noInherit = fromPath
|
|
82
81
|
.map((node) => node.paramSchema)
|
|
@@ -89,7 +88,7 @@ export class PathUtils {
|
|
|
89
88
|
*/
|
|
90
89
|
function makeInheritedParamsNode(toNode) {
|
|
91
90
|
// All param values for the node (may include default key/vals, when key was not found in toParams)
|
|
92
|
-
let toParamVals =
|
|
91
|
+
let toParamVals = Object.assign({}, toNode && toNode.paramValues);
|
|
93
92
|
// limited to only those keys found in toParams
|
|
94
93
|
const incomingParamVals = pick(toParamVals, toKeys);
|
|
95
94
|
toParamVals = omit(toParamVals, toKeys);
|
|
@@ -98,7 +97,7 @@ export class PathUtils {
|
|
|
98
97
|
noInherit,
|
|
99
98
|
);
|
|
100
99
|
// extend toParamVals with any fromParamVals, then override any of those those with incomingParamVals
|
|
101
|
-
const ownParamVals =
|
|
100
|
+
const ownParamVals = Object.assign(
|
|
102
101
|
toParamVals,
|
|
103
102
|
fromParamVals,
|
|
104
103
|
incomingParamVals,
|
|
@@ -196,4 +195,4 @@ PathUtils.nonDynamicParams = (node) =>
|
|
|
196
195
|
node.state.parameters({ inherit: false }).filter((param) => !param.dynamic);
|
|
197
196
|
/** Gets the raw parameter values from a path */
|
|
198
197
|
PathUtils.paramValues = (path) =>
|
|
199
|
-
path.reduce((acc, node) =>
|
|
198
|
+
path.reduce((acc, node) => Object.assign(acc, node.paramValues), {});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { identity } from "../../../core/utils";
|
|
2
2
|
import { services } from "../common/coreservices";
|
|
3
3
|
import { trace } from "../common/trace";
|
|
4
4
|
import { stringify } from "../common/strings";
|
|
@@ -26,7 +26,7 @@ export class Resolvable {
|
|
|
26
26
|
this.resolved = false;
|
|
27
27
|
this.promise = undefined;
|
|
28
28
|
if (arg1 instanceof Resolvable) {
|
|
29
|
-
|
|
29
|
+
Object.assign(this, arg1);
|
|
30
30
|
} else if (isFunction(resolveFn)) {
|
|
31
31
|
if (isNullOrUndefined(arg1))
|
|
32
32
|
throw new Error("new Resolvable(): token argument is required");
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyPairs,
|
|
3
|
-
extend,
|
|
4
3
|
identity,
|
|
5
4
|
inherit,
|
|
6
5
|
mapObj,
|
|
@@ -89,7 +88,7 @@ function pathBuilder(state) {
|
|
|
89
88
|
return state.parent ? state.parent.path.concat(state) : /*root*/ [state];
|
|
90
89
|
}
|
|
91
90
|
function includesBuilder(state) {
|
|
92
|
-
const includes = state.parent ?
|
|
91
|
+
const includes = state.parent ? Object.assign({}, state.parent.includes) : {};
|
|
93
92
|
includes[state.name] = true;
|
|
94
93
|
return includes;
|
|
95
94
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createProxyFunctions,
|
|
3
3
|
defaults,
|
|
4
|
-
extend,
|
|
5
4
|
inArray,
|
|
6
5
|
noop,
|
|
7
6
|
removeFrom,
|
|
@@ -338,7 +337,7 @@ export class StateService {
|
|
|
338
337
|
const globals = router.globals;
|
|
339
338
|
options = defaults(options, defaultTransOpts);
|
|
340
339
|
const getCurrent = () => globals.transition;
|
|
341
|
-
options =
|
|
340
|
+
options = Object.assign(options, { current: getCurrent });
|
|
342
341
|
const ref = this.target(to, toParams, options);
|
|
343
342
|
const currentPath = this.getCurrentPath();
|
|
344
343
|
if (!ref.exists()) return this._handleInvalidTargetState(currentPath, ref);
|
|
@@ -391,7 +390,7 @@ export class StateService {
|
|
|
391
390
|
.catch(rejectedTransitionHandler(transition));
|
|
392
391
|
silenceUncaughtInPromise(transitionToPromise); // issue #2676
|
|
393
392
|
// Return a promise for the transition, which also has the transition object on it.
|
|
394
|
-
return
|
|
393
|
+
return Object.assign(transitionToPromise, { transition });
|
|
395
394
|
}
|
|
396
395
|
/**
|
|
397
396
|
* Checks if the current state *is* the provided state
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { isObject, isString } from "../common/predicates";
|
|
2
2
|
import { stringify } from "../common/strings";
|
|
3
|
-
import { extend } from "../common/common";
|
|
4
3
|
/**
|
|
5
4
|
* Encapsulate the target (destination) state/params/options of a [[Transition]].
|
|
6
5
|
*
|
|
@@ -49,8 +48,8 @@ export class TargetState {
|
|
|
49
48
|
this._stateRegistry = _stateRegistry;
|
|
50
49
|
this._identifier = _identifier;
|
|
51
50
|
this._identifier = _identifier;
|
|
52
|
-
this._params =
|
|
53
|
-
this._options =
|
|
51
|
+
this._params = Object.assign({}, _params || {});
|
|
52
|
+
this._options = Object.assign({}, _options || {});
|
|
54
53
|
this._definition = _stateRegistry.matcher.find(
|
|
55
54
|
_identifier,
|
|
56
55
|
this._options.relative,
|
|
@@ -124,7 +123,9 @@ export class TargetState {
|
|
|
124
123
|
* When true the parameter values will be used instead of the current values.
|
|
125
124
|
*/
|
|
126
125
|
withParams(params, replace = false) {
|
|
127
|
-
const newParams = replace
|
|
126
|
+
const newParams = replace
|
|
127
|
+
? params
|
|
128
|
+
: Object.assign({}, this._params, params);
|
|
128
129
|
return new TargetState(
|
|
129
130
|
this._stateRegistry,
|
|
130
131
|
this._identifier,
|
|
@@ -140,7 +141,9 @@ export class TargetState {
|
|
|
140
141
|
* When true the options will be used instead of the current options.
|
|
141
142
|
*/
|
|
142
143
|
withOptions(options, replace = false) {
|
|
143
|
-
const newOpts = replace
|
|
144
|
+
const newOpts = replace
|
|
145
|
+
? options
|
|
146
|
+
: Object.assign({}, this._options, options);
|
|
144
147
|
return new TargetState(
|
|
145
148
|
this._stateRegistry,
|
|
146
149
|
this._identifier,
|