diff --git a/frontendNew/src/components/ui/card/Card.vue b/frontendNew/src/components/ui/card/Card.vue index 5c76af74..166157e5 100644 --- a/frontendNew/src/components/ui/card/Card.vue +++ b/frontendNew/src/components/ui/card/Card.vue @@ -19,7 +19,7 @@ const props = withDefaults( :data-size="size" :class=" cn( - 'ring-foreground/10 bg-card text-card-foreground gap-4 overflow-hidden rounded-xl py-4 text-sm ring-1 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col transition-all duration-200', + 'border-border/70 bg-card text-card-foreground gap-4 overflow-hidden rounded-xl border py-4 text-sm has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl group/card flex flex-col transition-all duration-200', props.class, ) " diff --git a/frontendNew/src/components/ui/select/Select.vue b/frontendNew/src/components/ui/select/Select.vue new file mode 100644 index 00000000..e08ec541 --- /dev/null +++ b/frontendNew/src/components/ui/select/Select.vue @@ -0,0 +1,28 @@ + + + diff --git a/frontendNew/src/components/ui/select/SelectContent.vue b/frontendNew/src/components/ui/select/SelectContent.vue new file mode 100644 index 00000000..95c1a9b7 --- /dev/null +++ b/frontendNew/src/components/ui/select/SelectContent.vue @@ -0,0 +1,50 @@ + + + diff --git a/frontendNew/src/components/ui/select/SelectItem.vue b/frontendNew/src/components/ui/select/SelectItem.vue new file mode 100644 index 00000000..fc58192d --- /dev/null +++ b/frontendNew/src/components/ui/select/SelectItem.vue @@ -0,0 +1,38 @@ + + + diff --git a/frontendNew/src/components/ui/select/SelectLabel.vue b/frontendNew/src/components/ui/select/SelectLabel.vue new file mode 100644 index 00000000..cd31754e --- /dev/null +++ b/frontendNew/src/components/ui/select/SelectLabel.vue @@ -0,0 +1,21 @@ + + + diff --git a/frontendNew/src/components/ui/select/SelectSeparator.vue b/frontendNew/src/components/ui/select/SelectSeparator.vue new file mode 100644 index 00000000..85775c5f --- /dev/null +++ b/frontendNew/src/components/ui/select/SelectSeparator.vue @@ -0,0 +1,19 @@ + + + diff --git a/frontendNew/src/components/ui/select/SelectTrigger.vue b/frontendNew/src/components/ui/select/SelectTrigger.vue new file mode 100644 index 00000000..0d4f3df4 --- /dev/null +++ b/frontendNew/src/components/ui/select/SelectTrigger.vue @@ -0,0 +1,30 @@ + + + diff --git a/frontendNew/src/components/ui/select/SelectValue.vue b/frontendNew/src/components/ui/select/SelectValue.vue new file mode 100644 index 00000000..8d8af199 --- /dev/null +++ b/frontendNew/src/components/ui/select/SelectValue.vue @@ -0,0 +1,12 @@ + + + diff --git a/frontendNew/src/components/ui/select/index.ts b/frontendNew/src/components/ui/select/index.ts new file mode 100644 index 00000000..879368be --- /dev/null +++ b/frontendNew/src/components/ui/select/index.ts @@ -0,0 +1,8 @@ +export { default as Select } from "./Select.vue"; +export { default as SelectContent } from "./SelectContent.vue"; +export { default as SelectItem } from "./SelectItem.vue"; +export { default as SelectLabel } from "./SelectLabel.vue"; +export { default as SelectSeparator } from "./SelectSeparator.vue"; +export { default as SelectTrigger } from "./SelectTrigger.vue"; +export { default as SelectValue } from "./SelectValue.vue"; +export { SelectGroup } from "reka-ui"; diff --git a/frontendNew/src/components/ui/select/utils.ts b/frontendNew/src/components/ui/select/utils.ts new file mode 100644 index 00000000..3767eb69 --- /dev/null +++ b/frontendNew/src/components/ui/select/utils.ts @@ -0,0 +1,29 @@ +import type { AcceptableValue } from "reka-ui"; + +const EMPTY_VALUE = "__dcalc_select_empty__"; + +export type SelectModelValue = AcceptableValue | AcceptableValue[] | undefined; + +export function toSelectValue(value: SelectModelValue): SelectModelValue { + if (Array.isArray(value)) { + return value.map((item) => toSelectValue(item)); + } + + return value === "" ? EMPTY_VALUE : value; +} + +export function toSelectItemValue(value: AcceptableValue): AcceptableValue { + return value === "" ? EMPTY_VALUE : value; +} + +export function fromSelectValue(value: SelectModelValue): SelectModelValue { + if (Array.isArray(value)) { + return value.map((item) => fromSelectValue(item)); + } + + return value === EMPTY_VALUE ? "" : value; +} + +export function fromSelectUpdateValue(value: AcceptableValue): AcceptableValue { + return value === EMPTY_VALUE ? "" : value; +} diff --git a/frontendNew/src/pages/Dcalc/Character/EquipmentDictionary/Index.vue b/frontendNew/src/pages/Dcalc/Character/EquipmentDictionary/Index.vue index fc62bc77..b1b29be0 100644 --- a/frontendNew/src/pages/Dcalc/Character/EquipmentDictionary/Index.vue +++ b/frontendNew/src/pages/Dcalc/Character/EquipmentDictionary/Index.vue @@ -21,6 +21,13 @@ import { SheetTitle, SheetTrigger, } from "@/components/ui/sheet"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; import Tabs from "@/components/ui/tabs/Tabs.vue"; import TabsList from "@/components/ui/tabs/TabsList.vue"; import TabsTrigger from "@/components/ui/tabs/TabsTrigger.vue"; @@ -916,22 +923,23 @@ const setTriggerOption = (id: number, value: string) => { class="grid gap-1 text-sm" > {{ option.name }} - + + + + + + {{ item }} + + + diff --git a/frontendNew/src/pages/Dcalc/Character/Forge/index.vue b/frontendNew/src/pages/Dcalc/Character/Forge/index.vue index 0b636144..193a359b 100644 --- a/frontendNew/src/pages/Dcalc/Character/Forge/index.vue +++ b/frontendNew/src/pages/Dcalc/Character/Forge/index.vue @@ -5,6 +5,13 @@ import { useConfigStore, useInfoStore } from "@/stores"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; import { Accordion, AccordionContent, @@ -697,21 +704,20 @@ const resetAllForge = () => {
@@ -1077,31 +1127,43 @@ const resetAllForge = () => { class="grid grid-cols-1 gap-2 rounded-md border p-2 md:grid-cols-[6rem_1fr_12rem] md:items-center md:p-3" >
槽位 {{ Number(key) + 1 }}
- - + + + + + + 无 + + {{ item.value }} + + +
@@ -1131,21 +1193,23 @@ const resetAllForge = () => { class="grid grid-cols-1 gap-2 rounded-md border p-2 sm:grid-cols-[6rem_1fr] sm:items-center sm:p-3" >
{{ field.label }}
- + + + + + + {{ item.name }} + + +