@memberjunction/ng-data-context 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 +170 -44
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,14 +1,20 @@
1
- # Data Context Component
1
+ # @memberjunction/ng-data-context
2
2
 
3
- This Angular component package provides a way to display and interact with MemberJunction Data Contexts, which are collections of data items from different sources that can be used together.
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.
4
+
5
+ ## Overview
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.
4
8
 
5
9
  ## Features
6
10
 
7
- - **Display Data Context Details**: View information about a data context including ID, name, and description
8
- - **View Data Context Items**: See all items within a data context in a grid format
9
- - **Dialog Wrapper**: Includes a dialog component for easy integration into existing UIs
10
- - **Metadata Provider Integration**: Works with MemberJunction metadata providers
11
- - **Loading State Management**: Provides visual feedback during data loading
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
12
18
 
13
19
  ## Installation
14
20
 
@@ -50,41 +56,65 @@ export class YourModule { }
50
56
  <mj-data-context-dialog
51
57
  *ngIf="showDataContextDialog"
52
58
  [dataContextId]="selectedDataContextId"
59
+ [Provider]="metadataProvider"
53
60
  (dialogClosed)="showDataContextDialog = false">
54
61
  </mj-data-context-dialog>
55
62
  ```
56
63
 
57
- ### TypeScript Component Example
64
+ ### Complete TypeScript Example
58
65
 
59
66
  ```typescript
60
67
  import { Component } from '@angular/core';
61
- import { IMetadataProvider } from '@memberjunction/core';
68
+ import { IMetadataProvider, Metadata } from '@memberjunction/core';
62
69
 
63
70
  @Component({
64
71
  selector: 'app-data-context-viewer',
65
72
  template: `
66
- <button (click)="showDialog()">View Data Context</button>
67
-
68
- <mj-data-context-dialog
69
- *ngIf="isDialogVisible"
70
- [dataContextId]="currentDataContextId"
71
- [Provider]="metadataProvider"
72
- (dialogClosed)="isDialogVisible = false">
73
- </mj-data-context-dialog>
74
- `
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 -->
86
+ <mj-data-context-dialog
87
+ *ngIf="isDialogVisible"
88
+ [dataContextId]="selectedDataContextId"
89
+ [Provider]="metadataProvider"
90
+ (dialogClosed)="onDialogClose()">
91
+ </mj-data-context-dialog>
92
+ </div>
93
+ `,
94
+ styles: [`
95
+ .data-context-container {
96
+ padding: 20px;
97
+ }
98
+ `]
75
99
  })
76
100
  export class DataContextViewerComponent {
77
101
  isDialogVisible = false;
78
- currentDataContextId = '12345';
102
+ selectedDataContextId = '12345-67890-abcdef';
79
103
  metadataProvider: IMetadataProvider;
80
104
 
81
- constructor(metadataService: YourMetadataService) {
82
- this.metadataProvider = metadataService.getProvider();
105
+ constructor() {
106
+ // Use the global metadata provider or inject your own
107
+ this.metadataProvider = Metadata.Provider;
83
108
  }
84
109
 
85
- showDialog() {
110
+ showDialog(): void {
86
111
  this.isDialogVisible = true;
87
112
  }
113
+
114
+ onDialogClose(): void {
115
+ this.isDialogVisible = false;
116
+ // Additional cleanup or refresh logic here
117
+ }
88
118
  }
89
119
  ```
90
120
 
@@ -92,48 +122,144 @@ export class DataContextViewerComponent {
92
122
 
93
123
  ### DataContextComponent
94
124
 
95
- This is the main component for displaying a data context and its items.
125
+ The main component for displaying a data context and its items.
126
+
127
+ **Selector**: `mj-data-context`
96
128
 
97
129
  #### Inputs
98
130
 
99
- - `dataContextId`: string - The ID of the data context to display (required)
100
- - `Provider`: IMetadataProvider - Custom metadata provider (optional, will use global provider if not specified)
131
+ | Input | Type | Required | Default | Description |
132
+ |-------|------|----------|---------|-------------|
133
+ | `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 |
135
+
136
+ #### Properties
137
+
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 |
101
143
 
102
144
  ### DataContextDialogComponent
103
145
 
104
- This component wraps the DataContextComponent in a Kendo dialog window.
146
+ Dialog wrapper component that displays the DataContextComponent in a Kendo dialog.
147
+
148
+ **Selector**: `mj-data-context-dialog`
105
149
 
106
150
  #### Inputs
107
151
 
108
- - `dataContextId`: string - The ID of the data context to display (required)
109
- - `Provider`: IMetadataProvider - Custom metadata provider (optional)
152
+ | Input | Type | Required | Default | Description |
153
+ |-------|------|----------|---------|-------------|
154
+ | `dataContextId` | `string` | Yes | - | The ID of the data context to display |
155
+ | `Provider` | `IMetadataProvider \| null` | No | `null` | Custom metadata provider |
110
156
 
111
157
  #### Outputs
112
158
 
113
- - `dialogClosed`: EventEmitter<void> - Emitted when the dialog is closed
159
+ | Output | Type | Description |
160
+ |--------|------|-------------|
161
+ | `dialogClosed` | `EventEmitter<void>` | Emitted when the dialog is closed |
162
+
163
+ ### DataContextModule
164
+
165
+ The NgModule that exports both components.
166
+
167
+ **Exports**:
168
+ - `DataContextComponent`
169
+ - `DataContextDialogComponent`
114
170
 
115
171
  ## Data Context Structure
116
172
 
117
- A data context in MemberJunction typically consists of:
173
+ A data context in MemberJunction consists of:
174
+
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
118
188
 
119
- 1. **Context Record** - Contains metadata about the context (name, description, etc.)
120
- 2. **Context Items** - The actual data items that make up the context, which can be:
121
- - SQL queries
122
- - Views
123
- - Entity records
124
- - Query results
125
- - Other data items
189
+ ## Grid Features
126
190
 
127
- The component displays both the context metadata and a grid of the items contained within it.
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
128
197
 
129
198
  ## Styling
130
199
 
131
- The component uses Kendo UI components for consistent styling and includes basic CSS that can be overridden in your application.
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
+ }
207
+
208
+ .kendo-grid-container {
209
+ height: 500px; /* Adjust grid height */
210
+ }
211
+ ```
132
212
 
133
213
  ## Dependencies
134
214
 
135
- - `@memberjunction/core`: For metadata and entity access
136
- - `@memberjunction/core-entities`: For DataContextEntity type
137
- - `@memberjunction/global`: For global utilities
138
- - `@progress/kendo-angular-grid`: For displaying data context items
139
- - `@progress/kendo-angular-indicators`: For loading indicators
215
+ ### 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
+
231
+ This package integrates seamlessly with other MemberJunction packages:
232
+
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
237
+
238
+ ## Build and Development
239
+
240
+ To build this package individually:
241
+
242
+ ```bash
243
+ cd packages/Angular/Generic/data-context
244
+ npm run build
245
+ ```
246
+
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
+ ## License
264
+
265
+ ISC
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/ng-data-context",
3
- "version": "2.42.1",
3
+ "version": "2.44.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",
@@ -25,9 +25,9 @@
25
25
  "@progress/kendo-angular-indicators": "16.2.0"
26
26
  },
27
27
  "dependencies": {
28
- "@memberjunction/core": "2.42.1",
29
- "@memberjunction/core-entities": "2.42.1",
30
- "@memberjunction/global": "2.42.1",
28
+ "@memberjunction/core": "2.44.0",
29
+ "@memberjunction/core-entities": "2.44.0",
30
+ "@memberjunction/global": "2.44.0",
31
31
  "tslib": "^2.3.0"
32
32
  },
33
33
  "sideEffects": false