@memberjunction/ng-explorer-core 2.42.1 → 2.44.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 +380 -96
  2. package/package.json +25 -25
package/README.md CHANGED
@@ -2,17 +2,24 @@
2
2
 
3
3
  The `@memberjunction/ng-explorer-core` package provides the core components and infrastructure for the MemberJunction Explorer application. It serves as the foundation for building a complete data exploration and management interface based on MemberJunction entities.
4
4
 
5
+ ## Overview
6
+
7
+ Explorer Core is a comprehensive Angular library that implements the MemberJunction Explorer application's core functionality. It provides a dynamic resource-based architecture for managing entities, records, reports, dashboards, queries, and other data resources within the MemberJunction ecosystem.
8
+
5
9
  ## Features
6
10
 
7
- - Resource container architecture for dynamic loading of components
8
- - Navigation and browsing components for entity records, reports, dashboards, and queries
9
- - Resource wrapper components that facilitate consistent display of different resource types
10
- - Header, navigation, and UI structure components
11
- - Authentication and user profile components
12
- - Home screen and application components
13
- - Dashboard builder and viewer components
14
- - Form toolbar and common UI patterns
15
- - Integration with MemberJunction's metadata system
11
+ - **Dynamic Resource Container Architecture**: Loads components at runtime based on resource type
12
+ - **Complete Navigation System**: Drawer-based navigation with workspace and tab management
13
+ - **Entity Management**: Browse, view, create, edit, and delete entity records
14
+ - **Dashboard System**: Create, edit, and view interactive dashboards
15
+ - **Report Integration**: Display and manage reports
16
+ - **Query Support**: Execute and display query results
17
+ - **Search Integration**: Unified search results display
18
+ - **User Views**: Support for custom user-defined views
19
+ - **Authentication**: Built-in authentication components and guards
20
+ - **Responsive Design**: Mobile-friendly UI that adapts to different screen sizes
21
+ - **Workspace Management**: Persistent workspace with saved tabs and state
22
+ - **Event-Driven Architecture**: Comprehensive event system for component communication
16
23
 
17
24
  ## Installation
18
25
 
@@ -22,158 +29,435 @@ npm install @memberjunction/ng-explorer-core
22
29
 
23
30
  ## Requirements
24
31
 
25
- - Angular 18+
26
- - MemberJunction core libraries (@memberjunction/core, @memberjunction/core-entities)
27
- - Various MemberJunction UI components
28
- - Kendo UI Angular components
32
+ - Angular 18.0.2 or higher
33
+ - MemberJunction core libraries:
34
+ - `@memberjunction/core` v2.43.0+
35
+ - `@memberjunction/core-entities` v2.43.0+
36
+ - `@memberjunction/global` v2.43.0+
37
+ - Kendo UI for Angular v16.2.0+
38
+ - TypeScript 4.9+
29
39
 
30
- ## Usage
40
+ ## Basic Setup
31
41
 
32
- ### Basic Setup
42
+ ### Module Import
33
43
 
34
- Import the ExplorerCoreModule in your application module:
44
+ Import the `ExplorerCoreModule` in your application module:
35
45
 
36
46
  ```typescript
47
+ import { NgModule } from '@angular/core';
48
+ import { BrowserModule } from '@angular/platform-browser';
37
49
  import { ExplorerCoreModule } from '@memberjunction/ng-explorer-core';
38
50
 
39
51
  @NgModule({
52
+ declarations: [AppComponent],
40
53
  imports: [
41
- // other imports...
54
+ BrowserModule,
42
55
  ExplorerCoreModule
43
56
  ],
57
+ bootstrap: [AppComponent]
44
58
  })
45
59
  export class AppModule { }
46
60
  ```
47
61
 
48
- ### Resource Container Architecture
62
+ ### Routing Configuration
49
63
 
50
- The core of the Explorer is built on a resource container architecture that dynamically loads components based on resource type:
64
+ The Explorer Core module includes its own routing configuration. You can integrate it with your application's routing:
51
65
 
52
- ```html
53
- <mj-resource
54
- [Data]="resourceData"
55
- [isVisible]="activeResourceId === resourceData.ID"
56
- (ResourceRecordSaved)="handleResourceSaved($event)"
57
- (ContentLoadingStarted)="handleLoadingStarted($event)"
58
- (ContentLoadingComplete)="handleLoadingComplete($event)">
59
- </mj-resource>
66
+ ```typescript
67
+ import { Routes } from '@angular/router';
68
+ import { AuthGuardService } from '@memberjunction/ng-explorer-core';
69
+
70
+ const routes: Routes = [
71
+ {
72
+ path: '',
73
+ canActivate: [AuthGuardService],
74
+ loadChildren: () => import('@memberjunction/ng-explorer-core').then(m => m.ExplorerCoreModule)
75
+ }
76
+ ];
60
77
  ```
61
78
 
62
- Where resourceData is a ResourceData object that includes configuration for loading the appropriate component.
79
+ ## Core Components
80
+
81
+ ### Resource Container Component
82
+
83
+ The heart of the Explorer architecture, dynamically loading components based on resource type:
84
+
85
+ ```typescript
86
+ import { Component } from '@angular/core';
87
+ import { ResourceData } from '@memberjunction/core-entities';
88
+
89
+ @Component({
90
+ template: `
91
+ <mj-resource
92
+ [Data]="resourceData"
93
+ [isVisible]="isActive"
94
+ (ResourceRecordSaved)="onResourceSaved($event)"
95
+ (ContentLoadingStarted)="onLoadingStarted($event)"
96
+ (ContentLoadingComplete)="onLoadingComplete($event)">
97
+ </mj-resource>
98
+ `
99
+ })
100
+ export class MyComponent {
101
+ resourceData: ResourceData = {
102
+ ID: 'unique-id',
103
+ Name: 'My Resource',
104
+ ResourceType: 'Records',
105
+ ResourceRecordID: '123',
106
+ Configuration: {
107
+ Entity: 'Contacts'
108
+ }
109
+ };
110
+
111
+ isActive = true;
112
+
113
+ onResourceSaved(entity: BaseEntity) {
114
+ console.log('Resource saved:', entity);
115
+ }
116
+
117
+ onLoadingStarted(container: ResourceContainerComponent) {
118
+ console.log('Loading started');
119
+ }
120
+
121
+ onLoadingComplete(container: ResourceContainerComponent) {
122
+ console.log('Loading complete');
123
+ }
124
+ }
125
+ ```
63
126
 
64
127
  ### Navigation Component
65
128
 
66
- The navigation component provides the main menu structure:
129
+ Provides the main application navigation with workspace and tab management:
67
130
 
68
- ```html
69
- <mj-navigation
70
- [selectedItem]="currentNavigationItem"
71
- (itemSelected)="handleNavigationItemSelected($event)">
72
- </mj-navigation>
131
+ ```typescript
132
+ @Component({
133
+ template: `
134
+ <mj-navigation
135
+ [applicationName]="'My Application'">
136
+ </mj-navigation>
137
+ `
138
+ })
139
+ export class AppComponent { }
73
140
  ```
74
141
 
75
142
  ### Home Component
76
143
 
77
- The home component serves as the landing page for the application:
144
+ Displays navigation items configured to show on the home screen:
78
145
 
79
- ```html
80
- <mj-home></mj-home>
146
+ ```typescript
147
+ @Component({
148
+ template: `<mj-home></mj-home>`
149
+ })
150
+ export class HomePageComponent { }
81
151
  ```
82
152
 
83
- ### Entity and Record Management
153
+ ### Entity Management Components
84
154
 
85
- For displaying and managing entity records:
155
+ #### Entity Browser
156
+ ```typescript
157
+ @Component({
158
+ template: `
159
+ <mj-single-entity
160
+ [entityName]="'Contacts'"
161
+ [viewID]="viewId">
162
+ </mj-single-entity>
163
+ `
164
+ })
165
+ export class EntityBrowserComponent {
166
+ viewId?: string; // Optional view ID
167
+ }
168
+ ```
86
169
 
87
- ```html
88
- <mj-single-entity [entityName]="entityName"></mj-single-entity>
89
- <mj-single-record [entityName]="entityName" [PrimaryKey]="recordKey"></mj-single-record>
170
+ #### Record Editor
171
+ ```typescript
172
+ @Component({
173
+ template: `
174
+ <mj-single-record
175
+ [entityName]="'Contacts'"
176
+ [PrimaryKey]="recordKey"
177
+ [newRecordValues]="defaultValues"
178
+ (recordSaved)="onRecordSaved($event)"
179
+ (loadComplete)="onLoadComplete()">
180
+ </mj-single-record>
181
+ `
182
+ })
183
+ export class RecordEditorComponent {
184
+ recordKey = new CompositeKey([{ FieldName: 'ID', Value: '123' }]);
185
+ defaultValues = { CompanyID: 1 }; // For new records
186
+
187
+ onRecordSaved(entity: BaseEntity) {
188
+ console.log('Record saved:', entity);
189
+ }
190
+
191
+ onLoadComplete() {
192
+ console.log('Record loaded');
193
+ }
194
+ }
90
195
  ```
91
196
 
92
197
  ### Dashboard Components
93
198
 
94
- For displaying and managing dashboards:
95
-
96
- ```html
97
- <mj-single-dashboard [dashboardId]="dashboardId"></mj-single-dashboard>
199
+ ```typescript
200
+ @Component({
201
+ template: `
202
+ <mj-single-dashboard
203
+ [dashboardId]="dashboardId"
204
+ [editMode]="false">
205
+ </mj-single-dashboard>
206
+ `
207
+ })
208
+ export class DashboardViewerComponent {
209
+ dashboardId = '456';
210
+ }
98
211
  ```
99
212
 
100
- ## Architecture
213
+ ### Form Toolbar
101
214
 
102
- ### Resource Wrappers
215
+ Provides consistent form actions across the application:
103
216
 
104
- The Explorer is built on a resource wrapper pattern where different types of content (records, reports, dashboards, etc.) are wrapped in specialized components that handle their specific requirements:
217
+ ```typescript
218
+ @Component({
219
+ template: `
220
+ <mj-form-toolbar
221
+ [record]="entity"
222
+ [EditMode]="true"
223
+ (SaveRecord)="save()"
224
+ (DeleteRecord)="delete()"
225
+ (CancelEdit)="cancel()">
226
+ </mj-form-toolbar>
227
+ `
228
+ })
229
+ export class FormComponent {
230
+ entity: BaseEntity;
231
+
232
+ save() { /* Save logic */ }
233
+ delete() { /* Delete logic */ }
234
+ cancel() { /* Cancel logic */ }
235
+ }
236
+ ```
105
237
 
106
- - `EntityRecordResource` - For displaying and editing entity records
107
- - `ReportResource` - For displaying and managing reports
108
- - `DashboardResource` - For displaying dashboards
109
- - `QueryResource` - For displaying query results
110
- - `SearchResultsResource` - For displaying search results
111
- - `UserViewResource` - For displaying custom user views
112
- - `ListDetailResource` - For displaying list-detail interfaces
238
+ ## Resource Types and Wrappers
113
239
 
114
- ### Component Registration
240
+ The Explorer supports multiple resource types through specialized wrapper components:
115
241
 
116
- Components register themselves with MemberJunction's class factory system:
242
+ ### Creating Custom Resource Types
117
243
 
118
244
  ```typescript
119
- @RegisterClass(BaseResourceComponent, 'ResourceType')
245
+ import { Component } from '@angular/core';
246
+ import { RegisterClass } from '@memberjunction/global';
247
+ import { BaseResourceComponent } from '@memberjunction/ng-shared';
248
+
249
+ @RegisterClass(BaseResourceComponent, 'CustomResource')
120
250
  @Component({
121
- selector: 'mj-example-resource',
122
- template: `...`
251
+ selector: 'mj-custom-resource',
252
+ template: `
253
+ <div class="custom-resource">
254
+ <h2>{{ Data.Name }}</h2>
255
+ <!-- Custom resource implementation -->
256
+ </div>
257
+ `
123
258
  })
124
- export class ExampleResource extends BaseResourceComponent {
125
- // Component implementation
259
+ export class CustomResource extends BaseResourceComponent {
260
+ async GetResourceDisplayName(data: ResourceData): Promise<string> {
261
+ return `Custom: ${data.Name}`;
262
+ }
263
+
264
+ async GetResourceIconClass(data: ResourceData): Promise<string> {
265
+ return 'fa-solid fa-star';
266
+ }
126
267
  }
127
268
  ```
128
269
 
129
- This allows the `ResourceContainerComponent` to dynamically load the appropriate component based on the resource type.
270
+ ### Built-in Resource Types
130
271
 
131
- ## Key Components
272
+ - **Records**: Entity record viewing and editing
273
+ - **Reports**: Report display and execution
274
+ - **Dashboards**: Interactive dashboard display
275
+ - **Queries**: Query execution and results
276
+ - **UserViews**: Custom user-defined views
277
+ - **SearchResults**: Unified search results
278
+ - **ListDetail**: Master-detail layouts
132
279
 
133
- ### Resource Container
280
+ ## Event System
134
281
 
135
- The `ResourceContainerComponent` is the core of the dynamic loading system, using Angular's ViewContainerRef to create components at runtime.
282
+ The Explorer uses a comprehensive event system for component communication:
136
283
 
137
- ### Form Toolbar
284
+ ```typescript
285
+ import { MJGlobal, MJEventType } from '@memberjunction/global';
286
+ import { EventCodes } from '@memberjunction/ng-shared';
287
+
288
+ // Subscribe to events
289
+ const subscription = MJGlobal.Instance.GetEventListener(false)
290
+ .subscribe((event) => {
291
+ if (event.eventCode === EventCodes.ComponentEvent) {
292
+ console.log('Component event:', event.args);
293
+ }
294
+ });
295
+
296
+ // Emit events
297
+ MJGlobal.Instance.RaiseEvent({
298
+ eventCode: EventCodes.ComponentEvent,
299
+ eventType: MJEventType.ComponentEvent,
300
+ sourceComponent: this,
301
+ args: { action: 'save', entityName: 'Contacts' }
302
+ });
303
+ ```
138
304
 
139
- The `FormToolbarComponent` provides a consistent interface for form actions like save, delete, and cancel.
305
+ ## Authentication and Guards
140
306
 
141
- ### Home Component
307
+ ### Auth Guard Service
142
308
 
143
- The `HomeComponent` serves as the landing page for the application, displaying navigation items marked for home screen display.
309
+ ```typescript
310
+ import { Routes } from '@angular/router';
311
+ import { AuthGuardService } from '@memberjunction/ng-explorer-core';
312
+
313
+ const routes: Routes = [
314
+ {
315
+ path: 'secure',
316
+ canActivate: [AuthGuardService],
317
+ component: SecureComponent
318
+ }
319
+ ];
320
+ ```
144
321
 
145
- ### Navigation Component
322
+ ### Entities Guard
146
323
 
147
- The `NavigationComponent` provides the main menu structure based on the Explorer navigation items defined in the metadata.
324
+ ```typescript
325
+ import { EntitiesGuard } from '@memberjunction/ng-explorer-core';
326
+
327
+ const routes: Routes = [
328
+ {
329
+ path: 'entities/:entityName',
330
+ canActivate: [EntitiesGuard],
331
+ component: EntityComponent
332
+ }
333
+ ];
334
+ ```
148
335
 
149
- ### Single Entity/Record Components
336
+ ## Advanced Features
150
337
 
151
- These components display entity lists and individual records, handling all CRUD operations.
338
+ ### Workspace Management
152
339
 
153
- ### Dashboard Components
340
+ The Explorer automatically manages workspace state, including:
341
+ - Open tabs and their state
342
+ - Navigation history
343
+ - User preferences
344
+ - Resource configurations
345
+
346
+ ### Tab Management
347
+
348
+ ```typescript
349
+ // Access tab management through the navigation component
350
+ @ViewChild(NavigationComponent) navigation: NavigationComponent;
351
+
352
+ // Open a new tab
353
+ this.navigation.openTab({
354
+ label: 'New Contact',
355
+ icon: 'fa-user',
356
+ data: {
357
+ resourceType: 'Records',
358
+ entityName: 'Contacts',
359
+ recordId: 'new'
360
+ }
361
+ });
362
+ ```
363
+
364
+ ### Custom Expansion Panels
365
+
366
+ ```typescript
367
+ @Component({
368
+ template: `
369
+ <mj-expansion-panel
370
+ [title]="'Advanced Options'"
371
+ [expanded]="false"
372
+ (expandedChange)="onExpandedChange($event)">
373
+ <!-- Panel content -->
374
+ </mj-expansion-panel>
375
+ `
376
+ })
377
+ export class MyPanelComponent { }
378
+ ```
379
+
380
+ ## Build Scripts
381
+
382
+ ```json
383
+ {
384
+ "scripts": {
385
+ "build": "ngc",
386
+ "watch": "ngc -w",
387
+ "test": "echo \"Error: no test specified\" && exit 1"
388
+ }
389
+ }
390
+ ```
391
+
392
+ ## Development
393
+
394
+ ### Building the Package
395
+
396
+ ```bash
397
+ # Build the package
398
+ npm run build
399
+
400
+ # Watch mode for development
401
+ npm run watch
402
+ ```
403
+
404
+ ### Package Structure
405
+
406
+ ```
407
+ explorer-core/
408
+ ├── src/
409
+ │ ├── lib/
410
+ │ │ ├── auth-button/
411
+ │ │ ├── dashboard-browser-component/
412
+ │ │ ├── generic/
413
+ │ │ ├── guards/
414
+ │ │ ├── header/
415
+ │ │ ├── home-component/
416
+ │ │ ├── navigation/
417
+ │ │ ├── resource-wrappers/
418
+ │ │ ├── single-dashboard/
419
+ │ │ ├── single-entity/
420
+ │ │ ├── single-record/
421
+ │ │ └── ...
422
+ │ ├── generic/
423
+ │ ├── shared/
424
+ │ ├── module.ts
425
+ │ └── public-api.ts
426
+ ├── package.json
427
+ └── tsconfig.json
428
+ ```
429
+
430
+ ## Integration with Other MJ Packages
431
+
432
+ The Explorer Core integrates seamlessly with:
433
+
434
+ - **@memberjunction/ng-auth-services**: Authentication and authorization
435
+ - **@memberjunction/ng-container-directives**: Layout management
436
+ - **@memberjunction/ng-entity-permissions**: Entity-level permissions
437
+ - **@memberjunction/ng-file-storage**: File upload and management
438
+ - **@memberjunction/ng-record-changes**: Audit trail functionality
439
+ - **@memberjunction/ng-user-view-grid**: Data grid components
440
+ - **@memberjunction/ng-skip-chat**: AI chat integration
441
+ - **@memberjunction/ng-dashboards**: Dashboard creation and management
442
+ - **@memberjunction/ng-resource-permissions**: Resource-level permissions
443
+
444
+ ## Best Practices
154
445
 
155
- Components for creating, editing, and viewing dashboards with support for multiple dashboard items.
446
+ 1. **Resource Loading**: Always check `isVisible` before loading heavy resources
447
+ 2. **Event Handling**: Unsubscribe from events in `ngOnDestroy`
448
+ 3. **Tab Management**: Limit concurrent tabs to maintain performance
449
+ 4. **Entity Access**: Use metadata to check entity permissions before operations
450
+ 5. **Error Handling**: Implement proper error handling for all async operations
156
451
 
157
- ## Integration
452
+ ## Troubleshooting
158
453
 
159
- This package integrates with many other MemberJunction packages including:
454
+ ### Common Issues
160
455
 
161
- - Auth services for authentication
162
- - Container directives for layout management
163
- - Entity permissions for access control
164
- - File storage for document management
165
- - Record changes for audit trail
166
- - User view grid for data display
167
- - Skip Chat for AI integration
456
+ 1. **Resource not loading**: Ensure the resource type is properly registered
457
+ 2. **Navigation errors**: Check route configuration and guards
458
+ 3. **Missing icons**: Verify Font Awesome is properly loaded
459
+ 4. **Performance issues**: Review tab count and resource loading strategies
168
460
 
169
- ## Dependencies
461
+ ## License
170
462
 
171
- - @angular/common
172
- - @angular/core
173
- - @angular/forms
174
- - @angular/router
175
- - @memberjunction/global
176
- - @memberjunction/core
177
- - @memberjunction/core-entities
178
- - Various MemberJunction UI component packages
179
- - Kendo UI Angular components
463
+ ISC License - see LICENSE file for details
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-explorer-core",
3
- "version": "2.42.1",
3
+ "version": "2.44.0",
4
4
  "description": "MemberJunction Explorer: Core Angular Components",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -26,30 +26,30 @@
26
26
  "@angular/router": "18.0.2"
27
27
  },
28
28
  "dependencies": {
29
- "@memberjunction/global": "2.42.1",
30
- "@memberjunction/core": "2.42.1",
31
- "@memberjunction/core-entities": "2.42.1",
32
- "@memberjunction/entity-communications-client": "2.42.1",
33
- "@memberjunction/communication-types": "2.42.1",
34
- "@memberjunction/templates-base-types": "2.42.1",
35
- "@memberjunction/ng-compare-records": "2.42.1",
36
- "@memberjunction/ng-file-storage": "2.42.1",
37
- "@memberjunction/ng-record-changes": "2.42.1",
38
- "@memberjunction/ng-container-directives": "2.42.1",
39
- "@memberjunction/ng-user-view-grid": "2.42.1",
40
- "@memberjunction/ng-query-grid": "2.42.1",
41
- "@memberjunction/ng-user-view-properties": "2.42.1",
42
- "@memberjunction/ng-shared": "2.42.1",
43
- "@memberjunction/ng-tabstrip": "2.42.1",
44
- "@memberjunction/ng-skip-chat": "2.42.1",
45
- "@memberjunction/ng-ask-skip": "2.42.1",
46
- "@memberjunction/ng-auth-services": "2.42.1",
47
- "@memberjunction/ng-explorer-settings": "2.42.1",
48
- "@memberjunction/ng-base-forms": "2.42.1",
49
- "@memberjunction/ng-entity-form-dialog": "2.42.1",
50
- "@memberjunction/ng-record-selector": "2.42.1",
51
- "@memberjunction/ng-resource-permissions": "2.42.1",
52
- "@memberjunction/ng-dashboards": "2.42.1",
29
+ "@memberjunction/global": "2.44.0",
30
+ "@memberjunction/core": "2.44.0",
31
+ "@memberjunction/core-entities": "2.44.0",
32
+ "@memberjunction/entity-communications-client": "2.44.0",
33
+ "@memberjunction/communication-types": "2.44.0",
34
+ "@memberjunction/templates-base-types": "2.44.0",
35
+ "@memberjunction/ng-compare-records": "2.44.0",
36
+ "@memberjunction/ng-file-storage": "2.44.0",
37
+ "@memberjunction/ng-record-changes": "2.44.0",
38
+ "@memberjunction/ng-container-directives": "2.44.0",
39
+ "@memberjunction/ng-user-view-grid": "2.44.0",
40
+ "@memberjunction/ng-query-grid": "2.44.0",
41
+ "@memberjunction/ng-user-view-properties": "2.44.0",
42
+ "@memberjunction/ng-shared": "2.44.0",
43
+ "@memberjunction/ng-tabstrip": "2.44.0",
44
+ "@memberjunction/ng-skip-chat": "2.44.0",
45
+ "@memberjunction/ng-ask-skip": "2.44.0",
46
+ "@memberjunction/ng-auth-services": "2.44.0",
47
+ "@memberjunction/ng-explorer-settings": "2.44.0",
48
+ "@memberjunction/ng-base-forms": "2.44.0",
49
+ "@memberjunction/ng-entity-form-dialog": "2.44.0",
50
+ "@memberjunction/ng-record-selector": "2.44.0",
51
+ "@memberjunction/ng-resource-permissions": "2.44.0",
52
+ "@memberjunction/ng-dashboards": "2.44.0",
53
53
  "@progress/kendo-angular-grid": "16.2.0",
54
54
  "@progress/kendo-angular-buttons": "16.2.0",
55
55
  "@progress/kendo-angular-listview": "16.2.0",