1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.treeChangesCleanup = exports.registerAddCoreResolvables = void 0;
|
4 | var transition_1 = require("../transition/transition");
|
5 | var router_1 = require("../router");
|
6 | var resolve_1 = require("../resolve");
|
7 | var common_1 = require("../common");
|
8 | function addCoreResolvables(trans) {
|
9 | trans.addResolvable(resolve_1.Resolvable.fromData(router_1.UIRouter, trans.router), '');
|
10 | trans.addResolvable(resolve_1.Resolvable.fromData(transition_1.Transition, trans), '');
|
11 | trans.addResolvable(resolve_1.Resolvable.fromData('$transition$', trans), '');
|
12 | trans.addResolvable(resolve_1.Resolvable.fromData('$stateParams', trans.params()), '');
|
13 | trans.entering().forEach(function (state) {
|
14 | trans.addResolvable(resolve_1.Resolvable.fromData('$state$', state), state);
|
15 | });
|
16 | }
|
17 | exports.registerAddCoreResolvables = function (transitionService) {
|
18 | return transitionService.onCreate({}, addCoreResolvables);
|
19 | };
|
20 | var TRANSITION_TOKENS = ['$transition$', transition_1.Transition];
|
21 | var isTransition = common_1.inArray(TRANSITION_TOKENS);
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | exports.treeChangesCleanup = function (trans) {
|
27 | var nodes = common_1.values(trans.treeChanges()).reduce(common_1.unnestR, []).reduce(common_1.uniqR, []);
|
28 |
|
29 | var replaceTransitionWithNull = function (r) {
|
30 | return isTransition(r.token) ? resolve_1.Resolvable.fromData(r.token, null) : r;
|
31 | };
|
32 | nodes.forEach(function (node) {
|
33 | node.resolvables = node.resolvables.map(replaceTransitionWithNull);
|
34 | });
|
35 | };
|
36 |
|
\ | No newline at end of file |