diff --git a/packages/filter/src/specs/preset.tsx b/packages/filter/src/specs/preset.tsx index 8f3bce4..1e9298d 100644 --- a/packages/filter/src/specs/preset.tsx +++ b/packages/filter/src/specs/preset.tsx @@ -109,18 +109,21 @@ export const presetDataInputSpecs: DataInputViewSpec[] = [ (option: unknown) => option instanceof z.ZodLiteral, ); }, - view: ({ inputSchema, rule, onChange }) => { + view: function LiteralSelect({ inputSchema, rule, onChange }) { const SelectView = useView("Select"); - const unionSchema = inputSchema.items[0] as z.ZodUnion; - console.log(unionSchema, unionSchema.options); - const options = unionSchema.options.map((item: z.ZodLiteral) => ({ - label: item.value, - value: item.value, - })); + const unionSchema = inputSchema.items[0] as z.ZodUnion< + [z.ZodLiteral] + >; + const options = unionSchema.options.map( + (item: z.ZodLiteral) => ({ + label: item.description ?? String(item.value), + value: item.value, + }), + ); return ( { onChange({ ...rule,