({ selectedKey }: DetailsPanelProps)
| 12 | } |
| 13 | |
| 14 | export function DetailsPanel({ selectedKey }: DetailsPanelProps) { |
| 15 | const styles = useStyles() |
| 16 | const { store } = useFormEventClient() |
| 17 | |
| 18 | const selectedInstance = createMemo(() => { |
| 19 | const key = selectedKey() |
| 20 | return key |
| 21 | ? (store.formState.find((form) => form.id === key) ?? null) |
| 22 | : null |
| 23 | }) |
| 24 | |
| 25 | const state = createMemo(() => selectedInstance()?.state) |
| 26 | const history = createMemo(() => selectedInstance()?.history) |
| 27 | |
| 28 | const sections = createMemo(() => [ |
| 29 | { |
| 30 | title: 'Form options', |
| 31 | value: selectedInstance()?.options, |
| 32 | }, |
| 33 | { |
| 34 | title: 'Form values', |
| 35 | value: state()?.values, |
| 36 | }, |
| 37 | { |
| 38 | title: 'Form Interactions', |
| 39 | value: { |
| 40 | isPristine: state()?.isPristine, |
| 41 | isTouched: state()?.isTouched, |
| 42 | isDirty: state()?.isDirty, |
| 43 | isDefaultValue: state()?.isDefaultValue, |
| 44 | isBlurred: state()?.isBlurred, |
| 45 | }, |
| 46 | }, |
| 47 | { |
| 48 | title: 'Form Status', |
| 49 | value: { |
| 50 | canSubmit: state()?.canSubmit, |
| 51 | isFormValid: state()?.isFormValid, |
| 52 | isFormValidating: state()?.isFormValidating, |
| 53 | isSubmitted: state()?.isSubmitted, |
| 54 | isSubmitting: state()?.isSubmitting, |
| 55 | isSubmitSuccessful: state()?.isSubmitSuccessful, |
| 56 | submissionAttempts: state()?.submissionAttempts, |
| 57 | errors: state()?.errors, |
| 58 | errorMap: state()?.errorMap, |
| 59 | }, |
| 60 | }, |
| 61 | { |
| 62 | title: 'Field Status', |
| 63 | value: { |
| 64 | isFieldsValid: state()?.isFieldsValid, |
| 65 | isFieldsValidating: state()?.isFieldsValidating, |
| 66 | fieldMeta: state()?.fieldMeta, |
| 67 | }, |
| 68 | }, |
| 69 | { |
| 70 | title: 'Submission history', |
| 71 | value: history(), |
nothing calls this directly
no test coverage detected