File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -103,7 +103,16 @@ const models: AdminpanelConfig["models"] = {
103103 select : {
104104 title : 'Select' ,
105105 type : "select" ,
106- isIn : [ 'one' , 'two' , 'three' ]
106+ isIn : {
107+ decrease : 'Уменьшение баллов' ,
108+ increase : 'Увеличение баллов' ,
109+ none : 'Без изменений'
110+ } ,
111+ // isIn: [
112+ // "decrease",
113+ // "increase",
114+ // "none",
115+ // ],
107116 } ,
108117 date : {
109118 title : 'Date' ,
Original file line number Diff line number Diff line change @@ -157,9 +157,12 @@ const FieldRenderer: FC<{
157157 < SelectValue placeholder = "" />
158158 </ SelectTrigger >
159159 < SelectContent className = "z-[9999999]" >
160- { ( field . isIn ?? [ ] ) . map ( ( option ) => (
161- < SelectItem value = { option } key = { option } >
162- { option }
160+ { ( Array . isArray ( field . isIn )
161+ ? field . isIn . map ( value => [ value , value ] ) // если массив — используем значение и отображаемое значение одинаковыми
162+ : Object . entries ( field . isIn as object ) // если объект — получаем пары [ключ, отображаемое значение]
163+ ) . map ( ( [ key , value ] ) => (
164+ < SelectItem value = { String ( key ) } key = { String ( key ) } >
165+ { String ( value ) }
163166 </ SelectItem >
164167 ) ) }
165168 </ SelectContent >
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ export interface Field {
103103 value : FieldValue ;
104104 disabled ?: boolean ;
105105 required ?: boolean ;
106- isIn ?: string [ ] ;
106+ isIn ?: string [ ] | object ;
107107 options ?: any ;
108108}
109109
You can’t perform that action at this time.
0 commit comments