import { StateManager } from "../../../CommonUI/StateManagement/StateManager";
import { RuleBuilderPage } from "../../DesignUI/RuleBuilderPage";
export class RuleTableEditContext {
    constructor(def) {
        this.mode = RuleBuilderPage.Rule;
        this.navigate = (direction) => {
            if (!this.selectedCell)
                return;
            let newCell = null;
            if (direction === "Left") {
                newCell = this.definition.getPrevCell(this.selectedCell);
            }
            else if (direction === "Right" || direction === "Tab") {
                newCell = this.definition.getNextCell(this.selectedCell);
            }
            else if (direction === "Down") {
                newCell = this.definition.getNextRowCell(this.selectedCell);
            }
            else if (direction === "Up") {
                newCell = this.definition.getPrevRowCell(this.selectedCell);
            }
            if (newCell) {
                this.selectedCell = newCell;
            }
        };
        this.definition = def;
    }
    set selectedColumnHeader(col) {
        this._selectedColumnHeader = col;
        StateManager.propertyChanged(this, "selectedColumnHeader");
    }
    get selectedColumnHeader() {
        return this._selectedColumnHeader;
    }
    onCopy(id) { }
    onCut(id) { }
    onDelete(id) { }
    onPaste(id) { }
    set notification(notification) {
        this._notification = notification;
        StateManager.propertyChanged(this, "notification");
    }
    get notification() {
        return this._notification;
    }
    set selectedCell(cell) {
        this._selectedCell = cell;
        StateManager.propertyChanged(this, "selectedCell");
    }
    get selectedCell() {
        return this._selectedCell;
    }
    isSelected(cell) {
        return cell === this.selectedCell;
    }
    setSelected(cell) {
        this.selectedCell = cell;
    }
}
//# sourceMappingURL=RuleTableEditContext.js.map