@ngrdt/router 0.0.95 → 0.0.96
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/fesm2022/ngrdt-router.mjs +87 -22
- package/fesm2022/ngrdt-router.mjs.map +1 -1
- package/index.d.ts +25 -11
- package/package.json +4 -4
package/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import * as i0 from '@angular/core';
|
|
|
2
2
|
import { Provider, EnvironmentProviders, Type, Injector, InjectionToken, OnInit, OnChanges, SimpleChanges, DestroyRef } from '@angular/core';
|
|
3
3
|
import * as i1 from '@angular/router';
|
|
4
4
|
import { LoadChildrenCallback, Route, ResolveFn, CanActivateFn, CanDeactivateFn, CanActivateChildFn, RunGuardsAndResolvers, Data, Params, NavigationEnd, IsActiveMatchOptions, Router } from '@angular/router';
|
|
5
|
+
import * as _ngrdt_router from '@ngrdt/router';
|
|
5
6
|
import { Observable } from 'rxjs';
|
|
6
7
|
|
|
7
8
|
declare class RdtAngularRoute<T extends object> {
|
|
@@ -62,7 +63,7 @@ declare class RdtRouteBase<T extends object> {
|
|
|
62
63
|
protected _parent: RdtRoute | null;
|
|
63
64
|
protected _children: RdtRoute[];
|
|
64
65
|
protected _entryDisabled: boolean;
|
|
65
|
-
protected _canBeEntered:
|
|
66
|
+
protected _canBeEntered: RdtCanBeEnteredFn<T>;
|
|
66
67
|
protected _data: Data;
|
|
67
68
|
/**
|
|
68
69
|
* Data that is passed to Angular route definition.
|
|
@@ -103,7 +104,7 @@ declare class RdtRouteBase<T extends object> {
|
|
|
103
104
|
}
|
|
104
105
|
|
|
105
106
|
declare class RdtRouteBuilder<T extends object = any> extends RdtRouteBase<T> {
|
|
106
|
-
get canBeEntered():
|
|
107
|
+
get canBeEntered(): RdtCanBeEnteredFn<T>;
|
|
107
108
|
get orderedParams(): string[];
|
|
108
109
|
get paramMappings(): ParamMapping[];
|
|
109
110
|
/**
|
|
@@ -113,11 +114,11 @@ declare class RdtRouteBuilder<T extends object = any> extends RdtRouteBase<T> {
|
|
|
113
114
|
* you can inject global services, tokens, etc.
|
|
114
115
|
* @param fn
|
|
115
116
|
*/
|
|
116
|
-
withCanBeEntered(fn:
|
|
117
|
+
withCanBeEntered(fn: RdtCanBeEnteredFn<T>): this;
|
|
117
118
|
/**
|
|
118
119
|
* @deprecated Use withCanBeEntered() instead.
|
|
119
120
|
*/
|
|
120
|
-
setCanBeEntered(fn:
|
|
121
|
+
setCanBeEntered(fn: RdtCanBeEnteredFn<T>): this;
|
|
121
122
|
/**
|
|
122
123
|
* Entry disabled route will generate disabled breadcrumb.
|
|
123
124
|
* It should not have any component nor module added to it.
|
|
@@ -217,13 +218,15 @@ declare class RdtRoute<T extends object = any> extends RdtRouteBase<T> {
|
|
|
217
218
|
* Meta guard that is used by [rdtRouterLink] and RdtMenu
|
|
218
219
|
* to determine if route can be entered.
|
|
219
220
|
* @param injector Environment or custom injector.
|
|
221
|
+
* @param params Optional parameters to pass to guard function.
|
|
220
222
|
* @returns True if route can be entered.
|
|
221
223
|
*/
|
|
222
|
-
canBeEntered(injector?: Injector): boolean;
|
|
224
|
+
canBeEntered(injector?: Injector, combinedParams?: Partial<RdtCombinedRouteParams<T>>): boolean;
|
|
225
|
+
get canBeEnteredFn(): _ngrdt_router.RdtCanBeEnteredFn<T>;
|
|
223
226
|
/**
|
|
224
227
|
* Extracts url parameters from absolute path for this path and each parent.
|
|
225
228
|
*/
|
|
226
|
-
parseAbsoluteUrl(url: string):
|
|
229
|
+
parseAbsoluteUrl(url: string): RdtCombinedRouteParams<T> | null;
|
|
227
230
|
private fill;
|
|
228
231
|
/**
|
|
229
232
|
* Fills parameters in path with values from paramMap.
|
|
@@ -255,6 +258,7 @@ declare class RdtRoute<T extends object = any> extends RdtRouteBase<T> {
|
|
|
255
258
|
* @returns Partial of object that only contains properties necessary to create this route.
|
|
256
259
|
*/
|
|
257
260
|
extractRouteParams(row: T): Partial<T>;
|
|
261
|
+
getStaticParams(): RdtParameters;
|
|
258
262
|
/**
|
|
259
263
|
* @returns New instance of RdtRoute<T> that is clone of
|
|
260
264
|
* this route and its parents (NOT children).
|
|
@@ -282,9 +286,18 @@ declare class RdtParameters {
|
|
|
282
286
|
constructor(params?: StaticRouteParams);
|
|
283
287
|
get<T extends object>(route: RdtRoute<T>): Partial<T> | null;
|
|
284
288
|
set<T extends object>(route: RdtRoute<T>, params: Partial<T>): this;
|
|
289
|
+
append<T extends object>(route: RdtRoute<T>, params: Partial<T>): this;
|
|
290
|
+
setAll(params: RdtParameters): this;
|
|
285
291
|
[Symbol.iterator](): Generator<(string | object)[], void, unknown>;
|
|
286
292
|
}
|
|
287
293
|
type LoadComponentCallback = Route['loadComponent'];
|
|
294
|
+
type RdtCanBeEnteredFn<T extends object> = (route: RdtRoute<T>, params: RdtCombinedRouteParams<T>) => boolean;
|
|
295
|
+
interface RdtCombinedRouteParams<T extends object> {
|
|
296
|
+
params: Partial<T>;
|
|
297
|
+
route: RdtParameters;
|
|
298
|
+
query: Params;
|
|
299
|
+
state: Params;
|
|
300
|
+
}
|
|
288
301
|
|
|
289
302
|
/**
|
|
290
303
|
* Injection token that defines behavior when route cannot be entered (canBeEntered returns false).
|
|
@@ -317,11 +330,11 @@ declare class RdtRouterService {
|
|
|
317
330
|
get currentUrl(): string | null;
|
|
318
331
|
parsePreviousUrl(): {
|
|
319
332
|
route: RdtRoute<any>;
|
|
320
|
-
params:
|
|
333
|
+
params: RdtCombinedRouteParams<any>;
|
|
321
334
|
} | null;
|
|
322
335
|
parseCurrentUrl(): {
|
|
323
336
|
route: RdtRoute<any>;
|
|
324
|
-
params:
|
|
337
|
+
params: RdtCombinedRouteParams<any>;
|
|
325
338
|
} | null;
|
|
326
339
|
readonly navigationEnd$: Observable<NavigationEnd>;
|
|
327
340
|
readonly nextNavigationEnd$: Observable<NavigationEnd>;
|
|
@@ -348,9 +361,9 @@ declare class RdtRouterService {
|
|
|
348
361
|
*/
|
|
349
362
|
parseAbsoluteUrl(url?: string): {
|
|
350
363
|
route: RdtRoute<any>;
|
|
351
|
-
params:
|
|
364
|
+
params: RdtCombinedRouteParams<any>;
|
|
352
365
|
} | null;
|
|
353
|
-
extractAllParams(currentRoute?: RdtRoute):
|
|
366
|
+
extractAllParams(currentRoute?: RdtRoute): RdtCombinedRouteParams<any> | null;
|
|
354
367
|
isParentOfCurrentLocation(route: RdtRoute): boolean;
|
|
355
368
|
removeQueryParams(...paramNames: string[]): void;
|
|
356
369
|
static ɵfac: i0.ɵɵFactoryDeclaration<RdtRouterService, never>;
|
|
@@ -419,6 +432,7 @@ declare class RdtRouterLinkDirective<T extends object> {
|
|
|
419
432
|
readonly queryParams: i0.InputSignal<Params | undefined>;
|
|
420
433
|
readonly stateParams: i0.InputSignal<Params | undefined>;
|
|
421
434
|
readonly disabled: i0.InputSignalWithTransform<boolean, unknown>;
|
|
435
|
+
readonly canBeEntered: i0.Signal<boolean>;
|
|
422
436
|
protected readonly updateEffect: i0.EffectRef;
|
|
423
437
|
private updateButton;
|
|
424
438
|
private setButtonLink;
|
|
@@ -445,4 +459,4 @@ declare class GlobalRouteGuardService {
|
|
|
445
459
|
declare const preventDataLossGuardFn: CanDeactivateFn<any>;
|
|
446
460
|
|
|
447
461
|
export { GlobalRouteGuardService, PERMISSION_DISABLED_KEY, RDT_CANNOT_BE_ENTERED_PROVIDER, RDT_CONFIRM_DATA_LOSS_SERVICE, RDT_ROUTES_PROVIDER, RdtAngularRoute, RdtAnyRouteActiveDirective, RdtBackLinkDirective, RdtConfirmDataLossService, RdtConfirmDataLossServiceAlert, RdtNavigationSource, RdtParameters, RdtRoute, RdtRouteBuilder, RdtRouterLinkDirective, RdtRouterService, preventDataLossGuardFn };
|
|
448
|
-
export type { RdtNavigateExtras };
|
|
462
|
+
export type { RdtCanBeEnteredFn, RdtNavigateExtras };
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngrdt/router",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.96",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": ">=20.0.0",
|
|
6
6
|
"@angular/core": ">=20.0.0",
|
|
7
7
|
"@angular/router": ">=20.0.0",
|
|
8
8
|
"rxjs": ">=7.0.0",
|
|
9
|
-
"@ngrdt/utils": "^0.0.
|
|
10
|
-
"@ngrdt/core": "^0.0.
|
|
11
|
-
"@ngrdt/button": "^0.0.
|
|
9
|
+
"@ngrdt/utils": "^0.0.96",
|
|
10
|
+
"@ngrdt/core": "^0.0.96",
|
|
11
|
+
"@ngrdt/button": "^0.0.96"
|
|
12
12
|
},
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"module": "fesm2022/ngrdt-router.mjs",
|