( ctx: JsonFormsStateContext, props: OwnPropsOfEnum )
| 299 | ) => mapStateToControlProps({ jsonforms: { ...ctx } }, props); |
| 300 | |
| 301 | export const ctxToEnumControlProps = ( |
| 302 | ctx: JsonFormsStateContext, |
| 303 | props: OwnPropsOfEnum |
| 304 | ) => { |
| 305 | const enumProps = mapStateToEnumControlProps( |
| 306 | { jsonforms: { ...ctx } }, |
| 307 | props |
| 308 | ); |
| 309 | /** |
| 310 | * Make sure, that options are memoized as otherwise the component will rerender for every change, |
| 311 | * as the options array is recreated every time. |
| 312 | */ |
| 313 | const options = useMemo( |
| 314 | () => enumProps.options, |
| 315 | [props.options, enumProps.schema, ctx.i18n?.translate] |
| 316 | ); |
| 317 | return { ...enumProps, options }; |
| 318 | }; |
| 319 | |
| 320 | export const ctxToOneOfEnumControlProps = ( |
| 321 | ctx: JsonFormsStateContext, |
no test coverage detected
searching dependent graphs…