import{a5 as J,av as L,aw as N,K as w,a0 as F}from"./index.17037962789732.js";import"./index.170379627897336.js";import"./index.170379627897315.js";import"./index.170379627897319.js";import{_ as O}from"./index.vue_vue_type_script_setup_true_name_ValueItem_lang.1703796278973.js";import"./index.170379627897327.js";import"./index.170379627897316.js";import"./index.170379627897317.js";import{d as U,k as S,m as $,p as E,r as K,o as d,x as T,F as M,h as P,c as b,a as c,b as u,u as k,B as R}from"./vue.1703796278973.js";import{_ as q}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./dayjs.min.1703796278973.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./index.170379627897337.js";import"./index.170379627897338.js";import"./index.170379627897314.js";import"./index.170379627897329.js";import"./index.170379627897330.js";import"./index.170379627897325.js";import"./index.170379627897322.js";import"./index.170379627897323.js";import"./index.170379627897324.js";import"./style.1703796278973.js";import"./comm.1703796278973.js";import"./system.1703796278973.js";import"./index.170379627897332.js";import"./index.170379627897333.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./permission.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";const z={key:0,class:"tagName"},G=U({__name:"Tag",props:{value:{type:Array,default:()=>[]},tagData:{type:Array,default:()=>[]}},emits:["update:value","change"],setup(V,{emit:g}){const m=V,x=S([]),p=S([]),C=e=>({...e,valueType:e.valueType?e.valueType.type:"-",format:e.valueType?e.valueType.format:void 0,options:e.valueType?e.valueType.elements:void 0,value:e==null?void 0:e.value}),j=()=>{p.value.push({type:"and"})},B=e=>{p.value.splice(e,1),y()},A=(e,o)=>{const a=p.value[o];a.type=e,p.value[o]=a,y()},D=(e,o)=>{const a=p.value[o].type,l=C({...e,value:void 0,type:a});p.value[o]=l,y()},y=()=>{const e=p.value.map(o=>({column:o.id,type:o==null?void 0:o.type,value:o==null?void 0:o.value}));g("update:value",[{value:e,name:"标签"}]),g("change",[{value:e,name:"标签"}],p.value)};return $(()=>[m.tagData,m.value],([e,o])=>{var a,l;if(x.value=e.map(s=>({label:s.name,value:s.id,...s})),o&&o[0]&&((a=o[0])!=null&&a.name)&&e&&e.length){const s=[],_=(l=o[0])==null?void 0:l.value.filter(t=>e.some(r=>t.column===r.id)).map(t=>{const r=e.find(h=>h.id===t.column);return r?(s.push(r.name),{...C(r),value:t==null?void 0:t.value,type:t==null?void 0:t.type}):t});p.value=_}else p.value=[{}]},{immediate:!0,deep:!0}),E(()=>{var e,o,a,l;if((o=(e=m.value)==null?void 0:e[0])!=null&&o.value){const s=[];(l=(a=m.value)==null?void 0:a[0])==null||l.value.map(_=>{const t=m.tagData.find(r=>r.id===_.column);t&&s.push({...t,..._})}),g("change",m.value,s)}}),(e,o)=>{const a=J,l=L,s=O,_=N,t=K("AIcon"),r=w,h=F;return d(),T("div",null,[(d(!0),T(M,null,P(k(p),(n,f)=>(d(),b(_,{key:n.id,gutter:24,style:{"margin-bottom":"12px"}},{default:c(()=>[u(l,{span:4},{default:c(()=>[f===0?(d(),T("span",z,"标签选择")):(d(),b(a,{key:1,options:[{label:"并且",value:"and"},{label:"或者",value:"or"}],value:n==null?void 0:n.type,style:{width:"100%"},onSelect:i=>A(i,f)},null,8,["value","onSelect"]))]),_:2},1024),u(l,{span:16},{default:c(()=>[u(_,{gutter:24},{default:c(()=>[u(l,{flex:"120px"},{default:c(()=>[u(a,{style:{width:"120px"},value:n.id,placeholder:"请选择标签",options:k(x),onSelect:(i,v)=>D(v,f)},null,8,["value","options","onSelect"])]),_:2},1024),u(l,{flex:"auto"},{default:c(()=>{var i;return[u(s,{modelValue:n.value,"onUpdate:modelValue":v=>n.value=v,itemType:n.valueType,onChange:y,options:n.valueType==="enum"?(((i=n==null?void 0:n.dataType)==null?void 0:i.elements)||[]).map(v=>({label:v.text,value:v.value})):n.valueType==="boolean"?[{label:"是",value:!0},{label:"否",value:!1}]:void 0},null,8,["modelValue","onUpdate:modelValue","itemType","options"])]}),_:2},1024)]),_:2},1024)]),_:2},1024),u(l,{span:4},{default:c(()=>[u(h,null,{default:c(()=>[u(r,{style:{padding:"0 8px"},onClick:j},{default:c(()=>[u(t,{type:"PlusOutlined"})]),_:1}),k(p).length>1?(d(),b(r,{key:0,danger:"",style:{padding:"0 8px"},onClick:i=>B(f)},{default:c(()=>[u(t,{type:"DeleteOutlined"})]),_:2},1032,["onClick"])):R("",!0)]),_:2},1024)]),_:2},1024)]),_:2},1024))),128))])}}});const Be=q(G,[["__scopeId","data-v-c1b0bf63"]]);export{Be as default};
