@worktile/planet 15.1.0 → 16.0.0-next.0
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/CHANGELOG.md +21 -0
- package/esm2020/module.mjs +5 -4
- package/esm2020/router/route-redirect.mjs +50 -10
- package/fesm2015/worktile-planet.mjs +66 -26
- package/fesm2015/worktile-planet.mjs.map +1 -1
- package/fesm2020/worktile-planet.mjs +65 -26
- package/fesm2020/worktile-planet.mjs.map +1 -1
- package/module.d.ts +2 -1
- package/module.d.ts.map +1 -1
- package/package.json +3 -3
- package/router/route-redirect.d.ts +8 -1
- package/router/route-redirect.d.ts.map +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, Injectable, NgZone, Inject, Optional, Component, ChangeDetectionStrategy, Injector, createComponent, reflectComponentType, EventEmitter, Directive, Input, Output,
|
|
2
|
+
import { InjectionToken, Injectable, NgZone, Inject, Optional, Component, ChangeDetectionStrategy, Injector, createComponent, reflectComponentType, EventEmitter, Directive, Input, Output, inject, NgModule } from '@angular/core';
|
|
3
3
|
import * as i3 from '@angular/router';
|
|
4
4
|
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
|
|
5
5
|
import * as i1 from '@angular/common/http';
|
|
@@ -2083,6 +2083,66 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImpor
|
|
|
2083
2083
|
type: Output
|
|
2084
2084
|
}] } });
|
|
2085
2085
|
|
|
2086
|
+
class RouteRedirect {
|
|
2087
|
+
constructor(redirectTo) {
|
|
2088
|
+
this.activatedRoute = inject(ActivatedRoute);
|
|
2089
|
+
this.router = inject(Router);
|
|
2090
|
+
const finalRedirectTo = redirectTo || this.activatedRoute.snapshot.data.redirectTo;
|
|
2091
|
+
if (finalRedirectTo) {
|
|
2092
|
+
const activatedRouteUrl = this.activatedRoute.pathFromRoot
|
|
2093
|
+
.filter(route => {
|
|
2094
|
+
return route.snapshot.url?.length > 0;
|
|
2095
|
+
})
|
|
2096
|
+
.map(route => {
|
|
2097
|
+
return route.snapshot.url.join('/');
|
|
2098
|
+
})
|
|
2099
|
+
.join('/');
|
|
2100
|
+
if (this.router.isActive(activatedRouteUrl, {
|
|
2101
|
+
matrixParams: 'exact',
|
|
2102
|
+
paths: 'exact',
|
|
2103
|
+
queryParams: 'exact',
|
|
2104
|
+
fragment: 'exact'
|
|
2105
|
+
})) {
|
|
2106
|
+
this.router.navigate([`${finalRedirectTo}`],
|
|
2107
|
+
// By replacing the current URL in the history, we keep the Browser's Back
|
|
2108
|
+
// Button behavior in tact. This will allow the user to easily navigate back
|
|
2109
|
+
// to the previous URL without getting caught in a redirect.
|
|
2110
|
+
{
|
|
2111
|
+
replaceUrl: true,
|
|
2112
|
+
relativeTo: this.activatedRoute
|
|
2113
|
+
});
|
|
2114
|
+
}
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
function routeRedirect(redirectTo) {
|
|
2119
|
+
return new RouteRedirect(redirectTo);
|
|
2120
|
+
}
|
|
2121
|
+
class RedirectToRouteComponent {
|
|
2122
|
+
constructor() {
|
|
2123
|
+
this.routeRedirect = routeRedirect();
|
|
2124
|
+
}
|
|
2125
|
+
}
|
|
2126
|
+
RedirectToRouteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: RedirectToRouteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2127
|
+
RedirectToRouteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.5", type: RedirectToRouteComponent, isStandalone: true, selector: "planet-redirect-to-route", ngImport: i0, template: '', isInline: true });
|
|
2128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: RedirectToRouteComponent, decorators: [{
|
|
2129
|
+
type: Component,
|
|
2130
|
+
args: [{
|
|
2131
|
+
selector: 'planet-redirect-to-route',
|
|
2132
|
+
template: '',
|
|
2133
|
+
standalone: true
|
|
2134
|
+
}]
|
|
2135
|
+
}] });
|
|
2136
|
+
function redirectToRoute(redirectTo) {
|
|
2137
|
+
return {
|
|
2138
|
+
path: '',
|
|
2139
|
+
component: RedirectToRouteComponent,
|
|
2140
|
+
data: {
|
|
2141
|
+
redirectTo: redirectTo
|
|
2142
|
+
}
|
|
2143
|
+
};
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2086
2146
|
class NgxPlanetModule {
|
|
2087
2147
|
static forRoot(apps) {
|
|
2088
2148
|
return {
|
|
@@ -2097,13 +2157,13 @@ class NgxPlanetModule {
|
|
|
2097
2157
|
}
|
|
2098
2158
|
}
|
|
2099
2159
|
NgxPlanetModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgxPlanetModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
2100
|
-
NgxPlanetModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: NgxPlanetModule, imports: [HttpClientModule, PlanetComponentOutlet, EmptyComponent], exports: [HttpClientModule, EmptyComponent, PlanetComponentOutlet] });
|
|
2101
|
-
NgxPlanetModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgxPlanetModule, imports: [HttpClientModule, EmptyComponent, HttpClientModule] });
|
|
2160
|
+
NgxPlanetModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.5", ngImport: i0, type: NgxPlanetModule, imports: [HttpClientModule, PlanetComponentOutlet, EmptyComponent, RedirectToRouteComponent], exports: [HttpClientModule, EmptyComponent, PlanetComponentOutlet] });
|
|
2161
|
+
NgxPlanetModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgxPlanetModule, imports: [HttpClientModule, EmptyComponent, RedirectToRouteComponent, HttpClientModule] });
|
|
2102
2162
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.5", ngImport: i0, type: NgxPlanetModule, decorators: [{
|
|
2103
2163
|
type: NgModule,
|
|
2104
2164
|
args: [{
|
|
2105
2165
|
declarations: [],
|
|
2106
|
-
imports: [HttpClientModule, PlanetComponentOutlet, EmptyComponent],
|
|
2166
|
+
imports: [HttpClientModule, PlanetComponentOutlet, EmptyComponent, RedirectToRouteComponent],
|
|
2107
2167
|
providers: [],
|
|
2108
2168
|
exports: [HttpClientModule, EmptyComponent, PlanetComponentOutlet]
|
|
2109
2169
|
}]
|
|
@@ -2116,27 +2176,6 @@ class PlantComponentConfig {
|
|
|
2116
2176
|
}
|
|
2117
2177
|
}
|
|
2118
2178
|
|
|
2119
|
-
class RouteRedirect {
|
|
2120
|
-
constructor(redirectTo) {
|
|
2121
|
-
this.activatedRoute = inject(ActivatedRoute);
|
|
2122
|
-
this.router = inject(Router);
|
|
2123
|
-
const finalRedirectTo = redirectTo || this.activatedRoute.snapshot.data.redirectTo;
|
|
2124
|
-
if (finalRedirectTo) {
|
|
2125
|
-
this.router.navigate([`${finalRedirectTo}`],
|
|
2126
|
-
// By replacing the current URL in the history, we keep the Browser's Back
|
|
2127
|
-
// Button behavior in tact. This will allow the user to easily navigate back
|
|
2128
|
-
// to the previous URL without getting caught in a redirect.
|
|
2129
|
-
{
|
|
2130
|
-
replaceUrl: true,
|
|
2131
|
-
relativeTo: this.activatedRoute
|
|
2132
|
-
});
|
|
2133
|
-
}
|
|
2134
|
-
}
|
|
2135
|
-
}
|
|
2136
|
-
function routeRedirect(redirectTo) {
|
|
2137
|
-
return new RouteRedirect(redirectTo);
|
|
2138
|
-
}
|
|
2139
|
-
|
|
2140
2179
|
/*
|
|
2141
2180
|
* Public API Surface of core
|
|
2142
2181
|
*/
|
|
@@ -2145,5 +2184,5 @@ function routeRedirect(redirectTo) {
|
|
|
2145
2184
|
* Generated bundle index. Do not edit.
|
|
2146
2185
|
*/
|
|
2147
2186
|
|
|
2148
|
-
export { ApplicationStatus, AssetsLoader, EmptyComponent, GlobalEventDispatcher, NgxPlanetModule, PLANET_APPLICATIONS, Planet, PlanetApplicationLoader, PlanetApplicationRef, PlanetApplicationService, PlanetComponentLoader, PlanetComponentOutlet, PlanetComponentRef, PlanetPortalApplication, PlantComponentConfig, SwitchModes, defineApplication, getPlanetApplicationRef, getPortalApplicationData, routeRedirect };
|
|
2187
|
+
export { ApplicationStatus, AssetsLoader, EmptyComponent, GlobalEventDispatcher, NgxPlanetModule, PLANET_APPLICATIONS, Planet, PlanetApplicationLoader, PlanetApplicationRef, PlanetApplicationService, PlanetComponentLoader, PlanetComponentOutlet, PlanetComponentRef, PlanetPortalApplication, PlantComponentConfig, RedirectToRouteComponent, SwitchModes, defineApplication, getPlanetApplicationRef, getPortalApplicationData, redirectToRoute, routeRedirect };
|
|
2149
2188
|
//# sourceMappingURL=worktile-planet.mjs.map
|