Angular components for managing MemberJunction Data Contexts -- reusable collections of data sources (views, queries, raw SQL) that can be composed and referenced by reports, dashboards, and AI prompts.
The @memberjunction/ng-data-context package provides an interactive component for creating, editing, and previewing data contexts. A data context defines one or more data source items (entity views, stored queries, or raw SQL statements) along with optional filters, and packages them into a named, reusable unit. The package includes both an inline component and a dialog wrapper.
graph TD
A[DataContextModule] --> B[DataContextComponent]
A --> C[DataContextDialogComponent]
B --> D["Data Source Items"]
D --> D1["Entity Views"]
D --> D2["Stored Queries"]
D --> D3["Raw SQL"]
D --> D4["Entity Records"]
B --> E["Item Configuration"]
E --> E1["Filters"]
E --> E2["Preview"]
E --> E3["Virtual Scrolling"]
C --> B
style A fill:#2d6a9f,stroke:#1a4971,color:#fff
style B fill:#7c5295,stroke:#563a6b,color:#fff
style C fill:#2d8659,stroke:#1a5c3a,color:#fff
style D fill:#b8762f,stroke:#8a5722,color:#fff
npm install @memberjunction/ng-data-context
import { DataContextModule } from '@memberjunction/ng-data-context';
@NgModule({
imports: [DataContextModule]
})
export class YourModule { }
<mj-data-context
[dataContextId]="'your-data-context-id'"
[Provider]="customMetadataProvider">
</mj-data-context>
<mj-data-context-dialog
[dataContextId]="selectedDataContextId"
[Provider]="metadataProvider"
(dialogClosed)="onDialogClosed()">
</mj-data-context-dialog>
import { Component } from '@angular/core';
import { IMetadataProvider, Metadata } from '@memberjunction/core';
@Component({
selector: 'app-data-context-viewer',
template: `
<mj-data-context
[dataContextId]="selectedDataContextId"
[Provider]="metadataProvider">
</mj-data-context>
<button (click)="showDialog()">View in Dialog</button>
@if (isDialogVisible) {
<mj-data-context-dialog
[dataContextId]="selectedDataContextId"
[Provider]="metadataProvider"
(dialogClosed)="onDialogClose()">
</mj-data-context-dialog>
}
`
})
export class DataContextViewerComponent {
isDialogVisible = false;
selectedDataContextId = '12345-67890-abcdef';
metadataProvider: IMetadataProvider;
constructor() {
this.metadataProvider = Metadata.Provider;
}
showDialog(): void {
this.isDialogVisible = true;
}
onDialogClose(): void {
this.isDialogVisible = false;
}
}
mj-data-context)Main component for displaying a data context and its items.
| Input | Type | Required | Default | Description |
|---|---|---|---|---|
dataContextId |
string |
Yes | - | The ID of the data context to display |
Provider |
IMetadataProvider | null |
No | Metadata.Provider |
Custom metadata provider |
mj-data-context-dialog)Dialog wrapper displaying the DataContextComponent in a Kendo dialog.
| Input | Type | Required | Default | Description |
|---|---|---|---|---|
dataContextId |
string |
Yes | - | The ID of the data context to display |
Provider |
IMetadataProvider | null |
No | null |
Custom metadata provider |
| Output | Type | Description |
|---|---|---|
dialogClosed |
EventEmitter<void> |
Emitted when the dialog is closed |
A data context in MemberJunction consists of:
DataContextEntity) -- ID, Name, Description, and metadataData Context Items entity) with the following types:
SQL -- Direct SQL queryView -- Reference to a saved viewQuery -- Reference to a stored queryEntity -- Reference to an entityRecord -- Specific record referenceLogError function| Package | Description |
|---|---|
@memberjunction/core |
Core MemberJunction framework |
@memberjunction/core-entities |
Entity type definitions |
@memberjunction/global |
Global utilities |
@memberjunction/ng-container-directives |
Container directives |
@memberjunction/ng-shared |
Shared Angular utilities |
@progress/kendo-angular-grid |
Grid with virtual scrolling |
@progress/kendo-angular-indicators |
Loading indicators |
@progress/kendo-angular-dialog |
Dialog component |
@progress/kendo-angular-buttons |
Button components |
@angular/common ^21.x@angular/core ^21.xcd packages/Angular/Generic/data-context
npm run build
ISC