@toolbox-web/grid-angular 0.10.0 → 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 +649 -64
- 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 +383 -115
- package/types/toolbox-web-grid-angular.d.ts.map +1 -1
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import * as _toolbox_web_grid from '@toolbox-web/grid';
|
|
2
|
-
import { GridConfig, ColumnConfig, FrameworkAdapter, ColumnViewRenderer, ColumnEditorSpec, TypeDefault, GridIcons, DataGridElement, ExpandCollapseAnimation, CellClickDetail, RowClickDetail, CellActivateDetail, CellChangeDetail, SortChangeDetail, ColumnResizeDetail, GridColumnState } from '@toolbox-web/grid';
|
|
3
1
|
import * as _angular_core from '@angular/core';
|
|
4
2
|
import { Type, EnvironmentInjector, ApplicationRef, ViewContainerRef, InjectionToken, EnvironmentProviders, Signal, TemplateRef, EventEmitter, OnInit, OnDestroy, AfterContentInit } from '@angular/core';
|
|
5
|
-
import {
|
|
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';
|
|
6
5
|
import { EditingConfig, ChangedRowsResetDetail } from '@toolbox-web/grid/plugins/editing';
|
|
7
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';
|
|
8
7
|
|
|
@@ -14,7 +13,7 @@ import { SelectionConfig, ClipboardConfig, ContextMenuConfig, MultiSortConfig, F
|
|
|
14
13
|
*/
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
|
-
* Interface for
|
|
16
|
+
* Interface for cell renderer components.
|
|
18
17
|
*
|
|
19
18
|
* Renderer components receive the cell value, row data, and column config as inputs.
|
|
20
19
|
* Use Angular signal inputs for reactive updates.
|
|
@@ -22,20 +21,20 @@ import { SelectionConfig, ClipboardConfig, ContextMenuConfig, MultiSortConfig, F
|
|
|
22
21
|
* @example
|
|
23
22
|
* ```typescript
|
|
24
23
|
* import { Component, input } from '@angular/core';
|
|
25
|
-
* import type {
|
|
24
|
+
* import type { CellRenderer } from '@toolbox-web/grid-angular';
|
|
26
25
|
*
|
|
27
26
|
* @Component({
|
|
28
27
|
* selector: 'app-status-badge',
|
|
29
28
|
* template: `<span [class]="'badge-' + value()">{{ value() }}</span>`
|
|
30
29
|
* })
|
|
31
|
-
* export class StatusBadgeComponent implements
|
|
30
|
+
* export class StatusBadgeComponent implements CellRenderer<Employee, string> {
|
|
32
31
|
* value = input.required<string>();
|
|
33
32
|
* row = input.required<Employee>();
|
|
34
33
|
* column = input<unknown>();
|
|
35
34
|
* }
|
|
36
35
|
* ```
|
|
37
36
|
*/
|
|
38
|
-
interface
|
|
37
|
+
interface CellRenderer<TRow = unknown, TValue = unknown> {
|
|
39
38
|
/** The cell value - use `input<TValue>()` or `input.required<TValue>()` */
|
|
40
39
|
value: {
|
|
41
40
|
(): TValue | undefined;
|
|
@@ -50,7 +49,12 @@ interface AngularCellRenderer<TRow = unknown, TValue = unknown> {
|
|
|
50
49
|
};
|
|
51
50
|
}
|
|
52
51
|
/**
|
|
53
|
-
*
|
|
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.
|
|
54
58
|
*
|
|
55
59
|
* Editor components receive the cell value, row data, and column config as inputs,
|
|
56
60
|
* plus must emit `commit` and `cancel` outputs.
|
|
@@ -58,7 +62,7 @@ interface AngularCellRenderer<TRow = unknown, TValue = unknown> {
|
|
|
58
62
|
* @example
|
|
59
63
|
* ```typescript
|
|
60
64
|
* import { Component, input, output } from '@angular/core';
|
|
61
|
-
* import type {
|
|
65
|
+
* import type { CellEditor } from '@toolbox-web/grid-angular';
|
|
62
66
|
*
|
|
63
67
|
* @Component({
|
|
64
68
|
* selector: 'app-status-editor',
|
|
@@ -69,7 +73,7 @@ interface AngularCellRenderer<TRow = unknown, TValue = unknown> {
|
|
|
69
73
|
* </select>
|
|
70
74
|
* `
|
|
71
75
|
* })
|
|
72
|
-
* export class StatusEditorComponent implements
|
|
76
|
+
* export class StatusEditorComponent implements CellEditor<Employee, string> {
|
|
73
77
|
* value = input.required<string>();
|
|
74
78
|
* row = input.required<Employee>();
|
|
75
79
|
* column = input<unknown>();
|
|
@@ -78,7 +82,7 @@ interface AngularCellRenderer<TRow = unknown, TValue = unknown> {
|
|
|
78
82
|
* }
|
|
79
83
|
* ```
|
|
80
84
|
*/
|
|
81
|
-
interface
|
|
85
|
+
interface CellEditor<TRow = unknown, TValue = unknown> extends CellRenderer<TRow, TValue> {
|
|
82
86
|
/** Emit to commit the new value - use `output<TValue>()` */
|
|
83
87
|
commit: {
|
|
84
88
|
emit(value: TValue): void;
|
|
@@ -95,17 +99,59 @@ interface AngularCellEditor<TRow = unknown, TValue = unknown> extends AngularCel
|
|
|
95
99
|
};
|
|
96
100
|
}
|
|
97
101
|
/**
|
|
98
|
-
*
|
|
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.
|
|
99
145
|
*
|
|
100
146
|
* Extends the base ColumnConfig to allow Angular component classes
|
|
101
147
|
* to be used directly as renderers and editors.
|
|
102
148
|
*
|
|
103
149
|
* @example
|
|
104
150
|
* ```typescript
|
|
105
|
-
* import type {
|
|
151
|
+
* import type { ColumnConfig } from '@toolbox-web/grid-angular';
|
|
106
152
|
* import { StatusBadgeComponent, StatusEditorComponent } from './components';
|
|
107
153
|
*
|
|
108
|
-
* const columns:
|
|
154
|
+
* const columns: ColumnConfig<Employee>[] = [
|
|
109
155
|
* { field: 'name', header: 'Name' },
|
|
110
156
|
* {
|
|
111
157
|
* field: 'status',
|
|
@@ -117,61 +163,51 @@ interface AngularCellEditor<TRow = unknown, TValue = unknown> extends AngularCel
|
|
|
117
163
|
* ];
|
|
118
164
|
* ```
|
|
119
165
|
*/
|
|
120
|
-
interface
|
|
166
|
+
interface ColumnConfig<TRow = unknown> extends Omit<ColumnConfig$1<TRow>, 'renderer' | 'editor'> {
|
|
121
167
|
/**
|
|
122
168
|
* Cell renderer - can be:
|
|
123
169
|
* - A function `(ctx) => HTMLElement | string`
|
|
124
|
-
* - An Angular component class implementing
|
|
170
|
+
* - An Angular component class implementing CellRenderer
|
|
125
171
|
*/
|
|
126
|
-
renderer?: ColumnConfig<TRow>['renderer'] | Type<
|
|
172
|
+
renderer?: ColumnConfig$1<TRow>['renderer'] | Type<CellRenderer<TRow, unknown>>;
|
|
127
173
|
/**
|
|
128
174
|
* Cell editor - can be:
|
|
129
175
|
* - A function `(ctx) => HTMLElement`
|
|
130
|
-
* - An Angular component class implementing
|
|
176
|
+
* - An Angular component class implementing CellEditor
|
|
131
177
|
*/
|
|
132
|
-
editor?: ColumnConfig<TRow>['editor'] | Type<
|
|
178
|
+
editor?: ColumnConfig$1<TRow>['editor'] | Type<CellEditor<TRow, unknown>>;
|
|
133
179
|
}
|
|
134
180
|
/**
|
|
135
|
-
*
|
|
181
|
+
* @deprecated Use `ColumnConfig` instead.
|
|
182
|
+
* @see {@link ColumnConfig}
|
|
183
|
+
*/
|
|
184
|
+
type AngularColumnConfig<TRow = unknown> = ColumnConfig<TRow>;
|
|
185
|
+
/**
|
|
186
|
+
* Grid configuration for Angular applications.
|
|
136
187
|
*
|
|
137
|
-
* Extends the base
|
|
138
|
-
*
|
|
188
|
+
* Extends the base GridConfig to use Angular-augmented ColumnConfig and TypeDefault.
|
|
189
|
+
* This allows component classes as renderers/editors.
|
|
139
190
|
*
|
|
140
191
|
* @example
|
|
141
192
|
* ```typescript
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
* },
|
|
148
|
-
* date: {
|
|
149
|
-
* editor: DatePickerComponent, // Angular component
|
|
150
|
-
* }
|
|
151
|
-
* }
|
|
193
|
+
* import type { GridConfig, ColumnConfig } from '@toolbox-web/grid-angular';
|
|
194
|
+
*
|
|
195
|
+
* const config: GridConfig<Employee> = {
|
|
196
|
+
* columns: [...],
|
|
197
|
+
* plugins: [...],
|
|
152
198
|
* };
|
|
153
199
|
* ```
|
|
154
200
|
*/
|
|
155
|
-
interface
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
renderer?: ColumnConfig<TRow>['renderer'] | Type<AngularCellRenderer<TRow, unknown>>;
|
|
160
|
-
/** Cell editor - can be vanilla JS function or Angular component */
|
|
161
|
-
editor?: ColumnConfig<TRow>['editor'] | Type<AngularCellEditor<TRow, unknown>>;
|
|
162
|
-
/** Default editor parameters */
|
|
163
|
-
editorParams?: Record<string, unknown>;
|
|
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>>;
|
|
164
205
|
}
|
|
165
206
|
/**
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* Extends the base GridConfig to use AngularColumnConfig and AngularTypeDefault.
|
|
207
|
+
* @deprecated Use `GridConfig` instead.
|
|
208
|
+
* @see {@link GridConfig}
|
|
169
209
|
*/
|
|
170
|
-
|
|
171
|
-
columns?: AngularColumnConfig<TRow>[];
|
|
172
|
-
/** Type-level defaults that can use Angular component classes */
|
|
173
|
-
typeDefaults?: Record<string, AngularTypeDefault$1<TRow>>;
|
|
174
|
-
}
|
|
210
|
+
type AngularGridConfig<TRow = unknown> = GridConfig<TRow>;
|
|
175
211
|
/**
|
|
176
212
|
* Type guard to check if a value is an Angular component class.
|
|
177
213
|
*
|
|
@@ -194,7 +230,7 @@ declare function isComponentClass(value: unknown): value is Type<unknown>;
|
|
|
194
230
|
* ```typescript
|
|
195
231
|
* import { Component, inject, EnvironmentInjector, ApplicationRef, ViewContainerRef } from '@angular/core';
|
|
196
232
|
* import { GridElement } from '@toolbox-web/grid';
|
|
197
|
-
* import {
|
|
233
|
+
* import { GridAdapter } from '@toolbox-web/grid-angular';
|
|
198
234
|
*
|
|
199
235
|
* @Component({
|
|
200
236
|
* selector: 'app-root',
|
|
@@ -205,7 +241,7 @@ declare function isComponentClass(value: unknown): value is Type<unknown>;
|
|
|
205
241
|
* const injector = inject(EnvironmentInjector);
|
|
206
242
|
* const appRef = inject(ApplicationRef);
|
|
207
243
|
* const viewContainerRef = inject(ViewContainerRef);
|
|
208
|
-
* GridElement.registerAdapter(new
|
|
244
|
+
* GridElement.registerAdapter(new GridAdapter(injector, appRef, viewContainerRef));
|
|
209
245
|
* }
|
|
210
246
|
* }
|
|
211
247
|
* ```
|
|
@@ -244,7 +280,7 @@ declare function isComponentClass(value: unknown): value is Type<unknown>;
|
|
|
244
280
|
* - Handles editor callbacks (onCommit/onCancel)
|
|
245
281
|
* - Manages view lifecycle and change detection
|
|
246
282
|
*/
|
|
247
|
-
declare class
|
|
283
|
+
declare class GridAdapter implements FrameworkAdapter {
|
|
248
284
|
private injector;
|
|
249
285
|
private appRef;
|
|
250
286
|
private viewContainerRef;
|
|
@@ -260,9 +296,9 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
260
296
|
*
|
|
261
297
|
* @example
|
|
262
298
|
* ```typescript
|
|
263
|
-
* import {
|
|
299
|
+
* import { GridAdapter, type GridConfig } from '@toolbox-web/grid-angular';
|
|
264
300
|
*
|
|
265
|
-
* const config:
|
|
301
|
+
* const config: GridConfig<Employee> = {
|
|
266
302
|
* columns: [
|
|
267
303
|
* { field: 'status', renderer: StatusBadgeComponent, editor: StatusEditorComponent },
|
|
268
304
|
* ],
|
|
@@ -270,7 +306,7 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
270
306
|
*
|
|
271
307
|
* // In component
|
|
272
308
|
* constructor() {
|
|
273
|
-
* const adapter = inject(
|
|
309
|
+
* const adapter = inject(GridAdapter); // or create new instance
|
|
274
310
|
* this.processedConfig = adapter.processGridConfig(config);
|
|
275
311
|
* }
|
|
276
312
|
* ```
|
|
@@ -278,7 +314,7 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
278
314
|
* @param config - Angular grid configuration with possible component class references
|
|
279
315
|
* @returns Processed GridConfig with actual renderer/editor functions
|
|
280
316
|
*/
|
|
281
|
-
processGridConfig<TRow = unknown>(config:
|
|
317
|
+
processGridConfig<TRow = unknown>(config: GridConfig<TRow>): GridConfig$1<TRow>;
|
|
282
318
|
/**
|
|
283
319
|
* Processes typeDefaults configuration, converting component class references
|
|
284
320
|
* to actual renderer/editor functions.
|
|
@@ -286,7 +322,7 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
286
322
|
* @param typeDefaults - Angular type defaults with possible component class references
|
|
287
323
|
* @returns Processed TypeDefault record
|
|
288
324
|
*/
|
|
289
|
-
processTypeDefaults<TRow = unknown>(typeDefaults: Record<string,
|
|
325
|
+
processTypeDefaults<TRow = unknown>(typeDefaults: Record<string, TypeDefault<TRow>>): Record<string, TypeDefault$1<TRow>>;
|
|
290
326
|
/**
|
|
291
327
|
* Processes a single column configuration, converting component class references
|
|
292
328
|
* to actual renderer/editor functions.
|
|
@@ -294,7 +330,7 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
294
330
|
* @param column - Angular column configuration
|
|
295
331
|
* @returns Processed ColumnConfig
|
|
296
332
|
*/
|
|
297
|
-
processColumn<TRow = unknown>(column:
|
|
333
|
+
processColumn<TRow = unknown>(column: ColumnConfig<TRow>): ColumnConfig$1<TRow>;
|
|
298
334
|
/**
|
|
299
335
|
* Determines if this adapter can handle the given element.
|
|
300
336
|
* Checks if a template is registered for this element (structural or nested).
|
|
@@ -380,7 +416,7 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
380
416
|
* };
|
|
381
417
|
* ```
|
|
382
418
|
*/
|
|
383
|
-
getTypeDefault<TRow = unknown>(type: string): TypeDefault<TRow> | undefined;
|
|
419
|
+
getTypeDefault<TRow = unknown>(type: string): TypeDefault$1<TRow> | undefined;
|
|
384
420
|
/**
|
|
385
421
|
* Creates and mounts an Angular component dynamically.
|
|
386
422
|
* Shared logic between renderer and editor component creation.
|
|
@@ -420,6 +456,11 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
420
456
|
*/
|
|
421
457
|
destroy(): void;
|
|
422
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;
|
|
423
464
|
|
|
424
465
|
/**
|
|
425
466
|
* Type-level default registry for Angular applications.
|
|
@@ -429,10 +470,20 @@ declare class AngularGridAdapter implements FrameworkAdapter {
|
|
|
429
470
|
*/
|
|
430
471
|
|
|
431
472
|
/**
|
|
432
|
-
*
|
|
433
|
-
* 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
|
+
* ```
|
|
434
485
|
*/
|
|
435
|
-
interface
|
|
486
|
+
interface TypeDefaultRegistration<TRow = unknown> {
|
|
436
487
|
/** Angular component class for rendering cells of this type */
|
|
437
488
|
renderer?: Type<any>;
|
|
438
489
|
/** Angular component class for editing cells of this type */
|
|
@@ -443,7 +494,7 @@ interface AngularTypeDefault<TRow = unknown> {
|
|
|
443
494
|
/**
|
|
444
495
|
* Injection token for providing type defaults at app level.
|
|
445
496
|
*/
|
|
446
|
-
declare const GRID_TYPE_DEFAULTS: InjectionToken<Record<string,
|
|
497
|
+
declare const GRID_TYPE_DEFAULTS: InjectionToken<Record<string, TypeDefaultRegistration<unknown>>>;
|
|
447
498
|
/**
|
|
448
499
|
* Injectable service for managing type-level defaults.
|
|
449
500
|
*
|
|
@@ -489,11 +540,11 @@ declare class GridTypeRegistry {
|
|
|
489
540
|
* @param type - The type name (e.g., 'country', 'currency')
|
|
490
541
|
* @param defaults - Renderer/editor configuration
|
|
491
542
|
*/
|
|
492
|
-
register<T = unknown>(type: string, defaults:
|
|
543
|
+
register<T = unknown>(type: string, defaults: TypeDefaultRegistration<T>): void;
|
|
493
544
|
/**
|
|
494
545
|
* Get type defaults for a given type.
|
|
495
546
|
*/
|
|
496
|
-
get(type: string):
|
|
547
|
+
get(type: string): TypeDefaultRegistration | undefined;
|
|
497
548
|
/**
|
|
498
549
|
* Remove type defaults for a type.
|
|
499
550
|
*/
|
|
@@ -512,7 +563,7 @@ declare class GridTypeRegistry {
|
|
|
512
563
|
*
|
|
513
564
|
* @internal
|
|
514
565
|
*/
|
|
515
|
-
getAsTypeDefault(type: string): TypeDefault | undefined;
|
|
566
|
+
getAsTypeDefault(type: string): TypeDefault$1 | undefined;
|
|
516
567
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<GridTypeRegistry, never>;
|
|
517
568
|
static ɵprov: _angular_core.ɵɵInjectableDeclaration<GridTypeRegistry>;
|
|
518
569
|
}
|
|
@@ -536,7 +587,7 @@ declare class GridTypeRegistry {
|
|
|
536
587
|
* };
|
|
537
588
|
* ```
|
|
538
589
|
*/
|
|
539
|
-
declare function provideGridTypeDefaults(defaults: Record<string,
|
|
590
|
+
declare function provideGridTypeDefaults(defaults: Record<string, TypeDefaultRegistration>): EnvironmentProviders;
|
|
540
591
|
|
|
541
592
|
/**
|
|
542
593
|
* Icon configuration registry for Angular applications.
|
|
@@ -654,31 +705,65 @@ declare function provideGridIcons(icons: Partial<GridIcons>): EnvironmentProvide
|
|
|
654
705
|
|
|
655
706
|
/**
|
|
656
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
|
+
* ```
|
|
657
723
|
*/
|
|
658
724
|
interface SelectionMethods<TRow = unknown> {
|
|
659
725
|
/**
|
|
660
726
|
* Select all rows in the grid.
|
|
661
727
|
* Requires SelectionPlugin with mode: 'row'.
|
|
728
|
+
* @deprecated Use `injectGridSelection()` from `@toolbox-web/grid-angular/features/selection` instead.
|
|
662
729
|
*/
|
|
663
730
|
selectAll: () => void;
|
|
664
731
|
/**
|
|
665
732
|
* Clear all selection.
|
|
666
733
|
* Works with any SelectionPlugin mode.
|
|
734
|
+
* @deprecated Use `injectGridSelection()` from `@toolbox-web/grid-angular/features/selection` instead.
|
|
667
735
|
*/
|
|
668
736
|
clearSelection: () => void;
|
|
669
737
|
/**
|
|
670
738
|
* Get selected row indices.
|
|
671
739
|
* Returns Set of selected row indices.
|
|
740
|
+
* @deprecated Use `injectGridSelection()` from `@toolbox-web/grid-angular/features/selection` instead.
|
|
672
741
|
*/
|
|
673
742
|
getSelectedIndices: () => Set<number>;
|
|
674
743
|
/**
|
|
675
744
|
* Get selected rows data.
|
|
676
745
|
* Returns array of selected row objects.
|
|
746
|
+
* @deprecated Use `injectGridSelection()` from `@toolbox-web/grid-angular/features/selection` instead.
|
|
677
747
|
*/
|
|
678
748
|
getSelectedRows: () => TRow[];
|
|
679
749
|
}
|
|
680
750
|
/**
|
|
681
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
|
+
* ```
|
|
682
767
|
*/
|
|
683
768
|
interface ExportMethods {
|
|
684
769
|
/**
|
|
@@ -686,6 +771,7 @@ interface ExportMethods {
|
|
|
686
771
|
* Requires ExportPlugin to be loaded.
|
|
687
772
|
*
|
|
688
773
|
* @param filename - Optional filename (defaults to 'export.csv')
|
|
774
|
+
* @deprecated Use `injectGridExport()` from `@toolbox-web/grid-angular/features/export` instead.
|
|
689
775
|
*/
|
|
690
776
|
exportToCsv: (filename?: string) => void;
|
|
691
777
|
/**
|
|
@@ -693,11 +779,17 @@ interface ExportMethods {
|
|
|
693
779
|
* Requires ExportPlugin to be loaded.
|
|
694
780
|
*
|
|
695
781
|
* @param filename - Optional filename (defaults to 'export.json')
|
|
782
|
+
* @deprecated Use `injectGridExport()` from `@toolbox-web/grid-angular/features/export` instead.
|
|
696
783
|
*/
|
|
697
784
|
exportToJson: (filename?: string) => void;
|
|
698
785
|
}
|
|
699
786
|
/**
|
|
700
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`
|
|
701
793
|
*/
|
|
702
794
|
interface InjectGridReturn<TRow = unknown> extends SelectionMethods<TRow>, ExportMethods {
|
|
703
795
|
/** Direct access to the typed grid element */
|
|
@@ -705,9 +797,9 @@ interface InjectGridReturn<TRow = unknown> extends SelectionMethods<TRow>, Expor
|
|
|
705
797
|
/** Whether the grid is ready */
|
|
706
798
|
isReady: Signal<boolean>;
|
|
707
799
|
/** Current grid configuration */
|
|
708
|
-
config: Signal<GridConfig<TRow> | null>;
|
|
800
|
+
config: Signal<GridConfig$1<TRow> | null>;
|
|
709
801
|
/** Get the effective configuration */
|
|
710
|
-
getConfig: () => Promise<GridConfig<TRow> | null>;
|
|
802
|
+
getConfig: () => Promise<GridConfig$1<TRow> | null>;
|
|
711
803
|
/** Force a layout recalculation */
|
|
712
804
|
forceLayout: () => Promise<void>;
|
|
713
805
|
/** Toggle a group row */
|
|
@@ -717,7 +809,7 @@ interface InjectGridReturn<TRow = unknown> extends SelectionMethods<TRow>, Expor
|
|
|
717
809
|
/** Unregister custom styles */
|
|
718
810
|
unregisterStyles: (id: string) => void;
|
|
719
811
|
/** Get current visible columns */
|
|
720
|
-
visibleColumns: Signal<ColumnConfig<TRow>[]>;
|
|
812
|
+
visibleColumns: Signal<ColumnConfig$1<TRow>[]>;
|
|
721
813
|
}
|
|
722
814
|
/**
|
|
723
815
|
* Angular inject function for programmatic access to a grid instance.
|
|
@@ -905,7 +997,7 @@ declare abstract class BaseGridEditor<TRow = unknown, TValue = unknown> {
|
|
|
905
997
|
/**
|
|
906
998
|
* The column configuration.
|
|
907
999
|
*/
|
|
908
|
-
readonly column: _angular_core.InputSignal<ColumnConfig<TRow> | undefined>;
|
|
1000
|
+
readonly column: _angular_core.InputSignal<ColumnConfig$1<TRow> | undefined>;
|
|
909
1001
|
/**
|
|
910
1002
|
* The FormControl for this cell, if the grid is bound to a FormArray.
|
|
911
1003
|
* When provided, the editor uses control.value instead of the value input.
|
|
@@ -1342,6 +1434,7 @@ declare class GridFormArray implements OnInit, OnDestroy {
|
|
|
1342
1434
|
private rowCommitListener;
|
|
1343
1435
|
private touchListener;
|
|
1344
1436
|
private valueChangesSubscription;
|
|
1437
|
+
private statusChangesSubscriptions;
|
|
1345
1438
|
/**
|
|
1346
1439
|
* The FormArray to bind to the grid.
|
|
1347
1440
|
*/
|
|
@@ -1353,6 +1446,7 @@ declare class GridFormArray implements OnInit, OnDestroy {
|
|
|
1353
1446
|
* - After a cell commit, if the FormControl is invalid, the cell is marked with `setInvalid()`
|
|
1354
1447
|
* - When a FormControl becomes valid, `clearInvalid()` is called
|
|
1355
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
|
|
1356
1450
|
*
|
|
1357
1451
|
* @default true
|
|
1358
1452
|
*/
|
|
@@ -1368,6 +1462,190 @@ declare class GridFormArray implements OnInit, OnDestroy {
|
|
|
1368
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>;
|
|
1369
1463
|
}
|
|
1370
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
|
+
|
|
1371
1649
|
/**
|
|
1372
1650
|
* Context object passed to the responsive card template.
|
|
1373
1651
|
*
|
|
@@ -1596,7 +1874,7 @@ interface RowCommitEvent<TRow = unknown> {
|
|
|
1596
1874
|
* ```
|
|
1597
1875
|
*
|
|
1598
1876
|
* The directive automatically:
|
|
1599
|
-
* - Creates
|
|
1877
|
+
* - Creates a GridAdapter instance
|
|
1600
1878
|
* - Registers it with the GridElement
|
|
1601
1879
|
* - Injects custom styles into the grid
|
|
1602
1880
|
* - Handles cleanup on destruction
|
|
@@ -1717,55 +1995,30 @@ declare class Grid implements OnInit, AfterContentInit, OnDestroy {
|
|
|
1717
1995
|
*/
|
|
1718
1996
|
loading: _angular_core.InputSignal<boolean | undefined>;
|
|
1719
1997
|
/**
|
|
1720
|
-
*
|
|
1998
|
+
* Grid configuration object with optional Angular-specific extensions.
|
|
1721
1999
|
*
|
|
1722
|
-
*
|
|
1723
|
-
*
|
|
1724
|
-
* 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.
|
|
1725
2002
|
*
|
|
1726
|
-
*
|
|
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
|
|
1727
2006
|
*
|
|
1728
2007
|
* @example
|
|
1729
2008
|
* ```typescript
|
|
2009
|
+
* // Simple config with plain renderers
|
|
1730
2010
|
* config: GridConfig = {
|
|
2011
|
+
* columns: [
|
|
2012
|
+
* { field: 'name', header: 'Name' },
|
|
2013
|
+
* { field: 'active', type: 'boolean' }
|
|
2014
|
+
* ],
|
|
1731
2015
|
* typeDefaults: {
|
|
1732
2016
|
* boolean: { renderer: (ctx) => ctx.value ? '✓' : '✗' }
|
|
1733
2017
|
* }
|
|
1734
2018
|
* };
|
|
1735
|
-
* columns = [
|
|
1736
|
-
* { field: 'active', type: 'boolean' }
|
|
1737
|
-
* ];
|
|
1738
|
-
* ```
|
|
1739
|
-
*
|
|
1740
|
-
* ```html
|
|
1741
|
-
* <tbw-grid [gridConfig]="config" [columns]="columns" />
|
|
1742
|
-
* ```
|
|
1743
|
-
*/
|
|
1744
|
-
gridConfig: _angular_core.InputSignal<any>;
|
|
1745
|
-
/**
|
|
1746
|
-
* Angular-specific grid configuration that supports component classes for renderers/editors.
|
|
1747
|
-
*
|
|
1748
|
-
* Use this input when you want to specify Angular component classes directly in column configs.
|
|
1749
|
-
* Components must implement the appropriate interfaces:
|
|
1750
|
-
* - Renderers: `AngularCellRenderer<TRow, TValue>` - requires `value()` and `row()` signal inputs
|
|
1751
|
-
* - Editors: `AngularCellEditor<TRow, TValue>` - adds `commit` and `cancel` outputs
|
|
1752
|
-
*
|
|
1753
|
-
* The directive automatically processes component classes and converts them to grid-compatible
|
|
1754
|
-
* renderer/editor functions before applying to the grid.
|
|
1755
2019
|
*
|
|
1756
|
-
*
|
|
1757
|
-
*
|
|
1758
|
-
* // Component that implements AngularCellEditor
|
|
1759
|
-
* @Component({...})
|
|
1760
|
-
* export class BonusEditorComponent implements AngularCellEditor<Employee, number> {
|
|
1761
|
-
* value = input.required<number>();
|
|
1762
|
-
* row = input.required<Employee>();
|
|
1763
|
-
* commit = output<number>();
|
|
1764
|
-
* cancel = output<void>();
|
|
1765
|
-
* }
|
|
1766
|
-
*
|
|
1767
|
-
* // In your grid config
|
|
1768
|
-
* config: AngularGridConfig<Employee> = {
|
|
2020
|
+
* // Config with component classes
|
|
2021
|
+
* config: GridConfig<Employee> = {
|
|
1769
2022
|
* columns: [
|
|
1770
2023
|
* { field: 'name', header: 'Name' },
|
|
1771
2024
|
* { field: 'bonus', header: 'Bonus', editable: true, editor: BonusEditorComponent }
|
|
@@ -1774,10 +2027,25 @@ declare class Grid implements OnInit, AfterContentInit, OnDestroy {
|
|
|
1774
2027
|
* ```
|
|
1775
2028
|
*
|
|
1776
2029
|
* ```html
|
|
1777
|
-
* <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" />
|
|
1778
2046
|
* ```
|
|
1779
2047
|
*/
|
|
1780
|
-
angularConfig: _angular_core.InputSignal<
|
|
2048
|
+
angularConfig: _angular_core.InputSignal<GridConfig<any> | undefined>;
|
|
1781
2049
|
/**
|
|
1782
2050
|
* Enable cell/row/range selection.
|
|
1783
2051
|
*
|
|
@@ -2393,7 +2661,7 @@ declare class Grid implements OnInit, AfterContentInit, OnDestroy {
|
|
|
2393
2661
|
private configureResponsiveCard;
|
|
2394
2662
|
ngOnDestroy(): void;
|
|
2395
2663
|
static ɵfac: _angular_core.ɵɵFactoryDeclaration<Grid, never>;
|
|
2396
|
-
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>;
|
|
2397
2665
|
}
|
|
2398
2666
|
|
|
2399
2667
|
/**
|
|
@@ -2562,6 +2830,6 @@ declare class TbwEditor implements OnDestroy {
|
|
|
2562
2830
|
static ɵdir: _angular_core.ɵɵDirectiveDeclaration<TbwEditor, "[tbwEditor]", never, {}, {}, never, never, true, never>;
|
|
2563
2831
|
}
|
|
2564
2832
|
|
|
2565
|
-
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 };
|
|
2566
|
-
export type { AngularCellEditor, AngularCellRenderer, AngularColumnConfig, AngularGridConfig, AngularTypeDefault
|
|
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 };
|
|
2567
2835
|
//# sourceMappingURL=toolbox-web-grid-angular.d.ts.map
|