-
Notifications
You must be signed in to change notification settings - Fork 54
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
820ec78
commit 4f72d11
Showing
1,199 changed files
with
75,055 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Source: App.js</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">Source: App.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>/** | ||
* Internal module, you should not use it directly | ||
* @module react-cmf/lib/App | ||
*/ | ||
import PropTypes from 'prop-types'; | ||
|
||
import { Provider } from 'react-redux'; | ||
|
||
import RegistryProvider from './RegistryProvider'; | ||
import { WaitForSettings } from './settings'; | ||
import ErrorBoundary from './components/ErrorBoundary/ErrorBoundary.component'; | ||
|
||
/** | ||
* The React component that render your app and provide CMF environment. | ||
* @param {object} props { store } | ||
* @return {object} ReactElement | ||
*/ | ||
export default function App(props) { | ||
let content = props.children; | ||
if (props.withSettings) { | ||
content = <WaitForSettings loading={props.loading}>{content}</WaitForSettings>; | ||
} | ||
return ( | ||
<Provider store={props.store}> | ||
<RegistryProvider value={props.registry}> | ||
<ErrorBoundary fullPage>{content}</ErrorBoundary> | ||
</RegistryProvider> | ||
</Provider> | ||
); | ||
} | ||
|
||
App.displayName = 'CMFApp'; | ||
App.propTypes = { | ||
store: PropTypes.object.isRequired, | ||
registry: PropTypes.object, | ||
children: PropTypes.node, | ||
withSettings: PropTypes.bool, | ||
loading: PropTypes.func, | ||
}; | ||
|
||
App.defaultProps = { | ||
loading: () => 'loading', | ||
}; | ||
</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-react-cmf.html">react-cmf</a></li><li><a href="module-react-cmf_lib_App.html">react-cmf/lib/App</a></li><li><a href="module-react-cmf_lib_Dispatcher.html">react-cmf/lib/Dispatcher</a></li><li><a href="module-react-cmf_lib_Inject.html">react-cmf/lib/Inject</a></li><li><a href="module-react-cmf_lib_RegistryProvider.html">react-cmf/lib/RegistryProvider</a></li><li><a href="module-react-cmf_lib_action.html">react-cmf/lib/action</a></li><li><a href="module-react-cmf_lib_actions.html">react-cmf/lib/actions</a></li><li><a href="module-react-cmf_lib_actions_collectionsActions.html">react-cmf/lib/actions/collectionsActions</a></li><li><a href="module-react-cmf_lib_actions_componentsActions.html">react-cmf/lib/actions/componentsActions</a></li><li><a href="module-react-cmf_lib_actions_settingsActions.html">react-cmf/lib/actions/settingsActions</a></li><li><a href="module-react-cmf_lib_cmfConnect.html">react-cmf/lib/cmfConnect</a></li><li><a href="module-react-cmf_lib_componentState.html">react-cmf/lib/componentState</a></li><li><a href="module-react-cmf_lib_deprecated.html">react-cmf/lib/deprecated</a></li><li><a href="module-react-cmf_lib_expression.html">react-cmf/lib/expression</a></li><li><a href="module-react-cmf_lib_reducers.html">react-cmf/lib/reducers</a></li><li><a href="module-react-cmf_lib_reducers_collectionsReducers.html">react-cmf/lib/reducers/collectionsReducers</a></li><li><a href="module-react-cmf_lib_reducers_componentsReducers.html">react-cmf/lib/reducers/componentsReducers</a></li><li><a href="module-react-cmf_lib_reducers_settingsReducers.html">react-cmf/lib/reducers/settingsReducers</a></li><li><a href="module-react-cmf_lib_registry.html">react-cmf/lib/registry</a></li><li><a href="module-react-cmf_lib_store.html">react-cmf/lib/store</a></li></ul><h3><a href="global.html">Global</a></h3> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Thu Dec 19 2024 10:23:27 GMT+0000 (Coordinated Universal Time) | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
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,141 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Source: Dispatcher.js</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">Source: Dispatcher.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>/** | ||
* This module expose Dispatcher component. | ||
* @module react-cmf/lib/Dispatcher | ||
* @see module:react-cmf/lib/action | ||
*/ | ||
import PropTypes from 'prop-types'; | ||
|
||
import { useContext, Children, cloneElement } from 'react'; | ||
import cmfConnect from './cmfConnect'; | ||
import action from './action'; | ||
import actionCreator from './actionCreator'; | ||
import { RegistryContext } from './RegistryProvider'; | ||
|
||
/** | ||
* This component purpose is to decorate any component and map an user event | ||
* to an action to be dispatched | ||
* @example | ||
function myfunc(event, props, context) { | ||
} | ||
<Dispatcher onClick={myfunc}> | ||
<ChildrenElement /> | ||
</Dispatcher> | ||
*/ | ||
export function Dispatcher(props) { | ||
const registry = useContext(RegistryContext); | ||
// console.log('@@@ registry', registry); | ||
|
||
/** | ||
* on any even just try to find a onTHEEVENT props. | ||
* If found execute it with the common stuff | ||
* (event, props, context) | ||
* @param {object} event the react event dispatched event | ||
* @param {string} eventName the name of the event | ||
*/ | ||
function onEvent(event, eventName) { | ||
if (props.stopPropagation) { | ||
event.stopPropagation(); | ||
} | ||
if (props.preventDefault) { | ||
event.preventDefault(); | ||
} | ||
if (props[eventName]) { | ||
props.dispatchActionCreator(props[eventName], event, props); | ||
} | ||
} | ||
|
||
function checkIfActionInfoExist() { | ||
action.getOnProps(props).forEach(name => { | ||
if (typeof props[name] === 'string') { | ||
actionCreator.get({ registry }, props[name]); | ||
} | ||
}); | ||
} | ||
|
||
checkIfActionInfoExist(); | ||
const onProps = action.getOnProps(props); | ||
const childrenWithProps = Children.map(props.children, child => { | ||
const newProps = {}; | ||
onProps.forEach(name => { | ||
newProps[name] = event => onEvent(event, name); | ||
}); | ||
return cloneElement(child, newProps); | ||
}); | ||
return Children.only(childrenWithProps[0]); | ||
} | ||
|
||
Dispatcher.propTypes = { | ||
children: PropTypes.node.isRequired, | ||
stopPropagation: PropTypes.bool, | ||
preventDefault: PropTypes.bool, | ||
dispatchActionCreator: PropTypes.func, | ||
}; | ||
Dispatcher.displayName = 'Dispatcher'; | ||
Dispatcher.defaultProps = { | ||
stopPropagation: false, | ||
preventDefault: false, | ||
}; | ||
const ConnectedDispatcher = cmfConnect({ | ||
withDispatchActionCreator: true, | ||
})(Dispatcher); | ||
|
||
/** | ||
* This component purpose is to decorate any component and map an user event | ||
* to an action to be dispatched | ||
* @example | ||
<Dispatcher onClick="actionCreator:identifier" onDrag="actionCreator:anotherid"> | ||
<ChildrenElement /> | ||
</Dispatcher> | ||
*/ | ||
export default ConnectedDispatcher; | ||
</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-react-cmf.html">react-cmf</a></li><li><a href="module-react-cmf_lib_App.html">react-cmf/lib/App</a></li><li><a href="module-react-cmf_lib_Dispatcher.html">react-cmf/lib/Dispatcher</a></li><li><a href="module-react-cmf_lib_Inject.html">react-cmf/lib/Inject</a></li><li><a href="module-react-cmf_lib_RegistryProvider.html">react-cmf/lib/RegistryProvider</a></li><li><a href="module-react-cmf_lib_action.html">react-cmf/lib/action</a></li><li><a href="module-react-cmf_lib_actions.html">react-cmf/lib/actions</a></li><li><a href="module-react-cmf_lib_actions_collectionsActions.html">react-cmf/lib/actions/collectionsActions</a></li><li><a href="module-react-cmf_lib_actions_componentsActions.html">react-cmf/lib/actions/componentsActions</a></li><li><a href="module-react-cmf_lib_actions_settingsActions.html">react-cmf/lib/actions/settingsActions</a></li><li><a href="module-react-cmf_lib_cmfConnect.html">react-cmf/lib/cmfConnect</a></li><li><a href="module-react-cmf_lib_componentState.html">react-cmf/lib/componentState</a></li><li><a href="module-react-cmf_lib_deprecated.html">react-cmf/lib/deprecated</a></li><li><a href="module-react-cmf_lib_expression.html">react-cmf/lib/expression</a></li><li><a href="module-react-cmf_lib_reducers.html">react-cmf/lib/reducers</a></li><li><a href="module-react-cmf_lib_reducers_collectionsReducers.html">react-cmf/lib/reducers/collectionsReducers</a></li><li><a href="module-react-cmf_lib_reducers_componentsReducers.html">react-cmf/lib/reducers/componentsReducers</a></li><li><a href="module-react-cmf_lib_reducers_settingsReducers.html">react-cmf/lib/reducers/settingsReducers</a></li><li><a href="module-react-cmf_lib_registry.html">react-cmf/lib/registry</a></li><li><a href="module-react-cmf_lib_store.html">react-cmf/lib/store</a></li></ul><h3><a href="global.html">Global</a></h3> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Thu Dec 19 2024 10:23:27 GMT+0000 (Coordinated Universal Time) | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
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,96 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Source: Inject.component.js</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">Source: Inject.component.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>import PropTypes from 'prop-types'; | ||
import componentAPI from './component'; | ||
import { useCMFContext } from './useContext'; | ||
|
||
/** | ||
* The Inject component let you use the registry to render named component | ||
* using the registry. It will not break the app if component is not found | ||
* but it will display an error. | ||
* @module react-cmf/lib/Inject | ||
* @example | ||
import { Inject } from '@talend/react-cmf'; | ||
// this is not the best example but it show the concept | ||
function MyComponent(props) { | ||
return ( | ||
<Inject component="Action" onClick={props.onClick}> | ||
<Inject component="Icon" icon={props.icon} /> | ||
</Inject> | ||
); | ||
} | ||
*/ | ||
|
||
function NotFoundComponent({ error }) { | ||
// eslint-disable-next-line no-console | ||
console.error(error); | ||
return <div className="alert alert-danger">{error.message}</div>; | ||
} | ||
NotFoundComponent.propTypes = { | ||
error: PropTypes.string.isRequired, | ||
}; | ||
|
||
function Inject({ component, ...props }) { | ||
const context = useCMFContext(); | ||
try { | ||
const Component = componentAPI.get(component, context); | ||
return <Component {...props} />; | ||
} catch (error) { | ||
return <NotFoundComponent error={error} />; | ||
} | ||
} | ||
Inject.propTypes = { | ||
component: PropTypes.string.isRequired, | ||
}; | ||
Inject.NotFoundComponent = NotFoundComponent; | ||
|
||
export default Inject; | ||
</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-react-cmf.html">react-cmf</a></li><li><a href="module-react-cmf_lib_App.html">react-cmf/lib/App</a></li><li><a href="module-react-cmf_lib_Dispatcher.html">react-cmf/lib/Dispatcher</a></li><li><a href="module-react-cmf_lib_Inject.html">react-cmf/lib/Inject</a></li><li><a href="module-react-cmf_lib_RegistryProvider.html">react-cmf/lib/RegistryProvider</a></li><li><a href="module-react-cmf_lib_action.html">react-cmf/lib/action</a></li><li><a href="module-react-cmf_lib_actions.html">react-cmf/lib/actions</a></li><li><a href="module-react-cmf_lib_actions_collectionsActions.html">react-cmf/lib/actions/collectionsActions</a></li><li><a href="module-react-cmf_lib_actions_componentsActions.html">react-cmf/lib/actions/componentsActions</a></li><li><a href="module-react-cmf_lib_actions_settingsActions.html">react-cmf/lib/actions/settingsActions</a></li><li><a href="module-react-cmf_lib_cmfConnect.html">react-cmf/lib/cmfConnect</a></li><li><a href="module-react-cmf_lib_componentState.html">react-cmf/lib/componentState</a></li><li><a href="module-react-cmf_lib_deprecated.html">react-cmf/lib/deprecated</a></li><li><a href="module-react-cmf_lib_expression.html">react-cmf/lib/expression</a></li><li><a href="module-react-cmf_lib_reducers.html">react-cmf/lib/reducers</a></li><li><a href="module-react-cmf_lib_reducers_collectionsReducers.html">react-cmf/lib/reducers/collectionsReducers</a></li><li><a href="module-react-cmf_lib_reducers_componentsReducers.html">react-cmf/lib/reducers/componentsReducers</a></li><li><a href="module-react-cmf_lib_reducers_settingsReducers.html">react-cmf/lib/reducers/settingsReducers</a></li><li><a href="module-react-cmf_lib_registry.html">react-cmf/lib/registry</a></li><li><a href="module-react-cmf_lib_store.html">react-cmf/lib/store</a></li></ul><h3><a href="global.html">Global</a></h3> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Thu Dec 19 2024 10:23:27 GMT+0000 (Coordinated Universal Time) | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
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,64 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Source: RegistryProvider.js</title> | ||
|
||
<script src="scripts/prettify/prettify.js"> </script> | ||
<script src="scripts/prettify/lang-css.js"> </script> | ||
<!--[if lt IE 9]> | ||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> | ||
<![endif]--> | ||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> | ||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> | ||
</head> | ||
|
||
<body> | ||
|
||
<div id="main"> | ||
|
||
<h1 class="page-title">Source: RegistryProvider.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>/** | ||
* Internal. This is the component which inject the registry as child context. | ||
* It is called by the App component | ||
* @module react-cmf/lib/RegistryProvider | ||
* @see module:react-cmf/lib/App | ||
*/ | ||
import { createContext } from 'react'; | ||
import Registry from './registry'; | ||
|
||
export const RegistryContext = createContext(Registry.getRegistry()); | ||
export const RegistryProvider = RegistryContext.Provider; | ||
|
||
export default RegistryContext.Provider; | ||
</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-react-cmf.html">react-cmf</a></li><li><a href="module-react-cmf_lib_App.html">react-cmf/lib/App</a></li><li><a href="module-react-cmf_lib_Dispatcher.html">react-cmf/lib/Dispatcher</a></li><li><a href="module-react-cmf_lib_Inject.html">react-cmf/lib/Inject</a></li><li><a href="module-react-cmf_lib_RegistryProvider.html">react-cmf/lib/RegistryProvider</a></li><li><a href="module-react-cmf_lib_action.html">react-cmf/lib/action</a></li><li><a href="module-react-cmf_lib_actions.html">react-cmf/lib/actions</a></li><li><a href="module-react-cmf_lib_actions_collectionsActions.html">react-cmf/lib/actions/collectionsActions</a></li><li><a href="module-react-cmf_lib_actions_componentsActions.html">react-cmf/lib/actions/componentsActions</a></li><li><a href="module-react-cmf_lib_actions_settingsActions.html">react-cmf/lib/actions/settingsActions</a></li><li><a href="module-react-cmf_lib_cmfConnect.html">react-cmf/lib/cmfConnect</a></li><li><a href="module-react-cmf_lib_componentState.html">react-cmf/lib/componentState</a></li><li><a href="module-react-cmf_lib_deprecated.html">react-cmf/lib/deprecated</a></li><li><a href="module-react-cmf_lib_expression.html">react-cmf/lib/expression</a></li><li><a href="module-react-cmf_lib_reducers.html">react-cmf/lib/reducers</a></li><li><a href="module-react-cmf_lib_reducers_collectionsReducers.html">react-cmf/lib/reducers/collectionsReducers</a></li><li><a href="module-react-cmf_lib_reducers_componentsReducers.html">react-cmf/lib/reducers/componentsReducers</a></li><li><a href="module-react-cmf_lib_reducers_settingsReducers.html">react-cmf/lib/reducers/settingsReducers</a></li><li><a href="module-react-cmf_lib_registry.html">react-cmf/lib/registry</a></li><li><a href="module-react-cmf_lib_store.html">react-cmf/lib/store</a></li></ul><h3><a href="global.html">Global</a></h3> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Thu Dec 19 2024 10:23:27 GMT+0000 (Coordinated Universal Time) | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
Oops, something went wrong.