@sheetxl/models
Version:
Models - A Headless javascript spreadsheet library.
83 lines • 2.1 kB
TypeScript
import { CellRangeCoords, RemoveListener } from "@sheetxl/common";
/**
* Describes how an anchored items bounds will adjust if
* rows/columns are inserted/removed.
*/
export declare enum AnchorType {
/**
* Doesn't move when anchors moves.
*/
Absolute = "absolute",
/**
* Only moves the top left
*/
OneCell = "oneCell",
/**
* Moves both the top left and the bottom right
*/
TwoCell = "twoCell"
}
export interface IAnchoredItemListener {
/**
* Called when the anchor bounds are updated.
* @param cellRangeCoords
*/
onAnchorUpdate?(cellRangeCoords: CellRangeCoords): void;
/**
* Called when the anchor protection is updated.
*/
onProtectedChange?(src: IAnchoredItem): void;
/**
* Called when the anchor is removed.
*/
onDelete?(model: IAnchoredItem): void;
/**
* Called when the anchor transaction is closed.
*/
onClose?(model: IAnchoredItem): void;
}
/**
* AnchoredItem belong to a sheet and is anchored to a range of cells.
*/
export interface IAnchoredItem {
/**
* Returns the anchor
*/
getAnchor(): CellRangeCoords;
/**
* Ses the anchorBounds.
* @defaultValue AnchorType.TwoCell
*/
setAnchorType?(anchorType: AnchorType): void;
/**
* Returns how the anchorBounds adjust when inserting/removing rows/columns.
* @defaultValue AnchorType.TwoCell
*/
getAnchorType?(): AnchorType;
/**
* If the drawing is unable to be modified.
*/
isProtected(): boolean;
/**
* Adds a listener for the anchor item
* @param listener
*/
addListener(listener: IAnchoredItemListener): RemoveListener;
/**
* Deletes the anchored item.
*/
delete(): void;
/**
* Similar to delete but cleans resources and can't be undone..
*/
close(): void;
/**
* Returns if the model has been closed
*/
isClosed(): boolean;
/**
* For runtime type checking
*/
readonly isAnchoredItem: true;
}
//# sourceMappingURL=IAnchoredItem.d.ts.map