Skip to content

Commit 0525208

Browse files
committed
fix:fix bug
1 parent eb9c5d1 commit 0525208

4 files changed

Lines changed: 166 additions & 156 deletions

File tree

src/frontend/platform/src/pages/Dashboard/components/config/ComponentConfigDrawer.tsx

Lines changed: 59 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -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"

src/frontend/platform/src/pages/Dashboard/components/config/DashboardConfigPanel.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import { Button } from "@/components/bs-ui/button"
55
import { ListIndentDecrease, ListIndentIncrease } from "lucide-react"
6-
import { useEffect, useState } from "react"
6+
import { useCallback, useEffect, useState } from "react"
77
import { useEditorDashboardStore } from "@/store/dashboardStore"
88
import { useTranslation } from "react-i18next"
99

@@ -52,16 +52,18 @@ export function DashboardConfigPanel({ collapsed = false, onCollapse }: Dashboar
5252
</div>
5353
)
5454

55-
const CollapseLabel = ({ label, onClick, icon }: any) => (
56-
<div className="h-full flex flex-col items-center justify-center cursor-pointer hover:bg-accent/50 transition-colors" onClick={onClick}>
57-
<div className="writing-mode-vertical text-sm font-medium py-4">{label}</div>
58-
<div className="mt-2">{icon}</div>
55+
const CollapseLabel = useCallback(({ label, onClick, icon }: any) => (
56+
<div className="h-full flex flex-col items-center cursor-pointer hover:bg-accent/50 transition-colors" onClick={onClick}>
57+
<div className="m-[20px]">{icon}</div>
58+
<div className="w-full h-[2px] bg-gray-100 mb-4"></div>
59+
<div className="writing-mode-vertical text-sm font-medium tracking-[6px]">{label}</div>
60+
5961
</div>
60-
)
62+
), [])
6163

6264
return (
6365
<div className="h-full flex bg-background border-l border-border">
64-
<div className={`border-r flex flex-col h-full transition-all duration-300 ${collapsed ? "w-12" : "w-[460px]"} shrink-0`}>
66+
<div className={`border-r flex flex-col h-full transition-all duration-300 ${collapsed ? "w-12" : "w-[440px]"} shrink-0`}>
6567
{collapsed ? (
6668
<CollapseLabel
6769
label={t("configPanel.title")}

0 commit comments

Comments
 (0)