11import { components } from "@/shared/api/rest/types.generated" ;
22import Accordion from "@/shared/components/display/accordion" ;
33import { ComputedAttributeDisplay } from "./computed-attribute-display" ;
4- import { AccordionStyled , NullDisplay , PropertyRow } from "./styled" ;
4+ import { AccordionStyled , NullDisplay , PropertyRow , PropertyTitle } from "./styled" ;
55
66export const AttributeDisplay = ( {
77 attribute,
@@ -29,6 +29,7 @@ export const AttributeDisplay = ({
2929 < PropertyRow title = "Label" value = { attribute . label } />
3030 < PropertyRow title = "Description" value = { attribute . description } />
3131 < PropertyRow title = "Inherited" value = { attribute . inherited } />
32+ < PropertyRow title = "Default value" value = { attribute . default_value as any } />
3233 </ div >
3334
3435 < div >
@@ -38,16 +39,12 @@ export const AttributeDisplay = ({
3839 < PropertyRow title = "Enum" value = { attribute . enum as string [ ] } />
3940 </ div >
4041
41- < div >
42- < PropertyRow title = "Default value" value = { attribute . default_value as any } />
43- < PropertyRow title = "Max length" value = { attribute . max_length } />
44- < PropertyRow title = "Min length" value = { attribute . min_length } />
45- < PropertyRow title = "Regex" value = { attribute . regex } />
46- </ div >
4742 < div >
4843 < PropertyRow title = "Branch" value = { attribute . branch } />
4944 < PropertyRow title = "Order weight" value = { attribute . order_weight } />
5045 </ div >
46+
47+ < AttributeParameters attribute = { attribute } />
5148 </ AccordionStyled >
5249 ) ;
5350} ;
@@ -86,3 +83,23 @@ const ChoicesRow = ({
8683 </ div >
8784 ) ;
8885} ;
86+
87+ const AttributeParameters = ( {
88+ attribute,
89+ } : { attribute : components [ "schemas" ] [ "AttributeSchema-Output" ] } ) => {
90+ if ( attribute . kind === "Text" ) {
91+ return (
92+ < div >
93+ < PropertyTitle title = "Parameters" />
94+
95+ < div className = "pl-4" >
96+ < PropertyRow title = "Regex" value = { attribute . parameters ?. regex } />
97+ < PropertyRow title = "Min length" value = { attribute . parameters ?. min_length } />
98+ < PropertyRow title = "Max length" value = { attribute . parameters ?. max_length } />
99+ </ div >
100+ </ div >
101+ ) ;
102+ }
103+
104+ return null ;
105+ } ;
0 commit comments