Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 5e658f7

Browse files
author
daniel.gomez
committed
#36 Move Root component handling to ComponentFactory
1 parent 4c5390f commit 5e658f7

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

‎package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "redux-autoform-utils",
3-
"version": "1.0.3",
3+
"version": "1.0.4-experimental",
44
"description": "Common javascript files to all the redux-autoform related projects",
55
"main": "./lib/index.js",
66
"scripts": {

‎src/factory/ComponentFactory.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ export default class ComponentFactory {
2323

2424
// The id of the default component for groups
2525
this.defaultGroupComponentId = null;
26+
27+
// This this a list of Root components
28+
this.rootComponentsById = { };
29+
30+
this.currentRoot = null;
31+
2632
}
2733

2834
/**
@@ -191,4 +197,20 @@ export default class ComponentFactory {
191197

192198
return React.createElement(componentType, groupComponentProps);
193199
}
200+
201+
202+
// Allows to register a new Root component
203+
registerRootComponent(id, component) {
204+
this.rootComponentsById[id] = component;
205+
}
206+
207+
// Allows to define the id of the current Root component that should be used
208+
setCurrentRoot(id) {
209+
this.currentRoot = id;
210+
}
211+
212+
// Return the selected Root component in AutoformInternal
213+
getRoot() {
214+
return this.rootComponentsById[this.currentRoot];
215+
}
194216
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /