Fix: angle bracket display exception

This commit is contained in:
hailaz 2022-03-02 10:58:49 +08:00
parent 0f4ae0196d
commit 575c61b5f4

View File

@ -1,9 +1,9 @@
import * as React from 'react'; import * as React from 'react';
import { TypeFormat, TypePrefix } from '../../common-elements/fields'; import { TypeFormat, TypePrefix } from '../../common-elements/fields';
import { ConstraintsView } from './FieldContstraints';
import { Pattern } from './Pattern';
import { SchemaModel } from '../../services'; import { SchemaModel } from '../../services';
import styled from '../../styled-components'; import styled from '../../styled-components';
import { ConstraintsView } from './FieldContstraints';
import { Pattern } from './Pattern';
export function ArrayItemDetails({ schema }: { schema: SchemaModel }) { export function ArrayItemDetails({ schema }: { schema: SchemaModel }) {
if (!schema || (schema.type === 'string' && !schema.constraints.length)) return null; if (!schema || (schema.type === 'string' && !schema.constraints.length)) return null;
@ -11,7 +11,7 @@ export function ArrayItemDetails({ schema }: { schema: SchemaModel }) {
return ( return (
<Wrapper> <Wrapper>
[ items [ items
{schema.displayFormat && <TypeFormat>{` &lt;${schema.displayFormat}&gt; `}</TypeFormat>} {schema.displayFormat && <TypeFormat>{` <${schema.displayFormat}> `}</TypeFormat>}
<ConstraintsView constraints={schema.constraints} /> <ConstraintsView constraints={schema.constraints} />
<Pattern schema={schema} /> <Pattern schema={schema} />
{schema.items && <ArrayItemDetails schema={schema.items} />} ] {schema.items && <ArrayItemDetails schema={schema.items} />} ]