@reforgium/data-grid 1.0.2 → 1.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.
|
@@ -1,230 +1,1038 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { TemplateRef, ElementRef } from '@angular/core';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* Directive for defining type-specific cell templates in a data grid.
|
|
6
|
+
*
|
|
7
|
+
* This directive allows developers to create custom cell renderers for specific data types
|
|
8
|
+
* within the data grid component. It binds a template to a type identifier, enabling
|
|
9
|
+
* the grid to dynamically select and render the appropriate template based on column type.
|
|
10
|
+
*
|
|
11
|
+
* Example usage:
|
|
12
|
+
* ```html
|
|
13
|
+
* <ng-template reDataGridTypeCell="date" let-data>
|
|
14
|
+
* {{ data.value | date }}
|
|
15
|
+
* </ng-template>
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* The directive captures the template reference and makes it available to the parent
|
|
19
|
+
* data grid component for rendering cells of the specified type.
|
|
20
|
+
*/
|
|
4
21
|
declare class DataGridTypeCellTemplateDirective {
|
|
22
|
+
/**
|
|
23
|
+
* The type identifier for this cell template.
|
|
24
|
+
*
|
|
25
|
+
* Specifies which data type this template should be used for.
|
|
26
|
+
* When the data grid encounters a column with a matching type,
|
|
27
|
+
* it will use this template to render cells in that column.
|
|
28
|
+
*
|
|
29
|
+
* @default ''
|
|
30
|
+
*/
|
|
5
31
|
type: _angular_core.InputSignal<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Reference to the template defined in the directive.
|
|
34
|
+
*
|
|
35
|
+
* This template will be rendered for each cell of the matching type,
|
|
36
|
+
* receiving `RenderTemplateData` as its context with cell-specific information.
|
|
37
|
+
*/
|
|
6
38
|
tpl: TemplateRef<any>;
|
|
7
39
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DataGridTypeCellTemplateDirective, never>;
|
|
8
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DataGridTypeCellTemplateDirective, "ng-template[
|
|
40
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DataGridTypeCellTemplateDirective, "ng-template[reDataGridTypeCell]", never, { "type": { "alias": "reDataGridTypeCell"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
9
41
|
}
|
|
10
42
|
|
|
43
|
+
declare class DataGridCellTemplateDirective {
|
|
44
|
+
key: _angular_core.InputSignal<string>;
|
|
45
|
+
/**
|
|
46
|
+
* The injected template reference containing the custom cell template.
|
|
47
|
+
* The template context is of the type `DataGridCellTemplateDirective`.
|
|
48
|
+
*/
|
|
49
|
+
tpl: TemplateRef<any>;
|
|
50
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DataGridCellTemplateDirective, never>;
|
|
51
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DataGridCellTemplateDirective, "ng-template[reDataGridCell]", never, { "key": { "alias": "reDataGridCell"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Directive for defining custom header templates in data grid columns.
|
|
56
|
+
*
|
|
57
|
+
* This directive allows you to specify a custom template for rendering column headers
|
|
58
|
+
* in the data grid. The template is associated with a column key and receives
|
|
59
|
+
* header-specific context data.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```html
|
|
63
|
+
* <ng-template reDataGridHeader="username" let-header>
|
|
64
|
+
* <div class="custom-header">{{ header.label }}</div>
|
|
65
|
+
* </ng-template>
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
11
68
|
declare class DataGridHeaderTemplateDirective {
|
|
69
|
+
/**
|
|
70
|
+
* The column key this header template is associated with.
|
|
71
|
+
* Uses the `reDataGridHeader` directive attribute as an alias.
|
|
72
|
+
* Defaults to an empty string if not provided.
|
|
73
|
+
*/
|
|
12
74
|
key: _angular_core.InputSignal<string>;
|
|
75
|
+
/**
|
|
76
|
+
* The injected template reference containing the custom header template.
|
|
77
|
+
* The template context is of the type `HeaderTemplateData`.
|
|
78
|
+
*/
|
|
13
79
|
tpl: TemplateRef<any>;
|
|
14
80
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DataGridHeaderTemplateDirective, never>;
|
|
15
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DataGridHeaderTemplateDirective, "ng-template[
|
|
81
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DataGridHeaderTemplateDirective, "ng-template[reDataGridHeader]", never, { "key": { "alias": "reDataGridHeader"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
16
82
|
}
|
|
17
83
|
|
|
84
|
+
/**
|
|
85
|
+
* Directive for providing a custom template to display when the data grid has no data.
|
|
86
|
+
*
|
|
87
|
+
* Used as a structural directive on `<ng-template>` elements within data grid components.
|
|
88
|
+
* The template receives a boolean context value indicating the empty state.
|
|
89
|
+
*
|
|
90
|
+
* Example:
|
|
91
|
+
* ```html
|
|
92
|
+
* <ng-template reDataGridEmpty let-isEmpty>
|
|
93
|
+
* <div *ngIf="isEmpty">No data available</div>
|
|
94
|
+
* </ng-template>
|
|
95
|
+
* ```
|
|
96
|
+
*
|
|
97
|
+
* Template context:
|
|
98
|
+
* - `$implicit: boolean` — indicates whether the grid is in an empty state
|
|
99
|
+
*/
|
|
18
100
|
declare class DataGridCellEmptyDirective {
|
|
19
101
|
tpl: TemplateRef<any>;
|
|
20
102
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DataGridCellEmptyDirective, never>;
|
|
21
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DataGridCellEmptyDirective, "ng-template[
|
|
103
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DataGridCellEmptyDirective, "ng-template[reDataGridEmpty]", never, {}, {}, never, never, true, never>;
|
|
22
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* Directive for providing a custom template to display when the data grid is loading data.
|
|
107
|
+
*
|
|
108
|
+
* Used as a structural directive on `<ng-template>` elements within data grid components.
|
|
109
|
+
* The template receives a boolean context value indicating the loading state.
|
|
110
|
+
*
|
|
111
|
+
* Example:
|
|
112
|
+
* ```html
|
|
113
|
+
* <ng-template reDataGridLoading let-isLoading>
|
|
114
|
+
* <div *ngIf="isLoading">Loading...</div>
|
|
115
|
+
* </ng-template>
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* Template context:
|
|
119
|
+
* - `$implicit: boolean` — indicates whether the grid is in loading state
|
|
120
|
+
*/
|
|
23
121
|
declare class DataGridCellLoadingDirective {
|
|
24
122
|
tpl: TemplateRef<any>;
|
|
25
123
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DataGridCellLoadingDirective, never>;
|
|
26
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DataGridCellLoadingDirective, "ng-template[
|
|
124
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DataGridCellLoadingDirective, "ng-template[reDataGridLoading]", never, {}, {}, never, never, true, never>;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
declare class DataGridSortIconDirective {
|
|
128
|
+
tpl: TemplateRef<any>;
|
|
129
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DataGridSortIconDirective, never>;
|
|
130
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DataGridSortIconDirective, "ng-template[reDataGridSortIcon]", never, {}, {}, never, never, true, never>;
|
|
131
|
+
}
|
|
132
|
+
declare class DataGridExpanderIconDirective {
|
|
133
|
+
tpl: TemplateRef<any>;
|
|
134
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DataGridExpanderIconDirective, never>;
|
|
135
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<DataGridExpanderIconDirective, "ng-template[reDataGridExpanderIcon]", never, {}, {}, never, never, true, never>;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
declare class DataGridPaginator {
|
|
139
|
+
current: _angular_core.InputSignalWithTransform<number, string | number | undefined>;
|
|
140
|
+
totalElements: _angular_core.InputSignalWithTransform<number, string | number | undefined>;
|
|
141
|
+
pageSize: _angular_core.InputSignalWithTransform<number, string | number | undefined>;
|
|
142
|
+
maxShowPages: _angular_core.InputSignalWithTransform<number, string | number | undefined>;
|
|
143
|
+
pageChange: _angular_core.OutputEmitterRef<number>;
|
|
144
|
+
totalPages: _angular_core.Signal<number>;
|
|
145
|
+
pages: _angular_core.Signal<number[]>;
|
|
146
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DataGridPaginator, never>;
|
|
147
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DataGridPaginator, "re-data-grid-paginator", never, { "current": { "alias": "current"; "required": false; "isSignal": true; }; "totalElements": { "alias": "totalElements"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "maxShowPages": { "alias": "maxShowPages"; "required": false; "isSignal": true; }; }, { "pageChange": "pageChange"; }, never, never, true, never>;
|
|
27
148
|
}
|
|
28
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Represents a key of an object that is also a string, or any string.
|
|
152
|
+
* Used for identifying data properties in rows.
|
|
153
|
+
*/
|
|
29
154
|
type DataKey<Data> = (keyof Data & string) | string;
|
|
155
|
+
/**
|
|
156
|
+
* Function type that resolves a value of type `Return` from an argument of type `Arg`.
|
|
157
|
+
* Often used to transform row data or extract specific properties.
|
|
158
|
+
*/
|
|
30
159
|
type KeyResolver<Arg = AnyType, Return = string> = (arg: Arg) => Return;
|
|
160
|
+
/**
|
|
161
|
+
* Union type for row identification.
|
|
162
|
+
* Can be either a property key (string) or a resolver function.
|
|
163
|
+
*/
|
|
31
164
|
type RowKeyFn<Data> = DataKey<Data> | KeyResolver<Data, string | number>;
|
|
165
|
+
/**
|
|
166
|
+
* Type alias for `any`.
|
|
167
|
+
*/
|
|
32
168
|
type AnyType = any;
|
|
169
|
+
/**
|
|
170
|
+
* Represents an object with string keys and values of any type.
|
|
171
|
+
* Common base type for row data.
|
|
172
|
+
*/
|
|
33
173
|
type AnyDict = Record<string, AnyType>;
|
|
34
174
|
|
|
175
|
+
/**
|
|
176
|
+
* Defines how pagination is displayed and handled in the data grid.
|
|
177
|
+
*
|
|
178
|
+
* - `'none'` - No pagination, all rows are displayed
|
|
179
|
+
* - `'pagination'` - Classic page-based pagination with page numbers
|
|
180
|
+
* - `'infinity'` - Infinite scroll pagination (load more on scroll)
|
|
181
|
+
*/
|
|
35
182
|
type GridPaginationMode = 'none' | 'pagination' | 'infinity';
|
|
183
|
+
/**
|
|
184
|
+
* Position where a row can be pinned in the data grid.
|
|
185
|
+
*
|
|
186
|
+
* - `'top'` - Pin row at the top of the grid
|
|
187
|
+
* - `'bottom'` - Pin row at the bottom of the grid
|
|
188
|
+
*/
|
|
36
189
|
type GridPinnedPosition = 'top' | 'bottom';
|
|
190
|
+
/**
|
|
191
|
+
* Row selection mode for the data grid.
|
|
192
|
+
*
|
|
193
|
+
* - `'single'` - Allow selecting only one row at a time
|
|
194
|
+
* - `'multi'` - Allow selecting multiple rows
|
|
195
|
+
* - `'none'` - Disable row selection
|
|
196
|
+
*/
|
|
37
197
|
type GridSelectMode = 'single' | 'multi' | 'none';
|
|
198
|
+
/**
|
|
199
|
+
* Sort direction for grid columns.
|
|
200
|
+
*
|
|
201
|
+
* - `'asc'` - Ascending order (A to Z, 0 to 9)
|
|
202
|
+
* - `'desc'` - Descending order (Z to A, 9 to 0)
|
|
203
|
+
*/
|
|
38
204
|
type GridSortOrder = 'asc' | 'desc';
|
|
205
|
+
/**
|
|
206
|
+
* Horizontal alignment options for grid cell content.
|
|
207
|
+
*
|
|
208
|
+
* - `'left'` - Align content to the left
|
|
209
|
+
* - `'center'` - Center align content
|
|
210
|
+
* - `'right'` - Align content to the right
|
|
211
|
+
*/
|
|
39
212
|
type GridCellAlign = 'left' | 'center' | 'right';
|
|
213
|
+
/**
|
|
214
|
+
* Built-in cell renderer types for common data display formats.
|
|
215
|
+
*
|
|
216
|
+
* - `'plain'` - Display raw text value (default)
|
|
217
|
+
* - `'date'` - Format and display date values
|
|
218
|
+
* - `'number'` - Format and display numeric values
|
|
219
|
+
* - `'index'` - Display row index number
|
|
220
|
+
* - `'checkbox'` - Display checkbox for selection
|
|
221
|
+
*/
|
|
40
222
|
type GridCellRendererType = 'plain' | 'date' | 'number' | 'index' | 'checkbox';
|
|
223
|
+
/**
|
|
224
|
+
* Array of column definitions for the data grid.
|
|
225
|
+
*
|
|
226
|
+
* @template Data - Type of data objects displayed in the grid rows
|
|
227
|
+
*/
|
|
41
228
|
type GridColumns<Data extends AnyDict = AnyDict> = GridColumn<Data>[];
|
|
229
|
+
/**
|
|
230
|
+
* Array of pinned row definitions for the data grid.
|
|
231
|
+
*
|
|
232
|
+
* Pinned rows remain fixed at the top or bottom of the grid regardless of scrolling.
|
|
233
|
+
*
|
|
234
|
+
* @template Data - Type of data objects displayed in the grid rows
|
|
235
|
+
*/
|
|
42
236
|
type GridPinnedRows<Data extends AnyDict = AnyDict> = GridPinnedRow<Data>[];
|
|
237
|
+
/**
|
|
238
|
+
* Union type representing grid selection configuration.
|
|
239
|
+
*
|
|
240
|
+
* Can be either a configuration with no selection enabled,
|
|
241
|
+
* or a configuration with single/multi selection enabled.
|
|
242
|
+
*
|
|
243
|
+
* @template Data - Type of data objects displayed in the grid rows
|
|
244
|
+
*/
|
|
43
245
|
type GridSelection<Data extends AnyDict = AnyDict> = _Selectless | _Selectfull<Data>;
|
|
246
|
+
/**
|
|
247
|
+
* Selection configuration when row selection is disabled.
|
|
248
|
+
*
|
|
249
|
+
* When the mode is set to `'none'`, no additional configuration is required.
|
|
250
|
+
*/
|
|
44
251
|
type _Selectless = {
|
|
45
252
|
mode: 'none';
|
|
46
253
|
};
|
|
254
|
+
/**
|
|
255
|
+
* Selection configuration when row selection is enabled (single or multi).
|
|
256
|
+
*
|
|
257
|
+
* Requires specifying which data property to use as the unique identifier
|
|
258
|
+
* for tracking selected rows. Optionally allows setting default selection.
|
|
259
|
+
*
|
|
260
|
+
* @template Data - Type of data objects displayed in the grid rows
|
|
261
|
+
*/
|
|
47
262
|
type _Selectfull<Data extends AnyDict> = {
|
|
263
|
+
/**
|
|
264
|
+
* Selection mode: `'single'` or `'multi'`.
|
|
265
|
+
*/
|
|
48
266
|
mode: Omit<GridSelectMode, 'none'>;
|
|
267
|
+
/**
|
|
268
|
+
* Data property to use as a unique identifier for selection.
|
|
269
|
+
*/
|
|
49
270
|
key: DataKey<Data>;
|
|
271
|
+
/**
|
|
272
|
+
* Optional array of initially selected row identifiers.
|
|
273
|
+
*/
|
|
50
274
|
defaultSelected?: DataKey<Data>[];
|
|
51
275
|
};
|
|
276
|
+
/**
|
|
277
|
+
* Configuration for a single pinned row in the data grid.
|
|
278
|
+
*
|
|
279
|
+
* Pinned rows remain fixed at the specified position (top or bottom)
|
|
280
|
+
* and can display static data or use a custom template for rendering.
|
|
281
|
+
*
|
|
282
|
+
* @template Data - Type of data objects displayed in the grid rows
|
|
283
|
+
*/
|
|
52
284
|
type GridPinnedRow<Data extends AnyDict = AnyDict> = {
|
|
285
|
+
/**
|
|
286
|
+
* Where to pin the row (`'top'` or `'bottom'`).
|
|
287
|
+
*/
|
|
53
288
|
position: GridPinnedPosition;
|
|
289
|
+
/**
|
|
290
|
+
* Relative display order when multiple rows are pinned at the same position.
|
|
291
|
+
*/
|
|
54
292
|
order?: number;
|
|
293
|
+
/**
|
|
294
|
+
* Static data or function returning data for the row.
|
|
295
|
+
*/
|
|
55
296
|
data: Partial<Data> | (() => Partial<Data>);
|
|
297
|
+
/**
|
|
298
|
+
* Optional Angular template for custom row rendering.
|
|
299
|
+
*/
|
|
56
300
|
rowTemplate?: TemplateRef<{
|
|
57
301
|
$implicit: Partial<Data>;
|
|
58
302
|
}>;
|
|
59
303
|
};
|
|
304
|
+
/**
|
|
305
|
+
* Union type representing different column definition variants.
|
|
306
|
+
*
|
|
307
|
+
* A column can use built-in renderers, custom value functions, or Angular templates
|
|
308
|
+
* for rendering cell content.
|
|
309
|
+
*
|
|
310
|
+
* @template Data - Type of data objects displayed in the grid rows
|
|
311
|
+
*/
|
|
60
312
|
type GridColumn<Data extends AnyDict = AnyDict> = _DefaultGridColumn<Data> | _ValuedGridColumn<Data> | _TemplatedGridColumn<Data>;
|
|
313
|
+
/**
|
|
314
|
+
* Base properties shared by all column definition types.
|
|
315
|
+
*
|
|
316
|
+
* Contains configuration for column identification, header display,
|
|
317
|
+
* sizing, alignment, visibility, and behavior.
|
|
318
|
+
*
|
|
319
|
+
* @template Data - Type of data objects displayed in the grid rows
|
|
320
|
+
*/
|
|
61
321
|
type _BaseGridColumn<Data extends AnyDict = AnyDict> = {
|
|
322
|
+
/**
|
|
323
|
+
* Data property key this column displays.
|
|
324
|
+
*/
|
|
62
325
|
key: DataKey<Data>;
|
|
326
|
+
/**
|
|
327
|
+
* Optional alternative key for sorting (if different from a display key).
|
|
328
|
+
*/
|
|
63
329
|
sortKey?: string;
|
|
330
|
+
/**
|
|
331
|
+
* Column header text string.
|
|
332
|
+
*/
|
|
64
333
|
header: string;
|
|
334
|
+
/**
|
|
335
|
+
* Optional Angular template for custom header rendering.
|
|
336
|
+
* If provided, overrides the default text header.
|
|
337
|
+
*/
|
|
65
338
|
headerTemplate?: TemplateRef<HeaderTemplateData>;
|
|
339
|
+
/**
|
|
340
|
+
* Horizontal alignment of cell content.
|
|
341
|
+
*/
|
|
66
342
|
align?: GridCellAlign;
|
|
343
|
+
/**
|
|
344
|
+
* CSS class(es) to apply to cells.
|
|
345
|
+
* Can be a static string or a resolver function that returns a class string based on row data.
|
|
346
|
+
*/
|
|
67
347
|
cellClass?: KeyResolver<Data> | string;
|
|
348
|
+
/**
|
|
349
|
+
* Fixed column width in pixels.
|
|
350
|
+
*/
|
|
68
351
|
width?: number;
|
|
352
|
+
/**
|
|
353
|
+
* Minimum column width in pixels.
|
|
354
|
+
*/
|
|
69
355
|
minWidth?: number;
|
|
356
|
+
/**
|
|
357
|
+
* Maximum column width in pixels.
|
|
358
|
+
*/
|
|
70
359
|
maxWidth?: number;
|
|
360
|
+
/**
|
|
361
|
+
* Flex grow factor for flexible width columns.
|
|
362
|
+
*/
|
|
71
363
|
flex?: number;
|
|
364
|
+
/**
|
|
365
|
+
* Whether the column is disabled.
|
|
366
|
+
*/
|
|
72
367
|
disabled?: boolean;
|
|
368
|
+
/**
|
|
369
|
+
* Whether the column is visible.
|
|
370
|
+
*/
|
|
73
371
|
visible?: boolean;
|
|
372
|
+
/**
|
|
373
|
+
* Whether the column remains fixed during the horizontal scroll.
|
|
374
|
+
*/
|
|
74
375
|
sticky?: boolean;
|
|
376
|
+
/**
|
|
377
|
+
* Data key to use for expanding/collapsing row details.
|
|
378
|
+
*/
|
|
75
379
|
expandBy?: DataKey<Data>;
|
|
76
380
|
};
|
|
381
|
+
/**
|
|
382
|
+
* Column definition using built-in cell renderer types.
|
|
383
|
+
*
|
|
384
|
+
* Extends the base column with an optional renderer type specification.
|
|
385
|
+
* If no type is specified, defaults to `'plain'` renderer.
|
|
386
|
+
*
|
|
387
|
+
* @template Data - Type of data objects displayed in the grid rows
|
|
388
|
+
*/
|
|
77
389
|
type _DefaultGridColumn<Data extends AnyDict = AnyDict> = _BaseGridColumn<Data> & {
|
|
390
|
+
/**
|
|
391
|
+
* Built-in renderer type for formatting cell values.
|
|
392
|
+
*/
|
|
78
393
|
type?: GridCellRendererType;
|
|
394
|
+
/**
|
|
395
|
+
* Optional configuration or formatting options passed to the renderer (e.g., date/number format). *[NEW in 1.1.0]*
|
|
396
|
+
*/
|
|
397
|
+
typeParams?: AnyType;
|
|
79
398
|
};
|
|
399
|
+
/**
|
|
400
|
+
* Column definition using a custom value renderer function.
|
|
401
|
+
*
|
|
402
|
+
* Allows custom logic for transforming row data into display values.
|
|
403
|
+
* Requires a tracking function for change detection optimization.
|
|
404
|
+
*
|
|
405
|
+
* @template Data - Type of data objects displayed in the grid rows
|
|
406
|
+
*/
|
|
80
407
|
type _ValuedGridColumn<Data extends AnyDict = AnyDict> = _BaseGridColumn<Data> & {
|
|
408
|
+
/**
|
|
409
|
+
* Function returning unique identifier for the row (for change detection).
|
|
410
|
+
*/
|
|
81
411
|
track: (row: Data) => string;
|
|
412
|
+
/**
|
|
413
|
+
* Function that resolves cell display value from row data.
|
|
414
|
+
*/
|
|
82
415
|
value: GridCellRenderer<Data>;
|
|
83
416
|
};
|
|
417
|
+
/**
|
|
418
|
+
* Column definition using an Angular template for cell rendering.
|
|
419
|
+
*
|
|
420
|
+
* Provides maximum flexibility by allowing custom HTML templates
|
|
421
|
+
* with full access to row data, column config, and cell context.
|
|
422
|
+
* Requires a tracking function for change detection optimization.
|
|
423
|
+
*
|
|
424
|
+
* @template Data - Type of data objects displayed in the grid rows
|
|
425
|
+
*/
|
|
84
426
|
type _TemplatedGridColumn<Data extends AnyDict = AnyDict> = _BaseGridColumn<Data> & {
|
|
427
|
+
/**
|
|
428
|
+
* Function returning unique identifier for the row (for change detection).
|
|
429
|
+
*/
|
|
85
430
|
track: (row: Data) => string;
|
|
431
|
+
/**
|
|
432
|
+
* Angular TemplateRef for rendering cell content.
|
|
433
|
+
*/
|
|
86
434
|
renderTemplate: TemplateRef<RenderTemplateData<Data>>;
|
|
87
435
|
};
|
|
436
|
+
/**
|
|
437
|
+
* Type for custom cell value resolver functions.
|
|
438
|
+
*
|
|
439
|
+
* Function that takes row data and returns a string or number for display.
|
|
440
|
+
* Used in `_ValuedGridColumn` to customize how cell values are extracted and formatted.
|
|
441
|
+
*
|
|
442
|
+
* @template Data - Type of data objects displayed in the grid rows
|
|
443
|
+
*/
|
|
88
444
|
type GridCellRenderer<Data> = KeyResolver<Data, string | number>;
|
|
445
|
+
/**
|
|
446
|
+
* Context data provided to the header template.
|
|
447
|
+
*
|
|
448
|
+
* Implicit value is the header text string.
|
|
449
|
+
*/
|
|
89
450
|
type HeaderTemplateData = {
|
|
451
|
+
/**
|
|
452
|
+
* The column header text string.
|
|
453
|
+
*/
|
|
90
454
|
$implicit: string;
|
|
91
455
|
};
|
|
456
|
+
/**
|
|
457
|
+
* Context data provided to cell render template.
|
|
458
|
+
*
|
|
459
|
+
* Provides comprehensive access to cell, row, and column information
|
|
460
|
+
* for use within custom Angular templates.
|
|
461
|
+
*
|
|
462
|
+
* @template Data - Type of data objects displayed in the grid rows
|
|
463
|
+
*/
|
|
92
464
|
type RenderTemplateData<Data extends AnyDict = AnyDict> = {
|
|
465
|
+
/**
|
|
466
|
+
* The cell's display value as string (implicit context).
|
|
467
|
+
*/
|
|
93
468
|
$implicit: string;
|
|
469
|
+
/**
|
|
470
|
+
* The cell's display value as string (same as $implicit).
|
|
471
|
+
*/
|
|
94
472
|
value: string;
|
|
473
|
+
/**
|
|
474
|
+
* Complete data object for the current row.
|
|
475
|
+
*/
|
|
95
476
|
row: Data;
|
|
477
|
+
/**
|
|
478
|
+
* Column definition configuration object.
|
|
479
|
+
*/
|
|
96
480
|
col: GridColumn<Data>;
|
|
481
|
+
/**
|
|
482
|
+
* Zero-based row index in the current data set.
|
|
483
|
+
*/
|
|
97
484
|
index: number;
|
|
98
485
|
};
|
|
99
486
|
|
|
487
|
+
/**
|
|
488
|
+
* Event emitted when pagination changes in the data grid.
|
|
489
|
+
*
|
|
490
|
+
* Contains information about the current page, page size, and optional sorting parameters.
|
|
491
|
+
* Property names are compatible with PrimeNG table component conventions.
|
|
492
|
+
*/
|
|
100
493
|
type GridPageChangeEvent = {
|
|
101
494
|
page: number;
|
|
102
|
-
/** `pageSize`,
|
|
495
|
+
/** `pageSize`, named `rows` for compatibility with PrimeNG */
|
|
103
496
|
rows: number;
|
|
104
|
-
/**
|
|
497
|
+
/** for compatibility with PrimeNG */
|
|
105
498
|
sortField?: string;
|
|
106
|
-
/**
|
|
499
|
+
/** for compatibility with PrimeNG */
|
|
107
500
|
sortOrder?: GridSortOrder;
|
|
108
501
|
};
|
|
502
|
+
/**
|
|
503
|
+
* Event emitted when column sorting changes in the data grid.
|
|
504
|
+
*
|
|
505
|
+
* Contains information about the sorted column key and the sort direction.
|
|
506
|
+
* The `key` property is type-safe and corresponds to actual data object keys.
|
|
507
|
+
*
|
|
508
|
+
* @template Data - Type of data objects in the grid
|
|
509
|
+
*/
|
|
109
510
|
type GridSortEvent<Data = AnyDict> = {
|
|
110
511
|
key: DataKey<Data>;
|
|
111
512
|
order?: GridSortOrder;
|
|
112
513
|
};
|
|
514
|
+
/**
|
|
515
|
+
* Event emitted when row selection changes in the data grid.
|
|
516
|
+
*
|
|
517
|
+
* Contains an array of selected values, which can be either string identifiers
|
|
518
|
+
* or actual data values from the specified key column.
|
|
519
|
+
*
|
|
520
|
+
* @template Data - Type of data objects in the grid
|
|
521
|
+
*/
|
|
113
522
|
type GridSelectEvent<Data extends AnyDict = AnyDict> = {
|
|
114
523
|
selected: (string | Data[DataKey<Data>])[];
|
|
115
524
|
};
|
|
525
|
+
/**
|
|
526
|
+
* Event emitted when a row is clicked in the data grid.
|
|
527
|
+
*
|
|
528
|
+
* Provides access to the clicked row's data object and its numeric index position
|
|
529
|
+
* within the current grid data set.
|
|
530
|
+
*
|
|
531
|
+
* @template Data - Type of data objects in the grid
|
|
532
|
+
*/
|
|
116
533
|
type GridRowClickEvent<Data extends AnyDict = AnyDict> = {
|
|
117
534
|
row: Data;
|
|
118
535
|
index: number;
|
|
119
536
|
};
|
|
537
|
+
/**
|
|
538
|
+
* Event emitted when a specific cell is clicked in the data grid.
|
|
539
|
+
*
|
|
540
|
+
* Provides detailed information about the clicked cell, including the row data,
|
|
541
|
+
* column configuration, and the row's numeric index position.
|
|
542
|
+
*
|
|
543
|
+
* @template Data - Type of data objects in the grid
|
|
544
|
+
*/
|
|
120
545
|
type GridCellClickEvent<Data extends AnyDict = AnyDict> = {
|
|
121
546
|
row: Data;
|
|
122
547
|
col: GridColumn<Data>;
|
|
123
548
|
index: number;
|
|
124
549
|
};
|
|
125
550
|
|
|
551
|
+
/**
|
|
552
|
+
* View model for the data grid component.
|
|
553
|
+
*
|
|
554
|
+
* Manages grid state including column layout, sticky positioning, scrollbar calculations,
|
|
555
|
+
* and pinned rows. Automatically recomputes column widths based on container size and
|
|
556
|
+
* handles sticky column offsets for left and right pinned columns.
|
|
557
|
+
*
|
|
558
|
+
* @template Data - Type of data objects in the grid, must extend AnyDict
|
|
559
|
+
*
|
|
560
|
+
* @example
|
|
561
|
+
* ```typescript
|
|
562
|
+
* const gridVm = inject(DataGridVm<MyDataType>);
|
|
563
|
+
* gridVm.columns.set([{ key: 'name', title: 'Name' }]);
|
|
564
|
+
* gridVm.containerWidth.set(800);
|
|
565
|
+
* ```
|
|
566
|
+
*/
|
|
126
567
|
declare class DataGridVm<Data extends AnyDict> {
|
|
127
568
|
#private;
|
|
569
|
+
/**
|
|
570
|
+
* Reference to the scrollable container element.
|
|
571
|
+
*
|
|
572
|
+
* Used for scrollbar calculations and scroll position management.
|
|
573
|
+
*/
|
|
128
574
|
scrollEl: _angular_core.WritableSignal<ElementRef<HTMLDivElement> | undefined>;
|
|
575
|
+
/**
|
|
576
|
+
* Array of column configurations for the grid.
|
|
577
|
+
*
|
|
578
|
+
* Defines all columns including their keys, titles, sticky positioning, and widths.
|
|
579
|
+
* Value is reactive and triggers column layout recalculation when changed.
|
|
580
|
+
*/
|
|
129
581
|
columns: _angular_core.WritableSignal<GridColumn<Data>[]>;
|
|
582
|
+
/**
|
|
583
|
+
* Array of pinned row configurations.
|
|
584
|
+
*
|
|
585
|
+
* Defines rows that remain fixed at the top or bottom of the grid during scrolling.
|
|
586
|
+
* Each row includes data, position ('top' or 'bottom'), and optional ordering.
|
|
587
|
+
*/
|
|
130
588
|
pinnedRows: _angular_core.WritableSignal<GridPinnedRow<Data>[]>;
|
|
589
|
+
/**
|
|
590
|
+
* Current width of the grid container in pixels.
|
|
591
|
+
*
|
|
592
|
+
* Used for column width calculations and layout adjustments.
|
|
593
|
+
* Value is reactive and triggers column layout recalculation when changed.
|
|
594
|
+
*/
|
|
131
595
|
containerWidth: _angular_core.WritableSignal<number>;
|
|
596
|
+
/**
|
|
597
|
+
* Flag indicating whether the custom scrollbar should be visible.
|
|
598
|
+
*
|
|
599
|
+
* Automatically computed based on content height vs. container height.
|
|
600
|
+
*/
|
|
132
601
|
scrollbarVisible: _angular_core.WritableSignal<boolean>;
|
|
602
|
+
/**
|
|
603
|
+
* Height of the scrollbar thumb in pixels.
|
|
604
|
+
*
|
|
605
|
+
* Proportional to the ratio of visible content to total content height.
|
|
606
|
+
*/
|
|
133
607
|
thumbHeightPx: _angular_core.WritableSignal<number>;
|
|
608
|
+
/**
|
|
609
|
+
* Top position of the scrollbar thumb in pixels.
|
|
610
|
+
*
|
|
611
|
+
* Corresponds to the current scroll position within the scrollable area.
|
|
612
|
+
*/
|
|
134
613
|
thumbTopPx: _angular_core.WritableSignal<number>;
|
|
614
|
+
/**
|
|
615
|
+
* Flag indicating whether the user is currently dragging the scrollbar thumb.
|
|
616
|
+
*
|
|
617
|
+
* Used to track active scroll drag interactions.
|
|
618
|
+
*/
|
|
135
619
|
dragging: boolean;
|
|
620
|
+
/**
|
|
621
|
+
* Map of global cell renderer templates by type.
|
|
622
|
+
*
|
|
623
|
+
* Stores reusable template references for different cell renderer types
|
|
624
|
+
* that can be shared across multiple columns.
|
|
625
|
+
*/
|
|
136
626
|
globalTypeCellTpls: Map<GridCellRendererType, TemplateRef<Data>>;
|
|
627
|
+
globalDataCellTpls: Map<string | keyof Data, TemplateRef<Data>>;
|
|
628
|
+
/**
|
|
629
|
+
* Computed an array of non-sticky columns to display in the scrollable area.
|
|
630
|
+
*
|
|
631
|
+
* Automatically splits columns into left-sticky, visible, and right-sticky groups,
|
|
632
|
+
* recomputes sticky offsets, and returns only the scrollable middle section.
|
|
633
|
+
* Recalculates whenever columns or container width changes.
|
|
634
|
+
*/
|
|
137
635
|
columnsToShow: _angular_core.Signal<GridColumn<Data>[]>;
|
|
636
|
+
/**
|
|
637
|
+
* Computed array of rows pinned to the top of the grid.
|
|
638
|
+
*
|
|
639
|
+
* Filters pinned rows by 'top' position and sorts them by order property.
|
|
640
|
+
* Rows with lower order values appear first.
|
|
641
|
+
*/
|
|
138
642
|
pinnedTop: _angular_core.Signal<GridPinnedRow<Data>[]>;
|
|
643
|
+
/**
|
|
644
|
+
* Computed array of rows pinned to the bottom of the grid.
|
|
645
|
+
*
|
|
646
|
+
* Filters pinned rows by 'bottom' position and sorts them by order property.
|
|
647
|
+
* Rows with lower order values appear first.
|
|
648
|
+
*/
|
|
139
649
|
pinnedBottom: _angular_core.Signal<GridPinnedRow<Data>[]>;
|
|
140
650
|
constructor();
|
|
651
|
+
/**
|
|
652
|
+
* Returns the computed width for a column by its key.
|
|
653
|
+
*
|
|
654
|
+
* If the column width has not been calculated, returns the default column width.
|
|
655
|
+
*
|
|
656
|
+
* @param key - The unique identifier for the column
|
|
657
|
+
* @returns Width in pixels
|
|
658
|
+
*/
|
|
141
659
|
widthByKey: (key: string) => number;
|
|
660
|
+
/**
|
|
661
|
+
* Checks if a column is pinned to the left side of the grid.
|
|
662
|
+
*
|
|
663
|
+
* @param key - The unique identifier for the column
|
|
664
|
+
* @returns `true` if the column is sticky on the left, `false` otherwise
|
|
665
|
+
*/
|
|
142
666
|
isStickyLeft: (key: string) => boolean;
|
|
667
|
+
/**
|
|
668
|
+
* Checks if a column is pinned to the right side of the grid.
|
|
669
|
+
*
|
|
670
|
+
* @param key - The unique identifier for the column
|
|
671
|
+
* @returns `true` if the column is sticky on the right, `false` otherwise
|
|
672
|
+
*/
|
|
143
673
|
isStickyRight: (key: string) => boolean;
|
|
674
|
+
/**
|
|
675
|
+
* Returns the horizontal offset for a sticky column.
|
|
676
|
+
*
|
|
677
|
+
* Calculates the distance from the specified edge (left or right) where the column
|
|
678
|
+
* should be positioned. Returns `null` if the column is not sticky in the given direction.
|
|
679
|
+
*
|
|
680
|
+
* @param key - The unique identifier for the column
|
|
681
|
+
* @param dir - The direction to check ('left' or 'right')
|
|
682
|
+
* @returns Offset in pixels, or `null` if not sticky in the specified direction
|
|
683
|
+
*/
|
|
144
684
|
stickyOffset: (key: string, dir: "left" | "right") => number | null;
|
|
685
|
+
/**
|
|
686
|
+
* Calculates and updates scrollbar state based on the current scroll position.
|
|
687
|
+
*
|
|
688
|
+
* Computes whether the scrollbar should be visible, and if so, determines
|
|
689
|
+
* the thumb height and position based on scroll height, client height, and scroll position.
|
|
690
|
+
* Updates the corresponding signal properties with the calculated values.
|
|
691
|
+
*/
|
|
145
692
|
calcScrollbar(): void;
|
|
146
693
|
private recomputeStickyOffsets;
|
|
147
694
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DataGridVm<any>, never>;
|
|
148
695
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<DataGridVm<any>>;
|
|
149
696
|
}
|
|
150
697
|
|
|
698
|
+
/**
|
|
699
|
+
* Service class for managing row selection in a data grid.
|
|
700
|
+
*
|
|
701
|
+
* Handles selection state and operations for grid rows, supporting multiple selection modes
|
|
702
|
+
* (none, single, multi). Provides reactive signals for tracking selected items and
|
|
703
|
+
* computed values for selection state.
|
|
704
|
+
*
|
|
705
|
+
* @template Data - The type of data objects in the grid, must extend `AnyDict`.
|
|
706
|
+
*
|
|
707
|
+
* @example
|
|
708
|
+
* ```typescript
|
|
709
|
+
* const selector = new Selector<User>();
|
|
710
|
+
* selector.data.set(users);
|
|
711
|
+
* selector.selection.set({ mode: 'multi', key: 'id' });
|
|
712
|
+
* selector.select(users[0]);
|
|
713
|
+
* console.log(selector.selectedKeys()); // ['user-id']
|
|
714
|
+
* ```
|
|
715
|
+
*/
|
|
151
716
|
declare class Selector<Data extends AnyDict> {
|
|
717
|
+
/**
|
|
718
|
+
* Signal containing the full dataset of grid rows.
|
|
719
|
+
*
|
|
720
|
+
* This signal holds all data items that can be selected.
|
|
721
|
+
* Defaults to an empty array.
|
|
722
|
+
*/
|
|
152
723
|
data: _angular_core.WritableSignal<Data[]>;
|
|
724
|
+
/**
|
|
725
|
+
* Signal containing the current selection configuration.
|
|
726
|
+
*
|
|
727
|
+
* Defines the selection mode and the key property used for identifying rows.
|
|
728
|
+
* Defaults to `{ mode: 'none' }` which disables selection.
|
|
729
|
+
*/
|
|
153
730
|
selection: _angular_core.WritableSignal<GridSelection>;
|
|
731
|
+
/**
|
|
732
|
+
* Signal containing the array of currently selected row keys.
|
|
733
|
+
*
|
|
734
|
+
* Stores the keys of all selected rows based on the key property
|
|
735
|
+
* defined in the selection configuration.
|
|
736
|
+
* Defaults to an empty array.
|
|
737
|
+
*/
|
|
154
738
|
selectedKeys: _angular_core.WritableSignal<DataKey<Data>[]>;
|
|
739
|
+
/**
|
|
740
|
+
* Computed signal indicating the overall selection state of all rows.
|
|
741
|
+
*
|
|
742
|
+
* Returns:
|
|
743
|
+
* - `true` if all rows are selected
|
|
744
|
+
* - `false` if no rows are selected
|
|
745
|
+
* - `'mixed'` if some but not all rows are selected
|
|
746
|
+
*
|
|
747
|
+
* Useful for implementing "select all" checkbox with indeterminate state.
|
|
748
|
+
*/
|
|
155
749
|
isAllSelected: _angular_core.Signal<boolean | "mixed">;
|
|
750
|
+
/**
|
|
751
|
+
* Checks whether a specific row is currently selected.
|
|
752
|
+
*
|
|
753
|
+
* Compares the row's key value against the list of selected keys.
|
|
754
|
+
* Returns `false` if selection mode is 'none' or key is not configured.
|
|
755
|
+
*
|
|
756
|
+
* @param row - The data row to check selection status for.
|
|
757
|
+
* @returns `true` if the row is selected, `false` otherwise.
|
|
758
|
+
*/
|
|
156
759
|
isSelected(row: Data): boolean;
|
|
760
|
+
/**
|
|
761
|
+
* Toggles selection of all rows.
|
|
762
|
+
*
|
|
763
|
+
* If all rows are selected, deselects all.
|
|
764
|
+
* If no rows or some rows are selected, selects all.
|
|
765
|
+
*
|
|
766
|
+
* This method only works in `'multi'` selection mode and throws an error
|
|
767
|
+
* if called in any other mode.
|
|
768
|
+
*
|
|
769
|
+
* @returns The updated array of selected keys.
|
|
770
|
+
* @throws {Error} If selection mode is not `'multi'`.
|
|
771
|
+
*/
|
|
157
772
|
selectAll(): DataKey<Data>[];
|
|
773
|
+
/**
|
|
774
|
+
* Selects or deselects a specific row.
|
|
775
|
+
*
|
|
776
|
+
* Behavior depends on the selection mode:
|
|
777
|
+
* - In `'single'` mode: replaces current selection with the specified row.
|
|
778
|
+
* - In `'multi'` mode: toggles the row's selection state (adds if not selected, removes if selected).
|
|
779
|
+
* - In `'none'` mode: throws an error.
|
|
780
|
+
*
|
|
781
|
+
* @param row - The data row to select or deselect.
|
|
782
|
+
* @returns The updated array of selected keys after the operation.
|
|
783
|
+
* @throws {Error} If selection mode is `'none'`.
|
|
784
|
+
*/
|
|
158
785
|
select(row: Data): (string | Data[DataKey<Data>])[];
|
|
159
786
|
}
|
|
160
787
|
|
|
788
|
+
/**
|
|
789
|
+
* Data grid component with virtual scrolling, sorting, selection, and pagination support.
|
|
790
|
+
*
|
|
791
|
+
* Provides high-performance rendering of large datasets with features like:
|
|
792
|
+
* - Virtual scrolling for efficient DOM management
|
|
793
|
+
* - Column sorting and expandable columns
|
|
794
|
+
* - Row selection (single/multiple)
|
|
795
|
+
* - Pagination modes: none, pagination, or infinite scroll
|
|
796
|
+
* - Pinned rows
|
|
797
|
+
* - Custom cell and header templates
|
|
798
|
+
*
|
|
799
|
+
* @example
|
|
800
|
+
* ```html
|
|
801
|
+
* <re-data-grid
|
|
802
|
+
* [data]="users"
|
|
803
|
+
* [columns]="columns"
|
|
804
|
+
* [selection]="{ mode: 'multiple' }"
|
|
805
|
+
* (sortChange)="onSort($event)"
|
|
806
|
+
* />
|
|
807
|
+
* ```
|
|
808
|
+
*/
|
|
161
809
|
declare class DataGrid<Data extends AnyDict> {
|
|
162
|
-
/**
|
|
810
|
+
/**
|
|
811
|
+
* Array of data to display in the table.
|
|
812
|
+
*
|
|
813
|
+
* Each item represents a single row. The component will efficiently render
|
|
814
|
+
* only visible rows using virtual scrolling.
|
|
815
|
+
*/
|
|
163
816
|
data: _angular_core.InputSignal<Data[]>;
|
|
164
|
-
/**
|
|
817
|
+
/**
|
|
818
|
+
* Column configuration for the table.
|
|
819
|
+
*
|
|
820
|
+
* Defines how each column should be rendered, sorted, and styled.
|
|
821
|
+
* Supports custom templates, sorting keys, and expandable columns.
|
|
822
|
+
*/
|
|
165
823
|
columns: _angular_core.InputSignal<GridColumn<Data>[]>;
|
|
166
|
-
/**
|
|
824
|
+
/**
|
|
825
|
+
* Pagination mode: 'none', 'pagination', or 'infinity'.
|
|
826
|
+
*
|
|
827
|
+
* - `none` - No pagination, all data is rendered
|
|
828
|
+
* - `pagination` - Classic page-based pagination with fixed page size
|
|
829
|
+
* - `infinity` - Infinite scroll mode, loads more data as user scrolls
|
|
830
|
+
*/
|
|
167
831
|
mode: _angular_core.InputSignal<GridPaginationMode>;
|
|
168
|
-
/**
|
|
832
|
+
/**
|
|
833
|
+
* Array of pinned rows that remain visible at the top or bottom.
|
|
834
|
+
*
|
|
835
|
+
* Pinned rows stay fixed while the rest of the content scrolls.
|
|
836
|
+
* Useful for totals, summaries, or always-visible items.
|
|
837
|
+
*/
|
|
169
838
|
pinnedRows: _angular_core.InputSignal<GridPinnedRow<Data>[]>;
|
|
170
|
-
/**
|
|
839
|
+
/**
|
|
840
|
+
* Whether to add an index column showing row numbers.
|
|
841
|
+
*
|
|
842
|
+
* When enabled, it automatically adds a column displaying sequential row numbers.
|
|
843
|
+
*/
|
|
171
844
|
hasIndexColumn: _angular_core.InputSignalWithTransform<boolean, string | number | undefined>;
|
|
172
|
-
/**
|
|
845
|
+
/**
|
|
846
|
+
* Row selection configuration.
|
|
847
|
+
*
|
|
848
|
+
* Controls whether users can select rows and in what mode:
|
|
849
|
+
* - `{ mode: 'none' }` - No selection
|
|
850
|
+
* - `{ mode: 'single' }` - Single row selection
|
|
851
|
+
* - `{ mode: 'multi' }` - Multiple row selection with checkboxes
|
|
852
|
+
*
|
|
853
|
+
* When selection is enabled, a `key` must be provided to identify rows.
|
|
854
|
+
*/
|
|
173
855
|
selection: _angular_core.InputSignal<GridSelection>;
|
|
174
|
-
/**
|
|
856
|
+
/**
|
|
857
|
+
* Number of items per page.
|
|
858
|
+
*
|
|
859
|
+
* Used in pagination and infinity scroll modes to control
|
|
860
|
+
* how many rows are loaded at once. Default is 20.
|
|
861
|
+
*/
|
|
175
862
|
pageSize: _angular_core.InputSignalWithTransform<number, string | number | undefined>;
|
|
176
|
-
/**
|
|
863
|
+
/**
|
|
864
|
+
* Height of each row in pixels.
|
|
865
|
+
*
|
|
866
|
+
* Used for virtual scrolling calculations. Must be consistent
|
|
867
|
+
* across all rows for accurate scrolling. Default is 40.
|
|
868
|
+
*/
|
|
177
869
|
rowHeight: _angular_core.InputSignalWithTransform<number, string | number | undefined>;
|
|
178
|
-
/**
|
|
179
|
-
|
|
180
|
-
|
|
870
|
+
/**
|
|
871
|
+
* Grid height configuration.
|
|
872
|
+
*
|
|
873
|
+
* - `number` - Fixed height in pixels
|
|
874
|
+
* - `'full'` - Fill container height (100%), can be managed by host component style
|
|
875
|
+
* - `'default'` - Height by CSS var (--re-data-grid-height)
|
|
876
|
+
*/
|
|
877
|
+
height: _angular_core.InputSignal<number | "full" | "default">;
|
|
878
|
+
/**
|
|
879
|
+
* Size of the virtual scroll buffer.
|
|
880
|
+
*
|
|
881
|
+
* Number of extra rows to render above and below the viewport
|
|
882
|
+
* to reduce flickering during fast scrolling. Default is 6.
|
|
883
|
+
*/
|
|
181
884
|
virtualBuffer: _angular_core.InputSignal<number>;
|
|
182
|
-
/**
|
|
885
|
+
/**
|
|
886
|
+
* Loading state indicator.
|
|
887
|
+
*
|
|
888
|
+
* When true, displays loading template instead of data.
|
|
889
|
+
* Useful during async data fetching operations.
|
|
890
|
+
*/
|
|
183
891
|
loading: _angular_core.InputSignalWithTransform<boolean, string | boolean | undefined>;
|
|
184
|
-
/**
|
|
892
|
+
/**
|
|
893
|
+
* Function or property name for obtaining a unique row key.
|
|
894
|
+
*
|
|
895
|
+
* Used for efficient change detection and row tracking.
|
|
896
|
+
* Can be a property name (string) or a function that returns a unique identifier.
|
|
897
|
+
*/
|
|
185
898
|
rowKey: _angular_core.InputSignal<RowKeyFn<Data> | undefined>;
|
|
186
|
-
/**
|
|
899
|
+
/**
|
|
900
|
+
* Whether to start a page count from 0 (true) or 1 (false).
|
|
901
|
+
*
|
|
902
|
+
* Controls the numbering scheme for pagination events.
|
|
903
|
+
* Default is true (0-based indexing).
|
|
904
|
+
*/
|
|
187
905
|
pageStartFromZero: _angular_core.InputSignalWithTransform<boolean, string | boolean | undefined>;
|
|
188
|
-
/**
|
|
906
|
+
/**
|
|
907
|
+
* Event emitted when requesting data for a new page.
|
|
908
|
+
*
|
|
909
|
+
* Fired in pagination and infinity scroll modes when the user navigates
|
|
910
|
+
* to a different page or scrolls near the end of current data.
|
|
911
|
+
*
|
|
912
|
+
* @example
|
|
913
|
+
* ```typescript
|
|
914
|
+
* onPageChange(event: GridPageChangeEvent) {
|
|
915
|
+
* this.loadData(event.page, event.rows);
|
|
916
|
+
* }
|
|
917
|
+
* ```
|
|
918
|
+
*/
|
|
189
919
|
pageChange: _angular_core.OutputEmitterRef<GridPageChangeEvent>;
|
|
190
|
-
/**
|
|
920
|
+
/**
|
|
921
|
+
* Event emitted when sort order changes.
|
|
922
|
+
*
|
|
923
|
+
* Fired when a user clicks on a sortable column header.
|
|
924
|
+
* Contains the sort key and direction (asc/desc).
|
|
925
|
+
*
|
|
926
|
+
* @example
|
|
927
|
+
* ```typescript
|
|
928
|
+
* onSortChange(event: GridSortEvent<User>) {
|
|
929
|
+
* this.data = sortBy(this.data, event.key, event.order);
|
|
930
|
+
* }
|
|
931
|
+
* ```
|
|
932
|
+
*/
|
|
191
933
|
sortChange: _angular_core.OutputEmitterRef<GridSortEvent<Data>>;
|
|
192
|
-
/**
|
|
934
|
+
/**
|
|
935
|
+
* Event emitted when selected rows change.
|
|
936
|
+
*
|
|
937
|
+
* Fired when a user selects or deselects rows.
|
|
938
|
+
* Contains an array of currently selected row keys.
|
|
939
|
+
*/
|
|
193
940
|
selectChange: _angular_core.OutputEmitterRef<GridSelectEvent<Data>>;
|
|
194
|
-
/**
|
|
941
|
+
/**
|
|
942
|
+
* Event emitted when a row is clicked.
|
|
943
|
+
*
|
|
944
|
+
* Contains the clicked row data and its index.
|
|
945
|
+
*/
|
|
195
946
|
rowClick: _angular_core.OutputEmitterRef<GridRowClickEvent<Data>>;
|
|
196
|
-
/**
|
|
947
|
+
/**
|
|
948
|
+
* Event emitted when a cell is clicked.
|
|
949
|
+
*
|
|
950
|
+
* Contains the clicked row, column configuration, and row index.
|
|
951
|
+
*/
|
|
197
952
|
cellClick: _angular_core.OutputEmitterRef<GridCellClickEvent<Data>>;
|
|
198
953
|
vm: DataGridVm<Data>;
|
|
199
954
|
selector: Selector<Data>;
|
|
200
955
|
private rootEl;
|
|
201
956
|
private scrollEl;
|
|
202
957
|
private headerEl;
|
|
203
|
-
private
|
|
958
|
+
private cellTypedSlotRefs;
|
|
959
|
+
private cellDataSlotRefs;
|
|
204
960
|
private headerSlotRefs;
|
|
205
961
|
private emptySlotRefs;
|
|
206
962
|
private loadingSlotRefs;
|
|
207
|
-
|
|
208
|
-
|
|
963
|
+
private sortIcSlotRefs;
|
|
964
|
+
private expanderIcSlotRefs;
|
|
965
|
+
protected emptyTpl: _angular_core.Signal<DataGridCellEmptyDirective>;
|
|
966
|
+
protected loadingTpl: _angular_core.Signal<DataGridCellLoadingDirective>;
|
|
967
|
+
protected sortTpl: _angular_core.Signal<DataGridSortIconDirective | undefined>;
|
|
968
|
+
protected expanderTpl: _angular_core.Signal<DataGridExpanderIconDirective | undefined>;
|
|
209
969
|
protected visibleRows: _angular_core.WritableSignal<Data[]>;
|
|
210
970
|
protected startIndex: number;
|
|
211
971
|
protected headerHeight: _angular_core.WritableSignal<number>;
|
|
212
972
|
protected expanderMap: _angular_core.WritableSignal<Map<DataKey<Data>, boolean>>;
|
|
213
973
|
protected extendedColumns: _angular_core.Signal<GridColumn<Data>[]>;
|
|
974
|
+
/**
|
|
975
|
+
* Computed CSS height value based on height setting.
|
|
976
|
+
*/
|
|
977
|
+
styleHeight: _angular_core.Signal<string>;
|
|
214
978
|
private hideSbTimeout?;
|
|
215
979
|
currentSortField?: string;
|
|
216
980
|
currentSortOrder: GridSortOrder;
|
|
217
981
|
private subscription;
|
|
218
982
|
private observer;
|
|
219
983
|
constructor();
|
|
220
|
-
protected get styleHeight(): string | null;
|
|
221
984
|
protected resolvePinnedData(pr: GridPinnedRow): Partial<Data>;
|
|
985
|
+
/**
|
|
986
|
+
* Handles column header click for sorting.
|
|
987
|
+
*
|
|
988
|
+
* Toggles sort order between ascending and descending for the clicked column.
|
|
989
|
+
* If a different column is clicked, it resets to ascending order.
|
|
990
|
+
* Emits sortChange event with the current sort state.
|
|
991
|
+
*
|
|
992
|
+
* @param col - Column configuration that was clicked
|
|
993
|
+
*/
|
|
222
994
|
protected onSort(col: GridColumn<Data>): void;
|
|
995
|
+
/**
|
|
996
|
+
* Handles cell click events.
|
|
997
|
+
*
|
|
998
|
+
* Emits cellClick event and handles row selection if selection mode is enabled.
|
|
999
|
+
* Updates the selection state and emits selectChange event accordingly.
|
|
1000
|
+
*
|
|
1001
|
+
* @param row - Data row that was clicked
|
|
1002
|
+
* @param col - Column configuration of the clicked cell
|
|
1003
|
+
* @param index - Row index in the dataset
|
|
1004
|
+
*/
|
|
223
1005
|
protected onCellClick(row: Data, col: GridColumn<Data>, index: number): void;
|
|
224
1006
|
protected isExpandable(column: GridColumn<Data>): boolean;
|
|
1007
|
+
/**
|
|
1008
|
+
* Handles column expand/collapse toggle.
|
|
1009
|
+
*
|
|
1010
|
+
* Toggles the expanded state of a column and updates the visibility
|
|
1011
|
+
* of all dependent columns that reference this column via expandBy property.
|
|
1012
|
+
*
|
|
1013
|
+
* @param column - Column configuration to expand or collapse
|
|
1014
|
+
*/
|
|
225
1015
|
protected onExpand(column: GridColumn<Data>): void;
|
|
1016
|
+
/**
|
|
1017
|
+
* Handles vertical scroll events and updates visible rows.
|
|
1018
|
+
*
|
|
1019
|
+
* Implements virtual scrolling by calculating which rows should be rendered
|
|
1020
|
+
* based on the current scroll position. Also handles infinite scroll data loading
|
|
1021
|
+
* when the user scrolls near the end of available data.
|
|
1022
|
+
*
|
|
1023
|
+
* @param initial - Whether this is the initial scroll calculation
|
|
1024
|
+
*/
|
|
226
1025
|
protected onVerticalScroll(initial?: boolean): void;
|
|
227
1026
|
protected onHorizontalScroll(): void;
|
|
1027
|
+
/**
|
|
1028
|
+
* Handles mouse down event on scrollbar thumb for drag scrolling.
|
|
1029
|
+
*
|
|
1030
|
+
* Initiates dragging mode and sets up mouse move/up event listeners
|
|
1031
|
+
* to track thumb position and update scroll position accordingly.
|
|
1032
|
+
* Automatically cleans up listeners when dragging ends.
|
|
1033
|
+
*
|
|
1034
|
+
* @param e - Mouse down event from a scrollbar thumb element
|
|
1035
|
+
*/
|
|
228
1036
|
protected onThumbDown(e: MouseEvent): void;
|
|
229
1037
|
protected showScrollbar(): void;
|
|
230
1038
|
protected hideScrollbarSoon(delay?: number): void;
|
|
@@ -241,9 +1049,9 @@ declare class DataGrid<Data extends AnyDict> {
|
|
|
241
1049
|
private initObserver;
|
|
242
1050
|
private initExpander;
|
|
243
1051
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<DataGrid<any>, never>;
|
|
244
|
-
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DataGrid<any>, "re-data-grid", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "pinnedRows": { "alias": "pinnedRows"; "required": false; "isSignal": true; }; "hasIndexColumn": { "alias": "hasIndexColumn"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "rowHeight": { "alias": "rowHeight"; "required": false; "isSignal": true; }; "
|
|
1052
|
+
static ɵcmp: _angular_core.ɵɵComponentDeclaration<DataGrid<any>, "re-data-grid", never, { "data": { "alias": "data"; "required": false; "isSignal": true; }; "columns": { "alias": "columns"; "required": false; "isSignal": true; }; "mode": { "alias": "mode"; "required": false; "isSignal": true; }; "pinnedRows": { "alias": "pinnedRows"; "required": false; "isSignal": true; }; "hasIndexColumn": { "alias": "hasIndexColumn"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "pageSize": { "alias": "pageSize"; "required": false; "isSignal": true; }; "rowHeight": { "alias": "rowHeight"; "required": false; "isSignal": true; }; "height": { "alias": "height"; "required": false; "isSignal": true; }; "virtualBuffer": { "alias": "virtualBuffer"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "rowKey": { "alias": "rowKey"; "required": false; "isSignal": true; }; "pageStartFromZero": { "alias": "pageStartFromZero"; "required": false; "isSignal": true; }; }, { "pageChange": "pageChange"; "sortChange": "sortChange"; "selectChange": "selectChange"; "rowClick": "rowClick"; "cellClick": "cellClick"; }, ["cellTypedSlotRefs", "cellDataSlotRefs", "headerSlotRefs", "emptySlotRefs", "loadingSlotRefs", "sortIcSlotRefs", "expanderIcSlotRefs"], never, true, never>;
|
|
245
1053
|
}
|
|
246
1054
|
|
|
247
|
-
export { DataGrid, DataGridCellEmptyDirective, DataGridCellLoadingDirective, DataGridHeaderTemplateDirective, DataGridTypeCellTemplateDirective };
|
|
1055
|
+
export { DataGrid, DataGridCellEmptyDirective, DataGridCellLoadingDirective, DataGridCellTemplateDirective, DataGridExpanderIconDirective, DataGridHeaderTemplateDirective, DataGridPaginator, DataGridSortIconDirective, DataGridTypeCellTemplateDirective };
|
|
248
1056
|
export type { GridCellClickEvent, GridCellRenderer, GridColumn, GridColumns, GridPageChangeEvent, GridPinnedRow, GridPinnedRows, GridRowClickEvent, GridSelectEvent, GridSelection, GridSortEvent };
|
|
249
1057
|
//# sourceMappingURL=reforgium-data-grid.d.ts.map
|