@memberjunction/ng-entity-viewer 2.132.0 → 2.133.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 (37) hide show
  1. package/README.md +317 -124
  2. package/dist/lib/entity-data-grid/entity-data-grid.component.d.ts +792 -0
  3. package/dist/lib/entity-data-grid/entity-data-grid.component.d.ts.map +1 -0
  4. package/dist/lib/entity-data-grid/entity-data-grid.component.js +3778 -0
  5. package/dist/lib/entity-data-grid/entity-data-grid.component.js.map +1 -0
  6. package/dist/lib/entity-data-grid/events/grid-events.d.ts +398 -0
  7. package/dist/lib/entity-data-grid/events/grid-events.d.ts.map +1 -0
  8. package/dist/lib/entity-data-grid/events/grid-events.js +556 -0
  9. package/dist/lib/entity-data-grid/events/grid-events.js.map +1 -0
  10. package/dist/lib/entity-data-grid/models/grid-types.d.ts +437 -0
  11. package/dist/lib/entity-data-grid/models/grid-types.d.ts.map +1 -0
  12. package/dist/lib/entity-data-grid/models/grid-types.js +37 -0
  13. package/dist/lib/entity-data-grid/models/grid-types.js.map +1 -0
  14. package/dist/lib/entity-viewer/entity-viewer.component.d.ts +92 -2
  15. package/dist/lib/entity-viewer/entity-viewer.component.d.ts.map +1 -1
  16. package/dist/lib/entity-viewer/entity-viewer.component.js +255 -92
  17. package/dist/lib/entity-viewer/entity-viewer.component.js.map +1 -1
  18. package/dist/lib/types.d.ts +14 -31
  19. package/dist/lib/types.d.ts.map +1 -1
  20. package/dist/lib/types.js.map +1 -1
  21. package/dist/lib/view-config-panel/view-config-panel.component.d.ts +363 -0
  22. package/dist/lib/view-config-panel/view-config-panel.component.d.ts.map +1 -0
  23. package/dist/lib/view-config-panel/view-config-panel.component.js +2006 -0
  24. package/dist/lib/view-config-panel/view-config-panel.component.js.map +1 -0
  25. package/dist/module.d.ts +16 -13
  26. package/dist/module.d.ts.map +1 -1
  27. package/dist/module.js +24 -14
  28. package/dist/module.js.map +1 -1
  29. package/dist/public-api.d.ts +4 -1
  30. package/dist/public-api.d.ts.map +1 -1
  31. package/dist/public-api.js +6 -1
  32. package/dist/public-api.js.map +1 -1
  33. package/package.json +10 -6
  34. package/dist/lib/entity-grid/entity-grid.component.d.ts +0 -216
  35. package/dist/lib/entity-grid/entity-grid.component.d.ts.map +0 -1
  36. package/dist/lib/entity-grid/entity-grid.component.js +0 -676
  37. package/dist/lib/entity-grid/entity-grid.component.js.map +0 -1
@@ -0,0 +1,792 @@
1
+ import { EventEmitter, OnInit, OnDestroy, ChangeDetectorRef, ElementRef } from '@angular/core';
2
+ import { BaseEntity, RunViewParams, EntityInfo } from '@memberjunction/core';
3
+ import { UserViewEntityExtended } from '@memberjunction/core-entities';
4
+ import { ColDef, GridReadyEvent, RowClickedEvent, RowDoubleClickedEvent, RowSelectionOptions, GetRowIdParams, SortChangedEvent as AgSortChangedEvent, ColumnResizedEvent, ColumnMovedEvent, SelectionChangedEvent, GridOptions } from 'ag-grid-community';
5
+ import { GridSelectionMode, GridEditMode, GridLinesMode, GridColumnConfig, GridToolbarConfig, GridToolbarButton, GridState, GridRowData, ColumnRuntimeState, ViewGridStateConfig, GridStateChangedEvent, EntityActionConfig, GridVisualConfig } from './models/grid-types';
6
+ import { BeforeRowSelectEventArgs, AfterRowSelectEventArgs, BeforeRowDeselectEventArgs, AfterRowDeselectEventArgs, BeforeRowClickEventArgs, AfterRowClickEventArgs, BeforeRowDoubleClickEventArgs, AfterRowDoubleClickEventArgs, BeforeCellEditEventArgs, AfterCellEditBeginEventArgs, BeforeCellEditCommitEventArgs, AfterCellEditCommitEventArgs, BeforeCellEditCancelEventArgs, AfterCellEditCancelEventArgs, BeforeRowSaveEventArgs, AfterRowSaveEventArgs, BeforeRowDeleteEventArgs, AfterRowDeleteEventArgs, BeforeDataLoadEventArgs, AfterDataLoadEventArgs, BeforeDataRefreshEventArgs, AfterDataRefreshEventArgs, BeforeSortEventArgs, AfterSortEventArgs, BeforeColumnReorderEventArgs, AfterColumnReorderEventArgs, BeforeColumnResizeEventArgs, AfterColumnResizeEventArgs, BeforeColumnVisibilityChangeEventArgs, AfterColumnVisibilityChangeEventArgs } from './events/grid-events';
7
+ import { ExportService, ExportDialogConfig, ExportDialogResult } from '@memberjunction/ng-export-service';
8
+ import { ExportOptions, ExportResult } from '@memberjunction/export-engine';
9
+ import * as i0 from "@angular/core";
10
+ /**
11
+ * A modern, flexible data grid component for displaying and managing entity data.
12
+ * Built on AG Grid Community edition with a rich Before/After cancelable event system.
13
+ *
14
+ * Features:
15
+ * - RunView-based data loading with automatic refresh
16
+ * - AG Grid for high-performance rendering
17
+ * - Rich event system with Before/After cancelable patterns
18
+ * - Column configuration with type-aware formatters
19
+ * - Row selection (single, multiple, checkbox modes)
20
+ * - Inline cell and row editing
21
+ * - Column reordering, resizing, and visibility toggle
22
+ * - State persistence to User Settings
23
+ * - Compatible with ViewGridStateConfig from User Views
24
+ *
25
+ * @example
26
+ * ```html
27
+ * <mj-entity-data-grid
28
+ * [entityName]="'Contacts'"
29
+ * [showToolbar]="true"
30
+ * [allowSorting]="true"
31
+ * [selectionMode]="'multiple'"
32
+ * (afterRowDoubleClick)="onRowDoubleClick($event)">
33
+ * </mj-entity-data-grid>
34
+ * ```
35
+ */
36
+ export declare class EntityDataGridComponent implements OnInit, OnDestroy {
37
+ private cdr;
38
+ private elementRef;
39
+ private exportService;
40
+ private _params;
41
+ /**
42
+ * RunViewParams for data loading - the primary way to specify data source.
43
+ * Supports stored views (ViewID, ViewName, ViewEntity) and dynamic views (EntityName + filters).
44
+ * Mutually exclusive with the legacy entityName/extraFilter inputs.
45
+ * When Params is provided, it takes precedence over legacy inputs.
46
+ */
47
+ set Params(value: RunViewParams | null);
48
+ get Params(): RunViewParams | null;
49
+ private _allowLoad;
50
+ /**
51
+ * Controls whether data loading is allowed.
52
+ * Set to false to defer loading until ready (useful for complex forms where params may change multiple times).
53
+ * When set to true and Params is provided, triggers a data load.
54
+ */
55
+ set AllowLoad(value: boolean);
56
+ get AllowLoad(): boolean;
57
+ private _autoRefreshOnParamsChange;
58
+ /**
59
+ * When true, automatically refreshes data when Params changes.
60
+ * When false, you must call Refresh() manually after changing Params.
61
+ */
62
+ set AutoRefreshOnParamsChange(value: boolean);
63
+ get AutoRefreshOnParamsChange(): boolean;
64
+ private _paginationMode;
65
+ /**
66
+ * Pagination mode for the grid:
67
+ * - 'client': All data loaded upfront (default, legacy behavior)
68
+ * - 'infinite': Server-side pagination with infinite scroll (recommended for large datasets)
69
+ */
70
+ set PaginationMode(value: 'client' | 'infinite');
71
+ get PaginationMode(): 'client' | 'infinite';
72
+ private _pageSize;
73
+ /**
74
+ * Number of rows to fetch per page when using infinite pagination mode.
75
+ * Default is 100 rows per page.
76
+ */
77
+ set PageSize(value: number);
78
+ get PageSize(): number;
79
+ private _cacheBlockSize;
80
+ /**
81
+ * Size of each cache block in infinite scroll mode.
82
+ * Should match or be a multiple of PageSize for optimal performance.
83
+ */
84
+ set CacheBlockSize(value: number);
85
+ get CacheBlockSize(): number;
86
+ private _maxBlocksInCache;
87
+ /**
88
+ * Maximum number of blocks to keep in cache.
89
+ * When exceeded, oldest blocks are purged.
90
+ */
91
+ set MaxBlocksInCache(value: number);
92
+ get MaxBlocksInCache(): number;
93
+ private _data;
94
+ /**
95
+ * Pre-loaded data (bypass RunView, use provided data).
96
+ * When provided, the grid displays this data instead of loading via RunView.
97
+ * Parent component is responsible for data loading and passing results here.
98
+ */
99
+ set Data(value: BaseEntity[]);
100
+ get Data(): BaseEntity[];
101
+ private _columns;
102
+ /**
103
+ * Column definitions - if not provided, auto-generates from entity metadata
104
+ */
105
+ set Columns(value: GridColumnConfig[]);
106
+ get Columns(): GridColumnConfig[];
107
+ private _gridState;
108
+ /**
109
+ * Grid state from a User View - controls columns, widths, order, sort
110
+ * When provided, this takes precedence over auto-generated columns
111
+ */
112
+ set GridState(value: ViewGridStateConfig | null);
113
+ get GridState(): ViewGridStateConfig | null;
114
+ private _allowColumnReorder;
115
+ set AllowColumnReorder(value: boolean);
116
+ get AllowColumnReorder(): boolean;
117
+ private _allowColumnResize;
118
+ set AllowColumnResize(value: boolean);
119
+ get AllowColumnResize(): boolean;
120
+ private _allowColumnToggle;
121
+ set AllowColumnToggle(value: boolean);
122
+ get AllowColumnToggle(): boolean;
123
+ private _showHeader;
124
+ set ShowHeader(value: boolean);
125
+ get ShowHeader(): boolean;
126
+ private _allowSorting;
127
+ set AllowSorting(value: boolean);
128
+ get AllowSorting(): boolean;
129
+ private _allowMultiSort;
130
+ set AllowMultiSort(value: boolean);
131
+ get AllowMultiSort(): boolean;
132
+ private _serverSideSorting;
133
+ /**
134
+ * Whether sorting is handled server-side
135
+ * When true, sort changes trigger a new data load
136
+ */
137
+ set ServerSideSorting(value: boolean);
138
+ get ServerSideSorting(): boolean;
139
+ private _allowColumnFilters;
140
+ set AllowColumnFilters(value: boolean);
141
+ get AllowColumnFilters(): boolean;
142
+ private _showSearch;
143
+ set ShowSearch(value: boolean);
144
+ get ShowSearch(): boolean;
145
+ private _selectionMode;
146
+ set SelectionMode(value: GridSelectionMode);
147
+ get SelectionMode(): GridSelectionMode;
148
+ private _selectedKeys;
149
+ set SelectedKeys(value: string[]);
150
+ get SelectedKeys(): string[];
151
+ private _keyField;
152
+ set KeyField(value: string);
153
+ get KeyField(): string;
154
+ private _editMode;
155
+ set EditMode(value: GridEditMode);
156
+ get EditMode(): GridEditMode;
157
+ private _allowAdd;
158
+ set AllowAdd(value: boolean);
159
+ get AllowAdd(): boolean;
160
+ private _allowDelete;
161
+ set AllowDelete(value: boolean);
162
+ get AllowDelete(): boolean;
163
+ private _height;
164
+ set Height(value: number | 'auto' | 'fit-content');
165
+ get Height(): number | 'auto' | 'fit-content';
166
+ private _rowHeight;
167
+ set RowHeight(value: number);
168
+ get RowHeight(): number;
169
+ private _virtualScroll;
170
+ set VirtualScroll(value: boolean);
171
+ get VirtualScroll(): boolean;
172
+ private _showRowNumbers;
173
+ set ShowRowNumbers(value: boolean);
174
+ get ShowRowNumbers(): boolean;
175
+ private _striped;
176
+ set Striped(value: boolean);
177
+ get Striped(): boolean;
178
+ private _gridLines;
179
+ set GridLines(value: GridLinesMode);
180
+ get GridLines(): GridLinesMode;
181
+ private _visualConfig;
182
+ /**
183
+ * Visual configuration for the grid appearance.
184
+ * Allows customization of header styles, row colors, cell formatting, and more.
185
+ * All properties are optional - unset properties use attractive defaults.
186
+ */
187
+ set VisualConfig(value: GridVisualConfig);
188
+ get VisualConfig(): GridVisualConfig;
189
+ /**
190
+ * Get the effective visual config (user config merged with defaults)
191
+ */
192
+ get effectiveVisualConfig(): Required<GridVisualConfig>;
193
+ private _showToolbar;
194
+ set ShowToolbar(value: boolean);
195
+ get ShowToolbar(): boolean;
196
+ private _toolbarConfig;
197
+ set ToolbarConfig(value: GridToolbarConfig);
198
+ get ToolbarConfig(): GridToolbarConfig;
199
+ private _stateKey;
200
+ set StateKey(value: string);
201
+ get StateKey(): string;
202
+ private _autoPersistState;
203
+ /**
204
+ * When true and using a stored view (ViewID/ViewName/ViewEntity in Params),
205
+ * automatically persists grid state changes (column widths, order, sort) to the UserView entity.
206
+ * Only saves if the user has edit permission on the view.
207
+ * For dynamic views, only emits the gridStateChanged event.
208
+ */
209
+ set AutoPersistState(value: boolean);
210
+ get AutoPersistState(): boolean;
211
+ private _statePersistDebounce;
212
+ /**
213
+ * Debounce time in milliseconds before persisting state changes to the server.
214
+ * Default is 5000ms (5 seconds) to avoid excessive server calls during rapid column adjustments.
215
+ */
216
+ set StatePersistDebounce(value: number);
217
+ get StatePersistDebounce(): number;
218
+ private _refreshDebounce;
219
+ set RefreshDebounce(value: number);
220
+ get RefreshDebounce(): number;
221
+ private _filterText;
222
+ /**
223
+ * Text to highlight in grid cells.
224
+ * Supports SQL-style % wildcards for pattern matching.
225
+ */
226
+ set FilterText(value: string);
227
+ get FilterText(): string;
228
+ private _showNewButton;
229
+ /**
230
+ * Show the "New" button in toolbar (creates new record)
231
+ */
232
+ set ShowNewButton(value: boolean);
233
+ get ShowNewButton(): boolean;
234
+ private _showRefreshButton;
235
+ /**
236
+ * Show the "Refresh" button in toolbar
237
+ */
238
+ set ShowRefreshButton(value: boolean);
239
+ get ShowRefreshButton(): boolean;
240
+ private _showExportButton;
241
+ /**
242
+ * Show the "Export to Excel" button in toolbar
243
+ */
244
+ set ShowExportButton(value: boolean);
245
+ get ShowExportButton(): boolean;
246
+ private _showDeleteButton;
247
+ /**
248
+ * Show the "Delete" button in toolbar (deletes selected rows)
249
+ */
250
+ set ShowDeleteButton(value: boolean);
251
+ get ShowDeleteButton(): boolean;
252
+ private _showCompareButton;
253
+ /**
254
+ * Show the "Compare" button in toolbar (compare selected records)
255
+ */
256
+ set ShowCompareButton(value: boolean);
257
+ get ShowCompareButton(): boolean;
258
+ private _showMergeButton;
259
+ /**
260
+ * Show the "Merge" button in toolbar (merge selected records)
261
+ */
262
+ set ShowMergeButton(value: boolean);
263
+ get ShowMergeButton(): boolean;
264
+ private _showAddToListButton;
265
+ /**
266
+ * Show the "Add to List" button in toolbar
267
+ */
268
+ set ShowAddToListButton(value: boolean);
269
+ get ShowAddToListButton(): boolean;
270
+ private _showDuplicateSearchButton;
271
+ /**
272
+ * Show the "Search for Duplicates" button in toolbar
273
+ */
274
+ set ShowDuplicateSearchButton(value: boolean);
275
+ get ShowDuplicateSearchButton(): boolean;
276
+ private _showCommunicationButton;
277
+ /**
278
+ * Show the "Send Message" button in toolbar (if entity supports communication)
279
+ */
280
+ set ShowCommunicationButton(value: boolean);
281
+ get ShowCommunicationButton(): boolean;
282
+ private _autoNavigate;
283
+ /**
284
+ * When true, clicking or double-clicking a row will emit a navigation request.
285
+ * The parent component can handle the navigationRequested event to open the record.
286
+ */
287
+ set AutoNavigate(value: boolean);
288
+ get AutoNavigate(): boolean;
289
+ private _navigateOnDoubleClick;
290
+ /**
291
+ * When true, navigation is triggered on double-click only.
292
+ * When false, navigation is triggered on single click.
293
+ * Only applies when AutoNavigate is true.
294
+ */
295
+ set NavigateOnDoubleClick(value: boolean);
296
+ get NavigateOnDoubleClick(): boolean;
297
+ private _createRecordMode;
298
+ /**
299
+ * How to open new records when the "New" button is clicked:
300
+ * - 'Tab': Emit event to open in a new tab (default)
301
+ * - 'Dialog': Emit event to open in a dialog
302
+ */
303
+ set CreateRecordMode(value: 'Dialog' | 'Tab');
304
+ get CreateRecordMode(): 'Dialog' | 'Tab';
305
+ private _newRecordValues;
306
+ /**
307
+ * Default values to set on new records.
308
+ * These values are passed with the newRecordDialogRequested event.
309
+ */
310
+ set NewRecordValues(value: Record<string, unknown>);
311
+ get NewRecordValues(): Record<string, unknown>;
312
+ private _showEntityActionButtons;
313
+ /**
314
+ * When true, displays entity action buttons in the toolbar overflow menu.
315
+ * Entity actions are loaded dynamically based on the current entity.
316
+ * The entityActionsLoaded event is emitted when actions are ready.
317
+ */
318
+ set ShowEntityActionButtons(value: boolean);
319
+ get ShowEntityActionButtons(): boolean;
320
+ private _entityActions;
321
+ /**
322
+ * Array of entity actions to display in the toolbar.
323
+ * Set this after receiving the entityActionsLoaded event.
324
+ */
325
+ set EntityActions(value: EntityActionConfig[]);
326
+ get EntityActions(): EntityActionConfig[];
327
+ BeforeRowSelect: EventEmitter<BeforeRowSelectEventArgs>;
328
+ AfterRowSelect: EventEmitter<AfterRowSelectEventArgs>;
329
+ BeforeRowDeselect: EventEmitter<BeforeRowDeselectEventArgs>;
330
+ AfterRowDeselect: EventEmitter<AfterRowDeselectEventArgs>;
331
+ SelectionChange: EventEmitter<string[]>;
332
+ BeforeRowClick: EventEmitter<BeforeRowClickEventArgs>;
333
+ AfterRowClick: EventEmitter<AfterRowClickEventArgs>;
334
+ BeforeRowDoubleClick: EventEmitter<BeforeRowDoubleClickEventArgs>;
335
+ AfterRowDoubleClick: EventEmitter<AfterRowDoubleClickEventArgs>;
336
+ BeforeCellEdit: EventEmitter<BeforeCellEditEventArgs>;
337
+ AfterCellEditBegin: EventEmitter<AfterCellEditBeginEventArgs>;
338
+ BeforeCellEditCommit: EventEmitter<BeforeCellEditCommitEventArgs>;
339
+ AfterCellEditCommit: EventEmitter<AfterCellEditCommitEventArgs>;
340
+ BeforeCellEditCancel: EventEmitter<BeforeCellEditCancelEventArgs>;
341
+ AfterCellEditCancel: EventEmitter<AfterCellEditCancelEventArgs>;
342
+ BeforeRowSave: EventEmitter<BeforeRowSaveEventArgs>;
343
+ AfterRowSave: EventEmitter<AfterRowSaveEventArgs>;
344
+ BeforeRowDelete: EventEmitter<BeforeRowDeleteEventArgs>;
345
+ AfterRowDelete: EventEmitter<AfterRowDeleteEventArgs>;
346
+ BeforeDataLoad: EventEmitter<BeforeDataLoadEventArgs>;
347
+ AfterDataLoad: EventEmitter<AfterDataLoadEventArgs>;
348
+ BeforeDataRefresh: EventEmitter<BeforeDataRefreshEventArgs>;
349
+ AfterDataRefresh: EventEmitter<AfterDataRefreshEventArgs>;
350
+ BeforeSort: EventEmitter<BeforeSortEventArgs>;
351
+ AfterSort: EventEmitter<AfterSortEventArgs>;
352
+ BeforeColumnReorder: EventEmitter<BeforeColumnReorderEventArgs>;
353
+ AfterColumnReorder: EventEmitter<AfterColumnReorderEventArgs>;
354
+ BeforeColumnResize: EventEmitter<BeforeColumnResizeEventArgs>;
355
+ AfterColumnResize: EventEmitter<AfterColumnResizeEventArgs>;
356
+ BeforeColumnVisibilityChange: EventEmitter<BeforeColumnVisibilityChangeEventArgs>;
357
+ AfterColumnVisibilityChange: EventEmitter<AfterColumnVisibilityChangeEventArgs>;
358
+ GridStateChanged: EventEmitter<GridStateChangedEvent>;
359
+ AddRequested: EventEmitter<void>;
360
+ DeleteRequested: EventEmitter<BaseEntity<unknown>[]>;
361
+ ExportRequested: EventEmitter<void>;
362
+ NewButtonClick: EventEmitter<void>;
363
+ RefreshButtonClick: EventEmitter<void>;
364
+ ExportButtonClick: EventEmitter<void>;
365
+ DeleteButtonClick: EventEmitter<BaseEntity<unknown>[]>;
366
+ CompareButtonClick: EventEmitter<BaseEntity<unknown>[]>;
367
+ MergeButtonClick: EventEmitter<BaseEntity<unknown>[]>;
368
+ AddToListButtonClick: EventEmitter<BaseEntity<unknown>[]>;
369
+ DuplicateSearchButtonClick: EventEmitter<BaseEntity<unknown>[]>;
370
+ CommunicationButtonClick: EventEmitter<BaseEntity<unknown>[]>;
371
+ /**
372
+ * Emitted when a row is clicked/double-clicked and AutoNavigate is enabled.
373
+ * Parent components should handle this to open the entity record.
374
+ */
375
+ NavigationRequested: EventEmitter<{
376
+ entityInfo: EntityInfo;
377
+ record: BaseEntity;
378
+ compositeKey: string;
379
+ }>;
380
+ /**
381
+ * Emitted when the "New" button is clicked and CreateRecordMode is 'Dialog'.
382
+ * Parent components should handle this to show a new record dialog.
383
+ */
384
+ NewRecordDialogRequested: EventEmitter<{
385
+ entityInfo: EntityInfo;
386
+ defaultValues: Record<string, unknown>;
387
+ }>;
388
+ /**
389
+ * Emitted when the "New" button is clicked and CreateRecordMode is 'Tab'.
390
+ * Parent components should handle this to open a new record in a tab.
391
+ */
392
+ NewRecordTabRequested: EventEmitter<{
393
+ entityInfo: EntityInfo;
394
+ defaultValues: Record<string, unknown>;
395
+ }>;
396
+ /**
397
+ * Emitted when Compare Records functionality is requested.
398
+ * Parent components should handle this to show the compare dialog.
399
+ */
400
+ CompareRecordsRequested: EventEmitter<{
401
+ entityInfo: EntityInfo;
402
+ records: BaseEntity[];
403
+ }>;
404
+ /**
405
+ * Emitted when Merge Records functionality is requested.
406
+ * Parent components should handle this to show the merge dialog.
407
+ */
408
+ MergeRecordsRequested: EventEmitter<{
409
+ entityInfo: EntityInfo;
410
+ records: BaseEntity[];
411
+ }>;
412
+ /**
413
+ * Emitted when Communication/Send Message functionality is requested.
414
+ * Parent components should handle this to show the communication dialog.
415
+ */
416
+ CommunicationRequested: EventEmitter<{
417
+ entityInfo: EntityInfo;
418
+ records: BaseEntity[];
419
+ viewParams: RunViewParams | null;
420
+ }>;
421
+ /**
422
+ * Emitted when duplicate search functionality is requested.
423
+ * Parent components should handle this to show the duplicate search results.
424
+ */
425
+ DuplicateSearchRequested: EventEmitter<{
426
+ entityInfo: EntityInfo;
427
+ records: BaseEntity[];
428
+ }>;
429
+ /**
430
+ * Emitted when the Add to List button is clicked.
431
+ * Parent components should handle this to show the list management dialog.
432
+ */
433
+ AddToListRequested: EventEmitter<{
434
+ entityInfo: EntityInfo;
435
+ records: BaseEntity[];
436
+ recordIds: string[];
437
+ }>;
438
+ /**
439
+ * Emitted when entity actions need to be loaded.
440
+ * Parent components should load actions and set the EntityActions input.
441
+ */
442
+ LoadEntityActionsRequested: EventEmitter<{
443
+ entityInfo: EntityInfo;
444
+ }>;
445
+ /**
446
+ * Emitted when an entity action is selected for execution.
447
+ * Parent components should handle the action execution.
448
+ */
449
+ EntityActionRequested: EventEmitter<{
450
+ entityInfo: EntityInfo;
451
+ action: EntityActionConfig;
452
+ selectedRecords: BaseEntity[];
453
+ }>;
454
+ gridContainer: ElementRef<HTMLDivElement>;
455
+ /** AG Grid column definitions */
456
+ agColumnDefs: ColDef[];
457
+ /** AG Grid row data */
458
+ rowData: Record<string, unknown>[];
459
+ /** AG Grid API reference */
460
+ private gridApi;
461
+ /** AG Grid theme (v34+) with custom selection colors */
462
+ agGridTheme: import("ag-grid-community").Theme<import("ag-grid-community").ThemeDefaultParams>;
463
+ /** AG Grid row selection configuration */
464
+ agRowSelection: RowSelectionOptions;
465
+ /** Default column settings */
466
+ defaultColDef: ColDef;
467
+ /** Get row ID function for AG Grid */
468
+ getRowId: (params: GetRowIdParams<Record<string, unknown>>) => string;
469
+ /** Suppress sort changed events during programmatic updates */
470
+ private suppressSortEvents;
471
+ /** AG Grid options for infinite scroll mode */
472
+ gridOptions: GridOptions;
473
+ /** Datasource for infinite scroll mode */
474
+ private infiniteDatasource;
475
+ private _useExternalData;
476
+ private _allData;
477
+ private _rowDataMap;
478
+ private _entityInfo;
479
+ private _viewEntity;
480
+ private _columnStates;
481
+ private _sortState;
482
+ private _filterState;
483
+ private _editingRowKey;
484
+ private _editingField;
485
+ private _pendingChanges;
486
+ /**
487
+ * The loaded view entity if using a stored view (ViewID, ViewName, or ViewEntity in Params).
488
+ * Null for dynamic views or when using legacy entityName input.
489
+ */
490
+ get ViewEntity(): UserViewEntityExtended | null;
491
+ /**
492
+ * The entity metadata for the current data source.
493
+ * Available after Params is set and data is loaded.
494
+ */
495
+ get EntityInfo(): EntityInfo | null;
496
+ /**
497
+ * True if using a dynamic view (EntityName only) rather than a stored view.
498
+ * False if using ViewID, ViewName, ViewEntity in Params, or viewEntity input.
499
+ */
500
+ get IsDynamicView(): boolean;
501
+ loading: boolean;
502
+ errorMessage: string;
503
+ totalRowCount: number;
504
+ private _loadDataPromise;
505
+ private destroy$;
506
+ private refreshSubject;
507
+ private statesSaveSubject;
508
+ private statePersistSubject;
509
+ private userDefaultsPersistSubject;
510
+ private pendingStateToSave;
511
+ private isSavingState;
512
+ /**
513
+ * Pending state waiting to be persisted (for flushing on destroy).
514
+ * Tracks state for both saved views and user defaults separately.
515
+ */
516
+ private _pendingViewStateToPersist;
517
+ private _pendingUserDefaultsToPersist;
518
+ /**
519
+ * Flag to suppress state persistence during view transitions.
520
+ * When true, emitGridStateChanged will not trigger persistence.
521
+ * This prevents the old view's column state from being saved to the new view.
522
+ */
523
+ private _suppressPersist;
524
+ /**
525
+ * Dirty flag to track if grid state has actually been modified by user actions.
526
+ * Only set to true when: column resize, column move, or sort change.
527
+ * Reset to false: when view loads, after successful persistence.
528
+ * This prevents emitting gridStateChanged events when no real change occurred.
529
+ */
530
+ private _isGridStateDirty;
531
+ /**
532
+ * Whether the current user can edit the view.
533
+ * For dynamic views, always true (persists to user settings).
534
+ * For saved views, depends on view ownership and permissions.
535
+ */
536
+ get canEditCurrentView(): boolean;
537
+ showOverflowMenu: boolean;
538
+ showExportDialog: boolean;
539
+ exportDialogConfig: ExportDialogConfig | null;
540
+ constructor(cdr: ChangeDetectorRef, elementRef: ElementRef, exportService: ExportService);
541
+ ngOnInit(): Promise<void>;
542
+ ngOnDestroy(): void;
543
+ /**
544
+ * Immediately persists any pending state changes without waiting for debounce.
545
+ * Called on component destroy to ensure changes aren't lost.
546
+ */
547
+ private flushPendingPersistence;
548
+ private setupRefreshDebounce;
549
+ private setupStatePersistDebounce;
550
+ private setupUserDefaultsPersistDebounce;
551
+ /**
552
+ * Called when Params input changes. Handles loading view entity metadata
553
+ * and triggering data load if allowed.
554
+ */
555
+ private onParamsChanged;
556
+ /**
557
+ * Gets a view from the UserViewEngine cache by ID.
558
+ * Returns undefined if not found or engine not initialized.
559
+ */
560
+ private getViewFromEngine;
561
+ /**
562
+ * Gets a view from the UserViewEngine cache by name.
563
+ * Returns undefined if not found or engine not initialized.
564
+ */
565
+ private getViewFromEngineByName;
566
+ /**
567
+ * Loads user's saved grid state defaults for a dynamic view.
568
+ * Uses UserInfoEngine to retrieve settings stored with key format: "default-view-setting/{entityName}"
569
+ */
570
+ private loadUserDefaultGridState;
571
+ /**
572
+ * Persists the current grid state as user defaults for a dynamic view.
573
+ * Uses UserInfoEngine to store settings with key format: "default-view-setting/{entityName}"
574
+ */
575
+ private persistUserDefaultGridState;
576
+ /**
577
+ * Applies settings from a loaded ViewEntity (column configuration, sort state, etc.)
578
+ *
579
+ * Precedence rules (highest to lowest):
580
+ * 1. Props passed directly (gridState, orderBy, etc.) - always take precedence
581
+ * 2. Settings from ViewEntity.GridState (persisted column/sort configuration)
582
+ * 3. Settings from ViewEntity.SortInfo (legacy sort configuration)
583
+ * 4. Auto-generated defaults from entity metadata
584
+ */
585
+ private applyViewEntitySettings;
586
+ private onGridStateChanged;
587
+ private onFilterTextChanged;
588
+ private generateColumnsFromMetadata;
589
+ private shouldShowField;
590
+ private estimateColumnWidth;
591
+ private mapFieldTypeToGridType;
592
+ private initializeColumnStates;
593
+ private buildAgColumnDefs;
594
+ private buildAgColumnDefsFromGridState;
595
+ private mapColumnConfigToColDef;
596
+ private generateAgColumnDefs;
597
+ private applyFieldFormatter;
598
+ /**
599
+ * Helper to wrap content with an inline style span
600
+ */
601
+ private wrapWithStyle;
602
+ /**
603
+ * Build a CSS style string from a ColumnTextStyle object
604
+ */
605
+ private buildCssStyle;
606
+ /**
607
+ * Build a style object for AG Grid from a ColumnTextStyle object
608
+ */
609
+ private buildStyleObject;
610
+ /**
611
+ * Format a value using custom ColumnFormat settings
612
+ */
613
+ private formatValueWithCustomFormat;
614
+ private formatCustomNumber;
615
+ private formatCustomCurrency;
616
+ private formatCustomPercent;
617
+ private formatCustomDate;
618
+ private formatCustomBoolean;
619
+ private updateAgRowSelection;
620
+ loadData(isAutoRefresh?: boolean): Promise<void>;
621
+ /**
622
+ * Internal method that performs the actual data loading.
623
+ * Called by loadData() which handles promise deduplication.
624
+ */
625
+ private executeLoadData;
626
+ /**
627
+ * Builds RunViewParams from the Params input.
628
+ * Requires Params to be set - the grid needs a data source configured.
629
+ */
630
+ private buildRunViewParams;
631
+ private buildOrderByClause;
632
+ /**
633
+ * Creates and returns an AG Grid IDatasource for infinite scroll mode.
634
+ * This datasource fetches data in pages from the server as the user scrolls.
635
+ */
636
+ private createInfiniteDatasource;
637
+ /**
638
+ * Converts a BaseEntity to AG Grid row data format.
639
+ * This is used by both client and infinite scroll modes for consistent data formatting.
640
+ */
641
+ private entityToRowData;
642
+ /**
643
+ * Sets up the grid for infinite scroll mode.
644
+ * Called when PaginationMode is 'infinite'.
645
+ */
646
+ private setupInfiniteScroll;
647
+ /**
648
+ * Refreshes the infinite scroll cache.
649
+ * Call this when data source parameters change.
650
+ */
651
+ private refreshInfiniteCache;
652
+ private processData;
653
+ private getRowKey;
654
+ private computeRowClasses;
655
+ onGridReady(event: GridReadyEvent): void;
656
+ /**
657
+ * Smart column auto-sizing that respects our width estimates
658
+ * while ensuring the grid fills available space appropriately
659
+ */
660
+ private autoSizeColumnsSmartly;
661
+ onAgRowClicked(event: RowClickedEvent): void;
662
+ onAgRowDoubleClicked(event: RowDoubleClickedEvent): void;
663
+ /**
664
+ * Emits a navigation request for the given entity record.
665
+ */
666
+ private emitNavigationRequest;
667
+ onAgSortChanged(event: AgSortChangedEvent): void;
668
+ onAgSelectionChanged(event: SelectionChangedEvent): void;
669
+ onAgColumnResized(event: ColumnResizedEvent): void;
670
+ onAgColumnMoved(event: ColumnMovedEvent): void;
671
+ private emitGridStateChanged;
672
+ /**
673
+ * Persists the grid state to the UserView entity.
674
+ * Only saves if the user has edit permission on the view.
675
+ */
676
+ private persistGridStateToView;
677
+ private buildCurrentGridState;
678
+ private applySortStateToGrid;
679
+ private updateSelection;
680
+ private updateRowSelectionState;
681
+ SelectRows(keys: string[], additive?: boolean): void;
682
+ DeselectRows(keys: string[]): void;
683
+ SelectAll(): void;
684
+ ClearSelection(): void;
685
+ GetSelectedRows(): BaseEntity[];
686
+ IsRowSelected(key: string): boolean;
687
+ /**
688
+ * Scrolls the grid to make the specified row visible.
689
+ * @param key The primary key of the row to scroll to
690
+ * @param position Where to position the row: 'top', 'middle', or 'bottom'
691
+ */
692
+ EnsureRowVisible(key: string, position?: 'top' | 'middle' | 'bottom'): void;
693
+ Refresh(): Promise<void>;
694
+ Clear(): void;
695
+ GetData(): BaseEntity[];
696
+ GetRowByKey(key: string): BaseEntity | undefined;
697
+ GetRowByIndex(index: number): BaseEntity | undefined;
698
+ GetState(): GridState;
699
+ SetState(state: GridState): void;
700
+ ResetState(): void;
701
+ private scheduleStateSave;
702
+ private loadPersistedState;
703
+ onAddClick(): void;
704
+ onDeleteClick(): void;
705
+ onExportClick(): void;
706
+ /**
707
+ * Shows the export dialog for the current grid data
708
+ */
709
+ private showExportDialogForCurrentData;
710
+ /**
711
+ * Handle export dialog close
712
+ */
713
+ onExportDialogClosed(result: ExportDialogResult): void;
714
+ /**
715
+ * Export grid data directly without showing dialog.
716
+ * Use this for programmatic export with specific options.
717
+ * @param options Export options (format, sampling, etc.)
718
+ * @param download If true, automatically downloads the file. Default true.
719
+ * @returns Export result with data buffer and metadata
720
+ */
721
+ Export(options?: Partial<ExportOptions>, download?: boolean): Promise<ExportResult>;
722
+ /**
723
+ * Export to Excel format directly (convenience method)
724
+ * @param download If true, automatically downloads the file. Default true.
725
+ */
726
+ ExportToExcel(download?: boolean): Promise<ExportResult>;
727
+ /**
728
+ * Export to CSV format directly (convenience method)
729
+ * @param download If true, automatically downloads the file. Default true.
730
+ */
731
+ ExportToCSV(download?: boolean): Promise<ExportResult>;
732
+ /**
733
+ * Export to JSON format directly (convenience method)
734
+ * @param download If true, automatically downloads the file. Default true.
735
+ */
736
+ ExportToJSON(download?: boolean): Promise<ExportResult>;
737
+ /**
738
+ * Get the current grid data formatted for export
739
+ */
740
+ private getExportData;
741
+ /**
742
+ * Get column definitions for export based on current grid columns
743
+ */
744
+ private getExportColumns;
745
+ /**
746
+ * Map MemberJunction field types to export column types
747
+ */
748
+ private mapFieldTypeToExportType;
749
+ /**
750
+ * Generate default file name for export
751
+ */
752
+ private getDefaultExportFileName;
753
+ onRefreshClick(): void;
754
+ onCompareClick(): void;
755
+ onMergeClick(): void;
756
+ onAddToListClick(): void;
757
+ onDuplicateSearchClick(): void;
758
+ onCommunicationClick(): void;
759
+ onColumnChooserClick(): void;
760
+ /**
761
+ * Handles entity action click from the overflow menu
762
+ */
763
+ onEntityActionClick(action: EntityActionConfig): void;
764
+ /**
765
+ * Checks if an entity action is currently enabled based on selection requirements
766
+ */
767
+ isEntityActionEnabled(action: EntityActionConfig): boolean;
768
+ toggleOverflowMenu(): void;
769
+ closeOverflowMenu(): void;
770
+ private handleOutsideClick;
771
+ get hasOverflowMenuItems(): boolean;
772
+ get showExportInOverflow(): boolean;
773
+ get showColumnChooserInOverflow(): boolean;
774
+ get hasSelectionDependentOverflowActions(): boolean;
775
+ get showCommunicationInOverflow(): boolean;
776
+ get HasSelection(): boolean;
777
+ get HasMultipleSelection(): boolean;
778
+ get gridContainerClasses(): string[];
779
+ /**
780
+ * Apply visual configuration by setting CSS custom properties
781
+ */
782
+ private applyVisualConfig;
783
+ get gridHeightStyle(): string;
784
+ isButtonVisible(button: GridToolbarButton): boolean;
785
+ isButtonDisabled(button: GridToolbarButton): boolean;
786
+ onToolbarButtonClick(button: GridToolbarButton): void;
787
+ get VisibleRows(): GridRowData[];
788
+ get VisibleColumnStates(): ColumnRuntimeState[];
789
+ static ɵfac: i0.ɵɵFactoryDeclaration<EntityDataGridComponent, never>;
790
+ static ɵcmp: i0.ɵɵComponentDeclaration<EntityDataGridComponent, "mj-entity-data-grid", never, { "Params": { "alias": "Params"; "required": false; }; "AllowLoad": { "alias": "AllowLoad"; "required": false; }; "AutoRefreshOnParamsChange": { "alias": "AutoRefreshOnParamsChange"; "required": false; }; "PaginationMode": { "alias": "PaginationMode"; "required": false; }; "PageSize": { "alias": "PageSize"; "required": false; }; "CacheBlockSize": { "alias": "CacheBlockSize"; "required": false; }; "MaxBlocksInCache": { "alias": "MaxBlocksInCache"; "required": false; }; "Data": { "alias": "Data"; "required": false; }; "Columns": { "alias": "Columns"; "required": false; }; "GridState": { "alias": "GridState"; "required": false; }; "AllowColumnReorder": { "alias": "AllowColumnReorder"; "required": false; }; "AllowColumnResize": { "alias": "AllowColumnResize"; "required": false; }; "AllowColumnToggle": { "alias": "AllowColumnToggle"; "required": false; }; "ShowHeader": { "alias": "ShowHeader"; "required": false; }; "AllowSorting": { "alias": "AllowSorting"; "required": false; }; "AllowMultiSort": { "alias": "AllowMultiSort"; "required": false; }; "ServerSideSorting": { "alias": "ServerSideSorting"; "required": false; }; "AllowColumnFilters": { "alias": "AllowColumnFilters"; "required": false; }; "ShowSearch": { "alias": "ShowSearch"; "required": false; }; "SelectionMode": { "alias": "SelectionMode"; "required": false; }; "SelectedKeys": { "alias": "SelectedKeys"; "required": false; }; "KeyField": { "alias": "KeyField"; "required": false; }; "EditMode": { "alias": "EditMode"; "required": false; }; "AllowAdd": { "alias": "AllowAdd"; "required": false; }; "AllowDelete": { "alias": "AllowDelete"; "required": false; }; "Height": { "alias": "Height"; "required": false; }; "RowHeight": { "alias": "RowHeight"; "required": false; }; "VirtualScroll": { "alias": "VirtualScroll"; "required": false; }; "ShowRowNumbers": { "alias": "ShowRowNumbers"; "required": false; }; "Striped": { "alias": "Striped"; "required": false; }; "GridLines": { "alias": "GridLines"; "required": false; }; "VisualConfig": { "alias": "VisualConfig"; "required": false; }; "ShowToolbar": { "alias": "ShowToolbar"; "required": false; }; "ToolbarConfig": { "alias": "ToolbarConfig"; "required": false; }; "StateKey": { "alias": "StateKey"; "required": false; }; "AutoPersistState": { "alias": "AutoPersistState"; "required": false; }; "StatePersistDebounce": { "alias": "StatePersistDebounce"; "required": false; }; "RefreshDebounce": { "alias": "RefreshDebounce"; "required": false; }; "FilterText": { "alias": "FilterText"; "required": false; }; "ShowNewButton": { "alias": "ShowNewButton"; "required": false; }; "ShowRefreshButton": { "alias": "ShowRefreshButton"; "required": false; }; "ShowExportButton": { "alias": "ShowExportButton"; "required": false; }; "ShowDeleteButton": { "alias": "ShowDeleteButton"; "required": false; }; "ShowCompareButton": { "alias": "ShowCompareButton"; "required": false; }; "ShowMergeButton": { "alias": "ShowMergeButton"; "required": false; }; "ShowAddToListButton": { "alias": "ShowAddToListButton"; "required": false; }; "ShowDuplicateSearchButton": { "alias": "ShowDuplicateSearchButton"; "required": false; }; "ShowCommunicationButton": { "alias": "ShowCommunicationButton"; "required": false; }; "AutoNavigate": { "alias": "AutoNavigate"; "required": false; }; "NavigateOnDoubleClick": { "alias": "NavigateOnDoubleClick"; "required": false; }; "CreateRecordMode": { "alias": "CreateRecordMode"; "required": false; }; "NewRecordValues": { "alias": "NewRecordValues"; "required": false; }; "ShowEntityActionButtons": { "alias": "ShowEntityActionButtons"; "required": false; }; "EntityActions": { "alias": "EntityActions"; "required": false; }; }, { "BeforeRowSelect": "BeforeRowSelect"; "AfterRowSelect": "AfterRowSelect"; "BeforeRowDeselect": "BeforeRowDeselect"; "AfterRowDeselect": "AfterRowDeselect"; "SelectionChange": "SelectionChange"; "BeforeRowClick": "BeforeRowClick"; "AfterRowClick": "AfterRowClick"; "BeforeRowDoubleClick": "BeforeRowDoubleClick"; "AfterRowDoubleClick": "AfterRowDoubleClick"; "BeforeCellEdit": "BeforeCellEdit"; "AfterCellEditBegin": "AfterCellEditBegin"; "BeforeCellEditCommit": "BeforeCellEditCommit"; "AfterCellEditCommit": "AfterCellEditCommit"; "BeforeCellEditCancel": "BeforeCellEditCancel"; "AfterCellEditCancel": "AfterCellEditCancel"; "BeforeRowSave": "BeforeRowSave"; "AfterRowSave": "AfterRowSave"; "BeforeRowDelete": "BeforeRowDelete"; "AfterRowDelete": "AfterRowDelete"; "BeforeDataLoad": "BeforeDataLoad"; "AfterDataLoad": "AfterDataLoad"; "BeforeDataRefresh": "BeforeDataRefresh"; "AfterDataRefresh": "AfterDataRefresh"; "BeforeSort": "BeforeSort"; "AfterSort": "AfterSort"; "BeforeColumnReorder": "BeforeColumnReorder"; "AfterColumnReorder": "AfterColumnReorder"; "BeforeColumnResize": "BeforeColumnResize"; "AfterColumnResize": "AfterColumnResize"; "BeforeColumnVisibilityChange": "BeforeColumnVisibilityChange"; "AfterColumnVisibilityChange": "AfterColumnVisibilityChange"; "GridStateChanged": "GridStateChanged"; "AddRequested": "AddRequested"; "DeleteRequested": "DeleteRequested"; "ExportRequested": "ExportRequested"; "NewButtonClick": "NewButtonClick"; "RefreshButtonClick": "RefreshButtonClick"; "ExportButtonClick": "ExportButtonClick"; "DeleteButtonClick": "DeleteButtonClick"; "CompareButtonClick": "CompareButtonClick"; "MergeButtonClick": "MergeButtonClick"; "AddToListButtonClick": "AddToListButtonClick"; "DuplicateSearchButtonClick": "DuplicateSearchButtonClick"; "CommunicationButtonClick": "CommunicationButtonClick"; "NavigationRequested": "NavigationRequested"; "NewRecordDialogRequested": "NewRecordDialogRequested"; "NewRecordTabRequested": "NewRecordTabRequested"; "CompareRecordsRequested": "CompareRecordsRequested"; "MergeRecordsRequested": "MergeRecordsRequested"; "CommunicationRequested": "CommunicationRequested"; "DuplicateSearchRequested": "DuplicateSearchRequested"; "AddToListRequested": "AddToListRequested"; "LoadEntityActionsRequested": "LoadEntityActionsRequested"; "EntityActionRequested": "EntityActionRequested"; }, never, never, false, never>;
791
+ }
792
+ //# sourceMappingURL=entity-data-grid.component.d.ts.map