Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
range(0, data.length).map(index => {
const foundUISchema = findUISchema(uischemas, schema, uischema.scope, path);
const childPath = composePaths(path, `${index}`);
return (
);
})
) : (
setSelectedIndex(undefined);
} else if (selectedIndex > value) {
setSelectedIndex(selectedIndex - 1);
}
},
[removeItems, setSelectedIndex]
);
const handleListItemClick = useCallback(
(index: number) => () => setSelectedIndex(index),
[setSelectedIndex]
);
const handleCreateDefaultValue = useCallback(
() => createDefaultValue(schema),
[createDefaultValue]
);
const foundUISchema = findUISchema(
uischemas,
schema,
uischema.scope,
path,
undefined,
uischema
);
const appliedUiSchemaOptions = merge({}, config, uischema.options);
return (
mapAdditionalProps(props: ControlWithDetailProps) {
this.propsPath = props.path;
this.detailUiSchema = findUISchema(
props.uischemas,
props.schema,
undefined,
props.path
);
}
}
const MaterialObjectRenderer = ({
renderers,
uischemas,
schema,
label,
path,
visible,
enabled,
uischema,
rootSchema
}: StatePropsOfControlWithDetail) => {
const detailUiSchema = findUISchema(
uischemas,
schema,
uischema.scope,
path,
'Group',
uischema,
rootSchema
);
if (isEmpty(path)) {
detailUiSchema.type = 'VerticalLayout';
} else {
(detailUiSchema as GroupLayout).label = startCase(
isPlainLabel(label) ? label : label.default
);
}
return (
moveDown,
moveUp,
enableMoveDown,
enableMoveUp,
handleExpansion,
removeItems,
path,
rootSchema,
schema,
uischema,
uischemas,
renderers,
config
} = props;
const foundUISchema = findUISchema(
uischemas,
schema,
uischema.scope,
path,
undefined,
uischema,
rootSchema
);
const appliedUiSchemaOptions = merge({}, config, uischema.options);
return (
mapAdditionalProps(props: ArrayControlProps) {
const { data, path, schema, uischema } = props;
const controlElement = uischema as ControlElement;
this.propsPath = props.path;
const detailUISchema =
controlElement.options.detail ||
findUISchema(
props.uischemas,
schema,
`${controlElement.scope}/items`,
props.path,
'VerticalLayout'
);
if (!this.isEnabled()) {
setReadonly(detailUISchema);
}
const masterItems = (data || []).map((d: any, index: number) => {
const labelRefInstancePath = removeSchemaKeywords(
controlElement.options.labelRef
);
const masterItem = {
label: get(d, labelRefInstancePath),
mapAdditionalProps(props: ControlWithDetailProps) {
this.detailUiSchema = findUISchema(
props.uischemas,
props.schema,
undefined,
props.path,
'Group'
);
if (isEmpty(props.path)) {
this.detailUiSchema.type = 'VerticalLayout';
} else {
(this.detailUiSchema as GroupLayout).label = startCase(props.path);
}
if (!this.isEnabled()) {
setReadonly(this.detailUiSchema);
}
}
}
data[0],
Paths.compose(
path,
'0'
)
);
} else {
resetSelection = this.setSelection(schema, data, path);
}
const handlers = {
onSelect: this.setSelection,
onAdd: this.openDialog,
resetSelection: resetSelection
};
const detailUiSchema = findUISchema(
uischemas,
this.state.selected.schema,
undefined,
path
);
return (
<div hidden="{!visible}">
<div>
<label>
{typeof controlElement.label === 'string'
? controlElement.label
: ''}
</label>
{Array.isArray(data) && (
<button>Add to root</button></div></div>