@toolbox-web/grid-angular 0.9.1 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -22
- package/fesm2022/toolbox-web-grid-angular-features-export.mjs +123 -4
- package/fesm2022/toolbox-web-grid-angular-features-export.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-filtering.mjs +123 -1
- package/fesm2022/toolbox-web-grid-angular-features-filtering.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-print.mjs +89 -1
- package/fesm2022/toolbox-web-grid-angular-features-print.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-selection.mjs +133 -1
- package/fesm2022/toolbox-web-grid-angular-features-selection.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular-features-undo-redo.mjs +106 -1
- package/fesm2022/toolbox-web-grid-angular-features-undo-redo.mjs.map +1 -1
- package/fesm2022/toolbox-web-grid-angular.mjs +757 -122
- package/fesm2022/toolbox-web-grid-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/types/toolbox-web-grid-angular-features-export.d.ts +113 -1
- package/types/toolbox-web-grid-angular-features-export.d.ts.map +1 -1
- package/types/toolbox-web-grid-angular-features-filtering.d.ts +120 -1
- package/types/toolbox-web-grid-angular-features-filtering.d.ts.map +1 -1
- package/types/toolbox-web-grid-angular-features-print.d.ts +91 -1
- package/types/toolbox-web-grid-angular-features-print.d.ts.map +1 -1
- package/types/toolbox-web-grid-angular-features-selection.d.ts +114 -1
- package/types/toolbox-web-grid-angular-features-selection.d.ts.map +1 -1
- package/types/toolbox-web-grid-angular-features-undo-redo.d.ts +107 -1
- package/types/toolbox-web-grid-angular-features-undo-redo.d.ts.map +1 -1
- package/types/toolbox-web-grid-angular.d.ts +419 -91
- package/types/toolbox-web-grid-angular.d.ts.map +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _angular_core from '@angular/core';
|
|
2
2
|
import { Type, EnvironmentInjector, ApplicationRef, ViewContainerRef, InjectionToken, EnvironmentProviders, Signal, TemplateRef, EventEmitter, OnInit, OnDestroy, AfterContentInit } from '@angular/core';
|
|
3
|
-
import { GridConfig, ColumnConfig, FrameworkAdapter, ColumnViewRenderer, ColumnEditorSpec,
|
|
4
|
-
import { AbstractControl,
|
|
5
|
-
import { ChangedRowsResetDetail } from '@toolbox-web/grid/plugins/editing';
|
|
3
|
+
import { GridConfig as GridConfig$1, ColumnConfig as ColumnConfig$1, FrameworkAdapter, TypeDefault as TypeDefault$1, ColumnViewRenderer, ColumnEditorSpec, GridIcons, DataGridElement, ExpandCollapseAnimation, CellClickDetail, RowClickDetail, CellActivateDetail, CellChangeDetail, SortChangeDetail, ColumnResizeDetail, GridColumnState } from '@toolbox-web/grid';
|
|
4
|
+
import { AbstractControl, FormGroup, FormArray } from '@angular/forms';
|
|
5
|
+
import { EditingConfig, ChangedRowsResetDetail } from '@toolbox-web/grid/plugins/editing';
|
|
6
6
|
import { SelectionConfig, ClipboardConfig, ContextMenuConfig, MultiSortConfig, FilterConfig, ReorderConfig, VisibilityConfig, GroupingColumnsConfig, ColumnVirtualizationConfig, RowReorderConfig, GroupingRowsConfig, PinnedRowsConfig, TreeConfig, MasterDetailConfig, ResponsivePluginConfig, UndoRedoConfig, ExportConfig, PrintConfig, PivotConfig, ServerSideConfig, FilterChangeDetail, ColumnMoveDetail, ColumnVisibilityDetail, SelectionChangeDetail, RowMoveDetail, GroupToggleDetail, TreeExpandDetail, DetailExpandDetail, ResponsiveChangeDetail, CopyDetail, PasteDetail, UndoRedoDetail, ExportCompleteDetail, PrintStartDetail, PrintCompleteDetail } from '@toolbox-web/grid/all';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -13,7 +13,7 @@ import { SelectionConfig, ClipboardConfig, ContextMenuConfig, MultiSortConfig, F
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
* Interface for
|
|
16
|
+
* Interface for cell renderer components.
|
|
17
17
|
*
|
|
18
18
|
* Renderer components receive the cell value, row data, and column config as inputs.
|
|
19
19
|
* Use Angular signal inputs for reactive updates.
|
|
@@ -21,20 +21,20 @@ import { SelectionConfig, ClipboardConfig, ContextMenuConfig, MultiSortConfig, F
|
|
|
21
21
|
* @example
|
|
22
22
|
* ```typescript
|
|
23
23
|
* import { Component, input } from '@angular/core';
|
|
24
|
-
* import type {
|
|
24
|
+
* import type { CellRenderer } from '@toolbox-web/grid-angular';
|
|
25
25
|
*
|
|
26
26
|
* @Component({
|
|
27
27
|
* selector: 'app-status-badge',
|
|
28
28
|
* template: `<span [class]="'badge-' + value()">{{ value() }}</span>`
|
|
29
29
|
* })
|
|
30
|
-
* export class StatusBadgeComponent implements
|
|
30
|
+
* export class StatusBadgeComponent implements CellRenderer<Employee, string> {
|
|
31
31
|
* value = input.required<string>();
|
|
32
32
|
* row = input.required<Employee>();
|
|
33
33
|
* column = input<unknown>();
|
|
34
34
|
* }
|
|
35
35
|
* ```
|
|
36
36
|
*/
|
|
37
|
-
interface
|
|
37
|
+
interface CellRenderer<TRow = unknown, TValue = unknown> {
|
|
38
38
|
/** The cell value - use `input<TValue>()` or `input.required<TValue>()` */
|
|
39
39
|
value: {
|
|
40
40
|
(): TValue | undefined;
|
|
@@ -49,7 +49,12 @@ interface AngularCellRenderer<TRow = unknown, TValue = unknown> {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
|
-
*
|
|
52
|
+
* @deprecated Use `CellRenderer` instead.
|
|
53
|
+
* @see {@link CellRenderer}
|
|
54
|
+
*/
|
|
55
|
+
type AngularCellRenderer<TRow = unknown, TValue = unknown> = CellRenderer<TRow, TValue>;
|
|
56
|
+
/**
|
|
57
|
+
* Interface for cell editor components.
|
|
53
58
|
*
|
|
54
59
|
* Editor components receive the cell value, row data, and column config as inputs,
|
|
55
60
|
* plus must emit `commit` and `cancel` outputs.
|
|
@@ -57,7 +62,7 @@ interface AngularCellRenderer<TRow = unknown, TValue = unknown> {
|
|
|
57
62
|
* @example
|
|
58
63
|
* ```typescript
|
|
59
64
|
* import { Component, input, output } from '@angular/core';
|
|
60
|
-
* import type {
|
|
65
|
+
* import type { CellEditor } from '@toolbox-web/grid-angular';
|
|
61
66
|
*
|
|
62
67
|
* @Component({
|
|
63
68
|
* selector: 'app-status-editor',
|
|
@@ -68,7 +73,7 @@ interface AngularCellRenderer<TRow = unknown, TValue = unknown> {
|
|
|
68
73
|
* </select>
|
|
69
74
|
* `
|
|
70
75
|
* })
|
|
71
|
-
* export class StatusEditorComponent implements
|
|
76
|
+
* export class StatusEditorComponent implements CellEditor<Employee, string> {
|
|
72
77
|
* value = input.required<string>();
|
|
73
78
|
* row = input.required<Employee>();
|
|
74
79
|
* column = input<unknown>();
|
|
@@ -77,7 +82,7 @@ interface AngularCellRenderer<TRow = unknown, TValue = unknown> {
|
|
|
77
82
|
* }
|
|
78
83
|
* ```
|
|
79
84
|
*/
|
|
80
|
-
interface
|
|
85
|
+
interface CellEditor<TRow = unknown, TValue = unknown> extends CellRenderer<TRow, TValue> {
|
|
81
86
|
/** Emit to commit the new value - use `output<TValue>()` */
|
|
82
87
|
commit: {
|
|
83
88
|
emit(value: TValue): void;
|
|
@@ -94,17 +99,59 @@ interface AngularCellEditor<TRow = unknown, TValue = unknown> extends AngularCel
|
|
|
94
99
|
};
|
|
95
100
|
}
|
|
96
101
|
/**
|
|
97
|
-
*
|
|
102
|
+
* @deprecated Use `CellEditor` instead.
|
|
103
|
+
* @see {@link CellEditor}
|
|
104
|
+
*/
|
|
105
|
+
type AngularCellEditor<TRow = unknown, TValue = unknown> = CellEditor<TRow, TValue>;
|
|
106
|
+
/**
|
|
107
|
+
* Type default configuration.
|
|
108
|
+
*
|
|
109
|
+
* Allows Angular component classes for renderers and editors in typeDefaults.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* import type { GridConfig, TypeDefault } from '@toolbox-web/grid-angular';
|
|
114
|
+
*
|
|
115
|
+
* const config: GridConfig<Employee> = {
|
|
116
|
+
* typeDefaults: {
|
|
117
|
+
* boolean: {
|
|
118
|
+
* renderer: (ctx) => { ... }, // vanilla JS renderer
|
|
119
|
+
* editor: CheckboxEditorComponent, // Angular component
|
|
120
|
+
* },
|
|
121
|
+
* date: {
|
|
122
|
+
* editor: DatePickerComponent, // Angular component
|
|
123
|
+
* }
|
|
124
|
+
* }
|
|
125
|
+
* };
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
interface TypeDefault<TRow = unknown> {
|
|
129
|
+
/** Format function for cell display */
|
|
130
|
+
format?: (value: unknown, row: TRow) => string;
|
|
131
|
+
/** Cell renderer - can be vanilla JS function or Angular component */
|
|
132
|
+
renderer?: ColumnConfig$1<TRow>['renderer'] | Type<CellRenderer<TRow, unknown>>;
|
|
133
|
+
/** Cell editor - can be vanilla JS function or Angular component */
|
|
134
|
+
editor?: ColumnConfig$1<TRow>['editor'] | Type<CellEditor<TRow, unknown>>;
|
|
135
|
+
/** Default editor parameters */
|
|
136
|
+
editorParams?: Record<string, unknown>;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* @deprecated Use `TypeDefault` instead.
|
|
140
|
+
* @see {@link TypeDefault}
|
|
141
|
+
*/
|
|
142
|
+
type AngularTypeDefault<TRow = unknown> = TypeDefault<TRow>;
|
|
143
|
+
/**
|
|
144
|
+
* Column configuration for Angular applications.
|
|
98
145
|
*
|
|
99
146
|
* Extends the base ColumnConfig to allow Angular component classes
|
|
100
147
|
* to be used directly as renderers and editors.
|
|
101
148
|
*
|
|
102
149
|
* @example
|
|
103
150
|
* ```typescript
|
|
104
|
-
* import type {
|
|
151
|
+
* import type { ColumnConfig } from '@toolbox-web/grid-angular';
|
|
105
152
|
* import { StatusBadgeComponent, StatusEditorComponent } from './components';
|
|
106
153
|
*
|
|
107
|
-
* const columns:
|
|
154
|
+
* const columns: ColumnConfig<Employee>[] = [
|
|
108
155
|
* { field: 'name', header: 'Name' },
|
|
109
156
|
* {
|
|
110
157
|
* field: 'status',
|
|
@@ -116,28 +163,51 @@ interface AngularCellEditor<TRow = unknown, TValue = unknown> extends AngularCel
|
|
|
116
163
|
* ];
|
|
117
164
|
* ```
|
|
118
165
|
*/
|
|
119
|
-
interface
|
|
166
|
+
interface ColumnConfig<TRow = unknown> extends Omit<ColumnConfig$1<TRow>, 'renderer' | 'editor'> {
|
|
120
167
|
/**
|
|
121
168
|
* Cell renderer - can be:
|
|
122
169
|
* - A function `(ctx) => HTMLElement | string`
|
|
123
|
-
* - An Angular component class implementing
|
|
170
|
+
* - An Angular component class implementing CellRenderer
|
|
124
171
|
*/
|
|
125
|
-
renderer?: ColumnConfig<TRow>['renderer'] | Type<
|
|
172
|
+
renderer?: ColumnConfig$1<TRow>['renderer'] | Type<CellRenderer<TRow, unknown>>;
|
|
126
173
|
/**
|
|
127
174
|
* Cell editor - can be:
|
|
128
175
|
* - A function `(ctx) => HTMLElement`
|
|
129
|
-
* - An Angular component class implementing
|
|
176
|
+
* - An Angular component class implementing CellEditor
|
|
130
177
|
*/
|
|
131
|
-
editor?: ColumnConfig<TRow>['editor'] | Type<
|
|
178
|
+
editor?: ColumnConfig$1<TRow>['editor'] | Type<CellEditor<TRow, unknown>>;
|
|
132
179
|
}
|
|
133
180
|
/**
|
|
134
|
-
*
|
|
181
|
+
* @deprecated Use `ColumnConfig` instead.
|
|
182
|
+
* @see {@link ColumnConfig}
|
|
183
|
+
*/
|
|
184
|
+
type AngularColumnConfig<TRow = unknown> = ColumnConfig<TRow>;
|
|
185
|
+
/**
|
|
186
|
+
* Grid configuration for Angular applications.
|
|
187
|
+
*
|
|
188
|
+
* Extends the base GridConfig to use Angular-augmented ColumnConfig and TypeDefault.
|
|
189
|
+
* This allows component classes as renderers/editors.
|
|
135
190
|
*
|
|
136
|
-
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```typescript
|
|
193
|
+
* import type { GridConfig, ColumnConfig } from '@toolbox-web/grid-angular';
|
|
194
|
+
*
|
|
195
|
+
* const config: GridConfig<Employee> = {
|
|
196
|
+
* columns: [...],
|
|
197
|
+
* plugins: [...],
|
|
198
|
+
* };
|
|
199
|
+
* ```
|
|
137
200
|
*/
|
|
138
|
-
interface
|
|
139
|
-
columns?:
|
|
201
|
+
interface GridConfig<TRow = unknown> extends Omit<GridConfig$1<TRow>, 'columns' | 'typeDefaults'> {
|
|
202
|
+
columns?: ColumnConfig<TRow>[];
|
|
203
|
+
/** Type-level defaults that can use Angular component classes */
|
|
204
|
+
typeDefaults?: Record<string, TypeDefault<TRow>>;
|
|
140
205
|
}
|
|
206
|
+
/**
|
|
207
|
+
* @deprecated Use `GridConfig` instead.
|
|
208
|
+
* @see {@link GridConfig}
|
|
209
|
+
*/
|
|
210
|
+
type AngularGridConfig<TRow = unknown> = GridConfig<TRow>;
|
|
141
211
|
/**
|
|
142
212
|
* Type guard to check if a value is an Angular component class.
|
|
143
213
|
*
|
|
@@ -160,7 +230,7 @@ declare function isComponentClass(value: unknown): value is Type<unknown>;
|
|
|
160
230
|
* ```typescript
|
|
161
231
|
* import { Component, inject, EnvironmentInjector, ApplicationRef, ViewContainerRef } from '@angular/core';
|
|
162
232
|
* import { GridElement } from '@toolbox-web/grid';
|
|
163
|
-
* import {
|
|
233
|
+
* import { GridAdapter } from '@toolbox-web/grid-angular';
|
|
164
234
|
*
|
|
165
235
|
* @Component({
|
|
166
236
|
* selector: 'app-root',
|
|
@@ -171,7 +241,7 @@ declare function isComponentClass(value: unknown): value is Type<unknown>;
|
|
|
171
241
|
* const injector = inject(EnvironmentInjector);
|
|
172
242
|
* const appRef = inject(ApplicationRef);
|
|
173
243
|
* const viewContainerRef = inject(ViewContainerRef);
|
|
174
|
-
* GridElement.registerAdapter(new
|
|
244
|
+
* GridElement.registerAdapter(new GridAdapter(injector, appRef, viewContainerRef));
|
|
175
245
|
* }
|
|
176
246
|
* }
|
|
177
247
|
* ```
|
|
@@ -210,7 +280,7 @@ declare function isComponentClass(value: unknown): value is Type<unknown>;
|
|
|
210
280
|
* - Handles editor callbacks (onCommit/onCancel)
|
|
211
281
|
* - Manages view lifecycle and change detection
|
|
212
282
|
*/
|
|
213
|
-
declare class
|
|
283
|
+
declare class GridAdapter implements FrameworkAdapter {
|
|
214
284
|
private injector;
|
|
215
285
|
private appRef;
|
|
216
286
|
private viewContainerRef;
|
|
@@ -226,9 +296,9 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
226
296
|
*
|
|
227
297
|
* @example
|
|
228
298
|
* ```typescript
|
|
229
|
-
* import {
|
|
299
|
+
* import { GridAdapter, type GridConfig } from '@toolbox-web/grid-angular';
|
|
230
300
|
*
|
|
231
|
-
* const config:
|
|
301
|
+
* const config: GridConfig<Employee> = {
|
|
232
302
|
* columns: [
|
|
233
303
|
* { field: 'status', renderer: StatusBadgeComponent, editor: StatusEditorComponent },
|
|
234
304
|
* ],
|
|
@@ -236,7 +306,7 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
236
306
|
*
|
|
237
307
|
* // In component
|
|
238
308
|
* constructor() {
|
|
239
|
-
* const adapter = inject(
|
|
309
|
+
* const adapter = inject(GridAdapter); // or create new instance
|
|
240
310
|
* this.processedConfig = adapter.processGridConfig(config);
|
|
241
311
|
* }
|
|
242
312
|
* ```
|
|
@@ -244,7 +314,15 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
244
314
|
* @param config - Angular grid configuration with possible component class references
|
|
245
315
|
* @returns Processed GridConfig with actual renderer/editor functions
|
|
246
316
|
*/
|
|
247
|
-
processGridConfig<TRow = unknown>(config:
|
|
317
|
+
processGridConfig<TRow = unknown>(config: GridConfig<TRow>): GridConfig$1<TRow>;
|
|
318
|
+
/**
|
|
319
|
+
* Processes typeDefaults configuration, converting component class references
|
|
320
|
+
* to actual renderer/editor functions.
|
|
321
|
+
*
|
|
322
|
+
* @param typeDefaults - Angular type defaults with possible component class references
|
|
323
|
+
* @returns Processed TypeDefault record
|
|
324
|
+
*/
|
|
325
|
+
processTypeDefaults<TRow = unknown>(typeDefaults: Record<string, TypeDefault<TRow>>): Record<string, TypeDefault$1<TRow>>;
|
|
248
326
|
/**
|
|
249
327
|
* Processes a single column configuration, converting component class references
|
|
250
328
|
* to actual renderer/editor functions.
|
|
@@ -252,7 +330,7 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
252
330
|
* @param column - Angular column configuration
|
|
253
331
|
* @returns Processed ColumnConfig
|
|
254
332
|
*/
|
|
255
|
-
processColumn<TRow = unknown>(column:
|
|
333
|
+
processColumn<TRow = unknown>(column: ColumnConfig<TRow>): ColumnConfig$1<TRow>;
|
|
256
334
|
/**
|
|
257
335
|
* Determines if this adapter can handle the given element.
|
|
258
336
|
* Checks if a template is registered for this element (structural or nested).
|
|
@@ -284,7 +362,7 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
284
362
|
* ```
|
|
285
363
|
* As long as the component emits `(commit)` with the new value.
|
|
286
364
|
*/
|
|
287
|
-
createEditor<TRow = unknown, TValue = unknown>(element: HTMLElement): ColumnEditorSpec<TRow, TValue
|
|
365
|
+
createEditor<TRow = unknown, TValue = unknown>(element: HTMLElement): ColumnEditorSpec<TRow, TValue> | undefined;
|
|
288
366
|
/**
|
|
289
367
|
* Creates a detail renderer function for MasterDetailPlugin.
|
|
290
368
|
* Renders Angular templates for expandable detail rows.
|
|
@@ -338,7 +416,19 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
338
416
|
* };
|
|
339
417
|
* ```
|
|
340
418
|
*/
|
|
341
|
-
getTypeDefault<TRow = unknown>(type: string): TypeDefault<TRow> | undefined;
|
|
419
|
+
getTypeDefault<TRow = unknown>(type: string): TypeDefault$1<TRow> | undefined;
|
|
420
|
+
/**
|
|
421
|
+
* Creates and mounts an Angular component dynamically.
|
|
422
|
+
* Shared logic between renderer and editor component creation.
|
|
423
|
+
* @internal
|
|
424
|
+
*/
|
|
425
|
+
private mountComponent;
|
|
426
|
+
/**
|
|
427
|
+
* Wires up commit/cancel handlers for an editor component.
|
|
428
|
+
* Supports both Angular outputs and DOM CustomEvents.
|
|
429
|
+
* @internal
|
|
430
|
+
*/
|
|
431
|
+
private wireEditorCallbacks;
|
|
342
432
|
/**
|
|
343
433
|
* Creates a renderer function from an Angular component class.
|
|
344
434
|
* @internal
|
|
@@ -366,6 +456,11 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
366
456
|
*/
|
|
367
457
|
destroy(): void;
|
|
368
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* @deprecated Use `GridAdapter` instead. This alias will be removed in a future version.
|
|
461
|
+
* @see {@link GridAdapter}
|
|
462
|
+
*/
|
|
463
|
+
declare const AngularGridAdapter: typeof GridAdapter;
|
|
369
464
|
|
|
370
465
|
/**
|
|
371
466
|
* Type-level default registry for Angular applications.
|
|
@@ -375,10 +470,20 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
375
470
|
*/
|
|
376
471
|
|
|
377
472
|
/**
|
|
378
|
-
*
|
|
379
|
-
* Uses Angular component types
|
|
473
|
+
* Type default registration configuration.
|
|
474
|
+
* Uses Angular component types for renderers/editors.
|
|
475
|
+
*
|
|
476
|
+
* @example
|
|
477
|
+
* ```typescript
|
|
478
|
+
* const defaults: Record<string, TypeDefaultRegistration> = {
|
|
479
|
+
* country: {
|
|
480
|
+
* renderer: CountryCellComponent,
|
|
481
|
+
* editor: CountryEditorComponent,
|
|
482
|
+
* },
|
|
483
|
+
* };
|
|
484
|
+
* ```
|
|
380
485
|
*/
|
|
381
|
-
interface
|
|
486
|
+
interface TypeDefaultRegistration<TRow = unknown> {
|
|
382
487
|
/** Angular component class for rendering cells of this type */
|
|
383
488
|
renderer?: Type<any>;
|
|
384
489
|
/** Angular component class for editing cells of this type */
|
|
@@ -389,7 +494,7 @@ interface AngularTypeDefault<TRow = unknown> {
|
|
|
389
494
|
/**
|
|
390
495
|
* Injection token for providing type defaults at app level.
|
|
391
496
|
*/
|
|
392
|
-
declare const GRID_TYPE_DEFAULTS: InjectionToken<Record<string,
|
|
497
|
+
declare const GRID_TYPE_DEFAULTS: InjectionToken<Record<string, TypeDefaultRegistration<unknown>>>;
|
|
393
498
|
/**
|
|
394
499
|
* Injectable service for managing type-level defaults.
|
|
395
500
|
*
|
|
@@ -435,11 +540,11 @@ declare class GridTypeRegistry {
|
|
|
435
540
|
* @param type - The type name (e.g., 'country', 'currency')
|
|
436
541
|
* @param defaults - Renderer/editor configuration
|
|
437
542
|
*/
|
|
438
|
-
register<T = unknown>(type: string, defaults:
|
|
543
|
+
register<T = unknown>(type: string, defaults: TypeDefaultRegistration<T>): void;
|
|
439
544
|
/**
|
|
440
545
|
* Get type defaults for a given type.
|
|
441
546
|
*/
|
|
442
|
-
get(type: string):
|
|
547
|
+
get(type: string): TypeDefaultRegistration | undefined;
|
|
443
548
|
/**
|
|
444
549
|
* Remove type defaults for a type.
|
|
445
550
|
*/
|
|
@@ -458,7 +563,7 @@ declare class GridTypeRegistry {
|
|
|
458
563
|
*
|
|
459
564
|
* @internal
|
|
460
565
|
*/
|
|
461
|
-
getAsTypeDefault(type: string): TypeDefault | undefined;
|
|
566
|
+
getAsTypeDefault(type: string): TypeDefault$1 | undefined;
|
|
462
567
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<GridTypeRegistry, never>;
|
|
463
568
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<GridTypeRegistry>;
|
|
464
569
|
}
|
|
@@ -482,7 +587,7 @@ declare class GridTypeRegistry {
|
|
|
482
587
|
* };
|
|
483
588
|
* ```
|
|
484
589
|
*/
|
|
485
|
-
declare function provideGridTypeDefaults(defaults: Record<string,
|
|
590
|
+
declare function provideGridTypeDefaults(defaults: Record<string, TypeDefaultRegistration>): EnvironmentProviders;
|
|
486
591
|
|
|
487
592
|
/**
|
|
488
593
|
* Icon configuration registry for Angular applications.
|
|
@@ -600,31 +705,65 @@ declare function provideGridIcons(icons: Partial<GridIcons>): EnvironmentProvide
|
|
|
600
705
|
|
|
601
706
|
/**
|
|
602
707
|
* Selection convenience methods returned from injectGrid.
|
|
708
|
+
*
|
|
709
|
+
* @deprecated These methods are deprecated and will be removed in a future version.
|
|
710
|
+
* Use `injectGridSelection()` from `@toolbox-web/grid-angular/features/selection` instead.
|
|
711
|
+
*
|
|
712
|
+
* @example
|
|
713
|
+
* ```typescript
|
|
714
|
+
* // Old (deprecated)
|
|
715
|
+
* const grid = injectGrid();
|
|
716
|
+
* grid.selectAll();
|
|
717
|
+
*
|
|
718
|
+
* // New (recommended)
|
|
719
|
+
* import { injectGridSelection } from '@toolbox-web/grid-angular/features/selection';
|
|
720
|
+
* const selection = injectGridSelection();
|
|
721
|
+
* selection.selectAll();
|
|
722
|
+
* ```
|
|
603
723
|
*/
|
|
604
724
|
interface SelectionMethods<TRow = unknown> {
|
|
605
725
|
/**
|
|
606
726
|
* Select all rows in the grid.
|
|
607
727
|
* Requires SelectionPlugin with mode: 'row'.
|
|
728
|
+
* @deprecated Use `injectGridSelection()` from `@toolbox-web/grid-angular/features/selection` instead.
|
|
608
729
|
*/
|
|
609
730
|
selectAll: () => void;
|
|
610
731
|
/**
|
|
611
732
|
* Clear all selection.
|
|
612
733
|
* Works with any SelectionPlugin mode.
|
|
734
|
+
* @deprecated Use `injectGridSelection()` from `@toolbox-web/grid-angular/features/selection` instead.
|
|
613
735
|
*/
|
|
614
736
|
clearSelection: () => void;
|
|
615
737
|
/**
|
|
616
738
|
* Get selected row indices.
|
|
617
739
|
* Returns Set of selected row indices.
|
|
740
|
+
* @deprecated Use `injectGridSelection()` from `@toolbox-web/grid-angular/features/selection` instead.
|
|
618
741
|
*/
|
|
619
742
|
getSelectedIndices: () => Set<number>;
|
|
620
743
|
/**
|
|
621
744
|
* Get selected rows data.
|
|
622
745
|
* Returns array of selected row objects.
|
|
746
|
+
* @deprecated Use `injectGridSelection()` from `@toolbox-web/grid-angular/features/selection` instead.
|
|
623
747
|
*/
|
|
624
748
|
getSelectedRows: () => TRow[];
|
|
625
749
|
}
|
|
626
750
|
/**
|
|
627
751
|
* Export convenience methods returned from injectGrid.
|
|
752
|
+
*
|
|
753
|
+
* @deprecated These methods are deprecated and will be removed in a future version.
|
|
754
|
+
* Use `injectGridExport()` from `@toolbox-web/grid-angular/features/export` instead.
|
|
755
|
+
*
|
|
756
|
+
* @example
|
|
757
|
+
* ```typescript
|
|
758
|
+
* // Old (deprecated)
|
|
759
|
+
* const grid = injectGrid();
|
|
760
|
+
* grid.exportToCsv('data.csv');
|
|
761
|
+
*
|
|
762
|
+
* // New (recommended)
|
|
763
|
+
* import { injectGridExport } from '@toolbox-web/grid-angular/features/export';
|
|
764
|
+
* const gridExport = injectGridExport();
|
|
765
|
+
* gridExport.exportToCsv('data.csv');
|
|
766
|
+
* ```
|
|
628
767
|
*/
|
|
629
768
|
interface ExportMethods {
|
|
630
769
|
/**
|
|
@@ -632,6 +771,7 @@ interface ExportMethods {
|
|
|
632
771
|
* Requires ExportPlugin to be loaded.
|
|
633
772
|
*
|
|
634
773
|
* @param filename - Optional filename (defaults to 'export.csv')
|
|
774
|
+
* @deprecated Use `injectGridExport()` from `@toolbox-web/grid-angular/features/export` instead.
|
|
635
775
|
*/
|
|
636
776
|
exportToCsv: (filename?: string) => void;
|
|
637
777
|
/**
|
|
@@ -639,11 +779,17 @@ interface ExportMethods {
|
|
|
639
779
|
* Requires ExportPlugin to be loaded.
|
|
640
780
|
*
|
|
641
781
|
* @param filename - Optional filename (defaults to 'export.json')
|
|
782
|
+
* @deprecated Use `injectGridExport()` from `@toolbox-web/grid-angular/features/export` instead.
|
|
642
783
|
*/
|
|
643
784
|
exportToJson: (filename?: string) => void;
|
|
644
785
|
}
|
|
645
786
|
/**
|
|
646
787
|
* Return type for injectGrid function.
|
|
788
|
+
*
|
|
789
|
+
* Note: Selection and export convenience methods are deprecated.
|
|
790
|
+
* Use feature-specific inject functions instead:
|
|
791
|
+
* - `injectGridSelection()` from `@toolbox-web/grid-angular/features/selection`
|
|
792
|
+
* - `injectGridExport()` from `@toolbox-web/grid-angular/features/export`
|
|
647
793
|
*/
|
|
648
794
|
interface InjectGridReturn<TRow = unknown> extends SelectionMethods<TRow>, ExportMethods {
|
|
649
795
|
/** Direct access to the typed grid element */
|
|
@@ -651,9 +797,9 @@ interface InjectGridReturn<TRow = unknown> extends SelectionMethods<TRow>, Expor
|
|
|
651
797
|
/** Whether the grid is ready */
|
|
652
798
|
isReady: Signal<boolean>;
|
|
653
799
|
/** Current grid configuration */
|
|
654
|
-
config: Signal<GridConfig<TRow> | null>;
|
|
800
|
+
config: Signal<GridConfig$1<TRow> | null>;
|
|
655
801
|
/** Get the effective configuration */
|
|
656
|
-
getConfig: () => Promise<GridConfig<TRow> | null>;
|
|
802
|
+
getConfig: () => Promise<GridConfig$1<TRow> | null>;
|
|
657
803
|
/** Force a layout recalculation */
|
|
658
804
|
forceLayout: () => Promise<void>;
|
|
659
805
|
/** Toggle a group row */
|
|
@@ -663,7 +809,7 @@ interface InjectGridReturn<TRow = unknown> extends SelectionMethods<TRow>, Expor
|
|
|
663
809
|
/** Unregister custom styles */
|
|
664
810
|
unregisterStyles: (id: string) => void;
|
|
665
811
|
/** Get current visible columns */
|
|
666
|
-
visibleColumns: Signal<ColumnConfig<TRow>[]>;
|
|
812
|
+
visibleColumns: Signal<ColumnConfig$1<TRow>[]>;
|
|
667
813
|
}
|
|
668
814
|
/**
|
|
669
815
|
* Angular inject function for programmatic access to a grid instance.
|
|
@@ -851,7 +997,7 @@ declare abstract class BaseGridEditor<TRow = unknown, TValue = unknown> {
|
|
|
851
997
|
/**
|
|
852
998
|
* The column configuration.
|
|
853
999
|
*/
|
|
854
|
-
readonly column: _angular_core.InputSignal<ColumnConfig<TRow> | undefined>;
|
|
1000
|
+
readonly column: _angular_core.InputSignal<ColumnConfig$1<TRow> | undefined>;
|
|
855
1001
|
/**
|
|
856
1002
|
* The FormControl for this cell, if the grid is bound to a FormArray.
|
|
857
1003
|
* When provided, the editor uses control.value instead of the value input.
|
|
@@ -1282,10 +1428,13 @@ declare function getFormArrayContext(gridElement: HTMLElement): FormArrayContext
|
|
|
1282
1428
|
*/
|
|
1283
1429
|
declare class GridFormArray implements OnInit, OnDestroy {
|
|
1284
1430
|
#private;
|
|
1431
|
+
private readonly destroyRef;
|
|
1285
1432
|
private elementRef;
|
|
1286
1433
|
private cellCommitListener;
|
|
1287
1434
|
private rowCommitListener;
|
|
1288
1435
|
private touchListener;
|
|
1436
|
+
private valueChangesSubscription;
|
|
1437
|
+
private statusChangesSubscriptions;
|
|
1289
1438
|
/**
|
|
1290
1439
|
* The FormArray to bind to the grid.
|
|
1291
1440
|
*/
|
|
@@ -1297,12 +1446,14 @@ declare class GridFormArray implements OnInit, OnDestroy {
|
|
|
1297
1446
|
* - After a cell commit, if the FormControl is invalid, the cell is marked with `setInvalid()`
|
|
1298
1447
|
* - When a FormControl becomes valid, `clearInvalid()` is called
|
|
1299
1448
|
* - On `row-commit`, if the row's FormGroup has invalid controls, the commit is prevented
|
|
1449
|
+
* - In grid mode: validation state is synced on initial render and updated reactively
|
|
1300
1450
|
*
|
|
1301
1451
|
* @default true
|
|
1302
1452
|
*/
|
|
1303
1453
|
readonly syncValidation: _angular_core.InputSignal<boolean>;
|
|
1304
1454
|
/**
|
|
1305
|
-
* Effect that
|
|
1455
|
+
* Effect that sets up valueChanges subscription when FormArray changes.
|
|
1456
|
+
* This handles both initial binding and when the FormArray reference changes.
|
|
1306
1457
|
*/
|
|
1307
1458
|
private syncFormArrayToGrid;
|
|
1308
1459
|
ngOnInit(): void;
|
|
@@ -1311,6 +1462,190 @@ declare class GridFormArray implements OnInit, OnDestroy {
|
|
|
1311
1462
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<GridFormArray, "tbw-grid[formArray]", never, { "formArray": { "alias": "formArray"; "required": true; "isSignal": true; }; "syncValidation": { "alias": "syncValidation"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
|
|
1312
1463
|
}
|
|
1313
1464
|
|
|
1465
|
+
/**
|
|
1466
|
+
* Gets the FormArrayContext from a grid element, if present.
|
|
1467
|
+
* @internal
|
|
1468
|
+
*/
|
|
1469
|
+
declare function getLazyFormContext(gridElement: HTMLElement): FormArrayContext | undefined;
|
|
1470
|
+
/**
|
|
1471
|
+
* Factory function type for creating FormGroups lazily.
|
|
1472
|
+
* Called when a row enters edit mode for the first time.
|
|
1473
|
+
*
|
|
1474
|
+
* @template TRow The row data type
|
|
1475
|
+
* @param row The row data object
|
|
1476
|
+
* @param rowIndex The row index in the grid
|
|
1477
|
+
* @returns A FormGroup for the row (only include editable fields)
|
|
1478
|
+
*/
|
|
1479
|
+
type LazyFormFactory<TRow = unknown> = (row: TRow, rowIndex: number) => FormGroup;
|
|
1480
|
+
/**
|
|
1481
|
+
* Event emitted when a row's form values have changed.
|
|
1482
|
+
*/
|
|
1483
|
+
interface RowFormChangeEvent<TRow = unknown> {
|
|
1484
|
+
/** The row index */
|
|
1485
|
+
rowIndex: number;
|
|
1486
|
+
/** The row ID (if available) */
|
|
1487
|
+
rowId?: string;
|
|
1488
|
+
/** The original row data */
|
|
1489
|
+
row: TRow;
|
|
1490
|
+
/** The FormGroup for this row */
|
|
1491
|
+
formGroup: FormGroup;
|
|
1492
|
+
/** The current form values */
|
|
1493
|
+
values: Partial<TRow>;
|
|
1494
|
+
/** Whether the form is valid */
|
|
1495
|
+
valid: boolean;
|
|
1496
|
+
/** Whether the form is dirty */
|
|
1497
|
+
dirty: boolean;
|
|
1498
|
+
}
|
|
1499
|
+
/**
|
|
1500
|
+
* Directive that provides lazy FormGroup creation for grid editing.
|
|
1501
|
+
*
|
|
1502
|
+
* Unlike `GridFormArray` which creates all FormGroups upfront, this directive
|
|
1503
|
+
* creates FormGroups on-demand only when a row enters edit mode. This provides
|
|
1504
|
+
* much better performance for large datasets while still enabling full
|
|
1505
|
+
* Angular Reactive Forms integration.
|
|
1506
|
+
*
|
|
1507
|
+
* ## Key Benefits
|
|
1508
|
+
*
|
|
1509
|
+
* - **Performance**: Only creates FormGroups for rows being edited (20-100x fewer controls)
|
|
1510
|
+
* - **Same DX**: Editors still receive `control` in their context for validation
|
|
1511
|
+
* - **Memory efficient**: FormGroups are cleaned up when rows exit edit mode
|
|
1512
|
+
*
|
|
1513
|
+
* ## Usage
|
|
1514
|
+
*
|
|
1515
|
+
* ```typescript
|
|
1516
|
+
* import { Component, inject, signal } from '@angular/core';
|
|
1517
|
+
* import { FormBuilder, Validators, ReactiveFormsModule } from '@angular/forms';
|
|
1518
|
+
* import { Grid, GridLazyForm, TbwEditor } from '@toolbox-web/grid-angular';
|
|
1519
|
+
*
|
|
1520
|
+
* @Component({
|
|
1521
|
+
* imports: [Grid, GridLazyForm, TbwEditor, ReactiveFormsModule],
|
|
1522
|
+
* template: \`
|
|
1523
|
+
* <tbw-grid
|
|
1524
|
+
* [rows]="employees()"
|
|
1525
|
+
* [lazyForm]="createRowForm"
|
|
1526
|
+
* [gridConfig]="config">
|
|
1527
|
+
*
|
|
1528
|
+
* <tbw-grid-column field="firstName">
|
|
1529
|
+
* <input *tbwEditor="let _; control as ctrl"
|
|
1530
|
+
* [formControl]="ctrl"
|
|
1531
|
+
* [class.is-invalid]="ctrl?.invalid && ctrl?.touched" />
|
|
1532
|
+
* </tbw-grid-column>
|
|
1533
|
+
* </tbw-grid>
|
|
1534
|
+
* \`
|
|
1535
|
+
* })
|
|
1536
|
+
* export class MyComponent {
|
|
1537
|
+
* private fb = inject(FormBuilder);
|
|
1538
|
+
* employees = signal(generateEmployees(1000));
|
|
1539
|
+
*
|
|
1540
|
+
* // Factory called when editing starts - only include editable fields!
|
|
1541
|
+
* createRowForm = (row: Employee): FormGroup => this.fb.group({
|
|
1542
|
+
* firstName: [row.firstName, Validators.required],
|
|
1543
|
+
* lastName: [row.lastName, Validators.minLength(2)],
|
|
1544
|
+
* salary: [row.salary, [Validators.required, Validators.min(0)]],
|
|
1545
|
+
* });
|
|
1546
|
+
*
|
|
1547
|
+
* gridConfig = { columns: [...] };
|
|
1548
|
+
* }
|
|
1549
|
+
* ```
|
|
1550
|
+
*
|
|
1551
|
+
* ## How It Works
|
|
1552
|
+
*
|
|
1553
|
+
* 1. Rows come from `[rows]` input (plain data array)
|
|
1554
|
+
* 2. When a cell enters edit mode, the FormGroup is created lazily
|
|
1555
|
+
* 3. Editors receive the FormControl in their template context
|
|
1556
|
+
* 4. On commit, FormGroup values are synced back to the row
|
|
1557
|
+
* 5. FormGroup is cleaned up when the row exits edit mode (configurable)
|
|
1558
|
+
*
|
|
1559
|
+
* ## Performance Comparison
|
|
1560
|
+
*
|
|
1561
|
+
* | Rows | GridFormArray (20 fields) | GridLazyForm |
|
|
1562
|
+
* |------|---------------------------|--------------|
|
|
1563
|
+
* | 100 | 2,000 controls | ~20 controls |
|
|
1564
|
+
* | 500 | 10,000 controls | ~20 controls |
|
|
1565
|
+
* | 1000 | 20,000 controls | ~20 controls |
|
|
1566
|
+
*
|
|
1567
|
+
* @see GridFormArray For small datasets with full upfront validation
|
|
1568
|
+
*/
|
|
1569
|
+
declare class GridLazyForm<TRow = unknown> implements OnInit, OnDestroy {
|
|
1570
|
+
#private;
|
|
1571
|
+
private elementRef;
|
|
1572
|
+
private formGroupCache;
|
|
1573
|
+
private rowIndexMap;
|
|
1574
|
+
private editingRowIndex;
|
|
1575
|
+
private cellCommitListener;
|
|
1576
|
+
private rowCommitListener;
|
|
1577
|
+
private rowsChangeListener;
|
|
1578
|
+
/**
|
|
1579
|
+
* Factory function to create a FormGroup for a row.
|
|
1580
|
+
* Called lazily when the row first enters edit mode.
|
|
1581
|
+
*
|
|
1582
|
+
* @example
|
|
1583
|
+
* ```typescript
|
|
1584
|
+
* createRowForm = (row: Employee): FormGroup => this.fb.group({
|
|
1585
|
+
* firstName: [row.firstName, Validators.required],
|
|
1586
|
+
* lastName: [row.lastName],
|
|
1587
|
+
* salary: [row.salary, [Validators.min(0)]],
|
|
1588
|
+
* });
|
|
1589
|
+
* ```
|
|
1590
|
+
*/
|
|
1591
|
+
readonly lazyForm: _angular_core.InputSignal<LazyFormFactory<TRow>>;
|
|
1592
|
+
/**
|
|
1593
|
+
* Whether to automatically sync Angular validation state to grid's visual invalid styling.
|
|
1594
|
+
*
|
|
1595
|
+
* When enabled:
|
|
1596
|
+
* - After a cell commit, if the FormControl is invalid, the cell is marked with `setInvalid()`
|
|
1597
|
+
* - When a FormControl becomes valid, `clearInvalid()` is called
|
|
1598
|
+
* - On `row-commit`, if the row's FormGroup has invalid controls, the commit is prevented
|
|
1599
|
+
*
|
|
1600
|
+
* @default true
|
|
1601
|
+
*/
|
|
1602
|
+
readonly syncValidation: _angular_core.InputSignal<boolean>;
|
|
1603
|
+
/**
|
|
1604
|
+
* Whether to keep FormGroups cached after a row exits edit mode.
|
|
1605
|
+
*
|
|
1606
|
+
* - `true`: FormGroups are kept, preserving dirty/touched state across edit sessions
|
|
1607
|
+
* - `false`: FormGroups are disposed when the row exits edit mode (default)
|
|
1608
|
+
*
|
|
1609
|
+
* @default false
|
|
1610
|
+
*/
|
|
1611
|
+
readonly keepFormGroups: _angular_core.InputSignal<boolean>;
|
|
1612
|
+
/**
|
|
1613
|
+
* Emitted when a row's form values change.
|
|
1614
|
+
* Useful for auto-save, validation display, or syncing to external state.
|
|
1615
|
+
*/
|
|
1616
|
+
readonly rowFormChange: _angular_core.OutputEmitterRef<RowFormChangeEvent<TRow>>;
|
|
1617
|
+
ngOnInit(): void;
|
|
1618
|
+
ngOnDestroy(): void;
|
|
1619
|
+
/**
|
|
1620
|
+
* Gets the FormGroup for a row, if it exists.
|
|
1621
|
+
* Unlike the context methods, this does NOT create a FormGroup lazily.
|
|
1622
|
+
*
|
|
1623
|
+
* @param rowIndex The row index
|
|
1624
|
+
* @returns The FormGroup or undefined
|
|
1625
|
+
*/
|
|
1626
|
+
getFormGroup(rowIndex: number): FormGroup | undefined;
|
|
1627
|
+
/**
|
|
1628
|
+
* Gets all cached FormGroups.
|
|
1629
|
+
* Useful for bulk validation or inspection.
|
|
1630
|
+
*
|
|
1631
|
+
* @returns Map of row objects to their FormGroups
|
|
1632
|
+
*/
|
|
1633
|
+
getAllFormGroups(): ReadonlyMap<TRow, FormGroup>;
|
|
1634
|
+
/**
|
|
1635
|
+
* Clears all cached FormGroups.
|
|
1636
|
+
* Useful when the underlying data changes significantly.
|
|
1637
|
+
*/
|
|
1638
|
+
clearAllFormGroups(): void;
|
|
1639
|
+
/**
|
|
1640
|
+
* Validates all currently cached FormGroups.
|
|
1641
|
+
*
|
|
1642
|
+
* @returns true if all FormGroups are valid, false otherwise
|
|
1643
|
+
*/
|
|
1644
|
+
validateAll(): boolean;
|
|
1645
|
+
static ɵfac: _angular_core.ɵɵFactoryDeclaration<GridLazyForm<any>, never>;
|
|
1646
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<GridLazyForm<any>, "tbw-grid[lazyForm]", never, { "lazyForm": { "alias": "lazyForm"; "required": true; "isSignal": true; }; "syncValidation": { "alias": "syncValidation"; "required": false; "isSignal": true; }; "keepFormGroups": { "alias": "keepFormGroups"; "required": false; "isSignal": true; }; }, { "rowFormChange": "rowFormChange"; }, never, never, true, never>;
|
|
1647
|
+
}
|
|
1648
|
+
|
|
1314
1649
|
/**
|
|
1315
1650
|
* Context object passed to the responsive card template.
|
|
1316
1651
|
*
|
|
@@ -1539,7 +1874,7 @@ interface RowCommitEvent<TRow = unknown> {
|
|
|
1539
1874
|
* ```
|
|
1540
1875
|
*
|
|
1541
1876
|
* The directive automatically:
|
|
1542
|
-
* - Creates
|
|
1877
|
+
* - Creates a GridAdapter instance
|
|
1543
1878
|
* - Registers it with the GridElement
|
|
1544
1879
|
* - Injects custom styles into the grid
|
|
1545
1880
|
* - Handles cleanup on destruction
|
|
@@ -1660,55 +1995,30 @@ declare class Grid implements OnInit, AfterContentInit, OnDestroy {
|
|
|
1660
1995
|
*/
|
|
1661
1996
|
loading: _angular_core.InputSignal<boolean | undefined>;
|
|
1662
1997
|
/**
|
|
1663
|
-
*
|
|
1998
|
+
* Grid configuration object with optional Angular-specific extensions.
|
|
1664
1999
|
*
|
|
1665
|
-
*
|
|
1666
|
-
*
|
|
1667
|
-
* but allows the directive to properly merge feature plugins and config overrides.
|
|
2000
|
+
* Accepts Angular-augmented `GridConfig` from `@toolbox-web/grid-angular`.
|
|
2001
|
+
* You can specify Angular component classes directly for renderers and editors.
|
|
1668
2002
|
*
|
|
1669
|
-
*
|
|
2003
|
+
* Component classes must implement the appropriate interfaces:
|
|
2004
|
+
* - Renderers: `CellRenderer<TRow, TValue>` - requires `value()` and `row()` signal inputs
|
|
2005
|
+
* - Editors: `CellEditor<TRow, TValue>` - adds `commit` and `cancel` outputs
|
|
1670
2006
|
*
|
|
1671
2007
|
* @example
|
|
1672
2008
|
* ```typescript
|
|
2009
|
+
* // Simple config with plain renderers
|
|
1673
2010
|
* config: GridConfig = {
|
|
2011
|
+
* columns: [
|
|
2012
|
+
* { field: 'name', header: 'Name' },
|
|
2013
|
+
* { field: 'active', type: 'boolean' }
|
|
2014
|
+
* ],
|
|
1674
2015
|
* typeDefaults: {
|
|
1675
2016
|
* boolean: { renderer: (ctx) => ctx.value ? '✓' : '✗' }
|
|
1676
2017
|
* }
|
|
1677
2018
|
* };
|
|
1678
|
-
* columns = [
|
|
1679
|
-
* { field: 'active', type: 'boolean' }
|
|
1680
|
-
* ];
|
|
1681
|
-
* ```
|
|
1682
|
-
*
|
|
1683
|
-
* ```html
|
|
1684
|
-
* <tbw-grid [gridConfig]="config" [columns]="columns" />
|
|
1685
|
-
* ```
|
|
1686
|
-
*/
|
|
1687
|
-
gridConfig: _angular_core.InputSignal<any>;
|
|
1688
|
-
/**
|
|
1689
|
-
* Angular-specific grid configuration that supports component classes for renderers/editors.
|
|
1690
|
-
*
|
|
1691
|
-
* Use this input when you want to specify Angular component classes directly in column configs.
|
|
1692
|
-
* Components must implement the appropriate interfaces:
|
|
1693
|
-
* - Renderers: `AngularCellRenderer<TRow, TValue>` - requires `value()` and `row()` signal inputs
|
|
1694
|
-
* - Editors: `AngularCellEditor<TRow, TValue>` - adds `commit` and `cancel` outputs
|
|
1695
|
-
*
|
|
1696
|
-
* The directive automatically processes component classes and converts them to grid-compatible
|
|
1697
|
-
* renderer/editor functions before applying to the grid.
|
|
1698
|
-
*
|
|
1699
|
-
* @example
|
|
1700
|
-
* ```typescript
|
|
1701
|
-
* // Component that implements AngularCellEditor
|
|
1702
|
-
* @Component({...})
|
|
1703
|
-
* export class BonusEditorComponent implements AngularCellEditor<Employee, number> {
|
|
1704
|
-
* value = input.required<number>();
|
|
1705
|
-
* row = input.required<Employee>();
|
|
1706
|
-
* commit = output<number>();
|
|
1707
|
-
* cancel = output<void>();
|
|
1708
|
-
* }
|
|
1709
2019
|
*
|
|
1710
|
-
* //
|
|
1711
|
-
* config:
|
|
2020
|
+
* // Config with component classes
|
|
2021
|
+
* config: GridConfig<Employee> = {
|
|
1712
2022
|
* columns: [
|
|
1713
2023
|
* { field: 'name', header: 'Name' },
|
|
1714
2024
|
* { field: 'bonus', header: 'Bonus', editable: true, editor: BonusEditorComponent }
|
|
@@ -1717,10 +2027,25 @@ declare class Grid implements OnInit, AfterContentInit, OnDestroy {
|
|
|
1717
2027
|
* ```
|
|
1718
2028
|
*
|
|
1719
2029
|
* ```html
|
|
1720
|
-
* <tbw-grid [
|
|
2030
|
+
* <tbw-grid [gridConfig]="config" [rows]="employees"></tbw-grid>
|
|
2031
|
+
* ```
|
|
2032
|
+
*/
|
|
2033
|
+
gridConfig: _angular_core.InputSignal<GridConfig<any> | undefined>;
|
|
2034
|
+
/**
|
|
2035
|
+
* @deprecated Use `gridConfig` instead. This input will be removed in a future version.
|
|
2036
|
+
*
|
|
2037
|
+
* The `angularConfig` name was inconsistent with React and Vue adapters, which both use `gridConfig`.
|
|
2038
|
+
* The `gridConfig` input now accepts `GridConfig` directly.
|
|
2039
|
+
*
|
|
2040
|
+
* ```html
|
|
2041
|
+
* <!-- Before -->
|
|
2042
|
+
* <tbw-grid [angularConfig]="config" />
|
|
2043
|
+
*
|
|
2044
|
+
* <!-- After -->
|
|
2045
|
+
* <tbw-grid [gridConfig]="config" />
|
|
1721
2046
|
* ```
|
|
1722
2047
|
*/
|
|
1723
|
-
angularConfig: _angular_core.InputSignal<
|
|
2048
|
+
angularConfig: _angular_core.InputSignal<GridConfig<any> | undefined>;
|
|
1724
2049
|
/**
|
|
1725
2050
|
* Enable cell/row/range selection.
|
|
1726
2051
|
*
|
|
@@ -1756,9 +2081,12 @@ declare class Grid implements OnInit, AfterContentInit, OnDestroy {
|
|
|
1756
2081
|
* <tbw-grid [editing]="'click'" />
|
|
1757
2082
|
* <tbw-grid [editing]="'dblclick'" />
|
|
1758
2083
|
* <tbw-grid [editing]="'manual'" />
|
|
2084
|
+
*
|
|
2085
|
+
* <!-- Full config with callbacks -->
|
|
2086
|
+
* <tbw-grid [editing]="{ editOn: 'dblclick', onBeforeEditClose: myCallback }" />
|
|
1759
2087
|
* ```
|
|
1760
2088
|
*/
|
|
1761
|
-
editing: _angular_core.InputSignal<boolean | "click" | "dblclick" | "manual" | undefined>;
|
|
2089
|
+
editing: _angular_core.InputSignal<boolean | "click" | "dblclick" | "manual" | EditingConfig | undefined>;
|
|
1762
2090
|
/**
|
|
1763
2091
|
* Enable clipboard copy/paste. Requires selection to be enabled.
|
|
1764
2092
|
*
|
|
@@ -2333,7 +2661,7 @@ declare class Grid implements OnInit, AfterContentInit, OnDestroy {
|
|
|
2333
2661
|
private configureResponsiveCard;
|
|
2334
2662
|
ngOnDestroy(): void;
|
|
2335
2663
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<Grid, never>;
|
|
2336
|
-
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Grid, "tbw-grid", never, { "customStyles": { "alias": "customStyles"; "required": false; "isSignal": true; }; "sortable": { "alias": "sortable"; "required": false; "isSignal": true; }; "filterable": { "alias": "filterable"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "gridConfig": { "alias": "gridConfig"; "required": false; "isSignal": true; }; "angularConfig": { "alias": "angularConfig"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "editing": { "alias": "editing"; "required": false; "isSignal": true; }; "clipboard": { "alias": "clipboard"; "required": false; "isSignal": true; }; "contextMenu": { "alias": "contextMenu"; "required": false; "isSignal": true; }; "multiSort": { "alias": "multiSort"; "required": false; "isSignal": true; }; "sorting": { "alias": "sorting"; "required": false; "isSignal": true; }; "filtering": { "alias": "filtering"; "required": false; "isSignal": true; }; "reorder": { "alias": "reorder"; "required": false; "isSignal": true; }; "visibility": { "alias": "visibility"; "required": false; "isSignal": true; }; "pinnedColumns": { "alias": "pinnedColumns"; "required": false; "isSignal": true; }; "groupingColumns": { "alias": "groupingColumns"; "required": false; "isSignal": true; }; "columnVirtualization": { "alias": "columnVirtualization"; "required": false; "isSignal": true; }; "rowReorder": { "alias": "rowReorder"; "required": false; "isSignal": true; }; "groupingRows": { "alias": "groupingRows"; "required": false; "isSignal": true; }; "pinnedRows": { "alias": "pinnedRows"; "required": false; "isSignal": true; }; "tree": { "alias": "tree"; "required": false; "isSignal": true; }; "masterDetail": { "alias": "masterDetail"; "required": false; "isSignal": true; }; "responsive": { "alias": "responsive"; "required": false; "isSignal": true; }; "undoRedo": { "alias": "undoRedo"; "required": false; "isSignal": true; }; "exportFeature": { "alias": "
|
|
2664
|
+
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<Grid, "tbw-grid", never, { "customStyles": { "alias": "customStyles"; "required": false; "isSignal": true; }; "sortable": { "alias": "sortable"; "required": false; "isSignal": true; }; "filterable": { "alias": "filterable"; "required": false; "isSignal": true; }; "selectable": { "alias": "selectable"; "required": false; "isSignal": true; }; "loading": { "alias": "loading"; "required": false; "isSignal": true; }; "gridConfig": { "alias": "gridConfig"; "required": false; "isSignal": true; }; "angularConfig": { "alias": "angularConfig"; "required": false; "isSignal": true; }; "selection": { "alias": "selection"; "required": false; "isSignal": true; }; "editing": { "alias": "editing"; "required": false; "isSignal": true; }; "clipboard": { "alias": "clipboard"; "required": false; "isSignal": true; }; "contextMenu": { "alias": "contextMenu"; "required": false; "isSignal": true; }; "multiSort": { "alias": "multiSort"; "required": false; "isSignal": true; }; "sorting": { "alias": "sorting"; "required": false; "isSignal": true; }; "filtering": { "alias": "filtering"; "required": false; "isSignal": true; }; "reorder": { "alias": "reorder"; "required": false; "isSignal": true; }; "visibility": { "alias": "visibility"; "required": false; "isSignal": true; }; "pinnedColumns": { "alias": "pinnedColumns"; "required": false; "isSignal": true; }; "groupingColumns": { "alias": "groupingColumns"; "required": false; "isSignal": true; }; "columnVirtualization": { "alias": "columnVirtualization"; "required": false; "isSignal": true; }; "rowReorder": { "alias": "rowReorder"; "required": false; "isSignal": true; }; "groupingRows": { "alias": "groupingRows"; "required": false; "isSignal": true; }; "pinnedRows": { "alias": "pinnedRows"; "required": false; "isSignal": true; }; "tree": { "alias": "tree"; "required": false; "isSignal": true; }; "masterDetail": { "alias": "masterDetail"; "required": false; "isSignal": true; }; "responsive": { "alias": "responsive"; "required": false; "isSignal": true; }; "undoRedo": { "alias": "undoRedo"; "required": false; "isSignal": true; }; "exportFeature": { "alias": "export"; "required": false; "isSignal": true; }; "print": { "alias": "print"; "required": false; "isSignal": true; }; "pivot": { "alias": "pivot"; "required": false; "isSignal": true; }; "serverSide": { "alias": "serverSide"; "required": false; "isSignal": true; }; }, { "cellClick": "cellClick"; "rowClick": "rowClick"; "cellActivate": "cellActivate"; "cellChange": "cellChange"; "cellCommit": "cellCommit"; "rowCommit": "rowCommit"; "changedRowsReset": "changedRowsReset"; "sortChange": "sortChange"; "filterChange": "filterChange"; "columnResize": "columnResize"; "columnMove": "columnMove"; "columnVisibility": "columnVisibility"; "columnStateChange": "columnStateChange"; "selectionChange": "selectionChange"; "rowMove": "rowMove"; "groupToggle": "groupToggle"; "treeExpand": "treeExpand"; "detailExpand": "detailExpand"; "responsiveChange": "responsiveChange"; "copy": "copy"; "paste": "paste"; "undoRedoAction": "undoRedoAction"; "exportComplete": "exportComplete"; "printStart": "printStart"; "printComplete": "printComplete"; }, never, never, true, never>;
|
|
2337
2665
|
}
|
|
2338
2666
|
|
|
2339
2667
|
/**
|
|
@@ -2502,6 +2830,6 @@ declare class TbwEditor implements OnDestroy {
|
|
|
2502
2830
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TbwEditor, "[tbwEditor]", never, {}, {}, never, never, true, never>;
|
|
2503
2831
|
}
|
|
2504
2832
|
|
|
2505
|
-
export { AngularGridAdapter, BaseGridEditor, GRID_ICONS, GRID_TYPE_DEFAULTS, Grid, GridColumnEditor, GridColumnView, GridDetailView, GridFormArray, GridIconRegistry, GridResponsiveCard, GridToolPanel, GridTypeRegistry, TbwEditor as TbwCellEditor, TbwRenderer as TbwCellView, TbwEditor, TbwRenderer, clearFeatureRegistry, createPluginFromFeature, getFeatureFactory, getFormArrayContext, getRegisteredFeatures, injectGrid, isComponentClass, isFeatureRegistered, provideGridIcons, provideGridTypeDefaults, registerFeature };
|
|
2506
|
-
export type { AngularCellEditor, AngularCellRenderer, AngularColumnConfig, AngularGridConfig, AngularTypeDefault, CellCommitEvent, ExportMethods, FeatureName, FormArrayContext, GridCellContext, GridDetailContext, GridEditorContext, GridResponsiveCardContext, GridToolPanelContext, InjectGridReturn, PluginFactory, RowCommitEvent, SelectionMethods, StructuralCellContext, StructuralEditorContext };
|
|
2833
|
+
export { AngularGridAdapter, BaseGridEditor, GRID_ICONS, GRID_TYPE_DEFAULTS, Grid, GridAdapter, GridColumnEditor, GridColumnView, GridDetailView, GridFormArray, GridIconRegistry, GridLazyForm, GridResponsiveCard, GridToolPanel, GridTypeRegistry, TbwEditor as TbwCellEditor, TbwRenderer as TbwCellView, TbwEditor, TbwRenderer, clearFeatureRegistry, createPluginFromFeature, getFeatureFactory, getFormArrayContext, getLazyFormContext, getRegisteredFeatures, injectGrid, isComponentClass, isFeatureRegistered, provideGridIcons, provideGridTypeDefaults, registerFeature };
|
|
2834
|
+
export type { AngularCellEditor, AngularCellRenderer, AngularColumnConfig, AngularGridConfig, AngularTypeDefault, CellCommitEvent, CellEditor, CellRenderer, ColumnConfig, ExportMethods, FeatureName, FormArrayContext, GridCellContext, GridConfig, GridDetailContext, GridEditorContext, GridResponsiveCardContext, GridToolPanelContext, InjectGridReturn, LazyFormFactory, PluginFactory, RowCommitEvent, RowFormChangeEvent, SelectionMethods, StructuralCellContext, StructuralEditorContext, TypeDefault, TypeDefaultRegistration };
|
|
2507
2835
|
//# sourceMappingURL=toolbox-web-grid-angular.d.ts.map
|