niucloud-admin/niucloud/public/admin/assets/edit-addon-list-31f61476.js
2023-10-23 19:26:32 +08:00

2 lines
4.1 KiB
JavaScript

import{d as z,r as v,o as A,E as F,R as N,e as p,f as x,Q as m,u as t,g as a,B as _,y as i,x as c,F as C,z as R,A as j,v as w,H as P,h as $}from"./base-06478700.js";/* empty css */import{E as M}from"./el-overlay-42a687c6.js";/* empty css *//* empty css *//* empty css */import"./el-tooltip-58212670.js";import{W as O,_ as W}from"./index-981b0207.js";/* empty css *//* empty css */import{E as H}from"./el-form-item-314d006d.js";/* empty css */import{v as f}from"./event-10eba222.js";import{t as r}from"./index-81ed253c.js";import{u as Q}from"./diy-81c73356.js";import{d as y}from"./common-92a35870.js";import{S as U}from"./sortable.esm-be94e56d.js";import{r as q}from"./range-1a1bb482.js";import{E as G}from"./index-c2f001d3.js";import{E as J}from"./index-543fb162.js";import{a as K,E as X}from"./index-4bec4464.js";import{v as Y}from"./directive-cb2d3366.js";const Z={class:"content-wrap"},ee={class:"edit-attr-item-wrap"},te={class:"mb-[10px]"},oe={class:"flex items-center pb-[10px]"},ae=["src"],le={class:"flex flex-col justify-center ml-[10px] leading-[1]"},ne={class:"text-[14px]"},se={class:"text-[12px] text-[#999] mt-[8px]"},ie=["onClick"],re={class:"style-wrap"},de=z({__name:"edit-addon-list",setup(ce,{expose:k}){const o=Q();o.editComponent.ignore=[],o.editComponent.verify=s=>{var e={code:!0,message:""};return e};const u=v(!1),b=v();A(()=>{F(()=>{const s=U.create(b.value,{group:"item-wrap",animation:200,onEnd:e=>{const d=o.editComponent.list[e.oldIndex];o.editComponent.list.splice(e.oldIndex,1),o.editComponent.list.splice(e.newIndex,0,d),s.sort(q(o.editComponent.list.length).map(g=>g.toString()))}})})});const l=N({page:1,limit:10,total:0,loading:!0,data:[],searchParam:{title:"",key:""}});((s=1)=>{l.loading=!0,l.page=s,O({...l.searchParam}).then(e=>{l.loading=!1,l.data=e.data,l.total=e.data.length}).catch(()=>{l.loading=!1})})();const E=s=>{let e={id:o.generateRandom(),key:"",title:"",url:"",icon:"",desc:""};for(let d in s)e[d]=s[d];o.editComponent.list.push(e),u.value=!1},S=()=>{u.value=!0};return k({}),(s,e)=>{const d=W,g=G,T=H,B=J,h=K,D=X,L=M,V=Y;return p(),x(C,null,[m(a("div",Z,[a("div",ee,[a("h3",te,_(t(r)("addonListSet")),1),i(T,{"label-width":"100px",class:"px-[10px]"},{default:c(()=>[a("div",{ref_key:"addonBoxRef",ref:b},[(p(!0),x(C,null,R(t(o).editComponent.list,(n,I)=>(p(),x("div",{key:n.id,class:"item-wrap !cursor-move p-[10px] pb-0 relative border border-dashed border-gray-300 mb-[16px]"},[m(a("div",oe,[a("img",{class:"w-[60px] h-[60px] rounded-md",src:t(y)(n.icon)},null,8,ae),a("div",le,[a("span",ne,_(n.title),1),a("span",se,_(n.desc),1)])],512),[[f,n.title]]),m(a("div",{class:"del absolute cursor-pointer z-[2] top-[-8px] right-[-8px]",onClick:me=>t(o).editComponent.list.splice(I,1)},[i(d,{name:"element-CircleCloseFilled",color:"#bbb",size:"20px"})],8,ie),[[f,t(o).editComponent.list.length>1]])]))),128))],512),i(g,{class:"w-full",onClick:S},{default:c(()=>[j(_(t(r)("addAddon")),1)]),_:1})]),_:1})]),i(L,{modelValue:u.value,"onUpdate:modelValue":e[0]||(e[0]=n=>u.value=n),title:t(r)("addonListTips"),width:"600px","close-on-press-escape":!1,"close-on-click-modal":!1},{default:c(()=>[a("div",null,[m((p(),w(D,{data:l.data,size:"large",onCurrentChange:E,"highlight-current-row":"","max-height":"500px"},{empty:c(()=>[a("span",null,_(l.loading?"":t(r)("emptyData")),1)]),default:c(()=>[i(h,{label:t(r)("addonIcon"),width:"120",align:"center"},{default:c(({row:n})=>[n.icon?(p(),w(B,{key:0,class:"w-[50px] h-[50px]",src:t(y)(n.icon),fit:"contain"},null,8,["src"])):P("",!0)]),_:1},8,["label"]),i(h,{prop:"title","show-overflow-tooltip":!0,width:"120",label:t(r)("addonTitle")},null,8,["label"]),i(h,{prop:"desc","show-overflow-tooltip":!0,label:t(r)("addonDesc")},null,8,["label"])]),_:1},8,["data"])),[[V,l.loading]])])]),_:1},8,["modelValue","title"])],512),[[f,t(o).editTab=="content"]]),m(a("div",re,[$(s.$slots,"style")],512),[[f,t(o).editTab=="style"]])],64)}}}),Fe=Object.freeze(Object.defineProperty({__proto__:null,default:de},Symbol.toStringTag,{value:"Module"}));export{Fe as _};