@memberjunction/ng-data-context 4.0.0 → 4.1.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 +78 -146
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -1,20 +1,34 @@
1
1
  # @memberjunction/ng-data-context
2
2
 
3
- Angular component package for displaying and editing MemberJunction Data Contexts - collections of data items from different sources that can be used together for analysis, reporting, or other data operations.
3
+ 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.
4
4
 
5
5
  ## Overview
6
6
 
7
- This package provides Angular components to display Data Contexts and their associated items in a clean, user-friendly interface. Data Contexts in MemberJunction are powerful constructs that allow users to group related data from various sources (SQL queries, views, entities, etc.) into a single logical unit.
7
+ 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.
8
8
 
9
- ## Features
9
+ ```mermaid
10
+ graph TD
11
+ A[DataContextModule] --> B[DataContextComponent]
12
+ A --> C[DataContextDialogComponent]
13
+
14
+ B --> D["Data Source Items"]
15
+ D --> D1["Entity Views"]
16
+ D --> D2["Stored Queries"]
17
+ D --> D3["Raw SQL"]
18
+ D --> D4["Entity Records"]
19
+
20
+ B --> E["Item Configuration"]
21
+ E --> E1["Filters"]
22
+ E --> E2["Preview"]
23
+ E --> E3["Virtual Scrolling"]
24
+
25
+ C --> B
10
26
 
11
- - **Display Data Context Details**: View comprehensive information about a data context including ID, name, and description
12
- - **View Data Context Items**: Display all items within a data context in a sortable, scrollable grid format
13
- - **Dialog Wrapper**: Ready-to-use dialog component for popup displays
14
- - **Metadata Provider Integration**: Seamlessly integrates with MemberJunction's metadata system
15
- - **Loading State Management**: Built-in loading indicators for better user experience
16
- - **Virtual Scrolling**: Efficiently handle large datasets with Kendo Grid's virtual scrolling
17
- - **Responsive Design**: Components adapt to different screen sizes
27
+ style A fill:#2d6a9f,stroke:#1a4971,color:#fff
28
+ style B fill:#7c5295,stroke:#563a6b,color:#fff
29
+ style C fill:#2d8659,stroke:#1a5c3a,color:#fff
30
+ style D fill:#b8762f,stroke:#8a5722,color:#fff
31
+ ```
18
32
 
19
33
  ## Installation
20
34
 
@@ -30,38 +44,31 @@ npm install @memberjunction/ng-data-context
30
44
  import { DataContextModule } from '@memberjunction/ng-data-context';
31
45
 
32
46
  @NgModule({
33
- imports: [
34
- DataContextModule,
35
- // other imports
36
- ],
37
- // ...
47
+ imports: [DataContextModule]
38
48
  })
39
49
  export class YourModule { }
40
50
  ```
41
51
 
42
- ### Basic Component Usage
52
+ ### Inline Component
43
53
 
44
54
  ```html
45
- <!-- Display a data context using its ID -->
46
55
  <mj-data-context
47
56
  [dataContextId]="'your-data-context-id'"
48
57
  [Provider]="customMetadataProvider">
49
58
  </mj-data-context>
50
59
  ```
51
60
 
52
- ### Dialog Component Usage
61
+ ### Dialog Component
53
62
 
54
63
  ```html
55
- <!-- Show data context in a dialog -->
56
64
  <mj-data-context-dialog
57
- *ngIf="showDataContextDialog"
58
65
  [dataContextId]="selectedDataContextId"
59
66
  [Provider]="metadataProvider"
60
- (dialogClosed)="showDataContextDialog = false">
67
+ (dialogClosed)="onDialogClosed()">
61
68
  </mj-data-context-dialog>
62
69
  ```
63
70
 
64
- ### Complete TypeScript Example
71
+ ### Complete Example
65
72
 
66
73
  ```typescript
67
74
  import { Component } from '@angular/core';
@@ -70,82 +77,57 @@ import { IMetadataProvider, Metadata } from '@memberjunction/core';
70
77
  @Component({
71
78
  selector: 'app-data-context-viewer',
72
79
  template: `
73
- <div class="data-context-container">
74
- <h2>Data Context Viewer</h2>
75
-
76
- <!-- Inline component usage -->
77
- <mj-data-context
78
- [dataContextId]="selectedDataContextId"
79
- [Provider]="metadataProvider">
80
- </mj-data-context>
81
-
82
- <!-- Dialog trigger button -->
83
- <button (click)="showDialog()">View in Dialog</button>
84
-
85
- <!-- Dialog component -->
80
+ <mj-data-context
81
+ [dataContextId]="selectedDataContextId"
82
+ [Provider]="metadataProvider">
83
+ </mj-data-context>
84
+
85
+ <button (click)="showDialog()">View in Dialog</button>
86
+
87
+ @if (isDialogVisible) {
86
88
  <mj-data-context-dialog
87
- *ngIf="isDialogVisible"
88
89
  [dataContextId]="selectedDataContextId"
89
90
  [Provider]="metadataProvider"
90
91
  (dialogClosed)="onDialogClose()">
91
92
  </mj-data-context-dialog>
92
- </div>
93
- `,
94
- styles: [`
95
- .data-context-container {
96
- padding: 20px;
97
93
  }
98
- `]
94
+ `
99
95
  })
100
96
  export class DataContextViewerComponent {
101
97
  isDialogVisible = false;
102
98
  selectedDataContextId = '12345-67890-abcdef';
103
99
  metadataProvider: IMetadataProvider;
104
-
100
+
105
101
  constructor() {
106
- // Use the global metadata provider or inject your own
107
102
  this.metadataProvider = Metadata.Provider;
108
103
  }
109
-
104
+
110
105
  showDialog(): void {
111
106
  this.isDialogVisible = true;
112
107
  }
113
-
108
+
114
109
  onDialogClose(): void {
115
110
  this.isDialogVisible = false;
116
- // Additional cleanup or refresh logic here
117
111
  }
118
112
  }
119
113
  ```
120
114
 
121
115
  ## API Reference
122
116
 
123
- ### DataContextComponent
124
-
125
- The main component for displaying a data context and its items.
117
+ ### DataContextComponent (`mj-data-context`)
126
118
 
127
- **Selector**: `mj-data-context`
119
+ Main component for displaying a data context and its items.
128
120
 
129
121
  #### Inputs
130
122
 
131
123
  | Input | Type | Required | Default | Description |
132
124
  |-------|------|----------|---------|-------------|
133
125
  | `dataContextId` | `string` | Yes | - | The ID of the data context to display |
134
- | `Provider` | `IMetadataProvider \| null` | No | `Metadata.Provider` | Custom metadata provider. If not provided, uses the global MemberJunction metadata provider |
126
+ | `Provider` | `IMetadataProvider \| null` | No | `Metadata.Provider` | Custom metadata provider |
135
127
 
136
- #### Properties
128
+ ### DataContextDialogComponent (`mj-data-context-dialog`)
137
129
 
138
- | Property | Type | Description |
139
- |----------|------|-------------|
140
- | `dataContextRecord` | `DataContextEntity \| undefined` | The loaded data context entity |
141
- | `dataContextItems` | `any[]` | Array of data context items |
142
- | `showLoader` | `boolean` | Loading state indicator |
143
-
144
- ### DataContextDialogComponent
145
-
146
- Dialog wrapper component that displays the DataContextComponent in a Kendo dialog.
147
-
148
- **Selector**: `mj-data-context-dialog`
130
+ Dialog wrapper displaying the DataContextComponent in a Kendo dialog.
149
131
 
150
132
  #### Inputs
151
133
 
@@ -160,106 +142,56 @@ Dialog wrapper component that displays the DataContextComponent in a Kendo dialo
160
142
  |--------|------|-------------|
161
143
  | `dialogClosed` | `EventEmitter<void>` | Emitted when the dialog is closed |
162
144
 
163
- ### DataContextModule
164
-
165
- The NgModule that exports both components.
166
-
167
- **Exports**:
168
- - `DataContextComponent`
169
- - `DataContextDialogComponent`
170
-
171
145
  ## Data Context Structure
172
146
 
173
147
  A data context in MemberJunction consists of:
174
148
 
175
- 1. **Context Record** (`DataContextEntity`)
176
- - `ID`: Unique identifier
177
- - `Name`: Display name
178
- - `Description`: Detailed description
179
- - Additional metadata fields
180
-
181
- 2. **Context Items** (`Data Context Items` entity)
182
- - `Type`: The type of data item (SQL, View, Query, Entity, Record)
183
- - `SQL`: Direct SQL query (if applicable)
184
- - `ViewID`: Reference to a view
185
- - `QueryID`: Reference to a saved query
186
- - `EntityID`: Reference to an entity
187
- - `RecordID`: Specific record reference
188
-
189
- ## Grid Features
190
-
191
- The component uses Kendo Grid with the following features enabled:
192
- - **Virtual Scrolling**: Efficiently handles large datasets
193
- - **Sorting**: Click column headers to sort
194
- - **Resizable Columns**: Drag column borders to resize
195
- - **Keyboard Navigation**: Navigate cells with keyboard
196
- - **Page Size**: Default 100 items per virtual page
197
-
198
- ## Styling
199
-
200
- The components use Kendo UI for Angular styling. You can override styles by targeting the component selectors:
201
-
202
- ```css
203
- /* Custom styling example */
204
- mj-data-context {
205
- /* Your custom styles */
206
- }
149
+ 1. **Context Record** (`DataContextEntity`) -- ID, Name, Description, and metadata
150
+ 2. **Context Items** (`Data Context Items` entity) with the following types:
151
+ - `SQL` -- Direct SQL query
152
+ - `View` -- Reference to a saved view
153
+ - `Query` -- Reference to a stored query
154
+ - `Entity` -- Reference to an entity
155
+ - `Record` -- Specific record reference
207
156
 
208
- .kendo-grid-container {
209
- height: 500px; /* Adjust grid height */
210
- }
211
- ```
157
+ ## Features
158
+
159
+ - **Multi-source composition**: Combine entity views, stored queries, raw SQL, and specific records into a single named context
160
+ - **Virtual scrolling**: Efficient handling of large datasets via Kendo Grid
161
+ - **Column sorting and resizing**: Interactive grid features
162
+ - **Metadata integration**: Uses MemberJunction's metadata system for entity loading
163
+ - **Loading state management**: Built-in loading indicators
164
+ - **Custom provider support**: Works with custom metadata providers for multi-tenant scenarios
165
+ - **Error handling**: Logs errors via MemberJunction's `LogError` function
212
166
 
213
167
  ## Dependencies
214
168
 
215
169
  ### Runtime Dependencies
216
- - `@memberjunction/core` (v2.43.0): Core MemberJunction functionality
217
- - `@memberjunction/core-entities` (v2.43.0): Entity type definitions
218
- - `@memberjunction/global` (v2.43.0): Global utilities
219
- - `tslib` (^2.3.0): TypeScript runtime helpers
220
-
221
- ### Peer Dependencies
222
- - `@angular/common` (18.0.2)
223
- - `@angular/core` (18.0.2)
224
- - `@progress/kendo-angular-grid` (16.2.0)
225
- - `@progress/kendo-angular-indicators` (16.2.0)
226
- - `@progress/kendo-angular-dialog` (imported via module)
227
- - `@progress/kendo-angular-buttons` (imported via module)
228
-
229
- ## Integration with MemberJunction
230
170
 
231
- This package integrates seamlessly with other MemberJunction packages:
171
+ | Package | Description |
172
+ |---------|-------------|
173
+ | `@memberjunction/core` | Core MemberJunction framework |
174
+ | `@memberjunction/core-entities` | Entity type definitions |
175
+ | `@memberjunction/global` | Global utilities |
176
+ | `@memberjunction/ng-container-directives` | Container directives |
177
+ | `@memberjunction/ng-shared` | Shared Angular utilities |
178
+ | `@progress/kendo-angular-grid` | Grid with virtual scrolling |
179
+ | `@progress/kendo-angular-indicators` | Loading indicators |
180
+ | `@progress/kendo-angular-dialog` | Dialog component |
181
+ | `@progress/kendo-angular-buttons` | Button components |
232
182
 
233
- - Uses the MemberJunction metadata system for entity loading
234
- - Leverages `RunView` for efficient data retrieval
235
- - Compatible with MemberJunction's security and permission system
236
- - Works with custom metadata providers for multi-tenant scenarios
183
+ ### Peer Dependencies
237
184
 
238
- ## Build and Development
185
+ - `@angular/common` ^21.x
186
+ - `@angular/core` ^21.x
239
187
 
240
- To build this package individually:
188
+ ## Build
241
189
 
242
190
  ```bash
243
191
  cd packages/Angular/Generic/data-context
244
192
  npm run build
245
193
  ```
246
194
 
247
- The package uses Angular CLI's `ngc` compiler for building the library.
248
-
249
- ## Error Handling
250
-
251
- The component includes built-in error handling:
252
- - Logs errors using MemberJunction's `LogError` function
253
- - Hides the loader on error
254
- - Gracefully handles missing or invalid data context IDs
255
-
256
- ## Best Practices
257
-
258
- 1. **Provider Usage**: Only provide a custom `Provider` if you need to override the global metadata provider
259
- 2. **Dialog Management**: Always handle the `dialogClosed` event to properly manage dialog state
260
- 3. **Performance**: The virtual scrolling is optimized for datasets up to several thousand items
261
- 4. **Error Handling**: Monitor console logs for any data loading errors
262
-
263
195
  ## License
264
196
 
265
- ISC
197
+ ISC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-data-context",
3
- "version": "4.0.0",
3
+ "version": "4.1.0",
4
4
  "description": "MemberJunction: Angular component and pop-up window to display and edit the contents of a data context.",
5
5
  "main": "./dist/public-api.js",
6
6
  "typings": "./dist/public-api.d.ts",
@@ -26,11 +26,11 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@angular/forms": "21.1.3",
29
- "@memberjunction/core": "4.0.0",
30
- "@memberjunction/core-entities": "4.0.0",
31
- "@memberjunction/global": "4.0.0",
32
- "@memberjunction/ng-container-directives": "4.0.0",
33
- "@memberjunction/ng-shared-generic": "4.0.0",
29
+ "@memberjunction/core": "4.1.0",
30
+ "@memberjunction/core-entities": "4.1.0",
31
+ "@memberjunction/global": "4.1.0",
32
+ "@memberjunction/ng-container-directives": "4.1.0",
33
+ "@memberjunction/ng-shared-generic": "4.1.0",
34
34
  "@progress/kendo-angular-buttons": "22.0.1",
35
35
  "@progress/kendo-angular-dialog": "22.0.1",
36
36
  "@progress/kendo-angular-inputs": "22.0.1",