feat: support boot-ui

This commit is contained in:
ReaJason
2024-12-20 01:15:12 +08:00
parent 2b00c96a06
commit 534db31fa0
81 changed files with 1556 additions and 929 deletions
+37 -70
View File
@@ -1,9 +1,18 @@
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card.tsx";
import { Label } from "@/components/ui/label.tsx";
import { FormControl, FormField, FormItem, FormLabel } from "@/components/ui/form.tsx";
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group.tsx";
import { FormSchema } from "@/types/schema.ts";
import { PackerConfig } from "@/types/shell.ts";
import { PackageIcon } from "lucide-react";
import { FormProvider, UseFormReturn } from "react-hook-form";
export function PackageConfigCard() {
export function PackageConfigCard({
packerConfig,
form,
}: {
packerConfig: PackerConfig | undefined;
form: UseFormReturn<FormSchema>;
}) {
return (
<Card className="w-full">
<CardHeader className="pb-1">
@@ -12,74 +21,32 @@ export function PackageConfigCard() {
<span>打包配置</span>
</CardTitle>
</CardHeader>
<CardContent className="space-y-2">
<div className="space-y-1">
<Label className="text-sm">打包方式</Label>
<RadioGroup defaultValue="base64">
<div className="grid grid-cols-2 gap-2">
<div className="flex items-center space-x-2">
<RadioGroupItem value="base64" id="base64" />
<Label htmlFor="base64" className="text-xs">
Base64
</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="jsp" id="jsp" />
<Label htmlFor="jsp" className="text-xs">
JSP
</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="classFile" id="classFile" />
<Label htmlFor="classFile" className="text-xs">
反序列化
</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="scriptEngine" id="scriptEngine" />
<Label htmlFor="scriptEngine" className="text-xs">
ScriptEngine
</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="elExpression" id="elExpression" />
<Label htmlFor="elExpression" className="text-xs">
EL Expression
</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="ognlExpression" id="ognlExpression" />
<Label htmlFor="ognlExpression" className="text-xs">
OGNL Expression
</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="spelExpression" id="spelExpression" />
<Label htmlFor="spelExpression" className="text-xs">
SpEL Expression
</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="elExpression" id="elExpression" />
<Label htmlFor="elExpression" className="text-xs">
EL Expression
</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="freemarkerExpression" id="freemarkerExpression" />
<Label htmlFor="freemarkerExpression" className="text-xs">
Freemarker
</Label>
</div>
<div className="flex items-center space-x-2">
<RadioGroupItem value="velocityExpression" id="velocityExpression" />
<Label htmlFor="velocityExpression" className="text-xs">
Velocity
</Label>
</div>
</div>
</RadioGroup>
</div>
<CardContent>
<FormProvider {...form}>
<FormField
control={form.control}
name="packingMethod"
render={({ field }) => (
<FormItem className="space-y-3">
<FormLabel>打包方式</FormLabel>
<FormControl>
<RadioGroup onValueChange={field.onChange} defaultValue={field.value} className="grid grid-cols-3">
{Object.entries(packerConfig ?? {}).map(([name, value]) => (
<FormItem key={value} className="flex items-center space-x-3 space-y-0">
<FormControl>
<RadioGroupItem value={value} id={value} />
</FormControl>
<FormLabel className="text-xs" htmlFor={value}>
{name}
</FormLabel>
</FormItem>
))}
</RadioGroup>
</FormControl>
</FormItem>
)}
/>
</FormProvider>
</CardContent>
</Card>
);