(props: {
value: any
keyName?: string
isRoot?: boolean
isLastKey?: boolean
copyable?: boolean
defaultExpansionDepth: number
depth: number
collapsePaths?: Array<string>
path: string
config?: { dateFormat?: string }
})
| 35 | } |
| 36 | |
| 37 | function JsonValue(props: { |
| 38 | value: any |
| 39 | keyName?: string |
| 40 | isRoot?: boolean |
| 41 | isLastKey?: boolean |
| 42 | copyable?: boolean |
| 43 | |
| 44 | defaultExpansionDepth: number |
| 45 | depth: number |
| 46 | |
| 47 | collapsePaths?: Array<string> |
| 48 | path: string |
| 49 | |
| 50 | config?: { dateFormat?: string } |
| 51 | }) { |
| 52 | const styles = createStyles() |
| 53 | |
| 54 | return ( |
| 55 | <span class={styles().tree.valueContainer(props.isRoot ?? false)}> |
| 56 | {props.keyName && |
| 57 | typeof props.value !== 'object' && |
| 58 | !Array.isArray(props.value) && ( |
| 59 | <span class={styles().tree.valueKey}> |
| 60 | "{props.keyName}":{' '} |
| 61 | </span> |
| 62 | )} |
| 63 | |
| 64 | {(() => { |
| 65 | if (typeof props.value === 'string') { |
| 66 | return ( |
| 67 | <span class={styles().tree.valueString}> |
| 68 | "{props.value}" |
| 69 | </span> |
| 70 | ) |
| 71 | } |
| 72 | |
| 73 | if (typeof props.value === 'number') { |
| 74 | return ( |
| 75 | <span class={styles().tree.valueNumber}>{String(props.value)}</span> |
| 76 | ) |
| 77 | } |
| 78 | |
| 79 | if (typeof props.value === 'boolean') { |
| 80 | return ( |
| 81 | <span class={styles().tree.valueBoolean}> |
| 82 | {String(props.value)} |
| 83 | </span> |
| 84 | ) |
| 85 | } |
| 86 | |
| 87 | if (props.value === null) { |
| 88 | return <span class={styles().tree.valueNull}>null</span> |
| 89 | } |
| 90 | |
| 91 | if (props.value === undefined) { |
| 92 | return <span class={styles().tree.valueNull}>undefined</span> |
| 93 | } |
| 94 |
nothing calls this directly
no test coverage detected