@memberjunction/ng-core-entity-forms 2.32.1 → 2.33.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.
Files changed (2) hide show
  1. package/README.md +180 -0
  2. package/package.json +11 -11
package/README.md ADDED
@@ -0,0 +1,180 @@
1
+ # @memberjunction/ng-core-entity-forms
2
+
3
+ The `@memberjunction/ng-core-entity-forms` package provides a comprehensive set of Angular form components for all core MemberJunction entities. It includes both auto-generated form components based on entity metadata and custom form components with enhanced functionality for specific entities.
4
+
5
+ ## Features
6
+
7
+ - Pre-built form components for all MemberJunction core entities
8
+ - Automatically generated forms with consistent UI across the platform
9
+ - Custom form implementations for complex entities
10
+ - Support for detail sections, tabs, and specialized form layouts
11
+ - Integration with MemberJunction's metadata system
12
+ - Tree-shake safe implementation for production builds
13
+ - Form components following MemberJunction's design patterns
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @memberjunction/ng-core-entity-forms
19
+ ```
20
+
21
+ ## Requirements
22
+
23
+ - Angular 18+
24
+ - @memberjunction/core
25
+ - @memberjunction/core-entities
26
+ - @memberjunction/ng-explorer-core
27
+ - @memberjunction/ng-base-forms
28
+ - Various MemberJunction and Kendo UI components
29
+
30
+ ## Usage
31
+
32
+ The package includes two main modules:
33
+
34
+ 1. `CoreGeneratedFormsModule` - Contains all auto-generated form components
35
+ 2. `MemberJunctionCoreEntityFormsModule` - Contains custom form components
36
+
37
+ ### Basic Setup
38
+
39
+ Import the necessary modules in your application module:
40
+
41
+ ```typescript
42
+ import {
43
+ CoreGeneratedFormsModule,
44
+ MemberJunctionCoreEntityFormsModule
45
+ } from '@memberjunction/ng-core-entity-forms';
46
+
47
+ @NgModule({
48
+ imports: [
49
+ // other imports...
50
+ CoreGeneratedFormsModule,
51
+ MemberJunctionCoreEntityFormsModule
52
+ ],
53
+ })
54
+ export class YourModule { }
55
+ ```
56
+
57
+ ### Using Generated Forms
58
+
59
+ Generated forms are dynamically loaded based on entity names. The typical pattern is to use a component factory to create the appropriate form component:
60
+
61
+ ```typescript
62
+ import { Component, ViewChild, ViewContainerRef, ComponentFactoryResolver } from '@angular/core';
63
+ import { Metadata } from '@memberjunction/core';
64
+
65
+ @Component({
66
+ selector: 'app-entity-form-container',
67
+ template: '<ng-container #formContainer></ng-container>'
68
+ })
69
+ export class EntityFormContainerComponent {
70
+ @ViewChild('formContainer', { read: ViewContainerRef }) formContainer!: ViewContainerRef;
71
+
72
+ constructor(
73
+ private componentFactoryResolver: ComponentFactoryResolver,
74
+ private metadata: Metadata
75
+ ) {}
76
+
77
+ async loadEntityForm(entityName: string, recordId: any) {
78
+ // Clear the container
79
+ this.formContainer.clear();
80
+
81
+ // Get the form component class for the entity
82
+ const formComponent = await this.metadata.GetEntityFormComponent(entityName);
83
+ if (formComponent) {
84
+ // Create the component
85
+ const factory = this.componentFactoryResolver.resolveComponentFactory(formComponent);
86
+ const componentRef = this.formContainer.createComponent(factory);
87
+
88
+ // Set inputs
89
+ componentRef.instance.recordId = recordId;
90
+
91
+ // Initialize the form
92
+ await componentRef.instance.ngOnInit();
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
98
+ ### Using Custom Forms
99
+
100
+ Custom forms can be used directly in your templates:
101
+
102
+ ```html
103
+ <!-- For the extended Entity form -->
104
+ <mj-entities-form
105
+ [recordId]="entityId"
106
+ [showToolbar]="true"
107
+ (saved)="onEntitySaved($event)">
108
+ </mj-entities-form>
109
+
110
+ <!-- For the extended EntityAction form -->
111
+ <mj-entity-action-form
112
+ [recordId]="actionId"
113
+ [showToolbar]="true"
114
+ (saved)="onActionSaved($event)">
115
+ </mj-entity-action-form>
116
+ ```
117
+
118
+ ## Architecture
119
+
120
+ ### Generated Forms
121
+
122
+ The `CoreGeneratedFormsModule` contains multiple sub-modules that collectively register all generated form components. Each entity has:
123
+
124
+ 1. A main form component (e.g., `EntityFormComponent`)
125
+ 2. Multiple section components (e.g., `EntityDetailsComponent`, `EntityTopComponent`)
126
+ 3. A loader function to prevent tree-shaking (e.g., `LoadEntityFormComponent()`)
127
+
128
+ ### Custom Forms
129
+
130
+ The `MemberJunctionCoreEntityFormsModule` contains extended form components that provide additional functionality beyond the auto-generated forms:
131
+
132
+ 1. `EntityFormExtendedComponent` - Enhanced form for Entity management
133
+ 2. `EntityActionExtendedFormComponent` - Enhanced form for EntityAction management
134
+ 3. `ActionTopComponentExtended` - Custom top section for Action forms
135
+
136
+ ## Forms Structure
137
+
138
+ Each entity form typically follows this structure:
139
+
140
+ 1. A main form component that extends `BaseFormComponent`
141
+ 2. Multiple section components for different aspects of the entity
142
+ 3. A tabbed interface for complex entities
143
+ 4. Integration with grids, dropdowns, and other UI components
144
+
145
+ ## Key Components
146
+
147
+ | Component | Description |
148
+ |-----------|-------------|
149
+ | Entity forms | Forms for managing metadata entities (Entity, EntityField, etc.) |
150
+ | Action forms | Forms for managing actions and workflows |
151
+ | User forms | Forms for user management and permissions |
152
+ | Integration forms | Forms for external system integrations |
153
+ | AI-related forms | Forms for AI models, prompts, and agents |
154
+ | Content forms | Forms for content management |
155
+ | Communication forms | Forms for messaging and notifications |
156
+
157
+ ## Notes
158
+
159
+ - Form components are dynamically instantiated at runtime based on entity names
160
+ - Custom loader functions are used to prevent tree-shaking in production builds
161
+ - The package is designed to work with the MemberJunction Explorer application
162
+ - Forms rely on metadata from the `@memberjunction/core` package for field definitions
163
+
164
+ ## Dependencies
165
+
166
+ - @angular/common
167
+ - @angular/core
168
+ - @angular/forms
169
+ - @memberjunction/core
170
+ - @memberjunction/core-entities
171
+ - @memberjunction/ng-explorer-core
172
+ - @memberjunction/ng-base-forms
173
+ - @memberjunction/ng-form-toolbar
174
+ - @memberjunction/ng-tabstrip
175
+ - @memberjunction/ng-container-directives
176
+ - @memberjunction/ng-code-editor
177
+ - @memberjunction/ng-timeline
178
+ - @memberjunction/ng-join-grid
179
+ - @progress/kendo-angular-grid
180
+ - @progress/kendo-angular-dropdowns
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-core-entity-forms",
3
- "version": "2.32.1",
3
+ "version": "2.33.0",
4
4
  "description": "MemberJunction Core Entity Angular Forms",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -24,16 +24,16 @@
24
24
  "@angular/forms": "18.0.2"
25
25
  },
26
26
  "dependencies": {
27
- "@memberjunction/core": "2.32.1",
28
- "@memberjunction/core-entities": "2.32.1",
29
- "@memberjunction/ng-explorer-core": "2.32.1",
30
- "@memberjunction/ng-base-forms": "2.32.1",
31
- "@memberjunction/ng-form-toolbar": "2.32.1",
32
- "@memberjunction/ng-tabstrip": "2.32.1",
33
- "@memberjunction/ng-container-directives": "2.32.1",
34
- "@memberjunction/ng-code-editor": "2.32.1",
35
- "@memberjunction/ng-timeline": "2.32.1",
36
- "@memberjunction/ng-join-grid": "2.32.1",
27
+ "@memberjunction/core": "2.33.0",
28
+ "@memberjunction/core-entities": "2.33.0",
29
+ "@memberjunction/ng-explorer-core": "2.33.0",
30
+ "@memberjunction/ng-base-forms": "2.33.0",
31
+ "@memberjunction/ng-form-toolbar": "2.33.0",
32
+ "@memberjunction/ng-tabstrip": "2.33.0",
33
+ "@memberjunction/ng-container-directives": "2.33.0",
34
+ "@memberjunction/ng-code-editor": "2.33.0",
35
+ "@memberjunction/ng-timeline": "2.33.0",
36
+ "@memberjunction/ng-join-grid": "2.33.0",
37
37
  "@progress/kendo-angular-grid": "16.2.0",
38
38
  "@progress/kendo-angular-dropdowns": "16.2.0",
39
39
  "tslib": "^2.3.0"