epic-designer
Version:
基于vue3的设计器,可视化开发页面表单
2 lines (1 loc) • 2.43 kB
JavaScript
;const e=require("vue"),v=require("vue-draggable-plus");;/* empty css */const u=require("../../../../base-ui/src/icon/icon.vue.cjs");;/* empty css */;/* empty css */const V=require("../../../../../manager/src/pluginManager.cjs"),_=require("../../../../../utils/src/common/string.cjs");require("../../../../../git/epic/epic-designer/node_modules/.pnpm/jsep@1.4.0/node_modules/jsep/dist/jsep.cjs");require("@vueuse/core");require("../../../../../hooks/src/store/index.cjs");;/* empty css */const h={class:"epic-propedit-item p-2"},k={key:0,class:"epic-option-del-btn flex items-center"},b=e.defineComponent({inheritAttrs:!1,__name:"index",props:{modelValue:{default:()=>[],type:Array}},emits:["update:modelValue"],setup(i,{emit:c}){const d=i,s=c,p=V.pluginManager.component.get("input"),t=e.computed({get(){return d.modelValue},set(l){s("update:modelValue",l)}});function m(){const l=t.value.length+1,o={id:_.getUUID(),label:`标签${l}`,type:"tab-pane",children:[]};t.value.push(o)}function g(l){t.value.splice(l,1)}return(l,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",h,[e.createVNode(e.unref(v.VueDraggable),{modelValue:t.value,"onUpdate:modelValue":o[0]||(o[0]=n=>t.value=n),"item-key":"id","component-data":{type:"transition-group"},group:"option-list",handle:".handle",animation:200},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.value,(n,r)=>(e.openBlock(),e.createElementBlock("div",{key:r,class:"epic-tab-pane-editor-item my-2 grid grid-cols-[auto_auto_16px] items-center gap-2"},[e.createVNode(e.unref(u),{class:"handle cursor-move text-lg",name:"icon--epic--drag"}),e.createVNode(e.unref(p),{value:n.label,"onUpdate:value":a=>n.label=a,modelValue:n.label,"onUpdate:modelValue":a=>n.label=a},null,8,["value","onUpdate:value","modelValue","onUpdate:modelValue"]),t.value.length>1?(e.openBlock(),e.createElementBlock("div",k,[e.createVNode(e.unref(u),{class:"hover:text-red cursor-pointer text-lg",name:"icon--epic--delete-outline-rounded",onClick:a=>g(r)},null,8,["onClick"])])):e.createCommentVNode("",!0)]))),128))]),_:1},8,["modelValue"])]),e.createElementVNode("div",{class:"ep-button ghost primary",onClick:m},"添加")],64))}});module.exports=b;