@@ -5,7 +5,15 @@ const { RangePicker } = DatePicker;
55export const getFormElement = ( type : FormItem [ "type" ] , info : FormItem ) => {
66 switch ( type ) {
77 case "radio" :
8- return < Radio . Group options = { info . options || [ ] } optionType = { info . optionType || "button" } buttonStyle = "outline" disabled = { info . disable } { ...info . otherOptions } /> ;
8+ return (
9+ < Radio . Group
10+ options = { info . options || [ ] }
11+ optionType = { info . otherOptions ?. optionType || "button" }
12+ buttonStyle = "outline"
13+ disabled = { info . disable }
14+ { ...info . otherOptions }
15+ />
16+ ) ;
917
1018 case "checkbox" :
1119 return < Checkbox . Group style = { { width : "100%" } } options = { info . options || [ ] } { ...info . otherOptions } /> ;
@@ -27,7 +35,7 @@ export const getFormElement = (type: FormItem["type"], info: FormItem) => {
2735 < Select
2836 showSearch
2937 allowClear
30- mode = { info . mode }
38+ mode = { info . otherOptions ?. mode }
3139 placeholder = { info . placeholder }
3240 disabled = { info . disable }
3341 options = { info . options as { value : string } [ ] }
@@ -40,17 +48,36 @@ export const getFormElement = (type: FormItem["type"], info: FormItem) => {
4048 ) ;
4149
4250 case "rangePick" :
43- return < RangePicker disabled = { info . disable } showTime = { info . showTime } placeholder = { [ "开始时间" , "结束时间" ] } { ...info . otherOptions } /> ;
51+ return < RangePicker disabled = { info . disable } showTime = { info . otherOptions ?. showTime } placeholder = { [ "开始时间" , "结束时间" ] } { ...info . otherOptions } /> ;
4452
4553 case "datePick" :
46- return < DatePicker disabled = { info . disable } showTime = { info . showTime } { ...info . otherOptions } /> ;
54+ return < DatePicker disabled = { info . disable } showTime = { info . otherOptions ?. showTime } { ...info . otherOptions } /> ;
4755
4856 case "textArea" :
4957 return (
50- < Input . TextArea placeholder = { info . placeholder } disabled = { info . disable } showCount maxLength = { info . maxLength || 500 } className = "mb-6 h-32" { ...info . otherOptions } />
58+ < Input . TextArea
59+ showCount
60+ disabled = { info . disable }
61+ placeholder = { info . placeholder }
62+ maxLength = { info . otherOptions ?. maxLength || 500 }
63+ classNames = { {
64+ textarea : "h-40 resize-none" ,
65+ } }
66+ { ...info . otherOptions }
67+ />
5168 ) ;
5269
5370 case "treeSelect" :
54- return < TreeSelect allowClear placeholder = { info . placeholder } disabled = { info . disable } treeDefaultExpandAll className = "w-full" { ...info . otherOptions } /> ;
71+ return (
72+ < TreeSelect
73+ allowClear
74+ placeholder = { info . placeholder }
75+ treeData = { info . options }
76+ disabled = { info . disable }
77+ treeDefaultExpandAll
78+ className = "w-full"
79+ { ...info . otherOptions }
80+ />
81+ ) ;
5582 }
5683} ;
0 commit comments