@luigi-project/client-support-angular 2.17.1-dev.20241160030 → 2.17.1-dev.20241181435
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/esm2022/lib/component/luigi.preload.component.mjs +11 -0
- package/esm2022/lib/luigi-mock/luigi-mock.module.mjs +40 -0
- package/esm2022/lib/luigi.angular.support.module.mjs +70 -0
- package/esm2022/lib/route/luigi-activated-route-snapshot-helper.mjs +11 -0
- package/esm2022/lib/service/luigi-auto-routing.service.mjs +137 -0
- package/esm2022/lib/service/luigi-context.model.mjs +6 -0
- package/esm2022/lib/service/luigi-context.service.impl.mjs +76 -0
- package/esm2022/lib/service/luigi-context.service.mjs +3 -0
- package/esm2022/public-api.mjs +11 -0
- package/{fesm2020 → fesm2022}/luigi-project-client-support-angular.mjs +166 -169
- package/fesm2022/luigi-project-client-support-angular.mjs.map +1 -0
- package/lib/component/luigi.preload.component.d.ts +2 -5
- package/lib/luigi.angular.support.module.d.ts +0 -3
- package/lib/service/luigi-auto-routing.service.d.ts +5 -7
- package/lib/service/luigi-context.model.d.ts +9 -0
- package/lib/service/{luigi-context-service.d.ts → luigi-context.service.d.ts} +1 -8
- package/lib/service/luigi-context.service.impl.d.ts +6 -6
- package/package.json +7 -13
- package/public-api.d.ts +4 -3
- package/esm2020/lib/component/luigi.preload.component.mjs +0 -13
- package/esm2020/lib/luigi-mock/luigi-mock.module.mjs +0 -40
- package/esm2020/lib/luigi.angular.support.module.mjs +0 -70
- package/esm2020/lib/route/luigi-activated-route-snapshot-helper.mjs +0 -11
- package/esm2020/lib/service/luigi-auto-routing.service.mjs +0 -141
- package/esm2020/lib/service/luigi-context-service.mjs +0 -8
- package/esm2020/lib/service/luigi-context.service.impl.mjs +0 -77
- package/esm2020/public-api.mjs +0 -10
- package/fesm2015/luigi-project-client-support-angular.mjs +0 -357
- package/fesm2015/luigi-project-client-support-angular.mjs.map +0 -1
- package/fesm2020/luigi-project-client-support-angular.mjs.map +0 -1
- /package/{esm2020 → esm2022}/lib/route/luigi-route-strategy.mjs +0 -0
- /package/{esm2020 → esm2022}/luigi-project-client-support-angular.mjs +0 -0
|
@@ -1,25 +1,80 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { Component,
|
|
2
|
+
import { Component, APP_INITIALIZER, NgModule, inject, NgZone, Injectable, DestroyRef } from '@angular/core';
|
|
3
|
+
import { LuigiMockEngine } from '@luigi-project/testing-utilities';
|
|
3
4
|
import * as i1 from '@angular/router';
|
|
4
|
-
import { BaseRouteReuseStrategy,
|
|
5
|
-
import { ReplaySubject, Subscription } from 'rxjs';
|
|
6
|
-
import { first, filter } from 'rxjs/operators';
|
|
5
|
+
import { BaseRouteReuseStrategy, RouteReuseStrategy, RouterModule, NavigationEnd, convertToParamMap } from '@angular/router';
|
|
7
6
|
import { addInitListener, addContextUpdateListener, isLuigiClientInitialized, uxManager, linkManager } from '@luigi-project/client';
|
|
8
|
-
import {
|
|
7
|
+
import { ReplaySubject } from 'rxjs';
|
|
8
|
+
import { first, filter } from 'rxjs/operators';
|
|
9
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
9
10
|
|
|
10
11
|
class LuigiPreloadComponent {
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiPreloadComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
13
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "18.2.10", type: LuigiPreloadComponent, selector: "lib-client-support-angular", ngImport: i0, template: "<p luigipreload=\"luigipreload\"></p>\n" });
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
-
LuigiPreloadComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: LuigiPreloadComponent, selector: "lib-client-support-angular", ngImport: i0, template: "<p luigipreload=\"luigipreload\"></p>\n" });
|
|
16
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LuigiPreloadComponent, decorators: [{
|
|
15
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiPreloadComponent, decorators: [{
|
|
17
16
|
type: Component,
|
|
18
17
|
args: [{ selector: 'lib-client-support-angular', template: "<p luigipreload=\"luigipreload\"></p>\n" }]
|
|
19
|
-
}]
|
|
18
|
+
}] });
|
|
19
|
+
|
|
20
|
+
// @dynamic
|
|
21
|
+
/*
|
|
22
|
+
* This class mocks Luigi Core related functionality.
|
|
23
|
+
*
|
|
24
|
+
* Micro Frontends that use Luigi Client would usually communicate with Luigi Core
|
|
25
|
+
* back and forth. When testing Luigi Client based components, Luigi Core might
|
|
26
|
+
* not be present which leads into limitations on integration/e2e testing for standalone
|
|
27
|
+
* microfrontends.
|
|
28
|
+
*
|
|
29
|
+
* This module adds a hook to the window postMessage API by adding an event listener to the
|
|
30
|
+
* global message event of the window object and mocking the callback.
|
|
31
|
+
* In the normal workflow this message would picked up by Luigi Core which then sends the response back.
|
|
32
|
+
*/
|
|
33
|
+
class LuigiMockModule {
|
|
34
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
35
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.10", ngImport: i0, type: LuigiMockModule });
|
|
36
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiMockModule, providers: [
|
|
37
|
+
{
|
|
38
|
+
provide: APP_INITIALIZER,
|
|
39
|
+
useFactory: LuigiMockEngine.initPostMessageHook,
|
|
40
|
+
multi: true
|
|
41
|
+
}
|
|
42
|
+
] });
|
|
43
|
+
}
|
|
44
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiMockModule, decorators: [{
|
|
45
|
+
type: NgModule,
|
|
46
|
+
args: [{
|
|
47
|
+
providers: [
|
|
48
|
+
{
|
|
49
|
+
provide: APP_INITIALIZER,
|
|
50
|
+
useFactory: LuigiMockEngine.initPostMessageHook,
|
|
51
|
+
multi: true
|
|
52
|
+
}
|
|
53
|
+
]
|
|
54
|
+
}]
|
|
55
|
+
}] });
|
|
56
|
+
|
|
57
|
+
class LuigiActivatedRouteSnapshotHelper {
|
|
58
|
+
// tslint:disable-next-line:variable-name
|
|
59
|
+
static _current = null;
|
|
60
|
+
static getCurrent() {
|
|
61
|
+
return LuigiActivatedRouteSnapshotHelper._current;
|
|
62
|
+
}
|
|
63
|
+
static setCurrent(current) {
|
|
64
|
+
LuigiActivatedRouteSnapshotHelper._current = current;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
class LuigiRouteStrategy extends BaseRouteReuseStrategy {
|
|
69
|
+
retrieve(route) {
|
|
70
|
+
LuigiActivatedRouteSnapshotHelper.setCurrent(route);
|
|
71
|
+
return super.retrieve(route);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
20
74
|
|
|
21
75
|
class LuigiContextService {
|
|
22
76
|
}
|
|
77
|
+
|
|
23
78
|
var ILuigiContextTypes;
|
|
24
79
|
(function (ILuigiContextTypes) {
|
|
25
80
|
ILuigiContextTypes[ILuigiContextTypes["INIT"] = 0] = "INIT";
|
|
@@ -27,17 +82,23 @@ var ILuigiContextTypes;
|
|
|
27
82
|
})(ILuigiContextTypes || (ILuigiContextTypes = {}));
|
|
28
83
|
|
|
29
84
|
class LuigiContextServiceImpl {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
addInitListener(initContext => {
|
|
85
|
+
subject = new ReplaySubject(1);
|
|
86
|
+
currentContext;
|
|
87
|
+
ngZone = inject(NgZone);
|
|
88
|
+
constructor() {
|
|
89
|
+
addInitListener((initContext) => {
|
|
35
90
|
this.addListener(ILuigiContextTypes.INIT, initContext);
|
|
36
91
|
});
|
|
37
|
-
addContextUpdateListener(updateContext => {
|
|
92
|
+
addContextUpdateListener((updateContext) => {
|
|
38
93
|
this.addListener(ILuigiContextTypes.UPDATE, updateContext);
|
|
39
94
|
});
|
|
40
95
|
}
|
|
96
|
+
addListener(contextType, context) {
|
|
97
|
+
this.setContext({
|
|
98
|
+
contextType,
|
|
99
|
+
context
|
|
100
|
+
});
|
|
101
|
+
}
|
|
41
102
|
contextObservable() {
|
|
42
103
|
return this.subject.asObservable();
|
|
43
104
|
}
|
|
@@ -45,22 +106,21 @@ class LuigiContextServiceImpl {
|
|
|
45
106
|
* Get latest context object retrieved from luigi core application or empty object, if not yet set.
|
|
46
107
|
*/
|
|
47
108
|
getContext() {
|
|
48
|
-
return
|
|
109
|
+
return this.currentContext?.context || {};
|
|
49
110
|
}
|
|
50
111
|
/**
|
|
51
112
|
* Get a promise that resolves when context is set.
|
|
52
113
|
*/
|
|
53
114
|
getContextAsync() {
|
|
54
|
-
return new Promise((resolve
|
|
55
|
-
|
|
115
|
+
return new Promise((resolve) => {
|
|
116
|
+
const context = this.getContext();
|
|
117
|
+
if (this.isObject(context) && Object.keys(context)?.length) {
|
|
56
118
|
resolve(this.getContext());
|
|
57
119
|
}
|
|
58
120
|
else {
|
|
59
121
|
this.contextObservable()
|
|
60
122
|
.pipe(first())
|
|
61
|
-
.subscribe(ctx =>
|
|
62
|
-
resolve(ctx.context);
|
|
63
|
-
});
|
|
123
|
+
.subscribe((ctx) => resolve(ctx.context));
|
|
64
124
|
}
|
|
65
125
|
});
|
|
66
126
|
}
|
|
@@ -76,59 +136,96 @@ class LuigiContextServiceImpl {
|
|
|
76
136
|
* Set current context
|
|
77
137
|
*/
|
|
78
138
|
setContext(obj) {
|
|
79
|
-
this.
|
|
139
|
+
this.ngZone.run(() => {
|
|
80
140
|
this.currentContext = obj;
|
|
81
141
|
this.subject.next(obj);
|
|
82
142
|
});
|
|
83
143
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
contextType,
|
|
87
|
-
context
|
|
88
|
-
});
|
|
89
|
-
}
|
|
144
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiContextServiceImpl, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
145
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiContextServiceImpl, providedIn: 'root' });
|
|
90
146
|
}
|
|
91
|
-
|
|
92
|
-
LuigiContextServiceImpl.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LuigiContextServiceImpl, providedIn: 'root' });
|
|
93
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LuigiContextServiceImpl, decorators: [{
|
|
147
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiContextServiceImpl, decorators: [{
|
|
94
148
|
type: Injectable,
|
|
95
149
|
args: [{
|
|
96
150
|
providedIn: 'root'
|
|
97
151
|
}]
|
|
98
|
-
}], ctorParameters:
|
|
99
|
-
|
|
100
|
-
class LuigiActivatedRouteSnapshotHelper {
|
|
101
|
-
static getCurrent() {
|
|
102
|
-
return LuigiActivatedRouteSnapshotHelper._current;
|
|
103
|
-
}
|
|
104
|
-
static setCurrent(current) {
|
|
105
|
-
LuigiActivatedRouteSnapshotHelper._current = current;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
// tslint:disable-next-line:variable-name
|
|
109
|
-
LuigiActivatedRouteSnapshotHelper._current = null;
|
|
152
|
+
}], ctorParameters: () => [] });
|
|
110
153
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
154
|
+
const staticRoutes = [
|
|
155
|
+
// here an example if you want to specify that this component is a virtualTree element in Luigi Core navigation
|
|
156
|
+
{
|
|
157
|
+
path: 'luigi-client-support-preload',
|
|
158
|
+
component: LuigiPreloadComponent,
|
|
159
|
+
data: { fromVirtualTreeRoot: true }
|
|
160
|
+
},
|
|
161
|
+
// here an example if you want to specify that this component is a Luigi component and you want to change the navigation in Luigi core
|
|
162
|
+
{
|
|
163
|
+
path: 'luigi-client-support-preload',
|
|
164
|
+
component: LuigiPreloadComponent,
|
|
165
|
+
data: { luigiRoute: '/home/reload' }
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* here an example if you want to reuse the component and not recreating every time you navigate to it (a singleton Component)
|
|
169
|
+
* it requires in your module to redefine
|
|
170
|
+
*/
|
|
171
|
+
{
|
|
172
|
+
path: 'luigi-client-support-preload=component',
|
|
173
|
+
component: LuigiPreloadComponent,
|
|
174
|
+
data: { reuse: true }
|
|
175
|
+
},
|
|
176
|
+
// here an example if you want to update modalPathParam on internal navigation
|
|
177
|
+
{
|
|
178
|
+
path: 'luigi-client-support-preload',
|
|
179
|
+
component: LuigiPreloadComponent,
|
|
180
|
+
data: { updateModalPathParam: true }
|
|
115
181
|
}
|
|
182
|
+
];
|
|
183
|
+
class LuigiAngularSupportModule {
|
|
184
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiAngularSupportModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
185
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.2.10", ngImport: i0, type: LuigiAngularSupportModule, declarations: [LuigiPreloadComponent], imports: [i1.RouterModule], exports: [LuigiPreloadComponent] });
|
|
186
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiAngularSupportModule, providers: [
|
|
187
|
+
{
|
|
188
|
+
provide: LuigiContextService,
|
|
189
|
+
useClass: LuigiContextServiceImpl
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
provide: RouteReuseStrategy,
|
|
193
|
+
useClass: LuigiRouteStrategy
|
|
194
|
+
}
|
|
195
|
+
], imports: [RouterModule.forChild(staticRoutes)] });
|
|
116
196
|
}
|
|
197
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiAngularSupportModule, decorators: [{
|
|
198
|
+
type: NgModule,
|
|
199
|
+
args: [{
|
|
200
|
+
declarations: [LuigiPreloadComponent],
|
|
201
|
+
imports: [RouterModule.forChild(staticRoutes)],
|
|
202
|
+
providers: [
|
|
203
|
+
{
|
|
204
|
+
provide: LuigiContextService,
|
|
205
|
+
useClass: LuigiContextServiceImpl
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
provide: RouteReuseStrategy,
|
|
209
|
+
useClass: LuigiRouteStrategy
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
exports: [LuigiPreloadComponent]
|
|
213
|
+
}]
|
|
214
|
+
}] });
|
|
117
215
|
|
|
118
216
|
class LuigiAutoRoutingService {
|
|
217
|
+
router;
|
|
218
|
+
luigiContextService;
|
|
219
|
+
destroyRef = inject(DestroyRef);
|
|
119
220
|
constructor(router, luigiContextService) {
|
|
120
221
|
this.router = router;
|
|
121
222
|
this.luigiContextService = luigiContextService;
|
|
122
|
-
this.
|
|
123
|
-
|
|
223
|
+
this.router.events
|
|
224
|
+
.pipe(this.doFilter(), takeUntilDestroyed(this.destroyRef))
|
|
225
|
+
.subscribe((event) => this.doSubscription(event));
|
|
124
226
|
}
|
|
125
227
|
doFilter() {
|
|
126
|
-
return filter((event) =>
|
|
127
|
-
return !!(event instanceof NavigationEnd &&
|
|
128
|
-
event.url &&
|
|
129
|
-
event.url.length > 0 &&
|
|
130
|
-
!(history.state && history.state.luigiInduced));
|
|
131
|
-
});
|
|
228
|
+
return filter((event) => !!(event instanceof NavigationEnd && event?.url?.length && !history?.state?.luigiInduced));
|
|
132
229
|
}
|
|
133
230
|
/**
|
|
134
231
|
* This method will be take in consideration angular route that having in data object the paramter
|
|
@@ -145,11 +242,11 @@ class LuigiAutoRoutingService {
|
|
|
145
242
|
let current = LuigiActivatedRouteSnapshotHelper.getCurrent();
|
|
146
243
|
if (!current) {
|
|
147
244
|
current = this.router.routerState.root.snapshot;
|
|
148
|
-
while (current?.children?.length
|
|
245
|
+
while (current?.children?.length) {
|
|
149
246
|
// handle multiple children
|
|
150
247
|
let primary = null;
|
|
151
|
-
current
|
|
152
|
-
if (childSnapshot
|
|
248
|
+
current.children.forEach((childSnapshot) => {
|
|
249
|
+
if (childSnapshot?.outlet === 'primary') {
|
|
153
250
|
primary = childSnapshot;
|
|
154
251
|
}
|
|
155
252
|
});
|
|
@@ -188,11 +285,11 @@ class LuigiAutoRoutingService {
|
|
|
188
285
|
const truncate = current.data.fromVirtualTreeRoot.truncate;
|
|
189
286
|
if (truncate) {
|
|
190
287
|
if (truncate.indexOf('*') === 0) {
|
|
191
|
-
const index = url.indexOf(truncate.
|
|
192
|
-
url = url.
|
|
288
|
+
const index = url.indexOf(truncate.substring(1));
|
|
289
|
+
url = url.substring(index + truncate.length - 1);
|
|
193
290
|
}
|
|
194
291
|
else if (url.indexOf(truncate) === 0) {
|
|
195
|
-
url = url.
|
|
292
|
+
url = url.substring(truncate.length);
|
|
196
293
|
}
|
|
197
294
|
}
|
|
198
295
|
route = url;
|
|
@@ -216,8 +313,8 @@ class LuigiAutoRoutingService {
|
|
|
216
313
|
return route;
|
|
217
314
|
}
|
|
218
315
|
const pmap = convertToParamMap(allParams);
|
|
219
|
-
pmap.keys.forEach(key => {
|
|
220
|
-
pmap.getAll(key).forEach(param => {
|
|
316
|
+
pmap.keys.forEach((key) => {
|
|
317
|
+
pmap.getAll(key).forEach((param) => {
|
|
221
318
|
route = route?.replace(':' + key, param);
|
|
222
319
|
});
|
|
223
320
|
});
|
|
@@ -234,115 +331,15 @@ class LuigiAutoRoutingService {
|
|
|
234
331
|
}
|
|
235
332
|
return allParams;
|
|
236
333
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
}
|
|
334
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiAutoRoutingService, deps: [{ token: i1.Router }, { token: LuigiContextService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
335
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiAutoRoutingService, providedIn: 'root' });
|
|
240
336
|
}
|
|
241
|
-
|
|
242
|
-
LuigiAutoRoutingService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LuigiAutoRoutingService, providedIn: 'root' });
|
|
243
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LuigiAutoRoutingService, decorators: [{
|
|
337
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.10", ngImport: i0, type: LuigiAutoRoutingService, decorators: [{
|
|
244
338
|
type: Injectable,
|
|
245
339
|
args: [{
|
|
246
340
|
providedIn: 'root'
|
|
247
341
|
}]
|
|
248
|
-
}], ctorParameters:
|
|
249
|
-
|
|
250
|
-
const staticRoutes = [
|
|
251
|
-
/** here an example if you want to specify that this component is a virtualTree element in Luigi Core navigation*/
|
|
252
|
-
{
|
|
253
|
-
path: 'luigi-client-support-preload',
|
|
254
|
-
component: LuigiPreloadComponent,
|
|
255
|
-
data: { fromVirtualTreeRoot: true }
|
|
256
|
-
},
|
|
257
|
-
/** here an example if you want to specify that this component it is a luigi component and u want to change the navigation in Luigi core*/
|
|
258
|
-
{
|
|
259
|
-
path: 'luigi-client-support-preload',
|
|
260
|
-
component: LuigiPreloadComponent,
|
|
261
|
-
data: { luigiRoute: '/home/reload' }
|
|
262
|
-
},
|
|
263
|
-
/** here an example if you want to reuse the component and not recreating every time you navigate to it (a singleton Component) It requires in your module to redefine */
|
|
264
|
-
{
|
|
265
|
-
path: 'luigi-client-support-preload=component',
|
|
266
|
-
component: LuigiPreloadComponent,
|
|
267
|
-
data: { reuse: true }
|
|
268
|
-
},
|
|
269
|
-
/** here an example if you want to update modalPathParam on internal navigation */
|
|
270
|
-
{
|
|
271
|
-
path: 'luigi-client-support-preload',
|
|
272
|
-
component: LuigiPreloadComponent,
|
|
273
|
-
data: { updateModalPathParam: true }
|
|
274
|
-
}
|
|
275
|
-
];
|
|
276
|
-
class LuigiAngularSupportModule {
|
|
277
|
-
constructor(navigation, context) { }
|
|
278
|
-
}
|
|
279
|
-
LuigiAngularSupportModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LuigiAngularSupportModule, deps: [{ token: LuigiAutoRoutingService }, { token: LuigiContextService }], target: i0.ɵɵFactoryTarget.NgModule });
|
|
280
|
-
LuigiAngularSupportModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: LuigiAngularSupportModule, declarations: [LuigiPreloadComponent], imports: [i1.RouterModule], exports: [LuigiPreloadComponent] });
|
|
281
|
-
LuigiAngularSupportModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LuigiAngularSupportModule, providers: [
|
|
282
|
-
{
|
|
283
|
-
provide: LuigiContextService,
|
|
284
|
-
useClass: LuigiContextServiceImpl
|
|
285
|
-
},
|
|
286
|
-
{
|
|
287
|
-
provide: RouteReuseStrategy,
|
|
288
|
-
useClass: LuigiRouteStrategy
|
|
289
|
-
}
|
|
290
|
-
], imports: [RouterModule.forChild(staticRoutes)] });
|
|
291
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LuigiAngularSupportModule, decorators: [{
|
|
292
|
-
type: NgModule,
|
|
293
|
-
args: [{
|
|
294
|
-
declarations: [LuigiPreloadComponent],
|
|
295
|
-
imports: [RouterModule.forChild(staticRoutes)],
|
|
296
|
-
providers: [
|
|
297
|
-
{
|
|
298
|
-
provide: LuigiContextService,
|
|
299
|
-
useClass: LuigiContextServiceImpl
|
|
300
|
-
},
|
|
301
|
-
{
|
|
302
|
-
provide: RouteReuseStrategy,
|
|
303
|
-
useClass: LuigiRouteStrategy
|
|
304
|
-
}
|
|
305
|
-
],
|
|
306
|
-
exports: [LuigiPreloadComponent]
|
|
307
|
-
}]
|
|
308
|
-
}], ctorParameters: function () { return [{ type: LuigiAutoRoutingService }, { type: LuigiContextService }]; } });
|
|
309
|
-
|
|
310
|
-
// @dynamic
|
|
311
|
-
/*
|
|
312
|
-
* This class mocks Luigi Core related functionality.
|
|
313
|
-
*
|
|
314
|
-
* Micro Frontends that use Luigi Client would usually communicate with Luigi Core
|
|
315
|
-
* back and forth. When testing Luigi Client based components, Luigi Core might
|
|
316
|
-
* not be present which leads into limitations on integration/e2e testing for standalone
|
|
317
|
-
* microfrontends.
|
|
318
|
-
*
|
|
319
|
-
* This module adds a hook to the window postMessage API by adding an event listener to the
|
|
320
|
-
* global message event of the window object and mocking the callback.
|
|
321
|
-
* In the normal workflow this message would picked up by Luigi Core which then sends the response back.
|
|
322
|
-
*/
|
|
323
|
-
class LuigiMockModule {
|
|
324
|
-
}
|
|
325
|
-
LuigiMockModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LuigiMockModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
326
|
-
LuigiMockModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: LuigiMockModule });
|
|
327
|
-
LuigiMockModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LuigiMockModule, providers: [
|
|
328
|
-
{
|
|
329
|
-
provide: APP_INITIALIZER,
|
|
330
|
-
useFactory: LuigiMockEngine.initPostMessageHook,
|
|
331
|
-
multi: true
|
|
332
|
-
}
|
|
333
|
-
] });
|
|
334
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: LuigiMockModule, decorators: [{
|
|
335
|
-
type: NgModule,
|
|
336
|
-
args: [{
|
|
337
|
-
providers: [
|
|
338
|
-
{
|
|
339
|
-
provide: APP_INITIALIZER,
|
|
340
|
-
useFactory: LuigiMockEngine.initPostMessageHook,
|
|
341
|
-
multi: true
|
|
342
|
-
}
|
|
343
|
-
]
|
|
344
|
-
}]
|
|
345
|
-
}] });
|
|
342
|
+
}], ctorParameters: () => [{ type: i1.Router }, { type: LuigiContextService }] });
|
|
346
343
|
|
|
347
344
|
/*
|
|
348
345
|
* Public API Surface of client-support-angular
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"luigi-project-client-support-angular.mjs","sources":["../../../projects/client-support-angular/src/lib/component/luigi.preload.component.ts","../../../projects/client-support-angular/src/lib/component/luigi.preload.component.html","../../../projects/client-support-angular/src/lib/luigi-mock/luigi-mock.module.ts","../../../projects/client-support-angular/src/lib/route/luigi-activated-route-snapshot-helper.ts","../../../projects/client-support-angular/src/lib/route/luigi-route-strategy.ts","../../../projects/client-support-angular/src/lib/service/luigi-context.service.ts","../../../projects/client-support-angular/src/lib/service/luigi-context.model.ts","../../../projects/client-support-angular/src/lib/service/luigi-context.service.impl.ts","../../../projects/client-support-angular/src/lib/luigi.angular.support.module.ts","../../../projects/client-support-angular/src/lib/service/luigi-auto-routing.service.ts","../../../projects/client-support-angular/src/public-api.ts","../../../projects/client-support-angular/src/luigi-project-client-support-angular.ts"],"sourcesContent":["import { Component } from '@angular/core';\n\n@Component({\n selector: 'lib-client-support-angular',\n templateUrl: './luigi.preload.component.html',\n})\nexport class LuigiPreloadComponent {}\n","<p luigipreload=\"luigipreload\"></p>\n","import { APP_INITIALIZER, NgModule } from '@angular/core';\nimport { LuigiMockEngine } from '@luigi-project/testing-utilities';\n\n// @dynamic\n@NgModule({\n providers: [\n {\n provide: APP_INITIALIZER,\n useFactory: LuigiMockEngine.initPostMessageHook,\n multi: true\n }\n ]\n})\n/*\n * This class mocks Luigi Core related functionality.\n *\n * Micro Frontends that use Luigi Client would usually communicate with Luigi Core\n * back and forth. When testing Luigi Client based components, Luigi Core might\n * not be present which leads into limitations on integration/e2e testing for standalone\n * microfrontends.\n *\n * This module adds a hook to the window postMessage API by adding an event listener to the\n * global message event of the window object and mocking the callback.\n * In the normal workflow this message would picked up by Luigi Core which then sends the response back.\n */\nexport class LuigiMockModule {}\n","import { ActivatedRouteSnapshot } from '@angular/router';\n\nexport class LuigiActivatedRouteSnapshotHelper {\n // tslint:disable-next-line:variable-name\n private static _current: ActivatedRouteSnapshot = (null as unknown) as ActivatedRouteSnapshot;\n\n static getCurrent(): ActivatedRouteSnapshot {\n return LuigiActivatedRouteSnapshotHelper._current;\n }\n\n static setCurrent(current: ActivatedRouteSnapshot): void {\n LuigiActivatedRouteSnapshotHelper._current = current;\n }\n}\n","import { BaseRouteReuseStrategy } from '@angular/router';\nimport { ActivatedRouteSnapshot, DetachedRouteHandle } from '@angular/router';\nimport { LuigiActivatedRouteSnapshotHelper } from './luigi-activated-route-snapshot-helper';\n\nexport class LuigiRouteStrategy extends BaseRouteReuseStrategy {\n retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null {\n LuigiActivatedRouteSnapshotHelper.setCurrent(route);\n return super.retrieve(route);\n }\n}\n","import { Context } from '@luigi-project/client';\nimport { Observable } from 'rxjs';\nimport { IContextMessage } from './luigi-context.model';\n\nexport abstract class LuigiContextService {\n /**\n * Listen to context changes\n * Receives current value, even if the event was already dispatched earlier.\n */\n abstract contextObservable(): Observable<IContextMessage>;\n\n /**\n * Get latest set context object\n */\n abstract getContext(): Context;\n\n /**\n * Get a promise that resolves when context is set.\n */\n abstract getContextAsync(): Promise<Context>;\n}\n","import { Context } from '@luigi-project/client';\n\nexport enum ILuigiContextTypes {\n INIT,\n UPDATE\n}\n\nexport interface IContextMessage {\n context: Context;\n contextType: ILuigiContextTypes;\n}\n","import { inject, Injectable, NgZone } from '@angular/core';\nimport { Context, addInitListener, addContextUpdateListener } from '@luigi-project/client';\nimport { ReplaySubject, Observable } from 'rxjs';\nimport { first } from 'rxjs/operators';\nimport { IContextMessage, ILuigiContextTypes } from './luigi-context.model';\nimport { LuigiContextService } from './luigi-context.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class LuigiContextServiceImpl implements LuigiContextService {\n private subject: ReplaySubject<IContextMessage> = new ReplaySubject<IContextMessage>(1);\n private currentContext!: IContextMessage;\n private ngZone = inject(NgZone);\n\n constructor() {\n addInitListener((initContext: Context) => {\n this.addListener(ILuigiContextTypes.INIT, initContext);\n });\n addContextUpdateListener((updateContext: Context) => {\n this.addListener(ILuigiContextTypes.UPDATE, updateContext);\n });\n }\n\n public addListener(contextType: ILuigiContextTypes, context: Context): void {\n this.setContext({\n contextType,\n context\n } as IContextMessage);\n }\n\n public contextObservable(): Observable<IContextMessage> {\n return this.subject.asObservable();\n }\n\n /**\n * Get latest context object retrieved from luigi core application or empty object, if not yet set.\n */\n public getContext(): Context {\n return this.currentContext?.context || {};\n }\n\n /**\n * Get a promise that resolves when context is set.\n */\n public getContextAsync(): Promise<Context> {\n return new Promise<Context>((resolve) => {\n const context: Context = this.getContext();\n\n if (this.isObject(context) && Object.keys(context)?.length) {\n resolve(this.getContext());\n } else {\n this.contextObservable()\n .pipe(first())\n .subscribe((ctx: IContextMessage) => resolve(ctx.context));\n }\n });\n }\n\n /**\n * Checks if input is an object.\n * @param objectToCheck mixed\n * @returns {boolean}\n */\n private isObject(objectToCheck: Context | undefined): boolean {\n return !!(objectToCheck && typeof objectToCheck === 'object' && !Array.isArray(objectToCheck));\n }\n\n /**\n * Set current context\n */\n protected setContext(obj: IContextMessage): void {\n this.ngZone.run(() => {\n this.currentContext = obj;\n this.subject.next(obj);\n });\n }\n}\n","import { NgModule } from '@angular/core';\nimport { RouteReuseStrategy, RouterModule, Routes } from '@angular/router';\nimport { LuigiPreloadComponent } from './component/luigi.preload.component';\nimport { LuigiRouteStrategy } from './route/luigi-route-strategy';\nimport { LuigiContextService } from './service/luigi-context.service';\nimport { LuigiContextServiceImpl } from './service/luigi-context.service.impl';\n\nexport const staticRoutes: Routes = [\n // here an example if you want to specify that this component is a virtualTree element in Luigi Core navigation\n {\n path: 'luigi-client-support-preload',\n component: LuigiPreloadComponent,\n data: { fromVirtualTreeRoot: true }\n },\n // here an example if you want to specify that this component is a Luigi component and you want to change the navigation in Luigi core\n {\n path: 'luigi-client-support-preload',\n component: LuigiPreloadComponent,\n data: { luigiRoute: '/home/reload' }\n },\n /**\n * here an example if you want to reuse the component and not recreating every time you navigate to it (a singleton Component)\n * it requires in your module to redefine\n */\n {\n path: 'luigi-client-support-preload=component',\n component: LuigiPreloadComponent,\n data: { reuse: true }\n },\n // here an example if you want to update modalPathParam on internal navigation\n {\n path: 'luigi-client-support-preload',\n component: LuigiPreloadComponent,\n data: { updateModalPathParam: true }\n }\n];\n\n@NgModule({\n declarations: [LuigiPreloadComponent],\n imports: [RouterModule.forChild(staticRoutes)],\n providers: [\n {\n provide: LuigiContextService,\n useClass: LuigiContextServiceImpl\n },\n {\n provide: RouteReuseStrategy,\n useClass: LuigiRouteStrategy\n }\n ],\n exports: [LuigiPreloadComponent]\n})\nexport class LuigiAngularSupportModule {}\n","import { Injectable, DestroyRef, inject } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { ActivatedRouteSnapshot, Event, NavigationEnd, ParamMap, Router, convertToParamMap } from '@angular/router';\nimport { linkManager, uxManager, isLuigiClientInitialized } from '@luigi-project/client';\nimport { OperatorFunction } from 'rxjs';\nimport { filter } from 'rxjs/operators';\nimport { LuigiActivatedRouteSnapshotHelper } from '../route/luigi-activated-route-snapshot-helper';\nimport { LuigiContextService } from './luigi-context.service';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class LuigiAutoRoutingService {\n private destroyRef = inject(DestroyRef);\n\n constructor(\n private router: Router,\n private luigiContextService: LuigiContextService\n ) {\n this.router.events\n .pipe(this.doFilter(), takeUntilDestroyed(this.destroyRef))\n .subscribe((event: NavigationEnd) => this.doSubscription(event));\n }\n\n doFilter(): OperatorFunction<Event, NavigationEnd> {\n return filter(\n (event: Event): event is NavigationEnd =>\n !!(event instanceof NavigationEnd && event?.url?.length && !history?.state?.luigiInduced)\n );\n }\n\n /**\n * This method will be take in consideration angular route that having in data object the paramter\n * fromVirtualTreeRoot: true, here an example:\n * {path: 'demo', component: DemoComponent, data:{fromVirtualTreeRoot: true}}\n * Another option is to specify the LuigiPath: if you add in route data luigiRoute:'/xxxx/xxx';\n * in the case we will update the path in LuigiCore navigation, here an example\n * {path: 'demo', component: DemoComponent, data:{luigiRoute: '/home/demo''}}\n * If updateModalPathParam is specified, than modalPathParam will be updated upon internal navigation:\n * {path: 'demo', component: DemoComponent, data:{updateModalPathParam: true}}\n * @param event the NavigationEnd event\n */\n doSubscription(event: NavigationEnd): void {\n let current: ActivatedRouteSnapshot | null = LuigiActivatedRouteSnapshotHelper.getCurrent();\n\n if (!current) {\n current = this.router.routerState.root.snapshot;\n\n while (current?.children?.length) {\n // handle multiple children\n let primary: ActivatedRouteSnapshot | null = null;\n\n current.children.forEach((childSnapshot: ActivatedRouteSnapshot) => {\n if (childSnapshot?.outlet === 'primary') {\n primary = childSnapshot;\n }\n });\n\n if (primary) {\n current = primary;\n } else if (current.firstChild) {\n current = current.firstChild;\n } else {\n break;\n }\n }\n }\n\n if (current?.data && isLuigiClientInitialized()) {\n const ux = uxManager();\n let lm = linkManager().withoutSync();\n let route: string | undefined;\n\n if (current.data.luigiRoute) {\n route = this.getResolvedLuigiRoute(current);\n\n if (current.data.fromContext) {\n if (!this.luigiContextService.getContext()) {\n console.debug('Ignoring auto navigation request, luigi context not set');\n return;\n }\n\n if (current.data.fromContext === true) {\n lm = lm.fromClosestContext();\n } else {\n lm = lm.fromContext(current.data.fromContext);\n }\n }\n } else if (current.data.fromVirtualTreeRoot) {\n let url = event.url;\n const truncate = current.data.fromVirtualTreeRoot.truncate;\n\n if (truncate) {\n if (truncate.indexOf('*') === 0) {\n const index = url.indexOf(truncate.substring(1));\n\n url = url.substring(index + truncate.length - 1);\n } else if (url.indexOf(truncate) === 0) {\n url = url.substring(truncate.length);\n }\n }\n\n route = url;\n console.debug('Calling fromVirtualTreeRoot for url ==> ' + route);\n lm = lm.fromVirtualTreeRoot();\n }\n\n if (ux.isModal()) {\n if (current.data.updateModalDataPath) {\n lm.updateModalPathInternalNavigation(route as string, {}, current.data.addHistoryEntry);\n }\n } else if (route) {\n lm.navigate(route);\n }\n }\n }\n\n getResolvedLuigiRoute(current: ActivatedRouteSnapshot): string | undefined {\n let route: string | undefined = current.data.luigiRoute;\n const allParams = this.getAllParamsFromParents(current);\n\n if (!route || !allParams) {\n return route;\n }\n\n const pmap: ParamMap = convertToParamMap(allParams);\n\n pmap.keys.forEach((key: string) => {\n pmap.getAll(key).forEach((param: string) => {\n route = route?.replace(':' + key, param);\n });\n });\n\n return route;\n }\n\n getAllParamsFromParents(current: ActivatedRouteSnapshot): { [key: string]: string } | undefined {\n let allParams: { [key: string]: string } = {};\n let currentToCheck: ActivatedRouteSnapshot | null = current;\n\n while (currentToCheck) {\n if (currentToCheck.params) {\n allParams = { ...allParams, ...currentToCheck.params };\n }\n\n currentToCheck = currentToCheck.parent;\n }\n\n return allParams;\n }\n}\n","/*\n * Public API Surface of client-support-angular\n */\n\nexport * from './lib/component/luigi.preload.component';\nexport * from './lib/luigi-mock/luigi-mock.module';\nexport * from './lib/luigi.angular.support.module';\nexport * from './lib/service/luigi-auto-routing.service';\nexport * from './lib/service/luigi-context.model';\nexport * from './lib/service/luigi-context.service';\nexport * from './lib/service/luigi-context.service.impl';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-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AA,CAAA;;4FAEP,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBAHnC,UAAU;AAAC,YAAA,IAAA,EAAA,CAAA;AACV,oBAAA,UAAU,EAAE;AACb,iBAAA;;;ACXD;;AAEG;;ACFH;;AAEG;;;;"}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { OnInit } from '@angular/core';
|
|
2
1
|
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class LuigiPreloadComponent
|
|
4
|
-
constructor();
|
|
5
|
-
ngOnInit(): void;
|
|
2
|
+
export declare class LuigiPreloadComponent {
|
|
6
3
|
static ɵfac: i0.ɵɵFactoryDeclaration<LuigiPreloadComponent, never>;
|
|
7
|
-
static ɵcmp: i0.ɵɵComponentDeclaration<LuigiPreloadComponent, "lib-client-support-angular", never, {}, {}, never, never, false>;
|
|
4
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<LuigiPreloadComponent, "lib-client-support-angular", never, {}, {}, never, never, false, never>;
|
|
8
5
|
}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { Routes } from '@angular/router';
|
|
2
|
-
import { LuigiContextService } from './service/luigi-context-service';
|
|
3
|
-
import { LuigiAutoRoutingService } from './service/luigi-auto-routing.service';
|
|
4
2
|
import * as i0 from "@angular/core";
|
|
5
3
|
import * as i1 from "./component/luigi.preload.component";
|
|
6
4
|
import * as i2 from "@angular/router";
|
|
7
5
|
export declare const staticRoutes: Routes;
|
|
8
6
|
export declare class LuigiAngularSupportModule {
|
|
9
|
-
constructor(navigation: LuigiAutoRoutingService, context: LuigiContextService);
|
|
10
7
|
static ɵfac: i0.ɵɵFactoryDeclaration<LuigiAngularSupportModule, never>;
|
|
11
8
|
static ɵmod: i0.ɵɵNgModuleDeclaration<LuigiAngularSupportModule, [typeof i1.LuigiPreloadComponent], [typeof i2.RouterModule], [typeof i1.LuigiPreloadComponent]>;
|
|
12
9
|
static ɵinj: i0.ɵɵInjectorDeclaration<LuigiAngularSupportModule>;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ActivatedRouteSnapshot, NavigationEnd, Router, RouterEvent } from '@angular/router';
|
|
1
|
+
import { ActivatedRouteSnapshot, Event, NavigationEnd, Router } from '@angular/router';
|
|
3
2
|
import { OperatorFunction } from 'rxjs';
|
|
4
|
-
import { LuigiContextService } from './luigi-context
|
|
3
|
+
import { LuigiContextService } from './luigi-context.service';
|
|
5
4
|
import * as i0 from "@angular/core";
|
|
6
|
-
export declare class LuigiAutoRoutingService
|
|
5
|
+
export declare class LuigiAutoRoutingService {
|
|
7
6
|
private router;
|
|
8
7
|
private luigiContextService;
|
|
9
|
-
private
|
|
8
|
+
private destroyRef;
|
|
10
9
|
constructor(router: Router, luigiContextService: LuigiContextService);
|
|
11
|
-
doFilter(): OperatorFunction<
|
|
10
|
+
doFilter(): OperatorFunction<Event, NavigationEnd>;
|
|
12
11
|
/**
|
|
13
12
|
* This method will be take in consideration angular route that having in data object the paramter
|
|
14
13
|
* fromVirtualTreeRoot: true, here an example:
|
|
@@ -25,7 +24,6 @@ export declare class LuigiAutoRoutingService implements OnDestroy {
|
|
|
25
24
|
getAllParamsFromParents(current: ActivatedRouteSnapshot): {
|
|
26
25
|
[key: string]: string;
|
|
27
26
|
} | undefined;
|
|
28
|
-
ngOnDestroy(): void;
|
|
29
27
|
static ɵfac: i0.ɵɵFactoryDeclaration<LuigiAutoRoutingService, never>;
|
|
30
28
|
static ɵprov: i0.ɵɵInjectableDeclaration<LuigiAutoRoutingService>;
|
|
31
29
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Context } from '@luigi-project/client';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
+
import { IContextMessage } from './luigi-context.model';
|
|
3
4
|
export declare abstract class LuigiContextService {
|
|
4
5
|
/**
|
|
5
6
|
* Listen to context changes
|
|
@@ -15,11 +16,3 @@ export declare abstract class LuigiContextService {
|
|
|
15
16
|
*/
|
|
16
17
|
abstract getContextAsync(): Promise<Context>;
|
|
17
18
|
}
|
|
18
|
-
export declare enum ILuigiContextTypes {
|
|
19
|
-
INIT = 0,
|
|
20
|
-
UPDATE = 1
|
|
21
|
-
}
|
|
22
|
-
export interface IContextMessage {
|
|
23
|
-
contextType: ILuigiContextTypes;
|
|
24
|
-
context: Context;
|
|
25
|
-
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { NgZone } from '@angular/core';
|
|
2
|
-
import { Observable } from 'rxjs';
|
|
3
1
|
import { Context } from '@luigi-project/client';
|
|
4
|
-
import {
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { IContextMessage, ILuigiContextTypes } from './luigi-context.model';
|
|
4
|
+
import { LuigiContextService } from './luigi-context.service';
|
|
5
5
|
import * as i0 from "@angular/core";
|
|
6
6
|
export declare class LuigiContextServiceImpl implements LuigiContextService {
|
|
7
|
-
private zone;
|
|
8
7
|
private subject;
|
|
9
8
|
private currentContext;
|
|
10
|
-
|
|
9
|
+
private ngZone;
|
|
10
|
+
constructor();
|
|
11
|
+
addListener(contextType: ILuigiContextTypes, context: Context): void;
|
|
11
12
|
contextObservable(): Observable<IContextMessage>;
|
|
12
13
|
/**
|
|
13
14
|
* Get latest context object retrieved from luigi core application or empty object, if not yet set.
|
|
@@ -27,7 +28,6 @@ export declare class LuigiContextServiceImpl implements LuigiContextService {
|
|
|
27
28
|
* Set current context
|
|
28
29
|
*/
|
|
29
30
|
protected setContext(obj: IContextMessage): void;
|
|
30
|
-
addListener(contextType: ILuigiContextTypes, context: Context): void;
|
|
31
31
|
static ɵfac: i0.ɵɵFactoryDeclaration<LuigiContextServiceImpl, never>;
|
|
32
32
|
static ɵprov: i0.ɵɵInjectableDeclaration<LuigiContextServiceImpl>;
|
|
33
33
|
}
|
package/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
"url": "ssh://github.com/SAP/luigi.git"
|
|
8
8
|
},
|
|
9
9
|
"peerDependencies": {
|
|
10
|
-
"@angular/common": "^
|
|
11
|
-
"@angular/core": "^
|
|
10
|
+
"@angular/common": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
11
|
+
"@angular/core": "^16.0.0 || ^17.0.0 || ^18.0.0",
|
|
12
12
|
"@luigi-project/testing-utilities": "^2.0.0",
|
|
13
13
|
"@luigi-project/client": "^2.0.0"
|
|
14
14
|
},
|
|
@@ -18,12 +18,8 @@
|
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"tag": "client-support-angular"
|
|
20
20
|
},
|
|
21
|
-
"version": "2.17.1-dev.
|
|
22
|
-
"module": "
|
|
23
|
-
"es2020": "fesm2020/luigi-project-client-support-angular.mjs",
|
|
24
|
-
"esm2020": "esm2020/luigi-project-client-support-angular.mjs",
|
|
25
|
-
"fesm2020": "fesm2020/luigi-project-client-support-angular.mjs",
|
|
26
|
-
"fesm2015": "fesm2015/luigi-project-client-support-angular.mjs",
|
|
21
|
+
"version": "2.17.1-dev.20241181435",
|
|
22
|
+
"module": "fesm2022/luigi-project-client-support-angular.mjs",
|
|
27
23
|
"typings": "index.d.ts",
|
|
28
24
|
"exports": {
|
|
29
25
|
"./package.json": {
|
|
@@ -31,11 +27,9 @@
|
|
|
31
27
|
},
|
|
32
28
|
".": {
|
|
33
29
|
"types": "./index.d.ts",
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"node": "./fesm2015/luigi-project-client-support-angular.mjs",
|
|
38
|
-
"default": "./fesm2020/luigi-project-client-support-angular.mjs"
|
|
30
|
+
"esm2022": "./esm2022/luigi-project-client-support-angular.mjs",
|
|
31
|
+
"esm": "./esm2022/luigi-project-client-support-angular.mjs",
|
|
32
|
+
"default": "./fesm2022/luigi-project-client-support-angular.mjs"
|
|
39
33
|
}
|
|
40
34
|
},
|
|
41
35
|
"sideEffects": false
|