PageSourceSearch

https://app.vpmsolutions.com/keyValueFilter.component63916.js

js vpmsolutions.com collected 2026-10-04 02:01:47 UTC 6,871 bytes, 1 lines download raw bytes

1import{d as j,u as z,$ as E,w as O,o as r,f as h,g as b,h as R,e as n,n as v,ax as P,L as Q,j as u,t as d,m as o,ab as y,ad as g,l as p,ah as D,C as k,b9 as B,r as L,c as w}from"./index63916.js";import{_ as G,a as H,b as I}from"./PopoverTrigger.vue_vue_type_script_setup_true_lang63916.js";import{r as J}from"./PlusCircleIcon63916.js";import{r as T}from"./ChevronDownIcon63916.js";import"./FocusScope63916.js";const W={class:"text-xs font-medium text-gray-500"},X={key:2,class:"flex flex-nowrap items-center whitespace-nowrap"},Y={key:0},Z={key:1},ee={key:0,class:"text-xs text-gray-500"},te={key:1,class:"mt-4 space-y-3"},ae={class:"flex flex-nowrap items-center whitespace-nowrap"},se=["id","name","value","disabled"],le={class:"ml-2 select-none flex-nowrap whitespace-nowrap text-xs"},re=["for"],ne={key:2,class:"mt-4 flex max-h-[300px] gap-6 overflow-y-auto p-2"},oe={key:0,class:"mb-2 text-xs font-medium text-gray-700"},ue={class:"space-y-3"},ie={class:"flex flex-nowrap items-center whitespace-nowrap"},de=["id","name","value","disabled"],ce={class:"ml-2 select-none flex-nowrap whitespace-nowrap text-xs"},fe=["for"],ve={key:3,class:"mt-3 space-y-1"},pe=["disabled"],be=j({__name:"keyValueFilter.component",props:{id:{},legend:{},title:{},keyValue:{},columns:{},containerClass:{},legendClass:{},legendDescription:{},rules:{}},setup(M){const l=M,f=z();let t=L([]),m=L(!1);const _=w(()=>{if(!l.rules)return[];const e=[];for(const a of l.rules)switch(a.type){case"min":a.value!==void 0&&t.value.length<a.value&&e.push(a.message);break;case"max":a.value!==void 0&&t.value.length>a.value&&e.push(a.message);break;case"exact":a.value!==void 0&&t.value.length!==a.value&&e.push(a.message);break;
1case"custom":a.validator&&!a.validator(t.value)&&e.push(a.message);break}return e}),x=w(()=>{if(!l.rules)return!0;for(const e of l.rules)if(e.disableApply!==!1)switch(e.type){case"min":if(e.value!==void 0&&t.value.length<e.value)return!1;break;case"max":if(e.value!==void 0&&t.value.length>e.value)return!1;break;case"exact":if(e.value!==void 0&&t.value.length!==e.value)return!1;break;case"custom":if(e.validator&&!e.validator(t.value))return!1;break}return!0}),U=w(()=>{if(!l.rules)return!1;for(const e of l.rules)if(e.disableInputs)switch(e.type){case"max":if(e.value!==void 0&&t.value.length>=e.value)return!0;break;case"exact":if(e.value!==void 0&&t.value.length>=e.value)return!0;break;case"custom":if(e.validator&&!e.validator([...t.value,"dummy"]))return!0;break}return!1}),V=e=>t.value.includes(e)?!1:U.value;E(()=>{C()}),O(()=>f.currentRoute.value.query,async e=>{e[l.id]||await F(),C()},{deep:!0});const C=()=>{if(f.currentRoute.value.query[l.id]){let e=f.currentRoute.value.query[l.id].toString().split(",");if(!e.length)return;Array.isArray(e)||(e=[e]),t.value=e}},K=()=>{var s;let e=((s=f.currentRoute.value.query[l.id])==null?void 0:s.toString().split(","))??[];const a=t.value;!e.length&&!a.length||a.length!==e.length&&(e.length||(e=[]),Array.isArray(e)||(e=[e]),t.value=e)},F=async()=>{t.value=[],await f.push({query:{...f.currentRoute.value.query,[l.id]:void 0}})},N=async()=>{x.value&&(await f.push({query:{...f.currentRoute.value.query,[l.id]:t.value.length?t.value.join(","):void 0}}),m.value=!1)},$=e=>{if(l.keyValue){const a=l.keyValue.find(s=>
1`${s.value}`==`${e}`);if(a)return a.label}if(l.columns)for(const a of l.columns){const s=a.items.find(i=>`${i.value}`==`${e}`);if(s)return s.label}return e},q=e=>e&&e.charAt(0).toUpperCase()+e.slice(1);return(e,a)=>(r(),h(n(I),{open:n(m),"onUpdate:open":a[5]||(a[5]=s=>k(m)?m.value=s:m=s)},{default:b(()=>[R(n(G),{class:v([n(t)&&n(t).length>0?" border-solid":"border-dashed","flex w-full max-w-max items-center rounded-full border border-gray-300 bg-gray-50 px-2 py-1 transition-all duration-150 ease-in-out hover:border-gray-400 hover:bg-gray-100 hover:text-gray-700 focus:outline-none focus:ring-2 focus:ring-pink-500 focus:ring-offset-2"]),onFocus:a[1]||(a[1]=s=>K())},{default:b(()=>[n(t)&&!n(t).length?(r(),h(n(J),{key:0,class:"mr-1 h-4 w-4 text-gray-400 transition-all duration-150 ease-in-out group-hover:text-gray-600","aria-hidden":"true"})):(r(),h(n(P),{key:1,class:"mr-1 h-4 w-4 text-gray-400 transition-all duration-150 ease-in-out hover:text-pink-500","aria-hidden":"true",onClick:a[0]||(a[0]=Q(s=>F(),["stop"]))})),u("span",W,d(l.title),1),n(t)&&n(t).length?(r(),o("div",X,[a[6]||(a[6]=u("span",{class:"mx-1 text-xs text-gray-500"},"|",-1)),(r(!0),o(y,null,g(n(t),(s,i)=>(r(),o("div",{key:i,class:"truncate text-xs font-medium text-pink-500"},[n(t).length<2?(r(),o("span",Y,d($(s))+d(i!==n(t).length-1?", ":""),1)):(r(),o("span",Z,d(i===0?$(s):"")+" "+d(i===0?`and ${n(t).length-1} more`:""),1))]))),128))])):p("",!0),n(t).length?(r(),h(n(T),{key:3,class:"ml-1 h-4 w-4 text-gray-400 transition-all duration-150 ease-in-out group-hover:text-gray-600","aria-hidden":"true"})):p("",!0)]),_:1},8,["class"]),R(n(H),{class:v(["min-w-0 max-w-fit origin-bottom-right",l.containerClass]),align:"start","side-offset":8},{default:b(()=>[u("fieldset",null,[u("legend",{class:v(["font-montserrat flex-nowrap whitespace-nowrap text-sm font-semibold text-gray-900",l.legendClass])},d(l.legend),3),l.legendDescription?(r(),o("p",ee,d(l.legendDescription),1)):p("",!0),!l.columns&&l.keyValue?(r(),o("div",te,[(r(!0),o(y,null,g(l.keyValue,(s,i)=>(r(),o("div",{key:i,class:v(["relative flex items-start",s.class])},[u("div",ae,[D(u("input",{"onUpdate:modelValue":a[2]||(a[2]=c=>k(t)?t.value=c:t=c),type:"checkbox",id:s.value,name:s.value,"aria-describedby":"kv-name",class:"h-4 w-4 rounded border-gray-300 text-pink-600 focus:ring-pink-500",value:s.value,disabled:V(s.value)},null,8,se),[[B,n(t)]])]),u("div",le,[u("label",{for:s.value,class:"text-gray-700"},d(q(s.label)),9,re)])],2))),128))])):l.columns?(r(),o("div",ne,[(r(!0),o(y,null,g(l.columns,(s,i)=>(r(),o("div",{key:i,class:v(["flex-1",s.class])},[s.label?(r(),o("div",oe,d(s.label),1)):p("",!0),u("div",ue,[(r(!0),o(y,null,g(s.items,(c,S)=>(r(),o("div",{key:S,class:v(["relative flex items-start",c.class])},[u("div",ie,[D(u("input",{"onUpdate:modelValue":a[3]||(a[3]=A=>k(t)?t.value=A:t=A),type:"checkbox",id:c.value,name:c.value,"aria-describedby":"kv-name",class:"h-4 w-4 rounded border-gray-300 text-pink-600 focus:ring-pink-500",value:c.value,disabled:V(c.value)},null,8,de),[[B,n(t)]])]),u("div",ce,[u("label",{for:c.value,class:"text-gray-700"},d(q(c.label)),9,fe)])],2))),128))])],2))),128))])):p("",!0),_.value.length>0?(r(),o("div",ve,[(r(!0),o(y,null,g(_.value,(s,i)=>(r(),o("div",{key:i,class:"text-xs text-red-600"},d(s),1))),128))])):p("",!0),u("button",{class:v(["mt-5 w-full rounded-md px-4 py-1 text-sm font-medium text-white",x.value?"bg-pink-500 hover:bg-pink-600":"cursor-not-allowed bg-gray-300"]),disabled:!x.value,onClick:a[4]||(a[4]=s=>N())}," Apply ",10,pe)])]),_:1},8,["class"])]),_:1},8,["open"]))}});export{be as default};

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.