source: trip-planner-front/node_modules/@angular/router/esm2015/src/router_state.js@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 47.1 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8import { BehaviorSubject } from 'rxjs';
9import { map } from 'rxjs/operators';
10import { convertToParamMap, PRIMARY_OUTLET } from './shared';
11import { equalSegments, UrlSegment } from './url_tree';
12import { shallowEqual, shallowEqualArrays } from './utils/collection';
13import { Tree, TreeNode } from './utils/tree';
14/**
15 * Represents the state of the router as a tree of activated routes.
16 *
17 * @usageNotes
18 *
19 * Every node in the route tree is an `ActivatedRoute` instance
20 * that knows about the "consumed" URL segments, the extracted parameters,
21 * and the resolved data.
22 * Use the `ActivatedRoute` properties to traverse the tree from any node.
23 *
24 * The following fragment shows how a component gets the root node
25 * of the current state to establish its own route tree:
26 *
27 * ```
28 * @Component({templateUrl:'template.html'})
29 * class MyComponent {
30 * constructor(router: Router) {
31 * const state: RouterState = router.routerState;
32 * const root: ActivatedRoute = state.root;
33 * const child = root.firstChild;
34 * const id: Observable<string> = child.params.map(p => p.id);
35 * //...
36 * }
37 * }
38 * ```
39 *
40 * @see `ActivatedRoute`
41 * @see [Getting route information](guide/router#getting-route-information)
42 *
43 * @publicApi
44 */
45export class RouterState extends Tree {
46 /** @internal */
47 constructor(root,
48 /** The current snapshot of the router state */
49 snapshot) {
50 super(root);
51 this.snapshot = snapshot;
52 setRouterState(this, root);
53 }
54 toString() {
55 return this.snapshot.toString();
56 }
57}
58export function createEmptyState(urlTree, rootComponent) {
59 const snapshot = createEmptyStateSnapshot(urlTree, rootComponent);
60 const emptyUrl = new BehaviorSubject([new UrlSegment('', {})]);
61 const emptyParams = new BehaviorSubject({});
62 const emptyData = new BehaviorSubject({});
63 const emptyQueryParams = new BehaviorSubject({});
64 const fragment = new BehaviorSubject('');
65 const activated = new ActivatedRoute(emptyUrl, emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, snapshot.root);
66 activated.snapshot = snapshot.root;
67 return new RouterState(new TreeNode(activated, []), snapshot);
68}
69export function createEmptyStateSnapshot(urlTree, rootComponent) {
70 const emptyParams = {};
71 const emptyData = {};
72 const emptyQueryParams = {};
73 const fragment = '';
74 const activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, urlTree.root, -1, {});
75 return new RouterStateSnapshot('', new TreeNode(activated, []));
76}
77/**
78 * Provides access to information about a route associated with a component
79 * that is loaded in an outlet.
80 * Use to traverse the `RouterState` tree and extract information from nodes.
81 *
82 * The following example shows how to construct a component using information from a
83 * currently activated route.
84 *
85 * Note: the observables in this class only emit when the current and previous values differ based
86 * on shallow equality. For example, changing deeply nested properties in resolved `data` will not
87 * cause the `ActivatedRoute.data` `Observable` to emit a new value.
88 *
89 * {@example router/activated-route/module.ts region="activated-route"
90 * header="activated-route.component.ts"}
91 *
92 * @see [Getting route information](guide/router#getting-route-information)
93 *
94 * @publicApi
95 */
96export class ActivatedRoute {
97 /** @internal */
98 constructor(
99 /** An observable of the URL segments matched by this route. */
100 url,
101 /** An observable of the matrix parameters scoped to this route. */
102 params,
103 /** An observable of the query parameters shared by all the routes. */
104 queryParams,
105 /** An observable of the URL fragment shared by all the routes. */
106 fragment,
107 /** An observable of the static and resolved data of this route. */
108 data,
109 /** The outlet name of the route, a constant. */
110 outlet,
111 /** The component of the route, a constant. */
112 // TODO(vsavkin): remove |string
113 component, futureSnapshot) {
114 this.url = url;
115 this.params = params;
116 this.queryParams = queryParams;
117 this.fragment = fragment;
118 this.data = data;
119 this.outlet = outlet;
120 this.component = component;
121 this._futureSnapshot = futureSnapshot;
122 }
123 /** The configuration used to match this route. */
124 get routeConfig() {
125 return this._futureSnapshot.routeConfig;
126 }
127 /** The root of the router state. */
128 get root() {
129 return this._routerState.root;
130 }
131 /** The parent of this route in the router state tree. */
132 get parent() {
133 return this._routerState.parent(this);
134 }
135 /** The first child of this route in the router state tree. */
136 get firstChild() {
137 return this._routerState.firstChild(this);
138 }
139 /** The children of this route in the router state tree. */
140 get children() {
141 return this._routerState.children(this);
142 }
143 /** The path from the root of the router state tree to this route. */
144 get pathFromRoot() {
145 return this._routerState.pathFromRoot(this);
146 }
147 /**
148 * An Observable that contains a map of the required and optional parameters
149 * specific to the route.
150 * The map supports retrieving single and multiple values from the same parameter.
151 */
152 get paramMap() {
153 if (!this._paramMap) {
154 this._paramMap = this.params.pipe(map((p) => convertToParamMap(p)));
155 }
156 return this._paramMap;
157 }
158 /**
159 * An Observable that contains a map of the query parameters available to all routes.
160 * The map supports retrieving single and multiple values from the query parameter.
161 */
162 get queryParamMap() {
163 if (!this._queryParamMap) {
164 this._queryParamMap =
165 this.queryParams.pipe(map((p) => convertToParamMap(p)));
166 }
167 return this._queryParamMap;
168 }
169 toString() {
170 return this.snapshot ? this.snapshot.toString() : `Future(${this._futureSnapshot})`;
171 }
172}
173/**
174 * Returns the inherited params, data, and resolve for a given route.
175 * By default, this only inherits values up to the nearest path-less or component-less route.
176 * @internal
177 */
178export function inheritedParamsDataResolve(route, paramsInheritanceStrategy = 'emptyOnly') {
179 const pathFromRoot = route.pathFromRoot;
180 let inheritingStartingFrom = 0;
181 if (paramsInheritanceStrategy !== 'always') {
182 inheritingStartingFrom = pathFromRoot.length - 1;
183 while (inheritingStartingFrom >= 1) {
184 const current = pathFromRoot[inheritingStartingFrom];
185 const parent = pathFromRoot[inheritingStartingFrom - 1];
186 // current route is an empty path => inherits its parent's params and data
187 if (current.routeConfig && current.routeConfig.path === '') {
188 inheritingStartingFrom--;
189 // parent is componentless => current route should inherit its params and data
190 }
191 else if (!parent.component) {
192 inheritingStartingFrom--;
193 }
194 else {
195 break;
196 }
197 }
198 }
199 return flattenInherited(pathFromRoot.slice(inheritingStartingFrom));
200}
201/** @internal */
202function flattenInherited(pathFromRoot) {
203 return pathFromRoot.reduce((res, curr) => {
204 const params = Object.assign(Object.assign({}, res.params), curr.params);
205 const data = Object.assign(Object.assign({}, res.data), curr.data);
206 const resolve = Object.assign(Object.assign({}, res.resolve), curr._resolvedData);
207 return { params, data, resolve };
208 }, { params: {}, data: {}, resolve: {} });
209}
210/**
211 * @description
212 *
213 * Contains the information about a route associated with a component loaded in an
214 * outlet at a particular moment in time. ActivatedRouteSnapshot can also be used to
215 * traverse the router state tree.
216 *
217 * The following example initializes a component with route information extracted
218 * from the snapshot of the root node at the time of creation.
219 *
220 * ```
221 * @Component({templateUrl:'./my-component.html'})
222 * class MyComponent {
223 * constructor(route: ActivatedRoute) {
224 * const id: string = route.snapshot.params.id;
225 * const url: string = route.snapshot.url.join('');
226 * const user = route.snapshot.data.user;
227 * }
228 * }
229 * ```
230 *
231 * @publicApi
232 */
233export class ActivatedRouteSnapshot {
234 /** @internal */
235 constructor(
236 /** The URL segments matched by this route */
237 url,
238 /**
239 * The matrix parameters scoped to this route.
240 *
241 * You can compute all params (or data) in the router state or to get params outside
242 * of an activated component by traversing the `RouterState` tree as in the following
243 * example:
244 * ```
245 * collectRouteParams(router: Router) {
246 * let params = {};
247 * let stack: ActivatedRouteSnapshot[] = [router.routerState.snapshot.root];
248 * while (stack.length > 0) {
249 * const route = stack.pop()!;
250 * params = {...params, ...route.params};
251 * stack.push(...route.children);
252 * }
253 * return params;
254 * }
255 * ```
256 */
257 params,
258 /** The query parameters shared by all the routes */
259 queryParams,
260 /** The URL fragment shared by all the routes */
261 fragment,
262 /** The static and resolved data of this route */
263 data,
264 /** The outlet name of the route */
265 outlet,
266 /** The component of the route */
267 component, routeConfig, urlSegment, lastPathIndex, resolve) {
268 this.url = url;
269 this.params = params;
270 this.queryParams = queryParams;
271 this.fragment = fragment;
272 this.data = data;
273 this.outlet = outlet;
274 this.component = component;
275 this.routeConfig = routeConfig;
276 this._urlSegment = urlSegment;
277 this._lastPathIndex = lastPathIndex;
278 this._resolve = resolve;
279 }
280 /** The root of the router state */
281 get root() {
282 return this._routerState.root;
283 }
284 /** The parent of this route in the router state tree */
285 get parent() {
286 return this._routerState.parent(this);
287 }
288 /** The first child of this route in the router state tree */
289 get firstChild() {
290 return this._routerState.firstChild(this);
291 }
292 /** The children of this route in the router state tree */
293 get children() {
294 return this._routerState.children(this);
295 }
296 /** The path from the root of the router state tree to this route */
297 get pathFromRoot() {
298 return this._routerState.pathFromRoot(this);
299 }
300 get paramMap() {
301 if (!this._paramMap) {
302 this._paramMap = convertToParamMap(this.params);
303 }
304 return this._paramMap;
305 }
306 get queryParamMap() {
307 if (!this._queryParamMap) {
308 this._queryParamMap = convertToParamMap(this.queryParams);
309 }
310 return this._queryParamMap;
311 }
312 toString() {
313 const url = this.url.map(segment => segment.toString()).join('/');
314 const matched = this.routeConfig ? this.routeConfig.path : '';
315 return `Route(url:'${url}', path:'${matched}')`;
316 }
317}
318/**
319 * @description
320 *
321 * Represents the state of the router at a moment in time.
322 *
323 * This is a tree of activated route snapshots. Every node in this tree knows about
324 * the "consumed" URL segments, the extracted parameters, and the resolved data.
325 *
326 * The following example shows how a component is initialized with information
327 * from the snapshot of the root node's state at the time of creation.
328 *
329 * ```
330 * @Component({templateUrl:'template.html'})
331 * class MyComponent {
332 * constructor(router: Router) {
333 * const state: RouterState = router.routerState;
334 * const snapshot: RouterStateSnapshot = state.snapshot;
335 * const root: ActivatedRouteSnapshot = snapshot.root;
336 * const child = root.firstChild;
337 * const id: Observable<string> = child.params.map(p => p.id);
338 * //...
339 * }
340 * }
341 * ```
342 *
343 * @publicApi
344 */
345export class RouterStateSnapshot extends Tree {
346 /** @internal */
347 constructor(
348 /** The url from which this snapshot was created */
349 url, root) {
350 super(root);
351 this.url = url;
352 setRouterState(this, root);
353 }
354 toString() {
355 return serializeNode(this._root);
356 }
357}
358function setRouterState(state, node) {
359 node.value._routerState = state;
360 node.children.forEach(c => setRouterState(state, c));
361}
362function serializeNode(node) {
363 const c = node.children.length > 0 ? ` { ${node.children.map(serializeNode).join(', ')} } ` : '';
364 return `${node.value}${c}`;
365}
366/**
367 * The expectation is that the activate route is created with the right set of parameters.
368 * So we push new values into the observables only when they are not the initial values.
369 * And we detect that by checking if the snapshot field is set.
370 */
371export function advanceActivatedRoute(route) {
372 if (route.snapshot) {
373 const currentSnapshot = route.snapshot;
374 const nextSnapshot = route._futureSnapshot;
375 route.snapshot = nextSnapshot;
376 if (!shallowEqual(currentSnapshot.queryParams, nextSnapshot.queryParams)) {
377 route.queryParams.next(nextSnapshot.queryParams);
378 }
379 if (currentSnapshot.fragment !== nextSnapshot.fragment) {
380 route.fragment.next(nextSnapshot.fragment);
381 }
382 if (!shallowEqual(currentSnapshot.params, nextSnapshot.params)) {
383 route.params.next(nextSnapshot.params);
384 }
385 if (!shallowEqualArrays(currentSnapshot.url, nextSnapshot.url)) {
386 route.url.next(nextSnapshot.url);
387 }
388 if (!shallowEqual(currentSnapshot.data, nextSnapshot.data)) {
389 route.data.next(nextSnapshot.data);
390 }
391 }
392 else {
393 route.snapshot = route._futureSnapshot;
394 // this is for resolved data
395 route.data.next(route._futureSnapshot.data);
396 }
397}
398export function equalParamsAndUrlSegments(a, b) {
399 const equalUrlParams = shallowEqual(a.params, b.params) && equalSegments(a.url, b.url);
400 const parentsMismatch = !a.parent !== !b.parent;
401 return equalUrlParams && !parentsMismatch &&
402 (!a.parent || equalParamsAndUrlSegments(a.parent, b.parent));
403}
404//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicm91dGVyX3N0YXRlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvcm91dGVyL3NyYy9yb3V0ZXJfc3RhdGUudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBR0gsT0FBTyxFQUFDLGVBQWUsRUFBYSxNQUFNLE1BQU0sQ0F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nQ7XG5cbiAgcmV0dXJuIGVxdWFsVXJsUGFyYW1zICYmICFwYXJlbnRzTWlzbWF0Y2ggJiZcbiAgICAgICghYS5wYXJlbnQgfHwgZXF1YWxQYXJhbXNBbmRVcmxTZWdtZW50cyhhLnBhcmVudCwgYi5wYXJlbnQhKSk7XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.