@acorex/platform-generator 18.0.13 → 19.2.11
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 -3
- 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 +13 -21
- package/src/generators/app-module/files/src/app/modules/auth/auth-root.module.ts.template +1 -1
- package/src/generators/app-module/files/src/app/modules/layout/entity.loader.ts.template +1 -1
- package/src/generators/app-module/files/src/app/modules/layout/layout-root.module.ts.template +9 -8
- 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/sample/sample.entity.ts.template +25 -51
- 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 +67 -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 +59 -48
- package/src/generators/app-module/files/src/assets/i18n/fa/common.json +71 -9
- 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 +11 -19
- 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/modules/layout/menu.loader.ts.template +0 -159
package/generators.json
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"generators": {
|
|
3
|
-
"app
|
|
3
|
+
"create-app": {
|
|
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.2.11",
|
|
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",
|
|
@@ -146,10 +146,10 @@
|
|
|
146
146
|
"executor": "@angular-devkit/build-angular:dev-server",
|
|
147
147
|
"configurations": {
|
|
148
148
|
"serve-prod": {
|
|
149
|
-
"
|
|
149
|
+
"buildTarget": "<%= name %>:build:serve-prod"
|
|
150
150
|
},
|
|
151
151
|
"serve-dev": {
|
|
152
|
-
"
|
|
152
|
+
"buildTarget": "<%= name %>:build:serve-dev"
|
|
153
153
|
},
|
|
154
154
|
},
|
|
155
155
|
"defaultConfiguration": "development"
|
|
@@ -157,7 +157,7 @@
|
|
|
157
157
|
"extract-i18n": {
|
|
158
158
|
"executor": "@angular-devkit/build-angular:extract-i18n",
|
|
159
159
|
"options": {
|
|
160
|
-
"
|
|
160
|
+
"buildTarget": "<%= name %>:build"
|
|
161
161
|
}
|
|
162
162
|
},
|
|
163
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';
|
|
@@ -11,14 +12,12 @@ import { StoreDevtoolsModule } from '@ngrx/store-devtools';
|
|
|
11
12
|
import { AppComponent } from './app.component';
|
|
12
13
|
import { appRoutes } from './app.routes';
|
|
13
14
|
import { BasicInterceptor } from './basic-interceptor.interceptor';
|
|
14
|
-
|
|
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
|
-
AXPDexieStorageService,
|
|
18
|
+
import {
|
|
19
19
|
AXPImageUrlLogoConfig,
|
|
20
|
-
AXPTextLogoConfig,
|
|
21
|
-
AXPStorageService,
|
|
20
|
+
AXPTextLogoConfig,
|
|
22
21
|
AXP_PLATFORM_CONFIG_TOKEN,
|
|
23
22
|
configPlatform,
|
|
24
23
|
} from '@acorex/platform/common';
|
|
@@ -29,16 +28,8 @@ import { AXPLayoutRootModule } from './modules/layout/layout-root.module';
|
|
|
29
28
|
import { AXLoadingDialogModule } from '@acorex/components/loading-dialog';
|
|
30
29
|
import { AXP_ROOT_CONFIG_TOKEN } from '@acorex/platform/common';
|
|
31
30
|
import { environment } from '../environments/environment';
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return () => {
|
|
35
|
-
const loadingText = document.querySelector('#loadingText');
|
|
36
|
-
return new Promise((resolve) => {
|
|
37
|
-
if (loadingText) loadingText.innerHTML = 'Initializing Modules...';
|
|
38
|
-
resolve(0);
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
}
|
|
31
|
+
import { AXMSampleEntityModule } from './modules/<%= name %>/sample/sample.module';
|
|
32
|
+
|
|
42
33
|
|
|
43
34
|
|
|
44
35
|
@NgModule({
|
|
@@ -59,9 +50,11 @@ export function initApp() {
|
|
|
59
50
|
AXPLayoutRootModule,
|
|
60
51
|
AXDialogModule,
|
|
61
52
|
AXLoadingDialogModule,
|
|
53
|
+
AXCMockModule,
|
|
62
54
|
//
|
|
63
55
|
AXPAuthRootModule,
|
|
64
56
|
//
|
|
57
|
+
AXMSampleEntityModule,
|
|
65
58
|
StoreDevtoolsModule.instrument({
|
|
66
59
|
maxAge: 25, // Retains last 25 states
|
|
67
60
|
logOnly: !isDevMode(), // Restrict extension to log-only mode
|
|
@@ -72,9 +65,8 @@ export function initApp() {
|
|
|
72
65
|
}),
|
|
73
66
|
],
|
|
74
67
|
providers: [
|
|
75
|
-
provideHttpClient(),
|
|
76
|
-
provideRouter(appRoutes, withEnabledBlockingInitialNavigation()),
|
|
77
|
-
{ provide: APP_INITIALIZER, useFactory: initApp, multi: true, deps: [] },
|
|
68
|
+
provideHttpClient(withInterceptorsFromDi()),
|
|
69
|
+
provideRouter(appRoutes, withEnabledBlockingInitialNavigation()),
|
|
78
70
|
{ provide: HTTP_INTERCEPTORS, useClass: BasicInterceptor, multi: true },
|
|
79
71
|
{
|
|
80
72
|
provide: AXP_ROOT_CONFIG_TOKEN, useValue: {
|
|
@@ -94,7 +86,7 @@ export function initApp() {
|
|
|
94
86
|
'Copyright © 2024',
|
|
95
87
|
}),
|
|
96
88
|
},
|
|
97
|
-
|
|
89
|
+
|
|
98
90
|
],
|
|
99
91
|
declarations: [AppComponent],
|
|
100
92
|
bootstrap: [AppComponent],
|
|
@@ -10,7 +10,7 @@ export class AXPRootEntityLoader implements AXPEntityDefinitionLoader {
|
|
|
10
10
|
return new Promise(async (resolve) => {
|
|
11
11
|
switch (entityName) {
|
|
12
12
|
case 'sample': {
|
|
13
|
-
const entity = (await import('../<%= name %>/sample/sample.entity')).
|
|
13
|
+
const entity = (await import('../<%= name %>/sample/sample.entity')).sampleFactory;
|
|
14
14
|
resolve(entity(this.injector) as any);
|
|
15
15
|
break;
|
|
16
16
|
}
|
package/src/generators/app-module/files/src/app/modules/layout/layout-root.module.ts.template
CHANGED
|
@@ -3,20 +3,19 @@ import {
|
|
|
3
3
|
AXPComponentSlotModule,
|
|
4
4
|
AXPFooterTextSlotComponent,
|
|
5
5
|
AXPMenuItem,
|
|
6
|
-
AXPNavBarSlotComponent,
|
|
7
|
-
AXPThemeSlotComponent,
|
|
6
|
+
AXPNavBarSlotComponent,
|
|
8
7
|
AXP_ENTITY_LOADER,
|
|
9
|
-
|
|
8
|
+
AXP_MENU_PROVIDER,
|
|
10
9
|
AXP_PLATFORM_CONFIG_TOKEN,
|
|
11
10
|
} from '@acorex/platform/common';
|
|
12
11
|
import { AXPLayoutModule } from '@acorex/platform/layouts';
|
|
13
12
|
import { NgModule, inject } from '@angular/core';
|
|
14
13
|
import pkg from '../../../../../../package.json';
|
|
15
14
|
import { AXPRootEntityLoader } from './entity.loader';
|
|
16
|
-
import {
|
|
15
|
+
import { AXPRootMenuProvider } from './menu.provider';
|
|
17
16
|
import { AXPEntityModule, AXP_ENTITY_DEFINITION_LOADER } from '@acorex/platform/layout/entity';
|
|
18
17
|
import { AXPDefaultThemeModule } from '@acorex/platform/themes/default';
|
|
19
|
-
|
|
18
|
+
import { AXPThemeSlotComponent } from '@acorex/platform/themes/shared';
|
|
20
19
|
@NgModule({
|
|
21
20
|
imports: [
|
|
22
21
|
AXPDefaultThemeModule,
|
|
@@ -57,13 +56,15 @@ import { AXPDefaultThemeModule } from '@acorex/platform/themes/default';
|
|
|
57
56
|
],
|
|
58
57
|
exports: [],
|
|
59
58
|
providers: [
|
|
60
|
-
|
|
61
|
-
provide:
|
|
62
|
-
useClass:
|
|
59
|
+
{
|
|
60
|
+
provide: AXP_MENU_PROVIDER,
|
|
61
|
+
useClass: AXPRootMenuProvider,
|
|
62
|
+
multi: true,
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
provide: AXP_ENTITY_DEFINITION_LOADER,
|
|
66
66
|
useClass: AXPRootEntityLoader,
|
|
67
|
+
multi:true
|
|
67
68
|
},
|
|
68
69
|
],
|
|
69
70
|
})
|
|
@@ -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
|
+
}
|
package/src/generators/app-module/files/src/app/modules/root/sample/sample.entity.ts.template
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import {
|
|
3
|
-
AXPDataGenerator,
|
|
4
3
|
AXPEntity,
|
|
5
|
-
AXPEntityCommandScope,
|
|
6
|
-
|
|
7
|
-
AXPEntityQueryType,
|
|
8
|
-
AXPStorageService,
|
|
4
|
+
AXPEntityCommandScope,
|
|
5
|
+
AXPEntityQueryType,
|
|
9
6
|
} from '@acorex/platform/common';
|
|
10
7
|
import { AXPWidgetsCatalog } from '@acorex/platform/layout/builder';
|
|
11
8
|
import { Injector } from '@angular/core';
|
|
12
|
-
import {
|
|
9
|
+
import { AXMSampleEntityService } from './sample.service';
|
|
10
|
+
import { AXMSampleModuleConst } from '../const';
|
|
13
11
|
|
|
14
|
-
export async function
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
export async function sampleFactory(injector: Injector): Promise<AXPEntity | null> {
|
|
13
|
+
const dataService = injector.get(AXMSampleEntityService);
|
|
14
|
+
|
|
15
|
+
const moduleName = AXMSampleModuleConst.moduleName;
|
|
18
16
|
|
|
19
17
|
const entityDef: AXPEntity = {
|
|
20
|
-
module:
|
|
21
|
-
name:
|
|
22
|
-
source: '
|
|
18
|
+
module: moduleName,
|
|
19
|
+
name: AXMSampleModuleConst.categoryEntity,
|
|
20
|
+
source: '',
|
|
23
21
|
title: 'Sample Entity',
|
|
24
22
|
formats: {
|
|
25
|
-
individual: '
|
|
26
|
-
plural: '
|
|
23
|
+
individual: 'Sample',
|
|
24
|
+
plural: 'Samples',
|
|
27
25
|
},
|
|
28
26
|
relatedEntities: [],
|
|
29
27
|
groups: [
|
|
@@ -106,17 +104,16 @@ export async function entityFactory(injector: Injector): Promise<AXPEntity | nul
|
|
|
106
104
|
},
|
|
107
105
|
],
|
|
108
106
|
},
|
|
109
|
-
|
|
107
|
+
{
|
|
110
108
|
name: 'email',
|
|
111
109
|
title: 'Email',
|
|
112
110
|
groupId: 'contact',
|
|
113
111
|
schema: {
|
|
114
112
|
dataType: 'string',
|
|
115
113
|
interface: {
|
|
116
|
-
type: AXPWidgetsCatalog.
|
|
114
|
+
type: AXPWidgetsCatalog.contact,
|
|
117
115
|
options: {
|
|
118
|
-
|
|
119
|
-
hasLabel: false,
|
|
116
|
+
type: { id: 'email', title: 'Email' },
|
|
120
117
|
},
|
|
121
118
|
},
|
|
122
119
|
},
|
|
@@ -133,10 +130,9 @@ export async function entityFactory(injector: Injector): Promise<AXPEntity | nul
|
|
|
133
130
|
schema: {
|
|
134
131
|
dataType: 'string',
|
|
135
132
|
interface: {
|
|
136
|
-
type: AXPWidgetsCatalog.
|
|
133
|
+
type: AXPWidgetsCatalog.contact,
|
|
137
134
|
options: {
|
|
138
|
-
|
|
139
|
-
hasLabel: false,
|
|
135
|
+
type: { id: 'phone', title: 'phone' },
|
|
140
136
|
},
|
|
141
137
|
},
|
|
142
138
|
},
|
|
@@ -167,16 +163,14 @@ export async function entityFactory(injector: Injector): Promise<AXPEntity | nul
|
|
|
167
163
|
create: {
|
|
168
164
|
execute: async (data: any) => {
|
|
169
165
|
console.log('CREATE', data);
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
return Promise.resolve(entity);
|
|
166
|
+
const res =await dataService.insertOne(data);
|
|
167
|
+
return {id: res};
|
|
173
168
|
},
|
|
174
169
|
},
|
|
175
170
|
delete: {
|
|
176
171
|
execute: async (id: any) => {
|
|
177
172
|
console.log('DELETE', id);
|
|
178
|
-
|
|
179
|
-
return Promise.resolve();
|
|
173
|
+
return await dataService.deleteOne(id);
|
|
180
174
|
},
|
|
181
175
|
},
|
|
182
176
|
update: {
|
|
@@ -184,7 +178,7 @@ export async function entityFactory(injector: Injector): Promise<AXPEntity | nul
|
|
|
184
178
|
console.log('UPDATE', data);
|
|
185
179
|
return new Promise((resolve) => {
|
|
186
180
|
setTimeout(async () => {
|
|
187
|
-
await
|
|
181
|
+
await dataService.updateOne(data.id, data);
|
|
188
182
|
resolve(data);
|
|
189
183
|
}, 1000);
|
|
190
184
|
});
|
|
@@ -197,7 +191,7 @@ export async function entityFactory(injector: Injector): Promise<AXPEntity | nul
|
|
|
197
191
|
console.log('users=>byKey', id);
|
|
198
192
|
return new Promise((resolve) => {
|
|
199
193
|
setTimeout(async () => {
|
|
200
|
-
const entity = await
|
|
194
|
+
const entity = await dataService.getOne(id);
|
|
201
195
|
resolve(entity);
|
|
202
196
|
}, 500);
|
|
203
197
|
});
|
|
@@ -206,14 +200,7 @@ export async function entityFactory(injector: Injector): Promise<AXPEntity | nul
|
|
|
206
200
|
},
|
|
207
201
|
list: {
|
|
208
202
|
execute: async (e: any) => {
|
|
209
|
-
|
|
210
|
-
const list = await dataProvider.getAll();
|
|
211
|
-
const sortedItems = applySortArray(list, e.sort);
|
|
212
|
-
const filteredItems = applyFilterArray(sortedItems, e.filter ? [e.filter] : []);
|
|
213
|
-
return Promise.resolve({
|
|
214
|
-
total: filteredItems.length,
|
|
215
|
-
items: filteredItems.slice(e.skip, (e.skip ?? 0) + (e.take ?? 0)),
|
|
216
|
-
});
|
|
203
|
+
return await dataService.query({ skip: e.skip, take: e.take, filter: e.filter, sort: e.sort });
|
|
217
204
|
},
|
|
218
205
|
type: AXPEntityQueryType.List,
|
|
219
206
|
},
|
|
@@ -228,9 +215,6 @@ export async function entityFactory(injector: Injector): Promise<AXPEntity | nul
|
|
|
228
215
|
{
|
|
229
216
|
id: 'contact',
|
|
230
217
|
},
|
|
231
|
-
{
|
|
232
|
-
id: 'address',
|
|
233
|
-
},
|
|
234
218
|
],
|
|
235
219
|
properties: [
|
|
236
220
|
{
|
|
@@ -273,16 +257,6 @@ export async function entityFactory(injector: Injector): Promise<AXPEntity | nul
|
|
|
273
257
|
},
|
|
274
258
|
},
|
|
275
259
|
},
|
|
276
|
-
{
|
|
277
|
-
name: 'address',
|
|
278
|
-
layout: {
|
|
279
|
-
positions: {
|
|
280
|
-
lg: {
|
|
281
|
-
colSpan: 12,
|
|
282
|
-
},
|
|
283
|
-
},
|
|
284
|
-
},
|
|
285
|
-
},
|
|
286
260
|
],
|
|
287
261
|
},
|
|
288
262
|
update: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NgModule } from '@angular/core';
|
|
2
|
+
import {
|
|
3
|
+
AXMSampleEntityService,
|
|
4
|
+
AXMSampleEntityServiceImpl
|
|
5
|
+
} from './sample.service';
|
|
6
|
+
|
|
7
|
+
@NgModule({
|
|
8
|
+
imports: [],
|
|
9
|
+
exports: [],
|
|
10
|
+
declarations: [],
|
|
11
|
+
providers: [
|
|
12
|
+
{
|
|
13
|
+
provide: AXMSampleEntityService,
|
|
14
|
+
useClass: AXMSampleEntityServiceImpl,
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
})
|
|
18
|
+
export class AXMSampleEntityModule {}
|
package/src/generators/app-module/files/src/app/modules/root/sample/sample.service.ts.template
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AXMEntityCrudServiceImpl } from '@acorex/platform/common';
|
|
2
|
+
import { Injectable } from '@angular/core';
|
|
3
|
+
import { AXMSampleModuleConst } from '../const';
|
|
4
|
+
import { AXMSampleEntityModel } from './sample.types';
|
|
5
|
+
import { AXMSampleCreateEntityModel } from './sample.types';
|
|
6
|
+
|
|
7
|
+
export abstract class AXMSampleEntityService extends AXMEntityCrudServiceImpl<
|
|
8
|
+
string,
|
|
9
|
+
AXMSampleEntityModel,
|
|
10
|
+
AXMSampleCreateEntityModel
|
|
11
|
+
> {}
|
|
12
|
+
|
|
13
|
+
@Injectable()
|
|
14
|
+
export class AXMSampleEntityServiceImpl extends AXMSampleEntityService {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(`${AXMSampleModuleConst.moduleName}.${AXMSampleModuleConst.categoryEntity}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AXPEntityModel } from '@acorex/platform/common';
|
|
2
|
+
|
|
3
|
+
export interface AXMSampleEntityModel extends AXPEntityModel<string> {
|
|
4
|
+
firstname?: string;
|
|
5
|
+
lastname?: string;
|
|
6
|
+
phone?: string;
|
|
7
|
+
email?: string;
|
|
8
|
+
address?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AXMSampleCreateEntityModel extends AXPEntityModel<string> {
|
|
11
|
+
firstname?: string;
|
|
12
|
+
lastname?: string;
|
|
13
|
+
phone?: string;
|
|
14
|
+
email?: string;
|
|
15
|
+
}
|
|
@@ -6,10 +6,17 @@
|
|
|
6
6
|
"username-email": "Username / Email",
|
|
7
7
|
"firstname": "First Name",
|
|
8
8
|
"lastname": "Last Name",
|
|
9
|
+
"register": "Register",
|
|
9
10
|
"mobile": "Mobile",
|
|
10
11
|
"processing": "Processing...",
|
|
11
12
|
"redirecting": "Redirecting...",
|
|
12
13
|
"backLogin": "Back to Login",
|
|
14
|
+
"profile": {
|
|
15
|
+
"title": "Profile",
|
|
16
|
+
"edit": "Edit Profile",
|
|
17
|
+
"logout": "Logout",
|
|
18
|
+
"settings": "Settings"
|
|
19
|
+
},
|
|
13
20
|
"signin": {
|
|
14
21
|
"title": "Sign In",
|
|
15
22
|
"submit": "Sign In",
|
|
@@ -45,5 +52,10 @@
|
|
|
45
52
|
"submit": "Reset Password",
|
|
46
53
|
"remember": "Remember Password?",
|
|
47
54
|
"hint": "Enter Your {{ name }}"
|
|
55
|
+
},
|
|
56
|
+
"management": {
|
|
57
|
+
"title": "Security",
|
|
58
|
+
"users": "Users",
|
|
59
|
+
"rols": "Roles"
|
|
48
60
|
}
|
|
49
61
|
}
|