File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { formsDemo } from './demos/forms';
99import { sideBySideDemo } from './demos/sideBySide' ;
1010import { longContentDemo } from './demos/longContent' ;
1111import { inputsDemo } from './demos/inputs' ;
12+ import { WrapperProps } from './components/registry/componentWrapper' ;
1213
1314const widgets = new Registry ( 'widgets' , { componentWrapper : DemoWrapper } ) ;
1415widgets
@@ -46,14 +47,10 @@ export class App extends React.Component {
4647 }
4748}
4849
49- interface Props {
50- children : JSX . Element | JSX . Element [ ] ;
51- }
52-
53- function DemoWrapper ( { children} : Props ) {
50+ function DemoWrapper ( { OriginalComponent} : WrapperProps ) {
5451 return (
5552 < div className = "component-demo-local-wrapper" >
56- { children }
53+ < OriginalComponent />
5754 </ div >
5855 ) ;
5956}
Original file line number Diff line number Diff line change @@ -8,11 +8,14 @@ import { LayoutProps } from './layouts/LayoutProps';
88
99import { simulateState , refreshComponents } from './state/stateSimulation' ;
1010
11+ import { WrapperProps } from './registry/componentWrapper' ;
12+
1113export {
1214 Registry ,
1315 Registries ,
1416 ComponentDemo ,
1517 ComponentViewer ,
18+ WrapperProps ,
1619 LayoutProps ,
1720 GridLayout ,
1821 TabsLayout ,
Original file line number Diff line number Diff line change @@ -6,10 +6,10 @@ import { TabsLayout } from '../layouts/TabsLayout';
66import { LayoutProps } from '../layouts/LayoutProps' ;
77import { LabelInstanceTableLayout } from '../layouts/LabelInstanceTableLayout' ;
88import { SingleItemLayout } from '../layouts/SingleItemLayout' ;
9- import { wrapComponent } from './componentWrapper' ;
9+ import { wrapComponent , WrapperProps } from './componentWrapper' ;
1010
1111export interface RegistryConfig {
12- componentWrapper ?: React . ComponentType ;
12+ componentWrapper ?: React . ComponentType < WrapperProps > ;
1313}
1414
1515class Registry {
Original file line number Diff line number Diff line change 11import * as React from 'react' ;
22
3- export function wrapComponent ( Wrapper : React . ComponentType , Component : React . ComponentType ) {
3+ export interface WrapperProps {
4+ OriginalComponent : React . ComponentType ;
5+ }
6+
7+ export function wrapComponent ( Wrapper : React . ComponentType < WrapperProps > , Component : React . ComponentType ) {
48 return ( ) => (
5- < Wrapper >
6- < Component />
7- </ Wrapper >
9+ < Wrapper OriginalComponent = { Component } />
810 ) ;
911}
You can’t perform that action at this time.
0 commit comments