-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
98e81fc
commit cea5aba
Showing
14 changed files
with
200 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
@plotly/dash-test-components/src/components/AsyncComponent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import PropTypes from 'prop-types'; | ||
import React, { Suspense } from 'react'; | ||
import { asyncDecorator } from '@plotly/dash-component-plugins'; | ||
import asyncComponentLoader from './../fragments/AsyncComponentLoader'; | ||
|
||
const AsyncComponent = props => (<Suspense fallback={null}> | ||
<RealAsyncComponent {...props} /> | ||
</Suspense>); | ||
|
||
const RealAsyncComponent = asyncDecorator(AsyncComponent, asyncComponentLoader); | ||
|
||
AsyncComponent.propTypes = { | ||
id: PropTypes.string, | ||
value: PropTypes.string | ||
}; | ||
|
||
AsyncComponent.defaultProps = {}; | ||
|
||
export default AsyncComponent; |
18 changes: 18 additions & 0 deletions
18
@plotly/dash-test-components/src/components/CollapseComponent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import PropTypes from 'prop-types'; | ||
import React, { Fragment } from 'react'; | ||
|
||
const CollapseComponent = props => (<Fragment> | ||
{display ? props.children : null} | ||
</Fragment>); | ||
|
||
CollapseComponent.propTypes = { | ||
children: PropTypes.node, | ||
display: PropTypes.bool, | ||
id: PropTypes.string | ||
}; | ||
|
||
CollapseComponent.defaultProps = { | ||
display: false | ||
}; | ||
|
||
export default CollapseComponent; |
18 changes: 18 additions & 0 deletions
18
@plotly/dash-test-components/src/components/DelayedEventComponent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import PropTypes from 'prop-types'; | ||
import React from 'react'; | ||
|
||
const DelayedEventComponent = ({ id, n_clicks, setProps }) => (<button | ||
id={id} | ||
onClick={() => setTimeout(() => setProps({ n_clicks: n_clicks + 1 }), 20)} | ||
/>); | ||
|
||
DelayedEventComponent.propTypes = { | ||
id: PropTypes.string, | ||
n_clicks: PropTypes.number | ||
}; | ||
|
||
DelayedEventComponent.defaultProps = { | ||
n_clicks: 0 | ||
}; | ||
|
||
export default DelayedEventComponent; |
15 changes: 15 additions & 0 deletions
15
@plotly/dash-test-components/src/components/FragmentComponent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import PropTypes from 'prop-types'; | ||
import React, { Fragment } from 'react'; | ||
|
||
const FragmentComponent = props => (<Fragment> | ||
{props.children} | ||
</Fragment>); | ||
|
||
FragmentComponent.propTypes = { | ||
children: PropTypes.node, | ||
id: PropTypes.string | ||
}; | ||
|
||
FragmentComponent.defaultProps = {}; | ||
|
||
export default FragmentComponent; |
19 changes: 19 additions & 0 deletions
19
@plotly/dash-test-components/src/fragments/AsyncComponent.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import PropTypes from 'prop-types'; | ||
import React, { Fragment } from 'react'; | ||
import { asyncDecorator } from '@plotly/dash-component-plugins'; | ||
|
||
/** | ||
* MyComponent description | ||
*/ | ||
const AsyncComponent = ({ value }) => (<Fragment> | ||
{value} | ||
</Fragment>); | ||
|
||
AsyncComponent.propTypes = { | ||
id: PropTypes.string, | ||
value: PropTypes.string | ||
}; | ||
|
||
AsyncComponent.defaultProps = {}; | ||
|
||
export default AsyncComponent; |
1 change: 1 addition & 0 deletions
1
@plotly/dash-test-components/src/fragments/AsyncComponentLoader.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default () => import('./AsyncComponent'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,18 @@ | ||
import AsyncComponent from './components/AsyncComponent'; | ||
import CollapseComponent from './components/CollapseComponent'; | ||
import DelayedEventComponent from './components/DelayedEventComponent'; | ||
import FragmentComponent from './components/FragmentComponent'; | ||
import StyledComponent from './components/StyledComponent'; | ||
import MyPersistedComponent from './components/MyPersistedComponent'; | ||
import MyPersistedComponentNested from './components/MyPersistedComponentNested'; | ||
|
||
|
||
export { | ||
StyledComponent, MyPersistedComponent, MyPersistedComponentNested | ||
AsyncComponent, | ||
CollapseComponent, | ||
DelayedEventComponent, | ||
FragmentComponent, | ||
MyPersistedComponent, | ||
MyPersistedComponentNested, | ||
StyledComponent | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters