-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2762 from plotly/feat/dynamic-loading
Dynamic loading of component libraries.
- Loading branch information
Showing
24 changed files
with
666 additions
and
113 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import checkPropTypes from './checkPropTypes'; | ||
import {propTypeErrorHandler} from './exceptions'; | ||
import {createLibraryElement} from './libraries/createLibraryElement'; | ||
import PropTypes from 'prop-types'; | ||
|
||
export function CheckedComponent(p) { | ||
const {element, extraProps, props, children, type} = p; | ||
|
||
const errorMessage = checkPropTypes( | ||
element.propTypes, | ||
props, | ||
'component prop', | ||
element | ||
); | ||
if (errorMessage) { | ||
propTypeErrorHandler(errorMessage, props, type); | ||
} | ||
|
||
return createLibraryElement(element, props, extraProps, children); | ||
} | ||
|
||
CheckedComponent.propTypes = { | ||
children: PropTypes.any, | ||
element: PropTypes.any, | ||
layout: PropTypes.any, | ||
props: PropTypes.any, | ||
extraProps: PropTypes.any, | ||
id: PropTypes.string, | ||
type: PropTypes.string | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import {LibrariesActions} from '../libraries/libraryTypes'; | ||
|
||
const createAction = (type: LibrariesActions) => (payload: any) => ({ | ||
type, | ||
payload | ||
}); | ||
|
||
export const setLibraryLoading = createAction(LibrariesActions.LOAD); | ||
export const setLibraryLoaded = createAction(LibrariesActions.LOADED); | ||
export const setLibraryToLoad = createAction(LibrariesActions.TO_LOAD); |
Oops, something went wrong.