2.48.0 • Published 5 months ago

@memberjunction/ng-explorer-core v2.48.0

Weekly downloads
-
License
ISC
Repository
-
Last release
5 months ago

@memberjunction/ng-explorer-core

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.

Overview

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.

Features

  • Dynamic Resource Container Architecture: Loads components at runtime based on resource type
  • Complete Navigation System: Drawer-based navigation with workspace and tab management
  • Entity Management: Browse, view, create, edit, and delete entity records
  • Dashboard System: Create, edit, and view interactive dashboards
  • Report Integration: Display and manage reports
  • Query Support: Execute and display query results
  • Search Integration: Unified search results display
  • User Views: Support for custom user-defined views
  • Authentication: Built-in authentication components and guards
  • Responsive Design: Mobile-friendly UI that adapts to different screen sizes
  • Workspace Management: Persistent workspace with saved tabs and state
  • Event-Driven Architecture: Comprehensive event system for component communication

Installation

npm install @memberjunction/ng-explorer-core

Requirements

  • Angular 18.0.2 or higher
  • MemberJunction core libraries:
    • @memberjunction/core v2.43.0+
    • @memberjunction/core-entities v2.43.0+
    • @memberjunction/global v2.43.0+
  • Kendo UI for Angular v16.2.0+
  • TypeScript 4.9+

Basic Setup

Module Import

Import the ExplorerCoreModule in your application module:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ExplorerCoreModule } from '@memberjunction/ng-explorer-core';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    ExplorerCoreModule
  ],
  bootstrap: [AppComponent]
})
export class AppModule { }

Routing Configuration

The Explorer Core module includes its own routing configuration. You can integrate it with your application's routing:

import { Routes } from '@angular/router';
import { AuthGuardService } from '@memberjunction/ng-explorer-core';

const routes: Routes = [
  {
    path: '',
    canActivate: [AuthGuardService],
    loadChildren: () => import('@memberjunction/ng-explorer-core').then(m => m.ExplorerCoreModule)
  }
];

Core Components

Resource Container Component

The heart of the Explorer architecture, dynamically loading components based on resource type:

import { Component } from '@angular/core';
import { ResourceData } from '@memberjunction/core-entities';

@Component({
  template: `
    <mj-resource
      [Data]="resourceData"
      [isVisible]="isActive"
      (ResourceRecordSaved)="onResourceSaved($event)"
      (ContentLoadingStarted)="onLoadingStarted($event)"
      (ContentLoadingComplete)="onLoadingComplete($event)">
    </mj-resource>
  `
})
export class MyComponent {
  resourceData: ResourceData = {
    ID: 'unique-id',
    Name: 'My Resource',
    ResourceType: 'Records',
    ResourceRecordID: '123',
    Configuration: {
      Entity: 'Contacts'
    }
  };
  
  isActive = true;
  
  onResourceSaved(entity: BaseEntity) {
    console.log('Resource saved:', entity);
  }
  
  onLoadingStarted(container: ResourceContainerComponent) {
    console.log('Loading started');
  }
  
  onLoadingComplete(container: ResourceContainerComponent) {
    console.log('Loading complete');
  }
}

Navigation Component

Provides the main application navigation with workspace and tab management:

@Component({
  template: `
    <mj-navigation 
      [applicationName]="'My Application'">
    </mj-navigation>
  `
})
export class AppComponent { }

Home Component

Displays navigation items configured to show on the home screen:

@Component({
  template: `<mj-home></mj-home>`
})
export class HomePageComponent { }

Entity Management Components

Entity Browser

@Component({
  template: `
    <mj-single-entity 
      [entityName]="'Contacts'"
      [viewID]="viewId">
    </mj-single-entity>
  `
})
export class EntityBrowserComponent {
  viewId?: string; // Optional view ID
}

Record Editor

@Component({
  template: `
    <mj-single-record 
      [entityName]="'Contacts'"
      [PrimaryKey]="recordKey"
      [newRecordValues]="defaultValues"
      (recordSaved)="onRecordSaved($event)"
      (loadComplete)="onLoadComplete()">
    </mj-single-record>
  `
})
export class RecordEditorComponent {
  recordKey = new CompositeKey([{ FieldName: 'ID', Value: '123' }]);
  defaultValues = { CompanyID: 1 }; // For new records
  
  onRecordSaved(entity: BaseEntity) {
    console.log('Record saved:', entity);
  }
  
  onLoadComplete() {
    console.log('Record loaded');
  }
}

Dashboard Components

@Component({
  template: `
    <mj-single-dashboard 
      [dashboardId]="dashboardId"
      [editMode]="false">
    </mj-single-dashboard>
  `
})
export class DashboardViewerComponent {
  dashboardId = '456';
}

Form Toolbar

Provides consistent form actions across the application:

@Component({
  template: `
    <mj-form-toolbar
      [record]="entity"
      [EditMode]="true"
      (SaveRecord)="save()"
      (DeleteRecord)="delete()"
      (CancelEdit)="cancel()">
    </mj-form-toolbar>
  `
})
export class FormComponent {
  entity: BaseEntity;
  
  save() { /* Save logic */ }
  delete() { /* Delete logic */ }
  cancel() { /* Cancel logic */ }
}

Resource Types and Wrappers

The Explorer supports multiple resource types through specialized wrapper components:

Creating Custom Resource Types

import { Component } from '@angular/core';
import { RegisterClass } from '@memberjunction/global';
import { BaseResourceComponent } from '@memberjunction/ng-shared';

@RegisterClass(BaseResourceComponent, 'CustomResource')
@Component({
  selector: 'mj-custom-resource',
  template: `
    <div class="custom-resource">
      <h2>{{ Data.Name }}</h2>
      <!-- Custom resource implementation -->
    </div>
  `
})
export class CustomResource extends BaseResourceComponent {
  async GetResourceDisplayName(data: ResourceData): Promise<string> {
    return `Custom: ${data.Name}`;
  }
  
  async GetResourceIconClass(data: ResourceData): Promise<string> {
    return 'fa-solid fa-star';
  }
}

Built-in Resource Types

  • Records: Entity record viewing and editing
  • Reports: Report display and execution
  • Dashboards: Interactive dashboard display
  • Queries: Query execution and results
  • UserViews: Custom user-defined views
  • SearchResults: Unified search results
  • ListDetail: Master-detail layouts

Event System

The Explorer uses a comprehensive event system for component communication:

import { MJGlobal, MJEventType } from '@memberjunction/global';
import { EventCodes } from '@memberjunction/ng-shared';

// Subscribe to events
const subscription = MJGlobal.Instance.GetEventListener(false)
  .subscribe((event) => {
    if (event.eventCode === EventCodes.ComponentEvent) {
      console.log('Component event:', event.args);
    }
  });

// Emit events
MJGlobal.Instance.RaiseEvent({
  eventCode: EventCodes.ComponentEvent,
  eventType: MJEventType.ComponentEvent,
  sourceComponent: this,
  args: { action: 'save', entityName: 'Contacts' }
});

Authentication and Guards

Auth Guard Service

import { Routes } from '@angular/router';
import { AuthGuardService } from '@memberjunction/ng-explorer-core';

const routes: Routes = [
  {
    path: 'secure',
    canActivate: [AuthGuardService],
    component: SecureComponent
  }
];

Entities Guard

import { EntitiesGuard } from '@memberjunction/ng-explorer-core';

const routes: Routes = [
  {
    path: 'entities/:entityName',
    canActivate: [EntitiesGuard],
    component: EntityComponent
  }
];

Advanced Features

Workspace Management

The Explorer automatically manages workspace state, including:

  • Open tabs and their state
  • Navigation history
  • User preferences
  • Resource configurations

Tab Management

// Access tab management through the navigation component
@ViewChild(NavigationComponent) navigation: NavigationComponent;

// Open a new tab
this.navigation.openTab({
  label: 'New Contact',
  icon: 'fa-user',
  data: {
    resourceType: 'Records',
    entityName: 'Contacts',
    recordId: 'new'
  }
});

Custom Expansion Panels

@Component({
  template: `
    <mj-expansion-panel
      [title]="'Advanced Options'"
      [expanded]="false"
      (expandedChange)="onExpandedChange($event)">
      <!-- Panel content -->
    </mj-expansion-panel>
  `
})
export class MyPanelComponent { }

Build Scripts

{
  "scripts": {
    "build": "ngc",
    "watch": "ngc -w",
    "test": "echo \"Error: no test specified\" && exit 1"
  }
}

Development

Building the Package

# Build the package
npm run build

# Watch mode for development
npm run watch

Package Structure

explorer-core/
├── src/
│   ├── lib/
│   │   ├── auth-button/
│   │   ├── dashboard-browser-component/
│   │   ├── generic/
│   │   ├── guards/
│   │   ├── header/
│   │   ├── home-component/
│   │   ├── navigation/
│   │   ├── resource-wrappers/
│   │   ├── single-dashboard/
│   │   ├── single-entity/
│   │   ├── single-record/
│   │   └── ...
│   ├── generic/
│   ├── shared/
│   ├── module.ts
│   └── public-api.ts
├── package.json
└── tsconfig.json

Integration with Other MJ Packages

The Explorer Core integrates seamlessly with:

  • @memberjunction/ng-auth-services: Authentication and authorization
  • @memberjunction/ng-container-directives: Layout management
  • @memberjunction/ng-entity-permissions: Entity-level permissions
  • @memberjunction/ng-file-storage: File upload and management
  • @memberjunction/ng-record-changes: Audit trail functionality
  • @memberjunction/ng-user-view-grid: Data grid components
  • @memberjunction/ng-skip-chat: AI chat integration
  • @memberjunction/ng-dashboards: Dashboard creation and management
  • @memberjunction/ng-resource-permissions: Resource-level permissions

Best Practices

  1. Resource Loading: Always check isVisible before loading heavy resources
  2. Event Handling: Unsubscribe from events in ngOnDestroy
  3. Tab Management: Limit concurrent tabs to maintain performance
  4. Entity Access: Use metadata to check entity permissions before operations
  5. Error Handling: Implement proper error handling for all async operations

Troubleshooting

Common Issues

  1. Resource not loading: Ensure the resource type is properly registered
  2. Navigation errors: Check route configuration and guards
  3. Missing icons: Verify Font Awesome is properly loaded
  4. Performance issues: Review tab count and resource loading strategies

License

ISC License - see LICENSE file for details

2.23.2

9 months ago

2.46.0

5 months ago

2.23.1

9 months ago

2.34.0

6 months ago

2.19.4

9 months ago

2.19.5

9 months ago

2.19.2

9 months ago

2.19.3

9 months ago

2.19.0

9 months ago

2.19.1

9 months ago

2.34.2

6 months ago

2.34.1

6 months ago

2.45.0

5 months ago

2.22.1

9 months ago

2.22.0

9 months ago

2.22.2

9 months ago

2.33.0

6 months ago

2.18.3

9 months ago

2.18.1

9 months ago

2.18.2

9 months ago

2.18.0

9 months ago

2.21.0

9 months ago

2.44.0

5 months ago

2.29.0

8 months ago

2.29.2

8 months ago

2.29.1

8 months ago

2.32.0

7 months ago

2.32.2

7 months ago

2.32.1

7 months ago

2.17.0

9 months ago

2.43.0

5 months ago

2.20.2

9 months ago

2.20.3

9 months ago

2.20.0

9 months ago

2.20.1

9 months ago

2.28.0

8 months ago

2.31.0

7 months ago

2.39.0

5 months ago

2.16.1

9 months ago

2.16.0

9 months ago

2.42.1

5 months ago

2.42.0

5 months ago

2.27.1

8 months ago

2.27.0

8 months ago

2.30.0

7 months ago

2.15.2

9 months ago

2.15.1

9 months ago

2.38.0

5 months ago

2.41.0

5 months ago

2.26.1

8 months ago

2.26.0

8 months ago

2.37.1

6 months ago

2.37.0

6 months ago

2.14.0

10 months ago

2.40.0

5 months ago

2.25.0

8 months ago

2.48.0

5 months ago

2.13.4

10 months ago

2.36.0

6 months ago

2.13.2

11 months ago

2.13.3

10 months ago

2.13.0

11 months ago

2.36.1

6 months ago

2.13.1

11 months ago

2.47.0

5 months ago

2.24.1

8 months ago

2.24.0

8 months ago

2.12.0

12 months ago

2.35.1

6 months ago

2.35.0

6 months ago

2.23.0

9 months ago

2.11.0

12 months ago

2.10.0

1 year ago

2.9.0

1 year ago

2.8.0

1 year ago

2.7.0

1 year ago

2.7.1

1 year ago

2.6.1

1 year ago

2.6.0

1 year ago

2.5.2

1 year ago

1.6.1

1 year ago

1.6.0

1 year ago

2.4.1

1 year ago

2.4.0

1 year ago

1.5.3

1 year ago

1.5.2

1 year ago

1.5.1

1 year ago

1.5.0

1 year ago

2.3.0

1 year ago

2.3.2

1 year ago

2.3.1

1 year ago

2.3.3

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

2.2.1

1 year ago

2.2.0

1 year ago

1.3.3

1 year ago

1.3.2

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

2.1.2

1 year ago

2.1.1

1 year ago

2.1.4

1 year ago

2.1.3

1 year ago

2.1.5

1 year ago

2.0.0

1 year ago

1.8.1

1 year ago

1.8.0

1 year ago

1.7.1

1 year ago

1.7.0

1 year ago

2.5.0

1 year ago

2.5.1

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.7-next.0

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.8-next.6

2 years ago

1.0.8-next.5

2 years ago

1.0.8-next.4

2 years ago

1.0.8-next.3

2 years ago

1.0.8-next.2

2 years ago

1.0.8-next.1

2 years ago

1.0.8-next.0

2 years ago

1.0.8-beta.0

2 years ago

1.0.6

2 years ago

1.0.4

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.9.236

2 years ago

0.9.235

2 years ago

0.9.231

2 years ago

0.9.230

2 years ago

0.9.233

2 years ago

0.9.232

2 years ago

0.9.227

2 years ago

0.9.234

2 years ago

0.9.222

2 years ago

0.9.224

2 years ago

0.9.223

2 years ago

0.9.226

2 years ago

0.9.225

2 years ago

0.9.221

2 years ago

0.9.220

2 years ago

0.9.217

2 years ago

0.9.216

2 years ago

0.9.219

2 years ago

0.9.218

2 years ago

0.9.215

2 years ago

0.9.214

2 years ago

0.9.211

2 years ago

0.9.210

2 years ago

0.9.209

2 years ago

0.9.208

2 years ago

0.9.206

2 years ago

0.9.205

2 years ago

0.9.207

2 years ago

0.9.202

2 years ago

0.9.203

2 years ago

0.9.204

2 years ago

0.9.200

2 years ago

0.9.199

2 years ago

0.9.198

2 years ago

0.9.197

2 years ago

0.9.196

2 years ago

0.9.195

2 years ago

0.9.194

2 years ago

0.9.193

2 years ago

0.9.192

2 years ago

0.9.189

2 years ago

0.9.190

2 years ago

0.9.191

2 years ago

0.9.188

2 years ago

0.9.187

2 years ago

0.9.186

2 years ago

0.9.183

2 years ago

0.9.182

2 years ago

0.9.185

2 years ago

0.9.184

2 years ago

0.9.176

2 years ago

0.9.175

2 years ago

0.9.178

2 years ago

0.9.177

2 years ago

0.9.172

2 years ago

0.9.171

2 years ago

0.9.174

2 years ago

0.9.173

2 years ago

0.9.170

2 years ago

0.9.181

2 years ago

0.9.180

2 years ago

0.9.179

2 years ago

0.9.167

2 years ago

0.9.166

2 years ago

0.9.169

2 years ago

0.9.165

2 years ago

0.9.154

2 years ago

0.9.153

2 years ago

0.9.156

2 years ago

0.9.155

2 years ago

0.9.150

2 years ago

0.9.152

2 years ago

0.9.151

2 years ago

0.9.147

2 years ago

0.9.146

2 years ago

0.9.149

2 years ago

0.9.148

2 years ago

0.9.164

2 years ago

0.9.161

2 years ago

0.9.160

2 years ago

0.9.163

2 years ago

0.9.162

2 years ago

0.9.158

2 years ago

0.9.157

2 years ago

0.9.159

2 years ago

0.9.143

2 years ago

0.9.142

2 years ago

0.9.145

2 years ago

0.9.144

2 years ago

0.9.141

2 years ago

0.9.140

2 years ago

0.9.136

2 years ago

0.9.135

2 years ago

0.9.138

2 years ago

0.9.137

2 years ago

0.9.134

2 years ago

0.9.131

2 years ago

0.9.130

2 years ago

0.9.129

2 years ago

0.9.121

2 years ago

0.9.123

2 years ago

0.9.122

2 years ago

0.9.125

2 years ago

0.9.124

2 years ago

0.9.127

2 years ago

0.9.126

2 years ago

0.9.120

2 years ago

0.9.118

2 years ago

0.9.119

2 years ago

0.9.117

2 years ago

0.9.116

2 years ago

0.9.96

2 years ago

0.9.79

2 years ago

0.9.78

2 years ago

0.9.75

2 years ago

0.9.77

2 years ago

0.9.58

2 years ago

0.9.59

2 years ago

0.9.63

2 years ago

0.9.64

2 years ago

0.9.65

2 years ago

0.9.66

2 years ago

0.9.60

2 years ago

0.9.62

2 years ago

0.9.56

2 years ago

0.9.57

2 years ago

0.9.52

2 years ago

0.9.53

2 years ago

0.9.54

2 years ago

0.9.55

2 years ago

0.9.50

2 years ago

0.9.51

2 years ago

0.9.45

2 years ago

0.9.46

2 years ago

0.9.47

2 years ago

0.9.48

2 years ago

0.9.43

2 years ago

0.9.44

2 years ago

0.9.49

2 years ago

0.9.39

2 years ago

0.9.37

2 years ago

0.9.38

2 years ago

0.9.34

2 years ago

0.9.35

2 years ago

0.9.36

2 years ago

0.9.30

2 years ago

0.9.31

2 years ago

0.9.32

2 years ago

0.9.33

2 years ago

0.9.29

2 years ago

0.9.27

2 years ago

0.9.28

2 years ago

0.9.23

2 years ago

0.9.24

2 years ago

0.9.25

2 years ago

0.9.26

2 years ago

0.9.22

2 years ago

0.9.21

2 years ago

0.9.20

2 years ago

0.9.18

2 years ago

0.9.19

2 years ago

0.9.16

2 years ago

0.9.17

2 years ago

0.9.15

2 years ago

0.9.14

2 years ago

0.9.13

2 years ago

0.9.12

2 years ago

0.9.11

2 years ago

0.9.10

2 years ago

0.9.9

2 years ago

0.9.8

2 years ago

0.9.7

2 years ago

0.9.6

2 years ago

0.9.5

2 years ago

0.9.4

2 years ago

0.9.3

2 years ago

0.9.2

2 years ago