feat(ui): suggest input on Combobox replaces datalists, RadioGroup for task pickers
Also records the combobox and radio-group components added in 63476393.
This commit is contained in:
1 parent
63476393d7
commit
ca597c3678
16 files changed
+192
-165
No files matched your search
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { SuggestInput } from "@/components/ui/suggest-input";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { ArrowLeft, Braces, Type } from "@lucide/vue";
|
||||
@@ -287,7 +288,6 @@ const resume = () => transition(api.bindingResume, "pending_approval");
|
||||
|
||||
<section class="space-y-1.5">
|
||||
<div class="text-xs font-medium text-fg-muted">Inputs</div>
|
||||
<datalist id="bind-paths"><option v-for="path in paths" :key="path" :value="path" /></datalist>
|
||||
<div class="divide-y divide-border rounded-md border border-border">
|
||||
<div v-for="[name, spec] in inputs" :key="name" class="space-y-1 px-3 py-2">
|
||||
<div class="flex items-center gap-1.5 text-xs">
|
||||
@@ -306,10 +306,10 @@ const resume = () => transition(api.bindingResume, "pending_approval");
|
||||
<Type v-if="rows[name]!.from === 'path'" /><Braces v-else />
|
||||
</Button>
|
||||
</div>
|
||||
<Input
|
||||
<SuggestInput
|
||||
v-if="rows[name]!.from === 'path'"
|
||||
v-model="rows[name]!.path"
|
||||
list="bind-paths"
|
||||
:options="paths"
|
||||
:aria-label="`${name} payload path`"
|
||||
placeholder="payload path"
|
||||
class="h-8 w-full font-mono text-xs"
|
||||
@@ -326,9 +326,9 @@ const resume = () => transition(api.bindingResume, "pending_approval");
|
||||
</div>
|
||||
<div v-if="repository" class="space-y-1 px-3 py-2">
|
||||
<div class="text-xs" title="Optional: owner/name of a configured repository; blank uses the configured one">Repository</div>
|
||||
<Input
|
||||
<SuggestInput
|
||||
v-model="repositoryPath"
|
||||
list="bind-paths"
|
||||
:options="paths"
|
||||
aria-label="Repository payload path"
|
||||
placeholder="payload path"
|
||||
class="h-8 w-full font-mono text-xs"
|
||||
|
||||
@@ -6,6 +6,7 @@ import { parse, stringify } from "yaml";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { DurationInput } from "@/components/ui/duration-input";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { SuggestInput } from "@/components/ui/suggest-input";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { Textarea } from "@/components/ui/textarea";
|
||||
import { addBranch, branchingOf, deleteBranch, renameBranch, earlierStepIDs, replaceStep, stepAt, workflowField, type StepPath, type StepRecord } from "./workflow-edit";
|
||||
@@ -159,8 +160,7 @@ const ON_FAILURE = [{ value: "", label: "Park the task" }, { value: "continue",
|
||||
<section v-if="branching" class="space-y-3">
|
||||
<label v-if="type === 'switch'" class="block space-y-1.5">
|
||||
<span class="text-xs font-medium text-fg-muted" title="The value whose case runs; a case named default runs when none matches">Switch on</span>
|
||||
<Input :model-value="branching.on" class="font-mono" placeholder="steps.assess.result.fit" :list="`${uid}-switch-on`" @change="setOn(($event.target as HTMLInputElement).value.trim())" />
|
||||
<datalist :id="`${uid}-switch-on`"><option v-for="id in earlier" :key="id" :value="`steps.${id}.result.`" /></datalist>
|
||||
<SuggestInput :model-value="branching.on" class="font-mono" placeholder="steps.assess.result.fit" :options="earlier.map((id) => `steps.${id}.result.`)" @change="setOn(($event.target as HTMLInputElement).value.trim())" />
|
||||
</label>
|
||||
<div class="text-xs font-medium text-fg-muted">{{ type === "switch" ? "Cases" : "Branches" }}</div>
|
||||
<div v-for="name in branches" :key="name" class="flex items-center gap-2">
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { useId } from "vue";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { SuggestInput } from "@/components/ui/suggest-input";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
|
||||
defineProps<{ value: string; workflows: { id: string }[]; label: string; class?: string; editable?: boolean }>();
|
||||
const listId = useId();
|
||||
const emit = defineEmits<{ pick: [string] }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<template v-if="editable">
|
||||
<Input :model-value="value" :list="listId" :aria-label="label" :class="$props.class" placeholder="Workflow id or {{ reference }}" @update:model-value="emit('pick', String($event))" />
|
||||
<datalist :id="listId"><option v-for="entry in workflows" :key="entry.id" :value="entry.id" /></datalist>
|
||||
<SuggestInput :model-value="value" :options="workflows.map((entry) => entry.id)" :aria-label="label" :class="$props.class" placeholder="Workflow id or {{ reference }}" @update:model-value="emit('pick', $event)" />
|
||||
</template>
|
||||
<Select v-else :model-value="value || undefined" @update:model-value="emit('pick', String($event))">
|
||||
<SelectTrigger :aria-label="label" :class="$props.class"><SelectValue placeholder="Choose workflow" /></SelectTrigger>
|
||||
|
||||
Reference in new issue
Block a user