File tree Expand file tree Collapse file tree 4 files changed +48
-7
lines changed
Expand file tree Collapse file tree 4 files changed +48
-7
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,19 @@ export interface TreeViewItem {
77 parentId ?: string
88}
99
10+ export interface ItemTypeCustomisations {
11+ makeItemsCheckable ( types : string [ ] ) : void ;
12+ typeCustomisations ( ) : { [ type : string ] : Customisations } ;
13+ }
14+
15+ export interface TreeViewCreatedEventPayload {
16+ itemCustomisations :
17+ }
18+
19+ export interface Customisations {
20+ isCheckable ?: boolean ;
21+ }
22+
1023export interface ItemCheckedChangedEvent {
1124 item : TreeViewItem ,
1225 status : CheckedState
Original file line number Diff line number Diff line change 1+ import { ItemCustomisations } from "./itemCustomisations" ;
2+
3+ describe ( "ItemCustomisation" , ( ) => {
4+ const customisations = ItemCustomisations ;
5+
6+ it ( "makeItemsCheckable() should make items checkable" , ( ) => {
7+ const expectedTypes = [ ".docs" , ".excel" ] ;
8+ customisations . makeItemsCheckable ( expectedTypes ) ;
9+
10+ const customisedTypes = customisations . typeCustomisations ( ) ;
11+ expectedTypes . forEach ( type => {
12+ expect ( customisedTypes [ type ] . isCheckable ) . toBe ( true ) ;
13+ } )
14+ } ) ;
15+ } ) ;
Original file line number Diff line number Diff line change 1+ import { Customisations , ItemTypeCustomisations } from "../contracts/types" ;
2+
3+ const typeCustomisations : { [ type : string ] : Customisations } = { } ;
4+
5+ export const ItemCustomisations : ItemTypeCustomisations = {
6+ makeItemsCheckable ( types : string [ ] ) : void {
7+ types . forEach ( type => {
8+ if ( ! typeCustomisations [ type ] )
9+ typeCustomisations [ type ] = { }
10+
11+ typeCustomisations [ type ] . isCheckable = true ;
12+ } ) ;
13+ } ,
14+
15+ typeCustomisations ( ) : { [ type : string ] : Customisations } {
16+ return typeCustomisations ;
17+ }
18+ }
Original file line number Diff line number Diff line change 1- import { Vue } from 'vue-property-decorator' ;
21import { TreeViewItem , CheckedState } from "@/businessLogic/contracts/types" ;
32import { eventHub } from "@/businessLogic/eventHub/explorerEventPublisher" ;
43import { cascadeStateToDescendants , flattenNodes } from "../hierachyTraversal/hierachyTraversal" ;
54
6- export interface TreeViewItemEvents {
7- checkedStatusChanged ( item : TreeViewItem ) : void ;
8- }
9-
10- export interface TreeViewViewModel extends TreeViewItemEvents {
5+ let flattenedNodesLookUp : { [ id : string ] : TreeViewItem } = { } ;
6+ export interface TreeViewViewModel {
117 loadNodes ( nodes : TreeViewItem [ ] ) : void ;
128 getNodes ( ) : { [ id : string ] : TreeViewItem } ;
139 removeTreeViewItem ( id : string ) : boolean ;
@@ -17,7 +13,6 @@ export interface TreeViewViewModel extends TreeViewItemEvents {
1713 checkedStatusChanged ( item : TreeViewItem ) : void ;
1814}
1915
20- let flattenedNodesLookUp : { [ id : string ] : TreeViewItem } = { } ;
2116
2217export const notifyParentOfSelection = ( item : TreeViewItem ) : void => {
2318 const parentId = item . parentId as string ;
You can’t perform that action at this time.
0 commit comments