@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.
Files changed (26) hide show
  1. package/README.md +28 -22
  2. package/fesm2022/toolbox-web-grid-angular-features-export.mjs +123 -4
  3. package/fesm2022/toolbox-web-grid-angular-features-export.mjs.map +1 -1
  4. package/fesm2022/toolbox-web-grid-angular-features-filtering.mjs +123 -1
  5. package/fesm2022/toolbox-web-grid-angular-features-filtering.mjs.map +1 -1
  6. package/fesm2022/toolbox-web-grid-angular-features-print.mjs +89 -1
  7. package/fesm2022/toolbox-web-grid-angular-features-print.mjs.map +1 -1
  8. package/fesm2022/toolbox-web-grid-angular-features-selection.mjs +133 -1
  9. package/fesm2022/toolbox-web-grid-angular-features-selection.mjs.map +1 -1
  10. package/fesm2022/toolbox-web-grid-angular-features-undo-redo.mjs +106 -1
  11. package/fesm2022/toolbox-web-grid-angular-features-undo-redo.mjs.map +1 -1
  12. package/fesm2022/toolbox-web-grid-angular.mjs +757 -122
  13. package/fesm2022/toolbox-web-grid-angular.mjs.map +1 -1
  14. package/package.json +1 -1
  15. package/types/toolbox-web-grid-angular-features-export.d.ts +113 -1
  16. package/types/toolbox-web-grid-angular-features-export.d.ts.map +1 -1
  17. package/types/toolbox-web-grid-angular-features-filtering.d.ts +120 -1
  18. package/types/toolbox-web-grid-angular-features-filtering.d.ts.map +1 -1
  19. package/types/toolbox-web-grid-angular-features-print.d.ts +91 -1
  20. package/types/toolbox-web-grid-angular-features-print.d.ts.map +1 -1
  21. package/types/toolbox-web-grid-angular-features-selection.d.ts +114 -1
  22. package/types/toolbox-web-grid-angular-features-selection.d.ts.map +1 -1
  23. package/types/toolbox-web-grid-angular-features-undo-redo.d.ts +107 -1
  24. package/types/toolbox-web-grid-angular-features-undo-redo.d.ts.map +1 -1
  25. package/types/toolbox-web-grid-angular.d.ts +419 -91
  26. package/types/toolbox-web-grid-angular.d.ts.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toolbox-web/grid-angular",
3
- "version": "0.9.1",
3
+ "version": "0.11.0",
4
4
  "description": "Angular adapter for @toolbox-web/grid data grid component",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -1,3 +1,115 @@
1
+ import { Signal } from '@angular/core';
2
+ import { ExportParams, ExportFormat } from '@toolbox-web/grid/plugins/export';
1
3
 
2
- export { };
4
+ /**
5
+ * Export feature for @toolbox-web/grid-angular
6
+ *
7
+ * Import this module to enable the `export` input on Grid directive.
8
+ * Also exports `injectGridExport()` for programmatic export control.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import '@toolbox-web/grid-angular/features/export';
13
+ *
14
+ * <tbw-grid [export]="true" />
15
+ * <tbw-grid [export]="{ fileName: 'data.csv' }" />
16
+ * ```
17
+ *
18
+ * @example Using injectGridExport
19
+ * ```typescript
20
+ * import { injectGridExport } from '@toolbox-web/grid-angular/features/export';
21
+ *
22
+ * @Component({...})
23
+ * export class MyComponent {
24
+ * private gridExport = injectGridExport();
25
+ *
26
+ * exportData() {
27
+ * this.gridExport.exportToCsv('employees.csv');
28
+ * }
29
+ * }
30
+ * ```
31
+ *
32
+ * @packageDocumentation
33
+ */
34
+
35
+ /**
36
+ * Export methods returned from injectGridExport.
37
+ *
38
+ * Uses lazy discovery - the grid is found on first method call, not during initialization.
39
+ * This ensures it works with lazy-rendered tabs, conditional rendering, etc.
40
+ */
41
+ interface ExportMethods {
42
+ /**
43
+ * Export grid data to CSV file.
44
+ * @param filename - Optional filename (defaults to 'export.csv')
45
+ * @param params - Optional export parameters
46
+ */
47
+ exportToCsv: (filename?: string, params?: Partial<ExportParams>) => void;
48
+ /**
49
+ * Export grid data to Excel file (XML Spreadsheet format).
50
+ * @param filename - Optional filename (defaults to 'export.xlsx')
51
+ * @param params - Optional export parameters
52
+ */
53
+ exportToExcel: (filename?: string, params?: Partial<ExportParams>) => void;
54
+ /**
55
+ * Export grid data to JSON file.
56
+ * @param filename - Optional filename (defaults to 'export.json')
57
+ * @param params - Optional export parameters
58
+ */
59
+ exportToJson: (filename?: string, params?: Partial<ExportParams>) => void;
60
+ /**
61
+ * Check if an export is currently in progress.
62
+ */
63
+ isExporting: () => boolean;
64
+ /**
65
+ * Get information about the last export.
66
+ */
67
+ getLastExport: () => {
68
+ format: ExportFormat;
69
+ timestamp: Date;
70
+ } | null;
71
+ /**
72
+ * Signal indicating if grid is ready.
73
+ * The grid is discovered lazily, so this updates when first method call succeeds.
74
+ */
75
+ isReady: Signal<boolean>;
76
+ }
77
+ /**
78
+ * Angular inject function for programmatic export control.
79
+ *
80
+ * Uses **lazy grid discovery** - the grid element is found when methods are called,
81
+ * not during initialization. This ensures it works reliably with:
82
+ * - Lazy-rendered tabs
83
+ * - Conditional rendering (*ngIf)
84
+ * - Dynamic component loading
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
89
+ * import { Grid } from '@toolbox-web/grid-angular';
90
+ * import '@toolbox-web/grid-angular/features/export';
91
+ * import { injectGridExport } from '@toolbox-web/grid-angular/features/export';
92
+ *
93
+ * @Component({
94
+ * selector: 'app-my-grid',
95
+ * imports: [Grid],
96
+ * schemas: [CUSTOM_ELEMENTS_SCHEMA],
97
+ * template: `
98
+ * <button (click)="handleExport()">Export CSV</button>
99
+ * <tbw-grid [rows]="rows" [export]="true"></tbw-grid>
100
+ * `
101
+ * })
102
+ * export class MyGridComponent {
103
+ * gridExport = injectGridExport();
104
+ *
105
+ * handleExport() {
106
+ * this.gridExport.exportToCsv('employees.csv');
107
+ * }
108
+ * }
109
+ * ```
110
+ */
111
+ declare function injectGridExport(): ExportMethods;
112
+
113
+ export { injectGridExport };
114
+ export type { ExportMethods };
3
115
  //# sourceMappingURL=toolbox-web-grid-angular-features-export.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolbox-web-grid-angular-features-export.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"toolbox-web-grid-angular-features-export.d.ts","sources":["../../../../libs/grid-angular/features/export/src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;;AAcH;;;;;AAKG;;AAED;;;;AAIG;AACH,8CAAA,OAAA,CAAA,YAAA;AAEA;;;;AAIG;AACH,gDAAA,OAAA,CAAA,YAAA;AAEA;;;;AAIG;AACH,+CAAA,OAAA,CAAA,YAAA;AAEA;;AAEG;;AAGH;;AAEG;AACH;;;AAA8D;AAE9D;;;AAGG;AACH,aAAA,MAAA;AACD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;AACH,iBAAA,gBAAA,IAAA,aAAA;;;;"}
@@ -1,3 +1,122 @@
1
+ import { Signal } from '@angular/core';
2
+ import { FilterModel } from '@toolbox-web/grid/plugins/filtering';
1
3
 
2
- export { };
4
+ /**
5
+ * Filtering feature for @toolbox-web/grid-angular
6
+ *
7
+ * Import this module to enable the `filtering` input on Grid directive.
8
+ * Also exports `injectGridFiltering()` for programmatic filter control.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import '@toolbox-web/grid-angular/features/filtering';
13
+ *
14
+ * <tbw-grid [filtering]="true" />
15
+ * <tbw-grid [filtering]="{ debounceMs: 200 }" />
16
+ * ```
17
+ *
18
+ * @example Using injectGridFiltering
19
+ * ```typescript
20
+ * import { injectGridFiltering } from '@toolbox-web/grid-angular/features/filtering';
21
+ *
22
+ * @Component({...})
23
+ * export class MyComponent {
24
+ * private filtering = injectGridFiltering();
25
+ *
26
+ * filterByStatus(status: string) {
27
+ * this.filtering.setFilter('status', { operator: 'equals', value: status });
28
+ * }
29
+ * }
30
+ * ```
31
+ *
32
+ * @packageDocumentation
33
+ */
34
+
35
+ /**
36
+ * Filtering methods returned from injectGridFiltering.
37
+ *
38
+ * Uses lazy discovery - the grid is found on first method call, not during initialization.
39
+ */
40
+ interface FilteringMethods {
41
+ /**
42
+ * Set a filter on a specific field.
43
+ * @param field - The field name to filter
44
+ * @param filter - Filter configuration, or null to remove
45
+ */
46
+ setFilter: (field: string, filter: Omit<FilterModel, 'field'> | null) => void;
47
+ /**
48
+ * Get the current filter for a field.
49
+ */
50
+ getFilter: (field: string) => FilterModel | undefined;
51
+ /**
52
+ * Get all active filters.
53
+ */
54
+ getFilters: () => FilterModel[];
55
+ /**
56
+ * Set all filters at once (replaces existing).
57
+ */
58
+ setFilterModel: (filters: FilterModel[]) => void;
59
+ /**
60
+ * Clear all active filters.
61
+ */
62
+ clearAllFilters: () => void;
63
+ /**
64
+ * Clear filter for a specific field.
65
+ */
66
+ clearFieldFilter: (field: string) => void;
67
+ /**
68
+ * Check if a field has an active filter.
69
+ */
70
+ isFieldFiltered: (field: string) => boolean;
71
+ /**
72
+ * Get the count of rows after filtering.
73
+ */
74
+ getFilteredRowCount: () => number;
75
+ /**
76
+ * Get unique values for a field (for building filter dropdowns).
77
+ */
78
+ getUniqueValues: (field: string) => unknown[];
79
+ /**
80
+ * Signal indicating if grid is ready.
81
+ */
82
+ isReady: Signal<boolean>;
83
+ }
84
+ /**
85
+ * Angular inject function for programmatic filter control.
86
+ *
87
+ * Uses **lazy grid discovery** - the grid element is found when methods are called,
88
+ * not during initialization.
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
93
+ * import { Grid } from '@toolbox-web/grid-angular';
94
+ * import '@toolbox-web/grid-angular/features/filtering';
95
+ * import { injectGridFiltering } from '@toolbox-web/grid-angular/features/filtering';
96
+ *
97
+ * @Component({
98
+ * selector: 'app-my-grid',
99
+ * imports: [Grid],
100
+ * schemas: [CUSTOM_ELEMENTS_SCHEMA],
101
+ * template: `
102
+ * <input (input)="applyFilter($event)" placeholder="Filter by name..." />
103
+ * <span>{{ filtering.getFilteredRowCount() }} results</span>
104
+ * <button (click)="filtering.clearAllFilters()">Clear</button>
105
+ * <tbw-grid [rows]="rows" [filtering]="true"></tbw-grid>
106
+ * `
107
+ * })
108
+ * export class MyGridComponent {
109
+ * filtering = injectGridFiltering();
110
+ *
111
+ * applyFilter(event: Event) {
112
+ * const value = (event.target as HTMLInputElement).value;
113
+ * this.filtering.setFilter('name', value ? { operator: 'contains', value } : null);
114
+ * }
115
+ * }
116
+ * ```
117
+ */
118
+ declare function injectGridFiltering(): FilteringMethods;
119
+
120
+ export { injectGridFiltering };
121
+ export type { FilteringMethods };
3
122
  //# sourceMappingURL=toolbox-web-grid-angular-features-filtering.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolbox-web-grid-angular-features-filtering.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"toolbox-web-grid-angular-features-filtering.d.ts","sources":["../../../../libs/grid-angular/features/filtering/src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;;AAcH;;;;AAIG;;AAED;;;;AAIG;AACH,uCAAA,IAAA,CAAA,WAAA;AAEA;;AAEG;;AAGH;;AAEG;AACH,sBAAA,WAAA;AAEA;;AAEG;;AAGH;;AAEG;;AAGH;;AAEG;AACH;AAEA;;AAEG;AACH;AAEA;;AAEG;;AAGH;;AAEG;;AAGH;;AAEG;AACH,aAAA,MAAA;AACD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;AACH,iBAAA,mBAAA,IAAA,gBAAA;;;;"}
@@ -1,3 +1,93 @@
1
+ import { Signal } from '@angular/core';
2
+ import { PrintParams } from '@toolbox-web/grid/plugins/print';
1
3
 
2
- export { };
4
+ /**
5
+ * Print feature for @toolbox-web/grid-angular
6
+ *
7
+ * Import this module to enable the `print` input on Grid directive.
8
+ * Also exports `injectGridPrint()` for programmatic print control.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import '@toolbox-web/grid-angular/features/print';
13
+ *
14
+ * <tbw-grid [print]="true" />
15
+ * ```
16
+ *
17
+ * @example Using injectGridPrint
18
+ * ```typescript
19
+ * import { injectGridPrint } from '@toolbox-web/grid-angular/features/print';
20
+ *
21
+ * @Component({...})
22
+ * export class MyComponent {
23
+ * private gridPrint = injectGridPrint();
24
+ *
25
+ * printReport() {
26
+ * this.gridPrint.print({ title: 'My Report' });
27
+ * }
28
+ * }
29
+ * ```
30
+ *
31
+ * @packageDocumentation
32
+ */
33
+
34
+ /**
35
+ * Print methods returned from injectGridPrint.
36
+ *
37
+ * Uses lazy discovery - the grid is found on first method call, not during initialization.
38
+ */
39
+ interface PrintMethods {
40
+ /**
41
+ * Print the grid.
42
+ * Opens browser print dialog after preparing the grid for printing.
43
+ * @param params - Optional print parameters
44
+ */
45
+ print: (params?: PrintParams) => Promise<void>;
46
+ /**
47
+ * Check if a print operation is currently in progress.
48
+ */
49
+ isPrinting: () => boolean;
50
+ /**
51
+ * Signal indicating if grid is ready.
52
+ */
53
+ isReady: Signal<boolean>;
54
+ }
55
+ /**
56
+ * Angular inject function for programmatic print control.
57
+ *
58
+ * Uses **lazy grid discovery** - the grid element is found when methods are called,
59
+ * not during initialization.
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
64
+ * import { Grid } from '@toolbox-web/grid-angular';
65
+ * import '@toolbox-web/grid-angular/features/print';
66
+ * import { injectGridPrint } from '@toolbox-web/grid-angular/features/print';
67
+ *
68
+ * @Component({
69
+ * selector: 'app-my-grid',
70
+ * imports: [Grid],
71
+ * schemas: [CUSTOM_ELEMENTS_SCHEMA],
72
+ * template: `
73
+ * <button (click)="handlePrint()" [disabled]="gridPrint.isPrinting()">
74
+ * {{ gridPrint.isPrinting() ? 'Printing...' : 'Print' }}
75
+ * </button>
76
+ * <tbw-grid [rows]="rows" [print]="true"></tbw-grid>
77
+ * `
78
+ * })
79
+ * export class MyGridComponent {
80
+ * gridPrint = injectGridPrint();
81
+ *
82
+ * async handlePrint() {
83
+ * await this.gridPrint.print({ title: 'Employee Report', isolate: true });
84
+ * console.log('Print dialog closed');
85
+ * }
86
+ * }
87
+ * ```
88
+ */
89
+ declare function injectGridPrint(): PrintMethods;
90
+
91
+ export { injectGridPrint };
92
+ export type { PrintMethods };
3
93
  //# sourceMappingURL=toolbox-web-grid-angular-features-print.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolbox-web-grid-angular-features-print.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"toolbox-web-grid-angular-features-print.d.ts","sources":["../../../../libs/grid-angular/features/print/src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;;AAcH;;;;AAIG;;AAED;;;;AAIG;;AAGH;;AAEG;;AAGH;;AAEG;AACH,aAAA,MAAA;AACD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCG;AACH,iBAAA,eAAA,IAAA,YAAA;;;;"}
@@ -1,3 +1,116 @@
1
+ import { Signal } from '@angular/core';
2
+ import { SelectionResult, CellRange } from '@toolbox-web/grid/plugins/selection';
1
3
 
2
- export { };
4
+ /**
5
+ * Selection feature for @toolbox-web/grid-angular
6
+ *
7
+ * Import this module to enable the `selection` input on Grid directive.
8
+ * Also exports `injectGridSelection()` for programmatic selection control.
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * import '@toolbox-web/grid-angular/features/selection';
13
+ *
14
+ * <tbw-grid [selection]="'range'" />
15
+ * ```
16
+ *
17
+ * @example Using injectGridSelection
18
+ * ```typescript
19
+ * import { injectGridSelection } from '@toolbox-web/grid-angular/features/selection';
20
+ *
21
+ * @Component({...})
22
+ * export class MyComponent {
23
+ * private selection = injectGridSelection<Employee>();
24
+ *
25
+ * selectAll() {
26
+ * this.selection.selectAll();
27
+ * }
28
+ *
29
+ * getSelected() {
30
+ * return this.selection.getSelection();
31
+ * }
32
+ * }
33
+ * ```
34
+ *
35
+ * @packageDocumentation
36
+ */
37
+
38
+ /**
39
+ * Selection methods returned from injectGridSelection.
40
+ *
41
+ * Uses lazy discovery - the grid is found on first method call, not during initialization.
42
+ * This ensures it works with lazy-rendered tabs, conditional rendering, etc.
43
+ */
44
+ interface SelectionMethods {
45
+ /**
46
+ * Select all rows (row mode) or all cells (range mode).
47
+ */
48
+ selectAll: () => void;
49
+ /**
50
+ * Clear all selection.
51
+ */
52
+ clearSelection: () => void;
53
+ /**
54
+ * Get the current selection state.
55
+ * Use this to derive selected rows, indices, etc.
56
+ */
57
+ getSelection: () => SelectionResult | null;
58
+ /**
59
+ * Check if a specific cell is selected.
60
+ */
61
+ isCellSelected: (row: number, col: number) => boolean;
62
+ /**
63
+ * Set selection ranges programmatically.
64
+ */
65
+ setRanges: (ranges: CellRange[]) => void;
66
+ /**
67
+ * Signal indicating if grid is ready.
68
+ * The grid is discovered lazily, so this updates when first method call succeeds.
69
+ */
70
+ isReady: Signal<boolean>;
71
+ }
72
+ /**
73
+ * Angular inject function for programmatic selection control.
74
+ *
75
+ * Uses **lazy grid discovery** - the grid element is found when methods are called,
76
+ * not during initialization. This ensures it works reliably with:
77
+ * - Lazy-rendered tabs
78
+ * - Conditional rendering (*ngIf)
79
+ * - Dynamic component loading
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
84
+ * import { Grid } from '@toolbox-web/grid-angular';
85
+ * import '@toolbox-web/grid-angular/features/selection';
86
+ * import { injectGridSelection } from '@toolbox-web/grid-angular/features/selection';
87
+ *
88
+ * @Component({
89
+ * selector: 'app-my-grid',
90
+ * imports: [Grid],
91
+ * schemas: [CUSTOM_ELEMENTS_SCHEMA],
92
+ * template: `
93
+ * <button (click)="handleSelectAll()">Select All</button>
94
+ * <tbw-grid [rows]="rows" [selection]="'range'"></tbw-grid>
95
+ * `
96
+ * })
97
+ * export class MyGridComponent {
98
+ * selection = injectGridSelection();
99
+ *
100
+ * handleSelectAll() {
101
+ * this.selection.selectAll();
102
+ * }
103
+ *
104
+ * getSelectedRows() {
105
+ * const selection = this.selection.getSelection();
106
+ * if (!selection) return [];
107
+ * // Derive rows from selection.ranges as needed
108
+ * }
109
+ * }
110
+ * ```
111
+ */
112
+ declare function injectGridSelection<TRow = unknown>(): SelectionMethods;
113
+
114
+ export { injectGridSelection };
115
+ export type { SelectionMethods };
3
116
  //# sourceMappingURL=toolbox-web-grid-angular-features-selection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolbox-web-grid-angular-features-selection.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"toolbox-web-grid-angular-features-selection.d.ts","sources":["../../../../libs/grid-angular/features/selection/src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCG;;AAgBH;;;;;AAKG;;AAED;;AAEG;;AAGH;;AAEG;;AAGH;;;AAGG;AACH,wBAAA,eAAA;AAEA;;AAEG;;AAGH;;AAEG;;AAGH;;;AAGG;AACH,aAAA,MAAA;AACD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCG;AACH,iBAAA,mBAAA,oBAAA,gBAAA;;;;"}
@@ -1,3 +1,109 @@
1
+ import { Signal } from '@angular/core';
2
+ import { EditAction } from '@toolbox-web/grid/plugins/undo-redo';
1
3
 
2
- export { };
4
+ /**
5
+ * Undo/Redo feature for @toolbox-web/grid-angular
6
+ *
7
+ * Import this module to enable the `undoRedo` input on Grid directive.
8
+ * Also exports `injectGridUndoRedo()` for programmatic undo/redo control.
9
+ * Requires editing feature to be enabled.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import '@toolbox-web/grid-angular/features/editing';
14
+ * import '@toolbox-web/grid-angular/features/undo-redo';
15
+ *
16
+ * <tbw-grid [editing]="'dblclick'" [undoRedo]="true" />
17
+ * ```
18
+ *
19
+ * @example Using injectGridUndoRedo
20
+ * ```typescript
21
+ * import { injectGridUndoRedo } from '@toolbox-web/grid-angular/features/undo-redo';
22
+ *
23
+ * @Component({...})
24
+ * export class MyComponent {
25
+ * private undoRedo = injectGridUndoRedo();
26
+ *
27
+ * undo() { this.undoRedo.undo(); }
28
+ * redo() { this.undoRedo.redo(); }
29
+ * }
30
+ * ```
31
+ *
32
+ * @packageDocumentation
33
+ */
34
+
35
+ /**
36
+ * Undo/Redo methods returned from injectGridUndoRedo.
37
+ *
38
+ * Uses lazy discovery - the grid is found on first method call, not during initialization.
39
+ */
40
+ interface UndoRedoMethods {
41
+ /**
42
+ * Undo the last edit action.
43
+ * @returns The undone action, or null if nothing to undo
44
+ */
45
+ undo: () => EditAction | null;
46
+ /**
47
+ * Redo the last undone action.
48
+ * @returns The redone action, or null if nothing to redo
49
+ */
50
+ redo: () => EditAction | null;
51
+ /**
52
+ * Check if there are any actions that can be undone.
53
+ */
54
+ canUndo: () => boolean;
55
+ /**
56
+ * Check if there are any actions that can be redone.
57
+ */
58
+ canRedo: () => boolean;
59
+ /**
60
+ * Clear all undo/redo history.
61
+ */
62
+ clearHistory: () => void;
63
+ /**
64
+ * Get a copy of the current undo stack.
65
+ */
66
+ getUndoStack: () => EditAction[];
67
+ /**
68
+ * Get a copy of the current redo stack.
69
+ */
70
+ getRedoStack: () => EditAction[];
71
+ /**
72
+ * Signal indicating if grid is ready.
73
+ */
74
+ isReady: Signal<boolean>;
75
+ }
76
+ /**
77
+ * Angular inject function for programmatic undo/redo control.
78
+ *
79
+ * Uses **lazy grid discovery** - the grid element is found when methods are called,
80
+ * not during initialization.
81
+ *
82
+ * @example
83
+ * ```typescript
84
+ * import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
85
+ * import { Grid } from '@toolbox-web/grid-angular';
86
+ * import '@toolbox-web/grid-angular/features/editing';
87
+ * import '@toolbox-web/grid-angular/features/undo-redo';
88
+ * import { injectGridUndoRedo } from '@toolbox-web/grid-angular/features/undo-redo';
89
+ *
90
+ * @Component({
91
+ * selector: 'app-my-grid',
92
+ * imports: [Grid],
93
+ * schemas: [CUSTOM_ELEMENTS_SCHEMA],
94
+ * template: `
95
+ * <button (click)="undoRedo.undo()" [disabled]="!undoRedo.canUndo()">Undo</button>
96
+ * <button (click)="undoRedo.redo()" [disabled]="!undoRedo.canRedo()">Redo</button>
97
+ * <tbw-grid [rows]="rows" [editing]="'dblclick'" [undoRedo]="true"></tbw-grid>
98
+ * `
99
+ * })
100
+ * export class MyGridComponent {
101
+ * undoRedo = injectGridUndoRedo();
102
+ * }
103
+ * ```
104
+ */
105
+ declare function injectGridUndoRedo(): UndoRedoMethods;
106
+
107
+ export { injectGridUndoRedo };
108
+ export type { UndoRedoMethods };
3
109
  //# sourceMappingURL=toolbox-web-grid-angular-features-undo-redo.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"toolbox-web-grid-angular-features-undo-redo.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"toolbox-web-grid-angular-features-undo-redo.d.ts","sources":["../../../../libs/grid-angular/features/undo-redo/src/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;;AAcH;;;;AAIG;;AAED;;;AAGG;AACH,gBAAA,UAAA;AAEA;;;AAGG;AACH,gBAAA,UAAA;AAEA;;AAEG;;AAGH;;AAEG;;AAGH;;AAEG;;AAGH;;AAEG;AACH,wBAAA,UAAA;AAEA;;AAEG;AACH,wBAAA,UAAA;AAEA;;AAEG;AACH,aAAA,MAAA;AACD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BG;AACH,iBAAA,kBAAA,IAAA,eAAA;;;;"}