File tree Expand file tree Collapse file tree
packages/plugin-view-manager-pane/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,13 +14,21 @@ import { AddFile } from '../addFile';
1414const { Popup } = Overlay ;
1515const { Item } = Menu ;
1616
17+ function filterResourceList ( resourceList : IPublicModelResource [ ] | undefined , handler ?: Function ) {
18+ if ( typeof handler === 'function' ) {
19+ return handler ( resourceList ) ;
20+ }
21+
22+ return resourceList ;
23+ }
24+
1725export function ResourcePaneContent ( props : IPluginOptions ) {
1826 const { workspace } = props . pluginContext || { } ;
1927 const [ resourceList , setResourceList ] = useState < IPublicModelResource [ ] | undefined > (
20- workspace ?. resourceList
28+ filterResourceList ( workspace ?. resourceList , props ?. options ?. filterResourceList )
2129 ) ;
2230 workspace ?. onResourceListChange ( ( ) => {
23- setResourceList ( workspace . resourceList ) ;
31+ setResourceList ( filterResourceList ( workspace ? .resourceList , props ?. options ?. filterResourceList ) ) ;
2432 } ) ;
2533 return (
2634 < ResourceListTree
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ export interface IOptions {
3232
3333 handleClose ?: ( force ?: boolean ) => void ;
3434
35+ filterResourceList ?: ( ) => { } ;
36+
3537 showIconText ?: boolean ;
3638
3739 skeletonConfig ?: IPublicTypeSkeletonConfig ;
@@ -135,6 +137,11 @@ ViewManagerPane.meta = {
135137 type : 'function' ,
136138 description : '' ,
137139 } ,
140+ {
141+ key : 'filterResourceList' ,
142+ type : 'function' ,
143+ description : '' ,
144+ } ,
138145 {
139146 key : 'showIconText' ,
140147 type : 'boolean' ,
You can’t perform that action at this time.
0 commit comments