2 lines
1.9 KiB
JavaScript
2 lines
1.9 KiB
JavaScript
import{u as x}from"./store-28c0e441.js";import w from"./SchemaCanvas-a841f26c.js";import z from"./SchemaSidebar-9a869d8a.js";import{_ as B}from"./_plugin-vue_export-helper-c27b6911.js";import{r as t,o as C,M,D,w as _,j as c,l as R,h as l,f as s,Y as W,a1 as k,bt as E,bu as L}from"./index-7b482730.js";import"./SchemaTabs-a065312d.js";import"./EditableInput-9b4a13c6.js";import"./SchemaSections-e3f0b1d4.js";import"./_commonjsHelpers-de833af9.js";import"./index-2fe8616a.js";const N=300,X=700,j={__name:"SchemaBuilder",props:{initialSchema:{type:Object,default:()=>({})},onSave:{type:Function,default:null}},setup(S,{expose:y}){const a=S;y({getSchemaData:()=>o.schema});const o=x(),n=t(300),i=t(!1),b=t(null),u=t(null),d=t(null),m=t(0),v=t(300);function g(e){e.preventDefault(),e.stopPropagation(),m.value=e.clientX,v.value=n.value,i.value=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none",document.addEventListener("mousemove",p),document.addEventListener("mouseup",h)}function p(e){if(!i.value)return;const f=m.value-e.clientX,r=v.value+f;r>=N&&r<=X&&(n.value=r)}function h(){i.value=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",p),document.removeEventListener("mouseup",h)}return C(()=>{u.value=document.body,d.value=document.body,a.initialSchema&&Object.keys(a.initialSchema).length>0&&o.loadSchema(a.initialSchema)}),M(()=>o.schema,e=>{a.onSave&&e&&a.onSave(e)},{deep:!0}),(e,f)=>(R(),D(c(L),{to:d.value},{default:_(()=>[l(c(E),{to:u.value},{default:_(()=>[s("div",{class:"schema-builder-container",ref_key:"containerRef",ref:b},[s("div",{class:W(["schema-main",[c(o).preview?"preview":""]])},[l(w)],2),s("div",{class:"resize-handle",onMousedown:g},null,32),s("div",{class:"schema-sidebar",style:k({width:n.value+"px"})},[l(z)],4)],512)]),_:1},8,["to"])]),_:1},8,["to"]))}},K=B(j,[["__scopeId","data-v-aa1da059"]]);export{K as default};
|