@@ -1053,65 +1053,7 @@ export function ComponentConfigDrawer() {
10531053 </ FormBlock >
10541054
10551055
1056- { /* 结果显示 */ }
1057- { ( editingComponent . type !== 'metric' && isMetricCard ) &&
1058- < div >
1059- < RadioGroup
1060- value = { limitType }
1061- onValueChange = { ( value : "all" | "limit" ) => setLimitType ( value ) }
1062- className = "flex justify-between gap-4"
1063- >
1064- < div className = " text-sm font-medium mt-1" >
1065- { t ( "componentConfigDrawer.resultsDisplay" ) }
1066- </ div >
1067- < div className = "flex" >
1068- < div className = "flex items-center space-x-2 mr-1" >
1069- < RadioGroupItem value = "all" id = "limit-all" />
1070- < Label htmlFor = "limit-all" className = "text-sm cursor-pointer whitespace-nowrap" >
1071- { t ( "componentConfigDrawer.allResults" ) }
1072- </ Label >
1073- </ div >
1074- < div className = "flex items-center space-x-2" >
1075- < RadioGroupItem value = "limit" id = "limit-limit" />
1076- < div className = "flex items-center gap-2" >
1077- < Input
1078- className = "w-16 h-7 text-sm appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
1079- type = "number"
1080- value = { limitValue }
1081- disabled = { limitType !== "limit" }
1082- onChange = { ( e ) => {
1083- const value = e . target . value ;
1084- if ( value === '' || / ^ \d + $ / . test ( value ) ) {
1085- const num = parseInt ( value ) ;
1086- if ( value === '' || ( num >= 1 && num <= 1000 ) ) {
1087- setLimitValue ( value ) ;
1088- }
1089- }
1090- } }
1091- onBlur = { ( e ) => {
1092- const value = e . target . value ;
1093- const num = parseInt ( value ) ;
1094- if ( value === '' || isNaN ( num ) ) {
1095- setLimitValue ( '1' ) ;
1096- } else if ( num < 1 ) {
1097- setLimitValue ( '1' ) ;
1098- } else if ( num > 1000 ) {
1099- setLimitValue ( '1000' ) ;
1100- } else {
1101- setLimitValue ( num . toString ( ) ) ;
1102- }
1103- } }
1104- min = { 1 }
1105- max = { 1000 }
1106- placeholder = "1000"
1107- />
1108- </ div >
1109- </ div >
1110- </ div >
11111056
1112- </ RadioGroup >
1113- </ div >
1114- }
11151057
11161058 { /* <Button id="config_save" className="w-full h-10 mt-4" onClick={handleUpdateChart}>
11171059 {t("componentConfigDrawer.updateChartData")}
@@ -1137,6 +1079,65 @@ export function ComponentConfigDrawer() {
11371079 </ div >
11381080 { /* 底部固定更新按钮(不随滚动) */ }
11391081 { configTab !== "style" && < div className = "px-4 py-3 border-t bg-background" >
1082+ { /* 结果显示 */ }
1083+ { ( editingComponent . type !== 'metric' && isMetricCard ) &&
1084+ < div >
1085+ < RadioGroup
1086+ value = { limitType }
1087+ onValueChange = { ( value : "all" | "limit" ) => setLimitType ( value ) }
1088+ className = "flex justify-between gap-4"
1089+ >
1090+ < div className = " text-sm font-medium mt-1" >
1091+ { t ( "componentConfigDrawer.resultsDisplay" ) }
1092+ </ div >
1093+ < div className = "flex" >
1094+ < div className = "flex items-center space-x-2 mr-1" >
1095+ < RadioGroupItem value = "all" id = "limit-all" />
1096+ < Label htmlFor = "limit-all" className = "text-sm cursor-pointer whitespace-nowrap" >
1097+ { t ( "componentConfigDrawer.allResults" ) }
1098+ </ Label >
1099+ </ div >
1100+ < div className = "flex items-center space-x-2" >
1101+ < RadioGroupItem value = "limit" id = "limit-limit" />
1102+ < div className = "flex items-center gap-2" >
1103+ < Input
1104+ className = "w-16 h-7 text-sm appearance-none [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
1105+ type = "number"
1106+ value = { limitValue }
1107+ disabled = { limitType !== "limit" }
1108+ onChange = { ( e ) => {
1109+ const value = e . target . value ;
1110+ if ( value === '' || / ^ \d + $ / . test ( value ) ) {
1111+ const num = parseInt ( value ) ;
1112+ if ( value === '' || ( num >= 1 && num <= 1000 ) ) {
1113+ setLimitValue ( value ) ;
1114+ }
1115+ }
1116+ } }
1117+ onBlur = { ( e ) => {
1118+ const value = e . target . value ;
1119+ const num = parseInt ( value ) ;
1120+ if ( value === '' || isNaN ( num ) ) {
1121+ setLimitValue ( '1' ) ;
1122+ } else if ( num < 1 ) {
1123+ setLimitValue ( '1' ) ;
1124+ } else if ( num > 1000 ) {
1125+ setLimitValue ( '1000' ) ;
1126+ } else {
1127+ setLimitValue ( num . toString ( ) ) ;
1128+ }
1129+ } }
1130+ min = { 1 }
1131+ max = { 1000 }
1132+ placeholder = "1000"
1133+ />
1134+ </ div >
1135+ </ div >
1136+ </ div >
1137+
1138+ </ RadioGroup >
1139+ </ div >
1140+ }
11401141 < Button
11411142 id = "config_save"
11421143 className = "w-full h-10"
0 commit comments