Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function buildOptions(schema, uiWidget) {
// Note: uiWidget can be undefined, a string or an object; we only deal with
// the inline option when we're provided a definition object.
return {
inline: isObject(uiWidget) &&
isObject(uiWidget.options) &&
uiWidget.options.inline,
enumOptions: optionsList(Object.assign({
enumNames: ['true', 'false'],
enum: [true, false]
}, {enumNames: schema.enumNames}))
};
}
renderMultiSelect() {
const {
schema,
idSchema,
uiSchema,
disabled,
readonly,
autofocus,
onBlur,
onFocus,
registry,
} = this.props;
const items = this.props.formData;
const { widgets, definitions, formContext } = registry;
const itemsSchema = retrieveSchema(schema.items, definitions);
const enumOptions = optionsList(itemsSchema);
const { widget = 'select', ...options } = {
...getUiOptions(uiSchema),
enumOptions,
};
const Widget = getWidget(schema, widget, widgets);
return (
function buildOptions(schema) {
return {
enumOptions: optionsList(
Object.assign(
{
enumNames: ['true', 'false'],
enum: [true, false],
},
{ enumNames: schema.enumNames },
),
),
};
}
function Key({ schema, data, onChange, ...internalProps }) {
if (schema.properties && Array.isArray(schema.properties.key.enum)) {
const options = optionsList(schema.properties.key);
return (
<select value="{data.key}"> onChange({ key: change, value: data.value })}
/>
);
}
return (
onChange(`${change}=${toValue(data)}`)}
/></select>
renderMultiSelect() {
const {
schema,
idSchema,
uiSchema,
disabled,
readonly,
autofocus
} = this.props;
const {items} = this.state;
const {widgets, definitions} = this.props.registry;
const itemsSchema = retrieveSchema(schema.items, definitions);
const enumOptions = (itemsSchema && itemsSchema.options) ?
optionsListObject(itemsSchema) :
optionsList(itemsSchema);
const {
widget = 'select',
...options
} = {
...getUiOptions(uiSchema),
enumOptions,
};
const Widget = getWidget(schema, widget, widgets);
return (
const enumOptions = optionsListObject(schema);
if (widget) {
const Widget = getWidget(schema, widget, {...registry.widgets, ...widgets}, {enumOptions});
return ;
}
return (
);
} else if (Array.isArray(schema.enum)) {
const enumOptions = optionsList(schema);
if (widget) {
const Widget = getWidget(schema, widget, {...registry.widgets, ...widgets}, {enumOptions});
return ;
}
return ;
} else if (schema.format === 'text') {
return ;
}
if (widget) {
const Widget = getWidget(schema, widget, {...registry.widgets, ...widgets});
return ;
}
name,
uiSchema,
idSchema,
formData,
required,
disabled,
readonly,
autofocus,
onChange,
onBlur,
registry = getDefaultRegistry(),
} = this.props;
const { title, format } = schema;
const { widgets, formContext } = registry;
const enumOptions = Array.isArray(schema.enum) && optionsList(schema);
const defaultWidget = format || (enumOptions ? 'select' : 'text');
const {
widget = defaultWidget,
placeholder = '',
...options
} = getUiOptions(uiSchema);
const Widget = CollabStringField.getWidget(schema, widget, widgets);
const ref = {};
if (this.isCollab) ref.widgetRef = w => (this._widget = w);
if (options.emptyValue === undefined) options.emptyValue = '';
return (