Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function Widget({ id, schema }) {
const { properties } = useContext(formContext);
const WidgetComponent = widgetDictionary[schema.widget || schema.type];
const value = getValue(properties, schema);
const widgetId = sfPath.name(schema.key, '_', id);
return ;
}
Widget.propTypes = {
const values = rhf.getValues({ nest: true });
if (!shouldRender(condition, values, key)) {
return null;
}
const widgetName = widget || type;
const WidgetImpl = getWidget(displayMode || schema.displayMode, widgetName, widgets);
if (!WidgetImpl) {
return <p>Widget not found {widgetName}</p>;
}
const instance = (
);
if (tooltip) {
return (
<div>{instance}</div>
);
tooltip,
tooltipPlacement,
} = props.schema;
const widgetId = widget || type;
if (widgetId === 'hidden' || !shouldRender(condition, props.properties, key)) {
return null;
}
const WidgetImpl = getWidget(props.displayMode || displayMode, widgetId, props.widgets);
if (!WidgetImpl) {
return <p>Widget not found {widgetId}</p>;
}
const id = sfPath.name(key, '_', props.id);
const error = getError(props.errors, props.schema);
const errorMessage = validationMessage || error;
const all = {
...props,
id,
key: id,
options,
errorMessage,
isValid: !error,
value: getValue(props.properties, props.schema),
valueIsUpdating: isUpdating(props.updating, props.schema.key),
};
if (tooltip) {
return (