PageSourceSearch

https://mickvvw-fgffgtrfg.hf.space/assets/TagInput.vue-vue-type-script-setup-true-lang-BRV7k9bP.js

js mickvvw-fgffgtrfg.hf.space collected 2026-10-03 17:07:44 UTC 3,316 bytes, 1 lines download raw bytes

1import{d as L,r as c,w as F,a as $,o as E,a3 as s,ao as x,R as g,ai as M,Y as v,X as k,P as h,ah as O,aG as j,F as z,a4 as D,c as V,Q as n,a1 as N,ar as R}from"./vendor-BZs9TBrR.js";import{a as S}from"./index-Cv1nF1yH.js";import{_ as I}from"./Input.vue-vue-type-script-setup-true-lang-BANfw5ky.js";import{a as K,C as U}from"./vendor-ui-Cfisu8eT.js";const q={class:"relative group"},G={key:0,class:"absolute z-[100] top-full left-0 mt-1 w-full min-w-[200px] bg-popover text-popover-foreground rounded-md border shadow-xl p-1 animate-in fade-in zoom-in-95 duration-100"},P={key:0,class:"flex items-center justify-center py-4"},Q={key:1,class:"py-2 px-3 text-[11px] text-muted-foreground"},X={key:2,class:"max-h-[300px] overflow-y-auto space-y-0.5"},Y=["onMousedown"],A={class:"truncate font-medium"},te=L({__name:"TagInput",props:{modelValue:{},placeholder:{},icon:{},multiple:{type:Boolean,default:!1},clearOnSelect:{type:Boolean,default:!1},fetchTags:{type:Function,default:()=>S.tasks.tags()}},emits:["update:modelValue","enter"],setup(u,{emit:C}){const i=u,r=C,l=c(!1),d=c([]),f=c(!1),o=c(i.modelValue),m=c(null);F(()=>i.modelValue,e=>{o.value=e});async function _(){f.value=!0;try{const e=await i.fetchTags();d.value=e||[]}catch(e){console.error("Failed to fetch tags",e)}finally{f.value=!1}}const y=V(()=>(o.value||"").split(",").map(e=>e.trim()).filter(Boolean)),p=V(()=>{const e=(o.value||"").split(","),t=(e[e.length-1]||"").trim().toLowerCase();return t?d.value.filter(a=>a.toLowerCase().includes(t)):d.value.slice(0,10)});function T(e){if(i.multiple){const t=[...y.value],a=t.indexOf(e);a>-1?t.splice(a,1):t.push(e),o.value=t.length>0?t.join(",")+",":"",r("update:modelValue",o.value)}else i.clearOnSelect?(o.value="",r("update:modelValue","")):(o.value=e,r("update:modelValue",e)),l.value=!1,r("enter",e)}function b(){r("update:modelValue",o.value),!l.value&&p.value.length>0&&(l.value=!0)}function B(){l.value=!1,r("enter")}function w(e){m.value&&!m.value.contains(e.target)&&l.value&&(l.value=!1)}return $(()=>{_(),window.addEventListener("mousedown",w)}),E(()=>{window.removeEventListener("mousedown",w)}),(e,t)=>(n(),s("div",{ref_key:"containerRef",ref:m,class:"relative w-full"},[x("div",q,[u.icon?(n(),g(M(u.icon),{key:0,class:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground group-focus-within:text-primary transition-colors pointer-events-none"})):v("",!0),k(h(I),{modelValue:o.value,"onUpdate:modelValue":t[0]||(t[0]=a=>o.value=a),placeholder:u.placeholder,class:j([[u.icon?"pl-9":"pl-3",e.$attrs.class],"cursor-pointer"]),onInput:b,onKeydown:O(B,["enter"]),onClick:t[1]||(t[1]=a=>l.value=!0),onFocus:t[2]||(t[2]=a=>l.value=!0)},null,8,["modelValue","placeholder","class"])]),l.value?(n(),s("div",G,[f.value?(n(),s("div",P,[k(h(K),{class:"h-4 w-4 animate-spin text-muted-foreground"})])):p.value.length===0?(n(),s("div",Q," 无匹配标签 ")):(n(),s("div",X,[(n(!0),s(z,null,D(p.value,a=>(n(),s("button",{key:a,class:"w-full text-left px-3 py-2 text-xs rounded-md hover:bg-primary/10 hover:text-primary transition-colors flex items-center justify-between group/item",onMousedown:N(H=>T(a),["prevent"])},[x("span",A,R(a),1),y.value.includes(a)?(n(),g(h(U),{key:0,class:"h-3.5 w-3.5 text-primary shrink-0"})):v("",!0)],40,Y))),128))]))])):v("",!0)],512))}});export{te as _};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.