@memberjunction/ng-entity-viewer 2.133.0 → 3.0.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.
- package/dist/lib/entity-cards/entity-cards.component.js +2 -2
- package/dist/lib/entity-cards/entity-cards.component.js.map +1 -1
- package/dist/lib/entity-data-grid/entity-data-grid.component.d.ts +2 -1
- package/dist/lib/entity-data-grid/entity-data-grid.component.d.ts.map +1 -1
- package/dist/lib/entity-data-grid/entity-data-grid.component.js +14 -11
- package/dist/lib/entity-data-grid/entity-data-grid.component.js.map +1 -1
- package/dist/lib/entity-grid/entity-grid.component.d.ts +216 -0
- package/dist/lib/entity-grid/entity-grid.component.d.ts.map +1 -0
- package/dist/lib/entity-grid/entity-grid.component.js +676 -0
- package/dist/lib/entity-grid/entity-grid.component.js.map +1 -0
- package/dist/lib/entity-record-detail-panel/entity-record-detail-panel.component.js +2 -2
- package/dist/lib/entity-record-detail-panel/entity-record-detail-panel.component.js.map +1 -1
- package/dist/lib/entity-viewer/entity-viewer.component.d.ts +45 -1
- package/dist/lib/entity-viewer/entity-viewer.component.d.ts.map +1 -1
- package/dist/lib/entity-viewer/entity-viewer.component.js +71 -7
- package/dist/lib/entity-viewer/entity-viewer.component.js.map +1 -1
- package/dist/lib/pagination/pagination.component.js +2 -2
- package/dist/lib/pagination/pagination.component.js.map +1 -1
- package/dist/lib/pill/pill.component.js +2 -2
- package/dist/lib/pill/pill.component.js.map +1 -1
- package/dist/lib/view-config-panel/view-config-panel.component.js +2 -2
- package/dist/lib/view-config-panel/view-config-panel.component.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/package.json +15 -15
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { EventEmitter, OnChanges, OnInit, SimpleChanges } from '@angular/core';
|
|
2
|
+
import { EntityInfo } from '@memberjunction/core';
|
|
3
|
+
import { BaseEntity } from '@memberjunction/core';
|
|
4
|
+
import { ColDef, GridReadyEvent, RowClickedEvent, RowDoubleClickedEvent, RowSelectionOptions, GetRowIdParams, SortChangedEvent as AgSortChangedEvent, ColumnResizedEvent, ColumnMovedEvent } from 'ag-grid-community';
|
|
5
|
+
import { GridColumnDef, RecordSelectedEvent, RecordOpenedEvent, SortState, SortChangedEvent, ViewGridStateConfig, GridStateChangedEvent } from '../types';
|
|
6
|
+
import * as i0 from "@angular/core";
|
|
7
|
+
/**
|
|
8
|
+
* EntityGridComponent - AG Grid based table view for entity records
|
|
9
|
+
*
|
|
10
|
+
* This component provides a lightweight, customizable grid view for displaying
|
|
11
|
+
* entity records. It uses AG Grid Community edition for high-performance rendering.
|
|
12
|
+
*
|
|
13
|
+
* Supports two modes:
|
|
14
|
+
* 1. Parent-managed data: Records are passed in via [records] input
|
|
15
|
+
* 2. Standalone: Component loads its own data with pagination
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```html
|
|
19
|
+
* <mj-entity-grid
|
|
20
|
+
* [entity]="selectedEntity"
|
|
21
|
+
* [records]="filteredRecords"
|
|
22
|
+
* [selectedRecordId]="selectedId"
|
|
23
|
+
* [sortState]="currentSort"
|
|
24
|
+
* [serverSideSorting]="true"
|
|
25
|
+
* (recordSelected)="onRecordSelected($event)"
|
|
26
|
+
* (recordOpened)="onRecordOpened($event)"
|
|
27
|
+
* (sortChanged)="onSortChanged($event)">
|
|
28
|
+
* </mj-entity-grid>
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export declare class EntityGridComponent implements OnInit, OnChanges {
|
|
32
|
+
/**
|
|
33
|
+
* The entity metadata for the records being displayed
|
|
34
|
+
*/
|
|
35
|
+
entity: EntityInfo | null;
|
|
36
|
+
/**
|
|
37
|
+
* The records to display in the grid (optional - component can load its own)
|
|
38
|
+
*/
|
|
39
|
+
records: BaseEntity[] | null;
|
|
40
|
+
/**
|
|
41
|
+
* The currently selected record's primary key string
|
|
42
|
+
*/
|
|
43
|
+
selectedRecordId: string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Custom column definitions (optional - auto-generated if not provided)
|
|
46
|
+
*/
|
|
47
|
+
columns: GridColumnDef[];
|
|
48
|
+
/**
|
|
49
|
+
* Height of the grid (CSS value)
|
|
50
|
+
* @default '100%'
|
|
51
|
+
*/
|
|
52
|
+
height: string;
|
|
53
|
+
/**
|
|
54
|
+
* Whether to enable row selection
|
|
55
|
+
* @default true
|
|
56
|
+
*/
|
|
57
|
+
enableSelection: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Filter text for highlighting matches in cells
|
|
60
|
+
* Supports SQL-style % wildcards
|
|
61
|
+
*/
|
|
62
|
+
filterText: string;
|
|
63
|
+
/**
|
|
64
|
+
* Current sort state (for external control)
|
|
65
|
+
*/
|
|
66
|
+
sortState: SortState | null;
|
|
67
|
+
/**
|
|
68
|
+
* Whether sorting is handled server-side
|
|
69
|
+
* When true, sort changes emit events but don't sort locally
|
|
70
|
+
* @default true
|
|
71
|
+
*/
|
|
72
|
+
serverSideSorting: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Page size for standalone data loading
|
|
75
|
+
* @default 100
|
|
76
|
+
*/
|
|
77
|
+
pageSize: number;
|
|
78
|
+
/**
|
|
79
|
+
* Grid state from a User View - controls columns, widths, order, sort
|
|
80
|
+
* When provided, this takes precedence over auto-generated columns
|
|
81
|
+
*/
|
|
82
|
+
gridState: ViewGridStateConfig | null;
|
|
83
|
+
/**
|
|
84
|
+
* Emitted when a record is selected (single click)
|
|
85
|
+
*/
|
|
86
|
+
recordSelected: EventEmitter<RecordSelectedEvent>;
|
|
87
|
+
/**
|
|
88
|
+
* Emitted when a record should be opened (double click)
|
|
89
|
+
*/
|
|
90
|
+
recordOpened: EventEmitter<RecordOpenedEvent>;
|
|
91
|
+
/**
|
|
92
|
+
* Emitted when sort state changes
|
|
93
|
+
*/
|
|
94
|
+
sortChanged: EventEmitter<SortChangedEvent>;
|
|
95
|
+
/**
|
|
96
|
+
* Emitted when grid state changes (column resize, reorder, etc.)
|
|
97
|
+
*/
|
|
98
|
+
gridStateChanged: EventEmitter<GridStateChangedEvent>;
|
|
99
|
+
/** AG Grid column definitions */
|
|
100
|
+
columnDefs: ColDef[];
|
|
101
|
+
/** AG Grid row data */
|
|
102
|
+
rowData: Record<string, unknown>[];
|
|
103
|
+
/** AG Grid API reference */
|
|
104
|
+
private gridApi;
|
|
105
|
+
/** Internal records when loading standalone */
|
|
106
|
+
private internalRecords;
|
|
107
|
+
/** Track if we're in standalone mode (no external records provided) */
|
|
108
|
+
private standaloneMode;
|
|
109
|
+
/** Loading state for standalone mode */
|
|
110
|
+
isLoading: boolean;
|
|
111
|
+
/** Suppress sort changed events during programmatic sort updates */
|
|
112
|
+
private suppressSortEvents;
|
|
113
|
+
/** Default column settings */
|
|
114
|
+
defaultColDef: ColDef;
|
|
115
|
+
/** AG Grid theme (v34+) */
|
|
116
|
+
theme: import("ag-grid-community").Theme<import("ag-grid-community").ThemeDefaultParams>;
|
|
117
|
+
/** Row selection configuration (v34+ object-based API) */
|
|
118
|
+
rowSelection: RowSelectionOptions;
|
|
119
|
+
/** Get row ID function for AG Grid */
|
|
120
|
+
getRowId: (params: GetRowIdParams<Record<string, unknown>>) => string;
|
|
121
|
+
ngOnInit(): void;
|
|
122
|
+
ngOnChanges(changes: SimpleChanges): void;
|
|
123
|
+
/**
|
|
124
|
+
* Get effective records (external or internal)
|
|
125
|
+
*/
|
|
126
|
+
private get effectiveRecords();
|
|
127
|
+
/**
|
|
128
|
+
* Load data in standalone mode
|
|
129
|
+
*/
|
|
130
|
+
private loadData;
|
|
131
|
+
/**
|
|
132
|
+
* Handle AG Grid ready event
|
|
133
|
+
*/
|
|
134
|
+
onGridReady(event: GridReadyEvent): void;
|
|
135
|
+
/**
|
|
136
|
+
* Handle AG Grid sort changed event
|
|
137
|
+
*/
|
|
138
|
+
onGridSortChanged(event: AgSortChangedEvent): void;
|
|
139
|
+
/**
|
|
140
|
+
* Handle column resized event
|
|
141
|
+
*/
|
|
142
|
+
onColumnResized(event: ColumnResizedEvent): void;
|
|
143
|
+
/**
|
|
144
|
+
* Handle column moved event
|
|
145
|
+
*/
|
|
146
|
+
onColumnMoved(event: ColumnMovedEvent): void;
|
|
147
|
+
/**
|
|
148
|
+
* Emit grid state changed event with current column/sort state
|
|
149
|
+
*/
|
|
150
|
+
private emitGridStateChanged;
|
|
151
|
+
/**
|
|
152
|
+
* Build current grid state from AG Grid's column state
|
|
153
|
+
*/
|
|
154
|
+
private buildCurrentGridState;
|
|
155
|
+
/**
|
|
156
|
+
* Apply external sort state to the grid
|
|
157
|
+
*/
|
|
158
|
+
private applySortStateToGrid;
|
|
159
|
+
/**
|
|
160
|
+
* Handle row click event
|
|
161
|
+
*/
|
|
162
|
+
onRowClicked(event: RowClickedEvent): void;
|
|
163
|
+
/**
|
|
164
|
+
* Handle row double-click event
|
|
165
|
+
*/
|
|
166
|
+
onRowDoubleClicked(event: RowDoubleClickedEvent): void;
|
|
167
|
+
/**
|
|
168
|
+
* Build AG Grid column definitions from gridState, custom columns, or entity metadata
|
|
169
|
+
* Priority: gridState > custom columns > auto-generated
|
|
170
|
+
*/
|
|
171
|
+
private buildColumnDefs;
|
|
172
|
+
/**
|
|
173
|
+
* Build column definitions from gridState column settings
|
|
174
|
+
*/
|
|
175
|
+
private buildColumnDefsFromGridState;
|
|
176
|
+
/**
|
|
177
|
+
* Map custom column definition to AG Grid ColDef
|
|
178
|
+
*/
|
|
179
|
+
private mapCustomColumnDef;
|
|
180
|
+
/**
|
|
181
|
+
* Auto-generate column definitions from entity metadata
|
|
182
|
+
*/
|
|
183
|
+
private generateColumnDefs;
|
|
184
|
+
/**
|
|
185
|
+
* Cell renderer that highlights matching text
|
|
186
|
+
* Uses HighlightUtil which only highlights if the text actually matches the pattern
|
|
187
|
+
*/
|
|
188
|
+
private highlightCellRenderer;
|
|
189
|
+
/**
|
|
190
|
+
* Determine if a field should be shown in the grid
|
|
191
|
+
*/
|
|
192
|
+
private shouldShowField;
|
|
193
|
+
/**
|
|
194
|
+
* Estimate appropriate column width based on field type
|
|
195
|
+
*/
|
|
196
|
+
private estimateColumnWidth;
|
|
197
|
+
/**
|
|
198
|
+
* Get value formatter for a field based on its type
|
|
199
|
+
*/
|
|
200
|
+
private getValueFormatter;
|
|
201
|
+
/**
|
|
202
|
+
* Build row data from entity records
|
|
203
|
+
*/
|
|
204
|
+
private buildRowData;
|
|
205
|
+
/**
|
|
206
|
+
* Update grid selection to match selectedRecordId and scroll to the selected row
|
|
207
|
+
*/
|
|
208
|
+
private updateSelection;
|
|
209
|
+
/**
|
|
210
|
+
* Find a record by its primary key string
|
|
211
|
+
*/
|
|
212
|
+
private findRecordByPk;
|
|
213
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<EntityGridComponent, never>;
|
|
214
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<EntityGridComponent, "mj-entity-grid", never, { "entity": { "alias": "entity"; "required": false; }; "records": { "alias": "records"; "required": false; }; "selectedRecordId": { "alias": "selectedRecordId"; "required": false; }; "columns": { "alias": "columns"; "required": false; }; "height": { "alias": "height"; "required": false; }; "enableSelection": { "alias": "enableSelection"; "required": false; }; "filterText": { "alias": "filterText"; "required": false; }; "sortState": { "alias": "sortState"; "required": false; }; "serverSideSorting": { "alias": "serverSideSorting"; "required": false; }; "pageSize": { "alias": "pageSize"; "required": false; }; "gridState": { "alias": "gridState"; "required": false; }; }, { "recordSelected": "recordSelected"; "recordOpened": "recordOpened"; "sortChanged": "sortChanged"; "gridStateChanged": "gridStateChanged"; }, never, never, false, never>;
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=entity-grid.component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entity-grid.component.d.ts","sourceRoot":"","sources":["../../../src/lib/entity-grid/entity-grid.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACzG,OAAO,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