@progress/kendo-angular-grid 19.2.0-develop.4 → 19.2.0-develop.6

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.
@@ -7,7 +7,6 @@ import { CellSelectionItem, SelectionEvent } from '../selection/types';
7
7
  import { RowArgs } from '../rendering/common/row-args';
8
8
  import { ContextService } from '../common/provider.service';
9
9
  import { ColumnInfoService } from '../common/column-info.service';
10
- import { LocalDataChangesService } from '../editing/local-data-changes.service';
11
10
  import * as i0 from "@angular/core";
12
11
  /**
13
12
  * @hidden
@@ -22,13 +21,12 @@ interface GroupedAggregates {
22
21
  */
23
22
  export declare class CellSelectionAggregateService {
24
23
  private ctx;
25
- private dataChanges;
26
24
  private columnInfoService;
27
25
  selectedItems: Array<CellSelectionItem | RowArgs>;
28
26
  groupedAggregates: GroupedAggregates;
29
27
  aggregates: SelectionAggregates;
30
28
  private sub;
31
- constructor(ctx: ContextService, dataChanges: LocalDataChangesService, columnInfoService: ColumnInfoService);
29
+ constructor(ctx: ContextService, columnInfoService: ColumnInfoService);
32
30
  ngOnDestroy(): void;
33
31
  isAggregateIncluded(aggregate: SelectionAggregate): boolean;
34
32
  init(): void;
@@ -7,6 +7,7 @@ import { LocalizationService } from '@progress/kendo-angular-l10n';
7
7
  import type { GridComponent } from '../grid.component';
8
8
  import { GridToolbarNavigationService } from '../rendering/toolbar/toolbar-navigation.service';
9
9
  import type { GroupBindingDirective } from '../grouping/group-scroll-binding.directive';
10
+ import { DataBindingDirective } from '../databinding.directive';
10
11
  import * as i0 from "@angular/core";
11
12
  /**
12
13
  * @hidden
@@ -24,7 +25,7 @@ export declare class ContextService {
24
25
  topToolbarNavigation: GridToolbarNavigationService;
25
26
  bottomToolbarNavigation: GridToolbarNavigationService;
26
27
  navigable: boolean;
27
- groupBindingDirective: GroupBindingDirective;
28
+ dataBindingDirective: DataBindingDirective | GroupBindingDirective;
28
29
  constructor(renderer: Renderer2, localization: LocalizationService);
29
30
  static ɵfac: i0.ɵɵFactoryDeclaration<ContextService, never>;
30
31
  static ɵprov: i0.ɵɵInjectableDeclaration<ContextService>;
@@ -10,6 +10,7 @@ import { GridDataResult } from './data/data.collection';
10
10
  import { LocalDataChangesService } from './editing/local-data-changes.service';
11
11
  import { RowReorderEvent } from './row-reordering/types';
12
12
  import { RowReorderService } from './row-reordering/row-reorder.service';
13
+ import { ContextService } from './common/provider.service';
13
14
  import * as i0 from "@angular/core";
14
15
  /**
15
16
  * A directive that handles in-memory data operations like [paging]({% slug paging_grid %}),
@@ -67,7 +68,7 @@ export declare class DataBindingDirective implements OnInit, OnDestroy, DoCheck,
67
68
  private stateChangeSubscription;
68
69
  private dataChangedSubscription;
69
70
  private rowReorderSubscription;
70
- constructor(grid: GridComponent, changeDetector?: ChangeDetectorRef, localDataChangesService?: LocalDataChangesService, rowReorderService?: RowReorderService);
71
+ constructor(grid: GridComponent, changeDetector?: ChangeDetectorRef, localDataChangesService?: LocalDataChangesService, rowReorderService?: RowReorderService, ctx?: ContextService);
71
72
  /**
72
73
  * @hidden
73
74
  */
@@ -5,19 +5,16 @@
5
5
  import { Injectable } from '@angular/core';
6
6
  import { ContextService } from '../common/provider.service';
7
7
  import { ColumnInfoService } from '../common/column-info.service';
8
- import { LocalDataChangesService } from '../editing/local-data-changes.service';
9
8
  import { recursiveFlatMap } from '../utils';
10
9
  import { Subscription } from 'rxjs';
11
10
  import * as i0 from "@angular/core";
12
11
  import * as i1 from "../common/provider.service";
13
- import * as i2 from "../editing/local-data-changes.service";
14
- import * as i3 from "../common/column-info.service";
12
+ import * as i2 from "../common/column-info.service";
15
13
  /**
16
14
  * @hidden
17
15
  */
18
16
  export class CellSelectionAggregateService {
19
17
  ctx;
20
- dataChanges;
21
18
  columnInfoService;
22
19
  selectedItems = [];
23
20
  groupedAggregates = { dates: [], numbers: [], booleans: [] };
@@ -33,9 +30,8 @@ export class CellSelectionAggregateService {
33
30
  latest: null
34
31
  };
35
32
  sub = new Subscription();
36
- constructor(ctx, dataChanges, columnInfoService) {
33
+ constructor(ctx, columnInfoService) {
37
34
  this.ctx = ctx;
38
- this.dataChanges = dataChanges;
39
35
  this.columnInfoService = columnInfoService;
40
36
  }
41
37
  ngOnDestroy() {
@@ -196,9 +192,9 @@ export class CellSelectionAggregateService {
196
192
  this.aggregates['isFalse'] = this.aggregates['isTrue'] = null;
197
193
  this.aggregates['earliest'] = this.aggregates['latest'] = null;
198
194
  }
199
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CellSelectionAggregateService, deps: [{ token: i1.ContextService }, { token: i2.LocalDataChangesService }, { token: i3.ColumnInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
195
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CellSelectionAggregateService, deps: [{ token: i1.ContextService }, { token: i2.ColumnInfoService }], target: i0.ɵɵFactoryTarget.Injectable });
200
196
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CellSelectionAggregateService });
201
197
  }
202
198
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: CellSelectionAggregateService, decorators: [{
203
199
  type: Injectable
204
- }], ctorParameters: function () { return [{ type: i1.ContextService }, { type: i2.LocalDataChangesService }, { type: i3.ColumnInfoService }]; } });
200
+ }], ctorParameters: function () { return [{ type: i1.ContextService }, { type: i2.ColumnInfoService }]; } });
@@ -23,7 +23,7 @@ export class ContextService {
23
23
  topToolbarNavigation;
24
24
  bottomToolbarNavigation;
25
25
  navigable;
26
- groupBindingDirective;
26
+ dataBindingDirective;
27
27
  constructor(renderer, localization) {
28
28
  this.renderer = renderer;
29
29
  this.localization = localization;
@@ -8,10 +8,12 @@ import { GridComponent } from './grid.component';
8
8
  import { anyChanged, isPresent } from './utils';
9
9
  import { LocalDataChangesService } from './editing/local-data-changes.service';
10
10
  import { RowReorderService } from './row-reordering/row-reorder.service';
11
+ import { ContextService } from './common/provider.service';
11
12
  import * as i0 from "@angular/core";
12
13
  import * as i1 from "./grid.component";
13
14
  import * as i2 from "./editing/local-data-changes.service";
14
15
  import * as i3 from "./row-reordering/row-reorder.service";
16
+ import * as i4 from "./common/provider.service";
15
17
  /**
16
18
  * A directive that handles in-memory data operations like [paging]({% slug paging_grid %}),
17
19
  * [sorting]({% slug sorting_grid %}), and [grouping]({% slug grouping_grid %}).
@@ -92,7 +94,7 @@ export class DataBindingDirective {
92
94
  stateChangeSubscription;
93
95
  dataChangedSubscription;
94
96
  rowReorderSubscription;
95
- constructor(grid, changeDetector, localDataChangesService, rowReorderService) {
97
+ constructor(grid, changeDetector, localDataChangesService, rowReorderService, ctx) {
96
98
  this.grid = grid;
97
99
  this.changeDetector = changeDetector;
98
100
  this.localDataChangesService = localDataChangesService;
@@ -100,6 +102,7 @@ export class DataBindingDirective {
100
102
  if (localDataChangesService) {
101
103
  this.dataChangedSubscription = this.localDataChangesService.changes.subscribe(this.rebind.bind(this));
102
104
  }
105
+ ctx && (ctx.dataBindingDirective = this);
103
106
  }
104
107
  /**
105
108
  * @hidden
@@ -194,7 +197,7 @@ export class DataBindingDirective {
194
197
  this.grid.updateNavigationMetadata();
195
198
  this.dataChanged = false;
196
199
  }
197
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataBindingDirective, deps: [{ token: i1.GridComponent }, { token: i0.ChangeDetectorRef }, { token: i2.LocalDataChangesService }, { token: i3.RowReorderService }], target: i0.ɵɵFactoryTarget.Directive });
200
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataBindingDirective, deps: [{ token: i1.GridComponent }, { token: i0.ChangeDetectorRef }, { token: i2.LocalDataChangesService }, { token: i3.RowReorderService }, { token: i4.ContextService }], target: i0.ɵɵFactoryTarget.Directive });
198
201
  static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: DataBindingDirective, isStandalone: true, selector: "[kendoGridBinding]", inputs: { skip: "skip", sort: "sort", filter: "filter", pageSize: "pageSize", group: "group", data: ["kendoGridBinding", "data"] }, exportAs: ["kendoGridBinding"], usesOnChanges: true, ngImport: i0 });
199
202
  }
200
203
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: DataBindingDirective, decorators: [{
@@ -204,7 +207,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
204
207
  exportAs: 'kendoGridBinding',
205
208
  standalone: true
206
209
  }]
207
- }], ctorParameters: function () { return [{ type: i1.GridComponent }, { type: i0.ChangeDetectorRef }, { type: i2.LocalDataChangesService }, { type: i3.RowReorderService }]; }, propDecorators: { skip: [{
210
+ }], ctorParameters: function () { return [{ type: i1.GridComponent }, { type: i0.ChangeDetectorRef }, { type: i2.LocalDataChangesService }, { type: i3.RowReorderService }, { type: i4.ContextService }]; }, propDecorators: { skip: [{
208
211
  type: Input
209
212
  }], sort: [{
210
213
  type: Input
@@ -100,6 +100,7 @@ import { AdaptiveGridService } from './common/adaptiveness.service';
100
100
  import { AdaptiveRendererComponent } from './adaptiveness/adaptive-renderer.component';
101
101
  import { ColumnMenuService } from './column-menu/column-menu.service';
102
102
  import { MenuTabbingService } from './filtering/menu/menu-tabbing.service';
103
+ import { GroupBindingDirective } from './grouping/group-scroll-binding.directive';
103
104
  import { DataMappingService } from './data/data-mapping.service';
104
105
  import * as i0 from "@angular/core";
105
106
  import * as i1 from "./layout/browser-support.service";
@@ -1609,12 +1610,12 @@ export class GridComponent {
1609
1610
  this.sort = state.sort;
1610
1611
  this.group = state.group;
1611
1612
  this.filter = state.filter;
1612
- this.group = state.group;
1613
1613
  this.skip = state.skip;
1614
1614
  this.pageSize = state.take;
1615
- this.data = state.currentData;
1616
- this.changeNotification.notify();
1617
- this.changeDetectorRef.detectChanges();
1615
+ if (state.currentData) {
1616
+ this.data = state.currentData;
1617
+ }
1618
+ this.changeDetectorRef.markForCheck();
1618
1619
  }
1619
1620
  traverseColumns(columns, callback) {
1620
1621
  columns.forEach((column) => {
@@ -2303,8 +2304,8 @@ export class GridComponent {
2303
2304
  }
2304
2305
  if (this.groupsService.isExpanded({ groupIndex: index }) !== expand) {
2305
2306
  this.groupsService.toggleRow({ index }, false);
2306
- if (this.ctx.groupBindingDirective) {
2307
- this.ctx.groupBindingDirective[`group${expand ? 'Expand' : 'Collapse'}`]({ groupIndex: index });
2307
+ if (this.ctx.dataBindingDirective && this.ctx.dataBindingDirective instanceof GroupBindingDirective) {
2308
+ this.ctx.dataBindingDirective[`group${expand ? 'Expand' : 'Collapse'}`]({ groupIndex: index });
2308
2309
  }
2309
2310
  }
2310
2311
  }
@@ -196,9 +196,9 @@ export class GroupBindingDirective extends DataBindingDirective {
196
196
  groups;
197
197
  gridSubs = new Subscription();
198
198
  constructor(changeDetector, localDataChangesService, ctxService, groupsService) {
199
- super(ctxService.grid, changeDetector, localDataChangesService);
199
+ super(ctxService.grid, changeDetector, localDataChangesService, null, ctxService);
200
200
  this.groupsService = groupsService;
201
- ctxService.groupBindingDirective = this;
201
+ ctxService.dataBindingDirective = this;
202
202
  }
203
203
  ngOnInit() {
204
204
  super.ngOnInit();
@@ -10,7 +10,7 @@ export const packageMetadata = {
10
10
  productName: 'Kendo UI for Angular',
11
11
  productCode: 'KENDOUIANGULAR',
12
12
  productCodes: ['KENDOUIANGULAR'],
13
- publishDate: 1750933458,
14
- version: '19.2.0-develop.4',
13
+ publishDate: 1751009984,
14
+ version: '19.2.0-develop.6',
15
15
  licensingDocsUrl: 'https://www.telerik.com/kendo-angular-ui/my-license/'
16
16
  };
@@ -8,15 +8,20 @@ import { GridComponent } from '../grid.component';
8
8
  import { UndoRedoEvent } from './grid-state.models';
9
9
  import { Subscription } from 'rxjs';
10
10
  import { EditService } from '../editing/edit.service';
11
- import { filter, tap } from 'rxjs/operators';
11
+ import { filter } from 'rxjs/operators';
12
12
  import { UndoRedoService } from './undo-redo.service';
13
- import { hasObservers } from '@progress/kendo-angular-common';
13
+ import { hasObservers, isPresent } from '@progress/kendo-angular-common';
14
14
  import { ChangeNotificationService } from '../data/change-notification.service';
15
+ import { ContextService } from '../common/provider.service';
16
+ import { LocalDataChangesService } from '../editing/local-data-changes.service';
17
+ import { recursiveFlatMap } from '../utils';
15
18
  import * as i0 from "@angular/core";
16
19
  import * as i1 from "../grid.component";
17
20
  import * as i2 from "../editing/edit.service";
18
21
  import * as i3 from "./undo-redo.service";
19
22
  import * as i4 from "../data/change-notification.service";
23
+ import * as i5 from "../common/provider.service";
24
+ import * as i6 from "../editing/local-data-changes.service";
20
25
  /**
21
26
  * Represents the directive that manages undo-redo operations in the Grid.
22
27
  * Use this directive to enable undo and redo functionality for user actions in the Grid.
@@ -33,11 +38,17 @@ export class UndoRedoDirective {
33
38
  editService;
34
39
  undoRedoService;
35
40
  changeNotification;
41
+ ctx;
42
+ localDataChangesService;
36
43
  /**
37
44
  * Sets the maximum number of actions to keep in the undo-redo stack.
38
45
  * @default 10
39
46
  */
40
47
  maxStoredStates = 10;
48
+ /**
49
+ * Defines the property name of the data item unique key that will be used to identify the items when performing undo-redo actions.
50
+ */
51
+ itemIdKey;
41
52
  /**
42
53
  * Fires when you perform the undo action. Provides the Grid state to apply.
43
54
  */
@@ -55,11 +66,13 @@ export class UndoRedoDirective {
55
66
  stack;
56
67
  subs = new Subscription();
57
68
  addToState = true;
58
- constructor(host, editService, undoRedoService, changeNotification) {
69
+ constructor(host, editService, undoRedoService, changeNotification, ctx, localDataChangesService) {
59
70
  this.host = host;
60
71
  this.editService = editService;
61
72
  this.undoRedoService = undoRedoService;
62
73
  this.changeNotification = changeNotification;
74
+ this.ctx = ctx;
75
+ this.localDataChangesService = localDataChangesService;
63
76
  this.host.undoRedoService = this.undoRedoService;
64
77
  }
65
78
  ngOnInit() {
@@ -71,7 +84,7 @@ export class UndoRedoDirective {
71
84
  sort: this.host.sort,
72
85
  filter: this.host.filter,
73
86
  group: this.host.group
74
- }, gridState: structuredClone(this.host.currentState)
87
+ }, gridState: this.host.currentState
75
88
  });
76
89
  this.subs = this.host.gridStateChange.subscribe((state) => {
77
90
  if (this.addToState) {
@@ -83,7 +96,7 @@ export class UndoRedoDirective {
83
96
  filter: state.filter,
84
97
  group: state.group
85
98
  },
86
- gridState: structuredClone(state)
99
+ gridState: state
87
100
  });
88
101
  }
89
102
  let stackEndPointReached;
@@ -96,36 +109,72 @@ export class UndoRedoDirective {
96
109
  this.undoRedoService.stackEndReached.next(stackEndPointReached);
97
110
  });
98
111
  this.subs.add(this.editService.changes
99
- .pipe(filter(event => event.action === 'save' || event.action === 'remove'), tap(event => this.undoRedoService.originalEvent = event))
112
+ .pipe(filter((event) => event.action === 'save' || event.action === 'remove'))
100
113
  .subscribe(event => {
101
114
  this.stack.add({
102
- originalEvent: event,
103
- gridState: structuredClone(this.host.currentState)
115
+ originalEvent: { ...event, dataItem: structuredClone(event.dataItem) },
116
+ gridState: this.host.currentState
104
117
  });
105
118
  this.addToState = false;
106
119
  this.host.gridStateChange.emit(this.stack.current.gridState);
107
120
  this.addToState = true;
108
121
  this.updateUndoRedoDisabled();
109
122
  }));
110
- this.subs.add(this.changeNotification.changes.subscribe(() => this.stack.current.gridState = this.host.currentState));
123
+ this.subs.add(this.changeNotification.changes.subscribe(() => {
124
+ if (!this.ctx.dataBindingDirective) {
125
+ this.stack.current.gridState = this.host.currentState;
126
+ }
127
+ }));
111
128
  ['Undo', 'Redo'].forEach((action) => {
112
129
  this.subs.add(this.undoRedoService[`on${action}`].subscribe(() => {
113
130
  if (!this.stack[`can${action}`]) {
114
131
  return;
115
132
  }
116
- this.stack[`${action.toLowerCase()}`]();
133
+ let eventData;
134
+ if (action === 'Undo') {
135
+ const isSaveOrRemove = this.stack.current.originalEvent.action === 'save' || this.stack.current.originalEvent.action === 'remove';
136
+ eventData = isSaveOrRemove ? this.stack.current : this.stack.peekPrev();
137
+ }
138
+ else {
139
+ eventData = this.stack.peekNext();
140
+ }
141
+ const event = new UndoRedoEvent(eventData);
117
142
  if (hasObservers(this[`on${action}`])) {
118
- const event = new UndoRedoEvent(this.stack.current);
119
143
  this[`on${action}`].emit(event);
120
144
  if (event.isDefaultPrevented()) {
121
145
  return;
122
146
  }
123
147
  }
148
+ this.stack[`${action.toLowerCase()}`]();
124
149
  this.updateUndoRedoDisabled();
125
- this.host.loadState(this.stack.current.gridState);
150
+ const originalAction = event.originalEvent.action;
151
+ const isLocalData = isPresent(this.ctx?.dataBindingDirective);
152
+ if (!isLocalData) {
153
+ return;
154
+ }
155
+ const isSaveOrRemove = originalAction === 'save' || originalAction === 'remove';
156
+ if (isSaveOrRemove) {
157
+ if (originalAction === 'save') {
158
+ const stateItem = this.getGridDataItems(this.stack.current.gridState.currentData).find(item => item[this.itemIdKey] === event.originalEvent.dataItem[this.itemIdKey]);
159
+ Object.assign(event.originalEvent.originalDataItem, stateItem);
160
+ }
161
+ else if (action === 'Undo') {
162
+ this.localDataChangesService?.data.splice(event.originalEvent.rowIndex, 0, event.originalEvent.dataItem);
163
+ }
164
+ else {
165
+ this.localDataChangesService?.data.splice(event.originalEvent.rowIndex, 1);
166
+ }
167
+ this.localDataChangesService?.changes.emit();
168
+ }
169
+ else {
170
+ this.host.loadState({ ...this.stack.current.gridState, currentData: null });
171
+ if (this.isDataStateChangeEvent(event.originalEvent)) {
172
+ const { skip, take, sort, filter, group } = this.stack.current.gridState;
173
+ this.host.dataStateChange.emit({ skip, take, sort, filter, group });
174
+ }
175
+ }
126
176
  }));
127
177
  });
128
- this.subs.add(this.undoRedoService.setState.subscribe((state) => this.stack.add({ originalEvent: 'dataChange', gridState: state })));
129
178
  }
130
179
  ngOnDestroy() {
131
180
  this.stack.clear();
@@ -167,8 +216,15 @@ export class UndoRedoDirective {
167
216
  }
168
217
  this.undoRedoService.stackEndReached.next(false);
169
218
  }
170
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UndoRedoDirective, deps: [{ token: i1.GridComponent }, { token: i2.EditService }, { token: i3.UndoRedoService }, { token: i4.ChangeNotificationService }], target: i0.ɵɵFactoryTarget.Directive });
171
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: UndoRedoDirective, isStandalone: true, selector: "[kendoGridUndoRedo]", inputs: { maxStoredStates: "maxStoredStates" }, outputs: { onUndo: "undo", onRedo: "redo" }, providers: [UndoRedoService], exportAs: ["kendoGridUndoRedo"], ngImport: i0 });
219
+ getGridDataItems(data) {
220
+ return Array.isArray(data) ? data.flatMap(recursiveFlatMap) :
221
+ data.data.flatMap(recursiveFlatMap);
222
+ }
223
+ isDataStateChangeEvent(event) {
224
+ return event && ['skip', 'take', 'sort', 'filter', 'group'].some(prop => prop in event);
225
+ }
226
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UndoRedoDirective, deps: [{ token: i1.GridComponent }, { token: i2.EditService }, { token: i3.UndoRedoService }, { token: i4.ChangeNotificationService }, { token: i5.ContextService }, { token: i6.LocalDataChangesService }], target: i0.ɵɵFactoryTarget.Directive });
227
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "16.2.12", type: UndoRedoDirective, isStandalone: true, selector: "[kendoGridUndoRedo]", inputs: { maxStoredStates: "maxStoredStates", itemIdKey: "itemIdKey" }, outputs: { onUndo: "undo", onRedo: "redo" }, providers: [UndoRedoService], exportAs: ["kendoGridUndoRedo"], ngImport: i0 });
172
228
  }
173
229
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UndoRedoDirective, decorators: [{
174
230
  type: Directive,
@@ -178,7 +234,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImpo
178
234
  exportAs: 'kendoGridUndoRedo',
179
235
  providers: [UndoRedoService]
180
236
  }]
181
- }], ctorParameters: function () { return [{ type: i1.GridComponent }, { type: i2.EditService }, { type: i3.UndoRedoService }, { type: i4.ChangeNotificationService }]; }, propDecorators: { maxStoredStates: [{
237
+ }], ctorParameters: function () { return [{ type: i1.GridComponent }, { type: i2.EditService }, { type: i3.UndoRedoService }, { type: i4.ChangeNotificationService }, { type: i5.ContextService }, { type: i6.LocalDataChangesService }]; }, propDecorators: { maxStoredStates: [{
238
+ type: Input
239
+ }], itemIdKey: [{
182
240
  type: Input
183
241
  }], onUndo: [{
184
242
  type: Output,
@@ -13,7 +13,6 @@ export class UndoRedoService {
13
13
  onUndo = new Subject();
14
14
  onRedo = new Subject();
15
15
  stackEndReached = new Subject();
16
- setState = new Subject();
17
16
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UndoRedoService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
18
17
  static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: UndoRedoService });
19
18
  }
@@ -139,6 +139,12 @@ export class UndoRedoStack {
139
139
  this.currentNode = this.currentNode.previous;
140
140
  return this.currentNode.state;
141
141
  }
142
+ peekNext() {
143
+ return this.currentNode.next?.state || null;
144
+ }
145
+ peekPrev() {
146
+ return this.currentNode.previous?.state || null;
147
+ }
142
148
  /**
143
149
  * Performs a redo operation, moving to the next state
144
150
  * @returns The next state or null if can't redo