@mj-biz-apps/common-ng 5.4.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/README.md +276 -0
- package/dist/lib/components/address-editor/address-editor.component.d.ts +249 -0
- package/dist/lib/components/address-editor/address-editor.component.d.ts.map +1 -0
- package/dist/lib/components/address-editor/address-editor.component.js +981 -0
- package/dist/lib/components/address-editor/address-editor.component.js.map +1 -0
- package/dist/lib/components/contact-method-list/contact-method-list.component.d.ts +256 -0
- package/dist/lib/components/contact-method-list/contact-method-list.component.d.ts.map +1 -0
- package/dist/lib/components/contact-method-list/contact-method-list.component.js +788 -0
- package/dist/lib/components/contact-method-list/contact-method-list.component.js.map +1 -0
- package/dist/lib/components/org-hierarchy-tree/org-hierarchy-tree.component.d.ts +119 -0
- package/dist/lib/components/org-hierarchy-tree/org-hierarchy-tree.component.d.ts.map +1 -0
- package/dist/lib/components/org-hierarchy-tree/org-hierarchy-tree.component.js +295 -0
- package/dist/lib/components/org-hierarchy-tree/org-hierarchy-tree.component.js.map +1 -0
- package/dist/lib/components/relationship-list/relationship-list.component.d.ts +392 -0
- package/dist/lib/components/relationship-list/relationship-list.component.d.ts.map +1 -0
- package/dist/lib/components/relationship-list/relationship-list.component.js +1171 -0
- package/dist/lib/components/relationship-list/relationship-list.component.js.map +1 -0
- package/dist/lib/custom/Organization/organization-form.component.d.ts +24 -0
- package/dist/lib/custom/Organization/organization-form.component.d.ts.map +1 -0
- package/dist/lib/custom/Organization/organization-form.component.js +244 -0
- package/dist/lib/custom/Organization/organization-form.component.js.map +1 -0
- package/dist/lib/custom/Person/person-form.component.d.ts +24 -0
- package/dist/lib/custom/Person/person-form.component.d.ts.map +1 -0
- package/dist/lib/custom/Person/person-form.component.js +231 -0
- package/dist/lib/custom/Person/person-form.component.js.map +1 -0
- package/dist/lib/custom/custom-forms.module.d.ts +17 -0
- package/dist/lib/custom/custom-forms.module.d.ts.map +1 -0
- package/dist/lib/custom/custom-forms.module.js +64 -0
- package/dist/lib/custom/custom-forms.module.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonAddress/mjbizappscommonaddress.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonAddress/mjbizappscommonaddress.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonAddress/mjbizappscommonaddress.form.component.js +94 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonAddress/mjbizappscommonaddress.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonAddressLink/mjbizappscommonaddresslink.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonAddressLink/mjbizappscommonaddresslink.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonAddressLink/mjbizappscommonaddresslink.form.component.js +70 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonAddressLink/mjbizappscommonaddresslink.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonAddressType/mjbizappscommonaddresstype.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonAddressType/mjbizappscommonaddresstype.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonAddressType/mjbizappscommonaddresstype.form.component.js +86 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonAddressType/mjbizappscommonaddresstype.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonContactMethod/mjbizappscommoncontactmethod.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonContactMethod/mjbizappscommoncontactmethod.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonContactMethod/mjbizappscommoncontactmethod.form.component.js +70 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonContactMethod/mjbizappscommoncontactmethod.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonContactType/mjbizappscommoncontacttype.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonContactType/mjbizappscommoncontacttype.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonContactType/mjbizappscommoncontacttype.form.component.js +86 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonContactType/mjbizappscommoncontacttype.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonOrganization/mjbizappscommonorganization.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonOrganization/mjbizappscommonorganization.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonOrganization/mjbizappscommonorganization.form.component.js +190 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonOrganization/mjbizappscommonorganization.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonOrganizationType/mjbizappscommonorganizationtype.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonOrganizationType/mjbizappscommonorganizationtype.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonOrganizationType/mjbizappscommonorganizationtype.form.component.js +80 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonOrganizationType/mjbizappscommonorganizationtype.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonPerson/mjbizappscommonperson.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonPerson/mjbizappscommonperson.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonPerson/mjbizappscommonperson.form.component.js +184 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonPerson/mjbizappscommonperson.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonRelationship/mjbizappscommonrelationship.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonRelationship/mjbizappscommonrelationship.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonRelationship/mjbizappscommonrelationship.form.component.js +78 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonRelationship/mjbizappscommonrelationship.form.component.js.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonRelationshipType/mjbizappscommonrelationshiptype.form.component.d.ts +10 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonRelationshipType/mjbizappscommonrelationshiptype.form.component.d.ts.map +1 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonRelationshipType/mjbizappscommonrelationshiptype.form.component.js +90 -0
- package/dist/lib/generated/Entities/mjBizAppsCommonRelationshipType/mjbizappscommonrelationshiptype.form.component.js.map +1 -0
- package/dist/lib/generated/class-registrations-manifest.d.ts +22 -0
- package/dist/lib/generated/class-registrations-manifest.d.ts.map +1 -0
- package/dist/lib/generated/class-registrations-manifest.js +39 -0
- package/dist/lib/generated/class-registrations-manifest.js.map +1 -0
- package/dist/lib/generated/generated-forms.module.d.ts +28 -0
- package/dist/lib/generated/generated-forms.module.d.ts.map +1 -0
- package/dist/lib/generated/generated-forms.module.js +94 -0
- package/dist/lib/generated/generated-forms.module.js.map +1 -0
- package/dist/public-api.d.ts +23 -0
- package/dist/public-api.d.ts.map +1 -0
- package/dist/public-api.js +30 -0
- package/dist/public-api.js.map +1 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# @mj-biz-apps/common-ng
|
|
2
|
+
|
|
3
|
+
Angular bootstrap and reusable UI component library for the **BizApps Common** MemberJunction Open App. Provides form components, data widgets, and composed detail views for People, Organizations, and their related data (addresses, contact methods, relationships).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @mj-biz-apps/common-ng
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
**Peer dependencies:** `@angular/core >=21`, `@angular/common >=21`
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
Import and call the bootstrap function during application initialization to register all entity classes and form components with MemberJunction's class factory:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { LoadBizAppsCommonClient } from '@mj-biz-apps/common-ng';
|
|
19
|
+
|
|
20
|
+
// Call during app bootstrap (e.g., in APP_INITIALIZER or main.ts)
|
|
21
|
+
LoadBizAppsCommonClient();
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
For NgModule-based applications, import the form modules:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
import { GeneratedFormsModule, CustomFormsModule } from '@mj-biz-apps/common-ng';
|
|
28
|
+
|
|
29
|
+
@NgModule({
|
|
30
|
+
imports: [GeneratedFormsModule, CustomFormsModule]
|
|
31
|
+
})
|
|
32
|
+
export class AppModule {}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Architecture
|
|
38
|
+
|
|
39
|
+
The package follows a three-tier component architecture:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
Form Components (NgModule-declared, @RegisterClass)
|
|
43
|
+
└── Composed Detail Views (standalone)
|
|
44
|
+
└── Atomic Widgets (standalone)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
1. **Atomic Widgets** — Small, focused, reusable standalone components that handle one concern (e.g., a header bar, a section of form fields, or a CRUD list).
|
|
48
|
+
2. **Composed Detail Views** — Standalone components that assemble multiple atomic widgets into a complete layout for a specific entity (Person Command Center, Organization HQ View).
|
|
49
|
+
3. **Form Components** — NgModule-declared components registered with MJ's class factory via `@RegisterClass`. They wrap a composed detail view inside `mj-record-form-container` to get the standard MJ form chrome (save/delete toolbar, navigation, favorites, history).
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Components
|
|
54
|
+
|
|
55
|
+
### Atomic Widgets — Person
|
|
56
|
+
|
|
57
|
+
| Component | Selector | Description |
|
|
58
|
+
|---|---|---|
|
|
59
|
+
| `PersonHeaderComponent` | `<bizapps-person-header>` | Dark gradient header with avatar initials, name, job title, and organization navigation link |
|
|
60
|
+
| `PersonSummaryCardsComponent` | `<bizapps-person-summary-cards>` | Four metric cards showing email, phone, address count, and relationship count (lazy-loaded) |
|
|
61
|
+
| `PersonIdentitySectionComponent` | `<bizapps-person-identity-section>` | Section card with identity fields: name, preferred name, prefix/suffix/gender, date of birth |
|
|
62
|
+
| `PersonProfessionalSectionComponent` | `<bizapps-person-professional-section>` | Section card with professional fields: title, job title, organization link, email, phone, bio |
|
|
63
|
+
| `PersonAccountSectionComponent` | `<bizapps-person-account-section>` | Section card with account fields: linked user and status |
|
|
64
|
+
|
|
65
|
+
### Atomic Widgets — Organization
|
|
66
|
+
|
|
67
|
+
| Component | Selector | Description |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| `OrgHeaderComponent` | `<bizapps-org-header>` | Top bar with logo initial, name, type badge, status, founded year, and website action |
|
|
70
|
+
| `OrgIdentitySectionComponent` | `<bizapps-org-identity-section>` | Panel card with all organization detail fields: name, legal name, type, status, contacts, parent, description |
|
|
71
|
+
| `OrgHierarchyTreeComponent` | `<bizapps-org-hierarchy-tree>` | Self-loading tree view showing parent, current, and child organizations with navigation |
|
|
72
|
+
|
|
73
|
+
### Atomic Widgets — CRUD Data
|
|
74
|
+
|
|
75
|
+
| Component | Selector | Description |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `AddressEditorComponent` | `<bizapps-address-editor>` | Full CRUD for addresses via the AddressLink polymorphic pattern. Compact table layout with inline editing, primary badge, and type management |
|
|
78
|
+
| `ContactMethodListComponent` | `<bizapps-contact-method-list>` | Full CRUD for contact methods (email, phone, social, etc.) with icon-coded types, copy-to-clipboard, and primary designation |
|
|
79
|
+
| `RelationshipListComponent` | `<bizapps-relationship-list>` | Grouped relationship viewer organized by category (Employment, Personal, Business) with directional label logic and navigation events |
|
|
80
|
+
|
|
81
|
+
### Composed Detail Views
|
|
82
|
+
|
|
83
|
+
| Component | Selector | Description |
|
|
84
|
+
|---|---|---|
|
|
85
|
+
| `PersonDetailComponent` | `<bizapps-person-detail>` | **Command Center** layout — dark header, summary cards, two-column body with all person sections and CRUD widgets |
|
|
86
|
+
| `OrgDetailComponent` | `<bizapps-org-detail>` | **HQ View** layout — dark icon sidebar, header bar, two-column body with identity, hierarchy tree, and CRUD widgets |
|
|
87
|
+
|
|
88
|
+
### Form Components
|
|
89
|
+
|
|
90
|
+
| Component | Selector | Registered Entity |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| `BizAppsPersonFormComponent` | `<bizapps-person-form>` | `MJ.BizApps.Common: People` |
|
|
93
|
+
| `BizAppsOrganizationFormComponent` | `<bizapps-organization-form>` | `MJ.BizApps.Common: Organizations` |
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Usage Examples
|
|
98
|
+
|
|
99
|
+
### Standalone Widgets
|
|
100
|
+
|
|
101
|
+
All atomic widgets and composed detail views are **standalone components** that can be imported directly into any Angular component or module:
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<!-- Person Command Center (all-in-one) -->
|
|
105
|
+
<bizapps-person-detail
|
|
106
|
+
[Record]="personEntity"
|
|
107
|
+
[EditMode]="isEditing"
|
|
108
|
+
[FormContext]="formContext"
|
|
109
|
+
(Navigate)="onNavigate($event)">
|
|
110
|
+
</bizapps-person-detail>
|
|
111
|
+
|
|
112
|
+
<!-- Organization HQ View (all-in-one) -->
|
|
113
|
+
<bizapps-org-detail
|
|
114
|
+
[Record]="orgEntity"
|
|
115
|
+
[EditMode]="isEditing"
|
|
116
|
+
[FormContext]="formContext"
|
|
117
|
+
(Navigate)="onNavigate($event)">
|
|
118
|
+
</bizapps-org-detail>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Individual Widgets
|
|
122
|
+
|
|
123
|
+
Use atomic widgets independently when you only need part of the layout:
|
|
124
|
+
|
|
125
|
+
```html
|
|
126
|
+
<!-- Address editor for any entity that supports the AddressLink pattern -->
|
|
127
|
+
<bizapps-address-editor
|
|
128
|
+
EntityName="MJ.BizApps.Common: People"
|
|
129
|
+
[RecordID]="personId">
|
|
130
|
+
</bizapps-address-editor>
|
|
131
|
+
|
|
132
|
+
<!-- Contact methods for a person -->
|
|
133
|
+
<bizapps-contact-method-list
|
|
134
|
+
[PersonID]="personId">
|
|
135
|
+
</bizapps-contact-method-list>
|
|
136
|
+
|
|
137
|
+
<!-- Contact methods for an organization -->
|
|
138
|
+
<bizapps-contact-method-list
|
|
139
|
+
[OrganizationID]="orgId">
|
|
140
|
+
</bizapps-contact-method-list>
|
|
141
|
+
|
|
142
|
+
<!-- Relationships for a person -->
|
|
143
|
+
<bizapps-relationship-list
|
|
144
|
+
[PersonID]="personId"
|
|
145
|
+
(Navigate)="onNavigate($event)">
|
|
146
|
+
</bizapps-relationship-list>
|
|
147
|
+
|
|
148
|
+
<!-- Organization hierarchy tree (self-loading) -->
|
|
149
|
+
<bizapps-org-hierarchy-tree
|
|
150
|
+
[OrganizationID]="orgId"
|
|
151
|
+
(Navigate)="onNavigate($event)">
|
|
152
|
+
</bizapps-org-hierarchy-tree>
|
|
153
|
+
|
|
154
|
+
<!-- Person header only -->
|
|
155
|
+
<bizapps-person-header
|
|
156
|
+
[Record]="personEntity"
|
|
157
|
+
(Navigate)="onNavigate($event)">
|
|
158
|
+
</bizapps-person-header>
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
---
|
|
162
|
+
|
|
163
|
+
## Inputs & Outputs Reference
|
|
164
|
+
|
|
165
|
+
### Common Inputs (Section Widgets)
|
|
166
|
+
|
|
167
|
+
| Input | Type | Default | Description |
|
|
168
|
+
|---|---|---|---|
|
|
169
|
+
| `Record` | Entity object | `undefined` | The MJ entity record to display |
|
|
170
|
+
| `EditMode` | `boolean` | `false` | Whether fields are editable or read-only |
|
|
171
|
+
| `FormContext` | `FormContext` | `undefined` | Shared form state (validation, visibility settings) |
|
|
172
|
+
|
|
173
|
+
### Common Outputs
|
|
174
|
+
|
|
175
|
+
| Output | Type | Description |
|
|
176
|
+
|---|---|---|
|
|
177
|
+
| `Navigate` | `EventEmitter<FormNavigationEvent>` | Emitted when a navigation link is clicked (org link, relationship target, hierarchy node). The parent handles actual routing. |
|
|
178
|
+
|
|
179
|
+
### AddressEditor Inputs
|
|
180
|
+
|
|
181
|
+
| Input | Type | Description |
|
|
182
|
+
|---|---|---|
|
|
183
|
+
| `EntityName` | `string` | MJ entity name (e.g. `'MJ.BizApps.Common: People'`) |
|
|
184
|
+
| `RecordID` | `string` | ID of the parent record |
|
|
185
|
+
|
|
186
|
+
### ContactMethodList Inputs
|
|
187
|
+
|
|
188
|
+
| Input | Type | Description |
|
|
189
|
+
|---|---|---|
|
|
190
|
+
| `PersonID` | `string \| null` | Person record ID (set one) |
|
|
191
|
+
| `OrganizationID` | `string \| null` | Organization record ID (set one) |
|
|
192
|
+
|
|
193
|
+
### RelationshipList Inputs
|
|
194
|
+
|
|
195
|
+
| Input | Type | Description |
|
|
196
|
+
|---|---|---|
|
|
197
|
+
| `PersonID` | `string \| null` | Person record ID (set one) |
|
|
198
|
+
| `OrganizationID` | `string \| null` | Organization record ID (set one) |
|
|
199
|
+
|
|
200
|
+
### OrgHierarchyTree Inputs
|
|
201
|
+
|
|
202
|
+
| Input | Type | Description |
|
|
203
|
+
|---|---|---|
|
|
204
|
+
| `OrganizationID` | `string \| null` | Organization ID to build the tree around |
|
|
205
|
+
|
|
206
|
+
### OrgHeader Outputs
|
|
207
|
+
|
|
208
|
+
| Output | Type | Description |
|
|
209
|
+
|---|---|---|
|
|
210
|
+
| `Navigate` | `EventEmitter<FormNavigationEvent>` | Parent org navigation |
|
|
211
|
+
| `WebsiteClick` | `EventEmitter<string>` | Emitted with the website URL when the button is clicked |
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## Data Access Patterns
|
|
216
|
+
|
|
217
|
+
All components use MemberJunction's `RunView` / `RunViews` for data access:
|
|
218
|
+
|
|
219
|
+
- **AddressEditor**: Two-table pattern via `Address` + `AddressLink` entities. Batch-loads addresses, types, and links.
|
|
220
|
+
- **ContactMethodList**: Single-table CRUD on `ContactMethod` entity, with `ContactType` lookup for icons.
|
|
221
|
+
- **RelationshipList**: Loads `Relationship` entities with directional label logic (ForwardLabel/ReverseLabel) and groups by `RelationshipType.Category`.
|
|
222
|
+
- **OrgHierarchyTree**: Self-loading tree that batch-queries parent, current, and child organizations in a single `RunViews` call.
|
|
223
|
+
- **PersonSummaryCards**: Lazy-loads address and relationship counts via `RunViews` with `ResultType: 'simple'`.
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Exports
|
|
228
|
+
|
|
229
|
+
The package re-exports everything needed for consumption:
|
|
230
|
+
|
|
231
|
+
```typescript
|
|
232
|
+
// Bootstrap
|
|
233
|
+
export { LoadBizAppsCommonClient } from '@mj-biz-apps/common-ng';
|
|
234
|
+
export { CLASS_REGISTRATIONS } from '@mj-biz-apps/common-ng';
|
|
235
|
+
|
|
236
|
+
// Modules
|
|
237
|
+
export { GeneratedFormsModule } from '@mj-biz-apps/common-ng';
|
|
238
|
+
export { CustomFormsModule } from '@mj-biz-apps/common-ng';
|
|
239
|
+
|
|
240
|
+
// All 13 standalone components
|
|
241
|
+
export { PersonHeaderComponent } from '@mj-biz-apps/common-ng';
|
|
242
|
+
export { PersonSummaryCardsComponent } from '@mj-biz-apps/common-ng';
|
|
243
|
+
export { PersonIdentitySectionComponent } from '@mj-biz-apps/common-ng';
|
|
244
|
+
export { PersonProfessionalSectionComponent } from '@mj-biz-apps/common-ng';
|
|
245
|
+
export { PersonAccountSectionComponent } from '@mj-biz-apps/common-ng';
|
|
246
|
+
export { PersonDetailComponent } from '@mj-biz-apps/common-ng';
|
|
247
|
+
export { OrgHeaderComponent } from '@mj-biz-apps/common-ng';
|
|
248
|
+
export { OrgIdentitySectionComponent } from '@mj-biz-apps/common-ng';
|
|
249
|
+
export { OrgHierarchyTreeComponent, OrgTreeNode } from '@mj-biz-apps/common-ng';
|
|
250
|
+
export { OrgDetailComponent } from '@mj-biz-apps/common-ng';
|
|
251
|
+
export { AddressEditorComponent } from '@mj-biz-apps/common-ng';
|
|
252
|
+
export { ContactMethodListComponent } from '@mj-biz-apps/common-ng';
|
|
253
|
+
export { RelationshipListComponent } from '@mj-biz-apps/common-ng';
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Build
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
cd packages/Angular
|
|
262
|
+
npm run build # Runs ngc (Angular compiler)
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
The output is written to `dist/` and consumed via the `main` and `types` fields in `package.json`.
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Design Decisions
|
|
270
|
+
|
|
271
|
+
- **Standalone components** for all widgets ensures maximum reusability. Each component declares its own dependencies and can be imported anywhere without requiring a shared NgModule.
|
|
272
|
+
- **NgModule-declared form components** are required because MJ's `@RegisterClass(BaseFormComponent, ...)` pattern expects components to be declared in a module for the class factory to resolve them.
|
|
273
|
+
- **No routing** in any component. Navigation events are emitted as outputs; the containing application handles routing.
|
|
274
|
+
- **`@if`/`@for` block syntax** used throughout (Angular 21 modern template syntax).
|
|
275
|
+
- **`inject()` function** used for DI instead of constructor injection.
|
|
276
|
+
- **PascalCase** for all public members, **camelCase** for private/protected, per MJ conventions.
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import { EventEmitter } from '@angular/core';
|
|
2
|
+
import { mjBizAppsCommonAddressEntity, mjBizAppsCommonAddressLinkEntity, mjBizAppsCommonAddressTypeEntity } from '@mj-biz-apps/common-entities';
|
|
3
|
+
import * as i0 from "@angular/core";
|
|
4
|
+
/**
|
|
5
|
+
* Represents a single address row in the editor, pairing the physical
|
|
6
|
+
* address record with its entity-specific link record.
|
|
7
|
+
*
|
|
8
|
+
* MemberJunction uses a two-table pattern for addresses:
|
|
9
|
+
* - **Address** holds the street/city/state data (reusable across entities).
|
|
10
|
+
* - **AddressLink** binds an Address to a specific entity record and carries
|
|
11
|
+
* the address type and primary flag.
|
|
12
|
+
*/
|
|
13
|
+
interface AddressItem {
|
|
14
|
+
/** The AddressLink entity that ties the address to the parent record. */
|
|
15
|
+
Link: mjBizAppsCommonAddressLinkEntity;
|
|
16
|
+
/** The Address entity containing the physical location data. */
|
|
17
|
+
Address: mjBizAppsCommonAddressEntity;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Form model used for both creating and editing an address.
|
|
21
|
+
*
|
|
22
|
+
* All fields map directly to the corresponding Address and AddressLink
|
|
23
|
+
* entity properties so that two-way binding in the template works cleanly.
|
|
24
|
+
*/
|
|
25
|
+
interface AddressEditForm {
|
|
26
|
+
/** The selected AddressType record ID. */
|
|
27
|
+
TypeID: string;
|
|
28
|
+
/** Whether this address should be marked as the primary address for the parent record. */
|
|
29
|
+
IsPrimary: boolean;
|
|
30
|
+
/** Street address line 1 (required). */
|
|
31
|
+
Line1: string;
|
|
32
|
+
/** Street address line 2 (apartment, suite, etc.). Optional. */
|
|
33
|
+
Line2: string;
|
|
34
|
+
/** City name (required). */
|
|
35
|
+
City: string;
|
|
36
|
+
/** State or province abbreviation (e.g., `'CA'`, `'ON'`). */
|
|
37
|
+
StateProvince: string;
|
|
38
|
+
/** Postal or ZIP code. */
|
|
39
|
+
PostalCode: string;
|
|
40
|
+
/** ISO country code (e.g., `'US'`, `'CA'`). Defaults to `'US'`. */
|
|
41
|
+
Country: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Manages CRUD operations for addresses linked to any MemberJunction entity record.
|
|
45
|
+
*
|
|
46
|
+
* This component implements the MJ two-table address pattern:
|
|
47
|
+
* - **Address** stores the physical location data (line 1, city, country, etc.).
|
|
48
|
+
* - **AddressLink** binds an address to a specific entity and record, and carries
|
|
49
|
+
* the address type (Home, Work, etc.) and the primary flag.
|
|
50
|
+
*
|
|
51
|
+
* The component automatically loads addresses and address types when both
|
|
52
|
+
* {@link EntityName} and {@link RecordID} inputs are set, and provides
|
|
53
|
+
* inline add/edit/delete functionality with primary-address management.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```html
|
|
57
|
+
* <bizapps-address-editor
|
|
58
|
+
* EntityName="MJ.BizApps.Common: People"
|
|
59
|
+
* [RecordID]="personId">
|
|
60
|
+
* </bizapps-address-editor>
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare class AddressEditorComponent {
|
|
64
|
+
private cdr;
|
|
65
|
+
constructor();
|
|
66
|
+
/** ISO 3166-1 alpha-2 country codes for the country dropdown. */
|
|
67
|
+
readonly Countries: {
|
|
68
|
+
Code: string;
|
|
69
|
+
Name: string;
|
|
70
|
+
}[];
|
|
71
|
+
/**
|
|
72
|
+
* Controls whether add, edit, delete, and set-primary actions are available.
|
|
73
|
+
* When `false`, the component renders in read-only display mode.
|
|
74
|
+
* Typically bound to the parent form's `EditMode` property.
|
|
75
|
+
*/
|
|
76
|
+
EditMode: boolean;
|
|
77
|
+
/** Emitted after any mutation (save, delete, set-primary) so the parent can refresh derived data. */
|
|
78
|
+
DataChanged: EventEmitter<void>;
|
|
79
|
+
private _entityName;
|
|
80
|
+
private _recordID;
|
|
81
|
+
/**
|
|
82
|
+
* The MemberJunction entity name (schema-qualified) of the parent record
|
|
83
|
+
* whose addresses are being managed.
|
|
84
|
+
*
|
|
85
|
+
* Setting this property triggers a data reload when {@link RecordID} is
|
|
86
|
+
* also available, unless the value has not changed.
|
|
87
|
+
*
|
|
88
|
+
* @example `'MJ.BizApps.Common: People'`
|
|
89
|
+
*/
|
|
90
|
+
set EntityName(value: string);
|
|
91
|
+
get EntityName(): string;
|
|
92
|
+
/**
|
|
93
|
+
* The primary key (ID) of the parent record whose addresses are being managed.
|
|
94
|
+
*
|
|
95
|
+
* Setting this property triggers a data reload when {@link EntityName} is
|
|
96
|
+
* also available, unless the value has not changed.
|
|
97
|
+
*
|
|
98
|
+
* @example `'A1B2C3D4-E5F6-7890-ABCD-EF1234567890'`
|
|
99
|
+
*/
|
|
100
|
+
set RecordID(value: string);
|
|
101
|
+
get RecordID(): string;
|
|
102
|
+
/**
|
|
103
|
+
* The list of address items currently displayed, each pairing an
|
|
104
|
+
* AddressLink with its corresponding Address entity. Sorted with
|
|
105
|
+
* primary addresses first.
|
|
106
|
+
*/
|
|
107
|
+
AddressItems: AddressItem[];
|
|
108
|
+
/**
|
|
109
|
+
* All active address types available for selection in the type dropdown.
|
|
110
|
+
* Loaded from the `MJ.BizApps.Common: Address Types` entity, sorted by
|
|
111
|
+
* `DefaultRank ASC`.
|
|
112
|
+
*/
|
|
113
|
+
AddressTypes: mjBizAppsCommonAddressTypeEntity[];
|
|
114
|
+
/**
|
|
115
|
+
* Tracks the current editing state:
|
|
116
|
+
* - `null` -- not editing (display mode)
|
|
117
|
+
* - `-1` -- adding a new address
|
|
118
|
+
* - `>= 0` -- editing the address at that array index
|
|
119
|
+
*/
|
|
120
|
+
EditingIndex: number | null;
|
|
121
|
+
/**
|
|
122
|
+
* The form model bound to the inline add/edit panel via two-way binding.
|
|
123
|
+
* Reset to defaults when adding, or populated from the existing record
|
|
124
|
+
* when editing.
|
|
125
|
+
*/
|
|
126
|
+
EditForm: AddressEditForm;
|
|
127
|
+
/**
|
|
128
|
+
* Indicates whether the component is performing the initial data load.
|
|
129
|
+
* The template shows a loading spinner while this is `true`.
|
|
130
|
+
*/
|
|
131
|
+
Loading: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* Indicates whether a save, delete, or set-primary operation is in progress.
|
|
134
|
+
* Used to disable action buttons and show spinner feedback while `true`.
|
|
135
|
+
*/
|
|
136
|
+
Saving: boolean;
|
|
137
|
+
/** The resolved MJ EntityID for the current {@link EntityName}. */
|
|
138
|
+
private resolvedEntityID;
|
|
139
|
+
/** Cached action ID for the Postal Code Lookup action. */
|
|
140
|
+
private postalCodeLookupActionID;
|
|
141
|
+
/** Whether a postal code lookup is currently in progress. */
|
|
142
|
+
LookingUpPostalCode: boolean;
|
|
143
|
+
/** Whether the last postal code lookup returned no results. */
|
|
144
|
+
PostalCodeNotFound: boolean;
|
|
145
|
+
/** The postal code value when the form was opened, used to detect changes. */
|
|
146
|
+
private originalPostalCode;
|
|
147
|
+
/** Creates a blank {@link AddressEditForm} with sensible defaults. */
|
|
148
|
+
private createEmptyForm;
|
|
149
|
+
/**
|
|
150
|
+
* Looks up city and state from a postal code using the Postal Code Lookup
|
|
151
|
+
* MJ Action (backed by Google Geocoding API). Called on blur of the postal
|
|
152
|
+
* code input field.
|
|
153
|
+
*
|
|
154
|
+
* For new addresses: triggers when City or State are empty.
|
|
155
|
+
* For edits: triggers when the postal code changed from the original value.
|
|
156
|
+
*/
|
|
157
|
+
onPostalCodeBlur(): Promise<void>;
|
|
158
|
+
/** Resolves and caches the Action ID for "Postal Code Lookup" using ActionEngineBase metadata. */
|
|
159
|
+
private getPostalCodeLookupActionID;
|
|
160
|
+
/**
|
|
161
|
+
* Loads address links, their associated addresses, and available address
|
|
162
|
+
* types from the server. Resets editing state before loading.
|
|
163
|
+
*/
|
|
164
|
+
private loadData;
|
|
165
|
+
/**
|
|
166
|
+
* Resolves the Font Awesome icon class for a given address type.
|
|
167
|
+
*
|
|
168
|
+
* Falls back to `'fa-solid fa-location-dot'` when the type is not found
|
|
169
|
+
* or has no icon configured.
|
|
170
|
+
*
|
|
171
|
+
* @param typeID - The AddressType record ID to look up
|
|
172
|
+
* @returns The CSS class string for the icon (e.g., `'fa-solid fa-home'`)
|
|
173
|
+
*/
|
|
174
|
+
getAddressTypeIcon(typeID: string): string;
|
|
175
|
+
/**
|
|
176
|
+
* Formats the first line of an address display string.
|
|
177
|
+
*
|
|
178
|
+
* Combines Line1 and Line2 (if present) with a comma separator.
|
|
179
|
+
*
|
|
180
|
+
* @param address - The Address entity to format
|
|
181
|
+
* @returns A formatted string such as `'123 Main St, Suite 200'`
|
|
182
|
+
*/
|
|
183
|
+
formatAddressLine1(address: mjBizAppsCommonAddressEntity): string;
|
|
184
|
+
/**
|
|
185
|
+
* Formats the second line of an address display string.
|
|
186
|
+
*
|
|
187
|
+
* Combines City, StateProvince, PostalCode, and Country into a standard
|
|
188
|
+
* comma-separated format.
|
|
189
|
+
*
|
|
190
|
+
* @param address - The Address entity to format
|
|
191
|
+
* @returns A formatted string such as `'San Francisco, CA, 94105, US'`
|
|
192
|
+
*/
|
|
193
|
+
formatAddressLine2(address: mjBizAppsCommonAddressEntity): string;
|
|
194
|
+
/**
|
|
195
|
+
* Opens the inline add form for creating a new address.
|
|
196
|
+
*
|
|
197
|
+
* Resets the edit form to defaults, pre-selects the first available
|
|
198
|
+
* address type, and auto-checks the "Primary" flag when no addresses
|
|
199
|
+
* exist yet.
|
|
200
|
+
*/
|
|
201
|
+
onAdd(): void;
|
|
202
|
+
/**
|
|
203
|
+
* Opens the inline edit form for an existing address, populating the
|
|
204
|
+
* form fields from the current address and link data.
|
|
205
|
+
*
|
|
206
|
+
* @param index - The zero-based index of the address item in {@link AddressItems}
|
|
207
|
+
*/
|
|
208
|
+
onEdit(index: number): void;
|
|
209
|
+
/**
|
|
210
|
+
* Cancels the current add or edit operation and returns to display mode.
|
|
211
|
+
*/
|
|
212
|
+
onCancelEdit(): void;
|
|
213
|
+
/**
|
|
214
|
+
* Persists the current form data, handling both new address creation and
|
|
215
|
+
* existing address updates.
|
|
216
|
+
*
|
|
217
|
+
* When the "Primary" flag is set, all other addresses for the same
|
|
218
|
+
* parent record are demoted. After saving, the address list is reloaded.
|
|
219
|
+
*/
|
|
220
|
+
onSave(): Promise<void>;
|
|
221
|
+
/** Updates an existing Address and its AddressLink with form data. */
|
|
222
|
+
private saveExisting;
|
|
223
|
+
/** Creates a new Address record and its associated AddressLink. */
|
|
224
|
+
private saveNew;
|
|
225
|
+
/** Removes the primary flag from all other address links for this record. */
|
|
226
|
+
private clearOtherPrimaries;
|
|
227
|
+
/**
|
|
228
|
+
* Promotes the address at the given index to primary, demoting all others.
|
|
229
|
+
*
|
|
230
|
+
* After the update, the address list is reloaded so that sort order
|
|
231
|
+
* reflects the new primary designation.
|
|
232
|
+
*
|
|
233
|
+
* @param index - The zero-based index of the address item in {@link AddressItems}
|
|
234
|
+
*/
|
|
235
|
+
onSetPrimary(index: number): Promise<void>;
|
|
236
|
+
/**
|
|
237
|
+
* Deletes the address at the given index, removing both the AddressLink
|
|
238
|
+
* and the orphaned Address record.
|
|
239
|
+
*
|
|
240
|
+
* After deletion, the address list is reloaded.
|
|
241
|
+
*
|
|
242
|
+
* @param index - The zero-based index of the address item in {@link AddressItems}
|
|
243
|
+
*/
|
|
244
|
+
onDelete(index: number): Promise<void>;
|
|
245
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<AddressEditorComponent, never>;
|
|
246
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<AddressEditorComponent, "bizapps-address-editor", never, { "EditMode": { "alias": "EditMode"; "required": false; }; "EntityName": { "alias": "EntityName"; "required": false; }; "RecordID": { "alias": "RecordID"; "required": false; }; }, { "DataChanged": "DataChanged"; }, never, never, true, never>;
|
|
247
|
+
}
|
|
248
|
+
export {};
|
|
249
|
+
//# sourceMappingURL=address-editor.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-editor.component.d.ts","sourceRoot":"","sources":["../../../../src/lib/components/address-editor/address-editor.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAA6B,MAAM,eAAe,CAAC;AAMlG,OAAO,EACH,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EACnC,MAAM,8BAA8B,CAAC;;AAEtC;;;;;;;;GAQG;AACH,UAAU,WAAW;IACjB,yEAAyE;IACzE,IAAI,EAAE,gCAAgC,CAAC;IAEvC,gEAAgE;IAChE,OAAO,EAAE,4BAA4B,CAAC;CACzC;AAED;;;;;GAKG;AACH,UAAU,eAAe;IACrB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IAEf,0FAA0F;IAC1F,SAAS,EAAE,OAAO,CAAC;IAEnB,wCAAwC;IACxC,KAAK,EAAE,MAAM,CAAC;IAEd,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IAEd,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IAEb,6DAA6D;IAC7D,aAAa,EAAE,MAAM,CAAC;IAEtB,0BAA0B;IAC1B,UAAU,EAAE,MAAM,CAAC;IAEnB,mEAAmE;IACnE,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAOa,sBAAsB;IAC/B,OAAO,CAAC,GAAG,CAA6B;;IAOxC,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAgClD;IAEF;;;;OAIG;IACM,QAAQ,UAAS;IAE1B,qGAAqG;IAC3F,WAAW,qBAA4B;IAEjD,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,SAAS,CAAM;IAEvB;;;;;;;;OAQG;IACH,IACI,UAAU,CAAC,KAAK,EAAE,MAAM,EAM3B;IACD,IAAI,UAAU,IAAI,MAAM,CAA6B;IAErD;;;;;;;OAOG;IACH,IACI,QAAQ,CAAC,KAAK,EAAE,MAAM,EAMzB;IACD,IAAI,QAAQ,IAAI,MAAM,CAA2B;IAEjD;;;;OAIG;IACH,YAAY,EAAE,WAAW,EAAE,CAAM;IAEjC;;;;OAIG;IACH,YAAY,EAAE,gCAAgC,EAAE,CAAM;IAEtD;;;;;OAKG;IACH,YAAY,EAAE,MAAM,GAAG,IAAI,CAAQ;IAEnC;;;;OAIG;IACH,QAAQ,EAAE,eAAe,CAA0B;IAEnD;;;OAGG;IACH,OAAO,UAAS;IAEhB;;;OAGG;IACH,MAAM,UAAS;IAEf,mEAAmE;IACnE,OAAO,CAAC,gBAAgB,CAAM;IAE9B,0DAA0D;IAC1D,OAAO,CAAC,wBAAwB,CAAuB;IAEvD,6DAA6D;IAC7D,mBAAmB,UAAS;IAE5B,+DAA+D;IAC/D,kBAAkB,UAAS;IAE3B,8EAA8E;IAC9E,OAAO,CAAC,kBAAkB,CAAM;IAEhC,sEAAsE;IACtE,OAAO,CAAC,eAAe;IAavB;;;;;;;OAOG;IACG,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC;IAuDvC,kGAAkG;YACpF,2BAA2B;IASzC;;;OAGG;YACW,QAAQ;IAiFtB;;;;;;;;OAQG;IACH,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAK1C;;;;;;;OAOG;IACH,kBAAkB,CAAC,OAAO,EAAE,4BAA4B,GAAG,MAAM;IAMjE;;;;;;;;OAQG;IACH,kBAAkB,CAAC,OAAO,EAAE,4BAA4B,GAAG,MAAM;IAWjE;;;;;;OAMG;IACH,KAAK,IAAI,IAAI;IAcb;;;;;OAKG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAiB3B;;OAEG;IACH,YAAY,IAAI,IAAI;IAKpB;;;;;;OAMG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAiC7B,sEAAsE;YACxD,YAAY;IAkB1B,mEAAmE;YACrD,OAAO;IA8BrB,6EAA6E;YAC/D,mBAAmB;IAajC;;;;;;;OAOG;IACG,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA2BhD;;;;;;;OAOG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;yCAxjBnC,sBAAsB;2CAAtB,sBAAsB;CA8kBlC"}
|