( state: JsonFormsState, ownProps: OwnPropsOfControl & OwnPropsOfEnum )
| 699 | * @returns {StatePropsOfControl & OwnPropsOfEnum} |
| 700 | */ |
| 701 | export const mapStateToEnumControlProps = ( |
| 702 | state: JsonFormsState, |
| 703 | ownProps: OwnPropsOfControl & OwnPropsOfEnum |
| 704 | ): StatePropsOfControl & OwnPropsOfEnum => { |
| 705 | const props: StatePropsOfControl = mapStateToControlProps(state, ownProps); |
| 706 | const options: EnumOption[] = |
| 707 | ownProps.options || |
| 708 | props.schema.enum?.map((e) => |
| 709 | enumToEnumOptionMapper( |
| 710 | e, |
| 711 | getTranslator()(state), |
| 712 | getI18nKeyPrefix(props.schema, props.uischema, props.path) |
| 713 | ) |
| 714 | ) || |
| 715 | (props.schema.const && [ |
| 716 | enumToEnumOptionMapper( |
| 717 | props.schema.const, |
| 718 | getTranslator()(state), |
| 719 | getI18nKeyPrefix(props.schema, props.uischema, props.path) |
| 720 | ), |
| 721 | ]); |
| 722 | return { |
| 723 | ...props, |
| 724 | options, |
| 725 | }; |
| 726 | }; |
| 727 | |
| 728 | /** |
| 729 | * Default mapStateToCellProps for enum control based on oneOf. Options is used for populating dropdown list |
no test coverage detected
searching dependent graphs…