@@ -3,6 +3,8 @@ import PropTypes from 'prop-types';
33import ErrorBoundary from './error-boundary' ;
44import * as plugins from '../modules/plugins' ;
55
6+ import { TestRepeaterComponent } from './test-repeater' ;
7+
68export default class ExtensionPoint extends Component {
79 static propTypes = {
810 name : PropTypes . string . isRequired ,
@@ -12,13 +14,14 @@ export default class ExtensionPoint extends Component {
1214 render ( ) {
1315 const loadedPluginConfigs = plugins . getLoadedConfigs ( ) ;
1416
15- if ( loadedPluginConfigs . length ) {
16- const { name : pointName , children : reportComponent , ...componentProps } = this . props ;
17- const pluginComponents = getExtensionPointComponents ( loadedPluginConfigs , pointName ) ;
18- return getComponentsComposition ( pluginComponents , reportComponent , componentProps ) ;
19- }
17+ const { name : pointName , children : reportComponent , ...componentProps } = this . props ;
18+ const pluginComponents = getExtensionPointComponents ( loadedPluginConfigs , pointName ) ;
2019
21- return this . props . children ;
20+ return (
21+ < div style = { { display : 'flex' , gap : '12px' , flexDirection : 'column' } } >
22+ { getComponentsComposition ( pluginComponents , reportComponent , componentProps ) }
23+ </ div >
24+ ) ;
2225 }
2326}
2427
@@ -60,26 +63,30 @@ function composeComponents(PluginComponent, pluginProps, currentComponent, posit
6063 }
6164}
6265
66+ const defaultComponents = [
67+ TestRepeaterComponent
68+ ] ;
69+
6370export function getExtensionPointComponents ( loadedPluginConfigs , pointName ) {
64- return loadedPluginConfigs
65- . map ( config => {
66- try {
67- const PluginComponent = plugins . get ( config . name , config . component ) ;
68- return {
69- PluginComponent,
70- name ,
71- point : getComponentPoint ( PluginComponent , config ) ,
72- position : getComponentPosition ( PluginComponent , config ) ,
73- config
74- } ;
75- } catch ( err ) {
76- console . error ( err ) ;
77- return { } ;
78- }
79- } )
80- . filter ( ( { point , position } ) => {
81- return point && position && point === pointName ;
82- } ) ;
71+ return [
72+ ... defaultComponents ,
73+ ... loadedPluginConfigs
74+ . map ( config => {
75+ try {
76+ const PluginComponent = plugins . get ( config . name , config . component ) ;
77+ return {
78+ PluginComponent ,
79+ name ,
80+ point : getComponentPoint ( PluginComponent , config ) ,
81+ position : getComponentPosition ( PluginComponent , config ) ,
82+ config
83+ } ;
84+ } catch ( err ) {
85+ console . error ( err ) ;
86+ return { } ;
87+ }
88+ } )
89+ ] . filter ( ( { point , position } ) => ( point && position && point === pointName ) ) ;
8390}
8491
8592function getComponentPoint ( component , config ) {
0 commit comments