@acorex/platform-generator 18.0.11 → 19.0.1
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/generators.json +11 -1
- package/package.json +7 -6
- package/src/generators/app-module/files/project.json.template +3 -119
- package/src/generators/app-module/files/src/app/app.component.ts.template +1 -0
- package/src/generators/app-module/files/src/app/app.module.ts.template +15 -20
- package/src/generators/app-module/files/src/app/basic-interceptor.interceptor.ts.template +62 -0
- package/src/generators/app-module/files/src/app/modules/auth/auth-root.module.ts.template +2 -2
- package/src/generators/app-module/files/src/app/modules/layout/entity.loader.ts.template +6 -5
- package/src/generators/app-module/files/src/app/modules/layout/layout-root.module.ts.template +32 -34
- package/src/generators/app-module/files/src/app/modules/layout/menu.provider.ts.template +104 -0
- package/src/generators/app-module/files/src/app/modules/root/const.ts.template +6 -0
- package/src/generators/app-module/files/src/app/modules/root/home/home.page.html.template +1 -1
- package/src/generators/app-module/files/src/app/modules/root/mock.data.ts.template +14 -0
- package/src/generators/app-module/files/src/app/modules/root/sample/sample.entity.ts.template +431 -160
- package/src/generators/app-module/files/src/app/modules/root/sample/sample.module.ts.template +18 -0
- package/src/generators/app-module/files/src/app/modules/root/sample/sample.service.ts.template +18 -0
- package/src/generators/app-module/files/src/app/modules/root/sample/sample.types.ts.template +15 -0
- package/src/generators/app-module/files/src/assets/i18n/en/auth.json +12 -0
- package/src/generators/app-module/files/src/assets/i18n/en/common.json +108 -1
- package/src/generators/app-module/files/src/assets/i18n/en/form-template-management.json +19 -0
- package/src/generators/app-module/files/src/assets/i18n/en/notification-management.json +8 -0
- package/src/generators/app-module/files/src/assets/i18n/en/platform-management.json +30 -0
- package/src/generators/app-module/files/src/assets/i18n/en/platform.json +20 -0
- package/src/generators/app-module/files/src/assets/i18n/en/scheduler-job-management.json +6 -0
- package/src/generators/app-module/files/src/assets/i18n/en/text-template-management.json +6 -0
- package/src/generators/app-module/files/src/assets/i18n/fa/auth.json +61 -0
- package/src/generators/app-module/files/src/assets/i18n/fa/common.json +282 -0
- package/src/generators/app-module/files/src/assets/i18n/fa/form-template-management.json +19 -0
- package/src/generators/app-module/files/src/assets/i18n/fa/notification-management.json +8 -0
- package/src/generators/app-module/files/src/assets/i18n/fa/platform-management.json +33 -0
- package/src/generators/app-module/files/src/assets/i18n/fa/platform.json +20 -0
- package/src/generators/app-module/files/src/assets/i18n/fa/scheduler-job-management.json +6 -0
- package/src/generators/app-module/files/src/assets/i18n/fa/text-template-management.json +6 -0
- package/src/generators/app-module/files/src/styles.scss.template +10 -11
- package/src/generators/app-module/files/tailwind.config.js.template +53 -18
- package/src/generators/create-app-module/files/__fileName__/README.md +3 -0
- package/src/generators/create-app-module/files/__fileName__/ng-package.json +5 -0
- package/src/generators/create-app-module/generator.d.ts +6 -0
- package/src/generators/create-app-module/generator.js +25 -0
- package/src/generators/create-app-module/generator.js.map +1 -0
- package/src/generators/create-app-module/schema.json +13 -0
- package/src/generators/create-module-entity/generator.d.ts +7 -0
- package/src/generators/create-module-entity/generator.js +94 -0
- package/src/generators/create-module-entity/generator.js.map +1 -0
- package/src/generators/create-module-entity/schema.json +16 -0
- package/src/generators/app-module/files/src/app/header-interceptor.interceptor.ts.template +0 -33
- package/src/generators/app-module/files/src/app/modules/layout/menu.loader.ts.template +0 -159
- package/src/generators/app-module/files/src/environments/environment.local.ts.template +0 -19
- package/src/generators/app-module/files/src/environments/environment.prod.ts.template +0 -19
- package/src/generators/app-module/files/src/environments/environment.test.local.ts.template +0 -19
- package/src/generators/app-module/files/src/environments/environment.test.ts.template +0 -19
package/generators.json
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"generators": {
|
|
3
|
-
"app-module": {
|
|
3
|
+
"create-app-module": {
|
|
4
4
|
"factory": "./src/generators/app-module/generator",
|
|
5
5
|
"schema": "./src/generators/app-module/schema.json",
|
|
6
6
|
"description": "app-module generator"
|
|
7
|
+
},
|
|
8
|
+
"create-module": {
|
|
9
|
+
"factory": "./src/generators/create-app-module/generator",
|
|
10
|
+
"schema": "./src/generators/create-app-module/schema.json",
|
|
11
|
+
"description": "create-app-module generator"
|
|
12
|
+
},
|
|
13
|
+
"create-module-entity": {
|
|
14
|
+
"factory": "./src/generators/create-module-entity/generator",
|
|
15
|
+
"schema": "./src/generators/create-module-entity/schema.json",
|
|
16
|
+
"description": "create-module-entity generator"
|
|
7
17
|
}
|
|
8
18
|
}
|
|
9
19
|
}
|
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acorex/platform-generator",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "19.0.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@nx/devkit": "19.2.2",
|
|
6
6
|
"tslib": "^2.3.0"
|
|
7
7
|
},
|
|
8
8
|
"peerDependencies": {
|
|
9
|
-
"@acorex/platform": ">=
|
|
10
|
-
"@acorex/modules": ">=
|
|
11
|
-
"@acorex/styles": ">=
|
|
12
|
-
"@acorex/core": ">=
|
|
13
|
-
"@acorex/components": ">=
|
|
9
|
+
"@acorex/platform": ">=19.0.0",
|
|
10
|
+
"@acorex/modules": ">=19.0.0",
|
|
11
|
+
"@acorex/styles": ">=19.0.0",
|
|
12
|
+
"@acorex/core": ">=19.0.0",
|
|
13
|
+
"@acorex/components": ">=19.0.0",
|
|
14
|
+
"@acorex/connectivity": ">=19.0.0"
|
|
14
15
|
},
|
|
15
16
|
"type": "commonjs",
|
|
16
17
|
"main": "./src/index.js",
|
|
@@ -58,35 +58,6 @@
|
|
|
58
58
|
"commonChunk": true,
|
|
59
59
|
"extractLicenses": true
|
|
60
60
|
},
|
|
61
|
-
"build-test": {
|
|
62
|
-
"fileReplacements": [
|
|
63
|
-
{
|
|
64
|
-
"replace": "apps/<%= name %>/src/environments/environment.ts",
|
|
65
|
-
"with": "apps/<%= name %>/src/environments/environment.test.ts"
|
|
66
|
-
}
|
|
67
|
-
],
|
|
68
|
-
"budgets": [
|
|
69
|
-
{
|
|
70
|
-
"type": "initial",
|
|
71
|
-
"maximumWarning": "500kb",
|
|
72
|
-
"maximumError": "5mb"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"type": "anyComponentStyle",
|
|
76
|
-
"maximumWarning": "200kb",
|
|
77
|
-
"maximumError": "400kb"
|
|
78
|
-
}
|
|
79
|
-
],
|
|
80
|
-
"outputHashing": "all",
|
|
81
|
-
"sourceMap": false,
|
|
82
|
-
"optimization": true,
|
|
83
|
-
"namedChunks": false,
|
|
84
|
-
"vendorChunk": true,
|
|
85
|
-
"buildOptimizer": true,
|
|
86
|
-
"aot": true,
|
|
87
|
-
"commonChunk": true,
|
|
88
|
-
"extractLicenses": true
|
|
89
|
-
},
|
|
90
61
|
"build-dev": {
|
|
91
62
|
"fileReplacements": [
|
|
92
63
|
{
|
|
@@ -142,32 +113,6 @@
|
|
|
142
113
|
"sourceMap": true,
|
|
143
114
|
"namedChunks": true
|
|
144
115
|
},
|
|
145
|
-
"serve-test": {
|
|
146
|
-
"fileReplacements": [
|
|
147
|
-
{
|
|
148
|
-
"replace": "apps/<%= name %>/src/environments/environment.ts",
|
|
149
|
-
"with": "apps/<%= name %>/src/environments/environment.test.ts"
|
|
150
|
-
}
|
|
151
|
-
],
|
|
152
|
-
"budgets": [
|
|
153
|
-
{
|
|
154
|
-
"type": "initial",
|
|
155
|
-
"maximumWarning": "500kb",
|
|
156
|
-
"maximumError": "8mb"
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
"type": "anyComponentStyle",
|
|
160
|
-
"maximumWarning": "200kb",
|
|
161
|
-
"maximumError": "400kb"
|
|
162
|
-
}
|
|
163
|
-
],
|
|
164
|
-
"buildOptimizer": false,
|
|
165
|
-
"optimization": false,
|
|
166
|
-
"vendorChunk": true,
|
|
167
|
-
"extractLicenses": false,
|
|
168
|
-
"sourceMap": true,
|
|
169
|
-
"namedChunks": true
|
|
170
|
-
},
|
|
171
116
|
"serve-dev": {
|
|
172
117
|
"fileReplacements": [
|
|
173
118
|
{
|
|
@@ -194,58 +139,6 @@
|
|
|
194
139
|
"sourceMap": true,
|
|
195
140
|
"namedChunks": true
|
|
196
141
|
},
|
|
197
|
-
"serve-local": {
|
|
198
|
-
"fileReplacements": [
|
|
199
|
-
{
|
|
200
|
-
"replace": "apps/<%= name %>/src/environments/environment.ts",
|
|
201
|
-
"with": "apps/<%= name %>/src/environments/environment.local.ts"
|
|
202
|
-
}
|
|
203
|
-
],
|
|
204
|
-
"budgets": [
|
|
205
|
-
{
|
|
206
|
-
"type": "initial",
|
|
207
|
-
"maximumWarning": "500kb",
|
|
208
|
-
"maximumError": "8mb"
|
|
209
|
-
},
|
|
210
|
-
{
|
|
211
|
-
"type": "anyComponentStyle",
|
|
212
|
-
"maximumWarning": "200kb",
|
|
213
|
-
"maximumError": "400kb"
|
|
214
|
-
}
|
|
215
|
-
],
|
|
216
|
-
"buildOptimizer": false,
|
|
217
|
-
"optimization": false,
|
|
218
|
-
"vendorChunk": true,
|
|
219
|
-
"extractLicenses": false,
|
|
220
|
-
"sourceMap": true,
|
|
221
|
-
"namedChunks": true
|
|
222
|
-
},
|
|
223
|
-
"serve-test-local": {
|
|
224
|
-
"fileReplacements": [
|
|
225
|
-
{
|
|
226
|
-
"replace": "apps/<%= name %>/src/environments/environment.ts",
|
|
227
|
-
"with": "apps/<%= name %>/src/environments/environment.test.local.ts"
|
|
228
|
-
}
|
|
229
|
-
],
|
|
230
|
-
"budgets": [
|
|
231
|
-
{
|
|
232
|
-
"type": "initial",
|
|
233
|
-
"maximumWarning": "500kb",
|
|
234
|
-
"maximumError": "8mb"
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
"type": "anyComponentStyle",
|
|
238
|
-
"maximumWarning": "200kb",
|
|
239
|
-
"maximumError": "400kb"
|
|
240
|
-
}
|
|
241
|
-
],
|
|
242
|
-
"buildOptimizer": false,
|
|
243
|
-
"optimization": false,
|
|
244
|
-
"vendorChunk": true,
|
|
245
|
-
"extractLicenses": false,
|
|
246
|
-
"sourceMap": true,
|
|
247
|
-
"namedChunks": true
|
|
248
|
-
}
|
|
249
142
|
},
|
|
250
143
|
"defaultConfiguration": "serve:prod"
|
|
251
144
|
},
|
|
@@ -253,27 +146,18 @@
|
|
|
253
146
|
"executor": "@angular-devkit/build-angular:dev-server",
|
|
254
147
|
"configurations": {
|
|
255
148
|
"serve-prod": {
|
|
256
|
-
"
|
|
257
|
-
},
|
|
258
|
-
"serve-test": {
|
|
259
|
-
"browserTarget": "<%= name %>:build:serve-test"
|
|
149
|
+
"buildTarget": "<%= name %>:build:serve-prod"
|
|
260
150
|
},
|
|
261
151
|
"serve-dev": {
|
|
262
|
-
"
|
|
263
|
-
},
|
|
264
|
-
"serve-local": {
|
|
265
|
-
"browserTarget": "<%= name %>:build:serve-local"
|
|
152
|
+
"buildTarget": "<%= name %>:build:serve-dev"
|
|
266
153
|
},
|
|
267
|
-
"serve-test-local": {
|
|
268
|
-
"browserTarget": "<%= name %>:build:serve-test-local"
|
|
269
|
-
}
|
|
270
154
|
},
|
|
271
155
|
"defaultConfiguration": "development"
|
|
272
156
|
},
|
|
273
157
|
"extract-i18n": {
|
|
274
158
|
"executor": "@angular-devkit/build-angular:extract-i18n",
|
|
275
159
|
"options": {
|
|
276
|
-
"
|
|
160
|
+
"buildTarget": "<%= name %>:build"
|
|
277
161
|
}
|
|
278
162
|
},
|
|
279
163
|
"lint": {
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { AXDialogModule } from '@acorex/components/dialog';
|
|
2
2
|
import { CommonModule } from '@angular/common';
|
|
3
|
-
import { HTTP_INTERCEPTORS, provideHttpClient } from '@angular/common/http';
|
|
4
|
-
|
|
3
|
+
import { HTTP_INTERCEPTORS, provideHttpClient,withInterceptorsFromDi } from '@angular/common/http';
|
|
4
|
+
|
|
5
|
+
import { NgModule, isDevMode } from '@angular/core';
|
|
5
6
|
import { BrowserModule } from '@angular/platform-browser';
|
|
6
7
|
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
7
8
|
import { RouterModule, provideRouter, withEnabledBlockingInitialNavigation } from '@angular/router';
|
|
@@ -10,13 +11,13 @@ import { StoreModule } from '@ngrx/store';
|
|
|
10
11
|
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
|
11
12
|
import { AppComponent } from './app.component';
|
|
12
13
|
import { appRoutes } from './app.routes';
|
|
13
|
-
import {
|
|
14
|
-
|
|
14
|
+
import { BasicInterceptor } from './basic-interceptor.interceptor';
|
|
15
|
+
import { AXCMockModule } from '@acorex/connectivity/mock';
|
|
15
16
|
import { AXFormatModule } from '@acorex/core/format';
|
|
16
17
|
import { AXValidationModule } from '@acorex/core/validation';
|
|
17
|
-
import {
|
|
18
|
+
import {
|
|
18
19
|
AXPImageUrlLogoConfig,
|
|
19
|
-
AXPTextLogoConfig,
|
|
20
|
+
AXPTextLogoConfig,
|
|
20
21
|
AXP_PLATFORM_CONFIG_TOKEN,
|
|
21
22
|
configPlatform,
|
|
22
23
|
} from '@acorex/platform/common';
|
|
@@ -27,16 +28,8 @@ import { AXPLayoutRootModule } from './modules/layout/layout-root.module';
|
|
|
27
28
|
import { AXLoadingDialogModule } from '@acorex/components/loading-dialog';
|
|
28
29
|
import { AXP_ROOT_CONFIG_TOKEN } from '@acorex/platform/common';
|
|
29
30
|
import { environment } from '../environments/environment';
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return () => {
|
|
33
|
-
const loadingText = document.querySelector('#loadingText');
|
|
34
|
-
return new Promise((resolve) => {
|
|
35
|
-
if (loadingText) loadingText.innerHTML = 'Initializing Modules...';
|
|
36
|
-
resolve(0);
|
|
37
|
-
});
|
|
38
|
-
};
|
|
39
|
-
}
|
|
31
|
+
import { AXMSampleEntityModule } from './modules/<%= name %>/sample/sample.module';
|
|
32
|
+
|
|
40
33
|
|
|
41
34
|
|
|
42
35
|
@NgModule({
|
|
@@ -57,9 +50,11 @@ export function initApp() {
|
|
|
57
50
|
AXPLayoutRootModule,
|
|
58
51
|
AXDialogModule,
|
|
59
52
|
AXLoadingDialogModule,
|
|
53
|
+
AXCMockModule,
|
|
60
54
|
//
|
|
61
55
|
AXPAuthRootModule,
|
|
62
56
|
//
|
|
57
|
+
AXMSampleEntityModule,
|
|
63
58
|
StoreDevtoolsModule.instrument({
|
|
64
59
|
maxAge: 25, // Retains last 25 states
|
|
65
60
|
logOnly: !isDevMode(), // Restrict extension to log-only mode
|
|
@@ -70,10 +65,9 @@ export function initApp() {
|
|
|
70
65
|
}),
|
|
71
66
|
],
|
|
72
67
|
providers: [
|
|
73
|
-
provideHttpClient(),
|
|
74
|
-
provideRouter(appRoutes, withEnabledBlockingInitialNavigation()),
|
|
75
|
-
{ provide:
|
|
76
|
-
{ provide: HTTP_INTERCEPTORS, useClass: headerInterceptorInterceptor, multi: true },
|
|
68
|
+
provideHttpClient(withInterceptorsFromDi()),
|
|
69
|
+
provideRouter(appRoutes, withEnabledBlockingInitialNavigation()),
|
|
70
|
+
{ provide: HTTP_INTERCEPTORS, useClass: BasicInterceptor, multi: true },
|
|
77
71
|
{
|
|
78
72
|
provide: AXP_ROOT_CONFIG_TOKEN, useValue: {
|
|
79
73
|
baseUrl: environment.baseUrl
|
|
@@ -92,6 +86,7 @@ export function initApp() {
|
|
|
92
86
|
'Copyright © 2024',
|
|
93
87
|
}),
|
|
94
88
|
},
|
|
89
|
+
|
|
95
90
|
],
|
|
96
91
|
declarations: [AppComponent],
|
|
97
92
|
bootstrap: [AppComponent],
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
|
|
2
|
+
import { AXPSessionService } from '@acorex/platform/auth';
|
|
3
|
+
import { HttpErrorResponse, HttpHandler, HttpInterceptor, HttpRequest, HttpEvent } from '@angular/common/http';
|
|
4
|
+
import { inject, Injectable } from '@angular/core';
|
|
5
|
+
import { Router } from '@angular/router';
|
|
6
|
+
import { Observable, throwError, from } from 'rxjs';
|
|
7
|
+
import { catchError, switchMap } from 'rxjs/operators';
|
|
8
|
+
|
|
9
|
+
@Injectable({ providedIn: 'root' })
|
|
10
|
+
export class BasicInterceptor implements HttpInterceptor {
|
|
11
|
+
private isRefreshing = false;
|
|
12
|
+
|
|
13
|
+
session = inject(AXPSessionService);
|
|
14
|
+
token = this.session.getToken();
|
|
15
|
+
router = inject(Router);
|
|
16
|
+
|
|
17
|
+
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<any> {
|
|
18
|
+
let modifiedReq = request.clone();
|
|
19
|
+
if (!(request.body instanceof FormData) && !request.headers.has('Content-Type')) {
|
|
20
|
+
modifiedReq = modifiedReq.clone({ setHeaders: { 'Content-Type': 'application/json' } });
|
|
21
|
+
}
|
|
22
|
+
if (this.token) {
|
|
23
|
+
modifiedReq = modifiedReq.clone({ setHeaders: { Authorization: `Bearer ${this.token}` } });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return next.handle(modifiedReq).pipe(
|
|
27
|
+
catchError((error: HttpErrorResponse) => {
|
|
28
|
+
if (error.status === 401 && !this.isRefreshing && this.token) {
|
|
29
|
+
return this.handle401Error(modifiedReq, next);
|
|
30
|
+
} else {
|
|
31
|
+
return throwError(() => error);
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
private handle401Error(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
|
38
|
+
this.isRefreshing = true;
|
|
39
|
+
|
|
40
|
+
return from(this.session.refreshToken()).pipe(
|
|
41
|
+
switchMap((c) => {
|
|
42
|
+
this.isRefreshing = false;
|
|
43
|
+
|
|
44
|
+
const _req = request.clone({
|
|
45
|
+
setHeaders: {
|
|
46
|
+
Authorization: `Bearer ${c}`,
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Retry the request with the new token
|
|
51
|
+
return next.handle(_req);
|
|
52
|
+
}),
|
|
53
|
+
catchError(() => {
|
|
54
|
+
this.isRefreshing = false;
|
|
55
|
+
this.session.signout();
|
|
56
|
+
this.router.navigate(['auth']); // Redirect to login on failure
|
|
57
|
+
return throwError(() => new Error('Token refresh failed'));
|
|
58
|
+
})
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
@@ -10,7 +10,7 @@ import { <%= upperCase(name) %>Strategy } from './auth.strategy';
|
|
|
10
10
|
|
|
11
11
|
@NgModule({
|
|
12
12
|
imports: [
|
|
13
|
-
AXMAuthModule
|
|
13
|
+
AXMAuthModule ,
|
|
14
14
|
AXPAuthModule.forRoot({
|
|
15
15
|
strategies: [<%= upperCase(name) %>Strategy],
|
|
16
16
|
}),
|
|
@@ -21,7 +21,7 @@ import { <%= upperCase(name) %>Strategy } from './auth.strategy';
|
|
|
21
21
|
provide: AXM_AUTH_CONFIG_TOKEN,
|
|
22
22
|
useValue: configAuthModule({
|
|
23
23
|
type: AXMAuthenticationTypes.UsernameEmailPassword,
|
|
24
|
-
|
|
24
|
+
authConfig: { ...environment.oidcConfig },
|
|
25
25
|
signinPage: {
|
|
26
26
|
description: `In this kind of post, the blogger introduces a person they’ve
|
|
27
27
|
interviewed and provides some background information about the
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AXPEntity } from '@acorex/platform/common';
|
|
2
|
+
import { AXPEntityDefinitionLoader } from '@acorex/platform/layout/entity';
|
|
2
3
|
import { Injectable, Injector, inject } from '@angular/core';
|
|
3
4
|
|
|
4
5
|
@Injectable()
|
|
5
|
-
export class AXPRootEntityLoader implements
|
|
6
|
+
export class AXPRootEntityLoader implements AXPEntityDefinitionLoader {
|
|
6
7
|
private injector = inject(Injector);
|
|
7
8
|
|
|
8
|
-
async get(moduleName: string, entityName: string): Promise<
|
|
9
|
+
async get(moduleName: string, entityName: string): Promise<AXPEntity | null> {
|
|
9
10
|
return new Promise(async (resolve) => {
|
|
10
11
|
switch (entityName) {
|
|
11
12
|
case 'sample': {
|
|
12
|
-
const entity = (await import('../<%= name %>/sample/sample.entity')).
|
|
13
|
-
resolve(entity(this.injector));
|
|
13
|
+
const entity = (await import('../<%= name %>/sample/sample.entity')).sampleFactory;
|
|
14
|
+
resolve(entity(this.injector) as any);
|
|
14
15
|
break;
|
|
15
16
|
}
|
|
16
17
|
default:
|
package/src/generators/app-module/files/src/app/modules/layout/layout-root.module.ts.template
CHANGED
|
@@ -1,73 +1,71 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AXPCommonModule,
|
|
3
|
+
AXPComponentSlotModule,
|
|
2
4
|
AXPFooterTextSlotComponent,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
+
AXPMenuItem,
|
|
6
|
+
AXPNavBarSlotComponent,
|
|
5
7
|
AXP_ENTITY_LOADER,
|
|
6
|
-
|
|
8
|
+
AXP_MENU_PROVIDER,
|
|
9
|
+
AXP_PLATFORM_CONFIG_TOKEN,
|
|
7
10
|
} from '@acorex/platform/common';
|
|
11
|
+
import { AXPLayoutModule } from '@acorex/platform/layouts';
|
|
8
12
|
import { NgModule, inject } from '@angular/core';
|
|
9
|
-
import { AXPRootMenuLoader } from './menu.loader';
|
|
10
|
-
import { AXPRootEntityLoader } from './entity.loader';
|
|
11
|
-
import { AXPCommonModule, AXPMenuItem, AXPNavigateAction, AXP_MENU_LOADER, AXP_PLATFORM_CONFIG_TOKEN } from '@acorex/platform/common';
|
|
12
13
|
import pkg from '../../../../../../package.json';
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
import { AXPRootEntityLoader } from './entity.loader';
|
|
15
|
+
import { AXPRootMenuProvider } from './menu.provider';
|
|
16
|
+
import { AXPEntityModule, AXP_ENTITY_DEFINITION_LOADER } from '@acorex/platform/layout/entity';
|
|
17
|
+
import { AXPDefaultThemeModule } from '@acorex/platform/themes/default';
|
|
18
|
+
import { AXPThemeSlotComponent } from '@acorex/platform/themes/shared';
|
|
15
19
|
@NgModule({
|
|
16
20
|
imports: [
|
|
17
|
-
|
|
21
|
+
AXPDefaultThemeModule,
|
|
18
22
|
AXPCommonModule,
|
|
19
23
|
AXPLayoutModule,
|
|
24
|
+
AXPEntityModule,
|
|
20
25
|
AXPComponentSlotModule.forRoot({
|
|
21
|
-
|
|
26
|
+
'footer-start': [
|
|
22
27
|
{
|
|
23
|
-
name:
|
|
28
|
+
name: 'version',
|
|
24
29
|
component: AXPFooterTextSlotComponent,
|
|
25
30
|
options: () => {
|
|
26
31
|
return { text: `v${pkg.version}` };
|
|
27
|
-
}
|
|
32
|
+
},
|
|
28
33
|
},
|
|
29
34
|
{
|
|
30
|
-
name:
|
|
35
|
+
name: 'copyright',
|
|
31
36
|
component: AXPFooterTextSlotComponent,
|
|
32
37
|
options: () => {
|
|
33
38
|
const a = inject(AXP_PLATFORM_CONFIG_TOKEN);
|
|
34
39
|
return { text: a.copyright };
|
|
35
|
-
}
|
|
40
|
+
},
|
|
36
41
|
},
|
|
37
42
|
],
|
|
38
|
-
|
|
43
|
+
'auth-footer-links': [
|
|
39
44
|
{
|
|
40
|
-
name:
|
|
45
|
+
name: 'links',
|
|
41
46
|
component: AXPNavBarSlotComponent,
|
|
42
|
-
|
|
43
|
-
const items: AXPMenuItem[] = [
|
|
44
|
-
// {
|
|
45
|
-
// text: 'About',
|
|
46
|
-
// command: AXPNavigateAction({ payload: { commands: ['asc/help/about'] } })
|
|
47
|
-
// }
|
|
48
|
-
];
|
|
49
|
-
return { items };
|
|
50
|
-
}
|
|
51
|
-
}
|
|
47
|
+
},
|
|
52
48
|
],
|
|
53
|
-
|
|
49
|
+
'header-end': [
|
|
54
50
|
{
|
|
55
51
|
name: 'theme',
|
|
56
52
|
component: AXPThemeSlotComponent,
|
|
57
53
|
},
|
|
58
54
|
],
|
|
59
|
-
})
|
|
55
|
+
}),
|
|
60
56
|
],
|
|
61
57
|
exports: [],
|
|
62
58
|
providers: [
|
|
63
|
-
|
|
64
|
-
provide:
|
|
65
|
-
useClass:
|
|
59
|
+
{
|
|
60
|
+
provide: AXP_MENU_PROVIDER,
|
|
61
|
+
useClass: AXPRootMenuProvider,
|
|
62
|
+
multi: true,
|
|
66
63
|
},
|
|
67
64
|
{
|
|
68
|
-
provide:
|
|
69
|
-
useClass: AXPRootEntityLoader
|
|
65
|
+
provide: AXP_ENTITY_DEFINITION_LOADER,
|
|
66
|
+
useClass: AXPRootEntityLoader,
|
|
67
|
+
multi:true
|
|
70
68
|
},
|
|
71
69
|
],
|
|
72
70
|
})
|
|
73
|
-
export class AXPLayoutRootModule {
|
|
71
|
+
export class AXPLayoutRootModule {}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { AXPMenuProviderContext, AXPMenuProvider } from '@acorex/platform/common';
|
|
2
|
+
import { Injectable } from '@angular/core';
|
|
3
|
+
import { Router } from '@angular/router';
|
|
4
|
+
import { cloneDeep, omit } from 'lodash-es';
|
|
5
|
+
import { Observable, of } from 'rxjs';
|
|
6
|
+
|
|
7
|
+
@Injectable()
|
|
8
|
+
export class AXPRootMenuProvider implements AXPMenuProvider {
|
|
9
|
+
async provide(context: AXPMenuProviderContext): Promise<void> {
|
|
10
|
+
context.addItems([
|
|
11
|
+
{
|
|
12
|
+
text: 'Home',
|
|
13
|
+
path: '/<%= name %>/home',
|
|
14
|
+
icon: 'fa-solid fa-grid-2',
|
|
15
|
+
data: {
|
|
16
|
+
//requiredPermission: '',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
text: 'Administration',
|
|
21
|
+
type: 'group',
|
|
22
|
+
data: {
|
|
23
|
+
requiredPermission: 'admin',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
text: 'General Settings',
|
|
28
|
+
icon: 'fa-solid fa-gear',
|
|
29
|
+
data: {
|
|
30
|
+
requiredPermission: '<%= name %>.admin.settings',
|
|
31
|
+
},
|
|
32
|
+
children: [
|
|
33
|
+
{
|
|
34
|
+
text: 'Sample Dynamic Entity',
|
|
35
|
+
path: '/<%= name %>/m/sample/e/sample/list',
|
|
36
|
+
},
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
text: 'Security Management',
|
|
41
|
+
path: '/security',
|
|
42
|
+
icon: 'fa-solid fa-lock',
|
|
43
|
+
data: {
|
|
44
|
+
requiredPermission: '<%= name %>.admin.settings',
|
|
45
|
+
},
|
|
46
|
+
opened: false,
|
|
47
|
+
children: [
|
|
48
|
+
{
|
|
49
|
+
text: 'User Management',
|
|
50
|
+
icon: 'fa-solid fa-users',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
text: 'Roles Management',
|
|
54
|
+
icon: 'fa-solid fa-key',
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
text: 'Security Management',
|
|
60
|
+
path: '/security',
|
|
61
|
+
icon: 'fa-solid fa-lock',
|
|
62
|
+
data: {
|
|
63
|
+
requiredPermission: 'platform.admin.settings',
|
|
64
|
+
},
|
|
65
|
+
opened: false,
|
|
66
|
+
children: [
|
|
67
|
+
{
|
|
68
|
+
text: 'User Management',
|
|
69
|
+
icon: 'fa-solid fa-users',
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
text: 'Roles Management',
|
|
73
|
+
icon: 'fa-solid fa-key',
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
text: 'Tenant Management',
|
|
79
|
+
path: '/tenant-managemenet',
|
|
80
|
+
icon: 'fa-solid fa-sitemap',
|
|
81
|
+
data: {
|
|
82
|
+
requiredPermission: 'platform.admin.settings',
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
text: 'Reports',
|
|
87
|
+
type: 'group',
|
|
88
|
+
data: {
|
|
89
|
+
requiredPermission: 'platform.admin.reports',
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
text: 'log Management',
|
|
94
|
+
path: '/log-managemenet',
|
|
95
|
+
icon: 'fa-solid fa-file-lines',
|
|
96
|
+
data: {
|
|
97
|
+
requiredPermission: 'platform.admin.reports',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
]);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AXPDataGenerator } from '@acorex/platform/common';
|
|
2
|
+
|
|
3
|
+
export const USERS = Array.from({ length: 20 }).map((_, i) => {
|
|
4
|
+
const firstName = AXPDataGenerator.firstName();
|
|
5
|
+
const lastName = AXPDataGenerator.lastName();
|
|
6
|
+
return {
|
|
7
|
+
id: AXPDataGenerator.uuid(),
|
|
8
|
+
firstname: firstName,
|
|
9
|
+
lastname: lastName,
|
|
10
|
+
phone: AXPDataGenerator.phone(),
|
|
11
|
+
email: AXPDataGenerator.email(firstName, lastName),
|
|
12
|
+
address: AXPDataGenerator.address(),
|
|
13
|
+
};
|
|
14
|
+
});
|