@memberjunction/codegen-lib 2.48.0 → 2.49.0
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/dist/Angular/angular-codegen.d.ts +164 -6
- package/dist/Angular/angular-codegen.d.ts.map +1 -1
- package/dist/Angular/angular-codegen.js +177 -13
- package/dist/Angular/angular-codegen.js.map +1 -1
- package/dist/Angular/join-grid-related-entity-component.d.ts +52 -3
- package/dist/Angular/join-grid-related-entity-component.d.ts.map +1 -1
- package/dist/Angular/join-grid-related-entity-component.js +58 -3
- package/dist/Angular/join-grid-related-entity-component.js.map +1 -1
- package/dist/Angular/related-entity-components.d.ts +99 -42
- package/dist/Angular/related-entity-components.d.ts.map +1 -1
- package/dist/Angular/related-entity-components.js +116 -26
- package/dist/Angular/related-entity-components.js.map +1 -1
- package/dist/Angular/timeline-related-entity-component.d.ts +46 -7
- package/dist/Angular/timeline-related-entity-component.d.ts.map +1 -1
- package/dist/Angular/timeline-related-entity-component.js +64 -7
- package/dist/Angular/timeline-related-entity-component.js.map +1 -1
- package/dist/Angular/user-view-grid-related-entity-component.d.ts +33 -1
- package/dist/Angular/user-view-grid-related-entity-component.d.ts.map +1 -1
- package/dist/Angular/user-view-grid-related-entity-component.js +33 -1
- package/dist/Angular/user-view-grid-related-entity-component.js.map +1 -1
- package/dist/Config/config.d.ts +369 -45
- package/dist/Config/config.d.ts.map +1 -1
- package/dist/Config/config.js +136 -2
- package/dist/Config/config.js.map +1 -1
- package/dist/Config/db-connection.d.ts +17 -3
- package/dist/Config/db-connection.d.ts.map +1 -1
- package/dist/Config/db-connection.js +31 -19
- package/dist/Config/db-connection.js.map +1 -1
- package/dist/Database/dbSchema.d.ts +44 -1
- package/dist/Database/dbSchema.d.ts.map +1 -1
- package/dist/Database/dbSchema.js +44 -1
- package/dist/Database/dbSchema.js.map +1 -1
- package/dist/Database/manage-metadata.d.ts +52 -46
- package/dist/Database/manage-metadata.d.ts.map +1 -1
- package/dist/Database/manage-metadata.js +221 -167
- package/dist/Database/manage-metadata.js.map +1 -1
- package/dist/Database/reorder-columns.d.ts +2 -2
- package/dist/Database/reorder-columns.d.ts.map +1 -1
- package/dist/Database/reorder-columns.js +23 -17
- package/dist/Database/reorder-columns.js.map +1 -1
- package/dist/Database/sql.d.ts +4 -4
- package/dist/Database/sql.d.ts.map +1 -1
- package/dist/Database/sql.js +2 -2
- package/dist/Database/sql.js.map +1 -1
- package/dist/Database/sql_codegen.d.ts +15 -15
- package/dist/Database/sql_codegen.d.ts.map +1 -1
- package/dist/Database/sql_codegen.js +184 -112
- package/dist/Database/sql_codegen.js.map +1 -1
- package/dist/Misc/advanced_generation.js +81 -81
- package/dist/Misc/advanced_generation.js.map +1 -1
- package/dist/Misc/entity_subclasses_codegen.d.ts +5 -5
- package/dist/Misc/entity_subclasses_codegen.d.ts.map +1 -1
- package/dist/Misc/entity_subclasses_codegen.js +10 -8
- package/dist/Misc/entity_subclasses_codegen.js.map +1 -1
- package/dist/Misc/graphql_server_codegen.d.ts.map +1 -1
- package/dist/Misc/graphql_server_codegen.js +33 -28
- package/dist/Misc/graphql_server_codegen.js.map +1 -1
- package/dist/Misc/sql_logging.d.ts +2 -2
- package/dist/Misc/sql_logging.d.ts.map +1 -1
- package/dist/Misc/sql_logging.js +4 -3
- package/dist/Misc/sql_logging.js.map +1 -1
- package/dist/Misc/status_logging.d.ts +37 -0
- package/dist/Misc/status_logging.d.ts.map +1 -1
- package/dist/Misc/status_logging.js +145 -3
- package/dist/Misc/status_logging.js.map +1 -1
- package/dist/Misc/system_integrity.d.ts +9 -9
- package/dist/Misc/system_integrity.d.ts.map +1 -1
- package/dist/Misc/system_integrity.js +23 -21
- package/dist/Misc/system_integrity.js.map +1 -1
- package/dist/index.d.ts +45 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +51 -7
- package/dist/index.js.map +1 -1
- package/dist/runCodeGen.d.ts +84 -6
- package/dist/runCodeGen.d.ts.map +1 -1
- package/dist/runCodeGen.js +242 -82
- package/dist/runCodeGen.js.map +1 -1
- package/package.json +14 -14
|
@@ -1,24 +1,83 @@
|
|
|
1
1
|
import { EntityInfo, EntityFieldInfo, GeneratedFormSectionType, UserInfo, EntityRelationshipInfo } from '@memberjunction/core';
|
|
2
2
|
import { GenerationResult } from './related-entity-components';
|
|
3
|
+
/**
|
|
4
|
+
* Represents metadata about an Angular form section that is generated for an entity
|
|
5
|
+
*/
|
|
3
6
|
export declare class AngularFormSectionInfo {
|
|
7
|
+
/**
|
|
8
|
+
* The type of form section (e.g., Top, Category, Details)
|
|
9
|
+
*/
|
|
4
10
|
Type: GeneratedFormSectionType;
|
|
11
|
+
/**
|
|
12
|
+
* The display name of the section
|
|
13
|
+
*/
|
|
5
14
|
Name: string;
|
|
15
|
+
/**
|
|
16
|
+
* The generated HTML code for the tab
|
|
17
|
+
*/
|
|
6
18
|
TabCode: string;
|
|
19
|
+
/**
|
|
20
|
+
* The TypeScript class name for the section component
|
|
21
|
+
*/
|
|
7
22
|
ClassName?: string;
|
|
23
|
+
/**
|
|
24
|
+
* The filename where the section component will be saved
|
|
25
|
+
*/
|
|
8
26
|
FileName?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The complete TypeScript component code for the section
|
|
29
|
+
*/
|
|
9
30
|
ComponentCode?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Array of entity fields that belong to this section
|
|
33
|
+
*/
|
|
10
34
|
Fields?: EntityFieldInfo[];
|
|
35
|
+
/**
|
|
36
|
+
* The filename without the .ts extension
|
|
37
|
+
*/
|
|
11
38
|
FileNameWithoutExtension?: string;
|
|
39
|
+
/**
|
|
40
|
+
* The class name of the entity this section belongs to
|
|
41
|
+
*/
|
|
12
42
|
EntityClassName?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Indicates if this section represents a related entity tab
|
|
45
|
+
*/
|
|
13
46
|
IsRelatedEntity?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Specifies where related entity tabs should be displayed relative to field tabs
|
|
49
|
+
*/
|
|
14
50
|
RelatedEntityDisplayLocation?: 'Before Field Tabs' | 'After Field Tabs';
|
|
51
|
+
/**
|
|
52
|
+
* The generation result for related entity components
|
|
53
|
+
*/
|
|
15
54
|
GeneratedOutput?: GenerationResult;
|
|
16
55
|
}
|
|
17
56
|
/**
|
|
18
|
-
* Base class for generating Angular client code
|
|
57
|
+
* Base class for generating Angular client code for MemberJunction entities.
|
|
58
|
+
* This class handles the generation of Angular components, forms, and modules based on entity metadata.
|
|
59
|
+
* You can sub-class this class to create your own Angular client code generator logic.
|
|
19
60
|
*/
|
|
20
61
|
export declare class AngularClientGeneratorBase {
|
|
62
|
+
/**
|
|
63
|
+
* Main entry point for generating Angular code for a collection of entities
|
|
64
|
+
* @param entities Array of EntityInfo objects to generate Angular code for
|
|
65
|
+
* @param directory The output directory where generated files will be saved
|
|
66
|
+
* @param modulePrefix A prefix to use for the generated module name
|
|
67
|
+
* @param contextUser The user context for permission checking and personalization
|
|
68
|
+
* @returns Promise<boolean> True if generation was successful, false otherwise
|
|
69
|
+
*/
|
|
21
70
|
generateAngularCode(entities: EntityInfo[], directory: string, modulePrefix: string, contextUser: UserInfo): Promise<boolean>;
|
|
71
|
+
/**
|
|
72
|
+
* Generates the main Angular module that imports all generated components and sub-modules
|
|
73
|
+
* @param componentImports Array of import statements for generated components
|
|
74
|
+
* @param componentNames Array of component names with their required related entity items
|
|
75
|
+
* @param relatedEntityModuleImports Array of library imports for related entity modules
|
|
76
|
+
* @param sections Array of form section information
|
|
77
|
+
* @param modulePrefix Prefix for the module name
|
|
78
|
+
* @param maxComponentsPerModule Maximum number of components to include in each sub-module (default: 25)
|
|
79
|
+
* @returns The generated TypeScript code for the Angular module
|
|
80
|
+
*/
|
|
22
81
|
protected generateAngularModule(componentImports: string[], componentNames: {
|
|
23
82
|
componentName: string;
|
|
24
83
|
relatedEntityItemsRequired: {
|
|
@@ -29,6 +88,14 @@ export declare class AngularClientGeneratorBase {
|
|
|
29
88
|
library: string;
|
|
30
89
|
modules: string[];
|
|
31
90
|
}[], sections: AngularFormSectionInfo[], modulePrefix: string, maxComponentsPerModule?: number): string;
|
|
91
|
+
/**
|
|
92
|
+
* Generates sub-modules to handle large numbers of components by breaking them into smaller chunks
|
|
93
|
+
* @param componentNames Array of component names with their required related entity items
|
|
94
|
+
* @param sections Array of form section information
|
|
95
|
+
* @param maxComponentsPerModule Maximum components per sub-module
|
|
96
|
+
* @param modulePrefix Prefix for module naming
|
|
97
|
+
* @returns Generated TypeScript code for all sub-modules and the master module
|
|
98
|
+
*/
|
|
32
99
|
protected generateAngularModuleCode(componentNames: {
|
|
33
100
|
componentName: string;
|
|
34
101
|
relatedEntityItemsRequired: {
|
|
@@ -36,35 +103,126 @@ export declare class AngularClientGeneratorBase {
|
|
|
36
103
|
moduleClassName: string;
|
|
37
104
|
}[];
|
|
38
105
|
}[], sections: AngularFormSectionInfo[], maxComponentsPerModule: number, modulePrefix: string): string;
|
|
106
|
+
/**
|
|
107
|
+
* Base name used for generating sub-module names
|
|
108
|
+
* @protected
|
|
109
|
+
*/
|
|
39
110
|
protected subModule_BaseName: string;
|
|
40
111
|
/**
|
|
41
|
-
* Get the base name for the sub-modules
|
|
112
|
+
* Get the base name for the sub-modules. Override this method to change the base name.
|
|
113
|
+
* @returns The base name for sub-modules (default: 'GeneratedForms_SubModule_')
|
|
42
114
|
*/
|
|
43
115
|
get SubModuleBaseName(): string;
|
|
116
|
+
/**
|
|
117
|
+
* Generates the closing section of a sub-module including imports and exports
|
|
118
|
+
* @param moduleNumber The sequential number of this sub-module
|
|
119
|
+
* @param additionalModulesToImport Array of additional module names to import
|
|
120
|
+
* @returns TypeScript code for the sub-module ending
|
|
121
|
+
*/
|
|
44
122
|
protected generateSubModuleEnding(moduleNumber: number, additionalModulesToImport: string[]): string;
|
|
123
|
+
/**
|
|
124
|
+
* Generates the TypeScript component code for a single entity
|
|
125
|
+
* @param entity The entity to generate the component for
|
|
126
|
+
* @param additionalSections Array of additional form sections for this entity
|
|
127
|
+
* @param relatedEntitySections Array of related entity sections
|
|
128
|
+
* @returns Generated TypeScript component code
|
|
129
|
+
*/
|
|
45
130
|
protected generateSingleEntityTypeScriptForAngular(entity: EntityInfo, additionalSections: AngularFormSectionInfo[], relatedEntitySections: AngularFormSectionInfo[]): string;
|
|
131
|
+
/**
|
|
132
|
+
* Checks if an entity has any fields designated for the top area section
|
|
133
|
+
* @param entity The entity to check
|
|
134
|
+
* @returns True if the entity has top area fields, false otherwise
|
|
135
|
+
*/
|
|
46
136
|
protected entityHasTopArea(entity: EntityInfo): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Generates HTML for the top area section of an entity form
|
|
139
|
+
* @param entity The entity to generate top area HTML for
|
|
140
|
+
* @returns HTML string for the top area section, or empty string if no top area exists
|
|
141
|
+
*/
|
|
47
142
|
protected generateTopAreaHTMLForAngular(entity: EntityInfo): string;
|
|
143
|
+
/**
|
|
144
|
+
* Adds a new section to the sections array if it doesn't already exist
|
|
145
|
+
* @param entity The entity the section belongs to
|
|
146
|
+
* @param sections Array of existing sections
|
|
147
|
+
* @param type The type of section to add
|
|
148
|
+
* @param name The name of the section
|
|
149
|
+
*/
|
|
48
150
|
protected AddSectionIfNeeded(entity: EntityInfo, sections: AngularFormSectionInfo[], type: GeneratedFormSectionType, name: string): void;
|
|
151
|
+
/**
|
|
152
|
+
* Generates additional form sections based on entity field metadata
|
|
153
|
+
* @param entity The entity to generate sections for
|
|
154
|
+
* @param startIndex Starting index for tab ordering
|
|
155
|
+
* @returns Array of generated form sections
|
|
156
|
+
*/
|
|
49
157
|
protected generateAngularAdditionalSections(entity: EntityInfo, startIndex: number): AngularFormSectionInfo[];
|
|
158
|
+
/**
|
|
159
|
+
* Generates HTML for a specific form section
|
|
160
|
+
* @param entity The entity containing the fields
|
|
161
|
+
* @param section The section to generate HTML for
|
|
162
|
+
* @returns HTML string for the form section
|
|
163
|
+
*/
|
|
50
164
|
protected generateSectionHTMLForAngular(entity: EntityInfo, section: AngularFormSectionInfo): string;
|
|
51
165
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* @param
|
|
55
|
-
* @
|
|
166
|
+
* Generates the tab name for a related entity tab. Appends the field's display name to the tab name
|
|
167
|
+
* if there are multiple tabs for the same related entity to differentiate them.
|
|
168
|
+
* @param relatedEntity The relationship information for the related entity
|
|
169
|
+
* @param sortedRelatedEntities All related entities sorted by sequence
|
|
170
|
+
* @returns The generated tab name
|
|
56
171
|
*/
|
|
57
172
|
protected generateRelatedEntityTabName(relatedEntity: EntityRelationshipInfo, sortedRelatedEntities: EntityRelationshipInfo[]): string;
|
|
173
|
+
/**
|
|
174
|
+
* Generates tabs for all related entities that should be displayed in the form
|
|
175
|
+
* @param entity The parent entity
|
|
176
|
+
* @param startIndex Starting index for tab ordering
|
|
177
|
+
* @param contextUser User context for permission checking
|
|
178
|
+
* @returns Promise resolving to array of related entity tab sections
|
|
179
|
+
*/
|
|
58
180
|
protected generateRelatedEntityTabs(entity: EntityInfo, startIndex: number, contextUser: UserInfo): Promise<AngularFormSectionInfo[]>;
|
|
181
|
+
/**
|
|
182
|
+
* Removes all whitespace from a string
|
|
183
|
+
* @param s The string to process
|
|
184
|
+
* @returns String with all whitespace removed
|
|
185
|
+
*/
|
|
59
186
|
protected stripWhiteSpace(s: string): string;
|
|
187
|
+
/**
|
|
188
|
+
* Generates the complete HTML template for a single entity form
|
|
189
|
+
* @param entity The entity to generate HTML for
|
|
190
|
+
* @param contextUser User context for permission checking
|
|
191
|
+
* @returns Promise resolving to an object containing the HTML code and section information
|
|
192
|
+
*/
|
|
60
193
|
protected generateSingleEntityHTMLForAngular(entity: EntityInfo, contextUser: UserInfo): Promise<{
|
|
61
194
|
htmlCode: string;
|
|
62
195
|
additionalSections: AngularFormSectionInfo[];
|
|
63
196
|
relatedEntitySections: AngularFormSectionInfo[];
|
|
64
197
|
}>;
|
|
198
|
+
/**
|
|
199
|
+
* Generates HTML with a vertical splitter layout for entities with a top area
|
|
200
|
+
* @param topArea HTML for the top area section
|
|
201
|
+
* @param additionalSections Array of additional form sections
|
|
202
|
+
* @param relatedEntitySections Array of related entity sections
|
|
203
|
+
* @returns Generated HTML with splitter layout
|
|
204
|
+
*/
|
|
65
205
|
protected generateSingleEntityHTMLWithSplitterForAngular(topArea: string, additionalSections: AngularFormSectionInfo[], relatedEntitySections: AngularFormSectionInfo[]): string;
|
|
206
|
+
/**
|
|
207
|
+
* Generates the inner HTML for the top area section
|
|
208
|
+
* @param topArea The top area content
|
|
209
|
+
* @returns HTML string for the top area container, or empty string if no content
|
|
210
|
+
*/
|
|
66
211
|
protected innerTopAreaHTML(topArea: string): string;
|
|
212
|
+
/**
|
|
213
|
+
* Generates the HTML for the tab strip containing all form sections
|
|
214
|
+
* @param additionalSections Array of field-based form sections
|
|
215
|
+
* @param relatedEntitySections Array of related entity sections
|
|
216
|
+
* @returns HTML string for the complete tab strip
|
|
217
|
+
*/
|
|
67
218
|
protected innerTabStripHTML(additionalSections: AngularFormSectionInfo[], relatedEntitySections: AngularFormSectionInfo[]): string;
|
|
219
|
+
/**
|
|
220
|
+
* Generates HTML without a splitter layout for entities without a top area
|
|
221
|
+
* @param topArea HTML for the top area section (expected to be empty)
|
|
222
|
+
* @param additionalSections Array of additional form sections
|
|
223
|
+
* @param relatedEntitySections Array of related entity sections
|
|
224
|
+
* @returns Generated HTML without splitter layout
|
|
225
|
+
*/
|
|
68
226
|
protected generateSingleEntityHTMLWithOUTSplitterForAngular(topArea: string, additionalSections: AngularFormSectionInfo[], relatedEntitySections: AngularFormSectionInfo[]): string;
|
|
69
227
|
}
|
|
70
228
|
//# sourceMappingURL=angular-codegen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"angular-codegen.d.ts","sourceRoot":"","sources":["../../src/Angular/angular-codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,wBAAwB,EAAyD,QAAQ,EAAE,sBAAsB,EAAE,MAA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AS,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,sBAAsB,EAAE,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,GAAG,MAAM;IAalI;;;;;;OAMG;IACH,SAAS,CAAC,iDAAiD,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,GAAG,MAAM;CAWxL"}
|
|
@@ -10,20 +10,74 @@ const fs_1 = __importDefault(require("fs"));
|
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const config_1 = require("../Config/config");
|
|
12
12
|
const related_entity_components_1 = require("./related-entity-components");
|
|
13
|
+
/**
|
|
14
|
+
* Represents metadata about an Angular form section that is generated for an entity
|
|
15
|
+
*/
|
|
13
16
|
class AngularFormSectionInfo {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* The type of form section (e.g., Top, Category, Details)
|
|
19
|
+
*/
|
|
20
|
+
Type;
|
|
21
|
+
/**
|
|
22
|
+
* The display name of the section
|
|
23
|
+
*/
|
|
24
|
+
Name;
|
|
25
|
+
/**
|
|
26
|
+
* The generated HTML code for the tab
|
|
27
|
+
*/
|
|
28
|
+
TabCode;
|
|
29
|
+
/**
|
|
30
|
+
* The TypeScript class name for the section component
|
|
31
|
+
*/
|
|
32
|
+
ClassName;
|
|
33
|
+
/**
|
|
34
|
+
* The filename where the section component will be saved
|
|
35
|
+
*/
|
|
36
|
+
FileName;
|
|
37
|
+
/**
|
|
38
|
+
* The complete TypeScript component code for the section
|
|
39
|
+
*/
|
|
40
|
+
ComponentCode;
|
|
41
|
+
/**
|
|
42
|
+
* Array of entity fields that belong to this section
|
|
43
|
+
*/
|
|
44
|
+
Fields;
|
|
45
|
+
/**
|
|
46
|
+
* The filename without the .ts extension
|
|
47
|
+
*/
|
|
48
|
+
FileNameWithoutExtension;
|
|
49
|
+
/**
|
|
50
|
+
* The class name of the entity this section belongs to
|
|
51
|
+
*/
|
|
52
|
+
EntityClassName;
|
|
53
|
+
/**
|
|
54
|
+
* Indicates if this section represents a related entity tab
|
|
55
|
+
*/
|
|
56
|
+
IsRelatedEntity = false;
|
|
57
|
+
/**
|
|
58
|
+
* Specifies where related entity tabs should be displayed relative to field tabs
|
|
59
|
+
*/
|
|
60
|
+
RelatedEntityDisplayLocation = 'After Field Tabs';
|
|
61
|
+
/**
|
|
62
|
+
* The generation result for related entity components
|
|
63
|
+
*/
|
|
64
|
+
GeneratedOutput;
|
|
18
65
|
}
|
|
19
66
|
exports.AngularFormSectionInfo = AngularFormSectionInfo;
|
|
20
67
|
/**
|
|
21
|
-
* Base class for generating Angular client code
|
|
68
|
+
* Base class for generating Angular client code for MemberJunction entities.
|
|
69
|
+
* This class handles the generation of Angular components, forms, and modules based on entity metadata.
|
|
70
|
+
* You can sub-class this class to create your own Angular client code generator logic.
|
|
22
71
|
*/
|
|
23
72
|
class AngularClientGeneratorBase {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
73
|
+
/**
|
|
74
|
+
* Main entry point for generating Angular code for a collection of entities
|
|
75
|
+
* @param entities Array of EntityInfo objects to generate Angular code for
|
|
76
|
+
* @param directory The output directory where generated files will be saved
|
|
77
|
+
* @param modulePrefix A prefix to use for the generated module name
|
|
78
|
+
* @param contextUser The user context for permission checking and personalization
|
|
79
|
+
* @returns Promise<boolean> True if generation was successful, false otherwise
|
|
80
|
+
*/
|
|
27
81
|
async generateAngularCode(entities, directory, modulePrefix, contextUser) {
|
|
28
82
|
try {
|
|
29
83
|
const entityPath = path_1.default.join(directory, 'Entities');
|
|
@@ -92,6 +146,16 @@ class AngularClientGeneratorBase {
|
|
|
92
146
|
return false;
|
|
93
147
|
}
|
|
94
148
|
}
|
|
149
|
+
/**
|
|
150
|
+
* Generates the main Angular module that imports all generated components and sub-modules
|
|
151
|
+
* @param componentImports Array of import statements for generated components
|
|
152
|
+
* @param componentNames Array of component names with their required related entity items
|
|
153
|
+
* @param relatedEntityModuleImports Array of library imports for related entity modules
|
|
154
|
+
* @param sections Array of form section information
|
|
155
|
+
* @param modulePrefix Prefix for the module name
|
|
156
|
+
* @param maxComponentsPerModule Maximum number of components to include in each sub-module (default: 25)
|
|
157
|
+
* @returns The generated TypeScript code for the Angular module
|
|
158
|
+
*/
|
|
95
159
|
generateAngularModule(componentImports, componentNames, relatedEntityModuleImports, sections, modulePrefix, maxComponentsPerModule = 25) {
|
|
96
160
|
// this function will generate the overall code for the module file.
|
|
97
161
|
// there is one master angular module called GeneratedFormsModule, and this module will include all of the sub-modules
|
|
@@ -146,6 +210,14 @@ export function Load${modulePrefix}GeneratedForms() {
|
|
|
146
210
|
}
|
|
147
211
|
`;
|
|
148
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Generates sub-modules to handle large numbers of components by breaking them into smaller chunks
|
|
215
|
+
* @param componentNames Array of component names with their required related entity items
|
|
216
|
+
* @param sections Array of form section information
|
|
217
|
+
* @param maxComponentsPerModule Maximum components per sub-module
|
|
218
|
+
* @param modulePrefix Prefix for module naming
|
|
219
|
+
* @returns Generated TypeScript code for all sub-modules and the master module
|
|
220
|
+
*/
|
|
149
221
|
generateAngularModuleCode(componentNames, sections, maxComponentsPerModule, modulePrefix) {
|
|
150
222
|
// this function breaks up the componentNames and sections up, we only want to have a max of maxComponentsPerModule components per module (of components and/or sections, doesn't matter)
|
|
151
223
|
// so, we break up the list of components into sub-modules, and then generate the code for each sub-module
|
|
@@ -198,11 +270,23 @@ export class ${modulePrefix}GeneratedFormsModule { }`;
|
|
|
198
270
|
return subModules.join('\n\n') + '\n\n' + masterModuleCode;
|
|
199
271
|
}
|
|
200
272
|
/**
|
|
201
|
-
*
|
|
273
|
+
* Base name used for generating sub-module names
|
|
274
|
+
* @protected
|
|
275
|
+
*/
|
|
276
|
+
subModule_BaseName = 'GeneratedForms_SubModule_';
|
|
277
|
+
/**
|
|
278
|
+
* Get the base name for the sub-modules. Override this method to change the base name.
|
|
279
|
+
* @returns The base name for sub-modules (default: 'GeneratedForms_SubModule_')
|
|
202
280
|
*/
|
|
203
281
|
get SubModuleBaseName() {
|
|
204
282
|
return this.subModule_BaseName;
|
|
205
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* Generates the closing section of a sub-module including imports and exports
|
|
286
|
+
* @param moduleNumber The sequential number of this sub-module
|
|
287
|
+
* @param additionalModulesToImport Array of additional module names to import
|
|
288
|
+
* @returns TypeScript code for the sub-module ending
|
|
289
|
+
*/
|
|
206
290
|
generateSubModuleEnding(moduleNumber, additionalModulesToImport) {
|
|
207
291
|
return `],
|
|
208
292
|
imports: [
|
|
@@ -227,6 +311,13 @@ exports: [
|
|
|
227
311
|
export class ${this.SubModuleBaseName}${moduleNumber} { }
|
|
228
312
|
`;
|
|
229
313
|
}
|
|
314
|
+
/**
|
|
315
|
+
* Generates the TypeScript component code for a single entity
|
|
316
|
+
* @param entity The entity to generate the component for
|
|
317
|
+
* @param additionalSections Array of additional form sections for this entity
|
|
318
|
+
* @param relatedEntitySections Array of related entity sections
|
|
319
|
+
* @returns Generated TypeScript component code
|
|
320
|
+
*/
|
|
230
321
|
generateSingleEntityTypeScriptForAngular(entity, additionalSections, relatedEntitySections) {
|
|
231
322
|
const entityObjectClass = entity.ClassName;
|
|
232
323
|
const sectionImports = additionalSections.length > 0 ? additionalSections.map(s => `import { Load${s.ClassName} } from "./sections/${s.FileNameWithoutExtension}"`).join('\n') : '';
|
|
@@ -280,15 +371,32 @@ export function Load${entity.ClassName}FormComponent() {
|
|
|
280
371
|
}
|
|
281
372
|
`;
|
|
282
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* Checks if an entity has any fields designated for the top area section
|
|
376
|
+
* @param entity The entity to check
|
|
377
|
+
* @returns True if the entity has top area fields, false otherwise
|
|
378
|
+
*/
|
|
283
379
|
entityHasTopArea(entity) {
|
|
284
380
|
return entity.Fields.some(f => f.GeneratedFormSectionType === core_1.GeneratedFormSectionType.Top);
|
|
285
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* Generates HTML for the top area section of an entity form
|
|
384
|
+
* @param entity The entity to generate top area HTML for
|
|
385
|
+
* @returns HTML string for the top area section, or empty string if no top area exists
|
|
386
|
+
*/
|
|
286
387
|
generateTopAreaHTMLForAngular(entity) {
|
|
287
388
|
if (!this.entityHasTopArea(entity))
|
|
288
389
|
return '';
|
|
289
390
|
else
|
|
290
391
|
return `<mj-form-section Entity="${entity.Name}" Section="top-area" [record]="record" [EditMode]="this.EditMode"></mj-form-section>`;
|
|
291
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* Adds a new section to the sections array if it doesn't already exist
|
|
395
|
+
* @param entity The entity the section belongs to
|
|
396
|
+
* @param sections Array of existing sections
|
|
397
|
+
* @param type The type of section to add
|
|
398
|
+
* @param name The name of the section
|
|
399
|
+
*/
|
|
292
400
|
AddSectionIfNeeded(entity, sections, type, name) {
|
|
293
401
|
const section = sections.find(s => s.Name === name && s.Type === type);
|
|
294
402
|
const fName = `${this.stripWhiteSpace(name.toLowerCase())}.component`;
|
|
@@ -305,6 +413,12 @@ export function Load${entity.ClassName}FormComponent() {
|
|
|
305
413
|
FileNameWithoutExtension: fName
|
|
306
414
|
});
|
|
307
415
|
}
|
|
416
|
+
/**
|
|
417
|
+
* Generates additional form sections based on entity field metadata
|
|
418
|
+
* @param entity The entity to generate sections for
|
|
419
|
+
* @param startIndex Starting index for tab ordering
|
|
420
|
+
* @returns Array of generated form sections
|
|
421
|
+
*/
|
|
308
422
|
generateAngularAdditionalSections(entity, startIndex) {
|
|
309
423
|
const sections = [];
|
|
310
424
|
let index = startIndex;
|
|
@@ -374,6 +488,12 @@ export function Load${entity.ClassName}${this.stripWhiteSpace(section.Name)}Comp
|
|
|
374
488
|
}
|
|
375
489
|
return sections;
|
|
376
490
|
}
|
|
491
|
+
/**
|
|
492
|
+
* Generates HTML for a specific form section
|
|
493
|
+
* @param entity The entity containing the fields
|
|
494
|
+
* @param section The section to generate HTML for
|
|
495
|
+
* @returns HTML string for the form section
|
|
496
|
+
*/
|
|
377
497
|
generateSectionHTMLForAngular(entity, section) {
|
|
378
498
|
let html = '';
|
|
379
499
|
// figure out which fields will be in this section first
|
|
@@ -463,10 +583,11 @@ export function Load${entity.ClassName}${this.stripWhiteSpace(section.Name)}Comp
|
|
|
463
583
|
return html;
|
|
464
584
|
}
|
|
465
585
|
/**
|
|
466
|
-
*
|
|
467
|
-
*
|
|
468
|
-
* @param
|
|
469
|
-
* @
|
|
586
|
+
* Generates the tab name for a related entity tab. Appends the field's display name to the tab name
|
|
587
|
+
* if there are multiple tabs for the same related entity to differentiate them.
|
|
588
|
+
* @param relatedEntity The relationship information for the related entity
|
|
589
|
+
* @param sortedRelatedEntities All related entities sorted by sequence
|
|
590
|
+
* @returns The generated tab name
|
|
470
591
|
*/
|
|
471
592
|
generateRelatedEntityTabName(relatedEntity, sortedRelatedEntities) {
|
|
472
593
|
if (relatedEntity.DisplayName && relatedEntity.DisplayName.length > 0) {
|
|
@@ -494,6 +615,13 @@ export function Load${entity.ClassName}${this.stripWhiteSpace(section.Name)}Comp
|
|
|
494
615
|
return tabName;
|
|
495
616
|
}
|
|
496
617
|
}
|
|
618
|
+
/**
|
|
619
|
+
* Generates tabs for all related entities that should be displayed in the form
|
|
620
|
+
* @param entity The parent entity
|
|
621
|
+
* @param startIndex Starting index for tab ordering
|
|
622
|
+
* @param contextUser User context for permission checking
|
|
623
|
+
* @returns Promise resolving to array of related entity tab sections
|
|
624
|
+
*/
|
|
497
625
|
async generateRelatedEntityTabs(entity, startIndex, contextUser) {
|
|
498
626
|
const md = new core_1.Metadata();
|
|
499
627
|
const tabs = [];
|
|
@@ -542,9 +670,20 @@ ${componentCodeWithTabs}
|
|
|
542
670
|
}
|
|
543
671
|
return tabs;
|
|
544
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* Removes all whitespace from a string
|
|
675
|
+
* @param s The string to process
|
|
676
|
+
* @returns String with all whitespace removed
|
|
677
|
+
*/
|
|
545
678
|
stripWhiteSpace(s) {
|
|
546
679
|
return s.replace(/\s/g, '');
|
|
547
680
|
}
|
|
681
|
+
/**
|
|
682
|
+
* Generates the complete HTML template for a single entity form
|
|
683
|
+
* @param entity The entity to generate HTML for
|
|
684
|
+
* @param contextUser User context for permission checking
|
|
685
|
+
* @returns Promise resolving to an object containing the HTML code and section information
|
|
686
|
+
*/
|
|
548
687
|
async generateSingleEntityHTMLForAngular(entity, contextUser) {
|
|
549
688
|
const topArea = this.generateTopAreaHTMLForAngular(entity);
|
|
550
689
|
const additionalSections = this.generateAngularAdditionalSections(entity, 0);
|
|
@@ -555,6 +694,13 @@ ${componentCodeWithTabs}
|
|
|
555
694
|
this.generateSingleEntityHTMLWithOUTSplitterForAngular(topArea, additionalSections, relatedEntitySections);
|
|
556
695
|
return { htmlCode, additionalSections, relatedEntitySections };
|
|
557
696
|
}
|
|
697
|
+
/**
|
|
698
|
+
* Generates HTML with a vertical splitter layout for entities with a top area
|
|
699
|
+
* @param topArea HTML for the top area section
|
|
700
|
+
* @param additionalSections Array of additional form sections
|
|
701
|
+
* @param relatedEntitySections Array of related entity sections
|
|
702
|
+
* @returns Generated HTML with splitter layout
|
|
703
|
+
*/
|
|
558
704
|
generateSingleEntityHTMLWithSplitterForAngular(topArea, additionalSections, relatedEntitySections) {
|
|
559
705
|
const htmlCode = `<div class="record-form-container" mjFillContainer [bottomMargin]="20" [rightMargin]="5">
|
|
560
706
|
<form *ngIf="record" class="record-form" #form="ngForm" mjFillContainer>
|
|
@@ -572,6 +718,11 @@ ${this.innerTabStripHTML(additionalSections, relatedEntitySections)}
|
|
|
572
718
|
`;
|
|
573
719
|
return htmlCode;
|
|
574
720
|
}
|
|
721
|
+
/**
|
|
722
|
+
* Generates the inner HTML for the top area section
|
|
723
|
+
* @param topArea The top area content
|
|
724
|
+
* @returns HTML string for the top area container, or empty string if no content
|
|
725
|
+
*/
|
|
575
726
|
innerTopAreaHTML(topArea) {
|
|
576
727
|
if (topArea.trim().length === 0)
|
|
577
728
|
return '';
|
|
@@ -580,6 +731,12 @@ ${this.innerTabStripHTML(additionalSections, relatedEntitySections)}
|
|
|
580
731
|
${topArea}
|
|
581
732
|
</div>`;
|
|
582
733
|
}
|
|
734
|
+
/**
|
|
735
|
+
* Generates the HTML for the tab strip containing all form sections
|
|
736
|
+
* @param additionalSections Array of field-based form sections
|
|
737
|
+
* @param relatedEntitySections Array of related entity sections
|
|
738
|
+
* @returns HTML string for the complete tab strip
|
|
739
|
+
*/
|
|
583
740
|
innerTabStripHTML(additionalSections, relatedEntitySections) {
|
|
584
741
|
// come up with the overall order by looking for the tabs that have DisplayLocation === 'Before Field Tabs' and put those, in sequence order
|
|
585
742
|
// ahead of the additionalSections, then do the additionalSections, and then do the relatedEntitySections
|
|
@@ -591,6 +748,13 @@ ${this.innerTabStripHTML(additionalSections, relatedEntitySections)}
|
|
|
591
748
|
${relatedEntityAfterFieldTabs ? relatedEntityAfterFieldTabs.map(s => s.TabCode).join('\n') : ''}
|
|
592
749
|
</mj-tabstrip>`;
|
|
593
750
|
}
|
|
751
|
+
/**
|
|
752
|
+
* Generates HTML without a splitter layout for entities without a top area
|
|
753
|
+
* @param topArea HTML for the top area section (expected to be empty)
|
|
754
|
+
* @param additionalSections Array of additional form sections
|
|
755
|
+
* @param relatedEntitySections Array of related entity sections
|
|
756
|
+
* @returns Generated HTML without splitter layout
|
|
757
|
+
*/
|
|
594
758
|
generateSingleEntityHTMLWithOUTSplitterForAngular(topArea, additionalSections, relatedEntitySections) {
|
|
595
759
|
const htmlCode = `<div class="record-form-container" mjFillContainer [bottomMargin]="20" [rightMargin]="5">
|
|
596
760
|
<form *ngIf="record" class="record-form" #form="ngForm" mjFillContainer>
|