@memberjunction/codegen-lib 2.47.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 +179 -25
- 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 +46 -13
- 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 +235 -191
- 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 +5 -16
- 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 +186 -123
- package/dist/Database/sql_codegen.js.map +1 -1
- package/dist/Misc/action_subclasses_codegen.d.ts.map +1 -1
- package/dist/Misc/action_subclasses_codegen.js +2 -12
- package/dist/Misc/action_subclasses_codegen.js.map +1 -1
- package/dist/Misc/advanced_generation.d.ts.map +1 -1
- package/dist/Misc/advanced_generation.js +82 -92
- package/dist/Misc/advanced_generation.js.map +1 -1
- package/dist/Misc/createNewUser.d.ts.map +1 -1
- package/dist/Misc/createNewUser.js +2 -12
- package/dist/Misc/createNewUser.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 +12 -20
- 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 +35 -40
- package/dist/Misc/graphql_server_codegen.js.map +1 -1
- package/dist/Misc/runCommand.d.ts.map +1 -1
- package/dist/Misc/runCommand.js +2 -12
- package/dist/Misc/runCommand.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 +147 -14
- 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 +244 -93
- 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,MAAM,sBAAsB,CAAC;AAMtL,OAAO,EAAE,gBAAgB,EAA8C,MAAM,6BAA6B,CAAC;AAE3G,qBAAa,sBAAsB;IAC/B,IAAI,EAAG,wBAAwB,CAAC;
|
|
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,MAAM,sBAAsB,CAAC;AAMtL,OAAO,EAAE,gBAAgB,EAA8C,MAAM,6BAA6B,CAAC;AAE3G;;GAEG;AACH,qBAAa,sBAAsB;IAC/B;;OAEG;IACH,IAAI,EAAG,wBAAwB,CAAC;IAEhC;;OAEG;IACH,IAAI,EAAG,MAAM,CAAC;IAEd;;OAEG;IACH,OAAO,EAAG,MAAM,CAAC;IAEjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;IAE3B;;OAEG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAElC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAS;IAElC;;O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,EAAE,CAAC;QAC7C,qBAAqB,EAAE,sBAAsB,EAAE,CAAA;KAAC,CAAC;IAYzJ;;;;;;OAMG;IACH,SAAS,CAAC,8CAA8C,CAAC,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,GAAG,MAAM;IAkBhL;;;;OAIG;IACH,SAAS,CAAC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;IAQnD;;;;;OAKG;IACH,SAAS,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"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
@@ -15,22 +9,75 @@ const status_logging_1 = require("../Misc/status_logging");
|
|
|
15
9
|
const fs_1 = __importDefault(require("fs"));
|
|
16
10
|
const path_1 = __importDefault(require("path"));
|
|
17
11
|
const config_1 = require("../Config/config");
|
|
18
|
-
const global_1 = require("@memberjunction/global");
|
|
19
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
|
+
*/
|
|
20
16
|
class AngularFormSectionInfo {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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;
|
|
25
65
|
}
|
|
26
66
|
exports.AngularFormSectionInfo = AngularFormSectionInfo;
|
|
27
67
|
/**
|
|
28
|
-
* 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.
|
|
29
71
|
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
72
|
+
class AngularClientGeneratorBase {
|
|
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
|
+
*/
|
|
34
81
|
async generateAngularCode(entities, directory, modulePrefix, contextUser) {
|
|
35
82
|
try {
|
|
36
83
|
const entityPath = path_1.default.join(directory, 'Entities');
|
|
@@ -99,6 +146,16 @@ let AngularClientGeneratorBase = class AngularClientGeneratorBase {
|
|
|
99
146
|
return false;
|
|
100
147
|
}
|
|
101
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
|
+
*/
|
|
102
159
|
generateAngularModule(componentImports, componentNames, relatedEntityModuleImports, sections, modulePrefix, maxComponentsPerModule = 25) {
|
|
103
160
|
// this function will generate the overall code for the module file.
|
|
104
161
|
// there is one master angular module called GeneratedFormsModule, and this module will include all of the sub-modules
|
|
@@ -153,6 +210,14 @@ export function Load${modulePrefix}GeneratedForms() {
|
|
|
153
210
|
}
|
|
154
211
|
`;
|
|
155
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
|
+
*/
|
|
156
221
|
generateAngularModuleCode(componentNames, sections, maxComponentsPerModule, modulePrefix) {
|
|
157
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)
|
|
158
223
|
// so, we break up the list of components into sub-modules, and then generate the code for each sub-module
|
|
@@ -205,11 +270,23 @@ export class ${modulePrefix}GeneratedFormsModule { }`;
|
|
|
205
270
|
return subModules.join('\n\n') + '\n\n' + masterModuleCode;
|
|
206
271
|
}
|
|
207
272
|
/**
|
|
208
|
-
*
|
|
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_')
|
|
209
280
|
*/
|
|
210
281
|
get SubModuleBaseName() {
|
|
211
282
|
return this.subModule_BaseName;
|
|
212
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
|
+
*/
|
|
213
290
|
generateSubModuleEnding(moduleNumber, additionalModulesToImport) {
|
|
214
291
|
return `],
|
|
215
292
|
imports: [
|
|
@@ -234,6 +311,13 @@ exports: [
|
|
|
234
311
|
export class ${this.SubModuleBaseName}${moduleNumber} { }
|
|
235
312
|
`;
|
|
236
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
|
+
*/
|
|
237
321
|
generateSingleEntityTypeScriptForAngular(entity, additionalSections, relatedEntitySections) {
|
|
238
322
|
const entityObjectClass = entity.ClassName;
|
|
239
323
|
const sectionImports = additionalSections.length > 0 ? additionalSections.map(s => `import { Load${s.ClassName} } from "./sections/${s.FileNameWithoutExtension}"`).join('\n') : '';
|
|
@@ -287,15 +371,32 @@ export function Load${entity.ClassName}FormComponent() {
|
|
|
287
371
|
}
|
|
288
372
|
`;
|
|
289
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
|
+
*/
|
|
290
379
|
entityHasTopArea(entity) {
|
|
291
380
|
return entity.Fields.some(f => f.GeneratedFormSectionType === core_1.GeneratedFormSectionType.Top);
|
|
292
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
|
+
*/
|
|
293
387
|
generateTopAreaHTMLForAngular(entity) {
|
|
294
388
|
if (!this.entityHasTopArea(entity))
|
|
295
389
|
return '';
|
|
296
390
|
else
|
|
297
391
|
return `<mj-form-section Entity="${entity.Name}" Section="top-area" [record]="record" [EditMode]="this.EditMode"></mj-form-section>`;
|
|
298
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
|
+
*/
|
|
299
400
|
AddSectionIfNeeded(entity, sections, type, name) {
|
|
300
401
|
const section = sections.find(s => s.Name === name && s.Type === type);
|
|
301
402
|
const fName = `${this.stripWhiteSpace(name.toLowerCase())}.component`;
|
|
@@ -312,6 +413,12 @@ export function Load${entity.ClassName}FormComponent() {
|
|
|
312
413
|
FileNameWithoutExtension: fName
|
|
313
414
|
});
|
|
314
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
|
+
*/
|
|
315
422
|
generateAngularAdditionalSections(entity, startIndex) {
|
|
316
423
|
const sections = [];
|
|
317
424
|
let index = startIndex;
|
|
@@ -381,6 +488,12 @@ export function Load${entity.ClassName}${this.stripWhiteSpace(section.Name)}Comp
|
|
|
381
488
|
}
|
|
382
489
|
return sections;
|
|
383
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
|
+
*/
|
|
384
497
|
generateSectionHTMLForAngular(entity, section) {
|
|
385
498
|
let html = '';
|
|
386
499
|
// figure out which fields will be in this section first
|
|
@@ -470,10 +583,11 @@ export function Load${entity.ClassName}${this.stripWhiteSpace(section.Name)}Comp
|
|
|
470
583
|
return html;
|
|
471
584
|
}
|
|
472
585
|
/**
|
|
473
|
-
*
|
|
474
|
-
*
|
|
475
|
-
* @param
|
|
476
|
-
* @
|
|
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
|
|
477
591
|
*/
|
|
478
592
|
generateRelatedEntityTabName(relatedEntity, sortedRelatedEntities) {
|
|
479
593
|
if (relatedEntity.DisplayName && relatedEntity.DisplayName.length > 0) {
|
|
@@ -501,6 +615,13 @@ export function Load${entity.ClassName}${this.stripWhiteSpace(section.Name)}Comp
|
|
|
501
615
|
return tabName;
|
|
502
616
|
}
|
|
503
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
|
+
*/
|
|
504
625
|
async generateRelatedEntityTabs(entity, startIndex, contextUser) {
|
|
505
626
|
const md = new core_1.Metadata();
|
|
506
627
|
const tabs = [];
|
|
@@ -549,9 +670,20 @@ ${componentCodeWithTabs}
|
|
|
549
670
|
}
|
|
550
671
|
return tabs;
|
|
551
672
|
}
|
|
673
|
+
/**
|
|
674
|
+
* Removes all whitespace from a string
|
|
675
|
+
* @param s The string to process
|
|
676
|
+
* @returns String with all whitespace removed
|
|
677
|
+
*/
|
|
552
678
|
stripWhiteSpace(s) {
|
|
553
679
|
return s.replace(/\s/g, '');
|
|
554
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
|
+
*/
|
|
555
687
|
async generateSingleEntityHTMLForAngular(entity, contextUser) {
|
|
556
688
|
const topArea = this.generateTopAreaHTMLForAngular(entity);
|
|
557
689
|
const additionalSections = this.generateAngularAdditionalSections(entity, 0);
|
|
@@ -562,6 +694,13 @@ ${componentCodeWithTabs}
|
|
|
562
694
|
this.generateSingleEntityHTMLWithOUTSplitterForAngular(topArea, additionalSections, relatedEntitySections);
|
|
563
695
|
return { htmlCode, additionalSections, relatedEntitySections };
|
|
564
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
|
+
*/
|
|
565
704
|
generateSingleEntityHTMLWithSplitterForAngular(topArea, additionalSections, relatedEntitySections) {
|
|
566
705
|
const htmlCode = `<div class="record-form-container" mjFillContainer [bottomMargin]="20" [rightMargin]="5">
|
|
567
706
|
<form *ngIf="record" class="record-form" #form="ngForm" mjFillContainer>
|
|
@@ -579,6 +718,11 @@ ${this.innerTabStripHTML(additionalSections, relatedEntitySections)}
|
|
|
579
718
|
`;
|
|
580
719
|
return htmlCode;
|
|
581
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
|
+
*/
|
|
582
726
|
innerTopAreaHTML(topArea) {
|
|
583
727
|
if (topArea.trim().length === 0)
|
|
584
728
|
return '';
|
|
@@ -587,6 +731,12 @@ ${this.innerTabStripHTML(additionalSections, relatedEntitySections)}
|
|
|
587
731
|
${topArea}
|
|
588
732
|
</div>`;
|
|
589
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
|
+
*/
|
|
590
740
|
innerTabStripHTML(additionalSections, relatedEntitySections) {
|
|
591
741
|
// come up with the overall order by looking for the tabs that have DisplayLocation === 'Before Field Tabs' and put those, in sequence order
|
|
592
742
|
// ahead of the additionalSections, then do the additionalSections, and then do the relatedEntitySections
|
|
@@ -598,6 +748,13 @@ ${this.innerTabStripHTML(additionalSections, relatedEntitySections)}
|
|
|
598
748
|
${relatedEntityAfterFieldTabs ? relatedEntityAfterFieldTabs.map(s => s.TabCode).join('\n') : ''}
|
|
599
749
|
</mj-tabstrip>`;
|
|
600
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
|
+
*/
|
|
601
758
|
generateSingleEntityHTMLWithOUTSplitterForAngular(topArea, additionalSections, relatedEntitySections) {
|
|
602
759
|
const htmlCode = `<div class="record-form-container" mjFillContainer [bottomMargin]="20" [rightMargin]="5">
|
|
603
760
|
<form *ngIf="record" class="record-form" #form="ngForm" mjFillContainer>
|
|
@@ -609,9 +766,6 @@ ${this.innerTabStripHTML(additionalSections, relatedEntitySections)}
|
|
|
609
766
|
`;
|
|
610
767
|
return htmlCode;
|
|
611
768
|
}
|
|
612
|
-
}
|
|
769
|
+
}
|
|
613
770
|
exports.AngularClientGeneratorBase = AngularClientGeneratorBase;
|
|
614
|
-
exports.AngularClientGeneratorBase = AngularClientGeneratorBase = __decorate([
|
|
615
|
-
(0, global_1.RegisterClass)(AngularClientGeneratorBase)
|
|
616
|
-
], AngularClientGeneratorBase);
|
|
617
771
|
//# sourceMappingURL=angular-codegen.js.map
|