Skip to content

Commit 2371234

Browse files
doc: update demo from 5547
1 parent e97eca6 commit 2371234

File tree

1,199 files changed

+75055
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,199 files changed

+75055
-0
lines changed

5547/cmf/jsdoc/App.js.html

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>JSDoc: Source: App.js</title>
6+
7+
<script src="scripts/prettify/prettify.js"> </script>
8+
<script src="scripts/prettify/lang-css.js"> </script>
9+
<!--[if lt IE 9]>
10+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11+
<![endif]-->
12+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14+
</head>
15+
16+
<body>
17+
18+
<div id="main">
19+
20+
<h1 class="page-title">Source: App.js</h1>
21+
22+
23+
24+
25+
26+
27+
<section>
28+
<article>
29+
<pre class="prettyprint source linenums"><code>/**
30+
* Internal module, you should not use it directly
31+
* @module react-cmf/lib/App
32+
*/
33+
import PropTypes from 'prop-types';
34+
35+
import { Provider } from 'react-redux';
36+
37+
import RegistryProvider from './RegistryProvider';
38+
import { WaitForSettings } from './settings';
39+
import ErrorBoundary from './components/ErrorBoundary/ErrorBoundary.component';
40+
41+
/**
42+
* The React component that render your app and provide CMF environment.
43+
* @param {object} props { store }
44+
* @return {object} ReactElement
45+
*/
46+
export default function App(props) {
47+
let content = props.children;
48+
if (props.withSettings) {
49+
content = &lt;WaitForSettings loading={props.loading}>{content}&lt;/WaitForSettings>;
50+
}
51+
return (
52+
&lt;Provider store={props.store}>
53+
&lt;RegistryProvider value={props.registry}>
54+
&lt;ErrorBoundary fullPage>{content}&lt;/ErrorBoundary>
55+
&lt;/RegistryProvider>
56+
&lt;/Provider>
57+
);
58+
}
59+
60+
App.displayName = 'CMFApp';
61+
App.propTypes = {
62+
store: PropTypes.object.isRequired,
63+
registry: PropTypes.object,
64+
children: PropTypes.node,
65+
withSettings: PropTypes.bool,
66+
loading: PropTypes.func,
67+
};
68+
69+
App.defaultProps = {
70+
loading: () => 'loading',
71+
};
72+
</code></pre>
73+
</article>
74+
</section>
75+
76+
77+
78+
79+
</div>
80+
81+
<nav>
82+
<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>
83+
</nav>
84+
85+
<br class="clear">
86+
87+
<footer>
88+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Mon Jun 09 2025 15:40:33 GMT+0000 (Coordinated Universal Time)
89+
</footer>
90+
91+
<script> prettyPrint(); </script>
92+
<script src="scripts/linenumber.js"> </script>
93+
</body>
94+
</html>

5547/cmf/jsdoc/Dispatcher.js.html

Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>JSDoc: Source: Dispatcher.js</title>
6+
7+
<script src="scripts/prettify/prettify.js"> </script>
8+
<script src="scripts/prettify/lang-css.js"> </script>
9+
<!--[if lt IE 9]>
10+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11+
<![endif]-->
12+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14+
</head>
15+
16+
<body>
17+
18+
<div id="main">
19+
20+
<h1 class="page-title">Source: Dispatcher.js</h1>
21+
22+
23+
24+
25+
26+
27+
<section>
28+
<article>
29+
<pre class="prettyprint source linenums"><code>/**
30+
* This module expose Dispatcher component.
31+
* @module react-cmf/lib/Dispatcher
32+
* @see module:react-cmf/lib/action
33+
*/
34+
import PropTypes from 'prop-types';
35+
36+
import { useContext, Children, cloneElement } from 'react';
37+
import cmfConnect from './cmfConnect';
38+
import action from './action';
39+
import actionCreator from './actionCreator';
40+
import { RegistryContext } from './RegistryProvider';
41+
42+
/**
43+
* This component purpose is to decorate any component and map an user event
44+
* to an action to be dispatched
45+
* @example
46+
function myfunc(event, props, context) {
47+
}
48+
&lt;Dispatcher onClick={myfunc}>
49+
&lt;ChildrenElement />
50+
&lt;/Dispatcher>
51+
*/
52+
export function Dispatcher(props) {
53+
const registry = useContext(RegistryContext);
54+
// console.log('@@@ registry', registry);
55+
56+
/**
57+
* on any even just try to find a onTHEEVENT props.
58+
* If found execute it with the common stuff
59+
* (event, props, context)
60+
* @param {object} event the react event dispatched event
61+
* @param {string} eventName the name of the event
62+
*/
63+
function onEvent(event, eventName) {
64+
if (props.stopPropagation) {
65+
event.stopPropagation();
66+
}
67+
if (props.preventDefault) {
68+
event.preventDefault();
69+
}
70+
if (props[eventName]) {
71+
props.dispatchActionCreator(props[eventName], event, props);
72+
}
73+
}
74+
75+
function checkIfActionInfoExist() {
76+
action.getOnProps(props).forEach(name => {
77+
if (typeof props[name] === 'string') {
78+
actionCreator.get({ registry }, props[name]);
79+
}
80+
});
81+
}
82+
83+
checkIfActionInfoExist();
84+
const onProps = action.getOnProps(props);
85+
const childrenWithProps = Children.map(props.children, child => {
86+
const newProps = {};
87+
onProps.forEach(name => {
88+
newProps[name] = event => onEvent(event, name);
89+
});
90+
return cloneElement(child, newProps);
91+
});
92+
return Children.only(childrenWithProps[0]);
93+
}
94+
95+
Dispatcher.propTypes = {
96+
children: PropTypes.node.isRequired,
97+
stopPropagation: PropTypes.bool,
98+
preventDefault: PropTypes.bool,
99+
dispatchActionCreator: PropTypes.func,
100+
};
101+
Dispatcher.displayName = 'Dispatcher';
102+
Dispatcher.defaultProps = {
103+
stopPropagation: false,
104+
preventDefault: false,
105+
};
106+
const ConnectedDispatcher = cmfConnect({
107+
withDispatchActionCreator: true,
108+
})(Dispatcher);
109+
110+
/**
111+
* This component purpose is to decorate any component and map an user event
112+
* to an action to be dispatched
113+
* @example
114+
&lt;Dispatcher onClick="actionCreator:identifier" onDrag="actionCreator:anotherid">
115+
&lt;ChildrenElement />
116+
&lt;/Dispatcher>
117+
*/
118+
export default ConnectedDispatcher;
119+
</code></pre>
120+
</article>
121+
</section>
122+
123+
124+
125+
126+
</div>
127+
128+
<nav>
129+
<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>
130+
</nav>
131+
132+
<br class="clear">
133+
134+
<footer>
135+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Mon Jun 09 2025 15:40:33 GMT+0000 (Coordinated Universal Time)
136+
</footer>
137+
138+
<script> prettyPrint(); </script>
139+
<script src="scripts/linenumber.js"> </script>
140+
</body>
141+
</html>
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>JSDoc: Source: Inject.component.js</title>
6+
7+
<script src="scripts/prettify/prettify.js"> </script>
8+
<script src="scripts/prettify/lang-css.js"> </script>
9+
<!--[if lt IE 9]>
10+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11+
<![endif]-->
12+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14+
</head>
15+
16+
<body>
17+
18+
<div id="main">
19+
20+
<h1 class="page-title">Source: Inject.component.js</h1>
21+
22+
23+
24+
25+
26+
27+
<section>
28+
<article>
29+
<pre class="prettyprint source linenums"><code>import PropTypes from 'prop-types';
30+
import componentAPI from './component';
31+
import { useCMFContext } from './useContext';
32+
33+
/**
34+
* The Inject component let you use the registry to render named component
35+
* using the registry. It will not break the app if component is not found
36+
* but it will display an error.
37+
* @module react-cmf/lib/Inject
38+
* @example
39+
import { Inject } from '@talend/react-cmf';
40+
// this is not the best example but it show the concept
41+
function MyComponent(props) {
42+
return (
43+
&lt;Inject component="Action" onClick={props.onClick}>
44+
&lt;Inject component="Icon" icon={props.icon} />
45+
&lt;/Inject>
46+
);
47+
}
48+
*/
49+
50+
function NotFoundComponent({ error }) {
51+
// eslint-disable-next-line no-console
52+
console.error(error);
53+
return &lt;div className="alert alert-danger">{error.message}&lt;/div>;
54+
}
55+
NotFoundComponent.propTypes = {
56+
error: PropTypes.string.isRequired,
57+
};
58+
59+
function Inject({ component, ...props }) {
60+
const context = useCMFContext();
61+
try {
62+
const Component = componentAPI.get(component, context);
63+
return &lt;Component {...props} />;
64+
} catch (error) {
65+
return &lt;NotFoundComponent error={error} />;
66+
}
67+
}
68+
Inject.propTypes = {
69+
component: PropTypes.string.isRequired,
70+
};
71+
Inject.NotFoundComponent = NotFoundComponent;
72+
73+
export default Inject;
74+
</code></pre>
75+
</article>
76+
</section>
77+
78+
79+
80+
81+
</div>
82+
83+
<nav>
84+
<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>
85+
</nav>
86+
87+
<br class="clear">
88+
89+
<footer>
90+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Mon Jun 09 2025 15:40:33 GMT+0000 (Coordinated Universal Time)
91+
</footer>
92+
93+
<script> prettyPrint(); </script>
94+
<script src="scripts/linenumber.js"> </script>
95+
</body>
96+
</html>
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>JSDoc: Source: RegistryProvider.js</title>
6+
7+
<script src="scripts/prettify/prettify.js"> </script>
8+
<script src="scripts/prettify/lang-css.js"> </script>
9+
<!--[if lt IE 9]>
10+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11+
<![endif]-->
12+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14+
</head>
15+
16+
<body>
17+
18+
<div id="main">
19+
20+
<h1 class="page-title">Source: RegistryProvider.js</h1>
21+
22+
23+
24+
25+
26+
27+
<section>
28+
<article>
29+
<pre class="prettyprint source linenums"><code>/**
30+
* Internal. This is the component which inject the registry as child context.
31+
* It is called by the App component
32+
* @module react-cmf/lib/RegistryProvider
33+
* @see module:react-cmf/lib/App
34+
*/
35+
import { createContext } from 'react';
36+
import Registry from './registry';
37+
38+
export const RegistryContext = createContext(Registry.getRegistry());
39+
export const RegistryProvider = RegistryContext.Provider;
40+
41+
export default RegistryContext.Provider;
42+
</code></pre>
43+
</article>
44+
</section>
45+
46+
47+
48+
49+
</div>
50+
51+
<nav>
52+
<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>
53+
</nav>
54+
55+
<br class="clear">
56+
57+
<footer>
58+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.4</a> on Mon Jun 09 2025 15:40:33 GMT+0000 (Coordinated Universal Time)
59+
</footer>
60+
61+
<script> prettyPrint(); </script>
62+
<script src="scripts/linenumber.js"> </script>
63+
</body>
64+
</html>

0 commit comments

Comments
 (0)