@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
|
@@ -1,19 +1,54 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
1
|
+
const { createGlobPatternsForDependencies } = require('@nx/angular/tailwind');
|
|
2
|
+
const { join } = require('path');
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
module.exports
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
/** @type {import('tailwindcss').Config} */
|
|
5
|
+
module.exports = {
|
|
6
|
+
presets: [require('@acorex/styles/tailwind-base')],
|
|
7
|
+
content: [join(__dirname, 'src/**/!(*.stories|*.spec).{ts,html}'), ...createGlobPatternsForDependencies(__dirname)],
|
|
8
|
+
safelist:[
|
|
9
|
+
...generateResponsiveGridClasses('ax-col-start-', 12),
|
|
10
|
+
...generateResponsiveGridClasses('ax-col-end-', 12),
|
|
11
|
+
...generateResponsiveGridClasses('ax-col-span-', 12),
|
|
12
|
+
...generateResponsiveGridClasses('ax-row-start-', 12),
|
|
13
|
+
...generateResponsiveGridClasses('ax-row-end-', 12),
|
|
14
|
+
...generateResponsiveGridClasses('ax-row-span-', 12),
|
|
15
|
+
...generateResponsiveGridClasses('ax-grid-cols-', 12),
|
|
16
|
+
...generateResponsiveGridClasses('ax-grid-rows-', 12),
|
|
17
|
+
...generateResponsiveGridClasses('ax-order-', 12), // Add order classes
|
|
18
|
+
...generateRangeClasses('ax-gap-',12),
|
|
19
|
+
...generateResponsiveUtilityClasses('ax-order-last','ax-order-first','ax-order-none','ax-justify-between')
|
|
20
|
+
|
|
21
|
+
],
|
|
22
|
+
theme: {
|
|
23
|
+
extend: {},
|
|
24
|
+
},
|
|
25
|
+
plugins: [],
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
function generateResponsiveGridClasses(base, max) {
|
|
31
|
+
const breakpoints = ['','sm', 'md', 'lg', 'xl', '2xl'];
|
|
32
|
+
let classes = [];
|
|
33
|
+
for (let breakpoint of breakpoints) {
|
|
34
|
+
classes = classes.concat(Array.from({ length: max }, (_, i) => breakpoint!=''? `${breakpoint}:${base}${i + 1}`: `${base}${i + 1}`));
|
|
35
|
+
}
|
|
36
|
+
return classes;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
function generateResponsiveUtilityClasses(...classes) {
|
|
41
|
+
const breakpoints = ['','sm', 'md', 'lg', 'xl', '2xl'];
|
|
42
|
+
let generatedClasses = [];
|
|
43
|
+
classes.forEach(cls => {
|
|
44
|
+
breakpoints.forEach(breakpoint => {
|
|
45
|
+
generatedClasses.push(breakpoint ? `${breakpoint}:${cls}` : cls);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
return generatedClasses;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function generateRangeClasses(base, max) {
|
|
52
|
+
let classes = Array.from({ length: max+1 }, (_, i) => `${base}${i}`);
|
|
53
|
+
return classes;
|
|
54
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
function default_1(tree, schema) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
const normalizedNames = (0, devkit_1.names)(schema.name);
|
|
10
|
+
const targetDir = (0, devkit_1.joinPathFragments)('libs', 'modules');
|
|
11
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), targetDir, Object.assign(Object.assign(Object.assign({}, schema), normalizedNames), { tmpl: '' }));
|
|
12
|
+
// Define the new path entry
|
|
13
|
+
const newPath = `@acorex/modules/${normalizedNames.fileName}`;
|
|
14
|
+
const newPathValue = [`libs/modules/${normalizedNames.fileName}/src/index.ts`];
|
|
15
|
+
// Update tsconfig.base.json to include the new path
|
|
16
|
+
(0, devkit_1.updateJson)(tree, 'tsconfig.base.json', (json) => {
|
|
17
|
+
if (!json.compilerOptions.paths) {
|
|
18
|
+
json.compilerOptions.paths = {};
|
|
19
|
+
}
|
|
20
|
+
json.compilerOptions.paths[newPath] = newPathValue;
|
|
21
|
+
return json;
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../generator/src/generators/create-app-module/generator.ts"],"names":[],"mappings":";;AAOA,4BAsBC;;AA7BD,uCAAuF;AACvF,6BAA6B;AAM7B,mBAA+B,IAAU,EAAE,MAAc;;QACvD,MAAM,eAAe,GAAG,IAAA,cAAK,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC3C,MAAM,SAAS,GAAG,IAAA,0BAAiB,EAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAEvD,IAAA,sBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,SAAS,gDACvD,MAAM,GACN,eAAe,KAClB,IAAI,EAAE,EAAE,IACR,CAAC;QAEH,4BAA4B;QAC5B,MAAM,OAAO,GAAG,mBAAmB,eAAe,CAAC,QAAQ,EAAE,CAAC;QAC9D,MAAM,YAAY,GAAG,CAAC,gBAAgB,eAAe,CAAC,QAAQ,eAAe,CAAC,CAAC;QAE/E,oDAAoD;QACpD,IAAA,mBAAU,EAAC,IAAI,EAAE,oBAAoB,EAAE,CAAC,IAAI,EAAE,EAAE;YAC9C,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;gBAChC,IAAI,CAAC,eAAe,CAAC,KAAK,GAAG,EAAE,CAAC;YAClC,CAAC;YACD,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC;YACnD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"title": "Module Generator",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"name": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "The name of the module to generate",
|
|
9
|
+
"x-prompt": "What is the Module Name?"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"required": ["name"]
|
|
13
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
function default_1(tree, schema) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
const normalizedNames = generateNameVariants(schema.name, 'entity');
|
|
10
|
+
const normalizedModuleNames = generateNameVariants(schema.moduleName, 'module');
|
|
11
|
+
const targetDir = (0, devkit_1.joinPathFragments)('libs', 'modules', // Ensure 'modules' is part of the path
|
|
12
|
+
normalizedModuleNames.moduleFileName, 'src', 'lib', 'entities', normalizedNames.entityFileName);
|
|
13
|
+
// Define the new menu item to add
|
|
14
|
+
const newMenuItem = `
|
|
15
|
+
{
|
|
16
|
+
text: \`\${scope}.${normalizedNames.entityPropertyName}\`,
|
|
17
|
+
path: '',
|
|
18
|
+
icon: ''
|
|
19
|
+
},
|
|
20
|
+
`;
|
|
21
|
+
const targetDirModule = (0, devkit_1.joinPathFragments)('libs', 'modules', normalizedModuleNames.moduleFileName);
|
|
22
|
+
(0, devkit_1.generateFiles)(tree, path.join(__dirname, 'files'), targetDir, Object.assign(Object.assign(Object.assign(Object.assign({}, schema), normalizedModuleNames), normalizedNames), { tmpl: '' }));
|
|
23
|
+
function generateNameVariants(baseName, prefix) {
|
|
24
|
+
const formattedNames = (0, devkit_1.names)(baseName);
|
|
25
|
+
//const capitalizedPrefix = prefix.charAt(0).toUpperCase() + prefix.slice(1);
|
|
26
|
+
return {
|
|
27
|
+
[`${prefix}Name`]: formattedNames.name,
|
|
28
|
+
[`${prefix}ClassName`]: formattedNames.className,
|
|
29
|
+
[`${prefix}PropertyName`]: formattedNames.propertyName,
|
|
30
|
+
[`${prefix}FileName`]: formattedNames.fileName,
|
|
31
|
+
[`${prefix}ConstantName`]: formattedNames.constantName,
|
|
32
|
+
[`${prefix}HumanName`]: toSpacedString(formattedNames.name),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function toSpacedString(str) {
|
|
36
|
+
return str.replace(/([a-z0-9])([A-Z])/g, '$1 $2').toLowerCase();
|
|
37
|
+
}
|
|
38
|
+
// Update const.ts with the new entity key
|
|
39
|
+
const constFilePath = (0, devkit_1.joinPathFragments)(targetDirModule, 'src/lib/const.ts');
|
|
40
|
+
if (tree.exists(constFilePath)) {
|
|
41
|
+
const originalContent = tree.read(constFilePath, 'utf-8');
|
|
42
|
+
const newContent = originalContent.replace(/};/, ` ${normalizedNames.entityPropertyName}Entity : '${normalizedNames.entityClassName}',\n};`);
|
|
43
|
+
tree.write(constFilePath, newContent);
|
|
44
|
+
}
|
|
45
|
+
// Append import and module to the existing module.ts file if it exists
|
|
46
|
+
const moduleFilePath = (0, devkit_1.joinPathFragments)(targetDirModule, `src/lib/${normalizedModuleNames.moduleFileName}.module.ts`);
|
|
47
|
+
// Define import and module strings for the new entity
|
|
48
|
+
const entityImport = `import { AXM${normalizedModuleNames.moduleClassName}${normalizedNames.entityClassName}EntityModule } from './entities/${normalizedNames.entityFileName}';`;
|
|
49
|
+
const entityModule = `AXM${normalizedModuleNames.moduleClassName}${normalizedNames.entityClassName}EntityModule`;
|
|
50
|
+
if (tree.exists(moduleFilePath)) {
|
|
51
|
+
const originalContent = tree.read(moduleFilePath, 'utf-8');
|
|
52
|
+
// Add the import if not already present
|
|
53
|
+
const updatedImports = originalContent.includes(entityImport)
|
|
54
|
+
? originalContent
|
|
55
|
+
: originalContent.replace(/(@NgModule\(\{)/, `${entityImport}\n$1`);
|
|
56
|
+
// Add the module to the imports array if not already present
|
|
57
|
+
const updatedImportsArray = updatedImports.includes(`${entityModule},`) ||
|
|
58
|
+
updatedImports.includes(`${entityModule} ,`) ||
|
|
59
|
+
updatedImports.includes(`[${entityModule}`) ||
|
|
60
|
+
updatedImports.includes(`[ ${entityModule}`) ||
|
|
61
|
+
updatedImports.includes(`${entityModule} ]`) ||
|
|
62
|
+
updatedImports.includes(`${entityModule}]`)
|
|
63
|
+
? updatedImports
|
|
64
|
+
: updatedImports.replace(/imports:\s*\[/, `imports: [${entityModule}, `);
|
|
65
|
+
// Write the updated content back to the module file
|
|
66
|
+
tree.write(moduleFilePath, updatedImportsArray);
|
|
67
|
+
}
|
|
68
|
+
// Append new menu item to `children` array in `menu.provider.ts`
|
|
69
|
+
const menuProviderFilePath = (0, devkit_1.joinPathFragments)(targetDirModule, 'src/lib/menu.provider.ts');
|
|
70
|
+
if (tree.exists(menuProviderFilePath)) {
|
|
71
|
+
const originalContent = tree.read(menuProviderFilePath, 'utf-8');
|
|
72
|
+
// Find the placeholder in the children array and add the new menu item
|
|
73
|
+
const updatedContent = originalContent.replace(/children:\s*\[\s*<%= menuItems %>\s*\]/, `children: [${newMenuItem}<%= menuItems %>]`);
|
|
74
|
+
// Write the updated content back to the `menu.provider.ts` file
|
|
75
|
+
tree.write(menuProviderFilePath, updatedContent);
|
|
76
|
+
}
|
|
77
|
+
const indexFilePath = (0, devkit_1.joinPathFragments)(targetDirModule, 'src', 'lib', 'entities', 'index.ts');
|
|
78
|
+
// Define the new export line
|
|
79
|
+
const newExportLine = `export * from './${normalizedNames.entityFileName}';\n`;
|
|
80
|
+
// Check if index.ts exists and append the new export line
|
|
81
|
+
if (tree.exists(indexFilePath)) {
|
|
82
|
+
const originalContent = tree.read(indexFilePath, 'utf-8');
|
|
83
|
+
const updatedContent = originalContent.includes(newExportLine)
|
|
84
|
+
? originalContent
|
|
85
|
+
: `${originalContent}${newExportLine}`;
|
|
86
|
+
tree.write(indexFilePath, updatedContent);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
// If index.ts does not exist, create it with the new export line
|
|
90
|
+
tree.write(indexFilePath, newExportLine);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../../../generator/src/generators/create-module-entity/generator.ts"],"names":[],"mappings":";;AAQA,4BA4HC;;A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AG,oBAAoB,eAAe,CAAC,cAAc,MAAM,CAAC;QAE/E,0DAA0D;QAC1D,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAC;YAC/B,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;YAC1D,MAAM,cAAc,GAAG,eAAe,CAAC,QAAQ,CAAC,aAAa,CAAC;gBAC5D,CAAC,CAAC,eAAe;gBACjB,CAAC,CAAC,GAAG,eAAe,GAAG,aAAa,EAAE,CAAC;YACzC,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,iEAAiE;YACjE,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,aAAa,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"title": "Create Module Entity",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"moduleName": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"description": "The name of the module"
|
|
9
|
+
},
|
|
10
|
+
"name": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "The name of the entity"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"required": ["moduleName", "name"]
|
|
16
|
+
}
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import { AXPMenuItem, AXPMenuLoader } 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 AXPRootMenuLoader implements AXPMenuLoader {
|
|
9
|
-
private initialMenu: AXPMenuItem[] = [
|
|
10
|
-
{
|
|
11
|
-
text: 'Home',
|
|
12
|
-
path: '/<%= name %>/home',
|
|
13
|
-
icon: 'fa-solid fa-grid-2',
|
|
14
|
-
data: {
|
|
15
|
-
//requiredPermission: '',
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
text: 'Administration',
|
|
20
|
-
type: 'group',
|
|
21
|
-
data: {
|
|
22
|
-
requiredPermission: 'admin',
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
text: 'General Settings',
|
|
27
|
-
icon: 'fa-solid fa-gear',
|
|
28
|
-
data: {
|
|
29
|
-
requiredPermission: '<%= name %>.admin.settings',
|
|
30
|
-
},
|
|
31
|
-
children: [
|
|
32
|
-
{
|
|
33
|
-
text: 'Sample Dynamic Entity',
|
|
34
|
-
path: '/<%= name %>/m/sample/e/sample/list',
|
|
35
|
-
},
|
|
36
|
-
]
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
text: 'Security Management',
|
|
40
|
-
path: '/security',
|
|
41
|
-
icon: 'fa-solid fa-lock',
|
|
42
|
-
data: {
|
|
43
|
-
requiredPermission: '<%= name %>.admin.settings',
|
|
44
|
-
},
|
|
45
|
-
opened: false,
|
|
46
|
-
children: [
|
|
47
|
-
{
|
|
48
|
-
text: 'User Management',
|
|
49
|
-
icon: 'fa-solid fa-users',
|
|
50
|
-
},
|
|
51
|
-
{
|
|
52
|
-
text: 'Roles Management',
|
|
53
|
-
icon: 'fa-solid fa-key',
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
text: 'Security Management',
|
|
59
|
-
path: '/security',
|
|
60
|
-
icon: 'fa-solid fa-lock',
|
|
61
|
-
data: {
|
|
62
|
-
requiredPermission: 'platform.admin.settings',
|
|
63
|
-
},
|
|
64
|
-
opened: false,
|
|
65
|
-
children: [
|
|
66
|
-
{
|
|
67
|
-
text: 'User Management',
|
|
68
|
-
icon: 'fa-solid fa-users',
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
text: 'Roles Management',
|
|
72
|
-
icon: 'fa-solid fa-key',
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
text: 'Tenant Management',
|
|
78
|
-
path: '/tenant-managemenet',
|
|
79
|
-
icon: 'fa-solid fa-sitemap',
|
|
80
|
-
data: {
|
|
81
|
-
requiredPermission: 'platform.admin.settings',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
text: 'Reports',
|
|
86
|
-
type: 'group',
|
|
87
|
-
data: {
|
|
88
|
-
requiredPermission: 'platform.admin.reports',
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
text: 'log Management',
|
|
93
|
-
path: '/log-managemenet',
|
|
94
|
-
icon: 'fa-solid fa-file-lines',
|
|
95
|
-
data: {
|
|
96
|
-
requiredPermission: 'platform.admin.reports',
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
];
|
|
100
|
-
|
|
101
|
-
constructor(private router: Router) { }
|
|
102
|
-
|
|
103
|
-
getItems(depth: number | null = null): Observable<AXPMenuItem[]> {
|
|
104
|
-
const menuClone = cloneDeep(this.initialMenu);
|
|
105
|
-
const result = this.internalGetMenuItemsByDepth(menuClone, depth);
|
|
106
|
-
return of(result);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
private internalGetMenuItemsByDepth(menuItems: AXPMenuItem[], depth: number | null, parent: AXPMenuItem | undefined = undefined): AXPMenuItem[] {
|
|
110
|
-
return menuItems.map((item) => {
|
|
111
|
-
// Create a new item with parent set
|
|
112
|
-
const newItem: AXPMenuItem = { ...item, parent: parent };
|
|
113
|
-
|
|
114
|
-
if (depth !== null) {
|
|
115
|
-
if (depth === 0) {
|
|
116
|
-
// If depth is 0, return the item without children
|
|
117
|
-
return omit(newItem, 'children');
|
|
118
|
-
} else if (item.children) {
|
|
119
|
-
// If the item has children, recursively set their parent and limit depth
|
|
120
|
-
newItem.children = this.internalGetMenuItemsByDepth(item.children, depth - 1, newItem);
|
|
121
|
-
}
|
|
122
|
-
} else if (item.children) {
|
|
123
|
-
// If depth is null, process all children without depth limit
|
|
124
|
-
newItem.children = this.internalGetMenuItemsByDepth(item.children, null, newItem);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return newItem;
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
currentMenuItem(): AXPMenuItem | null {
|
|
132
|
-
return this.internalCurrentMenuItem(this.internalGetMenuItemsByDepth(this.initialMenu, null), this.getCurrentRoutePath());
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
private internalCurrentMenuItem(menuItems: AXPMenuItem[], currentPath: string): AXPMenuItem | null {
|
|
136
|
-
for (const item of menuItems) {
|
|
137
|
-
// Check if the current item's path matches the current path
|
|
138
|
-
if (item.path === currentPath) {
|
|
139
|
-
return item;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// If the current item has children, search recursively in the children
|
|
143
|
-
if (item.children && item.children.length > 0) {
|
|
144
|
-
const found = this.internalCurrentMenuItem(item.children, currentPath);
|
|
145
|
-
if (found) {
|
|
146
|
-
return found;
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Return null if no matching item is found
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
private getCurrentRoutePath(): string {
|
|
156
|
-
// Using window.location to get the current browser URL
|
|
157
|
-
return window.location.pathname;
|
|
158
|
-
}
|
|
159
|
-
}
|