Skip to content

Commit 369231f

Browse files
committed
🚧 Adding customisationt to default behaviors (WIP)
1 parent 0a28509 commit 369231f

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/businessLogic/contracts/types.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,22 @@ export interface ItemTypeCustomisations {
1212
typeCustomisations(): {[type: string]: Customisations };
1313
}
1414

15+
export interface DefaultBehaviors {
16+
// Allow customisation of items that can be renamed on the tree.
17+
enableRenaming(type: string): void;
18+
// Allow customisation of items that can be deleted on the tree.
19+
enableDeleting(type: string): void;
20+
// Allow registration of handler to be called when an item of a particular type has been deleted.
21+
registerItemDeletedHandler(type: string, callback: (item: TreeViewItem) => Promise<TreeViewItem>): void;
22+
// Allow registration of a handler to be called when an item of a particular type has been renamed.
23+
registerItemRenamedHandler(type: string, callback: (renamedItem: TreeViewItem) => Promise<TreeViewItem>): void;
24+
// Allow registration of a handler to be called to verify if a drag-and-drop move operation is valid.
25+
registerItemCanMoveHandler(canItemMoveCallBack: (movingItem: TreeViewItem, destinationItem: TreeViewItem) => Promise<boolean>): void;
26+
// Allow registration of a handler to be called when a move operation is succesful. The moved item property will contain
27+
// the information of the parentID of it's new parent or undefined if it was moved to the root directory.
28+
registerItemMovedHandler(callBack: (movedItem: TreeViewItem) => Promise<TreeViewItem>): void;
29+
}
30+
1531
export interface TreeViewCreatedEventPayload {
1632
itemCustomisations: ItemTypeCustomisations;
1733
eventManager: EventManager;
@@ -40,7 +56,6 @@ export interface TreeViewViewModel {
4056
addTreeViewItem(TreeViewItem: TreeViewItem): void;
4157
checkedStatusChanged(item: TreeViewItem): void;
4258
setSelectionMode(mode: SelectionMode): void;
43-
selectedItems: TreeViewItem[];
4459
readonly selectedItems: TreeViewItem[];
4560
}
4661

0 commit comments

Comments
 (0)