UNPKG

ngxsmk-datatable

Version:

A powerful, feature-rich Angular datatable component with virtual scrolling, built for Angular 17+

105 lines (104 loc) 2.48 kB
import { BehaviorSubject } from 'rxjs'; import { UndoRedoAction, UndoRedoConfig } from '../interfaces/undo-redo.interface'; import * as i0 from "@angular/core"; /** * Undo/Redo service for managing action history * * This service provides undo/redo functionality for inline editing * and other reversible operations. * * @example * constructor(private undoRedoService: UndoRedoService) { * this.undoRedoService.setConfig({ maxUndoStackSize: 50 }); * } * * // Add action * this.undoRedoService.addAction({ * type: 'edit', * data: { row, oldValue, newValue }, * undo: () => row.value = oldValue, * redo: () => row.value = newValue * }); * * // Undo * this.undoRedoService.undo(); * * // Redo * this.undoRedoService.redo(); */ export declare class UndoRedoService { private config; private undoStack; private redoStack; /** * Observable for undo stack */ undoStack$: BehaviorSubject<UndoRedoAction[]>; /** * Observable for redo stack */ redoStack$: BehaviorSubject<UndoRedoAction[]>; /** * Observable for can undo state */ canUndo$: BehaviorSubject<boolean>; /** * Observable for can redo state */ canRedo$: BehaviorSubject<boolean>; constructor(); /** * Set configuration */ setConfig(config: Partial<UndoRedoConfig>): void; /** * Get configuration */ getConfig(): UndoRedoConfig; /** * Add an action to the undo stack */ addAction(action: Omit<UndoRedoAction, 'timestamp'>): void; /** * Undo the last action */ undo(): boolean; /** * Redo the last undone action */ redo(): boolean; /** * Check if undo is available */ canUndo(): boolean; /** * Check if redo is available */ canRedo(): boolean; /** * Clear all history */ clear(): void; /** * Get undo stack */ getUndoStack(): UndoRedoAction[]; /** * Get redo stack */ getRedoStack(): UndoRedoAction[]; /** * Get last action description */ getLastActionDescription(): string | undefined; /** * Get next redo action description */ getNextRedoDescription(): string | undefined; /** * Update all observables */ private updateObservables; static ɵfac: i0.ɵɵFactoryDeclaration<UndoRedoService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<UndoRedoService>; }