diff --git a/packages/plugin-view-manager-pane/src/components/resourceTree/index.tsx b/packages/plugin-view-manager-pane/src/components/resourceTree/index.tsx index a7a6cb7..2b0112f 100644 --- a/packages/plugin-view-manager-pane/src/components/resourceTree/index.tsx +++ b/packages/plugin-view-manager-pane/src/components/resourceTree/index.tsx @@ -14,13 +14,21 @@ import { AddFile } from '../addFile'; const { Popup } = Overlay; const { Item } = Menu; +function filterResourceList(resourceList: IPublicModelResource[] | undefined, handler?: Function) { + if (typeof handler === 'function') { + return handler(resourceList); + } + + return resourceList; +} + export function ResourcePaneContent(props: IPluginOptions) { const { workspace } = props.pluginContext || {}; const [resourceList, setResourceList] = useState( - workspace?.resourceList + filterResourceList(workspace?.resourceList, props?.options?.filterResourceList) ); workspace?.onResourceListChange(() => { - setResourceList(workspace.resourceList); + setResourceList(filterResourceList(workspace?.resourceList, props?.options?.filterResourceList)); }); return ( void; + filterResourceList?: () => {}; + showIconText?: boolean; skeletonConfig?: IPublicTypeSkeletonConfig; @@ -135,6 +137,11 @@ ViewManagerPane.meta = { type: 'function', description: '', }, + { + key: 'filterResourceList', + type: 'function', + description: '', + }, { key: 'showIconText', type: 'boolean',