Renamed widget type option
This commit is contained in:
parent
1876f89c89
commit
5bca64a03a
|
@ -59,14 +59,14 @@ const isReactComponent = component => {
|
||||||
*/
|
*/
|
||||||
export const getWidget = arg => {
|
export const getWidget = arg => {
|
||||||
|
|
||||||
const instantiate = (widget, config, type) => {
|
const instantiate = (widget, config, force) => {
|
||||||
// Check if user forced explicit type
|
// Check if user forced explicit type
|
||||||
if (typeof widget === 'string' || widget instanceof String) {
|
if (typeof widget === 'string' || widget instanceof String) {
|
||||||
// Built-in
|
// Built-in
|
||||||
return React.createElement(BUILTIN_WIDGETS[widget], config);
|
return React.createElement(BUILTIN_WIDGETS[widget], config);
|
||||||
} else {
|
} else {
|
||||||
// Plugin
|
// Plugin
|
||||||
if (type?.toLowerCase() === 'react') {
|
if (force?.toLowerCase() === 'react') {
|
||||||
return React.createElement(widget, config);
|
return React.createElement(widget, config);
|
||||||
} else {
|
} else {
|
||||||
// Auto-detect
|
// Auto-detect
|
||||||
|
@ -83,8 +83,8 @@ export const getWidget = arg => {
|
||||||
|
|
||||||
// First, check 'top-level' vs. 'nested object' case
|
// First, check 'top-level' vs. 'nested object' case
|
||||||
if (arg.widget) {
|
if (arg.widget) {
|
||||||
const { widget, type, ...config } = arg;
|
const { widget, force, ...config } = arg;
|
||||||
return instantiate(widget, config, type);
|
return instantiate(widget, config, force);
|
||||||
} else {
|
} else {
|
||||||
// No object with args -> instantiate arg directly
|
// No object with args -> instantiate arg directly
|
||||||
return instantiate(arg);
|
return instantiate(arg);
|
||||||
|
|
Loading…
Reference in New Issue