@eui/tools 6.3.33 → 6.3.35
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/.version.properties +1 -1
- package/CHANGELOG.md +18 -0
- package/package.json +1 -1
- package/sandbox.js +11 -6
- package/scripts/csdr/config/global.js +4 -2
- package/scripts/csdr/config/packages.js +7 -3
- package/scripts/csdr/config/projects.js +0 -2
- package/scripts/csdr/init/remotes/10.x/base/angular.json +0 -1
- package/scripts/csdr/init/remotes/10.x/full/common/app/eui-components.ts +11 -0
- package/scripts/csdr/init/remotes/10.x/full/common/app/fallback.component.ts +11 -0
- package/scripts/csdr/init/remotes/10.x/full/common/app/module.component.ts +91 -0
- package/scripts/csdr/init/remotes/10.x/full/common/app/module.ts +96 -0
- package/scripts/csdr/init/remotes/10.x/full/common/app/reducers/custom-route-serializer.ts +28 -0
- package/scripts/csdr/init/remotes/10.x/full/common/app/reducers/index.ts +42 -0
- package/scripts/csdr/init/remotes/10.x/full/common/app/routing.module.ts +34 -0
- package/scripts/csdr/init/remotes/10.x/full/common/assets/.gitkeep +0 -0
- package/scripts/csdr/init/remotes/10.x/full/common/config/global.ts +55 -0
- package/scripts/csdr/init/remotes/10.x/full/common/config/index.ts +20 -0
- package/scripts/csdr/init/remotes/10.x/full/common/config/modules.ts +3 -0
- package/scripts/csdr/init/remotes/10.x/full/common/environments/environment.prod.ts +3 -0
- package/scripts/csdr/init/remotes/10.x/full/common/environments/environment.ts +3 -0
- package/scripts/csdr/init/remotes/10.x/full/common/favicon.ico +0 -0
- package/scripts/csdr/init/remotes/10.x/full/common/index.html +10 -0
- package/scripts/csdr/init/remotes/10.x/full/common/main.ts +11 -0
- package/scripts/csdr/init/remotes/10.x/full/common/polyfills.ts +87 -0
- package/scripts/csdr/init/remotes/10.x/full/common/test.ts +20 -0
- package/scripts/csdr/init/remotes/10.x/full/options/definitions/dynatrace.json +4 -0
- package/scripts/csdr/init/remotes/10.x/full/options/definitions/participant.json +3 -0
- package/scripts/csdr/init/remotes/10.x/full/options/definitions/user-reducers.json +3 -0
- package/scripts/csdr/init/remotes/10.x/full/options/definitions/zipkin.json +5 -0
- package/scripts/csdr/init/remotes/10.x/full/options/participant/app/module.component.ts +94 -0
- package/scripts/csdr/init/remotes/10.x/full/options/participant/app/routing.module.ts +26 -0
- package/scripts/csdr/init/remotes/10.x/full/options/participant/config/index.ts +10 -0
- package/scripts/csdr/init/remotes/10.x/full/options/user-reducers/app/reducers/index.ts +66 -0
package/.version.properties
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.3.
|
|
1
|
+
6.3.35
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## 6.3.35 (2023-02-15)
|
|
2
|
+
|
|
3
|
+
##### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* **other:**
|
|
6
|
+
* euiVersion fetch for packages and remotes - MWP-9204 [MWP-9204](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9204) ([4873c6e4](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/4873c6e40f9822eaeb519a7e8e8236f050e347df))
|
|
7
|
+
|
|
8
|
+
* * *
|
|
9
|
+
* * *
|
|
10
|
+
## 6.3.34 (2023-02-14)
|
|
11
|
+
|
|
12
|
+
##### Chores
|
|
13
|
+
|
|
14
|
+
* **other:**
|
|
15
|
+
* add 10.x full skeleton sources injection for SEDIA v10 remotes - MWP-9204 [MWP-9204](https://webgate.ec.europa.eu/CITnet/jira/browse/MWP-9204) ([030d3696](https://webgate.ec.europa.eu/CITnet/stash/scm/csdr/eui-tools.git/commits/030d3696107e6bf7f4e73f6b59dfa28665069848))
|
|
16
|
+
|
|
17
|
+
* * *
|
|
18
|
+
* * *
|
|
1
19
|
## 6.3.33 (2023-02-14)
|
|
2
20
|
|
|
3
21
|
##### Chores
|
package/package.json
CHANGED
package/sandbox.js
CHANGED
|
@@ -1157,14 +1157,19 @@ const versionUtils = require('./scripts/csdr/version/version-utils');
|
|
|
1157
1157
|
// })
|
|
1158
1158
|
|
|
1159
1159
|
|
|
1160
|
+
// Promise.resolve()
|
|
1161
|
+
// .then(() => {
|
|
1162
|
+
// const remote = configUtils.remotes.getRemote('cc-task-centre-eui15-remote-el-ui');
|
|
1163
|
+
// return buildPackageUtils.element.postBuild(remote, '1.0.0');
|
|
1164
|
+
// })
|
|
1165
|
+
// .then(() => {
|
|
1166
|
+
// console.log('ok');
|
|
1167
|
+
// })
|
|
1160
1168
|
Promise.resolve()
|
|
1161
1169
|
.then(() => {
|
|
1162
|
-
const
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
.then(() => {
|
|
1166
|
-
console.log('ok');
|
|
1170
|
+
const pkg = configUtils.packages.getPackage('mywp-eusearch-eui10-remote-el-ui');
|
|
1171
|
+
const euiVersion = configUtils.packages.getPackageEuiVersion(pkg, true);
|
|
1172
|
+
console.log(euiVersion);
|
|
1167
1173
|
})
|
|
1168
1174
|
|
|
1169
1175
|
|
|
1170
|
-
|
|
@@ -165,6 +165,8 @@ module.exports.getConfig = () => {
|
|
|
165
165
|
|
|
166
166
|
|
|
167
167
|
module.exports.updateConfig = (args = { project, packages, remotes, reset}) => {
|
|
168
|
+
tools.logInfo('Updating euirc config');
|
|
169
|
+
console.log(args);
|
|
168
170
|
|
|
169
171
|
const configFile = path.join(process.cwd(), '.csdr', '.euirc.json');
|
|
170
172
|
|
|
@@ -194,11 +196,11 @@ module.exports.updateConfig = (args = { project, packages, remotes, reset}) => {
|
|
|
194
196
|
}
|
|
195
197
|
|
|
196
198
|
if (args.packages) {
|
|
197
|
-
newConfig.packages = tools.removeArrayDuplicates([...newConfig.packages, ...args.packages]);
|
|
199
|
+
newConfig.packages = tools.removeArrayDuplicates([...newConfig.packages || [], ...args.packages]);
|
|
198
200
|
}
|
|
199
201
|
|
|
200
202
|
if (args.remotes) {
|
|
201
|
-
newConfig.remotes = tools.removeArrayDuplicates([...newConfig.remotes, ...args.remotes]);
|
|
203
|
+
newConfig.remotes = tools.removeArrayDuplicates([...newConfig.remotes || [], ...args.remotes]);
|
|
202
204
|
}
|
|
203
205
|
}
|
|
204
206
|
|
|
@@ -276,11 +276,15 @@ const getPackageEuiVersion = module.exports.getPackageEuiVersion = (pkg, log = f
|
|
|
276
276
|
|
|
277
277
|
if (pkg.build && pkg.build.euiVersion) {
|
|
278
278
|
version = pkg.build.euiVersion;
|
|
279
|
+
}
|
|
279
280
|
|
|
280
|
-
|
|
281
|
-
|
|
281
|
+
if (!version) {
|
|
282
|
+
if (pkg.euiVersion) {
|
|
283
|
+
version = pkg.euiVersion;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
282
286
|
|
|
283
|
-
|
|
287
|
+
if (!version) {
|
|
284
288
|
version = getEuiVersionCore(pkg);
|
|
285
289
|
}
|
|
286
290
|
|
|
@@ -60,10 +60,8 @@ const getProjectPaths = (prj) => {
|
|
|
60
60
|
|
|
61
61
|
// locate and find the TSLint or ESLint configuration files
|
|
62
62
|
if(tools.isFileExists(path.join(rootPath, 'src', 'tslint.json'))) {
|
|
63
|
-
tools.logWarning('TSLint is deprecated and will be removed in the future. Consider migrating to ESLint')
|
|
64
63
|
paths.tslintPath = path.join(rootPath, 'src', 'tslint.json');
|
|
65
64
|
} else if(tools.isFileExists(path.join(rootPath, '.tslint.json'))) {
|
|
66
|
-
tools.logWarning('TSLint is deprecated and will be removed in the future. Consider migrating to ESLint')
|
|
67
65
|
paths.tslintPath = path.join(rootPath, '.tslint.json');
|
|
68
66
|
} else if(tools.isFileExists(path.join(rootPath, 'src', '.eslintrc.json'))) {
|
|
69
67
|
paths.eslintPath = path.join(rootPath, 'src', '.eslintrc.json');
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
"./node_modules/@eui/styles/dist/styles/eui.css",
|
|
31
31
|
"./node_modules/@eui/styles/dist/styles/eui-next.css",
|
|
32
32
|
"./node_modules/@eui/styles/dist/styles/eui-components.css",
|
|
33
|
-
"./node_modules/prismjs/plugins/line-numbers/prism-line-numbers.css",
|
|
34
33
|
"./node_modules/@eui/styles/dist/assets/fonts/font-awesome/font-awesome.min.css",
|
|
35
34
|
"./node_modules/@eui/styles/dist/assets/fonts/flag-icons/css/flag-icon.min.css"
|
|
36
35
|
]
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Component, OnInit, Inject, ElementRef, OnDestroy } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { take } from 'rxjs/operators';
|
|
4
|
+
|
|
5
|
+
import { CONFIG_TOKEN } from '@eui/core';
|
|
6
|
+
import { ElementSetupService, ElementLifeCycleService } from '@csdr/integration/element';
|
|
7
|
+
|
|
8
|
+
enum ElementStatus {
|
|
9
|
+
Loading = 'loading',
|
|
10
|
+
Loaded = 'loaded',
|
|
11
|
+
Error = 'error',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@Component({
|
|
15
|
+
template: `
|
|
16
|
+
<eui-block-content *ngIf="moduleStatus === ElementStatus.Loading" [isBlocked]="true">
|
|
17
|
+
<div style="height: 100%"></div>
|
|
18
|
+
</eui-block-content>
|
|
19
|
+
<ng-container *ngIf="moduleStatus === ElementStatus.Loaded">
|
|
20
|
+
<router-outlet></router-outlet>
|
|
21
|
+
</ng-container>
|
|
22
|
+
<ng-container *ngIf="moduleStatus === ElementStatus.Error">
|
|
23
|
+
<div class="error-container">
|
|
24
|
+
<div>
|
|
25
|
+
<h1>Translations or user data for this module failed to load.</h1>
|
|
26
|
+
<p>Do you want to try again?</p>
|
|
27
|
+
<button euiButton euiPrimary (click)="loadData()">
|
|
28
|
+
<span euiLabel>{{ 'global.RELOAD' | translate }}</span>
|
|
29
|
+
</button>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</ng-container>
|
|
33
|
+
`,
|
|
34
|
+
styles: [`
|
|
35
|
+
.error-container {
|
|
36
|
+
width: 50vw;
|
|
37
|
+
height: 50vh;
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: 50%;
|
|
40
|
+
left: 50%;
|
|
41
|
+
transform: translate(-50%, -50%);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.error-container div {
|
|
45
|
+
text-align: center
|
|
46
|
+
}
|
|
47
|
+
`],
|
|
48
|
+
})
|
|
49
|
+
export class ModuleComponent implements OnInit, OnDestroy {
|
|
50
|
+
ElementStatus = ElementStatus;
|
|
51
|
+
moduleStatus: ElementStatus;
|
|
52
|
+
|
|
53
|
+
constructor(private elRef: ElementRef,
|
|
54
|
+
@Inject(CONFIG_TOKEN) public config: any,
|
|
55
|
+
private elementLifeCycleService: ElementLifeCycleService,
|
|
56
|
+
private elementSetupService: ElementSetupService) {
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
ngOnInit() {
|
|
60
|
+
const elementData = this.elementLifeCycleService.getElementData(this.elRef);
|
|
61
|
+
this.elementLifeCycleService.setup(elementData);
|
|
62
|
+
this.loadData();
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
ngOnDestroy(): void {
|
|
66
|
+
this.elementLifeCycleService.cleanup();
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private loadData() {
|
|
70
|
+
this.setStatus(ElementStatus.Loading);
|
|
71
|
+
try {
|
|
72
|
+
this.elementSetupService.init()
|
|
73
|
+
.pipe(take(1))
|
|
74
|
+
.subscribe((loadStatus: { success: boolean; error?: string }) => {
|
|
75
|
+
if (!loadStatus.success) {
|
|
76
|
+
this.setStatus(ElementStatus.Error);
|
|
77
|
+
console.error(`[ELEMENT: ${this.config.global.elementName}] `, loadStatus.error);
|
|
78
|
+
} else {
|
|
79
|
+
this.setStatus(ElementStatus.Loaded);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
} catch (e) {
|
|
83
|
+
console.log(e);
|
|
84
|
+
this.setStatus(ElementStatus.Error);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private setStatus(status: ElementStatus) {
|
|
89
|
+
this.moduleStatus = status;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { NgModule, Injector, DoBootstrap, ApplicationRef } from '@angular/core';
|
|
2
|
+
import { BrowserModule } from '@angular/platform-browser';
|
|
3
|
+
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
4
|
+
import { HttpClient, HttpClientModule, HttpHeaders } from '@angular/common/http';
|
|
5
|
+
import { createCustomElement } from '@angular/elements';
|
|
6
|
+
|
|
7
|
+
import { StoreModule, USER_PROVIDED_META_REDUCERS } from '@ngrx/store';
|
|
8
|
+
import { EffectsModule } from '@ngrx/effects';
|
|
9
|
+
import { StoreRouterConnectingModule } from '@ngrx/router-store';
|
|
10
|
+
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
|
11
|
+
|
|
12
|
+
import { TranslateModule } from '@ngx-translate/core';
|
|
13
|
+
|
|
14
|
+
import {
|
|
15
|
+
CoreModule,
|
|
16
|
+
CONFIG_TOKEN,
|
|
17
|
+
EUI_CONFIG_TOKEN,
|
|
18
|
+
translateConfig,
|
|
19
|
+
} from '@eui/core';
|
|
20
|
+
import { EUI_COMPONENTS_MODULES } from './eui-components';
|
|
21
|
+
import {
|
|
22
|
+
CsdrCoreModule,
|
|
23
|
+
ElementStorageService,
|
|
24
|
+
} from '@csdr/core';
|
|
25
|
+
|
|
26
|
+
import { TOKEN, reducerProvider, metaReducers } from './reducers/index';
|
|
27
|
+
import { CustomSerializer } from './reducers/custom-route-serializer';
|
|
28
|
+
|
|
29
|
+
import { environment } from '../environments/environment';
|
|
30
|
+
import { appConfig } from '../config';
|
|
31
|
+
|
|
32
|
+
import { @root.common.module@ as RootCommonModule } from '@root.npm.pkg@';
|
|
33
|
+
import {
|
|
34
|
+
DEFAULT_MAPPED_PROVIDERS,
|
|
35
|
+
} from '@csdr/integration/element';
|
|
36
|
+
import { RoutingModule } from './routing.module';
|
|
37
|
+
|
|
38
|
+
import { FallbackComponent } from './fallback.component';
|
|
39
|
+
import { ModuleComponent } from './module.component';
|
|
40
|
+
|
|
41
|
+
// IMPORTS
|
|
42
|
+
|
|
43
|
+
// DECLARATIONS
|
|
44
|
+
|
|
45
|
+
@NgModule({
|
|
46
|
+
imports: [
|
|
47
|
+
BrowserModule,
|
|
48
|
+
BrowserAnimationsModule,
|
|
49
|
+
HttpClientModule,
|
|
50
|
+
EffectsModule.forRoot([]),
|
|
51
|
+
StoreDevtoolsModule.instrument({ name: appConfig.global.storeName, maxAge: 150, logOnly: environment.production }),
|
|
52
|
+
TranslateModule.forRoot(translateConfig),
|
|
53
|
+
|
|
54
|
+
CoreModule.forRoot(),
|
|
55
|
+
CsdrCoreModule.forRoot(),
|
|
56
|
+
RootCommonModule,
|
|
57
|
+
RoutingModule,
|
|
58
|
+
...EUI_COMPONENTS_MODULES,
|
|
59
|
+
|
|
60
|
+
// DEFINITIONS
|
|
61
|
+
],
|
|
62
|
+
declarations: [
|
|
63
|
+
FallbackComponent,
|
|
64
|
+
ModuleComponent,
|
|
65
|
+
],
|
|
66
|
+
entryComponents: [
|
|
67
|
+
FallbackComponent,
|
|
68
|
+
ModuleComponent,
|
|
69
|
+
],
|
|
70
|
+
providers: [
|
|
71
|
+
reducerProvider,
|
|
72
|
+
{
|
|
73
|
+
provide: EUI_CONFIG_TOKEN,
|
|
74
|
+
useValue: { appConfig: { ...appConfig, ...environment }, environment },
|
|
75
|
+
},
|
|
76
|
+
|
|
77
|
+
...DEFAULT_MAPPED_PROVIDERS,
|
|
78
|
+
|
|
79
|
+
// PROVIDERS
|
|
80
|
+
],
|
|
81
|
+
})
|
|
82
|
+
export class AppModule implements DoBootstrap {
|
|
83
|
+
|
|
84
|
+
constructor(private injector: Injector, private http: HttpClient) {
|
|
85
|
+
// CONSTRUCTOR DECLARATIONS
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
ngDoBootstrap(appRef: ApplicationRef): void {
|
|
89
|
+
const elementSampleEui = createCustomElement(ModuleComponent, { injector: this.injector });
|
|
90
|
+
try {
|
|
91
|
+
customElements.define(appConfig.global.elementName, elementSampleEui);
|
|
92
|
+
} catch (e) {
|
|
93
|
+
console.log(e);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Params, RouterStateSnapshot } from '@angular/router';
|
|
2
|
+
import { RouterStateSerializer } from '@ngrx/router-store';
|
|
3
|
+
|
|
4
|
+
export interface RouterStateUrl {
|
|
5
|
+
url: string;
|
|
6
|
+
params: Params;
|
|
7
|
+
queryParams: Params;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class CustomSerializer implements RouterStateSerializer<RouterStateUrl> {
|
|
11
|
+
serialize(routerState: RouterStateSnapshot): RouterStateUrl {
|
|
12
|
+
let route = routerState.root;
|
|
13
|
+
|
|
14
|
+
while (route.firstChild) {
|
|
15
|
+
route = route.firstChild;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const {
|
|
19
|
+
url,
|
|
20
|
+
root: { queryParams },
|
|
21
|
+
} = routerState;
|
|
22
|
+
const { params } = route;
|
|
23
|
+
|
|
24
|
+
// Only return an object including the URL, params and query params
|
|
25
|
+
// instead of the entire snapshot
|
|
26
|
+
return { url, params, queryParams };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { ActionReducer, ActionReducerMap, MetaReducer } from '@ngrx/store';
|
|
3
|
+
import * as fromRouter from '@ngrx/router-store';
|
|
4
|
+
import { storeFreeze } from 'ngrx-store-freeze';
|
|
5
|
+
import { reducers as coreReducers, CoreState, localStorageSync } from '@eui/core';
|
|
6
|
+
|
|
7
|
+
import { environment } from '../../environments/environment';
|
|
8
|
+
|
|
9
|
+
export interface AppState extends CoreState {
|
|
10
|
+
router: fromRouter.RouterReducerState<any>;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// -----------------
|
|
14
|
+
// ------------ AOT
|
|
15
|
+
export const TOKEN = new InjectionToken<any>('AppReducers');
|
|
16
|
+
|
|
17
|
+
export function getReducers(): ActionReducerMap<AppState, any> {
|
|
18
|
+
return {
|
|
19
|
+
router: fromRouter.routerReducer,
|
|
20
|
+
...coreReducers,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const reducerProvider = [
|
|
25
|
+
{ provide: TOKEN, useFactory: getReducers },
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
// console.log all actions
|
|
29
|
+
export function logger(reducer: ActionReducer<AppState>): ActionReducer<AppState> {
|
|
30
|
+
return (state, action) => {
|
|
31
|
+
const result = reducer(state, action);
|
|
32
|
+
console.groupCollapsed(action.type);
|
|
33
|
+
console.log('prev state', state);
|
|
34
|
+
console.log('action', action);
|
|
35
|
+
console.log('next state', result);
|
|
36
|
+
console.groupEnd();
|
|
37
|
+
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const metaReducers: MetaReducer<AppState>[] = !environment.production ? [logger, localStorageSync, storeFreeze] : [localStorageSync];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { RouterModule, Routes } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
import { ELEMENT_ROUTES_TOKEN } from '@csdr/integration/element';
|
|
5
|
+
|
|
6
|
+
import { routes } from '@root.npm.pkg@';
|
|
7
|
+
// DON'T PAY ATTENTION TO IMPORT ERRORS HERE, those files are injected at serve/build time
|
|
8
|
+
import { appConfig } from '../config/index';
|
|
9
|
+
import { FallbackComponent } from './fallback.component';
|
|
10
|
+
import { ModuleComponent } from './module.component';
|
|
11
|
+
|
|
12
|
+
const elementRoutes: Routes = [
|
|
13
|
+
{ path: '', component: ModuleComponent },
|
|
14
|
+
{
|
|
15
|
+
path: appConfig.global.baseUrl,
|
|
16
|
+
children: routes,
|
|
17
|
+
},
|
|
18
|
+
{ path: '**', component: FallbackComponent },
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
// @dynamic
|
|
22
|
+
@NgModule({
|
|
23
|
+
imports: [
|
|
24
|
+
RouterModule.forRoot(elementRoutes),
|
|
25
|
+
],
|
|
26
|
+
providers: [
|
|
27
|
+
{ provide: ELEMENT_ROUTES_TOKEN, useValue: elementRoutes },
|
|
28
|
+
],
|
|
29
|
+
exports: [
|
|
30
|
+
RouterModule,
|
|
31
|
+
],
|
|
32
|
+
})
|
|
33
|
+
export class RoutingModule {
|
|
34
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { registerLocaleData } from '@angular/common';
|
|
2
|
+
|
|
3
|
+
import localeEn from '@angular/common/locales/en';
|
|
4
|
+
import localeEnExtra from '@angular/common/locales/extra/en';
|
|
5
|
+
import localeFr from '@angular/common/locales/fr';
|
|
6
|
+
import localeFrExtra from '@angular/common/locales/extra/fr';
|
|
7
|
+
|
|
8
|
+
import { GlobalConfig, I18nConfig, LocaleServiceConfig } from '@eui/core';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* import and register locales (currently MWP uses only French and English)
|
|
12
|
+
*/
|
|
13
|
+
registerLocaleData(localeEn, 'en', localeEnExtra);
|
|
14
|
+
registerLocaleData(localeFr, 'fr', localeFrExtra);
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Internationalization Configuration
|
|
18
|
+
*/
|
|
19
|
+
const i18nConfig: I18nConfig = {
|
|
20
|
+
i18nLoader: {
|
|
21
|
+
i18nFolders: ['elements/@remote.name@/bundles/assets/i18n-compiled'],
|
|
22
|
+
i18nResources: [{
|
|
23
|
+
prefix: 'assets/i18n-eui/',
|
|
24
|
+
suffix: '.json',
|
|
25
|
+
}],
|
|
26
|
+
},
|
|
27
|
+
i18nService: {
|
|
28
|
+
languages: ['en', 'fr'],
|
|
29
|
+
defaultLanguage: 'en',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Locale Configuration
|
|
35
|
+
*/
|
|
36
|
+
const localeConfig: LocaleServiceConfig = {
|
|
37
|
+
id: 'en',
|
|
38
|
+
available: ['en', 'fr'],
|
|
39
|
+
bindWithTranslate: true,
|
|
40
|
+
affectGlobalLocale: true,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Global Configuration
|
|
45
|
+
*/
|
|
46
|
+
export const GLOBAL: GlobalConfig = {
|
|
47
|
+
/* URL that needs to be used in the appRouting of the MWP */
|
|
48
|
+
baseUrl: '@base.url@',
|
|
49
|
+
/* Element tag name that needs to be unique - make sure it doesn't collide with any other MWP element */
|
|
50
|
+
elementName: '@element.name@',
|
|
51
|
+
/* in case you are using NgRx give it a unique name (mostly for debugging) */
|
|
52
|
+
storeName: '@store.name@',
|
|
53
|
+
i18n: i18nConfig,
|
|
54
|
+
locale: localeConfig,
|
|
55
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { GLOBAL } from './global';
|
|
2
|
+
import { MODULES } from './modules';
|
|
3
|
+
import { EuiAppConfig, LogLevel, ConsoleAppender, LogConfig } from '@eui/core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Log Configuration
|
|
7
|
+
*/
|
|
8
|
+
const logConfig: LogConfig = {
|
|
9
|
+
logLevel: LogLevel.ALL,
|
|
10
|
+
logAppenders: [{
|
|
11
|
+
type: ConsoleAppender,
|
|
12
|
+
prefixFormat: '[{level}]',
|
|
13
|
+
}],
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const appConfig: EuiAppConfig = {
|
|
17
|
+
global: GLOBAL,
|
|
18
|
+
modules: MODULES,
|
|
19
|
+
log: logConfig,
|
|
20
|
+
};
|
|
Binary file
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { enableProdMode } from '@angular/core';
|
|
2
|
+
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
|
3
|
+
import { AppModule } from './app/module';
|
|
4
|
+
import { environment } from './environments/environment';
|
|
5
|
+
if (environment.production) {
|
|
6
|
+
enableProdMode();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
platformBrowserDynamic()
|
|
10
|
+
.bootstrapModule(AppModule)
|
|
11
|
+
.catch(err => console.log(err));
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
/**
|
|
3
|
+
* This file includes polyfills needed by Angular and is loaded before the app.
|
|
4
|
+
* You can add your own extra polyfills to this file.
|
|
5
|
+
*
|
|
6
|
+
* This file is divided into 2 sections:
|
|
7
|
+
* 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers.
|
|
8
|
+
* 2. Application imports. Files imported after ZoneJS that should be loaded before your main
|
|
9
|
+
* file.
|
|
10
|
+
*
|
|
11
|
+
* The current setup is for so-called "evergreen" browsers; the last versions of browsers that
|
|
12
|
+
* automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera),
|
|
13
|
+
* Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile.
|
|
14
|
+
*
|
|
15
|
+
* Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/***************************************************************************************************
|
|
19
|
+
* BROWSER POLYFILLS
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/** IE9, IE10 and IE11 requires all of the following polyfills. **/
|
|
23
|
+
// import 'core-js/es6/symbol';
|
|
24
|
+
// import 'core-js/es6/object';
|
|
25
|
+
// import 'core-js/es6/function';
|
|
26
|
+
// import 'core-js/es6/parse-int';
|
|
27
|
+
// import 'core-js/es6/parse-float';
|
|
28
|
+
// import 'core-js/es6/number';
|
|
29
|
+
// import 'core-js/es6/math';
|
|
30
|
+
// import 'core-js/es6/string';
|
|
31
|
+
// import 'core-js/es6/date';
|
|
32
|
+
// import 'core-js/es6/array';
|
|
33
|
+
// import 'core-js/es6/regexp';
|
|
34
|
+
// import 'core-js/es6/map';
|
|
35
|
+
// import 'core-js/es6/weak-map';
|
|
36
|
+
// import 'core-js/es6/set';
|
|
37
|
+
|
|
38
|
+
/** IE10 and IE11 requires the following for NgClass support on SVG elements */
|
|
39
|
+
// import 'classlist.js'; // Run `npm install --save classlist.js`.
|
|
40
|
+
|
|
41
|
+
/** IE10 and IE11 requires the following for the Reflect API. */
|
|
42
|
+
// import 'core-js/es6/reflect';
|
|
43
|
+
|
|
44
|
+
/** Evergreen browsers require these. **/
|
|
45
|
+
// Used for reflect-metadata in JIT. If you use AOT (and only Angular decorators), you can remove.
|
|
46
|
+
// import 'core-js/es7/reflect';
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Web Animations `@angular/platform-browser/animations`
|
|
50
|
+
* Only required if AnimationBuilder is used within the application and using IE/Edge or Safari.
|
|
51
|
+
* Standard animation support in Angular DOES NOT require any polyfills (as of Angular 6.0).
|
|
52
|
+
**/
|
|
53
|
+
// import 'web-animations-js'; // Run `npm install --save web-animations-js`.
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* By default, zone.js will patch all possible macroTask and DomEvents
|
|
57
|
+
* user can disable parts of macroTask/DomEvents patch by setting following flags
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
// (window as any).__Zone_disable_requestAnimationFrame = true; // disable patch requestAnimationFrame
|
|
61
|
+
// (window as any).__Zone_disable_on_property = true; // disable patch onProperty such as onclick
|
|
62
|
+
// (window as any).__zone_symbol__BLACK_LISTED_EVENTS = ['scroll', 'mousemove']; // disable patch specified eventNames
|
|
63
|
+
|
|
64
|
+
/*
|
|
65
|
+
* in IE/Edge developer tools, the addEventListener will also be wrapped by zone.js
|
|
66
|
+
* with the following flag, it will bypass `zone.js` patch for IE/Edge
|
|
67
|
+
*/
|
|
68
|
+
// (window as any).__Zone_enable_cross_context_check = true;
|
|
69
|
+
|
|
70
|
+
/***************************************************************************************************
|
|
71
|
+
* Zone JS is required by default for Angular itself.
|
|
72
|
+
*/
|
|
73
|
+
import 'zone.js/dist/zone'; // Included with Angular CLI.
|
|
74
|
+
|
|
75
|
+
/***************************************************************************************************
|
|
76
|
+
* APPLICATION IMPORTS
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Date, currency, decimal and percent pipes.
|
|
81
|
+
* Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10
|
|
82
|
+
*/
|
|
83
|
+
// import 'intl'; // Run `npm install --save intl`.
|
|
84
|
+
/**
|
|
85
|
+
* Need to import at least one locale-data with intl.
|
|
86
|
+
*/
|
|
87
|
+
// import 'intl/locale-data/jsonp/en';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// This file is required by karma.conf.js and loads recursively all the .spec and framework files
|
|
2
|
+
|
|
3
|
+
import 'zone.js/dist/zone-testing';
|
|
4
|
+
import { getTestBed } from '@angular/core/testing';
|
|
5
|
+
import {
|
|
6
|
+
BrowserDynamicTestingModule,
|
|
7
|
+
platformBrowserDynamicTesting,
|
|
8
|
+
} from '@angular/platform-browser-dynamic/testing';
|
|
9
|
+
|
|
10
|
+
declare const require: any;
|
|
11
|
+
|
|
12
|
+
// First, initialize the Angular testing environment.
|
|
13
|
+
getTestBed().initTestEnvironment(
|
|
14
|
+
BrowserDynamicTestingModule,
|
|
15
|
+
platformBrowserDynamicTesting(),
|
|
16
|
+
);
|
|
17
|
+
// Then we find all the tests.
|
|
18
|
+
const context = require.context('./', true, /\.spec\.ts$/);
|
|
19
|
+
// And load the modules.
|
|
20
|
+
context.keys().map(context);
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { Component, OnInit, Inject, ElementRef, OnDestroy } from '@angular/core';
|
|
2
|
+
|
|
3
|
+
import { take } from 'rxjs/operators';
|
|
4
|
+
|
|
5
|
+
import { CONFIG_TOKEN } from '@eui/core';
|
|
6
|
+
import { ElementSetupService, ElementLifeCycleService } from '@csdr/integration/element';
|
|
7
|
+
|
|
8
|
+
enum ElementStatus {
|
|
9
|
+
Loading = 'loading',
|
|
10
|
+
Loaded = 'loaded',
|
|
11
|
+
Error = 'error',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@Component({
|
|
15
|
+
template: `
|
|
16
|
+
<eui-block-content *ngIf="moduleStatus === ElementStatus.Loading" [isBlocked]="true">
|
|
17
|
+
<div style="height: 100%"></div>
|
|
18
|
+
</eui-block-content>
|
|
19
|
+
<ng-container *ngIf="moduleStatus === ElementStatus.Loaded">
|
|
20
|
+
<@block.container.name@ [block]="block"></@block.container.name@>
|
|
21
|
+
</ng-container>
|
|
22
|
+
<ng-container *ngIf="moduleStatus === ElementStatus.Error">
|
|
23
|
+
<div class="error-container">
|
|
24
|
+
<div>
|
|
25
|
+
<h1>Translations or user data for this module failed to load.</h1>
|
|
26
|
+
<p>Do you want to try again?</p>
|
|
27
|
+
<button euiButton euiPrimary (click)="loadData()">
|
|
28
|
+
<span euiLabel>{{ "global.RELOAD" | translate }}</span>
|
|
29
|
+
</button>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
</ng-container>
|
|
33
|
+
`,
|
|
34
|
+
styles: [`
|
|
35
|
+
.error-container {
|
|
36
|
+
width: 50vw;
|
|
37
|
+
height: 50vh;
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: 50%;
|
|
40
|
+
left: 50%;
|
|
41
|
+
transform: translate(-50%, -50%);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.error-container div {
|
|
45
|
+
text-align: center
|
|
46
|
+
}
|
|
47
|
+
`],
|
|
48
|
+
})
|
|
49
|
+
export class ModuleComponent implements OnInit, OnDestroy {
|
|
50
|
+
ElementStatus = ElementStatus;
|
|
51
|
+
moduleStatus: ElementStatus;
|
|
52
|
+
|
|
53
|
+
block: any;
|
|
54
|
+
|
|
55
|
+
constructor(private elRef: ElementRef,
|
|
56
|
+
@Inject(CONFIG_TOKEN) public config: any,
|
|
57
|
+
private elementLifeCycleService: ElementLifeCycleService,
|
|
58
|
+
private elementSetupService: ElementSetupService) {
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
ngOnInit() {
|
|
62
|
+
this.block = this.elRef.nativeElement.block;
|
|
63
|
+
const elementData = this.elementLifeCycleService.getElementData(this.elRef);
|
|
64
|
+
this.elementLifeCycleService.setup(elementData);
|
|
65
|
+
this.loadData();
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
ngOnDestroy(): void {
|
|
69
|
+
this.elementLifeCycleService.cleanup();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private loadData() {
|
|
73
|
+
this.setStatus(ElementStatus.Loading);
|
|
74
|
+
try {
|
|
75
|
+
this.elementSetupService.init()
|
|
76
|
+
.pipe(take(1))
|
|
77
|
+
.subscribe((loadStatus: { success: boolean, error?: string }) => {
|
|
78
|
+
if (!loadStatus.success) {
|
|
79
|
+
this.setStatus(ElementStatus.Error);
|
|
80
|
+
console.error(`[ELEMENT: ${this.config.global.elementName}] `, loadStatus.error);
|
|
81
|
+
} else {
|
|
82
|
+
this.setStatus(ElementStatus.Loaded);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
} catch (e) {
|
|
86
|
+
console.log(e);
|
|
87
|
+
this.setStatus(ElementStatus.Error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private setStatus(status: ElementStatus) {
|
|
92
|
+
this.moduleStatus = status;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import { RouterModule, Routes } from '@angular/router';
|
|
3
|
+
|
|
4
|
+
import { ELEMENT_ROUTES_TOKEN } from '@csdr/integration/element';
|
|
5
|
+
|
|
6
|
+
import { appConfig } from '../config/index'; // tslint:disable-line
|
|
7
|
+
import { FallbackComponent } from './fallback.component'; // tslint:disable-line
|
|
8
|
+
import { ModuleComponent } from './module.component';
|
|
9
|
+
|
|
10
|
+
const elementRoutes: Routes = [
|
|
11
|
+
{ path: '**', component: ModuleComponent },
|
|
12
|
+
];
|
|
13
|
+
|
|
14
|
+
@NgModule({
|
|
15
|
+
imports: [
|
|
16
|
+
RouterModule.forRoot(elementRoutes),
|
|
17
|
+
],
|
|
18
|
+
providers: [
|
|
19
|
+
{ provide: ELEMENT_ROUTES_TOKEN, useValue: elementRoutes },
|
|
20
|
+
],
|
|
21
|
+
exports: [
|
|
22
|
+
RouterModule,
|
|
23
|
+
],
|
|
24
|
+
})
|
|
25
|
+
export class RoutingModule {
|
|
26
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { GLOBAL } from './global';
|
|
2
|
+
import { MODULES } from './modules';
|
|
3
|
+
|
|
4
|
+
import { EuiAppConfig } from '@eui/core';
|
|
5
|
+
import { configMapping } from '@csdr/integration/element';
|
|
6
|
+
|
|
7
|
+
export const appConfig: EuiAppConfig = configMapping({
|
|
8
|
+
global: GLOBAL,
|
|
9
|
+
modules: MODULES,
|
|
10
|
+
});
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { InjectionToken } from '@angular/core';
|
|
2
|
+
import { ActionReducer, ActionReducerMap, MetaReducer, INIT } from '@ngrx/store';
|
|
3
|
+
import * as fromRouter from '@ngrx/router-store';
|
|
4
|
+
import { storeFreeze } from 'ngrx-store-freeze';
|
|
5
|
+
|
|
6
|
+
import { reducers as coreReducers, CoreState, localStorageSync } from '@eui/core';
|
|
7
|
+
import { ElementStorageService } from '@csdr/core';
|
|
8
|
+
|
|
9
|
+
import { environment } from '../../environments/environment';
|
|
10
|
+
|
|
11
|
+
export interface AppState extends CoreState {
|
|
12
|
+
router: fromRouter.RouterReducerState<any>;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// -----------------
|
|
16
|
+
// ------------ AOT
|
|
17
|
+
export const TOKEN = new InjectionToken<any>('AppReducers');
|
|
18
|
+
|
|
19
|
+
export function getReducers(): ActionReducerMap<AppState, any> {
|
|
20
|
+
return {
|
|
21
|
+
router: fromRouter.routerReducer,
|
|
22
|
+
...coreReducers,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const reducerProvider = [
|
|
27
|
+
{ provide: TOKEN, useFactory: getReducers },
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
// console.log all actions
|
|
31
|
+
export function logger(reducer: ActionReducer<AppState>): ActionReducer<AppState> {
|
|
32
|
+
return (state, action) => {
|
|
33
|
+
const result = reducer(state, action);
|
|
34
|
+
console.groupCollapsed(action.type);
|
|
35
|
+
console.log('prev state', state);
|
|
36
|
+
console.log('action', action);
|
|
37
|
+
console.log('next state', result);
|
|
38
|
+
console.groupEnd();
|
|
39
|
+
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function hydrationFactory(config: any, elementStorage: ElementStorageService): MetaReducer<AppState> {
|
|
45
|
+
return (reducer: ActionReducer<AppState>): ActionReducer<any> => {
|
|
46
|
+
return (state, action) => {
|
|
47
|
+
const key = `NgRx store: ${config.global.elementName}`;
|
|
48
|
+
if (action.type === INIT && elementStorage.hasData(key)) {
|
|
49
|
+
const cachedState = elementStorage.getData(key);
|
|
50
|
+
const nextStateFromCache = reducer(cachedState as AppState, action);
|
|
51
|
+
elementStorage.setData(key, nextStateFromCache);
|
|
52
|
+
return nextStateFromCache;
|
|
53
|
+
}
|
|
54
|
+
const nextState = reducer(state, action);
|
|
55
|
+
elementStorage.setData(key, nextState);
|
|
56
|
+
return nextState;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export function metaReducers(config: any, elementStorage: ElementStorageService): MetaReducer<AppState>[] {
|
|
62
|
+
if (!environment.production) {
|
|
63
|
+
return [logger, localStorageSync, storeFreeze, hydrationFactory(config, elementStorage)];
|
|
64
|
+
}
|
|
65
|
+
return [localStorageSync, hydrationFactory(config, elementStorage)];
|
|
66
|
+
}
|