Ensure only props are passed to propControl
This commit is contained in:
parent
4ba9791a66
commit
fca1b58829
|
@ -30,11 +30,11 @@ $: {
|
||||||
if(componentInfo)
|
if(componentInfo)
|
||||||
{
|
{
|
||||||
isInstance = !!instanceProps;
|
isInstance = !!instanceProps;
|
||||||
props = isInstance
|
props = isInstance
|
||||||
? getInstanceProps(componentInfo, instanceProps)
|
? getInstanceProps(componentInfo, instanceProps)
|
||||||
: cloneDeep(componentInfo.fullProps);
|
: cloneDeep(componentInfo.fullProps);
|
||||||
|
|
||||||
propsDefinitions = pipe(componentInfo.propsDefinition, [
|
propsDefinitions = pipe(componentInfo.propsDefinition.props, [
|
||||||
keys,
|
keys,
|
||||||
map(k => ({...componentInfo.propsDefinition[k], ____name:k})),
|
map(k => ({...componentInfo.propsDefinition[k], ____name:k})),
|
||||||
sortBy("____name")
|
sortBy("____name")
|
||||||
|
@ -64,16 +64,16 @@ let setProp = (name, value) => {
|
||||||
props = newProps;
|
props = newProps;
|
||||||
if(validate(finalProps))
|
if(validate(finalProps))
|
||||||
onPropsChanged(finalProps);
|
onPropsChanged(finalProps);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const validate = (finalProps) => {
|
const validate = (finalProps) => {
|
||||||
errors = validateProps(componentInfo.rootComponent, finalProps, [], false);
|
errors = validateProps(componentInfo.rootComponent, finalProps, [], false);
|
||||||
onValidate(errors);
|
onValidate(errors);
|
||||||
return errors.length === 0;
|
return errors.length === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldHasError = (propName) =>
|
const fieldHasError = (propName) =>
|
||||||
some(e => e.propName === propName)(errors);
|
some(e => e.propName === propName)(errors);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
@ -82,7 +82,7 @@ const fieldHasError = (propName) =>
|
||||||
|
|
||||||
<form class="uk-form-stacked form-root">
|
<form class="uk-form-stacked form-root">
|
||||||
{#each propsDefinitions as propDef, index}
|
{#each propsDefinitions as propDef, index}
|
||||||
|
|
||||||
<div class="prop-container">
|
<div class="prop-container">
|
||||||
|
|
||||||
<PropControl {setProp}
|
<PropControl {setProp}
|
||||||
|
@ -93,13 +93,13 @@ const fieldHasError = (propName) =>
|
||||||
disabled={false} />
|
disabled={false} />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -121,4 +121,4 @@ const fieldHasError = (propName) =>
|
||||||
min-width: 250px;
|
min-width: 250px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue